100 lines
2.9 KiB
C++
100 lines
2.9 KiB
C++
//SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
|
//
|
|
//SPDX-License-Identifier: GPL-3.0-or-later
|
|
/*
|
|
* This file was generated by qdbusxml2cpp-fix version 0.8
|
|
* Command line was: qdbusxml2cpp-fix -c Launcher -p generated/org_deepin_dde_launcher1 ../xml/org.deepin.dde.Launcher1.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 "dbuslauncherfront.h"
|
|
|
|
/*
|
|
* Implementation of interface class __Launcher
|
|
*/
|
|
|
|
class __LauncherPrivate
|
|
{
|
|
public:
|
|
__LauncherPrivate() = default;
|
|
|
|
// begin member variables
|
|
bool Visible;
|
|
|
|
public:
|
|
QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
|
|
QMap<QString, QList<QVariant>> m_waittingCalls;
|
|
};
|
|
|
|
LauncherFront::LauncherFront(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
|
|
: DBusExtendedAbstractInterface(service, path, staticInterfaceName(), connection, parent)
|
|
, d_ptr(new __LauncherPrivate)
|
|
{
|
|
connect(this, &LauncherFront::propertyChanged, this, &LauncherFront::onPropertyChanged);
|
|
|
|
}
|
|
|
|
LauncherFront::~LauncherFront()
|
|
{
|
|
qDeleteAll(d_ptr->m_processingCalls.values());
|
|
delete d_ptr;
|
|
}
|
|
|
|
void LauncherFront::onPropertyChanged(const QString &propName, const QVariant &value)
|
|
{
|
|
if (propName == QStringLiteral("Visible"))
|
|
{
|
|
const bool &Visible = qvariant_cast<bool>(value);
|
|
if (d_ptr->Visible != Visible)
|
|
{
|
|
d_ptr->Visible = Visible;
|
|
Q_EMIT VisibleChanged(d_ptr->Visible);
|
|
}
|
|
return;
|
|
}
|
|
|
|
qWarning() << "property not handle: " << propName;
|
|
return;
|
|
}
|
|
|
|
bool LauncherFront::visible()
|
|
{
|
|
return qvariant_cast<bool>(internalPropGet("Visible", &d_ptr->Visible));
|
|
}
|
|
|
|
void LauncherFront::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, &LauncherFront::onPendingCallFinished);
|
|
d_ptr->m_processingCalls.insert(callName, watcher);
|
|
}
|
|
}
|
|
|
|
void LauncherFront::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);
|
|
}
|