Add custom hotkeys. (#2340)

Co-authored-by: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com>
Co-authored-by: Paweł <zneix@zneix.eu>
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL
2021-11-21 17:46:21 +00:00
committed by GitHub
parent b94e21a600
commit 703f3717e2
54 changed files with 3613 additions and 617 deletions
+26 -5
View File
@@ -6,6 +6,7 @@
#include <QVBoxLayout>
#include "common/Channel.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
#include "messages/Message.hpp"
#include "messages/search/AuthorPredicate.hpp"
#include "messages/search/ChannelPredicate.hpp"
@@ -13,7 +14,6 @@
#include "messages/search/MessageFlagsPredicate.hpp"
#include "messages/search/RegexPredicate.hpp"
#include "messages/search/SubstringPredicate.hpp"
#include "util/Shortcut.hpp"
#include "widgets/helper/ChannelView.hpp"
namespace chatterino {
@@ -60,11 +60,32 @@ SearchPopup::SearchPopup(QWidget *parent)
{
this->initLayout();
this->resize(400, 600);
this->addShortcuts();
}
createShortcut(this, "CTRL+F", [this] {
this->searchInput_->setFocus();
this->searchInput_->selectAll();
});
void SearchPopup::addShortcuts()
{
HotkeyController::HotkeyMap actions{
{"search",
[this](std::vector<QString>) -> QString {
this->searchInput_->setFocus();
this->searchInput_->selectAll();
return "";
}},
{"delete",
[this](std::vector<QString>) -> QString {
this->close();
return "";
}},
{"reject", nullptr},
{"accept", nullptr},
{"openTab", nullptr},
{"scrollPage", nullptr},
};
this->shortcuts_ = getApp()->hotkeys->shortcutsForCategory(
HotkeyCategory::PopupWindow, actions, this);
}
void SearchPopup::setChannelFilters(FilterSetPtr filters)