diff options
Diffstat (limited to 'pokemodr/TimeUI.cpp')
| -rw-r--r-- | pokemodr/TimeUI.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/pokemodr/TimeUI.cpp b/pokemodr/TimeUI.cpp index cef3522e..402f2066 100644 --- a/pokemodr/TimeUI.cpp +++ b/pokemodr/TimeUI.cpp @@ -15,47 +15,51 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +// Header include +#include "TimeUI.h" + +// Pokemod includes +#include "../pokemod/Time.h" + // General includes #include "../general/BugCatcher.h" -#include "../general/Exception.h" - -// Gheaer include -#include "TimeUI.h" TimeUI::TimeUI(Time* time, QWidget* parent) : - ObjectUI(parent), - m_time(time), - m_time_mod(new Time(*time)) + ObjectUI(parent) { setupUi(this); QMetaObject::connectSlotsByName(this); - setObjects(m_time, m_time_mod); + setObjects(time, new Time(*time)); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); init(); } +TimeUI::~TimeUI() +{ +} + void TimeUI::setGui() { - varName->setText(m_time_mod->name()); - varTime->setTime(QTime(m_time_mod->hour(), m_time_mod->minute())); + varName->setText(static_cast<Time*>(modified())->name()); + varTime->setTime(QTime(static_cast<Time*>(modified())->hour(), static_cast<Time*>(modified())->minute())); } void TimeUI::on_buttonApply_clicked() { - *m_time = *m_time_mod; + *static_cast<Time*>(original()) = *static_cast<Time*>(modified()); emit(changed(false)); } void TimeUI::on_buttonDiscard_clicked() { - *m_time_mod = *m_time; + *static_cast<Time*>(modified()) = *static_cast<Time*>(original()); setGui(); emit(changed(false)); } void TimeUI::on_varName_textChanged(const QString& name) { - m_time_mod->setName(name); + static_cast<Time*>(modified())->setName(name); emit(changed(true)); } @@ -63,8 +67,8 @@ void TimeUI::on_varTime_timeChanged(const QTime& time) { try { - m_time_mod->setHour(time.hour()); - m_time_mod->setMinute(time.minute()); + static_cast<Time*>(modified())->setHour(time.hour()); + static_cast<Time*>(modified())->setMinute(time.minute()); emit(changed(true)); } catch (BoundsException& exception) |
