Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
bring back duplicate finding
Browse files Browse the repository at this point in the history
  • Loading branch information
sandsmark committed May 21, 2020
1 parent fca8a03 commit 22b2c68
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
30 changes: 28 additions & 2 deletions Phototonic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ void Phototonic::createActions() {
connect(colorsAction, SIGNAL(triggered()), this, SLOT(showColorsDialog()));
colorsAction->setIcon(QIcon(":/images/colors.png"));

findDupesAction = new QAction(tr("Find Duplicate Images"), this);
findDupesAction->setObjectName("findDupes");
findDupesAction->setIcon(QIcon(":/images/duplicates.png"));
findDupesAction->setCheckable(true);
connect(findDupesAction, SIGNAL(triggered()), this, SLOT(findDuplicateImages()));

mirrorDisabledAction = new QAction(tr("Disable Mirror"), this);
mirrorDisabledAction->setObjectName("mirrorDisabled");
mirrorDualAction = new QAction(tr("Dual Mirror"), this);
Expand Down Expand Up @@ -800,6 +806,9 @@ void Phototonic::createMenus() {
viewMenu->addAction(showHiddenFilesAction);
viewMenu->addSeparator();
viewMenu->addAction(refreshAction);
viewMenu->addSeparator();

viewMenu->addAction(findDupesAction);

// thumbs viewer context menu
thumbsViewer->addAction(viewImageAction);
Expand Down Expand Up @@ -852,6 +861,7 @@ void Phototonic::createToolBars() {
connect(pathLineEdit, SIGNAL(returnPressed()), this, SLOT(goPathBarDir()));
goToolBar->addWidget(pathLineEdit);
goToolBar->addAction(includeSubDirectoriesAction);
goToolBar->addAction(findDupesAction);
connect(goToolBar->toggleViewAction(), SIGNAL(triggered()), this, SLOT(setGoToolBarVisibility()));

/* View */
Expand Down Expand Up @@ -1068,6 +1078,7 @@ void Phototonic::sortThumbnails() {
}

void Phototonic::reload() {
findDupesAction->setChecked(false);
if (Settings::layoutMode == ThumbViewWidget) {
refreshThumbs(false);
} else {
Expand All @@ -1076,6 +1087,7 @@ void Phototonic::reload() {
}

void Phototonic::setIncludeSubDirs() {
findDupesAction->setChecked(false);
Settings::includeSubDirectories = includeSubDirectoriesAction->isChecked();
refreshThumbs(false);
}
Expand Down Expand Up @@ -1970,6 +1982,7 @@ void Phototonic::deletePermanentlyOperation() {
}

void Phototonic::goTo(QString path) {
findDupesAction->setChecked(false);
Settings::isFileListLoaded = false;
fileListWidget->clearSelection();
thumbsViewer->setNeedToScroll(true);
Expand All @@ -1979,6 +1992,7 @@ void Phototonic::goTo(QString path) {
}

void Phototonic::goSelectedDir(const QModelIndex &idx) {
findDupesAction->setChecked(false);
Settings::isFileListLoaded = false;
fileListWidget->clearSelection();
thumbsViewer->setNeedToScroll(true);
Expand All @@ -1988,6 +2002,7 @@ void Phototonic::goSelectedDir(const QModelIndex &idx) {
}

void Phototonic::goPathBarDir() {
findDupesAction->setChecked(false);
thumbsViewer->setNeedToScroll(true);

QDir checkPath(pathLineEdit->text());
Expand Down Expand Up @@ -3144,12 +3159,18 @@ void Phototonic::onReloadThumbs() {
setThumbsViewerWindowTitle();
}

thumbsViewer->reLoad();
if (findDupesAction->isChecked()) {
thumbsViewer->loadDuplicates();
} else {
thumbsViewer->reLoad();
}
}

void Phototonic::setThumbsViewerWindowTitle() {

if (Settings::isFileListLoaded) {
if (findDupesAction->isChecked()) {
setWindowTitle(tr("Duplicate images in %1").arg(Settings::currentDirectory) + " - Phototonic");
} else if (Settings::isFileListLoaded) {
setWindowTitle(tr("Files List") + " - Phototonic");
} else {
setWindowTitle(Settings::currentDirectory + " - Phototonic");
Expand Down Expand Up @@ -3538,3 +3559,8 @@ void Phototonic::addBookmark(QString path) {
Settings::bookmarkPaths.insert(path);
bookmarks->reloadBookmarks();
}

void Phototonic::findDuplicateImages()
{
refreshThumbs(true);
}
3 changes: 3 additions & 0 deletions Phototonic.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ private slots:

void onReloadThumbs();

void findDuplicateImages();

void renameDir();

void setThumbsViewerWindowTitle();
Expand Down Expand Up @@ -405,6 +407,7 @@ private slots:
QAction *viewImageAction;
QAction *filterImagesFocusAction;
QAction *setPathFocusAction;
QAction *findDupesAction;

QAction *openWithMenuAction;
QAction *externalAppsAction;
Expand Down
Binary file added images/duplicates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions phototonic.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<file>images/tag_filter_on.png</file>
<file>images/tag_filter_negate.png</file>
<file>images/tag_filter_off.png</file>
<file>images/duplicates.png</file>
<file>images/busy.gif</file>
<file>translations/phototonic_pl.qm</file>
<file>translations/phototonic_de.qm</file>
Expand Down

0 comments on commit 22b2c68

Please sign in to comment.