diff options
Diffstat (limited to 'mobile')
| -rw-r--r-- | mobile/CMakeLists.txt | 109 | ||||
| -rw-r--r-- | mobile/commandmodel.cpp | 54 | ||||
| -rw-r--r-- | mobile/commandmodel.h | 50 | ||||
| -rw-r--r-- | mobile/deployment.pri | 13 | ||||
| -rw-r--r-- | mobile/main.cpp | 38 | ||||
| -rw-r--r-- | mobile/main.qml | 172 | ||||
| -rw-r--r-- | mobile/maincontroller.cpp | 44 | ||||
| -rw-r--r-- | mobile/maincontroller.h | 29 | ||||
| -rw-r--r-- | mobile/mobile.pro | 20 | ||||
| -rw-r--r-- | mobile/mobile.qrc | 5 | ||||
| -rw-r--r-- | mobile/qml.qrc | 6 | ||||
| -rw-r--r-- | mobile/qml/main.qml | 17 | ||||
| -rw-r--r-- | mobile/resources/images/add.png | bin | 4696 -> 0 bytes |
13 files changed, 0 insertions, 557 deletions
diff --git a/mobile/CMakeLists.txt b/mobile/CMakeLists.txt deleted file mode 100644 index ddc0543..0000000 --- a/mobile/CMakeLists.txt +++ /dev/null @@ -1,109 +0,0 @@ -cmake_minimum_required(VERSION 3.16) - -option(UPDATE_TRANSLATIONS "update Translation" OFF) -MESSAGE(STATUS "UPDATE TRANSLATIONS: ${UPDATE_TRANSLATIONS}") - - -project(diceGui) - - -# Find includes in corresponding build directories -set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Instruct CMake to run moc automatically when needed. -set(CMAKE_AUTOMOC ON) - -# Find the QtWidgets library -find_package(Qt6 COMPONENTS Quick Qml Core Widgets Gui) -#find_package(Qt6QuickCompiler) - -set(EXECUTABLE_OUTPUT_PATH bin/) - -include_directories(${Qt5Core_INCLUDES} ${Qt5Widgets_INCLUDES} ${Qt5Gui_INCLUDES} ${Qt5Qml_INCLUDES} ${Qt5Quick_INCLUDES}../) -add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Qml_DEFINITIONS} ${Qt5Quick_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ) - -ADD_DEFINITIONS( - -std=c++11 -) - -set(diceGui_RESOURCES diceparser.qrc) -FIND_PACKAGE(Qt6LinguistTools) - - -IF(UPDATE_TRANSLATIONS) - MESSAGE( update Translation ) - FILE(GLOB_RECURSE translate_diceGui_SRCS ../*.cpp ../*.h) - SET(translate_SRCS ${translate_dice_SRCS}) - SET(diceGui_TS "${CMAKE_CURRENT_SOURCE_DIR}/i18n/diceGui_en.ts" "${CMAKE_CURRENT_SOURCE_DIR}/i18n/diceGui_fr.ts") -ELSE() - MESSAGE( NO updates for translations) - FILE(GLOB diceGui_TS "${CMAKE_CURRENT_SOURCE_DIR}/i18n/*.ts") -ENDIF(UPDATE_TRANSLATIONS) - -if(Qt5Core_FOUND) - - IF(UPDATE_TRANSLATIONS) - MESSAGE(status "find" ${diceGui_TS} ${translate_SRCS} ) - QT5_CREATE_TRANSLATION(diceGui_QM ${translate_SRCS} ${diceGui_TS}) - ELSE() - QT5_ADD_TRANSLATION(diceGui_QM ${diceGui_TS}) - ENDIF() - - QT5_ADD_RESOURCES(diceGui_RESOURCES_RCC ${diceGui_RESOURCES}) - - # guess plugins and libraries directory - set(QT_PLUGINS_DIR "${Qt5Core_DIR}/../../../plugins") - get_target_property(QT_LIBRARY_DIR Qt6::Core LOCATION) - get_filename_component(QT_LIBRARY_DIR ${QT_LIBRARY_DIR} PATH) -endif() - -SET( diceGui_sources - ../diceparser.cpp - ../range.cpp - ../booleancondition.cpp - ../validator.cpp - ../compositevalidator.cpp - ../operationcondition.cpp - ../die.cpp - ../parsingtoolbox.cpp - ../dicealias.cpp - ../result/result.cpp - ../result/scalarresult.cpp - ../result/stringresult.cpp - ../result/diceresult.cpp - ../node/countexecutenode.cpp - ../node/dicerollernode.cpp - ../node/executionnode.cpp - ../node/explodedicenode.cpp - ../node/helpnode.cpp - ../node/mergenode.cpp - ../node/jumpbackwardnode.cpp - ../node/keepdiceexecnode.cpp - ../node/listaliasnode.cpp - ../node/listsetrollnode.cpp - ../node/numbernode.cpp - ../node/parenthesesnode.cpp - ../node/paintnode.cpp - ../node/rerolldicenode.cpp - ../node/scalaroperatornode.cpp - ../node/sortresult.cpp - ../node/startingnode.cpp - ../node/ifnode.cpp - ../node/filternode.cpp - ../node/stringnode.cpp - ../node/splitnode.cpp - ../node/groupnode.cpp - ../node/variablenode.cpp - ../node/bind.cpp - main.cpp - maincontroller.cpp - commandmodel.cpp - ../highlightdice.cpp -) -qt5_add_resources(RESOURCE_ADDED mobile.qrc) - -add_executable( diceGui ${diceGui_sources} ${diceGui_QM} ${RESOURCE_ADDED} ) - -target_link_libraries(diceGui ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Qml_LIBRARIES} ${Qt5Quick_LIBRARIES}) -INSTALL_TARGETS(/bin diceGui) - -#qt5_use_modules() diff --git a/mobile/commandmodel.cpp b/mobile/commandmodel.cpp deleted file mode 100644 index 7b50397..0000000 --- a/mobile/commandmodel.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 by Renaud Guezennec * - * http://www.rolisteam.org/contact * - * * - * rolisteam 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 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "commandmodel.h" - -CommandModel::CommandModel() {} - -QVariant CommandModel::data(const QModelIndex& index, int role) const -{ - QPair<QString, QString> indexP= m_data.at(index.row()); - if(role == NameRole) - { - return indexP.first; - } - else if(role == CmdRole) - { - return indexP.second; - } -} - -int CommandModel::rowCount(const QModelIndex& parent) const -{ - return m_data.count(); -} -QHash<int, QByteArray> CommandModel::roleNames() const -{ - QHash<int, QByteArray> roles; - roles[NameRole]= "name"; - roles[CmdRole]= "cmd"; - return roles; -} -void CommandModel::insertCmd(QString name, QString cmd) -{ - QModelIndex index; - beginInsertRows(index, 0, 0); - m_data.prepend(QPair<QString, QString>(name, cmd)); - endInsertRows(); -} diff --git a/mobile/commandmodel.h b/mobile/commandmodel.h deleted file mode 100644 index 4037032..0000000 --- a/mobile/commandmodel.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 by Renaud Guezennec * - * http://www.rolisteam.org/contact * - * * - * rolisteam 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 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef COMMANDMODEL_H -#define COMMANDMODEL_H - -#include <QObject> - -#include <QAbstractListModel> - -class CommandModel : public QAbstractListModel -{ - Q_OBJECT -public: - enum CustomRole - { - NameRole= Qt::UserRole + 1, - CmdRole - }; - CommandModel(); - - virtual QVariant data(const QModelIndex& index, int role= Qt::DisplayRole) const; - virtual int rowCount(const QModelIndex& parent) const; - - QHash<int, QByteArray> roleNames() const; - -public slots: - void insertCmd(QString name, QString cmd); - -private: - QList<QPair<QString, QString>> m_data; -}; - -#endif // COMMANDMODEL_H diff --git a/mobile/deployment.pri b/mobile/deployment.pri deleted file mode 100644 index 265ce71..0000000 --- a/mobile/deployment.pri +++ /dev/null @@ -1,13 +0,0 @@ -unix:!android { - isEmpty(target.path) { - qnx { - target.path = /tmp/$${TARGET}/bin - } else { - target.path = /opt/$${TARGET}/bin - } - export(target.path) - } - INSTALLS += target -} - -export(INSTALLS) diff --git a/mobile/main.cpp b/mobile/main.cpp deleted file mode 100644 index 9b81329..0000000 --- a/mobile/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 by Renaud Guezennec * - * http://www.rolisteam.org/contact * - * * - * rolisteam 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 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include <QGuiApplication> -#include <QQmlApplicationEngine> - -#include "maincontroler.h" - -int main(int argc, char* argv[]) -{ - QGuiApplication app(argc, argv); - - MainControler* main= new MainControler(); - - QQmlApplicationEngine engine; - main->initEngine(&engine); - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - // main->setConnections(&engine); - - return app.exec(); -} diff --git a/mobile/main.qml b/mobile/main.qml deleted file mode 100644 index 700f3a7..0000000 --- a/mobile/main.qml +++ /dev/null @@ -1,172 +0,0 @@ -import QtQuick 2.7 -import QtQuick.Window 2.2 - -Window { - id:root - visible: true - signal addRoll(string name, string cmd ) - signal roll(string cmd) - color: "black" - height: 1280 - width: 720 - - Column{ - - anchors.fill: parent - leftPadding: width*0.025 - rightPadding: width*0.025 - topPadding: width*0.025 - Rectangle { - height: parent.height*0.12 - width: parent.width*0.95 - Image { - anchors.fill: parent - horizontalAlignment: Image.AlignHCenter - verticalAlignment:Image.AlignVCenter - fillMode: Image.PreserveAspectFit - source: "qrc:/resources/images/add.png" - } - gradient: Gradient { - GradientStop { position: 0.0; color: "darkblue" } - GradientStop { position: 1.0; color: "blue" } - } - MouseArea { - anchors.fill: parent - onClicked:popupAdd.visible = true - } - } - - ListView { - model: _model - focus: true - height: parent.height*0.88 - width: parent.width*0.95 - delegate: Item{ - height: parent.height - width: parent.width - Column{ - width: parent.width - height: parent.height - Text{ - text: name - font.pointSize: 40 - color: "white" - - - } - Text{ - text: cmd - font.pointSize:30 - color: "white" - - } - } - MouseArea{ - anchors.fill:parent - onClicked: roll(cmd) - } - } - } - - } - Rectangle { - id: popupAdd - color: "black" - x: parent.width*0.1 - y: parent.height*0.1 - height: parent.height*0.80 - width: parent.width*0.80 - visible: false - border.color: "white" - border.width: 1 - - Column{ - id:form - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - height: parent.height*0.80 - leftPadding: width*0.025 - rightPadding: width*0.025 - topPadding: width*0.025 - property alias name : nameInp - property alias cmd : cmdInp - Text { - text: qsTr("Name") - color: "white" - height: parent.height*0.1 - font.pointSize: 40 - } - Rectangle{ - height: parent.height*0.1 - width: parent.width*0.90 - border.color: "#BBBBBB" - border.width: 1 - color: "black" - TextInput{ - id: nameInp - color: "white" - anchors.fill: parent - font.pointSize: 40 - } - } - - Text { - text: qsTr("Command") - color: "white" - height: parent.height*0.1 - font.pointSize: 40 - } - Rectangle{ - height: parent.height*0.1 - width: parent.width*0.90 - border.color: "#BBBBBB" - border.width: 1 - color: "black" - TextInput{ - id: cmdInp - color: "white" - anchors.fill: parent - font.pointSize: 40 - } - } - } - - Rectangle { - color:"red" - id: cancel - anchors.top: form.bottom - anchors.left: form.left - anchors.right: form.horizontalCenter - anchors.bottom: parent.bottom - radius: height/2 - MouseArea { - anchors.fill: parent - onClicked:{ - nameInp.text="" - cmdInp.text="" - popupAdd.visible = false - } - } - } - Rectangle { - color:"green" - anchors.top: form.bottom - anchors.left: cancel.right - anchors.right: form.right - anchors.bottom: parent.bottom - radius: height/2 - MouseArea { - anchors.fill: parent - onClicked: - { - root.addRoll(nameInp,cmdInp.text); - nameInp.text="" - cmdInp.text="" - popupAdd.visible = false - } - } - - } - } -} 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))); -} diff --git a/mobile/maincontroller.h b/mobile/maincontroller.h deleted file mode 100644 index 43fc1ae..0000000 --- a/mobile/maincontroller.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef MAINCONTROLER_H -#define MAINCONTROLER_H - -#include <QObject> -#include <QQmlApplicationEngine> - -#include "commandmodel.h" -#include "diceparser.h" - -class MainControler : public QObject -{ - Q_OBJECT -public: - explicit MainControler(QObject* parent= 0); - - void initEngine(QQmlApplicationEngine*); -signals: - -public slots: - void setConnections(QObject* root, QUrl url); - void rollDice(QString cmd); - -private: - // CommandModel* m_model; - DiceParser* m_diceParser; - QQmlApplicationEngine* m_engine; -}; - -#endif // MAINCONTROLER_H diff --git a/mobile/mobile.pro b/mobile/mobile.pro deleted file mode 100644 index 2e33522..0000000 --- a/mobile/mobile.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = app - -QT += qml quick -CONFIG += c++11 - -SOURCES += main.cpp maincontroler.cpp \ - commandmodel.cpp - -HEADERS += maincontroler.h \ - commandmodel.h - -RESOURCES += qml.qrc - -include(../diceparser.pri) - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -# Default rules for deployment. -include(deployment.pri) diff --git a/mobile/mobile.qrc b/mobile/mobile.qrc deleted file mode 100644 index 69145a8..0000000 --- a/mobile/mobile.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>qml/main.qml</file> - </qresource> -</RCC> diff --git a/mobile/qml.qrc b/mobile/qml.qrc deleted file mode 100644 index 2cbbe08..0000000 --- a/mobile/qml.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>resources/images/add.png</file> - </qresource> -</RCC> diff --git a/mobile/qml/main.qml b/mobile/qml/main.qml deleted file mode 100644 index ed9d480..0000000 --- a/mobile/qml/main.qml +++ /dev/null @@ -1,17 +0,0 @@ -import QtQuick 2.4 - -Item { - id:root - - ListView { - id: diceList - } - - Item{ - id: popupInput - - } - Item { - id: popupResult - } -} diff --git a/mobile/resources/images/add.png b/mobile/resources/images/add.png Binary files differdeleted file mode 100644 index c8e1bd2..0000000 --- a/mobile/resources/images/add.png +++ /dev/null |