Add themes list to map selection widget
authorunc0rr
Thu, 14 Aug 2008 14:04:45 +0000
changeset 1210 bfed1b89bc85
parent 1209 7f6cb1d7be2a
child 1211 94c4f20abdda
Add themes list to map selection widget
QTfrontend/hwconsts.cpp.in
QTfrontend/hwconsts.h
QTfrontend/main.cpp
QTfrontend/mapContainer.cpp
QTfrontend/mapContainer.h
--- a/QTfrontend/hwconsts.cpp.in	Thu Aug 14 13:34:44 2008 +0000
+++ b/QTfrontend/hwconsts.cpp.in	Thu Aug 14 14:04:45 2008 +0000
@@ -27,6 +27,7 @@
 QDir * datadir = new QDir();
 
 QStringList * Themes;
+QStringList * mapList;
 
 QString * cDefaultAmmoStore = new QString("eammstore 939192942219912103223511");
 
--- a/QTfrontend/hwconsts.h	Thu Aug 14 13:34:44 2008 +0000
+++ b/QTfrontend/hwconsts.h	Thu Aug 14 14:04:45 2008 +0000
@@ -30,6 +30,7 @@
 extern QDir * datadir;
 
 extern QStringList * Themes;
+extern QStringList * mapList;
 
 extern QString * cDefaultAmmoStore;
 
--- a/QTfrontend/main.cpp	Thu Aug 14 13:34:44 2008 +0000
+++ b/QTfrontend/main.cpp	Thu Aug 14 14:04:45 2008 +0000
@@ -261,6 +261,12 @@
 		QMessageBox::critical(0, "Error", "Cannot access themes.cfg", "OK");
 	}
 
+	QDir tmpdir;
+	tmpdir.cd(datadir->absolutePath());
+	tmpdir.cd("Maps");
+	tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
+	mapList = new QStringList(tmpdir.entryList(QStringList("*")));
+
 	HWForm *Form = new HWForm();
 	Form->show();
 	return app.exec();
--- a/QTfrontend/mapContainer.cpp	Thu Aug 14 13:34:44 2008 +0000
+++ b/QTfrontend/mapContainer.cpp	Thu Aug 14 14:04:45 2008 +0000
@@ -53,13 +53,8 @@
 
   chooseMap = new QComboBox(this);
   chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-  QDir tmpdir;
-  tmpdir.cd(datadir->absolutePath());
-  tmpdir.cd("Maps");
-  tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
-  QStringList mapList=tmpdir.entryList(QStringList("*"));
-  mapList.push_front(QComboBox::tr("generated map..."));
-  chooseMap->addItems(mapList);
+  chooseMap->addItem(QComboBox::tr("generated map..."));
+  chooseMap->addItems(*mapList);
   connect(chooseMap, SIGNAL(activated(int)), this, SLOT(mapChanged(int)));
   mainLayout.addWidget(chooseMap, 1, 1);
 
@@ -70,9 +65,14 @@
 	gbThemes->setTitle(tr("Themes"));
 	gbThemes->setStyleSheet("padding: 0px;");
 	mainLayout.addWidget(gbThemes, 0, 2, 2, 1);
+	
 	QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes);
 	lwThemes = new QListWidget(this);
+	lwThemes->setMinimumHeight(30);
 	lwThemes->setFixedWidth(100);
+	for (int i = 0; i < Themes->size(); ++i)
+		lwThemes->addItem(Themes->at(i));
+	
 	gbTLayout->addWidget(lwThemes);
 	lwThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
 	
--- a/QTfrontend/mapContainer.h	Thu Aug 14 13:34:44 2008 +0000
+++ b/QTfrontend/mapContainer.h	Thu Aug 14 14:04:45 2008 +0000
@@ -19,12 +19,12 @@
 #ifndef _HWMAP_CONTAINER_INCLUDED
 #define _HWMAP_CONTAINER_INCLUDED
 
-#include "hwmap.h"
-
 #include <QWidget>
 #include <QGridLayout>
 #include <QComboBox>
 
+#include "hwmap.h"
+
 class QPushButton;
 class IconedGroupBox;
 class QListWidget;