mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
started fixing clicking emtoes
This commit is contained in:
parent
74fd6c9663
commit
05339aad2d
6 changed files with 26 additions and 3 deletions
|
@ -30,6 +30,11 @@ EmotePopup::EmotePopup(singletons::ThemeManager &themeManager)
|
||||||
tabs->addTab(this->viewEmojis, "Emojis");
|
tabs->addTab(this->viewEmojis, "Emojis");
|
||||||
|
|
||||||
this->loadEmojis();
|
this->loadEmojis();
|
||||||
|
|
||||||
|
this->viewEmotes->linkClicked.connect(
|
||||||
|
[this](const Link &link) { this->linkClicked.invoke(link); });
|
||||||
|
this->viewEmojis->linkClicked.connect(
|
||||||
|
[this](const Link &link) { this->linkClicked.invoke(link); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmotePopup::loadChannel(ChannelPtr _channel)
|
void EmotePopup::loadChannel(ChannelPtr _channel)
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "widgets/basewindow.hpp"
|
#include "widgets/basewindow.hpp"
|
||||||
#include "widgets/helper/channelview.hpp"
|
#include "widgets/helper/channelview.hpp"
|
||||||
|
|
||||||
|
#include <pajlada/signals/signal.hpp>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
|
@ -15,6 +17,8 @@ public:
|
||||||
void loadChannel(ChannelPtr channel);
|
void loadChannel(ChannelPtr channel);
|
||||||
void loadEmojis();
|
void loadEmojis();
|
||||||
|
|
||||||
|
pajlada::Signals::Signal<messages::Link> linkClicked;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChannelView *viewEmotes;
|
ChannelView *viewEmotes;
|
||||||
ChannelView *viewEmojis;
|
ChannelView *viewEmojis;
|
||||||
|
|
|
@ -834,6 +834,8 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
this->channel->sendMessage(value);
|
this->channel->sendMessage(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->linkClicked.invoke(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChannelView::tryGetMessageAt(QPoint p, std::shared_ptr<messages::MessageLayout> &_message,
|
bool ChannelView::tryGetMessageAt(QPoint p, std::shared_ptr<messages::MessageLayout> &_message,
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
boost::signals2::signal<void(QMouseEvent *)> mouseDown;
|
boost::signals2::signal<void(QMouseEvent *)> mouseDown;
|
||||||
boost::signals2::signal<void()> selectionChanged;
|
boost::signals2::signal<void()> selectionChanged;
|
||||||
pajlada::Signals::NoArgSignal highlightedMessageReceived;
|
pajlada::Signals::NoArgSignal highlightedMessageReceived;
|
||||||
|
pajlada::Signals::Signal<const messages::Link &> linkClicked;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void refreshTheme() override;
|
virtual void refreshTheme() override;
|
||||||
|
|
|
@ -52,8 +52,13 @@ SplitInput::SplitInput(Split *_chatWidget)
|
||||||
"/>");
|
"/>");
|
||||||
|
|
||||||
connect(&this->emotesLabel, &RippleEffectLabel::clicked, [this] {
|
connect(&this->emotesLabel, &RippleEffectLabel::clicked, [this] {
|
||||||
if (this->emotePopup == nullptr) {
|
if (!this->emotePopup) {
|
||||||
this->emotePopup = new EmotePopup(this->themeManager);
|
this->emotePopup = std::make_unique<EmotePopup>(this->themeManager);
|
||||||
|
this->emotePopup->linkClicked.connect([this](const messages::Link &link) {
|
||||||
|
if (link.getType() == messages::Link::InsertText) {
|
||||||
|
this->insertText(link.getValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this->emotePopup->resize((int)(300 * this->emotePopup->getDpiMultiplier()),
|
this->emotePopup->resize((int)(300 * this->emotePopup->getDpiMultiplier()),
|
||||||
|
@ -210,6 +215,11 @@ QString SplitInput::getInputText() const
|
||||||
return this->textInput.toPlainText();
|
return this->textInput.toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplitInput::insertText(const QString &text)
|
||||||
|
{
|
||||||
|
this->textInput.insertPlainText(text);
|
||||||
|
}
|
||||||
|
|
||||||
void SplitInput::refreshTheme()
|
void SplitInput::refreshTheme()
|
||||||
{
|
{
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
|
|
|
@ -27,6 +27,7 @@ public:
|
||||||
|
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
QString getInputText() const;
|
QString getInputText() const;
|
||||||
|
void insertText(const QString &text);
|
||||||
|
|
||||||
pajlada::Signals::Signal<const QString &> textChanged;
|
pajlada::Signals::Signal<const QString &> textChanged;
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Split *const chatWidget;
|
Split *const chatWidget;
|
||||||
EmotePopup *emotePopup = nullptr;
|
std::unique_ptr<EmotePopup> emotePopup;
|
||||||
|
|
||||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
|
||||||
QHBoxLayout hbox;
|
QHBoxLayout hbox;
|
||||||
|
|
Loading…
Reference in a new issue