mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
add entry dbus
Change-Id: Ifae25f9e6b5d3202cc5cc5965a0bca8c71724dd5
This commit is contained in:
parent
c2eebf07dd
commit
68d8db4d25
@ -1,4 +1,7 @@
|
|||||||
#include "dockitemcontroller.h"
|
#include "dockitemcontroller.h"
|
||||||
|
#include "dbus/dbusdockentry.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
DockItemController *DockItemController::INSTANCE = nullptr;
|
DockItemController *DockItemController::INSTANCE = nullptr;
|
||||||
|
|
||||||
@ -11,7 +14,7 @@ DockItemController *DockItemController::instance(QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DockItemController::DockItemController(QObject *parent)
|
DockItemController::DockItemController(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent),
|
||||||
|
m_entryManager(new DBusDockEntryManager(this))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef DOCKITEMCONTROLLER_H
|
#ifndef DOCKITEMCONTROLLER_H
|
||||||
#define DOCKITEMCONTROLLER_H
|
#define DOCKITEMCONTROLLER_H
|
||||||
|
|
||||||
|
#include "dbus/dbusdockentrymanager.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class DockItemController : public QObject
|
class DockItemController : public QObject
|
||||||
@ -8,7 +10,7 @@ class DockItemController : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DockItemController *instance(QObject *parent);
|
static DockItemController *instance(QObject *parent);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dockItemCountChanged() const;
|
void dockItemCountChanged() const;
|
||||||
@ -16,6 +18,8 @@ signals:
|
|||||||
private:
|
private:
|
||||||
explicit DockItemController(QObject *parent = 0);
|
explicit DockItemController(QObject *parent = 0);
|
||||||
|
|
||||||
|
DBusDockEntryManager *m_entryManager;
|
||||||
|
|
||||||
static DockItemController *INSTANCE;
|
static DockItemController *INSTANCE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
31
dbus/dbusdockentry.cpp
Normal file
31
dbus/dbusdockentry.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This file was generated by qdbusxml2cpp version 0.8
|
||||||
|
* Command line was: qdbusxml2cpp -c DBusDockEntry -p dbusdockentry dde-dock-entry-v1.xml
|
||||||
|
*
|
||||||
|
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
*
|
||||||
|
* This is an auto-generated file.
|
||||||
|
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||||
|
* before re-generating it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dbusdockentry.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation of interface class DBusDockEntry
|
||||||
|
*/
|
||||||
|
|
||||||
|
DBusDockEntry::DBusDockEntry(const QString &path, QObject *parent)
|
||||||
|
: QDBusAbstractInterface("com.deepin.daemon.Dock", path, staticInterfaceName(), QDBusConnection::sessionBus(), parent)
|
||||||
|
{
|
||||||
|
qRegisterMetaType<Dict>("Dict");
|
||||||
|
qDBusRegisterMetaType<Dict>();
|
||||||
|
|
||||||
|
QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged","sa{sv}as", this, SLOT(__propertyChanged__(QDBusMessage)));
|
||||||
|
}
|
||||||
|
|
||||||
|
DBusDockEntry::~DBusDockEntry()
|
||||||
|
{
|
||||||
|
QDBusConnection::sessionBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage)));
|
||||||
|
}
|
||||||
|
|
92
dbus/dbusdockentry.h
Normal file
92
dbus/dbusdockentry.h
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* This file was generated by qdbusxml2cpp version 0.8
|
||||||
|
* Command line was: qdbusxml2cpp -c DBusDockEntry -p dbusdockentry dde-dock-entry-v1.xml
|
||||||
|
*
|
||||||
|
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
*
|
||||||
|
* This is an auto-generated file.
|
||||||
|
* Do not edit! All changes made to it will be lost.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DBUSDOCKENTRY_H_1464922075
|
||||||
|
#define DBUSDOCKENTRY_H_1464922075
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtDBus/QtDBus>
|
||||||
|
|
||||||
|
typedef QMap<QString, QString> Dict;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Proxy class for interface dde.dock.Entry
|
||||||
|
*/
|
||||||
|
class DBusDockEntry: public QDBusAbstractInterface
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
|
||||||
|
{
|
||||||
|
QList<QVariant> arguments = msg.arguments();
|
||||||
|
if (3 != arguments.count())
|
||||||
|
return;
|
||||||
|
QString interfaceName = msg.arguments().at(0).toString();
|
||||||
|
if (interfaceName !="dde.dock.Entry")
|
||||||
|
return;
|
||||||
|
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||||
|
foreach(const QString &prop, changedProps.keys()) {
|
||||||
|
const QMetaObject* self = metaObject();
|
||||||
|
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||||
|
QMetaProperty p = self->property(i);
|
||||||
|
if (p.name() == prop) {
|
||||||
|
Q_EMIT p.notifySignal().invoke(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
static inline const char *staticInterfaceName()
|
||||||
|
{ return "dde.dock.Entry"; }
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DBusDockEntry(const QString &path, QObject *parent = 0);
|
||||||
|
|
||||||
|
~DBusDockEntry();
|
||||||
|
|
||||||
|
Q_PROPERTY(Dict Data READ data NOTIFY DataChanged)
|
||||||
|
inline Dict data() const
|
||||||
|
{ return qvariant_cast< Dict >(property("Data")); }
|
||||||
|
|
||||||
|
Q_PROPERTY(QString Id READ id NOTIFY IdChanged)
|
||||||
|
inline QString id() const
|
||||||
|
{ return qvariant_cast< QString >(property("Id")); }
|
||||||
|
|
||||||
|
Q_PROPERTY(QString Type READ type NOTIFY TypeChanged)
|
||||||
|
inline QString type() const
|
||||||
|
{ return qvariant_cast< QString >(property("Type")); }
|
||||||
|
|
||||||
|
public Q_SLOTS: // METHODS
|
||||||
|
inline QDBusPendingReply<> Activate()
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("Activate"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_SIGNALS: // SIGNALS
|
||||||
|
void DataChanged(const QString &in0, const QString &in1);
|
||||||
|
// begin property changed signals
|
||||||
|
void DataChanged();
|
||||||
|
void IdChanged();
|
||||||
|
void TypeChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace dde {
|
||||||
|
namespace dock {
|
||||||
|
typedef ::DBusDockEntry Entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,13 +1,5 @@
|
|||||||
<interface name="dde.dock.Entry">
|
<interface name="dde.dock.Entry">
|
||||||
<method name="Activate">
|
<method name="Activate">
|
||||||
<arg type="i" direction="in"></arg>
|
|
||||||
<arg type="i" direction="in"></arg>
|
|
||||||
<arg type="u" direction="in"></arg>
|
|
||||||
<arg type="b" direction="out"></arg>
|
|
||||||
</method>
|
|
||||||
<method name="ContextMenu">
|
|
||||||
<arg type="i" direction="in"></arg>
|
|
||||||
<arg type="i" direction="in"></arg>
|
|
||||||
</method>
|
</method>
|
||||||
<signal name="DataChanged">
|
<signal name="DataChanged">
|
||||||
<arg type="s"></arg>
|
<arg type="s"></arg>
|
||||||
@ -15,5 +7,7 @@
|
|||||||
</signal>
|
</signal>
|
||||||
<property name="Id" type="s" access="read"></property>
|
<property name="Id" type="s" access="read"></property>
|
||||||
<property name="Type" type="s" access="read"></property>
|
<property name="Type" type="s" access="read"></property>
|
||||||
<property name="Data" type="a{ss}" access="read"></property>
|
<property name="Data" type="a{ss}" access="read">
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName" value="Dict"/>
|
||||||
|
</property>
|
||||||
</interface>
|
</interface>
|
||||||
|
@ -12,7 +12,8 @@ SOURCES += main.cpp \
|
|||||||
xcb/xcb_misc.cpp \
|
xcb/xcb_misc.cpp \
|
||||||
item/dockitem.cpp \
|
item/dockitem.cpp \
|
||||||
panel/mainpanel.cpp \
|
panel/mainpanel.cpp \
|
||||||
controller/dockitemcontroller.cpp
|
controller/dockitemcontroller.cpp \
|
||||||
|
dbus/dbusdockentry.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
window/mainwindow.h \
|
window/mainwindow.h \
|
||||||
@ -20,4 +21,5 @@ HEADERS += \
|
|||||||
xcb/xcb_misc.h \
|
xcb/xcb_misc.h \
|
||||||
item/dockitem.h \
|
item/dockitem.h \
|
||||||
panel/mainpanel.h \
|
panel/mainpanel.h \
|
||||||
controller/dockitemcontroller.h
|
controller/dockitemcontroller.h \
|
||||||
|
dbus/dbusdockentry.h
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
m_mainPanel(new MainPanel(this))
|
m_mainPanel(new MainPanel(this)),
|
||||||
|
m_itemController(DockItemController::instance(this))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "xcb/xcb_misc.h"
|
#include "xcb/xcb_misc.h"
|
||||||
#include "panel/mainpanel.h"
|
#include "panel/mainpanel.h"
|
||||||
|
#include "controller/dockitemcontroller.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ private:
|
|||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
MainPanel *m_mainPanel;
|
MainPanel *m_mainPanel;
|
||||||
|
DockItemController *m_itemController;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user