void ExtractOneVideoFrame::markShortVideo(const DB::FileName &fileName) { if (s_tokenForShortVideos.isNull()) { Utilities::StringSet usedTokens = MainWindow::TokenEditor::tokensInUse().toSet(); for ( int ch = 'A'; ch <= 'Z'; ++ch ) { QString token = QChar::fromLatin1( (char) ch ); if (!usedTokens.contains(token)) { s_tokenForShortVideos = token; break; } } if (s_tokenForShortVideos.isNull()) { // Hmmm, no free token. OK lets just skip setting tokens. return; } KMessageBox::information(MainWindow::Window::theMainWindow(), i18n("Unable to extract video thumbnails from some files. " "Either the file is damaged in some way, or the video is ultra short. " "For your convenience, the token '%1' " "has been set on those videos.\n\n" "(You might need to wait till the video extraction led in your status bar has stopped blinking, " "to see all affected videos.)", s_tokenForShortVideos)); } DB::ImageInfoPtr info = DB::ImageDB::instance()->info(fileName); DB::CategoryPtr tokensCategory = DB::ImageDB::instance()->categoryCollection()->categoryForSpecial(DB::Category::TokensCategory); info->addCategoryInfo(tokensCategory->name(), s_tokenForShortVideos); MainWindow::DirtyIndicator::markDirty(); }
void DB::ImageInfo::createFolderCategoryItem( DB::CategoryPtr folderCategory, DB::MemberMap& memberMap ) { QString folderName = Utilities::relativeFolderName( m_fileName.relative() ); if ( folderName.isEmpty() ) return; QStringList directories = folderName.split(QString::fromLatin1( "/" ) ); QString curPath; for( QStringList::ConstIterator directoryIt = directories.constBegin(); directoryIt != directories.constEnd(); ++directoryIt ) { if ( curPath.isEmpty() ) curPath = *directoryIt; else { QString oldPath = curPath; curPath = curPath + QString::fromLatin1( "/" ) + *directoryIt; memberMap.addMemberToGroup( folderCategory->name(), oldPath, curPath ); } } m_categoryInfomation.insert( folderCategory->name() , StringSet() << folderName ); folderCategory->addItem( folderName ); }
AnnotationDialog::ListSelect::ListSelect( const DB::CategoryPtr& category, QWidget* parent ) : QWidget( parent ), m_category( category ), m_baseTitle( ) { QVBoxLayout* layout = new QVBoxLayout( this ); m_lineEdit = new CompletableLineEdit( this ); m_lineEdit->setProperty( "FocusCandidate", true ); m_lineEdit->setProperty( "WantsFocus", true ); m_lineEdit->setObjectName( category->name() ); layout->addWidget( m_lineEdit ); // PENDING(blackie) rename instance variable to something better than _listView m_treeWidget = new CategoryListView::DragableTreeWidget( m_category, this ); m_treeWidget->setHeaderLabel( QString::fromLatin1( "items" ) ); m_treeWidget->header()->hide(); connect( m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemSelected(QTreeWidgetItem*)) ); m_treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect( m_treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect( m_treeWidget, SIGNAL(itemsChanged()), this, SLOT(rePopulate()) ); connect( m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(updateSelectionCount()) ); layout->addWidget( m_treeWidget ); // Merge CheckBox QHBoxLayout* lay2 = new QHBoxLayout; layout->addLayout( lay2 ); m_or = new QRadioButton( i18n("or"), this ); m_and = new QRadioButton( i18n("and"), this ); lay2->addWidget( m_or ); lay2->addWidget( m_and ); lay2->addStretch(1); // Sorting tool button QButtonGroup* grp = new QButtonGroup( this ); grp->setExclusive( true ); m_alphaTreeSort = new QToolButton; m_alphaTreeSort->setIcon( SmallIcon( QString::fromLatin1( "view-list-tree" ) ) ); m_alphaTreeSort->setCheckable( true ); m_alphaTreeSort->setToolTip( i18n("Sort Alphabetically (Tree)") ); grp->addButton( m_alphaTreeSort ); m_alphaFlatSort = new QToolButton; m_alphaFlatSort->setIcon( SmallIcon( QString::fromLatin1( "draw-text" ) ) ); m_alphaFlatSort->setCheckable( true ); m_alphaFlatSort->setToolTip( i18n("Sort Alphabetically (Flat)") ); grp->addButton( m_alphaFlatSort ); m_dateSort = new QToolButton; m_dateSort->setIcon( SmallIcon( QString::fromLatin1( "x-office-calendar" ) ) ); m_dateSort->setCheckable( true ); m_dateSort->setToolTip( i18n("Sort by date") ); grp->addButton( m_dateSort ); m_showSelectedOnly = new QToolButton; m_showSelectedOnly->setIcon( SmallIcon( QString::fromLatin1( "view-filter" ) ) ); m_showSelectedOnly->setCheckable( true ); m_showSelectedOnly->setToolTip( i18n("Show only selected Ctrl+S") ); m_showSelectedOnly->setChecked( ShowSelectionOnlyManager::instance().selectionIsLimited() ); m_alphaTreeSort->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortAlphaTree ); m_alphaFlatSort->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortAlphaFlat ); m_dateSort->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortLastUse ); connect( m_dateSort, SIGNAL(clicked()), this, SLOT(slotSortDate()) ); connect( m_alphaTreeSort, SIGNAL(clicked()), this, SLOT(slotSortAlphaTree()) ); connect( m_alphaFlatSort, SIGNAL(clicked()), this, SLOT(slotSortAlphaFlat()) ); connect( m_showSelectedOnly, SIGNAL(clicked()), &ShowSelectionOnlyManager::instance(), SLOT(toggle()) ); lay2->addWidget( m_alphaTreeSort ); lay2->addWidget( m_alphaFlatSort ); lay2->addWidget( m_dateSort ); lay2->addWidget( m_showSelectedOnly ); m_lineEdit->setListView( m_treeWidget ); connect( m_lineEdit, SIGNAL(returnPressed(QString)), this, SLOT(slotReturn()) ); populate(); connect( Settings::SettingsData::instance(), SIGNAL(viewSortTypeChanged(Settings::ViewSortType)), this, SLOT(setViewSortType(Settings::ViewSortType)) ); connect( Settings::SettingsData::instance(), SIGNAL(matchTypeChanged(AnnotationDialog::MatchType)), this, SLOT(updateListview()) ); connect( &ShowSelectionOnlyManager::instance(), SIGNAL(limitToSelected()), this, SLOT(limitToSelection()) ); connect( &ShowSelectionOnlyManager::instance(), SIGNAL(broaden()), this, SLOT(showAllChildren()) ); }