--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlFrontend/themeiconprovider.cpp Wed Oct 01 01:20:05 2014 +0400
@@ -0,0 +1,37 @@
+#include <QByteArray>
+#include <QDebug>
+
+#include "themeiconprovider.h"
+#include "flib.h"
+
+ThemeIconProvider::ThemeIconProvider()
+ : QQuickImageProvider(QQuickImageProvider::Image)
+{
+ getThemeIcon = 0;
+}
+
+void ThemeIconProvider::setFileContentsFunction(getThemeIcon_t *f)
+{
+ getThemeIcon = f;
+}
+
+QImage ThemeIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
+{
+ Q_UNUSED(requestedSize);
+
+ if(!getThemeIcon)
+ return QImage();
+
+ QByteArray buf;
+ buf.resize(65536);
+
+ uint32_t fileSize = getThemeIcon(id.toUtf8().data(), buf.data(), buf.size());
+ buf.truncate(fileSize);
+ qDebug() << "ThemeIconProvider file size = " << fileSize;
+
+ QImage img = QImage::fromData(buf);
+
+ if (size)
+ *size = img.size();
+ return img;
+}