--- a/QTfrontend/ammoSchemeModel.cpp Thu Mar 12 13:55:47 2009 +0000
+++ b/QTfrontend/ammoSchemeModel.cpp Thu Mar 12 20:19:33 2009 +0000
@@ -30,7 +30,7 @@
<< "0" // solid land
<< "0" // border
<< "45" // turn time
- << "100" // init health
+ << "101" // init health
<< "15" // sudden death
<< "5" // case probability
;
@@ -107,5 +107,5 @@
|| role != Qt::DisplayRole)
return QVariant();
- return schemes[index.row()][index.column()];
+ return QVariant::fromValue(schemes[index.row()][index.column()]);
}
--- a/QTfrontend/gamecfgwidget.cpp Thu Mar 12 13:55:47 2009 +0000
+++ b/QTfrontend/gamecfgwidget.cpp Thu Mar 12 20:19:33 2009 +0000
@@ -46,8 +46,7 @@
QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions);
- QTableView * tv = new QTableView(this);
- tv->setModel(new AmmoSchemeModel);
+ tv = new QTableView(this);
GBoxOptionsLayout->addWidget(tv, 0, 0, 1, 2);
QPushButton * goToSchemePage = new QPushButton(GBoxOptions);
--- a/QTfrontend/gamecfgwidget.h Thu Mar 12 13:55:47 2009 +0000
+++ b/QTfrontend/gamecfgwidget.h Thu Mar 12 20:19:33 2009 +0000
@@ -29,6 +29,7 @@
class QCheckBox;
class QVBoxLayout;
class QLabel;
+class QTableView;
class GameCFGWidget : public QGroupBox
{
@@ -41,6 +42,7 @@
QStringList getFullConfig() const;
QComboBox * WeaponsName;
HWMapContainer* pMapContainer;
+ QTableView * tv;
public slots:
void setParam(const QString & param, const QStringList & value);
--- a/QTfrontend/hwform.cpp Thu Mar 12 13:55:47 2009 +0000
+++ b/QTfrontend/hwform.cpp Thu Mar 12 20:19:33 2009 +0000
@@ -33,6 +33,7 @@
#include <QTimer>
#include <QScrollBar>
#include <QDataWidgetMapper>
+#include <QTableView>
#include "hwform.h"
#include "game.h"
@@ -124,30 +125,34 @@
connect(ui.pageGameStats->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
- connect(ui.pageSinglePlayer->BtnSimpleGamePage, SIGNAL(clicked()), this, SLOT(SimpleGame()));
- connect(ui.pageSinglePlayer->BtnTrainPage, SIGNAL(clicked()), this, SLOT(GoToTraining()));
- connect(ui.pageSinglePlayer->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer()));
- connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves()));
- connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos()));
- connect(ui.pageSinglePlayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
+ connect(ui.pageSinglePlayer->BtnSimpleGamePage, SIGNAL(clicked()), this, SLOT(SimpleGame()));
+ connect(ui.pageSinglePlayer->BtnTrainPage, SIGNAL(clicked()), this, SLOT(GoToTraining()));
+ connect(ui.pageSinglePlayer->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer()));
+ connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves()));
+ connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos()));
+ connect(ui.pageSinglePlayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
- connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining()));
- connect(ui.pageTraining->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
+ connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining()));
+ connect(ui.pageTraining->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
- connect(ui.pageSelectWeapon->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
- connect(ui.pageSelectWeapon->BtnDefault, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(setDefault()));
- connect(ui.pageSelectWeapon->BtnSave, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(save()));
+ connect(ui.pageSelectWeapon->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
+ connect(ui.pageSelectWeapon->BtnDefault, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(setDefault()));
+ connect(ui.pageSelectWeapon->BtnSave, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(save()));
- connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
+ connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
- connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
+ connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
this, SLOT(UpdateWeapons())); // executed second
- connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
+ connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
this, SLOT(GoBack())); // executed third
+ connect(ui.pageScheme->BtnSave, SIGNAL(clicked()), this, SLOT(GoBack()));
+ connect(ui.pageScheme->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
+
AmmoSchemeModel * ammoSchemeModel = new AmmoSchemeModel(this);
- ui.pageScheme->mapper->setModel(ammoSchemeModel);
+ ui.pageScheme->setModel(ammoSchemeModel);
+ ui.pageMultiplayer->gameCFG->tv->setModel(ammoSchemeModel);
PagesStack.push(ID_PAGE_MAIN);
GoBack();
--- a/QTfrontend/pages.cpp Thu Mar 12 13:55:47 2009 +0000
+++ b/QTfrontend/pages.cpp Thu Mar 12 20:19:33 2009 +0000
@@ -896,6 +896,17 @@
pageLayout->addWidget(LE_name, 8, 1);
mapper = new QDataWidgetMapper(this);
+
+ BtnBack = addButton(":/res/Exit.png", pageLayout, 10, 0, true);
+ BtnSave = addButton(":/res/Save.png", pageLayout, 10, 2, true);
+
+ connect(BtnSave, SIGNAL(clicked()), mapper, SLOT(toFirst()));
+}
+
+void PageScheme::setModel(QAbstractItemModel * model)
+{
+ mapper->setModel(model);
+
mapper->addMapping(LE_name, 0);
mapper->addMapping(CB_mode_Forts, 1);
mapper->addMapping(CB_teamsDivide, 2);
@@ -905,4 +916,6 @@
mapper->addMapping(SB_InitHealth, 6);
mapper->addMapping(SB_SuddenDeath, 7);
mapper->addMapping(SB_CaseProb, 8);
+
+ mapper->toFirst();
}
--- a/QTfrontend/pages.h Thu Mar 12 13:55:47 2009 +0000
+++ b/QTfrontend/pages.h Thu Mar 12 20:19:33 2009 +0000
@@ -44,6 +44,7 @@
class QTableWidget;
class QAction;
class QDataWidgetMapper;
+class QAbstractItemModel;
class GameCFGWidget;
class TeamSelWidget;
@@ -406,9 +407,13 @@
public:
PageScheme(QWidget* parent = 0);
- QDataWidgetMapper * mapper;
+ QPushButton * BtnBack;
+ QPushButton * BtnSave;
+
+ void setModel(QAbstractItemModel * model);
private:
+ QDataWidgetMapper * mapper;
QCheckBox * CB_mode_Forts;
QCheckBox * CB_teamsDivide;
QCheckBox * CB_solid;