[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kphotoalbum] MainWindow/DuplicateMerger: Formatting.
From: Tobias Leupold <tobias.leupold () web ! de>
Date: 2016-08-20 12:14:14
Message-ID: E1bb5AE-0002g5-Vo () code ! kde ! org
[Download RAW message or body]
Git commit ae4349e3eaa4d8d5c11059a2eb7ef38233967c7a by Tobias Leupold.
Committed on 20/08/2016 at 12:14.
Pushed by tleupold into branch 'master'.
Formatting.
M +31 -18 MainWindow/DuplicateMerger/DuplicateMerger.cpp
M +6 -4 MainWindow/DuplicateMerger/DuplicateMerger.h
http://commits.kde.org/kphotoalbum/ae4349e3eaa4d8d5c11059a2eb7ef38233967c7a
diff --git a/MainWindow/DuplicateMerger/DuplicateMerger.cpp \
b/MainWindow/DuplicateMerger/DuplicateMerger.cpp index 5f1cae5..55767f3 100644
--- a/MainWindow/DuplicateMerger/DuplicateMerger.cpp
+++ b/MainWindow/DuplicateMerger/DuplicateMerger.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2012 Jesper K. Pedersen <blackie@kde.org>
+/* Copyright 2012-2016 Jesper K. Pedersen <blackie@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -17,25 +17,27 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DuplicateMerger.h"
-#include "DB/ImageDB.h"
-#include "DB/FileName.h"
-#include "DB/FileNameList.h"
-#include "DB/ImageInfo.h"
-#include "DB/MD5.h"
#include <QScrollArea>
#include <QVBoxLayout>
-#include "DuplicateMatch.h"
-#include <KLocalizedString>
#include <QLabel>
-#include "Utilities/ShowBusyCursor.h"
-#include "MergeToolTip.h"
#include <QRadioButton>
-#include "Utilities/DeleteFiles.h"
#include <QDialogButtonBox>
#include <QPushButton>
#include <QDebug>
+#include <KLocalizedString>
+
+#include "DuplicateMerger.h"
+#include "DuplicateMatch.h"
+#include "MergeToolTip.h"
+#include "Utilities/ShowBusyCursor.h"
+#include "Utilities/DeleteFiles.h"
+#include "DB/ImageDB.h"
+#include "DB/FileName.h"
+#include "DB/FileNameList.h"
+#include "DB/ImageInfo.h"
+#include "DB/MD5.h"
+
namespace MainWindow {
DuplicateMerger::DuplicateMerger(QWidget *parent) : QDialog(parent)
@@ -114,13 +116,17 @@ void DuplicateMerger::selectNone()
void DuplicateMerger::go()
{
Utilities::DeleteMethod method = Utilities::BlockFromDatabase;
- if (m_trash->isChecked())
+
+ if (m_trash->isChecked()) {
method = Utilities::MoveToTrash;
- else if (m_deleteFromDisk->isChecked())
+ } else if (m_deleteFromDisk->isChecked()) {
method = Utilities::DeleteFromDisk;
+ }
+
Q_FOREACH( DuplicateMatch* selector, m_selectors) {
selector->execute(method);
}
+
accept();
}
@@ -128,19 +134,21 @@ void DuplicateMerger::updateSelectionCount()
{
int total = 0;
int selected = 0;
+
Q_FOREACH( DuplicateMatch* selector, m_selectors) {
++total;
if (selector->selected())
++selected;
}
- m_selectionCount->setText(i18n("%1 of %2 selected", selected, total));
+ m_selectionCount->setText(i18n("%1 of %2 selected", selected, total));
m_okButton->setEnabled(selected > 0);
}
void DuplicateMerger::findDuplicates()
{
Utilities::ShowBusyCursor dummy;
+
Q_FOREACH( const DB::FileName& fileName, DB::ImageDB::instance()->images() ) {
const DB::ImageInfoPtr info = DB::ImageDB::instance()->info(fileName);
const DB::MD5 md5 = info->MD5Sum();
@@ -148,15 +156,19 @@ void DuplicateMerger::findDuplicates()
}
bool anyFound = false;
- for (QMap<DB::MD5, DB::FileNameList>::const_iterator it = \
m_matches.constBegin(); it != m_matches.constEnd(); ++it) {
- if ( it.value().count() > 1 ) {
+ for (QMap<DB::MD5, DB::FileNameList>::const_iterator it = \
m_matches.constBegin(); + it != m_matches.constEnd(); ++it)
+ {
+ if (it.value().count() > 1) {
addRow(it.key());
anyFound = true;
}
}
- if ( !anyFound )
+ if (! anyFound) {
tellThatNoDuplicatesWereFound();
+ }
+
updateSelectionCount();
}
@@ -191,4 +203,5 @@ void DuplicateMerger::tellThatNoDuplicatesWereFound()
} // namespace MainWindow
#include "DuplicateMerger.moc"
+
// vi:expandtab:tabstop=4 shiftwidth=4:
diff --git a/MainWindow/DuplicateMerger/DuplicateMerger.h \
b/MainWindow/DuplicateMerger/DuplicateMerger.h index cc38de4..41c2165 100644
--- a/MainWindow/DuplicateMerger/DuplicateMerger.h
+++ b/MainWindow/DuplicateMerger/DuplicateMerger.h
@@ -1,4 +1,4 @@
-/* Copyright 2012 Jesper K. Pedersen <blackie@kde.org>
+/* Copyright 2012-2016 Jesper K. Pedersen <blackie@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -22,8 +22,9 @@
#include <QWidget>
#include <QDialog>
-#include "DB/MD5.h"
#include <QMap>
+
+#include <DB/MD5.h>
#include <DB/FileNameList.h>
class QVBoxLayout;
@@ -51,7 +52,7 @@ private slots:
private:
void findDuplicates();
- void addRow(const DB::MD5& );
+ void addRow(const DB::MD5&);
void selectAll(bool b);
void tellThatNoDuplicatesWereFound();
@@ -70,7 +71,8 @@ private:
QPushButton* m_cancelButton;
};
-
} // namespace MainWindow
+
#endif // MAINWINDOW_DUPLICATEMERGER_H
+
// vi:expandtab:tabstop=4 shiftwidth=4:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic