From f6ac9f82ee776ea98d47b5a29ac02e407a13ffe4 Mon Sep 17 00:00:00 2001 From: Ilia Ryabokon Date: Tue, 14 Aug 2012 16:21:46 +0300 Subject: [PATCH] Progress bar favorites fix --- src/board/UBFeaturesController.cpp | 195 +++++++++++++---------------- src/board/UBFeaturesController.h | 17 ++- src/gui/UBFeaturesWidget.cpp | 133 +++++++++++++------- src/gui/UBFeaturesWidget.h | 30 ++++- 4 files changed, 215 insertions(+), 160 deletions(-) diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index a0bac9dd..8710b6c2 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -22,7 +22,7 @@ const QString UBFeaturesController::virtualRootName = "root"; -void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath) +void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet &pFavoriteSet) { Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists()); @@ -47,27 +47,29 @@ void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & emit sendFeature(testFeature); emit featureSent(); + emit scanPath(fullFileName); -// featuresList->append(testFeature); - -// if ( favoriteSet->find( QUrl::fromLocalFile( fullFileName ) ) != favoriteSet->end() ) { -// featuresList->append( UBFeature( favoritePath, icon, fileName, QUrl::fromLocalFile( fullFileName ), featureType ) ); -// } + if ( pFavoriteSet.find(QUrl::fromLocalFile(fullFileName)) != pFavoriteSet.end()) { + //TODO send favoritePath from the controller or make favoritePath public and static + emit sendFeature(UBFeature( "/root/Favorites", icon, fileName, QUrl::fromLocalFile(fullFileName), featureType)); + } if (featureType == FEATURE_FOLDER) { - scanFS(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName); + scanFS(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName, pFavoriteSet); } } } -void UBFeaturesComputingThread::scanAll(QList > pScanningData) +void UBFeaturesComputingThread::scanAll(QList > pScanningData, const QSet &pFavoriteSet) { for (int i = 0; i < pScanningData.count(); i++) { if (abort) { return; } QPair curPair = pScanningData.at(i); - scanFS(curPair.first, curPair.second); + + emit scanCategory(UBFeaturesController::categoryNameForVirtualPath(curPair.second)); + scanFS(curPair.first, curPair.second, pFavoriteSet); } } @@ -84,8 +86,6 @@ int UBFeaturesComputingThread::featuresCount(const QUrl &pPath) if (featureType != FEATURE_INVALID && !fullFileName.contains(".thumbnail.")) { noItems++; - } else { - continue; } if (featureType == FEATURE_FOLDER) { @@ -114,11 +114,12 @@ QThread(parent) abort = false; } -void UBFeaturesComputingThread::compute(const QList > &pScanningData) +void UBFeaturesComputingThread::compute(const QList > &pScanningData, QSet *pFavoritesSet) { QMutexLocker curLocker(&mMutex); mScanningData = pScanningData; + mFavoriteSet = *pFavoritesSet; if (!isRunning()) { start(LowPriority); @@ -135,6 +136,7 @@ void UBFeaturesComputingThread::run() mMutex.lock(); QList > searchData = mScanningData; + QSet favoriteSet = mFavoriteSet; mMutex.unlock(); if (abort) { @@ -152,7 +154,7 @@ void UBFeaturesComputingThread::run() emit maxFilesCountEvaluated(fsCnt); emit scanStarted(); - scanAll(searchData); + scanAll(searchData, favoriteSet); emit scanFinished(); mMutex.lock(); @@ -210,9 +212,12 @@ bool UBFeature::isFolder() const || elementType == FEATURE_FOLDER; } -bool UBFeature::isDeletable()const +bool UBFeature::isDeletable() const { return elementType == FEATURE_ITEM + || elementType == FEATURE_AUDIO + || elementType == FEATURE_VIDEO + || elementType == FEATURE_IMAGE || elementType == FEATURE_FOLDER; } @@ -238,6 +243,7 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) : shapesPath = rootPath + "/Shapes"; trashPath = rootPath + "/Trash"; favoritePath = rootPath + "/Favorites"; + webSearchPath = rootPath + "/Web search"; //Initializing physical directories from UBSettings mUserAudioDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userAudioDirectory()); @@ -295,11 +301,10 @@ UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) : connect(&mCThread, SIGNAL(scanStarted()), this, SIGNAL(scanStarted())); connect(&mCThread, SIGNAL(scanFinished()), this, SIGNAL(scanFinished())); connect(&mCThread, SIGNAL(maxFilesCountEvaluated(int)), this, SIGNAL(maxFilesCountEvaluated(int))); - //Very unsafe function. Considering using deleteLater() instead -// connect(qApp, SIGNAL(aboutToQuit()), &mCThread, SLOT(terminate())); + connect(&mCThread, SIGNAL(scanCategory(QString)), this, SIGNAL(scanCategory(QString))); + connect(&mCThread, SIGNAL(scanPath(QString)), this, SIGNAL(scanPath(QString))); QTimer::singleShot(0, this, SLOT(startThread())); -// startThread(); } void UBFeaturesController::startThread() @@ -323,7 +328,7 @@ void UBFeaturesController::startThread() << QPair(trashDirectoryPath, trashPath) << QPair(mLibSearchDirectoryPath, rootPath + "/" + "Web search" ); - mCThread.compute(computingData); + mCThread.compute(computingData, favoriteSet); } void UBFeaturesController::scanFS() @@ -342,6 +347,7 @@ void UBFeaturesController::scanFS() << webSearchElement << trashElement; + //filling favoriteList loadFavoriteList(); QList tools = UBToolsManager::manager()->allTools(); @@ -350,54 +356,9 @@ void UBFeaturesController::scanFS() featuresList->append(UBFeature(appPath, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL)); if (favoriteSet->find(QUrl(tool.id)) != favoriteSet->end()) { featuresList->append(UBFeature(favoritePath, tool.icon.toImage(), tool.label, QUrl(tool.id), FEATURE_INTERNAL)); - } - } - QTime time = QTime::currentTime(); - //Claudio: - // don't change the order of the scans -// fileSystemScan( mLibAudiosDirectoryPath, audiosPath); -// fileSystemScan( mLibVideosDirectoryPath, moviesPath); -// fileSystemScan( mLibAnimationsDirectoryPath, flashPath); -// fileSystemScan( mLibPicturesDirectoryPath, picturesPath ); - -// fileSystemScan( mUserInteractiveDirectoryPath, appPath ); -// fileSystemScan( mUserAudioDirectoryPath, audiosPath ); -// fileSystemScan( mUserPicturesDirectoryPath, picturesPath ); -// fileSystemScan( mUserVideoDirectoryPath, moviesPath ); -// fileSystemScan( mUserAnimationDirectoryPath, flashPath ); - -// fileSystemScan( mLibApplicationsDirectoryPath, appPath ); -// fileSystemScan( mLibShapesDirectoryPath, shapesPath ); -// fileSystemScan( mLibInteractiveDirectoryPath, interactPath ); -// fileSystemScan( trashDirectoryPath, trashPath ); -// fileSystemScan( mLibSearchDirectoryPath, rootPath + "/" + "Web search" ); - - int i =0; - - i += featuresCount(mLibAudiosDirectoryPath); - i += featuresCount(mLibVideosDirectoryPath); - i += featuresCount(mLibAnimationsDirectoryPath); - i += featuresCount(mLibPicturesDirectoryPath); - - i += featuresCount(mUserInteractiveDirectoryPath); - i += featuresCount(mUserAudioDirectoryPath); - i += featuresCount(mUserPicturesDirectoryPath); - i += featuresCount(mUserVideoDirectoryPath); - i += featuresCount(mUserAnimationDirectoryPath); - - i += featuresCount(mLibApplicationsDirectoryPath); - i += featuresCount(mLibShapesDirectoryPath); - i += featuresCount(mLibInteractiveDirectoryPath); - i += featuresCount(trashDirectoryPath); - i += featuresCount(mLibSearchDirectoryPath); - - int msecs = QTime(time).msecsTo(QTime::currentTime()); - qDebug() << "Loading library" << msecs << "msecs\nNumber of elements" << i; - -// emit TopIndexingLimitSet(i); -// emit indexingProgressValueChanged(i / 4); + } + } } - void UBFeaturesController::fileSystemScan(const QUrl & currentPath, const QString & currVirtualPath) { QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile()); @@ -492,7 +453,8 @@ void UBFeaturesController::addToFavorite( const QUrl &path ) { QFileInfo fileInfo( filePath ); QString fileName = fileInfo.fileName(); - UBFeature elem(favoritePath, getIcon( filePath, FEATURE_CATEGORY ), fileName, path, fileTypeFromUrl(filePath) ); + UBFeatureElementType type = fileTypeFromUrl(fileInfo.absoluteFilePath()); + UBFeature elem(favoritePath, getIcon(filePath, type), fileName, path, fileTypeFromUrl(filePath) ); favoriteSet->insert( path ); saveFavoriteList(); @@ -524,7 +486,7 @@ QString UBFeaturesController::fileNameFromUrl( const QUrl &url ) } -UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path ) +UBFeatureElementType UBFeaturesController::fileTypeFromUrl(const QString &path) { QFileInfo fileInfo(path); @@ -535,7 +497,7 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path QString fileName = fileInfo.fileName(); QString mimeString = UBFileSystemUtils::mimeTypeFromFileName(fileName); - UBFeatureElementType fileType = fileInfo.isDir() ? FEATURE_FOLDER : FEATURE_ITEM; + UBFeatureElementType fileType = FEATURE_INVALID; if ( mimeString.contains("application")) { if (mimeString.contains("application/search")) { @@ -545,7 +507,17 @@ UBFeatureElementType UBFeaturesController::fileTypeFromUrl( const QString &path } } else if ( path.contains("uniboardTool://")) { fileType = FEATURE_INTERNAL; - } + } else if (mimeString.contains("audio")) { + fileType = FEATURE_AUDIO; + } else if (mimeString.contains("video")) { + fileType = FEATURE_VIDEO; + } else if (mimeString.contains("image")) { + fileType = FEATURE_IMAGE; + } else if (fileInfo.isDir()) { + fileType = FEATURE_FOLDER; + } else { + fileType = FEATURE_INVALID; + } return fileType; } @@ -554,64 +526,65 @@ QImage UBFeaturesController::getIcon(const QString &path, UBFeatureElementType p { if (pFType == FEATURE_FOLDER) { return QImage(":images/libpalette/folder.svg"); - - } else if (pFType == FEATURE_INTERACTIVE) { + } else if (pFType == FEATURE_INTERACTIVE || pFType == FEATURE_SEARCH) { return QImage(UBAbstractWidget::iconFilePath(QUrl::fromLocalFile(path))); + } else if (pFType == FEATURE_INTERNAL) { + return QImage(UBToolsManager::manager()->iconFromToolId(path)); + } else if (pFType == FEATURE_AUDIO) { + return QImage(":images/libpalette/soundIcon.svg"); + } else if (pFType == FEATURE_VIDEO) { + return QImage(":images/libpalette/movieIcon.svg"); + } else if (pFType == FEATURE_IMAGE) { + QImage pix(path); + if (pix.isNull()) { + pix = QImage(":images/libpalette/notFound.png"); + } else { + pix = pix.scaledToWidth(qMin(UBSettings::maxThumbnailWidth, pix.width())); + } + return pix; } - - if ( path.contains("uniboardTool://") ) { - return QImage( UBToolsManager::manager()->iconFromToolId(path) ); - - } if ( UBFileSystemUtils::mimeTypeFromFileName(path).contains("application")) { - return QImage( UBAbstractWidget::iconFilePath( QUrl::fromLocalFile(path) ) ); - } - - QImage thumb; - QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path); - - if ( QFileInfo( thumbnailPath ).exists() ) - thumb = QImage( thumbnailPath ); - else thumb = createThumbnail( path ); - - return thumb; + return QImage(":images/libpalette/notFound.png"); } bool UBFeaturesController::isDeletable( const QUrl &url ) { - UBFeatureElementType type = fileTypeFromUrl( fileNameFromUrl(url) ); - return type == FEATURE_ITEM; + UBFeatureElementType type = fileTypeFromUrl(fileNameFromUrl(url)); + return type == FEATURE_AUDIO + || type == FEATURE_VIDEO + || type == FEATURE_IMAGE + || type == FEATURE_ITEM; +} + +QString UBFeaturesController::categoryNameForVirtualPath(const QString &str) +{ + QString result; + int ind = str.lastIndexOf("/"); + if (ind != -1) { + result = str.right(str.count() - ind - 1); + } + return result; } QImage UBFeaturesController::createThumbnail(const QString &path) { - QString thumbnailPath = UBFileSystemUtils::thumbnailPath(path); + QString thumbnailPath = path; QString mimetype = UBFileSystemUtils::mimeTypeFromFileName(path); - QString extension = QFileInfo(path).completeSuffix(); - if ( mimetype.contains("audio" )) + if ( mimetype.contains("audio" )) { thumbnailPath = ":images/libpalette/soundIcon.svg"; - else if ( mimetype.contains("video") ) + } else if ( mimetype.contains("video")) { thumbnailPath = ":images/libpalette/movieIcon.svg"; - else - { - if ( extension.startsWith("svg", Qt::CaseInsensitive) || extension.startsWith("svgz", Qt::CaseInsensitive) ) - { - thumbnailPath = path; - } - else - { - QImage pix(path); - if (!pix.isNull()) - { - pix = pix.scaledToWidth(qMin(UBSettings::maxThumbnailWidth, pix.width()), Qt::SmoothTransformation); - pix.save(thumbnailPath); - UBPlatformUtils::hideFile(thumbnailPath); - } - else{ - thumbnailPath = ":images/libpalette/notFound.png"; - } + } else { + QImage pix(path); + if (!pix.isNull()) { + pix = pix.scaledToWidth(qMin(UBSettings::maxThumbnailWidth, pix.width()), Qt::SmoothTransformation); + return pix; + + } else { + thumbnailPath = ":images/libpalette/notFound.png"; } + } return QImage(thumbnailPath); diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index 64bbd5cc..9a551363 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -33,7 +33,7 @@ class UBFeaturesComputingThread : public QThread public: explicit UBFeaturesComputingThread(QObject *parent = 0); virtual ~UBFeaturesComputingThread(); - void compute(const QList > &pScanningData); + void compute(const QList > &pScanningData, QSet *pFavoritesSet); protected: void run(); @@ -44,12 +44,14 @@ signals: void scanStarted(); void scanFinished(); void maxFilesCountEvaluated(int max); + void scanCategory(const QString &str); + void scanPath(const QString &str); public slots: private: - void scanFS(const QUrl & currentPath, const QString & currVirtualPath); - void scanAll(QList > pScanningData); + void scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet &pFavoriteSet); + void scanAll(QList > pScanningData, const QSet &pFavoriteSet); int featuresCount(const QUrl &pPath); int featuresCountAll(QList > pScanningData); @@ -59,6 +61,7 @@ private: QUrl mScanningPath; QString mScanningVirtualPath; QList > mScanningData; + QSet mFavoriteSet; bool restart; bool abort; }; @@ -72,6 +75,9 @@ enum UBFeatureElementType FEATURE_INTERACTIVE, FEATURE_INTERNAL, FEATURE_ITEM, + FEATURE_AUDIO, + FEATURE_VIDEO, + FEATURE_IMAGE, FEATURE_TRASH, FEATURE_FAVORITE, FEATURE_SEARCH, @@ -107,6 +113,7 @@ public: private: QString virtualDir; + QString virtualPath; QImage mThumbnail; QString mName; QUrl mPath; @@ -167,6 +174,7 @@ public: static QImage getIcon( const QString &path, UBFeatureElementType pFType ); static bool isDeletable( const QUrl &url ); static char featureTypeSplitter() {return ':';} + static QString categoryNameForVirtualPath(const QString &str); static const QString virtualRootName; @@ -178,6 +186,8 @@ signals: void scanStarted(); void scanFinished(); void featureAddedFromThread(); + void scanCategory(const QString &); + void scanPath(const QString &); private slots: void addNewFolder(QString name); @@ -233,6 +243,7 @@ private: QString interactPath; QString trashPath; QString favoritePath; + QString webSearchPath; int mLastItemOffsetIndex; UBFeature currentElement; diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index 5cc7b27a..032c80fe 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -82,7 +82,9 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) connect(controller, SIGNAL(scanStarted()), mActionBar, SLOT(lockIt())); connect(controller, SIGNAL(scanFinished()), mActionBar, SLOT(unlockIt())); connect(controller, SIGNAL(maxFilesCountEvaluated(int)), centralWidget, SIGNAL(maxFilesCountEvaluated(int))); - connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SLOT(increaseStatusBarValue())); + connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SIGNAL(increaseStatusBarValue())); + connect(controller, SIGNAL(scanCategory(QString)), centralWidget, SIGNAL(scanCategory(QString))); + connect(controller, SIGNAL(scanPath(QString)), centralWidget, SIGNAL(scanPath(QString))); } UBFeaturesWidget::~UBFeaturesWidget() @@ -498,15 +500,14 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare connect(this, SIGNAL(sendFileNameList(QStringList)), dlg, SLOT(setFileNameList(QStringList))); //Progress bar to show scanning progress - QProgressBar *progressBar = new QProgressBar(); + UBFeaturesProgressInfo *progressBar = new UBFeaturesProgressInfo(); mAdditionalDataContainer->addWidget(progressBar); mAdditionalDataContainer->setCurrentIndex(ProgressBarWidget); - progressBar->setMinimum(0); - progressBar->setValue(0); - progressBar->setMaximum(10000); - - connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setMaximum(int))); + connect(this, SIGNAL(maxFilesCountEvaluated(int)), progressBar, SLOT(setProgressMax(int))); + connect(this, SIGNAL(increaseStatusBarValue()), progressBar, SLOT(increaseProgressValue())); + connect(this, SIGNAL(scanCategory(QString)), progressBar, SLOT(setCommmonInfoText(QString))); + connect(this, SIGNAL(scanPath(QString)), progressBar, SLOT(setDetailedInfoText(QString))); mLayout->addWidget(mStackedWidget, 1); mLayout->addWidget(mAdditionalDataContainer, 0); @@ -547,6 +548,11 @@ UBFeature UBFeaturesCentralWidget::getCurElementFromProperties() void UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState) { + if (!mAdditionalDataContainer->widget(pWidgetType)) { + qDebug() << "can't find widget specified by UBFeaturesCentralWidget::showAdditionalData(AddWidget pWidgetType, AddWidgetState pState)"; + return; + } + mAdditionalDataContainer->setMaximumHeight(mAdditionalDataContainer->widget(pWidgetType)->sizeHint().height()); mAdditionalDataContainer->setCurrentIndex(pWidgetType); @@ -574,46 +580,21 @@ void UBFeaturesCentralWidget::hideAdditionalData() void UBFeaturesCentralWidget::scanStarted() { - if (!mAdditionalDataContainer->widget(ProgressBarWidget)) { - return; - } - QProgressBar *progressBar = qobject_cast(mAdditionalDataContainer->widget(ProgressBarWidget)); - if (progressBar && !progressBar->isVisible()) { - showAdditionalData((AddWidget)1); - } + showAdditionalData(ProgressBarWidget); } void UBFeaturesCentralWidget::scanFinished() { - if (!mAdditionalDataContainer->widget(ProgressBarWidget)) { - return; - } - QProgressBar *progressBar = qobject_cast(mAdditionalDataContainer->widget(ProgressBarWidget)); - if (progressBar && progressBar->isVisible()) { - hideAdditionalData(); - qDebug() << "progressBar max value is " << progressBar->maximum(); - } -} - -void UBFeaturesCentralWidget::increaseStatusBarValue() -{ - if (!mAdditionalDataContainer->widget(ProgressBarWidget)) { - return; - } - QProgressBar *progressBar = qobject_cast(mAdditionalDataContainer->widget(ProgressBarWidget)); - if (progressBar) { - progressBar->setValue(progressBar->value() + 1); - } + hideAdditionalData(); } UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(parent) { this->setStyleSheet("background:white;"); - QVBoxLayout *mainLayout = new QVBoxLayout(); - setLayout(mainLayout); + QVBoxLayout *mainLayout = new QVBoxLayout(this); - QVBoxLayout *labelLayout = new QVBoxLayout(this); + QVBoxLayout *labelLayout = new QVBoxLayout(); QLabel *mLabel = new QLabel(labelText, this); mLineEdit = new QLineEdit(this); @@ -623,7 +604,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget( labelLayout->addWidget(mLabel); labelLayout->addWidget(mLineEdit); - QHBoxLayout *buttonLayout = new QHBoxLayout(this); + QHBoxLayout *buttonLayout = new QHBoxLayout(); acceptButton = new QPushButton(acceptText, this); QPushButton *cancelButton = new QPushButton(cancelText, this); @@ -677,6 +658,64 @@ void UBFeaturesNewFolderDialog::reactOnTextChanged(const QString &pStr) } } +UBFeaturesProgressInfo::UBFeaturesProgressInfo(QWidget *parent) : + QWidget(parent), + mProgressBar(0), + mCommonInfoLabel(0), + mDetailedInfoLabel(0) +{ + QVBoxLayout *mainLayer = new QVBoxLayout(this); + + mProgressBar = new QProgressBar(this); +// setting defaults + mProgressBar->setMinimum(0); + mProgressBar->setMaximum(100000); + mProgressBar->setValue(0); + + mProgressBar->setStyleSheet("background:white"); + + mCommonInfoLabel = new QLabel(this); + mDetailedInfoLabel = new QLabel(this); + mDetailedInfoLabel->setAlignment(Qt::AlignRight); + mCommonInfoLabel->hide(); + mDetailedInfoLabel->hide(); + + mainLayer->addWidget(mCommonInfoLabel); + mainLayer->addWidget(mDetailedInfoLabel); + mainLayer->addWidget(mProgressBar); +} + +void UBFeaturesProgressInfo::setCommmonInfoText(const QString &str) +{ + mProgressBar->setFormat(str + tr(" load") + "(%p%)"); +} + +void UBFeaturesProgressInfo::setDetailedInfoText(const QString &str) +{ + mDetailedInfoLabel->setText(str); +} + +void UBFeaturesProgressInfo::setProgressMax(int pValue) +{ + mProgressBar->setMaximum(pValue); +} + +void UBFeaturesProgressInfo::setProgressMin(int pValue) +{ + mProgressBar->setMinimum(pValue); +} + +void UBFeaturesProgressInfo::increaseProgressValue() +{ + mProgressBar->setValue(mProgressBar->value() + 1); +} + +void UBFeaturesProgressInfo::sendFeature(UBFeature pFeature) +{ + Q_UNUSED(pFeature); +} + + UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent) , mpView(NULL) , mpWebSettings(NULL) @@ -1295,9 +1334,12 @@ Qt::ItemFlags UBFeaturesModel::flags( const QModelIndex &index ) const { UBFeature item = index.data( Qt::UserRole + 1 ).value(); if ( item.getType() == FEATURE_INTERACTIVE - || item.getType() == FEATURE_ITEM - || item.getType() == FEATURE_INTERNAL - || item.getType() == FEATURE_FOLDER) + || item.getType() == FEATURE_ITEM + || item.getType() == FEATURE_AUDIO + || item.getType() == FEATURE_VIDEO + || item.getType() == FEATURE_IMAGE + || item.getType() == FEATURE_INTERNAL + || item.getType() == FEATURE_FOLDER) resultFlags |= Qt::ItemIsDragEnabled; @@ -1338,12 +1380,15 @@ bool UBFeaturesSearchProxyModel::filterAcceptsRow( int sourceRow, const QModelIn /*QString name = sourceModel()->data(index, Qt::DisplayRole).toString(); eUBLibElementType type = (eUBLibElementType)sourceModel()->data(index, Qt::UserRole + 1).toInt();*/ - UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value(); + UBFeature feature = sourceModel()->data(index, Qt::UserRole + 1).value(); bool isFile = feature.getType() == FEATURE_INTERACTIVE - || feature.getType() == FEATURE_INTERNAL - || feature.getType() == FEATURE_ITEM; + || feature.getType() == FEATURE_INTERNAL + || feature.getType() == FEATURE_ITEM + || feature.getType() == FEATURE_AUDIO + || feature.getType() == FEATURE_VIDEO + || feature.getType() == FEATURE_IMAGE; - return isFile && filterRegExp().exactMatch( feature.getName() ); + return isFile && filterRegExp().exactMatch( feature.getName() ); } bool UBFeaturesPathProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex & sourceParent )const diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index 788de51b..583d7268 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -45,6 +45,7 @@ class UBFeaturesNavigatorWidget; class UBFeaturesMimeData; class UBFeaturesCentralWidget; class UBFeaturesNewFolderDialog; +class UBFeaturesProgressBar; class UBFeaturesWidget : public UBDockPaletteWidget { @@ -189,7 +190,6 @@ public: void setPropertiesThumbnail(const QPixmap &pix); StackElement currentView() const {return static_cast(mStackedWidget->currentIndex());} UBFeature getCurElementFromProperties(); - void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal); void setLockedExcludingAdditional(bool pLock); @@ -207,6 +207,12 @@ signals: // progressbar widget related signals void maxFilesCountEvaluated(int pValue); + void increaseStatusBarValue(); + void scanCategory(const QString &); + void scanPath(const QString &); + +public slots: + void showAdditionalData(AddWidget pWidgetType, AddWidgetState pState = NonModal); private slots: void createNewFolderSlot(QString pStr); @@ -214,7 +220,6 @@ private slots: void scanStarted(); void scanFinished(); - void increaseStatusBarValue(); private: @@ -252,6 +257,27 @@ private: }; +class UBFeaturesProgressInfo: public QWidget { + Q_OBJECT + +public: + UBFeaturesProgressInfo(QWidget *parent = 0); + +private slots: + void setCommmonInfoText(const QString &str); + void setDetailedInfoText(const QString &str); + void setProgressMin(int pValue); + void setProgressMax(int pValue); + void increaseProgressValue(); + void sendFeature(UBFeature pFeature); + + +private: + QProgressBar *mProgressBar; + QLabel *mCommonInfoLabel; + QLabel *mDetailedInfoLabel; +}; + class UBFeaturesWebView : public QWidget { Q_OBJECT