Sun, 11 Aug 2013 14:04:03 +0300
Replaced the Bytestream class with QDataStream
13
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
1 | /* |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
2 | * ZanDemo: Zandronum demo launcher |
9bdddd2ccde6
now with 3691% extra legalese!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
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 | |
12 | 19 | #include "prompts.h" |
20 | #include "ui_unknownversion.h" | |
21 | #include "misc.h" | |
22 | #include "build/moc_prompts.cpp" | |
23 | #include "config.h" | |
24 | ||
25 | // ============================================================================= | |
26 | // ----------------------------------------------------------------------------- | |
27 | UnknownVersionPrompt::UnknownVersionPrompt ( | |
28 | str fileName, | |
29 | str binaryName, | |
30 | bool isRelease, | |
31 | QWidget* parent, | |
32 | Qt::WindowFlags f | |
33 | ) : | |
34 | QDialog (parent, f), | |
35 | m_binaryString (binaryName), | |
36 | m_isRelease (isRelease) | |
37 | { | |
38 | ui = new Ui_UnknownVersion; | |
39 | ui->setupUi (this); | |
40 | ||
41 | // Replace the placeholders | |
42 | str text = ui->m_description->text(); | |
43 | text.replace ("<DEMO>", basename (fileName)); | |
44 | text.replace ("<VERSION>", binaryName); | |
45 | ui->m_description->setText (text); | |
46 | ||
47 | connect (ui->m_addVersion, SIGNAL (clicked(bool)), this, SLOT (addBinary())); | |
48 | connect (ui->m_findBinary, SIGNAL (clicked(bool)), this, SLOT (findBinary())); | |
49 | } | |
50 | ||
51 | // ============================================================================= | |
52 | // ----------------------------------------------------------------------------- | |
53 | UnknownVersionPrompt::~UnknownVersionPrompt() { | |
54 | delete ui; | |
55 | } | |
56 | ||
57 | // ============================================================================= | |
58 | // ----------------------------------------------------------------------------- | |
59 | void UnknownVersionPrompt::addBinary() { | |
60 | addVersion (m_binaryString, m_isRelease, ui->m_binaryPath->text()); | |
61 | accept(); | |
62 | } | |
63 | ||
64 | // ============================================================================= | |
65 | // ----------------------------------------------------------------------------- | |
66 | void UnknownVersionPrompt::findBinary() { | |
67 | str path = ConfigBox::getBinaryPath (this); | |
68 | ||
69 | if (path.isEmpty()) | |
70 | return; | |
71 | ||
72 | ui->m_binaryPath->setText (path); | |
73 | } |