add more documentation
This commit is contained in:
parent
5f32c11810
commit
d1244a9abc
@ -917,6 +917,7 @@ DeviceManager::DeviceError DeviceManager::executeAction(const Action &action)
|
|||||||
return DeviceErrorDeviceNotFound;
|
return DeviceErrorDeviceNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Centralized time tick for the GuhTimer resource. Ticks every second.*/
|
||||||
void DeviceManager::timeTick()
|
void DeviceManager::timeTick()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -356,6 +356,7 @@ RuleEngine *GuhCore::ruleEngine() const
|
|||||||
return m_ruleEngine;
|
return m_ruleEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns a pointer to the \l{TimeManager} instance owned by GuhCore.*/
|
||||||
TimeManager *GuhCore::timeManager() const
|
TimeManager *GuhCore::timeManager() const
|
||||||
{
|
{
|
||||||
return m_timeManager;
|
return m_timeManager;
|
||||||
|
|||||||
@ -843,6 +843,7 @@ QVariantMap JsonTypes::packCalendarItem(const CalendarItem &calendarItem)
|
|||||||
return calendarItemVariant;
|
return calendarItemVariant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns a variant map of the given \a timeEventItem. */
|
||||||
QVariantMap JsonTypes::packTimeEventItem(const TimeEventItem &timeEventItem)
|
QVariantMap JsonTypes::packTimeEventItem(const TimeEventItem &timeEventItem)
|
||||||
{
|
{
|
||||||
QVariantMap timeEventItemVariant;
|
QVariantMap timeEventItemVariant;
|
||||||
@ -1226,6 +1227,7 @@ CalendarItem JsonTypes::unpackCalendarItem(const QVariantMap &calendarItemMap)
|
|||||||
return calendarItem;
|
return calendarItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns a \l{TimeEventItem} created from the given \a timeEventItemMap. */
|
||||||
TimeEventItem JsonTypes::unpackTimeEventItem(const QVariantMap &timeEventItemMap)
|
TimeEventItem JsonTypes::unpackTimeEventItem(const QVariantMap &timeEventItemMap)
|
||||||
{
|
{
|
||||||
TimeEventItem timeEventItem;
|
TimeEventItem timeEventItem;
|
||||||
@ -1242,6 +1244,7 @@ TimeEventItem JsonTypes::unpackTimeEventItem(const QVariantMap &timeEventItemMap
|
|||||||
return timeEventItem;
|
return timeEventItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns a \l{TimeDescriptor} created from the given \a timeDescriptorMap. */
|
||||||
TimeDescriptor JsonTypes::unpackTimeDescriptor(const QVariantMap &timeDescriptorMap)
|
TimeDescriptor JsonTypes::unpackTimeDescriptor(const QVariantMap &timeDescriptorMap)
|
||||||
{
|
{
|
||||||
TimeDescriptor timeDescriptor;
|
TimeDescriptor timeDescriptor;
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class guhserver::TimeDescriptor
|
\class guhserver::TimeDescriptor
|
||||||
\brief Describes the time elements of a time based \l{guhserver::Rule}{Rule}.
|
\brief Describes the time elements of a time based \l{guhserver::Rule}{Rule}.
|
||||||
|
|||||||
@ -18,50 +18,72 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class guhserver::TimeEventItem
|
||||||
|
\brief Describes a time event of a time based \l{guhserver::Rule}{Rule}.
|
||||||
|
|
||||||
|
\ingroup rules
|
||||||
|
\inmodule core
|
||||||
|
|
||||||
|
|
||||||
|
\sa Rule, TimeDescriptor, CalendarItem
|
||||||
|
*/
|
||||||
|
|
||||||
#include "timeeventitem.h"
|
#include "timeeventitem.h"
|
||||||
|
|
||||||
namespace guhserver {
|
namespace guhserver {
|
||||||
|
|
||||||
|
/*! Constructs an invalid \l{TimeEventItem}. */
|
||||||
TimeEventItem::TimeEventItem()
|
TimeEventItem::TimeEventItem()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the dateTime of this \l{TimeEventItem}. */
|
||||||
QDateTime TimeEventItem::dateTime() const
|
QDateTime TimeEventItem::dateTime() const
|
||||||
{
|
{
|
||||||
return m_dateTimer;
|
return m_dateTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Sets the dateTime of this \l{TimeEventItem} to the given \a timeStamp. */
|
||||||
void TimeEventItem::setDateTime(const int &timeStamp)
|
void TimeEventItem::setDateTime(const int &timeStamp)
|
||||||
{
|
{
|
||||||
m_dateTimer = QDateTime::fromTime_t(timeStamp);
|
m_dateTimer = QDateTime::fromTime_t(timeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the time of this \l{TimeEventItem}. */
|
||||||
QTime TimeEventItem::time() const
|
QTime TimeEventItem::time() const
|
||||||
{
|
{
|
||||||
return m_time;
|
return m_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Sets the \a time of this \l{TimeEventItem}. */
|
||||||
void TimeEventItem::setTime(const QTime &time)
|
void TimeEventItem::setTime(const QTime &time)
|
||||||
{
|
{
|
||||||
m_time = time;
|
m_time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the \l{RepeatingOption} of this \l{TimeEventItem}. */
|
||||||
RepeatingOption TimeEventItem::repatingOption() const
|
RepeatingOption TimeEventItem::repatingOption() const
|
||||||
{
|
{
|
||||||
return m_repeatingOption;
|
return m_repeatingOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Sets the \a repeatingOption of this \l{TimeEventItem}. */
|
||||||
void TimeEventItem::setRepeatingOption(const RepeatingOption &repeatingOption)
|
void TimeEventItem::setRepeatingOption(const RepeatingOption &repeatingOption)
|
||||||
{
|
{
|
||||||
m_repeatingOption = repeatingOption;
|
m_repeatingOption = repeatingOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns true if this \l{TimeEventItem} is valid. A \l{TimeEventItem} is valid
|
||||||
|
if either the \l{time()} or the \l{dateTime()} is set.
|
||||||
|
*/
|
||||||
bool TimeEventItem::isValid() const
|
bool TimeEventItem::isValid() const
|
||||||
{
|
{
|
||||||
return !m_dateTimer.isNull() || !m_time.isNull();
|
return (!m_dateTimer.isNull() != !m_time.isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns true, if the given \a dateTime matches this \l{TimeEventItem}. */
|
||||||
bool TimeEventItem::evaluate(const QDateTime &dateTime) const
|
bool TimeEventItem::evaluate(const QDateTime &dateTime) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(dateTime)
|
Q_UNUSED(dateTime)
|
||||||
|
|||||||
@ -18,11 +18,33 @@
|
|||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class guhserver::TimeManager
|
||||||
|
\brief Describes the centralized time manager of guh.
|
||||||
|
|
||||||
|
\ingroup rules
|
||||||
|
\inmodule core
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \fn void guhserver::TimeManager::tick()
|
||||||
|
Represents the central time tick. Will be emitted every second.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \fn void guhserver::TimeManager::dateChanged(const QDate ¤tDate);
|
||||||
|
Will be emitted when the \a currentDate has changed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \fn void guhserver::TimeManager::timeChanged(const QTime ¤tTime);
|
||||||
|
Will be emitted when the \a currentTime has changed.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "timemanager.h"
|
#include "timemanager.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
|
|
||||||
namespace guhserver {
|
namespace guhserver {
|
||||||
|
|
||||||
|
/*! Constructs a new \l{TimeManager} with the given \a timeZone and \a parent. */
|
||||||
TimeManager::TimeManager(const QByteArray &timeZone, QObject *parent) :
|
TimeManager::TimeManager(const QByteArray &timeZone, QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
@ -42,11 +64,13 @@ TimeManager::TimeManager(const QByteArray &timeZone, QObject *parent) :
|
|||||||
m_guhTimer->start();
|
m_guhTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the time zone of this \l{TimeManager}. */
|
||||||
QByteArray TimeManager::timeZone() const
|
QByteArray TimeManager::timeZone() const
|
||||||
{
|
{
|
||||||
return m_timeZone.id();
|
return m_timeZone.id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Sets the \a timeZone of this \l{TimeManager}. */
|
||||||
void TimeManager::setTimeZone(const QByteArray &timeZone)
|
void TimeManager::setTimeZone(const QByteArray &timeZone)
|
||||||
{
|
{
|
||||||
if (!QTimeZone(timeZone).isValid()) {
|
if (!QTimeZone(timeZone).isValid()) {
|
||||||
@ -59,16 +83,19 @@ void TimeManager::setTimeZone(const QByteArray &timeZone)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the current dateTime of this \l{TimeManager}. */
|
||||||
QDateTime TimeManager::currentDateTime() const
|
QDateTime TimeManager::currentDateTime() const
|
||||||
{
|
{
|
||||||
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone);
|
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the current time of this \l{TimeManager}. */
|
||||||
QTime TimeManager::currentTime() const
|
QTime TimeManager::currentTime() const
|
||||||
{
|
{
|
||||||
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone).time();
|
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone).time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the current date of this \l{TimeManager}. */
|
||||||
QDate TimeManager::currentDate() const
|
QDate TimeManager::currentDate() const
|
||||||
{
|
{
|
||||||
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone).date();
|
return QDateTime::currentDateTimeUtc().toTimeZone(m_timeZone).date();
|
||||||
|
|||||||
Reference in New Issue
Block a user