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

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

SMPlayer: update trunk to 0.8.2

File size: 3.9 KB
Line 
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 PANELSEEKER_H
20#define PANELSEEKER_H
21
22#include <QAbstractSlider>
23#include <QPixmap>
24#include <QTimer>
25#include "mybutton.h"
26
27class PanelSeeker : public QAbstractSlider
28{
29Q_OBJECT
30
31Q_PROPERTY( QPixmap left READ leftIcon WRITE setLeftIcon)
32Q_PROPERTY( QPixmap center READ centerIcon WRITE setCenterIcon)
33Q_PROPERTY( QPixmap right READ rightIcon WRITE setRightIcon)
34Q_PROPERTY( QPixmap progress READ progressIcon WRITE setProgressIcon )
35Q_PROPERTY( QPixmap buffering READ bufferingIcon WRITE setBufferingIcon)
36Q_PROPERTY( QPixmap knob READ knobIcon WRITE setKnobIcon )
37
38public:
39
40 enum State
41 {
42 Normal = 2,
43 Hovered = 4,
44 Pressed = 8,
45 Disabled =16,
46 Stopped = 32,
47 Buffering = 64
48 };
49 Q_DECLARE_FLAGS(States, State)
50 explicit PanelSeeker(QWidget *parent = 0);
51 QPixmap leftIcon() { return leftPix; }
52 QPixmap centerIcon() { return centerPix; }
53 QPixmap rightIcon() { return rightPix; }
54 QPixmap progressIcon() { return progressPix; }
55 QPixmap bufferingIcon() { return bufferingPix; }
56 QPixmap knobIcon() { return knobPix.pixmap(MyIcon::Normal, MyIcon::Off); }
57 States states() { return state; }
58
59 void setLeftIcon( QPixmap pix) { leftPix = pix; }
60 void setCenterIcon( QPixmap pix) { centerPix = pix; }
61 void setRightIcon( QPixmap pix) { rightPix = pix; }
62 void setProgressIcon ( QPixmap pix) { progressPix = pix; }
63 void setBufferingIcon( QPixmap pix) { bufferingPix = pix; }
64 void setKnobIcon( QPixmap pix );
65 void setSingleKnobIcon(QPixmap pix);
66 void setState(State st, bool on = true);
67 void setLeftRightMargin( int margin) { leftRightMargin = margin; }
68 void setDelayPeriod(int period) { delayPeriod = period; }
69 void setFrozenPeriod(int period) { frozenPeriod = period; }
70 qreal valueForPos(int pos);
71
72
73
74private:
75 QPixmap leftPix;
76 QPixmap centerPix;
77 QPixmap rightPix;
78 QPixmap progressPix;
79 QPixmap bufferingPix;
80 MyIcon knobPix;
81 QRectF knobRect;
82 bool isPressed;
83 int leftRightMargin;
84 QPointF mousePressPos;
85 qreal mousePressDifference;
86 States state;
87 qreal bufferingPixShift;
88 QPixmap knobCurrentPix;
89 // freeze the knob after seeking through mouse for frozenPeriod
90 // so that knob is not reset by the signal from timeslider action.
91 bool frozen;
92 QTimer* freezeTimer;
93 // we dont seek the movie immediately, so that mutliple
94 // consecutive changes are clustered in one seek signal
95 QTimer* dragDelayTimer;
96 int delayPeriod;
97 int frozenPeriod;
98
99
100 void resetKnob( bool start = true);
101 void knobAdjust(qreal x, bool setValue = false);
102
103
104
105
106signals:
107
108public slots:
109 void moved( int value);
110 void setSliderValue(int value);
111 void stopFreeze();
112 void goToSliderPosition();
113
114
115protected:
116 void paintEvent(QPaintEvent * e);
117 void mousePressEvent(QMouseEvent * m);
118 void mouseMoveEvent(QMouseEvent * m);
119 void mouseReleaseEvent(QMouseEvent * m);
120 void resizeEvent(QResizeEvent *);
121 bool event(QEvent *e);
122 void changeEvent(QEvent *e);
123 void timerEvent(QTimerEvent * t);
124 void wheelEvent(QWheelEvent *e);
125
126
127};
128Q_DECLARE_OPERATORS_FOR_FLAGS(PanelSeeker::States)
129
130#endif // PANELSEEKER_H
Note: See TracBrowser for help on using the repository browser.