diff -r bde641cf53c8 -r e350500c4edb QTfrontend/gameuiconfig.cpp --- a/QTfrontend/gameuiconfig.cpp Thu Apr 04 14:37:19 2013 +0200 +++ b/QTfrontend/gameuiconfig.cpp Tue Jun 04 22:28:12 2013 +0200 @@ -1,6 +1,6 @@ /* * Hedgewars, a free turn based strategy game - * Copyright (c) 2004-2012 Andrey Korotaev + * Copyright (c) 2004-2013 Andrey Korotaev * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include #include #include +#include #include "gameuiconfig.h" #include "hwform.h" @@ -94,8 +95,8 @@ // If left blank reset the resolution to the default wWidth = (wWidth == "" ? widthStr : wWidth); wHeight = (wHeight == "" ? heightStr : wHeight); - Form->ui.pageOptions->windowWidthEdit->setText(wWidth); - Form->ui.pageOptions->windowHeightEdit->setText(wHeight); + Form->ui.pageOptions->windowWidthEdit->setValue(wWidth.toInt()); + Form->ui.pageOptions->windowHeightEdit->setValue(wHeight.toInt()); Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 1 : t); Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool()); @@ -111,7 +112,7 @@ Form->ui.pageOptions->CBFrontendMusic->setChecked(value("frontend/music", true).toBool()); Form->ui.pageOptions->SLVolume->setValue(value("audio/volume", 100).toUInt()); - QString netNick = value("net/nick", "").toString(); + QString netNick = value("net/nick", tr("Guest")+QString("%1").arg(rand())).toString(); Form->ui.pageOptions->editNetNick->setText(netNick); bool savePwd = value("net/savepassword",true).toBool(); Form->ui.pageOptions->CBSavePassword->setChecked(savePwd); @@ -156,7 +157,7 @@ { // load colors QStandardItemModel * model = DataManager::instance().colorsModel(); for(int i = model->rowCount() - 1; i >= 0; --i) - model->item(i)->setData(value(QString("colors/color%1").arg(i), model->item(i)->data())); + model->item(i)->setData(QColor(value(QString("colors/color%1").arg(i), model->item(i)->data()).toString())); } { // load binds @@ -319,7 +320,7 @@ { // save colors QStandardItemModel * model = DataManager::instance().colorsModel(); for(int i = model->rowCount() - 1; i >= 0; --i) - setValue(QString("colors/color%1").arg(i), model->item(i)->data()); + setValue(QString("colors/color%1").arg(i), model->item(i)->data().value().name()); } sync(); @@ -520,14 +521,28 @@ setValue("net/passwordhash", QString()); setValue("net/passwordlength", 0); setValue("net/savepassword", false); //changes the savepassword value to false in order to not let the user save an empty password in PAGE_SETUP - reloadValues(); //reloads the values of PAGE_SETUP + Form->ui.pageOptions->editNetPassword->setEnabled(false); + Form->ui.pageOptions->editNetPassword->setText(""); } void GameUIConfig::setPasswordHash(const QString & passwordhash) { setValue("net/passwordhash", passwordhash); - setValue("net/passwordlength", passwordhash.size()/4); - setNetPasswordLength(passwordhash.size()/4); //the hash.size() is divided by 4 let PAGE_SETUP use a reasonable number of stars to display the PW + if (passwordhash!=NULL && passwordhash.size() > 0) + { + // WTF - the whole point of "password length" was to have the dots match what they typed. This is totally pointless, and all hashes are the same length for a given hash so might as well hardcode it. + // setValue("net/passwordlength", passwordhash.size()/4); + setValue("net/passwordlength", 8); + + // More WTF + //setNetPasswordLength(passwordhash.size()/4); //the hash.size() is divided by 4 let PAGE_SETUP use a reasonable number of stars to display the PW + setNetPasswordLength(8); + } + else + { + setValue("net/passwordlength", 0); + setNetPasswordLength(0); + } } QString GameUIConfig::passwordHash()