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