Add D-Bus API (#916)
This adds functionality for viewing joined rooms and activating rooms.
This commit is contained in:
parent
3329b7aab2
commit
686ebfdbec
15 changed files with 508 additions and 54 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include "MxcImageProvider.h"
|
||||
#include "UserSettingsPage.h"
|
||||
#include "Utils.h"
|
||||
#include "dbus/NhekoDBusApi.h"
|
||||
|
||||
NotificationsManager::NotificationsManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
|
|
@ -269,49 +270,3 @@ NotificationsManager::notificationClosed(uint id, uint reason)
|
|||
Q_UNUSED(reason);
|
||||
notificationIds.remove(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatic marshaling of a QImage for org.freedesktop.Notifications.Notify
|
||||
*
|
||||
* This function is from the Clementine project (see
|
||||
* http://www.clementine-player.org) and licensed under the GNU General Public
|
||||
* License, version 3 or later.
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2010 David Sansome <me@davidsansome.com>
|
||||
*/
|
||||
QDBusArgument &
|
||||
operator<<(QDBusArgument &arg, const QImage &image)
|
||||
{
|
||||
if (image.isNull()) {
|
||||
arg.beginStructure();
|
||||
arg << 0 << 0 << 0 << false << 0 << 0 << QByteArray();
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
|
||||
QImage i = image.height() > 100 || image.width() > 100
|
||||
? image.scaledToHeight(100, Qt::SmoothTransformation)
|
||||
: image;
|
||||
i = std::move(i).convertToFormat(QImage::Format_RGBA8888);
|
||||
|
||||
arg.beginStructure();
|
||||
arg << i.width();
|
||||
arg << i.height();
|
||||
arg << i.bytesPerLine();
|
||||
arg << i.hasAlphaChannel();
|
||||
int channels = i.hasAlphaChannel() ? 4 : 3;
|
||||
arg << i.depth() / channels;
|
||||
arg << channels;
|
||||
arg << QByteArray(reinterpret_cast<const char *>(i.bits()), i.sizeInBytes());
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &
|
||||
operator>>(const QDBusArgument &arg, QImage &)
|
||||
{
|
||||
// This is needed to link but shouldn't be called.
|
||||
Q_ASSERT(0);
|
||||
return arg;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue