|
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 "main.h" |
|
22 #include "types.h" |
|
23 |
|
24 // |
|
25 // ------------------------------------------------------------------------------------------------- |
|
26 // |
|
27 // A ZandronumVersion represented in the config window. |
|
28 // |
|
29 |
|
30 struct VersionGuiEntry |
|
31 { |
|
32 class QTableWidgetItem* labelItem; |
|
33 class QTableWidgetItem* pathItem; |
|
34 QString name; |
|
35 bool isRelease; |
|
36 |
|
37 ZandronumVersion toNonGuiVersion() const; |
|
38 }; |
|
39 |
|
40 // |
|
41 // ------------------------------------------------------------------------------------------------- |
|
42 // |
|
43 |
|
44 class ConfigWindow : public QDialog |
|
45 { |
|
46 Q_OBJECT |
|
47 |
|
48 public: |
|
49 enum |
|
50 { |
|
51 LabelColumn, |
|
52 PathColumn, |
|
53 }; |
|
54 |
|
55 typedef QMap<class QTableWidgetItem*, VersionGuiEntry*> VersionEntryMap; |
|
56 |
|
57 ConfigWindow (QWidget* parent = NULL, Qt::WindowFlags f = 0); |
|
58 virtual ~ConfigWindow(); |
|
59 |
|
60 public slots: |
|
61 void addWadPath(); |
|
62 void findWadPath(); |
|
63 void removeCurrentWadPath(); |
|
64 void buttonPressed (class QAbstractButton* btn); |
|
65 void newVersion(); |
|
66 void removeCurrentVersion(); |
|
67 void editExePressed(); |
|
68 void clearExePathsClicked(); |
|
69 |
|
70 private: |
|
71 class Ui_ConfigBox& ui; |
|
72 QList<VersionGuiEntry*> m_versionEntries; |
|
73 VersionEntryMap m_versionEntryMap; |
|
74 |
|
75 void addWadPath (QString path); |
|
76 VersionGuiEntry* addVersion (const ZandronumVersion& version); |
|
77 VersionGuiEntry* currentVersionEntry(); |
|
78 void initFromSettings(); |
|
79 void removeVersion (VersionGuiEntry* entry); |
|
80 void saveSettings(); |
|
81 }; |