Mercurial > retraceit
annotate src/mainwindow.h @ 45:213d9163dab0
Add error handling to the folder selection dialog
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 06 May 2015 19:45:44 +0200 |
parents | 73e6b6b12412 |
children | 098a10fc2e83 |
rev | line source |
---|---|
25
64a51a42c01f
Assign copyright correctly
Andre Heinecke <andre.heinecke@intevation.de>
parents:
9
diff
changeset
|
1 /* Copyright (C) 2015 by ETH Zürich |
64a51a42c01f
Assign copyright correctly
Andre Heinecke <andre.heinecke@intevation.de>
parents:
9
diff
changeset
|
2 * Software engineering by Intevation GmbH |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 * |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=2) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * See LICENSE.txt for details. |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 */ |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 /** @file The Main UI class. |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 * |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 * Parent class of all dialogs and graphical user interaction. |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 */ |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 #include <QMainWindow> |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 #include <QSettings> |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 class QPushButton; |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 class QDropEvent; |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 class QDragLeaveEvent; |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 class QDragMoveEvent; |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 class QDragEnterEvent; |
2
97d2c8869c39
First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
0
diff
changeset
|
22 class MetaDataView; |
97d2c8869c39
First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
0
diff
changeset
|
23 class PNGPlayer; |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 class MainWindow : public QMainWindow |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 { |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 Q_OBJECT |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 public: |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 MainWindow(); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 protected: |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 /** @brief UI setup */ |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 void setupGUI(); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 /** @brief Cleanup and save the current state */ |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 virtual void closeEvent(QCloseEvent *event); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 /** @brief Restores the last window state */ |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 void readSettings(); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 |
2
97d2c8869c39
First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
0
diff
changeset
|
42 /* The drag drop actions |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
43 void dragEnterEvent(QDragEnterEvent *event); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
44 void dragMoveEvent(QDragMoveEvent *event); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
45 void dragLeaveEvent(QDragLeaveEvent *event); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
46 void dropEvent(QDropEvent *event); |
2
97d2c8869c39
First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
0
diff
changeset
|
47 */ |
32
179239c94740
(issue7-8) Add shortcuts for play/pause and next
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
48 |
179239c94740
(issue7-8) Add shortcuts for play/pause and next
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
49 void setupShortcuts(); |
179239c94740
(issue7-8) Add shortcuts for play/pause and next
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
50 |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
51 public slots: |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
52 /** @brief set an absolute folder to read a metadata.csv from. */ |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
53 void setFolder(const QString &folder); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
54 |
9
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
55 /** @brief set an absolute folder to check for subfolders. */ |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
56 void setRootFolder(const QString &folder); |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
57 |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
58 public: |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
59 /** @brief start the folder selection and show afterwards. */ |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
60 void showWithFolderSelect(); |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
61 |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
62 /** @brief start the subfolder selection and show afterwards. */ |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
63 void showSubFolderSelect(); |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
64 |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
65 protected slots: |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
66 /** @brief Show an error dialog to the user. */ |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
67 void showErrorMessage(const QString& errMsg); |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
68 |
5
107e435cb569
Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
2
diff
changeset
|
69 /** @brief update the status bar for the image. |
107e435cb569
Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
2
diff
changeset
|
70 * |
107e435cb569
Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
2
diff
changeset
|
71 * Function signature is similar to showPicture in pngviewer |
107e435cb569
Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
2
diff
changeset
|
72 */ |
107e435cb569
Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
2
diff
changeset
|
73 void showPictureNameStatus(const QString& fileName, int current, |
44
73e6b6b12412
(issue 1,2) Make the column used for the Timestamp value configurable
Andre Heinecke <andre.heinecke@intevation.de>
parents:
32
diff
changeset
|
74 int max, const QString& timestamp ); |
5
107e435cb569
Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
2
diff
changeset
|
75 |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
76 private: |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
77 QSettings mSettings; |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
78 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
79 QString mCurFolder; |
9
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
80 QString mRootFolder; |
e3c8f61e45a9
Implement folderselection dialogs
Andre Heinecke <andre.heinecke@intevation.de>
parents:
5
diff
changeset
|
81 QString mSubFolder; |
2
97d2c8869c39
First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
0
diff
changeset
|
82 MetaDataView *mDataView; |
97d2c8869c39
First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
0
diff
changeset
|
83 PNGPlayer *mPlayer; |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
84 }; |