summaryrefslogtreecommitdiffstats
path: root/fswidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fswidget.cpp')
-rw-r--r--fswidget.cpp30
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()){