QTfrontend/gameuiconfig.cpp
changeset 6911 1cda333286e0
parent 6700 e04da46ee43c
child 6952 7f70f37bbf08
equal deleted inserted replaced
6910:ea058558c68b 6911:1cda333286e0
    39     connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
    39     connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
    40 
    40 
    41     //Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt());
    41     //Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt());
    42     resizeToConfigValues();
    42     resizeToConfigValues();
    43 
    43 
       
    44     reloadValues();
       
    45 }
       
    46 
       
    47 void GameUIConfig::reloadValues(void)
       
    48 {
    44     Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltips", true).toBool());
    49     Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltips", true).toBool());
    45 
    50 
    46     int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
    51     int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
    47     if (t < 0)
    52     if (t < 0)
    48     {
    53     {
    66     Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("frontend/music", true).toBool());
    71     Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("frontend/music", true).toBool());
    67     Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
    72     Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
    68 
    73 
    69     QString netNick = value("net/nick", "").toString();
    74     QString netNick = value("net/nick", "").toString();
    70     Form->ui.pageOptions->editNetNick->setText(netNick);
    75     Form->ui.pageOptions->editNetNick->setText(netNick);
       
    76     bool savePwd = value("net/savepassword",true).toBool();
       
    77     Form->ui.pageOptions->CBSavePassword->setChecked(savePwd);
    71 
    78 
    72     Form->ui.pageOptions->editNetPassword->installEventFilter(this);
    79     Form->ui.pageOptions->editNetPassword->installEventFilter(this);
    73 
    80 
    74     int passLength = value("net/passwordlength", 0).toInt();
    81     int passLength = value("net/passwordlength", 0).toInt();
    75     setNetPasswordLength(passLength);
    82     setNetPasswordLength(passLength);
       
    83     if (savePwd == false) {
       
    84         Form->ui.pageOptions->editNetPassword->setEnabled(savePwd);
       
    85         Form->ui.pageOptions->editNetPassword->setText("");
       
    86         setNetPasswordLength(0);        
       
    87     }
    76 
    88 
    77     delete netHost;
    89     delete netHost;
    78     netHost = new QString(value("net/ip", "").toString());
    90     netHost = new QString(value("net/ip", "").toString());
    79     netPort = value("net/port", 46631).toUInt();
    91     netPort = value("net/port", 46631).toUInt();
    80 
    92 
   147     setValue("audio/music", isMusicEnabled());
   159     setValue("audio/music", isMusicEnabled());
   148     setValue("frontend/music", isFrontendMusicEnabled());
   160     setValue("frontend/music", isFrontendMusicEnabled());
   149     setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
   161     setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
   150 
   162 
   151     setValue("net/nick", netNick());
   163     setValue("net/nick", netNick());
   152     if (netPasswordIsValid())
   164     if (netPasswordIsValid() && Form->ui.pageOptions->CBSavePassword->isChecked())
   153     {
   165     {
   154         setValue("net/passwordhash", netPasswordHash());
   166         setValue("net/passwordhash", netPasswordHash());
   155         setValue("net/passwordlength", netPasswordLength());
   167         setValue("net/passwordlength", netPasswordLength());
   156     }
   168     }
       
   169     setValue("net/savepassword", Form->ui.pageOptions->CBSavePassword->isChecked());
   157     setValue("net/ip", *netHost);
   170     setValue("net/ip", *netHost);
   158     setValue("net/port", netPort);
   171     setValue("net/port", netPort);
   159     setValue("net/servername", Form->ui.pageNetServer->leServerDescr->text());
   172     setValue("net/servername", Form->ui.pageNetServer->leServerDescr->text());
   160     setValue("net/serverport", Form->ui.pageNetServer->sbPort->value());
   173     setValue("net/serverport", Form->ui.pageNetServer->sbPort->value());
   161 
   174