diff options
author | Arno <arno@disconnect.de> | 2018-09-14 11:06:37 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-09-14 11:06:37 +0200 |
commit | 9bf18870778a908ed6ce3608788ad29897485a6e (patch) | |
tree | 7a8866ad44baad8e7ee4f0195d9fa9d510595a0f /fswidget.cpp | |
parent | 0fa27c938ec80aeda984fc96892a641e7982021e (diff) | |
download | SheMov-9bf18870778a908ed6ce3608788ad29897485a6e.tar.gz SheMov-9bf18870778a908ed6ce3608788ad29897485a6e.tar.bz2 SheMov-9bf18870778a908ed6ce3608788ad29897485a6e.zip |
Add compare action for pics
Show files with the same filename *after another* in Viewer.
Diffstat (limited to 'fswidget.cpp')
-rw-r--r-- | fswidget.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/fswidget.cpp b/fswidget.cpp index 52dca10..05034a0 100644 --- a/fswidget.cpp +++ b/fswidget.cpp @@ -142,6 +142,8 @@ void FSWidget::setupWidget(){ connect(unselectAllA, &QAction::triggered, [=] { mFileView->selectionModel()->clear(); }); unselectAllA->setShortcut(tr("CTRL+k")); unselectAllA->setData(SmView::InvisibleAction); + QAction *compareA = new QAction(QIcon(":/compare.png"), tr("Compare..."), this); + connect(compareA, &QAction::triggered, this, &FSWidget::comparePics); QIcon plusIcon = Helper::icon(QColor(255,85,255), Qt::white, '+', true, true); QIcon minusIcon = Helper::icon(QColor(255,85,255), Qt::white, '-', true, true); @@ -199,7 +201,7 @@ void FSWidget::setupWidget(){ mFileView->sortByColumn(0, Qt::AscendingOrder); connect(mFileView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &FSWidget::calculateSelectionChanged); - mFileView->addActions(QList<QAction*>() << playSelectedA << playRepeatMA << mPlayWithA << Helper::createSeparator(this) << backA << forwardA << Helper::createSeparator(this) << refreshA << deleteFilesA << Helper::createSeparator(this) << archiveMovieA << archivePicsA << Helper::createSeparator(this) << unpackA << previewA << selectFilterA << unselectAllA); + mFileView->addActions(QList<QAction*>() << playSelectedA << playRepeatMA << mPlayWithA << Helper::createSeparator(this) << backA << forwardA << Helper::createSeparator(this) << refreshA << deleteFilesA << Helper::createSeparator(this) << archiveMovieA << archivePicsA << Helper::createSeparator(this) << unpackA << previewA << compareA << selectFilterA << unselectAllA); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(topWL); @@ -389,7 +391,7 @@ void FSWidget::gatherData(const QString &curDir){ } if(!dups.isEmpty()){ currentBrush = blueBrush; - presenceStr = QString(tr("Pics: Name")).arg(QString::number(dups.count())); + presenceStr = QString(tr("Pics: Name")); //.arg(QString::number(dups.count())); } } @@ -570,6 +572,30 @@ void FSWidget::preview(){ } } +void FSWidget::comparePics(){ + QModelIndexList selected = mFileView->selectionModel()->selectedRows(); + if(selected.isEmpty()){ + return; + } + QString fullPath = selected.first().data(FullPathRole).toString(); + QFileInfo fi(fullPath); + QString fn = fi.fileName(); + QStringList files = QStringList() << fullPath; + QSqlDatabase db = QSqlDatabase::database("treedb"); + QSqlQuery nameQ(db); + nameQ.prepare("SELECT tfilename, cmd5sum FROM pics WHERE tfilename = :arg"); + nameQ.bindValue(":arg", fn); + nameQ.exec(); + while(nameQ.next()){ + QString v1 = nameQ.value(0).toString(); + QString v2 = nameQ.value(1).toString(); + QString fullPath = Helper::createArchivePath(v1, v2, false); + files << fullPath; + } + mViewer->setFiles(files); + mViewer->showMaximized(); +} + void FSWidget::playSelected(int count, QString player){ QModelIndexList selected = mFileView->selectionModel()->selectedRows(); if(selected.isEmpty()){ |