[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / addons / gui / skin / SkinTimer.h
blob334a816dd31658ba8454566653661e80e074ce57
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "guilib/GUIAction.h"
12 #include "interfaces/info/InfoExpression.h"
13 #include "utils/Stopwatch.h"
15 #include <memory>
16 #include <string>
18 class TiXmlElement;
20 /*! \brief Skin timers are skin objects that dependent on time and can be fully controlled from skins either using boolean
21 * conditions or builtin functions. This class represents the Skin Timer object.
22 * \sa Skin_Timers
24 class CSkinTimer : public CStopWatch
26 public:
27 /*! \brief Skin timer constructor
28 * \param name - the name of the timer
29 * \param startCondition - the boolean info expression to start the timer (may be null)
30 * \param resetCondition - the boolean info expression to reset the timer (may be null)
31 * \param stopCondition - the boolean info expression to stop the timer (may be null)
32 * \param startActions - the builtin functions to execute on timer start (actions may be empty)
33 * \param stopActions - the builtin functions to execute on timer stop (actions may be empty)
34 * \param resetOnStart - if the timer should be reset when started (i.e. start from zero if true or resumed if false)
36 CSkinTimer(const std::string& name,
37 const INFO::InfoPtr& startCondition,
38 const INFO::InfoPtr& resetCondition,
39 const INFO::InfoPtr& stopCondition,
40 const CGUIAction& startActions,
41 const CGUIAction& stopActions,
42 bool resetOnStart);
44 /*! \brief Default skin timer destructor */
45 virtual ~CSkinTimer() = default;
47 /*! \brief Start the skin timer */
48 void Start();
50 /*! \brief Resets the skin timer so that the elapsed time of the timer is 0 */
51 void Reset();
53 /*! \brief stops the skin timer */
54 void Stop();
56 /*! \brief Getter for the timer name
57 * \return the timer name
59 const std::string& GetName() const;
61 /*! \brief Getter for the timer start boolean condition/expression
62 * \return the start boolean condition/expression (may be null)
64 INFO::InfoPtr GetStartCondition() const;
66 /*! \brief Getter for the timer reset boolean condition/expression
67 * \return the reset boolean condition/expression (may be null)
69 INFO::InfoPtr GetResetCondition() const;
71 /*! \brief Getter for the timer start boolean condition/expression
72 * \return the start boolean condition/expression (may be null)
74 INFO::InfoPtr GetStopCondition() const;
76 /*! \brief Checks if a given timer is configured to reset every time it starts
77 * \return true if the timer is configured to reset on start, false otherwise
79 bool ResetsOnStart() const;
81 /*! \brief Gets the start actions of this skin timer
82 * \return the actions configured to start when the timer is started
84 const CGUIAction& GetStartActions() const;
86 /*! \brief Gets the stop actions of this skin timer
87 * \return the actions configured to start when the timer is stopped
89 const CGUIAction& GetStopActions() const;
91 /*! \brief Evaluates the timer start boolean info expression returning the respective result.
92 * \details Called from the skin timer manager to check if the timer should be started
93 * \return true if the condition is true, false otherwise
95 bool VerifyStartCondition() const;
97 /*! \brief Evaluates the timer reset boolean info expression returning the respective result.
98 * \details Called from the skin timer manager to check if the timer should be reset to 0
99 * \return true if the condition is true, false otherwise
101 bool VerifyResetCondition() const;
103 /*! \brief Evaluates the timer stop boolean info expression returning the respective result.
104 * \details Called from the skin timer manager to check if the timer should be stopped
105 * \return true if the condition is true, false otherwise
107 bool VerifyStopCondition() const;
109 private:
110 /*! \brief Called when this timer is started */
111 void OnStart();
113 /*! \brief Called when this timer is stopped */
114 void OnStop();
116 /*! The name of the skin timer */
117 std::string m_name;
118 /*! The info boolean expression that automatically starts the timer if evaluated true */
119 INFO::InfoPtr m_startCondition;
120 /*! The info boolean expression that automatically resets the timer if evaluated true */
121 INFO::InfoPtr m_resetCondition;
122 /*! The info boolean expression that automatically stops the timer if evaluated true */
123 INFO::InfoPtr m_stopCondition;
124 /*! The builtin functions to be executed when the timer is started */
125 CGUIAction m_startActions;
126 /*! The builtin functions to be executed when the timer is stopped */
127 CGUIAction m_stopActions;
128 /*! if the timer should be reset on start (or just resumed) */
129 bool m_resetOnStart{false};