From 24e186e73bd8f1e14a454beb1154197e0973d70a Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Wed, 24 May 2017 16:51:14 +0200 Subject: [PATCH] Fix application auto close bug. This happens on Windows and i3wm (no other are known). But why only them? God knows.. --- colorpicker/colorpickerscene.cpp | 3 ++- main.cpp | 2 ++ uploaders/customuploader.cpp | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/colorpicker/colorpickerscene.cpp b/colorpicker/colorpickerscene.cpp index 5a14828..308feb0 100644 --- a/colorpicker/colorpickerscene.cpp +++ b/colorpicker/colorpickerscene.cpp @@ -6,7 +6,8 @@ #include #include -ColorPickerScene::ColorPickerScene(QPixmap *pixmap, QWidget *parentWidget) : QGraphicsScene(), QGraphicsView(this, parentWidget) { +ColorPickerScene::ColorPickerScene(QPixmap *pixmap, QWidget *parentWidget) +: QGraphicsScene(), QGraphicsView(this, parentWidget) { setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); diff --git a/main.cpp b/main.cpp index 31aa7a0..0c2a1a6 100644 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,5 @@ #include "mainwindow.hpp" +#include "screenshotutil.hpp" #include #include #include @@ -32,6 +33,7 @@ void handler(QtMsgType type, const QMessageLogContext &, const QString &msg) { int main(int argc, char *argv[]) { qInstallMessageHandler(handler); QApplication a(argc, argv); + a.setQuitOnLastWindowClosed(false); a.setApplicationName("KShare"); a.setOrganizationName("ArsenArsen"); a.setApplicationVersion("3.0"); diff --git a/uploaders/customuploader.cpp b/uploaders/customuploader.cpp index 6e6f03a..e785004 100644 --- a/uploaders/customuploader.cpp +++ b/uploaders/customuploader.cpp @@ -39,6 +39,7 @@ CustomUploader::CustomUploader(QString absFilePath) { if (!obj["desc"].isString()) /*t*/ error(absFilePath, "desc not a string"); else + desc = obj["desc"].toString(); } else desc = absFilePath; @@ -78,7 +79,8 @@ CustomUploader::CustomUploader(QString absFilePath) { error(absFilePath, "imageformat not string"); } QString imageFormat = imageValue.toString(); - if (imageFormat == "base64" || QRegExp("base64\\([^+]+\\+[^+]+)").exactMatch(imageFormat) || QRegExp("[^+]+\\+[^+]+").exactMatch(imageFormat)) { + if (imageFormat == "base64" || QRegExp("base64\\([^+]+\\+[^+]+)").exactMatch(imageFormat) + || QRegExp("[^+]+\\+[^+]+").exactMatch(imageFormat)) { this->iFormat = imageFormat; } else error(absFilePath, "imageformat invalid"); @@ -230,7 +232,8 @@ void parseResult(QJsonDocument result, QByteArray data, QString returnPathspec, } else notifications::notify("KShare Custom Uploader " + name, "Upload done, but result empty!"); } else { - notifications::notify("KShare Custom Uploader " + name, "Upload done, but result is not JSON Object! Result in clipboard."); + notifications::notify("KShare Custom Uploader " + name, + "Upload done, but result is not JSON Object! Result in clipboard."); QApplication::clipboard()->setText(data); } }