|
1 #include "prompts.h" |
|
2 #include "ui_unknownversion.h" |
|
3 #include "misc.h" |
|
4 #include "build/moc_prompts.cpp" |
|
5 #include "config.h" |
|
6 |
|
7 // ============================================================================= |
|
8 // ----------------------------------------------------------------------------- |
|
9 UnknownVersionPrompt::UnknownVersionPrompt ( |
|
10 str fileName, |
|
11 str binaryName, |
|
12 bool isRelease, |
|
13 QWidget* parent, |
|
14 Qt::WindowFlags f |
|
15 ) : |
|
16 QDialog (parent, f), |
|
17 m_binaryString (binaryName), |
|
18 m_isRelease (isRelease) |
|
19 { |
|
20 ui = new Ui_UnknownVersion; |
|
21 ui->setupUi (this); |
|
22 |
|
23 // Replace the placeholders |
|
24 str text = ui->m_description->text(); |
|
25 text.replace ("<DEMO>", basename (fileName)); |
|
26 text.replace ("<VERSION>", binaryName); |
|
27 ui->m_description->setText (text); |
|
28 |
|
29 connect (ui->m_addVersion, SIGNAL (clicked(bool)), this, SLOT (addBinary())); |
|
30 connect (ui->m_findBinary, SIGNAL (clicked(bool)), this, SLOT (findBinary())); |
|
31 } |
|
32 |
|
33 // ============================================================================= |
|
34 // ----------------------------------------------------------------------------- |
|
35 UnknownVersionPrompt::~UnknownVersionPrompt() { |
|
36 delete ui; |
|
37 } |
|
38 |
|
39 // ============================================================================= |
|
40 // ----------------------------------------------------------------------------- |
|
41 void UnknownVersionPrompt::addBinary() { |
|
42 addVersion (m_binaryString, m_isRelease, ui->m_binaryPath->text()); |
|
43 accept(); |
|
44 } |
|
45 |
|
46 // ============================================================================= |
|
47 // ----------------------------------------------------------------------------- |
|
48 void UnknownVersionPrompt::findBinary() { |
|
49 str path = ConfigBox::getBinaryPath (this); |
|
50 |
|
51 if (path.isEmpty()) |
|
52 return; |
|
53 |
|
54 ui->m_binaryPath->setText (path); |
|
55 } |