source: smplayer/vendor/current/src/mplayerwindow.h@ 91

Last change on this file since 91 was 90, checked in by Silvan Scherrer, 16 years ago

smplayer: import 0.6.9

File size: 5.2 KB
RevLine 
[90]1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2010 Ricardo Villalba <[email protected]>
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
20#ifndef MPLAYERWINDOW_H
21#define MPLAYERWINDOW_H
22
23#include <QWidget>
24#include <QSize>
25#include <QPoint>
26
27#include <QResizeEvent>
28#include <QWheelEvent>
29#include <QMouseEvent>
30#include <QKeyEvent>
31#include <QPaintEvent>
32
33#include "config.h"
34
35class QWidget;
36class QLabel;
37class QKeyEvent;
38class QTimer;
39
40#define ZOOM_STEP 0.05
41#define ZOOM_MIN 0.5
42
43#define DELAYED_RESIZE 0
44#define NEW_MOUSE_CHECK_POS 1
45
46//! Screen is a widget that hides the mouse cursor after some seconds if not moved.
47
48class Screen : public QWidget
49{
50 Q_OBJECT
51
52public:
53 Screen(QWidget* parent = 0, Qt::WindowFlags f = 0);
54 ~Screen();
55
56#if NEW_MOUSE_CHECK_POS
57 void setAutoHideCursor(bool b);
58 bool autoHideCursor() { return autohide_cursor; };
59
60 void setAutoHideInterval(int milliseconds) { autohide_interval = milliseconds; };
61 int autoHideInterval() { return autohide_interval; };
62#endif
63
64public slots:
65 //! Should be called when a file has started.
66 virtual void playingStarted();
67
68 //! Should be called when a file has stopped.
69 virtual void playingStopped();
70
71protected:
72#if !NEW_MOUSE_CHECK_POS
73 virtual void mouseMoveEvent( QMouseEvent * e );
74#endif
75 virtual void paintEvent ( QPaintEvent * e );
76
77protected slots:
78 virtual void checkMousePos();
79
80private:
81 QTimer * check_mouse_timer;
82#if NEW_MOUSE_CHECK_POS
83 QPoint mouse_last_position;
84 bool autohide_cursor;
85 int autohide_interval;
86#else
87 QPoint cursor_pos, last_cursor_pos;
88#endif
89};
90
91//! MplayerLayer can be instructed to not delete the background.
92
93class MplayerLayer : public Screen
94{
95 Q_OBJECT
96
97public:
98 MplayerLayer(QWidget* parent = 0, Qt::WindowFlags f = 0);
99 ~MplayerLayer();
100
101#if REPAINT_BACKGROUND_OPTION
102 //! If b is true, the background of the widget will be repainted as usual.
103 /*! Otherwise the background will not repainted when a video is playing. */
104 void setRepaintBackground(bool b);
105
106 //! Return true if repainting the background is allowed.
107 bool repaintBackground() { return repaint_background; };
108#endif
109
110public slots:
111 //! Should be called when a file has started.
112 /*! It's needed to know if the background has to be cleared or not. */
113 virtual void playingStarted();
114 //! Should be called when a file has stopped.
115 virtual void playingStopped();
116
117#if REPAINT_BACKGROUND_OPTION
118protected:
119 virtual void paintEvent ( QPaintEvent * e );
120#endif
121
122private:
123#if REPAINT_BACKGROUND_OPTION
124 bool repaint_background;
125#endif
126 bool playing;
127};
128
129
130class MplayerWindow : public Screen
131{
132 Q_OBJECT
133
134public:
135 MplayerWindow( QWidget* parent = 0, Qt::WindowFlags f = 0);