[137] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[137] | 3 | umplayer, Copyright (C) 2010 Ori Rejwan
|
---|
| 4 |
|
---|
| 5 | This program is free software; you can redistribute it and/or modify
|
---|
| 6 | it under the terms of the GNU General Public License as published by
|
---|
| 7 | the Free Software Foundation; either version 2 of the License, or
|
---|
| 8 | (at your option) any later version.
|
---|
| 9 |
|
---|
| 10 | This program is distributed in the hope that it will be useful,
|
---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | GNU General Public License for more details.
|
---|
| 14 |
|
---|
| 15 | You should have received a copy of the GNU General Public License
|
---|
| 16 | along with this program; if not, write to the Free Software
|
---|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 18 | */
|
---|
| 19 |
|
---|
| 20 | #ifndef PLAYCONTROL_H
|
---|
| 21 | #define PLAYCONTROL_H
|
---|
| 22 |
|
---|
| 23 | #include <QWidget>
|
---|
| 24 | #include <QPushButton>
|
---|
| 25 | #include <QHBoxLayout>
|
---|
| 26 | #include <QPixmap>
|
---|
| 27 | #include "myicon.h"
|
---|
| 28 | #include "mybutton.h"
|
---|
| 29 |
|
---|
| 30 | class MyAction;
|
---|
| 31 |
|
---|
| 32 | class PlayControl : public QWidget
|
---|
| 33 | {
|
---|
| 34 | Q_OBJECT
|
---|
| 35 |
|
---|
| 36 | public:
|
---|
| 37 | explicit PlayControl(QWidget *parent = 0);
|
---|
| 38 |
|
---|
| 39 | private:
|
---|
| 40 | MyButton* backwardButton;
|
---|
| 41 | MyButton* previousButton;
|
---|
| 42 | MyButton* playPauseButton;
|
---|
| 43 | MyButton* stopButton;
|
---|
| 44 | MyButton* nextButton;
|
---|
| 45 | MyButton* forwardButton;
|
---|
| 46 | MyButton* recordButton;
|
---|
| 47 | QHBoxLayout* layout;
|
---|
| 48 | bool playOrPause;
|
---|
| 49 | void updateSize();
|
---|
| 50 | void updateWidths();
|
---|
| 51 |
|
---|
| 52 | public:
|
---|
| 53 | QPixmap backwardIcon();
|
---|
| 54 | void setRecordEnabled(bool enable) { recordButton->setEnabled(enable); updateWidths();}
|
---|
| 55 | void setPreviousTrackEnabled(bool enable) { previousButton->setEnabled(enable); updateWidths();}
|
---|
| 56 | void setNextTrackEnabled(bool enable) { nextButton->setEnabled(enable); updateWidths();}
|
---|
| 57 | void setPlay(bool on) { playOrPause = on; playPauseButton->setState(on); }
|
---|
| 58 |
|
---|
| 59 | void setBackwardIcon(MyIcon icon ) { backwardButton->setMyIcon(icon); backwardButton->setFixedSize(icon.size(MyIcon::Normal, MyIcon::Off)); updateWidths(); }
|
---|
| 60 | void setForwardIcon(MyIcon icon) { forwardButton->setMyIcon(icon); forwardButton->setFixedSize(icon.size(MyIcon::Normal, MyIcon::Off)); updateWidths(); }
|
---|
| 61 | void setPreviousIcon(MyIcon icon) { previousButton->setMyIcon(icon); previousButton->setFixedSize(icon.size(MyIcon::Normal, MyIcon::Off)); updateWidths();}
|
---|
| 62 | void setNextIcon(MyIcon icon) { nextButton->setMyIcon(icon); nextButton->setFixedSize(icon.size(MyIcon::Normal, MyIcon::Off)); updateWidths();}
|
---|
| 63 | void setPlayPauseIcon (MyIcon icon) { playPauseButton->setMyIcon(icon); playPauseButton->setFixedSize(icon.size(MyIcon::Normal, MyIcon::Off));updateWidths();}
|
---|
| 64 | void setStopIcon (MyIcon icon) { stopButton->setMyIcon(icon); stopButton->setFixedSize(icon.size(MyIcon::Normal, MyIcon::Off)); updateWidths();}
|
---|
| 65 | void setRecordIcon(MyIcon icon) { recordButton->setMyIcon(icon); recordButton->setFixedSize(icon.size(MyIcon::Normal, MyIcon::Off)); updateWidths();}
|
---|
| 66 |
|
---|
| 67 | void setActionCollection(QList<QAction*> actions);
|
---|
| 68 | bool eventFilter(QObject *watched, QEvent *event);
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | protected:
|
---|
| 72 | void resizeEvent(QResizeEvent * e);
|
---|
| 73 | virtual void changeEvent (QEvent * event);
|
---|
| 74 | virtual void retranslateStrings();
|
---|
| 75 |
|
---|
| 76 | friend class IconSetter;
|
---|
| 77 | };
|
---|
| 78 |
|
---|
| 79 | #endif // PLAYCONTROL_H
|
---|