Browse Source

Im stupid

tags/v5.0.0
ArsenArsen 5 years ago
parent
commit
91aa7badc6
  1. 2
      main.cpp
  2. 1
      notifications.cpp
  3. 6
      uploaders/uploadersingleton.cpp
  4. 2
      uploaders/uploadersingleton.hpp

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;
}
}

1
notifications.cpp

@ -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);
}

6
uploaders/uploadersingleton.cpp

@ -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
uploaders/uploadersingleton.hpp

@ -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…
Cancel
Save