| 312 | } |
| 313 | |
| 314 | UBFeaturesController::UBFeaturesController(QWidget *pParentWidget) : |
| 315 | QObject(pParentWidget) |
| 316 | ,featuresList(0) |
| 317 | ,mLastItemOffsetIndex(0) |
| 318 | { |
| 319 | //Initializing physical directories from UBSettings |
| 320 | mUserAudioDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userAudioDirectory()); |
| 321 | mUserVideoDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userVideoDirectory()); |
| 322 | mUserPicturesDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userImageDirectory()); |
| 323 | mUserInteractiveDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userInteractiveDirectory()); |
| 324 | mUserAnimationDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->userAnimationDirectory()); |
| 325 | |
| 326 | mLibPicturesDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationImageLibraryDirectory()); |
| 327 | mLibAudiosDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationAudiosLibraryDirectory()); |
| 328 | mLibVideosDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationVideosLibraryDirectory()); |
| 329 | mLibAnimationsDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationAnimationsLibraryDirectory()); |
| 330 | mLibInteractiveDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationInteractivesDirectory()); |
| 331 | mLibApplicationsDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationApplicationsLibraryDirectory()); |
| 332 | mLibShapesDirectoryPath = QUrl::fromLocalFile(UBSettings::settings()->applicationShapeLibraryDirectory()); |
| 333 | mLibSearchDirectoryPath =QUrl::fromLocalFile(UBSettings::settings()->userSearchDirectory()); |
| 334 | trashDirectoryPath = QUrl::fromLocalFile(UBSettings::userTrashDirPath()); |
| 335 | |
| 336 | rootElement = UBFeature(rootPath, QImage( ":images/libpalette/home.png" ), "root", QUrl()); |
| 337 | audiosElement = UBFeature( audiosPath, QImage(":images/libpalette/AudiosCategory.svg"), tr("Audios") , mUserAudioDirectoryPath, FEATURE_CATEGORY); |
| 338 | moviesElement = UBFeature( moviesPath, QImage(":images/libpalette/MoviesCategory.svg"), tr("Movies") , mUserVideoDirectoryPath, FEATURE_CATEGORY); |
| 339 | picturesElement = UBFeature( picturesPath, QImage(":images/libpalette/PicturesCategory.svg"), tr("Pictures") , mUserPicturesDirectoryPath, FEATURE_CATEGORY); |
| 340 | //flashElement = UBFeature( flashPath, QImage(":images/libpalette/FlashCategory.svg"), tr("Animations") , mUserAnimationDirectoryPath, FEATURE_CATEGORY); |
| 341 | interactElement = UBFeature( interactPath, QImage(":images/libpalette/InteractivesCategory.svg"), tr("Interactivities") , mLibInteractiveDirectoryPath, FEATURE_CATEGORY); |
| 342 | applicationsElement = UBFeature( appPath, QImage(":images/libpalette/ApplicationsCategory.svg"), tr("Applications") , mUserInteractiveDirectoryPath, FEATURE_CATEGORY); |
| 343 | shapesElement = UBFeature( shapesPath, QImage(":images/libpalette/ShapesCategory.svg"), tr("Shapes") , mLibShapesDirectoryPath, FEATURE_CATEGORY ); |
| 344 | favoriteElement = UBFeature( favoritePath, QImage(":images/libpalette/FavoritesCategory.svg"), tr("Favorites"), QUrl("favorites"), FEATURE_FAVORITE ); |
| 345 | webSearchElement = UBFeature( webSearchPath, QImage(":images/libpalette/WebSearchCategory.svg"), tr("Web search"), mLibSearchDirectoryPath, FEATURE_CATEGORY); |
| 346 | |
| 347 | trashElement = UBFeature( trashPath, QImage(":images/libpalette/TrashCategory.svg"), tr("Trash"), trashDirectoryPath, FEATURE_TRASH); |
| 348 | |
| 349 | featuresList = new QList <UBFeature>(); |
| 350 | |
| 351 | scanFS(); |
| 352 | |
| 353 | featuresModel = new UBFeaturesModel(featuresList, this); |
| 354 | //featuresModel->setSupportedDragActions(Qt::CopyAction | Qt::MoveAction); |
| 355 | |
| 356 | featuresProxyModel = new UBFeaturesProxyModel(this); |
| 357 | featuresProxyModel->setFilterRegularExpression(QRegularExpression::anchoredPattern(rootPath)); |
| 358 | featuresProxyModel->setSourceModel(featuresModel); |
| 359 | featuresProxyModel->setFilterCaseSensitivity( Qt::CaseInsensitive ); |
| 360 | |
| 361 | featuresSearchModel = new UBFeaturesSearchProxyModel(this); |
| 362 | featuresSearchModel->setSourceModel(featuresModel); |
| 363 | featuresSearchModel->setFilterCaseSensitivity( Qt::CaseInsensitive ); |
| 364 | |
| 365 | featuresPathModel = new UBFeaturesPathProxyModel(this); |
| 366 | featuresPathModel->setPath(rootPath); |
| 367 | featuresPathModel->setSourceModel(featuresModel); |
| 368 | |
| 369 | connect(featuresModel, SIGNAL(dataRestructured()), featuresProxyModel, SLOT(invalidate())); |
| 370 | connect(&mCThread, SIGNAL(sendFeature(UBFeature)), featuresModel, SLOT(addItem(UBFeature))); |
| 371 | connect(&mCThread, SIGNAL(featureSent()), this, SIGNAL(featureAddedFromThread())); |
nothing calls this directly
no test coverage detected