diff options
| author | 2022-04-29 10:48:09 +0200 | |
|---|---|---|
| committer | 2022-04-29 10:48:09 +0200 | |
| commit | 07c5f6ec23fcf9237a24e71adcfacabce677f818 (patch) | |
| tree | 588e8c5f82b9163181fad3581f610e6f1d88cba4 /mobile/maincontroller.cpp | |
| parent | a9153f1615a842cfb9e9bcda4d9071e202618569 (diff) | |
| download | OneRoll-07c5f6ec23fcf9237a24e71adcfacabce677f818.tar.gz OneRoll-07c5f6ec23fcf9237a24e71adcfacabce677f818.zip | |
Change file organization.
Diffstat (limited to 'mobile/maincontroller.cpp')
| -rw-r--r-- | mobile/maincontroller.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/mobile/maincontroller.cpp b/mobile/maincontroller.cpp deleted file mode 100644 index 6f301ff..0000000 --- a/mobile/maincontroller.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "maincontroler.h" - -#include <QJSValue> -#include <QQmlEngine> - -MainControler::MainControler(QObject* parent) : QObject(parent) -{ - - m_diceParser= new DiceParser(); - qmlRegisterSingletonType("DiceParser", 1, 0, "Model", [](QQmlEngine* engine, QJSEngine* scriptEngine) -> QObject* { - Q_UNUSED(engine) - static CommandModel model; - static bool initialized= false; - if(!initialized) - { - model.insertCmd("L5R", "8D10e10k4"); - initialized= true; - } - return &model; - }); -} -void MainControler::initEngine(QQmlApplicationEngine* engine) -{ - m_engine= engine; - engine->rootContext()->setContextProperty("_model", m_model); - connect(m_engine, SIGNAL(objectCreated(QObject*, QUrl)), this, SLOT(setConnections(QObject*, QUrl))); -} -void MainControler::rollDice(QString cmd) -{ - if(m_diceParser->parseLine(cmd)) - { - m_diceParser->start(); - for(int i= 0; i < m_diceParser->getStartNodeCount(); ++i) - { - // qDebug() << m_diceParser->getSumOfDiceResult(i); - } - } -} -void MainControler::setConnections(QObject* root, QUrl url) -{ - // QObject* root = engine->rootContext()->contextObject(); - connect(root, SIGNAL(roll(QString)), this, SLOT(rollDice(QString))); - connect(root, SIGNAL(addRoll(QString, QString)), m_model, SLOT(insertCmd(QString, QString))); -} |