From b6068fb0a0f857187dee116dc74d8be198e3bcd6 Mon Sep 17 00:00:00 2001 From: Felix Hammer Date: Wed, 19 Aug 2015 15:08:54 +0200 Subject: [PATCH] QML:Starting seperate AppStyle file for central GUI adjustments (maybe later depending on dpi) CreateLocalGameView: New delegate for viewing Blinds raise mode --- .../MyBlindsRaiseIntervalSelector.qml | 20 +-- .../components/MyBlindsRaiseModeSelector.qml | 135 ++++++++++++++++++ src/gui/qml/components/MyComboBoxSelector.qml | 4 +- .../components/MyListViewDelegateFactory.qml | 121 ++++++++++++++-- src/gui/qml/components/MySpinBoxSelector.qml | 8 +- src/gui/qml/components/styles/AppStyle.qml | 34 +++++ .../components/styles/MyRadioButtonStyle.qml | 3 +- .../components/styles/MyTextFieldStyle.qml | 9 +- src/gui/qml/components/styles/qmldir | 1 + src/gui/qml/cpp/qmlconfig.cpp | 24 ++++ src/gui/qml/cpp/qmlconfig.h | 2 + src/gui/qml/main.qml | 27 ++-- src/gui/qml/qml.qrc | 3 + .../CreateLocalGameView.qml | 26 +++- 14 files changed, 365 insertions(+), 52 deletions(-) create mode 100644 src/gui/qml/components/MyBlindsRaiseModeSelector.qml create mode 100644 src/gui/qml/components/styles/AppStyle.qml create mode 100644 src/gui/qml/components/styles/qmldir diff --git a/src/gui/qml/components/MyBlindsRaiseIntervalSelector.qml b/src/gui/qml/components/MyBlindsRaiseIntervalSelector.qml index 71b56caf..a7b9cf5c 100644 --- a/src/gui/qml/components/MyBlindsRaiseIntervalSelector.qml +++ b/src/gui/qml/components/MyBlindsRaiseIntervalSelector.qml @@ -73,10 +73,10 @@ Rectangle { ColumnLayout { id: content anchors.fill: parent - spacing: appWindow.columnLayoutSpacing + spacing: AppStyle.columnLayoutSpacing Text { id: titleText - font.pixelSize: appWindow.selectorTitleFontSize + font.pixelSize: AppStyle.selectorTitleFontSize font.bold: true text: qsTr("Raise blinds") anchors.left: parent.left @@ -87,7 +87,7 @@ Rectangle { ExclusiveGroup { id: raiseTypeGroup } RowLayout { //Hands interval section - spacing: appWindow.rowLayoutSpacing + spacing: AppStyle.rowLayoutSpacing RadioButton { id: radioBtnRaiseOnHands @@ -101,7 +101,7 @@ Rectangle { TextField { id: textFieldHandsInterval - width: appWindow.textFieldFontSize*2 + width: AppStyle.textFieldFontSize*2 validator: IntValidator{bottom: raiseOnHandsMinimum; top: raiseOnHandsMaximum;} text: raiseOnHandsInterval function correctValue() { @@ -116,12 +116,12 @@ Rectangle { } Text { id: onHandsString - font.pixelSize: appWindow.selectorValueFontSize + font.pixelSize: AppStyle.selectorValueFontSize text: qsTr("hands") } } RowLayout { //Minutes interval section - spacing: appWindow.rowLayoutSpacing + spacing: AppStyle.rowLayoutSpacing RadioButton { id: radioBtnRaiseOnMinutes exclusiveGroup: raiseTypeGroup @@ -135,7 +135,7 @@ Rectangle { id: textFieldMinutesInterval validator: IntValidator{bottom: raiseOnMinutesMinimum; top: raiseOnMinutesMaximum;} text: raiseOnMinutesInterval - width: appWindow.textFieldFontSize*2 + width: AppStyle.textFieldFontSize*2 function correctValue() { text = GlobalTools.correctTextFieldIntegerValue(selector, text, raiseOnMinutesMinimum); @@ -149,7 +149,7 @@ Rectangle { } Text { id: onMinutesString - font.pixelSize: appWindow.selectorValueFontSize + font.pixelSize: AppStyle.selectorValueFontSize text: qsTr("minutes") } } @@ -164,7 +164,7 @@ Rectangle { Text { id: cancelButton - font.pixelSize: appWindow.selectorButtonFontSize + font.pixelSize: AppStyle.selectorButtonFontSize font.bold: true text: qsTr("CANCEL") Layout.preferredHeight: contentHeight @@ -178,7 +178,7 @@ Rectangle { } Text { id: okButton - font.pixelSize: appWindow.selectorButtonFontSize + font.pixelSize: AppStyle.selectorButtonFontSize font.bold: true color: GlobalColors.accentColor text: qsTr("OK") diff --git a/src/gui/qml/components/MyBlindsRaiseModeSelector.qml b/src/gui/qml/components/MyBlindsRaiseModeSelector.qml new file mode 100644 index 00000000..07588712 --- /dev/null +++ b/src/gui/qml/components/MyBlindsRaiseModeSelector.qml @@ -0,0 +1,135 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import "../js/colors.js" as GlobalColors +import "../js/tools.js" as GlobalTools +import "styles" + +Rectangle { + id: selector + z:1000 + visible: false + anchors.fill: parent + color: "#88000000" //dark transparent background + + property string titleString: "" + property bool alwaysDoubleBlinds: false + property var manualBlindsList + property bool afterMBAlwaysDoubleBlinds: false + property bool afterMBAlwaysRaiseAbout: false + property bool afterMBStayAtLastBlind: false + property int afterMBAlwaysRaiseValue: 0 + property bool ready: false + + function show(doubleBlinds, list, afterMBDouble, afterMBRaise, afterMBRaiseValue, afterMBStay) { + alwaysDoubleBlinds = doubleBlinds; + manualBlindsList = list; + afterMBAlwaysDoubleBlinds = afterMBDouble; + afterMBAlwaysRaiseAbout = afterMBRaise; + afterMBAlwaysRaiseValue = afterMBRaiseValue; + afterMBStayAtLastBlind = afterMBStay; + visible = true; + +// if(raiseOnHandsType == "1") { +// textFieldHandsInterval.focus = true; +// radioBtnRaiseOnHands.checked = true; +// } +// else { +// textFieldMinutesInterval.focus = true; +// radioBtnRaiseOnMinutes.checked = true; +// } + } + + function reject() { + visible = false; + } + + function selected(doubleBlinds, list, afterMBDouble, afterMBRaise, afterMBRaiseValue, afterMBStay) { + alwaysDoubleBlinds = doubleBlinds; + manualBlindsList = list; + afterMBAlwaysDoubleBlinds = afterMBDouble; + afterMBAlwaysRaiseAbout = afterMBRaise; + afterMBAlwaysRaiseValue = afterMBRaiseValue; + afterMBStayAtLastBlind = afterMBStay; + visible = false; + } + + MouseArea { + //set empty MouseArea to prevent the background to be clicked + anchors.fill: parent + } + + 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) + radius: Math.round(parent.height*0.01) + + Rectangle { + id: selectionBoxcontent + anchors.fill: parent + anchors.margins: Math.round(appWindow.height*0.05) + + ColumnLayout { + id: contentColumnLayout + anchors.fill: parent + spacing: AppStyle.columnLayoutSpacing + +// TODO always double or manual list + + + + + + + RowLayout { //bottom button line + width: parent.width + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.bottomMargin: -Math.round(appWindow.height*0.017) + spacing: okButton.contentWidth + Layout.preferredHeight: cancelButton.contentHeight + + Text { + id: cancelButton + font.pixelSize: appWindow.selectorButtonFontSize + font.bold: true + text: qsTr("CANCEL") + Layout.preferredHeight: contentHeight + MouseArea { + id: cancelMouse + anchors.fill: parent + onClicked: { + reject() + } + } + } + Text { + id: okButton + font.pixelSize: appWindow.selectorButtonFontSize + font.bold: true + color: GlobalColors.accentColor + text: qsTr("OK") + Layout.preferredHeight: contentHeight + MouseArea { + id: okMouse + anchors.fill: parent + onClicked: { +// textFieldHandsInterval.correctValue(); +// textFieldMinutesInterval.correctValue(); + //return values +// selected(radioBtnRaiseOnHands.checked ? "1": "0", textFieldHandsInterval.text, textFieldMinutesInterval.text); + } + } + } + } + } + } + } + Component.onCompleted: ready = true; +} diff --git a/src/gui/qml/components/MyComboBoxSelector.qml b/src/gui/qml/components/MyComboBoxSelector.qml index faffa243..2d78749d 100644 --- a/src/gui/qml/components/MyComboBoxSelector.qml +++ b/src/gui/qml/components/MyComboBoxSelector.qml @@ -66,7 +66,7 @@ Rectangle { spacing: Math.round(selectionBox.height*0.06) Text { id: titleText - font.pixelSize: appWindow.selectorTitleFontSize + font.pixelSize: AppStyle.selectorTitleFontSize font.bold: true text: titleString anchors.left: parent.left @@ -101,7 +101,7 @@ Rectangle { } Text { id: cancelButton - font.pixelSize: appWindow.selectorButtonFontSize + font.pixelSize: AppStyle.selectorButtonFontSize font.bold: true text: qsTr("CANCEL") anchors.right: parent.right diff --git a/src/gui/qml/components/MyListViewDelegateFactory.qml b/src/gui/qml/components/MyListViewDelegateFactory.qml index 8b243075..9669df83 100644 --- a/src/gui/qml/components/MyListViewDelegateFactory.qml +++ b/src/gui/qml/components/MyListViewDelegateFactory.qml @@ -4,6 +4,7 @@ import QtQuick.Window 2.0 import QtQuick.Dialogs 1.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 +import "styles" Item { id: root @@ -14,8 +15,9 @@ Item { property var componentMap: { "ComboBox": myComboBox, - "SpinBox": mySpinBox, - "BlindsRaiseInterval": myBlindsRaiseInterval + "SpinBox": mySpinBox, + "BlindsRaiseInterval": myBlindsRaiseInterval, + "BlindsRaiseMode": myBlindsRaiseMode } width: myListViewsWidth @@ -46,7 +48,7 @@ Item { 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: appWindow.listViewTitleFontSize + font.pixelSize: AppStyle.listViewTitleFontSize text: myTitle } Text { @@ -55,7 +57,7 @@ Item { anchors.margins: 30 y: Math.round(parent.height*0.5 + contentHeight*0.15) color: "grey" - font.pixelSize: myValue != "" ? appWindow.listViewValueFontSize : 0 + font.pixelSize: myValue != "" ? AppStyle.listViewValueFontSize : 0 //setup value from Index if necessary text: myValueIsIndex ? myValuesList.get(parseInt(myValue)).value : myValue } @@ -111,7 +113,7 @@ Item { 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: appWindow.listViewTitleFontSize + font.pixelSize: AppStyle.listViewTitleFontSize text: myTitle } Text { @@ -120,7 +122,7 @@ Item { anchors.margins: 30 y: Math.round(parent.height*0.5 + contentHeight*0.15) color: "grey" - font.pixelSize: myValue != "" ? appWindow.listViewValueFontSize : 0 + font.pixelSize: myValue != "" ? AppStyle.listViewValueFontSize : 0 text: myPrefix+myValue } Rectangle { @@ -175,7 +177,7 @@ Item { 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: appWindow.listViewTitleFontSize + font.pixelSize: AppStyle.listViewTitleFontSize text: myTitle } Text { @@ -184,7 +186,7 @@ Item { anchors.margins: 30 y: Math.round(parent.height*0.5 + contentHeight*0.15) color: "grey" - font.pixelSize: myValue != "" ? appWindow.listViewValueFontSize : 0 + font.pixelSize: AppStyle.listViewValueFontSize text: "" function buildTextString() { @@ -232,10 +234,105 @@ Item { } } - // BlindsRaiseType --> Always double vs. Manual blinds List -// Component { -// //TODO -// } + Component { + id: myBlindsRaiseMode // Always double vs. Manual blinds List + + Rectangle { + id: myBlindsRaiseModeContent + + MyBlindsRaiseModeSelector { + id: myBlindsRaiseModeSelector + parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView + } + + property int modelIndex: model.index + color: mouse.pressed ? "#11000000" : "white" + width: root.width + height: Math.round(blindsRaiseModeTitle.contentHeight*2.1 + blindsRaiseModeValue.contentHeight*1.0) + ColumnLayout { + anchors.verticalCenter: parent.verticalCenter + Text { + id: blindsRaiseModeTitle + anchors.left: parent.left + anchors.leftMargin: 30 + color: "black" + font.pixelSize: AppStyle.listViewTitleFontSize + text: myTitle + Layout.preferredHeight: contentHeight + } + Text { + id: blindsRaiseModeValue + anchors.left: parent.left + anchors.leftMargin: 30 + color: "grey" + font.pixelSize: AppStyle.listViewValueFontSize + text: "" + wrapMode: Text.WordWrap //maybe blinds list are too long + Layout.preferredHeight: contentHeight + + function buildTextString() { + if(myAlwaysDoubleBlinds == "1") { + text = qsTr("Always double blinds"); + } + else { + //build manual blindsList + var tempString = "" + for (var i=0; i < myManualBlindsList.count; i++) { + tempString = tempString + "$" + myManualBlindsList.get(i).blindValue.toString() + ", "; + } + text = tempString.substring(0, tempString.length - 2); + if(myAfterMBAlwaysDoubleBlinds == "1") { + text = text + "\n" + qsTr("afterwards always double blinds"); + } + else if (myAfterMBAlwaysRaiseAbout == "1") { + text = text + "\n" + qsTr("afterwards always raise about $") + myAfterMBAlwaysRaiseValue; + } + else { + text = text + "\n" + qsTr("afterwards keep last blind") + } + } + } + + Component.onCompleted: { + buildTextString(); + } + } + } + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + width: parent.width - 30 + height: 1 + color: "lightgrey" + } + MouseArea { + id: mouse + anchors.fill: parent + onClicked: { +// call selector overlay and set inital values + myBlindsRaiseModeSelector.show(myAlwaysDoubleBlinds, myManualBlindsList, myAfterMBAlwaysDoubleBlinds, myAfterMBAlwaysRaiseAbout, myAfterMBAlwaysRaiseValue, myAfterMBStayAtLastBlind); + } + // Connections { + // target: myBlindsRaiseIntervalSelector + // onVisibleChanged: { + // if(!myBlindsRaiseIntervalSelector.visible) { + // //call update the currentItem with selection from the comboBox selector + // myListViewModel.setProperty(myBlindsRaiseIntervalContent.modelIndex, "myRaiseOnHandsType", myBlindsRaiseIntervalSelector.raiseOnHandsType); + // myListViewModel.setProperty(myBlindsRaiseIntervalContent.modelIndex, "myRaiseOnHandsInterval", myBlindsRaiseIntervalSelector.raiseOnHandsInterval); + // myListViewModel.setProperty(myBlindsRaiseIntervalContent.modelIndex, "myRaiseOnMinutesInterval", myBlindsRaiseIntervalSelector.raiseOnMinutesInterval); + // //here we also need to trigger the textStringBuild from the model again + // blindsRaiseIntevalValue.buildTextString(); + // } + // } + // } + } + + Component.onCompleted: { + //after building the delegate content set the final height to the root item + root.height = Qt.binding(function() { return height }) + } + } + } Component.onCompleted: { listViewFactoryLoader.setSourceComponent(componentMap[myType]) diff --git a/src/gui/qml/components/MySpinBoxSelector.qml b/src/gui/qml/components/MySpinBoxSelector.qml index a8c62b20..2591a803 100644 --- a/src/gui/qml/components/MySpinBoxSelector.qml +++ b/src/gui/qml/components/MySpinBoxSelector.qml @@ -68,7 +68,7 @@ Rectangle { spacing: Math.round(selectionBox.height*0.06) Text { id: titleText - font.pixelSize: appWindow.fontSizeH1 + font.pixelSize: AppStyle.selectorTitleFontSize font.bold: true text: titleString anchors.left: parent.left @@ -84,7 +84,7 @@ Rectangle { anchors.rightMargin: 50 //make space for the prefix anchors.leftMargin: 50 + Math.round(appWindow.height*0.03) - validator: IntValidator{bottom: minValue; top: maxValue;} // TODO: test validator in later QtVersions > 5.5.0 + validator: IntValidator{bottom: minValue; top: maxValue;} function correctValue() { text = GlobalTools.correctTextFieldIntegerValue(selector, text, minValue); @@ -159,7 +159,7 @@ Rectangle { Text { id: cancelButton - font.pixelSize: appWindow.selectorButtonFontSize + font.pixelSize: AppStyle.selectorButtonFontSize font.bold: true text: qsTr("CANCEL") Layout.preferredHeight: contentHeight @@ -173,7 +173,7 @@ Rectangle { } Text { id: okButton - font.pixelSize: appWindow.selectorButtonFontSize + font.pixelSize: AppStyle.selectorButtonFontSize font.bold: true color: GlobalColors.accentColor text: qsTr("OK") diff --git a/src/gui/qml/components/styles/AppStyle.qml b/src/gui/qml/components/styles/AppStyle.qml new file mode 100644 index 00000000..b7331605 --- /dev/null +++ b/src/gui/qml/components/styles/AppStyle.qml @@ -0,0 +1,34 @@ +pragma Singleton +import QtQuick 2.4 +import QtQuick.Window 2.0 + +QtObject { + id: myAppStyle + + property int appHeight: 0 + property int appWidth: 0 + + property int fontSizeH1: Math.round(appHeight*0.10) + property int fontSizeH2: Math.round(appHeight*0.09) + property int fontSizeH3: Math.round(appHeight*0.08) + property int fontSizeH4: Math.round(appHeight*0.07) + property int fontSizeH5: Math.round(appHeight*0.06) + property int fontSizeH6: Math.round(appHeight*0.05) + + property int listViewTitleFontSize: fontSizeH5 + property int listViewValueFontSize: fontSizeH6 + property int selectorTitleFontSize: fontSizeH2 + property int selectorValueFontSize: fontSizeH5 + property int selectorButtonFontSize: fontSizeH6 + property int radioButtonLabelFontSize: fontSizeH5 + property int textFieldFontSize: fontSizeH2 + + property int rowLayoutSpacing: Math.round(appHeight*0.06) + property int columnLayoutSpacing: Math.round(appHeight*0.06) + + Component.onCompleted: { + console.log("pixelDensity: "+Screen.pixelDensity); + console.log("logicalPixelDensity: " +Screen.logicalPixelDensity); + console.log("devicePixelRatio: " +Screen.devicePixelRatio); + } +} diff --git a/src/gui/qml/components/styles/MyRadioButtonStyle.qml b/src/gui/qml/components/styles/MyRadioButtonStyle.qml index ad1c8cfa..43f8f94a 100644 --- a/src/gui/qml/components/styles/MyRadioButtonStyle.qml +++ b/src/gui/qml/components/styles/MyRadioButtonStyle.qml @@ -1,6 +1,7 @@ import QtQuick 2.4 import QtQuick.Controls.Styles 1.2 import "../../js/colors.js" as GlobalColors +import "." RadioButtonStyle { property var myRadioBtn @@ -22,7 +23,7 @@ RadioButtonStyle { label: Text { anchors.left: parent.left anchors.leftMargin: 10 - font.pixelSize: appWindow.radioButtonLabelFontSize + font.pixelSize: AppStyle.radioButtonLabelFontSize text: labelString MouseArea { diff --git a/src/gui/qml/components/styles/MyTextFieldStyle.qml b/src/gui/qml/components/styles/MyTextFieldStyle.qml index 96c27a9b..8a32d216 100644 --- a/src/gui/qml/components/styles/MyTextFieldStyle.qml +++ b/src/gui/qml/components/styles/MyTextFieldStyle.qml @@ -1,21 +1,22 @@ import QtQuick 2.4 import QtQuick.Controls.Styles 1.2 import "../../js/colors.js" as GlobalColors +import "." TextFieldStyle { property string prefix: "" - property int prefixIndent: prefix != "" ? appWindow.textFieldFontSize*0.33 : 0 + property int prefixIndent: prefix != "" ? AppStyle.textFieldFontSize*0.33 : 0 property var myTextField textColor: "black" - font.pixelSize: appWindow.textFieldFontSize + font.pixelSize: AppStyle.textFieldFontSize background: Item { //bottom line with colored focus indicator - implicitHeight: appWindow.textFieldFontSize + appWindow.textFieldFontSize*0.25 + implicitHeight: AppStyle.textFieldFontSize + AppStyle.textFieldFontSize*0.25 implicitWidth: myTextField.width Text { //prefix visible: prefix != "" ? true : false color: "black" - font.pixelSize: appWindow.textFieldFontSize + font.pixelSize: AppStyle.textFieldFontSize text: prefix anchors.left: parent.left anchors.leftMargin: -prefixIndent diff --git a/src/gui/qml/components/styles/qmldir b/src/gui/qml/components/styles/qmldir new file mode 100644 index 00000000..9574199b --- /dev/null +++ b/src/gui/qml/components/styles/qmldir @@ -0,0 +1 @@ +singleton AppStyle AppStyle.qml diff --git a/src/gui/qml/cpp/qmlconfig.cpp b/src/gui/qml/cpp/qmlconfig.cpp index 7e751e2a..d497c9a0 100644 --- a/src/gui/qml/cpp/qmlconfig.cpp +++ b/src/gui/qml/cpp/qmlconfig.cpp @@ -14,6 +14,30 @@ QString QmlConfig::readConfigString(QString varName) { return QString::fromUtf8(myConfig->readConfigString(varName.toStdString()).c_str()); } +QStringList QmlConfig::readConfigStringList(QString listName) +{ + std::list myList = myConfig->readConfigStringList(listName.toStdString()); + std::list::iterator it1; + QStringList returnList; + + for(it1= myList.begin(); it1 != myList.end(); ++it1) { + returnList.append(QString::fromStdString(*it1)); + } + return returnList; +} + QString QmlConfig::readConfigIntString(QString varName) { return QString::number(myConfig->readConfigInt(varName.toStdString())); } + +QStringList QmlConfig::readConfigIntStringList(QString listName) +{ + std::list myList = myConfig->readConfigIntList(listName.toStdString()); + std::list::iterator it1; + QStringList returnList; + + for(it1= myList.begin(); it1 != myList.end(); ++it1) { + returnList.append(QString::number(*it1,10)); + } + return returnList; +} diff --git a/src/gui/qml/cpp/qmlconfig.h b/src/gui/qml/cpp/qmlconfig.h index f56eab69..bf0f9c72 100644 --- a/src/gui/qml/cpp/qmlconfig.h +++ b/src/gui/qml/cpp/qmlconfig.h @@ -11,7 +11,9 @@ class QmlConfig: public QObject public: Q_INVOKABLE QString readConfigString(QString); + Q_INVOKABLE QStringList readConfigStringList(QString); Q_INVOKABLE QString readConfigIntString(QString); + Q_INVOKABLE QStringList readConfigIntStringList(QString); QmlConfig(boost::shared_ptr); ~QmlConfig(); diff --git a/src/gui/qml/main.qml b/src/gui/qml/main.qml index 37135aef..a1c737f6 100644 --- a/src/gui/qml/main.qml +++ b/src/gui/qml/main.qml @@ -5,33 +5,26 @@ import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import "views/startview" import "js/colors.js" as GlobalColors +import "components/styles" ApplicationWindow { id: appWindow title: qsTr("PokerTH - The open source poker app") + //send infos about app size to the style width: 1024 height: 600 minimumWidth: 320 minimumHeight: 240 visible: true - property int fontSizeH1: Math.round(height*0.10) - property int fontSizeH2: Math.round(height*0.09) - property int fontSizeH3: Math.round(height*0.08) - property int fontSizeH4: Math.round(height*0.07) - property int fontSizeH5: Math.round(height*0.06) - property int fontSizeH6: Math.round(height*0.05) + onHeightChanged: { AppStyle.appHeight = height } + onWidthChanged: { AppStyle.appWidth = width } - property int listViewTitleFontSize: fontSizeH5 - property int listViewValueFontSize: fontSizeH6 - property int selectorTitleFontSize: fontSizeH2 - property int selectorValueFontSize: fontSizeH5 - property int selectorButtonFontSize: fontSizeH6 - property int radioButtonLabelFontSize: fontSizeH5 - property int textFieldFontSize: fontSizeH2 - - property int rowLayoutSpacing: Math.round(appWindow.height*0.06) - property int columnLayoutSpacing: Math.round(appWindow.height*0.06) + Component.onCompleted: { + // initial info about app size for the style + AppStyle.appHeight = height + AppStyle.appWidth = width + } toolBar: Rectangle { @@ -40,7 +33,7 @@ ApplicationWindow { Behavior on opacity { NumberAnimation{} } color: GlobalColors.accentColor width: appWindow.width - height: appWindow.height*0.15 + height: appWindow.height*0.13 Behavior on height { NumberAnimation{} } Rectangle { //Shadow y: parent.height diff --git a/src/gui/qml/qml.qrc b/src/gui/qml/qml.qrc index 21518e47..84243a2e 100644 --- a/src/gui/qml/qml.qrc +++ b/src/gui/qml/qml.qrc @@ -20,5 +20,8 @@ components/styles/MyTextFieldStyle.qml components/styles/MyRadioButtonStyle.qml js/tools.js + components/MyBlindsRaiseModeSelector.qml + components/styles/AppStyle.qml + components/styles/qmldir diff --git a/src/gui/qml/views/createlocalgameview/CreateLocalGameView.qml b/src/gui/qml/views/createlocalgameview/CreateLocalGameView.qml index 429022fc..526df336 100644 --- a/src/gui/qml/views/createlocalgameview/CreateLocalGameView.qml +++ b/src/gui/qml/views/createlocalgameview/CreateLocalGameView.qml @@ -56,13 +56,24 @@ Rectangle { myValue: "" } ListElement { - myId: "comboBox_BlindsRaiseInterval" + myId: "selector_BlindsRaiseInterval" myTitle: qsTr("Blinds raise interval") myType: "BlindsRaiseInterval" myRaiseOnHandsType: "" //if false it is raise on minutes type myRaiseOnHandsInterval: "" myRaiseOnMinutesInterval: "" } + ListElement { + myId: "selector_BlindsRaiseMode" + myTitle: qsTr("Blinds raise mode") + myType: "BlindsRaiseMode" + myAlwaysDoubleBlinds: "" //if false it is "Manual Blinds Order" + myManualBlindsList: [] + myAfterMBAlwaysDoubleBlinds: "" + myAfterMBAlwaysRaiseAbout: "" + myAfterMBAlwaysRaiseValue: "" + myAfterMBStayAtLastBlind: "" + } ListElement { myId: "comboBox_GameSpeed" myTitle: qsTr("Game speed") @@ -92,7 +103,18 @@ Rectangle { createLocalGameViewModel.setProperty(3, "myRaiseOnHandsType", Config.readConfigIntString("RaiseBlindsAtHands")); createLocalGameViewModel.setProperty(3, "myRaiseOnHandsInterval", Config.readConfigIntString("RaiseSmallBlindEveryHands")); createLocalGameViewModel.setProperty(3, "myRaiseOnMinutesInterval", Config.readConfigIntString("RaiseSmallBlindEveryMinutes")); - createLocalGameViewModel.setProperty(4, "myValue", Config.readConfigIntString("GameSpeed")); + createLocalGameViewModel.setProperty(4, "myAlwaysDoubleBlinds", Config.readConfigIntString("AlwaysDoubleBlinds")); + + var tempList = Config.readConfigIntStringList("ManualBlindsList"); + for(var i=0; i < tempList.length; i++) { + createLocalGameViewModel.get(4).myManualBlindsList.append({"blindValue": tempList[i].toString()}) + } + + createLocalGameViewModel.setProperty(4, "myAfterMBAlwaysDoubleBlinds", Config.readConfigIntString("AfterMBAlwaysDoubleBlinds")); + createLocalGameViewModel.setProperty(4, "myAfterMBAlwaysRaiseAbout", Config.readConfigIntString("AfterMBAlwaysRaiseAbout")); + createLocalGameViewModel.setProperty(4, "myAfterMBAlwaysRaiseValue", Config.readConfigIntString("AfterMBAlwaysRaiseValue")); + createLocalGameViewModel.setProperty(4, "myAfterMBStayAtLastBlind", Config.readConfigIntString("AfterMBStayAtLastBlind")); + createLocalGameViewModel.setProperty(5, "myValue", Config.readConfigIntString("GameSpeed")); } } delegate: MyListViewDelegateFactory {