From e225f2edfd365d1709df2cb5bb2f752ec8d82c1c Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 25 Sep 2016 09:59:40 +0200 Subject: add file for mobile application --- mobile/deployment.pri | 13 ++++ mobile/main.qml | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++ mobile/mobile.pro | 20 ++++++ mobile/mobile.qrc | 5 ++ mobile/qml.qrc | 6 ++ mobile/qml/main.qml | 17 +++++ 6 files changed, 233 insertions(+) create mode 100644 mobile/deployment.pri create mode 100644 mobile/main.qml create mode 100644 mobile/mobile.pro create mode 100644 mobile/mobile.qrc create mode 100644 mobile/qml.qrc create mode 100644 mobile/qml/main.qml diff --git a/mobile/deployment.pri b/mobile/deployment.pri new file mode 100644 index 0000000..265ce71 --- /dev/null +++ b/mobile/deployment.pri @@ -0,0 +1,13 @@ +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.qml b/mobile/main.qml new file mode 100644 index 0000000..700f3a7 --- /dev/null +++ b/mobile/main.qml @@ -0,0 +1,172 @@ +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/mobile.pro b/mobile/mobile.pro new file mode 100644 index 0000000..2e33522 --- /dev/null +++ b/mobile/mobile.pro @@ -0,0 +1,20 @@ +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 new file mode 100644 index 0000000..69145a8 --- /dev/null +++ b/mobile/mobile.qrc @@ -0,0 +1,5 @@ + + + qml/main.qml + + diff --git a/mobile/qml.qrc b/mobile/qml.qrc new file mode 100644 index 0000000..2cbbe08 --- /dev/null +++ b/mobile/qml.qrc @@ -0,0 +1,6 @@ + + + main.qml + resources/images/add.png + + diff --git a/mobile/qml/main.qml b/mobile/qml/main.qml new file mode 100644 index 0000000..ed9d480 --- /dev/null +++ b/mobile/qml/main.qml @@ -0,0 +1,17 @@ +import QtQuick 2.4 + +Item { + id:root + + ListView { + id: diceList + } + + Item{ + id: popupInput + + } + Item { + id: popupResult + } +} -- cgit v1.2.3-70-g09d2