QML:Starting seperate AppStyle file for central GUI adjustments (maybe later depending on dpi)
CreateLocalGameView: New delegate for viewing Blinds raise mode
This commit is contained in:
@@ -73,10 +73,10 @@ Rectangle {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: content
|
id: content
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: appWindow.columnLayoutSpacing
|
spacing: AppStyle.columnLayoutSpacing
|
||||||
Text {
|
Text {
|
||||||
id: titleText
|
id: titleText
|
||||||
font.pixelSize: appWindow.selectorTitleFontSize
|
font.pixelSize: AppStyle.selectorTitleFontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: qsTr("Raise blinds")
|
text: qsTr("Raise blinds")
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -87,7 +87,7 @@ Rectangle {
|
|||||||
ExclusiveGroup { id: raiseTypeGroup }
|
ExclusiveGroup { id: raiseTypeGroup }
|
||||||
|
|
||||||
RowLayout { //Hands interval section
|
RowLayout { //Hands interval section
|
||||||
spacing: appWindow.rowLayoutSpacing
|
spacing: AppStyle.rowLayoutSpacing
|
||||||
|
|
||||||
RadioButton {
|
RadioButton {
|
||||||
id: radioBtnRaiseOnHands
|
id: radioBtnRaiseOnHands
|
||||||
@@ -101,7 +101,7 @@ Rectangle {
|
|||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: textFieldHandsInterval
|
id: textFieldHandsInterval
|
||||||
width: appWindow.textFieldFontSize*2
|
width: AppStyle.textFieldFontSize*2
|
||||||
validator: IntValidator{bottom: raiseOnHandsMinimum; top: raiseOnHandsMaximum;}
|
validator: IntValidator{bottom: raiseOnHandsMinimum; top: raiseOnHandsMaximum;}
|
||||||
text: raiseOnHandsInterval
|
text: raiseOnHandsInterval
|
||||||
function correctValue() {
|
function correctValue() {
|
||||||
@@ -116,12 +116,12 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id: onHandsString
|
id: onHandsString
|
||||||
font.pixelSize: appWindow.selectorValueFontSize
|
font.pixelSize: AppStyle.selectorValueFontSize
|
||||||
text: qsTr("hands")
|
text: qsTr("hands")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RowLayout { //Minutes interval section
|
RowLayout { //Minutes interval section
|
||||||
spacing: appWindow.rowLayoutSpacing
|
spacing: AppStyle.rowLayoutSpacing
|
||||||
RadioButton {
|
RadioButton {
|
||||||
id: radioBtnRaiseOnMinutes
|
id: radioBtnRaiseOnMinutes
|
||||||
exclusiveGroup: raiseTypeGroup
|
exclusiveGroup: raiseTypeGroup
|
||||||
@@ -135,7 +135,7 @@ Rectangle {
|
|||||||
id: textFieldMinutesInterval
|
id: textFieldMinutesInterval
|
||||||
validator: IntValidator{bottom: raiseOnMinutesMinimum; top: raiseOnMinutesMaximum;}
|
validator: IntValidator{bottom: raiseOnMinutesMinimum; top: raiseOnMinutesMaximum;}
|
||||||
text: raiseOnMinutesInterval
|
text: raiseOnMinutesInterval
|
||||||
width: appWindow.textFieldFontSize*2
|
width: AppStyle.textFieldFontSize*2
|
||||||
function correctValue() {
|
function correctValue() {
|
||||||
text = GlobalTools.correctTextFieldIntegerValue(selector, text, raiseOnMinutesMinimum);
|
text = GlobalTools.correctTextFieldIntegerValue(selector, text, raiseOnMinutesMinimum);
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id: onMinutesString
|
id: onMinutesString
|
||||||
font.pixelSize: appWindow.selectorValueFontSize
|
font.pixelSize: AppStyle.selectorValueFontSize
|
||||||
text: qsTr("minutes")
|
text: qsTr("minutes")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ Rectangle {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: cancelButton
|
id: cancelButton
|
||||||
font.pixelSize: appWindow.selectorButtonFontSize
|
font.pixelSize: AppStyle.selectorButtonFontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: qsTr("CANCEL")
|
text: qsTr("CANCEL")
|
||||||
Layout.preferredHeight: contentHeight
|
Layout.preferredHeight: contentHeight
|
||||||
@@ -178,7 +178,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id: okButton
|
id: okButton
|
||||||
font.pixelSize: appWindow.selectorButtonFontSize
|
font.pixelSize: AppStyle.selectorButtonFontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
color: GlobalColors.accentColor
|
color: GlobalColors.accentColor
|
||||||
text: qsTr("OK")
|
text: qsTr("OK")
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -66,7 +66,7 @@ Rectangle {
|
|||||||
spacing: Math.round(selectionBox.height*0.06)
|
spacing: Math.round(selectionBox.height*0.06)
|
||||||
Text {
|
Text {
|
||||||
id: titleText
|
id: titleText
|
||||||
font.pixelSize: appWindow.selectorTitleFontSize
|
font.pixelSize: AppStyle.selectorTitleFontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: titleString
|
text: titleString
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -101,7 +101,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id: cancelButton
|
id: cancelButton
|
||||||
font.pixelSize: appWindow.selectorButtonFontSize
|
font.pixelSize: AppStyle.selectorButtonFontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: qsTr("CANCEL")
|
text: qsTr("CANCEL")
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import QtQuick.Window 2.0
|
|||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
import QtQuick.Controls 1.2
|
import QtQuick.Controls 1.2
|
||||||
import QtQuick.Controls.Styles 1.2
|
import QtQuick.Controls.Styles 1.2
|
||||||
|
import "styles"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -14,8 +15,9 @@ Item {
|
|||||||
|
|
||||||
property var componentMap: {
|
property var componentMap: {
|
||||||
"ComboBox": myComboBox,
|
"ComboBox": myComboBox,
|
||||||
"SpinBox": mySpinBox,
|
"SpinBox": mySpinBox,
|
||||||
"BlindsRaiseInterval": myBlindsRaiseInterval
|
"BlindsRaiseInterval": myBlindsRaiseInterval,
|
||||||
|
"BlindsRaiseMode": myBlindsRaiseMode
|
||||||
}
|
}
|
||||||
width: myListViewsWidth
|
width: myListViewsWidth
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ Item {
|
|||||||
anchors.margins: 30
|
anchors.margins: 30
|
||||||
y: myValue != "" ? Math.round(parent.height*0.5 - contentHeight*0.9) : Math.round(parent.height*0.5 - contentHeight*0.5)
|
y: myValue != "" ? Math.round(parent.height*0.5 - contentHeight*0.9) : Math.round(parent.height*0.5 - contentHeight*0.5)
|
||||||
color: "black"
|
color: "black"
|
||||||
font.pixelSize: appWindow.listViewTitleFontSize
|
font.pixelSize: AppStyle.listViewTitleFontSize
|
||||||
text: myTitle
|
text: myTitle
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
@@ -55,7 +57,7 @@ Item {
|
|||||||
anchors.margins: 30
|
anchors.margins: 30
|
||||||
y: Math.round(parent.height*0.5 + contentHeight*0.15)
|
y: Math.round(parent.height*0.5 + contentHeight*0.15)
|
||||||
color: "grey"
|
color: "grey"
|
||||||
font.pixelSize: myValue != "" ? appWindow.listViewValueFontSize : 0
|
font.pixelSize: myValue != "" ? AppStyle.listViewValueFontSize : 0
|
||||||
//setup value from Index if necessary
|
//setup value from Index if necessary
|
||||||
text: myValueIsIndex ? myValuesList.get(parseInt(myValue)).value : myValue
|
text: myValueIsIndex ? myValuesList.get(parseInt(myValue)).value : myValue
|
||||||
}
|
}
|
||||||
@@ -111,7 +113,7 @@ Item {
|
|||||||
anchors.margins: 30
|
anchors.margins: 30
|
||||||
y: myValue != "" ? Math.round(parent.height*0.5 - contentHeight*0.9) : Math.round(parent.height*0.5 - contentHeight*0.5)
|
y: myValue != "" ? Math.round(parent.height*0.5 - contentHeight*0.9) : Math.round(parent.height*0.5 - contentHeight*0.5)
|
||||||
color: "black"
|
color: "black"
|
||||||
font.pixelSize: appWindow.listViewTitleFontSize
|
font.pixelSize: AppStyle.listViewTitleFontSize
|
||||||
text: myTitle
|
text: myTitle
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
@@ -120,7 +122,7 @@ Item {
|
|||||||
anchors.margins: 30
|
anchors.margins: 30
|
||||||
y: Math.round(parent.height*0.5 + contentHeight*0.15)
|
y: Math.round(parent.height*0.5 + contentHeight*0.15)
|
||||||
color: "grey"
|
color: "grey"
|
||||||
font.pixelSize: myValue != "" ? appWindow.listViewValueFontSize : 0
|
font.pixelSize: myValue != "" ? AppStyle.listViewValueFontSize : 0
|
||||||
text: myPrefix+myValue
|
text: myPrefix+myValue
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -175,7 +177,7 @@ Item {
|
|||||||
anchors.margins: 30
|
anchors.margins: 30
|
||||||
y: myValue != "" ? Math.round(parent.height*0.5 - contentHeight*0.9) : Math.round(parent.height*0.5 - contentHeight*0.5)
|
y: myValue != "" ? Math.round(parent.height*0.5 - contentHeight*0.9) : Math.round(parent.height*0.5 - contentHeight*0.5)
|
||||||
color: "black"
|
color: "black"
|
||||||
font.pixelSize: appWindow.listViewTitleFontSize
|
font.pixelSize: AppStyle.listViewTitleFontSize
|
||||||
text: myTitle
|
text: myTitle
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
@@ -184,7 +186,7 @@ Item {
|
|||||||
anchors.margins: 30
|
anchors.margins: 30
|
||||||
y: Math.round(parent.height*0.5 + contentHeight*0.15)
|
y: Math.round(parent.height*0.5 + contentHeight*0.15)
|
||||||
color: "grey"
|
color: "grey"
|
||||||
font.pixelSize: myValue != "" ? appWindow.listViewValueFontSize : 0
|
font.pixelSize: AppStyle.listViewValueFontSize
|
||||||
text: ""
|
text: ""
|
||||||
|
|
||||||
function buildTextString() {
|
function buildTextString() {
|
||||||
@@ -232,10 +234,105 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlindsRaiseType --> Always double vs. Manual blinds List
|
Component {
|
||||||
// Component {
|
id: myBlindsRaiseMode // Always double vs. Manual blinds List
|
||||||
// //TODO
|
|
||||||
// }
|
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: {
|
Component.onCompleted: {
|
||||||
listViewFactoryLoader.setSourceComponent(componentMap[myType])
|
listViewFactoryLoader.setSourceComponent(componentMap[myType])
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ Rectangle {
|
|||||||
spacing: Math.round(selectionBox.height*0.06)
|
spacing: Math.round(selectionBox.height*0.06)
|
||||||
Text {
|
Text {
|
||||||
id: titleText
|
id: titleText
|
||||||
font.pixelSize: appWindow.fontSizeH1
|
font.pixelSize: AppStyle.selectorTitleFontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: titleString
|
text: titleString
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -84,7 +84,7 @@ Rectangle {
|
|||||||
anchors.rightMargin: 50
|
anchors.rightMargin: 50
|
||||||
//make space for the prefix
|
//make space for the prefix
|
||||||
anchors.leftMargin: 50 + Math.round(appWindow.height*0.03)
|
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() {
|
function correctValue() {
|
||||||
text = GlobalTools.correctTextFieldIntegerValue(selector, text, minValue);
|
text = GlobalTools.correctTextFieldIntegerValue(selector, text, minValue);
|
||||||
@@ -159,7 +159,7 @@ Rectangle {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: cancelButton
|
id: cancelButton
|
||||||
font.pixelSize: appWindow.selectorButtonFontSize
|
font.pixelSize: AppStyle.selectorButtonFontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: qsTr("CANCEL")
|
text: qsTr("CANCEL")
|
||||||
Layout.preferredHeight: contentHeight
|
Layout.preferredHeight: contentHeight
|
||||||
@@ -173,7 +173,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id: okButton
|
id: okButton
|
||||||
font.pixelSize: appWindow.selectorButtonFontSize
|
font.pixelSize: AppStyle.selectorButtonFontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
color: GlobalColors.accentColor
|
color: GlobalColors.accentColor
|
||||||
text: qsTr("OK")
|
text: qsTr("OK")
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
import QtQuick.Controls.Styles 1.2
|
import QtQuick.Controls.Styles 1.2
|
||||||
import "../../js/colors.js" as GlobalColors
|
import "../../js/colors.js" as GlobalColors
|
||||||
|
import "."
|
||||||
|
|
||||||
RadioButtonStyle {
|
RadioButtonStyle {
|
||||||
property var myRadioBtn
|
property var myRadioBtn
|
||||||
@@ -22,7 +23,7 @@ RadioButtonStyle {
|
|||||||
label: Text {
|
label: Text {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 10
|
anchors.leftMargin: 10
|
||||||
font.pixelSize: appWindow.radioButtonLabelFontSize
|
font.pixelSize: AppStyle.radioButtonLabelFontSize
|
||||||
text: labelString
|
text: labelString
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
import QtQuick.Controls.Styles 1.2
|
import QtQuick.Controls.Styles 1.2
|
||||||
import "../../js/colors.js" as GlobalColors
|
import "../../js/colors.js" as GlobalColors
|
||||||
|
import "."
|
||||||
|
|
||||||
TextFieldStyle {
|
TextFieldStyle {
|
||||||
property string prefix: ""
|
property string prefix: ""
|
||||||
property int prefixIndent: prefix != "" ? appWindow.textFieldFontSize*0.33 : 0
|
property int prefixIndent: prefix != "" ? AppStyle.textFieldFontSize*0.33 : 0
|
||||||
property var myTextField
|
property var myTextField
|
||||||
|
|
||||||
textColor: "black"
|
textColor: "black"
|
||||||
font.pixelSize: appWindow.textFieldFontSize
|
font.pixelSize: AppStyle.textFieldFontSize
|
||||||
background: Item { //bottom line with colored focus indicator
|
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
|
implicitWidth: myTextField.width
|
||||||
Text { //prefix
|
Text { //prefix
|
||||||
visible: prefix != "" ? true : false
|
visible: prefix != "" ? true : false
|
||||||
color: "black"
|
color: "black"
|
||||||
font.pixelSize: appWindow.textFieldFontSize
|
font.pixelSize: AppStyle.textFieldFontSize
|
||||||
text: prefix
|
text: prefix
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: -prefixIndent
|
anchors.leftMargin: -prefixIndent
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
singleton AppStyle AppStyle.qml
|
||||||
@@ -14,6 +14,30 @@ QString QmlConfig::readConfigString(QString varName) {
|
|||||||
return QString::fromUtf8(myConfig->readConfigString(varName.toStdString()).c_str());
|
return QString::fromUtf8(myConfig->readConfigString(varName.toStdString()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList QmlConfig::readConfigStringList(QString listName)
|
||||||
|
{
|
||||||
|
std::list<std::string> myList = myConfig->readConfigStringList(listName.toStdString());
|
||||||
|
std::list<std::string>::iterator it1;
|
||||||
|
QStringList returnList;
|
||||||
|
|
||||||
|
for(it1= myList.begin(); it1 != myList.end(); ++it1) {
|
||||||
|
returnList.append(QString::fromStdString(*it1));
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
|
}
|
||||||
|
|
||||||
QString QmlConfig::readConfigIntString(QString varName) {
|
QString QmlConfig::readConfigIntString(QString varName) {
|
||||||
return QString::number(myConfig->readConfigInt(varName.toStdString()));
|
return QString::number(myConfig->readConfigInt(varName.toStdString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList QmlConfig::readConfigIntStringList(QString listName)
|
||||||
|
{
|
||||||
|
std::list<int> myList = myConfig->readConfigIntList(listName.toStdString());
|
||||||
|
std::list<int>::iterator it1;
|
||||||
|
QStringList returnList;
|
||||||
|
|
||||||
|
for(it1= myList.begin(); it1 != myList.end(); ++it1) {
|
||||||
|
returnList.append(QString::number(*it1,10));
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ class QmlConfig: public QObject
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
Q_INVOKABLE QString readConfigString(QString);
|
Q_INVOKABLE QString readConfigString(QString);
|
||||||
|
Q_INVOKABLE QStringList readConfigStringList(QString);
|
||||||
Q_INVOKABLE QString readConfigIntString(QString);
|
Q_INVOKABLE QString readConfigIntString(QString);
|
||||||
|
Q_INVOKABLE QStringList readConfigIntStringList(QString);
|
||||||
|
|
||||||
QmlConfig(boost::shared_ptr<ConfigFile>);
|
QmlConfig(boost::shared_ptr<ConfigFile>);
|
||||||
~QmlConfig();
|
~QmlConfig();
|
||||||
|
|||||||
+10
-17
@@ -5,33 +5,26 @@ import QtQuick.Window 2.2
|
|||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
import "views/startview"
|
import "views/startview"
|
||||||
import "js/colors.js" as GlobalColors
|
import "js/colors.js" as GlobalColors
|
||||||
|
import "components/styles"
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: appWindow
|
id: appWindow
|
||||||
title: qsTr("PokerTH - The open source poker app")
|
title: qsTr("PokerTH - The open source poker app")
|
||||||
|
//send infos about app size to the style
|
||||||
width: 1024
|
width: 1024
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 320
|
minimumWidth: 320
|
||||||
minimumHeight: 240
|
minimumHeight: 240
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
property int fontSizeH1: Math.round(height*0.10)
|
onHeightChanged: { AppStyle.appHeight = height }
|
||||||
property int fontSizeH2: Math.round(height*0.09)
|
onWidthChanged: { AppStyle.appWidth = width }
|
||||||
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)
|
|
||||||
|
|
||||||
property int listViewTitleFontSize: fontSizeH5
|
Component.onCompleted: {
|
||||||
property int listViewValueFontSize: fontSizeH6
|
// initial info about app size for the style
|
||||||
property int selectorTitleFontSize: fontSizeH2
|
AppStyle.appHeight = height
|
||||||
property int selectorValueFontSize: fontSizeH5
|
AppStyle.appWidth = width
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
toolBar: Rectangle {
|
toolBar: Rectangle {
|
||||||
@@ -40,7 +33,7 @@ ApplicationWindow {
|
|||||||
Behavior on opacity { NumberAnimation{} }
|
Behavior on opacity { NumberAnimation{} }
|
||||||
color: GlobalColors.accentColor
|
color: GlobalColors.accentColor
|
||||||
width: appWindow.width
|
width: appWindow.width
|
||||||
height: appWindow.height*0.15
|
height: appWindow.height*0.13
|
||||||
Behavior on height { NumberAnimation{} }
|
Behavior on height { NumberAnimation{} }
|
||||||
Rectangle { //Shadow
|
Rectangle { //Shadow
|
||||||
y: parent.height
|
y: parent.height
|
||||||
|
|||||||
@@ -20,5 +20,8 @@
|
|||||||
<file>components/styles/MyTextFieldStyle.qml</file>
|
<file>components/styles/MyTextFieldStyle.qml</file>
|
||||||
<file>components/styles/MyRadioButtonStyle.qml</file>
|
<file>components/styles/MyRadioButtonStyle.qml</file>
|
||||||
<file>js/tools.js</file>
|
<file>js/tools.js</file>
|
||||||
|
<file>components/MyBlindsRaiseModeSelector.qml</file>
|
||||||
|
<file>components/styles/AppStyle.qml</file>
|
||||||
|
<file>components/styles/qmldir</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -56,13 +56,24 @@ Rectangle {
|
|||||||
myValue: ""
|
myValue: ""
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
myId: "comboBox_BlindsRaiseInterval"
|
myId: "selector_BlindsRaiseInterval"
|
||||||
myTitle: qsTr("Blinds raise interval")
|
myTitle: qsTr("Blinds raise interval")
|
||||||
myType: "BlindsRaiseInterval"
|
myType: "BlindsRaiseInterval"
|
||||||
myRaiseOnHandsType: "" //if false it is raise on minutes type
|
myRaiseOnHandsType: "" //if false it is raise on minutes type
|
||||||
myRaiseOnHandsInterval: ""
|
myRaiseOnHandsInterval: ""
|
||||||
myRaiseOnMinutesInterval: ""
|
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 {
|
ListElement {
|
||||||
myId: "comboBox_GameSpeed"
|
myId: "comboBox_GameSpeed"
|
||||||
myTitle: qsTr("Game speed")
|
myTitle: qsTr("Game speed")
|
||||||
@@ -92,7 +103,18 @@ Rectangle {
|
|||||||
createLocalGameViewModel.setProperty(3, "myRaiseOnHandsType", Config.readConfigIntString("RaiseBlindsAtHands"));
|
createLocalGameViewModel.setProperty(3, "myRaiseOnHandsType", Config.readConfigIntString("RaiseBlindsAtHands"));
|
||||||
createLocalGameViewModel.setProperty(3, "myRaiseOnHandsInterval", Config.readConfigIntString("RaiseSmallBlindEveryHands"));
|
createLocalGameViewModel.setProperty(3, "myRaiseOnHandsInterval", Config.readConfigIntString("RaiseSmallBlindEveryHands"));
|
||||||
createLocalGameViewModel.setProperty(3, "myRaiseOnMinutesInterval", Config.readConfigIntString("RaiseSmallBlindEveryMinutes"));
|
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 {
|
delegate: MyListViewDelegateFactory {
|
||||||
|
|||||||
Reference in New Issue
Block a user