File indexing completed on 2024-05-19 05:35:19
0001 #ifndef oxygengeneric_data_h 0002 #define oxygengeneric_data_h 0003 0004 ////////////////////////////////////////////////////////////////////////////// 0005 // oxygengenericdata.h 0006 // generic data container for animations 0007 // ------------------- 0008 // 0009 // SPDX-FileCopyrightText: 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0010 // 0011 // SPDX-License-Identifier: MIT 0012 ////////////////////////////////////////////////////////////////////////////// 0013 0014 #include "oxygenanimation.h" 0015 #include "oxygenanimationdata.h" 0016 0017 #include <QObject> 0018 #include <QTextStream> 0019 namespace Oxygen 0020 { 0021 //* generic data 0022 class GenericData : public AnimationData 0023 { 0024 Q_OBJECT 0025 0026 //* declare opacity property 0027 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) 0028 0029 public: 0030 //* constructor 0031 GenericData(QObject *parent, QWidget *widget, int duration); 0032 0033 //* return animation object 0034 virtual const Animation::Pointer &animation() const 0035 { 0036 return _animation; 0037 } 0038 0039 //* opacity 0040 virtual qreal opacity(void) const 0041 { 0042 return _opacity; 0043 } 0044 0045 //* duration 0046 void setDuration(int duration) override 0047 { 0048 _animation.data()->setDuration(duration); 0049 } 0050 0051 //* opacity 0052 virtual void setOpacity(qreal value) 0053 { 0054 value = digitize(value); 0055 if (_opacity == value) 0056 return; 0057 0058 _opacity = value; 0059 setDirty(); 0060 } 0061 0062 private: 0063 //* animation handling 0064 Animation::Pointer _animation; 0065 0066 //* opacity variable 0067 qreal _opacity = 0; 0068 }; 0069 } 0070 0071 #endif