Gnash  0.8.11dev
klash_part.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // 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
18 
19 // Written by Koos Vriezen <koos ! vriezen ? xs4all ! nl>
20 
21 #ifndef KLASH_PART_H
22 #define KLASH_PART_H
23 
24 #include <qxembed.h>
25 #include <kprocess.h>
26 #include <kparts/browserextension.h>
27 
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
37 
38 class KAboutData;
39 class KlashPart;
40 class KInstance;
41 class KProcess;
42 class JSCommandEntry;
43 class KlashView;
44 
45 /*
46  * Part notifications to hosting application
47  */
48 class KLASH_NO_EXPORT KlashBrowserExtension : public KParts::BrowserExtension {
49  Q_OBJECT
50 public:
53  void urlChanged (const QString & url);
54  void setLoadingProgress (int percentage);
55 
56  void saveState (QDataStream & stream);
57  void restoreState (QDataStream & stream);
58  void requestOpenURL (const KURL & url, const QString & target, const QString & service);
59 };
60 
61 /*
62  * Part javascript support
63  */
64 class KLASH_NO_EXPORT KlashLiveConnectExtension : public KParts::LiveConnectExtension {
65  Q_OBJECT
66 public:
69 
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);
80  }
81 
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;
95 };
96 
97 class KLASH_NO_EXPORT KlashEmbed : public QXEmbed {
98  KlashView * m_view;
99 public:
100  KlashEmbed (KlashView * parent);
101  ~KlashEmbed ();
102 };
103 
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 *);
112 };
113 
114 /*
115  * Part that gets created when used a KPart
116  */
117 class KLASH_NO_EXPORT KlashPart : public KParts::ReadOnlyPart {
118  Q_OBJECT
119  friend struct GroupPredicate;
120 public:
121  KlashPart (QWidget * wparent, const char * wname,
122  QObject * parent, const char * name, const QStringList &args);
123  ~KlashPart ();
124 
126  { return m_browserextension; }
128  { return m_liveconnectextension; }
129  bool allowRedir (const KURL & url) const;
130  void fullScreen ();
131  void setLoaded (int percentage);
132  const QString & source () const { return m_src_url; }
133 public slots:
134  virtual bool openURL (const KURL & url);
135  virtual bool closeURL ();
136  void play ();
137  void stop ();
138  void pause ();
139  int width () const {return m_width; }
140  int height () const {return m_height; }
141 protected slots:
142  void playingStarted ();
143  void playingStopped ();
144  void processStopped (KProcess *);
145 protected:
146  virtual bool openFile();
147 private:
148  QStringList m_args;
149  KlashBrowserExtension * m_browserextension;
150  KlashLiveConnectExtension * m_liveconnectextension;
151  KProcess * m_process;
152  KURL m_docbase;
153  QString m_src_url;
154  QString m_file_name;
155  int m_width;
156  int m_height;
157  //bool m_noresize : 1;
158  bool m_autostart : 1;
159  bool m_fullscreen : 1;
160  bool m_started_emited : 1;
161 };
162 
163 
164 #endif
#define KDE_NO_CDTOR_EXPORT
Definition: klash_part.h:33
Definition: klash_part.h:64
int width() const
Definition: klash_part.h:139
#define KLASH_NO_EXPORT
Definition: klash_part.h:31
Definition: klash_part.h:117
KDE_NO_EXPORT KlashBrowserExtension * browserextension() const
Definition: klash_part.h:125
void sendEvent(const unsigned long objid, const QString &event, const KParts::LiveConnectExtension::ArgList &args)
Definition: klash_part.h:78
Type
Definition: AMF.h:45
Definition: klash_part.h:48
Definition: klash_part.cpp:330
KlashLiveConnectExtension * liveconnectextension() const
Definition: klash_part.h:127
int height() const
Definition: klash_part.h:140
Definition: klash_part.h:104
#define KDE_NO_EXPORT
Definition: klash_part.h:35
Definition: GnashKey.h:148
const QString & source() const
Definition: klash_part.h:132
Definition: GnashKey.h:154
w
Definition: test.py:8
std::string url
Definition: gnash.cpp:59
Definition: klash_part.cpp:330
Definition: klash_part.h:97
KDE_NO_CDTOR_EXPORT ~KlashBrowserExtension()
Definition: klash_part.h:52
std::string name
Definition: LocalConnection_as.cpp:149
void enableFinishEvent(bool b=true)
Definition: klash_part.h:82