Move the listView data to the c++ context

This commit is contained in:
Felix Hammer
2015-09-20 14:01:51 +02:00
parent 27b524f52f
commit e053cdcaf6
19 changed files with 8241 additions and 2952 deletions
+2 -1
View File
@@ -54,7 +54,8 @@ HEADERS += \
src/gui/qml/cpp/qmlwrapper.h \
src/gui/qml/cpp/qmlconfig.h \
src/gui/qml/cpp/startviewimpl.h \
src/gui/qml/cpp/createlocalgameviewimpl.h
src/gui/qml/cpp/createlocalgameviewimpl.h \
src/gui/qml/cpp/mylistviewitemdata.h
SOURCES += \
+14 -2
View File
@@ -13,6 +13,7 @@ Rectangle {
color: "#88000000" //dark transparent background
property alias container: ctr.children
property alias containerSelf: ctr
property string titleText: ""
property string button1Text: ""
@@ -76,7 +77,7 @@ Rectangle {
width: parent.width
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: AppStyle.rowLayoutSpacing
spacing: AppStyle.selectorBoxButtonRowLayoutSpacing
Layout.preferredHeight: btn1.contentHeight
Text {
@@ -86,12 +87,17 @@ Rectangle {
width: button1Text == "" ? 0 : contentWidth
text: button1Text
signal buttonClicked
MouseArea {
id: mouse1
anchors.fill: parent
anchors.margins: AppStyle.selectorBoxButtonMouseAreaMargin
onClicked: selector.button1Clicked()
Rectangle {
anchors.fill: parent
color: mouse1.pressed ? "#55555555" : "#00ffffff"
}
}
}
Text {
@@ -104,7 +110,13 @@ Rectangle {
MouseArea {
id: mouse2
anchors.fill: parent
anchors.margins: AppStyle.selectorBoxButtonMouseAreaMargin
onClicked: selector.button2Clicked()
Rectangle {
anchors.fill: parent
color: mouse2.pressed ? "#55555555" : "#00ffffff"
}
}
}
}
@@ -31,11 +31,11 @@ Item {
mySelector.show()
if(raiseOnHandsType == "1") {
textFieldHandsInterval.focus = true;
// textFieldHandsInterval.focus = true;
radioBtnRaiseOnHands.checked = true;
}
else {
textFieldMinutesInterval.focus = true;
// textFieldMinutesInterval.focus = true;
radioBtnRaiseOnMinutes.checked = true;
}
}
@@ -13,39 +13,93 @@ Item {
property string titleString: ""
property bool alwaysDoubleBlinds: false
property var manualBlindsList
property ListModel internalManualBlindsList: ListModel {}
property bool afterMBAlwaysDoubleBlinds: false
property bool afterMBAlwaysRaiseAbout: false
property bool afterMBStayAtLastBlind: false
property int afterMBAlwaysRaiseValue: 0
property string afterMBAlwaysRaiseValue: "0"
property var parentListViewModel
property var parentListViewRoot
property int addBlindTextFieldMinValue: 5
property int addBlindTextFieldMaxValue: 1000000
property bool ready: false
signal accepted
function show(title, doubleBlinds, list, afterMBDouble, afterMBRaise, afterMBRaiseValue, afterMBStay) {
function show(title, doubleBlinds, list, afterMBDouble, afterMBRaise, afterMBRaiseValue, afterMBStay, parentListModel, parentListRoot) {
//initial the class values
titleString = title
alwaysDoubleBlinds = doubleBlinds;
manualBlindsList = list;
//to easily edit the array put it into an temporary listmodel
internalManualBlindsList.clear();
for (var i=0; i < list.length; i++) {
internalManualBlindsList.append({"value": list[i]});
}
afterMBAlwaysDoubleBlinds = afterMBDouble;
afterMBAlwaysRaiseAbout = afterMBRaise;
afterMBAlwaysRaiseValue = afterMBRaiseValue;
afterMBStayAtLastBlind = afterMBStay;
parentListViewModel = parentListModel;
parentListViewRoot = parentListRoot;
//show the abstract selector with below defined specific content
mySelector.show()
// if(raiseOnHandsType == "1") {
// textFieldHandsInterval.focus = true;
// radioBtnRaiseOnHands.checked = true;
// }
// else {
// textFieldMinutesInterval.focus = true;
// radioBtnRaiseOnMinutes.checked = true;
// }
//set the config options to radiobuttons and textfields
if(alwaysDoubleBlinds) {
radioBtnBlindsRaiseModeAlwaysDouble.checked = true;
radioBtnBlindsRaiseModeManualBlindsList.checked = false;
}
else {
radioBtnBlindsRaiseModeManualBlindsList.checked = true;
radioBtnBlindsRaiseModeAlwaysDouble.checked = false;
}
//if we are in a createLocalGameView Dialog set min and max from corresponding values in the same list
if(parentListViewRoot.myReadableId == "createLocalGameViewRoot") {
//get current start blind as minimum and cash as maximum for the textfield
var currentStartBlind = 0;
var startCash = 0;
for (var i=0; i < parentListViewModel.length; i++) {
if(parentListViewModel[i].myId == "spinBox_FirstSmallBlind") {
currentStartBlind = parentListViewModel[i].myValue;
}
else if (parentListViewModel[i].myId == "spinBox_StartCash") {
startCash = parentListViewModel[i].myValue;
}
}
addBlindTextFieldMinValue = currentStartBlind;
addBlindTextFieldMaxValue = startCash;
textFieldAddListBlind.text = addBlindTextFieldMinValue;
}
if(afterMBAlwaysDoubleBlinds) {
radioBtnAfterMBAlwaysDouble.checked = true
radioBtnAfterMBAlwaysRaiseAbout.checked = false
radioBtnAfterMBKeepLastBlind.checked = false
}
else if (afterMBAlwaysRaiseAbout) {
radioBtnAfterMBAlwaysDouble.checked = false
radioBtnAfterMBAlwaysRaiseAbout.checked = true
radioBtnAfterMBKeepLastBlind.checked = false
}
else {
radioBtnAfterMBAlwaysDouble.checked = false
radioBtnAfterMBAlwaysRaiseAbout.checked = false
radioBtnAfterMBKeepLastBlind.checked = true
}
textFieldAfterMBAlwaysRaiseAboutValue.text = afterMBAlwaysRaiseValue
}
function selected(doubleBlinds, list, afterMBDouble, afterMBRaise, afterMBRaiseValue, afterMBStay) {
function selected(doubleBlinds, afterMBDouble, afterMBRaise, afterMBRaiseValue, afterMBStay) {
alwaysDoubleBlinds = doubleBlinds;
manualBlindsList = list;
afterMBAlwaysDoubleBlinds = afterMBDouble;
afterMBAlwaysRaiseAbout = afterMBRaise;
afterMBAlwaysRaiseValue = afterMBRaiseValue;
@@ -63,20 +117,169 @@ Item {
onButton1Clicked: hide()
button2Text: qsTr("OK")
onButton2Clicked: {
// textFieldHandsInterval.correctValue();
// textFieldMinutesInterval.correctValue();
textFieldAfterMBAlwaysRaiseAboutValue.correctValue();
//copy editable internal listmodel to returnable list
manualBlindsList = new Array(); //clear at first
for (var i=0; i < internalManualBlindsList.count; i++) {
manualBlindsList.push(internalManualBlindsList.get(i).value.toString());
}
//return values
// root.selected(radioBtnRaiseOnHands.checked ? "1": "0", textFieldHandsInterval.text, textFieldMinutesInterval.text);
root.selected(radioBtnBlindsRaiseModeAlwaysDouble.checked, radioBtnAfterMBAlwaysDouble.checked, radioBtnAfterMBAlwaysRaiseAbout.checked, textFieldAfterMBAlwaysRaiseAboutValue.text, radioBtnAfterMBKeepLastBlind.checked);
}
container: ScrollView {
id: scrollView
anchors.fill: parent
ColumnLayout {
width: parent.width
// TODO Hier gehts mit dem Inhalt weiter
spacing: AppStyle.columnLayoutSpacing
ExclusiveGroup { id: blindsRaiseModeGroup }
RadioButton {
id: radioBtnBlindsRaiseModeAlwaysDouble
exclusiveGroup: blindsRaiseModeGroup
style: MyRadioButtonStyle {
myRadioBtn: radioBtnBlindsRaiseModeAlwaysDouble
labelString: qsTr("Always double blinds");
}
}
RadioButton {
id: radioBtnBlindsRaiseModeManualBlindsList
exclusiveGroup: blindsRaiseModeGroup
style: MyRadioButtonStyle {
myRadioBtn: radioBtnBlindsRaiseModeManualBlindsList
labelString: qsTr("Manual blinds list");
}
}
RowLayout {
id: listControlsRow
width: parent.width
spacing: AppStyle.rowLayoutSpacing
TextField {
id: textFieldAddListBlind
anchors.left: parent.left
//make space for the prefix
anchors.leftMargin: AppStyle.spinBoxSelectorTextFieldPrefixExtraLeftMargin
width: Math.round(listControlsRow.width * 0.5)
style: MyTextFieldStyle {
prefix: "$"
myTextField: textFieldAddListBlind
}
function correctValue() {
text = GlobalTools.correctTextFieldIntegerValue(root, text, addBlindTextFieldMinValue, addBlindTextFieldMaxValue);
}
onFocusChanged: { if(root.ready && !focus) correctValue(); }
onEditingFinished: { if(root.ready) correctValue(); }
}
Text {
id: btnAddNewListBlind
font.pixelSize: AppStyle.selectorBoxButtonFontSize
font.bold: true
width: Math.round(listControlsRow.width * 0.5)
text: qsTr("ADD BLIND")
MouseArea {
id: mouseAddNewListBlind
anchors.fill: parent
anchors.margins: AppStyle.selectorBoxButtonMouseAreaMargin
onClicked: {
textFieldAddListBlind.correctValue();
internalManualBlindsList.append({"value": textFieldAddListBlind.text.toString()})
}
Rectangle {
anchors.fill: parent
color: mouseAddNewListBlind.pressed ? "#55555555" : "#00ffffff"
}
}
}
}
Repeater {
id: manualBlindListRepeater
width: parent.width
model: internalManualBlindsList
delegate: RowLayout {
spacing: AppStyle.rowLayoutSpacing
Text {
id: blindInList
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: AppStyle.radioButtonLabelFontSize
text: "$"+model.value
}
Text {
id: btnRemoveListBlind
anchors.verticalCenter: parent.verticalCenter
property int modelIndex: model.index
font.pixelSize: AppStyle.selectorBoxButtonFontSize
font.bold: true
width: Math.round(listControlsRow.width * 0.5)
text: qsTr("REMOVE")
MouseArea {
id: mouseRemoveListBlind
anchors.fill: parent
anchors.margins: AppStyle.selectorBoxButtonMouseAreaMargin
onClicked: {
internalManualBlindsList.remove(btnRemoveListBlind.modelIndex)
}
Rectangle {
anchors.fill: parent
color: mouseRemoveListBlind.pressed ? "#55555555" : "#00ffffff"
}
}
}
}
}
Text {
font.pixelSize: AppStyle.selectorBoxValueFontSize
text: qsTr("Afterwards:")
}
ExclusiveGroup { id: afterMBModeGroup }
RadioButton {
id: radioBtnAfterMBAlwaysDouble
exclusiveGroup: afterMBModeGroup
style: MyRadioButtonStyle {
myRadioBtn: radioBtnAfterMBAlwaysDouble
labelString: qsTr("always double blinds");
}
}
RadioButton {
id: radioBtnAfterMBAlwaysRaiseAbout
exclusiveGroup: afterMBModeGroup
style: MyRadioButtonStyle {
myRadioBtn: radioBtnAfterMBAlwaysRaiseAbout
labelString: qsTr("always raise about");
}
}
TextField {
id: textFieldAfterMBAlwaysRaiseAboutValue
//make space for the prefix
anchors.left: parent.left
anchors.leftMargin: AppStyle.spinBoxSelectorTextFieldPrefixExtraLeftMargin
width: radioBtnAfterMBAlwaysRaiseAbout.width
style: MyTextFieldStyle {
prefix: "$"
myTextField: textFieldAfterMBAlwaysRaiseAboutValue
}
function correctValue() {
text = GlobalTools.correctTextFieldIntegerValue(root, text, addBlindTextFieldMinValue, addBlindTextFieldMaxValue);
}
onFocusChanged: { if(root.ready && !focus) correctValue(); }
onEditingFinished: { if(root.ready) correctValue(); }
}
RadioButton {
id: radioBtnAfterMBKeepLastBlind
exclusiveGroup: afterMBModeGroup
style: MyRadioButtonStyle {
myRadioBtn: radioBtnAfterMBKeepLastBlind
labelString: qsTr("keep last blind");
}
}
}
}
}
Component.onCompleted: ready = true;
Component.onCompleted: {
ready = true;
}
}
+28 -10
View File
@@ -1,6 +1,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.2
import "../js/colors.js" as GlobalColors
import "styles"
@@ -9,7 +10,7 @@ Item {
id: root
anchors.fill: parent
property ListModel selectionModel: ListModel {}
property ListModel internalValuesList: ListModel {}
property string valueFromParent
property string titleString
property string returnValue
@@ -23,9 +24,9 @@ Item {
returnValue = vl; // <-- initial the returnValue with the preselection to prevent a NULL return when pressing Cancel
valueIsIndex = valueIndex;
//fill the model
selectionModel.clear();
for (var i=0; i < list.count; i++) {
selectionModel.append({"valueString": list.get(i).value});
internalValuesList.clear();
for (var i=0; i < list.length; i++) {
internalValuesList.append({"value": list[i]});
}
mySelector.show()
}
@@ -48,22 +49,39 @@ Item {
onButton1Clicked: hide()
container: ScrollView {
id: scrollView
anchors.fill:parent
property int yOfCheckedRadioButton: 0
ListView {
id:listView
anchors.fill: parent
spacing: Math.round(appWindow.height*0.05)
model: selectionModel
model: internalValuesList
delegate: RadioButton {
id: radioBtn
//check of value is index type and do the corresponding checked? test
checked: valueIsIndex ? (parseInt(valueFromParent) == index ? true : false) : (valueFromParent == valueString ? true : false)
checked: valueIsIndex ? (parseInt(valueFromParent) == index ? true : false) : (valueFromParent == value ? true : false)
onClicked: {
root.selected(valueString, index)
root.selected(value, index)
}
style: MyRadioButtonStyle {
myRadioBtn: radioBtn
labelString: valueString
labelString: value
}
Component.onCompleted: {
//set the position of the checked RadioButton to scroll to it later onContentHeightChange
if(checked) {
var checkedRadioBtnPositionY = Math.round((radioBtn.height + listView.spacing) * index - radioBtn.height * 1.5)
if( checkedRadioBtnPositionY > 0)
scrollView.yOfCheckedRadioButton = checkedRadioBtnPositionY
else
scrollView.yOfCheckedRadioButton = 0
}
}
}
onContentHeightChanged: {
//scroll to the checked RadioButton
contentY = scrollView.yOfCheckedRadioButton
}
}
}
@@ -15,9 +15,9 @@ Item {
property var componentMap: {
"ComboBox": myComboBox,
"SpinBox": mySpinBox,
"BlindsRaiseInterval": myBlindsRaiseInterval,
"BlindsRaiseMode": myBlindsRaiseMode
"SpinBox": mySpinBox,
"BlindsRaiseInterval": myBlindsRaiseInterval,
"BlindsRaiseMode": myBlindsRaiseMode
}
width: myListViewsWidth
@@ -35,7 +35,7 @@ Item {
MyComboBoxSelector {
id: myComboBoxSelector
parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView
onAccepted: myListViewModel.setProperty(myComboBoxContent.modelIndex, "myValue", myComboBoxSelector.returnValue);
onAccepted: myListViewModel[myComboBoxContent.modelIndex].myValue = myComboBoxSelector.returnValue;
}
id: myComboBoxContent
@@ -63,7 +63,7 @@ Item {
color: "grey"
font.pixelSize: myValue != "" ? AppStyle.listViewDelegateValueFontSize : 0
//setup value from Index if necessary
text: myValueIsIndex ? myValuesList.get(parseInt(myValue)).value : myValue
text: myValueIsIndex ? myValuesList[parseInt(myValue)].value : myValue
Layout.preferredHeight: contentHeight
}
}
@@ -96,7 +96,7 @@ Item {
MySpinBoxSelector {
id: mySpinBoxSelector
parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView
onAccepted: myListViewModel.setProperty(mySpinBoxContent.modelIndex, "myValue", mySpinBoxSelector.returnValue);
onAccepted: myListViewModel[mySpinBoxContent.modelIndex].myValue = mySpinBoxSelector.returnValue;
}
id: mySpinBoxContent
@@ -159,9 +159,9 @@ Item {
parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView
onAccepted: {
//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);
myListViewModel[myBlindsRaiseIntervalContent.modelIndex].myRaiseOnHandsType = myBlindsRaiseIntervalSelector.raiseOnHandsType;
myListViewModel[myBlindsRaiseIntervalContent.modelIndex].myRaiseOnHandsInterval = myBlindsRaiseIntervalSelector.raiseOnHandsInterval;
myListViewModel[myBlindsRaiseIntervalContent.modelIndex].myRaiseOnMinutesInterval = myBlindsRaiseIntervalSelector.raiseOnMinutesInterval;
//here we also need to trigger the textStringBuild from the model again
blindsRaiseIntevalValue.buildTextString();
}
@@ -215,7 +215,7 @@ Item {
anchors.fill: parent
onClicked: {
//call selector overlay and set inital values
myBlindsRaiseIntervalSelector.show(myTitle, myRaiseOnHandsType, myRaiseOnHandsInterval, myRaiseOnMinutesInterval)
myBlindsRaiseIntervalSelector.show(myTitle, myRaiseOnHandsType, myRaiseOnHandsInterval, myRaiseOnMinutesInterval, myListViewModel)
}
}
@@ -234,7 +234,15 @@ Item {
id: myBlindsRaiseModeSelector
parent: myListViewRoot // this needs to be parent to display the selector over the whole ListView
onAccepted: {
//TODO update model
//call update the currentItem with selection from the comboBox selector
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAlwaysDoubleBlinds = (myBlindsRaiseModeSelector.alwaysDoubleBlinds ? "1" : "0");
myListViewModel[myBlindsRaiseModeContent.modelIndex].myManualBlindsList = (myBlindsRaiseModeSelector.manualBlindsList);
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAfterMBAlwaysDoubleBlinds = (myBlindsRaiseModeSelector.afterMBAlwaysDoubleBlinds ? "1" : "0");
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAfterMBAlwaysRaiseAbout = (myBlindsRaiseModeSelector.afterMBAlwaysRaiseAbout ? "1" : "0");
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAfterMBAlwaysRaiseValue = (myBlindsRaiseModeSelector.afterMBAlwaysRaiseValue);
myListViewModel[myBlindsRaiseModeContent.modelIndex].myAfterMBStayAtLastBlind = (myBlindsRaiseModeSelector.afterMBStayAtLastBlind ? "1" : "0");
//here we also need to trigger the textStringBuild from the model again
blindsRaiseModeValue.buildTextString();
}
}
@@ -272,8 +280,8 @@ Item {
else {
//build manual blindsList
var tempString = ""
for (var i=0; i < myManualBlindsList.count; i++) {
tempString = tempString + "$" + myManualBlindsList.get(i).blindValue.toString() + ", ";
for (var i=0; i < myManualBlindsList.length; i++) {
tempString = tempString + "$" + myManualBlindsList[i] + ", ";
}
text = tempString.substring(0, tempString.length - 2);
if(myAfterMBAlwaysDoubleBlinds == "1") {
@@ -304,8 +312,8 @@ Item {
id: mouse
anchors.fill: parent
onClicked: {
// call selector overlay and set inital values
myBlindsRaiseModeSelector.show(myTitle, myAlwaysDoubleBlinds, myManualBlindsList, myAfterMBAlwaysDoubleBlinds, myAfterMBAlwaysRaiseAbout, myAfterMBAlwaysRaiseValue, myAfterMBStayAtLastBlind);
//call selector overlay and set inital values
myBlindsRaiseModeSelector.show(myTitle, myAlwaysDoubleBlinds == "1", myManualBlindsList, myAfterMBAlwaysDoubleBlinds == "1", myAfterMBAlwaysRaiseAbout == "1", myAfterMBAlwaysRaiseValue, myAfterMBStayAtLastBlind == "1", myListViewModel, myListViewRoot);
}
}
+1 -2
View File
@@ -32,12 +32,11 @@ Item {
prefix = myPrefix;
mySelector.show()
textField.focus = true;
// textField.focus = true;
}
function selected(newSelection) {
returnValue = newSelection;
mySelector.hide()
root.accepted()
}
@@ -30,6 +30,8 @@ QtObject {
property int selectorBoxTitleTopMargin: -Math.round(appHeight*0.02)
property int selectorBoxValueFontSize: fontSizeH5
property int selectorBoxButtonFontSize: fontSizeH5
property int selectorBoxButtonMouseAreaMargin: -Math.round(appHeight*0.02)
property int selectorBoxButtonRowLayoutSpacing: Math.round(appHeight*0.10)
property bool selectorBoxButtonFontBold: false
property int selectorBoxContentMargins: Math.round(appHeight*0.05)
property int selectorBoxRealContentLeftMargin: Math.round(appHeight*0.05)
+108 -1
View File
@@ -1,7 +1,114 @@
#include "createlocalgameviewimpl.h"
#include "configfile.h"
#include "mylistviewitemdata.h"
#include <QtQml>
CreateLocalGameViewImpl::CreateLocalGameViewImpl(QObject *parent) : QObject(parent)
CreateLocalGameViewImpl::CreateLocalGameViewImpl(QObject *parent, QQmlApplicationEngine *e, boost::shared_ptr<ConfigFile> c)
: QObject(parent) ,myQmlEngine(e), myConfig(c)
{
//Build the listView data structure
MyListViewItemData *item = NULL;
//ComboBox number of players
item = new MyListViewItemData;
item->setMyId("comboBox_NumberOfPlayers");
item->setMyTitle(tr("Number of players"));
item->setMyType("ComboBox");
const int n = 9;
for (int i = 10; i > (10-n); --i) item->appendToMyValuesList(QString::number(i));
item->setMyValueIsIndex(false);
myListData.append(item);
//SpinBox start cash-
item = new MyListViewItemData;
item->setMyId("spinBox_StartCash");
item->setMyTitle(tr("Start cash"));
item->setMyType("SpinBox");
item->setMyMaxValue("1000000");
item->setMyMinValue("1000");
item->setMyPrefix("$");
myListData.append(item);
//SpinBox start blind
item = new MyListViewItemData;
item->setMyId("spinBox_FirstSmallBlind");
item->setMyTitle(tr("First small blind"));
item->setMyType("SpinBox");
item->setMyMaxValue("20000");
item->setMyMinValue("5");
item->setMyPrefix("$");
myListData.append(item);
//Blinds raise interval selector
item = new MyListViewItemData;
item->setMyId("selector_BlindsRaiseInterval");
item->setMyTitle(tr("Blinds raise interval"));
item->setMyType("BlindsRaiseInterval");
myListData.append(item);
//Blinds raise mode selector
item = new MyListViewItemData;
item->setMyId("selector_BlindsRaiseMode");
item->setMyTitle(tr("Blinds raise mode"));
item->setMyType("BlindsRaiseMode");
myListData.append(item);
//ComboBox game speed
item = new MyListViewItemData;
item->setMyId("comboBox_GameSpeed");
item->setMyTitle(tr("Game speed"));
item->setMyType("ComboBox");
const int m = 11;
for (int i = 11; i > (11-m); --i) item->appendToMyValuesList(QString::number(i));
item->setMyValueIsIndex(false);
myListData.append(item);
myQmlEngine->rootContext()->setContextProperty("CreateLocalGameViewData", QVariant::fromValue(myListData));
}
CreateLocalGameViewImpl::~CreateLocalGameViewImpl()
{
}
MyListViewItemData* CreateLocalGameViewImpl::listItem(QString id)
{
for (int i = 0; i < myListData.size(); ++i) {
if (static_cast<MyListViewItemData*>(myListData.at(i))->myId() == id)
return static_cast<MyListViewItemData*>(myListData.at(i));
}
qDebug("ERROR: listItem in createLocalGameViewImpl could not be found");
return NULL;
}
void CreateLocalGameViewImpl::readConfigValues()
{
listItem("comboBox_NumberOfPlayers")->setMyValue(QString::number(myConfig->readConfigInt("NumberOfPlayers")));
listItem("spinBox_StartCash")->setMyValue(QString::number(myConfig->readConfigInt("StartCash")));
listItem("spinBox_FirstSmallBlind")->setMyValue(QString::number(myConfig->readConfigInt("FirstSmallBlind")));
listItem("selector_BlindsRaiseInterval")->setMyRaiseOnHandsType(QString::number(myConfig->readConfigInt("RaiseBlindsAtHands")));
listItem("selector_BlindsRaiseInterval")->setMyRaiseOnHandsInterval(QString::number(myConfig->readConfigInt("RaiseSmallBlindEveryHands")));
listItem("selector_BlindsRaiseInterval")->setMyRaiseOnMinutesInterval(QString::number(myConfig->readConfigInt("RaiseSmallBlindEveryMinutes")));
listItem("selector_BlindsRaiseMode")->setMyAlwaysDoubleBlinds(QString::number(myConfig->readConfigInt("AlwaysDoubleBlinds")));
std::list<int> myList = myConfig->readConfigIntList("ManualBlindsList");
std::list<int>::iterator it1;
listItem("selector_BlindsRaiseMode")->clearMyManualBlindsList();
for(it1= myList.begin(); it1 != myList.end(); ++it1) {
listItem("selector_BlindsRaiseMode")->appendToMyManualBlindsList(QString::number(*it1));
}
listItem("selector_BlindsRaiseMode")->setMyAfterMBAlwaysDoubleBlinds(QString::number(myConfig->readConfigInt("AfterMBAlwaysDoubleBlinds")));
listItem("selector_BlindsRaiseMode")->setMyAfterMBAlwaysRaiseAbout(QString::number(myConfig->readConfigInt("AfterMBAlwaysRaiseAbout")));
listItem("selector_BlindsRaiseMode")->setMyAfterMBAlwaysRaiseValue(QString::number(myConfig->readConfigInt("AfterMBAlwaysRaiseValue")));
listItem("selector_BlindsRaiseMode")->setMyAfterMBStayAtLastBlind(QString::number(myConfig->readConfigInt("AfterMBStayAtLastBlind")));
listItem("comboBox_GameSpeed")->setMyValue(QString::number(myConfig->readConfigInt("GameSpeed")));
}
void CreateLocalGameViewImpl::startGame()
{
qDebug() << "Start Game from CreateLocalGameViewImpl:";
qDebug() << "Number of players: " << listItem("comboBox_NumberOfPlayers")->myValue();
}
+17 -1
View File
@@ -1,16 +1,32 @@
#ifndef CREATELOCALGAMEVIEWIMPL_H
#define CREATELOCALGAMEVIEWIMPL_H
#include "boost/shared_ptr.hpp"
#include <QtCore>
#include <QQmlListProperty>
#include <QQmlApplicationEngine>
class ConfigFile;
class MyListViewItemData;
class CreateLocalGameViewImpl : public QObject
{
Q_OBJECT
public:
explicit CreateLocalGameViewImpl(QObject *parent = 0);
Q_INVOKABLE void readConfigValues();
Q_INVOKABLE void startGame();
CreateLocalGameViewImpl(QObject *parent, QQmlApplicationEngine *engine, boost::shared_ptr<ConfigFile>);
~CreateLocalGameViewImpl();
MyListViewItemData* listItem(QString id);
signals:
public slots:
private:
QQmlApplicationEngine *myQmlEngine;
QList<QObject*> myListData;
boost::shared_ptr<ConfigFile> myConfig;
};
#endif // CREATELOCALGAMEVIEWIMPL_H
+371
View File
@@ -0,0 +1,371 @@
#ifndef MYLISTVIEWITEMDATA_H
#define MYLISTVIEWITEMDATA_H
#include <QObject>
#include <QQmlListProperty>
class MyListViewItemData : public QObject
{
Q_OBJECT
Q_PROPERTY(QString myId READ myId WRITE setMyId NOTIFY myIdChanged)
Q_PROPERTY(QString myTitle READ myTitle WRITE setMyTitle NOTIFY myTitleChanged)
Q_PROPERTY(QString myType READ myType WRITE setMyType NOTIFY myTypeChanged)
Q_PROPERTY(QString myValue READ myValue WRITE setMyValue NOTIFY myValueChanged)
//ComboBox special
Q_PROPERTY(QStringList myValuesList READ myValuesList WRITE setMyValuesList NOTIFY myValuesListChanged)
Q_PROPERTY(bool myValueIsIndex READ myValueIsIndex WRITE setMyValueIsIndex NOTIFY myValueIsIndexChanged)
//SpinBox special
Q_PROPERTY(QString myMaxValue READ myMaxValue WRITE setMyMaxValue NOTIFY myMaxValueChanged)
Q_PROPERTY(QString myMinValue READ myMinValue WRITE setMyMinValue NOTIFY myMinValueChanged)
Q_PROPERTY(QString myPrefix READ myPrefix WRITE setMyPrefix NOTIFY myPrefixChanged)
//BlindsRaiseInterval-Selector special
Q_PROPERTY(QString myRaiseOnHandsType READ myRaiseOnHandsType WRITE setMyRaiseOnHandsType NOTIFY myRaiseOnHandsTypeChanged)
Q_PROPERTY(QString myRaiseOnHandsInterval READ myRaiseOnHandsInterval WRITE setMyRaiseOnHandsInterval NOTIFY myRaiseOnHandsIntervalChanged)
Q_PROPERTY(QString myRaiseOnMinutesInterval READ myRaiseOnMinutesInterval WRITE setMyRaiseOnMinutesInterval NOTIFY myRaiseOnMinutesIntervalChanged)
//BlindsRaiseMode-Selector special
Q_PROPERTY(QString myAlwaysDoubleBlinds READ myAlwaysDoubleBlinds WRITE setMyAlwaysDoubleBlinds NOTIFY myAlwaysDoubleBlindsChanged)
Q_PROPERTY(QStringList myManualBlindsList READ myManualBlindsList WRITE setMyManualBlindsList NOTIFY myManualBlindsListChanged)
Q_PROPERTY(QString myAfterMBAlwaysDoubleBlinds READ myAfterMBAlwaysDoubleBlinds WRITE setMyAfterMBAlwaysDoubleBlinds NOTIFY myAfterMBAlwaysDoubleBlindsChanged)
Q_PROPERTY(QString myAfterMBAlwaysRaiseAbout READ myAfterMBAlwaysRaiseAbout WRITE setMyAfterMBAlwaysRaiseAbout NOTIFY myAfterMBAlwaysRaiseAboutChanged)
Q_PROPERTY(QString myAfterMBAlwaysRaiseValue READ myAfterMBAlwaysRaiseValue WRITE setMyAfterMBAlwaysRaiseValue NOTIFY myAfterMBAlwaysRaiseValueChanged)
Q_PROPERTY(QString myAfterMBStayAtLastBlind READ myAfterMBStayAtLastBlind WRITE setMyAfterMBStayAtLastBlind NOTIFY myAfterMBStayAtLastBlindChanged)
QString m_myId;
QString m_myTitle;
QString m_myType;
QString m_myValue;
bool m_myValueIsIndex;
QString m_myMaxValue;
QString m_myMinValue;
QString m_myPrefix;
QString m_myRaiseOnHandsType;
QString m_myRaiseOnHandsInterval;
QString m_myRaiseOnMinutesInterval;
QString m_myAlwaysDoubleBlinds;
QString m_myAfterMBAlwaysDoubleBlinds;
QString m_myAfterMBAlwaysRaiseAbout;
QString m_myAfterMBStayAtLastBlind;
QString m_myAfterMBAlwaysRaiseValue;
QStringList m_myManualBlindsList;
QStringList m_myValuesList;
public:
inline MyListViewItemData(QObject *parent = 0) : QObject(parent) {}
inline ~MyListViewItemData() {}
QString myId() const
{
return m_myId;
}
QString myTitle() const
{
return m_myTitle;
}
QString myType() const
{
return m_myType;
}
QString myValue() const
{
return m_myValue;
}
bool myValueIsIndex() const
{
return m_myValueIsIndex;
}
QString myMaxValue() const
{
return m_myMaxValue;
}
QString myMinValue() const
{
return m_myMinValue;
}
QString myPrefix() const
{
return m_myPrefix;
}
QString myRaiseOnHandsType() const
{
return m_myRaiseOnHandsType;
}
QString myRaiseOnHandsInterval() const
{
return m_myRaiseOnHandsInterval;
}
QString myRaiseOnMinutesInterval() const
{
return m_myRaiseOnMinutesInterval;
}
QString myAlwaysDoubleBlinds() const
{
return m_myAlwaysDoubleBlinds;
}
QString myAfterMBAlwaysDoubleBlinds() const
{
return m_myAfterMBAlwaysDoubleBlinds;
}
QString myAfterMBAlwaysRaiseAbout() const
{
return m_myAfterMBAlwaysRaiseAbout;
}
QString myAfterMBStayAtLastBlind() const
{
return m_myAfterMBStayAtLastBlind;
}
QString myAfterMBAlwaysRaiseValue() const
{
return m_myAfterMBAlwaysRaiseValue;
}
QStringList myManualBlindsList() const
{
return m_myManualBlindsList;
}
void appendToMyManualBlindsList(QString str)
{
m_myManualBlindsList.append(str);
}
void clearMyManualBlindsList()
{
m_myManualBlindsList.clear();
}
QStringList myValuesList() const
{
return m_myValuesList;
}
void appendToMyValuesList(QString str)
{
m_myValuesList.append(str);
}
void clearMyValuesList()
{
m_myValuesList.clear();
}
signals:
void myIdChanged(QString myId);
void myTitleChanged(QString myTitle);
void myTypeChanged(QString myType);
void myValueChanged(QString myValue);
void myValueIsIndexChanged(bool myValueIsIndex);
void myMaxValueChanged(QString myMaxValue);
void myMinValueChanged(QString myMinValue);
void myPrefixChanged(QString myPrefix);
void myRaiseOnHandsTypeChanged(QString myRaiseOnHandsType);
void myRaiseOnHandsIntervalChanged(QString myRaiseOnHandsInterval);
void myRaiseOnMinutesIntervalChanged(QString myRaiseOnMinutesInterval);
void myAlwaysDoubleBlindsChanged(QString myAlwaysDoubleBlinds);
void myAfterMBAlwaysDoubleBlindsChanged(QString myAfterMBAlwaysDoubleBlinds);
void myAfterMBAlwaysRaiseAboutChanged(QString myAfterMBAlwaysRaiseAbout);
void myAfterMBAlwaysRaiseValueChanged(QString myAfterMBAlwaysRaiseValue);
void myAfterMBStayAtLastBlindChanged(QString myAfterMBStayAtLastBlind);
void myManualBlindsListChanged(QStringList myManualBlindsList);
void myValuesListChanged(QStringList myValuesList);
public slots:
void setMyId(QString myId)
{
if (m_myId == myId)
return;
m_myId = myId;
emit myIdChanged(myId);
}
void setMyTitle(QString myTitle)
{
if (m_myTitle == myTitle)
return;
m_myTitle = myTitle;
emit myTitleChanged(myTitle);
}
void setMyType(QString myType)
{
if (m_myType == myType)
return;
m_myType = myType;
emit myTypeChanged(myType);
}
void setMyValue(QString myValue)
{
if (m_myValue == myValue)
return;
m_myValue = myValue;
emit myValueChanged(myValue);
}
void setMyValueIsIndex(bool myValueIsIndex)
{
if (m_myValueIsIndex == myValueIsIndex)
return;
m_myValueIsIndex = myValueIsIndex;
emit myValueIsIndexChanged(myValueIsIndex);
}
void setMyMaxValue(QString myMaxValue)
{
if (m_myMaxValue == myMaxValue)
return;
m_myMaxValue = myMaxValue;
emit myMaxValueChanged(myMaxValue);
}
void setMyMinValue(QString myMinValue)
{
if (m_myMinValue == myMinValue)
return;
m_myMinValue = myMinValue;
emit myMinValueChanged(myMinValue);
}
void setMyPrefix(QString myPrefix)
{
if (m_myPrefix == myPrefix)
return;
m_myPrefix = myPrefix;
emit myPrefixChanged(myPrefix);
}
void setMyRaiseOnHandsType(QString myRaiseOnHandsType)
{
if (m_myRaiseOnHandsType == myRaiseOnHandsType)
return;
m_myRaiseOnHandsType = myRaiseOnHandsType;
emit myRaiseOnHandsTypeChanged(myRaiseOnHandsType);
}
void setMyRaiseOnHandsInterval(QString myRaiseOnHandsInterval)
{
if (m_myRaiseOnHandsInterval == myRaiseOnHandsInterval)
return;
m_myRaiseOnHandsInterval = myRaiseOnHandsInterval;
emit myRaiseOnHandsIntervalChanged(myRaiseOnHandsInterval);
}
void setMyRaiseOnMinutesInterval(QString myRaiseOnMinutesInterval)
{
if (m_myRaiseOnMinutesInterval == myRaiseOnMinutesInterval)
return;
m_myRaiseOnMinutesInterval = myRaiseOnMinutesInterval;
emit myRaiseOnMinutesIntervalChanged(myRaiseOnMinutesInterval);
}
void setMyAlwaysDoubleBlinds(QString myAlwaysDoubleBlinds)
{
if (m_myAlwaysDoubleBlinds == myAlwaysDoubleBlinds)
return;
m_myAlwaysDoubleBlinds = myAlwaysDoubleBlinds;
emit myAlwaysDoubleBlindsChanged(myAlwaysDoubleBlinds);
}
void setMyAfterMBAlwaysDoubleBlinds(QString myAfterMBAlwaysDoubleBlinds)
{
if (m_myAfterMBAlwaysDoubleBlinds == myAfterMBAlwaysDoubleBlinds)
return;
m_myAfterMBAlwaysDoubleBlinds = myAfterMBAlwaysDoubleBlinds;
emit myAfterMBAlwaysDoubleBlindsChanged(myAfterMBAlwaysDoubleBlinds);
}
void setMyAfterMBAlwaysRaiseAbout(QString myAfterMBAlwaysRaiseAbout)
{
if (m_myAfterMBAlwaysRaiseAbout == myAfterMBAlwaysRaiseAbout)
return;
m_myAfterMBAlwaysRaiseAbout = myAfterMBAlwaysRaiseAbout;
emit myAfterMBAlwaysRaiseAboutChanged(myAfterMBAlwaysRaiseAbout);
}
void setMyAfterMBAlwaysRaiseValue(QString myAfterMBAlwaysRaiseValue)
{
if (m_myAfterMBAlwaysRaiseValue == myAfterMBAlwaysRaiseValue)
return;
m_myAfterMBAlwaysRaiseValue = myAfterMBAlwaysRaiseValue;
emit myAfterMBAlwaysRaiseValueChanged(myAfterMBAlwaysRaiseValue);
} void setMyAfterMBStayAtLastBlind(QString myAfterMBStayAtLastBlind)
{
if (m_myAfterMBStayAtLastBlind == myAfterMBStayAtLastBlind)
return;
m_myAfterMBStayAtLastBlind = myAfterMBStayAtLastBlind;
emit myAfterMBStayAtLastBlindChanged(myAfterMBStayAtLastBlind);
}
void setMyManualBlindsList(QStringList myManualBlindsList)
{
if (m_myManualBlindsList == myManualBlindsList)
return;
m_myManualBlindsList = myManualBlindsList;
emit myManualBlindsListChanged(myManualBlindsList);
}
void setMyValuesList(QStringList myValuesList)
{
if (m_myValuesList == myValuesList)
return;
m_myValuesList = myValuesList;
emit myValuesListChanged(myValuesList);
}
};
#endif // MYLISTVIEWITEMDATA_H
+9 -8
View File
@@ -1,8 +1,8 @@
#include <QtCore>
#include <QtQml>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <configfile.h>
#include <boost/shared_ptr.hpp>
#include "qmlconfig.h"
#include "qmlwrapper.h"
@@ -12,24 +12,25 @@
QmlWrapper::QmlWrapper(boost::shared_ptr<ConfigFile> c)
:QObject(), myConfig(c)
{
myEngine.reset(new QQmlApplicationEngine);
myQmlConfig = new QmlConfig(myConfig); //need to be a default pointer because QML doesnt support shared_ptr()
myQmlEngine = new QQmlApplicationEngine;
myQmlConfig = new QmlConfig(myConfig);
//TODO create Session and Log here
myStartViewImpl = new StartViewImpl(this);
myCreateLocalGameViewImpl = new CreateLocalGameViewImpl(this);
myCreateLocalGameViewImpl = new CreateLocalGameViewImpl(this, myQmlEngine, myConfig);
//Add c++ content to QML here
myEngine->rootContext()->setContextProperty("Config", myQmlConfig);
myEngine->rootContext()->setContextProperty("StartViewImpl", myStartViewImpl);
myQmlEngine->rootContext()->setContextProperty("Config", myQmlConfig);
myQmlEngine->rootContext()->setContextProperty("StartViewImpl", myStartViewImpl);
myQmlEngine->rootContext()->setContextProperty("CreateLocalGameViewImpl", myCreateLocalGameViewImpl);
myEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
myQmlEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
}
QmlWrapper::~QmlWrapper()
{
myEngine->deleteLater();
myQmlEngine->deleteLater();
}
QmlWrapper::QmlWrapper(const QmlWrapper&)
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef QMLWRAPPER_H
#define QMLWRAPPER_H
#include <QtCore>
#include <boost/shared_ptr.hpp>
#include "boost/shared_ptr.hpp"
class QQmlApplicationEngine;
class ConfigFile;
@@ -20,7 +20,7 @@ public:
public slots:
private:
boost::shared_ptr<QQmlApplicationEngine> myEngine;
QQmlApplicationEngine *myQmlEngine;
boost::shared_ptr<ConfigFile> myConfig;
QmlConfig *myQmlConfig;
CreateLocalGameViewImpl *myCreateLocalGameViewImpl;
+7
View File
@@ -1,10 +1,17 @@
#include "startviewimpl.h"
#include "mylistviewitemdata.h"
StartViewImpl::StartViewImpl(QObject *parent) : QObject(parent)
{
}
StartViewImpl::~StartViewImpl()
{
}
void StartViewImpl::startLocalGame()
{
qDebug("startLocalGame im c++");
+6 -1
View File
@@ -2,17 +2,22 @@
#define STARTVIEWIMPL_H
#include <QtCore>
class CreateLocalGameViewImpl;
class StartViewImpl : public QObject
{
Q_OBJECT
public:
explicit StartViewImpl(QObject *parent = 0);
StartViewImpl(QObject *parent = 0);
~StartViewImpl();
signals:
public slots:
Q_INVOKABLE void startLocalGame();
private:
};
#endif // STARTVIEWIMPL_H
+6 -3
View File
@@ -1,10 +1,13 @@
//global tools definition
function correctTextFieldIntegerValue(readyComponent, textValue, minValue) {
function correctTextFieldIntegerValue(readyComponent, textValue, minValue, maxValue) {
if(readyComponent.ready) {
var returnValue = "";
if(textValue == "" || parseInt(textValue) == 0 || parseInt(textValue) < minValue) {
returnValue = minValue;
if(textValue == "" || parseInt(textValue) == 0 || isNaN(parseInt(textValue)) || parseInt(textValue) < parseInt(minValue)) {
returnValue = parseInt(minValue);
}
else if(maxValue && parseInt(textValue) > parseInt(maxValue)) {
returnValue = parseInt(maxValue);
}
else {
returnValue = parseInt(textValue); //remove leading "0000"
@@ -6,6 +6,7 @@ import "../../components"
Rectangle {
id: createLocalGameViewRoot
property string myReadableId: "createLocalGameViewRoot"
width: parent.width
height: parent.height
color: "#FAFAFA"
@@ -17,124 +18,24 @@ Rectangle {
ListView {
id: createLocalGameViewList
anchors.fill: parent
model: ListModel {
id: createLocalGameViewModel
ListElement {
myId: "comboBox_NumberOfPlayers"
myTitle: qsTr("Number of players")
myType: "ComboBox"
myValuesList: [
ListElement { value: "10" },
ListElement { value: "9" },
ListElement { value: "8" },
ListElement { value: "7" },
ListElement { value: "6" },
ListElement { value: "5" },
ListElement { value: "4" },
ListElement { value: "3" },
ListElement { value: "2" }
]
myValueIsIndex: false
myValue: ""
}
ListElement {
myId: "spinBox_StartCash"
myTitle: qsTr("Start cash")
myType: "SpinBox"
myMaxValue: "1000000"
myMinValue: "1000"
myPrefix: "$"
myValue: ""
}
ListElement {
myId: "spinBox_StartBlind"
myTitle: qsTr("Start blind")
myType: "SpinBox"
myMaxValue: "20000"
myMinValue: "5"
myPrefix: "$"
myValue: ""
}
ListElement {
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")
myType: "ComboBox"
myValuesList: [
ListElement { value: "11" },
ListElement { value: "10" },
ListElement { value: "9" },
ListElement { value: "8" },
ListElement { value: "7" },
ListElement { value: "6" },
ListElement { value: "5" },
ListElement { value: "4" },
ListElement { value: "3" },
ListElement { value: "2" },
ListElement { value: "1" }
]
myValue: ""
myValueIsIndex: false
}
Component.onCompleted: {
//set Config Values from config file
createLocalGameViewModel.setProperty(0, "myValue", Config.readConfigIntString("NumberOfPlayers"));
createLocalGameViewModel.setProperty(1, "myValue", Config.readConfigIntString("StartCash"));
createLocalGameViewModel.setProperty(2, "myValue", Config.readConfigIntString("FirstSmallBlind"));
createLocalGameViewModel.setProperty(3, "myRaiseOnHandsType", Config.readConfigIntString("RaiseBlindsAtHands"));
createLocalGameViewModel.setProperty(3, "myRaiseOnHandsInterval", Config.readConfigIntString("RaiseSmallBlindEveryHands"));
createLocalGameViewModel.setProperty(3, "myRaiseOnMinutesInterval", Config.readConfigIntString("RaiseSmallBlindEveryMinutes"));
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"));
}
}
model: CreateLocalGameViewData
delegate: MyListViewDelegateFactory {
myListViewsHeight: createLocalGameViewList.height
myListViewsWidth: createLocalGameViewList.width
myListViewRoot: createLocalGameViewRoot
myListViewModel: createLocalGameViewModel
// TODO --> Blindsfelder immer mit anzeigen spezialfeld manual blinds settings direkt hier inline implementieren
myListViewRoot: createLocalGameViewRoot //set this to be able to display the selector over the whole view
myListViewModel: CreateLocalGameViewData
}
Component.onCompleted: {
CreateLocalGameViewImpl.readConfigValues()
}
}
}
function getListElementValueString(elementName) {
//read model and check for the elementName
for (var i = 0; i < createLocalGameViewModel.count; i++ ) {
if(createLocalGameViewModel.get(i).myId == elementName) {
return createLocalGameViewModel.get(i).myValue;
for (var i = 0; i < CreateLocalGameViewData.lenght; i++ ) {
if(CreateLocalGameViewData[i].myId == elementName) {
return CreateLocalGameViewDat[i].myValue;
}
}
}
@@ -144,11 +45,11 @@ Rectangle {
toolBarRightButton.myIconName = "accept";
toolBarLeftButton.myIconName = "back";
//send start signal to the session
toolBarRightButton.clicked.connect(StartViewImpl.startLocalGame);
toolBarRightButton.clicked.connect(CreateLocalGameViewImpl.startGame);
}
function clearToolBar() {
toolBarRightButton.clicked.disconnect(StartViewImpl.startLocalGame);
toolBarRightButton.clicked.disconnect(CreateLocalGameViewImpl.startGame);
}
Component.onCompleted: {
+5066 -2099
View File
File diff suppressed because it is too large Load Diff
+2344 -676
View File
File diff suppressed because it is too large Load Diff