VLC-Qt 0.8.0- (Different version)
WidgetVolumeSlider.h
00001 /****************************************************************************
00002 * VLC-Qt - Qt and libvlc connector library
00003 * Copyright (C) 2012 Tadej Novak <tadej@tano.si>
00004 *
00005 * This library is free software: you can redistribute it and/or modify
00006 * it under the terms of the GNU Lesser General Public License as published
00007 * by the Free Software Foundation, either version 3 of the License, or
00008 * (at your option) any later version.
00009 *
00010 * This library is distributed in the hope that it will be useful,
00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 * GNU Lesser General Public License for more details.
00014 *
00015 * You should have received a copy of the GNU Lesser General Public License
00016 * along with this library. If not, see <http://www.gnu.org/licenses/>.
00017 *****************************************************************************/
00018 
00019 #ifndef VLCQT_WIDGETVOLUMESLIDER_H_
00020 #define VLCQT_WIDGETVOLUMESLIDER_H_
00021 
00022 #include <QWidget>
00023 
00024 #include "SharedExportWidgets.h"
00025 
00026 class QLabel;
00027 class QSlider;
00028 class QTimer;
00029 
00030 class VlcAudio;
00031 class VlcMediaPlayer;
00032 
00040 class VLCQT_WIDGETS_EXPORT VlcWidgetVolumeSlider : public QWidget
00041 {
00042 Q_OBJECT
00043 public:
00050     explicit VlcWidgetVolumeSlider(VlcMediaPlayer *player,
00051                              QWidget *parent = 0);
00052 
00057     explicit VlcWidgetVolumeSlider(QWidget *parent = 0);
00058 
00062     ~VlcWidgetVolumeSlider();
00063 
00064 
00069     void setMediaPlayer(VlcMediaPlayer *player);
00070 
00071 public slots:
00076     bool mute() const;
00077 
00082     void setMute(const bool &enabled);
00083 
00088     void setVolume(const int &volume);
00089 
00094     int volume() const;
00095 
00103     void volumeControl(const bool &up);
00104 
00112     void volumeDown() { volumeControl(false); }
00113 
00121     void volumeUp() { volumeControl(true); }
00122 
00123 signals:
00128     void newVolume(const int &);
00129 
00130 protected:
00131     void mousePressEvent(QMouseEvent *event);
00132     void mouseReleaseEvent(QMouseEvent *event);
00133 
00134 private slots:
00135     void updateVolume();
00136 
00137 private:
00138     void initWidgetVolumeSlider();
00139 
00140     bool _lock;
00141 
00142     void lock();
00143     void unlock();
00144 
00145     VlcAudio *_vlcAudio;
00146     VlcMediaPlayer *_vlcMediaPlayer;
00147 
00148     int _currentVolume;
00149 
00150     QSlider *_slider;
00151     QLabel *_label;
00152     QTimer *_timer;
00153 };
00154 
00155 #endif // VLCQT_WIDGETVOLUMESLIDER_H_
 All Classes Namespaces Functions Enumerations