Allow X to close
This commit is contained in:
parent
4e2a82f2bd
commit
bd2be65e03
@ -3,6 +3,7 @@
|
||||
#include "screenshotutil.hpp"
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QCoreApplication>
|
||||
@ -84,6 +85,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
addHotkeyItem("Area image", "area", new std::function<void()>([] { screenshotter::area(); }));
|
||||
|
||||
ui->quickMode->setChecked(settings::settings().value("quickMode", false).toBool());
|
||||
ui->hideToTray->setChecked(settings::settings().value("hideOnClose", true).toBool());
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
@ -103,8 +105,11 @@ MainWindow *MainWindow::inst() {
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
event->ignore();
|
||||
QTimer::singleShot(0, this, &MainWindow::hide);
|
||||
if (settings::settings().value("hideOnClose", true).toBool()) {
|
||||
event->ignore();
|
||||
QTimer::singleShot(0, this, &MainWindow::hide);
|
||||
} else
|
||||
QApplication::exit(0);
|
||||
}
|
||||
|
||||
void MainWindow::quit() {
|
||||
@ -172,3 +177,7 @@ void MainWindow::on_settingsButton_clicked() {
|
||||
void MainWindow::on_quickMode_clicked(bool checked) {
|
||||
settings::settings().setValue("quickMode", checked);
|
||||
}
|
||||
|
||||
void MainWindow::on_hideToTray_clicked(bool checked) {
|
||||
settings::settings().setValue("hideOnClose", checked);
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ class MainWindow : public QMainWindow {
|
||||
|
||||
void on_quickMode_clicked(bool checked);
|
||||
|
||||
void on_hideToTray_clicked(bool checked);
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<height>337</height>
|
||||
<height>368</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -25,7 +25,14 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Uploader selection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string><a href="https://github.com/ArsenArsen/KShare">Source code available free for everyone. Forever.</a>
|
||||
@ -34,36 +41,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="5">
|
||||
<widget class="QListWidget" name="hotkeys"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QDoubleSpinBox" name="delay">
|
||||
<property name="toolTip">
|
||||
<string>In seconds</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>A delay before taking a screenshot, in seconds</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>File name scheme:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Uploader selection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
@ -78,19 +55,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="uploaderList"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLineEdit" name="nameScheme">
|
||||
<property name="toolTip">
|
||||
<string>http://doc.qt.io/qt-5/qdatetime.html#toString</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Screenshot %(yyyy-MM-dd HH:mm:ss)date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="quickMode">
|
||||
<property name="text">
|
||||
@ -105,6 +69,49 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLineEdit" name="nameScheme">
|
||||
<property name="toolTip">
|
||||
<string>http://doc.qt.io/qt-5/qdatetime.html#toString</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Screenshot %(yyyy-MM-dd HH:mm:ss)date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QDoubleSpinBox" name="delay">
|
||||
<property name="toolTip">
|
||||
<string>In seconds</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>A delay before taking a screenshot, in seconds</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="5">
|
||||
<widget class="QListWidget" name="hotkeys"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>File name scheme:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="uploaderList"/>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="hideToTray">
|
||||
<property name="text">
|
||||
<string>Pressing <X> hides to tray</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
|
Loading…
Reference in New Issue
Block a user