From 1d689e6492993a66935c7b36ff9827f6c170e166 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 12 Oct 2014 15:39:40 +0300 Subject: Simplify chat tab colors usage. --- src/gui/widgets/tabs/chat/chattab.h | 8 ++++++++ src/gui/widgets/tabs/chat/emulateguildtab.cpp | 7 +------ src/gui/widgets/tabs/chat/gmtab.cpp | 7 +------ src/gui/widgets/tabs/chat/guildtab.cpp | 7 +------ src/gui/widgets/tabs/chat/partytab.cpp | 8 +------- src/gui/widgets/tabs/chat/whispertab.cpp | 15 ++------------- 6 files changed, 14 insertions(+), 38 deletions(-) diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h index b6c3d9af3..aa4162ce3 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -39,6 +39,14 @@ class ScrollArea; if (debugChatTab) \ debugChatTab->chatLog(str); +#define setTabColors(name) \ + setTabColor(&getThemeColor(name), \ + &getThemeColor(name##_OUTLINE)); \ + setHighlightedTabColor(&getThemeColor(name##_HIGHLIGHTED), \ + &getThemeColor(name##_HIGHLIGHTED_OUTLINE)); \ + setSelectedTabColor(&getThemeColor(name##_SELECTED), \ + &getThemeColor(name##_SELECTED_OUTLINE)) + /** * A tab for the chat window. This is special to ease chat handling. */ diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.cpp b/src/gui/widgets/tabs/chat/emulateguildtab.cpp index a3d41d481..2d24fee64 100644 --- a/src/gui/widgets/tabs/chat/emulateguildtab.cpp +++ b/src/gui/widgets/tabs/chat/emulateguildtab.cpp @@ -38,12 +38,7 @@ EmulateGuildTab::EmulateGuildTab(const Widget2 *const widget) : // TRANSLATORS: guild chat tab name ChatTab(widget, _("Guild"), "", ChatTabType::GUILD) { - setTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB), - &getThemeColor(Theme::GUILD_CHAT_TAB_OUTLINE)); - setHighlightedTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB_HIGHLIGHTED), - &getThemeColor(Theme::GUILD_CHAT_TAB_HIGHLIGHTED_OUTLINE)); - setSelectedTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB_SELECTED), - &getThemeColor(Theme::GUILD_CHAT_TAB_SELECTED_OUTLINE)); + setTabColors(Theme::GUILD_CHAT_TAB); mShowOnline = config.getBoolValue("showGuildOnline"); config.addListener("showGuildOnline", this); } diff --git a/src/gui/widgets/tabs/chat/gmtab.cpp b/src/gui/widgets/tabs/chat/gmtab.cpp index 77dc0b065..567aeeb4a 100644 --- a/src/gui/widgets/tabs/chat/gmtab.cpp +++ b/src/gui/widgets/tabs/chat/gmtab.cpp @@ -32,12 +32,7 @@ GmTab::GmTab(const Widget2 *const widget) : // TRANSLATORS: gb tab name ChatTab(widget, _("GM"), "", ChatTabType::GM) { - setTabColor(&getThemeColor(Theme::GM_CHAT_TAB), - &getThemeColor(Theme::GM_CHAT_TAB_OUTLINE)); - setHighlightedTabColor(&getThemeColor(Theme::GM_CHAT_TAB_HIGHLIGHTED), - &getThemeColor(Theme::GM_CHAT_TAB_HIGHLIGHTED_OUTLINE)); - setSelectedTabColor(&getThemeColor(Theme::GM_CHAT_TAB_SELECTED), - &getThemeColor(Theme::GM_CHAT_TAB_SELECTED_OUTLINE)); + setTabColors(Theme::GM_CHAT_TAB); } GmTab::~GmTab() diff --git a/src/gui/widgets/tabs/chat/guildtab.cpp b/src/gui/widgets/tabs/chat/guildtab.cpp index b6e95cb77..8074bd304 100644 --- a/src/gui/widgets/tabs/chat/guildtab.cpp +++ b/src/gui/widgets/tabs/chat/guildtab.cpp @@ -45,12 +45,7 @@ GuildTab::GuildTab(const Widget2 *const widget) : // TRANSLATORS: guild chat tab name ChatTab(widget, _("Guild"), "", ChatTabType::GUILD) { - setTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB), - &getThemeColor(Theme::GUILD_CHAT_TAB_OUTLINE)); - setHighlightedTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB_HIGHLIGHTED), - &getThemeColor(Theme::GUILD_CHAT_TAB_HIGHLIGHTED_OUTLINE)); - setSelectedTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB_SELECTED), - &getThemeColor(Theme::GUILD_CHAT_TAB_SELECTED_OUTLINE)); + setTabColors(Theme::GUILD_CHAT_TAB); mShowOnline = config.getBoolValue("showGuildOnline"); config.addListener("showGuildOnline", this); } diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp index ee8099623..7d928be17 100644 --- a/src/gui/widgets/tabs/chat/partytab.cpp +++ b/src/gui/widgets/tabs/chat/partytab.cpp @@ -45,13 +45,7 @@ PartyTab::PartyTab(const Widget2 *const widget) : // TRANSLATORS: party chat tab name ChatTab(widget, _("Party"), "", ChatTabType::PARTY) { - setTabColor(&getThemeColor(Theme::PARTY_CHAT_TAB), - &getThemeColor(Theme::PARTY_CHAT_TAB_OUTLINE)); - setHighlightedTabColor(&getThemeColor(Theme::PARTY_CHAT_TAB_HIGHLIGHTED), - &getThemeColor(Theme::PARTY_CHAT_TAB_HIGHLIGHTED_OUTLINE)); - setSelectedTabColor(&getThemeColor(Theme::PARTY_CHAT_TAB_SELECTED), - &getThemeColor(Theme::PARTY_CHAT_TAB_SELECTED_OUTLINE)); - + setTabColors(Theme::PARTY_CHAT_TAB); mShowOnline = config.getBoolValue("showPartyOnline"); config.addListener("showPartyOnline", this); } diff --git a/src/gui/widgets/tabs/chat/whispertab.cpp b/src/gui/widgets/tabs/chat/whispertab.cpp index a77a2e410..16b62a66c 100644 --- a/src/gui/widgets/tabs/chat/whispertab.cpp +++ b/src/gui/widgets/tabs/chat/whispertab.cpp @@ -123,21 +123,10 @@ void WhisperTab::getAutoCompleteList(StringVect &names) const void WhisperTab::setWhisperTabColors() { - setTabColor(&getThemeColor(Theme::WHISPER_TAB), - &getThemeColor(Theme::WHISPER_TAB_OUTLINE)); - setHighlightedTabColor(&getThemeColor(Theme::WHISPER_TAB_HIGHLIGHTED), - &getThemeColor(Theme::WHISPER_TAB_HIGHLIGHTED_OUTLINE)); - setSelectedTabColor(&getThemeColor(Theme::WHISPER_TAB_SELECTED), - &getThemeColor(Theme::WHISPER_TAB_SELECTED_OUTLINE)); + setTabColors(Theme::WHISPER_TAB); } void WhisperTab::setWhisperTabOfflineColors() { - setTabColor(&getThemeColor(Theme::WHISPER_TAB_OFFLINE), - &getThemeColor(Theme::WHISPER_TAB_OFFLINE_OUTLINE)); - setHighlightedTabColor(&getThemeColor( - Theme::WHISPER_TAB_OFFLINE_HIGHLIGHTED), &getThemeColor( - Theme::WHISPER_TAB_OFFLINE_HIGHLIGHTED_OUTLINE)); - setSelectedTabColor(&getThemeColor(Theme::WHISPER_TAB_OFFLINE_SELECTED), - &getThemeColor(Theme::WHISPER_TAB_OFFLINE_SELECTED_OUTLINE)); + setTabColors(Theme::WHISPER_TAB_OFFLINE); } -- cgit v1.2.3-70-g09d2