src-config/addversionprompt.cpp

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

mercurial