diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-27 17:57:32 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-27 17:57:32 +0000 |
| commit | 0fa52c1f61c457c9b68bec53bcce3af858e5eb44 (patch) | |
| tree | c5b10b77a01b417775097476029bcf67fac79975 /pokemodr/StoreUI.cpp | |
| parent | 807071d35159de0660f9df31c48d5bf895ca3622 (diff) | |
[FIX] More header cleanliness
[FIX] UI classes now just use the ObjectUI pointers
[FIX] Some miscellaneous qmake options
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@112 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/StoreUI.cpp')
| -rw-r--r-- | pokemodr/StoreUI.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/pokemodr/StoreUI.cpp b/pokemodr/StoreUI.cpp index c7043f77..31db81a9 100644 --- a/pokemodr/StoreUI.cpp +++ b/pokemodr/StoreUI.cpp @@ -25,30 +25,27 @@ // General includes #include "../general/BugCatcher.h" -#include "../general/Exception.h" - -// Qt includes -#include <QListWidgetItem> -#include <QVariant> StoreUI::StoreUI(Store* store, QWidget* parent) : - ObjectUI(parent), - m_store(store), - m_store_mod(new Store(*store)) + ObjectUI(parent) { setupUi(this); QMetaObject::connectSlotsByName(this); - setObjects(m_store, m_store_mod); + setObjects(store, new Store(*store)); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); init(); } +StoreUI::~StoreUI() +{ +} + void StoreUI::refreshGui() { varItems->clear(); - for (int i = 0; i < static_cast<const Pokemod*>(m_store->pokemod())->itemCount(); ++i) + for (int i = 0; i < static_cast<const Pokemod*>(static_cast<Store*>(original())->pokemod())->itemCount(); ++i) { - const Item* item = static_cast<const Pokemod*>(m_store->pokemod())->item(i); + const Item* item = static_cast<const Pokemod*>(static_cast<Store*>(original())->pokemod())->item(i); QListWidgetItem* widgetItem = new QListWidgetItem(item->name(), varItems); widgetItem->setData(Qt::UserRole, item->id()); } @@ -56,30 +53,30 @@ void StoreUI::refreshGui() void StoreUI::setGui() { - varName->setText(m_store_mod->name()); + varName->setText(static_cast<Store*>(modified())->name()); for (int i = 0; i < varItems->count(); ++i) { QListWidgetItem* widgetItem = varItems->item(i); - widgetItem->setSelected(m_store_mod->item(widgetItem->data(Qt::UserRole).toInt())); + widgetItem->setSelected(static_cast<Store*>(modified())->item(widgetItem->data(Qt::UserRole).toInt())); } } void StoreUI::on_buttonApply_clicked() { - *m_store = *m_store_mod; + *static_cast<Store*>(original()) = *static_cast<Store*>(modified()); emit(changed(false)); } void StoreUI::on_buttonDiscard_clicked() { - *m_store_mod = *m_store; + *static_cast<Store*>(modified()) = *static_cast<Store*>(original()); setGui(); emit(changed(false)); } void StoreUI::on_varName_textChanged(const QString& name) { - m_store_mod->setName(name); + static_cast<Store*>(modified())->setName(name); emit(changed(true)); } @@ -90,7 +87,7 @@ void StoreUI::on_varItems_itemSelectionChanged() for (int i = 0; i < varItems->count(); ++i) { const QListWidgetItem* widgetItem = varItems->item(i); - m_store_mod->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected()); + static_cast<Store*>(modified())->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected()); } emit(changed(true)); } |
