mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
parent
8aa459d826
commit
b8e268f969
4 changed files with 29 additions and 9 deletions
|
@ -117,6 +117,15 @@ void Notebook::select(SplitContainer *page)
|
||||||
this->performLayout();
|
this->performLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Notebook::selectIndex(unsigned index)
|
||||||
|
{
|
||||||
|
if (index >= this->pages.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->select(this->pages.at(index));
|
||||||
|
}
|
||||||
|
|
||||||
int Notebook::tabCount()
|
int Notebook::tabCount()
|
||||||
{
|
{
|
||||||
return this->pages.size();
|
return this->pages.size();
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
|
|
||||||
void removePage(SplitContainer *page);
|
void removePage(SplitContainer *page);
|
||||||
void select(SplitContainer *page);
|
void select(SplitContainer *page);
|
||||||
|
void selectIndex(unsigned index);
|
||||||
|
|
||||||
SplitContainer *getSelectedPage() const
|
SplitContainer *getSelectedPage() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "singletons/channelmanager.hpp"
|
#include "singletons/channelmanager.hpp"
|
||||||
#include "singletons/settingsmanager.hpp"
|
#include "singletons/settingsmanager.hpp"
|
||||||
#include "singletons/thememanager.hpp"
|
#include "singletons/thememanager.hpp"
|
||||||
|
#include "widgets/helper/shortcut.hpp"
|
||||||
#include "widgets/notebook.hpp"
|
#include "widgets/notebook.hpp"
|
||||||
#include "widgets/settingsdialog.hpp"
|
#include "widgets/settingsdialog.hpp"
|
||||||
#include "widgets/split.hpp"
|
#include "widgets/split.hpp"
|
||||||
|
@ -55,14 +56,22 @@ Window::Window(const QString &windowName, singletons::ThemeManager &_themeManage
|
||||||
|
|
||||||
this->loadGeometry();
|
this->loadGeometry();
|
||||||
|
|
||||||
// Initialize program-wide hotkeys
|
/// Initialize program-wide hotkeys
|
||||||
{
|
// CTRL+P: Open Settings Dialog
|
||||||
// CTRL+P: Open Settings Dialog
|
CreateShortcut(this, "CTRL+P", [] {
|
||||||
auto shortcut = new QShortcut(QKeySequence("CTRL+P"), this);
|
SettingsDialog::showDialog(); //
|
||||||
connect(shortcut, &QShortcut::activated, []() {
|
});
|
||||||
SettingsDialog::showDialog(); //
|
|
||||||
});
|
// CTRL+Number: Switch to n'th tab
|
||||||
}
|
CreateShortcut(this, "CTRL+1", [this] { this->notebook.selectIndex(0); });
|
||||||
|
CreateShortcut(this, "CTRL+2", [this] { this->notebook.selectIndex(1); });
|
||||||
|
CreateShortcut(this, "CTRL+3", [this] { this->notebook.selectIndex(2); });
|
||||||
|
CreateShortcut(this, "CTRL+4", [this] { this->notebook.selectIndex(3); });
|
||||||
|
CreateShortcut(this, "CTRL+5", [this] { this->notebook.selectIndex(4); });
|
||||||
|
CreateShortcut(this, "CTRL+6", [this] { this->notebook.selectIndex(5); });
|
||||||
|
CreateShortcut(this, "CTRL+7", [this] { this->notebook.selectIndex(6); });
|
||||||
|
CreateShortcut(this, "CTRL+8", [this] { this->notebook.selectIndex(7); });
|
||||||
|
CreateShortcut(this, "CTRL+9", [this] { this->notebook.selectIndex(8); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::repaintVisibleChatWidgets(Channel *channel)
|
void Window::repaintVisibleChatWidgets(Channel *channel)
|
||||||
|
|
|
@ -44,7 +44,8 @@ class Window : public BaseWidget
|
||||||
WindowGeometry windowGeometry;
|
WindowGeometry windowGeometry;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Window(const QString &windowName, singletons::ThemeManager &_themeManager, bool isMainWindow);
|
explicit Window(const QString &windowName, singletons::ThemeManager &_themeManager,
|
||||||
|
bool isMainWindow);
|
||||||
|
|
||||||
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue