Title: [98448] trunk/Tools
Revision
98448
Author
hausm...@webkit.org
Date
2011-10-26 01:29:00 -0700 (Wed, 26 Oct 2011)

Log Message

[Qt][WK2] Remove QtWidgets dependency in MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=70529

Remove obsolete code for a new QML based implementation
of MiniBrowser.
Change BrowserWindow to derive from QSGView instead of
QMainWindow. QSGView is used as a top level window that
provides the container for placing QML content.
Make MiniBrowserApplication derive from QGuiApplication
instead of QApplication.

Patch by Jocelyn Turcotte <jocelyn.turco...@nokia.com>,
         Zeno Albisser <zeno.albis...@nokia.com>

Patch by Zeno Albisser <zeno.albis...@nokia.com> on 2011-10-25
Reviewed by Simon Hausmann.

* MiniBrowser/qt/BrowserView.cpp: Removed.
* MiniBrowser/qt/BrowserView.h: Removed.
* MiniBrowser/qt/BrowserWindow.cpp:
(BrowserWindow::BrowserWindow):
(BrowserWindow::load):
(BrowserWindow::screenshot):
(BrowserWindow::loadURLListFromFile):
(BrowserWindow::updateUserAgentList):
(BrowserWindow::~BrowserWindow):
* MiniBrowser/qt/BrowserWindow.h:
* MiniBrowser/qt/MiniBrowser.pro:
* MiniBrowser/qt/MiniBrowserApplication.cpp:
(MiniBrowserApplication::MiniBrowserApplication):
(MiniBrowserApplication::notify):
* MiniBrowser/qt/MiniBrowserApplication.h:
* MiniBrowser/qt/UrlLoader.cpp:
(UrlLoader::UrlLoader):
* MiniBrowser/qt/main.cpp:

Modified Paths

Removed Paths

Diff

Modified: trunk/Tools/ChangeLog (98447 => 98448)


--- trunk/Tools/ChangeLog	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/ChangeLog	2011-10-26 08:29:00 UTC (rev 98448)
@@ -1,5 +1,42 @@
 2011-10-25  Zeno Albisser  <zeno.albis...@nokia.com>
 
+        [Qt][WK2] Remove QtWidgets dependency in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=70529
+
+        Remove obsolete code for a new QML based implementation
+        of MiniBrowser.
+        Change BrowserWindow to derive from QSGView instead of
+        QMainWindow. QSGView is used as a top level window that
+        provides the container for placing QML content.
+        Make MiniBrowserApplication derive from QGuiApplication
+        instead of QApplication.
+
+        Patch by Jocelyn Turcotte <jocelyn.turco...@nokia.com>,
+                 Zeno Albisser <zeno.albis...@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        * MiniBrowser/qt/BrowserView.cpp: Removed.
+        * MiniBrowser/qt/BrowserView.h: Removed.
+        * MiniBrowser/qt/BrowserWindow.cpp:
+        (BrowserWindow::BrowserWindow):
+        (BrowserWindow::load):
+        (BrowserWindow::screenshot):
+        (BrowserWindow::loadURLListFromFile):
+        (BrowserWindow::updateUserAgentList):
+        (BrowserWindow::~BrowserWindow):
+        * MiniBrowser/qt/BrowserWindow.h:
+        * MiniBrowser/qt/MiniBrowser.pro:
+        * MiniBrowser/qt/MiniBrowserApplication.cpp:
+        (MiniBrowserApplication::MiniBrowserApplication):
+        (MiniBrowserApplication::notify):
+        * MiniBrowser/qt/MiniBrowserApplication.h:
+        * MiniBrowser/qt/UrlLoader.cpp:
+        (UrlLoader::UrlLoader):
+        * MiniBrowser/qt/main.cpp:
+
+2011-10-25  Zeno Albisser  <zeno.albis...@nokia.com>
+
         [Qt][WK2] Remove QAction from MiniBrowser
         https://bugs.webkit.org/show_bug.cgi?id=70525
 

