1 /*  smplayer, GUI front-end for mplayer.
2     Copyright (C) 2006-2021 Ricardo Villalba <ricardo@smplayer.info>
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 TIMESLIDER_H
20 #define TIMESLIDER_H
21 
22 #include "myslider.h"
23 #include "config.h"
24 
25 class TimeSlider : public MySlider
26 {
27 	Q_OBJECT
28 
29 public:
30 	TimeSlider( QWidget * parent );
31 	~TimeSlider();
32 
33 public slots:
34 	virtual void setPos(int); // Don't use setValue!
35 	virtual int pos();
setDuration(double t)36 	virtual void setDuration(double t) { total_time = t; };
duration()37 	virtual double duration() { return total_time; };
38 #if ENABLE_DELAYED_DRAGGING
39 	void setDragDelay(int);
40 	int dragDelay();
41 #endif
42 
43 signals:
44 	void posChanged(int);
45 	void draggingPos(int);
46 #if ENABLE_DELAYED_DRAGGING
47 	//! Emitted with a few ms of delay
48 	void delayedDraggingPos(int);
49 #endif
50 	void wheelUp();
51 	void wheelDown();
52 
53 protected slots:
54 	void stopUpdate();
55 	void resumeUpdate();
56 	void mouseReleased();
57 	void valueChanged_slot(int);
58 #if ENABLE_DELAYED_DRAGGING
59 	void checkDragging(int);
60 	void sendDelayedPos();
61 #endif
62 
63 protected:
64 	virtual void wheelEvent(QWheelEvent * e);
65 	virtual bool event(QEvent *event);
66 
67 private:
68 	bool dont_update;
69 	int position;
70 	double total_time;
71 
72 #if ENABLE_DELAYED_DRAGGING
73 	int last_pos_to_send;
74 	QTimer * timer;
75 #endif
76 };
77 
78 #endif
79 
80