GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    : QSettings(fileName, QSettings::IniFormat)
{
    Form = FormWidgets;

    connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));

    //Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt());
    resizeToConfigValues();

    Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltips", true).toBool());

    int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
    Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
    Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
    bool ffscr=value("frontend/fullscreen", false).toBool();
    Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr);

    Form->ui.pageOptions->SLQuality->setValue(value("video/quality", 5).toUInt());
    Form->ui.pageOptions->CBStereoMode->setCurrentIndex(value("video/stereo", 0).toUInt());
    Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
    Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
    Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/sound", true).toBool());
    Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
    Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("frontend/music", true).toBool());
    Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());

    QString netNick = value("net/nick", "").toString();
    if (netNick.isEmpty())
        netNick = QInputDialog::getText(Form,
                QObject::tr("Nickname"),
                QObject::tr("Please enter your nickname"),
                QLineEdit::Normal,
                QDir::home().dirName());

    Form->ui.pageOptions->editNetNick->setText(netNick);

    delete netHost;
    netHost = new QString(value("net/ip", "").toString());
    netPort = value("net/port", 46631).toUInt();

    Form->ui.pageNetServer->leServerDescr->setText(value("net/servername", "hedgewars server").toString());
    Form->ui.pageNetServer->sbPort->setValue(value("net/serverport", 46631).toUInt());

    Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool());
    Form->ui.pageOptions->fpsedit->setValue(value("fps/limit", 27).toUInt());

    Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
    Form->ui.pageOptions->CBNameWithDate->setChecked(value("misc/appendTimeToRecords", false).toBool());

#ifdef SPARKLE_ENABLED
        Form->ui.pageOptions->CBAutoUpdate->setChecked(value("misc/autoUpdate", true).toBool());
#endif

    Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString()));

    depth = QApplication::desktop()->depth();
    if (depth < 16) depth = 16;
    else if (depth > 16) depth = 32;
}
Example #2
0
GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    : QSettings(fileName, QSettings::IniFormat, FormWidgets)
{
    Form = FormWidgets;

    setIniCodec("UTF-8");

    connect(Form->ui.pageOptions->CBFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));

    for(int i = 0; i < BINDS_NUMBER; i++)
    {
        m_binds.append(BindAction());
        m_binds[i].action = cbinds[i].action;
        m_binds[i].strbind = cbinds[i].strbind;
    }

    //Form->resize(value("frontend/width", 640).toUInt(), value("frontend/height", 450).toUInt());
    resizeToConfigValues();

    reloadValues();
#ifdef VIDEOREC
    reloadVideosValues();
#endif
}