diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-06 14:02:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-06 14:12:59 +0300 |
commit | 73e7be1617217396c5f1eead52af87bc7fef2357 (patch) | |
tree | b985dfd5f1173a6c7e1c741c796a4a61de0cefa8 /src/gui/emotewindow.cpp | |
parent | 5ffbb0ca66337bd13a21a1875cc5bec5cc9a724d (diff) | |
download | plus-73e7be1617217396c5f1eead52af87bc7fef2357.tar.gz plus-73e7be1617217396c5f1eead52af87bc7fef2357.tar.bz2 plus-73e7be1617217396c5f1eead52af87bc7fef2357.tar.xz plus-73e7be1617217396c5f1eead52af87bc7fef2357.zip |
add colors tab into chat emotes window.
Diffstat (limited to 'src/gui/emotewindow.cpp')
-rw-r--r-- | src/gui/emotewindow.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/gui/emotewindow.cpp b/src/gui/emotewindow.cpp index a66cecf87..fc76f474b 100644 --- a/src/gui/emotewindow.cpp +++ b/src/gui/emotewindow.cpp @@ -23,6 +23,8 @@ #include "gui/chatwindow.h" #include "gui/gui.h" +#include "gui/widgets/colormodel.h" +#include "gui/widgets/colorpage.h" #include "gui/widgets/emotepage.h" #include "gui/widgets/layouthelper.h" #include "gui/widgets/scrollarea.h" @@ -41,7 +43,9 @@ EmoteWindow::EmoteWindow() : Window(_("Emotes"), false, nullptr, "emotes.xml"), mTabs(new TabbedArea(this)), mEmotePage(new EmotePage(this)), - mScrollEmotePage(new ScrollArea(mEmotePage, false, "emotepage.xml")) + mColorModel(ColorModel::createDefault(this)), + mColorPage(new ColorPage(this, mColorModel, "colorpage.xml")), + mScrollColorPage(new ScrollArea(mColorPage, false, "emotepage.xml")) { setShowTitle(false); @@ -57,17 +61,28 @@ EmoteWindow::EmoteWindow() : center(); setTitleBarHeight(getPadding() + getTitlePadding()); + mScrollColorPage->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); // TRANSLATORS: emotes tab name mTabs->addTab(_("Emotes"), mEmotePage); + // TRANSLATORS: emotes tab name + mTabs->addTab(_("Colors"), mScrollColorPage); mEmotePage->setActionEventId("emote"); + mColorPage->setActionEventId("color"); } EmoteWindow::~EmoteWindow() { + mTabs->removeAll(false); mTabs->removeTab(mTabs->getTabByIndex(0)); - delete mScrollEmotePage; - mScrollEmotePage = nullptr; + delete mEmotePage; + mEmotePage = nullptr; + delete mColorPage; + mColorPage = nullptr; + delete mColorModel; + mColorModel = nullptr; + delete mScrollColorPage; + mScrollColorPage = nullptr; } void EmoteWindow::show() @@ -100,7 +115,26 @@ void EmoteWindow::clearEmote() setVisible(false); } +std::string EmoteWindow::getSelectedColor() const +{ + const int index = mColorPage->getSelected(); + if (index < 0) + return std::string(); + + char chr[2]; + chr[0] = '0' + index; + chr[1] = 0; + return std::string("##").append(&chr[0]); +} + +void EmoteWindow::clearColor() +{ + mColorPage->resetAction(); + setVisible(false); +} + void EmoteWindow::addListeners(gcn::ActionListener *const listener) { mEmotePage->addActionListener(listener); + mColorPage->addActionListener(listener); } |