diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-11-13 05:44:22 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2012-01-09 06:55:07 +0100 |
commit | f54cd905f49d08116bf988bcb4451beb168cbd48 (patch) | |
tree | fe1b9eebd4941fe44cee48cfd2818a7239b2ac07 /src/gui/widgets/chattab.cpp | |
parent | 734cf89900cde0526043429c3028cb69616f7cb8 (diff) | |
download | mana-client-f54cd905f49d08116bf988bcb4451beb168cbd48.tar.gz mana-client-f54cd905f49d08116bf988bcb4451beb168cbd48.tar.bz2 mana-client-f54cd905f49d08116bf988bcb4451beb168cbd48.tar.xz mana-client-f54cd905f49d08116bf988bcb4451beb168cbd48.zip |
Made the chat text much more readable in every opacity case.
I added text shadow and outline support to the browserbox,
and made it adapt the text for the chattabs depending on the
GUI opacity.
Reviewed-by: Ablu.
Diffstat (limited to 'src/gui/widgets/chattab.cpp')
-rw-r--r-- | src/gui/widgets/chattab.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index c86eb2ea..bd4c5910 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -27,6 +27,7 @@ #include "configuration.h" #include "localplayer.h" +#include "gui/gui.h" #include "gui/recorder.h" #include "gui/widgets/browserbox.h" @@ -63,6 +64,11 @@ ChatTab::ChatTab(const std::string &name) : Tab() mScrollArea->setOpaque(false); chatWindow->addTab(this); + + listen(Event::ConfigChannel); + + // Initiate the text format + updateTextFormat(((Window*)getParent())->getGuiAlpha()); } ChatTab::~ChatTab() @@ -74,6 +80,37 @@ ChatTab::~ChatTab() delete mScrollArea; } +void ChatTab::updateTextFormat(int alpha) +{ + if (alpha > 200) + { + mTextOutput->setOutlinedText(false); + mTextOutput->setShadowedText(false); + } + else if (alpha <= 200 && alpha > 100) + { + mTextOutput->setOutlinedText(false); + mTextOutput->setShadowedText(true); + } + else + { + mTextOutput->setOutlinedText(true); + mTextOutput->setShadowedText(false); + } +} + +void ChatTab::event(Event::Channel channel, const Event &event) +{ + // Update the text outline and shadow according to the gui opacity. + if (channel == Event::ConfigChannel && + event.getType() == Event::ConfigOptionChanged && + event.getString("option") == "guialpha") + { + int alpha = ((Window*)getParent())->getGuiAlpha(); + updateTextFormat(alpha); + } +} + void ChatTab::chatLog(std::string line, Own own, bool ignoreRecord) { // Trim whitespace |