File indexing completed on 2024-05-19 05:35:21

0001 #ifndef oxygenprogressbardata_h
0002 #define oxygenprogressbardata_h
0003 
0004 //////////////////////////////////////////////////////////////////////////////
0005 // oxygenprogressbardata.h
0006 // data container for progressbar 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 "oxygengenericdata.h"
0015 #include <QObject>
0016 #include <QTextStream>
0017 
0018 namespace Oxygen
0019 {
0020 //* generic data
0021 class ProgressBarData : public GenericData
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     //* constructor
0027     ProgressBarData(QObject *parent, QWidget *widget, int duration);
0028 
0029     //* event filter
0030     bool eventFilter(QObject *, QEvent *) override;
0031 
0032     //* progressbar value (during animation)
0033     int value(void) const
0034     {
0035         return _startValue + opacity() * (_endValue - _startValue);
0036     }
0037 
0038 private Q_SLOTS:
0039 
0040     //* triggered by progressBar::valueChanged
0041     void valueChanged(int);
0042 
0043 private:
0044     //* animation starting value
0045     int _startValue = 0;
0046 
0047     //* animation ending value
0048     int _endValue = 0;
0049 };
0050 }
0051 
0052 #endif