raDIYo 0.4
swabstractcontrol.cpp
1/***************************************************************************
2
3 source::worx raDIYo
4 Copyright © 2020-2022 c.holzheuer
5 c.holzheuer@sourceworx.org
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12***************************************************************************/
13
14
15#include <QDebug>
16#include <QPainter>
17#include <QLinearGradient>
18#include <QGraphicsOpacityEffect>
19
20#include <swabstractcontrol.h>
21#include <swradiyomainwidget.h>
22
23SWAbstractControl::SWAbstractControl( SWRaDIYoMainWidget* parent )
24 : QWidget( parent ), _controller( parent )
25{
26
27 _effect = new QGraphicsOpacityEffect;
28 //setGraphicsEffect( _effect );
29
30 _animFadeIn = new QPropertyAnimation( _effect, "opacity" );
31 _animFadeIn->setDuration( SWFADINGDURATION );
32 _animFadeIn->setStartValue( 0.0 );
33 _animFadeIn->setEndValue( 1.0 );
34 //_animFadeIn->setEasingCurve( QEasingCurve::InBack );
35
36 _animFadeOut = new QPropertyAnimation( _effect, "opacity" );
37 _animFadeOut->setDuration( SWFADINGDURATION );
38 _animFadeOut->setStartValue( 1.0 );
39 _animFadeOut->setEndValue( 0.0 );
40 //_animFadeOut->setEasingCurve( QEasingCurve::OutBack );
41 //??
42 connect( _animFadeOut, &QPropertyAnimation::finished, [=] { hide(); } );
43
44 hide();
45
46
47
48}
49
50
51SWAbstractControl::~SWAbstractControl()
52{
53 // ??
54 //saveSettings();
55 delete _effect;
56 delete _animFadeIn;
57 delete _animFadeOut;
58}
59
60bool SWAbstractControl::acceptDial()
61{
62 return _acceptDial;
63}
64
65
71{
72 qDebug() << "onDialClicked()";
73}
74
75
81{
82 Q_UNUSED( value )
83 qDebug() << "onDialValueChanged( int value )";
84}
85
86
87
88void SWAbstractControl::fadeIn()
89{
90 show();
91 setGraphicsEffect( _effect );
92 _animFadeIn->start();
93}
94
95
96void SWAbstractControl::fadeOut()
97{
98
99 setGraphicsEffect( _effect );
100 _animFadeOut->start();
101
102}
103
virtual void onDialClicked()
Wird aufgerufen, wenn das (externe) Dial geklickt wurde.
virtual void onDialValueChanged(int value)
Wird aufgerufen, wenn das (externe) Dial gedreht wurde.