Mon, 01 Jun 2015 17:06:13 +0300
Converted to CMake
30
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
1 | /* |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
2 | * ZCinema: Zandronum demo launcher |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
4 | * |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
8 | * (at your option) any later version. |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
9 | * |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
13 | * GNU General Public License for more details. |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
14 | * |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
17 | */ |
6b82f6a3ad53
renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
18 | |
25
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "versionEditor.h" |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "ui_versionEditor.h" |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "ui_addversion.h" |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "config.h" |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "misc.h" |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | EXTERN_CONFIG (Map, binaryPaths) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | EXTERN_CONFIG (List, devBuildNames) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | EXTERN_CONFIG (List, releaseNames) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | VersionEditor::VersionEditor (QWidget* parent, Qt::WindowFlags f) : |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | QDialog (parent, f), |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | m_ui (new Ui_VersionEditor) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | m_ui->setupUi (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | connect (m_ui->m_versions, SIGNAL (currentCellChanged (int, int, int, int)), |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | this, SLOT (selectionChanged (int))); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | connect (m_ui->m_add, SIGNAL (clicked (bool)), this, SLOT (add())); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | connect (m_ui->m_edit, SIGNAL (clicked (bool)), this, SLOT (edit())); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | connect (m_ui->m_remove, SIGNAL (clicked (bool)), this, SLOT (remove())); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | connect (m_ui->m_clear, SIGNAL (clicked (bool)), this, SLOT (clear())); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | initVersions(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | VersionEditor::~VersionEditor() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | delete m_ui; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | void VersionEditor::initVersions() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | int i = 0; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | for (const QVariant& ver : (cfg::releaseNames + cfg::devBuildNames)) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | bool isRelease = (i < cfg::releaseNames.size()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | addVersion (ver.toString(), cfg::binaryPaths[ver.toString()].toString(), isRelease); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | ++i; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | void VersionEditor::add() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | AddVersionPrompt* dlg = new AddVersionPrompt (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | if (!dlg->exec()) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | return; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | addVersion (dlg->name(), dlg->path(), dlg->release()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | void VersionEditor::edit() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | QTableWidget* const vers = m_ui->m_versions; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | int row = vers->currentRow(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | if (row < 0) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | return; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | AddVersionPrompt* dlg = new AddVersionPrompt (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | dlg->setName (vers->item (row, NameColumn)->text()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | dlg->setPath (vers->item (row, PathColumn)->text()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | dlg->setRelease (getReleaseCheckbox(row)->isChecked()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | if (!dlg->exec()) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | return; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | addVersion (dlg->name(), dlg->path(), dlg->release()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | void VersionEditor::remove() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | QTableWidget* const vers = m_ui->m_versions; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | str name = vers->item (vers->currentRow(), NameColumn)->text(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | vers->removeRow (vers->currentRow()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | void VersionEditor::clear() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | if (!confirm (tr ("Really remove all versions?"))) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | return; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | |
27
b9307871cf10
clear the rows of the version editor properly when clearing versions; don't save the config when closing the version editor since then changes will apply even if user presses cancel in the main config box
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
112 | for (int i = m_ui->m_versions->rowCount() - 1; i >= 0; --i) |
b9307871cf10
clear the rows of the version editor properly when clearing versions; don't save the config when closing the version editor since then changes will apply even if user presses cancel in the main config box
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
113 | m_ui->m_versions->removeRow (i); |
25
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | void VersionEditor::addVersion (str name, str path, bool isRelease) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | QTableWidget* const vers = m_ui->m_versions; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | int row = vers->rowCount(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | vers->insertRow (row); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | vers->setItem (row, NameColumn, new QTableWidgetItem); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | vers->setItem (row, PathColumn, new QTableWidgetItem); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | vers->item (row, NameColumn)->setText (name); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | vers->item (row, PathColumn)->setText (path); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | QCheckBox* cb = new QCheckBox; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | cb->setChecked (isRelease); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | vers->setCellWidget (row, ReleaseColumn, cb); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | void VersionEditor::saveChanges() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | QTableWidget* const vers = m_ui->m_versions; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | cfg::devBuildNames.clear(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | cfg::releaseNames.clear(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | cfg::binaryPaths.clear(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | for (int i = 0; i < vers->rowCount(); ++i) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | const QCheckBox* cb = getReleaseCheckbox (i); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | bool isRelease = cb->isChecked(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | const str name = vers->item (i, NameColumn)->text(), |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | path = vers->item (i, PathColumn)->text(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | if (isRelease) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | cfg::releaseNames << QVariant (name); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | else |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | cfg::devBuildNames << QVariant (name); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | cfg::binaryPaths[name] = path; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | void VersionEditor::selectionChanged (int row) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | bool ok = (row != -1); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | m_ui->m_edit->setEnabled (ok); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | m_ui->m_remove->setEnabled (ok); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
166 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
167 | QCheckBox* VersionEditor::getReleaseCheckbox (int i) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | return static_cast<QCheckBox*> (m_ui->m_versions->cellWidget (i, ReleaseColumn)); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | AddVersionPrompt::AddVersionPrompt (QWidget* parent, Qt::WindowFlags f) : |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | QDialog (parent, f), |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | m_ui (new Ui_AddVersion) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
177 | m_ui->setupUi (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | connect (m_ui->m_binaryName, SIGNAL (textChanged (QString)), this, SLOT (fieldsChanged())); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | connect (m_ui->m_binaryPath, SIGNAL (textChanged (QString)), this, SLOT (fieldsChanged())); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | connect (m_ui->m_findBinary, SIGNAL (clicked (bool)), this, SLOT (findPath())); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
184 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
185 | AddVersionPrompt::~AddVersionPrompt() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
186 | delete m_ui; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
187 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
188 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
189 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
190 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
191 | void AddVersionPrompt::findPath() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
192 | str path = ConfigBox::getBinaryPath (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | if (!path.isEmpty()) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
194 | m_ui->m_binaryPath->setText (path); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
196 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
197 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
198 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
199 | str AddVersionPrompt::name() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | return m_ui->m_binaryName->text(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
202 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
203 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
205 | str AddVersionPrompt::path() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | return m_ui->m_binaryPath->text(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | bool AddVersionPrompt::release() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | return m_ui->m_release->isChecked(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
213 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
214 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
215 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
216 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | void AddVersionPrompt::setName (const str& a) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | m_ui->m_binaryName->setText (a); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
220 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
221 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
222 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | void AddVersionPrompt::setPath (const str& a) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | m_ui->m_binaryPath->setText (a); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | void AddVersionPrompt::setRelease (bool a) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | m_ui->m_release->setChecked (a); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | } |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
233 | // ============================================================================= |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
234 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
235 | void AddVersionPrompt::fieldsChanged() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | bool ok = (!m_ui->m_binaryName->text().isEmpty()) && (!m_ui->m_binaryPath->text().isEmpty()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | m_ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (ok); |
36 | 238 | } |