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

DCORE_USE_NAMESPACE
/*
 * Implementation of interface class __OrgDeepinDdeDisplay1MonitorInterface
 */

class __OrgDeepinDdeDisplay1MonitorInterfacePrivate
{
public:
   __OrgDeepinDdeDisplay1MonitorInterfacePrivate() = default;

    // begin member variables
    QStringList AvailableFillModes;
    Resolution BestMode;
    bool Connected;
    QString CurrentFillMode;
    Resolution CurrentMode;
    uchar CurrentRotateMode;
    bool Enabled;
    ushort Height;
    QString Manufacturer;
    uint MmHeight;
    uint MmWidth;
    QString Model;
    ResolutionList Modes;
    QString Name;
    ushort Reflect;
    ReflectList Reflects;
    double RefreshRate;
    ushort Rotation;
    RotationList Rotations;
    ushort Width;
    short X;
    short Y;

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

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

    if (QMetaType::fromName("Resolution").id() == QMetaType::UnknownType)
        registerResolutionMetaType();
    if (QMetaType::fromName("ResolutionList").id() == QMetaType::UnknownType)
        registerResolutionListMetaType();
    if (QMetaType::fromName("ReflectList").id() == QMetaType::UnknownType)
        registerReflectListMetaType();
    if (QMetaType::fromName("RotationList").id() == QMetaType::UnknownType)
        registerRotationListMetaType();
}

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

