From 8a804d5a6d657e5e53ac4a3deefc8f8516cdd026 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 5 Jun 2009 00:20:56 -0400 Subject: Fix enabling of widgets based on other widgets when initialized and places missed before --- sigmodr/widgets/ItemTypeUI.cpp | 1 + sigmodr/widgets/ItemUI.cpp | 11 +++++++++++ sigmodr/widgets/MapEffectUI.cpp | 1 + sigmodr/widgets/MapWarpUI.cpp | 1 + sigmodr/widgets/RulesUI.cpp | 11 ++++++++++- sigmodr/widgets/SpeciesUI.cpp | 4 ++++ 6 files changed, 28 insertions(+), 1 deletion(-) (limited to 'sigmodr') diff --git a/sigmodr/widgets/ItemTypeUI.cpp b/sigmodr/widgets/ItemTypeUI.cpp index c914abd6..b6532391 100644 --- a/sigmodr/widgets/ItemTypeUI.cpp +++ b/sigmodr/widgets/ItemTypeUI.cpp @@ -83,6 +83,7 @@ QWidget* ItemTypeUI::Private::makeWidgets(ObjectUI* widget) void ItemTypeUI::Private::refreshGui() { ui_maxWeight->setMaximum(m_itemType->game()->rules()->maxTotalWeight()); + ui_maxWeight->setEnabled(0 < m_itemType->game()->rules()->maxTotalWeight()); ObjectUIPrivate::refreshGui(); } diff --git a/sigmodr/widgets/ItemUI.cpp b/sigmodr/widgets/ItemUI.cpp index 200edd81..492ed120 100644 --- a/sigmodr/widgets/ItemUI.cpp +++ b/sigmodr/widgets/ItemUI.cpp @@ -94,6 +94,15 @@ QWidget* ItemUI::Private::makeWidgets(ObjectUI* widget) connect(ui_weight, SIGNAL(valueChanged(int)), this, SLOT(weightChanged(int))); connect(ui_description, SIGNAL(textChanged(QString)), this, SLOT(descriptionChanged(QString))); connect(ui_script, SIGNAL(valueChanged(Sigcore::Script)), this, SLOT(scriptChanged(Sigcore::Script))); + ui_sellPrice->setEnabled(m_item->sellable()); + if (0 <= m_item->type()) + { + const ItemType* itemType = m_item->game()->itemType(m_item->type()); + ui_weight->setMaximum(itemType->maxWeight()); + ui_weight->setEnabled(0 < itemType->maxWeight()); + } + else + ui_weight->setMaximum(INT_MAX); return form; } @@ -105,6 +114,7 @@ void ItemUI::Private::refreshGui() ui_type->addItem(m_item->game()->itemType(i)->name()); ui_type->blockSignals(blocked); ui_price->setMaximum(m_item->game()->rules()->maxMoney()); + ui_price->setEnabled(0 < m_item->game()->rules()->maxMoney()); ObjectUIPrivate::refreshGui(); } @@ -141,6 +151,7 @@ void ItemUI::Private::typeChanged(const int type) const ItemType* itemType = m_item->game()->itemType(type); m_item->setType(itemType->id()); ui_weight->setMaximum(itemType->maxWeight()); + ui_weight->setEnabled(0 < itemType->maxWeight()); } else ui_weight->setMaximum(INT_MAX); diff --git a/sigmodr/widgets/MapEffectUI.cpp b/sigmodr/widgets/MapEffectUI.cpp index 9520411d..6011e6d4 100644 --- a/sigmodr/widgets/MapEffectUI.cpp +++ b/sigmodr/widgets/MapEffectUI.cpp @@ -84,6 +84,7 @@ QWidget* MapEffectUI::Private::makeWidgets(ObjectUI* widget) connect(ui_skin, SIGNAL(currentIndexChanged(int)), this, SLOT(skinChanged(int))); connect(ui_script, SIGNAL(valueChanged(Sigcore::Script)), this, SLOT(scriptChanged(Sigcore::Script))); connect(ui_isGhost, SIGNAL(toggled(bool)), this, SLOT(isGhostChanged(bool))); + ui_skin->setEnabled(0 <= m_effect->skin()); return form; } diff --git a/sigmodr/widgets/MapWarpUI.cpp b/sigmodr/widgets/MapWarpUI.cpp index bcdd9603..79c1af2b 100644 --- a/sigmodr/widgets/MapWarpUI.cpp +++ b/sigmodr/widgets/MapWarpUI.cpp @@ -78,6 +78,7 @@ QWidget* MapWarpUI::Private::makeWidgets(ObjectUI* widget) connect(ui_toMap, SIGNAL(currentIndexChanged(int)), this, SLOT(toMapChanged(int))); connect(ui_toWarp, SIGNAL(currentIndexChanged(int)), this, SLOT(toWarpChanged(int))); connect(ui_script, SIGNAL(valueChanged(Sigcore::Script)), this, SLOT(scriptChanged(Sigcore::Script))); + ui_toWarp->setEnabled(0 <= m_warp->toMap()); return form; } diff --git a/sigmodr/widgets/RulesUI.cpp b/sigmodr/widgets/RulesUI.cpp index 058a9e90..723e0631 100644 --- a/sigmodr/widgets/RulesUI.cpp +++ b/sigmodr/widgets/RulesUI.cpp @@ -107,6 +107,14 @@ QWidget* RulesUI::Private::makeWidgets(ObjectUI* widget) connect(ui_maxStages, SIGNAL(valueChanged(int)), this, SLOT(maxStagesChanged(int))); connect(ui_maxMoney, SIGNAL(valueChanged(int)), this, SLOT(maxMoneyChanged(int))); connect(ui_maxTotalWeight, SIGNAL(valueChanged(int)), this, SLOT(maxTotalWeightChanged(int))); + ui_breeding->setEnabled(m_rules->genderAllowed()); + ui_splitSpecialDV->setEnabled(m_rules->specialSplit()); + ui_maxEV->setEnabled(m_rules->effortValuesAllowed()); + ui_maxEVPerStat->setMaximum(m_rules->maxTotalEV()); + ui_maxEVPerStat->setEnabled(m_rules->effortValuesAllowed() && (0 < m_rules->maxTotalEV())); + ui_boxSize->setEnabled(0 < m_rules->numBoxes()); + ui_maxFight->setMaximum(m_rules->maxFight()); + ui_maxFight->setEnabled(0 < m_rules->maxFight()); return form; } @@ -166,7 +174,7 @@ void RulesUI::Private::effortValuesChanged(const bool effortValues) { m_rules->setEffortValuesAllowed(effortValues); ui_maxEV->setEnabled(effortValues); - ui_maxEVPerStat->setEnabled(effortValues); + ui_maxEVPerStat->setEnabled(effortValues && (0 < m_rules->maxTotalEV())); } void RulesUI::Private::maxEVChanged(const int maxEV) @@ -196,6 +204,7 @@ void RulesUI::Private::maxPartyChanged(const int maxParty) { m_rules->setMaxParty(maxParty); ui_maxFight->setMaximum(maxParty); + ui_maxFight->setEnabled(0 < maxParty); } void RulesUI::Private::maxFightChanged(const int maxFight) diff --git a/sigmodr/widgets/SpeciesUI.cpp b/sigmodr/widgets/SpeciesUI.cpp index 59dc14bd..9e75ddd7 100644 --- a/sigmodr/widgets/SpeciesUI.cpp +++ b/sigmodr/widgets/SpeciesUI.cpp @@ -164,6 +164,10 @@ QWidget* SpeciesUI::Private::makeWidgets(ObjectUI* widget) ui_growth->addItems(Species::StyleStr); ui_baseStat->horizontalHeader()->setResizeMode(QHeaderView::Stretch); ui_effortValue->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + ui_maleFront->setEnabled(m_species->genderFactor() < 1); + ui_maleBack->setEnabled(m_species->genderFactor() < 1); + ui_femaleFront->setEnabled(0 < m_species->genderFactor()); + ui_femaleBack->setEnabled(0 < m_species->genderFactor()); return form; } -- cgit