From eb692c986e548dc8a816c7a4659f00ddb027e44c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Sun, 21 Aug 2016 14:12:48 +0200 Subject: [PATCH] fix documentations and time tests --- doc/typeutils.qdoc | 3 +++ libguh/devicemanager.cpp | 3 ++- libguh/guhsettings.cpp | 1 + libguh/plugin/device.cpp | 4 ++-- libguh/plugin/deviceplugin.cpp | 6 ++++-- libguh/types/action.cpp | 2 +- libguh/types/event.cpp | 3 +-- libguh/types/eventdescriptor.cpp | 2 +- libguh/types/param.cpp | 14 ++++++------- libguh/types/paramdescriptor.cpp | 2 +- libguh/types/ruleaction.cpp | 2 +- libguh/types/ruleactionparam.cpp | 13 ++++++------ tests/auto/timemanager/testtimemanager.cpp | 24 +++++++++++----------- 13 files changed, 43 insertions(+), 36 deletions(-) diff --git a/doc/typeutils.qdoc b/doc/typeutils.qdoc index 4fae60ff..5418664c 100644 --- a/doc/typeutils.qdoc +++ b/doc/typeutils.qdoc @@ -311,6 +311,9 @@ \section2 VendorId This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{Vendor}. + \section2 ParamTypeId + This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{ParamType}. + \section2 DeviceClassId This class is a subclass of \l{http://doc.qt.io/qt-5/quuid.html}{QUuid} and represents the \e id of a \l{DeviceClass}. diff --git a/libguh/devicemanager.cpp b/libguh/devicemanager.cpp index 5310f2ed..fc050c97 100644 --- a/libguh/devicemanager.cpp +++ b/libguh/devicemanager.cpp @@ -193,7 +193,7 @@ #include #include -/*! Constructs the DeviceManager with the given \a parent. There should only be one DeviceManager in the system created by \l{guhserver::GuhCore}. +/*! Constructs the DeviceManager with the given \a locale and \a parent. There should only be one DeviceManager in the system created by \l{guhserver::GuhCore}. * Use \c guhserver::GuhCore::instance()->deviceManager() instead to access the DeviceManager. */ DeviceManager::DeviceManager(const QLocale &locale, QObject *parent) : QObject(parent), @@ -283,6 +283,7 @@ QList DeviceManager::pluginsMetadata() return pluginList; } +/*! Set the \a locale of all plugins and reload the translated strings. */ void DeviceManager::setLocale(const QLocale &locale) { m_locale = locale; diff --git a/libguh/guhsettings.cpp b/libguh/guhsettings.cpp index 97e9078b..2b770867 100644 --- a/libguh/guhsettings.cpp +++ b/libguh/guhsettings.cpp @@ -186,6 +186,7 @@ QString GuhSettings::settingsPath() return path; } +/*! Returns the default system translation path \tt{/usr/share/guh/translations}. */ QString GuhSettings::translationsPath() { return QString("/usr/share/guh/translations"); diff --git a/libguh/plugin/device.cpp b/libguh/plugin/device.cpp index cceeff61..154ecf73 100644 --- a/libguh/plugin/device.cpp +++ b/libguh/plugin/device.cpp @@ -123,7 +123,7 @@ QVariant Device::paramValue(const ParamTypeId ¶mTypeId) const return QVariant(); } -/*! Sets the \a value of the \l{Param} with the given \a paramName. */ +/*! Sets the \a value of the \l{Param} with the given \a paramTypeId. */ void Device::setParamValue(const ParamTypeId ¶mTypeId, const QVariant &value) { ParamList params; @@ -142,7 +142,7 @@ QList Device::states() const return m_states; } -/*! Returns true, a \l{Param} with the given \a paramName exists for this Device. */ +/*! Returns true, a \l{Param} with the given \a paramTypeId exists for this Device. */ bool Device::hasParam(const ParamTypeId ¶mTypeId) const { return m_params.hasParam(paramTypeId); diff --git a/libguh/plugin/deviceplugin.cpp b/libguh/plugin/deviceplugin.cpp index 64fed053..6745450b 100644 --- a/libguh/plugin/deviceplugin.cpp +++ b/libguh/plugin/deviceplugin.cpp @@ -101,8 +101,8 @@ */ /*! - \fn void DevicePlugin::configValueChanged(const QString ¶mName, const QVariant &value); - This signal is emitted when the \l{Param} with a certain \a paramName of a \l{Device} configuration changed the \a value. + \fn void DevicePlugin::configValueChanged(const ParamTypeId ¶mTypeId, const QVariant &value); + This signal is emitted when the \l{Param} with a certain \a paramTypeId of a \l{Device} configuration changed the \a value. */ /*! @@ -443,11 +443,13 @@ QList DevicePlugin::supportedDevices() const return deviceClasses; } +/*! Returns the translator of this \l{DevicePlugin}. */ QTranslator *DevicePlugin::translator() { return m_translator; } +/*! Returns true if the given \a locale could be set for this \l{DevicePlugin}. */ bool DevicePlugin::setLocale(const QLocale &locale) { // check if there are local translations diff --git a/libguh/types/action.cpp b/libguh/types/action.cpp index 66c0c6fa..210258ab 100644 --- a/libguh/types/action.cpp +++ b/libguh/types/action.cpp @@ -90,7 +90,7 @@ void Action::setParams(const ParamList ¶ms) m_params = params; } -/*! Returns the parameter of this Action with a cetrain \a paramName. */ +/*! Returns the parameter of this Action with a cetrain \a paramTypeId. */ Param Action::param(const ParamTypeId ¶mTypeId) const { foreach (const Param ¶m, m_params) { diff --git a/libguh/types/event.cpp b/libguh/types/event.cpp index be8b5e36..29f7c87e 100644 --- a/libguh/types/event.cpp +++ b/libguh/types/event.cpp @@ -98,7 +98,7 @@ void Event::setParams(const ParamList ¶ms) m_params = params; } -/*! Returns the parameter of this Event with a cetrain \a paramName. */ +/*! Returns the parameter of this Event with the given \a paramTypeId. */ Param Event::param(const ParamTypeId ¶mTypeId) const { foreach (const Param ¶m, m_params) { @@ -137,7 +137,6 @@ bool Event::operator ==(const Event &other) const QDebug operator<<(QDebug dbg, const Event &event) { dbg.nospace() << "Event(EventTypeId: " << event.eventTypeId().toString() << ", DeviceId" << event.deviceId().toString() << ")"; - return dbg.space(); } diff --git a/libguh/types/eventdescriptor.cpp b/libguh/types/eventdescriptor.cpp index 82baa198..101dba08 100644 --- a/libguh/types/eventdescriptor.cpp +++ b/libguh/types/eventdescriptor.cpp @@ -66,7 +66,7 @@ void EventDescriptor::setParamDescriptors(const QList ¶mDes m_paramDescriptors = paramDescriptors; } -/*! Set a parameters of this Event to \a paramDescriptorName. */ +/*! Returns the ParamDescriptor with the given \a paramTypeId, otherwise an invalid ParamDescriptor. */ ParamDescriptor EventDescriptor::paramDescriptor(const ParamTypeId ¶mTypeId) const { foreach (const ParamDescriptor ¶mDescriptor, m_paramDescriptors) { diff --git a/libguh/types/param.cpp b/libguh/types/param.cpp index 9b0cd75d..3d74c03f 100644 --- a/libguh/types/param.cpp +++ b/libguh/types/param.cpp @@ -33,38 +33,38 @@ #include -/*! Constructs a Param with the given \a name and \a value of the paramter. */ +/*! Constructs a \l Param with the given \a paramTypeId and \a value of the paramter. */ Param::Param(const ParamTypeId ¶mTypeId, const QVariant &value): m_paramTypeId(paramTypeId), m_value(value) { } -/*! Returns the paramTypeId of this Param. */ +/*! Returns the paramTypeId of this \l Param. */ ParamTypeId Param::paramTypeId() const { return m_paramTypeId; } -/*! Returns the value of this Param. */ +/*! Returns the value of this \l Param. */ QVariant Param::value() const { return m_value; } -/*! Sets the \a value of this Param. */ +/*! Sets the \a value of this \l Param. */ void Param::setValue(const QVariant &value) { m_value = value; } -/*! A Param is valid if name and and value are set. Returns true if valid, false if not. */ +/*! Returns true if paramTypeId() and and value() of this \l Param are set. */ bool Param::isValid() const { return !m_paramTypeId.isNull() && m_value.isValid(); } -/*! Writes the name and value of the given \a param to \a dbg. */ +/*! Writes the paramTypeId and value of the given \a param to \a dbg. */ QDebug operator<<(QDebug dbg, const Param ¶m) { dbg.nospace() << "Param(Id: " << param.paramTypeId().toString() << ", Value:" << param.value() << ")"; @@ -115,7 +115,7 @@ QVariant ParamList::paramValue(const ParamTypeId ¶mTypeId) const return QVariant(); } -/*! Sets the value of a Param with the given \a paramTypeId to the given \a value. */ +/*! Returns true if the value of a Param with the given \a paramTypeId could be set to the given \a value. */ bool ParamList::setParamValue(const ParamTypeId ¶mTypeId, const QVariant &value) { for (int i = 0; i < count(); i++) { diff --git a/libguh/types/paramdescriptor.cpp b/libguh/types/paramdescriptor.cpp index 7b97f90b..ff574c71 100644 --- a/libguh/types/paramdescriptor.cpp +++ b/libguh/types/paramdescriptor.cpp @@ -34,7 +34,7 @@ #include "paramdescriptor.h" -/*! Constructs an ParamDescriptor describing an \l{Param} with the given \a name and \a value. +/*! Constructs an ParamDescriptor describing an \l{Param} with the given \a paramTypeId and \a value. * The ValueOperator is by default ValueOperatorEquals. */ ParamDescriptor::ParamDescriptor(const ParamTypeId ¶mTypeId, const QVariant &value): Param(paramTypeId, value), diff --git a/libguh/types/ruleaction.cpp b/libguh/types/ruleaction.cpp index 80a0835d..6eaecc1e 100644 --- a/libguh/types/ruleaction.cpp +++ b/libguh/types/ruleaction.cpp @@ -115,7 +115,7 @@ void RuleAction::setRuleActionParams(const RuleActionParamList &ruleActionParams m_ruleActionParams = ruleActionParams; } -/*! Returns the \l{RuleActionParam} of this RuleAction with the given \a ruleActionParamName. +/*! Returns the \l{RuleActionParam} of this RuleAction with the given \a ruleActionParamTypeId. * If there is no \l{RuleActionParam} with th given name an invalid \l{RuleActionParam} will be returnend. * \sa RuleActionParam, */ RuleActionParam RuleAction::ruleActionParam(const ParamTypeId &ruleActionParamTypeId) const diff --git a/libguh/types/ruleactionparam.cpp b/libguh/types/ruleactionparam.cpp index d27f512a..a59ad201 100644 --- a/libguh/types/ruleactionparam.cpp +++ b/libguh/types/ruleactionparam.cpp @@ -45,7 +45,7 @@ RuleActionParam::RuleActionParam(const Param ¶m) : { } -/*! Constructs a \l{RuleActionParam} with the given \a name, \a value, \a eventTypeId and \a eventParamName. +/*! Constructs a \l{RuleActionParam} with the given \a paramTypeId, \a value, \a eventTypeId and \a eventParamTypeId. * \sa Param, Event, */ RuleActionParam::RuleActionParam(const ParamTypeId ¶mTypeId, const QVariant &value, const EventTypeId &eventTypeId, const ParamTypeId &eventParamTypeId) : m_paramTypeId(paramTypeId), @@ -55,18 +55,19 @@ RuleActionParam::RuleActionParam(const ParamTypeId ¶mTypeId, const QVariant { } +/*! Returns the \l ParamTypeId of this \l RuleActionParam. */ ParamTypeId RuleActionParam::paramTypeId() const { return m_paramTypeId; } -/*! Returns the name of the eventParam for this RuleActionParam. */ +/*! Returns the eventParamTypeId of this RuleActionParam. */ ParamTypeId RuleActionParam::eventParamTypeId() const { return m_eventParamTypeId; } -/*! Sets the \a eventParamName of this RuleActionParam. */ +/*! Sets the \a eventParamTypeId of this RuleActionParam. */ void RuleActionParam::setEventParamTypeId(const ParamTypeId &eventParamTypeId) { m_eventParamTypeId = eventParamTypeId; @@ -84,7 +85,7 @@ void RuleActionParam::setValue(const QVariant &value) m_value = value; } -/*! Returns true if the name and value or the name, eventTypeId and eventParamName of this RuleActionParam are set.*/ +/*! Returns true if the \tt{(paramTypeId AND value) XOR (paramTypeId AND eventTypeId AND eventParamName)} of this RuleActionParam are set.*/ bool RuleActionParam::isValid() const { bool validValue = (!m_paramTypeId.isNull() && m_value.isValid() && m_eventTypeId.isNull() && m_eventParamTypeId.isNull()); @@ -104,7 +105,7 @@ void RuleActionParam::setEventTypeId(const EventTypeId &eventTypeId) m_eventTypeId = eventTypeId; } -/*! Writes the name, value, eventId and eventParamName of the given \a ruleActionParam to \a dbg. */ +/*! Writes the paramTypeId, value, eventId and eventParamTypeId of the given \a ruleActionParam to \a dbg. */ QDebug operator<<(QDebug dbg, const RuleActionParam &ruleActionParam) { dbg.nospace() << "RuleActionParam(ParamTypeId: " << ruleActionParam.paramTypeId() << ", Value:" << ruleActionParam.value(); @@ -145,7 +146,7 @@ QVariant RuleActionParamList::paramValue(const ParamTypeId &ruleActionParamTypeI return QVariant(); } -/*! Sets the value of the \l{RuleActionParam} with the given \a ruleActionParamTypeId to the given \a value. */ +/*! Returns true if the \a value of the \l{RuleActionParam} with the given \a ruleActionParamTypeId could be set successfully. */ bool RuleActionParamList::setParamValue(const ParamTypeId &ruleActionParamTypeId, const QVariant &value) { for (int i = 0; i < count(); i++) { diff --git a/tests/auto/timemanager/testtimemanager.cpp b/tests/auto/timemanager/testtimemanager.cpp index 2000cfe1..963a0c01 100644 --- a/tests/auto/timemanager/testtimemanager.cpp +++ b/tests/auto/timemanager/testtimemanager.cpp @@ -381,11 +381,11 @@ void TestTimeManager::testCalendarDateTime() // Exit action (with params) QVariantList actionParams; QVariantMap param1; - param1.insert("name", "mockActionParam1"); + param1.insert("paramTypeId", mockActionParam1ParamTypeId); param1.insert("value", 12); actionParams.append(param1); QVariantMap param2; - param2.insert("name", "mockActionParam2"); + param2.insert("paramTypeId", mockActionParam2ParamTypeId); param2.insert("value", true); actionParams.append(param2); exitAction.insert("actionTypeId", mockActionIdWithParams); @@ -456,11 +456,11 @@ void TestTimeManager::testCalendarItemHourly() exitAction.insert("actionTypeId", mockActionIdWithParams); QVariantList actionParams; QVariantMap param1; - param1.insert("name", "mockActionParam1"); + param1.insert("paramTypeId", mockActionParam1ParamTypeId); param1.insert("value", 7); actionParams.append(param1); QVariantMap param2; - param2.insert("name", "mockActionParam2"); + param2.insert("paramTypeId", mockActionParam2ParamTypeId); param2.insert("value", true); actionParams.append(param2); exitAction.insert("deviceId", m_mockDeviceId); @@ -549,11 +549,11 @@ void TestTimeManager::testCalendarItemDaily() exitAction.insert("actionTypeId", mockActionIdWithParams); QVariantList actionParams; QVariantMap param1; - param1.insert("name", "mockActionParam1"); + param1.insert("paramTypeId", mockActionParam1ParamTypeId); param1.insert("value", 12); actionParams.append(param1); QVariantMap param2; - param2.insert("name", "mockActionParam2"); + param2.insert("paramTypeId", mockActionParam2ParamTypeId); param2.insert("value", true); actionParams.append(param2); exitAction.insert("deviceId", m_mockDeviceId); @@ -649,11 +649,11 @@ void TestTimeManager::testCalendarItemWeekly() // Exit action (with params) QVariantList actionParams; QVariantMap param1; - param1.insert("name", "mockActionParam1"); + param1.insert("paramTypeId", mockActionParam1ParamTypeId); param1.insert("value", 12); actionParams.append(param1); QVariantMap param2; - param2.insert("name", "mockActionParam2"); + param2.insert("paramTypeId", mockActionParam2ParamTypeId); param2.insert("value", true); actionParams.append(param2); exitAction.insert("actionTypeId", mockActionIdWithParams); @@ -804,11 +804,11 @@ void TestTimeManager::testCalendarItemMonthly() // Exit action (with params) QVariantList actionParams; QVariantMap param1; - param1.insert("name", "mockActionParam1"); + param1.insert("paramTypeId", mockActionParam1ParamTypeId); param1.insert("value", 12); actionParams.append(param1); QVariantMap param2; - param2.insert("name", "mockActionParam2"); + param2.insert("paramTypeId", mockActionParam2ParamTypeId); param2.insert("value", true); actionParams.append(param2); exitAction.insert("actionTypeId", mockActionIdWithParams); @@ -932,11 +932,11 @@ void TestTimeManager::testCalendarYearlyDateTime() // Exit action (with params) QVariantList actionParams; QVariantMap param1; - param1.insert("name", "mockActionParam1"); + param1.insert("paramTypeId", mockActionParam1ParamTypeId); param1.insert("value", 12); actionParams.append(param1); QVariantMap param2; - param2.insert("name", "mockActionParam2"); + param2.insert("paramTypeId", mockActionParam2ParamTypeId); param2.insert("value", true); actionParams.append(param2); exitAction.insert("actionTypeId", mockActionIdWithParams);