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);
|
---|
49 | QPixmap muteIcon() { return muteButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
50 | QPixmap maxIcon() { return maxButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
51 | QPixmap fullscreenIcon() { return fullscreenButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
52 | QPixmap playlistIcon() { return playlistButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
53 | QPixmap equalizerIcon() { return equalizerButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
54 | QPixmap volumebarPix() { return volumeBar->centerIcon(); }
|
---|
55 | QPixmap volumebarProgressPix() { return volumeBar->progressIcon(); }
|
---|
56 | QPixmap volumeKnobPix() { return volumeBar->knobIcon(); }
|
---|
57 |
|
---|
58 | void setMuteIcon( QPixmap pix) { setButtonIcons(muteButton, pix);}
|
---|
59 | void setMaxIcon( QPixmap pix) { setButtonIcons(maxButton, pix);}
|
---|
60 | void setFullscreenIcon( QPixmap pix) {setButtonIcons(fullscreenButton, pix);}
|
---|
61 | void setPlaylistIcon( QPixmap pix) {setButtonIcons(playlistButton, pix);}
|
---|
62 | void setEqualizerIcon( QPixmap pix) {setButtonIcons(equalizerButton, pix);}
|
---|
63 | void setVolumebarPix(QPixmap pix) { volumeBar->setCenterIcon(pix);}
|
---|
64 | void setVolumebarProgressPix(QPixmap pix) { volumeBar->setProgressIcon(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:
|
---|
74 | void setVolumeMax() { volumeBar->setValue( volumeBar->maximum()); }
|
---|
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
|
---|