2024-02-17 22:51:19 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
2024-08-09 01:20:25 +00:00
|
|
|
#pragma once
|
2024-02-17 22:51:19 +00:00
|
|
|
|
|
|
|
#include "breezeanimation.h"
|
|
|
|
#include "breezeanimationdata.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QTextStream>
|
2024-08-09 01:20:25 +00:00
|
|
|
|
2024-02-17 22:51:19 +00:00
|
|
|
namespace Breeze
|
|
|
|
{
|
|
|
|
//* generic data
|
|
|
|
class GenericData : public AnimationData
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
//* declare opacity property
|
|
|
|
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
|
|
|
|
|
|
|
|
public:
|
|
|
|
//* constructor
|
2024-08-09 01:20:25 +00:00
|
|
|
GenericData(QObject *parent, QObject *target, int duration);
|
2024-02-17 22:51:19 +00:00
|
|
|
|
|
|
|
//* return animation object
|
|
|
|
const Animation::Pointer &animation() const
|
|
|
|
{
|
|
|
|
return _animation;
|
|
|
|
}
|
|
|
|
|
|
|
|
//* duration
|
|
|
|
void setDuration(int duration) override
|
|
|
|
{
|
|
|
|
_animation.data()->setDuration(duration);
|
|
|
|
}
|
|
|
|
|
|
|
|
//* opacity
|
|
|
|
qreal opacity() const
|
|
|
|
{
|
|
|
|
return _opacity;
|
|
|
|
}
|
|
|
|
|
|
|
|
//* opacity
|
|
|
|
void setOpacity(qreal value)
|
|
|
|
{
|
|
|
|
value = digitize(value);
|
|
|
|
if (_opacity == value) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_opacity = value;
|
|
|
|
setDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
//* animation handling
|
|
|
|
Animation::Pointer _animation;
|
|
|
|
|
|
|
|
//* opacity variable
|
|
|
|
qreal _opacity = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|