kodi
SkinTimer.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "guilib/GUIAction.h"
12 #include "interfaces/info/InfoExpression.h"
13 #include "utils/Stopwatch.h"
14 
15 #include <memory>
16 #include <string>
17 
18 class TiXmlElement;
19 
24 class CSkinTimer : public CStopWatch
25 {
26 public:
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);
43 
45  virtual ~CSkinTimer() = default;
46 
48  void Start();
49 
51  void Reset();
52 
54  void Stop();
55 
59  const std::string& GetName() const;
60 
64  INFO::InfoPtr GetStartCondition() const;
65 
69  INFO::InfoPtr GetResetCondition() const;
70 
74  INFO::InfoPtr GetStopCondition() const;
75 
79  bool ResetsOnStart() const;
80 
84  const CGUIAction& GetStartActions() const;
85 
89  const CGUIAction& GetStopActions() const;
90 
95  bool VerifyStartCondition() const;
96 
101  bool VerifyResetCondition() const;
102 
107  bool VerifyStopCondition() const;
108 
109 private:
111  void OnStart();
112 
114  void OnStop();
115 
117  std::string m_name;
119  INFO::InfoPtr m_startCondition;
121  INFO::InfoPtr m_resetCondition;
123  INFO::InfoPtr m_stopCondition;
125  CGUIAction m_startActions;
127  CGUIAction m_stopActions;
129  bool m_resetOnStart{false};
130 };
Definition: Stopwatch.h:14
bool VerifyStartCondition() const
Evaluates the timer start boolean info expression returning the respective result.
Definition: SkinTimer.cpp:53
bool ResetsOnStart() const
Checks if a given timer is configured to reset every time it starts.
Definition: SkinTimer.cpp:98
void Reset()
Resets the skin timer so that the elapsed time of the timer is 0.
Definition: SkinTimer.cpp:42
void Stop()
stops the skin timer
Definition: SkinTimer.cpp:47
bool VerifyStopCondition() const
Evaluates the timer stop boolean info expression returning the respective result. ...
Definition: SkinTimer.cpp:63
INFO::InfoPtr GetStartCondition() const
Getter for the timer start boolean condition/expression.
Definition: SkinTimer.cpp:73
INFO::InfoPtr GetStopCondition() const
Getter for the timer start boolean condition/expression.
Definition: SkinTimer.cpp:83
INFO::InfoPtr GetResetCondition() const
Getter for the timer reset boolean condition/expression.
Definition: SkinTimer.cpp:78
Skin timers are skin objects that dependent on time and can be fully controlled from skins either usi...
Definition: SkinTimer.h:24
void Start()
Start the skin timer.
Definition: SkinTimer.cpp:29
const std::string & GetName() const
Getter for the timer name.
Definition: SkinTimer.cpp:68
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)
Skin timer constructor.
Definition: SkinTimer.cpp:12
bool VerifyResetCondition() const
Evaluates the timer reset boolean info expression returning the respective result.
Definition: SkinTimer.cpp:58
const CGUIAction & GetStopActions() const
Gets the stop actions of this skin timer.
Definition: SkinTimer.cpp:93
virtual ~CSkinTimer()=default
Default skin timer destructor.
const CGUIAction & GetStartActions() const
Gets the start actions of this skin timer.
Definition: SkinTimer.cpp:88
Class containing vector of condition->(action/navigation route) and handling its execution.
Definition: GUIAction.h:21