Author: cazfi Date: Wed Sep 7 18:39:33 2016 New Revision: 33766 URL: http://svn.gna.org/viewcvs/freeciv?rev=33766&view=rev Log: Added button to edit building's requirements to ruledit.
See patch #7651 Modified: trunk/tools/ruledit/tab_building.cpp trunk/tools/ruledit/tab_building.h trunk/tools/ruledit/tab_gov.cpp Modified: trunk/tools/ruledit/tab_building.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_building.cpp?rev=33766&r1=33765&r2=33766&view=diff ============================================================================== --- trunk/tools/ruledit/tab_building.cpp (original) +++ trunk/tools/ruledit/tab_building.cpp Wed Sep 7 18:39:33 2016 @@ -33,6 +33,7 @@ #include "improvement.h" // ruledit +#include "req_edit.h" #include "ruledit.h" #include "ruledit_qt.h" #include "validity.h" @@ -49,6 +50,7 @@ QLabel *label; QPushButton *add_button; QPushButton *delete_button; + QPushButton *reqs_button; ui = ui_in; selected = 0; @@ -79,14 +81,19 @@ bldg_layout->addWidget(same_name, 1, 1); bldg_layout->addWidget(name, 1, 2); + reqs_button = new QPushButton(QString::fromUtf8(R__("Requirements")), this); + connect(reqs_button, SIGNAL(pressed()), this, SLOT(edit_reqs())); + bldg_layout->addWidget(reqs_button, 2, 2); + show_experimental(reqs_button); + add_button = new QPushButton(QString::fromUtf8(R__("Add Building")), this); connect(add_button, SIGNAL(pressed()), this, SLOT(add_now2())); - bldg_layout->addWidget(add_button, 5, 0); + bldg_layout->addWidget(add_button, 3, 0); show_experimental(add_button); delete_button = new QPushButton(QString::fromUtf8(R__("Remove this Building")), this); connect(delete_button, SIGNAL(pressed()), this, SLOT(delete_now())); - bldg_layout->addWidget(delete_button, 5, 2); + bldg_layout->addWidget(delete_button, 3, 2); show_experimental(delete_button); refresh(); @@ -258,3 +265,16 @@ name->setText(rname->text()); } } + +/************************************************************************** + User wants to edit reqs +**************************************************************************/ +void tab_building::edit_reqs() +{ + if (selected != nullptr) { + req_edit *redit = new req_edit(ui, QString::fromUtf8(improvement_rule_name(selected)), + &selected->reqs); + + redit->show(); + } +} Modified: trunk/tools/ruledit/tab_building.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_building.h?rev=33766&r1=33765&r2=33766&view=diff ============================================================================== --- trunk/tools/ruledit/tab_building.h (original) +++ trunk/tools/ruledit/tab_building.h Wed Sep 7 18:39:33 2016 @@ -53,6 +53,7 @@ void add_now2(); // "2" in name to workaround segfault on program start. Due to compiler bug? void delete_now(); void same_name_toggle(bool checked); + void edit_reqs(); }; Modified: trunk/tools/ruledit/tab_gov.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_gov.cpp?rev=33766&r1=33765&r2=33766&view=diff ============================================================================== --- trunk/tools/ruledit/tab_gov.cpp (original) +++ trunk/tools/ruledit/tab_gov.cpp Wed Sep 7 18:39:33 2016 @@ -88,12 +88,12 @@ add_button = new QPushButton(QString::fromUtf8(R__("Add Government")), this); connect(add_button, SIGNAL(pressed()), this, SLOT(add_now())); - gov_layout->addWidget(add_button, 5, 0); + gov_layout->addWidget(add_button, 3, 0); show_experimental(add_button); delete_button = new QPushButton(QString::fromUtf8(R__("Remove this Government")), this); connect(delete_button, SIGNAL(pressed()), this, SLOT(delete_now())); - gov_layout->addWidget(delete_button, 5, 2); + gov_layout->addWidget(delete_button, 3, 2); show_experimental(delete_button); refresh(); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits