File indexing completed on 2024-05-12 05:28:37

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 "breeze.h"
0010 
0011 #include <QObject>
0012 
0013 namespace Breeze
0014 {
0015 //* base class for all animation engines
0016 /** it is used to store configuration values used by all animations stored in the engine */
0017 class BaseEngine : public QObject
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     using Pointer = WeakPointer<BaseEngine>;
0023 
0024     //* constructor
0025     explicit BaseEngine(QObject *parent)
0026         : QObject(parent)
0027     {
0028     }
0029 
0030     //* enability
0031     virtual void setEnabled(bool value)
0032     {
0033         _enabled = value;
0034     }
0035 
0036     //* enability
0037     virtual bool enabled() const
0038     {
0039         return _enabled;
0040     }
0041 
0042     //* duration
0043     virtual void setDuration(int value)
0044     {
0045         _duration = value;
0046     }
0047 
0048     //* duration
0049     virtual int duration() const
0050     {
0051         return _duration;
0052     }
0053 
0054     //* unregister widget
0055     virtual bool unregisterWidget(QObject *object) = 0;
0056 
0057 private:
0058     //* engine enability
0059     bool _enabled = true;
0060 
0061     //* animation duration
0062     int _duration = 200;
0063 };
0064 
0065 }