diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-05 21:51:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-05 21:51:03 +0300 |
commit | 5090180c23dd53de111c316286639d3ba8277468 (patch) | |
tree | b936b58ce905a06cc83a5ec70ce08629722abd04 /src/gui/widgets/tabs | |
parent | 38489512096ca1f5a79a5fdaf9a73c9f5fda22e2 (diff) | |
download | manaplus-5090180c23dd53de111c316286639d3ba8277468.tar.gz manaplus-5090180c23dd53de111c316286639d3ba8277468.tar.bz2 manaplus-5090180c23dd53de111c316286639d3ba8277468.tar.xz manaplus-5090180c23dd53de111c316286639d3ba8277468.zip |
Add chinese font auto usage if detected chinese locale.
Diffstat (limited to 'src/gui/widgets/tabs')
-rw-r--r-- | src/gui/widgets/tabs/setup_theme.cpp | 22 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_theme.h | 4 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index c80ec3aac..b4f6c35ac 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -46,7 +46,8 @@ const char* ACTION_BOLD_FONT = "bold font"; const char* ACTION_PARTICLE_FONT = "particle font"; const char* ACTION_HELP_FONT = "help font"; const char* ACTION_SECURE_FONT = "secure font"; -const char* ACTION_JAPAN_FONT = "japan font"; +const char* ACTION_JAPAN_FONT = "japanese font"; +const char* ACTION_CHINA_FONT = "chinese font"; const char* ACTION_INFO = "info"; class ThemesModel final : public NamesModel @@ -261,6 +262,10 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : mJapanFontLabel(new Label(this, _("Japanese font"))), mJapanFontDropDown(new DropDown(this, mFontsModel)), mJapanFont(config.getStringValue("japanFont")), + // TRANSLATORS: theme settings label + mChinaFontLabel(new Label(this, _("Chinese font"))), + mChinaFontDropDown(new DropDown(this, mFontsModel)), + mChinaFont(config.getStringValue("chinaFont")), mFontSizeListModel(new FontSizeChoiceListModel), // TRANSLATORS: theme settings label mFontSizeLabel(new Label(this, _("Font size"))), @@ -294,6 +299,8 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : mSecureFontDropDown->addActionListener(this); mJapanFontDropDown->setActionEventId(ACTION_JAPAN_FONT); mJapanFontDropDown->addActionListener(this); + mChinaFontDropDown->setActionEventId(ACTION_CHINA_FONT); + mChinaFontDropDown->addActionListener(this); mFontSizeDropDown->setSelected(mFontSize - 9); mFontSizeDropDown->adjustHeight(); mNpcFontSizeDropDown->setSelected(mNpcFontSize - 9); @@ -327,6 +334,8 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : config.getStringValue("secureFont"))); mJapanFontDropDown->setSelectedString(getFileName( config.getStringValue("japanFont"))); + mChinaFontDropDown->setSelectedString(getFileName( + config.getStringValue("chinaFont"))); updateInfo(); @@ -344,6 +353,7 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : place(0, 7, mHelpFontLabel, 5); place(0, 8, mSecureFontLabel, 5); place(0, 9, mJapanFontLabel, 5); + place(0, 10, mChinaFontLabel, 5); place(6, 0, mThemeDropDown, 10); place(6, 1, mLangDropDown, 10); @@ -355,6 +365,7 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : place(6, 7, mHelpFontDropDown, 10); place(6, 8, mSecureFontDropDown, 10); place(6, 9, mJapanFontDropDown, 10); + place(6, 10, mChinaFontDropDown, 10); place(17, 0, mInfoButton, 1); @@ -454,6 +465,10 @@ void Setup_Theme::action(const gcn::ActionEvent &event) { mJapanFont = mJapanFontDropDown->getSelectedString(); } + else if (eventId == ACTION_CHINA_FONT) + { + mChinaFont = mChinaFontDropDown->getSelectedString(); + } else if (eventId == ACTION_INFO) { // TRANSLATORS: theme info dialog header @@ -472,6 +487,7 @@ void Setup_Theme::cancel() mHelpFont = getFileName(config.getStringValue("helpFont")); mSecureFont = getFileName(config.getStringValue("secureFont")); mJapanFont = getFileName(config.getStringValue("japanFont")); + mChinaFont = getFileName(config.getStringValue("chinaFont")); } #define updateField(name1, name2) if (!mInfo->name1.empty()) \ @@ -495,6 +511,7 @@ void Setup_Theme::apply() updateField(helpFont, mHelpFont); updateField(secureFont, mSecureFont); updateField(japanFont, mJapanFont); + updateField(chinaFont, mChinaFont); if (mInfo->fontSize) { const int size = mInfo->fontSize - 9; @@ -518,6 +535,8 @@ void Setup_Theme::apply() || config.getValue("helpFont", "dejavusansmono.ttf") != mHelpFont || config.getValue("secureFont", "dejavusansmono.ttf") != mSecureFont || config.getValue("japanFont", "mplus-1p-regular.ttf") != mJapanFont + || config.getValue("chinaFont", "fonts/wqy-microhei.ttf") + != mChinaFont || config.getIntValue("fontSize") != static_cast<int>(mFontSizeDropDown->getSelected()) + 9 || config.getIntValue("npcfontSize") @@ -529,6 +548,7 @@ void Setup_Theme::apply() config.setValue("helpFont", "fonts/" + getFileName(mHelpFont)); config.setValue("secureFont", "fonts/" + getFileName(mSecureFont)); config.setValue("japanFont", "fonts/" + getFileName(mJapanFont)); + config.setValue("chinaFont", "fonts/" + getFileName(mChinaFont)); config.setValue("fontSize", mFontSizeDropDown->getSelected() + 9); config.setValue("npcfontSize", mNpcFontSizeDropDown->getSelected() + 9); diff --git a/src/gui/widgets/tabs/setup_theme.h b/src/gui/widgets/tabs/setup_theme.h index daf0a6f72..920ef62af 100644 --- a/src/gui/widgets/tabs/setup_theme.h +++ b/src/gui/widgets/tabs/setup_theme.h @@ -88,6 +88,10 @@ class Setup_Theme final : public SetupTab DropDown *mJapanFontDropDown; std::string mJapanFont; + Label *mChinaFontLabel; + DropDown *mChinaFontDropDown; + std::string mChinaFont; + FontSizeChoiceListModel *mFontSizeListModel; Label *mFontSizeLabel; int mFontSize; |