1 /* umplayer, GUI front-end for mplayer. 2 Copyright (C) 2010 Ori Rejwan 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 #ifndef VOLUMECONTROLPANEL_H 20 #define VOLUMECONTROLPANEL_H 21 22 #include <QWidget> 23 #include "mybutton.h" 24 #include "panelseeker.h" 25 26 class VolumeControlPanel : public QWidget 27 { 28 Q_OBJECT 29 Q_PROPERTY( QPixmap mute READ muteIcon WRITE setMuteIcon ) 30 Q_PROPERTY( QPixmap max READ maxIcon WRITE setMaxIcon ) 31 Q_PROPERTY( QPixmap fullscreen READ fullscreenIcon WRITE setFullscreenIcon) 32 Q_PROPERTY( QPixmap playlist READ playlistIcon WRITE setPlaylistIcon) 33 Q_PROPERTY( QPixmap equalizer READ equalizerIcon WRITE setEqualizerIcon) 34 Q_PROPERTY( QPixmap volumebar READ volumebarPix WRITE setVolumebarPix) 35 Q_PROPERTY( QPixmap volumebarProgress READ volumebarProgressPix WRITE setVolumebarProgressPix) 36 Q_PROPERTY( QPixmap volumeKnob READ volumeKnobPix WRITE setVolumeKnobPix) 37 38 private: 39 MyButton* muteButton; 40 MyButton* maxButton; 41 MyButton* fullscreenButton; 42 MyButton* playlistButton; 43 MyButton* equalizerButton; 44 PanelSeeker* volumeBar; 45 void setButtonIcons( MyButton* button, QPixmap pix); 46 47 public: 48 explicit VolumeControlPanel(QWidget *parent = 0); muteIcon()49 QPixmap muteIcon() { return muteButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); } maxIcon()50 QPixmap maxIcon() { return maxButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); } fullscreenIcon()51 QPixmap fullscreenIcon() { return fullscreenButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); } playlistIcon()52 QPixmap playlistIcon() { return playlistButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); } equalizerIcon()53 QPixmap equalizerIcon() { return equalizerButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); } volumebarPix()54 QPixmap volumebarPix() { return volumeBar->centerIcon(); } volumebarProgressPix()55 QPixmap volumebarProgressPix() { return volumeBar->progressIcon(); } volumeKnobPix()56 QPixmap volumeKnobPix() { return volumeBar->knobIcon(); } 57 setMuteIcon(QPixmap pix)58 void setMuteIcon( QPixmap pix) { setButtonIcons(muteButton, pix);} setMaxIcon(QPixmap pix)59 void setMaxIcon( QPixmap pix) { setButtonIcons(maxButton, pix);} setFullscreenIcon(QPixmap pix)60 void setFullscreenIcon( QPixmap pix) {setButtonIcons(fullscreenButton, pix);} setPlaylistIcon(QPixmap pix)61 void setPlaylistIcon( QPixmap pix) {setButtonIcons(playlistButton, pix);} setEqualizerIcon(QPixmap pix)62 void setEqualizerIcon( QPixmap pix) {setButtonIcons(equalizerButton, pix);} setVolumebarPix(QPixmap pix)63 void setVolumebarPix(QPixmap pix) { volumeBar->setCenterIcon(pix);} setVolumebarProgressPix(QPixmap pix)64 void setVolumebarProgressPix(QPixmap pix) { volumeBar->setProgressIcon(pix);} setVolumeKnobPix(QPixmap pix)65 void setVolumeKnobPix(QPixmap pix) { volumeBar->setKnobIcon(pix); } 66 void setActionCollection(QList<QAction*> actions); 67 /* bool eventFilter(QObject *watched, QEvent *event); */ 68 69 signals: 70 void volumeChanged(int); 71 void volumeSliderMoved(int); 72 73 public slots: setVolumeMax()74 void setVolumeMax() { volumeBar->setValue( volumeBar->maximum()); } setVolumeMin()75 void setVolumeMin() { volumeBar->setValue( volumeBar->minimum()); } 76 void setVolume(int value); 77 78 protected: 79 virtual void changeEvent (QEvent * event); 80 virtual void retranslateStrings(); 81 }; 82 83 #endif // VOLUMECONTROLPANEL_H 84