Im stupid

This commit is contained in:
ArsenArsen 2017-05-22 15:56:47 +02:00
parent 96f4cf7305
commit 91aa7badc6
4 changed files with 9 additions and 2 deletions

View File

@ -2,6 +2,7 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QtGlobal>
#include <notifications.hpp>
#include <stdio.h>
bool verbose = false;
@ -23,6 +24,7 @@ void handler(QtMsgType type, const QMessageLogContext &, const QString &msg) {
break;
case QtFatalMsg:
fprintf(stderr, "FATAL: %s\n", localMsg.constData());
notifications::notify("KShare Fatal Error", msg, QSystemTrayIcon::Critical);
break;
}
}

View File

@ -4,6 +4,7 @@
#include <QStatusBar>
void notifications::notify(QString title, QString body, QSystemTrayIcon::MessageIcon icon) {
if (!MainWindow::inst()) return;
MainWindow::inst()->tray->showMessage(title, body, icon, 5000);
MainWindow::inst()->statusBar()->showMessage(title + ": " + body);
}

View File

@ -11,10 +11,12 @@
UploaderSingleton::UploaderSingleton()
: QObject(), saveDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) {
if (QStandardPaths::writableLocation(QStandardPaths::PicturesLocation).isEmpty()) {
qFatal() << "Cannot determine location for pictures";
qFatal("Cannot determine location for pictures");
}
if (!saveDir.exists()) {
saveDir.mkpath(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
if (!saveDir.mkpath(".")) {
qFatal("Could not create the path %s to store images in!", saveDir.absoluteFilePath(".").toLocal8Bit().constData());
}
}
QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
configDir.mkpath("KShare/uploaders");

View File

@ -2,6 +2,7 @@
#define UPLOADERSINGLETON_HPP
#include "uploader.hpp"
#include <QDir>
#include <QMap>
class UploaderSingleton : public QObject {
@ -21,6 +22,7 @@ class UploaderSingleton : public QObject {
void newUploader(Uploader *u);
private:
QDir saveDir;
UploaderSingleton();
QMap<QString, Uploader *> uploaders;
QString uploader = "imgur";