Mercurial > retraceit
comparison src/folderselectdialog.h @ 9:e3c8f61e45a9
Implement folderselection dialogs
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 26 Mar 2015 16:30:18 +0100 |
parents | |
children | 64a51a42c01f |
comparison
equal
deleted
inserted
replaced
8:ac4db84f1d9d | 9:e3c8f61e45a9 |
---|---|
1 #ifndef FOLDERSELECTDIALOG_H | |
2 #define FOLDERSELECTDIALOG_H | |
3 /* Copyright (C) 2014 by Intevation GmbH | |
4 * | |
5 * This file is Free Software under the GNU GPL (v>=2) | |
6 * and comes with ABSOLUTELY NO WARRANTY! | |
7 * See LICENSE.txt for details. | |
8 */ | |
9 #include <QWidget> | |
10 #include <QDialog> | |
11 #include <QItemSelection> | |
12 | |
13 #include "filterwidget.h" | |
14 | |
15 class QTableView; | |
16 class QSortFilterProxyModel; | |
17 class FilterWidget; | |
18 class QStandardItemModel; | |
19 class QLabel; | |
20 class QPushButton; | |
21 class QLineEdit; | |
22 | |
23 class FolderSelectDialog : public QDialog | |
24 { | |
25 Q_OBJECT | |
26 | |
27 public: | |
28 /** @brief initialize a folder select dialog with a start folder and | |
29 * for a specific folder name pattern. | |
30 * | |
31 * If the parameter pathLabel is not empty it includes a path selection | |
32 * area. | |
33 * */ | |
34 FolderSelectDialog(const QString& startFolder, | |
35 const QString& folderPattern, | |
36 const QString& pathLabel = QString(), | |
37 QWidget * parent = 0, Qt::WindowFlags f = 0); | |
38 | |
39 void setFolder(const QString& folder); | |
40 | |
41 protected: | |
42 void setupGUI(); | |
43 | |
44 protected slots: | |
45 /** @brief The user wants to accept the selection */ | |
46 void wantToAccept(); | |
47 | |
48 /** @brief Open the folder selection dialog for the output folder */ | |
49 void changeFolderClicked(); | |
50 | |
51 /** @brief try to load the folder line into the model */ | |
52 void goClicked(); | |
53 | |
54 /** @brief enable or disable the go button depending on the path. */ | |
55 void pathLineChanged(); | |
56 | |
57 /** @brief enable or disable the ok button depending on the selection. */ | |
58 void selectionChanged (const QItemSelection& selected, | |
59 const QItemSelection& deselected); | |
60 | |
61 Q_SIGNALS: | |
62 /** @brief emited before the dialog is closed when a folder is selected */ | |
63 void folderSelected(const QString& folder); | |
64 | |
65 private: | |
66 QTableView *mView; | |
67 FilterWidget *mFilterWidget; | |
68 QSortFilterProxyModel *mSortModel; | |
69 QString mCurFolder, | |
70 mFolderPattern; | |
71 QString mPathLabelString; | |
72 QStandardItemModel *mModel; | |
73 QLabel *mPathLabel; | |
74 QLineEdit *mPathLineEdit; | |
75 QPushButton *mGoButton, | |
76 *mOkButton; | |
77 bool mShowPathSelection; | |
78 }; | |
79 | |
80 #endif // FOLDERSELECTDIALOG_H |