KShare/uploaders/uploadersingleton.hpp
ArsenArsen 34624e5762 Redesigned uploaders a bit to support more stuff.
Added a functionality of uploading byte arrays and even files. Created RecordingFormat, which allows me to create states, I guess??, for RecordingContex's. Needed for, eg. gifs, which are horrible and I strongly suggest against, which will actually be stored as files per frame which are QImages encoded with QImage::Format_RGB888 (confirmation needed).
2017-06-04 22:58:29 +02:00

36 lines
864 B
C++

#ifndef UPLOADERSINGLETON_HPP
#define UPLOADERSINGLETON_HPP
#include "uploader.hpp"
#include <QDir>
#include <QMap>
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);
void upload(QFile img);
virtual std::tuple<QString, QString> format();
QList<Uploader *> uploaderList();
void set(QString uploader);
QString selectedUploader();
QList<std::runtime_error> errors();
signals:
void newUploader(Uploader *u);
private:
QDir saveDir;
UploaderSingleton();
QMap<QString, Uploader *> uploaders;
QString uploader = "imgur";
QList<std::runtime_error> errs;
};
#endif // UPLOADERSINGLETON_HPP