From abd1927eb981520b0e370c61fa902dbb69c70069 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 23 Sep 2015 02:47:27 +0200 Subject: [PATCH] refs #452, added streaming operator for pixmap --- src/blackmisc/dbus.cpp | 28 ++++++++++++++++++++++++++++ src/blackmisc/dbus.h | 10 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/blackmisc/dbus.cpp diff --git a/src/blackmisc/dbus.cpp b/src/blackmisc/dbus.cpp new file mode 100644 index 000000000..3943323a2 --- /dev/null +++ b/src/blackmisc/dbus.cpp @@ -0,0 +1,28 @@ +/* Copyright (C) 2015 + * swift project Community / Contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "blackmisc/dbus.h" +#include "blackmisc/blackmiscfreefunctions.h" + +const QDBusArgument &operator>>(const QDBusArgument &argument, QPixmap &pixmap) +{ + QByteArray ba; + argument >> ba; + BlackMisc::pngByteArrayToPixmapRef(ba, pixmap); + return argument; +} + + +QDBusArgument &operator<<(QDBusArgument &argument, const QPixmap &pixmap) +{ + QByteArray ba; + BlackMisc::pixmapToPngByteArray(pixmap, ba); + argument << ba; + return argument; +} diff --git a/src/blackmisc/dbus.h b/src/blackmisc/dbus.h index 0924db50e..f53ae22d1 100644 --- a/src/blackmisc/dbus.h +++ b/src/blackmisc/dbus.h @@ -115,4 +115,14 @@ operator>>(const QDBusArgument &argument, ENUM &enumType) return argument; } +/*! + * Non member non-friend streaming for QPixmap + */ +const QDBusArgument &operator>>(const QDBusArgument &argument, QPixmap &pixmap); + +/*! + * Non member non-friend streaming for QPixmap + */ +QDBusArgument &operator<<(QDBusArgument &argument, const QPixmap &pixmap); + #endif // guard