2020-07-21 13:33:03 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
SPDX-FileCopyrightText: 2017 David Edmundson <kde@davidedmundson.co.uk>
|
|
|
|
SPDX-FileCopyrightText: 2018 Laurent Montel <montel@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
|
|
|
#include <QDBusArgument>
|
|
|
|
#include <QVariantMap>
|
|
|
|
#include <KRunner/QueryMatch>
|
|
|
|
|
|
|
|
struct RemoteMatch
|
|
|
|
{
|
|
|
|
//sssuda{sv}
|
|
|
|
QString id;
|
|
|
|
QString text;
|
|
|
|
QString iconName;
|
|
|
|
Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch;
|
|
|
|
qreal relevance = 0;
|
|
|
|
QVariantMap properties;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef QList<RemoteMatch> RemoteMatches;
|
|
|
|
|
|
|
|
struct RemoteAction
|
|
|
|
{
|
|
|
|
QString id;
|
|
|
|
QString text;
|
|
|
|
QString iconName;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef QList<RemoteAction> RemoteActions;
|
|
|
|
|
2020-12-17 19:04:05 +00:00
|
|
|
struct RemoteImage
|
|
|
|
{
|
|
|
|
//iiibiiay (matching notification spec image-data attribute)
|
|
|
|
int width = 0;
|
|
|
|
int height = 0;
|
|
|
|
int rowStride = 0;
|
|
|
|
bool hasAlpha = false;
|
|
|
|
int bitsPerSample = 0;
|
|
|
|
int channels = 0;
|
|
|
|
QByteArray data;
|
|
|
|
};
|
|
|
|
|
2020-07-21 13:33:03 +00:00
|
|
|
inline QDBusArgument &operator<< (QDBusArgument &argument, const RemoteMatch &match) {
|
|
|
|
argument.beginStructure();
|
|
|
|
argument << match.id;
|
|
|
|
argument << match.text;
|
|
|
|
argument << match.iconName;
|
|
|
|
argument << match.type;
|
|
|
|
argument << match.relevance;
|
|
|
|
argument << match.properties;
|
|
|
|
argument.endStructure();
|
|
|
|
return argument;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteMatch &match) {
|
|
|
|
argument.beginStructure();
|
|
|
|
argument >> match.id;
|
|
|
|
argument >> match.text;
|
|
|
|
argument >> match.iconName;
|
|
|
|
uint type;
|
|
|
|
argument >> type;
|
|
|
|
match.type = (Plasma::QueryMatch::Type)type;
|
|
|
|
argument >> match.relevance;
|
|
|
|
argument >> match.properties;
|
|
|
|
argument.endStructure();
|
|
|
|
|
|
|
|
return argument;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QDBusArgument &operator<< (QDBusArgument &argument, const RemoteAction &action)
|
|
|
|
{
|
|
|
|
argument.beginStructure();
|
|
|
|
argument << action.id;
|
|
|
|
argument << action.text;
|
|
|
|
argument << action.iconName;
|
|
|
|
argument.endStructure();
|
|
|
|
return argument;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteAction &action) {
|
|
|
|
argument.beginStructure();
|
|
|
|
argument >> action.id;
|
|
|
|
argument >> action.text;
|
|
|
|
argument >> action.iconName;
|
|
|
|
argument.endStructure();
|
|
|
|
return argument;
|
|
|
|
}
|
|
|
|
|
2020-12-17 19:04:05 +00:00
|
|
|
inline QDBusArgument &operator<< (QDBusArgument &argument, const RemoteImage &image) {
|
|
|
|
argument.beginStructure();
|
|
|
|
argument << image.width;
|
|
|
|
argument << image.height;
|
|
|
|
argument << image.rowStride;
|
|
|
|
argument << image.hasAlpha;
|
|
|
|
argument << image.bitsPerSample;
|
|
|
|
argument << image.channels;
|
|
|
|
argument << image.data;
|
|
|
|
argument.endStructure();
|
|
|
|
return argument;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteImage &image) {
|
|
|
|
argument.beginStructure();
|
|
|
|
argument >> image.width;
|
|
|
|
argument >> image.height;
|
|
|
|
argument >> image.rowStride;
|
|
|
|
argument >> image.hasAlpha;
|
|
|
|
argument >> image.bitsPerSample;
|
|
|
|
argument >> image.channels;
|
|
|
|
argument >> image.data;
|
|
|
|
argument.endStructure();
|
|
|
|
return argument;
|
|
|
|
}
|
|
|
|
|
2020-07-21 13:33:03 +00:00
|
|
|
Q_DECLARE_METATYPE(RemoteMatch)
|
|
|
|
Q_DECLARE_METATYPE(RemoteMatches)
|
|
|
|
Q_DECLARE_METATYPE(RemoteAction)
|
|
|
|
Q_DECLARE_METATYPE(RemoteActions)
|
2020-12-17 19:04:05 +00:00
|
|
|
Q_DECLARE_METATYPE(RemoteImage)
|