fix >= 0.7.1 update problems with PokerTH distributed default styles

This commit is contained in:
doitux
2010-07-11 20:36:50 +00:00
parent f2dc22324e
commit bd01ffad9f
11 changed files with 68 additions and 11 deletions
+2
View File
@@ -47,6 +47,8 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
myQtToolsInterface = CreateQtToolsWrapper();
myConfigState = OK;
// !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 83;
+2 -1
View File
@@ -25,7 +25,7 @@
#include <boost/thread.hpp>
enum ConfigState { NONEXISTING, OLD };
enum ConfigState { NONEXISTING, OLD, OK };
enum ConfigType { CONFIG_TYPE_INT, CONFIG_TYPE_STRING, CONFIG_TYPE_INT_LIST, CONFIG_TYPE_STRING_LIST };
class QtToolsInterface;
@@ -40,6 +40,7 @@ public:
void writeBuffer() const;
void updateConfig(ConfigState);
ConfigState getConfigState() const { return myConfigState; }
std::string readConfigString(std::string varName) const;
std::list<std::string> readConfigStringList(std::string varName) const;
+2
View File
@@ -35,5 +35,7 @@ Replay::Replay() : replaySqliteLogDb(0)
Replay::~Replay()
{
replaySqliteLogDb->close();
delete replaySqliteLogDb;
}
+1 -1
View File
@@ -659,7 +659,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) {
}
refreshGameTableStyle();
qDebug() << "table: " << myGameTableStyle->getStyleDescription() << myGameTableStyle->getState();
// qDebug() << "table: " << myGameTableStyle->getStyleDescription() << myGameTableStyle->getState();
if(this->isVisible() && myGameTableStyle->getState() != GT_STYLE_OK) myGameTableStyle->showErrorMessage();
//blind buttons refresh
+3 -1
View File
@@ -191,14 +191,16 @@ Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), my
Log::~Log()
{
qDebug() << "close log";
// Datenbank schließen
// Datenbank schließe
mySqliteLogDb->close();
delete myConfig;
delete myLogDir;
delete myHtmlLogFile;
delete mySqliteLogDb;
myConfig = 0;
}
+2
View File
@@ -43,6 +43,8 @@ GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myLog(NULL), myW(NUL
GuiWrapper::~GuiWrapper()
{
delete myLog;
}
void GuiWrapper::initGui(int speed) { myW->signalInitGui(speed); }
@@ -127,8 +127,8 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
}
void settingsDialogImpl::exec() {
void settingsDialogImpl::prepareDialog()
{
playerNickIsChanged = FALSE;
//Player Nicks
@@ -442,7 +442,6 @@ void settingsDialogImpl::exec() {
refreshLogFileList();
bool tmpHasIpv6 = socket_has_ipv6();
bool tmpHasSctp = socket_has_sctp();
checkBox_useIpv6->setEnabled(tmpHasIpv6);
@@ -468,7 +467,11 @@ void settingsDialogImpl::exec() {
//set this AFTER switch combobox like config-settings. This IS a currentIndexChanged() ;-)
languageIsChanged = FALSE;
}
void settingsDialogImpl::exec() {
prepareDialog();
QDialog::exec();
}
@@ -983,6 +986,7 @@ void settingsDialogImpl::showCurrentGameTableStylePreview()
QString MinimumSize = tr("Minimum Size");
QString MaximumSize = tr("Maximum Size");
QString FixedSize = tr("Fixed Size");
QString State = tr("State");
QString windowsSubString;
if(style.getIfFixedWindowSize().toInt()) {
@@ -997,7 +1001,8 @@ void settingsDialogImpl::showCurrentGameTableStylePreview()
maintainerEMailString = "<b>"+MaintainerEMail+":</b> "+style.getStyleMaintainerEMail()+"<br>";
}
label_gameTableStyleInfo->setText("<b>"+MaintainerName+":</b> "+style.getStyleMaintainerName()+"<br>"+maintainerEMailString+"<b>"+CreateDate+":</b> "+style.getStyleCreateDate()+"<br>"+windowsSubString);
label_gameTableStyleInfo->setWordWrap(TRUE);
label_gameTableStyleInfo->setText("<b>"+MaintainerName+":</b> "+style.getStyleMaintainerName()+"<br>"+maintainerEMailString+"<b>"+CreateDate+":</b> "+style.getStyleCreateDate()+"<br>"+windowsSubString+"<br><b>"+State+": </b>"+style.getMyStateToolTipInfo());
//active the current selected item directly
setSelectedGameTableStyleActivated();
@@ -40,7 +40,8 @@ class settingsDialogImpl: public QDialog, public Ui::settingsDialog {
Q_OBJECT
public:
settingsDialogImpl(QWidget *parent = 0, ConfigFile *c = 0, selectAvatarDialogImpl *s = 0);
void prepareDialog();
void exec();
void setPlayerNickIsChanged(bool theValue){ playerNickIsChanged = theValue;}
@@ -166,6 +166,27 @@ startWindowImpl::startWindowImpl(ConfigFile *c)
this->show();
//update HACKS
if(!checkForFirstStartAfterUpdated().isEmpty()) {
qDebug() << checkForFirstStartAfterUpdated();
}
}
startWindowImpl::~startWindowImpl()
{
delete myNewGameDialog;
delete mySelectAvatarDialog;
delete mySettingsDialog;
delete myChangeHumanPlayerNameDialog;
delete myJoinNetworkGameDialog;
delete myConnectToServerDialog;
delete myStartNetworkGameDialog;
delete myCreateNetworkGameDialog;
delete myAboutPokerthDialog;
delete myGameLobbyDialog;
delete myTimeoutDialog;
delete myServerListDialog;
delete myInternetGameLoginDialog;
}
void startWindowImpl::callNewGameDialog() {
@@ -897,3 +918,21 @@ QStringList startWindowImpl::getPlayerNicksList() {
return list;
}
QString startWindowImpl::checkForFirstStartAfterUpdated()
{
if(myConfig->getConfigState() == OLD) {
if(POKERTH_VERSION_MAJOR == 0 && POKERTH_VERSION_MINOR == 80) {
//version 0.8 HACK
//to avoid old PokerTH distributed styles pathes in settings which leads to error message like "outdated" prepare settings dialog (fallback will correct this issue) and save settings
mySettingsDialog->prepareDialog();
mySettingsDialog->isAccepted();
myGuiInterface->getMyW()->applySettings(mySettingsDialog);
}
return QString("Update old config to version %1").arg(QString::number(POKERTH_VERSION_MAJOR)+"."+QString::number(POKERTH_VERSION_MINOR));
}
return QString();
}
+3
View File
@@ -50,6 +50,7 @@ class startWindowImpl: public QMainWindow, public Ui::startWindow {
Q_OBJECT
public:
startWindowImpl(ConfigFile *c =0);
~startWindowImpl();
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
@@ -123,6 +124,8 @@ public slots:
void networkStart(boost::shared_ptr<Game> game);
QStringList getPlayerNicksList();
QString checkForFirstStartAfterUpdated();
private:
ConfigFile *myConfig;
+3 -3
View File
@@ -606,10 +606,10 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(ChatLogTextSize == "") { ChatLogTextSize = getFallBackFieldContent("ChatLogTextSize", 0); leftItems << "ChatLogTextSize"; }
//set loadedSuccessfull TRUE if everything works
qDebug() << "leftitem is empty: " << leftItems.isEmpty() << "pics left is empty: " << itemPicsLeft.isEmpty() << "stylefileversion is: " << PokerTHStyleFileVersion;
// qDebug() << "leftitem is empty: " << leftItems.isEmpty() << "pics left is empty: " << itemPicsLeft.isEmpty() << "stylefileversion is: " << PokerTHStyleFileVersion;
if(leftItems.isEmpty() && itemPicsLeft.isEmpty() && PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() == POKERTH_GT_STYLE_FILE_VERSION) {
myState = GT_STYLE_OK;
qDebug() << "myState of: " << StyleDescription << "is now: " << myState;
// qDebug() << "myState of: " << StyleDescription << "is now: " << myState;
}
else {
//check for style file version
@@ -624,7 +624,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(!itemPicsLeft.isEmpty() && myW != 0) myState = GT_STYLE_PICTURES_MISSING;
}
qDebug() << "myState of: " << StyleDescription << "is now: " << myState;
// qDebug() << "myState of: " << StyleDescription << "is now: " << myState;
}
loadedSuccessfull = 1;
}