2017-04-23 15:05:48 +02:00
|
|
|
#ifndef UPLOADERSINGLETON_HPP
|
|
|
|
#define UPLOADERSINGLETON_HPP
|
|
|
|
|
|
|
|
#include "uploader.hpp"
|
2017-05-22 15:56:47 +02:00
|
|
|
#include <QDir>
|
2017-04-23 15:05:48 +02:00
|
|
|
#include <QMap>
|
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
class UploaderSingleton : public QObject {
|
2017-05-09 17:26:00 +02:00
|
|
|
Q_OBJECT
|
2017-06-04 22:58:29 +02:00
|
|
|
public:
|
2017-05-09 17:26:00 +02:00
|
|
|
static UploaderSingleton &inst() {
|
|
|
|
static UploaderSingleton inst;
|
|
|
|
return inst;
|
|
|
|
}
|
|
|
|
void registerUploader(Uploader *uploader);
|
2017-07-02 20:51:15 +02:00
|
|
|
void upload(QPixmap pixmap);
|
2017-06-06 17:05:34 +02:00
|
|
|
void upload(QByteArray img, QString format);
|
2017-07-01 22:34:11 +02:00
|
|
|
void upload(QFile &img, QString format);
|
2017-06-30 15:05:37 +02:00
|
|
|
void showSettings();
|
2017-05-09 17:26:00 +02:00
|
|
|
QList<Uploader *> uploaderList();
|
|
|
|
void set(QString uploader);
|
|
|
|
QString selectedUploader();
|
|
|
|
QList<std::runtime_error> errors();
|
2017-06-23 14:39:51 +02:00
|
|
|
QString currentUploader();
|
2017-06-30 15:05:37 +02:00
|
|
|
bool validate();
|
2017-06-23 14:39:51 +02:00
|
|
|
|
2017-06-04 22:58:29 +02:00
|
|
|
signals:
|
2017-05-09 17:26:00 +02:00
|
|
|
void newUploader(Uploader *u);
|
2017-06-30 15:05:37 +02:00
|
|
|
void uploaderChanged(QString newName);
|
2017-04-23 15:05:48 +02:00
|
|
|
|
2017-06-04 22:58:29 +02:00
|
|
|
private:
|
2017-05-22 15:56:47 +02:00
|
|
|
QDir saveDir;
|
2017-05-09 17:26:00 +02:00
|
|
|
QMap<QString, Uploader *> uploaders;
|
|
|
|
QString uploader = "imgur";
|
|
|
|
QList<std::runtime_error> errs;
|
2017-07-29 17:22:17 +02:00
|
|
|
UploaderSingleton();
|
2017-04-23 15:05:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // UPLOADERSINGLETON_HPP
|