mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Save & load language selection
This commit is contained in:
parent
b012cd9490
commit
4cd91ffbed
@ -17,7 +17,7 @@
|
|||||||
"type" : "object",
|
"type" : "object",
|
||||||
"default": {},
|
"default": {},
|
||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
"required" : [ "playerName", "showfps", "music", "sound", "encoding", "swipe", "saveRandomMaps", "saveFrequency", "notifications", "extraDump" ],
|
"required" : [ "playerName", "showfps", "music", "sound", "encoding", "language", "swipe", "saveRandomMaps", "saveFrequency", "notifications", "extraDump" ],
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"playerName" : {
|
"playerName" : {
|
||||||
"type":"string",
|
"type":"string",
|
||||||
@ -51,6 +51,10 @@
|
|||||||
"type":"string",
|
"type":"string",
|
||||||
"default" : "Maps/Arrogance"
|
"default" : "Maps/Arrogance"
|
||||||
},
|
},
|
||||||
|
"language" : {
|
||||||
|
"type":"string",
|
||||||
|
"default" : "english"
|
||||||
|
},
|
||||||
"lastSave" : {
|
"lastSave" : {
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"default" : "NEWGAME"
|
"default" : "NEWGAME"
|
||||||
|
@ -51,6 +51,7 @@ MainWindow::MainWindow(QWidget * parent)
|
|||||||
: QMainWindow(parent), ui(new Ui::MainWindow)
|
: QMainWindow(parent), ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
load(); // load FS before UI
|
load(); // load FS before UI
|
||||||
|
updateTranslation(); // load translation
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -114,6 +114,11 @@ void CSettingsView::loadSettings()
|
|||||||
if(encodingIndex < ui->comboBoxEncoding->count())
|
if(encodingIndex < ui->comboBoxEncoding->count())
|
||||||
ui->comboBoxEncoding->setCurrentIndex((int)encodingIndex);
|
ui->comboBoxEncoding->setCurrentIndex((int)encodingIndex);
|
||||||
ui->comboBoxAutoSave->setCurrentIndex(settings["general"]["saveFrequency"].Integer() > 0 ? 1 : 0);
|
ui->comboBoxAutoSave->setCurrentIndex(settings["general"]["saveFrequency"].Integer() > 0 ? 1 : 0);
|
||||||
|
|
||||||
|
std::string language = settings["general"]["language"].String();
|
||||||
|
size_t languageIndex = boost::range::find(languageTagList, language) - languageTagList;
|
||||||
|
if(languageIndex < ui->comboBoxLanguage->count())
|
||||||
|
ui->comboBoxLanguage->setCurrentIndex((int)languageIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsView::fillValidResolutions(bool isExtraResolutionsModEnabled)
|
void CSettingsView::fillValidResolutions(bool isExtraResolutionsModEnabled)
|
||||||
@ -319,7 +324,8 @@ void CSettingsView::on_comboBoxLanguage_currentIndexChanged(int index)
|
|||||||
Settings node = settings.write["general"]["language"];
|
Settings node = settings.write["general"]["language"];
|
||||||
node->String() = languageTagList[index];
|
node->String() = languageTagList[index];
|
||||||
|
|
||||||
dynamic_cast<MainWindow*>(qApp->activeWindow())->updateTranslation();
|
if ( qApp->activeWindow() && dynamic_cast<MainWindow*>(qApp->activeWindow()) )
|
||||||
|
dynamic_cast<MainWindow*>(qApp->activeWindow())->updateTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsView::changeEvent(QEvent *event)
|
void CSettingsView::changeEvent(QEvent *event)
|
||||||
|
Loading…
Reference in New Issue
Block a user