Sun, 08 Sep 2013 22:08:52 +0300
renamed the project to ZCinema
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 | #include "build/moc_versionEditor.cpp" |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | EXTERN_CONFIG (Map, binaryPaths) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | EXTERN_CONFIG (List, devBuildNames) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | EXTERN_CONFIG (List, releaseNames) |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | VersionEditor::VersionEditor (QWidget* parent, Qt::WindowFlags f) : |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | QDialog (parent, f), |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | m_ui (new Ui_VersionEditor) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | m_ui->setupUi (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | 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
|
39 | this, SLOT (selectionChanged (int))); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | 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
|
42 | 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
|
43 | 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
|
44 | 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
|
45 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | initVersions(); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | VersionEditor::~VersionEditor() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | delete m_ui; |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | void VersionEditor::initVersions() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | int i = 0; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | for (const QVariant& ver : (cfg::releaseNames + cfg::devBuildNames)) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | bool isRelease = (i < cfg::releaseNames.size()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | addVersion (ver.toString(), cfg::binaryPaths[ver.toString()].toString(), isRelease); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | ++i; |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | void VersionEditor::add() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | AddVersionPrompt* dlg = new AddVersionPrompt (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | if (!dlg->exec()) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | return; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | addVersion (dlg->name(), dlg->path(), dlg->release()); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | void VersionEditor::edit() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | QTableWidget* const vers = m_ui->m_versions; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | int row = vers->currentRow(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | if (row < 0) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | return; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | AddVersionPrompt* dlg = new AddVersionPrompt (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | dlg->setName (vers->item (row, NameColumn)->text()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | dlg->setPath (vers->item (row, PathColumn)->text()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | dlg->setRelease (getReleaseCheckbox(row)->isChecked()); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | if (!dlg->exec()) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | return; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | addVersion (dlg->name(), dlg->path(), dlg->release()); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | void VersionEditor::remove() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | QTableWidget* const vers = m_ui->m_versions; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | str name = vers->item (vers->currentRow(), NameColumn)->text(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | vers->removeRow (vers->currentRow()); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | void VersionEditor::clear() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | if (!confirm (tr ("Really remove all versions?"))) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | return; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | |
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
|
113 | 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
|
114 | m_ui->m_versions->removeRow (i); |
25
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | void VersionEditor::addVersion (str name, str path, bool isRelease) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | QTableWidget* const vers = m_ui->m_versions; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | int row = vers->rowCount(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | vers->insertRow (row); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | vers->setItem (row, NameColumn, new QTableWidgetItem); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | vers->setItem (row, PathColumn, new QTableWidgetItem); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | vers->item (row, NameColumn)->setText (name); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | vers->item (row, PathColumn)->setText (path); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | QCheckBox* cb = new QCheckBox; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | cb->setChecked (isRelease); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | vers->setCellWidget (row, ReleaseColumn, cb); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | void VersionEditor::saveChanges() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | QTableWidget* const vers = m_ui->m_versions; |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | cfg::devBuildNames.clear(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | cfg::releaseNames.clear(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | cfg::binaryPaths.clear(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | for (int i = 0; i < vers->rowCount(); ++i) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | const QCheckBox* cb = getReleaseCheckbox (i); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | bool isRelease = cb->isChecked(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | const str name = vers->item (i, NameColumn)->text(), |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | path = vers->item (i, PathColumn)->text(); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | if (isRelease) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | cfg::releaseNames << QVariant (name); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | else |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | cfg::devBuildNames << QVariant (name); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | cfg::binaryPaths[name] = path; |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | void VersionEditor::selectionChanged (int row) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | bool ok = (row != -1); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | m_ui->m_edit->setEnabled (ok); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | m_ui->m_remove->setEnabled (ok); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | QCheckBox* VersionEditor::getReleaseCheckbox (int i) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | 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
|
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | AddVersionPrompt::AddVersionPrompt (QWidget* parent, Qt::WindowFlags f) : |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | QDialog (parent, f), |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | m_ui (new Ui_AddVersion) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
177 | { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | m_ui->setupUi (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | 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
|
180 | 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
|
181 | 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
|
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
186 | AddVersionPrompt::~AddVersionPrompt() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
187 | delete m_ui; |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
192 | void AddVersionPrompt::findPath() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | str path = ConfigBox::getBinaryPath (this); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
194 | if (!path.isEmpty()) |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | m_ui->m_binaryPath->setText (path); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | str AddVersionPrompt::name() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | return m_ui->m_binaryName->text(); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | str AddVersionPrompt::path() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | return m_ui->m_binaryPath->text(); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | bool AddVersionPrompt::release() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
213 | return m_ui->m_release->isChecked(); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | void AddVersionPrompt::setName (const str& a) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | m_ui->m_binaryName->setText (a); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | void AddVersionPrompt::setPath (const str& a) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | m_ui->m_binaryPath->setText (a); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | void AddVersionPrompt::setRelease (bool a) { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | m_ui->m_release->setChecked (a); |
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 | // ----------------------------------------------------------------------------- |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | void AddVersionPrompt::fieldsChanged() { |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | 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
|
238 | m_ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (ok); |
256bb5c6b77f
Added a version data editor
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | } |