diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-05-25 08:11:45 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-05-25 08:11:45 +0200 |
commit | ec102d766a4a36cc661567e80fa7bd78296d9ec1 (patch) | |
tree | e5b18834881198a032bd99aff58f2c030a661c79 | |
parent | Improved filter rules (diff) | |
download | smolbote-ec102d766a4a36cc661567e80fa7bd78296d9ec1.tar.xz |
Added fullscreen toggle
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | data/poi.toml | 1 | ||||
-rw-r--r-- | src/mainwindow.cpp | 13 | ||||
-rw-r--r-- | src/mainwindow.h | 2 | ||||
-rwxr-xr-x | tools/hooks/pre-commit.rb | 4 |
5 files changed, 19 insertions, 5 deletions
@@ -11,6 +11,4 @@ It is supposed to be: It's a small boat. ### Sounds dumb, how do I use it? -You make it yourself after taking a cursory glance at [BUILDING.md][1]. - -[1]: https://gitlab.com/xiannox/smolbote/blob/master/BUILDING.md +You make it yourself after taking a cursory glance at BUILDING.md. diff --git a/data/poi.toml b/data/poi.toml index 0547472..36247ca 100644 --- a/data/poi.toml +++ b/data/poi.toml @@ -31,6 +31,7 @@ title="title — smolbote [profile]" # Main window shortcuts [window.shortcuts] focusAddress="F4" +fullscreen="F11" tabNew="Ctrl+T" tabClose="Ctrl+X" tabLeft="Shift+Left" diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 587b072..537c04f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -43,6 +43,10 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) : { // set up UI ui->setupUi(this); + QAction *fullscreenAction = new QAction(this); + fullscreenAction->setShortcut(QKeySequence::fromString(sSettings->value("window.shortcuts.fullscreen").toString())); + connect(fullscreenAction, SIGNAL(triggered(bool)), this, SLOT(toggleFullscreen())); + addAction(fullscreenAction); // Dockable widget styling setDockOptions(dockOptions() | AllowTabbedDocks | ForceTabbedDocks); @@ -222,6 +226,15 @@ void MainWindow::loadProfile(const QString name) tabBar->setProfile(m_profile); } +void MainWindow::toggleFullscreen() +{ + if(isFullScreen()) { + setWindowState(Qt::WindowMaximized | Qt::WindowActive); + } else { + setWindowState(Qt::WindowFullScreen | Qt::WindowActive); + } +} + void MainWindow::handleNewWindow(const QUrl &url) { Browser::instance()->addWindow(new MainWindow(url)); diff --git a/src/mainwindow.h b/src/mainwindow.h index a2f365c..059da02 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -53,6 +53,8 @@ public slots: void loadProfile(const QString name = ""); + void toggleFullscreen(); + protected: void closeEvent(QCloseEvent *event) override; diff --git a/tools/hooks/pre-commit.rb b/tools/hooks/pre-commit.rb index ef2c6a5..ffc710c 100755 --- a/tools/hooks/pre-commit.rb +++ b/tools/hooks/pre-commit.rb @@ -21,8 +21,8 @@ if not `astyle --dry-run --formatted --options=astyle.rc #{files.join(' ')}`.emp result = 1 end -puts 'Running cppcheck...' -`cppcheck --quiet --enable=all --inconclusive --std=posix -I src/ .` +#puts 'Running cppcheck...' +#`cppcheck --quiet --enable=all --inconclusive --std=posix -I src/ .` puts "pre-commit exit(#{result})" exit result |