edited split dropdown
This commit is contained in:
@@ -327,6 +327,17 @@ void Window::addShortcuts()
|
||||
createWindowShortcut(this, "CTRL+SHIFT+TAB",
|
||||
[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
|
||||
{
|
||||
auto s = new QShortcut(QKeySequence::ZoomIn, this);
|
||||
|
||||
@@ -26,6 +26,8 @@ KeyboardSettingsPage::KeyboardSettingsPage()
|
||||
form->addItem(new QSpacerItem(16, 16));
|
||||
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 + N"),
|
||||
new QLabel("Open current split as a popup"));
|
||||
form->addRow(new QLabel("Ctrl + G"),
|
||||
new QLabel("Reopen last closed split"));
|
||||
|
||||
|
||||
@@ -187,6 +187,18 @@ void SplitContainer::insertSplit(Split *split, Direction direction,
|
||||
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)
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
@@ -177,6 +177,7 @@ public:
|
||||
void insertSplit(Split *split, Direction direction, Split *relativeTo);
|
||||
void insertSplit(Split *split, Direction direction,
|
||||
Node *relativeTo = nullptr);
|
||||
Split *getSelectedSplit() const;
|
||||
Position releaseSplit(Split *split);
|
||||
Position deleteSplit(Split *split);
|
||||
|
||||
@@ -244,7 +245,7 @@ private:
|
||||
QPoint mouseOverPoint_;
|
||||
|
||||
Node baseNode_;
|
||||
Split *selected_;
|
||||
Split *selected_{};
|
||||
Split *topRight_{};
|
||||
|
||||
NotebookTab *tab_;
|
||||
|
||||
@@ -277,7 +277,8 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
menu->addAction("Close", this->split_, &Split::deleteFromContainer,
|
||||
QKeySequence("Ctrl+W"));
|
||||
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,
|
||||
QKeySequence("Ctrl+F"));
|
||||
menu->addSeparator();
|
||||
@@ -323,6 +324,20 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
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
|
||||
auto subMenu = new QMenu("How to...", this);
|
||||
@@ -331,6 +346,8 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
menu->addMenu(subMenu);
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
// sub menu
|
||||
auto moreMenu = new QMenu("More", this);
|
||||
|
||||
@@ -379,17 +396,6 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
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->addAction("Clear messages", this->split_, &Split::clear);
|
||||
// moreMenu->addSeparator();
|
||||
|
||||
Reference in New Issue
Block a user