Deleted: trunk/Tools/MiniBrowser/qt/BrowserView.cpp (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/BrowserView.cpp	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/BrowserView.cpp	2011-10-26 08:29:00 UTC (rev 98448)
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2010 University of Szeged
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "BrowserView.h"
-
-#include <QGraphicsScene>
-#include <QtDeclarative/qsgitem.h>
-#include <QResizeEvent>
-#include <qdesktopwebview.h>
-#include <qtouchwebview.h>
-#include <qtouchwebpage.h>
-#include <qwebnavigationcontroller.h>
-
-BrowserView::BrowserView(bool useTouchWebView, QWindow* parent)
-    : QSGCanvas(parent)
-    , m_item(0)
-{
-    if (useTouchWebView)
-        m_item = new QTouchWebView(rootItem());
-    else
-        m_item = new QDesktopWebView(rootItem());
-}
-
-BrowserView::~BrowserView()
-{
-    delete m_item;
-    m_item = 0;
-}
-
-void BrowserView::resizeEvent(QResizeEvent* event)
-{
-    QSGCanvas::resizeEvent(event);
-    m_item->setX(0);
-    m_item->setY(0);
-    m_item->setSize(event->size());
-}
-
-void BrowserView::load(const QString& urlString)
-{
-    QUrl url(QUrl::fromUserInput(urlString));
-
-    if (desktopWebView())
-        desktopWebView()->load(url);
-    else if (touchWebView())
-        touchWebView()->page()->load(url);
-}
-
-QSGItem* BrowserView::view() const
-{
-    return m_item;
-}
-
-QTouchWebView* BrowserView::touchWebView() const
-{
-    return qobject_cast<QTouchWebView*>(m_item);
-}
-
-QDesktopWebView* BrowserView::desktopWebView() const
-{
-    return qobject_cast<QDesktopWebView*>(m_item);
-}
-

Deleted: trunk/Tools/MiniBrowser/qt/BrowserView.h (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/BrowserView.h	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/BrowserView.h	2011-10-26 08:29:00 UTC (rev 98448)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2010 University of Szeged
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BrowserView_h
-#define BrowserView_h
-
-#include <QAction>
-#include <QtDeclarative/qsgcanvas.h>
-
-class QDesktopWebView;
-class QSGItem;
-class QTouchWebView;
-
-class BrowserView : public QSGCanvas {
-    Q_OBJECT
-
-public:
-    BrowserView(bool useTouchWebView, QWindow* parent = 0);
-    virtual ~BrowserView();
-
-    void load(const QString&);
-    QSGItem* view() const;
-
-    QTouchWebView* touchWebView() const;
-    QDesktopWebView* desktopWebView() const;
-
-protected:
-    virtual void resizeEvent(QResizeEvent*);
-
-private:
-    QSGItem* m_item;
-};
-
-#endif

Modified: trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/BrowserWindow.cpp	2011-10-26 08:29:00 UTC (rev 98448)
@@ -33,48 +33,9 @@
 #include "qtouchwebview.h"
 #include "qtouchwebpage.h"
 
-#if 0
-// FIXME
-static QWKPage* newPageFunction(QWKPage* page)
-{
-    BrowserWindow* window = new BrowserWindow();
-    return window->page();
-}
-#endif
 
-WindowWrapper::WindowWrapper(QWindow* window, QWidget* widget)
-    : QWidget(widget)
-    , m_window(window)
-{
-    // Throttle resize events a bit
-    m_resizeTimer.setInterval(16);
-    m_resizeTimer.setSingleShot(true);
-    connect(&m_resizeTimer, SIGNAL(timeout()), this, SLOT(doResize()));
-    m_window->setWindowFlags(Qt::FramelessWindowHint);
-}
-
-void WindowWrapper::showEvent(QShowEvent* event)
-{
-    QWidget::showEvent(event);
-    m_window->setParent(window()->windowHandle());
-    m_window->show();
-}
-
-void WindowWrapper::resizeEvent(QResizeEvent* event)
-{
-    QWidget::resizeEvent(event);
-    if (!m_resizeTimer.isActive())
-        m_resizeTimer.start();
-}
-
-void WindowWrapper::doResize()
-{
-    m_window->setGeometry(QRect(mapTo(window(), QPoint(0, 0)), size()));
-}
-
 BrowserWindow::BrowserWindow(WindowOptions* options)
     : m_urlLoader(0)
-    , m_browser(0)
 {
     if (options)
         m_windowOptions = *options;
@@ -83,76 +44,8 @@
         m_windowOptions = tmpOptions;
     }
 
-    m_browser = new BrowserView(m_windowOptions.useTouchWebView);
-
-    setAttribute(Qt::WA_DeleteOnClose);
-
-    connect(webView(), SIGNAL(loadProgressChanged(int)), SLOT(onLoadProgressChanged(int)));
-    connect(webView(), SIGNAL(titleChanged(QString)), SLOT(setWindowTitle(QString)));
-    connect(webView(), SIGNAL(urlChanged(QUrl)), SLOT(urlChanged(QUrl)));
-
-    if (m_windowOptions.printLoadedUrls)
-        connect(webView(), SIGNAL(urlChanged(QUrl)), this, SLOT(printURL(QUrl)));
-
-    if (QDesktopWebView* const desktopWebView = m_browser->desktopWebView()) {
-        connect(desktopWebView, SIGNAL(statusBarMessageChanged(QString)), statusBar(), SLOT(showMessage(QString)));
-        connect(desktopWebView, SIGNAL(linkHovered(QUrl, QString)), this, SLOT(onLinkHovered(QUrl, QString)));
-    }
-
-    setCentralWidget(new WindowWrapper(m_browser, this));
-    centralWidget()->setFocus(Qt::OtherFocusReason);
-
-    QMenu* fileMenu = menuBar()->addMenu("&File");
-    fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New);
-    fileMenu->addAction("Open File", this, SLOT(openFile()), QKeySequence::Open);
-    fileMenu->addSeparator();
-    fileMenu->addAction("Quit", this, SLOT(close()));
-
-#if 0
-    QMenu* editMenu = menuBar()->addMenu("&Edit");
-    QAction* undo = page()->action(QWKPage::Undo);
-    undo->setShortcut(QKeySequence(QKeySequence::Undo));
-    editMenu->addAction(undo);
-    QAction* redo = page()->action(QWKPage::Redo);
-    redo->setShortcut(QKeySequence(QKeySequence::Redo));
-    editMenu->addAction(redo);
-    editMenu->addSeparator();
-
-    QMenu* viewMenu = menuBar()->addMenu("&View");
-    viewMenu->addAction(page()->action(QWKPage::Stop));
-    viewMenu->addAction(page()->action(QWKPage::Reload));
-    viewMenu->addSeparator();
-    viewMenu->addAction("Take Screen Shot...", this, SLOT(screenshot()));
-#endif
-
-    QMenu* windowMenu = menuBar()->addMenu("&Window");
-    QAction* toggleFullScreen = windowMenu->addAction("Toggle FullScreen", this, SIGNAL(enteredFullScreenMode(bool)));
-    toggleFullScreen->setShortcut(Qt::Key_F11);
-    toggleFullScreen->setCheckable(true);
-    toggleFullScreen->setChecked(false);
-    // When exit fullscreen mode by clicking on the exit area (bottom right corner) we must
-    // uncheck the Toggle FullScreen action.
-    toggleFullScreen->connect(this, SIGNAL(enteredFullScreenMode(bool)), SLOT(setChecked(bool)));
-    connect(this, SIGNAL(enteredFullScreenMode(bool)), this, SLOT(toggleFullScreenMode(bool)));
-
-    QMenu* toolsMenu = menuBar()->addMenu("&Develop");
-    toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
-    toolsMenu->addSeparator();
-    toolsMenu->addAction("Load URLs from file", this, SLOT(loadURLListFromFile()));
-
-    m_addressBar = new QLineEdit();
-    connect(m_addressBar, SIGNAL(returnPressed()), SLOT(changeLocation()));
-
-    QShortcut* selectAddressBar = new QShortcut(Qt::CTRL | Qt::Key_L, this);
-    connect(selectAddressBar, SIGNAL(activated()), this, SLOT(openLocation()));
-
-#if 0
-    // FIXME
-    page()->setCreateNewPageFunction(newPageFunction);
-#endif
-
     if (m_windowOptions.startMaximized)
-        setWindowState(windowState() | Qt::WindowMaximized);
+        setWindowState(Qt::WindowMaximized);
     else
         resize(800, 600);
     show();
@@ -160,15 +53,8 @@
 
 void BrowserWindow::load(const QString& url)
 {
-    m_addressBar->setText(url);
-    m_browser->load(url);
 }
 
-QObject* BrowserWindow::webView() const
-{
-    return m_browser->touchWebView() ? static_cast<QObject*>(m_browser->touchWebView()->page()) : static_cast<QObject*>(m_browser->desktopWebView());
-}
-
 BrowserWindow* BrowserWindow::newWindow(const QString& url)
 {
     BrowserWindow* window = new BrowserWindow();
@@ -176,171 +62,19 @@
     return window;
 }
 
-void BrowserWindow::openLocation()
-{
-    m_addressBar->selectAll();
-    m_addressBar->setFocus();
-}
-
-void BrowserWindow::changeLocation()
-{
-    QString string = m_addressBar->text();
-    m_browser->load(string);
-}
-
-void BrowserWindow::onLoadProgressChanged(int progress)
-{
-    QColor backgroundColor = QApplication::palette().color(QPalette::Base);
-    QColor progressColor = QColor(120, 180, 240);
-    QPalette pallete = m_addressBar->palette();
-
-    if (progress <= 0 || progress >= 100)
-        pallete.setBrush(QPalette::Base, backgroundColor);
-    else {
-        QLinearGradient gradient(0, 0, width(), 0);
-        gradient.setColorAt(0, progressColor);
-        gradient.setColorAt(((double) progress) / 100, progressColor);
-        if (progress != 100)
-            gradient.setColorAt((double) progress / 100 + 0.001, backgroundColor);
-        pallete.setBrush(QPalette::Base, gradient);
-    }
-    m_addressBar->setPalette(pallete);
-}
-
-void BrowserWindow::urlChanged(const QUrl& url)
-{
-    m_addressBar->setText(url.toString());
-    m_browser->requestActivateWindow();
-    m_browser->view()->setFocus(true);
-}
-
-void BrowserWindow::openFile()
-{
-    static const QString filter("HTML Files (*.htm *.html *.xhtml);;Text Files (*.txt);;Image Files (*.gif *.jpg *.png);;SVG Files (*.svg);;All Files (*)");
-
-    QFileDialog fileDialog(this, tr("Open"), QString(), filter);
-    fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
-    fileDialog.setFileMode(QFileDialog::ExistingFile);
-    fileDialog.setOptions(QFileDialog::ReadOnly);
-
-    if (fileDialog.exec()) {
-        QString selectedFile = fileDialog.selectedFiles()[0];
-        if (!selectedFile.isEmpty())
-            load(selectedFile);
-    }
-}
-
 void BrowserWindow::screenshot()
 {
-    QPixmap pixmap = QPixmap::grabWidget(m_browser);
-    QLabel* label = 0;
-    label = new QLabel;
-    label->setAttribute(Qt::WA_DeleteOnClose);
-    label->setWindowTitle("Screenshot - Preview");
-    label->setPixmap(pixmap);
-    label->show();
-
-    QString fileName = QFileDialog::getSaveFileName(label, "Screenshot", QString(), QString("PNG File (.png)"));
-    if (!fileName.isEmpty()) {
-        QRegExp rx("*.png");
-        rx.setCaseSensitivity(Qt::CaseInsensitive);
-        rx.setPatternSyntax(QRegExp::Wildcard);
-
-        if (!rx.exactMatch(fileName))
-            fileName += ".png";
-
-        pixmap.save(fileName, "png");
-        if (label)
-            label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName));
-    }
 }
 
