summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/gui/skin
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/gui/skin')
-rw-r--r--xbmc/addons/gui/skin/CMakeLists.txt7
-rw-r--r--xbmc/addons/gui/skin/SkinTimer.cpp97
-rw-r--r--xbmc/addons/gui/skin/SkinTimer.h110
-rw-r--r--xbmc/addons/gui/skin/SkinTimerManager.cpp222
-rw-r--r--xbmc/addons/gui/skin/SkinTimerManager.h77
-rw-r--r--xbmc/addons/gui/skin/SkinTimers.dox164
6 files changed, 677 insertions, 0 deletions
diff --git a/xbmc/addons/gui/skin/CMakeLists.txt b/xbmc/addons/gui/skin/CMakeLists.txt
new file mode 100644
index 0000000..916cd94
--- /dev/null
+++ b/xbmc/addons/gui/skin/CMakeLists.txt
@@ -0,0 +1,7 @@
+set(SOURCES SkinTimer.cpp
+ SkinTimerManager.cpp)
+
+set(HEADERS SkinTimer.h
+ SkinTimerManager.h)
+
+core_add_library(addons_gui_skin)
diff --git a/xbmc/addons/gui/skin/SkinTimer.cpp b/xbmc/addons/gui/skin/SkinTimer.cpp
new file mode 100644
index 0000000..c4e88b7
--- /dev/null
+++ b/xbmc/addons/gui/skin/SkinTimer.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2022 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+#include "SkinTimer.h"
+
+#include "interfaces/info/Info.h"
+
+CSkinTimer::CSkinTimer(const std::string& name,
+ const INFO::InfoPtr& startCondition,
+ const INFO::InfoPtr& resetCondition,
+ const INFO::InfoPtr& stopCondition,
+ const CGUIAction& startActions,
+ const CGUIAction& stopActions,
+ bool resetOnStart)
+ : m_name{name},
+ m_startCondition{startCondition},
+ m_resetCondition{resetCondition},
+ m_stopCondition{stopCondition},
+ m_startActions{startActions},
+ m_stopActions{stopActions},
+ m_resetOnStart{resetOnStart}
+{
+}
+
+void CSkinTimer::Start()
+{
+ if (m_resetOnStart)
+ {
+ CStopWatch::StartZero();
+ }
+ else
+ {
+ CStopWatch::Start();
+ }
+ OnStart();
+}
+
+void CSkinTimer::Reset()
+{
+ CStopWatch::Reset();
+}
+
+void CSkinTimer::Stop()
+{
+ CStopWatch::Stop();
+ OnStop();
+}
+
+bool CSkinTimer::VerifyStartCondition() const
+{
+ return m_startCondition && m_startCondition->Get(INFO::DEFAULT_CONTEXT);
+}
+
+bool CSkinTimer::VerifyResetCondition() const
+{
+ return m_resetCondition && m_resetCondition->Get(INFO::DEFAULT_CONTEXT);
+}
+
+bool CSkinTimer::VerifyStopCondition() const
+{
+ return m_stopCondition && m_stopCondition->Get(INFO::DEFAULT_CONTEXT);
+}
+
+INFO::InfoPtr CSkinTimer::GetStartCondition() const
+{
+ return m_startCondition;
+}
+
+INFO::InfoPtr CSkinTimer::GetResetCondition() const
+{
+ return m_resetCondition;
+}
+
+INFO::InfoPtr CSkinTimer::GetStopCondition() const
+{
+ return m_stopCondition;
+}
+
+void CSkinTimer::OnStart()
+{
+ if (m_startActions.HasAnyActions())
+ {
+ m_startActions.ExecuteActions();
+ }
+}
+
+void CSkinTimer::OnStop()
+{
+ if (m_stopActions.HasAnyActions())
+ {
+ m_stopActions.ExecuteActions();
+ }
+}
diff --git a/xbmc/addons/gui/skin/SkinTimer.h b/xbmc/addons/gui/skin/SkinTimer.h
new file mode 100644
index 0000000..d838ef0
--- /dev/null
+++ b/xbmc/addons/gui/skin/SkinTimer.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "guilib/GUIAction.h"
+#include "interfaces/info/InfoExpression.h"
+#include "utils/Stopwatch.h"
+
+#include <memory>
+#include <string>
+
+class TiXmlElement;
+
+/*! \brief Skin timers are skin objects that dependent on time and can be fully controlled from skins either using boolean
+ * conditions or builtin functions. This class represents the Skin Timer object.
+ * \sa Skin_Timers
+ */
+class CSkinTimer : public CStopWatch
+{
+public:
+ /*! \brief Skin timer constructor
+ * \param name - the name of the timer
+ * \param startCondition - the boolean info expression to start the timer (may be null)
+ * \param resetCondition - the boolean info expression to reset the timer (may be null)
+ * \param stopCondition - the boolean info expression to stop the timer (may be null)
+ * \param startActions - the builtin functions to execute on timer start (actions may be empty)
+ * \param stopActions - the builtin functions to execute on timer stop (actions may be empty)
+ * \param resetOnStart - if the timer should be reset when started (i.e. start from zero if true or resumed if false)
+ */
+ CSkinTimer(const std::string& name,
+ const INFO::InfoPtr& startCondition,
+ const INFO::InfoPtr& resetCondition,
+ const INFO::InfoPtr& stopCondition,
+ const CGUIAction& startActions,
+ const CGUIAction& stopActions,
+ bool resetOnStart);
+
+ /*! \brief Default skin timer destructor */
+ virtual ~CSkinTimer() = default;
+
+ /*! \brief Start the skin timer */
+ void Start();
+
+ /*! \brief Resets the skin timer so that the elapsed time of the timer is 0 */
+ void Reset();
+
+ /*! \brief stops the skin timer */
+ void Stop();
+
+ /*! \brief Getter for the timer start boolean condition/expression
+ * \return the start boolean condition/expression (may be null)
+ */
+ INFO::InfoPtr GetStartCondition() const;
+
+ /*! \brief Getter for the timer reset boolean condition/expression
+ * \return the reset boolean condition/expression (may be null)
+ */
+ INFO::InfoPtr GetResetCondition() const;
+
+ /*! \brief Getter for the timer start boolean condition/expression
+ * \return the start boolean condition/expression (may be null)
+ */
+ INFO::InfoPtr GetStopCondition() const;
+
+ /*! \brief Evaluates the timer start boolean info expression returning the respective result.
+ * \details Called from the skin timer manager to check if the timer should be started
+ * \return true if the condition is true, false otherwise
+ */
+ bool VerifyStartCondition() const;
+
+ /*! \brief Evaluates the timer reset boolean info expression returning the respective result.
+ * \details Called from the skin timer manager to check if the timer should be reset to 0
+ * \return true if the condition is true, false otherwise
+ */
+ bool VerifyResetCondition() const;
+
+ /*! \brief Evaluates the timer stop boolean info expression returning the respective result.
+ * \details Called from the skin timer manager to check if the timer should be stopped
+ * \return true if the condition is true, false otherwise
+ */
+ bool VerifyStopCondition() const;
+
+private:
+ /*! \brief Called when this timer is started */
+ void OnStart();
+
+ /*! \brief Called when this timer is stopped */
+ void OnStop();
+
+ /*! The name of the skin timer */
+ std::string m_name;
+ /*! The info boolean expression that automatically starts the timer if evaluated true */
+ INFO::InfoPtr m_startCondition;
+ /*! The info boolean expression that automatically resets the timer if evaluated true */
+ INFO::InfoPtr m_resetCondition;
+ /*! The info boolean expression that automatically stops the timer if evaluated true */
+ INFO::InfoPtr m_stopCondition;
+ /*! The builtin functions to be executed when the timer is started */
+ CGUIAction m_startActions;
+ /*! The builtin functions to be executed when the timer is stopped */
+ CGUIAction m_stopActions;
+ /*! if the timer should be reset on start (or just resumed) */
+ bool m_resetOnStart{false};
+};
diff --git a/xbmc/addons/gui/skin/SkinTimerManager.cpp b/xbmc/addons/gui/skin/SkinTimerManager.cpp
new file mode 100644
index 0000000..663f5aa
--- /dev/null
+++ b/xbmc/addons/gui/skin/SkinTimerManager.cpp
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2022 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "SkinTimerManager.h"
+
+#include "GUIInfoManager.h"
+#include "ServiceBroker.h"
+#include "guilib/GUIAction.h"
+#include "guilib/GUIComponent.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+#include "utils/log.h"
+
+#include <chrono>
+#include <mutex>
+
+using namespace std::chrono_literals;
+
+void CSkinTimerManager::LoadTimers(const std::string& path)
+{
+ CXBMCTinyXML doc;
+ if (!doc.LoadFile(path))
+ {
+ CLog::LogF(LOGWARNING, "Could not load timers file {}: {} (row: {}, col: {})", path,
+ doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol());
+ return;
+ }
+
+ TiXmlElement* root = doc.RootElement();
+ if (!root || !StringUtils::EqualsNoCase(root->Value(), "timers"))
+ {
+ CLog::LogF(LOGERROR, "Error loading timers file {}: Root element <timers> required.", path);
+ return;
+ }
+
+ const TiXmlElement* timerNode = root->FirstChildElement("timer");
+ while (timerNode)
+ {
+ LoadTimerInternal(timerNode);
+ timerNode = timerNode->NextSiblingElement("timer");
+ }
+}
+
+void CSkinTimerManager::LoadTimerInternal(const TiXmlElement* node)
+{
+ if ((!node->FirstChild("name") || !node->FirstChild("name")->FirstChild() ||
+ node->FirstChild("name")->FirstChild()->ValueStr().empty()))
+ {
+ CLog::LogF(LOGERROR, "Missing required field name for valid skin. Ignoring timer.");
+ return;
+ }
+
+ std::string timerName = node->FirstChild("name")->FirstChild()->Value();
+ if (m_timers.count(timerName) > 0)
+ {
+ CLog::LogF(LOGWARNING,
+ "Ignoring timer with name {} - another timer with the same name already exists",
+ timerName);
+ return;
+ }
+
+ // timer start
+ INFO::InfoPtr startInfo{nullptr};
+ bool resetOnStart{false};
+ if (node->FirstChild("start") && node->FirstChild("start")->FirstChild() &&
+ !node->FirstChild("start")->FirstChild()->ValueStr().empty())
+ {
+ startInfo = CServiceBroker::GetGUI()->GetInfoManager().Register(
+ node->FirstChild("start")->FirstChild()->ValueStr());
+ // check if timer needs to be reset after start
+ if (node->FirstChildElement("start")->Attribute("reset") &&
+ StringUtils::EqualsNoCase(node->FirstChildElement("start")->Attribute("reset"), "true"))
+ {
+ resetOnStart = true;
+ }
+ }
+
+ // timer reset
+ INFO::InfoPtr resetInfo{nullptr};
+ if (node->FirstChild("reset") && node->FirstChild("reset")->FirstChild() &&
+ !node->FirstChild("reset")->FirstChild()->ValueStr().empty())
+ {
+ resetInfo = CServiceBroker::GetGUI()->GetInfoManager().Register(
+ node->FirstChild("reset")->FirstChild()->ValueStr());
+ }
+ // timer stop
+ INFO::InfoPtr stopInfo{nullptr};
+ if (node->FirstChild("stop") && node->FirstChild("stop")->FirstChild() &&
+ !node->FirstChild("stop")->FirstChild()->ValueStr().empty())
+ {
+ stopInfo = CServiceBroker::GetGUI()->GetInfoManager().Register(
+ node->FirstChild("stop")->FirstChild()->ValueStr());
+ }
+
+ // process onstart actions
+ CGUIAction startActions;
+ startActions.EnableSendThreadMessageMode();
+ const TiXmlElement* onStartElement = node->FirstChildElement("onstart");
+ while (onStartElement)
+ {
+ if (onStartElement->FirstChild())
+ {
+ const std::string conditionalActionAttribute =
+ onStartElement->Attribute("condition") != nullptr ? onStartElement->Attribute("condition")
+ : "";
+ startActions.Append(CGUIAction::CExecutableAction{conditionalActionAttribute,
+ onStartElement->FirstChild()->Value()});
+ }
+ onStartElement = onStartElement->NextSiblingElement("onstart");
+ }
+
+ // process onstop actions
+ CGUIAction stopActions;
+ stopActions.EnableSendThreadMessageMode();
+ const TiXmlElement* onStopElement = node->FirstChildElement("onstop");
+ while (onStopElement)
+ {
+ if (onStopElement->FirstChild())
+ {
+ const std::string conditionalActionAttribute =
+ onStopElement->Attribute("condition") != nullptr ? onStopElement->Attribute("condition")
+ : "";
+ stopActions.Append(CGUIAction::CExecutableAction{conditionalActionAttribute,
+ onStopElement->FirstChild()->Value()});
+ }
+ onStopElement = onStopElement->NextSiblingElement("onstop");
+ }
+
+ m_timers[timerName] = std::make_unique<CSkinTimer>(CSkinTimer(
+ timerName, startInfo, resetInfo, stopInfo, startActions, stopActions, resetOnStart));
+}
+
+bool CSkinTimerManager::TimerIsRunning(const std::string& timer) const
+{
+ if (m_timers.count(timer) == 0)
+ {
+ CLog::LogF(LOGERROR, "Couldn't find Skin Timer with name: {}", timer);
+ return false;
+ }
+ return m_timers.at(timer)->IsRunning();
+}
+
+float CSkinTimerManager::GetTimerElapsedSeconds(const std::string& timer) const
+{
+ if (m_timers.count(timer) == 0)
+ {
+ CLog::LogF(LOGERROR, "Couldn't find Skin Timer with name: {}", timer);
+ return 0;
+ }
+ return m_timers.at(timer)->GetElapsedSeconds();
+}
+
+void CSkinTimerManager::TimerStart(const std::string& timer) const
+{
+ if (m_timers.count(timer) == 0)
+ {
+ CLog::LogF(LOGERROR, "Couldn't find Skin Timer with name: {}", timer);
+ return;
+ }
+ m_timers.at(timer)->Start();
+}
+
+void CSkinTimerManager::TimerStop(const std::string& timer) const
+{
+ if (m_timers.count(timer) == 0)
+ {
+ CLog::LogF(LOGERROR, "Couldn't find Skin Timer with name: {}", timer);
+ return;
+ }
+ m_timers.at(timer)->Stop();
+}
+
+void CSkinTimerManager::Stop()
+{
+ // skintimers, as infomanager clients register info conditions/expressions in the infomanager.
+ // The infomanager is linked to skins, being initialized or cleared when
+ // skins are loaded (or unloaded). All the registered boolean conditions from
+ // skin timers will end up being removed when the skin is unloaded. However, to
+ // self-contain this component unregister them all here.
+ for (auto const& [key, val] : m_timers)
+ {
+ const std::unique_ptr<CSkinTimer>::pointer timer = val.get();
+ if (timer->GetStartCondition())
+ {
+ CServiceBroker::GetGUI()->GetInfoManager().UnRegister(timer->GetStartCondition());
+ }
+ if (timer->GetStopCondition())
+ {
+ CServiceBroker::GetGUI()->GetInfoManager().UnRegister(timer->GetStopCondition());
+ }
+ if (timer->GetResetCondition())
+ {
+ CServiceBroker::GetGUI()->GetInfoManager().UnRegister(timer->GetResetCondition());
+ }
+ }
+ m_timers.clear();
+}
+
+void CSkinTimerManager::Process()
+{
+ for (const auto& [key, val] : m_timers)
+ {
+ const std::unique_ptr<CSkinTimer>::pointer timer = val.get();
+ if (!timer->IsRunning() && timer->VerifyStartCondition())
+ {
+ timer->Start();
+ }
+ else if (timer->IsRunning() && timer->VerifyStopCondition())
+ {
+ timer->Stop();
+ }
+ if (timer->GetElapsedSeconds() > 0 && timer->VerifyResetCondition())
+ {
+ timer->Reset();
+ }
+ }
+}
diff --git a/xbmc/addons/gui/skin/SkinTimerManager.h b/xbmc/addons/gui/skin/SkinTimerManager.h
new file mode 100644
index 0000000..fdf44d1
--- /dev/null
+++ b/xbmc/addons/gui/skin/SkinTimerManager.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "SkinTimer.h"
+
+#include <map>
+#include <memory>
+#include <string>
+
+/*! \brief CSkinTimerManager is the container and manager for Skin timers. Its role is that of
+ * checking if the timer boolean conditions are valid, start or stop timers and execute the respective
+ * builtin actions linked to the timer lifecycle
+ * \note This component should only be called by the main/rendering thread
+ * \sa Skin_Timers
+ * \sa CSkinTimer
+ */
+class CSkinTimerManager
+{
+public:
+ /*! \brief Skin timer manager constructor */
+ CSkinTimerManager() = default;
+
+ /*! \brief Default skin timer manager destructor */
+ ~CSkinTimerManager() = default;
+
+ /*! \brief Loads all the skin timers
+ * \param path - the path for the skin Timers.xml file
+ */
+ void LoadTimers(const std::string& path);
+
+ /*! \brief Stops the manager */
+ void Stop();
+
+ /*! \brief Checks if the timer with name `timer` is running
+ \param timer the name of the skin timer
+ \return true if the given timer exists and is running, false otherwise
+ */
+ bool TimerIsRunning(const std::string& timer) const;
+
+ /*! \brief Get the elapsed seconds since the timer with name `timer` was started
+ \param timer the name of the skin timer
+ \return the elapsed time in seconds the given timer is running (0 if not running or if it does not exist)
+ */
+ float GetTimerElapsedSeconds(const std::string& timer) const;
+
+ /*! \brief Starts/Enables a given skin timer
+ \param timer the name of the skin timer
+ */
+ void TimerStart(const std::string& timer) const;
+
+ /*! \brief Stops/Disables a given skin timer
+ \param timer the name of the skin timer
+ */
+ void TimerStop(const std::string& timer) const;
+
+ // CThread methods
+
+ /*! \brief Run the main manager processing loop */
+ void Process();
+
+private:
+ /*! \brief Loads a specific timer
+ * \note Called internally from LoadTimers
+ * \param node - the XML representation of a skin timer object
+ */
+ void LoadTimerInternal(const TiXmlElement* node);
+
+ /*! Container for the skin timers */
+ std::map<std::string, std::unique_ptr<CSkinTimer>> m_timers;
+};
diff --git a/xbmc/addons/gui/skin/SkinTimers.dox b/xbmc/addons/gui/skin/SkinTimers.dox
new file mode 100644
index 0000000..0d6f171
--- /dev/null
+++ b/xbmc/addons/gui/skin/SkinTimers.dox
@@ -0,0 +1,164 @@
+/*!
+
+\page Skin_Timers Skin Timers
+\brief **Programatic time-based resources for Skins**
+
+\tableofcontents
+
+--------------------------------------------------------------------------------
+\section Skin_Timers_sect1 Description
+
+Skin timers are skin resources that are dependent on time and can be fully controlled from skins either using
+\link page_List_of_built_in_functions **Builtin functions**\endlink or
+\link modules__infolabels_boolean_conditions **Infolabels and Boolean conditions**\endlink. One can see them
+as stopwatches that can be activated and deactivated automatically depending on the value of info expressions or simply activated/deactivated
+manually from builtins.
+The framework was created to allow skins to control the visibility of windows (and controls) depending on
+the elapsed time of timers the skin defines. Skin timers allow multiple use cases in skins, previously only available via the execution
+of python scripts:
+- Closing a specific window after x seconds have elapsed
+- Controlling the visibility of a group (or triggering an animation) depending on the elapsed time of a given timer
+- Defining a buffer time window that is kept activated for a short period of time (e.g. keep controls visible for x seconds after a player seek)
+- Executing timed actions (on timer stop or timer start)
+- etc
+
+Skin timers are defined in the `Timers.xml` file within the xml directory of the skin. The file has the following "schema":
+
+~~~~~~~~~~~~~{.xml}
+<timers>
+ <timer>...</timer>
+ <timer>...</timer>
+</timers>
+~~~~~~~~~~~~~
+
+see \link Skin_Timers_sect2 the examples section\endlink and \link Skin_Timers_sect3 the list of available tags\endlink for concrete details.
+
+\skinning_v20 Added skin timers
+
+--------------------------------------------------------------------------------
+\section Skin_Timers_sect2 Examples
+
+The following example illustrates the simplest possible skin timer. This timer is completely manual (it has to be manually started and stopped):
+
+~~~~~~~~~~~~~{.xml}
+<timer>
+ <name>mymanualtimer</name>
+ <description>100% manual timer</description>
+</timer>
+~~~~~~~~~~~~~
+
+This timer can be controlled from your skin by executing the \link Builtin_SkinStartTimer `Skin.TimerStart(mymanualtimer)` builtin\endlink or
+\link Builtin_SkinStopTimer `Skin.TimerStop(mymanualtimer)` builtin\endlink. You can define the visibility of skin elements based on the internal
+properties of the timer, such as the fact that the timer is active/running using \link Skin_TimerIsRunning `Skin.TimerIsRunning(mymanualtimer)` info\endlink
+or depending on the elapsed time (e.g. 5 seconds) using the \link Skin_TimerElapsedSecs Integer.IsGreaterOrEqual(Skin.TimerElapsedSecs(mymanualtimer),5) info\endlink.
+
+The following timer is a variation of the previous timer but with the added ability of being automatically stopped by the skinning engine after a maximum of elapsed
+5 seconds without having to issue the `Skin.TimerStop(mymanualtimer)` builtin:
+
+~~~~~~~~~~~~~{.xml}
+<timer>
+ <name>mymanualautocloseabletimer</name>
+ <description>100% manual autocloseable timer</description>
+ <stop>Integer.IsGreaterOrEqual(Skin.TimerElapsedSecs(mymanualautocloseabletimer),5)</stop>
+</timer>
+~~~~~~~~~~~~~
+
+This type of timer is particularly useful if you want to automatically close a specific window (or triggering a close animation) after x time has elapsed,
+while guaranteeing the timer is also stopped. See the example below:
+
+~~~~~~~~~~~~~{.xml}
+<?xml version="1.0" encoding="utf-8"?>
+<window type="dialog" id="1109">
+ <onload>Skin.TimerStart(mymanualautocloseabletimer)</onload>
+ ...
+ <controls>
+ <control type="group">
+ <animation effect="slide" start="0,0" end="0,-80" time="300" condition="Integer.IsGreaterOrEqual(Skin.TimerElapsedSecs(mymanualautocloseabletimer),5)">Conditional</animation>
+ ...
+ </control>
+ </controls>
+</window>
+~~~~~~~~~~~~~
+
+The following timer presents a notification (for 1 sec) whenever the timer is activated or deactivated:
+
+~~~~~~~~~~~~~{.xml}
+<timer>
+ <name>manualtimerwithactions</name>
+ <description>100% manual timer with actions</description>
+ <onstart>Notification(skintimer, My timer was started, 1000)</onstart>
+ <onstop>Notification(skintimer, My timer was stopped, 1000)</onstop>
+</timer>
+~~~~~~~~~~~~~
+
+The following timer is an example of a completely automatic timer. The timer is automatically activated or deactivated based on the value
+of boolean info expressions. In this particular example, the timer is automatically started whenever the Player is playing a file (if not already running). It is stopped if
+there is no file being played (and of course if previously running). Since the timer can be activated/deactivated multiple times, `reset="true"` ensures the timer is
+always reset to 0 on each start operation. Whenever the timer is started or stopped, notifications are issued.
+
+~~~~~~~~~~~~~{.xml}
+<timer>
+ <name>myautomatictimer</name>
+ <description>Player state checker</description>
+ <start reset="true">Player.Playing</start>
+ <stop>!Player.Playing</stop>
+ <onstart>Notification(skintimer, Player has started playing a file, 1000)</onstart>
+ <onstop>Notification(skintimer, Player is no longer playing a file, 1000)</onstop>
+</timer>
+~~~~~~~~~~~~~
+
+In certain situations you might want to reset your timer without having to stop and start. For instance, if you want to stop the timer after 5 seconds
+but have the timer resetting to 0 seconds if the user provides some input to Kodi. For such cases the `<reset/>` condition can be used:
+
+~~~~~~~~~~~~~{.xml}
+<timer>
+ <name>windowtimer</name>
+ <description>Reset on idle</description>
+ <start reset="true">Window.IsActive(mywindow)</start>
+ <reset>Window.IsActive(mywindow) + !System.IdleTime(1) + Integer.IsGreaterOrEqual(Skin.TimerElapsedSecs(windowtimer), 1)</reset>
+ <stop>!Window.IsActive(mywindow) + Integer.IsGreaterOrEqual(Skin.TimerElapsedSecs(windowtimer), 5)</stop>
+ <onstop>Dialog.Close(mywindow)</onstop>
+</timer>
+~~~~~~~~~~~~~
+
+Finer conditional granularity can also be applied to the `onstop` or `onstart` actions. This allows the skinner to create generic timers which respect a
+limited set of conditions but trigger different actions depending on a condition applied only to the action.
+The following timer plays the trailer of a given item when the user is in the videos window, the item has a trailer, the player is not playing and the
+global idle time is greater than 3 seconds.
+As you can see, the first action (notification) is triggered for any item. The actual playback, on the other hand, will only play if the focused
+item has the label "MyAwesomeMovie".
+
+~~~~~~~~~~~~~{.xml}
+<timer>
+ <name>trailer_autoplay_idle_timer</name>
+ <start reset="true">System.IdleTime(3) + Window.IsVisible(videos) + !Player.HasMedia + !String.IsEmpty(ListItem.Trailer)</start>
+ <onstart>Notification(skintimer try play, $INFO[ListItem.Trailer], 1000)</onstart>
+ <onstart condition="String.IsEqual(ListItem.Label,MyAwesomeMovie)">PlayMedia($INFO[ListItem.Trailer],1,noresume)</onstart>
+</timer>
+~~~~~~~~~~~~~
+
+--------------------------------------------------------------------------------
+\section Skin_Timers_sect3 Available tags
+
+Skin timers have the following available tags:
+
+| Tag | Description |
+|--------------:|:--------------------------------------------------------------|
+| name | The unique name of the timer. The name is used as the id of the timer, hence needs to be unique. <b>(required)</b>
+| description | The description of the timer, a helper string. <b>(optional)</b>
+| start | An info bool expression that the skinning engine should use to automatically start the timer <b>(optional)</b>
+| reset | An info bool expression that the skinning engine should use to automatically reset the timer <b>(optional)</b>
+| stop | An info bool expression that the skinning engine should use to automatically stop the timer <b>(optional)</b>
+| onstart | A builtin function that the skinning engine should execute when the timer is started <b>(optional)</b><b>(can be repeated)</b>. Supports an additional `"condition"` as element attribute.
+| onstop | A builtin function that the skinning engine should execute when the timer is stopped <b>(optional)</b><b>(can be repeated)</b>. Supports an additional `"condition"` as element attribute.
+
+@note If multiple onstart or onstop actions exist, their execution is triggered sequentially.
+@note Both onstart and onstop actions support fine-grained conditional granularity by specifying a "condition" attribute (see the examples above).
+
+--------------------------------------------------------------------------------
+\section Skin_Timers_sect4 See also
+#### Development:
+
+- [Skinning](http://kodi.wiki/view/Skinning)
+
+*/