source: smplayer/trunk/src/skingui/mediapanel.h@ 142

Last change on this file since 142 was 142, checked in by Silvan Scherrer, 12 years ago

SMPlayer: update trunk to 0.8.5

File size: 3.5 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net>
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
24#include <QtGui/QWidget>
25#include <QPixmap>
26#include <QLabel>
27#include "ui_mediapanel.h"
28#include "mybutton.h"
29#include "panelseeker.h"
30
31class ScrollingLabel : public QWidget
32{
33 Q_OBJECT
34
35public:
36 ScrollingLabel(QWidget* parent=0);
37 ~ScrollingLabel(){}
38 QString text() { return mText; }
39 void setText( QString text);
40
41private:
42 QString mText;
43 void updateLabel();
44 int scrollPos;
45 int timerId;
46 QRect textRect;
47 static const int gap = 10;
48
49protected:
50 void paintEvent(QPaintEvent *);
51 void changeEvent(QEvent *);
52 void resizeEvent(QResizeEvent *);
53 QSize sizeHint() const;
54
55private slots:
56 void timerEvent(QTimerEvent *);
57};
58
59class MediaPanel : public QWidget
60{
61 Q_OBJECT
62 Q_PROPERTY(QPixmap bgLeft READ bgLeftPix WRITE setBgLeftPix)
63 Q_PROPERTY(QPixmap bgRight READ bgRightPix WRITE setBgRightPix)
64 Q_PROPERTY(QPixmap bgCenter READ bgCenterPix WRITE setBgCenterPix)
65
66public:
67 MediaPanel(QWidget *parent = 0);
68 ~MediaPanel();
69 QPixmap bgLeftPix() { return leftBackground ;}
70 void setBgLeftPix( QPixmap pix){ leftBackground = pix; }
71 QPixmap bgRightPix() { return rightBackground ;}
72 void setBgRightPix( QPixmap pix){ rightBackground = pix; }
73 QPixmap bgCenterPix() { return centerBackground ;}
74 void setBgCenterPix( QPixmap pix){ centerBackground = pix; }
75 void setShuffleIcon( MyIcon icon );
76 void setRepeatIcon(MyIcon icon);
77 void setElapsedText(QString text) {
78 elapsedLabel->setText(text);
79 if(seeker->states().testFlag(PanelSeeker::Buffering))
80 setBuffering(false);
81 }
82 void setTotalText( QString text) { totalLabel->setText(text); }
83 void setActionCollection(QList<QAction*> actions);
84 void setMplayerState(int state);
85 void setDuration(int duration);
86 void setMediaLabelText(QString text);
87 void setStatusText(QString text, int time = 2000);
88 void setBuffering(bool enable);
89 bool eventFilter(QObject *object, QEvent *event);
90
91public slots:
92 void setSeeker(int v);
93
94private:
95 Ui::MediaPanelClass ui;
96 QPixmap leftBackground;
97 QPixmap centerBackground;
98 QPixmap rightBackground;
99 ScrollingLabel* mediaLabel;
100 PanelSeeker* seeker;
101 MyButton* repeatButton;
102 MyButton* shuffleButton;
103 QLabel* elapsedLabel;
104 QLabel* totalLabel;
105 QString originalTitle;
106 QTimer* timer;
107 int duration;
108
109private slots:
110 void reverseStatus();
111
112protected:
113 void paintEvent(QPaintEvent *);
114 virtual void changeEvent (QEvent * event);
115 virtual void retranslateStrings();
116
117signals:
118 void seekerChanged(int);
119
120public:
121 friend class IconSetter;
122};
123
124#endif // MEDIAPANEL_H
Note: See TracBrowser for help on using the repository browser.