diff options
-rw-r--r-- | compare.png | bin | 0 -> 1177 bytes | |||
-rw-r--r-- | fswidget.cpp | 30 | ||||
-rw-r--r-- | fswidget.h | 1 | ||||
-rw-r--r-- | shemov.qrc | 1 | ||||
-rw-r--r-- | viewer.cpp | 8 | ||||
-rw-r--r-- | viewer.h | 1 |
6 files changed, 38 insertions, 3 deletions
diff --git a/compare.png b/compare.png Binary files differnew file mode 100644 index 0000000..13c325f --- /dev/null +++ b/compare.png 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()){ @@ -45,6 +45,7 @@ class FSWidget : public QWidget { void unpack(); void doubleClicked(const QModelIndex &idx); void preview(); + void comparePics(); void playSelected(int count, QString player); void doPlay(); void selectFilter(); @@ -49,5 +49,6 @@ <file>delete.png</file> <file>refresh.png</file> <file>snapshot.png</file> + <file>compare.png</file> </qresource> </RCC> @@ -49,6 +49,13 @@ void Viewer::setFile(const QString &file, bool allFiles){ }
}
+void Viewer::setFiles(const QStringList &files){
+ mFiles.clear();
+ mFiles = files;
+ mCurIndex = 0;
+ displayFile(mCurIndex);
+}
+
void Viewer::preview(const QString &file){
mFiles.clear();
mCurIndex = -1;
@@ -58,7 +65,6 @@ void Viewer::preview(const QString &file){ setWindowTitle(winTitle);
}
-
void Viewer::wheelEvent(QWheelEvent *event){
if(mCurIndex == -1){
return;
@@ -9,6 +9,7 @@ class Viewer : public QWidget { public:
Viewer(QWidget *parent = 0, Qt::WindowFlags f = 0);
void setFile(const QString &file, bool allFiles = true);
+ void setFiles(const QStringList &files);
void preview(const QString &file);
protected:
|