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

DCORE_USE_NAMESPACE
/*
 * Implementation of interface class __OrgDeepinDdeTimedate1Interface
 */

class __OrgDeepinDdeTimedate1InterfacePrivate
{
public:
   __OrgDeepinDdeTimedate1InterfacePrivate() = default;

    // begin member variables
    bool CanNTP;
    int DSTOffset;
    bool LocalRTC;
    int LongDateFormat;
    int LongTimeFormat;
    bool NTP;
    QString NTPServer;
    int ShortDateFormat;
    int ShortTimeFormat;
    QString Timezone;
    bool Use24HourFormat;
    QStringList UserTimezones;
    int WeekBegins;
    int WeekdayFormat;

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

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

    if (QMetaType::fromName("ZoneInfo").id() == QMetaType::UnknownType)
        registerZoneInfoMetaType();
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

bool __OrgDeepinDdeTimedate1Interface::canNTP()
{
    return qvariant_cast<bool>(internalPropGet("CanNTP", &d_ptr->CanNTP));
}

int __OrgDeepinDdeTimedate1Interface::dSTOffset()
{
    return qvariant_cast<int>(internalPropGet("DSTOffset", &d_ptr->DSTOffset));
}

void __OrgDeepinDdeTimedate1Interface::setDSTOffset(int value)
{

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

bool __OrgDeepinDdeTimedate1Interface::localRTC()
{
    return qvariant_cast<bool>(internalPropGet("LocalRTC", &d_ptr->LocalRTC));
}

int __OrgDeepinDdeTimedate1Interface::longDateFormat()
{
    return qvariant_cast<int>(internalPropGet("LongDateFormat", &d_ptr->LongDateFormat));
}

void __OrgDeepinDdeTimedate1Interface::setLongDateFormat(int value)
{

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

int __OrgDeepinDdeTimedate1Interface::longTimeFormat()
{
    return qvariant_cast<int>(internalPropGet("LongTimeFormat", &d_ptr->LongTimeFormat));
}

void __OrgDeepinDdeTimedate1Interface::setLongTimeFormat(int value)
{

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

bool __OrgDeepinDdeTimedate1Interface::nTP()
{
    return qvariant_cast<bool>(internalPropGet("NTP", &d_ptr->NTP));
}

QString __OrgDeepinDdeTimedate1Interface::nTPServer()
{
    return qvariant_cast<QString>(internalPropGet("NTPServer", &d_ptr->NTPServer));
}

int __OrgDeepinDdeTimedate1Interface::shortDateFormat()
{
    return qvariant_cast<int>(internalPropGet("ShortDateFormat", &d_ptr->ShortDateFormat));
}

void __OrgDeepinDdeTimedate1Interface::setShortDateFormat(int value)
{

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

int __OrgDeepinDdeTimedate1Interface::shortTimeFormat()
{
    return qvariant_cast<int>(internalPropGet("ShortTimeFormat", &d_ptr->ShortTimeFormat));
}

void __OrgDeepinDdeTimedate1Interface::setShortTimeFormat(int value)
{

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

QString __OrgDeepinDdeTimedate1Interface::timezone()
{
    return qvariant_cast<QString>(internalPropGet("Timezone", &d_ptr->Timezone));
}

bool __OrgDeepinDdeTimedate1Interface::use24HourFormat()
{
    return qvariant_cast<bool>(internalPropGet("Use24HourFormat", &d_ptr->Use24HourFormat));
}

void __OrgDeepinDdeTimedate1Interface::setUse24HourFormat(bool value)
{

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

QStringList __OrgDeepinDdeTimedate1Interface::userTimezones()
{
    return qvariant_cast<QStringList>(internalPropGet("UserTimezones", &d_ptr->UserTimezones));
}

int __OrgDeepinDdeTimedate1Interface::weekBegins()
{
    return qvariant_cast<int>(internalPropGet("WeekBegins", &d_ptr->WeekBegins));
}

void __OrgDeepinDdeTimedate1Interface::setWeekBegins(int value)
{

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

int __OrgDeepinDdeTimedate1Interface::weekdayFormat()
{
    return qvariant_cast<int>(internalPropGet("WeekdayFormat", &d_ptr->WeekdayFormat));
}

void __OrgDeepinDdeTimedate1Interface::setWeekdayFormat(int value)
{

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

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

void __OrgDeepinDdeTimedate1Interface::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_timedate1interface.cpp"
