Warning, file /multimedia/amarok/src/widgets/VolumeDial.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /****************************************************************************************
0002 * Copyright (c) 2009 Thomas Luebking <thomas.luebking@web.de>                          *
0003 *                                                                                      *
0004 * This program is free software; you can redistribute it and/or modify it under        *
0005 * the terms of the GNU General Public License as published by the Free Software        *
0006 * Foundation; either version 2 of the License, or (at your option) any later           *
0007 * version.                                                                             *
0008 *                                                                                      *
0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012 *                                                                                      *
0013 * You should have received a copy of the GNU General Public License along with         *
0014 * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015 ****************************************************************************************/
0016 
0017 #ifndef VOLUMEDIAL_H
0018 #define VOLUMEDIAL_H
0019 
0020 #include <QDial>
0021 
0022 
0023 class VolumeDial : public QDial
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     explicit VolumeDial( QWidget *parent = nullptr );
0029     /**
0030         Add a list of widgets that should not hide the tooltip on wheelevents, but instead cause
0031         wheelevents on the dial
0032         You do NOT have to remove them on deconstruction.
0033     */
0034     void addWheelProxies( const QList<QWidget*> &proxies );
0035     QSize sizeHint() const override;
0036 
0037 public Q_SLOTS:
0038     /**
0039        Remove an added wheelproxy. The slot is automatically bound to the widgets deconstruction
0040        signal when added. You don't have to do that.
0041     */
0042     void removeWheelProxy( QObject * );
0043     void setMuted( bool mute );
0044 
0045 Q_SIGNALS:
0046     void muteToggled( bool mute );
0047 
0048 protected:
0049     void enterEvent( QEvent * ) override;
0050     bool eventFilter( QObject *o, QEvent *e ) override;
0051     void leaveEvent( QEvent * ) override;
0052     void paintEvent( QPaintEvent * ) override;
0053     void mouseMoveEvent( QMouseEvent * ) override;
0054     void mousePressEvent( QMouseEvent * ) override;
0055     void mouseReleaseEvent( QMouseEvent * ) override;
0056     void resizeEvent(QResizeEvent *) override;
0057     void sliderChange( SliderChange change ) override;
0058     void timerEvent ( QTimerEvent * ) override;
0059     friend class MainToolbar;
0060     void wheelEvent( QWheelEvent * ) override;
0061 
0062 private:
0063     void startFade();
0064     void stopFade();
0065     void renderIcons();
0066     void updateSliderGradient();
0067 
0068 private Q_SLOTS:
0069     void paletteChanged( const QPalette &palette );
0070     void valueChangedSlot( int );
0071 
0072 private:
0073     QPixmap m_icon[4];
0074     QPixmap m_sliderGradient;
0075     int m_formerValue;
0076     QList<QWidget*> m_wheelProxies;
0077     struct
0078     {
0079         int step;
0080         int timer;
0081     } m_anim;
0082     bool m_isClick, m_isDown, m_muted;
0083     QColor m_highlightColor;
0084 };
0085 
0086 #endif  // end include guard