-void BrowserWindow::toggleFullScreenMode(bool enable)
-{
-    bool alreadyEnabled = windowState() & Qt::WindowFullScreen;
-    if (enable ^ alreadyEnabled)
-        setWindowState(windowState() ^ Qt::WindowFullScreen);
-}
-
-void BrowserWindow::showUserAgentDialog()
-{
-#if 0
-    // FIXME
-    updateUserAgentList();
-
-    QDialog dialog(this);
-    dialog.setWindowTitle("Change User Agent");
-    dialog.resize(size().width() * 0.7, dialog.size().height());
-    QVBoxLayout* layout = new QVBoxLayout(&dialog);
-    dialog.setLayout(layout);
-
-    QComboBox* combo = new QComboBox(&dialog);
-    combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
-    combo->setEditable(true);
-    combo->insertItems(0, m_userAgentList);
-    layout->addWidget(combo);
-
-    int index = combo->findText(page()->customUserAgent());
-    combo->setCurrentIndex(index);
-
-    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel
-                                                      , Qt::Horizontal, &dialog);
-    connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
-    connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
-    layout->addWidget(buttonBox);
-
-    if (dialog.exec() && !combo->currentText().isEmpty())
-        page()->setCustomUserAgent(combo->currentText());
-#endif
-}
-
 void BrowserWindow::loadURLListFromFile()
 {
-    QString selectedFile;
-    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);
-    output << "Loaded: " << url.toString() << endl;
-}
-
-void BrowserWindow::onLinkHovered(const QUrl& url, const QString&)
-{
-    statusBar()->showMessage(url.toString());
-}
-
 void BrowserWindow::updateUserAgentList()
 {
-#if 0
-    // FIXME
-    QFile file(":/useragentlist.txt");
-
-    if (file.open(QIODevice::ReadOnly)) {
-        while (!file.atEnd()) {
-            QString agent = file.readLine().trimmed();
-            if (!m_userAgentList.contains(agent))
-                m_userAgentList << agent;
-        }
-        file.close();
-    }
-
-    Q_ASSERT(!m_userAgentList.isEmpty());
-    QWKPage* wkPage = page();
-    if (!(wkPage->customUserAgent().isEmpty() || m_userAgentList.contains(wkPage->customUserAgent())))
-        m_userAgentList << wkPage->customUserAgent();
-#endif
 }
 
 BrowserWindow::~BrowserWindow()
 {
     delete m_urlLoader;
-    delete m_addressBar;
 }

