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
|
/**
* Copyright (C) 2002-2003 by Koos Vriezen <[email protected]>
*
* 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 KMPLAYER_PART_H
#define KMPLAYER_PART_H
#include <kparts/browserextension.h>
#include "kmplayerpartbase.h"
#include "kmplayersource.h"
class KAboutData;
class KMPlayerPart;
class KInstance;
class JSCommandEntry;
/*
* Wrapper source for URLSource that has a HREF attribute
*/
class KMPLAYER_NO_EXPORT KMPlayerHRefSource : public KMPlayer::Source {
Q_OBJECT
public:
KMPlayerHRefSource (KMPlayer::PartBase * player);
virtual ~KMPlayerHRefSource ();
virtual bool processOutput (const TQString & line);
virtual bool hasLength ();
void setURL (const KURL &);
void clear ();
virtual TQString prettyName ();
public slots:
virtual void init ();
virtual void activate ();
virtual void deactivate ();
void finished ();
private slots:
void grabReady (const TQString & path);
void play ();
private:
TQString m_grabfile;
bool m_finished;
};
/*
* Part notifications to hosting application
*/
class KMPLAYER_NO_EXPORT KMPlayerBrowserExtension : public KParts::BrowserExtension {
Q_OBJECT
public:
KMPlayerBrowserExtension(KMPlayerPart *parent);
KDE_NO_CDTOR_EXPORT ~KMPlayerBrowserExtension () {}
void urlChanged (const TQString & url);
void setLoadingProgress (int percentage);
void saveState (TQDataStream & stream);
void restoreState (TQDataStream & stream);
void requestOpenURL (const KURL & url, const TQString & target, const TQString & service);
public slots:
void slotRequestOpenURL (const KURL & url, const TQString & target);
};
/*
* Part javascript support
*/
class KMPLAYER_NO_EXPORT KMPlayerLiveConnectExtension : public KParts::LiveConnectExtension {
Q_OBJECT
public:
KMPlayerLiveConnectExtension (KMPlayerPart * parent);
~KMPlayerLiveConnectExtension ();
// LiveConnect interface
bool get (const unsigned long, const TQString &,
KParts::LiveConnectExtension::Type &, unsigned long &, TQString &);
bool put (const unsigned long, const TQString &, const TQString &);
bool call (const unsigned long, const TQString &,
const TQStringList &, KParts::LiveConnectExtension::Type &,
unsigned long &, TQString &);
void unregister (const unsigned long);
void sendEvent(const unsigned long objid, const TQString & event, const KParts::LiveConnectExtension::ArgList & args ) {
emit partEvent(objid, event, args);
}
void enableFinishEvent (bool b = true) { m_enablefinish = b; }
signals:
void partEvent (const unsigned long, const TQString &,
const KParts::LiveConnectExtension::ArgList &);
public slots:
void setSize (int w, int h);
void started ();
void finished ();
void evaluate (const TQString & script, TQString & result);
private:
KMPlayerPart * player;
TQString script_result;
const JSCommandEntry * lastJSCommandEntry;
bool m_started;
bool m_enablefinish;
bool m_evaluating;
};
/*
* Part that gets created when used a KPart
*/
class KMPLAYER_NO_EXPORT KMPlayerPart : public KMPlayer::PartBase {
Q_OBJECT
friend struct GroupPredicate;
public:
enum Features {
Feat_Unknown = 0,
Feat_Viewer = 0x01, Feat_Controls = 0x02,
Feat_Label = 0x04, Feat_StatusBar = 0x08,
Feat_InfoPanel = 0x10, Feat_VolumeSlider = 0x20, Feat_PlayList = 0x40,
Feat_ImageWindow = 0x80, Feat_All = 0xff
};
KMPlayerPart (TQWidget * wparent, const char * wname,
TQObject * parent, const char * name, const TQStringList &args);
~KMPlayerPart ();
KDE_NO_EXPORT KMPlayerBrowserExtension * browserextension() const
{ return m_browserextension; }
KMPlayerLiveConnectExtension * liveconnectextension () const
{ return m_liveconnectextension; }
KDE_NO_EXPORT bool hasFeature (int f) { return m_features & f; }
bool allowRedir (const KURL & url) const;
void connectToPart (KMPlayerPart *);
KMPlayerPart * master () const { return m_master; }
void setMaster (KMPlayerPart * m) { m_master = m; }
virtual void setLoaded (int percentage);
bool openNewURL (const KURL & url); // for JS interface
public slots:
virtual bool openURL (const KURL & url);
virtual bool closeURL ();
void setMenuZoom (int id);
protected slots:
virtual void playingStarted ();
virtual void playingStopped ();
void viewerPartDestroyed (TQObject *);
void viewerPartProcessChanged (const char *);
void viewerPartSourceChanged (KMPlayer::Source *, KMPlayer::Source *);
void waitForImageWindowTimeOut ();
void statusPosition (int pos, int length);
private:
void setAutoControls (bool);
KMPlayerPart * m_master;
KMPlayerBrowserExtension * m_browserextension;
KMPlayerLiveConnectExtension * m_liveconnectextension;
TQString m_group;
KURL m_docbase;
TQString m_src_url;
TQString m_file_name;
int m_features;
int last_time_left;
bool m_started_emited : 1;
//bool m_noresize : 1;
bool m_havehref : 1;
};
#endif
|