config/configwindow.cpp

changeset 54
0b3a5bc4e8a8
parent 50
5dc8b48f80b3
child 56
bdbbde5f754e
--- a/config/configwindow.cpp	Sun Jun 07 19:15:12 2015 +0300
+++ b/config/configwindow.cpp	Sun Jun 07 19:55:06 2015 +0300
@@ -18,10 +18,12 @@
 
 #include <QFileDialog>
 #include <QMessageBox>
+#include <QLabel>
 #include <commonlib/config.h>
 #include <commonlib/version.h>
 #include "addversionprompt.h"
 #include "configwindow.h"
+#include "versionguientry.h"
 #include "ui_configbox.h"
 
 //
@@ -35,6 +37,16 @@
 }
 
 //
+// -----------------------------------------------------------------------------
+//
+
+void VersionGuiEntry::setName (const QString& a)
+{
+	m_name = a;
+	m_label->setText (a);
+}
+
+//
 // -------------------------------------------------------------------------------------------------
 //
 
@@ -91,20 +103,17 @@
 
 VersionGuiEntry* ConfigWindow::addVersion (const ZandronumVersion& version)
 {
-	QTableWidgetItem* labelItem = new QTableWidgetItem (version.name);
+	QLabel* label = new QLabel (version.name);
+
 	QTableWidgetItem* pathItem = new QTableWidgetItem (version.binaryPath);
 	int rownum = ui.exePaths->rowCount();
 	ui.exePaths->setSortingEnabled (false);
 	ui.exePaths->insertRow (rownum);
-	ui.exePaths->setItem (rownum, LabelColumn, labelItem);
+	ui.exePaths->setCellWidget (rownum, LabelColumn, label);
 	ui.exePaths->setItem (rownum, PathColumn, pathItem);
 	ui.exePaths->setSortingEnabled (true);
 
-	VersionGuiEntry* entry = new VersionGuiEntry;
-	entry->isRelease = version.isRelease;
-	entry->name = version.name;
-	entry->labelItem = labelItem;
-	entry->pathItem = pathItem;
+	VersionGuiEntry* entry = new VersionGuiEntry (version.name, version.isRelease, label, pathItem);
 	m_versionEntries.append (entry);
 	m_versionEntryMap[pathItem] = entry;
 	return entry;
@@ -125,8 +134,8 @@
 		}
 	}
 
-	m_versionEntryMap.remove (entry->pathItem);
-	ui.exePaths->removeRow (entry->pathItem->row());
+	m_versionEntryMap.remove (entry->pathItem());
+	ui.exePaths->removeRow (entry->pathItem()->row());
 	delete entry;
 }
 
@@ -190,7 +199,7 @@
 
 ZandronumVersion VersionGuiEntry::toNonGuiVersion() const
 {
-	return ZandronumVersion (name, isRelease, pathItem->text());
+	return ZandronumVersion (m_name, m_isRelease, m_pathItem->text());
 }
 
 //

mercurial