|
1 /* |
|
2 * ZCinema: Zandronum demo launcher |
|
3 * Copyright (C) 2013-2015 Teemu Piippo |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #pragma once |
|
20 #include <QDialog> |
|
21 #include "types.h" |
|
22 |
|
23 // |
|
24 // ------------------------------------------------------------------------------------------------- |
|
25 // |
|
26 // A ZandronumVersion represented in the config window. |
|
27 // |
|
28 |
|
29 struct VersionGuiEntry |
|
30 { |
|
31 class QTableWidgetItem* labelItem; |
|
32 class QTableWidgetItem* pathItem; |
|
33 QString name; |
|
34 bool isRelease; |
|
35 |
|
36 ZandronumVersion toNonGuiVersion() const; |
|
37 }; |
|
38 |
|
39 // |
|
40 // ------------------------------------------------------------------------------------------------- |
|
41 // |
|
42 |
|
43 class ConfigWindow : public QDialog |
|
44 { |
|
45 Q_OBJECT |
|
46 |
|
47 public: |
|
48 enum |
|
49 { |
|
50 LabelColumn, |
|
51 PathColumn, |
|
52 }; |
|
53 |
|
54 typedef QMap<class QTableWidgetItem*, VersionGuiEntry*> VersionEntryMap; |
|
55 |
|
56 ConfigWindow (QWidget* parent = NULL, Qt::WindowFlags f = 0); |
|
57 virtual ~ConfigWindow(); |
|
58 |
|
59 public slots: |
|
60 void addWadPath(); |
|
61 void findWadPath(); |
|
62 void removeCurrentWadPath(); |
|
63 void buttonPressed (class QAbstractButton* btn); |
|
64 void newVersion(); |
|
65 void removeCurrentVersion(); |
|
66 void editExePressed(); |
|
67 void clearExePathsClicked(); |
|
68 |
|
69 private: |
|
70 class Ui_ConfigBox& ui; |
|
71 QList<VersionGuiEntry*> m_versionEntries; |
|
72 VersionEntryMap m_versionEntryMap; |
|
73 |
|
74 void addWadPath (QString path); |
|
75 VersionGuiEntry* addVersion (const ZandronumVersion& version); |
|
76 VersionGuiEntry* currentVersionEntry(); |
|
77 void initFromSettings(); |
|
78 void removeVersion (VersionGuiEntry* entry); |
|
79 void saveSettings(); |
|
80 }; |