Title: [91806] trunk/Tools
- Revision
- 91806
- Author
- [email protected]
- Date
- 2011-07-26 18:12:50 -0700 (Tue, 26 Jul 2011)
Log Message
[Qt] Add option to turn on disk caching in QtTestBrowser
https://bugs.webkit.org/show_bug.cgi?id=65007
Patch by Keith Kyzivat <[email protected]> on 2011-07-26
Reviewed by Noam Rosenthal.
Add menu item and command line option to turn on disk caching in
QtTestBrowser. Simple QNetworkDiskCache added to the page's
QNetworkAccssManager.
* QtTestBrowser/launcherwindow.cpp:
(LauncherWindow::initializeView):
(LauncherWindow::createChrome):
(LauncherWindow::setDiskCache):
* QtTestBrowser/launcherwindow.h:
(WindowOptions::WindowOptions):
* QtTestBrowser/main.cpp:
(LauncherApplication::handleUserOptions):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (91805 => 91806)
--- trunk/Tools/ChangeLog 2011-07-27 01:10:04 UTC (rev 91805)
+++ trunk/Tools/ChangeLog 2011-07-27 01:12:50 UTC (rev 91806)
@@ -1,3 +1,23 @@
+2011-07-26 Keith Kyzivat <[email protected]>
+
+ [Qt] Add option to turn on disk caching in QtTestBrowser
+ https://bugs.webkit.org/show_bug.cgi?id=65007
+
+ Reviewed by Noam Rosenthal.
+
+ Add menu item and command line option to turn on disk caching in
+ QtTestBrowser. Simple QNetworkDiskCache added to the page's
+ QNetworkAccssManager.
+
+ * QtTestBrowser/launcherwindow.cpp:
+ (LauncherWindow::initializeView):
+ (LauncherWindow::createChrome):
+ (LauncherWindow::setDiskCache):
+ * QtTestBrowser/launcherwindow.h:
+ (WindowOptions::WindowOptions):
+ * QtTestBrowser/main.cpp:
+ (LauncherApplication::handleUserOptions):
+
2011-07-26 Sadrul Habib Chowdhury <[email protected]>
Add support for download='filename' attribute in anchors.
Modified: trunk/Tools/QtTestBrowser/launcherwindow.cpp (91805 => 91806)
--- trunk/Tools/QtTestBrowser/launcherwindow.cpp 2011-07-27 01:10:04 UTC (rev 91805)
+++ trunk/Tools/QtTestBrowser/launcherwindow.cpp 2011-07-27 01:12:50 UTC (rev 91806)
@@ -42,6 +42,11 @@
#include <QNetworkReply>
#endif
+#if !defined(QT_NO_NETWORKDISKCACHE) && !defined(QT_NO_DESKTOPSERVICES)
+#include <QtGui/QDesktopServices>
+#include <QtNetwork/QNetworkDiskCache>
+#endif
+
const int gExitClickArea = 80;
QVector<int> LauncherWindow::m_zoomLevels;
@@ -115,6 +120,7 @@
m_inputUrl = addressUrl();
QUrl url = ""
setPage(new WebPage(this));
+ setDiskCache(m_windowOptions.useDiskCache);
QSplitter* splitter = static_cast<QSplitter*>(centralWidget());
@@ -412,6 +418,12 @@
QMenu* settingsMenu = menuBar()->addMenu("&Settings");
+#if !defined(QT_NO_NETWORKDISKCACHE) && !defined(QT_NO_DESKTOPSERVICES)
+ QAction* toggleDiskCache = settingsMenu->addAction("Use Disk Cache", this, SLOT(setDiskCache(bool)));
+ toggleDiskCache->setCheckable(true);
+ toggleDiskCache->setChecked(m_windowOptions.useDiskCache);
+#endif
+
QAction* toggleAutoLoadImages = settingsMenu->addAction("Disable Auto Load Images", this, SLOT(toggleAutoLoadImages(bool)));
toggleAutoLoadImages->setCheckable(true);
toggleAutoLoadImages->setChecked(false);
@@ -786,6 +798,20 @@
#endif
}
+void LauncherWindow::setDiskCache(bool enable)
+{
+#if !defined(QT_NO_NETWORKDISKCACHE) && !defined(QT_NO_DESKTOPSERVICES)
+ m_windowOptions.useDiskCache = enable;
+ QNetworkDiskCache* cache = 0;
+ if (enable) {
+ cache = new QNetworkDiskCache();
+ QString cacheLocation = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
+ cache->setCacheDirectory(cacheLocation);
+ }
+ page()->networkAccessManager()->setCache(cache);
+#endif
+}
+
void LauncherWindow::setTouchMocking(bool on)
{
m_touchMocking = on;
Modified: trunk/Tools/QtTestBrowser/launcherwindow.h (91805 => 91806)
--- trunk/Tools/QtTestBrowser/launcherwindow.h 2011-07-27 01:10:04 UTC (rev 91805)
+++ trunk/Tools/QtTestBrowser/launcherwindow.h 2011-07-27 01:12:50 UTC (rev 91806)
@@ -81,6 +81,7 @@
public:
WindowOptions()
: useGraphicsView(false)
+ , useDiskCache(false)
, useCompositing(true)
, useTiledBackingStore(false)
, useWebGL(false)
@@ -113,6 +114,7 @@
}
bool useGraphicsView;
+ bool useDiskCache;
bool useCompositing;
bool useTiledBackingStore;
bool useWebGL;
@@ -173,6 +175,7 @@
void loadURLListFromFile();
+ void setDiskCache(bool enable);
void setTouchMocking(bool on);
void toggleWebView(bool graphicsBased);
void toggleAcceleratedCompositing(bool toggle);
Modified: trunk/Tools/QtTestBrowser/main.cpp (91805 => 91806)
--- trunk/Tools/QtTestBrowser/main.cpp 2011-07-27 01:10:04 UTC (rev 91805)
+++ trunk/Tools/QtTestBrowser/main.cpp 2011-07-27 01:12:50 UTC (rev 91806)
@@ -182,6 +182,9 @@
<< "[-webgl]"
#endif
<< QString("[-viewport-update-mode %1]").arg(formatKeys(updateModes)).toLatin1().data()
+#if !defined(QT_NO_NETWORKDISKCACHE) && !defined(QT_NO_DESKTOPSERVICES)
+ << "[-disk-cache]"
+#endif
<< "[-cache-webview]"
<< "[-maximize]"
<< "[-show-fps]"
@@ -217,6 +220,14 @@
windowOptions.showFrameRate = true;
}
+ if (args.contains("-disk-cache")) {
+#if !defined(QT_NO_NETWORKDISKCACHE) && !defined(QT_NO_DESKTOPSERVICES)
+ windowOptions.useDiskCache = true;
+#else
+ appQuit(1, "-disk-cache only works if QNetworkDiskCache and QDesktopServices is enabled in your Qt build.");
+#endif
+ }
+
if (args.contains("-cache-webview") || defaultForAnimations) {
requiresGraphicsView("-cache-webview");
windowOptions.cacheWebView = true;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes