QTfrontend/gameuiconfig.cpp
changeset 7565 00568d3054d0
parent 7347 88685fbb2679
parent 7541 e51b11349637
child 7633 d4251e519062
equal deleted inserted replaced
7544:a72ace943bfd 7565:00568d3054d0
    20 #include <QCheckBox>
    20 #include <QCheckBox>
    21 #include <QLineEdit>
    21 #include <QLineEdit>
    22 #include <QDesktopWidget>
    22 #include <QDesktopWidget>
    23 #include <QInputDialog>
    23 #include <QInputDialog>
    24 #include <QCryptographicHash>
    24 #include <QCryptographicHash>
       
    25 #include <QStandardItemModel>
    25 
    26 
    26 #include "gameuiconfig.h"
    27 #include "gameuiconfig.h"
    27 #include "hwform.h"
    28 #include "hwform.h"
    28 #include "pageoptions.h"
    29 #include "pageoptions.h"
    29 #include "pagevideos.h"
    30 #include "pagevideos.h"
    30 #include "pagenetserver.h"
    31 #include "pagenetserver.h"
    31 #include "hwconsts.h"
    32 #include "hwconsts.h"
    32 #include "fpsedit.h"
    33 #include "fpsedit.h"
    33 #include "HWApplication.h"
    34 #include "HWApplication.h"
       
    35 #include "DataManager.h"
    34 
    36 
    35 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    37 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    36     : QSettings(fileName, QSettings::IniFormat)
    38     : QSettings(fileName, QSettings::IniFormat)
    37 {
    39 {
    38     Form = FormWidgets;
    40     Form = FormWidgets;
   108     Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString()));
   110     Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString()));
   109 
   111 
   110     depth = HWApplication::desktop()->depth();
   112     depth = HWApplication::desktop()->depth();
   111     if (depth < 16) depth = 16;
   113     if (depth < 16) depth = 16;
   112     else if (depth > 16) depth = 32;
   114     else if (depth > 16) depth = 32;
       
   115 
       
   116     { // load colors
       
   117         QStandardItemModel * model = DataManager::instance().colorsModel();
       
   118         for(int i = model->rowCount() - 1; i >= 0; --i)
       
   119             model->item(i)->setData(QColor(value(QString("colors/color%1").arg(i), model->item(i)->data().value<QColor>()).value<QColor>()));
       
   120     }
   113 }
   121 }
   114 
   122 
   115 void GameUIConfig::reloadVideosValues(void)
   123 void GameUIConfig::reloadVideosValues(void)
   116 {
   124 {
   117     Form->ui.pageVideos->framerateBox->setValue(value("videorec/fps",25).toUInt());
   125     Form->ui.pageVideos->framerateBox->setValue(value("videorec/fps",25).toUInt());
   205     setValue("misc/locale", language());
   213     setValue("misc/locale", language());
   206 
   214 
   207 #ifdef SPARKLE_ENABLED
   215 #ifdef SPARKLE_ENABLED
   208     setValue("misc/autoUpdate", isAutoUpdateEnabled());
   216     setValue("misc/autoUpdate", isAutoUpdateEnabled());
   209 #endif
   217 #endif
       
   218 
       
   219     { // save colors
       
   220         QStandardItemModel * model = DataManager::instance().colorsModel();
       
   221         for(int i = model->rowCount() - 1; i >= 0; --i)
       
   222             setValue(QString("colors/color%1").arg(i), model->item(i)->data());
       
   223     }
   210 
   224 
   211     Form->gameSettings->sync();
   225     Form->gameSettings->sync();
   212 }
   226 }
   213 
   227 
   214 void GameUIConfig::SaveVideosOptions()
   228 void GameUIConfig::SaveVideosOptions()