1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Removed deprecated encoding option

This commit is contained in:
Ivan Savenko 2023-03-06 18:42:09 +02:00
parent 499496f9d0
commit f768a5543e
4 changed files with 350 additions and 424 deletions

View File

@ -21,7 +21,6 @@
"playerName",
"music",
"sound",
"encoding",
"language",
"swipe",
"swipeDesktop",
@ -46,10 +45,6 @@
"type" : "number",
"default" : 88
},
"encoding" : {
"type" : "string",
"default" : "auto"
},
"swipe" : {
"type" : "boolean",
"default" : true

View File

@ -31,26 +31,10 @@ QString resolutionToString(const QSize & resolution)
}
}
/// List of encoding which can be selected from Launcher.
/// Note that it is possible to specify enconding manually in settings.json
static const std::string knownEncodingsList[] = //TODO: remove hardcode
{
// Asks vcmi to automatically detect encoding
"auto",
// European Windows-125X encodings
"CP1250", // West European, covers mostly Slavic languages that use latin script
"CP1251", // Covers languages that use cyrillic scrypt
"CP1252", // Latin/East European, covers most of latin languages
// Chinese encodings
"GBK", // extension of GB2312, also known as CP936
"GB2312", // basic set for Simplified Chinese. Separate from GBK to allow proper detection of H3 fonts
// Korean encodings
"CP949" // extension of EUC-KR.
};
/// List of tags of languages that can be selected from Launcher (and have translation for Launcher)
static const std::string languageTagList[] =
{
"chinese",
"english",
"german",
"polish",
@ -119,10 +103,6 @@ void CSettingsView::loadSettings()
ui->lineEditGameDir->setText(pathToQString(VCMIDirs::get().binaryPath()));
ui->lineEditTempDir->setText(pathToQString(VCMIDirs::get().userLogsPath()));
std::string encoding = settings["general"]["encoding"].String();
size_t encodingIndex = boost::range::find(knownEncodingsList, encoding) - knownEncodingsList;
if(encodingIndex < ui->comboBoxEncoding->count())
ui->comboBoxEncoding->setCurrentIndex((int)encodingIndex);
ui->comboBoxAutoSave->setCurrentIndex(settings["general"]["saveFrequency"].Integer() > 0 ? 1 : 0);
std::string language = settings["general"]["language"].String();
@ -291,12 +271,6 @@ void CSettingsView::on_plainTextEditRepos_textChanged()
}
}
void CSettingsView::on_comboBoxEncoding_currentIndexChanged(int index)
{
Settings node = settings.write["general"]["encoding"];
node->String() = knownEncodingsList[index];
}
void CSettingsView::on_openTempDir_clicked()
{
QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(ui->lineEditTempDir->text()).absoluteFilePath()));

View File

@ -49,8 +49,6 @@ private slots:
void on_plainTextEditRepos_textChanged();
void on_comboBoxEncoding_currentIndexChanged(int index);
void on_openTempDir_clicked();
void on_openUserDataDir_clicked();

View File

