why image clipboard didnt work. lel

This commit is contained in:
Niklas 2019-05-18 15:52:44 +02:00
parent 872f26839f
commit f5a7b56de9
3 changed files with 8 additions and 2 deletions

View File

@ -23,6 +23,7 @@ void clipboardcopy::copyClipboard() {
if(mimeData->hasImage()) {
QPixmap map = qvariant_cast<QPixmap>(mimeData->imageData());
UploaderSingleton::inst().upload(map, false);
} else if(mimeData->hasText()) {
#ifdef Q_OS_WIN
QUrl fileUrl(mimeData->text());

View File

@ -53,7 +53,7 @@ void UploaderSingleton::registerUploader(Uploader *uploader) {
emit newUploader(uploader);
}
void UploaderSingleton::upload(QPixmap pixmap) {
void UploaderSingleton::upload(QPixmap pixmap, bool save) {
updateSaveSettings();
auto u = uploaders.value(uploader);
if (!u->validate()) {
@ -63,7 +63,7 @@ void UploaderSingleton::upload(QPixmap pixmap) {
}
QString format = settings::settings().value("captureformat", "PNG").toString();
QFile *file = nullptr;
if (saveImages) {
if (saveImages && save) {
file = new QFile(saveDir.absoluteFilePath(
formatter::format(settings::settings().value("fileFormat", "Screenshot %(yyyy-MM-dd HH-mm-ss)date.%ext").toString(),
format.toLower())));
@ -80,6 +80,10 @@ void UploaderSingleton::upload(QPixmap pixmap) {
delete file;
}
void UploaderSingleton::upload(QPixmap pixmap) {
UploaderSingleton::upload(pixmap, true);
}
void UploaderSingleton::upload(QByteArray img, QString format) {
updateSaveSettings();
if (img.isEmpty()) return;

View File

@ -14,6 +14,7 @@ public:
return inst;
}
void registerUploader(Uploader *uploader);
void upload(QPixmap pixmap, bool save);
void upload(QPixmap pixmap);
void upload(QByteArray img, QString format);
void upload(QFile &img, QString format);