/*
 * This file was generated by qdbusxml2cpp-fix version 0.8
 * Command line was: qdbusxml2cpp-fix -c TouchPad -p generated/com_deepin_daemon_inputdevice_touchpad ../xml/com.deepin.daemon.InputDevice.TouchPad.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 "generated/com_deepin_daemon_inputdevice_touchpad.h"

/*
 * Implementation of interface class __TouchPad
 */

class __TouchPadPrivate
{
public:
   __TouchPadPrivate() = default;

    // begin member variables
    int DeltaScroll;
    QString DeviceList;
    bool DisableIfTyping;
    int DoubleClick;
    int DragThreshold;
    bool EdgeScroll;
    bool Exist;
    bool HorizScroll;
    bool LeftHanded;
    double MotionAcceleration;
    double MotionScaling;
    double MotionThreshold;
    bool NaturalScroll;
    bool PalmDetect;
    int PalmMinWidth;
    int PalmMinZ;
    bool TPadEnable;
    bool TapClick;
    bool VertScroll;

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

__TouchPad::__TouchPad(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
    : DBusExtendedAbstractInterface(service, path, staticInterfaceName(), connection, parent)
    , d_ptr(new __TouchPadPrivate)
{
    connect(this, &__TouchPad::propertyChanged, this, &__TouchPad::onPropertyChanged);

}

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

void __TouchPad::onPropertyChanged(const QString &propName, const QVariant &value)
{
    if (propName == QStringLiteral("DeltaScroll"))
    {
        const int &DeltaScroll = qvariant_cast<int>(value);
        if (d_ptr->DeltaScroll != DeltaScroll)
        {
            d_ptr->DeltaScroll = DeltaScroll;
            Q_EMIT DeltaScrollChanged(d_ptr->DeltaScroll);
        }
        return;
    }

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

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

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

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

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

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

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

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

    if (propName == QStringLiteral("MotionAcceleration"))
    {
        const double &MotionAcceleration = qvariant_cast<double>(value);
        if (d_ptr->MotionAcceleration != MotionAcceleration)
        {
            d_ptr->MotionAcceleration = MotionAcceleration;
            Q_EMIT MotionAccelerationChanged(d_ptr->MotionAcceleration);
        }
        return;
    }

    if (propName == QStringLiteral("MotionScaling"))
    {
        const double &MotionScaling = qvariant_cast<double>(value);
        if (d_ptr->MotionScaling != MotionScaling)
        {
            d_ptr->MotionScaling = MotionScaling;
            Q_EMIT MotionScalingChanged(d_ptr->MotionScaling);
        }
        return;
    }

    if (propName == QStringLiteral("MotionThreshold"))
    {
        const double &MotionThreshold = qvariant_cast<double>(value);
        if (d_ptr->MotionThreshold != MotionThreshold)
        {
            d_ptr->MotionThreshold = MotionThreshold;
            Q_EMIT MotionThresholdChanged(d_ptr->MotionThreshold);
        }
        return;
    }

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

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

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

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

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

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

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

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

int __TouchPad::deltaScroll()
{
    return qvariant_cast<int>(internalPropGet("DeltaScroll", &d_ptr->DeltaScroll));
}

void __TouchPad::setDeltaScroll(int value)
{

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

QString __TouchPad::deviceList()
{
    return qvariant_cast<QString>(internalPropGet("DeviceList", &d_ptr->DeviceList));
}

bool __TouchPad::disableIfTyping()
{
    return qvariant_cast<bool>(internalPropGet("DisableIfTyping", &d_ptr->DisableIfTyping));
}

void __TouchPad::setDisableIfTyping(bool value)
{

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

int __TouchPad::doubleClick()
{
    return qvariant_cast<int>(internalPropGet("DoubleClick", &d_ptr->DoubleClick));
}

void __TouchPad::setDoubleClick(int value)
{

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

int __TouchPad::dragThreshold()
{
    return qvariant_cast<int>(internalPropGet("DragThreshold", &d_ptr->DragThreshold));
}

void __TouchPad::setDragThreshold(int value)
{

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

bool __TouchPad::edgeScroll()
{
    return qvariant_cast<bool>(internalPropGet("EdgeScroll", &d_ptr->EdgeScroll));
}

void __TouchPad::setEdgeScroll(bool value)
{

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

bool __TouchPad::exist()
{
    return qvariant_cast<bool>(internalPropGet("Exist", &d_ptr->Exist));
}

bool __TouchPad::horizScroll()
{
    return qvariant_cast<bool>(internalPropGet("HorizScroll", &d_ptr->HorizScroll));
}

void __TouchPad::setHorizScroll(bool value)
{

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

bool __TouchPad::leftHanded()
{
    return qvariant_cast<bool>(internalPropGet("LeftHanded", &d_ptr->LeftHanded));
}

void __TouchPad::setLeftHanded(bool value)
{

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

double __TouchPad::motionAcceleration()
{
    return qvariant_cast<double>(internalPropGet("MotionAcceleration", &d_ptr->MotionAcceleration));
}

void __TouchPad::setMotionAcceleration(double value)
{

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

double __TouchPad::motionScaling()
{
    return qvariant_cast<double>(internalPropGet("MotionScaling", &d_ptr->MotionScaling));
}

void __TouchPad::setMotionScaling(double value)
{

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

double __TouchPad::motionThreshold()
{
    return qvariant_cast<double>(internalPropGet("MotionThreshold", &d_ptr->MotionThreshold));
}

void __TouchPad::setMotionThreshold(double value)
{

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

bool __TouchPad::naturalScroll()
{
    return qvariant_cast<bool>(internalPropGet("NaturalScroll", &d_ptr->NaturalScroll));
}

void __TouchPad::setNaturalScroll(bool value)
{

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

bool __TouchPad::palmDetect()
{
    return qvariant_cast<bool>(internalPropGet("PalmDetect", &d_ptr->PalmDetect));
}

void __TouchPad::setPalmDetect(bool value)
{

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

int __TouchPad::palmMinWidth()
{
    return qvariant_cast<int>(internalPropGet("PalmMinWidth", &d_ptr->PalmMinWidth));
}

void __TouchPad::setPalmMinWidth(int value)
{

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

int __TouchPad::palmMinZ()
{
    return qvariant_cast<int>(internalPropGet("PalmMinZ", &d_ptr->PalmMinZ));
}

void __TouchPad::setPalmMinZ(int value)
{

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

bool __TouchPad::tPadEnable()
{
    return qvariant_cast<bool>(internalPropGet("TPadEnable", &d_ptr->TPadEnable));
}

void __TouchPad::setTPadEnable(bool value)
{

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

bool __TouchPad::tapClick()
{
    return qvariant_cast<bool>(internalPropGet("TapClick", &d_ptr->TapClick));
}

void __TouchPad::setTapClick(bool value)
{

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

bool __TouchPad::vertScroll()
{
    return qvariant_cast<bool>(internalPropGet("VertScroll", &d_ptr->VertScroll));
}

void __TouchPad::setVertScroll(bool value)
{

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

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

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