src/prompts.cpp

Sat, 06 Jun 2015 22:26:05 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 06 Jun 2015 22:26:05 +0300
changeset 42
9528f8d06962
parent 39
2c368cf5cc19
child 44
d0bf58f3560f
permissions
-rw-r--r--

rename config.cpp/h to configwindow.cpp/h

13
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
1 /*
30
6b82f6a3ad53 renamed the project to ZCinema
Teemu Piippo <crimsondusk64@gmail.com>
parents: 26
diff changeset
2 * ZCinema: Zandronum demo launcher
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
3 * Copyright (C) 2013-2015 Teemu Piippo
13
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
4 *
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
5 * This program is free software: you can redistribute it and/or modify
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
6 * it under the terms of the GNU General Public License as published by
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
8 * (at your option) any later version.
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
9 *
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
10 * This program is distributed in the hope that it will be useful,
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
13 * GNU General Public License for more details.
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
14 *
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
15 * You should have received a copy of the GNU General Public License
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
17 */
9bdddd2ccde6 now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 12
diff changeset
18
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
19 #include <QTableWidgetItem>
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
20 #include <QFileDialog>
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "prompts.h"
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "ui_unknownversion.h"
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include "misc.h"
42
9528f8d06962 rename config.cpp/h to configwindow.cpp/h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 39
diff changeset
24 #include "configwindow.h"
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
25 #include "ui_findfile.h"
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
26 #include "ui_addversion.h"
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
28 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
29 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
30 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
31
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 UnknownVersionPrompt::UnknownVersionPrompt (
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
33 QString fileName,
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
34 QString binaryName,
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 bool isRelease,
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 QWidget* parent,
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 Qt::WindowFlags f
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 ) :
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 QDialog (parent, f),
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 m_binaryString (binaryName),
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 m_isRelease (isRelease)
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 {
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 ui = new Ui_UnknownVersion;
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 ui->setupUi (this);
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
45
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 // Replace the placeholders
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
47 QString text = ui->m_description->text();
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 text.replace ("<DEMO>", basename (fileName));
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 text.replace ("<VERSION>", binaryName);
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 ui->m_description->setText (text);
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
51
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
52 connect (ui->m_addVersion, SIGNAL (clicked (bool)), this, SLOT (addBinary()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
53 connect (ui->m_findBinary, SIGNAL (clicked (bool)), this, SLOT (findBinary()));
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
54 setWindowTitle (versionSignature());
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 }
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
57 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
58 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
59 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
60
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
61 UnknownVersionPrompt::~UnknownVersionPrompt()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
62 {
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 delete ui;
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 }
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
66 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
67 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
68 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
69
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
70 void UnknownVersionPrompt::addBinary()
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
71 {
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
72 ZandronumVersion version (m_binaryString, m_isRelease, ui->m_binaryPath->text());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
73 QList<QVariant> versions = Config::get ("versions").toList();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
74 QVariant var;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
75 var.setValue (version);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
76 versions.append (var);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
77 Config::set ("versions", versions);
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 accept();
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 }
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
81 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
82 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
83 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
84
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
85 void UnknownVersionPrompt::findBinary()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
86 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
87 QString path = getBinaryPath (this);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
88
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 if (path.isEmpty())
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 return;
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
91
12
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 ui->m_binaryPath->setText (path);
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
93 }
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
94
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
95 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
96 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
97 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
98
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
99 FindFilePrompt::FindFilePrompt (QWidget* parent, Qt::WindowFlags f) :
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
100 QDialog (parent, f),
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
101 m_ui (new Ui_FindFile)
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
102 {
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
103 m_ui->setupUi (this);
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
104 connect (m_ui->m_find, SIGNAL (clicked()), this, SLOT (findDemo()));
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
105
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
106 setWindowTitle (versionSignature());
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
107 }
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
108
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
109 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
110 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
111 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
112
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
113 FindFilePrompt::~FindFilePrompt()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
114 {
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
115 delete m_ui;
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
116 }
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
117
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
118 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
119 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
120 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
121
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
122 void FindFilePrompt::findDemo()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
123 {
37
c82a86ea87be Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents: 36
diff changeset
124 QString path = QFileDialog::getOpenFileName (this, tr ("Open Demo File"),
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
125 QDir::homePath(), tr ("Demo files (*.cld);;All files (*.*)"));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
126
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
127 if (not path.isEmpty())
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
128 m_ui->m_path->setText (path);
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
129 }
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
130
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
131 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
132 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
133 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
134
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
135 QString FindFilePrompt::path() const
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
136 {
26
9aab482c9125 When launched with no parameters, prompt the user for a demo
Teemu Piippo <crimsondusk64@gmail.com>
parents: 20
diff changeset
137 return m_ui->m_path->text();
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
138 }
39
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
139
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
140 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
141 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
142 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
143
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
144 AddVersionPrompt::AddVersionPrompt (VersionGuiEntry* entry, QWidget* parent, Qt::WindowFlags f)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
145 : QDialog (parent, f),
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
146 ui (*new Ui_AddVersion),
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
147 m_entry (entry)
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
148 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
149 ui.setupUi (this);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
150 connect (ui.buttonBox, SIGNAL (accepted()), this, SLOT (acceptPressed()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
151 connect (ui.buttonBox, SIGNAL (rejected()), this, SLOT (reject()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
152 connect (ui.findExeButton, SIGNAL (clicked()), this, SLOT (findExePath()));
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
153
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
154 ui.nameField->setText (entry->name);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
155 ui.exePathField->setText (entry->pathItem->text());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
156 ui.releaseCheckbox->setChecked (entry->isRelease);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
157 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
158
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
159 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
160 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
161 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
162
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
163 void AddVersionPrompt::acceptPressed()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
164 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
165 m_entry->name = ui.nameField->text();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
166 m_entry->isRelease = ui.releaseCheckbox->isChecked();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
167 m_entry->labelItem->setText (m_entry->name);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
168 m_entry->pathItem->setText (ui.exePathField->text());
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
169 accept();
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
170 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
171
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
172 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
173 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
174 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
175
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
176 AddVersionPrompt::~AddVersionPrompt()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
177 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
178 delete &ui;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
179 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
180
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
181 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
182 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
183 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
184
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
185 void AddVersionPrompt::findExePath()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
186 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
187 QString path = getBinaryPath (this);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
188
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
189 if (not path.isEmpty())
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
190 ui.exePathField->setText (path);
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
191 }
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
192
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
193 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
194 // -------------------------------------------------------------------------------------------------
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
195 //
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
196
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
197 VersionGuiEntry* AddVersionPrompt::getVersionInfo()
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
198 {
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
199 return m_entry;
2c368cf5cc19 Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
200 }

mercurial