config/addversionprompt.cpp

Sun, 07 Jun 2015 18:11:06 +0300

author
Teemu Piippo <tsapii@utu.fi>
date
Sun, 07 Jun 2015 18:11:06 +0300
changeset 50
5dc8b48f80b3
parent 46
07578e081ae8
child 54
0b3a5bc4e8a8
permissions
-rw-r--r--

Removed the not very useful apply button from the config window
Fixed compilation warnings under MSVC 2013

44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * ZCinema: Zandronum demo launcher
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013-2015 Teemu Piippo
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <QTableWidget>
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
20 #include <commonlib/misc.h>
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "addversionprompt.h"
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "configwindow.h"
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include "ui_addversion.h"
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 // -------------------------------------------------------------------------------------------------
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 AddVersionPrompt::AddVersionPrompt (VersionGuiEntry* entry, QWidget* parent, Qt::WindowFlags f)
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 : QDialog (parent, f),
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 ui (*new Ui_AddVersion),
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 m_entry (entry)
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 {
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 ui.setupUi (this);
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 connect (ui.buttonBox, SIGNAL (accepted()), this, SLOT (acceptPressed()));
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 connect (ui.buttonBox, SIGNAL (rejected()), this, SLOT (reject()));
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 connect (ui.findExeButton, SIGNAL (clicked()), this, SLOT (findExePath()));
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 ui.nameField->setText (entry->name);
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 ui.exePathField->setText (entry->pathItem->text());
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 ui.releaseCheckbox->setChecked (entry->isRelease);
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 }
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 // -------------------------------------------------------------------------------------------------
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 void AddVersionPrompt::acceptPressed()
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 {
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 m_entry->name = ui.nameField->text();
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 m_entry->isRelease = ui.releaseCheckbox->isChecked();
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 m_entry->labelItem->setText (m_entry->name);
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 m_entry->pathItem->setText (ui.exePathField->text());
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 accept();
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 }
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 // -------------------------------------------------------------------------------------------------
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 AddVersionPrompt::~AddVersionPrompt()
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 {
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 delete &ui;
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 }
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 // -------------------------------------------------------------------------------------------------
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 void AddVersionPrompt::findExePath()
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 {
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 QString path = getBinaryPath (this);
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 if (not path.isEmpty())
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 ui.exePathField->setText (path);
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 }
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 // -------------------------------------------------------------------------------------------------
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 //
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 VersionGuiEntry* AddVersionPrompt::getVersionInfo()
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 {
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 return m_entry;
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 }

mercurial