16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 */ |
17 */ |
18 |
18 |
19 #include <QFileDialog> |
19 #include <QFileDialog> |
20 #include <QMessageBox> |
20 #include <QMessageBox> |
|
21 #include <QLabel> |
21 #include <commonlib/config.h> |
22 #include <commonlib/config.h> |
22 #include <commonlib/version.h> |
23 #include <commonlib/version.h> |
23 #include "addversionprompt.h" |
24 #include "addversionprompt.h" |
24 #include "configwindow.h" |
25 #include "configwindow.h" |
|
26 #include "versionguientry.h" |
25 #include "ui_configbox.h" |
27 #include "ui_configbox.h" |
26 |
28 |
27 // |
29 // |
28 // ----------------------------------------------------------------------------- |
30 // ----------------------------------------------------------------------------- |
29 // |
31 // |
30 |
32 |
31 bool confirm (const QString& text) |
33 bool confirm (const QString& text) |
32 { |
34 { |
33 return QMessageBox::question (NULL, QObject::tr ("Confirm"), text, |
35 return QMessageBox::question (NULL, QObject::tr ("Confirm"), text, |
34 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::No; |
36 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::No; |
|
37 } |
|
38 |
|
39 // |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 |
|
43 void VersionGuiEntry::setName (const QString& a) |
|
44 { |
|
45 m_name = a; |
|
46 m_label->setText (a); |
35 } |
47 } |
36 |
48 |
37 // |
49 // |
38 // ------------------------------------------------------------------------------------------------- |
50 // ------------------------------------------------------------------------------------------------- |
39 // |
51 // |
89 // ------------------------------------------------------------------------------------------------- |
101 // ------------------------------------------------------------------------------------------------- |
90 // |
102 // |
91 |
103 |
92 VersionGuiEntry* ConfigWindow::addVersion (const ZandronumVersion& version) |
104 VersionGuiEntry* ConfigWindow::addVersion (const ZandronumVersion& version) |
93 { |
105 { |
94 QTableWidgetItem* labelItem = new QTableWidgetItem (version.name); |
106 QLabel* label = new QLabel (version.name); |
|
107 |
95 QTableWidgetItem* pathItem = new QTableWidgetItem (version.binaryPath); |
108 QTableWidgetItem* pathItem = new QTableWidgetItem (version.binaryPath); |
96 int rownum = ui.exePaths->rowCount(); |
109 int rownum = ui.exePaths->rowCount(); |
97 ui.exePaths->setSortingEnabled (false); |
110 ui.exePaths->setSortingEnabled (false); |
98 ui.exePaths->insertRow (rownum); |
111 ui.exePaths->insertRow (rownum); |
99 ui.exePaths->setItem (rownum, LabelColumn, labelItem); |
112 ui.exePaths->setCellWidget (rownum, LabelColumn, label); |
100 ui.exePaths->setItem (rownum, PathColumn, pathItem); |
113 ui.exePaths->setItem (rownum, PathColumn, pathItem); |
101 ui.exePaths->setSortingEnabled (true); |
114 ui.exePaths->setSortingEnabled (true); |
102 |
115 |
103 VersionGuiEntry* entry = new VersionGuiEntry; |
116 VersionGuiEntry* entry = new VersionGuiEntry (version.name, version.isRelease, label, pathItem); |
104 entry->isRelease = version.isRelease; |
|
105 entry->name = version.name; |
|
106 entry->labelItem = labelItem; |
|
107 entry->pathItem = pathItem; |
|
108 m_versionEntries.append (entry); |
117 m_versionEntries.append (entry); |
109 m_versionEntryMap[pathItem] = entry; |
118 m_versionEntryMap[pathItem] = entry; |
110 return entry; |
119 return entry; |
111 } |
120 } |
112 |
121 |
188 // ------------------------------------------------------------------------------------------------- |
197 // ------------------------------------------------------------------------------------------------- |
189 // |
198 // |
190 |
199 |
191 ZandronumVersion VersionGuiEntry::toNonGuiVersion() const |
200 ZandronumVersion VersionGuiEntry::toNonGuiVersion() const |
192 { |
201 { |
193 return ZandronumVersion (name, isRelease, pathItem->text()); |
202 return ZandronumVersion (m_name, m_isRelease, m_pathItem->text()); |
194 } |
203 } |
195 |
204 |
196 // |
205 // |
197 // ------------------------------------------------------------------------------------------------- |
206 // ------------------------------------------------------------------------------------------------- |
198 // |
207 // |