diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 11:15:57 -0500 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 11:15:57 -0500 |
commit | 4a2e1b318419361fb814581aab583f7d856b7149 (patch) | |
tree | 9d406c9f7dbed40c31d76363d8772f121b3a25af /sigmodr/widgets/TileUI.cpp | |
parent | b48cebf7472f2a30e1ae8747349045661ecf6547 (diff) | |
download | sigen-4a2e1b318419361fb814581aab583f7d856b7149.tar.gz sigen-4a2e1b318419361fb814581aab583f7d856b7149.tar.xz sigen-4a2e1b318419361fb814581aab583f7d856b7149.zip |
MOve widgets cleaned up
Diffstat (limited to 'sigmodr/widgets/TileUI.cpp')
-rw-r--r-- | sigmodr/widgets/TileUI.cpp | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/sigmodr/widgets/TileUI.cpp b/sigmodr/widgets/TileUI.cpp index 3fbd69c8..737bf40c 100644 --- a/sigmodr/widgets/TileUI.cpp +++ b/sigmodr/widgets/TileUI.cpp @@ -18,27 +18,47 @@ // Header include #include "TileUI.h" +// Sigmodr widget includes +#include "ScriptWidget.h" + // Sigmod includes #include <sigmod/Tile.h> #include <sigmod/Sigmod.h> #include <sigmod/Sprite.h> +// KDE includes +#include <KLineEdit> + +// Qt includes +#include <QtCore/QFile> +#include <QtGui/QCheckBox> +#include <QtUiTools/QUiLoader> + Sigmodr::Widgets::TileUI::TileUI(Sigmod::Tile* tile, QWidget* parent) : ObjectUI(parent) { - setupUi(this); setObjects(tile, new Sigmod::Tile(*tile)); } -Sigmodr::Widgets::TileUI::~TileUI() +void Sigmodr::Widgets::TileUI::initGui() { + QFile file(":/gui/tile.ui"); + file.open(QFile::ReadOnly); + QWidget *formWidget = QUiLoader().load(&file, this); + file.close(); + ui_name = formWidget->findChild<KLineEdit*>("varName"); + ui_walkable = formWidget->findChild<QCheckBox*>("varName"); + ui_script = formWidget->findChild<ScriptWidget*>("varName"); + connect(ui_name, SIGNAL(textChanged(QString)), this, SLOT(nameChanged(QString))); + connect(ui_walkable, SIGNAL(toggled(bool)), this, SLOT(walkableChanged(bool))); + connect(ui_script, SIGNAL(valueChanged(Sigcore::Script)), this, SLOT(scriptChanged(Sigcore::Script))); } void Sigmodr::Widgets::TileUI::setGui() { - varName->setText(qobject_cast<Sigmod::Tile*>(modified())->name()); - varWalkable->setChecked(qobject_cast<Sigmod::Tile*>(modified())->walkable()); - varScript->setValue(qobject_cast<Sigmod::Tile*>(modified())->script()); + ui_name->setText(qobject_cast<Sigmod::Tile*>(modified())->name()); + ui_walkable->setChecked(qobject_cast<Sigmod::Tile*>(modified())->walkable()); + ui_script->setValue(qobject_cast<Sigmod::Tile*>(modified())->script()); } void Sigmodr::Widgets::TileUI::apply() @@ -54,19 +74,19 @@ void Sigmodr::Widgets::TileUI::discard() emit(changed(false)); } -void Sigmodr::Widgets::TileUI::on_varName_textChanged(const QString& name) +void Sigmodr::Widgets::TileUI::nameChanged(const QString& name) { - const int cursor = varName->cursorPosition(); + const int cursor = ui_name->cursorPosition(); qobject_cast<Sigmod::Tile*>(modified())->setName(name); - varName->setCursorPosition(cursor); + ui_name->setCursorPosition(cursor); } -void Sigmodr::Widgets::TileUI::on_varWalkable_toggled(const bool walkable) +void Sigmodr::Widgets::TileUI::walkableChanged(const bool walkable) { qobject_cast<Sigmod::Tile*>(modified())->setWalkable(walkable); } -void Sigmodr::Widgets::TileUI::on_varScript_valueChanged(const Sigcore::Script& script) +void Sigmodr::Widgets::TileUI::scriptChanged(const Sigcore::Script& script) { qobject_cast<Sigmod::Tile*>(modified())->setScript(script); } |