2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
3 * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
4 * Copyright (C) 2006 George Staikos <staikos@kde.org>
5 * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2006 Zack Rusin <zack@kde.org>
7 * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef launcherwindow_h
34 #define launcherwindow_h
37 #include <QtNetwork/QNetworkRequest>
39 #if defined(QT_CONFIGURED_WITH_OPENGL)
40 #include <QtOpenGL/QGLWidget>
43 #if !defined(QT_NO_PRINTER)
44 #include <QPrintPreviewDialog>
48 #include <QtUiTools/QUiLoader>
55 #include <qwebelement.h>
56 #include <qwebframe.h>
57 #include <qwebinspector.h>
58 #include <qwebsettings.h>
61 #include <qx11info_x11.h>
64 #include "DumpRenderTreeSupportQt.h"
65 #include "mainwindow.h"
66 #include "urlloader.h"
68 #include "webinspector.h"
73 #include <X11/Xatom.h>
78 class QPropertyAnimation;
83 : useGraphicsView(false)
85 , useCompositing(true)
86 , useTiledBackingStore(false)
88 #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
89 , useFrameFlattening(true)
91 , useFrameFlattening(false)
94 , showFrameRate(false)
95 , resizesToContents(false)
96 , viewportUpdateMode(QGraphicsView::MinimalViewportUpdate)
97 , useLocalStorage(false)
98 , useOfflineStorageDatabase(false)
99 , useOfflineWebApplicationCache(false)
100 , useDiskCookies(true)
101 , offlineStorageDefaultQuotaSize(0)
102 #if defined(QT_CONFIGURED_WITH_OPENGL)
103 , useQGLWidgetViewport(false)
105 #if defined(Q_WS_X11)
106 , useTestFonts(false)
108 , printLoadedUrls(false)
109 #if defined(Q_OS_SYMBIAN)
110 , startMaximized(true)
112 , startMaximized(false)
117 bool useGraphicsView;
120 bool useTiledBackingStore;
122 bool useFrameFlattening;
125 bool resizesToContents;
126 QGraphicsView::ViewportUpdateMode viewportUpdateMode;
127 bool useLocalStorage;
128 bool useOfflineStorageDatabase;
129 bool useOfflineWebApplicationCache;
131 quint64 offlineStorageDefaultQuotaSize;
132 #if defined(QT_CONFIGURED_WITH_OPENGL)
133 bool useQGLWidgetViewport;
135 #if defined(Q_WS_X11)
138 bool printLoadedUrls;
140 quint16 remoteInspectorPort;
144 class LauncherWindow : public MainWindow {
148 LauncherWindow(WindowOptions* data = 0, QGraphicsScene* sharedScene = 0);
149 virtual ~LauncherWindow();
151 virtual void keyPressEvent(QKeyEvent* event);
152 void grabZoomKeys(bool grab);
154 void sendTouchEvent();
156 bool eventFilter(QObject* obj, QEvent* event);
162 void showLinkHover(const QString &link, const QString &toolTip);
167 void toggleZoomTextOnly(bool on);
168 void zoomAnimationFinished();
173 void setEditable(bool on);
175 /* void dumpPlugins() */
178 void loadURLListFromFile();
180 void setDiskCache(bool enable);
181 void setTouchMocking(bool on);
182 void toggleWebView(bool graphicsBased);
183 void toggleAcceleratedCompositing(bool toggle);
184 void toggleTiledBackingStore(bool toggle);
185 void toggleResizesToContents(bool toggle);
186 void toggleWebGL(bool toggle);
187 void toggleSpatialNavigation(bool b);
188 void toggleFullScreenMode(bool enable);
189 void toggleFrameFlattening(bool toggle);
190 void toggleInterruptingJavaScriptEnabled(bool enable);
191 void toggleJavascriptCanOpenWindows(bool enable);
192 void toggleAutoLoadImages(bool enable);
193 void setUseDiskCookies(bool enable);
195 void togglePlugins(bool enable);
196 void toggleLocalStorage(bool toggle);
197 void toggleOfflineStorageDatabase(bool toggle);
198 void toggleOfflineWebApplicationCache(bool toggle);
199 void setOfflineStorageDefaultQuota();
200 #ifndef QT_NO_LINEEDIT
204 #if defined(QT_CONFIGURED_WITH_OPENGL)
205 void toggleQGLWidgetViewport(bool enable);
208 void changeViewportUpdateMode(int mode);
210 void animatedYFlip();
211 void selectElements();
212 void showFPS(bool enable);
213 void showUserAgentDialog();
215 void printURL(const QUrl&);
216 #if !defined(QT_NO_FILEDIALOG) && !defined(QT_NO_MESSAGEBOX)
217 void downloadRequest(const QNetworkRequest&);
218 void fileDownloadFinished();
222 LauncherWindow* newWindow();
223 LauncherWindow* cloneWindow();
224 void updateFPS(int fps);
227 void enteredFullScreenMode(bool on);
231 void initializeView();
236 bool isGraphicsBased() const;
239 static QVector<int> m_zoomLevels;
242 UrlLoader* m_urlLoader;
245 WebInspector* m_inspector;
247 WindowOptions m_windowOptions;
249 QAction* m_formatMenuAction;
251 QPropertyAnimation* m_zoomAnimation;
252 #if !defined(QT_NO_FILEDIALOG) && !defined(QT_NO_MESSAGEBOX)
253 QNetworkReply* m_reply;
255 QList<QTouchEvent::TouchPoint> m_touchPoints;
259 #ifndef QT_NO_LINEEDIT
261 QLineEdit* m_lineEdit;
263 static const int s_findNormalFlag = 0;