summaryrefslogtreecommitdiffstats
path: root/sigmodr/SigmodUI.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-02-23 11:20:47 -0500
committerBen Boeckel <MathStuf@gmail.com>2009-02-23 11:20:47 -0500
commit7aff48012c3040a675543a0ff3d23af6cb8a8638 (patch)
tree6dd17b90d1f1c6ba9b0b7c5ddc40c2a849c25286 /sigmodr/SigmodUI.cpp
parent25ec942048336dde5e1a17e6c75e15e4f8d8290d (diff)
downloadsigen-7aff48012c3040a675543a0ff3d23af6cb8a8638.tar.gz
sigen-7aff48012c3040a675543a0ff3d23af6cb8a8638.tar.xz
sigen-7aff48012c3040a675543a0ff3d23af6cb8a8638.zip
Started restructuring how sigmodr is built and moving things into libraries
Diffstat (limited to 'sigmodr/SigmodUI.cpp')
-rw-r--r--sigmodr/SigmodUI.cpp125
1 files changed, 0 insertions, 125 deletions
diff --git a/sigmodr/SigmodUI.cpp b/sigmodr/SigmodUI.cpp
deleted file mode 100644
index 0321e5a0..00000000
--- a/sigmodr/SigmodUI.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-// Header include
-#include "SigmodUI.h"
-
-// Sigmodr includes
-#include "TypechartModel.h"
-
-// Sigmod includes
-#include "../sigmod/Map.h"
-#include "../sigmod/MapWarp.h"
-#include "../sigmod/Sigmod.h"
-#include "../sigmod/Type.h"
-
-Sigmodr::SigmodUI::SigmodUI(Sigmod::Sigmod* sigmod, QWidget* parent) :
- ObjectUI(parent),
- m_changingMult(true)
-{
- setupUi(this);
- setObjects(sigmod, new Sigmod::Sigmod(*sigmod));
-}
-
-Sigmodr::SigmodUI::~SigmodUI()
-{
-}
-
-void Sigmodr::SigmodUI::initGui()
-{
- QStringList types;
- for (int i = 0; i < qobject_cast<Sigmod::Sigmod*>(original())->typeCount(); ++i)
- types << qobject_cast<Sigmod::Sigmod*>(original())->type(i)->name();
- varTypechart->setModel(new TypechartModel(qobject_cast<Sigmod::Sigmod*>(modified())->typechart(), types));
-}
-
-void Sigmodr::SigmodUI::refreshGui()
-{
- varEffectiveness->setEnabled(false);
-}
-
-void Sigmodr::SigmodUI::setGui()
-{
- varTitle->setText(qobject_cast<Sigmod::Sigmod*>(modified())->title());
- varVersion->setText(qobject_cast<Sigmod::Sigmod*>(modified())->version());
- varDescription->setText(qobject_cast<Sigmod::Sigmod*>(modified())->description());
- varSinglePlayer->setCheckState(qobject_cast<Sigmod::Sigmod*>(modified())->singlePlayer() ? Qt::Checked : Qt::Unchecked);
- varStartScript->setValue(qobject_cast<Sigmod::Sigmod*>(modified())->startScript());
-}
-
-void Sigmodr::SigmodUI::apply()
-{
- *qobject_cast<Sigmod::Sigmod*>(original()) = *qobject_cast<Sigmod::Sigmod*>(modified());
- emit(changed(false));
-}
-
-void Sigmodr::SigmodUI::discard()
-{
- *qobject_cast<Sigmod::Sigmod*>(modified()) = *qobject_cast<Sigmod::Sigmod*>(original());
- setGui();
- qobject_cast<TypechartModel*>(varTypechart->model())->discarded();
- emit(changed(false));
-}
-
-void Sigmodr::SigmodUI::on_varTitle_textChanged(const QString& title)
-{
- const int cursor = varTitle->cursorPosition();
- qobject_cast<Sigmod::Sigmod*>(modified())->setTitle(title);
- varTitle->setCursorPosition(cursor);
-}
-
-void Sigmodr::SigmodUI::on_varVersion_textChanged(const QString& version)
-{
- const int cursor = varVersion->cursorPosition();
- qobject_cast<Sigmod::Sigmod*>(modified())->setVersion(version);
- varVersion->setCursorPosition(cursor);
-}
-
-void Sigmodr::SigmodUI::on_varDescription_textChanged(const QString& description)
-{
- const int cursor = varDescription->cursorPosition();
- qobject_cast<Sigmod::Sigmod*>(modified())->setDescription(description);
- varDescription->setCursorPosition(cursor);
-}
-
-void Sigmodr::SigmodUI::on_varSinglePlayer_clicked(const bool singlePlayer)
-{
- qobject_cast<Sigmod::Sigmod*>(modified())->setSinglePlayer(singlePlayer);
-}
-
-void Sigmodr::SigmodUI::on_varStartScript_valueChanged(const Sigcore::Script& startScript)
-{
- qobject_cast<Sigmod::Sigmod*>(modified())->setStartScript(startScript);
-}
-
-void Sigmodr::SigmodUI::on_varTypechart_clicked(const QModelIndex& index)
-{
- m_index = index;
- m_changingMult = true;
- varEffectiveness->setEnabled(true);
- labelTypes->setText(QString("%1 vs. %2").arg(varTypechart->model()->headerData(index.row(), Qt::Vertical, Qt::DisplayRole).toString()).arg(varTypechart->model()->headerData(index.column(), Qt::Horizontal, Qt::DisplayRole).toString()));
- varEffectiveness->setValue(varTypechart->model()->data(m_index, Qt::EditRole).value<Sigcore::Fraction>());
-}
-
-void Sigmodr::SigmodUI::on_varEffectiveness_valueChanged(const Sigcore::Fraction& multiplier)
-{
- varTypechart->model()->setData(m_index, QVariant::fromValue(multiplier), Qt::EditRole);
- if (!m_changingMult)
- emit(changed());
- m_changingMult = false;
- setGui();
-}