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