Page MenuHomePhabricator (Chris)

imageuploader.cpp
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

imageuploader.cpp

#include "imageuploader.h"
#include "imguruploader.h"
#include "pomfuploader.h"
#include <QSettings>
#include "../screenshotmanager.h"
ImageUploader *ImageUploader::factory(const QString &name)
{
if (name == "imgur") {
return new ImgurUploader;
} else if (name == "pomf") {
return new PomfUploader;
}
return nullptr;
}
QVariantHash ImageUploader::loadSettings(const QString &uploaderType)
{
auto globalSettings = ScreenshotManager::instance()->settings();
globalSettings->beginGroup("upload/" + uploaderType);
auto keys = globalSettings->childKeys();
QVariantHash settings;
for (auto key : qAsConst(keys)) {
settings[key] = globalSettings->value(key);
}
globalSettings->endGroup();
return settings;
}
void ImageUploader::loadSettings()
{
mSettings = loadSettings(mUploaderType);
}
void ImageUploader::saveSettings(const QString &uploaderType, const QVariantHash &settings) {
auto globalSettings = ScreenshotManager::instance()->settings();
globalSettings->beginGroup("upload/" + uploaderType);
for (auto key : settings.keys()) {
globalSettings->setValue(key, settings[key]);
}
globalSettings->endGroup();
}
void ImageUploader::saveSettings()
{
saveSettings(mUploaderType, mSettings);
}
int ImageUploader::progress() const {
return mProgress;
}
void ImageUploader::setProgress(int progress)
{
if (mProgress != progress) {
mProgress = progress;
emit progressChanged(mProgress);
}
}

File Metadata

Mime Type
text/x-c
Expires
Sun, Nov 15, 4:09 PM (7 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
120064
Default Alt Text
imageuploader.cpp (1 KB)

Event Timeline