/*
 * This file was generated by qdbusxml2cpp-fix version 0.8
 * Command line was: qdbusxml2cpp-fix -m -p inputdevice1keyboardinterface /build/deepin-tray-loader/src/dde-tray-loader/plugins/dde-dock/dbus/xml/org.deepin.dde.InputDevice1.Keyboard.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 "inputdevice1keyboardinterface.h"

DCORE_USE_NAMESPACE
/*
 * Implementation of interface class __OrgDeepinDdeInputDevice1KeyboardInterface
 */

class __OrgDeepinDdeInputDevice1KeyboardInterfacePrivate
{
public:
   __OrgDeepinDdeInputDevice1KeyboardInterfacePrivate() = default;

    // begin member variables
    bool CapslockToggle;
    QString CurrentLayout;
    int CursorBlink;
    int LayoutScope;
    uint RepeatDelay;
    bool RepeatEnabled;
    uint RepeatInterval;
    QStringList UserLayoutList;
    QStringList UserOptionList;

public:
    QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
    QMap<QString, QList<QVariant>> m_waittingCalls;
};

__OrgDeepinDdeInputDevice1KeyboardInterface::__OrgDeepinDdeInputDevice1KeyboardInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
    : DDBusExtendedAbstractInterface(service, path, staticInterfaceName(), connection, parent)
    , d_ptr(new __OrgDeepinDdeInputDevice1KeyboardInterfacePrivate)
{
    connect(this, &__OrgDeepinDdeInputDevice1KeyboardInterface::propertyChanged, this, &__OrgDeepinDdeInputDevice1KeyboardInterface::onPropertyChanged);

    if (QMetaType::fromName("KeyboardLayoutList").id() == QMetaType::UnknownType)
        registerKeyboardLayoutListMetaType();
}

