src/prompts.cpp

changeset 37
c82a86ea87be
parent 36
b8fa9171be6e
child 39
2c368cf5cc19
equal deleted inserted replaced
36:b8fa9171be6e 37:c82a86ea87be
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.
24 #include <QFileDialog> 24 #include <QFileDialog>
25 25
26 // ============================================================================= 26 // =============================================================================
27 // ----------------------------------------------------------------------------- 27 // -----------------------------------------------------------------------------
28 UnknownVersionPrompt::UnknownVersionPrompt ( 28 UnknownVersionPrompt::UnknownVersionPrompt (
29 str fileName, 29 QString fileName,
30 str binaryName, 30 QString binaryName,
31 bool isRelease, 31 bool isRelease,
32 QWidget* parent, 32 QWidget* parent,
33 Qt::WindowFlags f 33 Qt::WindowFlags f
34 ) : 34 ) :
35 QDialog (parent, f), 35 QDialog (parent, f),
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 }

mercurial