QTfrontend/gameuiconfig.cpp
changeset 3708 64e059b6f9c5
parent 3695 c11abf387a7d
child 3759 f352e9dcf516
equal deleted inserted replaced
3706:a79784328c03 3708:64e059b6f9c5
    45     Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
    45     Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
    46     Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
    46     Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
    47     bool ffscr=value("frontend/fullscreen", false).toBool();
    47     bool ffscr=value("frontend/fullscreen", false).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->SLQuality->setValue(value("video/quality", 5).toUInt());
    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("frontend/sound", true).toBool());
    53     Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/sound", true).toBool());
    54 #ifdef _WIN32
       
    55 //  Form->ui.pageOptions->CBHardwareSound->setChecked(value("audio/hardware", false).toBool());
       
    56 #endif
       
    57     Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
    54     Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
    58     Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("frontend/music", true).toBool());
    55     Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("frontend/music", true).toBool());
    59     Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
    56     Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
    60 
    57 
    61     QString netNick = value("net/nick", "").toString();
    58     QString netNick = value("net/nick", "").toString();
   113 void GameUIConfig::SaveOptions()
   110 void GameUIConfig::SaveOptions()
   114 {
   111 {
   115     setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
   112     setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
   116     setValue("video/fullscreen", vid_Fullscreen());
   113     setValue("video/fullscreen", vid_Fullscreen());
   117 
   114 
   118     setValue("video/reducequality", isReducedQuality());
   115     setValue("video/quality", Form->ui.pageOptions->SLQuality->value());
   119 
   116 
   120     setValue("frontend/effects", isFrontendEffects());
   117     setValue("frontend/effects", isFrontendEffects());
   121 
   118 
   122     setValue("misc/weaponTooltips", isWeaponTooltip());
   119     setValue("misc/weaponTooltips", Form->ui.pageOptions->WeaponTooltip->isChecked());
   123 
   120 
   124     bool ffscr = isFrontendFullscreen();
   121     bool ffscr = isFrontendFullscreen();
   125     setValue("frontend/fullscreen", ffscr);
   122     setValue("frontend/fullscreen", ffscr);
   126     emit frontendFullscreen(ffscr);
   123     emit frontendFullscreen(ffscr);
   127     if (!ffscr) {
   124     if (!ffscr) {
   131       //resizeToConfigValues(); // TODO: why this has been made?
   128       //resizeToConfigValues(); // TODO: why this has been made?
   132     }
   129     }
   133 
   130 
   134     setValue("audio/sound", isSoundEnabled());
   131     setValue("audio/sound", isSoundEnabled());
   135     setValue("frontend/sound", isFrontendSoundEnabled());
   132     setValue("frontend/sound", isFrontendSoundEnabled());
   136 #ifdef _WIN32
       
   137 //  setValue("audio/hardware", isSoundHardware());
       
   138 #endif
       
   139     setValue("audio/music", isMusicEnabled());
   133     setValue("audio/music", isMusicEnabled());
   140     setValue("frontend/music", isFrontendMusicEnabled());
   134     setValue("frontend/music", isFrontendMusicEnabled());
   141     setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
   135     setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
   142 
   136 
   143     setValue("net/nick", netNick());
   137     setValue("net/nick", netNick());
   179 bool GameUIConfig::vid_Fullscreen()
   173 bool GameUIConfig::vid_Fullscreen()
   180 {
   174 {
   181     return Form->ui.pageOptions->CBFullscreen->isChecked();
   175     return Form->ui.pageOptions->CBFullscreen->isChecked();
   182 }
   176 }
   183 
   177 
   184 bool GameUIConfig::isReducedQuality() const
   178 quint32 GameUIConfig::translateQuality()
   185 {
   179 {
   186   return Form->ui.pageOptions->CBReduceQuality->isChecked();
   180     quint32 rqNone = 0x00000000;  // don't reduce quality
   187 }
   181     quint32 rqLowRes = 0x00000001;  // use half land array
       
   182     quint32 rqBlurryLand = 0x00000002;  // downscaled terrain
       
   183     quint32 rqNoBackground = 0x00000004;  // don't draw background
       
   184     quint32 rqSimpleRope = 0x00000008;  // avoid drawing rope
       
   185     quint32 rq2DWater = 0x00000010;  // disabe 3D water effect
       
   186     quint32 rqFancyBoom = 0x00000020;  // no fancy explosion effects
       
   187     quint32 rqKillFlakes = 0x00000040;  // no flakes
       
   188     quint32 rqSlowMenu = 0x00000080;  // ammomenu appears with no animation
       
   189     quint32 rqPlainSplash = 0x00000100;  // no droplets
       
   190     quint32 rqClampLess = 0x00000200;  // don't clamp textures
       
   191     quint32 rqTooltipsOff = 0x00000400;  // tooltips are not drawn
       
   192     quint32 rqDesyncVBlank = 0x00000800;  // don't sync on vblank
       
   193     
       
   194     quint32 result = (Form->ui.pageOptions->WeaponTooltip->isChecked()) ? rqNone : rqTooltipsOff;
       
   195     
       
   196     switch (Form->ui.pageOptions->SLQuality->value()) {
       
   197       case 5:
       
   198         break;
       
   199       case 4:
       
   200         result |= rqBlurryLand;
       
   201         break;
       
   202       case 3:
       
   203         result |= rqBlurryLand | rqKillFlakes | rqPlainSplash;
       
   204         break;
       
   205       case 2:
       
   206         result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater |
       
   207                   rqFancyBoom | rqSlowMenu;
       
   208         break;
       
   209       case 1:
       
   210         result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater |
       
   211                   rqFancyBoom | rqSlowMenu | rqSimpleRope | rqDesyncVBlank;
       
   212         break;
       
   213       case 0:
       
   214         result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater |
       
   215                   rqFancyBoom | rqSlowMenu | rqSimpleRope | rqDesyncVBlank |
       
   216                   rqNoBackground | rqClampLess;
       
   217         break;
       
   218       default:
       
   219         fprintf(stderr,"unset value from slider");
       
   220         break;
       
   221     }
       
   222     
       
   223     return result;
       
   224 }
       
   225 
   188 bool GameUIConfig::isFrontendEffects() const
   226 bool GameUIConfig::isFrontendEffects() const
   189 {
   227 {
   190   return Form->ui.pageOptions->CBFrontendEffects->isChecked();
   228   return Form->ui.pageOptions->CBFrontendEffects->isChecked();
   191 }
   229 }
   192 
   230 
   193 bool GameUIConfig::isWeaponTooltip() const
       
   194 {
       
   195   return Form->ui.pageOptions->WeaponTooltip->isChecked();
       
   196 }
       
   197 
       
   198 bool GameUIConfig::isFrontendFullscreen() const
   231 bool GameUIConfig::isFrontendFullscreen() const
   199 {
   232 {
   200   return Form->ui.pageOptions->CBFrontendFullscreen->isChecked();
   233   return Form->ui.pageOptions->CBFrontendFullscreen->isChecked();
   201 }
   234 }
   202 
   235 
   206 }
   239 }
   207 bool GameUIConfig::isFrontendSoundEnabled()
   240 bool GameUIConfig::isFrontendSoundEnabled()
   208 {
   241 {
   209     return Form->ui.pageOptions->CBEnableFrontendSound->isChecked();
   242     return Form->ui.pageOptions->CBEnableFrontendSound->isChecked();
   210 }
   243 }
   211 
       
   212 #ifdef _WIN32
       
   213 bool GameUIConfig::isSoundHardware()
       
   214 {
       
   215 //  return Form->ui.pageOptions->CBHardwareSound->isChecked();
       
   216 return false;
       
   217 }
       
   218 #endif
       
   219 
   244 
   220 bool GameUIConfig::isMusicEnabled()
   245 bool GameUIConfig::isMusicEnabled()
   221 {
   246 {
   222     return Form->ui.pageOptions->CBEnableMusic->isChecked();
   247     return Form->ui.pageOptions->CBEnableMusic->isChecked();
   223 }
   248 }