Modified: trunk/Tools/MiniBrowser/qt/BrowserWindow.h (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/BrowserWindow.h	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/BrowserWindow.h	2011-10-26 08:29:00 UTC (rev 98448)
@@ -29,74 +29,35 @@
 #ifndef BrowserWindow_h
 #define BrowserWindow_h
 
-#include "BrowserView.h"
-
 #include "MiniBrowserApplication.h"
 #include <QStringList>
 #include <QTimer>
+#include <QtDeclarative/QSGView>
 
 class UrlLoader;
 
-class WindowWrapper : public QWidget
-{
+class BrowserWindow : public QSGView {
     Q_OBJECT
 
 public:
-    WindowWrapper(QWindow* window, QWidget* widget = 0);
-
-protected:
-    void showEvent(QShowEvent* event);
-    void resizeEvent(QResizeEvent* event);
-
-private slots:
-    void doResize();
-
-private:
-    QWindow* m_window;
-    QTimer m_resizeTimer;
-};
-
-class BrowserWindow : public QMainWindow {
-    Q_OBJECT
-
-public:
     BrowserWindow(WindowOptions* = 0);
     ~BrowserWindow();
     void load(const QString& url);
-
     QObject* webView() const;
 
 public slots:
     BrowserWindow* newWindow(const QString& url = ""
-    void openLocation();
 
-signals:
-    void enteredFullScreenMode(bool on);
-
 protected slots:
-    void changeLocation();
-    void onLoadProgressChanged(int progress);
-    void urlChanged(const QUrl&);
-    void openFile();
-
     void screenshot();
 
-    void toggleFullScreenMode(bool enable);
-
-    void showUserAgentDialog();
-
     void loadURLListFromFile();
 
-    void printURL(const QUrl&);
-    void onLinkHovered(const QUrl&, const QString&);
-
 private:
     void updateUserAgentList();
 
     UrlLoader* m_urlLoader;
     WindowOptions m_windowOptions;
-    BrowserView* m_browser;
-    QLineEdit* m_addressBar;
     QStringList m_userAgentList;
 };
 

Modified: trunk/Tools/MiniBrowser/qt/MiniBrowser.pro (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/MiniBrowser.pro	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/MiniBrowser.pro	2011-10-26 08:29:00 UTC (rev 98448)
@@ -2,7 +2,6 @@
 TARGET = MiniBrowser
 
 SOURCES += \
-    BrowserView.cpp \
     BrowserWindow.cpp \
     main.cpp \
     MiniBrowserApplication.cpp \
@@ -10,7 +9,6 @@
     utils.cpp \
 
 HEADERS += \
-    BrowserView.h \
     BrowserWindow.h \
     MiniBrowserApplication.h \
     UrlLoader.h \
@@ -32,7 +30,6 @@
 
 QT += network declarative
 macx:QT+=xml
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
 linux-* {
     # From Creator's src/rpath.pri:
@@ -47,11 +44,6 @@
     QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
 }
 
-contains(QT_CONFIG, opengl) {
-    QT += opengl
-    DEFINES += QT_CONFIGURED_WITH_OPENGL
-}
-
 DEFINES -= QT_ASCII_CAST_WARNINGS
 
 # Use the MiniBrowser.qrc file from the sources.

Modified: trunk/Tools/MiniBrowser/qt/MiniBrowserApplication.cpp (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/MiniBrowserApplication.cpp	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/MiniBrowserApplication.cpp	2011-10-26 08:29:00 UTC (rev 98448)
@@ -61,7 +61,7 @@
 }
 
 MiniBrowserApplication::MiniBrowserApplication(int& argc, char** argv)
-    : QApplication(argc, argv, QApplication::GuiServer)
+    : QGuiApplication(argc, argv)
     , m_windowOptions()
     , m_realTouchEventReceived(false)
     , m_pendingFakeTouchEventCount(0)
@@ -82,14 +82,14 @@
     // with touch screen, and we should not have touch mocking.
 
     if (!event->spontaneous() || m_realTouchEventReceived)
-        return QApplication::notify(target, event);
+        return QGuiApplication::notify(target, event);
 
     if (isTouchEvent(event) && static_cast<QTouchEvent*>(event)->deviceType() == QTouchEvent::TouchScreen) {
         if (m_pendingFakeTouchEventCount)
             --m_pendingFakeTouchEventCount;
         else
             m_realTouchEventReceived = true;
-        return QApplication::notify(target, event);
+        return QGuiApplication::notify(target, event);
     }
 
     QWindow* targetWindow = qobject_cast<QWindow*>(target);
@@ -111,13 +111,13 @@
             break;
         case QEvent::MouseMove:
             if (!mouseEvent->buttons() || !m_touchPoints.contains(mouseEvent->buttons()))
-                return QApplication::notify(target, event);
+                return QGuiApplication::notify(target, event);
             touchPoint.state = Qt::TouchPointMoved;
             touchPoint.id = mouseEvent->buttons();
             break;
         case QEvent::MouseButtonRelease:
             if (mouseEvent->modifiers().testFlag(Qt::ControlModifier))
-                return QApplication::notify(target, event);
+                return QGuiApplication::notify(target, event);
             touchPoint.state = Qt::TouchPointReleased;
             touchPoint.id = mouseEvent->button();
             break;
@@ -148,7 +148,7 @@
             break;
         case Qt::TouchPointStationary:
             // Don't send the event if nothing changed.
-            return QApplication::notify(target, event);
+            return QGuiApplication::notify(target, event);
         default:
             eventType = QEvent::TouchUpdate;
             break;
@@ -162,10 +162,9 @@
             if (touchPoint.state ==  Qt::TouchPointReleased)
                 m_touchPoints.remove(touchPoint.id);
         }
-        return true;
     }
 
-    return QApplication::notify(target, event);
+    return QGuiApplication::notify(target, event);
 }
 
 void MiniBrowserApplication::handleUserOptions()
@@ -183,11 +182,7 @@
              << "[-r list]"
              << "[-robot-timeout seconds]"
              << "[-robot-extra-time seconds]"
-             << "[-chunked-drawing-area]"
              << "[-print-loaded-urls]"
-#if defined(QT_CONFIGURED_WITH_OPENGL)
-             << "[-gl-viewport]"
-#endif
              << "URLs";
         appQuit(0);
     }