void __OrgDeepinDdeDisplay1MonitorInterface::onPropertyChanged(const QString &propName, const QVariant &value)
{
    if (propName == QStringLiteral("AvailableFillModes"))
    {
        const QStringList &AvailableFillModes = qvariant_cast<QStringList>(value);
        if (d_ptr->AvailableFillModes != AvailableFillModes)
        {
            d_ptr->AvailableFillModes = AvailableFillModes;
            Q_EMIT AvailableFillModesChanged(d_ptr->AvailableFillModes);
        }
        return;
    }

    if (propName == QStringLiteral("BestMode"))
    {
        const Resolution &BestMode = qvariant_cast<Resolution>(value);
        if (d_ptr->BestMode != BestMode)
        {
            d_ptr->BestMode = BestMode;
            Q_EMIT BestModeChanged(d_ptr->BestMode);
        }
        return;
    }

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

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

    if (propName == QStringLiteral("CurrentMode"))
    {
        const Resolution &CurrentMode = qvariant_cast<Resolution>(value);
        if (d_ptr->CurrentMode != CurrentMode)
        {
            d_ptr->CurrentMode = CurrentMode;
            Q_EMIT CurrentModeChanged(d_ptr->CurrentMode);
        }
        return;
    }

    if (propName == QStringLiteral("CurrentRotateMode"))
    {
        const uchar &CurrentRotateMode = qvariant_cast<uchar>(value);
        if (d_ptr->CurrentRotateMode != CurrentRotateMode)
        {
            d_ptr->CurrentRotateMode = CurrentRotateMode;
            Q_EMIT CurrentRotateModeChanged(d_ptr->CurrentRotateMode);
        }
        return;
    }

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

    if (propName == QStringLiteral("Height"))
    {
        const ushort &Height = qvariant_cast<ushort>(value);
        if (d_ptr->Height != Height)
        {
            d_ptr->Height = Height;
            Q_EMIT HeightChanged(d_ptr->Height);
        }
        return;
    }

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

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

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

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

    if (propName == QStringLiteral("Modes"))
    {
        const ResolutionList &Modes = qvariant_cast<ResolutionList>(value);
        if (d_ptr->Modes != Modes)
        {
            d_ptr->Modes = Modes;
            Q_EMIT ModesChanged(d_ptr->Modes);
        }
        return;
    }

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

    if (propName == QStringLiteral("Reflect"))
    {
        const ushort &Reflect = qvariant_cast<ushort>(value);
        if (d_ptr->Reflect != Reflect)
        {
            d_ptr->Reflect = Reflect;
            Q_EMIT ReflectChanged(d_ptr->Reflect);
        }
        return;
    }

    if (propName == QStringLiteral("Reflects"))
    {
        const ReflectList &Reflects = qvariant_cast<ReflectList>(value);
        if (d_ptr->Reflects != Reflects)
        {
            d_ptr->Reflects = Reflects;
            Q_EMIT ReflectsChanged(d_ptr->Reflects);
        }
        return;
    }

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

    if (propName == QStringLiteral("Rotation"))
    {
        const ushort &Rotation = qvariant_cast<ushort>(value);
        if (d_ptr->Rotation != Rotation)
        {
            d_ptr->Rotation = Rotation;
            Q_EMIT RotationChanged(d_ptr->Rotation);
        }
        return;
    }

    if (propName == QStringLiteral("Rotations"))
    {
        const RotationList &Rotations = qvariant_cast<RotationList>(value);
        if (d_ptr->Rotations != Rotations)
        {
            d_ptr->Rotations = Rotations;
            Q_EMIT RotationsChanged(d_ptr->Rotations);
        }
        return;
    }

    if (propName == QStringLiteral("Width"))
    {
        const ushort &Width = qvariant_cast<ushort>(value);
        if (d_ptr->Width != Width)
        {
            d_ptr->Width = Width;
            Q_EMIT WidthChanged(d_ptr->Width);
        }
        return;
    }

    if (propName == QStringLiteral("X"))
    {
        const short &X = qvariant_cast<short>(value);
        if (d_ptr->X != X)
        {
            d_ptr->X = X;
            Q_EMIT XChanged(d_ptr->X);
        }
        return;
    }

    if (propName == QStringLiteral("Y"))
    {
        const short &Y = qvariant_cast<short>(value);
        if (d_ptr->Y != Y)
        {
            d_ptr->Y = Y;
            Q_EMIT YChanged(d_ptr->Y);
        }
        return;
    }

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

QStringList __OrgDeepinDdeDisplay1MonitorInterface::availableFillModes()
{
    return qvariant_cast<QStringList>(internalPropGet("AvailableFillModes", &d_ptr->AvailableFillModes));
}

Resolution __OrgDeepinDdeDisplay1MonitorInterface::bestMode()
{
    return qvariant_cast<Resolution>(internalPropGet("BestMode", &d_ptr->BestMode));
}

bool __OrgDeepinDdeDisplay1MonitorInterface::connected()
{
    return qvariant_cast<bool>(internalPropGet("Connected", &d_ptr->Connected));
}

QString __OrgDeepinDdeDisplay1MonitorInterface::currentFillMode()
{
    return qvariant_cast<QString>(internalPropGet("CurrentFillMode", &d_ptr->CurrentFillMode));
}

void __OrgDeepinDdeDisplay1MonitorInterface::setCurrentFillMode(const QString &value)
{

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

Resolution __OrgDeepinDdeDisplay1MonitorInterface::currentMode()
{
    return qvariant_cast<Resolution>(internalPropGet("CurrentMode", &d_ptr->CurrentMode));
}

uchar __OrgDeepinDdeDisplay1MonitorInterface::currentRotateMode()
{
    return qvariant_cast<uchar>(internalPropGet("CurrentRotateMode", &d_ptr->CurrentRotateMode));
}

bool __OrgDeepinDdeDisplay1MonitorInterface::enabled()
{
    return qvariant_cast<bool>(internalPropGet("Enabled", &d_ptr->Enabled));
}

ushort __OrgDeepinDdeDisplay1MonitorInterface::height()
{
    return qvariant_cast<ushort>(internalPropGet("Height", &d_ptr->Height));
}

QString __OrgDeepinDdeDisplay1MonitorInterface::manufacturer()
{
    return qvariant_cast<QString>(internalPropGet("Manufacturer", &d_ptr->Manufacturer));
}

uint __OrgDeepinDdeDisplay1MonitorInterface::mmHeight()
{
    return qvariant_cast<uint>(internalPropGet("MmHeight", &d_ptr->MmHeight));
}

uint __OrgDeepinDdeDisplay1MonitorInterface::mmWidth()
{
    return qvariant_cast<uint>(internalPropGet("MmWidth", &d_ptr->MmWidth));
}

QString __OrgDeepinDdeDisplay1MonitorInterface::model()
{
    return qvariant_cast<QString>(internalPropGet("Model", &d_ptr->Model));
}

ResolutionList __OrgDeepinDdeDisplay1MonitorInterface::modes()
{
    return qvariant_cast<ResolutionList>(internalPropGet("Modes", &d_ptr->Modes));
}

QString __OrgDeepinDdeDisplay1MonitorInterface::name()
{
    return qvariant_cast<QString>(internalPropGet("Name", &d_ptr->Name));
}

ushort __OrgDeepinDdeDisplay1MonitorInterface::reflect()
{
    return qvariant_cast<ushort>(internalPropGet("Reflect", &d_ptr->Reflect));
}

ReflectList __OrgDeepinDdeDisplay1MonitorInterface::reflects()
{
    return qvariant_cast<ReflectList>(internalPropGet("Reflects", &d_ptr->Reflects));
}

double __OrgDeepinDdeDisplay1MonitorInterface::refreshRate()
{
    return qvariant_cast<double>(internalPropGet("RefreshRate", &d_ptr->RefreshRate));
}

ushort __OrgDeepinDdeDisplay1MonitorInterface::rotation()
{
    return qvariant_cast<ushort>(internalPropGet("Rotation", &d_ptr->Rotation));
}

RotationList __OrgDeepinDdeDisplay1MonitorInterface::rotations()
{
    return qvariant_cast<RotationList>(internalPropGet("Rotations", &d_ptr->Rotations));
}

ushort __OrgDeepinDdeDisplay1MonitorInterface::width()
{
    return qvariant_cast<ushort>(internalPropGet("Width", &d_ptr->Width));
}

short __OrgDeepinDdeDisplay1MonitorInterface::x()
{
    return qvariant_cast<short>(internalPropGet("X", &d_ptr->X));
}

short __OrgDeepinDdeDisplay1MonitorInterface::y()
{
    return qvariant_cast<short>(internalPropGet("Y", &d_ptr->Y));
}

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

void __OrgDeepinDdeDisplay1MonitorInterface::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_display1monitorinterface.cpp"
