diff options
Diffstat (limited to 'sigmodr/widgets/ItemUI.cpp')
| -rw-r--r-- | sigmodr/widgets/ItemUI.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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); |
