Create GameData from createLocalGameView and move to startviewimpl. Ready to start the Network session ...
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#include "createlocalgameviewimpl.h"
|
||||
#include "startviewimpl.h"
|
||||
#include "configfile.h"
|
||||
#include "mylistviewitemdata.h"
|
||||
#include "gamedata.h"
|
||||
#include <QtQml>
|
||||
|
||||
CreateLocalGameViewImpl::CreateLocalGameViewImpl(QObject *parent, QQmlApplicationEngine *e, boost::shared_ptr<ConfigFile> c)
|
||||
: QObject(parent) ,myQmlEngine(e), myConfig(c)
|
||||
CreateLocalGameViewImpl::CreateLocalGameViewImpl(QObject *parent, QQmlApplicationEngine *e, boost::shared_ptr<ConfigFile> c, StartViewImpl *s )
|
||||
: QObject(parent) ,myQmlEngine(e), myConfig(c), myStartView(s)
|
||||
{
|
||||
//Build the listView data structure
|
||||
MyListViewItemData *item = NULL;
|
||||
@@ -104,11 +106,51 @@ void CreateLocalGameViewImpl::readConfigValues()
|
||||
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();
|
||||
|
||||
GameData gameData;
|
||||
gameData.maxNumberOfPlayers = listItem("comboBox_NumberOfPlayers")->myValue().toInt();
|
||||
gameData.startMoney = listItem("spinBox_StartCash")->myValue().toInt();
|
||||
gameData.firstSmallBlind = listItem("spinBox_FirstSmallBlind")->myValue().toInt();
|
||||
if(listItem("selector_BlindsRaiseInterval")->myRaiseOnHandsType() == "1") {
|
||||
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
|
||||
gameData.raiseSmallBlindEveryHandsValue = listItem("selector_BlindsRaiseInterval")->myRaiseOnHandsInterval().toInt();
|
||||
} else {
|
||||
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
|
||||
gameData.raiseSmallBlindEveryMinutesValue = listItem("selector_BlindsRaiseInterval")->myRaiseOnMinutesInterval().toInt();
|
||||
}
|
||||
|
||||
if(listItem("selector_BlindsRaiseMode")->myAlwaysDoubleBlinds() == "1") {
|
||||
gameData.raiseMode = DOUBLE_BLINDS;
|
||||
} else {
|
||||
gameData.raiseMode = MANUAL_BLINDS_ORDER;
|
||||
std::list<int> tempBlindList;
|
||||
int i;
|
||||
bool ok = true;
|
||||
for(i = 0; i < listItem("selector_BlindsRaiseMode")->myManualBlindsList().count(); i++) {
|
||||
tempBlindList.push_back(listItem("selector_BlindsRaiseMode")->myManualBlindsList().at(i).toInt());
|
||||
}
|
||||
gameData.manualBlindsList = tempBlindList;
|
||||
|
||||
if(listItem("selector_BlindsRaiseMode")->myAfterMBAlwaysDoubleBlinds() == "1") {
|
||||
gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS;
|
||||
} else {
|
||||
if(listItem("selector_BlindsRaiseMode")->myAfterMBAlwaysRaiseAbout() == "1") {
|
||||
gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT;
|
||||
gameData.afterMBAlwaysRaiseValue = listItem("selector_BlindsRaiseMode")->myAfterMBAlwaysRaiseValue().toInt();
|
||||
} else {
|
||||
gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND;
|
||||
}
|
||||
}
|
||||
}
|
||||
gameData.guiSpeed = listItem("comboBox_GameSpeed")->myValue().toInt();
|
||||
gameData.delayBetweenHandsSec = 7;
|
||||
gameData.playerActionTimeoutSec = 20;
|
||||
|
||||
myStartView->startLocalGame(gameData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user