diff --git a/chatterino.pro b/chatterino.pro index 76d236146..a396e741b 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -60,7 +60,6 @@ SOURCES += \ src/resources.cpp \ src/widgets/chatwidget.cpp \ src/widgets/chatwidgetheader.cpp \ - src/widgets/chatwidgetheaderbutton.cpp \ src/widgets/chatwidgetinput.cpp \ src/widgets/mainwindow.cpp \ src/widgets/notebook.cpp \ @@ -84,7 +83,6 @@ SOURCES += \ src/messages/messagebuilder.cpp \ src/twitch/twitchmessagebuilder.cpp \ src/twitch/twitchparsemessage.cpp \ - src/widgets/fancybutton.cpp \ src/widgets/titlebar.cpp \ src/appdatapath.cpp \ src/accountmanager.cpp \ @@ -98,7 +96,9 @@ SOURCES += \ src/widgets/qualitypopup.cpp \ src/widgets/emotepopup.cpp \ src/widgets/channelview.cpp \ - src/twitch/twitchchannel.cpp + src/twitch/twitchchannel.cpp \ + src/widgets/rippleeffectlabel.cpp \ + src/widgets/rippleeffectbutton.cpp HEADERS += \ src/asyncexec.hpp \ @@ -117,7 +117,6 @@ HEADERS += \ src/twitch/emotevalue.hpp \ src/widgets/chatwidget.hpp \ src/widgets/chatwidgetheader.hpp \ - src/widgets/chatwidgetheaderbutton.hpp \ src/widgets/chatwidgetinput.hpp \ src/widgets/mainwindow.hpp \ src/widgets/notebook.hpp \ @@ -148,7 +147,6 @@ HEADERS += \ src/messages/messagebuilder.hpp \ src/twitch/twitchmessagebuilder.hpp \ src/twitch/twitchparsemessage.hpp \ - src/widgets/fancybutton.hpp \ src/widgets/titlebar.hpp \ src/appdatapath.hpp \ src/accountmanager.hpp \ @@ -158,10 +156,12 @@ HEADERS += \ src/util/distancebetweenpoints.hpp \ src/widgets/basewidget.hpp \ src/completionmanager.hpp \ - src/widgets/qualitypopup.h \ - src/widgets/emotepopup.h \ src/widgets/channelview.hpp \ - src/twitch/twitchchannel.hpp + src/twitch/twitchchannel.hpp \ + src/widgets/rippleeffectbutton.hpp \ + src/widgets/rippleeffectlabel.hpp \ + src/widgets/qualitypopup.hpp \ + src/widgets/emotepopup.hpp PRECOMPILED_HEADER = diff --git a/src/emotemanager.cpp b/src/emotemanager.cpp index f909c2229..8e6db3511 100644 --- a/src/emotemanager.cpp +++ b/src/emotemanager.cpp @@ -151,6 +151,11 @@ EmoteMap &EmoteManager::getBTTVChannelEmoteFromCaches() return _bttvChannelEmoteFromCaches; } +EmoteMap &EmoteManager::getEmojis() +{ + return this->emojis; +} + ConcurrentMap &EmoteManager::getFFZChannelEmoteFromCaches() { return _ffzChannelEmoteFromCaches; @@ -208,7 +213,15 @@ void EmoteManager::loadEmojis() this->emojiFirstByte[emojiData.value.at(0)].append(emojiData); - // TODO(pajlada): The vectors in emojiFirstByte need to be sorted by emojiData.code.length() + QString url = "https://cdnjs.cloudflare.com/ajax/libs/" + "emojione/2.2.6/assets/png/" + + code + ".png"; + + this->emojis.insert(code, + EmoteData(new LazyLoadedImage(*this, this->windowManager, url, 0.35))); + + // TODO(pajlada): The vectors in emojiFirstByte need to be sorted by + // emojiData.code.length() } } diff --git a/src/emotemanager.hpp b/src/emotemanager.hpp index 36281eba7..16469430d 100644 --- a/src/emotemanager.hpp +++ b/src/emotemanager.hpp @@ -50,6 +50,7 @@ public: EmoteMap &getFFZEmotes(); EmoteMap &getChatterinoEmotes(); EmoteMap &getBTTVChannelEmoteFromCaches(); + EmoteMap &getEmojis(); ConcurrentMap &getFFZChannelEmoteFromCaches(); ConcurrentMap &getTwitchEmoteFromCache(); @@ -86,6 +87,7 @@ private: // url Emoji-one image EmoteMap emojiCache; + EmoteMap emojis; void loadEmojis(); diff --git a/src/widgets/chatwidget.cpp b/src/widgets/chatwidget.cpp index b982dce42..bea488dae 100644 --- a/src/widgets/chatwidget.cpp +++ b/src/widgets/chatwidget.cpp @@ -4,7 +4,7 @@ #include "notebookpage.hpp" #include "settingsmanager.hpp" #include "util/urlfetch.hpp" -#include "widgets/qualitypopup.h" +#include "widgets/qualitypopup.hpp" #include "widgets/textinputdialog.hpp" #include diff --git a/src/widgets/chatwidgetheader.cpp b/src/widgets/chatwidgetheader.cpp index bf77d8bfc..44ad80ded 100644 --- a/src/widgets/chatwidgetheader.cpp +++ b/src/widgets/chatwidgetheader.cpp @@ -37,7 +37,7 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *_chatWidget) this->leftLabel.getLabel().setTextFormat(Qt::RichText); this->leftLabel.getLabel().setText(""); - connect(&this->leftLabel, &ChatWidgetHeaderButton::clicked, this, + connect(&this->leftLabel, &RippleEffectLabel::clicked, this, &ChatWidgetHeader::leftButtonClicked); this->leftMenu.addAction("Add new split", this->chatWidget, &ChatWidget::doAddSplit, diff --git a/src/widgets/chatwidgetheader.hpp b/src/widgets/chatwidgetheader.hpp index fe437862e..f03c26a88 100644 --- a/src/widgets/chatwidgetheader.hpp +++ b/src/widgets/chatwidgetheader.hpp @@ -2,7 +2,7 @@ #include "signallabel.hpp" #include "widgets/basewidget.hpp" -#include "widgets/chatwidgetheaderbutton.hpp" +#include "widgets/rippleeffectlabel.hpp" #include #include @@ -46,14 +46,14 @@ private: QHBoxLayout hbox; // top left - ChatWidgetHeaderButton leftLabel; + RippleEffectLabel leftLabel; QMenu leftMenu; // center SignalLabel channelNameLabel; // top right - ChatWidgetHeaderButton rightLabel; + RippleEffectLabel rightLabel; QMenu rightMenu; void leftButtonClicked(); diff --git a/src/widgets/chatwidgetinput.cpp b/src/widgets/chatwidgetinput.cpp index a4a76de07..1a1ff45a4 100644 --- a/src/widgets/chatwidgetinput.cpp +++ b/src/widgets/chatwidgetinput.cpp @@ -45,7 +45,7 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan ""); - connect(&this->emotesLabel, &ChatWidgetHeaderButton::clicked, [this] { + connect(&this->emotesLabel, &RippleEffectLabel::clicked, [this] { if (this->emotePopup == nullptr) { this->emotePopup = new EmotePopup(this->colorScheme, this->emoteManager); } diff --git a/src/widgets/chatwidgetinput.hpp b/src/widgets/chatwidgetinput.hpp index 4e302e2dd..ab500c715 100644 --- a/src/widgets/chatwidgetinput.hpp +++ b/src/widgets/chatwidgetinput.hpp @@ -3,8 +3,8 @@ #include "emotemanager.hpp" #include "resizingtextedit.hpp" #include "widgets/basewidget.hpp" -#include "widgets/chatwidgetheaderbutton.hpp" -#include "widgets/emotepopup.h" +#include "widgets/rippleeffectlabel.hpp" +#include "widgets/emotepopup.hpp" #include #include @@ -46,7 +46,7 @@ private: QHBoxLayout editContainer; ResizingTextEdit textInput; QLabel textLengthLabel; - ChatWidgetHeaderButton emotesLabel; + RippleEffectLabel emotesLabel; QStringList prevMsg; unsigned int prevIndex = 0; virtual void refreshTheme() override; diff --git a/src/widgets/emotepopup.cpp b/src/widgets/emotepopup.cpp index b40083000..17891cc53 100644 --- a/src/widgets/emotepopup.cpp +++ b/src/widgets/emotepopup.cpp @@ -1,4 +1,4 @@ -#include "emotepopup.h" +#include "emotepopup.hpp" #include @@ -64,7 +64,9 @@ void EmotePopup::loadChannel(std::shared_ptr _channel) addEmotes(*channel->ffzChannelEmotes.get(), "FrankerFaceZ Channel Emotes", "FrankerFaceZ Channel Emote"); - view->setChannel(emoteChannel); + // addEmotes(this->emoteManager.getEmojis(), "Emojis", "Emoji"); + + this->view->setChannel(emoteChannel); } } } diff --git a/src/widgets/emotepopup.h b/src/widgets/emotepopup.hpp similarity index 100% rename from src/widgets/emotepopup.h rename to src/widgets/emotepopup.hpp diff --git a/src/widgets/notebookbutton.cpp b/src/widgets/notebookbutton.cpp index 7058be91e..875ba9cfb 100644 --- a/src/widgets/notebookbutton.cpp +++ b/src/widgets/notebookbutton.cpp @@ -1,6 +1,6 @@ #include "widgets/notebookbutton.hpp" #include "colorscheme.hpp" -#include "widgets/fancybutton.hpp" +#include "widgets/rippleeffectbutton.hpp" #include #include diff --git a/src/widgets/notebookbutton.hpp b/src/widgets/notebookbutton.hpp index a571421e1..769dadd8c 100644 --- a/src/widgets/notebookbutton.hpp +++ b/src/widgets/notebookbutton.hpp @@ -1,6 +1,6 @@ #pragma once -#include "fancybutton.hpp" +#include "rippleeffectbutton.hpp" #include diff --git a/src/widgets/qualitypopup.cpp b/src/widgets/qualitypopup.cpp index e844b16c2..06aa5e845 100644 --- a/src/widgets/qualitypopup.cpp +++ b/src/widgets/qualitypopup.cpp @@ -1,4 +1,4 @@ -#include "qualitypopup.h" +#include "qualitypopup.hpp" #include diff --git a/src/widgets/qualitypopup.h b/src/widgets/qualitypopup.hpp similarity index 100% rename from src/widgets/qualitypopup.h rename to src/widgets/qualitypopup.hpp diff --git a/src/widgets/fancybutton.cpp b/src/widgets/rippleeffectbutton.cpp similarity index 99% rename from src/widgets/fancybutton.cpp rename to src/widgets/rippleeffectbutton.cpp index 84285b210..53d338921 100644 --- a/src/widgets/fancybutton.cpp +++ b/src/widgets/rippleeffectbutton.cpp @@ -1,4 +1,4 @@ -#include "fancybutton.hpp" +#include "rippleeffectbutton.hpp" #include #include diff --git a/src/widgets/fancybutton.hpp b/src/widgets/rippleeffectbutton.hpp similarity index 100% rename from src/widgets/fancybutton.hpp rename to src/widgets/rippleeffectbutton.hpp diff --git a/src/widgets/chatwidgetheaderbutton.cpp b/src/widgets/rippleeffectlabel.cpp similarity index 67% rename from src/widgets/chatwidgetheaderbutton.cpp rename to src/widgets/rippleeffectlabel.cpp index 8a91a6305..2addd2973 100644 --- a/src/widgets/chatwidgetheaderbutton.cpp +++ b/src/widgets/rippleeffectlabel.cpp @@ -1,4 +1,4 @@ -#include "widgets/chatwidgetheaderbutton.hpp" +#include "widgets/rippleeffectlabel.hpp" #include "colorscheme.hpp" #include "widgets/chatwidgetheader.hpp" @@ -8,7 +8,7 @@ namespace chatterino { namespace widgets { -ChatWidgetHeaderButton::ChatWidgetHeaderButton(BaseWidget *parent, int spacing) +RippleEffectLabel::RippleEffectLabel(BaseWidget *parent, int spacing) : FancyButton(parent) { setLayout(&this->ui.hbox); @@ -23,12 +23,5 @@ ChatWidgetHeaderButton::ChatWidgetHeaderButton(BaseWidget *parent, int spacing) this->setMouseEffectColor(QColor(255, 255, 255, 63)); } -// void ChatWidgetHeaderButton::paintEvent(QPaintEvent *) -//{ -// QPainter painter(this); - -// this->fancyPaint(painter); -//} - } // namespace widgets } // namespace chatterino diff --git a/src/widgets/chatwidgetheaderbutton.hpp b/src/widgets/rippleeffectlabel.hpp similarity index 64% rename from src/widgets/chatwidgetheaderbutton.hpp rename to src/widgets/rippleeffectlabel.hpp index 07565703e..88175f142 100644 --- a/src/widgets/chatwidgetheaderbutton.hpp +++ b/src/widgets/rippleeffectlabel.hpp @@ -1,7 +1,7 @@ #pragma once #include "widgets/basewidget.hpp" -#include "widgets/fancybutton.hpp" +#include "widgets/rippleeffectbutton.hpp" #include "widgets/signallabel.hpp" #include @@ -15,21 +15,16 @@ class ColorScheme; namespace widgets { -class ChatWidgetHeader; - -class ChatWidgetHeaderButton : public FancyButton +class RippleEffectLabel : public FancyButton { public: - explicit ChatWidgetHeaderButton(BaseWidget *parent, int spacing = 6); + explicit RippleEffectLabel(BaseWidget *parent, int spacing = 6); SignalLabel &getLabel() { return this->ui.label; } -protected: - // virtual void paintEvent(QPaintEvent *) override; - private: struct { QHBoxLayout hbox;