Debian Codegraph @

src/dbus/NhekoDBusBackend.h

raw symbols SCIP
1 // SPDX-FileCopyrightText: Nheko Contributors
2 //
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 #pragma once
6
7 #include <QDBusMessage>
8 #include <QObject>
9
10 #include "NhekoDBusApi.h"
11 #include "config/nheko.h"
12
13 class RoomlistModel;
14
15 class NhekoDBusBackend final : public QObject
16 {
17 Q_OBJECT
18 Q_CLASSINFO("D-Bus Interface", "im.nheko.Nheko")
19
20 public:
21 NhekoDBusBackend(RoomlistModel *parent);
22
23 public slots:
24 //! Get the nheko D-Bus API version.
25 Q_SCRIPTABLE QString apiVersion() const { return nheko::dbus::dbusApiVersion.toString(); }
26 //! Get the nheko version.
27 Q_SCRIPTABLE QString nhekoVersion() const { return nheko::version; }
28 //! Call this function to get a list of all joined rooms.
29 Q_SCRIPTABLE QVector<nheko::dbus::RoomInfoItem> rooms() const;
30 //! Call this function to convert a URI into an image
31 Q_SCRIPTABLE QImage image(const QString &uri, const QDBusMessage &message) const;
32 //! Activates a currently joined room.
33 Q_SCRIPTABLE void activateRoom(const QString &alias) const;
34 //! Joins a room. It is your responsibility to ask for confirmation (if desired).
35 Q_SCRIPTABLE void joinRoom(const QString &alias) const;
36 //! Starts or activates a direct chat. It is your responsibility to ask for confirmation (if
37 //! desired).
38 Q_SCRIPTABLE void directChat(const QString &userId) const;
39 //! Gets the user's status message.
40 Q_SCRIPTABLE QString statusMessage() const;
41 //! Sets the user's status message.
42 Q_SCRIPTABLE void setStatusMessage(const QString &message);
43
44 private:
45 void bringWindowToTop() const;
46
47 RoomlistModel *m_parent;
48 };