From 4acab35a099e9f6834432e7e89dee716c41549ba Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 24 Feb 2009 21:21:41 -0500 Subject: Fixed Sigmodr widgets to use namespaces in sources --- sigmodr/widgets/TrainerUI.cpp | 85 ++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 41 deletions(-) (limited to 'sigmodr/widgets/TrainerUI.cpp') diff --git a/sigmodr/widgets/TrainerUI.cpp b/sigmodr/widgets/TrainerUI.cpp index 565f6b3f..75e48033 100644 --- a/sigmodr/widgets/TrainerUI.cpp +++ b/sigmodr/widgets/TrainerUI.cpp @@ -33,13 +33,16 @@ #include #include -Sigmodr::Widgets::TrainerUI::TrainerUI(Sigmod::Trainer* trainer, QWidget* parent) : +using namespace Sigmod; +using namespace Sigmodr::Widgets; + +TrainerUI::TrainerUI(Trainer* trainer, QWidget* parent) : ObjectUI(parent) { - setObjects(trainer, new Sigmod::Trainer(*trainer)); + setObjects(trainer, new Trainer(*trainer)); } -void Sigmodr::Widgets::TrainerUI::initGui() +void TrainerUI::initGui() { QFile file(":/gui/trainer.ui"); file.open(QFile::ReadOnly); @@ -63,14 +66,14 @@ void Sigmodr::Widgets::TrainerUI::initGui() connect(ui_itemIntel, SIGNAL(currentIndexChanged(int)), this, SLOT(itemIntelChanged(int))); connect(ui_abilityIntel, SIGNAL(currentIndexChanged(int)), this, SLOT(abilityIntelChanged(int))); connect(ui_statIntel, SIGNAL(currentIndexChanged(int)), this, SLOT(statIntelChanged(int))); - ui_teamIntel->addItems(Sigmod::Trainer::IntelligenceStr); - ui_moveIntel->addItems(Sigmod::Trainer::IntelligenceStr); - ui_itemIntel->addItems(Sigmod::Trainer::IntelligenceStr); - ui_abilityIntel->addItems(Sigmod::Trainer::IntelligenceStr); - ui_statIntel->addItems(Sigmod::Trainer::IntelligenceStr); + ui_teamIntel->addItems(Trainer::IntelligenceStr); + ui_moveIntel->addItems(Trainer::IntelligenceStr); + ui_itemIntel->addItems(Trainer::IntelligenceStr); + ui_abilityIntel->addItems(Trainer::IntelligenceStr); + ui_statIntel->addItems(Trainer::IntelligenceStr); } -void Sigmodr::Widgets::TrainerUI::refreshGui() +void TrainerUI::refreshGui() { for (int i = 0; i < game()->skinCount(); ++i) ui_skin->addItem(game()->skin(i)->name()); @@ -78,74 +81,74 @@ void Sigmodr::Widgets::TrainerUI::refreshGui() ui_abilityIntel->setEnabled(game()->rules()->maxAbilities()); } -void Sigmodr::Widgets::TrainerUI::setGui() +void TrainerUI::setGui() { - ui_name->setText(qobject_cast(modified())->name()); - ui_moneyFactor->setValue(qobject_cast(modified())->moneyFactor()); - ui_skin->setCurrentIndex(game()->skinIndex(qobject_cast(modified())->skin())); - ui_depth->setValue(qobject_cast(modified())->depth()); - ui_teamIntel->setCurrentIndex(qobject_cast(modified())->teamIntel()); - ui_moveIntel->setCurrentIndex(qobject_cast(modified())->moveIntel()); - ui_itemIntel->setCurrentIndex(qobject_cast(modified())->itemIntel()); - ui_abilityIntel->setCurrentIndex(qobject_cast(modified())->abilityIntel()); - ui_statIntel->setCurrentIndex(qobject_cast(modified())->statIntel()); + ui_name->setText(qobject_cast(modified())->name()); + ui_moneyFactor->setValue(qobject_cast(modified())->moneyFactor()); + ui_skin->setCurrentIndex(game()->skinIndex(qobject_cast(modified())->skin())); + ui_depth->setValue(qobject_cast(modified())->depth()); + ui_teamIntel->setCurrentIndex(qobject_cast(modified())->teamIntel()); + ui_moveIntel->setCurrentIndex(qobject_cast(modified())->moveIntel()); + ui_itemIntel->setCurrentIndex(qobject_cast(modified())->itemIntel()); + ui_abilityIntel->setCurrentIndex(qobject_cast(modified())->abilityIntel()); + ui_statIntel->setCurrentIndex(qobject_cast(modified())->statIntel()); } -void Sigmodr::Widgets::TrainerUI::apply() +void TrainerUI::apply() { - *qobject_cast(original()) = *qobject_cast(modified()); + *qobject_cast(original()) = *qobject_cast(modified()); emit(changed(false)); } -void Sigmodr::Widgets::TrainerUI::discard() +void TrainerUI::discard() { - *qobject_cast(modified()) = *qobject_cast(original()); + *qobject_cast(modified()) = *qobject_cast(original()); emit(changed(false)); } -void Sigmodr::Widgets::TrainerUI::nameChanged(const QString& name) +void TrainerUI::nameChanged(const QString& name) { const int cursor = ui_name->cursorPosition(); - qobject_cast(modified())->setName(name); + qobject_cast(modified())->setName(name); ui_name->setCursorPosition(cursor); } -void Sigmodr::Widgets::TrainerUI::moneyFactorChanged(const int moneyFactor) +void TrainerUI::moneyFactorChanged(const int moneyFactor) { - qobject_cast(modified())->setMoneyFactor(moneyFactor); + qobject_cast(modified())->setMoneyFactor(moneyFactor); } -void Sigmodr::Widgets::TrainerUI::skinChanged(const int skin) +void TrainerUI::skinChanged(const int skin) { - qobject_cast(modified())->setSkin(game()->skin(skin)->id()); + qobject_cast(modified())->setSkin(game()->skin(skin)->id()); } -void Sigmodr::Widgets::TrainerUI::depthChanged(const int depth) +void TrainerUI::depthChanged(const int depth) { - qobject_cast(modified())->setDepth(depth); + qobject_cast(modified())->setDepth(depth); } -void Sigmodr::Widgets::TrainerUI::teamIntelChanged(const int teamIntel) +void TrainerUI::teamIntelChanged(const int teamIntel) { - qobject_cast(modified())->setTeamIntel(static_cast(teamIntel)); + qobject_cast(modified())->setTeamIntel(static_cast(teamIntel)); } -void Sigmodr::Widgets::TrainerUI::moveIntelChanged(const int moveIntel) +void TrainerUI::moveIntelChanged(const int moveIntel) { - qobject_cast(modified())->setMoveIntel(static_cast(moveIntel)); + qobject_cast(modified())->setMoveIntel(static_cast(moveIntel)); } -void Sigmodr::Widgets::TrainerUI::itemIntelChanged(const int itemIntel) +void TrainerUI::itemIntelChanged(const int itemIntel) { - qobject_cast(modified())->setItemIntel(static_cast(itemIntel)); + qobject_cast(modified())->setItemIntel(static_cast(itemIntel)); } -void Sigmodr::Widgets::TrainerUI::abilityIntelChanged(const int abilityIntel) +void TrainerUI::abilityIntelChanged(const int abilityIntel) { - qobject_cast(modified())->setAbilityIntel(static_cast(abilityIntel)); + qobject_cast(modified())->setAbilityIntel(static_cast(abilityIntel)); } -void Sigmodr::Widgets::TrainerUI::statIntelChanged(const int statIntel) +void TrainerUI::statIntelChanged(const int statIntel) { - qobject_cast(modified())->setStatIntel(static_cast(statIntel)); + qobject_cast(modified())->setStatIntel(static_cast(statIntel)); } -- cgit