Commit f862975c authored by zoltan@webkit.org's avatar zoltan@webkit.org

2011-04-05 Zoltan Horvath <zoltan@webkit.org>

        Reviewed by Andreas Kling.

        [Qt] Make URL loader accessible from testbrowser's menus
        https://bugs.webkit.org/show_bug.cgi?id=57823

        Add "Load URLs from file" to QtTestBrowser's and to MiniBrowser's menu.

        * MiniBrowser/qt/BrowserWindow.cpp:
        (BrowserWindow::BrowserWindow):
        (BrowserWindow::loadURLListFromFile):
        (BrowserWindow::~BrowserWindow):
        * MiniBrowser/qt/BrowserWindow.h:
        * QtTestBrowser/launcherwindow.cpp:
        (LauncherWindow::LauncherWindow):
        (LauncherWindow::~LauncherWindow):
        (LauncherWindow::createChrome):
        (LauncherWindow::loadURLListFromFile):
        * QtTestBrowser/launcherwindow.h:

git-svn-id: svn://svn.chromium.org/blink/trunk@82919 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 539fd09a
2011-04-05 Zoltan Horvath <zoltan@webkit.org>
Reviewed by Andreas Kling.
[Qt] Make URL loader accessible from testbrowser's menus
https://bugs.webkit.org/show_bug.cgi?id=57823
Add "Load URLs from file" to QtTestBrowser's and to MiniBrowser's menu.
* MiniBrowser/qt/BrowserWindow.cpp:
(BrowserWindow::BrowserWindow):
(BrowserWindow::loadURLListFromFile):
(BrowserWindow::~BrowserWindow):
* MiniBrowser/qt/BrowserWindow.h:
* QtTestBrowser/launcherwindow.cpp:
(LauncherWindow::LauncherWindow):
(LauncherWindow::~LauncherWindow):
(LauncherWindow::createChrome):
(LauncherWindow::loadURLListFromFile):
* QtTestBrowser/launcherwindow.h:
2011-04-04 Sam Weinig <sam@webkit.org>
Reviewed by Brian Weinstein.
......
......@@ -28,6 +28,7 @@
#include "BrowserWindow.h"
#include "UrlLoader.h"
#include "qwkpreferences.h"
static QWKPage* newPageFunction(QWKPage* page)
......@@ -41,6 +42,7 @@ QVector<qreal> BrowserWindow::m_zoomLevels;
BrowserWindow::BrowserWindow(QWKContext* context, WindowOptions* options)
: m_isZoomTextOnly(false)
, m_currentZoom(1)
, m_urlLoader(0)
, m_context(context)
{
if (options)
......@@ -106,6 +108,8 @@ BrowserWindow::BrowserWindow(QWKContext* context, WindowOptions* options)
toggleFrameFlattening->setChecked(false);
toolsMenu->addSeparator();
toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
toolsMenu->addSeparator();
toolsMenu->addAction("Load URLs from file", this, SLOT(loadURLListFromFile()));
QMenu* settingsMenu = menuBar()->addMenu("&Settings");
QAction* toggleAutoLoadImages = settingsMenu->addAction("Disable Auto Load Images", this, SLOT(toggleAutoLoadImages(bool)));
......@@ -335,6 +339,17 @@ void BrowserWindow::showUserAgentDialog()
page()->setCustomUserAgent(combo->currentText());
}
void BrowserWindow::loadURLListFromFile()
{
QString selectedFile = QFileDialog::getOpenFileName(this, tr("Load URL list from file")
, QString(), tr("Text Files (*.txt);;All Files (*)"));
if (selectedFile.isEmpty())
return;
m_urlLoader = new UrlLoader(this, selectedFile, 0, 0);
m_urlLoader->loadNext();
}
void BrowserWindow::printURL(const QUrl& url)
{
QTextStream output(stdout);
......@@ -380,6 +395,7 @@ void BrowserWindow::applyZoom()
BrowserWindow::~BrowserWindow()
{
delete m_urlLoader;
delete m_addressBar;
delete m_browser;
}
......@@ -35,6 +35,8 @@
#include <QStringList>
#include <QtGui>
class UrlLoader;
class BrowserWindow : public QMainWindow {
Q_OBJECT
......@@ -69,6 +71,8 @@ protected slots:
void toggleFrameFlattening(bool);
void showUserAgentDialog();
void loadURLListFromFile();
void printURL(const QUrl&);
void toggleAutoLoadImages(bool);
......@@ -83,6 +87,7 @@ private:
bool m_isZoomTextOnly;
qreal m_currentZoom;
UrlLoader* m_urlLoader;
QWKContext* m_context;
WindowOptions m_windowOptions;
BrowserView* m_browser;
......
......@@ -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()
......@@ -287,6 +290,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)));
......@@ -900,6 +905,17 @@ void LauncherWindow::showUserAgentDialog()
delete dialog;
}
void LauncherWindow::loadURLListFromFile()
{
QString selectedFile = QFileDialog::getOpenFileName(this, tr("Load URL list from file")
, QString(), tr("Text Files (*.txt);;All Files (*)"));
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);
......
......@@ -165,6 +165,8 @@ protected slots:
/* void dumpPlugins() */
void dumpHtml();
void loadURLListFromFile();
void setTouchMocking(bool on);
void toggleWebView(bool graphicsBased);
void toggleAcceleratedCompositing(bool toggle);
......@@ -217,6 +219,8 @@ private:
static QVector<int> m_zoomLevels;
int m_currentZoom;
UrlLoader* m_urlLoader;
QWidget* m_view;
WebInspector* m_inspector;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment