Fix application auto close bug. This happens on Windows and i3wm (no

other are known). But why only them? God knows..
This commit is contained in:
ArsenArsen 2017-05-24 16:51:14 +02:00
parent 4150551d78
commit 24e186e73b
3 changed files with 9 additions and 3 deletions

View File

@ -6,7 +6,8 @@
#include <QGraphicsTextItem> #include <QGraphicsTextItem>
#include <QTimer> #include <QTimer>
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. setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes.
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

View File

@ -1,4 +1,5 @@
#include "mainwindow.hpp" #include "mainwindow.hpp"
#include "screenshotutil.hpp"
#include <QApplication> #include <QApplication>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QtGlobal> #include <QtGlobal>
@ -32,6 +33,7 @@ void handler(QtMsgType type, const QMessageLogContext &, const QString &msg) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
qInstallMessageHandler(handler); qInstallMessageHandler(handler);
QApplication a(argc, argv); QApplication a(argc, argv);
a.setQuitOnLastWindowClosed(false);
a.setApplicationName("KShare"); a.setApplicationName("KShare");
a.setOrganizationName("ArsenArsen"); a.setOrganizationName("ArsenArsen");
a.setApplicationVersion("3.0"); a.setApplicationVersion("3.0");

View File

@ -39,6 +39,7 @@ CustomUploader::CustomUploader(QString absFilePath) {
if (!obj["desc"].isString()) if (!obj["desc"].isString())
/*t*/ error(absFilePath, "desc not a string"); /*t*/ error(absFilePath, "desc not a string");
else else
desc = obj["desc"].toString(); desc = obj["desc"].toString();
} else } else
desc = absFilePath; desc = absFilePath;
@ -78,7 +79,8 @@ CustomUploader::CustomUploader(QString absFilePath) {
error(absFilePath, "imageformat not string"); error(absFilePath, "imageformat not string");
} }
QString imageFormat = imageValue.toString(); 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; this->iFormat = imageFormat;
} else } else
error(absFilePath, "imageformat invalid"); error(absFilePath, "imageformat invalid");
@ -230,7 +232,8 @@ void parseResult(QJsonDocument result, QByteArray data, QString returnPathspec,
} else } else
notifications::notify("KShare Custom Uploader " + name, "Upload done, but result empty!"); notifications::notify("KShare Custom Uploader " + name, "Upload done, but result empty!");
} else { } 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); QApplication::clipboard()->setText(data);
} }
} }