fix documentations and time tests

This commit is contained in:
Simon Stürz 2016-08-21 14:12:48 +02:00 committed by Michael Zanetti
parent 8c90550c63
commit eb692c986e
13 changed files with 43 additions and 36 deletions

View File

@ -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}.

View File

@ -193,7 +193,7 @@
#include <QStandardPaths>
#include <QDir>
/*! 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<QJsonObject> 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;

View File

@ -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");

View File

@ -123,7 +123,7 @@ QVariant Device::paramValue(const ParamTypeId &paramTypeId) 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 &paramTypeId, const QVariant &value)
{
ParamList params;
@ -142,7 +142,7 @@ QList<State> 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 &paramTypeId) const
{
return m_params.hasParam(paramTypeId);

View File

@ -101,8 +101,8 @@
*/
/*!
\fn void DevicePlugin::configValueChanged(const QString &paramName, 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 &paramTypeId, 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<DeviceClass> 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

View File

@ -90,7 +90,7 @@ void Action::setParams(const ParamList &params)
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 &paramTypeId) const
{
foreach (const Param &param, m_params) {

View File

@ -98,7 +98,7 @@ void Event::setParams(const ParamList &params)
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 &paramTypeId) const
{
foreach (const Param &param, 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();
}

View File

@ -66,7 +66,7 @@ void EventDescriptor::setParamDescriptors(const QList<ParamDescriptor> &paramDes
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 &paramTypeId) const
{
foreach (const ParamDescriptor &paramDescriptor, m_paramDescriptors) {

View File

@ -33,38 +33,38 @@
#include <QDebug>
/*! 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 &paramTypeId, 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 &param)
{
dbg.nospace() << "Param(Id: " << param.paramTypeId().toString() << ", Value:" << param.value() << ")";
@ -115,7 +115,7 @@ QVariant ParamList::paramValue(const ParamTypeId &paramTypeId) 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 &paramTypeId, const QVariant &value)
{
for (int i = 0; i < count(); i++) {

View File

@ -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 &paramTypeId, const QVariant &value):
Param(paramTypeId, value),

View File

@ -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

View File

@ -45,7 +45,7 @@ RuleActionParam::RuleActionParam(const Param &param) :
{
}
/*! 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 &paramTypeId, const QVariant &value, const EventTypeId &eventTypeId, const ParamTypeId &eventParamTypeId) :
m_paramTypeId(paramTypeId),
@ -55,18 +55,19 @@ RuleActionParam::RuleActionParam(const ParamTypeId &paramTypeId, 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++) {

View File

@ -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);