mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00

新增任务栏配置的控制中心插件 Log: 支持在控制中心中对任务栏的配置进行修改 Task: https://pms.uniontech.com/zentao/task-view-86359.html Change-Id: Ic55390c9ad98ec9513cb8f3f59d910d54c946008
124 lines
3.4 KiB
C++
124 lines
3.4 KiB
C++
/*
|
|
* This file was generated by qdbusxml2cpp-fix version 0.8
|
|
* Command line was: qdbusxml2cpp-fix -c Dock -p generated/com_deepin_dde_dock ../xml/com.deepin.dde.Dock.xml
|
|
*
|
|
* qdbusxml2cpp-fix is Copyright (C) 2016 Deepin Technology Co., Ltd.
|
|
*
|
|
* This is an auto-generated file.
|
|
* This file may have been hand-edited. Look for HAND-EDIT comments
|
|
* before re-generating it.
|
|
*/
|
|
|
|
#include "com_deepin_dde_dock.h"
|
|
|
|
/*
|
|
* Implementation of interface class _Dock
|
|
*/
|
|
|
|
class _DockPrivate
|
|
{
|
|
public:
|
|
_DockPrivate() = default;
|
|
|
|
// begin member variables
|
|
QRect geometry;
|
|
int showInPrimary;
|
|
|
|
public:
|
|
QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
|
|
QMap<QString, QList<QVariant>> m_waittingCalls;
|
|
};
|
|
|
|
_Dock::_Dock(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
|
|
: DBusExtendedAbstractInterface(service, path, staticInterfaceName(), connection, parent)
|
|
, d_ptr(new _DockPrivate)
|
|
{
|
|
connect(this, &_Dock::propertyChanged, this, &_Dock::onPropertyChanged);
|
|
|
|
if (QMetaType::type("QRect") == QMetaType::UnknownType) {
|
|
qRegisterMetaType<QRect>("QRect");
|
|
qDBusRegisterMetaType<QRect>();
|
|
}
|
|
}
|
|
|
|
_Dock::~_Dock()
|
|
{
|
|
qDeleteAll(d_ptr->m_processingCalls.values());
|
|
delete d_ptr;
|
|
}
|
|
|
|
void _Dock::onPropertyChanged(const QString &propName, const QVariant &value)
|
|
{
|
|
if (propName == QStringLiteral("geometry"))
|
|
{
|
|
const QRect &geometry = qvariant_cast<QRect>(value);
|
|
if (d_ptr->geometry != geometry)
|
|
{
|
|
d_ptr->geometry = geometry;
|
|
Q_EMIT GeometryChanged(d_ptr->geometry);
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (propName == QStringLiteral("showInPrimary"))
|
|
{
|
|
const int &showInPrimary = qvariant_cast<int>(value);
|
|
if (d_ptr->showInPrimary != showInPrimary)
|
|
{
|
|
d_ptr->showInPrimary = showInPrimary;
|
|
Q_EMIT ShowInPrimaryChanged(d_ptr->showInPrimary);
|
|
}
|
|
return;
|
|
}
|
|
|
|
qWarning() << "property not handle: " << propName;
|
|
return;
|
|
}
|
|
|
|
QRect _Dock::geometry()
|
|
{
|
|
return qvariant_cast<QRect>(internalPropGet("geometry", &d_ptr->geometry));
|
|
}
|
|
|
|
bool _Dock::showInPrimary()
|
|
{
|
|
return qvariant_cast<bool>(internalPropGet("showInPrimary", &d_ptr->showInPrimary));
|
|
}
|
|
|
|
void _Dock::setShowInPrimary(bool value)
|
|
{
|
|
|
|
internalPropSet("showInPrimary", QVariant::fromValue(value), &d_ptr->showInPrimary);
|
|
}
|
|
|
|
void _Dock::CallQueued(const QString &callName, const QList<QVariant> &args)
|
|
{
|
|
if (d_ptr->m_waittingCalls.contains(callName))
|
|
{
|
|
d_ptr->m_waittingCalls[callName] = args;
|
|
return;
|
|
}
|
|
if (d_ptr->m_processingCalls.contains(callName))
|
|
{
|
|
d_ptr->m_waittingCalls.insert(callName, args);
|
|
} else {
|
|
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
|
|
connect(watcher, &QDBusPendingCallWatcher::finished, this, &_Dock::onPendingCallFinished);
|
|
d_ptr->m_processingCalls.insert(callName, watcher);
|
|
}
|
|
}
|
|
|
|
void _Dock::onPendingCallFinished(QDBusPendingCallWatcher *w)
|
|
{
|
|
w->deleteLater();
|
|
const auto callName = d_ptr->m_processingCalls.key(w);
|
|
Q_ASSERT(!callName.isEmpty());
|
|
if (callName.isEmpty())
|
|
return;
|
|
d_ptr->m_processingCalls.remove(callName);
|
|
if (!d_ptr->m_waittingCalls.contains(callName))
|
|
return;
|
|
const auto args = d_ptr->m_waittingCalls.take(callName);
|
|
CallQueued(callName, args);
|
|
}
|