/****************************************************************************
** Generated from 'Example.IVI.Remote.qface'
**
** Created by: The QFace generator (QtAS 5.12.8)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "processingservice.h"#include "processingservice_p.h"#include "processingservicebackendinterface.h"#include <QQmlEngine>#include <QIviServiceObject>#include <QIviProxyServiceObject>/*!
\class ProcessingService
\inmodule Example.IVI.Remote
The ProcessingService provides a QML interface to a service doing all sorts of heavy processing
*//*!
\qmltype UiProcessingService
\instantiates ProcessingService
\inherits AbstractFeature
The ProcessingService provides a QML interface to a service doing all sorts of heavy processing
*//*! \internal */
ProcessingServicePrivate::ProcessingServicePrivate(constQString&interface, ProcessingService *parent)
: QIviAbstractFeaturePrivate(interface, parent)
, q_ptr(parent)
, m_lastMessage(QString())
{
m_supportsPropertyOverriding =true;
}
/*! \internal */
ProcessingServicePrivate *ProcessingServicePrivate::get(ProcessingService *v)
{
returnreinterpret_cast<ProcessingServicePrivate *>(v->d_ptr.data());
}
/*! \internal */const ProcessingServicePrivate *ProcessingServicePrivate::get(const ProcessingService *v)
{
returnreinterpret_cast<const ProcessingServicePrivate *>(v->d_ptr.data());
}
/*! \internal */
ProcessingService *ProcessingServicePrivate::getParent()
{
return q_ptr;
}
/*! \internal */void ProcessingServicePrivate::clearToDefaults()
{
m_lastMessage =QString();
}
/*! \internal */void ProcessingServicePrivate::onLastMessageChanged(constQString&lastMessage)
{
if (m_lastMessage != lastMessage) {
auto q = getParent();
m_lastMessage = lastMessage;
emit q->lastMessageChanged(lastMessage);
}
}
bool ProcessingServicePrivate::notify(constQByteArray&propertyName,constQVariant&value)
{
auto q = getParent();
if (propertyName ==QByteArray("lastMessage")) {
emit q->lastMessageChanged(value.value<QString>());
returntrue;
}
returnQIviAbstractFeaturePrivate::notify(propertyName, value);
}
/*!
Default constructs an instance of ProcessingService.
*/
ProcessingService::ProcessingService(QObject*parent)
: QIviAbstractFeature(*new ProcessingServicePrivate(QLatin1String(Remote_ProcessingService_iid),this), parent)
{
}
/*! \internal */
ProcessingService::~ProcessingService()
{
}
/*! \internal */void ProcessingService::registerQmlTypes(constQString& uri,int majorVersion,int minorVersion)
{
qmlRegisterType<ProcessingService>(uri.toLatin1(), majorVersion, minorVersion,"UiProcessingService");
}
/*!
\property ProcessingService::lastMessage
*//*!
\qmlproperty QString UiProcessingService::lastMessage
*/QString ProcessingService::lastMessage() const
{
constauto d = ProcessingServicePrivate::get(this);
if (Q_UNLIKELY(d->m_propertyOverride))
return d->m_propertyOverride->property(metaObject()->indexOfProperty("lastMessage")).value<QString>();
return d->m_lastMessage;
}
void ProcessingService::setLastMessage(constQString&lastMessage)
{
auto d = ProcessingServicePrivate::get(this);
bool forceUpdate =false;
if (Q_UNLIKELY(d->m_propertyOverride)) {
constint pi = metaObject()->indexOfProperty("lastMessage");
if (d->m_propertyOverride->isOverridden(pi)) {
emit lastMessageChanged(d->m_propertyOverride->property(pi).value<QString>());
return;
}
forceUpdate = property("lastMessageDirtyOverride").isValid();
if (forceUpdate)
setProperty("lastMessageDirtyOverride", {});
QVariant v =qVariantFromValue<QString>(lastMessage);
d->m_propertyOverride->setProperty(pi, v);
}
if (!forceUpdate && d->m_lastMessage == lastMessage)
return;
if (ProcessingServiceBackendInterface *backend = processingserviceBackend())
backend->setLastMessage(lastMessage);
elseemit lastMessageChanged(d->m_lastMessage);
}
/*!
\qmlmethod UiProcessingService::process(const QString &data)
*//*!
*/QIviPendingReply<int> ProcessingService::process(constQString&data)
{
if (ProcessingServiceBackendInterface *backend = processingserviceBackend())
return backend->process(data);
returnQIviPendingReply<int>::createFailedReply();
}
/*! \internal */void ProcessingService::connectToServiceObject(QIviServiceObject*serviceObject)
{
auto d = ProcessingServicePrivate::get(this);
auto*backend = processingserviceBackend();
if (!backend)
return;
QObjectPrivate::connect(backend,&ProcessingServiceBackendInterface::lastMessageChanged,
d,&ProcessingServicePrivate::onLastMessageChanged);
QIviAbstractFeature::connectToServiceObject(serviceObject);
}
/*! \internal */void ProcessingService::clearServiceObject()
{
auto d = ProcessingServicePrivate::get(this);
d->clearToDefaults();
}
/*! \internal */
ProcessingServiceBackendInterface *ProcessingService::processingserviceBackend() const
{
if (QIviServiceObject*so = serviceObject())
return so->interfaceInstance<ProcessingServiceBackendInterface*>(interfaceName());
return nullptr;
}
#include "moc_processingservice.cpp"