diff --git a/AndroidManifest.xml b/AndroidManifest.xml deleted file mode 100644 index 96d85712..00000000 --- a/AndroidManifest.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pokerth_game.pro b/pokerth_game.pro index da2b16ab..35f16da8 100755 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -412,8 +412,8 @@ unix:!mac { $$system(qmake -query QT_INSTALL_LIBS) } android{ - LIBPATH += $${PREFIX}/lib/armv5 - LIB_DIRS = $${PREFIX}/lib/armv5 + LIBPATH += $${PREFIX}/lib/armv5 + LIB_DIRS = $${PREFIX}/lib/armv5 } BOOST_FS = boost_filesystem \ boost_filesystem-mt @@ -523,7 +523,7 @@ unix:!mac { $$BOOST_REGEX \ $$BOOST_CHRONO \ $$BOOST_SYS - !count(BOOST_LIBS, 6):error("Unable to find boost libraries in PREFIX=$${PREFIX}/armv5") + !count(BOOST_LIBS, 6):error("Unable to find boost libraries in PREFIX=$${PREFIX}lib/armv5") LIBS += -ltinyxml LIBS += $$BOOST_LIBS LIBS += -lgsasl -lidn @@ -685,3 +685,14 @@ android_test{ HEADERS += src/gui/qt/sound/androidapi8dummy.h SOURCES += src/gui/qt/sound/androidapi8dummy.cpp } + +DISTFILES += \ + android/AndroidManifest.xml \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradlew \ + android/res/values/libs.xml \ + android/build.gradle \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew.bat + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android diff --git a/pokerth_qml-client.pro b/pokerth_qml-client.pro index 45ce8b79..465827ec 100644 --- a/pokerth_qml-client.pro +++ b/pokerth_qml-client.pro @@ -1,24 +1,30 @@ TEMPLATE = app -QT += core qml quick widgets +QT += core qml quick widgets svg DEFINES += QML_CLIENT INCLUDEPATH += \ src/gui/qml \ - src/gui/qml/views + src/gui/qml/views \ + src/gui/qml/components DEPENDPATH += \ src \ src/gui/qml \ - src/gui/qml/views + src/gui/qml/views \ + src/gui/qml/components -RESOURCES += src/gui/qml/views/qml.qrc +RESOURCES += src/gui/qml/qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = src/gui/qml/views/ +QML_IMPORT_PATH = \ + src/gui/qml/views/ \ + src/gui/qml/views/startview/ \ + src/gui/qml/views/createlocalgameview/ \ + src/gui/qml/components # Default rules for deployment. -include(src/gui/qml/views/deployment.pri) +include(src/gui/qml/deployment.pri) HEADERS += \ src/gui/qml/qmlwrapper.h \ @@ -28,3 +34,28 @@ SOURCES += \ src/pokerth.cpp \ src/gui/qml/qmlwrapper.cpp \ src/gui/qml/views/startview/startview.cpp + +unix:!mac { + # #### My release static build options + # QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections + # QMAKE_LFLAGS += -Wl,--gc-sections + INCLUDEPATH += $${PREFIX}/include + QMAKE_LIBDIR += lib + !android{ + LIBPATH += $${PREFIX}/lib /opt/gsasl/lib + LIB_DIRS = $${PREFIX}/lib \ + $${PREFIX}/lib64 \ + $${PREFIX}/lib/x86_64-linux-gnu \ + $$system(qmake -query QT_INSTALL_LIBS) + } + android{ + LIBPATH += $${PREFIX}/lib/armv5 + LIB_DIRS = $${PREFIX}/lib/armv5 + } +} + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + +contains(ANDROID_TARGET_ARCH,armeabi) { + ANDROID_EXTRA_LIBS = +} diff --git a/src/gui/qml/components/ListViewDelegateFactory.qml b/src/gui/qml/components/ListViewDelegateFactory.qml new file mode 100644 index 00000000..800f9eeb --- /dev/null +++ b/src/gui/qml/components/ListViewDelegateFactory.qml @@ -0,0 +1,182 @@ +import QtQuick 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 +import QtQuick.Dialogs 1.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +Item { + id: root + property int myListViewsHeight: 0 + property int myListViewsWidth: 0 + property var componentMap: { + "ComboBox": myComboBox, + "SpinBox": mySpinBox + } + width: myListViewsWidth + + Loader { + id: listViewFactoryLoader + function setSourceComponent(comp) { + sourceComponent = comp; + } + + } + + Component { + id: myComboBox + Rectangle { + color: mouse.pressed ? "#11000000" : "white" + width: root.width + height: Math.round(comboBoxTitle.contentHeight*2.1 + comboBoxValue.contentHeight*1.0) + Text { + id: comboBoxTitle + anchors.left: parent.left + anchors.margins: 30 + y: myValue != "" ? Math.round(parent.height*0.5 - contentHeight*0.9) : Math.round(parent.height*0.5 - contentHeight*0.5) + color: "black" + font.pixelSize: Math.round(myListViewsHeight*0.06) + text: myTitle + } + Text { + id: comboBoxValue + anchors.left: parent.left + anchors.margins: 30 + y: Math.round(parent.height*0.5 + contentHeight*0.15) + color: "grey" + font.pixelSize: myValue != "" ? Math.round(myListViewsHeight*0.05) : 0 + text: myValue + } + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + width: parent.width - 30 + height: 1 + color: "lightgrey" + } + MouseArea { + id: mouse + anchors.fill: parent + onClicked: { + myComboBoxSelector.show(myTitle, myValuesList) + } + } + + Component.onCompleted: { + root.height = Qt.binding(function() { return height }) + } + } + } + + Component { + id: mySpinBox + Rectangle { + width: root.width + height: Math.round(comboBoxTitle.contentHeight*2.1 + comboBoxValue.contentHeight*1.0) + Text { + id: comboBoxTitle + anchors.left: parent.left + anchors.margins: 30 + y: myValue != "" ? Math.round(parent.height*0.5 - contentHeight*0.9) : Math.round(parent.height*0.5 - contentHeight*0.5) + color: "black" + font.pixelSize: Math.round(myListViewsHeight*0.06) + text: myTitle + } + Text { + id: comboBoxValue + anchors.left: parent.left + anchors.margins: 30 + y: Math.round(parent.height*0.5 + contentHeight*0.15) + color: "grey" + font.pixelSize: myValue != "" ? Math.round(myListViewsHeight*0.05) : 0 + text: myValue + } + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + width: parent.width - 30 + height: 1 + color: "lightgrey" + } + MouseArea { + anchors.fill: parent + } + Component.onCompleted: { + root.height = Qt.binding(function() { return height }) + } + } + } + + Component.onCompleted: { + listViewFactoryLoader.setSourceComponent(componentMap[myType]) + } +} + +// Column { +// anchors.verticalCenter: parent.verticalCenter +// anchors.left: parent.left +// anchors.leftMargin: 30 +// Text { +// id: comboBoxTitle +// color: "#0F0F0F" +// font.pixelSize: parent.height*0.30 +// renderType: Text.NativeRendering +// text: title +// anchors.left: parent.left +// } +// Text { +// id: comboBoxValue +// color: "#0F0F0F" +// font.pixelSize: parent.height*0.30 +// renderType: Text.NativeRendering +// text: value +// anchors.left: parent.left +// } +// } +// Rectangle { //seperator +// anchors.horizontalCenter: parent.horizontalCenter +// anchors.bottom: parent.bottom +// width: parent.width - 30 +// height: 1 +// color: "lightgrey" +// } +// MouseArea { +// id: mouse +// anchors.fill: parent +// onClicked: root.clicked() + +// } + + +// Image { +// anchors.right: parent.right +// anchors.rightMargin: 20 +// anchors.verticalCenter: parent.verticalCenter +// source: "../../images/navigation_next_item.png" +// } + +//// CheckBox { +//// id: myCheckBox +//// anchors.verticalCenter: parent.verticalCenter +//// x: rect1.width-rect1.width*0.10 +//// style: CheckBoxStyle { +//// indicator: Rectangle { +//// color: "#FAFAFA" +//// implicitWidth: rect1.width*0.04 +//// implicitHeight: rect1.width*0.04 +//// radius: 3 +//// border.color: control.activeFocus ? "darkblue" : "gray" +//// border.width: 1 +//// Rectangle { +//// visible: control.checked +//// color: "#555" +//// border.color: "#333" +//// radius: 1 +//// anchors.margins: 4 +//// anchors.fill: parent +//// } +//// } +//// } +//// } + + diff --git a/src/gui/qml/components/MyComboBoxSelector.qml b/src/gui/qml/components/MyComboBoxSelector.qml new file mode 100644 index 00000000..528a1a3f --- /dev/null +++ b/src/gui/qml/components/MyComboBoxSelector.qml @@ -0,0 +1,89 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +Rectangle { + id: selector + z:1000 + visible: false + anchors.fill: parent + color: "#88000000" //Background + + property ListModel mySelectionModel: ListModel {} + property string myTitleString + property var returnSelection + + function show(title, map) { + //at first fill the model + myTitleString = title +// for (var i=0; i < map.count; i++) { +// mySelectionModel.append({"value": map.get(i).value}); +// } + visible = true; + } + + function reject() { + visible = false; + } + + function selected() { + visible = false; + } + + MouseArea { + anchors.fill: parent + onClicked: console.log("1001") + } + + Rectangle { + id: selectionBox + visible: true + color: "white" + height: Math.round(parent.height*0.9) + width: Math.round(parent.width*0.6) + x: Math.round(parent.width*0.5 - width*0.5) + y: Math.round(parent.height*0.5 - height*0.5) + ColumnLayout { + anchors.fill: parent + Text { + id: titleText + font.pixelSize: Math.round(selectionBox.height*0.10) + font.bold: true + text: myTitleString + anchors.left: parent.left + anchors.margins: 30 + Layout.preferredHeight: titleText.contentHeight + } + ScrollView { + ListView { + anchors.fill: parent + model: mySelectionModel + delegate: Text { + text: modelData + } + } + } + Text { + id: cancelButton + font.pixelSize: Math.round(selectionBox.height*0.07) + font.bold: true + text: qsTr("Cancel") + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 50 + Layout.preferredHeight: cancelButton.contentHeight + + MouseArea { + id: cancelMouse + anchors.fill: parent +// preventStealing: true + onClicked: { + console.log("1002") + reject() + } + } + } + } + } +} + diff --git a/src/gui/qml/images/arrow_back.svg b/src/gui/qml/images/arrow_back.svg new file mode 100644 index 00000000..468511e0 --- /dev/null +++ b/src/gui/qml/images/arrow_back.svg @@ -0,0 +1 @@ + diff --git a/src/gui/qml/images/button-default.png b/src/gui/qml/images/button-default.png new file mode 100644 index 00000000..f51e18c0 Binary files /dev/null and b/src/gui/qml/images/button-default.png differ diff --git a/src/gui/qml/images/button-pressed.png b/src/gui/qml/images/button-pressed.png new file mode 100644 index 00000000..aa4df043 Binary files /dev/null and b/src/gui/qml/images/button-pressed.png differ diff --git a/src/gui/qml/images/check.svg b/src/gui/qml/images/check.svg new file mode 100644 index 00000000..af70b048 --- /dev/null +++ b/src/gui/qml/images/check.svg @@ -0,0 +1 @@ + diff --git a/src/gui/qml/images/more_vert.svg b/src/gui/qml/images/more_vert.svg new file mode 100644 index 00000000..4e02e7bd --- /dev/null +++ b/src/gui/qml/images/more_vert.svg @@ -0,0 +1 @@ + diff --git a/src/gui/qml/images/pokerth-logo.svg b/src/gui/qml/images/pokerth-logo.svg new file mode 100755 index 00000000..39a80bc2 --- /dev/null +++ b/src/gui/qml/images/pokerth-logo.svg @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/gui/qml/images/startViewBackground.png b/src/gui/qml/images/startViewBackground.png new file mode 100644 index 00000000..6b5fa93e Binary files /dev/null and b/src/gui/qml/images/startViewBackground.png differ diff --git a/src/gui/qml/qmlwrapper.cpp b/src/gui/qml/qmlwrapper.cpp index db5592b5..05344e1a 100644 --- a/src/gui/qml/qmlwrapper.cpp +++ b/src/gui/qml/qmlwrapper.cpp @@ -1,24 +1,31 @@ #include -#include "startview/startview.h" +#include +#include + +//#include "startview/startview.h" #include "qmlwrapper.h" qmlWrapper::qmlWrapper() + :QObject() { qDebug("qmlWrapperKonstruktor"); - myStartView.reset(new startView); + myEngine.reset(new QQmlApplicationEngine); + myEngine->load(QUrl(QStringLiteral("qrc:/main.qml"))); + +// QTimer *timer = new QTimer(this); +// timer->setSingleShot(true); +// connect(timer, SIGNAL(timeout()), this, SLOT(showStartForm())); +// timer->start(1000); } qmlWrapper::~qmlWrapper() { + myEngine->deleteLater(); } qmlWrapper::qmlWrapper(const qmlWrapper&) + :QObject() { -} -void qmlWrapper::showStartView() -{ - qDebug("showStartView() in qmlWrapper"); - myStartView->show(); } diff --git a/src/gui/qml/qmlwrapper.h b/src/gui/qml/qmlwrapper.h index b01d15ad..92e167ba 100644 --- a/src/gui/qml/qmlwrapper.h +++ b/src/gui/qml/qmlwrapper.h @@ -1,21 +1,22 @@ #ifndef QMLWRAPPER_H #define QMLWRAPPER_H - +#include #include -class startView; +class QQmlApplicationEngine; -class qmlWrapper +class qmlWrapper: public QObject { + Q_OBJECT public: qmlWrapper(); ~qmlWrapper(); qmlWrapper(const qmlWrapper&); - void showStartView(); +public slots: private: - boost::shared_ptr myStartView; + boost::shared_ptr myEngine; }; #endif // QMLWRAPPER_H diff --git a/src/gui/qml/views/MainForm.ui.qml b/src/gui/qml/views/MainForm.ui.qml deleted file mode 100644 index e557debb..00000000 --- a/src/gui/qml/views/MainForm.ui.qml +++ /dev/null @@ -1,31 +0,0 @@ -import QtQuick 2.4 -import QtQuick.Controls 1.3 -import QtQuick.Layouts 1.1 - -Item { - width: 640 - height: 480 - - property alias button3: button3 - property alias button2: button2 - property alias button1: button1 - - RowLayout { - anchors.centerIn: parent - - Button { - id: button1 - text: qsTr("Press Me 1") - } - - Button { - id: button2 - text: qsTr("Press Me 2") - } - - Button { - id: button3 - text: qsTr("Press Me 3") - } - } -} diff --git a/src/gui/qml/views/createlocalgameview/CreateLocalGameView.qml b/src/gui/qml/views/createlocalgameview/CreateLocalGameView.qml new file mode 100644 index 00000000..a1b726a4 --- /dev/null +++ b/src/gui/qml/views/createlocalgameview/CreateLocalGameView.qml @@ -0,0 +1,85 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QtQuick.Layouts 1.1 +import "../../components" + +Rectangle { + + width: parent.width + height: parent.height + color: "#FAFAFA" + + MyComboBoxSelector { + id: myComboBoxSelector + } + + ScrollView { + width: parent.width + height: parent.height + + ListView { + id:myListView + anchors.fill: parent + model: ListModel { + ListElement { + myId: "comboBox_NumberOfPlayers" + myTitle: qsTr("Number of players") + myType: "ComboBox" + myValue: "10" + // property var myValuesInt: [10, 9, 8, 7, 6, 5, 4, 3, 2] + } + ListElement { + myId: "spinBox_StartCash" + myTitle: qsTr("Start cash") + myType: "SpinBox" + myMaxValue: 10000000 + myMinValue: 1000 + myPrefix: "$" + myValue: "5000" + } + ListElement { + myId: "comboBox_Blinds" + myTitle: qsTr("Blinds") + myType: "ComboBox" + myValuesList: [ + ListElement { value: qsTr("Use saved blinds settings") }, + ListElement { value: qsTr("Change blinds settings ...") } + ] + myValue: "0" + } + ListElement { + myId: "comboBox_GameSpeed" + myTitle: qsTr("Game speed") + myType: "ComboBox" + // myValuesInt: [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] + myValue: "5" + } + ListElement { + myId: "comboBox_GameSpeed" + myTitle: qsTr("Game speed") + myType: "ComboBox" + // myValuesInt: [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] + myValue: "5" + } + } + delegate: ListViewDelegateFactory { + myListViewsHeight: myListView.height + myListViewsWidth: myListView.width + } + } + } + + function setupToolBar() { + toolBarRightButton.myIconName = "accept"; + toolBarLeftButton.myIconName = "back"; + } + + Component.onCompleted: { + setupToolBar(); + } + onVisibleChanged: { + if(visible) setupToolBar() + } + +} diff --git a/src/gui/qml/views/deployment.pri b/src/gui/qml/views/deployment.pri deleted file mode 100644 index 5441b63d..00000000 --- a/src/gui/qml/views/deployment.pri +++ /dev/null @@ -1,27 +0,0 @@ -android-no-sdk { - target.path = /data/user/qt - export(target.path) - INSTALLS += target -} else:android { - x86 { - target.path = /libs/x86 - } else: armeabi-v7a { - target.path = /libs/armeabi-v7a - } else { - target.path = /libs/armeabi - } - export(target.path) - INSTALLS += target -} else:unix { - 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/src/gui/qml/views/main.cpp b/src/gui/qml/views/main.cpp deleted file mode 100644 index 1e5bf587..00000000 --- a/src/gui/qml/views/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/src/gui/qml/views/main.qml b/src/gui/qml/views/main.qml deleted file mode 100644 index e09bc3d4..00000000 --- a/src/gui/qml/views/main.qml +++ /dev/null @@ -1,42 +0,0 @@ -import QtQuick 2.4 -import QtQuick.Controls 1.3 -import QtQuick.Window 2.2 -import QtQuick.Dialogs 1.2 - -ApplicationWindow { - title: qsTr("Hello World") - width: 640 - height: 480 - visible: true - - menuBar: MenuBar { - Menu { - title: qsTr("&File") - MenuItem { - text: qsTr("&Open") - onTriggered: messageDialog.show(qsTr("Open action triggered")); - } - MenuItem { - text: qsTr("E&xit") - onTriggered: Qt.quit(); - } - } - } - - MainForm { - anchors.fill: parent - button1.onClicked: messageDialog.show(qsTr("Button 1 pressed")) - button2.onClicked: messageDialog.show(qsTr("Button 2 pressed")) - button3.onClicked: messageDialog.show(qsTr("Button 3 pressed")) - } - - MessageDialog { - id: messageDialog - title: qsTr("May I have your attention, please?") - - function show(caption) { - messageDialog.text = caption; - messageDialog.open(); - } - } -} diff --git a/src/gui/qml/views/qml.qrc b/src/gui/qml/views/qml.qrc deleted file mode 100644 index 7684346a..00000000 --- a/src/gui/qml/views/qml.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - main.qml - MainForm.ui.qml - - diff --git a/src/gui/qml/views/startview/StartButton.qml b/src/gui/qml/views/startview/StartButton.qml new file mode 100644 index 00000000..15da246d --- /dev/null +++ b/src/gui/qml/views/startview/StartButton.qml @@ -0,0 +1,42 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +Button { + property string page + + width: parent.width*0.50 + height: parent.height/7 + onClicked: stackView.push(Qt.resolvedUrl(page)) + anchors.horizontalCenter: parent.horizontalCenter + + Component { + id: myStyle + ButtonStyle { + panel: Item { + implicitHeight: height + implicitWidth: width + BorderImage { + anchors.fill: parent + antialiasing: true + border.bottom: 8 + border.top: 8 + border.left: 8 + border.right: 8 + anchors.margins: control.pressed ? -4 : 0 + source: control.pressed ? "../../images/button-pressed.png" : "../../images/button-default.png" + Text { + text: control.text + anchors.centerIn: parent + color: "white" + font.pixelSize: Math.min(parent.width*0.10, parent.height*0.40) + renderType: Text.NativeRendering + } + } + } + } + } + + style: myStyle +} + diff --git a/src/gui/qml/views/startview/StartView.qml b/src/gui/qml/views/startview/StartView.qml new file mode 100644 index 00000000..3e0f2190 --- /dev/null +++ b/src/gui/qml/views/startview/StartView.qml @@ -0,0 +1,41 @@ +import QtQuick 2.4 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.1 + +Item { + Image { + id: background + source: "../../images/startViewBackground.png" + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + } + ColumnLayout { + anchors.fill: parent + StartButton { + text: qsTr("Local game") + page: "../createlocalgameview/CreateLocalGameView.qml" + } + + StartButton { + text: qsTr("Internet game") + page: "JoinInternetGameView.qml" + } + + StartButton { + text: qsTr("Logs") + page: "LogsView.qml" + } + } + + function setupToolBar() { + toolBarRightButton.myIconName = "more"; + toolBarLeftButton.myIconName = "PokerTH"; + } + + Component.onCompleted: { + setupToolBar(); + } + onVisibleChanged: { + if(visible) setupToolBar() + } +} diff --git a/src/pokerth.cpp b/src/pokerth.cpp index 2c18d25f..97b79d32 100755 --- a/src/pokerth.cpp +++ b/src/pokerth.cpp @@ -38,7 +38,6 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); qmlWrapper myQml; - myQml.showStartView(); return app.exec(); }