summaryrefslogtreecommitdiffstats
path: root/sigmodr
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-07-19 13:50:43 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-07-19 13:50:43 -0400
commitdffac4ac7cb7f62619bf1d0b356b17f5791fa765 (patch)
treed7f05be81da9429e7f2d9736bae58cd0647655f8 /sigmodr
parent51f1d2c9d6c2a2b89821143de8fc3bce95d8f164 (diff)
downloadsigen-dffac4ac7cb7f62619bf1d0b356b17f5791fa765.tar.gz
sigen-dffac4ac7cb7f62619bf1d0b356b17f5791fa765.tar.xz
sigen-dffac4ac7cb7f62619bf1d0b356b17f5791fa765.zip
Remove sellable from item; set in sellPrice as -1
Diffstat (limited to 'sigmodr')
-rw-r--r--sigmodr/widgets/ItemUI.cpp14
-rw-r--r--sigmodr/widgets/ItemUI_p.h3
-rw-r--r--sigmodr/widgets/gui/item.ui89
3 files changed, 29 insertions, 77 deletions
diff --git a/sigmodr/widgets/ItemUI.cpp b/sigmodr/widgets/ItemUI.cpp
index 492ed120..4be61c4d 100644
--- a/sigmodr/widgets/ItemUI.cpp
+++ b/sigmodr/widgets/ItemUI.cpp
@@ -33,9 +33,6 @@
#include <KIntNumInput>
#include <KLineEdit>
-// Qt includes
-#include <QtGui/QCheckBox>
-
// Standard includes
#include <climits>
@@ -79,7 +76,6 @@ QWidget* ItemUI::Private::makeWidgets(ObjectUI* widget)
{
QWidget *form = openUiFile(":/gui/item.ui", widget);
ui_name = form->findChild<KLineEdit*>("varName");
- ui_sellable = form->findChild<QCheckBox*>("varSellable");
ui_type = form->findChild<KComboBox*>("varType");
ui_price = form->findChild<KIntNumInput*>("varPrice");
ui_sellPrice = form->findChild<KIntNumInput*>("varSellPrice");
@@ -87,14 +83,12 @@ QWidget* ItemUI::Private::makeWidgets(ObjectUI* widget)
ui_description = form->findChild<KLineEdit*>("varDescription");
ui_script = form->findChild<ScriptWidget*>("varScript");
connect(ui_name, SIGNAL(textChanged(QString)), this, SLOT(nameChanged(QString)));
- connect(ui_sellable, SIGNAL(toggled(bool)), this, SLOT(sellableChanged(bool)));
connect(ui_type, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int)));
connect(ui_price, SIGNAL(valueChanged(int)), this, SLOT(priceChanged(int)));
connect(ui_sellPrice, SIGNAL(valueChanged(int)), this, SLOT(sellPriceChanged(int)));
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());
@@ -121,11 +115,9 @@ void ItemUI::Private::refreshGui()
void ItemUI::Private::resetGui()
{
ui_name->setText(m_item->name());
- ui_sellable->setCheckState(m_item->sellable() ? Qt::Checked : Qt::Unchecked);
ui_type->setCurrentIndex(m_item->game()->itemTypeIndex(m_item->type()));
ui_price->setValue(m_item->price());
ui_sellPrice->setValue(m_item->sellPrice());
- ui_sellPrice->setEnabled(m_item->sellable());
ui_weight->setValue(m_item->weight());
ui_description->setText(m_item->description());
ui_script->setValue(m_item->script());
@@ -138,12 +130,6 @@ void ItemUI::Private::nameChanged(const QString& name)
ui_name->setCursorPosition(cursor);
}
-void ItemUI::Private::sellableChanged(const bool sellable)
-{
- m_item->setSellable(sellable);
- ui_sellPrice->setEnabled(sellable);
-}
-
void ItemUI::Private::typeChanged(const int type)
{
if (0 <= type)
diff --git a/sigmodr/widgets/ItemUI_p.h b/sigmodr/widgets/ItemUI_p.h
index b86e4934..239fc240 100644
--- a/sigmodr/widgets/ItemUI_p.h
+++ b/sigmodr/widgets/ItemUI_p.h
@@ -28,7 +28,6 @@
class KComboBox;
class KIntNumInput;
class KLineEdit;
-class QCheckBox;
namespace Sigcore
{
class Script;
@@ -59,7 +58,6 @@ class SIGMODRWIDGETS_NO_EXPORT ItemUI::Private : public ObjectUIPrivate
void resetGui();
protected slots:
void nameChanged(const QString& name);
- void sellableChanged(const bool sellable);
void typeChanged(const int type);
void priceChanged(const int price);
void sellPriceChanged(const int sellPrice);
@@ -68,7 +66,6 @@ class SIGMODRWIDGETS_NO_EXPORT ItemUI::Private : public ObjectUIPrivate
void scriptChanged(const Sigcore::Script& script);
private:
KLineEdit* ui_name;
- QCheckBox* ui_sellable;
KComboBox* ui_type;
KIntNumInput* ui_price;
KIntNumInput* ui_sellPrice;
diff --git a/sigmodr/widgets/gui/item.ui b/sigmodr/widgets/gui/item.ui
index f3a1ad69..76459d0f 100644
--- a/sigmodr/widgets/gui/item.ui
+++ b/sigmodr/widgets/gui/item.ui
@@ -88,80 +88,50 @@
</widget>
</item>
<item row="3" column="0">
- <widget class="QLabel" name="labelSellable">
+ <widget class="QLabel" name="labelSellPrice">
+ <property name="sizePolicy">
+ <sizepolicy vsizetype="Minimum" hsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
- <string>Selling:</string>
+ <string>Selling price:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignVCenter</set>
</property>
<property name="buddy">
- <cstring>varSellable</cstring>
+ <cstring>varSellPrice</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
- <widget class="QCheckBox" name="varSellable">
+ <widget class="KIntNumInput" name="varSellPrice">
+ <property name="sizePolicy">
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
- <string>Whether the item is sellable at a store or not</string>
+ <string>Amount received when item is sold</string>
</property>
<property name="statusTip">
- <string>Whether the item is sellable at a store or not</string>
+ <string>Amount received when item is sold</string>
</property>
<property name="whatsThis">
- <string>Whether the item is sellable at a store or not</string>
+ <string>Amount received when item is sold</string>
</property>
- <property name="text">
- <string>Can sell</string>
+ <property name="minimum">
+ <number>-1</number>
+ </property>
+ <property name="specialValueText">
+ <string>Cannot sell</string>
</property>
</widget>
</item>
- <item row="4" column="1">
- <layout class="QGridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="labelSellPrice">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Minimum" hsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Selling price:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignVCenter</set>
- </property>
- <property name="buddy">
- <cstring>varSellPrice</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KIntNumInput" name="varSellPrice">
- <property name="sizePolicy">
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Amount received when item is sold</string>
- </property>
- <property name="statusTip">
- <string>Amount received when item is sold</string>
- </property>
- <property name="whatsThis">
- <string>Amount received when item is sold</string>
- </property>
- <property name="minimum">
- <number>0</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="5" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="labelWeight">
<property name="text">
<string>Weight:</string>
@@ -174,7 +144,7 @@
</property>
</widget>
</item>
- <item row="5" column="1">
+ <item row="4" column="1">
<widget class="KIntNumInput" name="varWeight">
<property name="toolTip">
<string>How much the item weighs</string>
@@ -190,7 +160,7 @@
</property>
</widget>
</item>
- <item row="6" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="labelDescription">
<property name="text">
<string>Description:</string>
@@ -203,7 +173,7 @@
</property>
</widget>
</item>
- <item row="6" column="1">
+ <item row="5" column="1">
<widget class="KLineEdit" name="varDescription">
<property name="toolTip">
<string>Description of the item</string>
@@ -219,7 +189,7 @@
</property>
</widget>
</item>
- <item row="7" column="0" colspan="2">
+ <item row="6" column="0" colspan="2">
<widget class="QGroupBox" name="boxScript">
<property name="title">
<string>Script</string>
@@ -269,7 +239,6 @@
<tabstop>varName</tabstop>
<tabstop>varType</tabstop>
<tabstop>varPrice</tabstop>
- <tabstop>varSellable</tabstop>
<tabstop>varSellPrice</tabstop>
<tabstop>varWeight</tabstop>
<tabstop>varDescription</tabstop>