diff options
Diffstat (limited to 'Tools/QtTestBrowser')
-rw-r--r-- | Tools/QtTestBrowser/QtTestBrowser.pro | 4 | ||||
-rw-r--r-- | Tools/QtTestBrowser/launcherwindow.cpp | 41 | ||||
-rw-r--r-- | Tools/QtTestBrowser/launcherwindow.h | 10 | ||||
-rw-r--r-- | Tools/QtTestBrowser/main.cpp | 4 |
4 files changed, 42 insertions, 17 deletions
diff --git a/Tools/QtTestBrowser/QtTestBrowser.pro b/Tools/QtTestBrowser/QtTestBrowser.pro index 4cd7ecb..a7826e5 100644 --- a/Tools/QtTestBrowser/QtTestBrowser.pro +++ b/Tools/QtTestBrowser/QtTestBrowser.pro @@ -22,7 +22,7 @@ HEADERS += \ webview.h \ fpstimer.h \ -CONFIG += uitools +!isEqual(QT_ARCH,sh4): CONFIG += uitools isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../.. include(../../Source/WebKit.pri) @@ -34,7 +34,7 @@ DESTDIR = $$OUTPUT_DIR/bin QT += network macx:QT+=xml -unix:!mac:!symbian { +unix:!mac:!symbian:!embedded { CONFIG += link_pkgconfig PKGCONFIG += fontconfig } diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp index f4db898..a6b05f4 100644 --- a/Tools/QtTestBrowser/launcherwindow.cpp +++ b/Tools/QtTestBrowser/launcherwindow.cpp @@ -31,6 +31,7 @@ */ #include "launcherwindow.h" +#include "urlloader.h" const int gExitClickArea = 80; QVector<int> LauncherWindow::m_zoomLevels; @@ -38,6 +39,7 @@ QVector<int> LauncherWindow::m_zoomLevels; LauncherWindow::LauncherWindow(WindowOptions* data, QGraphicsScene* sharedScene) : MainWindow() , m_currentZoom(100) + , m_urlLoader(0) , m_view(0) , m_inspector(0) , m_formatMenuAction(0) @@ -56,6 +58,7 @@ LauncherWindow::LauncherWindow(WindowOptions* data, QGraphicsScene* sharedScene) LauncherWindow::~LauncherWindow() { grabZoomKeys(false); + delete m_urlLoader; } void LauncherWindow::init() @@ -63,12 +66,10 @@ void LauncherWindow::init() QSplitter* splitter = new QSplitter(Qt::Vertical, this); setCentralWidget(splitter); -#if defined(Q_OS_SYMBIAN) - setWindowState(Qt::WindowMaximized); -#else - setWindowState(Qt::WindowNoState); - resize(800, 600); -#endif + if (m_windowOptions.startMaximized) + setWindowState(windowState() | Qt::WindowMaximized); + else + resize(800, 600); m_inspector = new WebInspector; #ifndef QT_NO_PROPERTIES @@ -287,6 +288,8 @@ void LauncherWindow::createChrome() QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", m_inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I)); showInspectorAction->setCheckable(true); showInspectorAction->connect(m_inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool))); + toolsMenu->addSeparator(); + toolsMenu->addAction("Load URLs from file", this, SLOT(loadURLListFromFile())); // GraphicsView sub menu. QAction* toggleAcceleratedCompositing = graphicsViewMenu->addAction("Toggle Accelerated Compositing", this, SLOT(toggleAcceleratedCompositing(bool))); @@ -770,15 +773,9 @@ void LauncherWindow::toggleSpatialNavigation(bool b) void LauncherWindow::toggleFullScreenMode(bool enable) { - if (enable) - setWindowState(Qt::WindowFullScreen); - else { -#if defined(Q_OS_SYMBIAN) - setWindowState(Qt::WindowMaximized); -#else - setWindowState(Qt::WindowNoState); -#endif - } + bool alreadyEnabled = windowState() & Qt::WindowFullScreen; + if (enable ^ alreadyEnabled) + setWindowState(windowState() ^ Qt::WindowFullScreen); } void LauncherWindow::toggleFrameFlattening(bool toggle) @@ -900,6 +897,20 @@ void LauncherWindow::showUserAgentDialog() delete dialog; } +void LauncherWindow::loadURLListFromFile() +{ + QString selectedFile; +#ifndef QT_NO_FILEDIALOG + selectedFile = QFileDialog::getOpenFileName(this, tr("Load URL list from file") + , QString(), tr("Text Files (*.txt);;All Files (*)")); +#endif + if (selectedFile.isEmpty()) + return; + + m_urlLoader = new UrlLoader(this->page()->mainFrame(), selectedFile, 0, 0); + m_urlLoader->loadNext(); +} + void LauncherWindow::printURL(const QUrl& url) { QTextStream output(stdout); diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h index 8bdad4d..705a1e4 100644 --- a/Tools/QtTestBrowser/launcherwindow.h +++ b/Tools/QtTestBrowser/launcherwindow.h @@ -104,6 +104,11 @@ public: , useTestFonts(false) #endif , printLoadedUrls(false) +#if defined(Q_OS_SYMBIAN) + , startMaximized(true) +#else + , startMaximized(false) +#endif { } @@ -129,6 +134,7 @@ public: bool printLoadedUrls; QUrl inspectorUrl; quint16 remoteInspectorPort; + bool startMaximized; }; class LauncherWindow : public MainWindow { @@ -165,6 +171,8 @@ protected slots: /* void dumpPlugins() */ void dumpHtml(); + void loadURLListFromFile(); + void setTouchMocking(bool on); void toggleWebView(bool graphicsBased); void toggleAcceleratedCompositing(bool toggle); @@ -217,6 +225,8 @@ private: static QVector<int> m_zoomLevels; int m_currentZoom; + UrlLoader* m_urlLoader; + QWidget* m_view; WebInspector* m_inspector; diff --git a/Tools/QtTestBrowser/main.cpp b/Tools/QtTestBrowser/main.cpp index 059269c..c44c4c6 100644 --- a/Tools/QtTestBrowser/main.cpp +++ b/Tools/QtTestBrowser/main.cpp @@ -183,6 +183,7 @@ void LauncherApplication::handleUserOptions() #endif << QString("[-viewport-update-mode %1]").arg(formatKeys(updateModes)).toLatin1().data() << "[-cache-webview]" + << "[-maximize]" << "[-show-fps]" << "[-r list]" << "[-robot-timeout seconds]" @@ -234,6 +235,9 @@ void LauncherApplication::handleUserOptions() if (args.contains("-local-storage-enabled")) windowOptions.useLocalStorage = true; + if (args.contains("-maximize")) + windowOptions.startMaximized = true; + if (args.contains("-offline-storage-database-enabled")) windowOptions.useOfflineStorageDatabase = true; |