| 1 /* |
1 /* |
| 2 * ZCinema: Zandronum demo launcher |
2 * ZCinema: Zandronum demo launcher |
| 3 * Copyright (C) 2013 Santeri Piippo |
3 * Copyright (C) 2013-2015 Teemu Piippo |
| 4 * |
4 * |
| 5 * This program is free software: you can redistribute it and/or modify |
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 |
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 |
7 * the Free Software Foundation, either version 3 of the License, or |
| 8 * (at your option) any later version. |
8 * (at your option) any later version. |
| 38 { |
38 { |
| 39 ui = new Ui_UnknownVersion; |
39 ui = new Ui_UnknownVersion; |
| 40 ui->setupUi (this); |
40 ui->setupUi (this); |
| 41 |
41 |
| 42 // Replace the placeholders |
42 // Replace the placeholders |
| 43 str text = ui->m_description->text(); |
43 QString text = ui->m_description->text(); |
| 44 text.replace ("<DEMO>", basename (fileName)); |
44 text.replace ("<DEMO>", basename (fileName)); |
| 45 text.replace ("<VERSION>", binaryName); |
45 text.replace ("<VERSION>", binaryName); |
| 46 ui->m_description->setText (text); |
46 ui->m_description->setText (text); |
| 47 |
47 |
| 48 connect (ui->m_addVersion, SIGNAL (clicked(bool)), this, SLOT (addBinary())); |
48 connect (ui->m_addVersion, SIGNAL (clicked(bool)), this, SLOT (addBinary())); |
| 56 delete ui; |
56 delete ui; |
| 57 } |
57 } |
| 58 |
58 |
| 59 // ============================================================================= |
59 // ============================================================================= |
| 60 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
| 61 void UnknownVersionPrompt::addBinary() { |
61 void UnknownVersionPrompt::addBinary() |
| 62 addVersion (m_binaryString, m_isRelease, ui->m_binaryPath->text()); |
62 { |
| |
63 addVersion (ZandronumVersion (m_binaryString, m_isRelease, ui->m_binaryPath->text())); |
| 63 accept(); |
64 accept(); |
| 64 } |
65 } |
| 65 |
66 |
| 66 // ============================================================================= |
67 // ============================================================================= |
| 67 // ----------------------------------------------------------------------------- |
68 // ----------------------------------------------------------------------------- |
| 68 void UnknownVersionPrompt::findBinary() { |
69 void UnknownVersionPrompt::findBinary() { |
| 69 str path = ConfigBox::getBinaryPath (this); |
70 QString path = ConfigWindow::getBinaryPath (this); |
| 70 |
71 |
| 71 if (path.isEmpty()) |
72 if (path.isEmpty()) |
| 72 return; |
73 return; |
| 73 |
74 |
| 74 ui->m_binaryPath->setText (path); |
75 ui->m_binaryPath->setText (path); |
| 93 } |
94 } |
| 94 |
95 |
| 95 // ============================================================================= |
96 // ============================================================================= |
| 96 // ----------------------------------------------------------------------------- |
97 // ----------------------------------------------------------------------------- |
| 97 void FindFilePrompt::findDemo() { |
98 void FindFilePrompt::findDemo() { |
| 98 str path = QFileDialog::getOpenFileName (this, tr ("Open Demo File"), |
99 QString path = QFileDialog::getOpenFileName (this, tr ("Open Demo File"), |
| 99 QDir::homePath(), tr ("Demo files (*.cld);;All files (*.*)")); |
100 QDir::homePath(), tr ("Demo files (*.cld);;All files (*.*)")); |
| 100 |
101 |
| 101 if (!path.isEmpty()) |
102 if (!path.isEmpty()) |
| 102 m_ui->m_path->setText (path); |
103 m_ui->m_path->setText (path); |
| 103 } |
104 } |
| 104 |
105 |
| 105 // ============================================================================= |
106 // ============================================================================= |
| 106 // ----------------------------------------------------------------------------- |
107 // ----------------------------------------------------------------------------- |
| 107 str FindFilePrompt::path() const { |
108 QString FindFilePrompt::path() const { |
| 108 return m_ui->m_path->text(); |
109 return m_ui->m_path->text(); |
| 109 } |
110 } |