xbmc
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  INFO::InfoPtr GetStartCondition() const;
60 
64  INFO::InfoPtr GetResetCondition() const;
65 
69  INFO::InfoPtr GetStopCondition() const;
70 
75  bool VerifyStartCondition() const;
76 
81  bool VerifyResetCondition() const;
82 
87  bool VerifyStopCondition() const;
88 
89 private:
91  void OnStart();
92 
94  void OnStop();
95 
97  std::string m_name;
99  INFO::InfoPtr m_startCondition;
101  INFO::InfoPtr m_resetCondition;
103  INFO::InfoPtr m_stopCondition;
105  CGUIAction m_startActions;
107  CGUIAction m_stopActions;
109  bool m_resetOnStart{false};
110 };
Definition: Stopwatch.h:14
bool VerifyStartCondition() const
Evaluates the timer start boolean info expression returning the respective result.
Definition: SkinTimer.cpp:53
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:68
INFO::InfoPtr GetStopCondition() const
Getter for the timer start boolean condition/expression.
Definition: SkinTimer.cpp:78
INFO::InfoPtr GetResetCondition() const
Getter for the timer reset boolean condition/expression.
Definition: SkinTimer.cpp:73
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
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
virtual ~CSkinTimer()=default
Default skin timer destructor.
Class containing vector of condition->(action/navigation route) and handling its execution.
Definition: GUIAction.h:21