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