@ -114,259 +114,159 @@
<x>0</x>
<y>0</y>
<width>620</width>
<height>762</height>
<height>731</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="3,3,1,1">
<item row="0" column="0">
<widget class="QLabel" name="labelGeneral">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<layout class="QGridLayout" name="gridLayout" columnstretch="3,0,0,0">
<item row="22" column="0" colspan="4">
<widget class="QPlainTextEdit" name="plainTextEditRepos">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="text">
<string>General</string>
<property name="plainText">
<string notr="true">http://downloads.vcmi.eu/Mods/repository.json</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelLanguage">
<property name="text">
<string>VCMI Language</string>
<item row="12" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxPlayerAI">
<property name="currentText">
<string notr="true">VCAI</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelEncoding">
<property name="text">
<string>Heroes III character set</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxEncoding">
<item>
<property name="text">
<string>Automatic detection</string>
<string notr="true">VCAI</string>
</property>
</item>
<item>
<property name="text">
<string>Central European (Windows 1250)</string>
<string notr="true">Nullkiller</string>
</property>
</item>
<item>
<property name="text">
<string>Cyrillic script (Windows 1251)</string>
</property>
</item>
<item>
<property name="text">
<string>Western European (Windows 1252)</string>
</property>
</item>
<item>
<property name="text">
<string>Simplified Chinese (GBK)</string>
</property>
</item>
<item>
<property name="text">
<string>Simplified Chinese (GB2312)</string>
</property>
</item>
<item>
<property name="text">
<string>Korean (Windows 949)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelNetworkPort">
<property name="text">
<string>Network port</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelAutoSave">
<property name="text">
<string>Autosave</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelBuildVersionDesc">
<property name="text">
<string>Build version</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelVideo">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Video</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="labelResolution">
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="labelFullScreen">
<property name="text">
<string>Fullscreen</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="labelShowIntro">
<property name="text">
<string>Show intro</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="labelDisplayIndex">
<property name="text">
<string>Display index</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="labelCursorType">
<property name="text">
<string>Cursor</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="labelArtificialIntelligence">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Artificial Intelligence</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="labelPlayerAI">
<property name="text">
<string>Adventure Map AI</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="labelNeutralAI">
<property name="text">
<string>Neutral AI</string>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="labelFriendlyAI">
<property name="text">
<string>Friendly AI</string>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="labelEnemyAI">
<property name="text">
<string>Enemy AI</string>
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="QLabel" name="labelDataDirs">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item row="21" column="2" colspan="2">
<widget class="QPushButton" name="updatesButton">
<property name="text">
<string>Data Directories</string>
<string>Update now</string>
</property>
</widget>
</item>
<item row="18" column="0">
<widget class="QLabel" name="labelGameDir">
<item row="2" column="0">
<widget class="QLabel" name="labelNetworkPort">
<property name="text">
<string>Extra data directory</string>
<string>Network port</string>
</property>
</widget>
</item>
<item row="18" column="1">
<item row="14" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxFriendlyAI">
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string notr="true">BattleAI</string>
</property>
<item>
<property name="text">
<string notr="true">BattleAI</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="13" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxNeutralAI">
<property name="currentText">
<string notr="true">BattleAI</string>
</property>
<item>
<property name="text">
<string notr="true">BattleAI</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelAutoSave">
<property name="text">
<string>Autosave</string>
</property>
</widget>
</item>
<item row="17" column="1">
<widget class="QLineEdit" name="lineEditGameDir">
<property name="text">
<string notr="true">/usr/share/vcmi</string>
</property>
</widget>
</item>
<item row="18" column="2">
<widget class="QPushButton" name="changeGameDataDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Change</string>
</property>
</widget>
</item>
<item row="18" column="3">
<widget class="QPushButton" name="openGameDataDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="19" column="0">
<widget class="QLabel" name="labelUserDataDir">
<property name="text">
<string>User data directory</string>
</property>
</widget>
</item>
<item row="19" column="3">
<widget class="QPushButton" name="openUserDataDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="labelTempDir">
<property name="text">
<string>Log files directory</string>
</property>
</widget>
</item>
<item row="20" column="3">
<widget class="QPushButton" name="openTempDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="21" column="0">
<item row="8" column="0">
<widget class="QLabel" name="labelShowIntro">
<property name="text">
<string>Show intro</string>
</property>
</widget>
</item>
<item row="18" column="1" colspan="2">
<widget class="QLineEdit" name="lineEditUserDataDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">/home/user/.vcmi</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxFullScreen">
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
<item>
<property name="text">
<string>Real</string>
</property>
</item>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="labelRepositories">
<property name="font">
<font>
@ -379,15 +279,15 @@
</property>
</widget>
</item>
<item row="22" column="0">
<widget class="QLabel" name="labelAutoCheck">
<item row="9" column="0">
<widget class="QLabel" name="labelDisplayIndex">
<property name="text">
<string>Check on startup</string>
<string>Display index</string>
</property>
</widget>
</item>
<item row="22" column="1">
<widget class="QComboBox" name="comboBoxAutoCheck">
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxAutoSave">
<property name="currentIndex">
<number>1</number>
</property>
@ -403,24 +303,122 @@
</item>
</widget>
</item>
<item row="22" column="2" colspan="2">
<widget class="QPushButton" name="updatesButton">
<item row="5" column="0">
<widget class="QLabel" name="labelVideo">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Update now</string>
<string>Video</string>
</property>
</widget>
</item>
<item row="23" column="0" colspan="4">
<widget class="QPlainTextEdit" name="plainTextEditRepos">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string notr="true">http://downloads.vcmi.eu/Mods/repository.json</string>
<item row="19" column="0">
<widget class="QLabel" name="labelTempDir">
<property name="text">
<string>Log files directory</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="3">
<item row="15" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxEnemyAI">
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string notr="true">BattleAI</string>
</property>
<item>
<property name="text">
<string notr="true">BattleAI</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelBuildVersionDesc">
<property name="text">
<string>Build version</string>
</property>
</widget>
</item>
<item row="17" column="3">
<widget class="QPushButton" name="openGameDataDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QLineEdit" name="lineEditBuildVersion">
<property name="text">
<string notr="true"/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxShowIntro">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="labelArtificialIntelligence">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Artificial Intelligence</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelResolution">
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="labelCursorType">
<property name="text">
<string>Cursor</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="labelNeutralAI">
<property name="text">
<string>Neutral AI</string>
</property>
</widget>
</item>
<item row="10" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxCursorType">
<item>
<property name="text">
@ -439,6 +437,77 @@
</item>
</widget>
</item>
<item row="21" column="0">
<widget class="QLabel" name="labelAutoCheck">
<property name="text">
<string>Check on startup</string>
</property>
</widget>
</item>
<item row="18" column="3">
<widget class="QPushButton" name="openUserDataDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="labelFullScreen">
<property name="text">
<string>Fullscreen</string>
</property>
</widget>
</item>
<item row="9" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxDisplayIndex"/>
</item>
<item row="6" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxResolution"/>
</item>
<item row="19" column="1" colspan="2">
<widget class="QLineEdit" name="lineEditTempDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">/home/user/.vcmi</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelLanguage">
<property name="text">
<string>VCMI Language</string>
</property>
</widget>
</item>
<item row="21" column="1">
<widget class="QComboBox" name="comboBoxAutoCheck">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="labelPlayerAI">
<property name="text">
<string>Adventure Map AI</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxLanguage">
<item>
@ -446,6 +515,11 @@
<string>English</string>
</property>
</item>
<item>
<property name="text">
<string>简体中文 (Simplified Chinese)</string>
</property>
</item>
<item>
<property name="text">
<string>Deutsch (German)</string>
@ -468,7 +542,54 @@
</item>
</widget>
</item>
<item row="3" column="1" colspan="3">
<item row="16" column="0">
<widget class="QLabel" name="labelDataDirs">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Data Directories</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelGeneral">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>General</string>
</property>
</widget>
</item>
<item row="18" column="0">
<widget class="QLabel" name="labelUserDataDir">
<property name="text">
<string>User data directory</string>
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="QLabel" name="labelGameDir">
<property name="text">
<string>Extra data directory</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="labelFriendlyAI">
<property name="text">
<string>Friendly AI</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QSpinBox" name="spinBoxNetworkPort">
<property name="minimum">
<number>1024</number>
@ -481,175 +602,13 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxAutoSave">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxResolution"/>
</item>
<item row="19" column="1" colspan="2">
<widget class="QLineEdit" name="lineEditUserDataDir">
<item row="17" column="2">
<widget class="QPushButton" name="changeGameDataDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">/home/user/.vcmi</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="20" column="1" colspan="2">
<widget class="QLineEdit" name="lineEditTempDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">/home/user/.vcmi</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="16" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxEnemyAI">
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string notr="true">BattleAI</string>
</property>
<item>
<property name="text">
<string notr="true">BattleAI</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="15" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxFriendlyAI">
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string notr="true">BattleAI</string>
</property>
<item>
<property name="text">
<string notr="true">BattleAI</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="14" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxNeutralAI">
<property name="currentText">
<string notr="true">BattleAI</string>
</property>
<item>
<property name="text">
<string notr="true">BattleAI</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="13" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxPlayerAI">
<property name="currentText">
<string notr="true">VCAI</string>
</property>
<item>
<property name="text">
<string notr="true">VCAI</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Nullkiller</string>
</property>
</item>
</widget>
</item>
<item row="10" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxDisplayIndex"/>
</item>
<item row="9" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxShowIntro">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxFullScreen">
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
<item>
<property name="text">
<string>Real</string>
</property>
</item>
</widget>
</item>
<item row="5" column="1" colspan="3">
<widget class="QLineEdit" name="lineEditBuildVersion">
<property name="text">
<string notr="true"/>
</property>
<property name="readOnly">
<bool>true</bool>
<string>Change</string>
</property>
</widget>
</item>