diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index 21c3f97f..cac1c329 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -43,679 +43,681 @@ using namespace std; ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) { - myArgv0 = argv0; + myArgv0 = argv0; - myQtToolsInterface = CreateQtToolsWrapper(); + myQtToolsInterface = CreateQtToolsWrapper(); - // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 82; + // !!!! Revisionsnummer der Configdefaults !!!!! + configRev = 83; - //standard defaults - logOnOffDefault = "1"; + //standard defaults + logOnOffDefault = "1"; - // Pfad und Dateinamen setzen + // Pfad und Dateinamen setzen #ifdef _WIN32 - const char *appDataPath = getenv("AppData"); - if (appDataPath && appDataPath[0] != 0) { - configFileName = appDataPath; - } - else { - const int MaxPathSize = 1024; - char curDir[MaxPathSize + 1]; - curDir[0] = 0; - _getcwd(curDir, MaxPathSize); - curDir[MaxPathSize] = 0; - configFileName = curDir; - // Testen ob das Verzeichnis beschreibbar ist - ofstream tmpFile; - const char *tmpFileName = "pokerth_test.tmp"; - tmpFile.open((configFileName + "\\" + tmpFileName).c_str()); - if (tmpFile) { - // Erfolgreich, Verzeichnis beschreibbar. - // Datei wieder loeschen. - tmpFile.close(); - remove((configFileName + "\\" + tmpFileName).c_str()); - } - else { - // Fehlgeschlagen, Verzeichnis nicht beschreibbar - curDir[0] = 0; - GetTempPathA(MaxPathSize, curDir); - curDir[MaxPathSize] = 0; - configFileName = curDir; - } - } - //define app-dir - configFileName += "\\pokerth\\"; - ////define log-dir - logDir = configFileName; - logDir += "log-files\\"; - ////define data-dir - dataDir = configFileName; - dataDir += "data\\"; - ////define cache-dir - cacheDir = configFileName; - cacheDir += "cache\\"; + const char *appDataPath = getenv("AppData"); + if (appDataPath && appDataPath[0] != 0) { + configFileName = appDataPath; + } + else { + const int MaxPathSize = 1024; + char curDir[MaxPathSize + 1]; + curDir[0] = 0; + _getcwd(curDir, MaxPathSize); + curDir[MaxPathSize] = 0; + configFileName = curDir; + // Testen ob das Verzeichnis beschreibbar ist + ofstream tmpFile; + const char *tmpFileName = "pokerth_test.tmp"; + tmpFile.open((configFileName + "\\" + tmpFileName).c_str()); + if (tmpFile) { + // Erfolgreich, Verzeichnis beschreibbar. + // Datei wieder loeschen. + tmpFile.close(); + remove((configFileName + "\\" + tmpFileName).c_str()); + } + else { + // Fehlgeschlagen, Verzeichnis nicht beschreibbar + curDir[0] = 0; + GetTempPathA(MaxPathSize, curDir); + curDir[MaxPathSize] = 0; + configFileName = curDir; + } + } + //define app-dir + configFileName += "\\pokerth\\"; + ////define log-dir + logDir = configFileName; + logDir += "log-files\\"; + ////define data-dir + dataDir = configFileName; + dataDir += "data\\"; + ////define cache-dir + cacheDir = configFileName; + cacheDir += "cache\\"; - //create directories on first start of app - mkdir(configFileName.c_str()); - mkdir(logDir.c_str()); - mkdir(dataDir.c_str()); - mkdir(cacheDir.c_str()); + //create directories on first start of app + mkdir(configFileName.c_str()); + mkdir(logDir.c_str()); + mkdir(dataDir.c_str()); + mkdir(cacheDir.c_str()); #else - //define app-dir - const char *homePath = getenv("HOME"); - if(homePath) { - configFileName = homePath; - configFileName += "/.pokerth/"; - ////define log-dir - logDir = configFileName; - logDir += "log-files/"; - ////define data-dir - dataDir = configFileName; - dataDir += "data/"; - ////define cache-dir - cacheDir = configFileName; - cacheDir += "cache/"; - //create directories on first start of app - mkdir(configFileName.c_str(), MODUS) ; - mkdir(logDir.c_str(), MODUS); - mkdir(dataDir.c_str(), MODUS); - mkdir(cacheDir.c_str(), MODUS); - } + //define app-dir + const char *homePath = getenv("HOME"); + if(homePath) { + configFileName = homePath; + configFileName += "/.pokerth/"; + ////define log-dir + logDir = configFileName; + logDir += "log-files/"; + ////define data-dir + dataDir = configFileName; + dataDir += "data/"; + ////define cache-dir + cacheDir = configFileName; + cacheDir += "cache/"; + //create directories on first start of app + mkdir(configFileName.c_str(), MODUS) ; + mkdir(logDir.c_str(), MODUS); + mkdir(dataDir.c_str(), MODUS); + mkdir(cacheDir.c_str(), MODUS); + } #endif - ostringstream tempIntToString; - tempIntToString << configRev; - configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str())); - configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, myQtToolsInterface->getDataPathStdString(myArgv0))); - configList.push_back(ConfigInfo("Language", CONFIG_TYPE_INT, myQtToolsInterface->getDefaultLanguage())); - /*configList.push_back(ConfigInfo("InternetServerAddressIRCChannelUpdateDone", CONFIG_TYPE_INT, "1"));*/ //HACK - configList.push_back(ConfigInfo("ShowLeftToolBox", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("ShowRightToolBox", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("ShowFadeOutCardsAnimation", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("ShowBlindButtons", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("ShowCardsChanceMonitor", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("DontTranslateInternationalPokerStringsFromStyle", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("DisableSplashScreenOnStartup", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("AntiPeekMode", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("AlternateFKeysUserActionMode", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("EnableBetInputFocusSwitch", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("FlipsideTux", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("FlipsideOwn", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("FlipsideOwnFile", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("GameTableStylesList", CONFIG_TYPE_STRING_LIST, "GameTableStyles")); - configList.push_back(ConfigInfo("CurrentGameTableStyle", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("CardDeckStylesList", CONFIG_TYPE_STRING_LIST, "CardDeckStyles")); - configList.push_back(ConfigInfo("CurrentCardDeckStyle", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("LastGameTableStyleDir", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("LastCardDeckStyleDir", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("PlaySoundEffects", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("SoundVolume", CONFIG_TYPE_INT, "8")); - configList.push_back(ConfigInfo("PlayGameActions", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("PlayLobbyChatNotification", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("PlayNetworkGameNotification", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("NumberOfPlayers", CONFIG_TYPE_INT, "10")); - configList.push_back(ConfigInfo("StartCash", CONFIG_TYPE_INT, "5000")); - configList.push_back(ConfigInfo("FirstSmallBlind", CONFIG_TYPE_INT, "10")); - configList.push_back(ConfigInfo("RaiseBlindsAtHands", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("RaiseBlindsAtMinutes", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("RaiseSmallBlindEveryHands", CONFIG_TYPE_INT, "8")); - configList.push_back(ConfigInfo("RaiseSmallBlindEveryMinutes", CONFIG_TYPE_INT, "5")); - configList.push_back(ConfigInfo("AlwaysDoubleBlinds", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("ManualBlindsOrder", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("ManualBlindsList", CONFIG_TYPE_INT_LIST, "Blind")); - configList.push_back(ConfigInfo("AfterMBAlwaysDoubleBlinds", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("AfterMBAlwaysRaiseAbout", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("AfterMBAlwaysRaiseValue", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("AfterMBStayAtLastBlind", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("GameSpeed", CONFIG_TYPE_INT, "4")); - configList.push_back(ConfigInfo("PauseBetweenHands", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("ShowGameSettingsDialogOnNewGame", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("NetNumberOfPlayers", CONFIG_TYPE_INT, "10")); - configList.push_back(ConfigInfo("NetStartCash", CONFIG_TYPE_INT, "3000")); - configList.push_back(ConfigInfo("NetFirstSmallBlind", CONFIG_TYPE_INT, "10")); - configList.push_back(ConfigInfo("NetRaiseBlindsAtHands", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("NetRaiseBlindsAtMinutes", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("NetRaiseSmallBlindEveryHands", CONFIG_TYPE_INT, "8")); - configList.push_back(ConfigInfo("NetRaiseSmallBlindEveryMinutes", CONFIG_TYPE_INT, "5")); - configList.push_back(ConfigInfo("NetAlwaysDoubleBlinds", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("NetManualBlindsOrder", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("NetManualBlindsList", CONFIG_TYPE_INT_LIST, "NetBlind")); - configList.push_back(ConfigInfo("NetAfterMBAlwaysDoubleBlinds", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("NetAfterMBAlwaysRaiseAbout", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("NetAfterMBAlwaysRaiseValue", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("NetAfterMBStayAtLastBlind", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("NetGameSpeed", CONFIG_TYPE_INT, "4")); - configList.push_back(ConfigInfo("NetDelayBetweenHands", CONFIG_TYPE_INT, "7")); - configList.push_back(ConfigInfo("NetTimeOutPlayerAction", CONFIG_TYPE_INT, "20")); - configList.push_back(ConfigInfo("ServerPassword", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("ServerUseIpv6", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("ServerUseSctp", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("ServerPort", CONFIG_TYPE_INT, "7234")); - configList.push_back(ConfigInfo("ServerUsePutAvatars", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("ServerPutAvatarsAddress", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("ServerPutAvatarsUser", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("ServerPutAvatarsPassword", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("InternetServerConfigMode", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("InternetServerListAddress", CONFIG_TYPE_STRING, "pokerth.net/serverlist.xml.z")); - configList.push_back(ConfigInfo("InternetServerAddress", CONFIG_TYPE_STRING, "pokerth.6dns.org")); - configList.push_back(ConfigInfo("InternetServerPort", CONFIG_TYPE_INT, "7234")); - configList.push_back(ConfigInfo("InternetServerPassword", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("InternetServerUseIpv6", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("InternetServerUseSctp", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("UseAvatarServer", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("AvatarServerAddress", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("UseInternetGamePassword", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("InternetGamePassword", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("InternetGameType", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("InternetGameName", CONFIG_TYPE_STRING, "My Online Game")); - configList.push_back(ConfigInfo("UseLobbyChat", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("UseAdminIRC", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("AdminIRCServerAddress", CONFIG_TYPE_STRING, "chat.freenode.net")); - configList.push_back(ConfigInfo("AdminIRCServerPort", CONFIG_TYPE_INT, "6667")); - configList.push_back(ConfigInfo("AdminIRCChannel", CONFIG_TYPE_STRING, "#test")); - configList.push_back(ConfigInfo("AdminIRCChannelPassword", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("AdminIRCServerUseIpv6", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("AdminIRCServerNick", CONFIG_TYPE_INT, "PokerTH_Admin")); - configList.push_back(ConfigInfo("UseLobbyIRC", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("LobbyIRCServerAddress", CONFIG_TYPE_STRING, "chat.freenode.net")); - configList.push_back(ConfigInfo("LobbyIRCServerPort", CONFIG_TYPE_INT, "6667")); - configList.push_back(ConfigInfo("LobbyIRCChannel", CONFIG_TYPE_STRING, "#pokerth-lobby")); - configList.push_back(ConfigInfo("LobbyIRCChannelPassword", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("LobbyIRCServerUseIpv6", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("LobbyIRCServerNick", CONFIG_TYPE_INT, "PokerTH_Lobby")); - configList.push_back(ConfigInfo("UseChatCleaner", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("ChatCleanerHostAddress", CONFIG_TYPE_STRING, "localhost")); - configList.push_back(ConfigInfo("ChatCleanerPort", CONFIG_TYPE_INT, "4327")); - configList.push_back(ConfigInfo("ChatCleanerClientAuth", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("ChatCleanerServerAuth", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("ChatCleanerUseIpv6", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("MyName", CONFIG_TYPE_STRING, "Human Player")); - configList.push_back(ConfigInfo("MyAvatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent1Name", CONFIG_TYPE_STRING, "Player 1")); - configList.push_back(ConfigInfo("Opponent1Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent2Name", CONFIG_TYPE_STRING, "Player 2")); - configList.push_back(ConfigInfo("Opponent2Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent3Name", CONFIG_TYPE_STRING, "Player 3")); - configList.push_back(ConfigInfo("Opponent3Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent4Name", CONFIG_TYPE_STRING, "Player 4")); - configList.push_back(ConfigInfo("Opponent4Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent5Name", CONFIG_TYPE_STRING, "Player 5")); - configList.push_back(ConfigInfo("Opponent5Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent6Name", CONFIG_TYPE_STRING, "Player 6")); - configList.push_back(ConfigInfo("Opponent6Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent7Name", CONFIG_TYPE_STRING, "Player 7")); - configList.push_back(ConfigInfo("Opponent7Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent8Name", CONFIG_TYPE_STRING, "Player 8")); - configList.push_back(ConfigInfo("Opponent8Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("Opponent9Name", CONFIG_TYPE_STRING, "Player 9")); - configList.push_back(ConfigInfo("Opponent9Avatar", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("LogOnOff", CONFIG_TYPE_INT, logOnOffDefault)); - configList.push_back(ConfigInfo("LogDir", CONFIG_TYPE_STRING, logDir)); - configList.push_back(ConfigInfo("LogStoreDuration", CONFIG_TYPE_INT, "2")); - configList.push_back(ConfigInfo("LogInterval", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("UserDataDir", CONFIG_TYPE_STRING, dataDir)); - configList.push_back(ConfigInfo("CacheDir", CONFIG_TYPE_STRING, cacheDir)); - configList.push_back(ConfigInfo("CLA_NoWriteAccess", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("DisableBackToLobbyWarning", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("DlgGameLobbyGameListSortingSection", CONFIG_TYPE_INT, "2")); - configList.push_back(ConfigInfo("DlgGameLobbyGameListSortingOrder", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("DlgGameLobbyGameListFilterIndex", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("GameTableFullScreenSave", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("GameTableHeightSave", CONFIG_TYPE_INT, "600")); - configList.push_back(ConfigInfo("GameTableWidthSave", CONFIG_TYPE_INT, "1024")); - configList.push_back(ConfigInfo("InternetLoginMode", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("InternetLoginPassword", CONFIG_TYPE_STRING, "")); - configList.push_back(ConfigInfo("InternetSavePassword", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("IfInfoMessageShowList", CONFIG_TYPE_STRING_LIST, "Msg")); - - //fill tempList firstTime - configBufferList = configList; + ostringstream tempIntToString; + tempIntToString << configRev; + configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str())); + configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, myQtToolsInterface->getDataPathStdString(myArgv0))); + configList.push_back(ConfigInfo("Language", CONFIG_TYPE_INT, myQtToolsInterface->getDefaultLanguage())); + /*configList.push_back(ConfigInfo("InternetServerAddressIRCChannelUpdateDone", CONFIG_TYPE_INT, "1"));*/ //HACK + configList.push_back(ConfigInfo("ShowLeftToolBox", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("ShowRightToolBox", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("ShowFadeOutCardsAnimation", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("ShowBlindButtons", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("ShowCardsChanceMonitor", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("DontTranslateInternationalPokerStringsFromStyle", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("DisableSplashScreenOnStartup", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AntiPeekMode", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AlternateFKeysUserActionMode", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("EnableBetInputFocusSwitch", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("FlipsideTux", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("FlipsideOwn", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("FlipsideOwnFile", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("GameTableStylesList", CONFIG_TYPE_STRING_LIST, "GameTableStyles")); + configList.push_back(ConfigInfo("CurrentGameTableStyle", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("CardDeckStylesList", CONFIG_TYPE_STRING_LIST, "CardDeckStyles")); + configList.push_back(ConfigInfo("CurrentCardDeckStyle", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("LastGameTableStyleDir", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("LastCardDeckStyleDir", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("PlaySoundEffects", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("SoundVolume", CONFIG_TYPE_INT, "8")); + configList.push_back(ConfigInfo("PlayGameActions", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("PlayLobbyChatNotification", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("PlayNetworkGameNotification", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("NumberOfPlayers", CONFIG_TYPE_INT, "10")); + configList.push_back(ConfigInfo("StartCash", CONFIG_TYPE_INT, "5000")); + configList.push_back(ConfigInfo("FirstSmallBlind", CONFIG_TYPE_INT, "10")); + configList.push_back(ConfigInfo("RaiseBlindsAtHands", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("RaiseBlindsAtMinutes", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("RaiseSmallBlindEveryHands", CONFIG_TYPE_INT, "8")); + configList.push_back(ConfigInfo("RaiseSmallBlindEveryMinutes", CONFIG_TYPE_INT, "5")); + configList.push_back(ConfigInfo("AlwaysDoubleBlinds", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("ManualBlindsOrder", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("ManualBlindsList", CONFIG_TYPE_INT_LIST, "Blind")); + configList.push_back(ConfigInfo("AfterMBAlwaysDoubleBlinds", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("AfterMBAlwaysRaiseAbout", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AfterMBAlwaysRaiseValue", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AfterMBStayAtLastBlind", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("GameSpeed", CONFIG_TYPE_INT, "4")); + configList.push_back(ConfigInfo("PauseBetweenHands", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("ShowGameSettingsDialogOnNewGame", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("NetNumberOfPlayers", CONFIG_TYPE_INT, "10")); + configList.push_back(ConfigInfo("NetStartCash", CONFIG_TYPE_INT, "3000")); + configList.push_back(ConfigInfo("NetFirstSmallBlind", CONFIG_TYPE_INT, "10")); + configList.push_back(ConfigInfo("NetRaiseBlindsAtHands", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("NetRaiseBlindsAtMinutes", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("NetRaiseSmallBlindEveryHands", CONFIG_TYPE_INT, "8")); + configList.push_back(ConfigInfo("NetRaiseSmallBlindEveryMinutes", CONFIG_TYPE_INT, "5")); + configList.push_back(ConfigInfo("NetAlwaysDoubleBlinds", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("NetManualBlindsOrder", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("NetManualBlindsList", CONFIG_TYPE_INT_LIST, "NetBlind")); + configList.push_back(ConfigInfo("NetAfterMBAlwaysDoubleBlinds", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("NetAfterMBAlwaysRaiseAbout", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("NetAfterMBAlwaysRaiseValue", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("NetAfterMBStayAtLastBlind", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("NetGameSpeed", CONFIG_TYPE_INT, "4")); + configList.push_back(ConfigInfo("NetDelayBetweenHands", CONFIG_TYPE_INT, "7")); + configList.push_back(ConfigInfo("NetTimeOutPlayerAction", CONFIG_TYPE_INT, "20")); + configList.push_back(ConfigInfo("ServerPassword", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ServerUseIpv6", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("ServerUseSctp", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("ServerPort", CONFIG_TYPE_INT, "7234")); + configList.push_back(ConfigInfo("ServerUsePutAvatars", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("ServerPutAvatarsAddress", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ServerPutAvatarsUser", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ServerPutAvatarsPassword", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("InternetServerConfigMode", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("InternetServerListAddress", CONFIG_TYPE_STRING, "pokerth.net/serverlist.xml.z")); + configList.push_back(ConfigInfo("InternetServerAddress", CONFIG_TYPE_STRING, "pokerth.6dns.org")); + configList.push_back(ConfigInfo("InternetServerPort", CONFIG_TYPE_INT, "7234")); + configList.push_back(ConfigInfo("InternetServerPassword", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("InternetServerUseIpv6", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("InternetServerUseSctp", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("UseAvatarServer", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AvatarServerAddress", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("UseInternetGamePassword", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("InternetGamePassword", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("InternetGameType", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("InternetGameName", CONFIG_TYPE_STRING, "My Online Game")); + configList.push_back(ConfigInfo("UseLobbyChat", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("UseAdminIRC", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AdminIRCServerAddress", CONFIG_TYPE_STRING, "chat.freenode.net")); + configList.push_back(ConfigInfo("AdminIRCServerPort", CONFIG_TYPE_INT, "6667")); + configList.push_back(ConfigInfo("AdminIRCChannel", CONFIG_TYPE_STRING, "#test")); + configList.push_back(ConfigInfo("AdminIRCChannelPassword", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("AdminIRCServerUseIpv6", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AdminIRCServerNick", CONFIG_TYPE_INT, "PokerTH_Admin")); + configList.push_back(ConfigInfo("UseLobbyIRC", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("LobbyIRCServerAddress", CONFIG_TYPE_STRING, "chat.freenode.net")); + configList.push_back(ConfigInfo("LobbyIRCServerPort", CONFIG_TYPE_INT, "6667")); + configList.push_back(ConfigInfo("LobbyIRCChannel", CONFIG_TYPE_STRING, "#pokerth-lobby")); + configList.push_back(ConfigInfo("LobbyIRCChannelPassword", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("LobbyIRCServerUseIpv6", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("LobbyIRCServerNick", CONFIG_TYPE_INT, "PokerTH_Lobby")); + configList.push_back(ConfigInfo("UseChatCleaner", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("ChatCleanerHostAddress", CONFIG_TYPE_STRING, "localhost")); + configList.push_back(ConfigInfo("ChatCleanerPort", CONFIG_TYPE_INT, "4327")); + configList.push_back(ConfigInfo("ChatCleanerClientAuth", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ChatCleanerServerAuth", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ChatCleanerUseIpv6", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("MyName", CONFIG_TYPE_STRING, "Human Player")); + configList.push_back(ConfigInfo("MyAvatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent1Name", CONFIG_TYPE_STRING, "Player 1")); + configList.push_back(ConfigInfo("Opponent1Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent2Name", CONFIG_TYPE_STRING, "Player 2")); + configList.push_back(ConfigInfo("Opponent2Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent3Name", CONFIG_TYPE_STRING, "Player 3")); + configList.push_back(ConfigInfo("Opponent3Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent4Name", CONFIG_TYPE_STRING, "Player 4")); + configList.push_back(ConfigInfo("Opponent4Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent5Name", CONFIG_TYPE_STRING, "Player 5")); + configList.push_back(ConfigInfo("Opponent5Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent6Name", CONFIG_TYPE_STRING, "Player 6")); + configList.push_back(ConfigInfo("Opponent6Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent7Name", CONFIG_TYPE_STRING, "Player 7")); + configList.push_back(ConfigInfo("Opponent7Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent8Name", CONFIG_TYPE_STRING, "Player 8")); + configList.push_back(ConfigInfo("Opponent8Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("Opponent9Name", CONFIG_TYPE_STRING, "Player 9")); + configList.push_back(ConfigInfo("Opponent9Avatar", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("LogOnOff", CONFIG_TYPE_INT, logOnOffDefault)); + configList.push_back(ConfigInfo("LogDir", CONFIG_TYPE_STRING, logDir)); + configList.push_back(ConfigInfo("LogStoreDuration", CONFIG_TYPE_INT, "2")); + configList.push_back(ConfigInfo("LogInterval", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("UserDataDir", CONFIG_TYPE_STRING, dataDir)); + configList.push_back(ConfigInfo("CacheDir", CONFIG_TYPE_STRING, cacheDir)); + configList.push_back(ConfigInfo("CLA_NoWriteAccess", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("DisableBackToLobbyWarning", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("DlgGameLobbyGameListSortingSection", CONFIG_TYPE_INT, "2")); + configList.push_back(ConfigInfo("DlgGameLobbyGameListSortingOrder", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("DlgGameLobbyGameListFilterIndex", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("GameTableFullScreenSave", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("GameTableHeightSave", CONFIG_TYPE_INT, "600")); + configList.push_back(ConfigInfo("GameTableWidthSave", CONFIG_TYPE_INT, "1024")); + configList.push_back(ConfigInfo("InternetLoginMode", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("InternetLoginPassword", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("InternetSavePassword", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("IfInfoMessageShowList", CONFIG_TYPE_STRING_LIST, "Msg")); + configList.push_back(ConfigInfo("PlayerIgnoreList", CONFIG_TYPE_STRING_LIST, "Player")); -// cout << configTempList[3].name << " " << configTempList[10].defaultValue << endl; + //fill tempList firstTime + configBufferList = configList; - if(!noWriteAccess) { - configFileName += "config.xml"; + // cout << configTempList[3].name << " " << configTempList[10].defaultValue << endl; - //Prüfen ob Configfile existiert --> sonst anlegen - TiXmlDocument doc(configFileName); - if(!doc.LoadFile()){ - myConfigState = NONEXISTING; - updateConfig(myConfigState); - } - else { - //Check if config revision and AppDataDir is ok. Otherwise --> update() - int tempRevision = 0; - string tempAppDataPath (""); + if(!noWriteAccess) { + configFileName += "config.xml"; - TiXmlHandle docHandle( &doc ); - TiXmlElement* confRevision = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement(); - if ( confRevision ) { confRevision->QueryIntAttribute("value", &tempRevision ); } - TiXmlElement* confAppDataPath = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "AppDataDir" ).ToElement(); - if ( confAppDataPath ) { - const char *tmpStr = confAppDataPath->Attribute("value"); - if (tmpStr) tempAppDataPath = tmpStr; - //if appdatapath changes directly update it here not in UpdateConfig() - if(tempAppDataPath != myQtToolsInterface->getDataPathStdString(myArgv0)) { - confAppDataPath->SetAttribute("value", myQtToolsInterface->stringToUtf8(myQtToolsInterface->getDataPathStdString(myArgv0))); - doc.SaveFile( configFileName ); - } - } - if (tempRevision < configRev) { - myConfigState = OLD; - updateConfig(myConfigState) ; - } - } + //Prüfen ob Configfile existiert --> sonst anlegen + TiXmlDocument doc(configFileName); + if(!doc.LoadFile()){ + myConfigState = NONEXISTING; + updateConfig(myConfigState); + } + else { + //Check if config revision and AppDataDir is ok. Otherwise --> update() + int tempRevision = 0; + string tempAppDataPath (""); - fillBuffer(); - } + TiXmlHandle docHandle( &doc ); + TiXmlElement* confRevision = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement(); + if ( confRevision ) { confRevision->QueryIntAttribute("value", &tempRevision ); } + TiXmlElement* confAppDataPath = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "AppDataDir" ).ToElement(); + if ( confAppDataPath ) { + const char *tmpStr = confAppDataPath->Attribute("value"); + if (tmpStr) tempAppDataPath = tmpStr; + //if appdatapath changes directly update it here not in UpdateConfig() + if(tempAppDataPath != myQtToolsInterface->getDataPathStdString(myArgv0)) { + confAppDataPath->SetAttribute("value", myQtToolsInterface->stringToUtf8(myQtToolsInterface->getDataPathStdString(myArgv0))); + doc.SaveFile( configFileName ); + } + } + if (tempRevision < configRev) { + myConfigState = OLD; + updateConfig(myConfigState) ; + } + } + + fillBuffer(); + } } ConfigFile::~ConfigFile() { - delete myQtToolsInterface; - myQtToolsInterface = 0; + delete myQtToolsInterface; + myQtToolsInterface = 0; } void ConfigFile::fillBuffer() { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - size_t i; - string tempString1(""); - string tempString2(""); + size_t i; + string tempString1(""); + string tempString2(""); - TiXmlDocument doc(configFileName); + TiXmlDocument doc(configFileName); - if(doc.LoadFile()) { - TiXmlHandle docHandle( &doc ); + if(doc.LoadFile()) { + TiXmlHandle docHandle( &doc ); - for (i=0; iAttribute("value"); - if (tmpStr1) tempString1 = tmpStr1; - configBufferList[i].defaultValue = tempString1; + const char *tmpStr1 = conf->Attribute("value"); + if (tmpStr1) tempString1 = tmpStr1; + configBufferList[i].defaultValue = tempString1; - const char *tmpStr2 = conf->Attribute("type"); - if (tmpStr2) { - tempString2 = tmpStr2; - if(tempString2 == "list") { + const char *tmpStr2 = conf->Attribute("type"); + if (tmpStr2) { + tempString2 = tmpStr2; + if(tempString2 == "list") { - list tempStringList2; + list tempStringList2; - TiXmlElement* confList = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( configList[i].name ).FirstChild().ToElement(); + TiXmlElement* confList = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( configList[i].name ).FirstChild().ToElement(); - for( ; confList; confList=confList->NextSiblingElement()) { - tempStringList2.push_back(confList->Attribute("value")); - } + for( ; confList; confList=confList->NextSiblingElement()) { + tempStringList2.push_back(confList->Attribute("value")); + } - configBufferList[i].defaultListValue = tempStringList2; - } - } + configBufferList[i].defaultListValue = tempStringList2; + } + } - } - else { LOG_ERROR("Could not find the root element in the config file!"); } + } + else { LOG_ERROR("Could not find the root element in the config file!"); } -// cout << configBufferList[i].name << " " << configBufferList[i].defaultValue << endl; - } - } + // cout << configBufferList[i].name << " " << configBufferList[i].defaultValue << endl; + } + } } void ConfigFile::writeBuffer() const { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - //write buffer to disc if enabled - if(!noWriteAccess) { - TiXmlDocument doc; - TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); - doc.LinkEndChild( decl ); + //write buffer to disc if enabled + if(!noWriteAccess) { + TiXmlDocument doc; + TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); + doc.LinkEndChild( decl ); - TiXmlElement * root = new TiXmlElement( "PokerTH" ); - doc.LinkEndChild( root ); + TiXmlElement * root = new TiXmlElement( "PokerTH" ); + doc.LinkEndChild( root ); - TiXmlElement * config; - config = new TiXmlElement( "Configuration" ); - root->LinkEndChild( config ); + TiXmlElement * config; + config = new TiXmlElement( "Configuration" ); + root->LinkEndChild( config ); - size_t i; + size_t i; - for (i=0; iLinkEndChild( tmpElement ); - tmpElement->SetAttribute("value", configBufferList[i].defaultValue); + for (i=0; iLinkEndChild( tmpElement ); + tmpElement->SetAttribute("value", configBufferList[i].defaultValue); - if(configBufferList[i].type == CONFIG_TYPE_INT_LIST || configBufferList[i].type == CONFIG_TYPE_STRING_LIST) { + if(configBufferList[i].type == CONFIG_TYPE_INT_LIST || configBufferList[i].type == CONFIG_TYPE_STRING_LIST) { - tmpElement->SetAttribute("type", "list"); - list tempList = configBufferList[i].defaultListValue; - list::iterator it; - for(it = tempList.begin(); it != tempList.end(); it++) { + tmpElement->SetAttribute("type", "list"); + list tempList = configBufferList[i].defaultListValue; + list::iterator it; + for(it = tempList.begin(); it != tempList.end(); it++) { - TiXmlElement *tmpSubElement = new TiXmlElement(configBufferList[i].defaultValue); - tmpElement->LinkEndChild( tmpSubElement ); - tmpSubElement->SetAttribute("value", *it); - } + TiXmlElement *tmpSubElement = new TiXmlElement(configBufferList[i].defaultValue); + tmpElement->LinkEndChild( tmpSubElement ); + tmpSubElement->SetAttribute("value", *it); + } - } - } + } + } - doc.SaveFile( configFileName ); - } + doc.SaveFile( configFileName ); + } } void ConfigFile::updateConfig(ConfigState myConfigState) { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - size_t i; + size_t i; - if(myConfigState == NONEXISTING) { + if(myConfigState == NONEXISTING) { - //Create a new ConfigFile! - TiXmlDocument doc; - TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); - doc.LinkEndChild( decl ); + //Create a new ConfigFile! + TiXmlDocument doc; + TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); + doc.LinkEndChild( decl ); - TiXmlElement * root = new TiXmlElement( "PokerTH" ); - doc.LinkEndChild( root ); + TiXmlElement * root = new TiXmlElement( "PokerTH" ); + doc.LinkEndChild( root ); - TiXmlElement * config; - config = new TiXmlElement( "Configuration" ); - root->LinkEndChild( config ); + TiXmlElement * config; + config = new TiXmlElement( "Configuration" ); + root->LinkEndChild( config ); - for (i=0; iLinkEndChild( tmpElement ); - tmpElement->SetAttribute("value", myQtToolsInterface->stringToUtf8(configList[i].defaultValue)); + for (i=0; iLinkEndChild( tmpElement ); + tmpElement->SetAttribute("value", myQtToolsInterface->stringToUtf8(configList[i].defaultValue)); - if(configList[i].type == CONFIG_TYPE_INT_LIST || configBufferList[i].type == CONFIG_TYPE_STRING_LIST) { + if(configList[i].type == CONFIG_TYPE_INT_LIST || configBufferList[i].type == CONFIG_TYPE_STRING_LIST) { - tmpElement->SetAttribute("type", "list"); - list tempList = configList[i].defaultListValue; - list::iterator it; - for(it = tempList.begin(); it != tempList.end(); it++) { + tmpElement->SetAttribute("type", "list"); + list tempList = configList[i].defaultListValue; + list::iterator it; + for(it = tempList.begin(); it != tempList.end(); it++) { - TiXmlElement *tmpSubElement = new TiXmlElement(configList[i].defaultValue); - tmpElement->LinkEndChild( tmpSubElement ); - tmpSubElement->SetAttribute("value", *it); - } + TiXmlElement *tmpSubElement = new TiXmlElement(configList[i].defaultValue); + tmpElement->LinkEndChild( tmpSubElement ); + tmpSubElement->SetAttribute("value", *it); + } - } - } + } + } - doc.SaveFile( configFileName ); - } + doc.SaveFile( configFileName ); + } - if(myConfigState == OLD) { + if(myConfigState == OLD) { - TiXmlDocument oldDoc(configFileName); + TiXmlDocument oldDoc(configFileName); - //load the old one - if(oldDoc.LoadFile()) { + //load the old one + if(oldDoc.LoadFile()) { - string tempString1(""); - string tempString2(""); + string tempString1(""); + string tempString2(""); - TiXmlDocument newDoc; + TiXmlDocument newDoc; - //Create the new one - TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); - newDoc.LinkEndChild( decl ); + //Create the new one + TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); + newDoc.LinkEndChild( decl ); - TiXmlElement * root = new TiXmlElement( "PokerTH" ); - newDoc.LinkEndChild( root ); + TiXmlElement * root = new TiXmlElement( "PokerTH" ); + newDoc.LinkEndChild( root ); - TiXmlElement * config; - config = new TiXmlElement( "Configuration" ); - root->LinkEndChild( config ); + TiXmlElement * config; + config = new TiXmlElement( "Configuration" ); + root->LinkEndChild( config ); - //change configRev and AppDataPath - TiXmlElement * confElement0 = new TiXmlElement( "ConfigRevision" ); - config->LinkEndChild( confElement0 ); - confElement0->SetAttribute("value", configRev); + //change configRev and AppDataPath + TiXmlElement * confElement0 = new TiXmlElement( "ConfigRevision" ); + config->LinkEndChild( confElement0 ); + confElement0->SetAttribute("value", configRev); - TiXmlElement * confElement1 = new TiXmlElement( "AppDataDir" ); - config->LinkEndChild( confElement1 ); - confElement1->SetAttribute("value", myQtToolsInterface->stringToUtf8(myQtToolsInterface->getDataPathStdString(myArgv0))); + TiXmlElement * confElement1 = new TiXmlElement( "AppDataDir" ); + config->LinkEndChild( confElement1 ); + confElement1->SetAttribute("value", myQtToolsInterface->stringToUtf8(myQtToolsInterface->getDataPathStdString(myArgv0))); - TiXmlHandle oldDocHandle( &oldDoc ); + TiXmlHandle oldDocHandle( &oldDoc ); - for (i=0; i take over the saved values + if ( oldConf /*&& (ISAIRCChannelUpdateDone || !(configList[i].name == "IRCChannel" || (configList[i].name == "InternetServerAddress" )))*/ /*HACK remove after 0.6*/ ) { + // if element is already there --> take over the saved values - if(configList[i].name != "ConfigRevision" && configList[i].name != "AppDataDir") { - // dont update ConfigRevision and AppDataDir becaus it was already set ^ + if(configList[i].name != "ConfigRevision" && configList[i].name != "AppDataDir") { + // dont update ConfigRevision and AppDataDir becaus it was already set ^ - TiXmlElement *tmpElement = new TiXmlElement(configList[i].name); - config->LinkEndChild( tmpElement ); + TiXmlElement *tmpElement = new TiXmlElement(configList[i].name); + config->LinkEndChild( tmpElement ); - const char *tmpStr1 = oldConf->Attribute("value"); - if (tmpStr1) tempString1 = tmpStr1; - tmpElement->SetAttribute("value", tempString1); + const char *tmpStr1 = oldConf->Attribute("value"); + if (tmpStr1) tempString1 = tmpStr1; + tmpElement->SetAttribute("value", tempString1); - //for lists copy elements - const char *tmpStr2 = oldConf->Attribute("type"); - if (tmpStr2) { - tempString2 = tmpStr2; - if(tempString2 == "list") { + //for lists copy elements + const char *tmpStr2 = oldConf->Attribute("type"); + if (tmpStr2) { + tempString2 = tmpStr2; + if(tempString2 == "list") { - list tempStringList2; + list tempStringList2; - TiXmlElement* oldConfList = oldDocHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( configList[i].name ).FirstChild().ToElement(); + TiXmlElement* oldConfList = oldDocHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( configList[i].name ).FirstChild().ToElement(); - for( ; oldConfList; oldConfList=oldConfList->NextSiblingElement()) { - tempStringList2.push_back(oldConfList->Attribute("value")); - } + for( ; oldConfList; oldConfList=oldConfList->NextSiblingElement()) { + tempStringList2.push_back(oldConfList->Attribute("value")); + } - tmpElement->SetAttribute("type", "list"); - list tempList = tempStringList2; - list::iterator it; - for(it = tempList.begin(); it != tempList.end(); it++) { + tmpElement->SetAttribute("type", "list"); + list tempList = tempStringList2; + list::iterator it; + for(it = tempList.begin(); it != tempList.end(); it++) { - TiXmlElement *tmpSubElement = new TiXmlElement(tempString1); - tmpElement->LinkEndChild( tmpSubElement ); - tmpSubElement->SetAttribute("value", *it); - } - } - } - } - } - else { - // if element is not there --> set it with defaultValue - TiXmlElement *tmpElement = new TiXmlElement(configList[i].name); - config->LinkEndChild( tmpElement ); - tmpElement->SetAttribute("value", myQtToolsInterface->stringToUtf8(configList[i].defaultValue)); + TiXmlElement *tmpSubElement = new TiXmlElement(tempString1); + tmpElement->LinkEndChild( tmpSubElement ); + tmpSubElement->SetAttribute("value", *it); + } + } + } + } + } + else { + // if element is not there --> set it with defaultValue + TiXmlElement *tmpElement = new TiXmlElement(configList[i].name); + config->LinkEndChild( tmpElement ); + tmpElement->SetAttribute("value", myQtToolsInterface->stringToUtf8(configList[i].defaultValue)); - if(configList[i].type == CONFIG_TYPE_INT_LIST || configBufferList[i].type == CONFIG_TYPE_STRING_LIST) { + if(configList[i].type == CONFIG_TYPE_INT_LIST || configBufferList[i].type == CONFIG_TYPE_STRING_LIST) { - tmpElement->SetAttribute("type", "list"); - list tempList = configList[i].defaultListValue; - list::iterator it; - for(it = tempList.begin(); it != tempList.end(); it++) { + tmpElement->SetAttribute("type", "list"); + list tempList = configList[i].defaultListValue; + list::iterator it; + for(it = tempList.begin(); it != tempList.end(); it++) { - TiXmlElement *tmpSubElement = new TiXmlElement(configList[i].defaultValue); - tmpElement->LinkEndChild( tmpSubElement ); - tmpSubElement->SetAttribute("value", *it); - } - } - } - } - newDoc.SaveFile( configFileName ); - } - else { LOG_ERROR("Cannot update config file: Unable to load configuration."); } + TiXmlElement *tmpSubElement = new TiXmlElement(configList[i].defaultValue); + tmpElement->LinkEndChild( tmpSubElement ); + tmpSubElement->SetAttribute("value", *it); + } + } + } + } + newDoc.SaveFile( configFileName ); + } + else { LOG_ERROR("Cannot update config file: Unable to load configuration."); } - } + } } string ConfigFile::readConfigString(string varName) const { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - size_t i; - string tempString(""); + size_t i; + string tempString(""); - for (i=0; i> tempInt; + istringstream isst; + isst.str (tempString); + isst >> tempInt; - return tempInt; + return tempInt; } list ConfigFile::readConfigIntList(string varName) const { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - size_t i; - list tempStringList; - list tempIntList; + size_t i; + list tempStringList; + list tempIntList; - for (i=0; i::iterator it; - for(it = tempStringList.begin(); it != tempStringList.end(); it++) { + istringstream isst; + string tempString; + int tempInt; + list::iterator it; + for(it = tempStringList.begin(); it != tempStringList.end(); it++) { - isst.str(*it); - isst >> tempInt; - tempIntList.push_back(tempInt); - isst.str(""); - isst.clear(); - } + isst.str(*it); + isst >> tempInt; + tempIntList.push_back(tempInt); + isst.str(""); + isst.clear(); + } - return tempIntList; + return tempIntList; } list ConfigFile::readConfigStringList(string varName) const { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - size_t i; - list tempStringList; + size_t i; + list tempStringList; - for (i=0; i varCont) { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - size_t i; - ostringstream intToString; - list stringList; + size_t i; + ostringstream intToString; + list stringList; - for (i=0; i::iterator it; - for(it = varCont.begin(); it != varCont.end(); it++) { + if (configBufferList[i].name == varName) { + string tempString; + list::iterator it; + for(it = varCont.begin(); it != varCont.end(); it++) { - intToString << (*it); - stringList.push_back(intToString.str()); - intToString.str(""); - intToString.clear(); - } + intToString << (*it); + stringList.push_back(intToString.str()); + intToString.str(""); + intToString.clear(); + } - configBufferList[i].defaultListValue = stringList; - } - } + configBufferList[i].defaultListValue = stringList; + } + } } void ConfigFile::writeConfigString(string varName, string varCont) { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - size_t i; - for (i=0; i varCont) { - boost::recursive_mutex::scoped_lock lock(m_configMutex); + boost::recursive_mutex::scoped_lock lock(m_configMutex); - size_t i; - for (i=0; ireadConfigString("MyName").c_str()); + myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str()); } ChatTools::~ChatTools() @@ -38,152 +38,160 @@ ChatTools::~ChatTools() } void ChatTools::sendMessage() { - - if(myLineEdit->text().size() && mySession) { - fillChatLinesHistory(myLineEdit->text()); - if(myChatType == INGAME_CHAT) { - mySession->sendGameChatMessage(myLineEdit->text().toUtf8().constData()); - } - else { - mySession->sendLobbyChatMessage(myLineEdit->text().toUtf8().constData()); - } - myLineEdit->setText(""); - } + + if(myLineEdit->text().size() && mySession) { + fillChatLinesHistory(myLineEdit->text()); + if(myChatType == INGAME_CHAT) { + mySession->sendGameChatMessage(myLineEdit->text().toUtf8().constData()); + } + else { + mySession->sendLobbyChatMessage(myLineEdit->text().toUtf8().constData()); + } + myLineEdit->setText(""); + } } void ChatTools::receiveMessage(QString playerName, QString message) { - if(myTextBrowser) { + if(myTextBrowser) { - message = message.replace("<","<"); - message = message.replace(">",">"); + message = message.replace("<","<"); + message = message.replace(">",">"); - //refresh myNick if it was changed during runtime - myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str()); - - QString tempMsg; - - if(message.contains(myNick, Qt::CaseInsensitive)) { + //refresh myNick if it was changed during runtime + myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str()); - switch (myChatType) { - case INET_LOBBY_CHAT: { - tempMsg = QString(""+message+""); - //play beep sound only in INET-lobby-chat -// TODO dont play when message is from yourself - if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) { - myLobby->getMyW()->getMySDLPlayer()->playSound("lobbychatnotify",0); - } - } - break; - case LAN_LOBBY_CHAT: tempMsg = QString(""+message+""); - break; - case INGAME_CHAT: tempMsg = QString("getChatTextNickNotifyColor()+";\">"+message+""); - break; - default: tempMsg = message; - } - } - else { - switch (myChatType) { - case INET_LOBBY_CHAT: tempMsg = QString(""+message+""); - break; - case LAN_LOBBY_CHAT: tempMsg = QString(""+message+""); - break; - case INGAME_CHAT: tempMsg = QString("getChatLogTextColor()+";\">"+message+""); - break; - default: tempMsg = message; - } - - } - myTextBrowser->append(playerName + ": " + tempMsg); - } + QString tempMsg; + + if(message.contains(myNick, Qt::CaseInsensitive)) { + + switch (myChatType) { + case INET_LOBBY_CHAT: { + tempMsg = QString(""+message+""); + //play beep sound only in INET-lobby-chat + // TODO dont play when message is from yourself + if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) { + myLobby->getMyW()->getMySDLPlayer()->playSound("lobbychatnotify",0); + } + } + break; + case LAN_LOBBY_CHAT: tempMsg = QString(""+message+""); + break; + case INGAME_CHAT: tempMsg = QString("getChatTextNickNotifyColor()+";\">"+message+""); + break; + default: tempMsg = message; + } + } + else { + switch (myChatType) { + case INET_LOBBY_CHAT: tempMsg = QString(""+message+""); + break; + case LAN_LOBBY_CHAT: tempMsg = QString(""+message+""); + break; + case INGAME_CHAT: tempMsg = QString("getChatLogTextColor()+";\">"+message+""); + break; + default: tempMsg = message; + } + + } + + + myTextBrowser->append(playerName + ": " + tempMsg); + } } void ChatTools::clearChat() { - if(myTextBrowser) - myTextBrowser->clear(); + if(myTextBrowser) + myTextBrowser->clear(); } void ChatTools::checkInputLength(QString string) { - if(string.toUtf8().length() > 120) myLineEdit->setMaxLength(string.length()); + if(string.toUtf8().length() > 120) myLineEdit->setMaxLength(string.length()); } void ChatTools::fillChatLinesHistory(QString fillString) { - chatLinesHistory << fillString; - if(chatLinesHistory.size() > 50) chatLinesHistory.removeFirst(); + chatLinesHistory << fillString; + if(chatLinesHistory.size() > 50) chatLinesHistory.removeFirst(); } void ChatTools::showChatHistoryIndex(int index) { - if(index <= chatLinesHistory.size()) { + if(index <= chatLinesHistory.size()) { -// cout << chatLinesHistory.size() << " : " << index << endl; - if(index > 0) - myLineEdit->setText(chatLinesHistory.at(chatLinesHistory.size()-(index))); - else - myLineEdit->setText(""); - } + // cout << chatLinesHistory.size() << " : " << index << endl; + if(index > 0) + myLineEdit->setText(chatLinesHistory.at(chatLinesHistory.size()-(index))); + else + myLineEdit->setText(""); + } } void ChatTools::nickAutoCompletition() { - QString myChatString = myLineEdit->text(); - QStringList myChatStringList = myChatString.split(" "); + QString myChatString = myLineEdit->text(); + QStringList myChatStringList = myChatString.split(" "); - QStringList matchStringList; + QStringList matchStringList; - if(nickAutoCompletitionCounter == 0) { + if(nickAutoCompletitionCounter == 0) { - if(myNickTreeWidget) { - QTreeWidgetItemIterator it(myNickTreeWidget); - while (*it) { - if ((*it)->text(0).startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "") - matchStringList << (*it)->text(0); - ++it; - } - } + if(myNickTreeWidget) { + QTreeWidgetItemIterator it(myNickTreeWidget); + while (*it) { + if ((*it)->text(0).startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "") + matchStringList << (*it)->text(0); + ++it; + } + } - if(!myNickStringList.isEmpty()) { + if(!myNickStringList.isEmpty()) { - QStringListIterator it(myNickStringList); - while (it.hasNext()) { - QString next = it.next(); - if (next.startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "") - matchStringList << next; - } - } - } + QStringListIterator it(myNickStringList); + while (it.hasNext()) { + QString next = it.next(); + if (next.startsWith(myChatStringList.last(), Qt::CaseInsensitive) && myChatStringList.last() != "") + matchStringList << next; + } + } + } - if(!matchStringList.isEmpty() || nickAutoCompletitionCounter > 0) { - - myChatStringList.removeLast(); + if(!matchStringList.isEmpty() || nickAutoCompletitionCounter > 0) { -// cout << nickAutoCompletitionCounter << endl; + myChatStringList.removeLast(); - if(nickAutoCompletitionCounter == 0) { - //first one - lastChatString = myChatStringList.join(" "); - lastMatchStringList = matchStringList; - } + // cout << nickAutoCompletitionCounter << endl; - if(nickAutoCompletitionCounter == lastMatchStringList.size()) nickAutoCompletitionCounter = 0; + if(nickAutoCompletitionCounter == 0) { + //first one + lastChatString = myChatStringList.join(" "); + lastMatchStringList = matchStringList; + } -// cout << nickAutoCompletitionCounter << "\n"; - - if(lastChatString == "") - myLineEdit->setText(lastMatchStringList.at(nickAutoCompletitionCounter)+": "); - else - myLineEdit->setText(lastChatString+" "+lastMatchStringList.at(nickAutoCompletitionCounter)+" "); - - nickAutoCompletitionCounter++; - } + if(nickAutoCompletitionCounter == lastMatchStringList.size()) nickAutoCompletitionCounter = 0; + + // cout << nickAutoCompletitionCounter << "\n"; + + if(lastChatString == "") + myLineEdit->setText(lastMatchStringList.at(nickAutoCompletitionCounter)+": "); + else + myLineEdit->setText(lastChatString+" "+lastMatchStringList.at(nickAutoCompletitionCounter)+" "); + + nickAutoCompletitionCounter++; + } } void ChatTools::setChatTextEdited() { - nickAutoCompletitionCounter = 0; + nickAutoCompletitionCounter = 0; +} + +void ChatTools::refreshIgnoreList() +{ + + } diff --git a/src/gui/qt/chattools/chattools.h b/src/gui/qt/chattools/chattools.h index a31b8178..148a217f 100644 --- a/src/gui/qt/chattools/chattools.h +++ b/src/gui/qt/chattools/chattools.h @@ -34,55 +34,56 @@ class gameLobbyDialogImpl; class ChatTools : public QObject { -Q_OBJECT + Q_OBJECT public: - ChatTools(QLineEdit*, ConfigFile*, ChatType, QTextBrowser *b = NULL, QTreeWidget *t = NULL, gameLobbyDialogImpl *lo = NULL); + ChatTools(QLineEdit*, ConfigFile*, ChatType, QTextBrowser *b = NULL, QTreeWidget *t = NULL, gameLobbyDialogImpl *lo = NULL); - ~ChatTools(); + ~ChatTools(); - void setSession(boost::shared_ptr session) { mySession = session; } + void setSession(boost::shared_ptr session) { mySession = session; } public slots: - - void sendMessage(); - void receiveMessage(QString playerName, QString message); - void clearChat(); - void checkInputLength(QString string); - - void fillChatLinesHistory(QString fillString); - void showChatHistoryIndex(int index); - int getChatLinesHistorySize() { return chatLinesHistory.size(); } - - void nickAutoCompletition(); - void setChatTextEdited(); - void setPlayerNicksList(QStringList value) { myNickStringList = value; } - void setMyNick ( const QString& theValue ) { myNick = theValue; } - QString getMyNick () { return myNick; } + void sendMessage(); + void receiveMessage(QString playerName, QString message); + void clearChat(); + void checkInputLength(QString string); + + void fillChatLinesHistory(QString fillString); + void showChatHistoryIndex(int index); + int getChatLinesHistorySize() { return chatLinesHistory.size(); } + + void nickAutoCompletition(); + void setChatTextEdited(); + + void setPlayerNicksList(QStringList value) { myNickStringList = value; } + void setMyNick ( const QString& theValue ) { myNick = theValue; } + QString getMyNick () { return myNick; } + + void setMyStyle ( GameTableStyleReader* theValue ) { myStyle = theValue; } + void refreshIgnoreList(); - void setMyStyle ( GameTableStyleReader* theValue ) { myStyle = theValue; } - private: - QStringList chatLinesHistory; - QString lastChatString; - QStringList lastMatchStringList; - int nickAutoCompletitionCounter; + QStringList chatLinesHistory; + QString lastChatString; + QStringList lastMatchStringList; + int nickAutoCompletitionCounter; - QLineEdit *myLineEdit; - QTreeWidget *myNickTreeWidget; - QStringList myNickStringList; - QTextBrowser *myTextBrowser; - boost::shared_ptr mySession; - ChatType myChatType; - ConfigFile *myConfig; - - QString myNick; + QLineEdit *myLineEdit; + QTreeWidget *myNickTreeWidget; + QStringList myNickStringList; + QTextBrowser *myTextBrowser; + boost::shared_ptr mySession; + ChatType myChatType; + ConfigFile *myConfig; - GameTableStyleReader *myStyle; - gameLobbyDialogImpl *myLobby; + QString myNick; + + GameTableStyleReader *myStyle; + gameLobbyDialogImpl *myLobby; }; #endif diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index 7cf000b9..6490f3a1 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -21,6 +21,8 @@ #include #include "mymessagedialogimpl.h" +using namespace std; + gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) : QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), myCurrentGameId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0), inviteDialogIsCurrentlyShown(false) { @@ -86,6 +88,8 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) nickListContextMenu = new QMenu(); nickListInviteAction = new QAction(QIcon(":/gfx/list_add_user.png"), tr("Invite player"), nickListContextMenu); nickListContextMenu->addAction(nickListInviteAction); + nickListIgnorePlayerAction = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore player"), nickListContextMenu); + nickListContextMenu->addAction(nickListIgnorePlayerAction); connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) ); connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) ); @@ -106,6 +110,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) connect( comboBox_gameListFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changeGameListFilter(int))); connect( treeWidget_NickList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( showNickListContextMenu(QPoint) ) ); connect( nickListInviteAction, SIGNAL(triggered()), this, SLOT( invitePlayerToCurrentGame() )); + connect( nickListIgnorePlayerAction, SIGNAL(triggered()), this, SLOT( putPlayerOnIgnoreList() )); lineEdit_ChatInput->installEventFilter(this); @@ -1317,8 +1322,17 @@ void gameLobbyDialogImpl::showNickListContextMenu(QPoint p) assert(mySession); if(inGame && mySession->getClientGameInfo(mySession->getClientCurrentGameId()).data.gameType == GAME_TYPE_INVITE_ONLY && treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt() != mySession->getClientUniquePlayerId()) { - nickListContextMenu->popup(treeWidget_NickList->mapToGlobal(p)); + + nickListInviteAction->setEnabled(true); + nickListInviteAction->setText(tr("Invite player %1").arg(QString::fromUtf8(mySession->getClientPlayerInfo(treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt()).playerName.c_str()))); + } + else { + nickListInviteAction->setText(tr("Invite player ...")); + nickListInviteAction->setEnabled(true); + } + + nickListContextMenu->popup(treeWidget_NickList->mapToGlobal(p)); } } @@ -1365,13 +1379,14 @@ void gameLobbyDialogImpl::showInvitationDialog(unsigned gameId, unsigned playerI } -void gameLobbyDialogImpl::chatInfoPlayerInviation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom) +void gameLobbyDialogImpl::chatInfoPlayerInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom) { textBrowser_ChatDisplay->append(tr("Player %1 has been invited to %2 by %3.").arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdWho).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str()))); } -void gameLobbyDialogImpl::chatInfoPlayerRejectedInviation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason) +void gameLobbyDialogImpl::chatInfoPlayerRejectedInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason) { + QString string; if(reason == DENY_GAME_INVITATION_NO) string = tr("Player %1 has rejected intivation to %2."); @@ -1380,3 +1395,34 @@ void gameLobbyDialogImpl::chatInfoPlayerRejectedInviation(unsigned gameId, unsig textBrowser_ChatDisplay->append(string.arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdWho).playerName.c_str())).arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str()))); } + +bool gameLobbyDialogImpl::playerIsOnIgnoreList(unsigned playerId) { + + list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); + list::iterator it1; + for(it1= playerIgnoreList.begin(); it1 != playerIgnoreList.end(); it1++) { + + QString tmpString = QString::fromUtf8(it1->c_str()); + if(QString("%1").arg(playerId) == tmpString.split(",").at(0)) { + + return true; + } + } + + return false; +} + + +void gameLobbyDialogImpl::putPlayerOnIgnoreList(unsigned playerId) { + + if(!playerIsOnIgnoreList(playerId)) { + + list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); + playerIgnoreList.push_back(QString("%1,%2").arg(playerId).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str())).toUtf8().constData()); + myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList); + myConfig->writeBuffer(); + + myChat->refreshIgnoreList(); + } +} + diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h index 9fc985f0..3fc7cd6f 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h @@ -106,8 +106,10 @@ public slots: void invitePlayerToCurrentGame(); void showInfoMsgBox(); void showInvitationDialog(unsigned gameId, unsigned playerIdFrom); - void chatInfoPlayerInviation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom); - void chatInfoPlayerRejectedInviation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason); + void chatInfoPlayerInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom); + void chatInfoPlayerRejectedInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason); + void putPlayerOnIgnoreList(unsigned playerid); + bool playerIsOnIgnoreList(unsigned playerid); private: @@ -140,7 +142,7 @@ private: MyGameListSortFilterProxyModel *myGameListSortFilterProxyModel; QMenu *nickListContextMenu; QAction *nickListInviteAction; - QAction *ignorePlayerAction; + QAction *nickListIgnorePlayerAction; int infoMsgToShowId; int currentInvitationGameId; bool inviteDialogIsCurrentlyShown; diff --git a/src/gui/qt/resources/im-ban-user.png b/src/gui/qt/resources/im-ban-user.png new file mode 100644 index 00000000..30fe0db5 Binary files /dev/null and b/src/gui/qt/resources/im-ban-user.png differ diff --git a/src/gui/qt/resources/pokerth.qrc b/src/gui/qt/resources/pokerth.qrc index cb84425c..66027220 100644 --- a/src/gui/qt/resources/pokerth.qrc +++ b/src/gui/qt/resources/pokerth.qrc @@ -44,6 +44,7 @@ ktip.png system_help_64.png list_add_user_64.png + im-ban-user.png cflags/ad.png diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index a5ee98cf..f049697e 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -125,7 +125,7 @@ - 5 + 0 @@ -1464,319 +1464,384 @@ p, li { white-space: pre-wrap; } - + Qt::Horizontal - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + + + + 0 + + + + Server + + + + + + Automatic Server Configuration URL + + + true + + + + + + Serverlist Address: + + + + + + + + + + + + + + 0 + 116 + + + + Manual Server Configuration + + + true + + + false + + + + + + Server Address: + + + lineEdit_InternetServerAddress + + + + + + + 60 + + + + + + + Server Port: + + + spinBox_InternetServerPort + + + + + + + 80 + + + 65535 + + + 7234 + + + + + + + Avatar Server: + + + + + + + + + + + + Use IPv6 + + + + + + + <a href="http://en.wikipedia.org/wiki/Ipv6">What is this?</a> + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Use SCTP + + + + + + + <a href="http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol">What is this?</a> + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + Game + + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style="font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Note: Default </span><span style=" font-weight:600; font-style:italic;">Game Settings</span><span style=" font-style:italic;"> like "Maximum number of players", "Start Cash" and "Small Blind" will be used </span><span style=" font-weight:600; font-style:italic;">from Network Game Settings.</span></p></body></html> - - - true - - - - - - - Internet Server - - - - - - Automatic Server Configuration URL - - - true - - - - 4 - - 6 + + true - - + + + + + + - Serverlist Address: + Default game name: - - + + - - - - - - - 0 - 116 - - - - Manual Server Configuration - - - true - - - false - - - - 4 + + + + + + + Default game type: + + + + + + + + 0 + 0 + + + + + Standard + + + + :/gfx/player_play.png:/gfx/player_play.png + + + + + Registered players only + + + + :/gfx/registered.png:/gfx/registered.png + + + + + Invited players only + + + + :/gfx/list_add_user.png:/gfx/list_add_user.png + + + + + Ranking game + + + + :/gfx/cup.png:/gfx/cup.png + + + + + + + + + + 0 - + + + + Use password for private game: + + + + :/gfx/lock.png:/gfx/lock.png + + + + + + + false + + + QLineEdit::Password + + + + + + + + + Show lobby chat + + + + + + + Qt::Vertical + + + + 437 + 72 + + + + + + + + + Ignored Players + + + + + + true + + 5 - - - - Server Address: - - - lineEdit_InternetServerAddress - - - - - - - 60 - - - - - - - Server Port: - - - spinBox_InternetServerPort - - - - - - - 80 - - - 65535 - - - 7234 - - - - - - - Avatar Server: - - - - - - - - - - - - Use IPv6 - - - - - - - <a href="http://en.wikipedia.org/wiki/Ipv6">What is this?</a> - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Use SCTP - - - - - - - <a href="http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol">What is this?</a> - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - + + false + + + true + + + + Player + + + + + + + + Qt::Horizontal + + + + 256 + 218 + + + + + + + + Remove Player + + + + :/gfx/list-remove.png:/gfx/list-remove.png + + + + + - - - - - - Default game name: - - - - - - - - - - - - - - Default game type: - - - - - - - - 0 - 0 - - - - - Standard - - - - :/gfx/player_play.png:/gfx/player_play.png - - - - - Registered players only - - - - :/gfx/registered.png:/gfx/registered.png - - - - - Invited players only - - - - :/gfx/list_add_user.png:/gfx/list_add_user.png - - - - - Ranking game - - - - :/gfx/cup.png:/gfx/cup.png - - - - - - - - - - 0 - - - - - Use password for private game: - - - - :/gfx/lock.png:/gfx/lock.png - - - - - - - false - - - QLineEdit::Password - - - - - - - - - Show lobby chat - - - - - + + Qt::Vertical - 437 - 16 + 20 + 121 @@ -3452,17 +3517,6 @@ p, li { white-space: pre-wrap; } spinBox_serverPort checkBox_useIpv6 checkBox_useSctp - groupBox_automaticServerConfig - lineEdit_InternetServerListAddress - groupBox_manualServerConfig - lineEdit_InternetServerAddress - spinBox_InternetServerPort - checkBox_useAvatarServer - lineEdit_avatarServerAddress - checkBox_InternetServerUseIpv6 - checkBox_InternetServerUseSctp - checkBox_UseInternetGamePassword - lineEdit_InternetGamePassword pushButton_HumanPlayerAvatar lineEdit_HumanPlayerName pushButton_Opponent1Avatar @@ -3526,22 +3580,6 @@ p, li { white-space: pre-wrap; } - - checkBox_UseInternetGamePassword - toggled(bool) - lineEdit_InternetGamePassword - setEnabled(bool) - - - 402 - 434 - - - 774 - 436 - - - horizontalSlider_soundVolume valueChanged(int) @@ -3590,22 +3628,6 @@ p, li { white-space: pre-wrap; } - - checkBox_useAvatarServer - toggled(bool) - lineEdit_avatarServerAddress - setEnabled(bool) - - - 314 - 318 - - - 366 - 320 - - - radioButton_flipsideOwn toggled(bool) diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index 6009ee60..81d3a47c 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -34,807 +34,823 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva : QDialog(parent), myConfig(c), mySelectAvatarDialogImpl(s) { #ifdef __APPLE__ - setWindowModality(Qt::ApplicationModal); - setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); + setWindowModality(Qt::ApplicationModal); + setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); #endif - setupUi(this); + setupUi(this); - myManualBlindsOrderDialog = new manualBlindsOrderDialogImpl; + myManualBlindsOrderDialog = new manualBlindsOrderDialogImpl; - myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); + myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); - pushButton_openFlipsidePicture->setIcon(QIcon(QPixmap(myAppDataPath+"gfx/gui/misc/fileopen16.png"))); - pushButton_openLogDir->setIcon(QIcon(QPixmap(myAppDataPath+"gfx/gui/misc/fileopen16.png"))); + pushButton_openFlipsidePicture->setIcon(QIcon(QPixmap(myAppDataPath+"gfx/gui/misc/fileopen16.png"))); + pushButton_openLogDir->setIcon(QIcon(QPixmap(myAppDataPath+"gfx/gui/misc/fileopen16.png"))); - if (myConfig->readConfigInt("CLA_NoWriteAccess")) { groupBox_logOnOff->setDisabled(TRUE); } + if (myConfig->readConfigInt("CLA_NoWriteAccess")) { groupBox_logOnOff->setDisabled(TRUE); } - comboBox_switchLanguage->addItem(tr("Bulgarian"),"bg"); - comboBox_switchLanguage->addItem(tr("Chinese"),"zhcn"); - comboBox_switchLanguage->addItem(tr("Czech"),"cz"); - comboBox_switchLanguage->addItem(tr("Danish"),"dk"); - comboBox_switchLanguage->addItem(tr("Dutch"),"nl"); - comboBox_switchLanguage->addItem(tr("English"),"en"); - comboBox_switchLanguage->addItem(tr("French"),"fr"); - comboBox_switchLanguage->addItem(tr("Finnish"),"fi"); - comboBox_switchLanguage->addItem(tr("German"),"de"); - comboBox_switchLanguage->addItem(tr("Greek"),"gr"); - comboBox_switchLanguage->addItem(tr("Hungarian"),"hu"); - comboBox_switchLanguage->addItem(tr("Italian"),"it"); - comboBox_switchLanguage->addItem(tr("Norwegian"),"no"); - comboBox_switchLanguage->addItem(tr("Polish"),"pl"); - comboBox_switchLanguage->addItem(tr("Portuguese (Brazilian)"),"ptbr"); - comboBox_switchLanguage->addItem(tr("Portuguese (Portuguese)"),"ptpt"); - comboBox_switchLanguage->addItem(tr("Russian"),"ru"); - comboBox_switchLanguage->addItem(tr("Slovak"),"sk"); - comboBox_switchLanguage->addItem(tr("Spanish"),"es"); - comboBox_switchLanguage->addItem(tr("Swedish"),"sv"); - comboBox_switchLanguage->addItem(tr("Turkish"),"tr"); + comboBox_switchLanguage->addItem(tr("Bulgarian"),"bg"); + comboBox_switchLanguage->addItem(tr("Chinese"),"zhcn"); + comboBox_switchLanguage->addItem(tr("Czech"),"cz"); + comboBox_switchLanguage->addItem(tr("Danish"),"dk"); + comboBox_switchLanguage->addItem(tr("Dutch"),"nl"); + comboBox_switchLanguage->addItem(tr("English"),"en"); + comboBox_switchLanguage->addItem(tr("French"),"fr"); + comboBox_switchLanguage->addItem(tr("Finnish"),"fi"); + comboBox_switchLanguage->addItem(tr("German"),"de"); + comboBox_switchLanguage->addItem(tr("Greek"),"gr"); + comboBox_switchLanguage->addItem(tr("Hungarian"),"hu"); + comboBox_switchLanguage->addItem(tr("Italian"),"it"); + comboBox_switchLanguage->addItem(tr("Norwegian"),"no"); + comboBox_switchLanguage->addItem(tr("Polish"),"pl"); + comboBox_switchLanguage->addItem(tr("Portuguese (Brazilian)"),"ptbr"); + comboBox_switchLanguage->addItem(tr("Portuguese (Portuguese)"),"ptpt"); + comboBox_switchLanguage->addItem(tr("Russian"),"ru"); + comboBox_switchLanguage->addItem(tr("Slovak"),"sk"); + comboBox_switchLanguage->addItem(tr("Spanish"),"es"); + comboBox_switchLanguage->addItem(tr("Swedish"),"sv"); + comboBox_switchLanguage->addItem(tr("Turkish"),"tr"); - connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) ); - connect( lineEdit_HumanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent1Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent2Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent3Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent4Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent5Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent6Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent7Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent8Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( lineEdit_Opponent9Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); - connect( pushButton_openFlipsidePicture, SIGNAL( clicked() ), this, SLOT( setFlipsidePicFileName()) ); - connect( pushButton_openLogDir, SIGNAL( clicked() ), this, SLOT( setLogDir()) ); - connect( pushButton_HumanPlayerAvatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile0()) ); - connect( pushButton_Opponent1Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile1()) ); - connect( pushButton_Opponent2Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile2()) ); - connect( pushButton_Opponent3Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile3()) ); - connect( pushButton_Opponent4Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile4()) ); - connect( pushButton_Opponent5Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile5()) ); - connect( pushButton_Opponent6Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile6()) ); - connect( pushButton_Opponent7Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile7()) ); - connect( pushButton_Opponent8Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile8()) ); - connect( pushButton_Opponent9Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile9()) ); - connect( pushButton_editManualBlindsOrder, SIGNAL( clicked() ), this, SLOT( callManualBlindsOrderDialog()) ); - connect( pushButton_netEditManualBlindsOrder, SIGNAL( clicked() ), this, SLOT( callNetManualBlindsOrderDialog()) ); + connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) ); + connect( lineEdit_HumanPlayerName, SIGNAL( textChanged( const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent1Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent2Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent3Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent4Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent5Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent6Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent7Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent8Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( lineEdit_Opponent9Name, SIGNAL( textChanged(const QString &) ), this, SLOT( playerNickChanged() ) ); + connect( pushButton_openFlipsidePicture, SIGNAL( clicked() ), this, SLOT( setFlipsidePicFileName()) ); + connect( pushButton_openLogDir, SIGNAL( clicked() ), this, SLOT( setLogDir()) ); + connect( pushButton_HumanPlayerAvatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile0()) ); + connect( pushButton_Opponent1Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile1()) ); + connect( pushButton_Opponent2Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile2()) ); + connect( pushButton_Opponent3Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile3()) ); + connect( pushButton_Opponent4Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile4()) ); + connect( pushButton_Opponent5Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile5()) ); + connect( pushButton_Opponent6Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile6()) ); + connect( pushButton_Opponent7Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile7()) ); + connect( pushButton_Opponent8Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile8()) ); + connect( pushButton_Opponent9Avatar, SIGNAL( clicked() ), this, SLOT( setAvatarFile9()) ); + connect( pushButton_editManualBlindsOrder, SIGNAL( clicked() ), this, SLOT( callManualBlindsOrderDialog()) ); + connect( pushButton_netEditManualBlindsOrder, SIGNAL( clicked() ), this, SLOT( callNetManualBlindsOrderDialog()) ); - connect( checkBox_UseInternetGamePassword, SIGNAL( toggled(bool) ), this, SLOT( clearInternetGamePassword(bool)) ); + connect( checkBox_UseInternetGamePassword, SIGNAL( toggled(bool) ), this, SLOT( clearInternetGamePassword(bool)) ); -// connect( spinBox_netFirstSmallBlind, SIGNAL( valueChanged(int) ), this, SLOT ( checkProperNetFirstSmallBlind(int))); -// connect( spinBox_firstSmallBlind, SIGNAL( valueChanged(int) ), this, SLOT ( checkProperFirstSmallBlind(int))); + // connect( spinBox_netFirstSmallBlind, SIGNAL( valueChanged(int) ), this, SLOT ( checkProperNetFirstSmallBlind(int))); + // connect( spinBox_firstSmallBlind, SIGNAL( valueChanged(int) ), this, SLOT ( checkProperFirstSmallBlind(int))); - connect( radioButton_netManualBlindsOrder, SIGNAL( toggled(bool) ), this, SLOT( setFirstSmallBlindMargin() )); - connect( radioButton_manualBlindsOrder, SIGNAL( toggled(bool) ), this, SLOT( setFirstSmallBlindMargin() )); + connect( radioButton_netManualBlindsOrder, SIGNAL( toggled(bool) ), this, SLOT( setFirstSmallBlindMargin() )); + connect( radioButton_manualBlindsOrder, SIGNAL( toggled(bool) ), this, SLOT( setFirstSmallBlindMargin() )); - connect( comboBox_switchLanguage, SIGNAL( currentIndexChanged (int) ), this, SLOT ( setLanguageChanged(int) )); + connect( comboBox_switchLanguage, SIGNAL( currentIndexChanged (int) ), this, SLOT ( setLanguageChanged(int) )); - connect(groupBox_automaticServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxAutomaticServerConfig(bool))); - connect(groupBox_manualServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxManualServerConfig(bool))); + connect(groupBox_automaticServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxAutomaticServerConfig(bool))); + connect(groupBox_manualServerConfig, SIGNAL(toggled(bool)), this, SLOT(toggleGroupBoxManualServerConfig(bool))); - connect( listWidget_gameTableStyles, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*) ), this, SLOT ( showCurrentGameTableStylePreview() )); - connect( pushButton_addGameTableStyle, SIGNAL( clicked() ), this, SLOT( addGameTableStyle()) ); - connect( pushButton_removeGameTableStyle, SIGNAL( clicked() ), this, SLOT( removeGameTableStyle()) ); + connect( listWidget_gameTableStyles, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*) ), this, SLOT ( showCurrentGameTableStylePreview() )); + connect( pushButton_addGameTableStyle, SIGNAL( clicked() ), this, SLOT( addGameTableStyle()) ); + connect( pushButton_removeGameTableStyle, SIGNAL( clicked() ), this, SLOT( removeGameTableStyle()) ); - connect( listWidget_cardDeckStyles, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*) ), this, SLOT ( showCurrentCardDeckStylePreview() )); - connect( pushButton_addCardDeckStyle, SIGNAL( clicked() ), this, SLOT( addCardDeckStyle()) ); - connect( pushButton_removeCardDeckStyle, SIGNAL( clicked() ), this, SLOT( removeCardDeckStyle()) ); + connect( listWidget_cardDeckStyles, SIGNAL( currentItemChanged(QListWidgetItem*, QListWidgetItem*) ), this, SLOT ( showCurrentCardDeckStylePreview() )); + connect( pushButton_addCardDeckStyle, SIGNAL( clicked() ), this, SLOT( addCardDeckStyle()) ); + connect( pushButton_removeCardDeckStyle, SIGNAL( clicked() ), this, SLOT( removeCardDeckStyle()) ); } void settingsDialogImpl::exec() { - playerNickIsChanged = FALSE; - - //Player Nicks - lineEdit_HumanPlayerName->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str())); - pushButton_HumanPlayerAvatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("MyAvatar").c_str())); - lineEdit_Opponent1Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent1Name").c_str())); - pushButton_Opponent1Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent1Avatar").c_str())); - lineEdit_Opponent2Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent2Name").c_str())); - pushButton_Opponent2Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent2Avatar").c_str())); - lineEdit_Opponent3Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent3Name").c_str())); - pushButton_Opponent3Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent3Avatar").c_str())); - lineEdit_Opponent4Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent4Name").c_str())); - pushButton_Opponent4Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent4Avatar").c_str())); - lineEdit_Opponent5Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent5Name").c_str())); - pushButton_Opponent5Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent5Avatar").c_str())); - lineEdit_Opponent6Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent6Name").c_str())); - pushButton_Opponent6Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent6Avatar").c_str())); - lineEdit_Opponent7Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent7Name").c_str())); - pushButton_Opponent7Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent7Avatar").c_str())); - lineEdit_Opponent8Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent8Name").c_str())); - pushButton_Opponent8Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent8Avatar").c_str())); - lineEdit_Opponent9Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent9Name").c_str())); - pushButton_Opponent9Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent9Avatar").c_str())); + playerNickIsChanged = FALSE; - //refresh AvatarIcons - pushButton_HumanPlayerAvatar->setIcon(QIcon(pushButton_HumanPlayerAvatar->getMyLink())); - pushButton_Opponent1Avatar->setIcon(QIcon(pushButton_Opponent1Avatar->getMyLink())); - pushButton_Opponent2Avatar->setIcon(QIcon(pushButton_Opponent2Avatar->getMyLink())); - pushButton_Opponent3Avatar->setIcon(QIcon(pushButton_Opponent3Avatar->getMyLink())); - pushButton_Opponent4Avatar->setIcon(QIcon(pushButton_Opponent4Avatar->getMyLink())); - pushButton_Opponent5Avatar->setIcon(QIcon(pushButton_Opponent5Avatar->getMyLink())); - pushButton_Opponent6Avatar->setIcon(QIcon(pushButton_Opponent6Avatar->getMyLink())); - pushButton_Opponent7Avatar->setIcon(QIcon(pushButton_Opponent7Avatar->getMyLink())); - pushButton_Opponent8Avatar->setIcon(QIcon(pushButton_Opponent8Avatar->getMyLink())); - pushButton_Opponent9Avatar->setIcon(QIcon(pushButton_Opponent9Avatar->getMyLink())); + //Player Nicks + lineEdit_HumanPlayerName->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str())); + pushButton_HumanPlayerAvatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("MyAvatar").c_str())); + lineEdit_Opponent1Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent1Name").c_str())); + pushButton_Opponent1Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent1Avatar").c_str())); + lineEdit_Opponent2Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent2Name").c_str())); + pushButton_Opponent2Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent2Avatar").c_str())); + lineEdit_Opponent3Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent3Name").c_str())); + pushButton_Opponent3Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent3Avatar").c_str())); + lineEdit_Opponent4Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent4Name").c_str())); + pushButton_Opponent4Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent4Avatar").c_str())); + lineEdit_Opponent5Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent5Name").c_str())); + pushButton_Opponent5Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent5Avatar").c_str())); + lineEdit_Opponent6Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent6Name").c_str())); + pushButton_Opponent6Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent6Avatar").c_str())); + lineEdit_Opponent7Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent7Name").c_str())); + pushButton_Opponent7Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent7Avatar").c_str())); + lineEdit_Opponent8Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent8Name").c_str())); + pushButton_Opponent8Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent8Avatar").c_str())); + lineEdit_Opponent9Name->setText(QString::fromUtf8(myConfig->readConfigString("Opponent9Name").c_str())); + pushButton_Opponent9Avatar->setMyLink(QString::fromUtf8(myConfig->readConfigString("Opponent9Avatar").c_str())); - //Local Game Settings - spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NumberOfPlayers")); - spinBox_startCash->setValue(myConfig->readConfigInt("StartCash")); - spinBox_firstSmallBlind->setValue(myConfig->readConfigInt("FirstSmallBlind")); - radioButton_raiseBlindsAtHands->setChecked(myConfig->readConfigInt("RaiseBlindsAtHands")); - radioButton_raiseBlindsAtMinutes->setChecked(myConfig->readConfigInt("RaiseBlindsAtMinutes")); - spinBox_raiseSmallBlindEveryHands->setValue(myConfig->readConfigInt("RaiseSmallBlindEveryHands")); - spinBox_raiseSmallBlindEveryMinutes->setValue(myConfig->readConfigInt("RaiseSmallBlindEveryMinutes")); - radioButton_alwaysDoubleBlinds->setChecked(myConfig->readConfigInt("AlwaysDoubleBlinds")); - radioButton_manualBlindsOrder->setChecked(myConfig->readConfigInt("ManualBlindsOrder")); - spinBox_gameSpeed->setValue(myConfig->readConfigInt("GameSpeed")); - checkBox_pauseBetweenHands->setChecked(myConfig->readConfigInt("PauseBetweenHands")); - checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")); - - //Network Game Settings - spinBox_netQuantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers")); - spinBox_netStartCash->setValue(myConfig->readConfigInt("NetStartCash")); - spinBox_netFirstSmallBlind->setValue(myConfig->readConfigInt("NetFirstSmallBlind")); - radioButton_netRaiseBlindsAtHands->setChecked(myConfig->readConfigInt("NetRaiseBlindsAtHands")); - radioButton_netRaiseBlindsAtMinutes->setChecked(myConfig->readConfigInt("NetRaiseBlindsAtMinutes")); - spinBox_netRaiseSmallBlindEveryHands->setValue(myConfig->readConfigInt("NetRaiseSmallBlindEveryHands")); - spinBox_netRaiseSmallBlindEveryMinutes->setValue(myConfig->readConfigInt("NetRaiseSmallBlindEveryMinutes")); - radioButton_netAlwaysDoubleBlinds->setChecked(myConfig->readConfigInt("NetAlwaysDoubleBlinds")); - radioButton_netManualBlindsOrder->setChecked(myConfig->readConfigInt("NetManualBlindsOrder")); - spinBox_netDelayBetweenHands->setValue(myConfig->readConfigInt("NetDelayBetweenHands")); - spinBox_netTimeOutPlayerAction->setValue(myConfig->readConfigInt("NetTimeOutPlayerAction")); - spinBox_serverPort->setValue(myConfig->readConfigInt("ServerPort")); - checkBox_useIpv6->setChecked(myConfig->readConfigInt("ServerUseIpv6")); - checkBox_useSctp->setChecked(myConfig->readConfigInt("ServerUseSctp")); + //refresh AvatarIcons + pushButton_HumanPlayerAvatar->setIcon(QIcon(pushButton_HumanPlayerAvatar->getMyLink())); + pushButton_Opponent1Avatar->setIcon(QIcon(pushButton_Opponent1Avatar->getMyLink())); + pushButton_Opponent2Avatar->setIcon(QIcon(pushButton_Opponent2Avatar->getMyLink())); + pushButton_Opponent3Avatar->setIcon(QIcon(pushButton_Opponent3Avatar->getMyLink())); + pushButton_Opponent4Avatar->setIcon(QIcon(pushButton_Opponent4Avatar->getMyLink())); + pushButton_Opponent5Avatar->setIcon(QIcon(pushButton_Opponent5Avatar->getMyLink())); + pushButton_Opponent6Avatar->setIcon(QIcon(pushButton_Opponent6Avatar->getMyLink())); + pushButton_Opponent7Avatar->setIcon(QIcon(pushButton_Opponent7Avatar->getMyLink())); + pushButton_Opponent8Avatar->setIcon(QIcon(pushButton_Opponent8Avatar->getMyLink())); + pushButton_Opponent9Avatar->setIcon(QIcon(pushButton_Opponent9Avatar->getMyLink())); - //Internet Game Settings - if(myConfig->readConfigInt("InternetServerConfigMode")) { groupBox_manualServerConfig->setChecked(TRUE); } - else { groupBox_automaticServerConfig->setChecked(TRUE); } - lineEdit_InternetServerListAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerListAddress").c_str())); - lineEdit_InternetServerAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerAddress").c_str())); - spinBox_InternetServerPort->setValue(myConfig->readConfigInt("InternetServerPort")); - checkBox_InternetServerUseIpv6->setChecked(myConfig->readConfigInt("InternetServerUseIpv6")); - checkBox_InternetServerUseSctp->setChecked(myConfig->readConfigInt("InternetServerUseSctp")); - if(myConfig->readConfigInt("UseAvatarServer")) { - lineEdit_avatarServerAddress->setText(QString::fromUtf8(myConfig->readConfigString("AvatarServerAddress").c_str())); - checkBox_useAvatarServer->setCheckState(Qt::Checked); - lineEdit_avatarServerAddress->setEnabled(TRUE); - } - else { - checkBox_useAvatarServer->setCheckState(Qt::Unchecked); - lineEdit_avatarServerAddress->setEnabled(FALSE); - } - checkBox_UseInternetGamePassword->setChecked(myConfig->readConfigInt("UseInternetGamePassword")); - if(myConfig->readConfigInt("UseInternetGamePassword")) { - lineEdit_InternetGamePassword->setText(QString::fromUtf8(myConfig->readConfigString("InternetGamePassword").c_str())); - } - checkBox_UseLobbyChat->setChecked(myConfig->readConfigInt("UseLobbyChat")); - comboBox_internetGameType->setCurrentIndex(myConfig->readConfigInt("InternetGameType")); - lineEdit_internetGameName->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str())); + //Local Game Settings + spinBox_quantityPlayers->setValue(myConfig->readConfigInt("NumberOfPlayers")); + spinBox_startCash->setValue(myConfig->readConfigInt("StartCash")); + spinBox_firstSmallBlind->setValue(myConfig->readConfigInt("FirstSmallBlind")); + radioButton_raiseBlindsAtHands->setChecked(myConfig->readConfigInt("RaiseBlindsAtHands")); + radioButton_raiseBlindsAtMinutes->setChecked(myConfig->readConfigInt("RaiseBlindsAtMinutes")); + spinBox_raiseSmallBlindEveryHands->setValue(myConfig->readConfigInt("RaiseSmallBlindEveryHands")); + spinBox_raiseSmallBlindEveryMinutes->setValue(myConfig->readConfigInt("RaiseSmallBlindEveryMinutes")); + radioButton_alwaysDoubleBlinds->setChecked(myConfig->readConfigInt("AlwaysDoubleBlinds")); + radioButton_manualBlindsOrder->setChecked(myConfig->readConfigInt("ManualBlindsOrder")); + spinBox_gameSpeed->setValue(myConfig->readConfigInt("GameSpeed")); + checkBox_pauseBetweenHands->setChecked(myConfig->readConfigInt("PauseBetweenHands")); + checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")); - //Interface - comboBox_switchLanguage->setCurrentIndex(comboBox_switchLanguage->findData(QString::fromUtf8(myConfig->readConfigString("Language").c_str()).section('_', 0, 0))); - checkBox_showLeftToolbox->setChecked(myConfig->readConfigInt("ShowLeftToolBox")); - checkBox_showRightToolbox->setChecked(myConfig->readConfigInt("ShowRightToolBox")); - checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation")); - checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation")); - checkBox_showBlindButtons->setChecked(myConfig->readConfigInt("ShowBlindButtons")); - checkBox_antiPeekMode->setChecked(myConfig->readConfigInt("AntiPeekMode")); - checkBox_alternateFKeysUserActionMode->setChecked(myConfig->readConfigInt("AlternateFKeysUserActionMode")); - checkBox_enableBetInputFocusSwitch->setChecked(myConfig->readConfigInt("EnableBetInputFocusSwitch")); - checkBox_cardsChanceMonitor->setChecked(myConfig->readConfigInt("ShowCardsChanceMonitor")); - checkBox_dontTranslatePokerStrings->setChecked(myConfig->readConfigInt("DontTranslateInternationalPokerStringsFromStyle")); - checkBox_disableSplashscreen->setChecked(myConfig->readConfigInt("DisableSplashScreenOnStartup")); + //Network Game Settings + spinBox_netQuantityPlayers->setValue(myConfig->readConfigInt("NetNumberOfPlayers")); + spinBox_netStartCash->setValue(myConfig->readConfigInt("NetStartCash")); + spinBox_netFirstSmallBlind->setValue(myConfig->readConfigInt("NetFirstSmallBlind")); + radioButton_netRaiseBlindsAtHands->setChecked(myConfig->readConfigInt("NetRaiseBlindsAtHands")); + radioButton_netRaiseBlindsAtMinutes->setChecked(myConfig->readConfigInt("NetRaiseBlindsAtMinutes")); + spinBox_netRaiseSmallBlindEveryHands->setValue(myConfig->readConfigInt("NetRaiseSmallBlindEveryHands")); + spinBox_netRaiseSmallBlindEveryMinutes->setValue(myConfig->readConfigInt("NetRaiseSmallBlindEveryMinutes")); + radioButton_netAlwaysDoubleBlinds->setChecked(myConfig->readConfigInt("NetAlwaysDoubleBlinds")); + radioButton_netManualBlindsOrder->setChecked(myConfig->readConfigInt("NetManualBlindsOrder")); + spinBox_netDelayBetweenHands->setValue(myConfig->readConfigInt("NetDelayBetweenHands")); + spinBox_netTimeOutPlayerAction->setValue(myConfig->readConfigInt("NetTimeOutPlayerAction")); + spinBox_serverPort->setValue(myConfig->readConfigInt("ServerPort")); + checkBox_useIpv6->setChecked(myConfig->readConfigInt("ServerUseIpv6")); + checkBox_useSctp->setChecked(myConfig->readConfigInt("ServerUseSctp")); - //S t y l e - //TABLE -// define PokerTH default GameTableStyle - listWidget_gameTableStyles->clear(); + //Internet Game Settings + if(myConfig->readConfigInt("InternetServerConfigMode")) { groupBox_manualServerConfig->setChecked(TRUE); } + else { groupBox_automaticServerConfig->setChecked(TRUE); } + lineEdit_InternetServerListAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerListAddress").c_str())); + lineEdit_InternetServerAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerAddress").c_str())); + spinBox_InternetServerPort->setValue(myConfig->readConfigInt("InternetServerPort")); + checkBox_InternetServerUseIpv6->setChecked(myConfig->readConfigInt("InternetServerUseIpv6")); + checkBox_InternetServerUseSctp->setChecked(myConfig->readConfigInt("InternetServerUseSctp")); + if(myConfig->readConfigInt("UseAvatarServer")) { + lineEdit_avatarServerAddress->setText(QString::fromUtf8(myConfig->readConfigString("AvatarServerAddress").c_str())); + checkBox_useAvatarServer->setCheckState(Qt::Checked); + lineEdit_avatarServerAddress->setEnabled(TRUE); + } + else { + checkBox_useAvatarServer->setCheckState(Qt::Unchecked); + lineEdit_avatarServerAddress->setEnabled(FALSE); + } + checkBox_UseInternetGamePassword->setChecked(myConfig->readConfigInt("UseInternetGamePassword")); + if(myConfig->readConfigInt("UseInternetGamePassword")) { + lineEdit_InternetGamePassword->setText(QString::fromUtf8(myConfig->readConfigString("InternetGamePassword").c_str())); + } + checkBox_UseLobbyChat->setChecked(myConfig->readConfigInt("UseLobbyChat")); + comboBox_internetGameType->setCurrentIndex(myConfig->readConfigInt("InternetGameType")); + lineEdit_internetGameName->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str())); - GameTableStyleReader defaultTableStyle(myConfig, this); - defaultTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); - if(defaultTableStyle.getLoadedSuccessfull()) { - MyStyleListItem *defaultTableItem = new MyStyleListItem(defaultTableStyle.getStyleDescription(),listWidget_gameTableStyles); - defaultTableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); - defaultTableItem->setData(16, POKERTH_DISTRIBUTED_STYLE); - defaultTableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); - } - //add danuxi table - GameTableStyleReader danuxi1TableStyle(myConfig, this); - danuxi1TableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); - if(danuxi1TableStyle.getLoadedSuccessfull()) { - MyStyleListItem *danuxi1TableItem = new MyStyleListItem(danuxi1TableStyle.getStyleDescription(),listWidget_gameTableStyles); - danuxi1TableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); - danuxi1TableItem->setData(16, POKERTH_DISTRIBUTED_STYLE); - danuxi1TableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); - } - - //load secondary styles into list (if fallback no entry) - myGameTableStylesList = myConfig->readConfigStringList("GameTableStylesList"); - list::iterator it1; - for(it1= myGameTableStylesList.begin(); it1 != myGameTableStylesList.end(); it1++) { - GameTableStyleReader nextStyle(myConfig, this); - nextStyle.readStyleFile(QString::fromUtf8(it1->c_str())); - if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) { - MyStyleListItem *nextItem = new MyStyleListItem(nextStyle.getStyleDescription()); - nextItem->setData(15,QString::fromUtf8(it1->c_str())); - nextItem->setData(16, ADDITIONAL_STYLE); - nextItem->setData(Qt::ToolTipRole,QString::fromUtf8(it1->c_str())); - listWidget_gameTableStyles->addItem(nextItem); - } - } - listWidget_gameTableStyles->sortItems(Qt::AscendingOrder); - - //set current Game Table Style from config file or fallback to first entry - GameTableStyleReader currentGameTableStyle(myConfig, this); - currentGameTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentGameTableStyle").c_str())); - if(currentGameTableStyle.getLoadedSuccessfull()) { - int i; - bool currentGameTableFound(FALSE); - for(i=0; i < listWidget_gameTableStyles->count(); i++) { - QListWidgetItem *item = listWidget_gameTableStyles->item(i); - if(item->data(15) == currentGameTableStyle.getCurrentFileName()) { - item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - listWidget_gameTableStyles->setCurrentItem(item); - currentGameTableFound=TRUE; - } - else item->setIcon(QIcon()); - } - if(!currentGameTableFound) { - qDebug() << "Config ERROR: current game table style file not found in List. Try to mark default as selected."; - QListWidgetItem *item = listWidget_gameTableStyles->item(0); - if(item) { - item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - listWidget_gameTableStyles->setCurrentItem(item); - } - } - } - else { - qDebug() << "Config ERROR: current game table style file could not be loaded. Try to mark default as selected."; - QListWidgetItem *item = listWidget_gameTableStyles->item(0); - if(item) { - item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - listWidget_gameTableStyles->setCurrentItem(item); - } + std::list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); + std::list::iterator it5; + for(it5= playerIgnoreList.begin(); it5 != playerIgnoreList.end(); it5++) { + QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget_internetGameIgnoredPlayers); + item->setText(0, QString::fromUtf8(it5->c_str()).split(",").at(1) ); + item->setData(0, Qt::UserRole, QString::fromUtf8(it5->c_str()).split(",").at(0) ); + } + + //Interface + comboBox_switchLanguage->setCurrentIndex(comboBox_switchLanguage->findData(QString::fromUtf8(myConfig->readConfigString("Language").c_str()).section('_', 0, 0))); + checkBox_showLeftToolbox->setChecked(myConfig->readConfigInt("ShowLeftToolBox")); + checkBox_showRightToolbox->setChecked(myConfig->readConfigInt("ShowRightToolBox")); + checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation")); + checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation")); + checkBox_showBlindButtons->setChecked(myConfig->readConfigInt("ShowBlindButtons")); + checkBox_antiPeekMode->setChecked(myConfig->readConfigInt("AntiPeekMode")); + checkBox_alternateFKeysUserActionMode->setChecked(myConfig->readConfigInt("AlternateFKeysUserActionMode")); + checkBox_enableBetInputFocusSwitch->setChecked(myConfig->readConfigInt("EnableBetInputFocusSwitch")); + checkBox_cardsChanceMonitor->setChecked(myConfig->readConfigInt("ShowCardsChanceMonitor")); + checkBox_dontTranslatePokerStrings->setChecked(myConfig->readConfigInt("DontTranslateInternationalPokerStringsFromStyle")); + checkBox_disableSplashscreen->setChecked(myConfig->readConfigInt("DisableSplashScreenOnStartup")); + + //S t y l e + //TABLE + // define PokerTH default GameTableStyle + listWidget_gameTableStyles->clear(); + + GameTableStyleReader defaultTableStyle(myConfig, this); + defaultTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); + if(defaultTableStyle.getLoadedSuccessfull()) { + MyStyleListItem *defaultTableItem = new MyStyleListItem(defaultTableStyle.getStyleDescription(),listWidget_gameTableStyles); + defaultTableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); + defaultTableItem->setData(16, POKERTH_DISTRIBUTED_STYLE); + defaultTableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default/defaulttablestyle.xml"); + } + //add danuxi table + GameTableStyleReader danuxi1TableStyle(myConfig, this); + danuxi1TableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); + if(danuxi1TableStyle.getLoadedSuccessfull()) { + MyStyleListItem *danuxi1TableItem = new MyStyleListItem(danuxi1TableStyle.getStyleDescription(),listWidget_gameTableStyles); + danuxi1TableItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); + danuxi1TableItem->setData(16, POKERTH_DISTRIBUTED_STYLE); + danuxi1TableItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/danuxi1/danuxi1tablestyle.xml"); + } + + //load secondary styles into list (if fallback no entry) + myGameTableStylesList = myConfig->readConfigStringList("GameTableStylesList"); + list::iterator it1; + for(it1= myGameTableStylesList.begin(); it1 != myGameTableStylesList.end(); it1++) { + GameTableStyleReader nextStyle(myConfig, this); + nextStyle.readStyleFile(QString::fromUtf8(it1->c_str())); + if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) { + MyStyleListItem *nextItem = new MyStyleListItem(nextStyle.getStyleDescription()); + nextItem->setData(15,QString::fromUtf8(it1->c_str())); + nextItem->setData(16, ADDITIONAL_STYLE); + nextItem->setData(Qt::ToolTipRole,QString::fromUtf8(it1->c_str())); + listWidget_gameTableStyles->addItem(nextItem); } + } + listWidget_gameTableStyles->sortItems(Qt::AscendingOrder); - //refresh Game Table Style Preview - showCurrentGameTableStylePreview(); - - //CARDS - //define PokerTH default CardDeck - listWidget_cardDeckStyles->clear(); - CardDeckStyleReader defaultCardStyle(myConfig, this); - defaultCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); - if(defaultCardStyle.getLoadedSuccessfull()) { - MyStyleListItem *defaultCardItem = new MyStyleListItem(defaultCardStyle.getStyleDescription(),listWidget_cardDeckStyles); - defaultCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); - defaultCardItem->setData(16, POKERTH_DISTRIBUTED_STYLE); - defaultCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); - } - //define PokerTH default CardDeck4c - CardDeckStyleReader default4cCardStyle(myConfig, this); - default4cCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); - if(default4cCardStyle.getLoadedSuccessfull()) { - MyStyleListItem *default4cCardItem = new MyStyleListItem(default4cCardStyle.getStyleDescription(),listWidget_cardDeckStyles); - default4cCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); - default4cCardItem->setData(16, POKERTH_DISTRIBUTED_STYLE); - default4cCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); - } - - //load secondary card styles into list (if fallback no entry) - myCardDeckStylesList = myConfig->readConfigStringList("CardDeckStylesList"); - list::iterator it2; - for(it2= myCardDeckStylesList.begin(); it2 != myCardDeckStylesList.end(); it2++) { - CardDeckStyleReader nextStyle(myConfig, this); - nextStyle.readStyleFile(QString::fromUtf8(it2->c_str())); - if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) { - MyStyleListItem *nextItem = new MyStyleListItem(nextStyle.getStyleDescription()); - nextItem->setData(15,QString::fromUtf8(it2->c_str())); - nextItem->setData(16, ADDITIONAL_STYLE); - nextItem->setData(Qt::ToolTipRole,QString::fromUtf8(it2->c_str())); - listWidget_cardDeckStyles->addItem(nextItem); - } - } - listWidget_cardDeckStyles->sortItems(Qt::AscendingOrder); - - //set current card deck style from config file - CardDeckStyleReader currentCardDeckStyle(myConfig, this); - currentCardDeckStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentCardDeckStyle").c_str())); - if(currentCardDeckStyle.getLoadedSuccessfull()) { - int j; - bool currentCardDeckFound(FALSE); - for(j=0; j < listWidget_cardDeckStyles->count(); j++) { - QListWidgetItem *item = listWidget_cardDeckStyles->item(j); - if(item->data(15) == currentCardDeckStyle.getCurrentFileName()) { - item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - listWidget_cardDeckStyles->setCurrentItem(item); - currentCardDeckFound=TRUE; - } - else item->setIcon(QIcon()); + //set current Game Table Style from config file or fallback to first entry + GameTableStyleReader currentGameTableStyle(myConfig, this); + currentGameTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentGameTableStyle").c_str())); + if(currentGameTableStyle.getLoadedSuccessfull()) { + int i; + bool currentGameTableFound(FALSE); + for(i=0; i < listWidget_gameTableStyles->count(); i++) { + QListWidgetItem *item = listWidget_gameTableStyles->item(i); + if(item->data(15) == currentGameTableStyle.getCurrentFileName()) { + item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + listWidget_gameTableStyles->setCurrentItem(item); + currentGameTableFound=TRUE; } - if(!currentCardDeckFound) { - qDebug() << "Config ERROR: current card deck style file not found in List. Try to mark default as selected."; - QListWidgetItem *item = listWidget_cardDeckStyles->item(0); - if(item) { - item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - listWidget_cardDeckStyles->setCurrentItem(item); - } + else item->setIcon(QIcon()); + } + if(!currentGameTableFound) { + qDebug() << "Config ERROR: current game table style file not found in List. Try to mark default as selected."; + QListWidgetItem *item = listWidget_gameTableStyles->item(0); + if(item) { + item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + listWidget_gameTableStyles->setCurrentItem(item); } } - else { - qDebug() << "Config ERROR: current card deck style file could not be loaded. Try to mark default as selected."; + } + else { + qDebug() << "Config ERROR: current game table style file could not be loaded. Try to mark default as selected."; + QListWidgetItem *item = listWidget_gameTableStyles->item(0); + if(item) { + item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + listWidget_gameTableStyles->setCurrentItem(item); + } + } + + //refresh Game Table Style Preview + showCurrentGameTableStylePreview(); + + //CARDS + //define PokerTH default CardDeck + listWidget_cardDeckStyles->clear(); + CardDeckStyleReader defaultCardStyle(myConfig, this); + defaultCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); + if(defaultCardStyle.getLoadedSuccessfull()) { + MyStyleListItem *defaultCardItem = new MyStyleListItem(defaultCardStyle.getStyleDescription(),listWidget_cardDeckStyles); + defaultCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); + defaultCardItem->setData(16, POKERTH_DISTRIBUTED_STYLE); + defaultCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); + } + //define PokerTH default CardDeck4c + CardDeckStyleReader default4cCardStyle(myConfig, this); + default4cCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); + if(default4cCardStyle.getLoadedSuccessfull()) { + MyStyleListItem *default4cCardItem = new MyStyleListItem(default4cCardStyle.getStyleDescription(),listWidget_cardDeckStyles); + default4cCardItem->setData(15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); + default4cCardItem->setData(16, POKERTH_DISTRIBUTED_STYLE); + default4cCardItem->setData(Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); + } + + //load secondary card styles into list (if fallback no entry) + myCardDeckStylesList = myConfig->readConfigStringList("CardDeckStylesList"); + list::iterator it2; + for(it2= myCardDeckStylesList.begin(); it2 != myCardDeckStylesList.end(); it2++) { + CardDeckStyleReader nextStyle(myConfig, this); + nextStyle.readStyleFile(QString::fromUtf8(it2->c_str())); + if(!nextStyle.getFallBack() && nextStyle.getLoadedSuccessfull()) { + MyStyleListItem *nextItem = new MyStyleListItem(nextStyle.getStyleDescription()); + nextItem->setData(15,QString::fromUtf8(it2->c_str())); + nextItem->setData(16, ADDITIONAL_STYLE); + nextItem->setData(Qt::ToolTipRole,QString::fromUtf8(it2->c_str())); + listWidget_cardDeckStyles->addItem(nextItem); + } + } + listWidget_cardDeckStyles->sortItems(Qt::AscendingOrder); + + //set current card deck style from config file + CardDeckStyleReader currentCardDeckStyle(myConfig, this); + currentCardDeckStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentCardDeckStyle").c_str())); + if(currentCardDeckStyle.getLoadedSuccessfull()) { + int j; + bool currentCardDeckFound(FALSE); + for(j=0; j < listWidget_cardDeckStyles->count(); j++) { + QListWidgetItem *item = listWidget_cardDeckStyles->item(j); + if(item->data(15) == currentCardDeckStyle.getCurrentFileName()) { + item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + listWidget_cardDeckStyles->setCurrentItem(item); + currentCardDeckFound=TRUE; + } + else item->setIcon(QIcon()); + } + if(!currentCardDeckFound) { + qDebug() << "Config ERROR: current card deck style file not found in List. Try to mark default as selected."; QListWidgetItem *item = listWidget_cardDeckStyles->item(0); if(item) { item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); listWidget_cardDeckStyles->setCurrentItem(item); } } + } + else { + qDebug() << "Config ERROR: current card deck style file could not be loaded. Try to mark default as selected."; + QListWidgetItem *item = listWidget_cardDeckStyles->item(0); + if(item) { + item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + listWidget_cardDeckStyles->setCurrentItem(item); + } + } -// refresh Card Deck Style Preview - showCurrentCardDeckStylePreview(); + // refresh Card Deck Style Preview + showCurrentCardDeckStylePreview(); - radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux")); - radioButton_flipsideOwn->setChecked(myConfig->readConfigInt("FlipsideOwn")); - if(radioButton_flipsideOwn->isChecked()) { - lineEdit_OwnFlipsideFilename->setEnabled(TRUE); - pushButton_openFlipsidePicture->setEnabled(TRUE); - } - lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str())); + radioButton_flipsideTux->setChecked(myConfig->readConfigInt("FlipsideTux")); + radioButton_flipsideOwn->setChecked(myConfig->readConfigInt("FlipsideOwn")); + if(radioButton_flipsideOwn->isChecked()) { + lineEdit_OwnFlipsideFilename->setEnabled(TRUE); + pushButton_openFlipsidePicture->setEnabled(TRUE); + } + lineEdit_OwnFlipsideFilename->setText(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str())); - //Sound - groupBox_playSoundEffects->setChecked(myConfig->readConfigInt("PlaySoundEffects")); - horizontalSlider_soundVolume->setValue(myConfig->readConfigInt("SoundVolume")); - checkBox_playGameActions->setChecked(myConfig->readConfigInt("PlayGameActions")); - checkBox_playLobbyChatNotification->setChecked(myConfig->readConfigInt("PlayLobbyChatNotification")); - checkBox_playNetworkGameNotification->setChecked(myConfig->readConfigInt("PlayNetworkGameNotification")); + //Sound + groupBox_playSoundEffects->setChecked(myConfig->readConfigInt("PlaySoundEffects")); + horizontalSlider_soundVolume->setValue(myConfig->readConfigInt("SoundVolume")); + checkBox_playGameActions->setChecked(myConfig->readConfigInt("PlayGameActions")); + checkBox_playLobbyChatNotification->setChecked(myConfig->readConfigInt("PlayLobbyChatNotification")); + checkBox_playNetworkGameNotification->setChecked(myConfig->readConfigInt("PlayNetworkGameNotification")); - //Log - groupBox_logOnOff->setChecked(myConfig->readConfigInt("LogOnOff")); - lineEdit_logDir->setText(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())); - spinBox_logStoreDuration->setValue(myConfig->readConfigInt("LogStoreDuration")); - comboBox_logInterval->setCurrentIndex(myConfig->readConfigInt("LogInterval")); + //Log + groupBox_logOnOff->setChecked(myConfig->readConfigInt("LogOnOff")); + lineEdit_logDir->setText(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str())); + spinBox_logStoreDuration->setValue(myConfig->readConfigInt("LogStoreDuration")); + comboBox_logInterval->setCurrentIndex(myConfig->readConfigInt("LogInterval")); - bool tmpHasIpv6 = socket_has_ipv6(); - bool tmpHasSctp = socket_has_sctp(); - checkBox_useIpv6->setEnabled(tmpHasIpv6); - checkBox_useSctp->setEnabled(tmpHasSctp); - checkBox_InternetServerUseIpv6->setEnabled(tmpHasIpv6); - checkBox_InternetServerUseSctp->setEnabled(tmpHasSctp); + bool tmpHasIpv6 = socket_has_ipv6(); + bool tmpHasSctp = socket_has_sctp(); + checkBox_useIpv6->setEnabled(tmpHasIpv6); + checkBox_useSctp->setEnabled(tmpHasSctp); + checkBox_InternetServerUseIpv6->setEnabled(tmpHasIpv6); + checkBox_InternetServerUseSctp->setEnabled(tmpHasSctp); - //Manual Blinds Order Dialog (local) - myManualBlindsList = myConfig->readConfigIntList("ManualBlindsList"); - myAfterMBAlwaysDoubleBlinds = myConfig->readConfigInt("AfterMBAlwaysDoubleBlinds"); - myAfterMBAlwaysRaiseAbout = myConfig->readConfigInt("AfterMBAlwaysRaiseAbout"); - myAfterMBAlwaysRaiseValue = myConfig->readConfigInt("AfterMBAlwaysRaiseValue"); - myAfterMBStayAtLastBlind = myConfig->readConfigInt("AfterMBStayAtLastBlind"); - - //Manual Blinds Order Dialog (network) - myNetManualBlindsList = myConfig->readConfigIntList("NetManualBlindsList"); - myNetAfterMBAlwaysDoubleBlinds = myConfig->readConfigInt("NetAfterMBAlwaysDoubleBlinds"); - myNetAfterMBAlwaysRaiseAbout = myConfig->readConfigInt("NetAfterMBAlwaysRaiseAbout"); - myNetAfterMBAlwaysRaiseValue = myConfig->readConfigInt("NetAfterMBAlwaysRaiseValue"); - myNetAfterMBStayAtLastBlind = myConfig->readConfigInt("NetAfterMBStayAtLastBlind"); + //Manual Blinds Order Dialog (local) + myManualBlindsList = myConfig->readConfigIntList("ManualBlindsList"); + myAfterMBAlwaysDoubleBlinds = myConfig->readConfigInt("AfterMBAlwaysDoubleBlinds"); + myAfterMBAlwaysRaiseAbout = myConfig->readConfigInt("AfterMBAlwaysRaiseAbout"); + myAfterMBAlwaysRaiseValue = myConfig->readConfigInt("AfterMBAlwaysRaiseValue"); + myAfterMBStayAtLastBlind = myConfig->readConfigInt("AfterMBStayAtLastBlind"); - setFirstSmallBlindMargin(); + //Manual Blinds Order Dialog (network) + myNetManualBlindsList = myConfig->readConfigIntList("NetManualBlindsList"); + myNetAfterMBAlwaysDoubleBlinds = myConfig->readConfigInt("NetAfterMBAlwaysDoubleBlinds"); + myNetAfterMBAlwaysRaiseAbout = myConfig->readConfigInt("NetAfterMBAlwaysRaiseAbout"); + myNetAfterMBAlwaysRaiseValue = myConfig->readConfigInt("NetAfterMBAlwaysRaiseValue"); + myNetAfterMBStayAtLastBlind = myConfig->readConfigInt("NetAfterMBStayAtLastBlind"); - //set this AFTER switch combobox like config-settings. This IS a currentIndexChanged() ;-) - languageIsChanged = FALSE; + setFirstSmallBlindMargin(); - QDialog::exec(); + //set this AFTER switch combobox like config-settings. This IS a currentIndexChanged() ;-) + languageIsChanged = FALSE; + + QDialog::exec(); } void settingsDialogImpl::isAccepted() { - settingsCorrect = TRUE; + settingsCorrect = TRUE; -// Player Nicks - myConfig->writeConfigString("MyName", lineEdit_HumanPlayerName->text().trimmed().toUtf8().constData()); - myConfig->writeConfigString("MyAvatar", pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData()); - - myConfig->writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent1Avatar", pushButton_Opponent1Avatar->getMyLink().toUtf8().constData()); + // Player Nicks + myConfig->writeConfigString("MyName", lineEdit_HumanPlayerName->text().trimmed().toUtf8().constData()); + myConfig->writeConfigString("MyAvatar", pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData()); - myConfig->writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent2Avatar", pushButton_Opponent2Avatar->getMyLink().toUtf8().constData()); - - myConfig->writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent3Avatar", pushButton_Opponent3Avatar->getMyLink().toUtf8().constData()); - - myConfig->writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent4Avatar", pushButton_Opponent4Avatar->getMyLink().toUtf8().constData()); - - myConfig->writeConfigString("Opponent5Name", lineEdit_Opponent5Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent5Avatar", pushButton_Opponent5Avatar->getMyLink().toUtf8().constData()); + myConfig->writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent1Avatar", pushButton_Opponent1Avatar->getMyLink().toUtf8().constData()); - myConfig->writeConfigString("Opponent6Name", lineEdit_Opponent6Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent6Avatar", pushButton_Opponent6Avatar->getMyLink().toUtf8().constData()); - - myConfig->writeConfigString("Opponent7Name", lineEdit_Opponent7Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent7Avatar", pushButton_Opponent7Avatar->getMyLink().toUtf8().constData()); + myConfig->writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent2Avatar", pushButton_Opponent2Avatar->getMyLink().toUtf8().constData()); - myConfig->writeConfigString("Opponent8Name", lineEdit_Opponent8Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent8Avatar", pushButton_Opponent8Avatar->getMyLink().toUtf8().constData()); + myConfig->writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent3Avatar", pushButton_Opponent3Avatar->getMyLink().toUtf8().constData()); - myConfig->writeConfigString("Opponent9Name", lineEdit_Opponent9Name->text().toUtf8().constData()); - myConfig->writeConfigString("Opponent9Avatar", pushButton_Opponent9Avatar->getMyLink().toUtf8().constData()); + myConfig->writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent4Avatar", pushButton_Opponent4Avatar->getMyLink().toUtf8().constData()); -// Local Game Settings - myConfig->writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value()); - myConfig->writeConfigInt("StartCash", spinBox_startCash->value()); - myConfig->writeConfigInt("FirstSmallBlind", spinBox_firstSmallBlind->value()); - myConfig->writeConfigInt("RaiseBlindsAtHands", radioButton_raiseBlindsAtHands->isChecked()); - myConfig->writeConfigInt("RaiseBlindsAtMinutes", radioButton_raiseBlindsAtMinutes->isChecked()); - myConfig->writeConfigInt("RaiseSmallBlindEveryHands", spinBox_raiseSmallBlindEveryHands->value()); - myConfig->writeConfigInt("RaiseSmallBlindEveryMinutes", spinBox_raiseSmallBlindEveryMinutes->value()); - myConfig->writeConfigInt("AlwaysDoubleBlinds", radioButton_alwaysDoubleBlinds->isChecked()); - myConfig->writeConfigInt("ManualBlindsOrder", radioButton_manualBlindsOrder->isChecked()); - myConfig->writeConfigInt("GameSpeed", spinBox_gameSpeed->value()); - myConfig->writeConfigInt("PauseBetweenHands", checkBox_pauseBetweenHands->isChecked()); - myConfig->writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked()); + myConfig->writeConfigString("Opponent5Name", lineEdit_Opponent5Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent5Avatar", pushButton_Opponent5Avatar->getMyLink().toUtf8().constData()); - //Network Game Settings - myConfig->writeConfigInt("NetNumberOfPlayers", spinBox_netQuantityPlayers->value()); - myConfig->writeConfigInt("NetStartCash", spinBox_netStartCash->value()); - myConfig->writeConfigInt("NetFirstSmallBlind", spinBox_netFirstSmallBlind->value()); - myConfig->writeConfigInt("NetRaiseBlindsAtHands", radioButton_netRaiseBlindsAtHands->isChecked()); - myConfig->writeConfigInt("NetRaiseBlindsAtMinutes", radioButton_netRaiseBlindsAtMinutes->isChecked()); - myConfig->writeConfigInt("NetRaiseSmallBlindEveryHands", spinBox_netRaiseSmallBlindEveryHands->value()); - myConfig->writeConfigInt("NetRaiseSmallBlindEveryMinutes", spinBox_netRaiseSmallBlindEveryMinutes->value()); - myConfig->writeConfigInt("NetAlwaysDoubleBlinds", radioButton_netAlwaysDoubleBlinds->isChecked()); - myConfig->writeConfigInt("NetManualBlindsOrder", radioButton_netManualBlindsOrder->isChecked()); - myConfig->writeConfigInt("NetDelayBetweenHands", spinBox_netDelayBetweenHands->value()); - myConfig->writeConfigInt("NetTimeOutPlayerAction", spinBox_netTimeOutPlayerAction->value()); - myConfig->writeConfigInt("ServerPort", spinBox_serverPort->value()); - myConfig->writeConfigInt("ServerUseIpv6", checkBox_useIpv6->isChecked()); - myConfig->writeConfigInt("ServerUseSctp", checkBox_useSctp->isChecked()); + myConfig->writeConfigString("Opponent6Name", lineEdit_Opponent6Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent6Avatar", pushButton_Opponent6Avatar->getMyLink().toUtf8().constData()); - //Internet Game Settings - if(groupBox_automaticServerConfig->isChecked()) { + myConfig->writeConfigString("Opponent7Name", lineEdit_Opponent7Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent7Avatar", pushButton_Opponent7Avatar->getMyLink().toUtf8().constData()); - myConfig->writeConfigInt("InternetServerConfigMode", 0); + myConfig->writeConfigString("Opponent8Name", lineEdit_Opponent8Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent8Avatar", pushButton_Opponent8Avatar->getMyLink().toUtf8().constData()); -// QUrl serverList; -// serverList.setUrl(lineEdit_InternetServerListAddress->text(),QUrl::StrictMode); -// QRegExp rx("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"); -// if(lineEdit_InternetServerListAddress->text().contains(rx)) { - if(lineEdit_InternetServerListAddress->text().contains("/") && lineEdit_InternetServerListAddress->text().contains(".") ) { + myConfig->writeConfigString("Opponent9Name", lineEdit_Opponent9Name->text().toUtf8().constData()); + myConfig->writeConfigString("Opponent9Avatar", pushButton_Opponent9Avatar->getMyLink().toUtf8().constData()); - myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData()); - } - else { - QMessageBox::warning(this, tr("Settings Error"), - tr("The entered server list address is not a valid URL.\n" - "Please enter a valid server list address!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } - } - if(groupBox_manualServerConfig->isChecked()) { - - myConfig->writeConfigInt("InternetServerConfigMode", 1); - myConfig->writeConfigString("InternetServerAddress", lineEdit_InternetServerAddress->text().toUtf8().constData()); - myConfig->writeConfigInt("InternetServerPort", spinBox_InternetServerPort->value()); - } - if(checkBox_useAvatarServer->isChecked()) { - myConfig->writeConfigInt("UseAvatarServer", 1); - myConfig->writeConfigString("AvatarServerAddress", lineEdit_avatarServerAddress->text().toUtf8().constData()); - } - else { - myConfig->writeConfigInt("UseAvatarServer", 0); - } + // Local Game Settings + myConfig->writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value()); + myConfig->writeConfigInt("StartCash", spinBox_startCash->value()); + myConfig->writeConfigInt("FirstSmallBlind", spinBox_firstSmallBlind->value()); + myConfig->writeConfigInt("RaiseBlindsAtHands", radioButton_raiseBlindsAtHands->isChecked()); + myConfig->writeConfigInt("RaiseBlindsAtMinutes", radioButton_raiseBlindsAtMinutes->isChecked()); + myConfig->writeConfigInt("RaiseSmallBlindEveryHands", spinBox_raiseSmallBlindEveryHands->value()); + myConfig->writeConfigInt("RaiseSmallBlindEveryMinutes", spinBox_raiseSmallBlindEveryMinutes->value()); + myConfig->writeConfigInt("AlwaysDoubleBlinds", radioButton_alwaysDoubleBlinds->isChecked()); + myConfig->writeConfigInt("ManualBlindsOrder", radioButton_manualBlindsOrder->isChecked()); + myConfig->writeConfigInt("GameSpeed", spinBox_gameSpeed->value()); + myConfig->writeConfigInt("PauseBetweenHands", checkBox_pauseBetweenHands->isChecked()); + myConfig->writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked()); - myConfig->writeConfigInt("InternetServerUseIpv6", checkBox_InternetServerUseIpv6->isChecked()); - myConfig->writeConfigInt("InternetServerUseSctp", checkBox_InternetServerUseSctp->isChecked()); - myConfig->writeConfigInt("UseInternetGamePassword", checkBox_UseInternetGamePassword->isChecked()); - myConfig->writeConfigString("InternetGamePassword", lineEdit_InternetGamePassword->text().toUtf8().constData()); - myConfig->writeConfigInt("UseLobbyChat", checkBox_UseLobbyChat->isChecked()); - myConfig->writeConfigInt("InternetGameType", comboBox_internetGameType->currentIndex()); - myConfig->writeConfigString("InternetGameName", lineEdit_internetGameName->text().toUtf8().constData()); + //Network Game Settings + myConfig->writeConfigInt("NetNumberOfPlayers", spinBox_netQuantityPlayers->value()); + myConfig->writeConfigInt("NetStartCash", spinBox_netStartCash->value()); + myConfig->writeConfigInt("NetFirstSmallBlind", spinBox_netFirstSmallBlind->value()); + myConfig->writeConfigInt("NetRaiseBlindsAtHands", radioButton_netRaiseBlindsAtHands->isChecked()); + myConfig->writeConfigInt("NetRaiseBlindsAtMinutes", radioButton_netRaiseBlindsAtMinutes->isChecked()); + myConfig->writeConfigInt("NetRaiseSmallBlindEveryHands", spinBox_netRaiseSmallBlindEveryHands->value()); + myConfig->writeConfigInt("NetRaiseSmallBlindEveryMinutes", spinBox_netRaiseSmallBlindEveryMinutes->value()); + myConfig->writeConfigInt("NetAlwaysDoubleBlinds", radioButton_netAlwaysDoubleBlinds->isChecked()); + myConfig->writeConfigInt("NetManualBlindsOrder", radioButton_netManualBlindsOrder->isChecked()); + myConfig->writeConfigInt("NetDelayBetweenHands", spinBox_netDelayBetweenHands->value()); + myConfig->writeConfigInt("NetTimeOutPlayerAction", spinBox_netTimeOutPlayerAction->value()); + myConfig->writeConfigInt("ServerPort", spinBox_serverPort->value()); + myConfig->writeConfigInt("ServerUseIpv6", checkBox_useIpv6->isChecked()); + myConfig->writeConfigInt("ServerUseSctp", checkBox_useSctp->isChecked()); -// Interface - myConfig->writeConfigString("Language", comboBox_switchLanguage->itemData(comboBox_switchLanguage->currentIndex()).toString().toUtf8().constData()); - myConfig->writeConfigInt("ShowLeftToolBox", checkBox_showLeftToolbox->isChecked()); - myConfig->writeConfigInt("ShowRightToolBox", checkBox_showRightToolbox->isChecked()); - myConfig->writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked()); - myConfig->writeConfigInt("ShowFlipCardsAnimation", checkBox_showFlipCardsAnimation->isChecked()); - myConfig->writeConfigInt("ShowBlindButtons", checkBox_showBlindButtons->isChecked()); - myConfig->writeConfigInt("ShowCardsChanceMonitor", checkBox_cardsChanceMonitor->isChecked()); - myConfig->writeConfigInt("AntiPeekMode", checkBox_antiPeekMode->isChecked()); - myConfig->writeConfigInt("AlternateFKeysUserActionMode", checkBox_alternateFKeysUserActionMode->isChecked()); - myConfig->writeConfigInt("DontTranslateInternationalPokerStringsFromStyle", checkBox_dontTranslatePokerStrings->isChecked()); - myConfig->writeConfigInt("DisableSplashScreenOnStartup", checkBox_disableSplashscreen->isChecked()); - myConfig->writeConfigInt("EnableBetInputFocusSwitch", checkBox_enableBetInputFocusSwitch->isChecked()); - myConfig->writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked()); - myConfig->writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked()); + //Internet Game Settings + if(groupBox_automaticServerConfig->isChecked()) { - if(radioButton_flipsideOwn->isChecked()) { - if(QFile::QFile(lineEdit_OwnFlipsideFilename->text()).exists() && lineEdit_OwnFlipsideFilename->text() != "") {myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData()); } - else { QMessageBox::warning(this, tr("Settings Error"), - tr("The entered flipside picture doesn't exist.\n" - "Please enter an valid picture!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } - } + myConfig->writeConfigInt("InternetServerConfigMode", 0); - //S T Y L E -// TABLE - //save game table styles list - myGameTableStylesList.clear(); - int i; - for(i=0; i < listWidget_gameTableStyles->count(); i++) { - QListWidgetItem *item = listWidget_gameTableStyles->item(i); - if(item->data(16).toInt() == ADDITIONAL_STYLE) { - myGameTableStylesList.push_back(item->data(15).toString().toUtf8().constData()); - } - } - myConfig->writeConfigStringList("GameTableStylesList", myGameTableStylesList); - //save current game table style - for(i=0; i < listWidget_gameTableStyles->count(); i++) { - QListWidgetItem *item = listWidget_gameTableStyles->item(i); - if(!item->icon().isNull()) - myConfig->writeConfigString("CurrentGameTableStyle", item->data(15).toString().toUtf8().constData()); - } -// CARDS - //save card deck styles list - myCardDeckStylesList.clear(); - int j; - for(j=0; j < listWidget_cardDeckStyles->count(); j++) { - QListWidgetItem *item = listWidget_cardDeckStyles->item(j); - if(item->data(16).toInt() == ADDITIONAL_STYLE) { - myCardDeckStylesList.push_back(item->data(15).toString().toUtf8().constData()); - } - } - myConfig->writeConfigStringList("CardDeckStylesList", myCardDeckStylesList); - //save current card deck style - for(j=0; j < listWidget_cardDeckStyles->count(); j++) { - QListWidgetItem *item = listWidget_cardDeckStyles->item(j); - if(!item->icon().isNull()) - myConfig->writeConfigString("CurrentCardDeckStyle", item->data(15).toString().toUtf8().constData()); - } + // QUrl serverList; + // serverList.setUrl(lineEdit_InternetServerListAddress->text(),QUrl::StrictMode); + // QRegExp rx("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"); + // if(lineEdit_InternetServerListAddress->text().contains(rx)) { + if(lineEdit_InternetServerListAddress->text().contains("/") && lineEdit_InternetServerListAddress->text().contains(".") ) { - //Sound - myConfig->writeConfigInt("PlaySoundEffects", groupBox_playSoundEffects->isChecked()); - myConfig->writeConfigInt("SoundVolume", horizontalSlider_soundVolume->value()); - myConfig->writeConfigInt("PlayGameActions", checkBox_playGameActions->isChecked()); - myConfig->writeConfigInt("PlayLobbyChatNotification", checkBox_playLobbyChatNotification->isChecked()); - myConfig->writeConfigInt("PlayNetworkGameNotification", checkBox_playNetworkGameNotification->isChecked()); + myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData()); + } + else { + QMessageBox::warning(this, tr("Settings Error"), + tr("The entered server list address is not a valid URL.\n" + "Please enter a valid server list address!"), + QMessageBox::Ok); + settingsCorrect = FALSE; + } + } + if(groupBox_manualServerConfig->isChecked()) { -// Log - myConfig->writeConfigInt("LogOnOff", groupBox_logOnOff->isChecked()); - if (myConfig->readConfigInt("LogOnOff")) { + myConfig->writeConfigInt("InternetServerConfigMode", 1); + myConfig->writeConfigString("InternetServerAddress", lineEdit_InternetServerAddress->text().toUtf8().constData()); + myConfig->writeConfigInt("InternetServerPort", spinBox_InternetServerPort->value()); + } + if(checkBox_useAvatarServer->isChecked()) { + myConfig->writeConfigInt("UseAvatarServer", 1); + myConfig->writeConfigString("AvatarServerAddress", lineEdit_avatarServerAddress->text().toUtf8().constData()); + } + else { + myConfig->writeConfigInt("UseAvatarServer", 0); + } + + myConfig->writeConfigInt("InternetServerUseIpv6", checkBox_InternetServerUseIpv6->isChecked()); + myConfig->writeConfigInt("InternetServerUseSctp", checkBox_InternetServerUseSctp->isChecked()); + myConfig->writeConfigInt("UseInternetGamePassword", checkBox_UseInternetGamePassword->isChecked()); + myConfig->writeConfigString("InternetGamePassword", lineEdit_InternetGamePassword->text().toUtf8().constData()); + myConfig->writeConfigInt("UseLobbyChat", checkBox_UseLobbyChat->isChecked()); + myConfig->writeConfigInt("InternetGameType", comboBox_internetGameType->currentIndex()); + myConfig->writeConfigString("InternetGameName", lineEdit_internetGameName->text().toUtf8().constData()); + + int k; + std::list playerIgnoreList; + for(k=0; ktopLevelItemCount(); k++) { + playerIgnoreList.push_back(QString("%1,%2").arg(treeWidget_internetGameIgnoredPlayers->topLevelItem(k)->data(0,Qt::UserRole).toUInt()).arg(treeWidget_internetGameIgnoredPlayers->topLevelItem(k)->text(0)).toUtf8().constData()); + } + myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList); + + + // Interface + myConfig->writeConfigString("Language", comboBox_switchLanguage->itemData(comboBox_switchLanguage->currentIndex()).toString().toUtf8().constData()); + myConfig->writeConfigInt("ShowLeftToolBox", checkBox_showLeftToolbox->isChecked()); + myConfig->writeConfigInt("ShowRightToolBox", checkBox_showRightToolbox->isChecked()); + myConfig->writeConfigInt("ShowFadeOutCardsAnimation", checkBox_showFadeOutCardsAnimation->isChecked()); + myConfig->writeConfigInt("ShowFlipCardsAnimation", checkBox_showFlipCardsAnimation->isChecked()); + myConfig->writeConfigInt("ShowBlindButtons", checkBox_showBlindButtons->isChecked()); + myConfig->writeConfigInt("ShowCardsChanceMonitor", checkBox_cardsChanceMonitor->isChecked()); + myConfig->writeConfigInt("AntiPeekMode", checkBox_antiPeekMode->isChecked()); + myConfig->writeConfigInt("AlternateFKeysUserActionMode", checkBox_alternateFKeysUserActionMode->isChecked()); + myConfig->writeConfigInt("DontTranslateInternationalPokerStringsFromStyle", checkBox_dontTranslatePokerStrings->isChecked()); + myConfig->writeConfigInt("DisableSplashScreenOnStartup", checkBox_disableSplashscreen->isChecked()); + myConfig->writeConfigInt("EnableBetInputFocusSwitch", checkBox_enableBetInputFocusSwitch->isChecked()); + myConfig->writeConfigInt("FlipsideTux", radioButton_flipsideTux->isChecked()); + myConfig->writeConfigInt("FlipsideOwn", radioButton_flipsideOwn->isChecked()); + + if(radioButton_flipsideOwn->isChecked()) { + if(QFile::QFile(lineEdit_OwnFlipsideFilename->text()).exists() && lineEdit_OwnFlipsideFilename->text() != "") {myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData()); } + else { QMessageBox::warning(this, tr("Settings Error"), + tr("The entered flipside picture doesn't exist.\n" + "Please enter an valid picture!"), + QMessageBox::Ok); + settingsCorrect = FALSE; + } + } + + //S T Y L E + // TABLE + //save game table styles list + myGameTableStylesList.clear(); + int i; + for(i=0; i < listWidget_gameTableStyles->count(); i++) { + QListWidgetItem *item = listWidget_gameTableStyles->item(i); + if(item->data(16).toInt() == ADDITIONAL_STYLE) { + myGameTableStylesList.push_back(item->data(15).toString().toUtf8().constData()); + } + } + myConfig->writeConfigStringList("GameTableStylesList", myGameTableStylesList); + //save current game table style + for(i=0; i < listWidget_gameTableStyles->count(); i++) { + QListWidgetItem *item = listWidget_gameTableStyles->item(i); + if(!item->icon().isNull()) + myConfig->writeConfigString("CurrentGameTableStyle", item->data(15).toString().toUtf8().constData()); + } + // CARDS + //save card deck styles list + myCardDeckStylesList.clear(); + int j; + for(j=0; j < listWidget_cardDeckStyles->count(); j++) { + QListWidgetItem *item = listWidget_cardDeckStyles->item(j); + if(item->data(16).toInt() == ADDITIONAL_STYLE) { + myCardDeckStylesList.push_back(item->data(15).toString().toUtf8().constData()); + } + } + myConfig->writeConfigStringList("CardDeckStylesList", myCardDeckStylesList); + //save current card deck style + for(j=0; j < listWidget_cardDeckStyles->count(); j++) { + QListWidgetItem *item = listWidget_cardDeckStyles->item(j); + if(!item->icon().isNull()) + myConfig->writeConfigString("CurrentCardDeckStyle", item->data(15).toString().toUtf8().constData()); + } + + //Sound + myConfig->writeConfigInt("PlaySoundEffects", groupBox_playSoundEffects->isChecked()); + myConfig->writeConfigInt("SoundVolume", horizontalSlider_soundVolume->value()); + myConfig->writeConfigInt("PlayGameActions", checkBox_playGameActions->isChecked()); + myConfig->writeConfigInt("PlayLobbyChatNotification", checkBox_playLobbyChatNotification->isChecked()); + myConfig->writeConfigInt("PlayNetworkGameNotification", checkBox_playNetworkGameNotification->isChecked()); + + // Log + myConfig->writeConfigInt("LogOnOff", groupBox_logOnOff->isChecked()); + if (myConfig->readConfigInt("LogOnOff")) { // if log On - if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); } - else { - QMessageBox::warning(this, tr("Settings Error"), - tr("The log file directory doesn't exist.\n" - "Please select an valid directory!"), - QMessageBox::Ok); - settingsCorrect = FALSE; - } + if(QDir::QDir(lineEdit_logDir->text()).exists() && lineEdit_logDir->text() != "") { myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); } + else { + QMessageBox::warning(this, tr("Settings Error"), + tr("The log file directory doesn't exist.\n" + "Please select an valid directory!"), + QMessageBox::Ok); + settingsCorrect = FALSE; + } - myConfig->writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value()); - myConfig->writeConfigInt("LogInterval", comboBox_logInterval->currentIndex()); - } + myConfig->writeConfigInt("LogStoreDuration", spinBox_logStoreDuration->value()); + myConfig->writeConfigInt("LogInterval", comboBox_logInterval->currentIndex()); + } - //Manual Blinds Order Dialog (local) - myConfig->writeConfigIntList("ManualBlindsList",myManualBlindsList); - myConfig->writeConfigInt("AfterMBAlwaysDoubleBlinds",myAfterMBAlwaysDoubleBlinds); - myConfig->writeConfigInt("AfterMBAlwaysRaiseAbout",myAfterMBAlwaysRaiseAbout); - myConfig->writeConfigInt("AfterMBAlwaysRaiseValue",myAfterMBAlwaysRaiseValue); - myConfig->writeConfigInt("AfterMBStayAtLastBlind",myAfterMBStayAtLastBlind); + //Manual Blinds Order Dialog (local) + myConfig->writeConfigIntList("ManualBlindsList",myManualBlindsList); + myConfig->writeConfigInt("AfterMBAlwaysDoubleBlinds",myAfterMBAlwaysDoubleBlinds); + myConfig->writeConfigInt("AfterMBAlwaysRaiseAbout",myAfterMBAlwaysRaiseAbout); + myConfig->writeConfigInt("AfterMBAlwaysRaiseValue",myAfterMBAlwaysRaiseValue); + myConfig->writeConfigInt("AfterMBStayAtLastBlind",myAfterMBStayAtLastBlind); - //Manual Blinds Order Dialog (network) - myConfig->writeConfigIntList("NetManualBlindsList",myNetManualBlindsList); - myConfig->writeConfigInt("NetAfterMBAlwaysDoubleBlinds",myNetAfterMBAlwaysDoubleBlinds); - myConfig->writeConfigInt("NetAfterMBAlwaysRaiseAbout",myNetAfterMBAlwaysRaiseAbout); - myConfig->writeConfigInt("NetAfterMBAlwaysRaiseValue",myNetAfterMBAlwaysRaiseValue); - myConfig->writeConfigInt("NetAfterMBStayAtLastBlind",myNetAfterMBStayAtLastBlind); + //Manual Blinds Order Dialog (network) + myConfig->writeConfigIntList("NetManualBlindsList",myNetManualBlindsList); + myConfig->writeConfigInt("NetAfterMBAlwaysDoubleBlinds",myNetAfterMBAlwaysDoubleBlinds); + myConfig->writeConfigInt("NetAfterMBAlwaysRaiseAbout",myNetAfterMBAlwaysRaiseAbout); + myConfig->writeConfigInt("NetAfterMBAlwaysRaiseValue",myNetAfterMBAlwaysRaiseValue); + myConfig->writeConfigInt("NetAfterMBStayAtLastBlind",myNetAfterMBStayAtLastBlind); - //write buffer to disc - myConfig->writeBuffer(); + //write buffer to disc + myConfig->writeBuffer(); - if(languageIsChanged) { - QMessageBox::information(this, tr("Language Changed"), - tr("You have changed application language to %1.\nPlease restart PokerTH to load new language!").arg(comboBox_switchLanguage->itemText(changedLanguageIndex)), - QMessageBox::Ok); - } + if(languageIsChanged) { + QMessageBox::information(this, tr("Language Changed"), + tr("You have changed application language to %1.\nPlease restart PokerTH to load new language!").arg(comboBox_switchLanguage->itemText(changedLanguageIndex)), + QMessageBox::Ok); + } - //Wenn alles richtig eingegeben wurde --> Dialog schließen - if(settingsCorrect) { this->accept(); } + //Wenn alles richtig eingegeben wurde --> Dialog schließen + if(settingsCorrect) { this->accept(); } } void settingsDialogImpl::setFlipsidePicFileName() { - QDir flipSideDir(QDir::homePath()); - QFile flipSideFile(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str())); - if(flipSideFile.exists()) { - flipSideDir = QDir(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str())); - } + QDir flipSideDir(QDir::homePath()); + QFile flipSideFile(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str())); + if(flipSideFile.exists()) { + flipSideDir = QDir(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str())); + } - QString fileName = QFileDialog::getOpenFileName(this, tr("Select your flipside picture"), - flipSideDir.absolutePath(), - tr("Images (*.png *.jpg *.gif)")); + QString fileName = QFileDialog::getOpenFileName(this, tr("Select your flipside picture"), + flipSideDir.absolutePath(), + tr("Images (*.png *.jpg *.gif)")); - if (!fileName.isEmpty()) - lineEdit_OwnFlipsideFilename->setText(fileName); - } + if (!fileName.isEmpty()) + lineEdit_OwnFlipsideFilename->setText(fileName); +} void settingsDialogImpl::setAvatarFile0() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_HumanPlayerAvatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_HumanPlayerAvatar->setIcon(QIcon(pushButton_HumanPlayerAvatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_HumanPlayerAvatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_HumanPlayerAvatar->setIcon(QIcon(pushButton_HumanPlayerAvatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile1() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent1Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent1Avatar->setIcon(QIcon(pushButton_Opponent1Avatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent1Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent1Avatar->setIcon(QIcon(pushButton_Opponent1Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile2() { - callSelectAvatarDialog(); - - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent2Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent2Avatar->setIcon(QIcon(pushButton_Opponent2Avatar->getMyLink())); - } + callSelectAvatarDialog(); + + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent2Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent2Avatar->setIcon(QIcon(pushButton_Opponent2Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile3() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent3Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent3Avatar->setIcon(QIcon(pushButton_Opponent3Avatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent3Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent3Avatar->setIcon(QIcon(pushButton_Opponent3Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile4() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent4Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent4Avatar->setIcon(QIcon(pushButton_Opponent4Avatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent4Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent4Avatar->setIcon(QIcon(pushButton_Opponent4Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile5() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent5Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent5Avatar->setIcon(QIcon(pushButton_Opponent5Avatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent5Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent5Avatar->setIcon(QIcon(pushButton_Opponent5Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile6() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent6Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent6Avatar->setIcon(QIcon(pushButton_Opponent6Avatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent6Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent6Avatar->setIcon(QIcon(pushButton_Opponent6Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile7() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent7Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent7Avatar->setIcon(QIcon(pushButton_Opponent7Avatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent7Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent7Avatar->setIcon(QIcon(pushButton_Opponent7Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile8() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent8Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent8Avatar->setIcon(QIcon(pushButton_Opponent8Avatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent8Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent8Avatar->setIcon(QIcon(pushButton_Opponent8Avatar->getMyLink())); + } } void settingsDialogImpl::setAvatarFile9() { - callSelectAvatarDialog(); - if(mySelectAvatarDialogImpl->getSettingsCorrect()) { - pushButton_Opponent9Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); - pushButton_Opponent9Avatar->setIcon(QIcon(pushButton_Opponent9Avatar->getMyLink())); - } + callSelectAvatarDialog(); + if(mySelectAvatarDialogImpl->getSettingsCorrect()) { + pushButton_Opponent9Avatar->setMyLink(mySelectAvatarDialogImpl->getAvatarLink()); + pushButton_Opponent9Avatar->setIcon(QIcon(pushButton_Opponent9Avatar->getMyLink())); + } } void settingsDialogImpl::setLogDir() - { - QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), - QDir::homePath(), - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks); - - if (!dir.isEmpty()) lineEdit_logDir->setText(dir); - } +{ + QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), + QDir::homePath(), + QFileDialog::ShowDirsOnly + | QFileDialog::DontResolveSymlinks); + + if (!dir.isEmpty()) lineEdit_logDir->setText(dir); +} void settingsDialogImpl::clearInternetGamePassword(bool clear) { - if(!clear) { lineEdit_InternetGamePassword->clear(); } + if(!clear) { lineEdit_InternetGamePassword->clear(); } } void settingsDialogImpl::callManualBlindsOrderDialog() { - - myManualBlindsOrderDialog->listWidget_blinds->clear(); - myManualBlindsOrderDialog->spinBox_input->setMinimum(spinBox_firstSmallBlind->value()); - list::iterator it1; - for(it1= myManualBlindsList.begin(); it1 != myManualBlindsList.end(); it1++) { - myManualBlindsOrderDialog->listWidget_blinds->addItem(QString::number(*it1,10)); - } - myManualBlindsOrderDialog->sortBlindsList(); + myManualBlindsOrderDialog->listWidget_blinds->clear(); + myManualBlindsOrderDialog->spinBox_input->setMinimum(spinBox_firstSmallBlind->value()); - myManualBlindsOrderDialog->radioButton_alwaysDoubleBlinds->setChecked(myAfterMBAlwaysDoubleBlinds); - myManualBlindsOrderDialog->radioButton_alwaysRaiseAbout->setChecked(myAfterMBAlwaysRaiseAbout); - myManualBlindsOrderDialog->spinBox_alwaysRaiseValue->setValue(myAfterMBAlwaysRaiseValue); - myManualBlindsOrderDialog->radioButton_stayAtLastBlind->setChecked(myAfterMBStayAtLastBlind); + list::iterator it1; + for(it1= myManualBlindsList.begin(); it1 != myManualBlindsList.end(); it1++) { + myManualBlindsOrderDialog->listWidget_blinds->addItem(QString::number(*it1,10)); + } + myManualBlindsOrderDialog->sortBlindsList(); - myManualBlindsOrderDialog->exec(); - if(myManualBlindsOrderDialog->result() == QDialog::Accepted) { - - bool ok = TRUE; - int i; - myManualBlindsList.clear(); - for(i=0; ilistWidget_blinds->count(); i++) { - myManualBlindsList.push_back(myManualBlindsOrderDialog->listWidget_blinds->item(i)->text().toInt(&ok,10)); - } + myManualBlindsOrderDialog->radioButton_alwaysDoubleBlinds->setChecked(myAfterMBAlwaysDoubleBlinds); + myManualBlindsOrderDialog->radioButton_alwaysRaiseAbout->setChecked(myAfterMBAlwaysRaiseAbout); + myManualBlindsOrderDialog->spinBox_alwaysRaiseValue->setValue(myAfterMBAlwaysRaiseValue); + myManualBlindsOrderDialog->radioButton_stayAtLastBlind->setChecked(myAfterMBStayAtLastBlind); - myAfterMBAlwaysDoubleBlinds = myManualBlindsOrderDialog->radioButton_alwaysDoubleBlinds->isChecked(); - myAfterMBAlwaysRaiseAbout = myManualBlindsOrderDialog->radioButton_alwaysRaiseAbout->isChecked(); - myAfterMBAlwaysRaiseValue = myManualBlindsOrderDialog->spinBox_alwaysRaiseValue->value(); - myAfterMBStayAtLastBlind = myManualBlindsOrderDialog->radioButton_stayAtLastBlind->isChecked(); + myManualBlindsOrderDialog->exec(); + if(myManualBlindsOrderDialog->result() == QDialog::Accepted) { - setFirstSmallBlindMargin(); - } + bool ok = TRUE; + int i; + myManualBlindsList.clear(); + for(i=0; ilistWidget_blinds->count(); i++) { + myManualBlindsList.push_back(myManualBlindsOrderDialog->listWidget_blinds->item(i)->text().toInt(&ok,10)); + } + + myAfterMBAlwaysDoubleBlinds = myManualBlindsOrderDialog->radioButton_alwaysDoubleBlinds->isChecked(); + myAfterMBAlwaysRaiseAbout = myManualBlindsOrderDialog->radioButton_alwaysRaiseAbout->isChecked(); + myAfterMBAlwaysRaiseValue = myManualBlindsOrderDialog->spinBox_alwaysRaiseValue->value(); + myAfterMBStayAtLastBlind = myManualBlindsOrderDialog->radioButton_stayAtLastBlind->isChecked(); + + setFirstSmallBlindMargin(); + } } void settingsDialogImpl::callNetManualBlindsOrderDialog() { - myManualBlindsOrderDialog->listWidget_blinds->clear(); - myManualBlindsOrderDialog->spinBox_input->setMinimum(spinBox_netFirstSmallBlind->value()); + myManualBlindsOrderDialog->listWidget_blinds->clear(); + myManualBlindsOrderDialog->spinBox_input->setMinimum(spinBox_netFirstSmallBlind->value()); - list::iterator it1; - for(it1= myNetManualBlindsList.begin(); it1 != myNetManualBlindsList.end(); it1++) { - myManualBlindsOrderDialog->listWidget_blinds->addItem(QString::number(*it1,10)); - } - myManualBlindsOrderDialog->sortBlindsList(); - - myManualBlindsOrderDialog->radioButton_alwaysDoubleBlinds->setChecked(myNetAfterMBAlwaysDoubleBlinds); - myManualBlindsOrderDialog->radioButton_alwaysRaiseAbout->setChecked(myNetAfterMBAlwaysRaiseAbout); - myManualBlindsOrderDialog->spinBox_alwaysRaiseValue->setValue(myNetAfterMBAlwaysRaiseValue); - myManualBlindsOrderDialog->radioButton_stayAtLastBlind->setChecked(myNetAfterMBStayAtLastBlind); + list::iterator it1; + for(it1= myNetManualBlindsList.begin(); it1 != myNetManualBlindsList.end(); it1++) { + myManualBlindsOrderDialog->listWidget_blinds->addItem(QString::number(*it1,10)); + } + myManualBlindsOrderDialog->sortBlindsList(); - myManualBlindsOrderDialog->exec(); - if(myManualBlindsOrderDialog->result() == QDialog::Accepted) { + myManualBlindsOrderDialog->radioButton_alwaysDoubleBlinds->setChecked(myNetAfterMBAlwaysDoubleBlinds); + myManualBlindsOrderDialog->radioButton_alwaysRaiseAbout->setChecked(myNetAfterMBAlwaysRaiseAbout); + myManualBlindsOrderDialog->spinBox_alwaysRaiseValue->setValue(myNetAfterMBAlwaysRaiseValue); + myManualBlindsOrderDialog->radioButton_stayAtLastBlind->setChecked(myNetAfterMBStayAtLastBlind); - bool ok = TRUE; - int i; - myNetManualBlindsList.clear(); - for(i=0; ilistWidget_blinds->count(); i++) { - myNetManualBlindsList.push_back(myManualBlindsOrderDialog->listWidget_blinds->item(i)->text().toInt(&ok,10)); - } - - myNetAfterMBAlwaysDoubleBlinds = myManualBlindsOrderDialog->radioButton_alwaysDoubleBlinds->isChecked(); - myNetAfterMBAlwaysRaiseAbout = myManualBlindsOrderDialog->radioButton_alwaysRaiseAbout->isChecked(); - myNetAfterMBAlwaysRaiseValue = myManualBlindsOrderDialog->spinBox_alwaysRaiseValue->value(); - myNetAfterMBStayAtLastBlind = myManualBlindsOrderDialog->radioButton_stayAtLastBlind->isChecked(); + myManualBlindsOrderDialog->exec(); + if(myManualBlindsOrderDialog->result() == QDialog::Accepted) { - setFirstSmallBlindMargin(); - } + bool ok = TRUE; + int i; + myNetManualBlindsList.clear(); + for(i=0; ilistWidget_blinds->count(); i++) { + myNetManualBlindsList.push_back(myManualBlindsOrderDialog->listWidget_blinds->item(i)->text().toInt(&ok,10)); + } + + myNetAfterMBAlwaysDoubleBlinds = myManualBlindsOrderDialog->radioButton_alwaysDoubleBlinds->isChecked(); + myNetAfterMBAlwaysRaiseAbout = myManualBlindsOrderDialog->radioButton_alwaysRaiseAbout->isChecked(); + myNetAfterMBAlwaysRaiseValue = myManualBlindsOrderDialog->spinBox_alwaysRaiseValue->value(); + myNetAfterMBStayAtLastBlind = myManualBlindsOrderDialog->radioButton_stayAtLastBlind->isChecked(); + + setFirstSmallBlindMargin(); + } } @@ -849,279 +865,279 @@ void settingsDialogImpl::callNetManualBlindsOrderDialog() { void settingsDialogImpl::setFirstSmallBlindMargin() { - if(radioButton_manualBlindsOrder->isChecked() && !myManualBlindsList.empty()) { - if(spinBox_firstSmallBlind->value() > myManualBlindsList.front()) { - QMessageBox::warning(this, tr("Blinds Error"), - tr("The first element in your manual-blinds-list \nis smaller than current first-small-blind!\nThis first-small-blind-value will be set to maximum allowed value."), - QMessageBox::Close); - } - spinBox_firstSmallBlind->setMaximum(myManualBlindsList.front()); - } - else { - spinBox_firstSmallBlind->setMaximum(9999); - } - if(radioButton_netManualBlindsOrder->isChecked() && !myNetManualBlindsList.empty()) { - if(spinBox_netFirstSmallBlind->value() > myNetManualBlindsList.front()) { - QMessageBox::warning(this, tr("Blinds Error"), - tr("The first element in your manual-blinds-list \nis smaller than current first-small-blind!\nThis first-small-blind-value will be set to maximum allowed value."), - QMessageBox::Close); - } - spinBox_netFirstSmallBlind->setMaximum(myNetManualBlindsList.front()); - } - else { - spinBox_netFirstSmallBlind->setMaximum(9999); - } - + if(radioButton_manualBlindsOrder->isChecked() && !myManualBlindsList.empty()) { + if(spinBox_firstSmallBlind->value() > myManualBlindsList.front()) { + QMessageBox::warning(this, tr("Blinds Error"), + tr("The first element in your manual-blinds-list \nis smaller than current first-small-blind!\nThis first-small-blind-value will be set to maximum allowed value."), + QMessageBox::Close); + } + spinBox_firstSmallBlind->setMaximum(myManualBlindsList.front()); + } + else { + spinBox_firstSmallBlind->setMaximum(9999); + } + if(radioButton_netManualBlindsOrder->isChecked() && !myNetManualBlindsList.empty()) { + if(spinBox_netFirstSmallBlind->value() > myNetManualBlindsList.front()) { + QMessageBox::warning(this, tr("Blinds Error"), + tr("The first element in your manual-blinds-list \nis smaller than current first-small-blind!\nThis first-small-blind-value will be set to maximum allowed value."), + QMessageBox::Close); + } + spinBox_netFirstSmallBlind->setMaximum(myNetManualBlindsList.front()); + } + else { + spinBox_netFirstSmallBlind->setMaximum(9999); + } + } void settingsDialogImpl::setLanguageChanged(int index) { - languageIsChanged = TRUE; - changedLanguageIndex = index; - + languageIsChanged = TRUE; + changedLanguageIndex = index; + } void settingsDialogImpl::toggleGroupBoxAutomaticServerConfig(bool toggleState) { - if(toggleState) groupBox_manualServerConfig->setChecked(FALSE); - else groupBox_manualServerConfig->setChecked(TRUE); + if(toggleState) groupBox_manualServerConfig->setChecked(FALSE); + else groupBox_manualServerConfig->setChecked(TRUE); } void settingsDialogImpl::toggleGroupBoxManualServerConfig(bool toggleState) { - if(toggleState) groupBox_automaticServerConfig->setChecked(FALSE); - else groupBox_automaticServerConfig->setChecked(TRUE); + if(toggleState) groupBox_automaticServerConfig->setChecked(FALSE); + else groupBox_automaticServerConfig->setChecked(TRUE); } void settingsDialogImpl::showCurrentGameTableStylePreview() { - QListWidgetItem* item = listWidget_gameTableStyles->currentItem(); - if(item) { - GameTableStyleReader style(myConfig, this); - style.readStyleFile(item->data(15).toString()); - QPixmap preview(style.getPreview()); - if(preview.height() > 160 || preview.width() > 120) label_gameTableStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation)); - else label_gameTableStylePreview->setPixmap(preview); + QListWidgetItem* item = listWidget_gameTableStyles->currentItem(); + if(item) { + GameTableStyleReader style(myConfig, this); + style.readStyleFile(item->data(15).toString()); + QPixmap preview(style.getPreview()); + if(preview.height() > 160 || preview.width() > 120) label_gameTableStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation)); + else label_gameTableStylePreview->setPixmap(preview); - QString MaintainerName = tr("Maintainer Name"); - QString MaintainerEMail = tr("Maintainer EMail"); - QString CreateDate = tr("Create Date"); - QString WindowBehaviour = tr("Windows Behaviour"); - QString scaleable = tr("scaleable"); - QString fixed = tr("fixed"); - QString MinimumSize = tr("Minimum Size"); - QString MaximumSize = tr("Maximum Size"); - QString FixedSize = tr("Fixed Size"); + QString MaintainerName = tr("Maintainer Name"); + QString MaintainerEMail = tr("Maintainer EMail"); + QString CreateDate = tr("Create Date"); + QString WindowBehaviour = tr("Windows Behaviour"); + QString scaleable = tr("scaleable"); + QString fixed = tr("fixed"); + QString MinimumSize = tr("Minimum Size"); + QString MaximumSize = tr("Maximum Size"); + QString FixedSize = tr("Fixed Size"); - QString windowsSubString; - if(style.getIfFixedWindowSize().toInt()) { - windowsSubString = ""+WindowBehaviour+": "+fixed+"
"+FixedSize+": "+style.getFixedWindowWidth()+"x"+style.getFixedWindowHeight(); - } - else { - windowsSubString = ""+WindowBehaviour+": "+scaleable+"
"+MinimumSize+": "+style.getMinimumWindowWidth()+"x"+style.getMinimumWindowHeight()+"
"+MaximumSize+": "+style.getMaximumWindowWidth()+"x"+style.getMaximumWindowHeight(); - } + QString windowsSubString; + if(style.getIfFixedWindowSize().toInt()) { + windowsSubString = ""+WindowBehaviour+": "+fixed+"
"+FixedSize+": "+style.getFixedWindowWidth()+"x"+style.getFixedWindowHeight(); + } + else { + windowsSubString = ""+WindowBehaviour+": "+scaleable+"
"+MinimumSize+": "+style.getMinimumWindowWidth()+"x"+style.getMinimumWindowHeight()+"
"+MaximumSize+": "+style.getMaximumWindowWidth()+"x"+style.getMaximumWindowHeight(); + } - QString maintainerEMailString; - if(style.getStyleMaintainerEMail() != "NULL" && style.getStyleMaintainerEMail() != "") { - maintainerEMailString = ""+MaintainerEMail+": "+style.getStyleMaintainerEMail()+"
"; - } + QString maintainerEMailString; + if(style.getStyleMaintainerEMail() != "NULL" && style.getStyleMaintainerEMail() != "") { + maintainerEMailString = ""+MaintainerEMail+": "+style.getStyleMaintainerEMail()+"
"; + } - label_gameTableStyleInfo->setText(""+MaintainerName+": "+style.getStyleMaintainerName()+"
"+maintainerEMailString+""+CreateDate+": "+style.getStyleCreateDate()+"
"+windowsSubString); - - //active the current selected item directly - setSelectedGameTableStyleActivated(); - - //disable remove button for distributed styles - if(item->data(16).toInt() == POKERTH_DISTRIBUTED_STYLE) { pushButton_removeGameTableStyle->setDisabled(TRUE); } - else { pushButton_removeGameTableStyle->setDisabled(FALSE); } + label_gameTableStyleInfo->setText(""+MaintainerName+": "+style.getStyleMaintainerName()+"
"+maintainerEMailString+""+CreateDate+": "+style.getStyleCreateDate()+"
"+windowsSubString); + + //active the current selected item directly + setSelectedGameTableStyleActivated(); + + //disable remove button for distributed styles + if(item->data(16).toInt() == POKERTH_DISTRIBUTED_STYLE) { pushButton_removeGameTableStyle->setDisabled(TRUE); } + else { pushButton_removeGameTableStyle->setDisabled(FALSE); } - } + } } void settingsDialogImpl::setSelectedGameTableStyleActivated() { - QListWidgetItem* selectedItem = listWidget_gameTableStyles->currentItem(); - if(selectedItem) { - int i; - for(i=0; i < listWidget_gameTableStyles->count(); i++) { - QListWidgetItem *item = listWidget_gameTableStyles->item(i); - if(item == selectedItem) { - item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - } - else item->setIcon(QIcon()); - } - } + QListWidgetItem* selectedItem = listWidget_gameTableStyles->currentItem(); + if(selectedItem) { + int i; + for(i=0; i < listWidget_gameTableStyles->count(); i++) { + QListWidgetItem *item = listWidget_gameTableStyles->item(i); + if(item == selectedItem) { + item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + } + else item->setIcon(QIcon()); + } + } } void settingsDialogImpl::addGameTableStyle() { - QDir dir(QString::fromUtf8(myConfig->readConfigString("LastGameTableStyleDir").c_str())); - QString dirString; + QDir dir(QString::fromUtf8(myConfig->readConfigString("LastGameTableStyleDir").c_str())); + QString dirString; + + if(dir.exists()) dirString = dir.absolutePath(); + else dirString = QDir::home().absolutePath(); + + QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your game table style"), + dirString, + tr("PokerTH game table styles (*.xml)")); + + if (!fileName.isEmpty()) { - if(dir.exists()) dirString = dir.absolutePath(); - else dirString = QDir::home().absolutePath(); + int i; + bool fileNameAlreadyFound(FALSE); + for(i=0; i < listWidget_gameTableStyles->count(); i++) { + QListWidgetItem *item = listWidget_gameTableStyles->item(i); + if(item->data(15).toString() == fileName) + fileNameAlreadyFound = TRUE; + } - QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your game table style"), - dirString, - tr("PokerTH game table styles (*.xml)")); - - if (!fileName.isEmpty()) { - - int i; - bool fileNameAlreadyFound(FALSE); - for(i=0; i < listWidget_gameTableStyles->count(); i++) { - QListWidgetItem *item = listWidget_gameTableStyles->item(i); - if(item->data(15).toString() == fileName) - fileNameAlreadyFound = TRUE; - } - - if(fileNameAlreadyFound) { - QMessageBox::warning(this, tr("Game Table Style Error"), - tr("Selected game table style file is already in the list. \nPlease select another one to add!"), - QMessageBox::Ok); - } - else { - GameTableStyleReader newStyle(myConfig, this); - newStyle.readStyleFile(fileName); - if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) { - MyStyleListItem *newItem = new MyStyleListItem(newStyle.getStyleDescription()); - newItem->setData(15,fileName); - newItem->setData(16, ADDITIONAL_STYLE); - newItem->setData(Qt::ToolTipRole,fileName); - listWidget_gameTableStyles->addItem(newItem); - listWidget_gameTableStyles->setCurrentItem(newItem); - listWidget_gameTableStyles->sortItems(Qt::AscendingOrder); - } - else { - QMessageBox::warning(this, tr("Game Table Style File Error"), - tr("Could not load game table style file correctly. \nStyle will not be placed into list!"), - QMessageBox::Ok); - } - } - //save current filepath - myConfig->writeConfigString("LastGameTableStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData()); - } + if(fileNameAlreadyFound) { + QMessageBox::warning(this, tr("Game Table Style Error"), + tr("Selected game table style file is already in the list. \nPlease select another one to add!"), + QMessageBox::Ok); + } + else { + GameTableStyleReader newStyle(myConfig, this); + newStyle.readStyleFile(fileName); + if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) { + MyStyleListItem *newItem = new MyStyleListItem(newStyle.getStyleDescription()); + newItem->setData(15,fileName); + newItem->setData(16, ADDITIONAL_STYLE); + newItem->setData(Qt::ToolTipRole,fileName); + listWidget_gameTableStyles->addItem(newItem); + listWidget_gameTableStyles->setCurrentItem(newItem); + listWidget_gameTableStyles->sortItems(Qt::AscendingOrder); + } + else { + QMessageBox::warning(this, tr("Game Table Style File Error"), + tr("Could not load game table style file correctly. \nStyle will not be placed into list!"), + QMessageBox::Ok); + } + } + //save current filepath + myConfig->writeConfigString("LastGameTableStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData()); + } } void settingsDialogImpl::removeGameTableStyle() { - QListWidgetItem* selectedItem = listWidget_gameTableStyles->currentItem(); - //never delete PokerTH defaullt Styles - if(selectedItem && selectedItem->data(16).toInt() == ADDITIONAL_STYLE) { - // if selected is activated --> swith activation to first default - if(!selectedItem->icon().isNull()) { - QListWidgetItem* firstItem = listWidget_gameTableStyles->item(0); - firstItem->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - } - //remove from List - listWidget_gameTableStyles->takeItem(listWidget_gameTableStyles->currentRow()); - } + QListWidgetItem* selectedItem = listWidget_gameTableStyles->currentItem(); + //never delete PokerTH defaullt Styles + if(selectedItem && selectedItem->data(16).toInt() == ADDITIONAL_STYLE) { + // if selected is activated --> swith activation to first default + if(!selectedItem->icon().isNull()) { + QListWidgetItem* firstItem = listWidget_gameTableStyles->item(0); + firstItem->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + } + //remove from List + listWidget_gameTableStyles->takeItem(listWidget_gameTableStyles->currentRow()); + } } void settingsDialogImpl::showCurrentCardDeckStylePreview() { - QListWidgetItem* item = listWidget_cardDeckStyles->currentItem(); - if(item) { - CardDeckStyleReader style(myConfig, this); - style.readStyleFile(item->data(15).toString()); - QPixmap preview(style.getPreview()); - if(preview.height() > 160 || preview.width() > 120) label_cardDeckStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation)); - else label_cardDeckStylePreview->setPixmap(preview); - - QString MaintainerName = tr("Maintainer Name"); - QString MaintainerEMail = tr("Maintainer EMail"); - QString CreateDate = tr("Create Date"); - - QString maintainerEMailString; - if(style.getStyleMaintainerEMail() != "NULL" && style.getStyleMaintainerEMail() != "") { - maintainerEMailString = ""+MaintainerEMail+": "+style.getStyleMaintainerEMail()+"
"; - } - - label_cardDeckStyleInfo->setText(""+MaintainerName+": "+style.getStyleMaintainerName()+"
"+maintainerEMailString+""+CreateDate+": "+style.getStyleCreateDate()+""); - //active the current selected item directly - setSelectedCardDeckStyleActivated(); - - //disable remove button for distributed styles - if(item->data(16).toInt() == POKERTH_DISTRIBUTED_STYLE) { pushButton_removeCardDeckStyle->setDisabled(TRUE); } - else { pushButton_removeCardDeckStyle->setDisabled(FALSE); } - } + QListWidgetItem* item = listWidget_cardDeckStyles->currentItem(); + if(item) { + CardDeckStyleReader style(myConfig, this); + style.readStyleFile(item->data(15).toString()); + QPixmap preview(style.getPreview()); + if(preview.height() > 160 || preview.width() > 120) label_cardDeckStylePreview->setPixmap(preview.scaled(160,120,Qt::KeepAspectRatio,Qt::SmoothTransformation)); + else label_cardDeckStylePreview->setPixmap(preview); + + QString MaintainerName = tr("Maintainer Name"); + QString MaintainerEMail = tr("Maintainer EMail"); + QString CreateDate = tr("Create Date"); + + QString maintainerEMailString; + if(style.getStyleMaintainerEMail() != "NULL" && style.getStyleMaintainerEMail() != "") { + maintainerEMailString = ""+MaintainerEMail+": "+style.getStyleMaintainerEMail()+"
"; + } + + label_cardDeckStyleInfo->setText(""+MaintainerName+": "+style.getStyleMaintainerName()+"
"+maintainerEMailString+""+CreateDate+": "+style.getStyleCreateDate()+""); + //active the current selected item directly + setSelectedCardDeckStyleActivated(); + + //disable remove button for distributed styles + if(item->data(16).toInt() == POKERTH_DISTRIBUTED_STYLE) { pushButton_removeCardDeckStyle->setDisabled(TRUE); } + else { pushButton_removeCardDeckStyle->setDisabled(FALSE); } + } } void settingsDialogImpl::setSelectedCardDeckStyleActivated() { - QListWidgetItem* selectedItem = listWidget_cardDeckStyles->currentItem(); - if(selectedItem) { - int i; - for(i=0; i < listWidget_cardDeckStyles->count(); i++) { - QListWidgetItem *item = listWidget_cardDeckStyles->item(i); - if(item == selectedItem) { - item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - } - else item->setIcon(QIcon()); - } - } + QListWidgetItem* selectedItem = listWidget_cardDeckStyles->currentItem(); + if(selectedItem) { + int i; + for(i=0; i < listWidget_cardDeckStyles->count(); i++) { + QListWidgetItem *item = listWidget_cardDeckStyles->item(i); + if(item == selectedItem) { + item->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + } + else item->setIcon(QIcon()); + } + } } void settingsDialogImpl::addCardDeckStyle() { - QDir dir(QString::fromUtf8(myConfig->readConfigString("LastCardDeckStyleDir").c_str())); - QString dirString; + QDir dir(QString::fromUtf8(myConfig->readConfigString("LastCardDeckStyleDir").c_str())); + QString dirString; - if(dir.exists()) dirString = dir.absolutePath(); - else dirString = QDir::home().absolutePath(); + if(dir.exists()) dirString = dir.absolutePath(); + else dirString = QDir::home().absolutePath(); - QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your card deck style"), - dirString, - tr("PokerTH card deck styles (*.xml)")); + QString fileName = QFileDialog::getOpenFileName(this, tr("Please select your card deck style"), + dirString, + tr("PokerTH card deck styles (*.xml)")); - if (!fileName.isEmpty()) { + if (!fileName.isEmpty()) { - int i; - bool fileNameAlreadyFound(FALSE); - for(i=0; i < listWidget_cardDeckStyles->count(); i++) { - QListWidgetItem *item = listWidget_cardDeckStyles->item(i); - if(item->data(15).toString() == fileName) - fileNameAlreadyFound = TRUE; - } + int i; + bool fileNameAlreadyFound(FALSE); + for(i=0; i < listWidget_cardDeckStyles->count(); i++) { + QListWidgetItem *item = listWidget_cardDeckStyles->item(i); + if(item->data(15).toString() == fileName) + fileNameAlreadyFound = TRUE; + } - if(fileNameAlreadyFound) { - QMessageBox::warning(this, tr("Card Deck Style Error"), - tr("Selected card deck style file is already in the list. \nPlease select another one to add!"), - QMessageBox::Ok); - } - else { - CardDeckStyleReader newStyle(myConfig, this); - newStyle.readStyleFile(fileName); - if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) { - MyStyleListItem *newItem = new MyStyleListItem(newStyle.getStyleDescription()); - newItem->setData(15,fileName); - newItem->setData(16, ADDITIONAL_STYLE); - newItem->setData(Qt::ToolTipRole,fileName); - listWidget_cardDeckStyles->addItem(newItem); - listWidget_cardDeckStyles->setCurrentItem(newItem); - listWidget_cardDeckStyles->sortItems(Qt::AscendingOrder); - } - else { - QMessageBox::warning(this, tr("Card Deck Style File Error"), - tr("Could not load card deck style file correctly. \nStyle will not be placed into list!"), - QMessageBox::Ok); - } - } - //save current filepath - myConfig->writeConfigString("LastCardDeckStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData()); - } + if(fileNameAlreadyFound) { + QMessageBox::warning(this, tr("Card Deck Style Error"), + tr("Selected card deck style file is already in the list. \nPlease select another one to add!"), + QMessageBox::Ok); + } + else { + CardDeckStyleReader newStyle(myConfig, this); + newStyle.readStyleFile(fileName); + if(!newStyle.getFallBack() && newStyle.getLoadedSuccessfull()) { + MyStyleListItem *newItem = new MyStyleListItem(newStyle.getStyleDescription()); + newItem->setData(15,fileName); + newItem->setData(16, ADDITIONAL_STYLE); + newItem->setData(Qt::ToolTipRole,fileName); + listWidget_cardDeckStyles->addItem(newItem); + listWidget_cardDeckStyles->setCurrentItem(newItem); + listWidget_cardDeckStyles->sortItems(Qt::AscendingOrder); + } + else { + QMessageBox::warning(this, tr("Card Deck Style File Error"), + tr("Could not load card deck style file correctly. \nStyle will not be placed into list!"), + QMessageBox::Ok); + } + } + //save current filepath + myConfig->writeConfigString("LastCardDeckStyleDir",QFileInfo(fileName).absolutePath().toUtf8().constData()); + } } void settingsDialogImpl::removeCardDeckStyle() { - QListWidgetItem* selectedItem = listWidget_cardDeckStyles->currentItem(); - //never delete PokerTH defaullt Styles - if(selectedItem && selectedItem->data(16).toInt() == ADDITIONAL_STYLE) { - // if selected is activated --> swith activation to first default - if(!selectedItem->icon().isNull()) { - QListWidgetItem* firstItem = listWidget_cardDeckStyles->item(0); - firstItem->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); - } - //remove from List - listWidget_cardDeckStyles->takeItem(listWidget_cardDeckStyles->currentRow()); - } + QListWidgetItem* selectedItem = listWidget_cardDeckStyles->currentItem(); + //never delete PokerTH defaullt Styles + if(selectedItem && selectedItem->data(16).toInt() == ADDITIONAL_STYLE) { + // if selected is activated --> swith activation to first default + if(!selectedItem->icon().isNull()) { + QListWidgetItem* firstItem = listWidget_cardDeckStyles->item(0); + firstItem->setIcon(QIcon(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"/gfx/gui/misc/rating.png")); + } + //remove from List + listWidget_cardDeckStyles->takeItem(listWidget_cardDeckStyles->currentRow()); + } } diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index 366973f9..f71f0c5c 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -162,8 +162,8 @@ startWindowImpl::startWindowImpl(ConfigFile *c) connect(this, SIGNAL(signalNetClientGameStart(boost::shared_ptr)), this, SLOT(networkStart(boost::shared_ptr))); connect(this, SIGNAL(signalSelfGameInvitation(unsigned, unsigned)), myGameLobbyDialog, SLOT(showInvitationDialog(unsigned, unsigned))); - connect(this, SIGNAL(signalPlayerGameInvitation(unsigned, unsigned, unsigned)), myGameLobbyDialog, SLOT(chatInfoPlayerInviation(unsigned, unsigned, unsigned))); - connect(this, SIGNAL(signalRejectedGameInvitation(unsigned, unsigned, DenyGameInvitationReason)), myGameLobbyDialog, SLOT(chatInfoPlayerRejectedInviation(unsigned, unsigned, DenyGameInvitationReason))); + connect(this, SIGNAL(signalPlayerGameInvitation(unsigned, unsigned, unsigned)), myGameLobbyDialog, SLOT(chatInfoPlayerInvitation(unsigned, unsigned, unsigned))); + connect(this, SIGNAL(signalRejectedGameInvitation(unsigned, unsigned, DenyGameInvitationReason)), myGameLobbyDialog, SLOT(chatInfoPlayerRejectedInvitation(unsigned, unsigned, DenyGameInvitationReason))); this->show();