diff options
Diffstat (limited to 'sigmodr/widgets/CoinListUI.cpp')
| -rw-r--r-- | sigmodr/widgets/CoinListUI.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/sigmodr/widgets/CoinListUI.cpp b/sigmodr/widgets/CoinListUI.cpp index e35cce5e..14b1039c 100644 --- a/sigmodr/widgets/CoinListUI.cpp +++ b/sigmodr/widgets/CoinListUI.cpp @@ -18,25 +18,42 @@ // Header include #include "CoinListUI.h" +// Sigmodr widget includes +#include "ScriptWidget.h" + // Sigmod includes #include <sigmod/CoinList.h> #include <sigmod/Sigmod.h> +// KDE includes +#include <KLineEdit> + +// Qt includes +#include <QtCore/QFile> +#include <QtUiTools/QUiLoader> + Sigmodr::Widgets::CoinListUI::CoinListUI(Sigmod::CoinList* coinList, QWidget* parent) : ObjectUI(parent) { - setupUi(this); setObjects(coinList, new Sigmod::CoinList(*coinList)); } -Sigmodr::Widgets::CoinListUI::~CoinListUI() +void Sigmodr::Widgets::CoinListUI::initGui() { + QFile file(":/gui/coinlist.ui"); + file.open(QFile::ReadOnly); + QWidget *formWidget = QUiLoader().load(&file, this); + file.close(); + ui_name = formWidget->findChild<KLineEdit*>("varName"); + ui_script = formWidget->findChild<ScriptWidget*>("varScript"); + connect(ui_name, SIGNAL(textChanged(QString)), this, SLOT(nameChanged(QString))); + connect(ui_script, SIGNAL(valueChanged(Sigcore::Script)), this, SLOT(scriptChanged(Sigcore::Script))); } void Sigmodr::Widgets::CoinListUI::setGui() { - varName->setText(qobject_cast<Sigmod::CoinList*>(modified())->name()); - varScript->setValue(qobject_cast<Sigmod::CoinList*>(modified())->script()); + ui_name->setText(qobject_cast<Sigmod::CoinList*>(modified())->name()); + ui_script->setValue(qobject_cast<Sigmod::CoinList*>(modified())->script()); } void Sigmodr::Widgets::CoinListUI::apply() @@ -52,14 +69,14 @@ void Sigmodr::Widgets::CoinListUI::discard() emit(changed(false)); } -void Sigmodr::Widgets::CoinListUI::on_varName_textChanged(const QString& name) +void Sigmodr::Widgets::CoinListUI::nameChanged(const QString& name) { - const int cursor = varName->cursorPosition(); + const int cursor = ui_name->cursorPosition(); qobject_cast<Sigmod::CoinList*>(modified())->setName(name); - varName->setCursorPosition(cursor); + ui_name->setCursorPosition(cursor); } -void Sigmodr::Widgets::CoinListUI::on_varScript_valueChanged(const Sigcore::Script& script) +void Sigmodr::Widgets::CoinListUI::scriptChanged(const Sigcore::Script& script) { qobject_cast<Sigmod::CoinList*>(modified())->setScript(script); } |
