mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Merge pull request #684 from 23rd/patch-7-hotkey-emote-menu
Added hotkey for Emote menu.
This commit is contained in:
commit
875e12f728
3 changed files with 24 additions and 15 deletions
|
@ -41,6 +41,8 @@ KeyboardSettingsPage::KeyboardSettingsPage()
|
|||
form->addRow(new QLabel("Ctrl + R"), new QLabel("Change channel"));
|
||||
form->addRow(new QLabel("Ctrl + F"),
|
||||
new QLabel("Search in current channel"));
|
||||
form->addRow(new QLabel("Ctrl + E"),
|
||||
new QLabel("Open Emote menu"));
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -84,21 +84,7 @@ void SplitInput::initLayout()
|
|||
}));
|
||||
|
||||
// open emote popup
|
||||
QObject::connect(this->ui_.emoteButton, &EffectLabel::clicked, [this] {
|
||||
if (!this->emotePopup_) {
|
||||
this->emotePopup_ = std::make_unique<EmotePopup>();
|
||||
this->emotePopup_->linkClicked.connect([this](const Link &link) {
|
||||
if (link.type == Link::InsertText) {
|
||||
this->insertText(link.value + " ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this->emotePopup_->resize(int(300 * this->emotePopup_->getScale()),
|
||||
int(500 * this->emotePopup_->getScale()));
|
||||
this->emotePopup_->loadChannel(this->split_->getChannel());
|
||||
this->emotePopup_->show();
|
||||
});
|
||||
QObject::connect(this->ui_.emoteButton, &EffectLabel::clicked, [=] { this->openEmotePopup(); });
|
||||
|
||||
// clear channelview selection when selecting in the input
|
||||
QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable,
|
||||
|
@ -159,6 +145,23 @@ void SplitInput::updateEmoteButton()
|
|||
this->ui_.emoteButton->setFixedHeight(int(18 * scale));
|
||||
}
|
||||
|
||||
void SplitInput::openEmotePopup()
|
||||
{
|
||||
if (!this->emotePopup_) {
|
||||
this->emotePopup_ = std::make_unique<EmotePopup>();
|
||||
this->emotePopup_->linkClicked.connect([this](const Link &link) {
|
||||
if (link.type == Link::InsertText) {
|
||||
this->insertText(link.value + " ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this->emotePopup_->resize(int(300 * this->emotePopup_->getScale()),
|
||||
int(500 * this->emotePopup_->getScale()));
|
||||
this->emotePopup_->loadChannel(this->split_->getChannel());
|
||||
this->emotePopup_->show();
|
||||
}
|
||||
|
||||
void SplitInput::installKeyPressedEvent()
|
||||
{
|
||||
auto app = getApp();
|
||||
|
@ -284,6 +287,9 @@ void SplitInput::installKeyPressedEvent()
|
|||
this->split_->copyToClipboard();
|
||||
event->accept();
|
||||
}
|
||||
} else if (event->key() == Qt::Key_E &&
|
||||
event->modifiers() == Qt::ControlModifier) {
|
||||
this->openEmotePopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ private:
|
|||
void initLayout();
|
||||
void installKeyPressedEvent();
|
||||
void updateEmoteButton();
|
||||
void openEmotePopup();
|
||||
|
||||
Split *const split_;
|
||||
std::shared_ptr<EmotePopup> emotePopup_;
|
||||
|
|
Loading…
Reference in a new issue