Commit b7ceb4d3 authored by Anna Udovichenko's avatar Anna Udovichenko

Fixed some DnD bugs, added action bar class

parent 4b182e73
...@@ -60,7 +60,7 @@ void UBFeaturesController::initDirectoryTree() ...@@ -60,7 +60,7 @@ void UBFeaturesController::initDirectoryTree()
QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools(); QList <UBToolsManager::UBToolDescriptor> tools = UBToolsManager::manager()->allTools();
featuresList->push_back( UBFeature( "", QPixmap( ":images/libpalette/home.png" ), "root", "" ) ); featuresList->push_back( UBFeature( QString(), QPixmap( ":images/libpalette/home.png" ), "root", QString() ) );
appPath = rootPath + "/Applications"; appPath = rootPath + "/Applications";
audiosPath = rootPath + "/Audios"; audiosPath = rootPath + "/Audios";
...@@ -80,7 +80,7 @@ void UBFeaturesController::initDirectoryTree() ...@@ -80,7 +80,7 @@ void UBFeaturesController::initDirectoryTree()
foreach (UBToolsManager::UBToolDescriptor tool, tools) foreach (UBToolsManager::UBToolDescriptor tool, tools)
{ {
featuresList->push_back( UBFeature( appPath, tool.icon, tool.label, mUserInteractiveDirectoryPath, FEATURE_INTERACTIVE ) ); featuresList->push_back( UBFeature( appPath, tool.icon, tool.label, tool.id, FEATURE_INTERNAL ) );
} }
fileSystemScan( mUserInteractiveDirectoryPath, appPath ); fileSystemScan( mUserInteractiveDirectoryPath, appPath );
fileSystemScan( mUserAudioDirectoryPath, audiosPath ); fileSystemScan( mUserAudioDirectoryPath, audiosPath );
......
...@@ -16,6 +16,7 @@ enum UBFeatureElementType ...@@ -16,6 +16,7 @@ enum UBFeatureElementType
FEATURE_VIRTUALFOLDER, FEATURE_VIRTUALFOLDER,
FEATURE_FOLDER, FEATURE_FOLDER,
FEATURE_INTERACTIVE, FEATURE_INTERACTIVE,
FEATURE_INTERNAL,
FEATURE_ITEM FEATURE_ITEM
}; };
......
#include "UBFeaturesActionBar.h"
UBFeaturesActionBar::UBFeaturesActionBar( QWidget* parent, const char* name ) : QWidget (parent)
{
}
UBFeaturesActionBar::~UBFeaturesActionBar()
{
}
\ No newline at end of file
#ifndef UBFEATURESACTIONBAR_H
#define UBFEATURESACTIONBAR_H
#include <QWidget>
#include <QToolButton>
#include "UBLibActionBar.h"
class UBFeaturesActionBar : public QWidget
{
Q_OBJECT
public:
UBFeaturesActionBar(QWidget* parent=0, const char* name="UBFeaturesActionBar");
~UBFeaturesActionBar();
};
#endif
\ No newline at end of file
...@@ -106,7 +106,7 @@ void UBFeaturesWidget::searchStarted( QString pattern ) ...@@ -106,7 +106,7 @@ void UBFeaturesWidget::searchStarted( QString pattern )
featuresListView->setModel( featuresProxyModel ); featuresListView->setModel( featuresProxyModel );
featuresProxyModel->invalidate(); featuresProxyModel->invalidate();
} }
else else if ( pattern.size() > 2 )
{ {
featuresSearchModel->setFilterWildcard( "*" + pattern + "*" ); featuresSearchModel->setFilterWildcard( "*" + pattern + "*" );
featuresListView->setModel( featuresSearchModel ); featuresListView->setModel( featuresSearchModel );
...@@ -443,7 +443,14 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const ...@@ -443,7 +443,14 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const
if ( index.isValid() ) if ( index.isValid() )
{ {
UBFeature element = data( index, Qt::UserRole + 1 ).value<UBFeature>(); UBFeature element = data( index, Qt::UserRole + 1 ).value<UBFeature>();
urlList.push_back( QUrl::fromLocalFile( element.getFullPath() ) ); if ( element.getType() == FEATURE_INTERNAL )
{
urlList.push_back( QUrl( element.getFullPath() ) );
}
else if ( element.getType() == FEATURE_INTERACTIVE || element.getType() == FEATURE_ITEM )
{
urlList.push_back( QUrl::fromLocalFile(element.getFullPath()) );
}
} }
} }
mimeData->setUrls( urlList ); mimeData->setUrls( urlList );
...@@ -529,10 +536,11 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const ...@@ -529,10 +536,11 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
{ {
UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>(); UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>();
if ( item.getType() == FEATURE_INTERACTIVE || if ( item.getType() == FEATURE_INTERACTIVE ||
item.getType() == FEATURE_ITEM ) item.getType() == FEATURE_ITEM ||
item.getType() == FEATURE_INTERNAL )
return Qt::ItemIsDragEnabled | defaultFlags; return Qt::ItemIsDragEnabled | defaultFlags;
if ( item.getType() == FEATURE_FOLDER || if ( item.getType() == FEATURE_FOLDER ||
(item.getType() == FEATURE_CATEGORY && item.getFullPath() != "")) (item.getType() == FEATURE_CATEGORY && !item.getFullPath().isNull()))
return defaultFlags | Qt::ItemIsDropEnabled; return defaultFlags | Qt::ItemIsDropEnabled;
else return defaultFlags; else return defaultFlags;
} }
...@@ -572,6 +580,7 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn ...@@ -572,6 +580,7 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>(); UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
bool isFile = feature.getType() == FEATURE_INTERACTIVE || bool isFile = feature.getType() == FEATURE_INTERACTIVE ||
feature.getType() == FEATURE_INTERNAL ||
feature.getType() == FEATURE_ITEM; feature.getType() == FEATURE_ITEM;
return isFile && filterRegExp().exactMatch( feature.getName() ); return isFile && filterRegExp().exactMatch( feature.getName() );
......
...@@ -46,7 +46,8 @@ HEADERS += src/gui/UBThumbnailView.h \ ...@@ -46,7 +46,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBLibWebView.h \ src/gui/UBLibWebView.h \
src/gui/UBDownloadWidget.h \ src/gui/UBDownloadWidget.h \
src/gui/UBDockDownloadWidget.h \ src/gui/UBDockDownloadWidget.h \
src/gui/UBFeaturesWidget.h\ src/gui/UBFeaturesWidget.h \
src/gui/UBFeaturesActionBar.h \
src/gui/UBDockTeacherGuideWidget.h \ src/gui/UBDockTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidget.h \ src/gui/UBTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidgetsTools.h \ src/gui/UBTeacherGuideWidgetsTools.h \
...@@ -100,7 +101,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \ ...@@ -100,7 +101,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBLibWebView.cpp \ src/gui/UBLibWebView.cpp \
src/gui/UBDownloadWidget.cpp \ src/gui/UBDownloadWidget.cpp \
src/gui/UBDockDownloadWidget.cpp \ src/gui/UBDockDownloadWidget.cpp \
src/gui/UBFeaturesWidget.cpp\ src/gui/UBFeaturesWidget.cpp \
src/gui/UBFeaturesActionBar.cpp \
src/gui/UBDockTeacherGuideWidget.cpp \ src/gui/UBDockTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidget.cpp \ src/gui/UBTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidgetsTools.cpp \ src/gui/UBTeacherGuideWidgetsTools.cpp \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment