Git commit c7372e1ed40694d65d9c65d244e6ab8c527d6d29 by Tobias Leupold. Committed on 20/08/2016 at 12:03. Pushed by tleupold into branch 'master'. Ported MainWindow::DuplicateMerger to QDialog. M +27 -15 MainWindow/DuplicateMerger/DuplicateMerger.cpp M +12 -6 MainWindow/DuplicateMerger/DuplicateMerger.h M +1 -0 MainWindow/Window.cpp http://commits.kde.org/kphotoalbum/c7372e1ed40694d65d9c65d244e6ab8c527d6d29 diff --git a/MainWindow/DuplicateMerger/DuplicateMerger.cpp b/MainWindow/Du= plicateMerger/DuplicateMerger.cpp index e529230..dc6c4c3 100644 --- a/MainWindow/DuplicateMerger/DuplicateMerger.cpp +++ b/MainWindow/DuplicateMerger/DuplicateMerger.cpp @@ -1,5 +1,5 @@ /* Copyright 2012 Jesper K. Pedersen - = + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of @@ -7,12 +7,12 @@ accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. - = + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - = + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -32,18 +32,21 @@ #include "MergeToolTip.h" #include #include "Utilities/DeleteFiles.h" +#include +#include +#include = namespace MainWindow { = -DuplicateMerger::DuplicateMerger(QWidget *parent) : - KDialog(parent) +DuplicateMerger::DuplicateMerger(QWidget *parent) : QDialog(parent) { setAttribute(Qt::WA_DeleteOnClose); resize(800,600); = QWidget* top =3D new QWidget(this); QVBoxLayout* topLayout =3D new QVBoxLayout(top); - setMainWidget(top); + setLayout(topLayout); + topLayout->addWidget(top); = QString txt =3D i18n("

Below is a list of all images that are duplic= ate in your database.
" "Select which you want merged, and which of the dup= licates should be kept.
" @@ -76,12 +79,20 @@ DuplicateMerger::DuplicateMerger(QWidget *parent) : m_selectionCount =3D new QLabel; topLayout->addWidget(m_selectionCount); = - setButtons(Ok|Cancel|User1|User2); - setButtonText(User1, i18n("Select &All")); - setButtonText(User2, i18n("Select &None")); - connect(this, SIGNAL(user1Clicked()), this, SLOT(selectAll())); - connect(this, SIGNAL(user2Clicked()), this, SLOT(selectNone())); - connect(this, SIGNAL(okClicked()), this, SLOT(go())); + QDialogButtonBox* buttonBox =3D new QDialogButtonBox(); + + m_selectAllButton =3D buttonBox->addButton(i18n("Select &All"), QDialo= gButtonBox::YesRole); + m_selectNoneButton =3D buttonBox->addButton(i18n("Select &None"), QDia= logButtonBox::NoRole); + m_okButton =3D buttonBox->addButton(QDialogButtonBox::Ok); + m_cancelButton =3D buttonBox->addButton(QDialogButtonBox::Cancel); + + connect(m_selectAllButton, SIGNAL(clicked()), this, SLOT(selectAll())); + connect(m_selectNoneButton, SIGNAL(clicked()), this, SLOT(selectNone()= )); + connect(m_okButton, SIGNAL(clicked()), this, SLOT(go())); + connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(reject())); + + topLayout->addWidget(buttonBox); + findDuplicates(); } = @@ -110,6 +121,7 @@ void DuplicateMerger::go() Q_FOREACH( DuplicateMatch* selector, m_selectors) { selector->execute(method); } + accept(); } = void DuplicateMerger::updateSelectionCount() @@ -170,9 +182,9 @@ void DuplicateMerger::tellThatNoDuplicatesWereFound() label->setFont(fnt); m_scrollLayout->addWidget(label); = - enableButton(User1, false); - enableButton(User2, false); - enableButton(Cancel, false); + m_selectAllButton->setEnabled(false); + m_selectNoneButton->setEnabled(false); + m_cancelButton->setEnabled(false); } = } // namespace MainWindow diff --git a/MainWindow/DuplicateMerger/DuplicateMerger.h b/MainWindow/Dupl= icateMerger/DuplicateMerger.h index aa23526..cc38de4 100644 --- a/MainWindow/DuplicateMerger/DuplicateMerger.h +++ b/MainWindow/DuplicateMerger/DuplicateMerger.h @@ -1,5 +1,5 @@ /* Copyright 2012 Jesper K. Pedersen - = + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of @@ -7,12 +7,12 @@ accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. - = + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - = + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -21,7 +21,7 @@ #define MAINWINDOW_DUPLICATEMERGER_H = #include -#include +#include #include "DB/MD5.h" #include #include @@ -29,15 +29,16 @@ class QVBoxLayout; class QRadioButton; class QLabel; +class QPushButton; = namespace MainWindow { = class DuplicateMatch; = -class DuplicateMerger : public KDialog +class DuplicateMerger : public QDialog { Q_OBJECT - = + public: explicit DuplicateMerger(QWidget *parent =3D nullptr); ~DuplicateMerger(); @@ -62,6 +63,11 @@ private: QRadioButton* m_trash; QRadioButton *m_deleteFromDisk; QLabel* m_selectionCount; + + QPushButton* m_selectAllButton; + QPushButton* m_selectNoneButton; + QPushButton* m_okButton; + QPushButton* m_cancelButton; }; = = diff --git a/MainWindow/Window.cpp b/MainWindow/Window.cpp index f1b8887..aa53ae0 100644 --- a/MainWindow/Window.cpp +++ b/MainWindow/Window.cpp @@ -59,6 +59,7 @@ #include #include #include +#include = #ifdef HASKIPI # include