Add setTheme D-Bus API
Signed-off-by: weeman <weeman@frankfurt.ccc.de>
This commit is contained in:
parent
398cef5f8f
commit
ffaa12cc19
4 changed files with 20 additions and 0 deletions
|
|
@ -170,6 +170,14 @@ setStatusMessage(const QString &message)
|
|||
interface.call(QDBus::NoBlock, QStringLiteral("setStatusMessage"), message);
|
||||
}
|
||||
|
||||
void
|
||||
setTheme(const QString &theme)
|
||||
{
|
||||
if (QDBusInterface interface{QStringLiteral(NHEKO_DBUS_SERVICE_NAME), QStringLiteral("/")};
|
||||
interface.isValid())
|
||||
interface.call(QDBus::NoBlock, QStringLiteral("setTheme"), theme);
|
||||
}
|
||||
|
||||
} // nheko::dbus
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ statusMessage();
|
|||
//! Sets the user's status message (if supported by the homeserver).
|
||||
void
|
||||
setStatusMessage(const QString &message);
|
||||
//! Sets the current theme (supported values: "light", "dark" or "system")
|
||||
void
|
||||
setTheme(const QString &theme);
|
||||
|
||||
QDBusArgument &
|
||||
operator<<(QDBusArgument &arg, const RoomInfoItem &item);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "Logging.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MxcImageProvider.h"
|
||||
#include "UserSettingsPage.h"
|
||||
#include "timeline/RoomlistModel.h"
|
||||
#include "timeline/TimelineModel.h"
|
||||
|
||||
|
|
@ -112,6 +113,12 @@ NhekoDBusBackend::setStatusMessage(const QString &message)
|
|||
ChatPage::instance()->setStatus(message);
|
||||
}
|
||||
|
||||
void
|
||||
NhekoDBusBackend::setTheme(const QString &theme)
|
||||
{
|
||||
UserSettings::instance()->setTheme(theme);
|
||||
}
|
||||
|
||||
void
|
||||
NhekoDBusBackend::bringWindowToTop() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public slots:
|
|||
Q_SCRIPTABLE QString statusMessage() const;
|
||||
//! Sets the user's status message.
|
||||
Q_SCRIPTABLE void setStatusMessage(const QString &message);
|
||||
//! Sets the current theme (supported values: "light", "dark" or "system")
|
||||
Q_SCRIPTABLE void setTheme(const QString &theme);
|
||||
|
||||
private:
|
||||
void bringWindowToTop() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue