diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-06-10 16:40:23 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-04 02:27:36 +0800 |
commit | 09fd5c40d1ad8a33efcfc829cf445ed1de9e4ff0 (patch) | |
tree | 28d216898ee6065f58a23b2a536f085104ddaa7c /desktop-widgets/mainwindow.cpp | |
parent | f3ef38ca0d6db6f7e022a0e565f7460ed22f431e (diff) | |
download | subsurface-09fd5c40d1ad8a33efcfc829cf445ed1de9e4ff0.tar.gz |
Dive pictures: implement FindMovedImagesDialog
Move the find-moved-images functions into a new translation unit
and present the user with the identified matches before applying
them.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index dcd7aff32..a7cf6d82e 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -42,6 +42,7 @@ #include "desktop-widgets/divelogimportdialog.h" #include "desktop-widgets/divelogexportdialog.h" #include "desktop-widgets/usersurvey.h" +#include "desktop-widgets/findmovedimagesdialog.h" #include "core/divesitehelpers.h" #include "core/windowtitleupdate.h" #include "desktop-widgets/locationinformation.h" @@ -108,7 +109,8 @@ MainWindow::MainWindow() : QMainWindow(), helpView(0), #endif state(VIEWALL), - survey(0) + survey(0), + findMovedImagesDialog(0) { Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!"); m_Instance = this; @@ -701,37 +703,6 @@ void MainWindow::on_actionCloudOnline_triggered() updateCloudOnlineStatus(); } -static void learnImageDirs(QStringList dirnames, QVector<QString> imageFilenames) -{ - learnImages(dirnames, 10, imageFilenames); - DivePictureModel::instance()->updateDivePictures(); -} - -void MainWindow::on_actionHash_images_triggered() -{ - QFuture<void> future; - QFileDialog dialog(this, tr("Traverse image directories"), lastUsedDir()); - dialog.setFileMode(QFileDialog::Directory); - dialog.setViewMode(QFileDialog::Detail); - dialog.setLabelText(QFileDialog::Accept, tr("Scan")); - dialog.setLabelText(QFileDialog::Reject, tr("Cancel")); - QStringList dirnames; - if (dialog.exec()) - dirnames = dialog.selectedFiles(); - if (dirnames.isEmpty()) - return; - QVector<QString> imageFilenames; - int i; - struct dive *dive; - for_each_dive (i, dive) - FOR_EACH_PICTURE(dive) - imageFilenames.append(QString(picture->filename)); - future = QtConcurrent::run(learnImageDirs, dirnames, imageFilenames); - MainWindow::instance()->getNotificationWidget()->showNotification(tr("Scanning images...(this can take a while)"), KMessageWidget::Information); - MainWindow::instance()->getNotificationWidget()->setFuture(future); - -} - ProfileWidget2 *MainWindow::graphics() const { return qobject_cast<ProfileWidget2*>(applicationState["Default"].topRight->layout()->itemAt(1)->widget()); @@ -1375,6 +1346,13 @@ void MainWindow::on_actionUserSurvey_triggered() survey->show(); } +void MainWindow::on_actionHash_images_triggered() +{ + if(!findMovedImagesDialog) + findMovedImagesDialog = new FindMovedImagesDialog(this); + findMovedImagesDialog->show(); +} + QString MainWindow::filter_open() { QString f; |