Im stupid
This commit is contained in:
parent
96f4cf7305
commit
91aa7badc6
2
main.cpp
2
main.cpp
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user