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 "breezeanimation.h" 0010 #include "breezebaseengine.h" 0011 #include "breezebusyindicatordata.h" 0012 #include "breezedatamap.h" 0013 0014 namespace Breeze 0015 { 0016 //* handles progress bar animations 0017 class BusyIndicatorEngine : public BaseEngine 0018 { 0019 Q_OBJECT 0020 0021 //* declare opacity property 0022 Q_PROPERTY(int value READ value WRITE setValue) 0023 0024 public: 0025 //* constructor 0026 explicit BusyIndicatorEngine(QObject *); 0027 0028 //*@name accessors 0029 //@{ 0030 0031 //* true if widget is animated 0032 bool isAnimated(const QObject *); 0033 0034 //* value 0035 int value() const 0036 { 0037 return _value; 0038 } 0039 0040 //@} 0041 0042 //*@name modifiers 0043 //@{ 0044 0045 //* register progressbar 0046 bool registerWidget(QObject *); 0047 0048 //* duration 0049 void setDuration(int) override; 0050 0051 //* set object as animated 0052 void setAnimated(const QObject *, bool); 0053 0054 //* opacity 0055 void setValue(int value); 0056 0057 //@} 0058 0059 public Q_SLOTS: 0060 0061 //* remove widget from map 0062 bool unregisterWidget(QObject *) override; 0063 0064 protected: 0065 //* returns data associated to widget 0066 DataMap<BusyIndicatorData>::Value data(const QObject *); 0067 0068 private: 0069 //* map widgets to progressbar data 0070 DataMap<BusyIndicatorData> _data; 0071 0072 //* animation 0073 Animation::Pointer _animation; 0074 0075 //* value 0076 int _value = 0; 0077 }; 0078 0079 }