summaryrefslogtreecommitdiff
path: root/saltoqd/msolimageiohandler.cpp
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-04-21 00:47:30 +0200
committerJavier <dev.git@javispedro.com>2015-04-21 00:47:30 +0200
commit6662f40aff76e0700d82237261774758981bf784 (patch)
tree45617cf6b00b9e7e84da685abd216bd4278513f0 /saltoqd/msolimageiohandler.cpp
parente9628b70189b9acb84705693e155e10700f21177 (diff)
downloadsaltoq-6662f40aff76e0700d82237261774758981bf784.tar.gz
saltoq-6662f40aff76e0700d82237261774758981bf784.zip
forward some types of notification icons
Diffstat (limited to 'saltoqd/msolimageiohandler.cpp')
-rw-r--r--saltoqd/msolimageiohandler.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/saltoqd/msolimageiohandler.cpp b/saltoqd/msolimageiohandler.cpp
index c921c20..e6a9065 100644
--- a/saltoqd/msolimageiohandler.cpp
+++ b/saltoqd/msolimageiohandler.cpp
@@ -1,4 +1,5 @@
#include <QtCore/QtEndian>
+#include <QtCore/QBuffer>
#include <QtCore/QVariant>
#include <QtCore/QDebug>
#include <QtGui/QImage>
@@ -160,3 +161,28 @@ void MSOLImageIOHandler::setOption(ImageOption option, const QVariant &value)
{
}
+
+QByteArray convertImageToMsol(const QImage &img)
+{
+ MSOLImageIOHandler msolio;
+ QBuffer msolImg;
+ msolImg.open(QBuffer::WriteOnly);
+ msolio.setDevice(&msolImg);
+ if (!msolio.write(img)) {
+ return QByteArray();
+ }
+ return msolImg.data();
+}
+
+QImage convertMsolToImage(const QByteArray &msol)
+{
+ MSOLImageIOHandler msolio;
+ QBuffer msolImg;
+ QImage img;
+ msolImg.setData(msol);
+ msolImg.open(QBuffer::ReadOnly);
+ if (!msolio.read(&img)) {
+ return QImage();
+ }
+ return img;
+}