--- a/QTfrontend/ammoSchemeModel.cpp Thu Mar 12 20:29:01 2009 +0000
+++ b/QTfrontend/ammoSchemeModel.cpp Fri Mar 13 18:04:44 2009 +0000
@@ -25,10 +25,10 @@
{
defaultScheme
<< "Default" // name
- << "0" // fortsmode
- << "0" // team divide
- << "0" // solid land
- << "0" // border
+ << "false" // fortsmode
+ << "false" // team divide
+ << "false" // solid land
+ << "false" // border
<< "45" // turn time
<< "101" // init health
<< "15" // sudden death
@@ -85,7 +85,10 @@
{
beginInsertRows(parent, row, row);
- schemes.insert(row, defaultScheme);
+ QStringList newScheme = defaultScheme;
+ newScheme[0] = tr("new");
+
+ schemes.insert(row, newScheme);
endInsertRows();
}
@@ -104,7 +107,8 @@
if (!index.isValid() || index.row() < 0
|| index.row() >= schemes.size()
|| index.column() >= defaultScheme.size()
- || role != Qt::DisplayRole)
+ || (role != Qt::EditRole && role != Qt::DisplayRole)
+ )
return QVariant();
return QVariant::fromValue(schemes[index.row()][index.column()]);
--- a/QTfrontend/pages.cpp Thu Mar 12 20:29:01 2009 +0000
+++ b/QTfrontend/pages.cpp Fri Mar 13 18:04:44 2009 +0000
@@ -898,9 +898,15 @@
mapper = new QDataWidgetMapper(this);
BtnBack = addButton(":/res/Exit.png", pageLayout, 10, 0, true);
- BtnSave = addButton(":/res/Save.png", pageLayout, 10, 2, true);
+ BtnNew = addButton(tr("New"), pageLayout, 10, 1);
+ BtnPrev = addButton(tr("Prev"), pageLayout, 10, 2);
+ BtnNext = addButton(tr("Next"), pageLayout, 10, 3);
+ BtnSave = addButton(":/res/Save.png", pageLayout, 10, 4, true);
connect(BtnSave, SIGNAL(clicked()), mapper, SLOT(toFirst()));
+ connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow()));
+ connect(BtnPrev, SIGNAL(clicked()), mapper, SLOT(toPrevious()));
+ connect(BtnNext, SIGNAL(clicked()), mapper, SLOT(toNext()));
}
void PageScheme::setModel(QAbstractItemModel * model)
@@ -919,3 +925,10 @@
mapper->toFirst();
}
+
+void PageScheme::newRow()
+{
+ QAbstractItemModel * model = mapper->model();
+ model->insertRow(model->rowCount());
+ mapper->toLast();
+}
--- a/QTfrontend/pages.h Thu Mar 12 20:29:01 2009 +0000
+++ b/QTfrontend/pages.h Fri Mar 13 18:04:44 2009 +0000
@@ -408,6 +408,9 @@
PageScheme(QWidget* parent = 0);
QPushButton * BtnBack;
+ QPushButton * BtnNew;
+ QPushButton * BtnPrev;
+ QPushButton * BtnNext;
QPushButton * BtnSave;
void setModel(QAbstractItemModel * model);
@@ -423,6 +426,9 @@
QSpinBox * SB_SuddenDeath;
FreqSpinBox * SB_CaseProb;
QLineEdit * LE_name;
+
+private slots:
+ void newRow();
};
#endif // PAGES_H