dde-dock/plugins/system-tray/dbus/sni/dbusstructures.cpp
listenerri 68a4332ad1 feet(plugin): StatusNotifierItem system tray protocol support
Change-Id: I3b879b052e46f2eda758085dfb4701d23923d445
2018-10-13 13:30:42 +08:00

67 lines
2.0 KiB
C++

/*
* Copyright 2011 Canonical Ltd.
* Copyright 2014 Dmitry Shachnev <mitya57@ubuntu.com>
*
* Maintainer: listenerri <listenerri@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Based on sni-qt code by Aurelien Gateau <aurelien.gateau@canonical.com>.
*/
#include <QtDBus/qdbusmetatype.h>
#include "dbusstructures.h"
QDBusArgument &operator<<(QDBusArgument &argument, const DBusImage &image)
{
argument.beginStructure();
argument << image.width << image.height << image.pixels;
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument, DBusImage &image)
{
argument.beginStructure();
argument >> image.width >> image.height >> image.pixels;
argument.endStructure();
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument, const DBusToolTip &tip)
{
argument.beginStructure();
argument << tip.iconName << tip.iconPixmap << tip.title << tip.description;
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument, DBusToolTip &tip)
{
argument.beginStructure();
argument >> tip.iconName >> tip.iconPixmap >> tip.title >> tip.description;
argument.endStructure();
return argument;
}
void registerMetaTypes()
{
static bool registered = false;
if (registered) {
return;
}
qDBusRegisterMetaType<DBusImage>();
qDBusRegisterMetaType<DBusImageList>();
qDBusRegisterMetaType<DBusToolTip>();
}