@@ -224,8 +219,4 @@
     if (args.contains("-print-loaded-urls"))
         m_windowOptions.printLoadedUrls = true;
 
-#if defined(QT_CONFIGURED_WITH_OPENGL)
-    if (args.contains("-gl-viewport"))
-        m_windowOptions.useQGLWidgetViewport = true;
-#endif
 }

Modified: trunk/Tools/MiniBrowser/qt/MiniBrowserApplication.h (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/MiniBrowserApplication.h	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/MiniBrowserApplication.h	2011-10-26 08:29:00 UTC (rev 98448)
@@ -29,18 +29,10 @@
 #ifndef MiniBrowserApplication_h
 #define MiniBrowserApplication_h
 
-#include <QApplication>
-#include <QFileDialog>
 #include <QHash>
-#include <QLabel>
-#include <QLineEdit>
-#include <QMainWindow>
-#include <QMenu>
-#include <QMenuBar>
-#include <QShortcut>
-#include <QStatusBar>
 #include <QStringList>
-#include <QToolBar>
+#include <QtDeclarative>
+#include <QtGui/QGuiApplication>
 #include <QTouchEvent>
 #include <QUrl>
 #include "qwindowsysteminterface_qpa.h"
@@ -59,12 +51,9 @@
     bool printLoadedUrls;
     bool useTouchWebView;
     bool startMaximized;
-#if defined(QT_CONFIGURED_WITH_OPENGL)
-    bool useQGLWidgetViewport;
-#endif
 };
 
