Fixed some DnD bugs, added action bar class

preferencesAboutTextFull
Anna Udovichenko 13 years ago
parent 4b182e733f
commit b7ceb4d3d5
  1. 4
      src/board/UBFeaturesController.cpp
  2. 1
      src/board/UBFeaturesController.h
  3. 9
      src/gui/UBFeaturesActionBar.cpp
  4. 17
      src/gui/UBFeaturesActionBar.h
  5. 15
      src/gui/UBFeaturesWidget.cpp
  6. 2
      src/gui/gui.pri

@ -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()
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
FEATURE_VIRTUALFOLDER, FEATURE_VIRTUALFOLDER,
FEATURE_FOLDER, FEATURE_FOLDER,
FEATURE_INTERACTIVE, FEATURE_INTERACTIVE,
FEATURE_INTERNAL,
FEATURE_ITEM FEATURE_ITEM
}; };

@ -0,0 +1,9 @@
#include "UBFeaturesActionBar.h"
UBFeaturesActionBar::UBFeaturesActionBar( QWidget* parent, const char* name ) : QWidget (parent)
{
}
UBFeaturesActionBar::~UBFeaturesActionBar()
{
}

@ -0,0 +1,17 @@
#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

@ -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,9 +443,16 @@ 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>();
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()) ); urlList.push_back( QUrl::fromLocalFile(element.getFullPath()) );
} }
} }
}
mimeData->setUrls( urlList ); mimeData->setUrls( urlList );
return mimeData; return mimeData;
@ -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
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() );

@ -47,6 +47,7 @@ HEADERS += src/gui/UBThumbnailView.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 \
@ -101,6 +102,7 @@ SOURCES += src/gui/UBThumbnailView.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 \

Loading…
Cancel
Save