Mon, 22 Jun 2015 02:30:07 +0300
Changed version to 1.1-beta
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 <QFileDialog> |
46
07578e081ae8
Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents:
45
diff
changeset
|
20 | #include <commonlib/misc.h> |
07578e081ae8
Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents:
45
diff
changeset
|
21 | #include <commonlib/version.h> |
07578e081ae8
Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents:
45
diff
changeset
|
22 | #include <commonlib/config.h> |
12 | 23 | #include "prompts.h" |
24 | #include "ui_unknownversion.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" |
12 | 26 | |
39
2c368cf5cc19
Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
27 | // |
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 | |
12 | 31 | UnknownVersionPrompt::UnknownVersionPrompt ( |
37
c82a86ea87be
Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents:
36
diff
changeset
|
32 | QString fileName, |
c82a86ea87be
Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents:
36
diff
changeset
|
33 | QString binaryName, |
12 | 34 | bool isRelease, |
35 | QWidget* parent, | |
36 | Qt::WindowFlags f | |
37 | ) : | |
38 | QDialog (parent, f), | |
39 | m_binaryString (binaryName), | |
40 | m_isRelease (isRelease) | |
41 | { | |
42 | ui = new Ui_UnknownVersion; | |
43 | ui->setupUi (this); | |
39
2c368cf5cc19
Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
44 | |
12 | 45 | // Replace the placeholders |
37
c82a86ea87be
Major rework, lots of internal maintenance, version editor removed
Teemu Piippo <crimsondusk64@gmail.com>
parents:
36
diff
changeset
|
46 | QString text = ui->m_description->text(); |
52
7dcfac8a9f17
Improved wording on the unknown version prompt, replaced the command link buttons with a more regular button box
Teemu Piippo <tsapii@utu.fi>
parents:
46
diff
changeset
|
47 | text.replace ("{{DEMO}}", basename (fileName)); |
7dcfac8a9f17
Improved wording on the unknown version prompt, replaced the command link buttons with a more regular button box
Teemu Piippo <tsapii@utu.fi>
parents:
46
diff
changeset
|
48 | text.replace ("{{VERSION}}", binaryName); |
12 | 49 | ui->m_description->setText (text); |
39
2c368cf5cc19
Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
50 | |
52
7dcfac8a9f17
Improved wording on the unknown version prompt, replaced the command link buttons with a more regular button box
Teemu Piippo <tsapii@utu.fi>
parents:
46
diff
changeset
|
51 | connect (ui->buttonBox, SIGNAL (accepted()), this, SLOT (addBinary())); |
7dcfac8a9f17
Improved wording on the unknown version prompt, replaced the command link buttons with a more regular button box
Teemu Piippo <tsapii@utu.fi>
parents:
46
diff
changeset
|
52 | connect (ui->buttonBox, SIGNAL (rejected()), this, SLOT (reject())); |
39
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 | 55 | } |
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 | 63 | delete ui; |
64 | } | |
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 | 78 | accept(); |
79 | } | |
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 | 89 | if (path.isEmpty()) |
90 | return; | |
39
2c368cf5cc19
Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
91 | |
12 | 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(); |
39
2c368cf5cc19
Finally done with the new Zandronum version handling
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
138 | } |