QTfrontend/gameuiconfig.cpp
changeset 8297 b236e3afed0d
parent 8295 6ef114ea2298
child 8298 f9e6da8f94b1
equal deleted inserted replaced
8296:455da122c0ad 8297:b236e3afed0d
   231     setValue("audio/music", isMusicEnabled());
   231     setValue("audio/music", isMusicEnabled());
   232     setValue("frontend/music", isFrontendMusicEnabled());
   232     setValue("frontend/music", isFrontendMusicEnabled());
   233     setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
   233     setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
   234 
   234 
   235     setValue("net/nick", netNick());
   235     setValue("net/nick", netNick());
   236     if ((netPasswordLength()==0)) {
   236     if (netPasswordIsValid() && Form->ui.pageOptions->CBSavePassword->isChecked()) {
   237 	setValue("net/passwordhash", "");
   237 	setPasswordHash(netPasswordHash());
   238         setValue("net/passwordlength", 0);
   238     }
   239     }
   239     else if(!Form->ui.pageOptions->CBSavePassword->isChecked()) {
   240     else if (netPasswordIsValid() && Form->ui.pageOptions->CBSavePassword->isChecked()) {
   240         clearPasswordHash();
   241 	setValue("net/passwordhash", "");
       
   242 	setValue("net/passwordlength", 0);
       
   243     }
   241     }
   244 
   242 
   245     setValue("net/savepassword", Form->ui.pageOptions->CBSavePassword->isChecked());
   243     setValue("net/savepassword", Form->ui.pageOptions->CBSavePassword->isChecked());
   246     setValue("net/ip", *netHost);
   244     setValue("net/ip", *netHost);
   247     setValue("net/port", netPort);
   245     setValue("net/port", netPort);
   488 }
   486 }
   489 
   487 
   490 void GameUIConfig::setPasswordHash(const QString & passwordhash)
   488 void GameUIConfig::setPasswordHash(const QString & passwordhash)
   491 {
   489 {
   492     setValue("net/passwordhash", passwordhash);
   490     setValue("net/passwordhash", passwordhash);
   493     setValue("net/passwordlength", passwordhash.size());
   491     setValue("net/passwordlength", passwordhash.size()/4);
   494     setNetPasswordLength(passwordhash.size());
   492     setNetPasswordLength(passwordhash.size()/4);  //the hash.size() is divided by 4 let PAGE_SETUP use a reasonable number of stars to display the PW
   495 }
   493 }
   496 
   494 
   497 QString GameUIConfig::passwordHash()
   495 QString GameUIConfig::passwordHash()
   498 {
   496 {
   499     return value("net/passwordhash").toString();
   497     return value("net/passwordhash").toString();