src/prompts.cpp

Sun, 11 Aug 2013 13:33:57 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sun, 11 Aug 2013 13:33:57 +0300
changeset 16
a8c78391e414
parent 13
9bdddd2ccde6
child 20
a5457405cc9b
permissions
-rw-r--r--

Only add 'widgets' to QT in the project file in Qt5 - Qt4 doesn't have it and using it results in a warning.

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
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include "prompts.h"
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "ui_unknownversion.h"
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "misc.h"
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "build/moc_prompts.cpp"
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include "config.h"
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 // =============================================================================
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 // -----------------------------------------------------------------------------
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 UnknownVersionPrompt::UnknownVersionPrompt (
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 str fileName,
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 str binaryName,
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 bool isRelease,
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 QWidget* parent,
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 Qt::WindowFlags f
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 ) :
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 QDialog (parent, f),
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 m_binaryString (binaryName),
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 m_isRelease (isRelease)
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 {
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 ui = new Ui_UnknownVersion;
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 ui->setupUi (this);
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 // Replace the placeholders
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 str text = ui->m_description->text();
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 text.replace ("<DEMO>", basename (fileName));
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 text.replace ("<VERSION>", binaryName);
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 ui->m_description->setText (text);
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 connect (ui->m_addVersion, SIGNAL (clicked(bool)), this, SLOT (addBinary()));
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 connect (ui->m_findBinary, SIGNAL (clicked(bool)), this, SLOT (findBinary()));
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 }
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 // =============================================================================
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 // -----------------------------------------------------------------------------
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 UnknownVersionPrompt::~UnknownVersionPrompt() {
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 delete ui;
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
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 // =============================================================================
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 // -----------------------------------------------------------------------------
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 void UnknownVersionPrompt::addBinary() {
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 addVersion (m_binaryString, m_isRelease, ui->m_binaryPath->text());
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 accept();
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 }
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63
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 // -----------------------------------------------------------------------------
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 void UnknownVersionPrompt::findBinary() {
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 str path = ConfigBox::getBinaryPath (this);
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 if (path.isEmpty())
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 return;
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 ui->m_binaryPath->setText (path);
755bd43b2f9b added missing files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 }

mercurial