Torc  0.1
torctransitioncontrol.h
Go to the documentation of this file.
1 #ifndef TORCTRANSITIONCONTROL_H
2 #define TORCTRANSITIONCONTROL_H
3 
4 // Qt
5 #include <QEasingCurve>
6 #include <QPropertyAnimation>
7 
8 // Torc
9 #include "torccontrol.h"
10 
12 {
13  Q_OBJECT
14  Q_PROPERTY(double animationValue READ GetAnimationValue() WRITE SetAnimationValue(Value) CONSTANT)
15 
16  public:
17  TorcTransitionControl(const QString &Type, const QVariantMap &Details);
19 
20  static QEasingCurve::Type EasingCurveFromString (const QString &Curve);
21  static QString StringFromEasingCurve (QEasingCurve::Type Type);
22  bool Validate (void) override;
23  TorcControl::Type GetType (void) const override;
24  QStringList GetDescription (void) override;
25 
26  static qreal LinearLEDFunction (qreal progress);
27 
28  public slots:
29  bool event (QEvent *Event) override;
30  void Restart (void);
31  void SetAnimationValue (double Value);
32  double GetAnimationValue (void);
33 
34  private:
35  void CalculateOutput (void) override;
36 
37  private:
38  quint64 m_duration;
39  QEasingCurve::Type m_type;
40  QPropertyAnimation m_animation;
41  double animationValue;
42  bool m_firstTrigger;
43  double m_transitionValue; // tracks the input value to filter transitions
44 };
45 
46 #endif // TORCTRANSITIONCONTROL_H
void SetAnimationValue(double Value)
Our main output, value, is read only. So the animation operates on a proxy, animationValue.
bool event(QEvent *Event) override