From e47b69a9c57f5afcd0c21bb318010d6ef3b6f9cb Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Sat, 13 May 2017 19:19:56 +0200 Subject: [PATCH] Quick mode --- cropeditor/cropscene.cpp | 3 ++- mainwindow.cpp | 12 ++++++++++++ mainwindow.hpp | 4 ++++ mainwindow.ui | 18 ++++++++++++++++-- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/cropeditor/cropscene.cpp b/cropeditor/cropscene.cpp index fe87e2d..cad1c59 100644 --- a/cropeditor/cropscene.cpp +++ b/cropeditor/cropscene.cpp @@ -142,7 +142,8 @@ void CropScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) { drawingSelection = drawingSelectionMaker(); if (drawingSelection) if (!drawingSelection->init(this)) setDrawingSelection("None", [] { return nullptr; }); - } + } else if (settings::settings().value("quickMode", false).toBool()) + done(); prevButtons = Qt::NoButton; } diff --git a/mainwindow.cpp b/mainwindow.cpp index c83001a..8aa69a0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3,8 +3,10 @@ #include "screenshotutil.hpp" #include "ui_mainwindow.h" #include +#include #include #include +#include #include #include #include @@ -80,6 +82,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi addHotkeyItem("Fullscreen image", "fullscreen", new std::function([] { screenshotter::fullscreen(); })); addHotkeyItem("Area image", "area", new std::function([] { screenshotter::area(); })); + + ui->quickMode->setChecked(settings::settings().value("quickMode", false).toBool()); } MainWindow::~MainWindow() { @@ -158,3 +162,11 @@ void MainWindow::on_hotkeys_doubleClicked(const QModelIndex &) { if (ok && hotkeying::valid(seq)) hotkeying::hotkey(str, QKeySequence(seq), *fncs.value(str)); } } + +void MainWindow::on_settingsButton_clicked() { + QDesktopServices::openUrl(QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/KShare")); +} + +void MainWindow::on_quickMode_clicked(bool checked) { + settings::settings().setValue("quickMode", checked); +} diff --git a/mainwindow.hpp b/mainwindow.hpp index 382857a..2395741 100644 --- a/mainwindow.hpp +++ b/mainwindow.hpp @@ -30,6 +30,10 @@ class MainWindow : public QMainWindow { void on_hotkeys_doubleClicked(const QModelIndex &index); + void on_settingsButton_clicked(); + + void on_quickMode_clicked(bool checked); + public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); diff --git a/mainwindow.ui b/mainwindow.ui index 7997841..c1af1bf 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 512 - 304 + 337 @@ -25,7 +25,7 @@ - + <a href="https://github.com/ArsenArsen/KShare">Source code available free for everyone. Forever.</a> @@ -91,6 +91,20 @@ + + + + Quick mode (mouse release screenshots) + + + + + + + Open settings directory + + +