__OrgDeepinDdeInputDevice1KeyboardInterface::~__OrgDeepinDdeInputDevice1KeyboardInterface()
{
    qDeleteAll(d_ptr->m_processingCalls.values());
    delete d_ptr;
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::onPropertyChanged(const QString &propName, const QVariant &value)
{
    if (propName == QStringLiteral("CapslockToggle"))
    {
        const bool &CapslockToggle = qvariant_cast<bool>(value);
        if (d_ptr->CapslockToggle != CapslockToggle)
        {
            d_ptr->CapslockToggle = CapslockToggle;
            Q_EMIT CapslockToggleChanged(d_ptr->CapslockToggle);
        }
        return;
    }

    if (propName == QStringLiteral("CurrentLayout"))
    {
        const QString &CurrentLayout = qvariant_cast<QString>(value);
        if (d_ptr->CurrentLayout != CurrentLayout)
        {
            d_ptr->CurrentLayout = CurrentLayout;
            Q_EMIT CurrentLayoutChanged(d_ptr->CurrentLayout);
        }
        return;
    }

    if (propName == QStringLiteral("CursorBlink"))
    {
        const int &CursorBlink = qvariant_cast<int>(value);
        if (d_ptr->CursorBlink != CursorBlink)
        {
            d_ptr->CursorBlink = CursorBlink;
            Q_EMIT CursorBlinkChanged(d_ptr->CursorBlink);
        }
        return;
    }

    if (propName == QStringLiteral("LayoutScope"))
    {
        const int &LayoutScope = qvariant_cast<int>(value);
        if (d_ptr->LayoutScope != LayoutScope)
        {
            d_ptr->LayoutScope = LayoutScope;
            Q_EMIT LayoutScopeChanged(d_ptr->LayoutScope);
        }
        return;
    }

    if (propName == QStringLiteral("RepeatDelay"))
    {
        const uint &RepeatDelay = qvariant_cast<uint>(value);
        if (d_ptr->RepeatDelay != RepeatDelay)
        {
            d_ptr->RepeatDelay = RepeatDelay;
            Q_EMIT RepeatDelayChanged(d_ptr->RepeatDelay);
        }
        return;
    }

    if (propName == QStringLiteral("RepeatEnabled"))
    {
        const bool &RepeatEnabled = qvariant_cast<bool>(value);
        if (d_ptr->RepeatEnabled != RepeatEnabled)
        {
            d_ptr->RepeatEnabled = RepeatEnabled;
            Q_EMIT RepeatEnabledChanged(d_ptr->RepeatEnabled);
        }
        return;
    }

    if (propName == QStringLiteral("RepeatInterval"))
    {
        const uint &RepeatInterval = qvariant_cast<uint>(value);
        if (d_ptr->RepeatInterval != RepeatInterval)
        {
            d_ptr->RepeatInterval = RepeatInterval;
            Q_EMIT RepeatIntervalChanged(d_ptr->RepeatInterval);
        }
        return;
    }

    if (propName == QStringLiteral("UserLayoutList"))
    {
        const QStringList &UserLayoutList = qvariant_cast<QStringList>(value);
        if (d_ptr->UserLayoutList != UserLayoutList)
        {
            d_ptr->UserLayoutList = UserLayoutList;
            Q_EMIT UserLayoutListChanged(d_ptr->UserLayoutList);
        }
        return;
    }

    if (propName == QStringLiteral("UserOptionList"))
    {
        const QStringList &UserOptionList = qvariant_cast<QStringList>(value);
        if (d_ptr->UserOptionList != UserOptionList)
        {
            d_ptr->UserOptionList = UserOptionList;
            Q_EMIT UserOptionListChanged(d_ptr->UserOptionList);
        }
        return;
    }

    qWarning() << "property not handle: " << propName;
    return;
}

bool __OrgDeepinDdeInputDevice1KeyboardInterface::capslockToggle()
{
    return qvariant_cast<bool>(internalPropGet("CapslockToggle", &d_ptr->CapslockToggle));
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::setCapslockToggle(bool value)
{

   internalPropSet("CapslockToggle", QVariant::fromValue(value), &d_ptr->CapslockToggle);
}

QString __OrgDeepinDdeInputDevice1KeyboardInterface::currentLayout()
{
    return qvariant_cast<QString>(internalPropGet("CurrentLayout", &d_ptr->CurrentLayout));
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::setCurrentLayout(const QString &value)
{

   internalPropSet("CurrentLayout", QVariant::fromValue(value), &d_ptr->CurrentLayout);
}

int __OrgDeepinDdeInputDevice1KeyboardInterface::cursorBlink()
{
    return qvariant_cast<int>(internalPropGet("CursorBlink", &d_ptr->CursorBlink));
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::setCursorBlink(int value)
{

   internalPropSet("CursorBlink", QVariant::fromValue(value), &d_ptr->CursorBlink);
}

int __OrgDeepinDdeInputDevice1KeyboardInterface::layoutScope()
{
    return qvariant_cast<int>(internalPropGet("LayoutScope", &d_ptr->LayoutScope));
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::setLayoutScope(int value)
{

   internalPropSet("LayoutScope", QVariant::fromValue(value), &d_ptr->LayoutScope);
}

uint __OrgDeepinDdeInputDevice1KeyboardInterface::repeatDelay()
{
    return qvariant_cast<uint>(internalPropGet("RepeatDelay", &d_ptr->RepeatDelay));
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::setRepeatDelay(uint value)
{

   internalPropSet("RepeatDelay", QVariant::fromValue(value), &d_ptr->RepeatDelay);
}

bool __OrgDeepinDdeInputDevice1KeyboardInterface::repeatEnabled()
{
    return qvariant_cast<bool>(internalPropGet("RepeatEnabled", &d_ptr->RepeatEnabled));
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::setRepeatEnabled(bool value)
{

   internalPropSet("RepeatEnabled", QVariant::fromValue(value), &d_ptr->RepeatEnabled);
}

uint __OrgDeepinDdeInputDevice1KeyboardInterface::repeatInterval()
{
    return qvariant_cast<uint>(internalPropGet("RepeatInterval", &d_ptr->RepeatInterval));
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::setRepeatInterval(uint value)
{

   internalPropSet("RepeatInterval", QVariant::fromValue(value), &d_ptr->RepeatInterval);
}

QStringList __OrgDeepinDdeInputDevice1KeyboardInterface::userLayoutList()
{
    return qvariant_cast<QStringList>(internalPropGet("UserLayoutList", &d_ptr->UserLayoutList));
}

QStringList __OrgDeepinDdeInputDevice1KeyboardInterface::userOptionList()
{
    return qvariant_cast<QStringList>(internalPropGet("UserOptionList", &d_ptr->UserOptionList));
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::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, &__OrgDeepinDdeInputDevice1KeyboardInterface::onPendingCallFinished);
        d_ptr->m_processingCalls.insert(callName, watcher);
    }
}

void __OrgDeepinDdeInputDevice1KeyboardInterface::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);
}

#include "moc_inputdevice1keyboardinterface.cpp"
