QTfrontend/gameuiconfig.cpp
changeset 2776 9572aae13d49
parent 2773 e94f240a8a41
child 2898 c53636f556f8
equal deleted inserted replaced
2775:3445ce5e9c79 2776:9572aae13d49
    32 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    32 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    33 	: QSettings(fileName, QSettings::IniFormat)
    33 	: QSettings(fileName, QSettings::IniFormat)
    34 {
    34 {
    35 	Form = FormWidgets;
    35 	Form = FormWidgets;
    36 
    36 
    37 	connect(Form->ui.pageOptions->CBEnableMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
    37 	connect(Form->ui.pageOptions->CBEnableFrontendMusic, SIGNAL(toggled(bool)), Form, SLOT(Music(bool)));
    38 
    38 
    39 	//Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
    39 	//Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
    40 	resizeToConfigValues();
    40 	resizeToConfigValues();
    41 
    41 
    42 	Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/WeaponTooltip", true).toBool());
    42 	Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/WeaponTooltip", true).toBool());
    48 	Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr);
    48 	Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr);
    49 
    49 
    50 	Form->ui.pageOptions->CBReduceQuality->setChecked(value("video/reducequality", false).toBool());
    50 	Form->ui.pageOptions->CBReduceQuality->setChecked(value("video/reducequality", false).toBool());
    51 	Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
    51 	Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
    52 	Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
    52 	Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
       
    53 	Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("audio/frontendsound", true).toBool());
    53 #ifdef _WIN32
    54 #ifdef _WIN32
    54 //	Form->ui.pageOptions->CBHardwareSound->setChecked(value("audio/hardware", false).toBool());
    55 //	Form->ui.pageOptions->CBHardwareSound->setChecked(value("audio/hardware", false).toBool());
    55 #endif
    56 #endif
    56 	Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
    57 	Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
       
    58 	Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("audio/frontendmusic", true).toBool());
    57 	Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
    59 	Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
    58 
    60 
    59 	QString netNick = value("net/nick", "").toString();
    61 	QString netNick = value("net/nick", "").toString();
    60 	if (netNick.isEmpty())
    62 	if (netNick.isEmpty())
    61 		netNick = QInputDialog::getText(Form,
    63 		netNick = QInputDialog::getText(Form,
   124 	} else {
   126 	} else {
   125 	  //resizeToConfigValues(); // TODO: why this has been made?
   127 	  //resizeToConfigValues(); // TODO: why this has been made?
   126 	}
   128 	}
   127 
   129 
   128 	setValue("audio/sound", isSoundEnabled());
   130 	setValue("audio/sound", isSoundEnabled());
       
   131 	setValue("audio/frontendsound", isFrontendSoundEnabled());
   129 #ifdef _WIN32
   132 #ifdef _WIN32
   130 //	setValue("audio/hardware", isSoundHardware());
   133 //	setValue("audio/hardware", isSoundHardware());
   131 #endif
   134 #endif
   132 	setValue("audio/music", isMusicEnabled());
   135 	setValue("audio/music", isMusicEnabled());
       
   136 	setValue("audio/frontendmusic", isFrontendMusicEnabled());
   133 	setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
   137 	setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
   134 
   138 
   135 	setValue("net/nick", netNick());
   139 	setValue("net/nick", netNick());
   136 	setValue("net/ip", *netHost);
   140 	setValue("net/ip", *netHost);
   137 	setValue("net/port", netPort);
   141 	setValue("net/port", netPort);
   188 
   192 
   189 bool GameUIConfig::isSoundEnabled()
   193 bool GameUIConfig::isSoundEnabled()
   190 {
   194 {
   191 	return Form->ui.pageOptions->CBEnableSound->isChecked();
   195 	return Form->ui.pageOptions->CBEnableSound->isChecked();
   192 }
   196 }
       
   197 bool GameUIConfig::isFrontendSoundEnabled()
       
   198 {
       
   199 	return Form->ui.pageOptions->CBEnableFrontendSound->isChecked();
       
   200 }
   193 
   201 
   194 #ifdef _WIN32
   202 #ifdef _WIN32
   195 bool GameUIConfig::isSoundHardware()
   203 bool GameUIConfig::isSoundHardware()
   196 {
   204 {
   197 //	return Form->ui.pageOptions->CBHardwareSound->isChecked();
   205 //	return Form->ui.pageOptions->CBHardwareSound->isChecked();
   201 
   209 
   202 bool GameUIConfig::isMusicEnabled()
   210 bool GameUIConfig::isMusicEnabled()
   203 {
   211 {
   204 	return Form->ui.pageOptions->CBEnableMusic->isChecked();
   212 	return Form->ui.pageOptions->CBEnableMusic->isChecked();
   205 }
   213 }
       
   214 bool GameUIConfig::isFrontendMusicEnabled()
       
   215 {
       
   216 	return Form->ui.pageOptions->CBEnableFrontendMusic->isChecked();
       
   217 }
   206 
   218 
   207 bool GameUIConfig::isShowFPSEnabled()
   219 bool GameUIConfig::isShowFPSEnabled()
   208 {
   220 {
   209 	return Form->ui.pageOptions->CBShowFPS->isChecked();
   221 	return Form->ui.pageOptions->CBShowFPS->isChecked();
   210 }
   222 }