update copyright date
[gnash.git] / plugin / klash4 / klash_part.h
blob2af082c98f87fa3e433da485537e26036cbb6a63
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 // 2011 Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 // Written by Koos Vriezen <koos ! vriezen ? xs4all ! nl>
21 #ifndef KLASH_PART_H
22 #define KLASH_PART_H
24 #include <QX11EmbedWidget>
25 #include <kprocess.h>
26 #include <kparts/browserextension.h>
28 #if __GNUC__ - 0 > 3
29 #define KLASH_NO_EXPORT __attribute__ ((visibility("hidden")))
30 #else
31 #define KLASH_NO_EXPORT
32 #endif
33 #define KDE_NO_CDTOR_EXPORT KLASH_NO_EXPORT
34 #ifndef KDE_NO_EXPORT
35 #define KDE_NO_EXPORT KLASH_NO_EXPORT
36 #endif
38 class KAboutData;
39 class KlashPart;
40 class KInstance;
41 class KProcess;
42 class JSCommandEntry;
43 class KlashView;
46 * Part notifications to hosting application
48 class KLASH_NO_EXPORT KlashBrowserExtension : public KParts::BrowserExtension {
49 Q_OBJECT
50 public:
51 KlashBrowserExtension(KlashPart *parent);
52 KDE_NO_CDTOR_EXPORT ~KlashBrowserExtension () {}
53 void urlChanged (const QString & url);
54 void setLoadingProgress (int percentage);
56 void saveState (QDataStream & stream);
57 void restoreState (QDataStream & stream);
58 void requestOpenUrl (const KUrl & url, const QString & target, const QString & service);
62 * Part javascript support
64 class KLASH_NO_EXPORT KlashLiveConnectExtension : public KParts::LiveConnectExtension {
65 Q_OBJECT
66 public:
67 KlashLiveConnectExtension (KlashPart * parent);
68 ~KlashLiveConnectExtension ();
70 // LiveConnect interface
71 bool get (const unsigned long, const QString &,
72 KParts::LiveConnectExtension::Type &, unsigned long &, QString &);
73 bool put (const unsigned long, const QString &, const QString &);
74 bool call (const unsigned long, const QString &,
75 const QStringList &, KParts::LiveConnectExtension::Type &,
76 unsigned long &, QString &);
77 void unregister (const unsigned long);
78 void sendEvent(const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args ) {
79 emit partEvent(objid, event, args);
82 void enableFinishEvent (bool b = true) { m_enablefinish = b; }
83 signals:
84 void partEvent (const unsigned long, const QString &,
85 const KParts::LiveConnectExtension::ArgList &);
86 public slots:
87 void setSize (int w, int h);
88 void started ();
89 void finished ();
90 private:
91 KlashPart * player;
92 const JSCommandEntry * lastJSCommandEntry;
93 bool m_started : 1;
94 bool m_enablefinish : 1;
97 class KLASH_NO_EXPORT KlashEmbed : public QX11EmbedWidget {
98 KlashView * m_view;
99 public:
100 KlashEmbed (KlashView * parent);
101 ~KlashEmbed ();
104 class KLASH_NO_EXPORT KlashView : public QWidget {
105 KlashEmbed * m_embed;
106 public:
107 KlashView (QWidget * parent);
108 ~KlashView ();
109 WId embedId ();
110 protected:
111 void resizeEvent (QResizeEvent *);
115 * Part that gets created when used a KPart
117 class KLASH_NO_EXPORT KlashPart : public KParts::ReadOnlyPart {
118 Q_OBJECT
119 friend struct GroupPredicate;
120 public:
121 KlashPart (QWidget * wparent, QObject * parent, const QStringList &args);
122 ~KlashPart ();
124 KDE_NO_EXPORT KlashBrowserExtension * browserextension() const
125 { return m_browserextension; }
126 KlashLiveConnectExtension * liveconnectextension () const
127 { return m_liveconnectextension; }
128 bool allowRedir (const KUrl & url) const;
129 void fullScreen ();
130 void setLoaded (int percentage);
131 const QString & source () const { return m_src_url; }
132 public slots:
133 virtual bool openUrl (const KUrl & url);
134 virtual bool closeUrl ();
135 void play ();
136 void stop ();
137 void pause ();
138 int width () const {return m_width; }
139 int height () const {return m_height; }
140 protected slots:
141 void playingStarted ();
142 void playingStopped ();
143 void processStopped (int, QProcess::ExitStatus);
144 protected:
145 virtual bool openFile();
146 private:
147 QStringList m_args;
148 KlashBrowserExtension * m_browserextension;
149 KlashLiveConnectExtension * m_liveconnectextension;
150 KProcess * m_process;
151 KUrl m_docbase;
152 QString m_src_url;
153 QString m_file_name;
154 int m_width;
155 int m_height;
156 //bool m_noresize : 1;
157 bool m_autostart : 1;
158 bool m_fullscreen : 1;
159 bool m_started_emited : 1;
163 #endif