--- a/QTfrontend/gamecfgwidget.cpp Tue Feb 17 12:58:08 2009 +0000
+++ b/QTfrontend/gamecfgwidget.cpp Tue Feb 17 12:58:25 2009 +0000
@@ -68,7 +68,6 @@
GBoxOptionsLayout->addWidget(L_SuddenDeath, 6, 0);
GBoxOptionsLayout->addWidget(L_CaseProb, 7, 0);
GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 8, 0);
- GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Generated Map Filter"), GBoxOptions), 9, 0);
SB_TurnTime = new QSpinBox(GBoxOptions);
SB_TurnTime->setRange(1, 99);
@@ -97,15 +96,6 @@
WeaponsName = new QComboBox(GBoxOptions);
GBoxOptionsLayout->addWidget(WeaponsName, 8, 1);
- CB_TemplateFilter = new QComboBox(GBoxOptions);
- CB_TemplateFilter->addItem(tr("All"), 0);
- CB_TemplateFilter->addItem(tr("Small"), 1);
- CB_TemplateFilter->addItem(tr("Medium"), 2);
- CB_TemplateFilter->addItem(tr("Large"), 3);
- CB_TemplateFilter->addItem(tr("Cavern"), 4);
- CB_TemplateFilter->addItem(tr("Wacky"), 5);
- GBoxOptionsLayout->addWidget(CB_TemplateFilter, 9, 1);
-
connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
connect(SB_SuddenDeath, SIGNAL(valueChanged(int)), this, SIGNAL(suddenDeathTurnsChanged(int)));
@@ -115,8 +105,6 @@
connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
connect(CB_border, SIGNAL(toggled(bool)), this, SIGNAL(borderChanged(bool)));
connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
- connect(CB_TemplateFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(templateFilterChanged(int)));
- connect(CB_TemplateFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(templateFilterChanged(int)));
connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SIGNAL(seedChanged(const QString &)));
connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SIGNAL(mapChanged(const QString &)));
@@ -174,11 +162,6 @@
return SB_CaseProb->value();
}
-quint32 GameCFGWidget::getTemplateFilter() const
-{
- return CB_TemplateFilter->itemData(CB_TemplateFilter->currentIndex()).toInt();
-}
-
QStringList GameCFGWidget::getFullConfig() const
{
QStringList sl;
@@ -187,7 +170,7 @@
sl.append(QString("e$turntime %1").arg(getTurnTime() * 1000));
sl.append(QString("e$sd_turns %1").arg(getSuddenDeathTurns()));
sl.append(QString("e$casefreq %1").arg(getCaseProbability()));
- sl.append(QString("e$template_filter %1").arg(getTemplateFilter()));
+ sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()));
QString currentMap = getCurrentMap();
if (currentMap.size() > 0)
@@ -266,17 +249,6 @@
}
}
-void GameCFGWidget::setTemplateFilter(int filter)
-{
- CB_TemplateFilter->setCurrentIndex(filter);
-}
-
-void GameCFGWidget::templateFilterChanged(int filter)
-{
- pMapContainer->setTemplateFilter(filter);
- emit newTemplateFilter(filter);
-}
-
void GameCFGWidget::ammoChanged(int index)
{
if (index >= 0)
--- a/QTfrontend/gamecfgwidget.h Tue Feb 17 12:58:08 2009 +0000
+++ b/QTfrontend/gamecfgwidget.h Tue Feb 17 12:58:25 2009 +0000
@@ -66,10 +66,9 @@
quint32 getTurnTime() const;
quint32 getSuddenDeathTurns() const;
quint32 getCaseProbability() const;
- quint32 getTemplateFilter() const;
QStringList getFullConfig() const;
-
QComboBox* WeaponsName;
+ HWMapContainer* pMapContainer;
public slots:
void setSeed(const QString & seed);
@@ -84,7 +83,6 @@
void setSolid(bool value);
void setBorder(bool value);
void setNetAmmo(const QString& name, const QString& ammo);
- void setTemplateFilter(int filter);
signals:
void seedChanged(const QString & seed);
@@ -99,11 +97,9 @@
void solidChanged(bool value);
void borderChanged(bool value);
void newWeaponScheme(const QString & name, const QString & ammo);
- void newTemplateFilter(int filter);
private slots:
void ammoChanged(int index);
- void templateFilterChanged(int filter);
private:
QCheckBox * CB_mode_Forts;
@@ -111,11 +107,9 @@
QCheckBox * CB_solid;
QCheckBox * CB_border;
QGridLayout mainLayout;
- HWMapContainer* pMapContainer;
QSpinBox * SB_TurnTime;
QSpinBox * SB_InitHealth;
QSpinBox * SB_SuddenDeath;
- QComboBox* CB_TemplateFilter;
FreqSpinBox * SB_CaseProb;
QLabel * L_TurnTime;
QLabel * L_InitHealth;
--- a/QTfrontend/hwform.cpp Tue Feb 17 12:58:08 2009 +0000
+++ b/QTfrontend/hwform.cpp Tue Feb 17 12:58:25 2009 +0000
@@ -537,7 +537,7 @@
connect(ui.pageNetGame->pGameCFG, SIGNAL(borderChanged(bool)), hwnet, SLOT(onBorderChanged(bool)));
connect(ui.pageNetGame->pGameCFG, SIGNAL(newWeaponScheme(const QString &, const QString &)),
hwnet, SLOT(onWeaponsNameChanged(const QString &, const QString &)));
- connect(ui.pageNetGame->pGameCFG, SIGNAL(newTemplateFilter(int)), hwnet, SLOT(onTemplateFilterChanged(int)));
+ connect(ui.pageNetGame->pGameCFG->pMapContainer, SIGNAL(newTemplateFilter(int)), hwnet, SLOT(onTemplateFilterChanged(int)));
connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()), Qt::QueuedConnection);
connect(hwnet, SIGNAL(seedChanged(const QString &)), ui.pageNetGame->pGameCFG, SLOT(setSeed(const QString &)));
@@ -556,7 +556,7 @@
connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)));
connect(hwnet, SIGNAL(ammoChanged(const QString&, const QString&)), ui.pageNetGame->pGameCFG, SLOT(setNetAmmo(const QString&, const QString&)));
- connect(hwnet, SIGNAL(templateFilterChanged(int)), ui.pageNetGame->pGameCFG, SLOT(setTemplateFilter(int)));
+ connect(hwnet, SIGNAL(templateFilterChanged(int)), ui.pageNetGame->pGameCFG->pMapContainer, SLOT(setTemplateFilter(int)));
hwnet->Connect(hostName, port, nick);
}
--- a/QTfrontend/mapContainer.cpp Tue Feb 17 12:58:08 2009 +0000
+++ b/QTfrontend/mapContainer.cpp Tue Feb 17 12:58:25 2009 +0000
@@ -90,12 +90,26 @@
QLabel * lblMap = new QLabel(tr("Map"), this);
mainLayout.addWidget(lblMap, 1, 0);
+ lblFilter = new QLabel(tr("Filter"), this);
+ mainLayout.addWidget(lblFilter, 2, 0);
+
+ CB_TemplateFilter = new QComboBox(this);
+ CB_TemplateFilter->addItem(tr("All"), 0);
+ CB_TemplateFilter->addItem(tr("Small"), 1);
+ CB_TemplateFilter->addItem(tr("Medium"), 2);
+ CB_TemplateFilter->addItem(tr("Large"), 3);
+ CB_TemplateFilter->addItem(tr("Cavern"), 4);
+ CB_TemplateFilter->addItem(tr("Wacky"), 5);
+ mainLayout.addWidget(CB_TemplateFilter, 2, 1);
+
+ connect(CB_TemplateFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(templateFilterChanged(int)));
+
gbThemes = new IconedGroupBox(this);
gbThemes->setTitleTextPadding(60);
gbThemes->setTitle(tr("Themes"));
//gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon
- mainLayout.addWidget(gbThemes, 0, 2, 2, 1);
+ mainLayout.addWidget(gbThemes, 0, 2, 3, 1);
QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes);
gbTLayout->setContentsMargins(0, 0, 0 ,0);
@@ -110,7 +124,21 @@
lwThemes->addItem(lwi);
}
connect(lwThemes, SIGNAL(currentRowChanged(int)), this, SLOT(themeSelected(int)));
-
+
+ // override default style to tighten up theme scroller
+ lwThemes->setStyleSheet(QString(
+ "QListWidget{"
+ "border: solid;"
+ "border-width: 0px;"
+ "border-radius: 0px;"
+ "border-color: transparent;"
+ "background-color: #0d0544;"
+ "color: #ffcc00;"
+ "font: bold 14px;"
+ "}"
+ )
+ );
+
gbTLayout->addWidget(lwThemes);
lwThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
@@ -151,12 +179,16 @@
if(!index) {
changeImage();
gbThemes->show();
+ lblFilter->show();
+ CB_TemplateFilter->show();
emit mapChanged("+rnd+");
emit themeChanged(chooseMap->itemData(0).toString());
} else
{
loadMap(index);
gbThemes->hide();
+ lblFilter->hide();
+ CB_TemplateFilter->hide();
emit mapChanged(chooseMap->currentText());
}
}
@@ -199,7 +231,7 @@
pMap = new HWMap();
connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int)));
- pMap->getImage(m_seed.toStdString(), templateFilter);
+ pMap->getImage(m_seed.toStdString(), getTemplateFilter());
}
void HWMapContainer::themeSelected(int currentRow)
@@ -234,6 +266,11 @@
return hhLimit;
}
+quint32 HWMapContainer::getTemplateFilter() const
+{
+ return CB_TemplateFilter->itemData(CB_TemplateFilter->currentIndex()).toInt();
+}
+
void HWMapContainer::resizeEvent ( QResizeEvent * event )
{
//imageButt->setIconSize(imageButt->size());
@@ -288,5 +325,12 @@
void HWMapContainer::setTemplateFilter(int filter)
{
- templateFilter = filter;
+ CB_TemplateFilter->setCurrentIndex(filter);
}
+
+void HWMapContainer::templateFilterChanged(int filter)
+{
+ changeImage();
+ emit newTemplateFilter(filter);
+}
+
--- a/QTfrontend/mapContainer.h Tue Feb 17 12:58:08 2009 +0000
+++ b/QTfrontend/mapContainer.h Tue Feb 17 12:58:25 2009 +0000
@@ -22,6 +22,7 @@
#include <QWidget>
#include <QGridLayout>
#include <QComboBox>
+#include <QLabel>
#include "hwmap.h"
@@ -43,6 +44,7 @@
QString getCurrentMap() const;
QString getCurrentTheme() const;
int getCurrentHHLimit() const;
+ quint32 getTemplateFilter() const;
public slots:
void changeImage();
@@ -55,6 +57,7 @@
void seedChanged(const QString & seed);
void mapChanged(const QString & map);
void themeChanged(const QString & theme);
+ void newTemplateFilter(int filter);
private slots:
@@ -65,6 +68,7 @@
void setRandomTheme();
void themeSelected(int currentRow);
void addInfoToPreview(QPixmap image);
+ void templateFilterChanged(int filter);
protected:
virtual void resizeEvent ( QResizeEvent * event );
@@ -80,6 +84,8 @@
int hhLimit;
int templateFilter;
QPixmap hhSmall;
+ QLabel* lblFilter;
+ QComboBox* CB_TemplateFilter;
void loadMap(int index);
};
--- a/QTfrontend/newnetclient.cpp Tue Feb 17 12:58:08 2009 +0000
+++ b/QTfrontend/newnetclient.cpp Tue Feb 17 12:58:25 2009 +0000
@@ -581,7 +581,7 @@
m_pGameCFGWidget->WeaponsName->currentIndex()
).toString();
onWeaponsNameChanged(name, ammo);
- onTemplateFilterChanged(m_pGameCFGWidget->getTemplateFilter());
+ onTemplateFilterChanged(m_pGameCFGWidget->pMapContainer->getTemplateFilter());
}
void HWNewNet::RunGame()