cache icons based on pixel content instead of image string

This commit is contained in:
2026-05-27 13:46:15 +02:00
parent 41c9d9e9b4
commit afa3b0e3c4
3 changed files with 154 additions and 192 deletions
+8 -7
View File
@@ -1,10 +1,11 @@
#pragma once
#include <QtQuick/qquickitem.h>
#include <qjsvalue.h>
#include <qobject.h>
#include <QImage>
#include <QJSValue>
#include <QObject>
#include <qqmlintegration.h>
#include <qurl.h>
#include <QUrl>
namespace ZShell {
@@ -23,9 +24,9 @@ Q_INVOKABLE void saveItem(QQuickItem* target, const QUrl& path, QJSValue onSaved
Q_INVOKABLE void saveItem(QQuickItem* target, const QUrl& path, const QRect& rect, QJSValue onSaved);
Q_INVOKABLE void saveItem(QQuickItem* target, const QUrl& path, const QRect& rect, QJSValue onSaved, QJSValue onFailed);
Q_INVOKABLE void saveImage(const QUrl& source, const QUrl& target);
Q_INVOKABLE void saveImage(const QUrl& source, const QUrl& target, QJSValue onSaved);
Q_INVOKABLE void saveImage(const QUrl& source, const QUrl& target, QJSValue onSaved, QJSValue onFailed);
Q_INVOKABLE void cacheImage(const QUrl& source, const QString& cacheDir);
Q_INVOKABLE void cacheImage(const QUrl& source, const QString& cacheDir, QJSValue onSaved);
Q_INVOKABLE void cacheImage(const QUrl& source, const QString& cacheDir, QJSValue onSaved, QJSValue onFailed);
// clang-format on
Q_INVOKABLE bool copyFile(const QUrl& source, const QUrl& target, bool overwrite = true) const;
@@ -33,7 +34,7 @@ Q_INVOKABLE bool deleteFile(const QUrl& path) const;
Q_INVOKABLE QString toLocalFile(const QUrl& url) const;
private:
bool saveImageInternal(const QUrl& source, const QUrl& target) const;
bool loadSourceImage(const QUrl& source, QImage& image) const;
};
} // namespace ZShell