-class MiniBrowserApplication : public QApplication {
+class MiniBrowserApplication : public QGuiApplication {
     Q_OBJECT
 
 public:

Modified: trunk/Tools/MiniBrowser/qt/UrlLoader.cpp (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/UrlLoader.cpp	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/UrlLoader.cpp	2011-10-26 08:29:00 UTC (rev 98448)
@@ -41,13 +41,16 @@
     m_checkIfFinishedTimer.setSingleShot(true);
     connect(&m_checkIfFinishedTimer, SIGNAL(timeout()), this, SLOT(checkIfFinished()));
     // loadStarted and loadFinished on QWebPage is emitted for each frame/sub-frame
-    connect(m_browserWindow->webView(), SIGNAL(loadStarted()), this, SLOT(frameLoadStarted()));
-    connect(m_browserWindow->webView(), SIGNAL(loadFinished(bool)), this, SLOT(frameLoadFinished()));
 
+    // FIXME: Reconnect these signals after Qt5/QtQuick rewrite if necessary.
+    // connect(m_browserWindow->webView(), SIGNAL(loadStarted()), this, SLOT(frameLoadStarted()));
+    // connect(m_browserWindow->webView(), SIGNAL(loadFinished(bool)), this, SLOT(frameLoadFinished()));
+
     if (timeoutSeconds) {
         m_timeoutTimer.setInterval(timeoutSeconds * 1000);
         m_timeoutTimer.setSingleShot(true);
-        connect(m_browserWindow->webView(), SIGNAL(loadStarted()), &m_timeoutTimer, SLOT(start()));
+        // FIXME: Reconnect this signal after Qt5/QtQuick rewrite if necessary.
+        // connect(m_browserWindow->webView(), SIGNAL(loadStarted()), &m_timeoutTimer, SLOT(start()));
         connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(loadNext()));
     }
     if (extraTimeSeconds) {

Modified: trunk/Tools/MiniBrowser/qt/main.cpp (98447 => 98448)


--- trunk/Tools/MiniBrowser/qt/main.cpp	2011-10-26 08:28:30 UTC (rev 98447)
+++ trunk/Tools/MiniBrowser/qt/main.cpp	2011-10-26 08:29:00 UTC (rev 98448)
@@ -30,6 +30,7 @@
 
 #include "MiniBrowserApplication.h"
 #include "UrlLoader.h"
+#include <QDir>
 #include <QLatin1String>
 #include <QRegExp>
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to