diff src/mainwindow.cpp @ 9:e3c8f61e45a9

Implement folderselection dialogs
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 26 Mar 2015 16:30:18 +0100
parents 107e435cb569
children 6d5dd3ae2ad3
line wrap: on
line diff
--- a/src/mainwindow.cpp	Wed Mar 25 14:25:21 2015 +0100
+++ b/src/mainwindow.cpp	Thu Mar 26 16:30:18 2015 +0100
@@ -11,6 +11,7 @@
 #include "constants.h"
 #include "metadataview.h"
 #include "pngplayer.h"
+#include "folderselectdialog.h"
 
 #include <QDebug>
 #include <QDialog>
@@ -149,6 +150,7 @@
     mCurFolder = folder;
     mPlayer->setBaseDir(folder);
     mDataView->selectNextRow();
+    show();
 }
 
 void MainWindow::showPictureNameStatus(const QString& fileName, int current,
@@ -157,3 +159,37 @@
         statusBar()->showMessage(tr("Showing: '%1'").arg(fileName));
     }
 }
+
+void MainWindow::setRootFolder(const QString &folder) {
+    mRootFolder = folder;
+    showSubFolderSelect();
+}
+
+void MainWindow::showSubFolderSelect() {
+    const QString subPattern = mSettings.value(SUB_FOLDER_PATTERN_KEY,
+                                               SUB_FOLDER_PATTERN).toString();
+    FolderSelectDialog *fsDialog = new FolderSelectDialog(mRootFolder,
+                                                          subPattern);
+    fsDialog->setWindowTitle(tr("Persons"));
+    connect(fsDialog, &FolderSelectDialog::folderSelected,
+            this, &MainWindow::setFolder);
+
+    fsDialog->show();
+//    connect(fsDialog, &QDialog::closeEvent, fsDialog, &QObject::deleteLater);
+}
+
+void MainWindow::showWithFolderSelect() {
+    const QString startFolder = mSettings.value(ROOT_FOLDER_KEY,
+                                                QString()).toString();
+    const QString rootPattern = mSettings.value(ROOT_FOLDER_PATTERN_KEY,
+                                                DEFAULT_ROOT_PATTERN).toString();
+    FolderSelectDialog *fsDialog = new FolderSelectDialog(startFolder,
+                                                          rootPattern,
+                                                          tr("Root-Path"));
+    fsDialog->setWindowTitle(tr("Exams"));
+    connect(fsDialog, &FolderSelectDialog::folderSelected,
+            this, &MainWindow::setRootFolder);
+
+    fsDialog->show();
+   // connect(fsDialog, &QDialog::closeEvent, fsDialog, &QObject::deleteLater);
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)