summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp4
-rw-r--r--src/defaults.cpp2
-rw-r--r--src/gui/gui.cpp17
-rw-r--r--src/gui/gui.h7
-rw-r--r--src/gui/setup_theme.cpp22
-rw-r--r--src/gui/setup_theme.h4
6 files changed, 54 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp
index d512ac6e4..b9a1b56a6 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1728,6 +1728,7 @@ void Client::storeSafeParameters()
std::string boldFont;
std::string particleFont;
std::string helpFont;
+ std::string secureFont;
bool showBackground;
bool enableMumble;
@@ -1753,6 +1754,7 @@ void Client::storeSafeParameters()
boldFont = config.getStringValue("boldFont");
particleFont = config.getStringValue("particleFont");
helpFont = config.getStringValue("helpFont");
+ secureFont = config.getStringValue("secureFont");
showBackground = config.getBoolValue("showBackground");
enableMumble = config.getBoolValue("enableMumble");
@@ -1769,6 +1771,7 @@ void Client::storeSafeParameters()
config.setValue("boldFont", "fonts/dejavusans-bold.ttf");
config.setValue("particleFont", "fonts/dejavusans.ttf");
config.setValue("helpFont", "fonts/dejavusansmono.ttf");
+ config.setValue("secureFont", "fonts/dejavusansmono.ttf");
config.setValue("showBackground", false);
config.setValue("enableMumble", false);
@@ -1792,6 +1795,7 @@ void Client::storeSafeParameters()
config.setValue("boldFont", boldFont);
config.setValue("particleFont", particleFont);
config.setValue("helpFont", helpFont);
+ config.setValue("secureFont", secureFont);
config.setValue("showBackground", showBackground);
config.setValue("enableMumble", enableMumble);
}
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 48c650f6c..833c64bc2 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -158,6 +158,7 @@ DefaultsData* getConfigDefaults()
AddDEF(configData, "boldFont", "fonts/dejavusans-bold.ttf");
AddDEF(configData, "particleFont", "fonts/dejavusans.ttf");
AddDEF(configData, "helpFont", "fonts/dejavusansmono.ttf");
+ AddDEF(configData, "secureFont", "fonts/dejavusansmono.ttf");
AddDEF(configData, "showBackground", true);
AddDEF(configData, "enableTradeTab", true);
AddDEF(configData, "logToChat", false);
@@ -226,6 +227,7 @@ DefaultsData* getBrandingDefaults()
AddDEF(brandingData, "boldFont", "fonts/dejavusans-bold.ttf");
AddDEF(brandingData, "particleFont", "fonts/dejavusans.ttf");
AddDEF(brandingData, "helpFont", "fonts/dejavusansmono.ttf");
+ AddDEF(brandingData, "secureFont", "fonts/dejavusansmono.ttf");
AddDEF(brandingData, "guiPath", "graphics/gui/");
AddDEF(brandingData, "guiThemePath", "themes/");
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index a23da8157..6651a01d5 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -169,6 +169,21 @@ Gui::Gui(Graphics *graphics):
std::string("': ") + e.getMessage());
}
+ // Set secure font
+ fontFile = config.getValue("secureFont", "");
+ if (fontFile.empty())
+ fontFile = branding.getStringValue("secureFont");
+
+ try
+ {
+ mSecureFont = new SDLFont(fontFile, fontSize);
+ }
+ catch (const gcn::Exception &e)
+ {
+ logger->error(std::string("Unable to load '") + fontFile +
+ std::string("': ") + e.getMessage());
+ }
+
gcn::Widget::setGlobalFont(mGuiFont);
// Initialize mouse cursor and listen for changes to the option
@@ -195,6 +210,8 @@ Gui::~Gui()
boldFont = 0;
delete mHelpFont;
mHelpFont = 0;
+ delete mSecureFont;
+ mSecureFont = 0;
delete mInfoParticleFont;
mInfoParticleFont = 0;
delete getTop();
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 13df02822..578202b17 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -86,6 +86,12 @@ class Gui : public gcn::Gui
{ return mHelpFont; }
/**
+ * Return secure font.
+ */
+ gcn::Font *getSecureFont() const
+ { return mSecureFont; }
+
+ /**
* Return the Font used for "Info Particles", i.e. ones showing, what
* you picked up, etc.
*/
@@ -135,6 +141,7 @@ class Gui : public gcn::Gui
gcn::Font *mGuiFont; /**< The global GUI font */
gcn::Font *mInfoParticleFont; /**< Font for Info Particles*/
gcn::Font *mHelpFont; /**< Font for Help Window*/
+ gcn::Font *mSecureFont; /**< Font for secure labels*/
bool mCustomCursor; /**< Show custom cursor */
ImageSet *mMouseCursors; /**< Mouse cursor images */
float mMouseCursorAlpha;
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index b9ba8e3dc..7b003f1ca 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -49,6 +49,7 @@ const char* ACTION_FONT = "font";
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";
class NamesModel : public gcn::ListModel
{
@@ -104,7 +105,8 @@ Setup_Theme::Setup_Theme():
mFont(config.getStringValue("font")),
mBoldFont(config.getStringValue("boldFont")),
mParticleFont(config.getStringValue("particleFont")),
- mHelpFont(config.getStringValue("helpFont"))
+ mHelpFont(config.getStringValue("helpFont")),
+ mSecureFont(config.getStringValue("secureFont"))
{
setName(_("Theme"));
@@ -113,6 +115,7 @@ Setup_Theme::Setup_Theme():
mBoldFontLabel = new Label(_("Bold font"));
mParticleFontLabel = new Label(_("Particle font"));
mHelpFontLabel = new Label(_("Help font"));
+ mSecureFontLabel = new Label(_("Secure font"));
mThemesModel = new ThemesModel();
mFontsModel = new FontsModel();
@@ -136,6 +139,10 @@ Setup_Theme::Setup_Theme():
mHelpFontDropDown->setActionEventId(ACTION_HELP_FONT);
mHelpFontDropDown->addActionListener(this);
+ mSecureFontDropDown = new DropDown(mFontsModel);
+ mSecureFontDropDown->setActionEventId(ACTION_SECURE_FONT);
+ mSecureFontDropDown->addActionListener(this);
+
std::string skin = Theme::getThemeName();
if (!skin.empty())
mThemeDropDown->setSelectedString(skin);
@@ -150,6 +157,8 @@ Setup_Theme::Setup_Theme():
config.getStringValue("particleFont")));
mHelpFontDropDown->setSelectedString(getFileName(
config.getStringValue("helpFont")));
+ mSecureFontDropDown->setSelectedString(getFileName(
+ config.getStringValue("secureFont")));
// Do the layout
LayoutHelper h(this);
@@ -165,6 +174,8 @@ Setup_Theme::Setup_Theme():
place(0, 7, mParticleFontDropDown, 6);
place(0, 8, mHelpFontLabel, 10);
place(0, 9, mHelpFontDropDown, 6);
+ place(0, 10, mSecureFontLabel, 10);
+ place(0, 11, mSecureFontDropDown, 6);
place.getCell().matchColWidth(0, 0);
place = h.getPlacer(0, 1);
@@ -206,6 +217,10 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
{
mHelpFont = mHelpFontDropDown->getSelectedString();
}
+ else if (event.getId() == ACTION_SECURE_FONT)
+ {
+ mSecureFont = mSecureFontDropDown->getSelectedString();
+ }
}
void Setup_Theme::cancel()
@@ -215,6 +230,7 @@ void Setup_Theme::cancel()
mBoldFont = getFileName(config.getStringValue("boldFont"));
mParticleFont = getFileName(config.getStringValue("particleFont"));
mHelpFont = getFileName(config.getStringValue("helpFont"));
+ mSecureFont = getFileName(config.getStringValue("secureFont"));
}
void Setup_Theme::apply()
@@ -230,12 +246,14 @@ void Setup_Theme::apply()
if (config.getValue("font", "dejavusans.ttf") != mFont
|| config.getValue("boldFont", "dejavusans-bold.ttf") != mBoldFont
|| config.getValue("particleFont", "dejavusans.ttf") != mParticleFont
- || config.getValue("helpFont", "dejavusansmono.ttf") != mHelpFont)
+ || config.getValue("helpFont", "dejavusansmono.ttf") != mHelpFont
+ || config.getValue("secureFont", "dejavusansmono.ttf") != mSecureFont)
{
config.setValue("font", "fonts/" + getFileName(mFont));
config.setValue("boldFont", "fonts/" + getFileName(mBoldFont));
config.setValue("particleFont", "fonts/" + getFileName(mParticleFont));
config.setValue("helpFont", "fonts/" + getFileName(mHelpFont));
+ config.setValue("secureFont", "fonts/" + getFileName(mSecureFont));
gui->updateFonts();
}
}
diff --git a/src/gui/setup_theme.h b/src/gui/setup_theme.h
index 6b2c99999..eb5cc39db 100644
--- a/src/gui/setup_theme.h
+++ b/src/gui/setup_theme.h
@@ -68,6 +68,10 @@ class Setup_Theme : public SetupTab, public gcn::ActionListener
DropDown *mHelpFontDropDown;
std::string mHelpFont;
+ gcn::Label *mSecureFontLabel;
+ DropDown *mSecureFontDropDown;
+ std::string mSecureFont;
+
EditDialog *mEditDialog;
};