summaryrefslogtreecommitdiff
path: root/src/gui/windows/emotewindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-06 01:31:12 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-06 01:31:12 +0300
commitd4e28aa97cbce34a0053d3c02cf070ef9065439f (patch)
tree8e7300771b93caeed5faefbe709bd0720766e755 /src/gui/windows/emotewindow.cpp
parentbe163616712f8c360af9b3940969c7f127043dc0 (diff)
downloadplus-d4e28aa97cbce34a0053d3c02cf070ef9065439f.tar.gz
plus-d4e28aa97cbce34a0053d3c02cf070ef9065439f.tar.bz2
plus-d4e28aa97cbce34a0053d3c02cf070ef9065439f.tar.xz
plus-d4e28aa97cbce34a0053d3c02cf070ef9065439f.zip
Add quick messages with translation from current server language to default.
For use it open emotes/fonts in chat and select T tab.
Diffstat (limited to 'src/gui/windows/emotewindow.cpp')
-rw-r--r--src/gui/windows/emotewindow.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp
index 1fdd45612..796e3f342 100644
--- a/src/gui/windows/emotewindow.cpp
+++ b/src/gui/windows/emotewindow.cpp
@@ -34,8 +34,12 @@
#include "utils/delete2.h"
#include "utils/gettext.h"
+#include "utils/translation/podict.h"
+
#include "resources/imageset.h"
+#include "resources/db/textdb.h"
+
#include "resources/image/image.h"
#include "debug.h"
@@ -64,6 +68,10 @@ EmoteWindow::EmoteWindow() :
mFontPage(CREATEWIDGETR(ListBox, this, mFontModel, "")),
mScrollFontPage(new ScrollArea(this, mFontPage, Opaque_false,
"fontpage.xml")),
+ mTextModel(new NamesModel),
+ mTextPage(CREATEWIDGETR(ListBox, this, mTextModel, "")),
+ mScrollTextPage(new ScrollArea(this, mTextPage, Opaque_false,
+ "textpage.xml")),
mImageSet(Theme::getImageSetFromThemeXml("emotetabs.xml", "", 17, 16))
{
setShowTitle(false);
@@ -94,9 +102,13 @@ void EmoteWindow::postInit()
mScrollColorPage->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mScrollFontPage->setVerticalScrollPolicy(ScrollArea::SHOW_NEVER);
mScrollFontPage->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
+ mScrollTextPage->setVerticalScrollPolicy(ScrollArea::SHOW_NEVER);
+ mScrollTextPage->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mFontModel->fillFromArray(&fontSizeList[0], fontSizeListSize);
+
mFontPage->setCenter(true);
+ mTextPage->setCenter(true);
if (mImageSet && mImageSet->size() >= 3)
{
@@ -120,10 +132,13 @@ void EmoteWindow::postInit()
// TRANSLATORS: emotes tab name
mTabs->addTab(_("Fonts"), mScrollFontPage);
}
+ // TRANSLATORS: emotes tab name
+ mTabs->addTab(_("T"), mScrollTextPage);
mEmotePage->setActionEventId("emote");
mColorPage->setActionEventId("color");
mFontPage->setActionEventId("font");
+ mTextPage->setActionEventId("text");
}
EmoteWindow::~EmoteWindow()
@@ -137,6 +152,9 @@ EmoteWindow::~EmoteWindow()
delete2(mFontPage);
delete2(mFontModel);
delete2(mScrollFontPage);
+ delete2(mTextPage);
+ delete2(mTextModel);
+ delete2(mScrollTextPage);
if (mImageSet)
{
mImageSet->decRef();
@@ -147,6 +165,15 @@ EmoteWindow::~EmoteWindow()
void EmoteWindow::show()
{
setVisible(Visible_true);
+ if (dictionary != nullptr)
+ {
+ mTextModel->clear();
+ const std::vector<std::string> &texts = TextDb::getTexts();
+ FOR_EACH (StringVectCIter, it, texts)
+ {
+ mTextModel->add(dictionary->getStr(*it));
+ }
+ }
}
void EmoteWindow::hide()
@@ -186,6 +213,11 @@ std::string EmoteWindow::getSelectedColor() const
return std::string("##").append(&chr[0]);
}
+int EmoteWindow::getSelectedTextIndex() const
+{
+ return mTextPage->getSelected();
+}
+
void EmoteWindow::clearColor()
{
mColorPage->resetAction();
@@ -210,11 +242,18 @@ void EmoteWindow::clearFont()
setVisible(Visible_false);
}
+void EmoteWindow::clearText()
+{
+ mTextPage->setSelected(-1);
+ setVisible(Visible_false);
+}
+
void EmoteWindow::addListeners(ActionListener *const listener)
{
mEmotePage->addActionListener(listener);
mColorPage->addActionListener(listener);
mFontPage->addActionListener(listener);
+ mTextPage->addActionListener(listener);
}
void EmoteWindow::widgetResized(const Event &event)