[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 |
|
---|
| 21 | #ifndef MEDIAPANEL_H
|
---|
| 22 | #define MEDIAPANEL_H
|
---|
| 23 |
|
---|
[165] | 24 | #include <QWidget>
|
---|
[137] | 25 | #include <QPixmap>
|
---|
| 26 | #include <QLabel>
|
---|
| 27 | #include "ui_mediapanel.h"
|
---|
| 28 | #include "mybutton.h"
|
---|
| 29 | #include "panelseeker.h"
|
---|
| 30 |
|
---|
[156] | 31 | class QGridLayout;
|
---|
| 32 |
|
---|
[137] | 33 | class ScrollingLabel : public QWidget
|
---|
| 34 | {
|
---|
| 35 | Q_OBJECT
|
---|
| 36 |
|
---|
| 37 | public:
|
---|
| 38 | ScrollingLabel(QWidget* parent=0);
|
---|
| 39 | ~ScrollingLabel(){}
|
---|
| 40 | QString text() { return mText; }
|
---|
| 41 | void setText( QString text);
|
---|
| 42 |
|
---|
[176] | 43 | void setScrollingEnabled(bool b);
|
---|
| 44 | bool scrollingEnabled() { return scrolling_enabled; };
|
---|
| 45 |
|
---|
[137] | 46 | private:
|
---|
| 47 | QString mText;
|
---|
| 48 | void updateLabel();
|
---|
| 49 | int scrollPos;
|
---|
| 50 | int timerId;
|
---|
| 51 | QRect textRect;
|
---|
[176] | 52 | static const int gap = 10;
|
---|
| 53 | bool scrolling_enabled;
|
---|
[137] | 54 |
|
---|
| 55 | protected:
|
---|
| 56 | void paintEvent(QPaintEvent *);
|
---|
| 57 | void changeEvent(QEvent *);
|
---|
| 58 | void resizeEvent(QResizeEvent *);
|
---|
| 59 | QSize sizeHint() const;
|
---|
| 60 |
|
---|
| 61 | private slots:
|
---|
| 62 | void timerEvent(QTimerEvent *);
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | class MediaPanel : public QWidget
|
---|
| 66 | {
|
---|
| 67 | Q_OBJECT
|
---|
| 68 | Q_PROPERTY(QPixmap bgLeft READ bgLeftPix WRITE setBgLeftPix)
|
---|
| 69 | Q_PROPERTY(QPixmap bgRight READ bgRightPix WRITE setBgRightPix)
|
---|
| 70 | Q_PROPERTY(QPixmap bgCenter READ bgCenterPix WRITE setBgCenterPix)
|
---|
| 71 |
|
---|
| 72 | public:
|
---|
| 73 | MediaPanel(QWidget *parent = 0);
|
---|
| 74 | ~MediaPanel();
|
---|
| 75 | QPixmap bgLeftPix() { return leftBackground ;}
|
---|
| 76 | void setBgLeftPix( QPixmap pix){ leftBackground = pix; }
|
---|
| 77 | QPixmap bgRightPix() { return rightBackground ;}
|
---|
| 78 | void setBgRightPix( QPixmap pix){ rightBackground = pix; }
|
---|
| 79 | QPixmap bgCenterPix() { return centerBackground ;}
|
---|
| 80 | void setBgCenterPix( QPixmap pix){ centerBackground = pix; }
|
---|
| 81 | void setShuffleIcon( MyIcon icon );
|
---|
| 82 | void setRepeatIcon(MyIcon icon);
|
---|
| 83 | void setElapsedText(QString text) {
|
---|
| 84 | elapsedLabel->setText(text);
|
---|
| 85 | if(seeker->states().testFlag(PanelSeeker::Buffering))
|
---|
| 86 | setBuffering(false);
|
---|
| 87 | }
|
---|
| 88 | void setTotalText( QString text) { totalLabel->setText(text); }
|
---|
| 89 | void setActionCollection(QList<QAction*> actions);
|
---|
| 90 | void setMplayerState(int state);
|
---|
| 91 | void setDuration(int duration);
|
---|
| 92 | void setMediaLabelText(QString text);
|
---|
[156] | 93 | void setResolutionLabelText(QString text);
|
---|
[137] | 94 | void setStatusText(QString text, int time = 2000);
|
---|
| 95 | void setBuffering(bool enable);
|
---|
| 96 | bool eventFilter(QObject *object, QEvent *event);
|
---|
| 97 |
|
---|
| 98 | public slots:
|
---|
| 99 | void setSeeker(int v);
|
---|
[156] | 100 | void setResolutionVisible(bool b);
|
---|
[176] | 101 | void setScrollingEnabled(bool b);
|
---|
[137] | 102 |
|
---|
| 103 | private:
|
---|
| 104 | Ui::MediaPanelClass ui;
|
---|
[156] | 105 | QGridLayout * layout;
|
---|
[137] | 106 | QPixmap leftBackground;
|
---|
| 107 | QPixmap centerBackground;
|
---|
| 108 | QPixmap rightBackground;
|
---|
| 109 | ScrollingLabel* mediaLabel;
|
---|
[156] | 110 | QLabel *resolutionLabel;
|
---|
[170] | 111 | PanelTimeSeeker* seeker;
|
---|
[137] | 112 | MyButton* repeatButton;
|
---|
| 113 | MyButton* shuffleButton;
|
---|
| 114 | QLabel* elapsedLabel;
|
---|
| 115 | QLabel* totalLabel;
|
---|
| 116 | QString originalTitle;
|
---|
| 117 | QTimer* timer;
|
---|
| 118 | int duration;
|
---|
| 119 |
|
---|
| 120 | private slots:
|
---|
| 121 | void reverseStatus();
|
---|
[156] | 122 | void rearrangeWidgets(bool resolution_visible);
|
---|
[137] | 123 |
|
---|
| 124 | protected:
|
---|
| 125 | void paintEvent(QPaintEvent *);
|
---|
| 126 | virtual void changeEvent (QEvent * event);
|
---|
| 127 | virtual void retranslateStrings();
|
---|
| 128 |
|
---|
| 129 | signals:
|
---|
| 130 | void seekerChanged(int);
|
---|
[170] | 131 | void seekerWheelUp();
|
---|
| 132 | void seekerWheelDown();
|
---|
[137] | 133 |
|
---|
| 134 | public:
|
---|
| 135 | friend class IconSetter;
|
---|
| 136 | };
|
---|
| 137 |
|
---|
| 138 | #endif // MEDIAPANEL_H
|
---|