mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Move CTRL+T hotkey handling to Notebook
CTRL+T Can now be called anywhere in the window
This commit is contained in:
parent
84c577c0dc
commit
179cd5552d
|
@ -4,6 +4,7 @@
|
||||||
#include "singletons/windowmanager.hpp"
|
#include "singletons/windowmanager.hpp"
|
||||||
#include "widgets/helper/notebookbutton.hpp"
|
#include "widgets/helper/notebookbutton.hpp"
|
||||||
#include "widgets/helper/notebooktab.hpp"
|
#include "widgets/helper/notebooktab.hpp"
|
||||||
|
#include "widgets/helper/shortcut.hpp"
|
||||||
#include "widgets/settingsdialog.hpp"
|
#include "widgets/settingsdialog.hpp"
|
||||||
#include "widgets/splitcontainer.hpp"
|
#include "widgets/splitcontainer.hpp"
|
||||||
#include "widgets/window.hpp"
|
#include "widgets/window.hpp"
|
||||||
|
@ -51,6 +52,16 @@ Notebook::Notebook(Window *parent, bool _showButtons)
|
||||||
closeConfirmDialog.setDefaultButton(QMessageBox::Yes);
|
closeConfirmDialog.setDefaultButton(QMessageBox::Yes);
|
||||||
|
|
||||||
this->scaleChangedEvent(this->getScale());
|
this->scaleChangedEvent(this->getScale());
|
||||||
|
|
||||||
|
// Window-wide hotkeys
|
||||||
|
// CTRL+T: Create new split in selected notebook page
|
||||||
|
CreateWindowShortcut(this, "CTRL+T", [this]() {
|
||||||
|
if (this->selectedPage == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->selectedPage->addChat(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitContainer *Notebook::addNewPage(bool select)
|
SplitContainer *Notebook::addNewPage(bool select)
|
||||||
|
|
|
@ -58,9 +58,6 @@ Split::Split(SplitContainer *parent)
|
||||||
this->vbox.addWidget(&this->input);
|
this->vbox.addWidget(&this->input);
|
||||||
|
|
||||||
// Initialize chat widget-wide hotkeys
|
// Initialize chat widget-wide hotkeys
|
||||||
// CTRL+T: Create new split (Add page)
|
|
||||||
CreateShortcut(this, "CTRL+T", &Split::doAddSplit);
|
|
||||||
|
|
||||||
// CTRL+W: Close Split
|
// CTRL+W: Close Split
|
||||||
CreateShortcut(this, "CTRL+W", &Split::doCloseSplit);
|
CreateShortcut(this, "CTRL+W", &Split::doCloseSplit);
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ private:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Add new split to the notebook page that this chat widget is in
|
// Add new split to the notebook page that this chat widget is in
|
||||||
// Maybe we should use this chat widget as a hint to where the new split should be created
|
// This is only activated from the menu now. Hotkey is handled in Notebook
|
||||||
void doAddSplit();
|
void doAddSplit();
|
||||||
|
|
||||||
// Close current split (chat widget)
|
// Close current split (chat widget)
|
||||||
|
|
Loading…
Reference in a new issue