KShare/uploaders/uploadersingleton.hpp

37 lines
877 B
C++
Raw Normal View History

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 {
Q_OBJECT
public:
static UploaderSingleton &inst() {
static UploaderSingleton inst;
return inst;
}
void registerUploader(Uploader *uploader);
void upload(QPixmap *pixmap);
void upload(QByteArray img, QString format);
void upload(QFile img, QString format);
QList<Uploader *> uploaderList();
void set(QString uploader);
QString selectedUploader();
QList<std::runtime_error> errors();
2017-06-23 14:39:51 +02:00
QString currentUploader();
signals:
void newUploader(Uploader *u);
2017-04-23 15:05:48 +02:00
private:
2017-05-22 15:56:47 +02:00
QDir saveDir;
UploaderSingleton();
QMap<QString, Uploader *> uploaders;
QString uploader = "imgur";
QList<std::runtime_error> errs;
2017-04-23 15:05:48 +02:00
};
#endif // UPLOADERSINGLETON_HPP