1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
/**
* Copyright (C) 2002-2003 by Koos Vriezen <koos.vriezen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KMPLAYERVIEW_H
#define KMPLAYERVIEW_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <tqwidget.h>
#include <textedit.h>
#include <kdockwidget.h>
#include <kurl.h>
#include <qxembed.h>
#include <kmediaplayer/view.h>
#include "kmplayersource.h"
#define MOUSE_INVISIBLE_DELAY 2000
class TQWidgetStack;
class TQPixmap;
class TQPaintDevice;
class TQPainter;
class TQSlider;
class TQLabel;
class KActionCollection;
class KAction;
class KShortcut;
class KStatusBar;
class KFindDialog;
namespace KMPlayer {
class View;
class ViewArea;
class Viewer;
class ControlPanel;
class VolumeBar;
class Console;
class PlayListView;
class PlayListView;
class RootPlayListItem;
typedef KStatusBar StatusBar;
/*
* The console GUI
*/
class TextEdit : public TQTextEdit {
public:
TextEdit (TQWidget * parent, View * view);
protected:
void contextMenuEvent (TQContextMenuEvent * e);
private:
View * m_view;
};
/*
* The infowindow GUI
*/
class InfoWindow : public TQTextEdit {
public:
InfoWindow (TQWidget * parent, View * view);
KDE_NO_EXPORT View * view () const { return m_view; }
protected:
void contextMenuEvent (TQContextMenuEvent * e);
private:
View * m_view;
};
/*
* The view containing ViewArea and playlist
*/
class KMPLAYER_EXPORT View : public KMediaPlayer::View {
Q_OBJECT
TQ_OBJECT
public:
enum ControlPanelMode {
CP_Hide, CP_AutoHide, CP_Show, CP_Only /* no video widget */
};
enum StatusBarMode {
SB_Hide, SB_Show, SB_Only /* no video widget */
};
enum WidgetType {
WT_Video, WT_Console, WT_Picture, WT_Last
};
View (TQWidget *parent, const char *);
~View();
void addText (const TQString &, bool eol=false);
void init (KActionCollection * ac);
void reset ();
//void print(TQPrinter *pPrinter);
TextEdit * console () const { return m_multiedit; }
KDE_NO_EXPORT Viewer * viewer () const { return m_viewer; }
KDE_NO_EXPORT ControlPanel * controlPanel () const {return m_control_panel;}
KDE_NO_EXPORT StatusBar * statusBar () const {return m_status_bar;}
KDE_NO_EXPORT PlayListView * playList () const { return m_playlist; }
KDE_NO_EXPORT InfoWindow * infoPanel () const { return m_infopanel; }
KDE_NO_EXPORT TQWidgetStack * widgetStack () const { return m_widgetstack; }
KDE_NO_EXPORT KDockArea * docArea () const { return m_dockarea; }
KDE_NO_EXPORT ViewArea * viewArea () const { return m_view_area; }
KDE_NO_EXPORT bool keepSizeRatio () const { return m_keepsizeratio; }
void setKeepSizeRatio (bool b);
void showWidget (WidgetType w);
void setControlPanelMode (ControlPanelMode m);
void setStatusBarMode (StatusBarMode m);
void setEraseColor (const TQColor &);
KDE_NO_EXPORT ControlPanelMode controlPanelMode () const { return m_controlpanel_mode; }
KDE_NO_EXPORT StatusBarMode statusBarMode () const { return m_statusbar_mode; }
void delayedShowButtons (bool show);
bool isFullScreen () const;
int statusBarHeight () const;
KDE_NO_EXPORT bool editMode () const { return m_edit_mode; }
bool setPicture (const TQString & path);
KDE_NO_EXPORT TQPixmap * image () const { return m_image; }
void setNoInfoMessages (bool b) { m_no_info = b; }
void setViewOnly ();
void setInfoPanelOnly ();
void setPlaylistOnly ();
void setEditMode (RootPlayListItem *, bool enable=true);
void dragEnterEvent (TQDragEnterEvent *);
void dropEvent (TQDropEvent *);
KDE_NO_EXPORT void emitPictureClicked () { emit pictureClicked (); }
/* raise video widget, might (auto) hides panel */
void videoStart ();
void playingStart ();
/* shows panel */
void playingStop ();
public slots:
void setVolume (int);
void updateVolume ();
void fullScreen ();
void updateLayout ();
void toggleShowPlaylist ();
void toggleVideoConsoleWindow ();
void setInfoMessage (const TQString & msg);
void setStatusMessage (const TQString & msg);
signals:
void urlDropped (const KURL::List & urls);
void pictureClicked ();
void fullScreenChanged ();
void windowVideoConsoleToggled (int wt);
protected:
void leaveEvent (TQEvent *) KDE_NO_EXPORT;
void timerEvent (TQTimerEvent *) KDE_NO_EXPORT;
bool x11Event (XEvent *) KDE_NO_EXPORT;
private:
// widget for player's output
Viewer * m_viewer;
// console output
TextEdit * m_multiedit;
// widget stack contains m_viewer, m_multiedit and m_picturewidget
TQWidgetStack * m_widgetstack;
// widget that layouts m_widgetstack for ratio setting and m_control_panel
ViewArea * m_view_area;
// playlist widget
PlayListView * m_playlist;
// infopanel widget
InfoWindow * m_infopanel;
// all widget types
TQWidget * m_widgettypes [WT_Last];
KDockArea * m_dockarea;
KDockWidget * m_dock_video;
KDockWidget * m_dock_playlist;
KDockWidget * m_dock_infopanel;
TQString tmplog;
TQPixmap * m_image;
ControlPanel * m_control_panel;
StatusBar * m_status_bar;
TQSlider * m_volume_slider;
const char * m_mixer_object;
ControlPanelMode m_controlpanel_mode;
ControlPanelMode m_old_controlpanel_mode;
StatusBarMode m_statusbar_mode;
int controlbar_timer;
int infopanel_timer;
bool m_keepsizeratio;
bool m_playing;
bool m_mixer_init;
bool m_inVolumeUpdate;
bool m_sreensaver_disabled;
bool m_tmplog_needs_eol;
bool m_revert_fullscreen;
bool m_no_info;
bool m_edit_mode;
};
/*
* The video widget
*/
class KMPLAYER_EXPORT Viewer : public QXEmbed {
Q_OBJECT
TQ_OBJECT
public:
Viewer(TQWidget *parent, View * view);
~Viewer();
int heightForWidth (int w) const;
void setAspect (float a);
float aspect () { return m_aspect; }
void sendKeyEvent (int key);
void setBackgroundColor (const TQColor & c);
void resetBackgroundColor ();
void setCurrentBackgroundColor (const TQColor & c);
KDE_NO_EXPORT View * view () const { return m_view; }
void changeProtocol (QXEmbed::Protocol p);
public slots:
void sendConfigureEvent ();
protected:
void dragEnterEvent (TQDragEnterEvent *);
void dropEvent (TQDropEvent *);
void mouseMoveEvent (TQMouseEvent * e);
void contextMenuEvent (TQContextMenuEvent * e);
virtual void windowChanged( WId w );
private:
WId m_plain_window;
unsigned int m_bgcolor;
float m_aspect;
View * m_view;
};
} // namespace
#endif // KMPLAYERVIEW_H
|