# HG changeset patch # User unc0rr # Date 1218722685 0 # Node ID bfed1b89bc8541b8418548c1e6723035b50ea1e0 # Parent 7f6cb1d7be2ae8bea686555437c19b4224b278ef Add themes list to map selection widget diff -r 7f6cb1d7be2a -r bfed1b89bc85 QTfrontend/hwconsts.cpp.in --- 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"); diff -r 7f6cb1d7be2a -r bfed1b89bc85 QTfrontend/hwconsts.h --- 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; diff -r 7f6cb1d7be2a -r bfed1b89bc85 QTfrontend/main.cpp --- 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(); diff -r 7f6cb1d7be2a -r bfed1b89bc85 QTfrontend/mapContainer.cpp --- 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); diff -r 7f6cb1d7be2a -r bfed1b89bc85 QTfrontend/mapContainer.h --- 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 #include #include +#include "hwmap.h" + class QPushButton; class IconedGroupBox; class QListWidget;