Changeset View
Changeset View
Standalone View
Standalone View
dataengines/potd/cachedprovider.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 45 | SaveImageThread::SaveImageThread(const QString &identifier, const QImage &image) | |||
---|---|---|---|---|---|
46 | : m_image(image), | 46 | : m_image(image), | ||
47 | m_identifier(identifier) | 47 | m_identifier(identifier) | ||
48 | { | 48 | { | ||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | void SaveImageThread::run() | 51 | void SaveImageThread::run() | ||
52 | { | 52 | { | ||
53 | const QString path = CachedProvider::identifierToPath( m_identifier ); | 53 | const QString path = CachedProvider::identifierToPath( m_identifier ); | ||
54 | m_image.save(path, "PNG"); | 54 | m_image.save(path, "JPEG"); | ||
ngraham: seems unrelated | |||||
davidre: Can't we save the image in its original format? | |||||
JPEG is the original format for all POTD providers. For the save() function, you must specify format or extension. It cannot guess the original format. guoyunhe: JPEG is the original format for all POTD providers. For the `save()` function, you must specify… | |||||
55 | emit done( m_identifier, path, m_image ); | 55 | emit done( m_identifier, path, m_image ); | ||
56 | } | 56 | } | ||
57 | 57 | | |||
58 | QString CachedProvider::identifierToPath( const QString &identifier ) | 58 | QString CachedProvider::identifierToPath( const QString &identifier ) | ||
59 | { | 59 | { | ||
60 | const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1String("/plasma_engine_potd/"); | 60 | const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + QLatin1String("/plasma_engine_potd/"); | ||
61 | QDir d; | 61 | QDir d; | ||
62 | d.mkpath(dataDir); | 62 | d.mkpath(dataDir); | ||
63 | return dataDir + identifier; | 63 | return dataDir + identifier; | ||
64 | } | 64 | } | ||
65 | 65 | | |||
66 | 66 | | |||
67 | CachedProvider::CachedProvider( const QString &identifier, QObject *parent ) | 67 | CachedProvider::CachedProvider( const QString &identifier, QObject *parent ) | ||
68 | : PotdProvider( parent ), mIdentifier( identifier ) | 68 | : PotdProvider( parent ), mIdentifier( identifier ) | ||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
seems unrelated