Gnash 0.8.9
|
00001 // 00002 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 00003 // 2011 Free Software Foundation, Inc 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 #ifndef GNASH_KDE4GUI_H 00020 #define GNASH_KDE4GUI_H 00021 00022 #ifdef HAVE_CONFIG_H 00023 #include "gnashconfig.h" 00024 #endif 00025 00026 #include "gui.h" 00027 #include "rc.h" 00028 00029 #include <vector> 00030 #include <QX11EmbedWidget> 00031 #include <QDialog> 00032 00033 #ifdef RENDERER_AGG 00034 #include "Kde4GlueAgg.h" 00035 #endif 00036 00037 #ifdef RENDERER_CAIRO 00038 #include "Kde4GlueCairo.h" 00039 #endif 00040 00041 #ifdef RENDERER_OPENGL 00042 #include "Kde4GlueOgl.h" 00043 class QGLWidget; 00044 #endif 00045 00046 00047 class QMainWindow; 00048 class QMenuBar; 00049 class QMenu; 00050 class QRect; 00051 class QCheckBox; 00052 class QSlider; 00053 class QLineEdit; 00054 class QSpinBox; 00055 class QStackedWidget; 00056 00057 namespace gnash { 00058 class Kde4Gui; 00059 class DrawingWidget; 00060 } 00061 00062 namespace gnash 00063 { 00064 00065 class EmbedWidget : public QX11EmbedWidget 00066 { 00067 Q_OBJECT 00068 00069 public: 00070 EmbedWidget(Kde4Gui& gui); 00071 ~EmbedWidget() {}; 00072 00073 DrawingWidget* drawingWidget() { return _drawingWidget; } 00074 00075 public slots: 00076 void hidePlayButton(); 00077 void showPlayButton(); 00078 00079 private: 00080 QPushButton* _playButton; 00081 DrawingWidget* _drawingWidget; 00082 }; 00083 00084 00085 class FDMonitor : public QObject 00086 { 00087 Q_OBJECT 00088 public: 00089 FDMonitor(Kde4Gui& gui); 00090 ~FDMonitor(); 00091 00092 // Add a file descriptor for monitoring. 00093 void addFD(int fd); 00094 00095 public slots: 00096 void dataReceived(int fd); 00097 00098 private: 00099 Kde4Gui& _gui; 00100 }; 00101 00102 00103 class DSOEXPORT Kde4Gui : public Gui 00104 { 00105 public: 00106 Kde4Gui(unsigned long xid, float scale, bool loop, RunResources& r); 00107 virtual ~Kde4Gui(); 00108 virtual bool init(int argc, char **argv[]); 00109 virtual bool createWindow(const char* windowtitle, int width, int height, 00110 int xPosition = 0, int yPosition = 0); 00111 virtual void resizeWindow(int width, int height); 00112 virtual bool run(); 00113 virtual bool watchFD(int fd); 00114 virtual void renderBuffer(); 00115 virtual void setInterval(unsigned int interval); 00116 virtual void setTimeout(unsigned int timeout); 00117 virtual void handleKeyEvent(QKeyEvent *event, bool down); 00118 virtual void setCursor(gnash_cursor_type newcursor); 00119 virtual void setFullscreen(); 00120 virtual bool showMouse(bool show); 00121 virtual void unsetFullscreen(); 00122 void setInvalidatedRegions(const InvalidatedRanges& ranges); 00123 void resize(int width, int height); 00124 void showProperties(); 00125 void showPreferences(); 00126 void quitUI(); 00127 00128 bool want_multiple_regions() { return true; } 00129 00130 void renderWidget(const QRect& updateRect); 00131 00132 void popupMenu(const QPoint& point); 00133 00134 private: 00135 typedef std::vector<geometry::Range2d<int> > DrawBounds; 00136 typedef std::map<int, gnash::key::code> KeyMap; 00137 00138 void setupActions(); 00139 void setupMenus(); 00140 void createMainMenu(); 00141 00143 void setupKeyMap(); 00144 00147 void stopHook(); 00148 00150 void playHook(); 00151 00153 FDMonitor _fdMonitor; 00154 00155 DrawBounds _drawbounds; 00156 00159 std::auto_ptr<QApplication> _application; 00160 00162 EmbedWidget* _embedWidget; 00163 00165 // 00168 DrawingWidget* _drawingWidget; 00169 00171 std::auto_ptr<Kde4Glue> _glue; 00172 00174 std::auto_ptr<QMainWindow> _window; 00175 00178 KeyMap _keyMap; 00179 00181 gnash::key::code qtToGnashKey(QKeyEvent *event); 00182 int qtToGnashModifier(const Qt::KeyboardModifiers modifiers); 00183 00188 00189 // File Menu 00190 QMenu* fileMenu; 00191 QAction* propertiesAction; 00192 QAction* quitAction; 00193 00194 // Edit Menu 00195 QMenu* editMenu; 00196 QAction* preferencesAction; 00197 00198 // Movie Control Menu; 00199 QMenu* movieControlMenu; 00200 QAction* playAction; 00201 QAction* pauseAction; 00202 QAction* stopAction; 00203 QAction* restartAction; 00204 00205 // View Menu 00206 QMenu* viewMenu; 00207 QAction* refreshAction; 00208 QAction* fullscreenAction; 00209 }; 00210 00211 namespace Kde4GuiPrefs 00212 { 00213 00214 class PreferencesDialog : public QDialog 00215 { 00216 Q_OBJECT 00217 00218 public: 00219 PreferencesDialog(QWidget* parent); 00220 00221 private slots: 00222 void savePreferences(); 00223 00224 private: 00225 PreferencesDialog(const PreferencesDialog&); 00226 00227 // Logging tab widgets 00228 QSlider* _verbositySlider; 00229 QCheckBox* _logToFileToggle; 00230 QLineEdit* _logFileName; 00231 QCheckBox* _parserDumpToggle; 00232 QCheckBox* _actionDumpToggle; 00233 QCheckBox* _malformedSWFToggle; 00234 QCheckBox* _ASCodingErrorToggle; 00235 QCheckBox* _lcTraceToggle; 00236 00237 // Security tab widgets 00238 QCheckBox* _localHostToggle; 00239 QCheckBox* _localDomainToggle; 00240 QCheckBox* _insecureSSLToggle; 00241 QLineEdit* _solSandboxDir; 00242 QCheckBox* _solReadOnlyToggle; 00243 QCheckBox* _solLocalDomainToggle; 00244 QCheckBox* _localConnectionToggle; 00245 00246 // Network tab widgets 00247 QSpinBox* _streamsTimeoutScale; 00248 00249 // Media tab widgets 00250 QCheckBox* _soundToggle; 00251 QCheckBox* _saveStreamingMediaToggle; 00252 QCheckBox* _saveLoadedMediaToggle; 00253 QLineEdit* _mediaDir; 00254 00255 // Player tab widgets 00256 QLineEdit* _versionText; 00257 QLineEdit* _osText; 00258 QLineEdit* _urlOpenerText; 00259 QSpinBox* _librarySize; 00260 QCheckBox* _startStoppedToggle; 00261 00262 // The config storage. 00263 RcInitFile& _rcfile; 00264 }; 00265 00266 } 00267 00268 } 00269 00270 #endif