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. 17
      src/gui/UBFeaturesWidget.cpp
  6. 6
      src/gui/gui.pri

@ -60,7 +60,7 @@ void UBFeaturesController::initDirectoryTree()
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";
audiosPath = rootPath + "/Audios";
@ -80,7 +80,7 @@ void UBFeaturesController::initDirectoryTree()
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( mUserAudioDirectoryPath, audiosPath );

@ -16,6 +16,7 @@ enum UBFeatureElementType
FEATURE_VIRTUALFOLDER,
FEATURE_FOLDER,
FEATURE_INTERACTIVE,
FEATURE_INTERNAL,
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 );
featuresProxyModel->invalidate();
}
else
else if ( pattern.size() > 2 )
{
featuresSearchModel->setFilterWildcard( "*" + pattern + "*" );
featuresListView->setModel( featuresSearchModel );
@ -443,7 +443,14 @@ QMimeData* UBFeaturesModel::mimeData(const QModelIndexList &indexes) const
if ( index.isValid() )
{
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 );
@ -529,10 +536,11 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const
{
UBFeature item = index.data( Qt::UserRole + 1 ).value<UBFeature>();
if ( item.getType() == FEATURE_INTERACTIVE ||
item.getType() == FEATURE_ITEM )
item.getType() == FEATURE_ITEM ||
item.getType() == FEATURE_INTERNAL )
return Qt::ItemIsDragEnabled | defaultFlags;
if ( item.getType() == FEATURE_FOLDER ||
(item.getType() == FEATURE_CATEGORY && item.getFullPath() != ""))
(item.getType() == FEATURE_CATEGORY && !item.getFullPath().isNull()))
return defaultFlags | Qt::ItemIsDropEnabled;
else return defaultFlags;
}
@ -572,6 +580,7 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn
UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value<UBFeature>();
bool isFile = feature.getType() == FEATURE_INTERACTIVE ||
feature.getType() == FEATURE_INTERNAL ||
feature.getType() == FEATURE_ITEM;
return isFile && filterRegExp().exactMatch( feature.getName() );

@ -46,7 +46,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBLibWebView.h \
src/gui/UBDownloadWidget.h \
src/gui/UBDockDownloadWidget.h \
src/gui/UBFeaturesWidget.h\
src/gui/UBFeaturesWidget.h \
src/gui/UBFeaturesActionBar.h \
src/gui/UBDockTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidgetsTools.h \
@ -100,7 +101,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBLibWebView.cpp \
src/gui/UBDownloadWidget.cpp \
src/gui/UBDockDownloadWidget.cpp \
src/gui/UBFeaturesWidget.cpp\
src/gui/UBFeaturesWidget.cpp \
src/gui/UBFeaturesActionBar.cpp \
src/gui/UBDockTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidgetsTools.cpp \

Loading…
Cancel
Save