2010-03-20 13:11:46 +01:00
|
|
|
// ==============================================================
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
//
|
2012-10-30 07:48:12 +01:00
|
|
|
// Copyright (C) 2001-2008 Martiño Figueroa
|
2010-03-20 13:11:46 +01:00
|
|
|
//
|
2010-03-23 03:37:41 +01:00
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
2010-03-20 13:11:46 +01:00
|
|
|
// License, or (at your option) any later version
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
#include "menu_state_options.h"
|
|
|
|
|
|
|
|
#include "renderer.h"
|
2012-03-13 01:44:55 +01:00
|
|
|
#include "game.h"
|
|
|
|
#include "program.h"
|
2010-03-20 13:11:46 +01:00
|
|
|
#include "sound_renderer.h"
|
|
|
|
#include "core_data.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "menu_state_root.h"
|
|
|
|
#include "util.h"
|
2010-07-11 09:38:08 +02:00
|
|
|
#include "menu_state_graphic_info.h"
|
2011-01-04 02:39:54 +01:00
|
|
|
#include "menu_state_keysetup.h"
|
2011-06-26 05:38:28 +02:00
|
|
|
#include "string_utils.h"
|
2010-03-20 13:11:46 +01:00
|
|
|
#include "leak_dumper.h"
|
|
|
|
|
|
|
|
using namespace Shared::Util;
|
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class MenuStateOptions
|
|
|
|
// =====================================================
|
2010-03-23 03:37:41 +01:00
|
|
|
MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
|
2010-03-20 13:11:46 +01:00
|
|
|
MenuState(program, mainMenu, "config")
|
|
|
|
{
|
2011-12-05 01:02:32 +01:00
|
|
|
try {
|
|
|
|
containerName = "Options";
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
Config &config= Config::getInstance();
|
|
|
|
//modeinfos=list<ModeInfo> ();
|
|
|
|
Shared::PlatformCommon::getFullscreenVideoModes(&modeInfos,!config.getBool("Windowed"));
|
|
|
|
activeInputLabel=NULL;
|
|
|
|
|
|
|
|
int leftLabelStart=50;
|
|
|
|
int leftColumnStart=leftLabelStart+180;
|
2012-10-12 00:10:31 +02:00
|
|
|
int rightLabelStart=450;
|
|
|
|
int rightColumnStart=rightLabelStart+280;
|
2011-12-05 01:02:32 +01:00
|
|
|
int buttonRowPos=80;
|
|
|
|
int buttonStartPos=170;
|
|
|
|
int captionOffset=75;
|
|
|
|
int currentLabelStart=leftLabelStart;
|
|
|
|
int currentColumnStart=leftColumnStart;
|
|
|
|
int currentLine=700;
|
2012-10-12 00:10:31 +02:00
|
|
|
int lineOffset=26;
|
2011-12-05 01:02:32 +01:00
|
|
|
|
|
|
|
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
|
|
|
mainMessageBox.init(lang.get("Ok"));
|
|
|
|
mainMessageBox.setEnabled(false);
|
|
|
|
mainMessageBoxState=0;
|
|
|
|
|
|
|
|
labelAudioSection.registerGraphicComponent(containerName,"labelAudioSection");
|
|
|
|
labelAudioSection.init(currentLabelStart+captionOffset, currentLine);
|
|
|
|
labelAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
labelAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
|
|
|
labelAudioSection.setText(lang.get("Audio"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//soundboxes
|
|
|
|
labelSoundFactory.registerGraphicComponent(containerName,"labelSoundFactory");
|
|
|
|
labelSoundFactory.init(currentLabelStart, currentLine);
|
|
|
|
labelSoundFactory.setText(lang.get("SoundAndMusic"));
|
|
|
|
|
|
|
|
listBoxSoundFactory.registerGraphicComponent(containerName,"listBoxSoundFactory");
|
|
|
|
listBoxSoundFactory.init(currentColumnStart, currentLine, 100);
|
|
|
|
listBoxSoundFactory.pushBackItem("None");
|
|
|
|
listBoxSoundFactory.pushBackItem("OpenAL");
|
2012-08-01 02:51:27 +02:00
|
|
|
// deprecated as of 3.6.1
|
|
|
|
//#ifdef WIN32
|
|
|
|
//listBoxSoundFactory.pushBackItem("DirectSound8");
|
|
|
|
//#endif
|
2011-12-05 01:02:32 +01:00
|
|
|
|
|
|
|
listBoxSoundFactory.setSelectedItem(config.getString("FactorySound"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelVolumeFx.registerGraphicComponent(containerName,"labelVolumeFx");
|
|
|
|
labelVolumeFx.init(currentLabelStart, currentLine);
|
|
|
|
labelVolumeFx.setText(lang.get("FxVolume"));
|
|
|
|
|
|
|
|
listBoxVolumeFx.registerGraphicComponent(containerName,"listBoxVolumeFx");
|
|
|
|
listBoxVolumeFx.init(currentColumnStart, currentLine, 80);
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelVolumeAmbient.registerGraphicComponent(containerName,"labelVolumeAmbient");
|
|
|
|
labelVolumeAmbient.init(currentLabelStart, currentLine);
|
|
|
|
|
|
|
|
listBoxVolumeAmbient.registerGraphicComponent(containerName,"listBoxVolumeAmbient");
|
|
|
|
listBoxVolumeAmbient.init(currentColumnStart, currentLine, 80);
|
|
|
|
labelVolumeAmbient.setText(lang.get("AmbientVolume"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelVolumeMusic.registerGraphicComponent(containerName,"labelVolumeMusic");
|
|
|
|
labelVolumeMusic.init(currentLabelStart, currentLine);
|
|
|
|
|
|
|
|
listBoxVolumeMusic.registerGraphicComponent(containerName,"listBoxVolumeMusic");
|
|
|
|
listBoxVolumeMusic.init(currentColumnStart, currentLine, 80);
|
|
|
|
labelVolumeMusic.setText(lang.get("MusicVolume"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
for(int i=0; i<=100; i+=5){
|
|
|
|
listBoxVolumeFx.pushBackItem(intToStr(i));
|
|
|
|
listBoxVolumeAmbient.pushBackItem(intToStr(i));
|
|
|
|
listBoxVolumeMusic.pushBackItem(intToStr(i));
|
|
|
|
}
|
|
|
|
listBoxVolumeFx.setSelectedItem(intToStr(config.getInt("SoundVolumeFx")/5*5));
|
|
|
|
listBoxVolumeAmbient.setSelectedItem(intToStr(config.getInt("SoundVolumeAmbient")/5*5));
|
|
|
|
listBoxVolumeMusic.setSelectedItem(intToStr(config.getInt("SoundVolumeMusic")/5*5));
|
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
// Video Section
|
|
|
|
labelVideoSection.registerGraphicComponent(containerName,"labelVideoSection");
|
|
|
|
labelVideoSection.init(currentLabelStart+captionOffset, currentLine);
|
|
|
|
labelVideoSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
labelVideoSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
|
|
|
labelVideoSection.setText(lang.get("Video"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//resolution
|
|
|
|
labelScreenModes.registerGraphicComponent(containerName,"labelScreenModes");
|
|
|
|
labelScreenModes.init(currentLabelStart, currentLine);
|
|
|
|
labelScreenModes.setText(lang.get("Resolution"));
|
|
|
|
|
|
|
|
listBoxScreenModes.registerGraphicComponent(containerName,"listBoxScreenModes");
|
|
|
|
listBoxScreenModes.init(currentColumnStart, currentLine, 170);
|
|
|
|
|
|
|
|
string currentResString = config.getString("ScreenWidth") + "x" +
|
|
|
|
config.getString("ScreenHeight") + "-" +
|
|
|
|
intToStr(config.getInt("ColorBits"));
|
|
|
|
bool currentResolutionFound = false;
|
|
|
|
for(vector<ModeInfo>::const_iterator it= modeInfos.begin(); it!=modeInfos.end(); ++it){
|
|
|
|
if((*it).getString() == currentResString) {
|
|
|
|
currentResolutionFound = true;
|
|
|
|
}
|
|
|
|
listBoxScreenModes.pushBackItem((*it).getString());
|
|
|
|
}
|
|
|
|
if(currentResolutionFound == false) {
|
|
|
|
listBoxScreenModes.pushBackItem(currentResString);
|
|
|
|
}
|
|
|
|
listBoxScreenModes.setSelectedItem(currentResString);
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
|
|
|
|
//FullscreenWindowed
|
|
|
|
labelFullscreenWindowed.registerGraphicComponent(containerName,"labelFullscreenWindowed");
|
|
|
|
labelFullscreenWindowed.init(currentLabelStart, currentLine);
|
|
|
|
|
|
|
|
checkBoxFullscreenWindowed.registerGraphicComponent(containerName,"checkBoxFullscreenWindowed");
|
|
|
|
checkBoxFullscreenWindowed.init(currentColumnStart, currentLine);
|
|
|
|
labelFullscreenWindowed.setText(lang.get("Windowed"));
|
|
|
|
checkBoxFullscreenWindowed.setValue(config.getBool("Windowed"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
2012-03-13 01:44:55 +01:00
|
|
|
//gammaCorrection
|
|
|
|
labelGammaCorrection.registerGraphicComponent(containerName,"labelGammaCorrection");
|
|
|
|
labelGammaCorrection.init(currentLabelStart, currentLine);
|
|
|
|
labelGammaCorrection.setText(lang.get("GammaCorrection"));
|
|
|
|
|
|
|
|
listBoxGammaCorrection.registerGraphicComponent(containerName,"listBoxGammaCorrection");
|
|
|
|
listBoxGammaCorrection.init(currentColumnStart, currentLine, 170);
|
2012-03-13 19:59:33 +01:00
|
|
|
for (float f=0.5;f<3.0f;f=f+0.1f) {
|
2012-03-13 01:44:55 +01:00
|
|
|
listBoxGammaCorrection.pushBackItem(floatToStr(f));
|
|
|
|
}
|
2012-03-13 19:59:33 +01:00
|
|
|
float gammaValue=config.getFloat("GammaValue","1.0");
|
|
|
|
if(gammaValue==0.0f) gammaValue=1.0f;
|
|
|
|
listBoxGammaCorrection.setSelectedItem(floatToStr(gammaValue));
|
2012-03-13 01:44:55 +01:00
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
//filter
|
|
|
|
labelFilter.registerGraphicComponent(containerName,"labelFilter");
|
|
|
|
labelFilter.init(currentLabelStart, currentLine);
|
|
|
|
labelFilter.setText(lang.get("Filter"));
|
|
|
|
|
|
|
|
listBoxFilter.registerGraphicComponent(containerName,"listBoxFilter");
|
|
|
|
listBoxFilter.init(currentColumnStart, currentLine, 170);
|
|
|
|
listBoxFilter.pushBackItem("Bilinear");
|
|
|
|
listBoxFilter.pushBackItem("Trilinear");
|
|
|
|
listBoxFilter.setSelectedItem(config.getString("Filter"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//shadows
|
|
|
|
labelShadows.registerGraphicComponent(containerName,"labelShadows");
|
|
|
|
labelShadows.init(currentLabelStart, currentLine);
|
|
|
|
labelShadows.setText(lang.get("Shadows"));
|
|
|
|
|
|
|
|
listBoxShadows.registerGraphicComponent(containerName,"listBoxShadows");
|
|
|
|
listBoxShadows.init(currentColumnStart, currentLine, 170);
|
|
|
|
for(int i= 0; i<Renderer::sCount; ++i){
|
|
|
|
listBoxShadows.pushBackItem(lang.get(Renderer::shadowsToStr(static_cast<Renderer::Shadows>(i))));
|
|
|
|
}
|
|
|
|
string str= config.getString("Shadows");
|
|
|
|
listBoxShadows.setSelectedItemIndex(clamp(Renderer::strToShadows(str), 0, Renderer::sCount-1));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
2012-05-11 00:32:38 +02:00
|
|
|
//shadows
|
|
|
|
labelShadowTextureSize.registerGraphicComponent(containerName,"labelShadowTextureSize");
|
|
|
|
labelShadowTextureSize.init(currentLabelStart, currentLine);
|
|
|
|
labelShadowTextureSize.setText(lang.get("ShadowTextureSize"));
|
|
|
|
|
|
|
|
listBoxShadowTextureSize.registerGraphicComponent(containerName,"listBoxShadowTextureSize");
|
|
|
|
listBoxShadowTextureSize.init(currentColumnStart, currentLine, 170);
|
|
|
|
listBoxShadowTextureSize.pushBackItem("256");
|
|
|
|
listBoxShadowTextureSize.pushBackItem("512");
|
|
|
|
listBoxShadowTextureSize.pushBackItem("1024");
|
|
|
|
listBoxShadowTextureSize.setSelectedItemIndex(1,false);
|
|
|
|
listBoxShadowTextureSize.setSelectedItem(intToStr(config.getInt("ShadowTextureSize","512")),false);
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
//textures 3d
|
|
|
|
labelTextures3D.registerGraphicComponent(containerName,"labelTextures3D");
|
|
|
|
labelTextures3D.init(currentLabelStart, currentLine);
|
|
|
|
|
|
|
|
checkBoxTextures3D.registerGraphicComponent(containerName,"checkBoxTextures3D");
|
|
|
|
checkBoxTextures3D.init(currentColumnStart, currentLine);
|
|
|
|
labelTextures3D.setText(lang.get("Textures3D"));
|
|
|
|
checkBoxTextures3D.setValue(config.getBool("Textures3D"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//lights
|
|
|
|
labelLights.registerGraphicComponent(containerName,"labelLights");
|
|
|
|
labelLights.init(currentLabelStart, currentLine);
|
|
|
|
labelLights.setText(lang.get("MaxLights"));
|
|
|
|
|
|
|
|
listBoxLights.registerGraphicComponent(containerName,"listBoxLights");
|
|
|
|
listBoxLights.init(currentColumnStart, currentLine, 80);
|
|
|
|
for(int i= 1; i<=8; ++i){
|
|
|
|
listBoxLights.pushBackItem(intToStr(i));
|
|
|
|
}
|
|
|
|
listBoxLights.setSelectedItemIndex(clamp(config.getInt("MaxLights")-1, 0, 7));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//unit particles
|
|
|
|
labelUnitParticles.registerGraphicComponent(containerName,"labelUnitParticles");
|
|
|
|
labelUnitParticles.init(currentLabelStart,currentLine);
|
|
|
|
labelUnitParticles.setText(lang.get("ShowUnitParticles"));
|
|
|
|
|
|
|
|
checkBoxUnitParticles.registerGraphicComponent(containerName,"checkBoxUnitParticles");
|
|
|
|
checkBoxUnitParticles.init(currentColumnStart,currentLine);
|
|
|
|
checkBoxUnitParticles.setValue(config.getBool("UnitParticles","true"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//tileset particles
|
|
|
|
labelTilesetParticles.registerGraphicComponent(containerName,"labelTilesetParticles");
|
|
|
|
labelTilesetParticles.init(currentLabelStart,currentLine);
|
|
|
|
labelTilesetParticles.setText(lang.get("ShowTilesetParticles"));
|
|
|
|
|
|
|
|
checkBoxTilesetParticles.registerGraphicComponent(containerName,"checkBoxTilesetParticles");
|
|
|
|
checkBoxTilesetParticles.init(currentColumnStart,currentLine);
|
|
|
|
checkBoxTilesetParticles.setValue(config.getBool("TilesetParticles","true"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//unit particles
|
|
|
|
labelMapPreview.registerGraphicComponent(containerName,"labelMapPreview");
|
|
|
|
labelMapPreview.init(currentLabelStart,currentLine);
|
|
|
|
labelMapPreview.setText(lang.get("ShowMapPreview"));
|
|
|
|
|
|
|
|
checkBoxMapPreview.registerGraphicComponent(containerName,"checkBoxMapPreview");
|
|
|
|
checkBoxMapPreview.init(currentColumnStart,currentLine);
|
|
|
|
checkBoxMapPreview.setValue(config.getBool("MapPreview","true"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
// Texture Compression flag
|
|
|
|
labelEnableTextureCompression.registerGraphicComponent(containerName,"labelEnableTextureCompression");
|
|
|
|
labelEnableTextureCompression.init(currentLabelStart ,currentLine);
|
|
|
|
labelEnableTextureCompression.setText(lang.get("EnableTextureCompression"));
|
|
|
|
|
|
|
|
checkBoxEnableTextureCompression.registerGraphicComponent(containerName,"checkBoxEnableTextureCompression");
|
|
|
|
checkBoxEnableTextureCompression.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxEnableTextureCompression.setValue(config.getBool("EnableTextureCompression","false"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelRainEffect.registerGraphicComponent(containerName,"labelRainEffect");
|
|
|
|
labelRainEffect.init(currentLabelStart ,currentLine);
|
2012-04-12 00:19:50 +02:00
|
|
|
labelRainEffect.setText(lang.get("RainEffectMenuGame"));
|
|
|
|
|
|
|
|
checkBoxRainEffectMenu.registerGraphicComponent(containerName,"checkBoxRainEffectMenu");
|
|
|
|
checkBoxRainEffectMenu.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxRainEffectMenu.setValue(config.getBool("RainEffectMenu","true"));
|
|
|
|
|
|
|
|
labelRainEffectSeparator.registerGraphicComponent(containerName,"labelRainEffect");
|
|
|
|
labelRainEffectSeparator.init(currentColumnStart+30 ,currentLine);
|
|
|
|
labelRainEffectSeparator.setText("/");
|
2011-12-05 01:02:32 +01:00
|
|
|
|
|
|
|
checkBoxRainEffect.registerGraphicComponent(containerName,"checkBoxRainEffect");
|
2012-04-12 00:19:50 +02:00
|
|
|
checkBoxRainEffect.init(currentColumnStart+42 ,currentLine );
|
2011-12-05 01:02:32 +01:00
|
|
|
checkBoxRainEffect.setValue(config.getBool("RainEffect","true"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
2012-06-09 07:02:01 +02:00
|
|
|
labelVideos.registerGraphicComponent(containerName,"labelVideos");
|
|
|
|
labelVideos.init(currentLabelStart ,currentLine);
|
|
|
|
labelVideos.setText(lang.get("EnableVideos"));
|
|
|
|
|
|
|
|
checkBoxVideos.registerGraphicComponent(containerName,"checkBoxVideos");
|
|
|
|
checkBoxVideos.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxVideos.setValue(config.getBool("EnableVideos","true"));
|
2011-12-05 01:02:32 +01:00
|
|
|
|
|
|
|
// end
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
///////// RIGHT SIDE
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
currentLine=700; // reset line pos
|
|
|
|
currentLabelStart=rightLabelStart; // set to right side
|
|
|
|
currentColumnStart=rightColumnStart; // set to right side
|
|
|
|
|
|
|
|
|
|
|
|
//currentLine-=lineOffset;
|
|
|
|
labelMiscSection.registerGraphicComponent(containerName,"labelMiscSection");
|
|
|
|
labelMiscSection.init(currentLabelStart+captionOffset, currentLine);
|
|
|
|
labelMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
labelMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
|
|
|
labelMiscSection.setText(lang.get("Misc"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//lang
|
|
|
|
labelLang.registerGraphicComponent(containerName,"labelLang");
|
|
|
|
labelLang.init(currentLabelStart, currentLine);
|
|
|
|
labelLang.setText(lang.get("Language"));
|
|
|
|
|
|
|
|
listBoxLang.registerGraphicComponent(containerName,"listBoxLang");
|
|
|
|
listBoxLang.init(currentColumnStart, currentLine, 260);
|
|
|
|
vector<string> langResults;
|
|
|
|
|
|
|
|
// string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
|
|
|
//
|
|
|
|
// string userDataPath = getGameCustomCoreDataPath(data_path, "");
|
|
|
|
// findAll(userDataPath + "data/lang/*.lng", langResults, true, false);
|
|
|
|
//
|
|
|
|
// vector<string> langResults2;
|
|
|
|
// findAll(data_path + "data/lang/*.lng", langResults2, true);
|
|
|
|
// if(langResults2.empty() && langResults.empty()) {
|
2012-04-14 23:21:09 +02:00
|
|
|
// throw megaglest_runtime_error("There are no lang files");
|
2011-12-05 01:02:32 +01:00
|
|
|
// }
|
|
|
|
// for(unsigned int i = 0; i < langResults2.size(); ++i) {
|
|
|
|
// string testLanguage = langResults2[i];
|
|
|
|
// if(std::find(langResults.begin(),langResults.end(),testLanguage) == langResults.end()) {
|
|
|
|
// langResults.push_back(testLanguage);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
languageList = Lang::getInstance().getDiscoveredLanguageList(true);
|
|
|
|
for(map<string,string>::iterator iterMap = languageList.begin();
|
|
|
|
iterMap != languageList.end(); ++iterMap) {
|
|
|
|
langResults.push_back(iterMap->first + "-" + iterMap->second);
|
|
|
|
}
|
2010-09-09 08:42:39 +02:00
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
listBoxLang.setItems(langResults);
|
2010-12-09 21:41:11 +01:00
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
pair<string,string> defaultLang = Lang::getInstance().getNavtiveNameFromLanguageName(config.getString("Lang"));
|
|
|
|
if(defaultLang.first == "" && defaultLang.second == "") {
|
|
|
|
defaultLang = Lang::getInstance().getNavtiveNameFromLanguageName(Lang::getInstance().getDefaultLanguage());
|
|
|
|
}
|
|
|
|
listBoxLang.setSelectedItem(defaultLang.second + "-" + defaultLang.first);
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//playerName
|
|
|
|
labelPlayerNameLabel.registerGraphicComponent(containerName,"labelPlayerNameLabel");
|
|
|
|
labelPlayerNameLabel.init(currentLabelStart,currentLine);
|
|
|
|
labelPlayerNameLabel.setText(lang.get("Playername"));
|
|
|
|
|
|
|
|
labelPlayerName.registerGraphicComponent(containerName,"labelPlayerName");
|
|
|
|
labelPlayerName.init(currentColumnStart,currentLine);
|
|
|
|
labelPlayerName.setText(config.getString("NetPlayerName",Socket::getHostName().c_str()));
|
|
|
|
labelPlayerName.setFont(CoreData::getInstance().getMenuFontBig());
|
|
|
|
labelPlayerName.setFont3D(CoreData::getInstance().getMenuFontBig3D());
|
2012-07-26 08:27:00 +02:00
|
|
|
labelPlayerName.setMaxEditWidth(16);
|
2012-07-26 17:26:59 +02:00
|
|
|
labelPlayerName.setMaxEditRenderWidth(200);
|
2011-12-05 01:02:32 +01:00
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
//FontSizeAdjustment
|
|
|
|
labelFontSizeAdjustment.registerGraphicComponent(containerName,"labelFontSizeAdjustment");
|
|
|
|
labelFontSizeAdjustment.init(currentLabelStart,currentLine);
|
|
|
|
labelFontSizeAdjustment.setText(lang.get("FontSizeAdjustment"));
|
|
|
|
|
|
|
|
listFontSizeAdjustment.registerGraphicComponent(containerName,"listFontSizeAdjustment");
|
|
|
|
listFontSizeAdjustment.init(currentColumnStart, currentLine, 80);
|
|
|
|
for(int i=-5; i<=5; i+=1){
|
|
|
|
listFontSizeAdjustment.pushBackItem(intToStr(i));
|
|
|
|
}
|
|
|
|
listFontSizeAdjustment.setSelectedItem(intToStr(config.getInt("FontSizeAdjustment")));
|
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
// Screenshot type flag
|
|
|
|
labelScreenShotType.registerGraphicComponent(containerName,"labelScreenShotType");
|
|
|
|
labelScreenShotType.init(currentLabelStart ,currentLine);
|
|
|
|
labelScreenShotType.setText(lang.get("ScreenShotFileType"));
|
|
|
|
|
|
|
|
listBoxScreenShotType.registerGraphicComponent(containerName,"listBoxScreenShotType");
|
|
|
|
listBoxScreenShotType.init(currentColumnStart ,currentLine, 80 );
|
|
|
|
listBoxScreenShotType.pushBackItem("bmp");
|
|
|
|
listBoxScreenShotType.pushBackItem("jpg");
|
|
|
|
listBoxScreenShotType.pushBackItem("png");
|
|
|
|
listBoxScreenShotType.pushBackItem("tga");
|
|
|
|
listBoxScreenShotType.setSelectedItem(config.getString("ScreenShotFileType","jpg"));
|
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelDisableScreenshotConsoleText.registerGraphicComponent(containerName,"lavelDisableScreenshotConsoleText");
|
|
|
|
labelDisableScreenshotConsoleText.init(currentLabelStart ,currentLine);
|
|
|
|
labelDisableScreenshotConsoleText.setText(lang.get("ScreenShotConsoleText"));
|
|
|
|
|
|
|
|
checkBoxDisableScreenshotConsoleText.registerGraphicComponent(containerName,"checkBoxDisableScreenshotConsoleText");
|
|
|
|
checkBoxDisableScreenshotConsoleText.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxDisableScreenshotConsoleText.setValue(!config.getBool("DisableScreenshotConsoleText","false"));
|
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelMouseMoveScrollsWorld.registerGraphicComponent(containerName,"labelMouseMoveScrollsWorld");
|
|
|
|
labelMouseMoveScrollsWorld.init(currentLabelStart ,currentLine);
|
|
|
|
labelMouseMoveScrollsWorld.setText(lang.get("MouseScrollsWorld"));
|
|
|
|
|
|
|
|
checkBoxMouseMoveScrollsWorld.registerGraphicComponent(containerName,"checkBoxMouseMoveScrollsWorld");
|
|
|
|
checkBoxMouseMoveScrollsWorld.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxMouseMoveScrollsWorld.setValue(config.getBool("MouseMoveScrollsWorld","true"));
|
2012-10-12 00:10:31 +02:00
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelVisibleHud.registerGraphicComponent(containerName,"lavelVisibleHud");
|
|
|
|
labelVisibleHud.init(currentLabelStart ,currentLine);
|
|
|
|
labelVisibleHud.setText(lang.get("VisibleHUD"));
|
|
|
|
|
|
|
|
checkBoxVisibleHud.registerGraphicComponent(containerName,"checkBoxVisibleHud");
|
|
|
|
checkBoxVisibleHud.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxVisibleHud.setValue(config.getBool("VisibleHud","true"));
|
2011-12-05 01:02:32 +01:00
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
2012-10-12 00:10:31 +02:00
|
|
|
|
|
|
|
labelChatStaysActive.registerGraphicComponent(containerName,"labelChatStaysActive");
|
|
|
|
labelChatStaysActive.init(currentLabelStart ,currentLine);
|
|
|
|
labelChatStaysActive.setText(lang.get("ChatStaysActive"));
|
|
|
|
|
|
|
|
checkBoxChatStaysActive.registerGraphicComponent(containerName,"checkBoxChatStaysActive");
|
|
|
|
checkBoxChatStaysActive.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxChatStaysActive.setValue(config.getBool("ChatStaysActive","false"));
|
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelTimeDisplay.registerGraphicComponent(containerName,"labelTimeDisplay");
|
|
|
|
labelTimeDisplay.init(currentLabelStart ,currentLine);
|
|
|
|
labelTimeDisplay.setText(lang.get("TimeDisplay"));
|
|
|
|
|
|
|
|
checkBoxTimeDisplay.registerGraphicComponent(containerName,"checkBoxTimeDisplay");
|
|
|
|
checkBoxTimeDisplay.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxTimeDisplay.setValue(config.getBool("TimeDisplay","true"));
|
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
currentLine-=lineOffset;
|
2012-10-16 23:08:45 +02:00
|
|
|
|
|
|
|
labelLuaDisableSecuritySandbox.registerGraphicComponent(containerName,"labelLuaDisableSecuritySandbox");
|
|
|
|
labelLuaDisableSecuritySandbox.init(currentLabelStart ,currentLine);
|
|
|
|
labelLuaDisableSecuritySandbox.setText(lang.get("LuaDisableSecuritySandbox"));
|
|
|
|
|
|
|
|
checkBoxLuaDisableSecuritySandbox.registerGraphicComponent(containerName,"checkBoxLuaDisableSecuritySandbox");
|
|
|
|
checkBoxLuaDisableSecuritySandbox.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxLuaDisableSecuritySandbox.setValue(config.getBool("DisableLuaSandbox","false"));
|
|
|
|
|
|
|
|
luaMessageBox.registerGraphicComponent(containerName,"luaMessageBox");
|
|
|
|
luaMessageBox.init(lang.get("Yes"),lang.get("No"));
|
|
|
|
luaMessageBox.setEnabled(false);
|
|
|
|
luaMessageBoxState=0;
|
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
2012-10-16 23:08:45 +02:00
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
labelNetworkSettings.registerGraphicComponent(containerName,"labelNetworkSettingsSection");
|
|
|
|
labelNetworkSettings.init(currentLabelStart+captionOffset, currentLine);
|
|
|
|
labelNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
labelNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
|
|
|
labelNetworkSettings.setText(lang.get("Network"));
|
2012-10-06 20:22:48 +02:00
|
|
|
|
|
|
|
// external server port
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
labelPublishServerExternalPort.registerGraphicComponent(containerName,"labelPublishServerExternalPort");
|
|
|
|
labelPublishServerExternalPort.init(currentLabelStart, currentLine, 150);
|
|
|
|
labelPublishServerExternalPort.setText(lang.get("PublishServerExternalPort"));
|
|
|
|
|
|
|
|
labelExternalPort.init(currentColumnStart,currentLine);
|
|
|
|
string extPort= config.getString("PortExternal","not set");
|
|
|
|
if(extPort == "not set" || extPort == "0"){
|
|
|
|
extPort=" --- ";
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
extPort="!!! "+extPort+" !!!";
|
|
|
|
}
|
|
|
|
labelExternalPort.setText(extPort);
|
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
currentLine-=lineOffset;
|
|
|
|
// server port
|
|
|
|
labelServerPortLabel.registerGraphicComponent(containerName,"labelServerPortLabel");
|
|
|
|
labelServerPortLabel.init(currentLabelStart,currentLine);
|
|
|
|
labelServerPortLabel.setText(lang.get("ServerPort"));
|
2011-01-09 19:05:10 +01:00
|
|
|
|
2012-10-06 14:56:53 +02:00
|
|
|
listBoxServerPort.registerGraphicComponent(containerName,"listBoxPublishServerExternalPort");
|
|
|
|
listBoxServerPort.init(currentColumnStart, currentLine, 170);
|
2011-01-09 19:05:10 +01:00
|
|
|
|
2012-10-06 14:56:53 +02:00
|
|
|
string portListString = config.getString("PortList",intToStr(GameConstants::serverPort).c_str());
|
|
|
|
std::vector<std::string> portList;
|
|
|
|
Tokenize(portListString,portList,",");
|
2011-01-09 19:05:10 +01:00
|
|
|
|
2012-10-06 15:45:42 +02:00
|
|
|
string currentPort=config.getString("PortServer", intToStr(GameConstants::serverPort).c_str());
|
|
|
|
int portSelectionIndex=0;
|
2012-10-06 14:56:53 +02:00
|
|
|
for(int idx = 0; idx < portList.size(); idx++) {
|
|
|
|
if(portList[idx] != "" && IsNumeric(portList[idx].c_str(),false)) {
|
|
|
|
listBoxServerPort.pushBackItem(portList[idx]);
|
|
|
|
if(currentPort==portList[idx])
|
2011-12-05 01:02:32 +01:00
|
|
|
{
|
2012-10-06 15:45:42 +02:00
|
|
|
portSelectionIndex=idx;
|
2011-12-05 01:02:32 +01:00
|
|
|
}
|
2011-01-09 19:05:10 +01:00
|
|
|
}
|
|
|
|
}
|
2012-10-06 15:45:42 +02:00
|
|
|
listBoxServerPort.setSelectedItemIndex(portSelectionIndex);
|
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
currentLine-=lineOffset;
|
|
|
|
labelFTPServerPortLabel.registerGraphicComponent(containerName,"labelFTPServerPortLabel");
|
|
|
|
labelFTPServerPortLabel.init(currentLabelStart ,currentLine );
|
|
|
|
labelFTPServerPortLabel.setText(lang.get("FTPServerPort"));
|
|
|
|
|
|
|
|
int FTPPort = config.getInt("FTPServerPort",intToStr(ServerSocket::getFTPServerPort()).c_str());
|
|
|
|
labelFTPServerPort.registerGraphicComponent(containerName,"labelFTPServerPort");
|
|
|
|
labelFTPServerPort.init(currentColumnStart ,currentLine );
|
|
|
|
labelFTPServerPort.setText(intToStr(FTPPort));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
labelFTPServerDataPortsLabel.registerGraphicComponent(containerName,"labelFTPServerDataPortsLabel");
|
|
|
|
labelFTPServerDataPortsLabel.init(currentLabelStart ,currentLine );
|
|
|
|
labelFTPServerDataPortsLabel.setText(lang.get("FTPServerDataPort"));
|
|
|
|
|
2012-10-19 03:31:20 +02:00
|
|
|
char szBuf[8096]="";
|
|
|
|
snprintf(szBuf,8096,"%d - %d",FTPPort + 1, FTPPort + GameConstants::maxPlayers);
|
2011-12-05 01:02:32 +01:00
|
|
|
|
|
|
|
labelFTPServerDataPorts.registerGraphicComponent(containerName,"labelFTPServerDataPorts");
|
|
|
|
labelFTPServerDataPorts.init(currentColumnStart,currentLine );
|
|
|
|
labelFTPServerDataPorts.setText(szBuf);
|
|
|
|
currentLine-=lineOffset;
|
2012-10-06 20:22:48 +02:00
|
|
|
labelEnableFTPServer.registerGraphicComponent(containerName,"labelEnableFTPServer");
|
|
|
|
labelEnableFTPServer.init(currentLabelStart ,currentLine);
|
|
|
|
labelEnableFTPServer.setText(lang.get("EnableFTPServer"));
|
|
|
|
|
|
|
|
checkBoxEnableFTPServer.registerGraphicComponent(containerName,"checkBoxEnableFTPServer");
|
|
|
|
checkBoxEnableFTPServer.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxEnableFTPServer.setValue(config.getBool("EnableFTPServer","true"));
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
// FTP Config - start
|
|
|
|
labelEnableFTP.registerGraphicComponent(containerName,"labelEnableFTP");
|
|
|
|
labelEnableFTP.init(currentLabelStart ,currentLine);
|
|
|
|
labelEnableFTP.setText(lang.get("EnableFTP"));
|
|
|
|
|
|
|
|
checkBoxEnableFTP.registerGraphicComponent(containerName,"checkBoxEnableFTP");
|
|
|
|
checkBoxEnableFTP.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxEnableFTP.setValue(config.getBool("EnableFTPXfer","true"));
|
|
|
|
currentLine-=lineOffset;
|
2011-12-05 01:02:32 +01:00
|
|
|
|
|
|
|
labelEnableFTPServerInternetTilesetXfer.registerGraphicComponent(containerName,"labelEnableFTPServerInternetTilesetXfer");
|
|
|
|
labelEnableFTPServerInternetTilesetXfer.init(currentLabelStart ,currentLine );
|
|
|
|
labelEnableFTPServerInternetTilesetXfer.setText(lang.get("EnableFTPServerInternetTilesetXfer"));
|
|
|
|
|
|
|
|
checkBoxEnableFTPServerInternetTilesetXfer.registerGraphicComponent(containerName,"checkBoxEnableFTPServerInternetTilesetXfer");
|
|
|
|
checkBoxEnableFTPServerInternetTilesetXfer.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxEnableFTPServerInternetTilesetXfer.setValue(config.getBool("EnableFTPServerInternetTilesetXfer","true"));
|
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
labelEnableFTPServerInternetTechtreeXfer.registerGraphicComponent(containerName,"labelEnableFTPServerInternetTechtreeXfer");
|
|
|
|
labelEnableFTPServerInternetTechtreeXfer.init(currentLabelStart ,currentLine );
|
|
|
|
labelEnableFTPServerInternetTechtreeXfer.setText(lang.get("EnableFTPServerInternetTechtreeXfer"));
|
|
|
|
|
|
|
|
checkBoxEnableFTPServerInternetTechtreeXfer.registerGraphicComponent(containerName,"checkBoxEnableFTPServerInternetTechtreeXfer");
|
|
|
|
checkBoxEnableFTPServerInternetTechtreeXfer.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxEnableFTPServerInternetTechtreeXfer.setValue(config.getBool("EnableFTPServerInternetTechtreeXfer","true"));
|
|
|
|
|
|
|
|
currentLine-=lineOffset;
|
|
|
|
|
|
|
|
|
|
|
|
// FTP config end
|
|
|
|
|
|
|
|
// Privacy flag
|
|
|
|
labelEnablePrivacy.registerGraphicComponent(containerName,"labelEnablePrivacy");
|
|
|
|
labelEnablePrivacy.init(currentLabelStart ,currentLine);
|
|
|
|
labelEnablePrivacy.setText(lang.get("PrivacyPlease"));
|
|
|
|
|
|
|
|
checkBoxEnablePrivacy.registerGraphicComponent(containerName,"checkBoxEnablePrivacy");
|
|
|
|
checkBoxEnablePrivacy.init(currentColumnStart ,currentLine );
|
|
|
|
checkBoxEnablePrivacy.setValue(config.getBool("PrivacyPlease","false"));
|
2012-10-06 09:06:40 +02:00
|
|
|
//currentLine-=lineOffset;
|
2011-12-05 01:02:32 +01:00
|
|
|
// end
|
|
|
|
|
|
|
|
// buttons
|
|
|
|
buttonOk.registerGraphicComponent(containerName,"buttonOk");
|
|
|
|
buttonOk.init(buttonStartPos, buttonRowPos, 100);
|
|
|
|
buttonOk.setText(lang.get("Ok"));
|
|
|
|
buttonAbort.setText(lang.get("Abort"));
|
|
|
|
|
|
|
|
buttonAbort.registerGraphicComponent(containerName,"buttonAbort");
|
|
|
|
buttonAbort.init(buttonStartPos+110, buttonRowPos, 100);
|
|
|
|
buttonAutoConfig.setText(lang.get("AutoConfig"));
|
|
|
|
|
|
|
|
buttonAutoConfig.registerGraphicComponent(containerName,"buttonAutoConfig");
|
|
|
|
buttonAutoConfig.init(buttonStartPos+250, buttonRowPos, 125);
|
|
|
|
|
|
|
|
buttonVideoInfo.setText(lang.get("VideoInfo"));
|
|
|
|
buttonVideoInfo.registerGraphicComponent(containerName,"buttonVideoInfo");
|
|
|
|
buttonVideoInfo.init(buttonStartPos+385, buttonRowPos, 125); // was 620
|
|
|
|
|
|
|
|
buttonKeyboardSetup.setText(lang.get("Keyboardsetup"));
|
|
|
|
buttonKeyboardSetup.registerGraphicComponent(containerName,"buttonKeyboardSetup");
|
|
|
|
buttonKeyboardSetup.init(buttonStartPos+520, buttonRowPos, 145);
|
|
|
|
|
2012-10-22 07:08:52 +02:00
|
|
|
// Transifex related UI
|
|
|
|
labelCustomTranslation.registerGraphicComponent(containerName,"labelCustomTranslation");
|
|
|
|
labelCustomTranslation.init(currentColumnStart ,700);
|
|
|
|
labelCustomTranslation.setText(lang.get("CustomTranslation"));
|
|
|
|
|
|
|
|
checkBoxCustomTranslation.registerGraphicComponent(containerName,"checkBoxCustomTranslation");
|
|
|
|
checkBoxCustomTranslation.init(currentColumnStart + 200 ,700 );
|
|
|
|
checkBoxCustomTranslation.setValue(false);
|
|
|
|
|
|
|
|
buttonGetNewLanguageFiles.registerGraphicComponent(containerName,"buttonGetNewLanguageFiles");
|
|
|
|
buttonGetNewLanguageFiles.init(buttonStartPos, buttonRowPos - 60, 200);
|
|
|
|
buttonGetNewLanguageFiles.setText(lang.get("TransifexGetLanguageFiles"));
|
|
|
|
|
|
|
|
buttonDeleteNewLanguageFiles.registerGraphicComponent(containerName,"buttonDeleteNewLanguageFiles");
|
|
|
|
buttonDeleteNewLanguageFiles.init(buttonStartPos + 230, buttonRowPos - 60, 200);
|
|
|
|
buttonDeleteNewLanguageFiles.setText(lang.get("TransifexDeleteLanguageFiles"));
|
|
|
|
|
|
|
|
labelTransifexUserLabel.registerGraphicComponent(containerName,"labelTransifexUserLabel");
|
|
|
|
labelTransifexUserLabel.init(buttonStartPos ,buttonRowPos - 20);
|
|
|
|
labelTransifexUserLabel.setText(lang.get("TransifexUserName"));
|
|
|
|
|
|
|
|
labelTransifexUser.registerGraphicComponent(containerName,"labelTransifexUser");
|
|
|
|
labelTransifexUser.init(buttonStartPos ,buttonRowPos - 40);
|
2012-10-22 08:10:36 +02:00
|
|
|
labelTransifexUser.setMaxEditWidth(60);
|
|
|
|
labelTransifexUser.setMaxEditRenderWidth(120);
|
2012-10-22 07:08:52 +02:00
|
|
|
labelTransifexUser.setText(config.getString("TranslationGetURLUser","<none>"));
|
|
|
|
|
|
|
|
labelTransifexPwdLabel.registerGraphicComponent(containerName,"labelTransifexPwdLabel");
|
2012-10-22 21:38:28 +02:00
|
|
|
labelTransifexPwdLabel.init(buttonStartPos + 200 ,buttonRowPos - 20);
|
2012-10-22 07:08:52 +02:00
|
|
|
labelTransifexPwdLabel.setText(lang.get("TransifexPwd"));
|
|
|
|
|
|
|
|
labelTransifexPwd.registerGraphicComponent(containerName,"labelTransifexPwd");
|
2012-10-22 21:38:28 +02:00
|
|
|
labelTransifexPwd.init(buttonStartPos + 200 ,buttonRowPos - 40);
|
|
|
|
labelTransifexPwd.setIsPassword(true);
|
2012-10-22 08:10:36 +02:00
|
|
|
labelTransifexPwd.setMaxEditWidth(60);
|
|
|
|
labelTransifexPwd.setMaxEditRenderWidth(120);
|
2012-10-23 00:06:30 +02:00
|
|
|
labelTransifexPwd.setText(config.getString("TranslationGetURLPassword",""));
|
2012-10-22 07:08:52 +02:00
|
|
|
|
|
|
|
labelTransifexI18NLabel.registerGraphicComponent(containerName,"labelTransifexI18NLabel");
|
2012-10-22 21:38:28 +02:00
|
|
|
labelTransifexI18NLabel.init(buttonStartPos + 360 ,buttonRowPos - 20);
|
2012-10-22 07:08:52 +02:00
|
|
|
labelTransifexI18NLabel.setText(lang.get("TransifexI18N"));
|
|
|
|
|
|
|
|
labelTransifexI18N.registerGraphicComponent(containerName,"labelTransifexI18N");
|
2012-10-22 21:38:28 +02:00
|
|
|
labelTransifexI18N.init(buttonStartPos + 360 ,buttonRowPos - 40);
|
2012-10-22 08:31:57 +02:00
|
|
|
labelTransifexI18N.setMaxEditWidth(3);
|
2012-10-22 07:08:52 +02:00
|
|
|
labelTransifexI18N.setText(config.getString("TranslationGetURLLanguage","en"));
|
|
|
|
|
|
|
|
setupTransifexUI();
|
|
|
|
|
2011-12-05 01:02:32 +01:00
|
|
|
GraphicComponent::applyAllCustomProperties(containerName);
|
|
|
|
}
|
|
|
|
catch(exception &e) {
|
|
|
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error loading options: %s\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
2012-04-14 23:21:09 +02:00
|
|
|
throw megaglest_runtime_error(string("Error loading options msg: ") + e.what());
|
2011-01-09 19:05:10 +01:00
|
|
|
}
|
2010-03-20 13:11:46 +01:00
|
|
|
}
|
|
|
|
|
2011-10-25 20:39:11 +02:00
|
|
|
void MenuStateOptions::reloadUI() {
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
|
2011-11-04 00:38:43 +01:00
|
|
|
console.resetFonts();
|
2011-10-25 20:39:11 +02:00
|
|
|
mainMessageBox.init(lang.get("Ok"));
|
2012-10-16 23:08:45 +02:00
|
|
|
luaMessageBox.init(lang.get("Yes"),lang.get("No"));
|
2011-10-25 20:39:11 +02:00
|
|
|
|
|
|
|
labelAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
labelAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
|
|
|
labelAudioSection.setText(lang.get("Audio"));
|
|
|
|
|
|
|
|
labelSoundFactory.setText(lang.get("SoundAndMusic"));
|
|
|
|
|
|
|
|
std::vector<string> listboxData;
|
|
|
|
listboxData.push_back("None");
|
|
|
|
listboxData.push_back("OpenAL");
|
2012-08-01 02:51:27 +02:00
|
|
|
// deprecated as of 3.6.1
|
|
|
|
//#ifdef WIN32
|
|
|
|
// listboxData.push_back("DirectSound8");
|
|
|
|
//#endif
|
2011-10-25 20:39:11 +02:00
|
|
|
|
|
|
|
listBoxSoundFactory.setItems(listboxData);
|
|
|
|
|
|
|
|
labelVolumeFx.setText(lang.get("FxVolume"));
|
|
|
|
|
|
|
|
labelVolumeAmbient.setText(lang.get("AmbientVolume"));
|
|
|
|
labelVolumeMusic.setText(lang.get("MusicVolume"));
|
|
|
|
|
|
|
|
labelVideoSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
labelVideoSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
|
|
|
labelVideoSection.setText(lang.get("Video"));
|
|
|
|
|
|
|
|
labelScreenModes.setText(lang.get("Resolution"));
|
|
|
|
|
|
|
|
labelFullscreenWindowed.setText(lang.get("Windowed"));
|
|
|
|
labelFilter.setText(lang.get("Filter"));
|
|
|
|
|
|
|
|
listboxData.clear();
|
|
|
|
listboxData.push_back("Bilinear");
|
|
|
|
listboxData.push_back("Trilinear");
|
|
|
|
listBoxFilter.setItems(listboxData);
|
|
|
|
|
2012-03-13 01:44:55 +01:00
|
|
|
listboxData.clear();
|
|
|
|
for (float f=0.0;f<2.1f;f=f+0.1f) {
|
|
|
|
listboxData.push_back(floatToStr(f));
|
|
|
|
}
|
|
|
|
listBoxGammaCorrection.setItems(listboxData);
|
|
|
|
|
|
|
|
|
2011-10-25 20:39:11 +02:00
|
|
|
labelShadows.setText(lang.get("Shadows"));
|
2012-05-11 00:32:38 +02:00
|
|
|
labelShadowTextureSize.setText(lang.get("ShadowTextureSize"));
|
2011-10-25 20:39:11 +02:00
|
|
|
|
|
|
|
listboxData.clear();
|
|
|
|
for(int i= 0; i<Renderer::sCount; ++i){
|
|
|
|
listboxData.push_back(lang.get(Renderer::shadowsToStr(static_cast<Renderer::Shadows>(i))));
|
|
|
|
}
|
|
|
|
listBoxShadows.setItems(listboxData);
|
|
|
|
|
|
|
|
labelTextures3D.setText(lang.get("Textures3D"));
|
|
|
|
|
|
|
|
labelLights.setText(lang.get("MaxLights"));
|
|
|
|
|
|
|
|
labelUnitParticles.setText(lang.get("ShowUnitParticles"));
|
|
|
|
|
|
|
|
labelTilesetParticles.setText(lang.get("ShowTilesetParticles"));
|
|
|
|
|
|
|
|
labelMapPreview.setText(lang.get("ShowMapPreview"));
|
|
|
|
|
|
|
|
labelEnableTextureCompression.setText(lang.get("EnableTextureCompression"));
|
|
|
|
|
|
|
|
labelVisibleHud.setText(lang.get("VisibleHUD"));
|
2012-10-12 00:10:31 +02:00
|
|
|
labelChatStaysActive.setText(lang.get("ChatStaysActive"));
|
|
|
|
labelTimeDisplay.setText(lang.get("TimeDisplay"));
|
2011-10-25 20:39:11 +02:00
|
|
|
|
2012-10-16 23:08:45 +02:00
|
|
|
labelLuaDisableSecuritySandbox.setText(lang.get("LuaDisableSecuritySandbox"));
|
|
|
|
|
2011-10-25 20:39:11 +02:00
|
|
|
labelRainEffect.setText(lang.get("RainEffect"));
|
|
|
|
|
2012-06-09 07:02:01 +02:00
|
|
|
labelVideos.setText(lang.get("EnableVideos"));
|
|
|
|
|
2011-10-25 20:39:11 +02:00
|
|
|
labelMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
labelMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
|
|
|
labelMiscSection.setText(lang.get("Misc"));
|
|
|
|
|
|
|
|
labelLang.setText(lang.get("Language"));
|
|
|
|
|
|
|
|
labelPlayerNameLabel.setText(lang.get("Playername"));
|
|
|
|
|
|
|
|
labelPlayerName.setFont(CoreData::getInstance().getMenuFontBig());
|
|
|
|
labelPlayerName.setFont3D(CoreData::getInstance().getMenuFontBig3D());
|
|
|
|
|
|
|
|
labelFontSizeAdjustment.setText(lang.get("FontSizeAdjustment"));
|
|
|
|
|
|
|
|
labelScreenShotType.setText(lang.get("ScreenShotFileType"));
|
|
|
|
|
|
|
|
labelDisableScreenshotConsoleText.setText(lang.get("ScreenShotConsoleText"));
|
|
|
|
|
|
|
|
labelMouseMoveScrollsWorld.setText(lang.get("MouseScrollsWorld"));
|
|
|
|
|
|
|
|
labelNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
|
|
|
labelNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
|
|
|
labelNetworkSettings.setText(lang.get("Network"));
|
|
|
|
|
|
|
|
labelServerPortLabel.setText(lang.get("ServerPort"));
|
|
|
|
|
|
|
|
labelPublishServerExternalPort.setText(lang.get("PublishServerExternalPort"));
|
|
|
|
|
|
|
|
labelEnableFTP.setText(lang.get("EnableFTP"));
|
|
|
|
|
|
|
|
labelEnableFTPServer.setText(lang.get("EnableFTPServer"));
|
|
|
|
|
|
|
|
labelFTPServerPortLabel.setText(lang.get("FTPServerPort"));
|
|
|
|
|
|
|
|
labelFTPServerDataPortsLabel.setText(lang.get("FTPServerDataPort"));
|
|
|
|
|
|
|
|
labelEnableFTPServerInternetTilesetXfer.setText(lang.get("EnableFTPServerInternetTilesetXfer"));
|
|
|
|
|
|
|
|
labelEnableFTPServerInternetTechtreeXfer.setText(lang.get("EnableFTPServerInternetTechtreeXfer"));
|
|
|
|
|
|
|
|
labelEnablePrivacy.setText(lang.get("PrivacyPlease"));
|
|
|
|
|
|
|
|
buttonOk.setText(lang.get("Ok"));
|
|
|
|
buttonAbort.setText(lang.get("Abort"));
|
|
|
|
|
|
|
|
buttonAutoConfig.setText(lang.get("AutoConfig"));
|
|
|
|
|
|
|
|
buttonVideoInfo.setText(lang.get("VideoInfo"));
|
|
|
|
|
|
|
|
buttonKeyboardSetup.setText(lang.get("Keyboardsetup"));
|
|
|
|
|
2012-10-22 07:08:52 +02:00
|
|
|
labelCustomTranslation.setText(lang.get("CustomTranslation"));
|
|
|
|
buttonGetNewLanguageFiles.setText(lang.get("TransifexGetLanguageFiles"));
|
|
|
|
buttonDeleteNewLanguageFiles.setText(lang.get("TransifexDeleteLanguageFiles"));
|
|
|
|
labelTransifexUserLabel.setText(lang.get("TransifexUserName"));
|
|
|
|
labelTransifexPwdLabel.setText(lang.get("TransifexPwd"));
|
|
|
|
labelTransifexI18NLabel.setText(lang.get("TransifexI18N"));
|
|
|
|
|
2011-10-25 20:39:11 +02:00
|
|
|
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
|
|
|
}
|
|
|
|
|
2012-10-22 07:08:52 +02:00
|
|
|
void MenuStateOptions::setupTransifexUI() {
|
|
|
|
buttonGetNewLanguageFiles.setEnabled(checkBoxCustomTranslation.getValue());
|
|
|
|
buttonDeleteNewLanguageFiles.setEnabled(checkBoxCustomTranslation.getValue());
|
|
|
|
labelTransifexUserLabel.setEnabled(checkBoxCustomTranslation.getValue());
|
|
|
|
labelTransifexUser.setEnabled(checkBoxCustomTranslation.getValue());
|
|
|
|
labelTransifexPwdLabel.setEnabled(checkBoxCustomTranslation.getValue());
|
|
|
|
labelTransifexPwd.setEnabled(checkBoxCustomTranslation.getValue());
|
|
|
|
labelTransifexI18NLabel.setEnabled(checkBoxCustomTranslation.getValue());
|
|
|
|
labelTransifexI18N.setEnabled(checkBoxCustomTranslation.getValue());
|
|
|
|
}
|
|
|
|
|
2010-04-02 16:21:43 +02:00
|
|
|
void MenuStateOptions::showMessageBox(const string &text, const string &header, bool toggle){
|
|
|
|
if(!toggle){
|
|
|
|
mainMessageBox.setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!mainMessageBox.getEnabled()){
|
|
|
|
mainMessageBox.setText(text);
|
|
|
|
mainMessageBox.setHeader(header);
|
|
|
|
mainMessageBox.setEnabled(true);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
mainMessageBox.setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-16 23:08:45 +02:00
|
|
|
void MenuStateOptions::showLuaMessageBox(const string &text, const string &header, bool toggle) {
|
|
|
|
if(!toggle) {
|
|
|
|
luaMessageBox.setEnabled(false);
|
|
|
|
}
|
2010-04-02 16:21:43 +02:00
|
|
|
|
2012-10-16 23:08:45 +02:00
|
|
|
if(!luaMessageBox.getEnabled()){
|
|
|
|
luaMessageBox.setText(text);
|
|
|
|
luaMessageBox.setHeader(header);
|
|
|
|
luaMessageBox.setEnabled(true);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
luaMessageBox.setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
2010-04-02 16:21:43 +02:00
|
|
|
|
2010-03-20 13:11:46 +01:00
|
|
|
void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
|
|
|
|
|
|
|
Config &config= Config::getInstance();
|
|
|
|
CoreData &coreData= CoreData::getInstance();
|
|
|
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
|
|
|
|
2010-04-02 16:21:43 +02:00
|
|
|
if(mainMessageBox.getEnabled()){
|
2012-02-19 18:37:53 +01:00
|
|
|
int button= 0;
|
2010-04-02 16:21:43 +02:00
|
|
|
if(mainMessageBox.mouseClick(x, y, button))
|
|
|
|
{
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
2012-02-19 18:37:53 +01:00
|
|
|
if(button==0)
|
2010-04-02 16:21:43 +02:00
|
|
|
{
|
|
|
|
if(mainMessageBoxState==1)
|
|
|
|
{
|
|
|
|
mainMessageBox.setEnabled(false);
|
|
|
|
saveConfig();
|
|
|
|
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
mainMessageBox.setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-10-16 23:08:45 +02:00
|
|
|
else if(luaMessageBox.getEnabled()){
|
|
|
|
int button= 0;
|
|
|
|
if(luaMessageBox.mouseClick(x, y, button)) {
|
|
|
|
checkBoxLuaDisableSecuritySandbox.setValue(false);
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
if(button == 0) {
|
|
|
|
if(luaMessageBoxState == 1) {
|
|
|
|
checkBoxLuaDisableSecuritySandbox.setValue(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
luaMessageBox.setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(checkBoxLuaDisableSecuritySandbox.mouseClick(x, y)) {
|
|
|
|
if(checkBoxLuaDisableSecuritySandbox.getValue() == true) {
|
|
|
|
checkBoxLuaDisableSecuritySandbox.setValue(false);
|
|
|
|
|
|
|
|
luaMessageBoxState=1;
|
|
|
|
Lang &lang= Lang::getInstance();
|
2012-10-17 00:04:26 +02:00
|
|
|
showLuaMessageBox(lang.get("LuaDisableSecuritySandboxWarning"), lang.get("Question"), false);
|
2012-10-16 23:08:45 +02:00
|
|
|
}
|
|
|
|
}
|
2010-04-02 16:21:43 +02:00
|
|
|
else if(buttonOk.mouseClick(x, y)){
|
2010-03-23 02:38:19 +01:00
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
2010-12-09 21:41:11 +01:00
|
|
|
|
2010-04-02 16:21:43 +02:00
|
|
|
string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight")+"-"+intToStr(config.getInt("ColorBits"));
|
|
|
|
string selectedResolution=listBoxScreenModes.getSelectedItem();
|
|
|
|
if(currentResolution!=selectedResolution){
|
|
|
|
mainMessageBoxState=1;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
showMessageBox(lang.get("RestartNeeded"), lang.get("ResolutionChanged"), false);
|
|
|
|
return;
|
|
|
|
}
|
2010-04-08 00:20:28 +02:00
|
|
|
string currentFontSizeAdjustment=config.getString("FontSizeAdjustment");
|
|
|
|
string selectedFontSizeAdjustment=listFontSizeAdjustment.getSelectedItem();
|
|
|
|
if(currentFontSizeAdjustment!=selectedFontSizeAdjustment){
|
|
|
|
mainMessageBoxState=1;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
showMessageBox(lang.get("RestartNeeded"), lang.get("FontSizeAdjustmentChanged"), false);
|
|
|
|
return;
|
|
|
|
}
|
2010-12-09 21:41:11 +01:00
|
|
|
|
2010-05-04 00:07:27 +02:00
|
|
|
bool currentFullscreenWindowed=config.getBool("Windowed");
|
2010-12-27 01:59:57 +01:00
|
|
|
bool selectedFullscreenWindowed = checkBoxFullscreenWindowed.getValue();
|
2010-05-04 00:07:27 +02:00
|
|
|
if(currentFullscreenWindowed!=selectedFullscreenWindowed){
|
|
|
|
mainMessageBoxState=1;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
showMessageBox(lang.get("RestartNeeded"), lang.get("DisplaySettingsChanged"), false);
|
|
|
|
return;
|
|
|
|
}
|
2010-12-09 21:41:11 +01:00
|
|
|
|
2010-03-23 02:38:19 +01:00
|
|
|
saveConfig();
|
|
|
|
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
2011-03-06 08:29:30 +01:00
|
|
|
return;
|
2010-03-23 03:37:41 +01:00
|
|
|
}
|
2010-03-23 02:38:19 +01:00
|
|
|
else if(buttonAbort.mouseClick(x, y)){
|
2010-03-20 13:11:46 +01:00
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
2012-03-13 19:59:33 +01:00
|
|
|
|
|
|
|
// reset the gamma to former value
|
|
|
|
string currentGammaCorrection=config.getString("GammaValue","1.0");
|
|
|
|
string selectedGammaCorrection=listFontSizeAdjustment.getSelectedItem();
|
|
|
|
if(currentGammaCorrection!=selectedGammaCorrection){
|
|
|
|
float gammaValue=strToFloat(currentGammaCorrection);
|
|
|
|
if(gammaValue==0.0f) gammaValue=1.0f;
|
|
|
|
if(gammaValue!=0.0){
|
|
|
|
program->getWindow()->setGamma(gammaValue);
|
|
|
|
SDL_SetGamma(gammaValue, gammaValue, gammaValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-20 13:11:46 +01:00
|
|
|
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
2011-03-06 08:29:30 +01:00
|
|
|
return;
|
2010-03-23 03:37:41 +01:00
|
|
|
}
|
2010-03-20 13:11:46 +01:00
|
|
|
else if(buttonAutoConfig.mouseClick(x, y)){
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
Renderer::getInstance().autoConfig();
|
2011-11-02 20:11:58 +01:00
|
|
|
//saveConfig();
|
2010-03-20 13:11:46 +01:00
|
|
|
mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
2011-03-06 08:29:30 +01:00
|
|
|
return;
|
2010-03-23 03:37:41 +01:00
|
|
|
}
|
2010-07-11 09:38:08 +02:00
|
|
|
else if(buttonVideoInfo.mouseClick(x, y)){
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
mainMenu->setState(new MenuStateGraphicInfo(program, mainMenu));
|
2011-03-06 08:29:30 +01:00
|
|
|
return;
|
2010-07-11 09:38:08 +02:00
|
|
|
}
|
2010-12-24 04:36:34 +01:00
|
|
|
else if(buttonKeyboardSetup.mouseClick(x, y)){
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
2011-01-04 02:39:54 +01:00
|
|
|
mainMenu->setState(new MenuStateKeysetup(program, mainMenu)); // open keyboard shortcuts setup screen
|
|
|
|
//showMessageBox("Not implemented yet", "Keyboard setup", false);
|
2011-03-06 08:29:30 +01:00
|
|
|
return;
|
2010-12-24 04:36:34 +01:00
|
|
|
}
|
2012-10-22 07:08:52 +02:00
|
|
|
else if(checkBoxCustomTranslation.mouseClick(x, y)) {
|
|
|
|
setupTransifexUI();
|
|
|
|
}
|
|
|
|
else if(buttonDeleteNewLanguageFiles.mouseClick(x, y)) {
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
|
|
|
|
setActiveInputLable(NULL);
|
|
|
|
|
|
|
|
if(labelTransifexI18N.getText() != "") {
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
string language = lang.getLanguageFile(labelTransifexI18N.getText());
|
|
|
|
|
|
|
|
if(language != "") {
|
|
|
|
bool foundFilesToDelete = false;
|
|
|
|
|
|
|
|
Config &config = Config::getInstance();
|
|
|
|
string data_path = config.getString("UserData_Root","");
|
|
|
|
if(data_path != "") {
|
|
|
|
endPathWithSlash(data_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(data_path != "") {
|
2012-10-22 20:11:51 +02:00
|
|
|
|
|
|
|
string txnURLFileListMapping = Config::getInstance().getString("TranslationGetURLFileListMapping");
|
|
|
|
vector<string> languageFileMappings;
|
|
|
|
Tokenize(txnURLFileListMapping,languageFileMappings,"|");
|
|
|
|
|
2012-10-22 07:08:52 +02:00
|
|
|
Config &config = Config::getInstance();
|
|
|
|
|
|
|
|
// Cleanup Scenarios
|
|
|
|
vector<string> scenarioPaths = config.getPathListForType(ptScenarios);
|
|
|
|
if(scenarioPaths.size() > 1) {
|
|
|
|
string &scenarioPath = scenarioPaths[1];
|
|
|
|
endPathWithSlash(scenarioPath);
|
|
|
|
|
|
|
|
vector<string> scenarioList;
|
|
|
|
findDirs(scenarioPath, scenarioList, false,false);
|
|
|
|
for(unsigned int i = 0; i < scenarioList.size(); ++i) {
|
|
|
|
string scenario = scenarioList[i];
|
|
|
|
|
|
|
|
vector<string> langResults;
|
|
|
|
findAll(scenarioPath + scenario + "/*.lng", langResults, false, false);
|
|
|
|
for(unsigned int j = 0; j < langResults.size(); ++j) {
|
|
|
|
string testLanguage = langResults[j];
|
|
|
|
|
|
|
|
string removeLngFile = scenarioPath + scenario + "/" + testLanguage;
|
|
|
|
|
|
|
|
if(EndsWith(testLanguage,language + ".lng") == true) {
|
2012-10-22 20:11:51 +02:00
|
|
|
|
|
|
|
for(unsigned int k = 0; k < languageFileMappings.size(); ++k) {
|
|
|
|
string mapping = languageFileMappings[k];
|
|
|
|
replaceAll(mapping,"$language",language);
|
|
|
|
|
|
|
|
//printf("Comparing found [%s] with [%s]\n",removeLngFile.c_str(),mapping.c_str());
|
|
|
|
|
|
|
|
if(EndsWith(removeLngFile,mapping) == true) {
|
|
|
|
printf("About to delete file [%s]\n",removeLngFile.c_str());
|
|
|
|
removeFile(removeLngFile);
|
|
|
|
foundFilesToDelete = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-10-22 07:08:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cleanup tutorials
|
|
|
|
vector<string> tutorialPaths = config.getPathListForType(ptTutorials);
|
|
|
|
if(tutorialPaths.size() > 1) {
|
|
|
|
string &tutorialPath = tutorialPaths[1];
|
|
|
|
endPathWithSlash(tutorialPath);
|
|
|
|
|
|
|
|
vector<string> tutorialList;
|
|
|
|
findDirs(tutorialPath, tutorialList, false, false);
|
|
|
|
for(unsigned int i = 0; i < tutorialList.size(); ++i) {
|
|
|
|
string tutorial = tutorialList[i];
|
|
|
|
|
|
|
|
vector<string> langResults;
|
|
|
|
findAll(tutorialPath + tutorial + "/*.lng", langResults, false, false);
|
|
|
|
for(unsigned int j = 0; j < langResults.size(); ++j) {
|
|
|
|
string testLanguage = langResults[j];
|
|
|
|
|
|
|
|
string removeLngFile = tutorialPath + tutorial + "/" + testLanguage;
|
|
|
|
if(EndsWith(testLanguage,language + ".lng") == true) {
|
2012-10-22 20:11:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
for(unsigned int k = 0; k < languageFileMappings.size(); ++k) {
|
|
|
|
string mapping = languageFileMappings[k];
|
|
|
|
replaceAll(mapping,"$language",language);
|
|
|
|
|
|
|
|
//printf("Comparing found [%s] with [%s]\n",removeLngFile.c_str(),mapping.c_str());
|
|
|
|
|
|
|
|
if(EndsWith(removeLngFile,mapping) == true) {
|
|
|
|
printf("About to delete file [%s]\n",removeLngFile.c_str());
|
|
|
|
removeFile(removeLngFile);
|
|
|
|
foundFilesToDelete = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-10-22 07:08:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cleanup main and hint language files
|
|
|
|
string mainLngFile = data_path + "data/lang/" + language + ".lng";
|
|
|
|
if(fileExists(mainLngFile) == true) {
|
2012-10-22 20:11:51 +02:00
|
|
|
|
|
|
|
for(unsigned int k = 0; k < languageFileMappings.size(); ++k) {
|
|
|
|
string mapping = languageFileMappings[k];
|
|
|
|
replaceAll(mapping,"$language",language);
|
|
|
|
|
|
|
|
if(EndsWith(mainLngFile,mapping) == true) {
|
|
|
|
printf("About to delete file [%s]\n",mainLngFile.c_str());
|
|
|
|
removeFile(mainLngFile);
|
|
|
|
foundFilesToDelete = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-10-22 07:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
string hintLngFile = data_path + "data/lang/hint/hint_" + language + ".lng";
|
|
|
|
if(fileExists(hintLngFile) == true) {
|
2012-10-22 20:11:51 +02:00
|
|
|
for(unsigned int k = 0; k < languageFileMappings.size(); ++k) {
|
|
|
|
string mapping = languageFileMappings[k];
|
|
|
|
replaceAll(mapping,"$language",language);
|
|
|
|
|
|
|
|
if(EndsWith(hintLngFile,mapping) == true) {
|
|
|
|
printf("About to delete file [%s]\n",hintLngFile.c_str());
|
|
|
|
removeFile(hintLngFile);
|
|
|
|
foundFilesToDelete = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-10-22 07:08:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(lang.isLanguageLocal(toLower(language)) == true) {
|
|
|
|
lang.loadStrings(toLower(language));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(foundFilesToDelete == true) {
|
|
|
|
mainMessageBoxState=0;
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
showMessageBox(lang.get("TransifexDeleteSuccess"), lang.get("Notice"), false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(buttonGetNewLanguageFiles.mouseClick(x, y)) {
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
|
|
|
|
setActiveInputLable(NULL);
|
|
|
|
|
|
|
|
string orig_txnURLUser = Config::getInstance().getString("TranslationGetURLUser");
|
2012-10-23 00:06:30 +02:00
|
|
|
//string orig_txnURLPwd = Config::getInstance().getString("TranslationGetURLPassword","");
|
2012-10-22 07:08:52 +02:00
|
|
|
string orig_txnURLLang = Config::getInstance().getString("TranslationGetURLLanguage");
|
|
|
|
|
|
|
|
Config::getInstance().setString("TranslationGetURLUser",labelTransifexUser.getText());
|
2012-10-23 00:06:30 +02:00
|
|
|
Config::getInstance().setString("TranslationGetURLPassword",labelTransifexPwd.getText(),true);
|
2012-10-22 07:08:52 +02:00
|
|
|
Config::getInstance().setString("TranslationGetURLLanguage",labelTransifexI18N.getText());
|
|
|
|
|
|
|
|
bool saveChanges = (orig_txnURLUser != labelTransifexUser.getText() ||
|
|
|
|
orig_txnURLLang != labelTransifexI18N.getText());
|
|
|
|
|
|
|
|
string txnURL = Config::getInstance().getString("TranslationGetURL");
|
|
|
|
string txnURLUser = Config::getInstance().getString("TranslationGetURLUser");
|
|
|
|
string txnURLPwd = Config::getInstance().getString("TranslationGetURLPassword");
|
|
|
|
string txnURLLang = Config::getInstance().getString("TranslationGetURLLanguage");
|
|
|
|
string txnURLFileList = Config::getInstance().getString("TranslationGetURLFileList");
|
|
|
|
string txnURLFileListMapping = Config::getInstance().getString("TranslationGetURLFileListMapping");
|
|
|
|
|
|
|
|
string txnURLDetails = Config::getInstance().getString("TranslationGetURLDetails");
|
|
|
|
|
|
|
|
string credentials = txnURLUser + ":" + txnURLPwd;
|
|
|
|
|
|
|
|
printf("URL1 [%s] credentials [%s]\n",txnURL.c_str(),credentials.c_str());
|
|
|
|
|
|
|
|
//txnURLUser = SystemFlags::escapeURL(txnURLUser,handle);
|
|
|
|
//replaceAll(txnURL,"$user",txnURLUser);
|
|
|
|
|
|
|
|
//printf("URL2 [%s]\n",txnURL.c_str());
|
|
|
|
|
|
|
|
//txnURLPwd = SystemFlags::escapeURL(txnURLPwd,handle);
|
|
|
|
//replaceAll(txnURL,"$password",txnURLPwd);
|
|
|
|
|
|
|
|
//printf("URL3 [%s]\n",txnURL.c_str());
|
|
|
|
|
|
|
|
replaceAll(txnURL,"$language",txnURLLang);
|
|
|
|
|
|
|
|
printf("URL4 [%s]\n",txnURL.c_str());
|
|
|
|
|
|
|
|
//txnURLFileList
|
|
|
|
vector<string> languageFiles;
|
|
|
|
Tokenize(txnURLFileList,languageFiles,"|");
|
|
|
|
|
|
|
|
vector<string> languageFileMappings;
|
|
|
|
Tokenize(txnURLFileListMapping,languageFileMappings,"|");
|
|
|
|
|
2012-10-26 04:42:10 +02:00
|
|
|
printf("URL5 file count = %zu, %zu [%s]\n",languageFiles.size(),languageFileMappings.size(),(languageFiles.empty() == false ? languageFiles[0].c_str() : ""));
|
2012-10-22 07:08:52 +02:00
|
|
|
|
2012-10-24 08:54:10 +02:00
|
|
|
if(languageFiles.empty() == false) {
|
2012-10-22 07:08:52 +02:00
|
|
|
|
2012-10-24 08:54:10 +02:00
|
|
|
bool gotDownloads = false;
|
2012-10-22 07:08:52 +02:00
|
|
|
bool reloadLanguage = false;
|
|
|
|
string langName = "";
|
|
|
|
|
|
|
|
CURL *handle = SystemFlags::initHTTP();
|
|
|
|
for(unsigned int i = 0; i < languageFiles.size(); ++i) {
|
|
|
|
string fileURL = txnURL;
|
|
|
|
replaceAll(fileURL,"$file",languageFiles[i]);
|
|
|
|
|
|
|
|
if(langName == "") {
|
|
|
|
// Get language name for file
|
|
|
|
string fileURLDetails = txnURLDetails;
|
|
|
|
replaceAll(fileURLDetails,"$file",languageFiles[0]);
|
|
|
|
|
|
|
|
printf(" i = %u Trying [%s]\n",i,fileURLDetails.c_str());
|
|
|
|
curl_easy_setopt(handle, CURLOPT_VERBOSE, 1);
|
|
|
|
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
|
|
|
|
curl_easy_setopt(handle, CURLOPT_USERPWD, credentials.c_str());
|
|
|
|
std::string fileDataDetails = SystemFlags::getHTTP(fileURLDetails,handle);
|
|
|
|
|
|
|
|
// "available_languages": [
|
|
|
|
// {
|
|
|
|
// "code_aliases": " ",
|
|
|
|
// "code": "ca",
|
|
|
|
// "name": "Catalan"
|
|
|
|
// },
|
|
|
|
// {
|
|
|
|
// "code_aliases": " ",
|
|
|
|
// "code": "zh",
|
|
|
|
// "name": "Chinese"
|
|
|
|
// },
|
|
|
|
// curl -i -L --user softcoder -X GET https://www.transifex.com/api/2/project/megaglest/resource/main-language-file/?details
|
|
|
|
|
|
|
|
string search_detail_key = "\"code\": \"" + txnURLLang + "\"";
|
|
|
|
size_t posDetails = fileDataDetails.find( search_detail_key, 0 );
|
|
|
|
if( posDetails != fileDataDetails.npos ) {
|
|
|
|
posDetails = fileDataDetails.find( "\"name\": \"", posDetails+search_detail_key.length() );
|
|
|
|
|
|
|
|
if( posDetails != fileDataDetails.npos ) {
|
|
|
|
|
|
|
|
size_t posDetailsEnd = fileDataDetails.find( "\"", posDetails + 9 );
|
|
|
|
|
|
|
|
langName = fileDataDetails.substr(posDetails + 9, posDetailsEnd - (posDetails + 9));
|
2012-10-23 16:49:08 +02:00
|
|
|
replaceAll(langName,",","");
|
|
|
|
replaceAll(langName,"\\","");
|
|
|
|
replaceAll(langName,"/","");
|
|
|
|
replaceAll(langName,"?","");
|
|
|
|
replaceAll(langName,":","");
|
|
|
|
replaceAll(langName,"@","");
|
|
|
|
replaceAll(langName,"!","");
|
|
|
|
replaceAll(langName,"*","");
|
|
|
|
langName = trim(langName);
|
|
|
|
replaceAll(langName," ","-");
|
2012-10-22 07:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
printf("PARSED Language filename [%s]\n",langName.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("i = %u Trying [%s]\n",i,fileURL.c_str());
|
|
|
|
curl_easy_setopt(handle, CURLOPT_VERBOSE, 1);
|
|
|
|
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
|
|
|
|
curl_easy_setopt(handle, CURLOPT_USERPWD, credentials.c_str());
|
|
|
|
std::string fileData = SystemFlags::getHTTP(fileURL,handle);
|
|
|
|
|
|
|
|
// "content": "
|
|
|
|
// ",
|
|
|
|
// "mimetype": "text/plain"
|
|
|
|
size_t pos = fileData.find( "\"content\": \"", 0 );
|
|
|
|
if( pos != fileData.npos ) {
|
|
|
|
fileData = fileData.substr(pos+12, fileData.length());
|
|
|
|
|
|
|
|
pos = fileData.find( "\",\n", 0 );
|
|
|
|
if( pos != fileData.npos ) {
|
|
|
|
fileData = fileData.substr(0, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
replaceAll(fileData,"\\\\n","$requires-newline$");
|
|
|
|
replaceAll(fileData,"\\n","\n");
|
|
|
|
replaceAll(fileData,"$requires-newline$","\\n");
|
|
|
|
|
2012-10-22 22:05:42 +02:00
|
|
|
//replaceAll(fileData,""","\"");
|
|
|
|
replaceAllHTMLEntities(fileData);
|
2012-10-22 21:38:28 +02:00
|
|
|
|
|
|
|
|
2012-10-22 07:08:52 +02:00
|
|
|
printf("PARSED Language text\n[%s]\n",fileData.c_str());
|
|
|
|
|
|
|
|
//vector<string> languageName;
|
|
|
|
//Tokenize(fileData,languageName," ");
|
|
|
|
//printf("PARSED Language Name guessed to be [%s]\n",languageName[1].c_str());
|
|
|
|
|
|
|
|
//string data_path= getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
|
|
|
//if(data_path != ""){
|
|
|
|
//endPathWithSlash(data_path);
|
|
|
|
//}
|
|
|
|
Config &config = Config::getInstance();
|
|
|
|
string data_path = config.getString("UserData_Root","");
|
|
|
|
if(data_path != "") {
|
|
|
|
endPathWithSlash(data_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
string outputFile = languageFileMappings[i];
|
|
|
|
replaceAll(outputFile,"$language",toLower(langName));
|
|
|
|
//string lngFile = getGameCustomCoreDataPath(data_path, "data/lang/" + toLower(languageName[1]) + ".lng");
|
|
|
|
string lngFile = getGameCustomCoreDataPath(data_path, outputFile);
|
|
|
|
|
|
|
|
string lngPath = extractDirectoryPathFromFile(lngFile);
|
|
|
|
createDirectoryPaths(lngPath);
|
|
|
|
|
|
|
|
printf("Save data to Language Name [%s]\n",lngFile.c_str());
|
|
|
|
saveDataToFile(lngFile, fileData);
|
|
|
|
gotDownloads = true;
|
|
|
|
|
|
|
|
reloadLanguage = true;
|
|
|
|
if(saveChanges == true) {
|
|
|
|
saveChanges = false;
|
|
|
|
config.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("UNPARSED Language text\n[%s]\n",fileData.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SystemFlags::cleanupHTTP(&handle);
|
|
|
|
|
|
|
|
if(reloadLanguage == true && langName != "") {
|
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
if(lang.isLanguageLocal(toLower(langName)) == true) {
|
|
|
|
lang.loadStrings(toLower(langName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(gotDownloads == true) {
|
|
|
|
mainMessageBoxState=0;
|
|
|
|
Lang &lang= Lang::getInstance();
|
2012-10-23 16:49:08 +02:00
|
|
|
showMessageBox(lang.get("TransifexDownloadSuccess") + "\n" + langName, lang.get("Notice"), false);
|
2012-10-22 07:08:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2010-03-23 02:38:19 +01:00
|
|
|
else if(labelPlayerName.mouseClick(x, y) && ( activeInputLabel != &labelPlayerName )){
|
|
|
|
setActiveInputLable(&labelPlayerName);
|
2010-03-20 13:11:46 +01:00
|
|
|
}
|
2012-10-22 07:08:52 +02:00
|
|
|
else if(labelTransifexUser.mouseClick(x, y) && ( activeInputLabel != &labelTransifexUser )){
|
|
|
|
setActiveInputLable(&labelTransifexUser);
|
|
|
|
}
|
|
|
|
else if(labelTransifexPwd.mouseClick(x, y) && ( activeInputLabel != &labelTransifexPwd )){
|
|
|
|
setActiveInputLable(&labelTransifexPwd);
|
|
|
|
}
|
|
|
|
else if(labelTransifexI18N.mouseClick(x, y) && ( activeInputLabel != &labelTransifexI18N )){
|
|
|
|
setActiveInputLable(&labelTransifexI18N);
|
|
|
|
}
|
2010-03-23 02:38:19 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
listBoxLang.mouseClick(x, y);
|
|
|
|
listBoxShadows.mouseClick(x, y);
|
2012-05-11 00:32:38 +02:00
|
|
|
listBoxShadowTextureSize.mouseClick(x, y);
|
2010-03-23 02:38:19 +01:00
|
|
|
listBoxFilter.mouseClick(x, y);
|
2012-03-13 01:44:55 +01:00
|
|
|
if(listBoxGammaCorrection.mouseClick(x, y)){
|
2012-03-13 19:59:33 +01:00
|
|
|
float gammaValue=strToFloat(listBoxGammaCorrection.getSelectedItem());
|
|
|
|
if(gammaValue!=0.0){
|
|
|
|
program->getWindow()->setGamma(gammaValue);
|
|
|
|
SDL_SetGamma(gammaValue, gammaValue, gammaValue);
|
|
|
|
}
|
2012-03-13 01:44:55 +01:00
|
|
|
}
|
2010-12-27 01:59:57 +01:00
|
|
|
checkBoxTextures3D.mouseClick(x, y);
|
|
|
|
checkBoxUnitParticles.mouseClick(x, y);
|
2011-03-06 14:11:22 +01:00
|
|
|
checkBoxTilesetParticles.mouseClick(x, y);
|
2010-12-27 01:59:57 +01:00
|
|
|
checkBoxMapPreview.mouseClick(x, y);
|
2010-03-23 02:38:19 +01:00
|
|
|
listBoxLights.mouseClick(x, y);
|
2010-07-16 08:35:22 +02:00
|
|
|
listBoxSoundFactory.mouseClick(x, y);
|
2010-03-23 02:38:19 +01:00
|
|
|
listBoxVolumeFx.mouseClick(x, y);
|
|
|
|
listBoxVolumeAmbient.mouseClick(x, y);
|
|
|
|
listBoxVolumeMusic.mouseClick(x, y);
|
2010-04-01 02:13:28 +02:00
|
|
|
listBoxScreenModes.mouseClick(x, y);
|
2010-04-08 00:20:28 +02:00
|
|
|
listFontSizeAdjustment.mouseClick(x, y);
|
2010-12-27 01:59:57 +01:00
|
|
|
checkBoxFullscreenWindowed.mouseClick(x, y);
|
2012-10-06 14:56:53 +02:00
|
|
|
if(listBoxServerPort.mouseClick(x, y)){
|
|
|
|
int selectedPort=strToInt(listBoxServerPort.getSelectedItem());
|
2011-01-12 20:42:25 +01:00
|
|
|
if(selectedPort<10000){
|
|
|
|
selectedPort=GameConstants::serverPort;
|
|
|
|
}
|
|
|
|
// use the following ports for ftp
|
2012-10-19 03:31:20 +02:00
|
|
|
char szBuf[8096]="";
|
|
|
|
snprintf(szBuf,8096,"%d - %d",selectedPort + 2, selectedPort + 1 + GameConstants::maxPlayers);
|
2012-10-06 15:45:42 +02:00
|
|
|
labelFTPServerPort.setText(intToStr(selectedPort+1));
|
2011-01-12 20:42:25 +01:00
|
|
|
labelFTPServerDataPorts.setText(szBuf);
|
|
|
|
}
|
2011-01-06 08:15:43 +01:00
|
|
|
|
2011-01-07 06:32:47 +01:00
|
|
|
checkBoxEnableFTP.mouseClick(x, y);
|
|
|
|
checkBoxEnableFTPServer.mouseClick(x, y);
|
2011-01-26 00:30:51 +01:00
|
|
|
|
2011-03-11 13:14:24 +01:00
|
|
|
checkBoxEnableFTPServerInternetTilesetXfer.mouseClick(x, y);
|
|
|
|
checkBoxEnableFTPServerInternetTechtreeXfer.mouseClick(x, y);
|
|
|
|
|
2011-01-26 00:30:51 +01:00
|
|
|
checkBoxEnablePrivacy.mouseClick(x, y);
|
2011-03-31 03:34:01 +02:00
|
|
|
|
|
|
|
checkBoxEnableTextureCompression.mouseClick(x, y);
|
2011-04-02 23:17:17 +02:00
|
|
|
|
|
|
|
listBoxScreenShotType.mouseClick(x, y);
|
2011-04-19 05:26:42 +02:00
|
|
|
|
|
|
|
checkBoxDisableScreenshotConsoleText.mouseClick(x, y);
|
2011-08-31 22:10:43 +02:00
|
|
|
checkBoxMouseMoveScrollsWorld.mouseClick(x, y);
|
2012-06-09 07:02:01 +02:00
|
|
|
checkBoxVisibleHud.mouseClick(x, y);
|
2012-10-12 00:10:31 +02:00
|
|
|
checkBoxChatStaysActive.mouseClick(x, y);
|
|
|
|
checkBoxTimeDisplay.mouseClick(x, y);
|
|
|
|
|
2012-10-16 23:08:45 +02:00
|
|
|
checkBoxLuaDisableSecuritySandbox.mouseClick(x, y);
|
|
|
|
|
2012-06-09 07:02:01 +02:00
|
|
|
checkBoxRainEffect.mouseClick(x,y);
|
|
|
|
checkBoxRainEffectMenu.mouseClick(x,y);
|
|
|
|
|
|
|
|
checkBoxVideos.mouseClick(x,y);
|
2010-03-20 13:11:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
|
2010-04-02 16:21:43 +02:00
|
|
|
if (mainMessageBox.getEnabled()) {
|
2012-10-16 23:08:45 +02:00
|
|
|
mainMessageBox.mouseMove(x, y);
|
|
|
|
}
|
|
|
|
if (luaMessageBox.getEnabled()) {
|
|
|
|
luaMessageBox.mouseMove(x, y);
|
|
|
|
}
|
|
|
|
|
2010-03-23 02:38:19 +01:00
|
|
|
buttonOk.mouseMove(x, y);
|
|
|
|
buttonAbort.mouseMove(x, y);
|
2010-03-20 13:11:46 +01:00
|
|
|
buttonAutoConfig.mouseMove(x, y);
|
2010-07-11 09:38:08 +02:00
|
|
|
buttonVideoInfo.mouseMove(x, y);
|
2010-12-24 04:36:34 +01:00
|
|
|
buttonKeyboardSetup.mouseMove(x, y);
|
2012-10-22 07:08:52 +02:00
|
|
|
buttonGetNewLanguageFiles.mouseMove(x, y);
|
|
|
|
buttonDeleteNewLanguageFiles.mouseMove(x, y);
|
2010-03-20 13:11:46 +01:00
|
|
|
listBoxLang.mouseMove(x, y);
|
2010-07-16 08:35:22 +02:00
|
|
|
listBoxSoundFactory.mouseMove(x, y);
|
2010-03-20 13:11:46 +01:00
|
|
|
listBoxVolumeFx.mouseMove(x, y);
|
|
|
|
listBoxVolumeAmbient.mouseMove(x, y);
|
|
|
|
listBoxVolumeMusic.mouseMove(x, y);
|
|
|
|
listBoxLang.mouseMove(x, y);
|
|
|
|
listBoxFilter.mouseMove(x, y);
|
2012-03-13 01:44:55 +01:00
|
|
|
listBoxGammaCorrection.mouseMove(x, y);
|
2010-03-20 13:11:46 +01:00
|
|
|
listBoxShadows.mouseMove(x, y);
|
2010-12-27 01:59:57 +01:00
|
|
|
checkBoxTextures3D.mouseMove(x, y);
|
|
|
|
checkBoxUnitParticles.mouseMove(x, y);
|
2011-03-06 14:11:22 +01:00
|
|
|
checkBoxTilesetParticles.mouseMove(x, y);
|
2010-12-27 01:59:57 +01:00
|
|
|
checkBoxMapPreview.mouseMove(x, y);
|
2010-03-20 13:11:46 +01:00
|
|
|
listBoxLights.mouseMove(x, y);
|
2010-04-01 02:13:28 +02:00
|
|
|
listBoxScreenModes.mouseMove(x, y);
|
2010-12-27 01:59:57 +01:00
|
|
|
checkBoxFullscreenWindowed.mouseMove(x, y);
|
2010-04-08 00:20:28 +02:00
|
|
|
listFontSizeAdjustment.mouseMove(x, y);
|
2012-10-06 14:56:53 +02:00
|
|
|
listBoxServerPort.mouseMove(x, y);
|
2011-01-07 06:32:47 +01:00
|
|
|
checkBoxEnableFTP.mouseMove(x, y);
|
|
|
|
checkBoxEnableFTPServer.mouseMove(x, y);
|
2011-03-11 13:14:24 +01:00
|
|
|
checkBoxEnableFTPServerInternetTilesetXfer.mouseMove(x, y);
|
|
|
|
checkBoxEnableFTPServerInternetTechtreeXfer.mouseMove(x, y);
|
2011-01-26 00:30:51 +01:00
|
|
|
checkBoxEnablePrivacy.mouseMove(x, y);
|
2011-03-31 03:34:01 +02:00
|
|
|
checkBoxEnableTextureCompression.mouseMove(x, y);
|
2011-04-02 23:17:17 +02:00
|
|
|
listBoxScreenShotType.mouseMove(x, y);
|
2011-08-31 22:10:43 +02:00
|
|
|
checkBoxDisableScreenshotConsoleText.mouseMove(x, y);
|
|
|
|
checkBoxMouseMoveScrollsWorld.mouseMove(x, y);
|
2012-04-12 00:19:50 +02:00
|
|
|
checkBoxVisibleHud.mouseMove(x, y);
|
2012-10-12 00:10:31 +02:00
|
|
|
checkBoxChatStaysActive.mouseMove(x, y);
|
|
|
|
checkBoxTimeDisplay.mouseMove(x, y);
|
2012-10-16 23:08:45 +02:00
|
|
|
|
|
|
|
checkBoxLuaDisableSecuritySandbox.mouseMove(x, y);
|
|
|
|
|
2012-04-12 00:19:50 +02:00
|
|
|
checkBoxRainEffect.mouseMove(x, y);
|
|
|
|
checkBoxRainEffectMenu.mouseMove(x, y);
|
2012-06-09 07:02:01 +02:00
|
|
|
|
|
|
|
checkBoxVideos.mouseMove(x, y);
|
2012-10-22 07:08:52 +02:00
|
|
|
|
|
|
|
checkBoxCustomTranslation.mouseMove(x, y);
|
2010-03-20 13:11:46 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 18:25:16 +02:00
|
|
|
bool MenuStateOptions::isInSpecialKeyCaptureEvent() {
|
|
|
|
return (activeInputLabel != NULL);
|
|
|
|
}
|
|
|
|
|
2011-06-26 03:55:08 +02:00
|
|
|
void MenuStateOptions::keyDown(SDL_KeyboardEvent key) {
|
2011-04-20 18:25:16 +02:00
|
|
|
if(activeInputLabel != NULL) {
|
2012-07-26 08:27:00 +02:00
|
|
|
keyDownEditLabel(key, &activeInputLabel);
|
2010-03-23 02:38:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-26 03:55:08 +02:00
|
|
|
void MenuStateOptions::keyPress(SDL_KeyboardEvent c) {
|
2012-07-26 08:27:00 +02:00
|
|
|
if(activeInputLabel != NULL) {
|
2010-12-24 04:36:34 +01:00
|
|
|
//printf("[%d]\n",c); fflush(stdout);
|
2012-10-22 07:08:52 +02:00
|
|
|
if( &labelPlayerName == activeInputLabel ||
|
|
|
|
&labelTransifexUser == activeInputLabel ||
|
|
|
|
&labelTransifexPwd == activeInputLabel ||
|
|
|
|
&labelTransifexI18N == activeInputLabel) {
|
2012-07-26 08:27:00 +02:00
|
|
|
keyPressEditLabel(c, &activeInputLabel);
|
2010-03-23 03:37:41 +01:00
|
|
|
}
|
2010-03-23 02:38:19 +01:00
|
|
|
}
|
2010-09-09 23:07:39 +02:00
|
|
|
else {
|
|
|
|
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
2011-06-26 03:55:08 +02:00
|
|
|
if(isKeyPressed(configKeys.getSDLKey("SaveGUILayout"),c) == true) {
|
2011-09-01 03:11:23 +02:00
|
|
|
GraphicComponent::saveAllCustomProperties(containerName);
|
2010-09-09 23:07:39 +02:00
|
|
|
//Lang &lang= Lang::getInstance();
|
|
|
|
//console.addLine(lang.get("GUILayoutSaved") + " [" + (saved ? lang.get("Yes") : lang.get("No"))+ "]");
|
|
|
|
}
|
|
|
|
}
|
2010-03-23 02:38:19 +01:00
|
|
|
}
|
|
|
|
|
2010-03-20 13:11:46 +01:00
|
|
|
void MenuStateOptions::render(){
|
|
|
|
Renderer &renderer= Renderer::getInstance();
|
|
|
|
|
2010-04-02 16:21:43 +02:00
|
|
|
if(mainMessageBox.getEnabled()){
|
|
|
|
renderer.renderMessageBox(&mainMessageBox);
|
|
|
|
}
|
2012-10-16 23:08:45 +02:00
|
|
|
else if(luaMessageBox.getEnabled()){
|
|
|
|
renderer.renderMessageBox(&luaMessageBox);
|
|
|
|
}
|
2010-04-02 16:21:43 +02:00
|
|
|
else
|
|
|
|
{
|
2010-04-03 19:17:15 +02:00
|
|
|
renderer.renderButton(&buttonOk);
|
|
|
|
renderer.renderButton(&buttonAbort);
|
|
|
|
renderer.renderButton(&buttonAutoConfig);
|
2010-07-11 09:38:08 +02:00
|
|
|
renderer.renderButton(&buttonVideoInfo);
|
2010-12-24 04:36:34 +01:00
|
|
|
renderer.renderButton(&buttonKeyboardSetup);
|
2012-10-22 07:08:52 +02:00
|
|
|
|
|
|
|
renderer.renderLabel(&labelCustomTranslation);
|
|
|
|
renderer.renderCheckBox(&checkBoxCustomTranslation);
|
|
|
|
|
|
|
|
if(buttonGetNewLanguageFiles.getEnabled()) renderer.renderButton(&buttonGetNewLanguageFiles);
|
|
|
|
if(buttonDeleteNewLanguageFiles.getEnabled()) renderer.renderButton(&buttonDeleteNewLanguageFiles);
|
|
|
|
if(labelTransifexUserLabel.getEnabled()) renderer.renderLabel(&labelTransifexUserLabel);
|
|
|
|
if(labelTransifexPwdLabel.getEnabled()) renderer.renderLabel(&labelTransifexPwdLabel);
|
|
|
|
if(labelTransifexI18NLabel.getEnabled()) renderer.renderLabel(&labelTransifexI18NLabel);
|
|
|
|
if(labelTransifexUser.getEnabled()) renderer.renderLabel(&labelTransifexUser);
|
|
|
|
if(labelTransifexPwd.getEnabled()) renderer.renderLabel(&labelTransifexPwd);
|
|
|
|
if(labelTransifexI18N.getEnabled()) renderer.renderLabel(&labelTransifexI18N);
|
|
|
|
|
2010-04-03 19:17:15 +02:00
|
|
|
renderer.renderListBox(&listBoxLang);
|
|
|
|
renderer.renderListBox(&listBoxShadows);
|
2010-12-27 01:59:57 +01:00
|
|
|
renderer.renderCheckBox(&checkBoxTextures3D);
|
|
|
|
renderer.renderCheckBox(&checkBoxUnitParticles);
|
2011-03-06 14:11:22 +01:00
|
|
|
renderer.renderCheckBox(&checkBoxTilesetParticles);
|
2010-12-27 01:59:57 +01:00
|
|
|
renderer.renderCheckBox(&checkBoxMapPreview);
|
2010-04-03 19:17:15 +02:00
|
|
|
renderer.renderListBox(&listBoxLights);
|
|
|
|
renderer.renderListBox(&listBoxFilter);
|
2012-03-13 01:44:55 +01:00
|
|
|
renderer.renderListBox(&listBoxGammaCorrection);
|
2010-07-16 08:35:22 +02:00
|
|
|
renderer.renderListBox(&listBoxSoundFactory);
|
2010-04-03 19:17:15 +02:00
|
|
|
renderer.renderListBox(&listBoxVolumeFx);
|
|
|
|
renderer.renderListBox(&listBoxVolumeAmbient);
|
|
|
|
renderer.renderListBox(&listBoxVolumeMusic);
|
|
|
|
renderer.renderLabel(&labelLang);
|
|
|
|
renderer.renderLabel(&labelPlayerNameLabel);
|
|
|
|
renderer.renderLabel(&labelPlayerName);
|
|
|
|
renderer.renderLabel(&labelShadows);
|
|
|
|
renderer.renderLabel(&labelTextures3D);
|
|
|
|
renderer.renderLabel(&labelUnitParticles);
|
2011-03-06 14:11:22 +01:00
|
|
|
renderer.renderLabel(&labelTilesetParticles);
|
2010-09-26 23:34:00 +02:00
|
|
|
renderer.renderLabel(&labelMapPreview);
|
2010-04-03 19:17:15 +02:00
|
|
|
renderer.renderLabel(&labelLights);
|
|
|
|
renderer.renderLabel(&labelFilter);
|
2012-03-13 01:44:55 +01:00
|
|
|
renderer.renderLabel(&labelGammaCorrection);
|
2010-07-16 08:35:22 +02:00
|
|
|
renderer.renderLabel(&labelSoundFactory);
|
2010-04-03 19:17:15 +02:00
|
|
|
renderer.renderLabel(&labelVolumeFx);
|
|
|
|
renderer.renderLabel(&labelVolumeAmbient);
|
|
|
|
renderer.renderLabel(&labelVolumeMusic);
|
|
|
|
renderer.renderLabel(&labelVideoSection);
|
|
|
|
renderer.renderLabel(&labelAudioSection);
|
|
|
|
renderer.renderLabel(&labelMiscSection);
|
|
|
|
renderer.renderLabel(&labelScreenModes);
|
|
|
|
renderer.renderListBox(&listBoxScreenModes);
|
|
|
|
renderer.renderLabel(&labelServerPortLabel);
|
2012-10-06 15:45:42 +02:00
|
|
|
renderer.renderLabel(&labelExternalPort);
|
2010-04-08 00:20:28 +02:00
|
|
|
renderer.renderListBox(&listFontSizeAdjustment);
|
|
|
|
renderer.renderLabel(&labelFontSizeAdjustment);
|
2010-05-04 00:07:27 +02:00
|
|
|
renderer.renderLabel(&labelFullscreenWindowed);
|
2010-12-27 01:59:57 +01:00
|
|
|
renderer.renderCheckBox(&checkBoxFullscreenWindowed);
|
2010-10-11 02:53:25 +02:00
|
|
|
renderer.renderLabel(&labelPublishServerExternalPort);
|
2012-10-06 14:56:53 +02:00
|
|
|
renderer.renderListBox(&listBoxServerPort);
|
2011-01-09 19:05:10 +01:00
|
|
|
renderer.renderLabel(&labelNetworkSettings);
|
|
|
|
|
2011-01-06 08:15:43 +01:00
|
|
|
|
|
|
|
renderer.renderLabel(&labelEnableFTP);
|
2011-01-07 06:32:47 +01:00
|
|
|
renderer.renderCheckBox(&checkBoxEnableFTP);
|
|
|
|
|
|
|
|
renderer.renderLabel(&labelEnableFTPServer);
|
|
|
|
renderer.renderCheckBox(&checkBoxEnableFTPServer);
|
|
|
|
|
2011-01-06 08:15:43 +01:00
|
|
|
renderer.renderLabel(&labelFTPServerPortLabel);
|
|
|
|
renderer.renderLabel(&labelFTPServerPort);
|
|
|
|
renderer.renderLabel(&labelFTPServerDataPortsLabel);
|
|
|
|
renderer.renderLabel(&labelFTPServerDataPorts);
|
2011-01-26 00:30:51 +01:00
|
|
|
|
2011-03-11 13:14:24 +01:00
|
|
|
renderer.renderLabel(&labelEnableFTPServerInternetTilesetXfer);
|
|
|
|
renderer.renderCheckBox(&checkBoxEnableFTPServerInternetTilesetXfer);
|
|
|
|
renderer.renderLabel(&labelEnableFTPServerInternetTechtreeXfer);
|
|
|
|
renderer.renderCheckBox(&checkBoxEnableFTPServerInternetTechtreeXfer);
|
|
|
|
|
2011-01-26 00:30:51 +01:00
|
|
|
renderer.renderLabel(&labelEnablePrivacy);
|
|
|
|
renderer.renderCheckBox(&checkBoxEnablePrivacy);
|
2011-03-31 03:34:01 +02:00
|
|
|
|
|
|
|
renderer.renderLabel(&labelEnableTextureCompression);
|
|
|
|
renderer.renderCheckBox(&checkBoxEnableTextureCompression);
|
2011-04-02 23:17:17 +02:00
|
|
|
|
|
|
|
renderer.renderLabel(&labelScreenShotType);
|
|
|
|
renderer.renderListBox(&listBoxScreenShotType);
|
2011-04-19 05:26:42 +02:00
|
|
|
|
|
|
|
renderer.renderLabel(&labelDisableScreenshotConsoleText);
|
|
|
|
renderer.renderCheckBox(&checkBoxDisableScreenshotConsoleText);
|
2011-06-10 00:54:45 +02:00
|
|
|
|
2011-08-31 22:10:43 +02:00
|
|
|
renderer.renderLabel(&labelMouseMoveScrollsWorld);
|
|
|
|
renderer.renderCheckBox(&checkBoxMouseMoveScrollsWorld);
|
|
|
|
|
2011-06-10 00:54:45 +02:00
|
|
|
renderer.renderLabel(&labelVisibleHud);
|
2012-10-12 00:10:31 +02:00
|
|
|
renderer.renderLabel(&labelChatStaysActive);
|
|
|
|
renderer.renderLabel(&labelTimeDisplay);
|
2012-10-16 23:08:45 +02:00
|
|
|
|
|
|
|
renderer.renderLabel(&labelLuaDisableSecuritySandbox);
|
|
|
|
renderer.renderCheckBox(&checkBoxLuaDisableSecuritySandbox);
|
|
|
|
|
2011-06-10 00:54:45 +02:00
|
|
|
renderer.renderCheckBox(&checkBoxVisibleHud);
|
2012-10-12 00:10:31 +02:00
|
|
|
renderer.renderCheckBox(&checkBoxChatStaysActive);
|
|
|
|
renderer.renderCheckBox(&checkBoxTimeDisplay);
|
2011-06-21 01:48:22 +02:00
|
|
|
|
|
|
|
renderer.renderLabel(&labelRainEffect);
|
|
|
|
renderer.renderCheckBox(&checkBoxRainEffect);
|
2012-04-12 00:19:50 +02:00
|
|
|
renderer.renderLabel(&labelRainEffectSeparator);
|
|
|
|
renderer.renderCheckBox(&checkBoxRainEffectMenu);
|
2011-06-21 01:48:22 +02:00
|
|
|
|
2012-05-11 00:32:38 +02:00
|
|
|
renderer.renderLabel(&labelShadowTextureSize);
|
|
|
|
renderer.renderListBox(&listBoxShadowTextureSize);
|
2012-06-09 07:02:01 +02:00
|
|
|
|
|
|
|
renderer.renderLabel(&labelVideos);
|
|
|
|
renderer.renderCheckBox(&checkBoxVideos);
|
2010-04-02 16:21:43 +02:00
|
|
|
}
|
2010-07-08 10:29:51 +02:00
|
|
|
|
2011-04-15 03:05:36 +02:00
|
|
|
renderer.renderConsole(&console,false,true);
|
2010-07-08 10:29:51 +02:00
|
|
|
if(program != NULL) program->renderProgramMsgBox();
|
2010-03-20 13:11:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void MenuStateOptions::saveConfig(){
|
|
|
|
Config &config= Config::getInstance();
|
2010-03-23 02:38:19 +01:00
|
|
|
Lang &lang= Lang::getInstance();
|
|
|
|
setActiveInputLable(NULL);
|
2010-03-23 03:37:41 +01:00
|
|
|
|
2010-03-23 02:38:19 +01:00
|
|
|
if(labelPlayerName.getText().length()>0)
|
|
|
|
{
|
|
|
|
config.setString("NetPlayerName", labelPlayerName.getText());
|
|
|
|
}
|
|
|
|
//Copy values
|
2011-12-01 00:35:54 +01:00
|
|
|
map<string,string>::iterator iterMap = languageList.begin();
|
|
|
|
std::advance(iterMap, listBoxLang.getSelectedItemIndex());
|
|
|
|
|
2011-12-01 01:20:14 +01:00
|
|
|
config.setString("Lang", iterMap->first);
|
2010-03-23 02:38:19 +01:00
|
|
|
lang.loadStrings(config.getString("Lang"));
|
|
|
|
|
|
|
|
int index= listBoxShadows.getSelectedItemIndex();
|
|
|
|
config.setString("Shadows", Renderer::shadowsToStr(static_cast<Renderer::Shadows>(index)));
|
|
|
|
|
2012-05-11 00:32:38 +02:00
|
|
|
string texSizeString= listBoxShadowTextureSize.getSelectedItem();
|
|
|
|
config.setInt("ShadowTextureSize",strToInt(texSizeString) );
|
|
|
|
|
2010-12-27 01:59:57 +01:00
|
|
|
config.setBool("Windowed", checkBoxFullscreenWindowed.getValue());
|
2010-03-23 02:38:19 +01:00
|
|
|
config.setString("Filter", listBoxFilter.getSelectedItem());
|
2012-03-13 01:44:55 +01:00
|
|
|
config.setFloat("GammaValue", strToFloat(listBoxGammaCorrection.getSelectedItem()));
|
2010-12-27 01:59:57 +01:00
|
|
|
config.setBool("Textures3D", checkBoxTextures3D.getValue());
|
|
|
|
config.setBool("UnitParticles", (checkBoxUnitParticles.getValue()));
|
2011-03-06 14:11:22 +01:00
|
|
|
config.setBool("TilesetParticles", (checkBoxTilesetParticles.getValue()));
|
2010-12-27 01:59:57 +01:00
|
|
|
config.setBool("MapPreview", checkBoxMapPreview.getValue());
|
2010-03-23 02:38:19 +01:00
|
|
|
config.setInt("MaxLights", listBoxLights.getSelectedItemIndex()+1);
|
2010-07-16 08:35:22 +02:00
|
|
|
config.setString("FactorySound", listBoxSoundFactory.getSelectedItem());
|
2010-03-23 02:38:19 +01:00
|
|
|
config.setString("SoundVolumeFx", listBoxVolumeFx.getSelectedItem());
|
|
|
|
config.setString("SoundVolumeAmbient", listBoxVolumeAmbient.getSelectedItem());
|
2010-04-08 00:20:28 +02:00
|
|
|
config.setString("FontSizeAdjustment", listFontSizeAdjustment.getSelectedItem());
|
2010-03-23 02:38:19 +01:00
|
|
|
CoreData::getInstance().getMenuMusic()->setVolume(strToInt(listBoxVolumeMusic.getSelectedItem())/100.f);
|
|
|
|
config.setString("SoundVolumeMusic", listBoxVolumeMusic.getSelectedItem());
|
2012-10-06 15:45:42 +02:00
|
|
|
config.setString("PortServer", listBoxServerPort.getSelectedItem());
|
|
|
|
config.setInt("FTPServerPort",config.getInt("PortServer")+1);
|
2011-01-07 06:32:47 +01:00
|
|
|
config.setBool("EnableFTPXfer", checkBoxEnableFTP.getValue());
|
|
|
|
config.setBool("EnableFTPServer", checkBoxEnableFTPServer.getValue());
|
2011-03-11 13:14:24 +01:00
|
|
|
|
|
|
|
config.setBool("EnableFTPServerInternetTilesetXfer", checkBoxEnableFTPServerInternetTilesetXfer.getValue());
|
|
|
|
config.setBool("EnableFTPServerInternetTechtreeXfer", checkBoxEnableFTPServerInternetTechtreeXfer.getValue());
|
|
|
|
|
2011-01-26 00:30:51 +01:00
|
|
|
config.setBool("PrivacyPlease", checkBoxEnablePrivacy.getValue());
|
2010-12-09 21:41:11 +01:00
|
|
|
|
2011-03-31 03:34:01 +02:00
|
|
|
config.setBool("EnableTextureCompression", checkBoxEnableTextureCompression.getValue());
|
|
|
|
|
2011-04-02 23:17:17 +02:00
|
|
|
config.setString("ScreenShotFileType", listBoxScreenShotType.getSelectedItem());
|
|
|
|
|
2011-04-19 05:26:42 +02:00
|
|
|
config.setBool("DisableScreenshotConsoleText", !checkBoxDisableScreenshotConsoleText.getValue());
|
2011-08-31 22:10:43 +02:00
|
|
|
config.setBool("MouseMoveScrollsWorld", checkBoxMouseMoveScrollsWorld.getValue());
|
2011-06-10 00:54:45 +02:00
|
|
|
config.setBool("VisibleHud", checkBoxVisibleHud.getValue());
|
2012-10-12 00:10:31 +02:00
|
|
|
config.setBool("ChatStaysActive", checkBoxChatStaysActive.getValue());
|
|
|
|
config.setBool("TimeDisplay", checkBoxTimeDisplay.getValue());
|
|
|
|
|
2012-10-16 23:08:45 +02:00
|
|
|
config.setBool("DisableLuaSandbox", checkBoxLuaDisableSecuritySandbox.getValue());
|
|
|
|
|
2011-06-21 01:48:22 +02:00
|
|
|
config.setBool("RainEffect", checkBoxRainEffect.getValue());
|
2012-04-12 00:19:50 +02:00
|
|
|
config.setBool("RainEffectMenu", checkBoxRainEffectMenu.getValue());
|
2011-04-19 05:26:42 +02:00
|
|
|
|
2012-06-09 07:02:01 +02:00
|
|
|
config.setBool("EnableVideos", checkBoxVideos.getValue());
|
|
|
|
|
2010-04-01 02:13:28 +02:00
|
|
|
string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight");
|
|
|
|
string selectedResolution=listBoxScreenModes.getSelectedItem();
|
|
|
|
if(currentResolution!=selectedResolution){
|
2011-04-19 01:31:33 +02:00
|
|
|
for(vector<ModeInfo>::const_iterator it= modeInfos.begin(); it!=modeInfos.end(); ++it){
|
2010-04-01 02:13:28 +02:00
|
|
|
if((*it).getString()==selectedResolution)
|
|
|
|
{
|
|
|
|
config.setInt("ScreenWidth",(*it).width);
|
|
|
|
config.setInt("ScreenHeight",(*it).height);
|
2010-04-02 16:21:43 +02:00
|
|
|
config.setInt("ColorBits",(*it).depth);
|
2010-04-01 02:13:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-12-09 21:41:11 +01:00
|
|
|
|
2010-03-20 13:11:46 +01:00
|
|
|
config.save();
|
2010-07-16 08:35:22 +02:00
|
|
|
|
2012-10-16 23:08:45 +02:00
|
|
|
if(config.getBool("DisableLuaSandbox","false") == true) {
|
|
|
|
LuaScript::setDisableSandbox(true);
|
|
|
|
}
|
|
|
|
|
2010-07-16 08:35:22 +02:00
|
|
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
|
|
|
soundRenderer.stopAllSounds();
|
2011-03-27 17:55:55 +02:00
|
|
|
program->stopSoundSystem();
|
2011-09-01 03:11:23 +02:00
|
|
|
soundRenderer.init(program->getWindow());
|
2010-07-16 08:35:22 +02:00
|
|
|
soundRenderer.loadConfig();
|
|
|
|
soundRenderer.setMusicVolume(CoreData::getInstance().getMenuMusic());
|
2011-03-27 17:55:55 +02:00
|
|
|
program->startSoundSystem();
|
|
|
|
|
2012-05-19 10:40:49 +02:00
|
|
|
if(CoreData::getInstance().hasMainMenuVideoFilename() == false) {
|
|
|
|
soundRenderer.playMusic(CoreData::getInstance().getMenuMusic());
|
|
|
|
}
|
2010-07-16 08:35:22 +02:00
|
|
|
|
2010-05-20 23:32:25 +02:00
|
|
|
Renderer::getInstance().loadConfig();
|
2010-03-20 13:11:46 +01:00
|
|
|
}
|
|
|
|
|
2012-07-26 08:27:00 +02:00
|
|
|
void MenuStateOptions::setActiveInputLable(GraphicLabel *newLable) {
|
|
|
|
MenuState::setActiveInputLabel(newLable,&activeInputLabel);
|
2012-10-22 21:38:28 +02:00
|
|
|
|
|
|
|
if(newLable == &labelTransifexPwd) {
|
|
|
|
labelTransifexPwd.setIsPassword(false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
labelTransifexPwd.setIsPassword(true);
|
|
|
|
}
|
2010-03-23 02:38:19 +01:00
|
|
|
}
|
|
|
|
|
2010-03-20 13:11:46 +01:00
|
|
|
}}//end namespace
|