From 0aff42c0b854ab917cacb8b996a96723a5321dfd Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 8 Jun 2021 04:26:22 +0300 Subject: [PATCH 56/56] Ruledit: Add support for improvement upkeep editing See osdn #42487 Signed-off-by: Marko Lindqvist --- tools/ruledit/edit_impr.cpp | 27 +++++++++++++++++++++++++-- tools/ruledit/edit_impr.h | 2 ++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tools/ruledit/edit_impr.cpp b/tools/ruledit/edit_impr.cpp index 4e5e3ce7d9..e574f081b1 100644 --- a/tools/ruledit/edit_impr.cpp +++ b/tools/ruledit/edit_impr.cpp @@ -37,6 +37,7 @@ edit_impr::edit_impr(ruledit_gui *ui_in, struct impr_type *impr_in) : QDialog() QVBoxLayout *main_layout = new QVBoxLayout(this); QGridLayout *impr_layout = new QGridLayout(); QLabel *label; + int row; ui = ui_in; impr = impr_in; @@ -50,8 +51,19 @@ edit_impr::edit_impr(ruledit_gui *ui_in, struct impr_type *impr_in) : QDialog() bcost->setRange(0, 10000); connect(bcost, SIGNAL(valueChanged(int)), this, SLOT(set_bcost_value(int))); - impr_layout->addWidget(label, 0, 0); - impr_layout->addWidget(bcost, 0, 2); + row = 0; + impr_layout->addWidget(label, row, 0); + impr_layout->addWidget(bcost, row++, 2); + + label = new QLabel(QString::fromUtf8(R__("Upkeep"))); + label->setParent(this); + + upkeep = new QSpinBox(this); + upkeep->setRange(0, 1000); + connect(upkeep, SIGNAL(valueChanged(int)), this, SLOT(set_upkeep_value(int))); + + impr_layout->addWidget(label, row, 0); + impr_layout->addWidget(upkeep, row++, 2); refresh(); @@ -74,6 +86,7 @@ void edit_impr::closeEvent(QCloseEvent *cevent) void edit_impr::refresh() { bcost->setValue(impr->build_cost); + upkeep->setValue(impr->upkeep); } /**********************************************************************//** @@ -85,3 +98,13 @@ void edit_impr::set_bcost_value(int value) refresh(); } + +/**********************************************************************//** + Read upkeep value from spinbox +**************************************************************************/ +void edit_impr::set_upkeep_value(int value) +{ + impr->upkeep = value; + + refresh(); +} diff --git a/tools/ruledit/edit_impr.h b/tools/ruledit/edit_impr.h index ba8f3dd640..ce56686e6b 100644 --- a/tools/ruledit/edit_impr.h +++ b/tools/ruledit/edit_impr.h @@ -36,12 +36,14 @@ class edit_impr : public QDialog ruledit_gui *ui; struct impr_type *impr; QSpinBox *bcost; + QSpinBox *upkeep; protected: void closeEvent(QCloseEvent *cevent); private slots: void set_bcost_value(int value); + void set_upkeep_value(int value); }; -- 2.30.2