You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1.1 KiB

#include "imguruploader.hpp"
#include <QBuffer>
#include <QJsonObject>
#include <QJsonValue>
#include <io/ioutils.hpp>
#include <notifications.hpp>
#include <screenshotutil.hpp>
void ImgurUploader::doUpload(QPixmap *pixmap)
QByteArray byteArray;
QBuffer buffer(&byteArray);
pixmap->save(&buffer, "PNG");
QList<QPair<QString, QString>>()
<< QPair<QString, QString>("Content-Type", "application/x-www-form-urlencoded")
<< QPair<QString, QString>("Authorization", "Client-ID 8a98f183fc895da"),
byteArray, [](QJsonDocument res, QNetworkReply *) {
QString result = res.object()["data"].toObject()["link"].toString();
notifications::notify("KShare imgur Uploader ",
result.isEmpty() ? "Failed upload!" : "Upload done, but result empty!");