mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
edited split dropdown
This commit is contained in:
parent
8661c83312
commit
2c74e98023
5 changed files with 45 additions and 13 deletions
|
@ -327,6 +327,17 @@ void Window::addShortcuts()
|
||||||
createWindowShortcut(this, "CTRL+SHIFT+TAB",
|
createWindowShortcut(this, "CTRL+SHIFT+TAB",
|
||||||
[this] { this->notebook_->selectPreviousTab(); });
|
[this] { this->notebook_->selectPreviousTab(); });
|
||||||
|
|
||||||
|
createWindowShortcut(this, "CTRL+N", [this] {
|
||||||
|
if (auto page = dynamic_cast<SplitContainer *>(
|
||||||
|
this->notebook_->getSelectedPage()))
|
||||||
|
{
|
||||||
|
if (auto split = page->getSelectedSplit())
|
||||||
|
{
|
||||||
|
split->popup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Zoom in
|
// Zoom in
|
||||||
{
|
{
|
||||||
auto s = new QShortcut(QKeySequence::ZoomIn, this);
|
auto s = new QShortcut(QKeySequence::ZoomIn, this);
|
||||||
|
|
|
@ -26,6 +26,8 @@ KeyboardSettingsPage::KeyboardSettingsPage()
|
||||||
form->addItem(new QSpacerItem(16, 16));
|
form->addItem(new QSpacerItem(16, 16));
|
||||||
form->addRow(new QLabel("Ctrl + T"), new QLabel("Create new split"));
|
form->addRow(new QLabel("Ctrl + T"), new QLabel("Create new split"));
|
||||||
form->addRow(new QLabel("Ctrl + W"), new QLabel("Close current split"));
|
form->addRow(new QLabel("Ctrl + W"), new QLabel("Close current split"));
|
||||||
|
form->addRow(new QLabel("Ctrl + N"),
|
||||||
|
new QLabel("Open current split as a popup"));
|
||||||
form->addRow(new QLabel("Ctrl + G"),
|
form->addRow(new QLabel("Ctrl + G"),
|
||||||
new QLabel("Reopen last closed split"));
|
new QLabel("Reopen last closed split"));
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,18 @@ void SplitContainer::insertSplit(Split *split, Direction direction,
|
||||||
this->addSplit(split);
|
this->addSplit(split);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Split *SplitContainer::getSelectedSplit() const
|
||||||
|
{
|
||||||
|
// safety check
|
||||||
|
if (std::find(this->splits_.begin(), this->splits_.end(),
|
||||||
|
this->selected_) == this->splits_.end())
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->selected_;
|
||||||
|
}
|
||||||
|
|
||||||
void SplitContainer::addSplit(Split *split)
|
void SplitContainer::addSplit(Split *split)
|
||||||
{
|
{
|
||||||
assertInGuiThread();
|
assertInGuiThread();
|
||||||
|
|
|
@ -177,6 +177,7 @@ public:
|
||||||
void insertSplit(Split *split, Direction direction, Split *relativeTo);
|
void insertSplit(Split *split, Direction direction, Split *relativeTo);
|
||||||
void insertSplit(Split *split, Direction direction,
|
void insertSplit(Split *split, Direction direction,
|
||||||
Node *relativeTo = nullptr);
|
Node *relativeTo = nullptr);
|
||||||
|
Split *getSelectedSplit() const;
|
||||||
Position releaseSplit(Split *split);
|
Position releaseSplit(Split *split);
|
||||||
Position deleteSplit(Split *split);
|
Position deleteSplit(Split *split);
|
||||||
|
|
||||||
|
@ -244,7 +245,7 @@ private:
|
||||||
QPoint mouseOverPoint_;
|
QPoint mouseOverPoint_;
|
||||||
|
|
||||||
Node baseNode_;
|
Node baseNode_;
|
||||||
Split *selected_;
|
Split *selected_{};
|
||||||
Split *topRight_{};
|
Split *topRight_{};
|
||||||
|
|
||||||
NotebookTab *tab_;
|
NotebookTab *tab_;
|
||||||
|
|
|
@ -277,7 +277,8 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||||
menu->addAction("Close", this->split_, &Split::deleteFromContainer,
|
menu->addAction("Close", this->split_, &Split::deleteFromContainer,
|
||||||
QKeySequence("Ctrl+W"));
|
QKeySequence("Ctrl+W"));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction("Popup", this->split_, &Split::popup);
|
menu->addAction("Popup", this->split_, &Split::popup,
|
||||||
|
QKeySequence("Ctrl+N"));
|
||||||
menu->addAction("Search", this->split_, &Split::showSearch,
|
menu->addAction("Search", this->split_, &Split::showSearch,
|
||||||
QKeySequence("Ctrl+F"));
|
QKeySequence("Ctrl+F"));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
@ -323,6 +324,20 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reload / reconnect
|
||||||
|
if (this->split_->getChannel()->canReconnect())
|
||||||
|
menu->addAction("Reconnect", this, SLOT(reconnect()));
|
||||||
|
|
||||||
|
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
||||||
|
{
|
||||||
|
menu->addAction("Reload channel emotes", this,
|
||||||
|
SLOT(reloadChannelEmotes()), QKeySequence("F5"));
|
||||||
|
menu->addAction("Reload subscriber emotes", this,
|
||||||
|
SLOT(reloadSubscriberEmotes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
menu->addSeparator();
|
||||||
|
|
||||||
{
|
{
|
||||||
// "How to..." sub menu
|
// "How to..." sub menu
|
||||||
auto subMenu = new QMenu("How to...", this);
|
auto subMenu = new QMenu("How to...", this);
|
||||||
|
@ -331,6 +346,8 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||||
menu->addMenu(subMenu);
|
menu->addMenu(subMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menu->addSeparator();
|
||||||
|
|
||||||
// sub menu
|
// sub menu
|
||||||
auto moreMenu = new QMenu("More", this);
|
auto moreMenu = new QMenu("More", this);
|
||||||
|
|
||||||
|
@ -379,17 +396,6 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||||
moreMenu->addAction(action);
|
moreMenu->addAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
moreMenu->addSeparator();
|
|
||||||
if (this->split_->getChannel()->canReconnect())
|
|
||||||
moreMenu->addAction("Reconnect", this, SLOT(reconnect()));
|
|
||||||
|
|
||||||
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
|
||||||
{
|
|
||||||
moreMenu->addAction("Reload channel emotes", this,
|
|
||||||
SLOT(reloadChannelEmotes()));
|
|
||||||
moreMenu->addAction("Reload subscriber emotes", this,
|
|
||||||
SLOT(reloadSubscriberEmotes()));
|
|
||||||
}
|
|
||||||
moreMenu->addSeparator();
|
moreMenu->addSeparator();
|
||||||
moreMenu->addAction("Clear messages", this->split_, &Split::clear);
|
moreMenu->addAction("Clear messages", this->split_, &Split::clear);
|
||||||
// moreMenu->addSeparator();
|
// moreMenu->addSeparator();
|
||||||
|
|
Loading…
Reference in a new issue