File indexing completed on 2024-05-12 05:36:09
0001 // SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 #pragma once 0005 0006 #include "plasmashellmobileinterface.h" 0007 0008 #include <QDBusServiceWatcher> 0009 #include <QObject> 0010 #include <QString> 0011 #include <qqmlregistration.h> 0012 0013 class ShellDBusClient : public QObject 0014 { 0015 Q_OBJECT 0016 QML_ELEMENT 0017 QML_SINGLETON 0018 0019 Q_PROPERTY(bool doNotDisturb READ doNotDisturb WRITE setDoNotDisturb NOTIFY doNotDisturbChanged) 0020 Q_PROPERTY(bool isActionDrawerOpen READ isActionDrawerOpen WRITE setIsActionDrawerOpen NOTIFY isActionDrawerOpenChanged) 0021 Q_PROPERTY(bool isTaskSwitcherVisible READ isTaskSwitcherVisible NOTIFY isTaskSwitcherVisibleChanged) 0022 0023 public: 0024 explicit ShellDBusClient(QObject *parent = nullptr); 0025 0026 bool doNotDisturb() const; 0027 void setDoNotDisturb(bool value); 0028 0029 bool isActionDrawerOpen() const; 0030 void setIsActionDrawerOpen(bool value); 0031 0032 bool isTaskSwitcherVisible() const; 0033 0034 Q_INVOKABLE void openActionDrawer(); 0035 Q_INVOKABLE void closeActionDrawer(); 0036 0037 Q_INVOKABLE void openAppLaunchAnimation(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize); 0038 Q_INVOKABLE void closeAppLaunchAnimation(); 0039 0040 Q_INVOKABLE void openHomeScreen(); 0041 Q_INVOKABLE void resetHomeScreenPosition(); 0042 Q_INVOKABLE void showVolumeOSD(); 0043 0044 Q_SIGNALS: 0045 void isActionDrawerOpenChanged(); 0046 void doNotDisturbChanged(); 0047 void isTaskSwitcherVisibleChanged(); 0048 void openActionDrawerRequested(); 0049 void closeActionDrawerRequested(); 0050 void openAppLaunchAnimationRequested(QString splashIcon, QString title, qreal x, qreal y, qreal sourceIconSize); 0051 void closeAppLaunchAnimationRequested(); 0052 void openHomeScreenRequested(); 0053 void resetHomeScreenPositionRequested(); 0054 void showVolumeOSDRequested(); 0055 0056 private Q_SLOTS: 0057 void updateDoNotDisturb(); 0058 void updateIsActionDrawerOpen(); 0059 void updateIsTaskSwitcherVisible(); 0060 0061 private: 0062 void connectSignals(); 0063 0064 OrgKdePlasmashellInterface *m_interface; 0065 QDBusServiceWatcher *m_watcher; 0066 0067 bool m_doNotDisturb = false; 0068 bool m_isActionDrawerOpen = false; 0069 bool m_isTaskSwitcherVisible = false; 0070 0071 bool m_connected = false; 0072 };