2022-09-06 11:36:55 +08:00
|
|
|
// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
2016-10-14 15:47:43 +08:00
|
|
|
|
|
|
|
#ifndef DBUSDOCKADAPTORS_H
|
|
|
|
#define DBUSDOCKADAPTORS_H
|
|
|
|
|
|
|
|
#include <QtDBus/QtDBus>
|
2021-09-22 10:17:16 +08:00
|
|
|
|
2020-12-16 17:38:41 +08:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
2016-10-14 15:47:43 +08:00
|
|
|
/*
|
|
|
|
* Adaptor class for interface com.deepin.dde.Dock
|
|
|
|
*/
|
2021-09-22 10:17:16 +08:00
|
|
|
class QGSettings;
|
2016-10-14 15:47:43 +08:00
|
|
|
class DBusDockAdaptors: public QDBusAbstractAdaptor
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_CLASSINFO("D-Bus Interface", "com.deepin.dde.Dock")
|
|
|
|
Q_CLASSINFO("D-Bus Introspection", ""
|
|
|
|
" <interface name=\"com.deepin.dde.Dock\">\n"
|
|
|
|
" <property access=\"read\" type=\"(iiii)\" name=\"geometry\"/>\n"
|
2021-09-22 10:17:16 +08:00
|
|
|
" <property access=\"readwrite\" type=\"b\" name=\"showInPrimary\"/>\n"
|
2020-10-13 15:35:11 +08:00
|
|
|
" <method name=\"callShow\"/>"
|
2021-01-21 15:31:25 +08:00
|
|
|
" <method name=\"ReloadPlugins\"/>"
|
2021-09-22 10:17:16 +08:00
|
|
|
" <method name=\"GetLoadedPlugins\">"
|
|
|
|
" <arg name=\"list\" type=\"as\" direction=\"out\"/>"
|
|
|
|
" </method>"
|
2021-10-13 11:27:50 +08:00
|
|
|
" <method name=\"resizeDock\">"
|
|
|
|
" <arg name=\"offset\" type=\"i\" direction=\"in\"/>"
|
2021-11-05 13:10:09 +08:00
|
|
|
" <arg name=\"dragging\" type=\"b\" direction=\"in\"/>"
|
2021-10-13 11:27:50 +08:00
|
|
|
" </method>"
|
2021-10-11 11:14:40 +08:00
|
|
|
" <method name=\"getPluginKey\">"
|
|
|
|
" <arg name=\"pluginName\" type=\"s\" direction=\"in\"/>"
|
2021-10-13 11:27:50 +08:00
|
|
|
" <arg name=\"key\" type=\"s\" direction=\"out\"/>"
|
2021-10-11 11:14:40 +08:00
|
|
|
" </method>"
|
2021-09-22 10:17:16 +08:00
|
|
|
" <method name=\"getPluginVisible\">"
|
|
|
|
" <arg name=\"pluginName\" type=\"s\" direction=\"in\"/>"
|
|
|
|
" <arg name=\"visible\" type=\"b\" direction=\"out\"/>"
|
|
|
|
" </method>"
|
|
|
|
" <method name=\"setPluginVisible\">"
|
|
|
|
" <arg name=\"pluginName\" type=\"s\" direction=\"in\"/>"
|
|
|
|
" <arg name=\"visible\" type=\"b\" direction=\"in\"/>"
|
|
|
|
" </method>"
|
|
|
|
" <signal name=\"pluginVisibleChanged\">"
|
|
|
|
" <arg type=\"s\"/>"
|
|
|
|
" <arg type=\"b\"/>"
|
|
|
|
" </signal>"
|
2016-10-14 15:47:43 +08:00
|
|
|
" </interface>\n"
|
|
|
|
"")
|
2021-09-22 10:17:16 +08:00
|
|
|
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
|
|
|
|
Q_PROPERTY(bool showInPrimary READ showInPrimary WRITE setShowInPrimary NOTIFY showInPrimaryChanged)
|
2016-10-14 15:47:43 +08:00
|
|
|
|
|
|
|
public:
|
2021-05-31 17:37:21 +08:00
|
|
|
explicit DBusDockAdaptors(MainWindow *parent);
|
2016-10-14 15:47:43 +08:00
|
|
|
virtual ~DBusDockAdaptors();
|
|
|
|
|
|
|
|
MainWindow *parent() const;
|
|
|
|
|
2020-10-13 15:35:11 +08:00
|
|
|
public Q_SLOTS: // METHODS
|
|
|
|
void callShow();
|
2021-01-21 15:31:25 +08:00
|
|
|
void ReloadPlugins();
|
2020-10-13 15:35:11 +08:00
|
|
|
|
2021-09-22 10:17:16 +08:00
|
|
|
QStringList GetLoadedPlugins();
|
|
|
|
|
2021-11-05 13:10:09 +08:00
|
|
|
void resizeDock(int offset, bool dragging);
|
2021-10-13 11:27:50 +08:00
|
|
|
|
2021-10-11 11:14:40 +08:00
|
|
|
QString getPluginKey(const QString &pluginName);
|
|
|
|
|
2021-09-22 10:17:16 +08:00
|
|
|
bool getPluginVisible(const QString &pluginName);
|
|
|
|
void setPluginVisible(const QString &pluginName, bool visible);
|
|
|
|
|
2016-10-14 15:47:43 +08:00
|
|
|
public: // PROPERTIES
|
|
|
|
QRect geometry() const;
|
|
|
|
|
2021-09-22 10:17:16 +08:00
|
|
|
bool showInPrimary() const;
|
|
|
|
void setShowInPrimary(bool showInPrimary);
|
|
|
|
|
2016-10-14 15:47:43 +08:00
|
|
|
signals:
|
|
|
|
void geometryChanged(QRect geometry);
|
2021-09-22 10:17:16 +08:00
|
|
|
void showInPrimaryChanged(bool);
|
|
|
|
void pluginVisibleChanged(const QString &pluginName, bool visible);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool isPluginValid(const QString &name);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QGSettings *m_gsettings;
|
2016-10-14 15:47:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //DBUSDOCKADAPTORS
|