tweak interface, there is no need to manually add new weapons and schemes to the filter list
--- a/QTfrontend/ammoSchemeModel.cpp Wed Nov 10 00:56:21 2010 +0100
+++ b/QTfrontend/ammoSchemeModel.cpp Wed Nov 10 03:08:14 2010 +0100
@@ -64,8 +64,7 @@
QAbstractTableModel(parent),
fileConfig(fileName, QSettings::IniFormat)
{
- QStringList predefSchemesNames;
- predefSchemesNames
+ predefSchemesNames = QStringList()
<< "Default"
<< "Pro Mode"
<< "Shoppa"
@@ -472,7 +471,7 @@
QList<QVariant> kingmode;
kingmode
- << predefSchemesNames[10] // name 0
+ << predefSchemesNames[10] // name 0
<< QVariant(false) // fortsmode 1
<< QVariant(false) // team divide 2
<< QVariant(false) // solid land 3
--- a/QTfrontend/ammoSchemeModel.h Wed Nov 10 00:56:21 2010 +0100
+++ b/QTfrontend/ammoSchemeModel.h Wed Nov 10 03:08:14 2010 +0100
@@ -41,6 +41,7 @@
QVariant data(const QModelIndex &index, int role) const;
int numberOfDefaultSchemes;
+ QStringList predefSchemesNames;
public slots:
void Save();
--- a/QTfrontend/hwform.cpp Wed Nov 10 00:56:21 2010 +0100
+++ b/QTfrontend/hwform.cpp Wed Nov 10 03:08:14 2010 +0100
@@ -141,7 +141,9 @@
connect(ui.pageOptions->BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(DeleteTeam()));
connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions()));
connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack()));
+#ifndef __APPLE__
connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
+#endif
connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
@@ -1133,7 +1135,7 @@
registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\"");
#elif defined __APPLE__
success = false;
- // TODO; also reenable button in pages.cpp
+ // TODO; also enable button in pages.cpp and signal in hwform.cpp
#else
// this is a little silly due to all the system commands below anyway - just use mkdir -p ? Does have the advantage of the alert I guess
if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
--- a/QTfrontend/pages.cpp Wed Nov 10 00:56:21 2010 +0100
+++ b/QTfrontend/pages.cpp Wed Nov 10 03:08:14 2010 +0100
@@ -1120,13 +1120,10 @@
ruleLabel->setText(tr("Rules:"));
CBRules = new QComboBox(this);
CBRules->addItem(QComboBox::tr("Any"));
- CBRules->addItem("Default");
- CBRules->addItem("Pro mode");
- CBRules->addItem("Shoppa");
- CBRules->addItem("Clean Slate");
- CBRules->addItem("Minefield");
- CBRules->addItem("Barrel mayhem");
- CBRules->addItem("Tunnel hogs");
+ // not the most elegant solution but it works
+ ammoSchemeModel = new AmmoSchemeModel(this, NULL);
+ for (int i = 0; i < ammoSchemeModel->predefSchemesNames.count(); i++)
+ CBRules->addItem(ammoSchemeModel->predefSchemesNames.at(i).toAscii().constData());
filterLayout->addWidget(ruleLabel);
filterLayout->addWidget(CBRules);
filterLayout->addSpacing(30);
@@ -1135,12 +1132,10 @@
weaponLabel->setText(tr("Weapons:"));
CBWeapons = new QComboBox(this);
CBWeapons->addItem(QComboBox::tr("Any"));
- CBWeapons->addItem("Clean Slate");
- CBWeapons->addItem("Crazy");
- CBWeapons->addItem("Default");
- CBWeapons->addItem("Minefield");
- CBWeapons->addItem("Pro mode");
- CBWeapons->addItem("Shoppa");
+ for (int i = 0; i < cDefaultAmmos.count(); i++) {
+ QPair<QString,QString> ammo = cDefaultAmmos.at(i);
+ CBWeapons->addItem(ammo.first.toAscii().constData());
+ }
filterLayout->addWidget(weaponLabel);
filterLayout->addWidget(CBWeapons);
filterLayout->addSpacing(30);
@@ -1337,12 +1332,12 @@
item->setToolTip(tr("Games may be played on precreated or randomized maps."));
roomsList->setItem(r, 4, item);
- item = new QTableWidgetItem(list[i + 6].left(20)); // selected game scheme
+ item = new QTableWidgetItem(list[i + 6].left(24)); // selected game scheme
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setToolTip(tr("The Game Scheme defines general options and preferences like Round Time, Sudden Death or Vampirism."));
roomsList->setItem(r, 5, item);
- item = new QTableWidgetItem(list[i + 7].left(20)); // selected weapon scheme
+ item = new QTableWidgetItem(list[i + 7].left(24)); // selected weapon scheme
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count."));
roomsList->setItem(r, 6, item);
--- a/QTfrontend/pages.h Wed Nov 10 00:56:21 2010 +0100
+++ b/QTfrontend/pages.h Wed Nov 10 03:08:14 2010 +0100
@@ -416,6 +416,7 @@
bool gameInLobby;
QString gameInLobbyName;
QStringList listFromServer;
+ AmmoSchemeModel * ammoSchemeModel;
public slots:
void setRoomsList(const QStringList & list);