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

Last change on this file since 188 was 188, checked in by Silvan Scherrer, 8 years ago

SMPlayer: update trunk to version 17.1.0

File size: 3.9 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2017 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 <QWidget>
25#include <QPixmap>
26#include <QLabel>
27#include "ui_mediapanel.h"
28#include "mybutton.h"
29#include "panelseeker.h"
30
31class QGridLayout;
32
33class ScrollingLabel : public QWidget
34{
35 Q_OBJECT
36
37public:
38 ScrollingLabel(QWidget* parent=0);
39 ~ScrollingLabel(){}
40 QString text() { return mText; }
41 void setText( QString text);
42
43 void setScrollingEnabled(bool b);
44 bool scrollingEnabled() { return scrolling_enabled; };
45
46private:
47 QString mText;
48 void updateLabel();
49 int scrollPos;
50 int timerId;
51 QRect textRect;
52 static const int gap = 10;
53 bool scrolling_enabled;
54
55protected:
56 void paintEvent(QPaintEvent *);
57 void changeEvent(QEvent *);
58 void resizeEvent(QResizeEvent *);
59 QSize sizeHint() const;
60
61private slots:
62 void timerEvent(QTimerEvent *);
63};
64
65class 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
72public:
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);
93 void setResolutionLabelText(QString text);
94 void setStatusText(QString text, int time = 2000);
95 void setBuffering(bool enable);
96 bool eventFilter(QObject *object, QEvent *event);
97
98public slots:
99 void setSeeker(int v);
100 void setResolutionVisible(bool b);
101 void setScrollingEnabled(bool b);
102
103private:
104 Ui::MediaPanelClass ui;
105 QGridLayout * layout;
106 QPixmap leftBackground;
107 QPixmap centerBackground;
108 QPixmap rightBackground;
109 ScrollingLabel* mediaLabel;
110 QLabel *resolutionLabel;
111 PanelTimeSeeker* seeker;
112 MyButton* repeatButton;
113 MyButton* shuffleButton;
114 QLabel* elapsedLabel;
115 QLabel* totalLabel;
116 QString originalTitle;
117 QTimer* timer;
118 int duration;
119
120private slots:
121 void reverseStatus();
122 void rearrangeWidgets(bool resolution_visible);
123
124protected:
125 void paintEvent(QPaintEvent *);
126 virtual void changeEvent (QEvent * event);
127 virtual void retranslateStrings();
128
129signals:
130 void seekerChanged(int);
131 void seekerWheelUp();
132 void seekerWheelDown();
133
134public:
135 friend class IconSetter;
136};
137
138#endif // MEDIAPANEL_H
Note: See TracBrowser for help on using the repository browser.