--- a/QTfrontend/gameuiconfig.cpp Sat Mar 06 10:54:24 2010 +0000
+++ b/QTfrontend/gameuiconfig.cpp Sat Mar 06 10:59:20 2010 +0000
@@ -30,77 +30,77 @@
#include "fpsedit.h"
GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
- : QSettings(fileName, QSettings::IniFormat)
+ : QSettings(fileName, QSettings::IniFormat)
{
- Form = FormWidgets;
+ Form = FormWidgets;
- connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
+ connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
- //Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
- resizeToConfigValues();
+ //Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
+ resizeToConfigValues();
- Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltip", true).toBool());
+ Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltip", 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("video/frontendfullscreen", false).toBool();
- Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr);
+ 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("video/frontendfullscreen", false).toBool();
+ Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr);
- Form->ui.pageOptions->CBReduceQuality->setChecked(value("video/reducequality", false).toBool());
- Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
- Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
- Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("audio/frontendsound", true).toBool());
+ Form->ui.pageOptions->CBReduceQuality->setChecked(value("video/reducequality", false).toBool());
+ Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
+ Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
+ Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("audio/frontendsound", true).toBool());
#ifdef _WIN32
-// Form->ui.pageOptions->CBHardwareSound->setChecked(value("audio/hardware", false).toBool());
+// Form->ui.pageOptions->CBHardwareSound->setChecked(value("audio/hardware", false).toBool());
#endif
- Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
- Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("audio/frontendmusic", true).toBool());
- Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
+ Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
+ Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("audio/frontendmusic", 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());
+ 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);
+ Form->ui.pageOptions->editNetNick->setText(netNick);
- delete netHost;
- netHost = new QString(value("net/ip", "").toString());
- netPort = value("net/port", 46631).toUInt();
+ 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.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/interval", 27).toUInt());
+ Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool());
+ Form->ui.pageOptions->fpsedit->setValue(value("fps/interval", 27).toUInt());
- Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
- Form->ui.pageOptions->CBNameWithDate->setChecked(value("misc/appendTimeToRecords", false).toBool());
+ 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()));
+ 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;
+ depth = QApplication::desktop()->depth();
+ if (depth < 16) depth = 16;
+ else if (depth > 16) depth = 32;
}
QStringList GameUIConfig::GetTeamsList()
{
- QStringList teamslist = cfgdir->entryList(QStringList("*.cfg"));
- QStringList cleanedList;
- for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
+ QStringList teamslist = cfgdir->entryList(QStringList("*.cfg"));
+ QStringList cleanedList;
+ for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
QString tmpTeamStr=(*it).replace(QRegExp("^(.*)\\.cfg$"), "\\1");
cleanedList.push_back(tmpTeamStr);
- }
- return cleanedList;
+ }
+ return cleanedList;
}
void GameUIConfig::resizeToConfigValues()
@@ -110,46 +110,46 @@
void GameUIConfig::SaveOptions()
{
- setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
- setValue("video/fullscreen", vid_Fullscreen());
+ setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
+ setValue("video/fullscreen", vid_Fullscreen());
- setValue("video/reducequality", isReducedQuality());
+ setValue("video/reducequality", isReducedQuality());
- setValue("video/frontendeffects", isFrontendEffects());
+ setValue("video/frontendeffects", isFrontendEffects());
- setValue("misc/weaponTooltip", isWeaponTooltip());
+ setValue("misc/weaponTooltip", isWeaponTooltip());
- bool ffscr = isFrontendFullscreen();
- setValue("video/frontendfullscreen", ffscr);
- emit frontendFullscreen(ffscr);
- if (!ffscr) {
- setValue("window/width", Form->width());
- setValue("window/height", Form->height());
- } else {
- //resizeToConfigValues(); // TODO: why this has been made?
- }
+ bool ffscr = isFrontendFullscreen();
+ setValue("video/frontendfullscreen", ffscr);
+ emit frontendFullscreen(ffscr);
+ if (!ffscr) {
+ setValue("window/width", Form->width());
+ setValue("window/height", Form->height());
+ } else {
+ //resizeToConfigValues(); // TODO: why this has been made?
+ }
- setValue("audio/sound", isSoundEnabled());
- setValue("audio/frontendsound", isFrontendSoundEnabled());
+ setValue("audio/sound", isSoundEnabled());
+ setValue("audio/frontendsound", isFrontendSoundEnabled());
#ifdef _WIN32
-// setValue("audio/hardware", isSoundHardware());
+// setValue("audio/hardware", isSoundHardware());
#endif
- setValue("audio/music", isMusicEnabled());
- setValue("audio/frontendmusic", isFrontendMusicEnabled());
- setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
+ setValue("audio/music", isMusicEnabled());
+ setValue("audio/frontendmusic", isFrontendMusicEnabled());
+ setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
- setValue("net/nick", netNick());
- setValue("net/ip", *netHost);
- setValue("net/port", netPort);
- setValue("net/servername", Form->ui.pageNetServer->leServerDescr->text());
- setValue("net/serverport", Form->ui.pageNetServer->sbPort->value());
+ setValue("net/nick", netNick());
+ setValue("net/ip", *netHost);
+ setValue("net/port", netPort);
+ setValue("net/servername", Form->ui.pageNetServer->leServerDescr->text());
+ setValue("net/serverport", Form->ui.pageNetServer->sbPort->value());
- setValue("fps/show", isShowFPSEnabled());
- setValue("fps/interval", Form->ui.pageOptions->fpsedit->value());
+ setValue("fps/show", isShowFPSEnabled());
+ setValue("fps/interval", Form->ui.pageOptions->fpsedit->value());
- setValue("misc/altdamage", isAltDamageEnabled());
- setValue("misc/appendTimeToRecords", appendDateTimeToRecordName());
- setValue("misc/locale", language());
+ setValue("misc/altdamage", isAltDamageEnabled());
+ setValue("misc/appendTimeToRecords", appendDateTimeToRecordName());
+ setValue("misc/locale", language());
#ifdef SPARKLE_ENABLED
setValue("misc/autoUpdate", isAutoUpdateEnabled());
@@ -159,24 +159,24 @@
QString GameUIConfig::language()
{
- return Form->ui.pageOptions->CBLanguage->itemData(Form->ui.pageOptions->CBLanguage->currentIndex()).toString();
+ return Form->ui.pageOptions->CBLanguage->itemData(Form->ui.pageOptions->CBLanguage->currentIndex()).toString();
}
QRect GameUIConfig::vid_Resolution()
{
- QRect result(0, 0, 640, 480);
- QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x');
- if (wh.size() == 2)
- {
- result.setWidth(wh[0].toInt());
- result.setHeight(wh[1].toInt());
- }
- return result;
+ QRect result(0, 0, 640, 480);
+ QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x');
+ if (wh.size() == 2)
+ {
+ result.setWidth(wh[0].toInt());
+ result.setHeight(wh[1].toInt());
+ }
+ return result;
}
bool GameUIConfig::vid_Fullscreen()
{
- return Form->ui.pageOptions->CBFullscreen->isChecked();
+ return Form->ui.pageOptions->CBFullscreen->isChecked();
}
bool GameUIConfig::isReducedQuality() const
@@ -200,43 +200,43 @@
bool GameUIConfig::isSoundEnabled()
{
- return Form->ui.pageOptions->CBEnableSound->isChecked();
+ return Form->ui.pageOptions->CBEnableSound->isChecked();
}
bool GameUIConfig::isFrontendSoundEnabled()
{
- return Form->ui.pageOptions->CBEnableFrontendSound->isChecked();
+ return Form->ui.pageOptions->CBEnableFrontendSound->isChecked();
}
#ifdef _WIN32
bool GameUIConfig::isSoundHardware()
{
-// return Form->ui.pageOptions->CBHardwareSound->isChecked();
+// return Form->ui.pageOptions->CBHardwareSound->isChecked();
return false;
}
#endif
bool GameUIConfig::isMusicEnabled()
{
- return Form->ui.pageOptions->CBEnableMusic->isChecked();
+ return Form->ui.pageOptions->CBEnableMusic->isChecked();
}
bool GameUIConfig::isFrontendMusicEnabled()
{
- return Form->ui.pageOptions->CBEnableFrontendMusic->isChecked();
+ return Form->ui.pageOptions->CBEnableFrontendMusic->isChecked();
}
bool GameUIConfig::isShowFPSEnabled()
{
- return Form->ui.pageOptions->CBShowFPS->isChecked();
+ return Form->ui.pageOptions->CBShowFPS->isChecked();
}
bool GameUIConfig::isAltDamageEnabled()
{
- return Form->ui.pageOptions->CBAltDamage->isChecked();
+ return Form->ui.pageOptions->CBAltDamage->isChecked();
}
bool GameUIConfig::appendDateTimeToRecordName()
{
- return Form->ui.pageOptions->CBNameWithDate->isChecked();
+ return Form->ui.pageOptions->CBNameWithDate->isChecked();
}
#ifdef SPARKLE_ENABLED
@@ -248,20 +248,20 @@
quint8 GameUIConfig::timerInterval()
{
- return 35 - Form->ui.pageOptions->fpsedit->value();
+ return 35 - Form->ui.pageOptions->fpsedit->value();
}
quint8 GameUIConfig::bitDepth()
{
- return depth;
+ return depth;
}
QString GameUIConfig::netNick()
{
- return Form->ui.pageOptions->editNetNick->text();
+ return Form->ui.pageOptions->editNetNick->text();
}
quint8 GameUIConfig::volume()
{
- return Form->ui.pageOptions->volumeBox->value() * 128 / 100;
+ return Form->ui.pageOptions->volumeBox->value() * 128 / 100;
}