summaryrefslogtreecommitdiff
path: root/src/gui/setup_theme.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-18 19:02:04 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-18 19:02:04 +0300
commitc7ad8d093591214a32cacc79fa25d8e118493093 (patch)
tree2be3eacaa43c6941862b15ca099eeba8cd292fa5 /src/gui/setup_theme.cpp
parent2b4110a217110dfe9919fa3cc70e41c6920ac597 (diff)
downloadplus-c7ad8d093591214a32cacc79fa25d8e118493093.tar.gz
plus-c7ad8d093591214a32cacc79fa25d8e118493093.tar.bz2
plus-c7ad8d093591214a32cacc79fa25d8e118493093.tar.xz
plus-c7ad8d093591214a32cacc79fa25d8e118493093.zip
Add button in themes to show additional theme info.
Diffstat (limited to 'src/gui/setup_theme.cpp')
-rw-r--r--src/gui/setup_theme.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index 1886405be..66d806fc4 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -51,6 +51,7 @@ 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_INFO = "info";
class ThemesModel final : public NamesModel
{
@@ -194,7 +195,9 @@ Setup_Theme::Setup_Theme() :
mNpcFontSizeListModel(new FontSizeChoiceListModel),
mNpcFontSizeLabel(new Label(_("Npc font size"))),
mNpcFontSize(config.getIntValue("npcfontSize")),
- mNpcFontSizeDropDown(new DropDown(mNpcFontSizeListModel))
+ mNpcFontSizeDropDown(new DropDown(mNpcFontSizeListModel)),
+ // TRANSLATORS: button name with information about selected theme
+ mInfoButton(new Button(_("i"), ACTION_INFO, this))
{
setName(_("Theme"));
@@ -249,6 +252,8 @@ Setup_Theme::Setup_Theme() :
mJapanFontDropDown->setSelectedString(getFileName(
config.getStringValue("japanFont")));
+ updateInfo();
+
// Do the layout
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
@@ -275,8 +280,7 @@ Setup_Theme::Setup_Theme() :
place(6, 8, mSecureFontDropDown, 10);
place(6, 9, mJapanFontDropDown, 10);
- place.getCell().matchColWidth(0, 0);
- place = h.getPlacer(0, 1);
+ place(17, 0, mInfoButton, 1);
setDimension(gcn::Rectangle(0, 0, 365, 500));
}
@@ -299,6 +303,22 @@ Setup_Theme::~Setup_Theme()
mLangListModel = nullptr;
}
+void Setup_Theme::updateInfo()
+{
+ ThemeInfo *info = Theme::loadInfo(mTheme);
+ if (info)
+ {
+ mThemeInfo = "Name: " + info->name
+ + "\nCopyright:\n" + info->copyright;
+ }
+ else
+ {
+ mThemeInfo = "";
+ }
+ replaceAll(mThemeInfo, "\\n", "\n");
+ delete info;
+}
+
void Setup_Theme::action(const gcn::ActionEvent &event)
{
if (event.getId() == ACTION_THEME)
@@ -307,6 +327,7 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
mTheme = "";
else
mTheme = mThemeDropDown->getSelectedString();
+ updateInfo();
}
else if (event.getId() == ACTION_FONT)
{
@@ -340,6 +361,11 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
{
mJapanFont = mJapanFontDropDown->getSelectedString();
}
+ else if (event.getId() == ACTION_INFO)
+ {
+ new OkDialog(_("Theme info"), mThemeInfo, DIALOG_OK,
+ false, true, nullptr, 600);
+ }
}
void Setup_Theme::cancel()