[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

kenneth at webkit.org kenneth at webkit.org
Thu Feb 4 21:32:41 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 4762a518e397040596670836df4c9c694bdabb0a
Author: kenneth at webkit.org <kenneth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 29 21:32:27 2010 +0000

    Rubberstamped by Simon Hausmann.
    
    [Qt] Separate implementation from class definition.
    
    * QtLauncher/main.cpp:
    (LauncherWindow::webView):
    (LauncherWindow::LauncherWindow):
    (LauncherWindow::~LauncherWindow):
    (LauncherWindow::keyPressEvent):
    (LauncherWindow::grabZoomKeys):
    (LauncherWindow::sendTouchEvent):
    (LauncherWindow::eventFilter):
    (LauncherWindow::loadStarted):
    (LauncherWindow::loadFinished):
    (LauncherWindow::showLinkHover):
    (LauncherWindow::zoomIn):
    (LauncherWindow::zoomOut):
    (LauncherWindow::resetZoom):
    (LauncherWindow::toggleZoomTextOnly):
    (LauncherWindow::print):
    (LauncherWindow::screenshot):
    (LauncherWindow::setEditable):
    (LauncherWindow::dumpHtml):
    (LauncherWindow::selectElements):
    (LauncherWindow::setTouchMocking):
    (LauncherWindow::newWindow):
    (LauncherWindow::setupUI):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54077 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 13d56b4..d5dcb06 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -9,6 +9,36 @@
 
 2010-01-29  Kenneth Rohde Christiansen  <kenneth at webkit.org>
 
+        Rubberstamped by Simon Hausmann.
+
+        [Qt] Separate implementation from class definition.
+
+        * QtLauncher/main.cpp:
+        (LauncherWindow::webView):
+        (LauncherWindow::LauncherWindow):
+        (LauncherWindow::~LauncherWindow):
+        (LauncherWindow::keyPressEvent):
+        (LauncherWindow::grabZoomKeys):
+        (LauncherWindow::sendTouchEvent):
+        (LauncherWindow::eventFilter):
+        (LauncherWindow::loadStarted):
+        (LauncherWindow::loadFinished):
+        (LauncherWindow::showLinkHover):
+        (LauncherWindow::zoomIn):
+        (LauncherWindow::zoomOut):
+        (LauncherWindow::resetZoom):
+        (LauncherWindow::toggleZoomTextOnly):
+        (LauncherWindow::print):
+        (LauncherWindow::screenshot):
+        (LauncherWindow::setEditable):
+        (LauncherWindow::dumpHtml):
+        (LauncherWindow::selectElements):
+        (LauncherWindow::setTouchMocking):
+        (LauncherWindow::newWindow):
+        (LauncherWindow::setupUI):
+
+2010-01-29  Kenneth Rohde Christiansen  <kenneth at webkit.org>
+
         Reviewed by Ariya Hidayat.
 
         [Qt] On Maemo5, a click/touch in the location bar (when unfocused)
diff --git a/WebKitTools/QtLauncher/main.cpp b/WebKitTools/QtLauncher/main.cpp
index 1b77b34..081b8f0 100644
--- a/WebKitTools/QtLauncher/main.cpp
+++ b/WebKitTools/QtLauncher/main.cpp
@@ -74,399 +74,431 @@ class LauncherWindow : public MainWindow {
     Q_OBJECT
 
 public:
-    LauncherWindow(QString url = QString())
-        : MainWindow(url)
-        , currentZoom(100)
-    {
-        QSplitter* splitter = new QSplitter(Qt::Vertical, this);
-        setCentralWidget(splitter);
+    LauncherWindow(QString url = QString());
+    virtual ~LauncherWindow();
 
-        view = new WebViewTraditional(splitter);
-        view->setPage(page());
+    virtual void keyPressEvent(QKeyEvent* event);
+    void grabZoomKeys(bool grab);
 
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-        view->installEventFilter(this);
-        touchMocking = false;
+    void sendTouchEvent();
+    bool eventFilter(QObject* obj, QEvent* event);
 #endif
 
-        connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStarted()));
-        connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
-        connect(page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
-                this, SLOT(showLinkHover(const QString&, const QString&)));
+    QWebView* webView() const { return view; }
 
-        inspector = new WebInspector(splitter);
-        inspector->setPage(page());
-        inspector->hide();
-        connect(this, SIGNAL(destroyed()), inspector, SLOT(deleteLater()));
+protected slots:
+    void loadStarted();
+    void loadFinished();
 
-        setupUI();
+    void showLinkHover(const QString &link, const QString &toolTip);
 
-        // the zoom values are chosen to be like in Mozilla Firefox 3
-        zoomLevels << 30 << 50 << 67 << 80 << 90;
-        zoomLevels << 100;
-        zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
+    void zoomIn();
+    void zoomOut();
+    void resetZoom();
+    void toggleZoomTextOnly(bool on);
 
-        grabZoomKeys(true);
+    void print();
+    void screenshot();
 
-        load(url);
-    }
+    void setEditable(bool on);
 
-    ~LauncherWindow()
-    {
-        grabZoomKeys(false);
-    }
+    /* void dumpPlugins() */
+    void dumpHtml();
 
-    void keyPressEvent(QKeyEvent* event)
-    {
-#ifdef Q_WS_MAEMO_5
-        switch (event->key()) {
-        case Qt::Key_F7:
-            zoomIn();
-            event->accept();
-            break;
-        case Qt::Key_F8:
-            zoomOut();
-            event->accept();
-            break;
-        }
+    void selectElements();
+
+    void setTouchMocking(bool on);
+
+public slots:
+    void newWindow(const QString& url = QString());
+
+private:
+    // create the status bar, tool bar & menu
+    void setupUI();
+
+private:
+    QVector<int> zoomLevels;
+    int currentZoom;
+
+    QWebView* view;
+    WebInspector* inspector;
+
+    QAction* formatMenuAction;
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    QList<QTouchEvent::TouchPoint> touchPoints;
+    bool touchMocking;
+#endif
+};
+
+
+LauncherWindow::LauncherWindow(QString url)
+    : MainWindow(url)
+    , currentZoom(100)
+{
+    QSplitter* splitter = new QSplitter(Qt::Vertical, this);
+    setCentralWidget(splitter);
+
+    view = new WebViewTraditional(splitter);
+    view->setPage(page());
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    view->installEventFilter(this);
+    touchMocking = false;
 #endif
-        MainWindow::keyPressEvent(event);
+
+    connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStarted()));
+    connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
+    connect(page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
+            this, SLOT(showLinkHover(const QString&, const QString&)));
+
+    inspector = new WebInspector(splitter);
+    inspector->setPage(page());
+    inspector->hide();
+    connect(this, SIGNAL(destroyed()), inspector, SLOT(deleteLater()));
+
+    setupUI();
+
+    // the zoom values are chosen to be like in Mozilla Firefox 3
+    zoomLevels << 30 << 50 << 67 << 80 << 90;
+    zoomLevels << 100;
+    zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
+
+    grabZoomKeys(true);
+
+    load(url);
+}
+
+LauncherWindow::~LauncherWindow()
+{
+    grabZoomKeys(false);
+}
+
+void LauncherWindow::keyPressEvent(QKeyEvent* event)
+{
+#ifdef Q_WS_MAEMO_5
+    switch (event->key()) {
+    case Qt::Key_F7:
+        zoomIn();
+        event->accept();
+        break;
+    case Qt::Key_F8:
+        zoomOut();
+        event->accept();
+        break;
     }
+#endif
+    MainWindow::keyPressEvent(event);
+}
 
-    void grabZoomKeys(bool grab)
-    {
+void LauncherWindow::grabZoomKeys(bool grab)
+{
 #ifdef Q_WS_MAEMO_5
-        if (!winId()) {
-            qWarning("Can't grab keys unless we have a window id");
-            return;
-        }
+    if (!winId()) {
+        qWarning("Can't grab keys unless we have a window id");
+        return;
+    }
 
-        Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
-        if (!atom) {
-            qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM");
-            return;
-        }
+    Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
+    if (!atom) {
+        qWarning("Unable to obtain _HILDON_ZOOM_KEY_ATOM");
+        return;
+    }
 
-        unsigned long val = (grab) ? 1 : 0;
-        XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&val), 1);
+    unsigned long val = (grab) ? 1 : 0;
+    XChangeProperty(QX11Info::display(), winId(), atom, XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&val), 1);
 #endif
-    }
+}
 
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-    void sendTouchEvent()
-    {
-        if (touchPoints.isEmpty())
-            return;
-
-        QEvent::Type type = QEvent::TouchUpdate;
-        if (touchPoints.size() == 1) {
-            if (touchPoints[0].state() == Qt::TouchPointReleased)
-                type = QEvent::TouchEnd;
-            else if (touchPoints[0].state() == Qt::TouchPointPressed)
-                type = QEvent::TouchBegin;
-        }
-
-        QTouchEvent touchEv(type);
-        touchEv.setTouchPoints(touchPoints);
-        QCoreApplication::sendEvent(page(), &touchEv);
+void LauncherWindow::sendTouchEvent()
+{
+    if (touchPoints.isEmpty())
+        return;
 
-        // After sending the event, remove all touchpoints that were released
+    QEvent::Type type = QEvent::TouchUpdate;
+    if (touchPoints.size() == 1) {
         if (touchPoints[0].state() == Qt::TouchPointReleased)
-            touchPoints.removeAt(0);
-        if (touchPoints.size() > 1 && touchPoints[1].state() == Qt::TouchPointReleased)
-            touchPoints.removeAt(1);
+            type = QEvent::TouchEnd;
+        else if (touchPoints[0].state() == Qt::TouchPointPressed)
+            type = QEvent::TouchBegin;
     }
 
-    bool eventFilter(QObject* obj, QEvent* event)
-    {
-        if (!touchMocking || obj != view)
-            return QObject::eventFilter(obj, event);
+    QTouchEvent touchEv(type);
+    touchEv.setTouchPoints(touchPoints);
+    QCoreApplication::sendEvent(page(), &touchEv);
 
-        if (event->type() == QEvent::MouseButtonPress
-            || event->type() == QEvent::MouseButtonRelease
-            || event->type() == QEvent::MouseButtonDblClick
-            || event->type() == QEvent::MouseMove) {
-
-            QMouseEvent* ev = static_cast<QMouseEvent*>(event);
-            if (ev->type() == QEvent::MouseMove
-                && !(ev->buttons() & Qt::LeftButton))
-                return false;
+    // After sending the event, remove all touchpoints that were released
+    if (touchPoints[0].state() == Qt::TouchPointReleased)
+        touchPoints.removeAt(0);
+    if (touchPoints.size() > 1 && touchPoints[1].state() == Qt::TouchPointReleased)
+        touchPoints.removeAt(1);
+}
 
+bool LauncherWindow::eventFilter(QObject* obj, QEvent* event)
+{
+    if (!touchMocking || obj != view)
+        return QObject::eventFilter(obj, event);
+
+    if (event->type() == QEvent::MouseButtonPress
+        || event->type() == QEvent::MouseButtonRelease
+        || event->type() == QEvent::MouseButtonDblClick
+        || event->type() == QEvent::MouseMove) {
+
+        QMouseEvent* ev = static_cast<QMouseEvent*>(event);
+        if (ev->type() == QEvent::MouseMove
+            && !(ev->buttons() & Qt::LeftButton))
+            return false;
+
+        QTouchEvent::TouchPoint touchPoint;
+        touchPoint.setState(Qt::TouchPointMoved);
+        if ((ev->type() == QEvent::MouseButtonPress
+             || ev->type() == QEvent::MouseButtonDblClick))
+            touchPoint.setState(Qt::TouchPointPressed);
+        else if (ev->type() == QEvent::MouseButtonRelease)
+            touchPoint.setState(Qt::TouchPointReleased);
+
+        touchPoint.setId(0);
+        touchPoint.setScreenPos(ev->globalPos());
+        touchPoint.setPos(ev->pos());
+        touchPoint.setPressure(1);
+
+        // If the point already exists, update it. Otherwise create it.
+        if (touchPoints.size() > 0 && !touchPoints[0].id())
+            touchPoints[0] = touchPoint;
+        else if (touchPoints.size() > 1 && !touchPoints[1].id())
+            touchPoints[1] = touchPoint;
+        else
+            touchPoints.append(touchPoint);
+
+        sendTouchEvent();
+    } else if (event->type() == QEvent::KeyPress
+        && static_cast<QKeyEvent*>(event)->key() == Qt::Key_F
+        && static_cast<QKeyEvent*>(event)->modifiers() == Qt::ControlModifier) {
+
+        // If the keyboard point is already pressed, release it.
+        // Otherwise create it and append to touchPoints.
+        if (touchPoints.size() > 0 && touchPoints[0].id() == 1) {
+            touchPoints[0].setState(Qt::TouchPointReleased);
+            sendTouchEvent();
+        } else if (touchPoints.size() > 1 && touchPoints[1].id() == 1) {
+            touchPoints[1].setState(Qt::TouchPointReleased);
+            sendTouchEvent();
+        } else {
             QTouchEvent::TouchPoint touchPoint;
-            touchPoint.setState(Qt::TouchPointMoved);
-            if ((ev->type() == QEvent::MouseButtonPress
-                 || ev->type() == QEvent::MouseButtonDblClick))
-                touchPoint.setState(Qt::TouchPointPressed);
-            else if (ev->type() == QEvent::MouseButtonRelease)
-                touchPoint.setState(Qt::TouchPointReleased);
-
-            touchPoint.setId(0);
-            touchPoint.setScreenPos(ev->globalPos());
-            touchPoint.setPos(ev->pos());
+            touchPoint.setState(Qt::TouchPointPressed);
+            touchPoint.setId(1);
+            touchPoint.setScreenPos(QCursor::pos());
+            touchPoint.setPos(view->mapFromGlobal(QCursor::pos()));
             touchPoint.setPressure(1);
-
-            // If the point already exists, update it. Otherwise create it.
-            if (touchPoints.size() > 0 && !touchPoints[0].id())
-                touchPoints[0] = touchPoint;
-            else if (touchPoints.size() > 1 && !touchPoints[1].id())
-                touchPoints[1] = touchPoint;
-            else
-                touchPoints.append(touchPoint);
-
+            touchPoints.append(touchPoint);
             sendTouchEvent();
-        } else if (event->type() == QEvent::KeyPress
-            && static_cast<QKeyEvent*>(event)->key() == Qt::Key_F
-            && static_cast<QKeyEvent*>(event)->modifiers() == Qt::ControlModifier) {
-
-            // If the keyboard point is already pressed, release it.
-            // Otherwise create it and append to touchPoints.
-            if (touchPoints.size() > 0 && touchPoints[0].id() == 1) {
-                touchPoints[0].setState(Qt::TouchPointReleased);
-                sendTouchEvent();
-            } else if (touchPoints.size() > 1 && touchPoints[1].id() == 1) {
-                touchPoints[1].setState(Qt::TouchPointReleased);
-                sendTouchEvent();
-            } else {
-                QTouchEvent::TouchPoint touchPoint;
-                touchPoint.setState(Qt::TouchPointPressed);
-                touchPoint.setId(1);
-                touchPoint.setScreenPos(QCursor::pos());
-                touchPoint.setPos(view->mapFromGlobal(QCursor::pos()));
-                touchPoint.setPressure(1);
-                touchPoints.append(touchPoint);
-                sendTouchEvent();
-
-                // After sending the event, change the touchpoint state to stationary
-                touchPoints.last().setState(Qt::TouchPointStationary);
-            }
+
+            // After sending the event, change the touchpoint state to stationary
+            touchPoints.last().setState(Qt::TouchPointStationary);
         }
-        return false;
     }
+    return false;
+}
 #endif // QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
 
-    QWebView* webView() const
-    {
-        return view;
-    }
-
-protected slots:
-    void loadStarted()
-    {
-        view->setFocus(Qt::OtherFocusReason);
-    }
+void LauncherWindow::loadStarted()
+{
+    view->setFocus(Qt::OtherFocusReason);
+}
 
-    void loadFinished()
-    {
-        QUrl url = page()->mainFrame()->url();
-        setAddressUrl(url.toString());
-        addCompleterEntry(url);
-    }
+void LauncherWindow::loadFinished()
+{
+    QUrl url = page()->mainFrame()->url();
+    setAddressUrl(url.toString());
+    addCompleterEntry(url);
+}
 
-    void showLinkHover(const QString &link, const QString &toolTip)
-    {
+void LauncherWindow::showLinkHover(const QString &link, const QString &toolTip)
+{
 #ifndef Q_WS_MAEMO_5
-        statusBar()->showMessage(link);
+    statusBar()->showMessage(link);
 #endif
 #ifndef QT_NO_TOOLTIP
-        if (!toolTip.isEmpty())
-            QToolTip::showText(QCursor::pos(), toolTip);
+    if (!toolTip.isEmpty())
+        QToolTip::showText(QCursor::pos(), toolTip);
 #endif
-    }
+}
 
-    void zoomIn()
-    {
-        int i = zoomLevels.indexOf(currentZoom);
-        Q_ASSERT(i >= 0);
-        if (i < zoomLevels.count() - 1)
-            currentZoom = zoomLevels[i + 1];
+void LauncherWindow::zoomIn()
+{
+    int i = zoomLevels.indexOf(currentZoom);
+    Q_ASSERT(i >= 0);
+    if (i < zoomLevels.count() - 1)
+        currentZoom = zoomLevels[i + 1];
 
-        page()->mainFrame()->setZoomFactor(qreal(currentZoom) / 100.0);
-    }
+    page()->mainFrame()->setZoomFactor(qreal(currentZoom) / 100.0);
+}
 
-    void zoomOut()
-    {
-        int i = zoomLevels.indexOf(currentZoom);
-        Q_ASSERT(i >= 0);
-        if (i > 0)
-            currentZoom = zoomLevels[i - 1];
+void LauncherWindow::zoomOut()
+{
+    int i = zoomLevels.indexOf(currentZoom);
+    Q_ASSERT(i >= 0);
+    if (i > 0)
+        currentZoom = zoomLevels[i - 1];
 
-        page()->mainFrame()->setZoomFactor(qreal(currentZoom) / 100.0);
-    }
+    page()->mainFrame()->setZoomFactor(qreal(currentZoom) / 100.0);
+}
 
-    void resetZoom()
-    {
-       currentZoom = 100;
-       page()->mainFrame()->setZoomFactor(1.0);
-    }
+void LauncherWindow::resetZoom()
+{
+   currentZoom = 100;
+   page()->mainFrame()->setZoomFactor(1.0);
+}
 
-    void toggleZoomTextOnly(bool b)
-    {
-        page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, b);
-    }
+void LauncherWindow::toggleZoomTextOnly(bool b)
+{
+    page()->settings()->setAttribute(QWebSettings::ZoomTextOnly, b);
+}
 
-    void print()
-    {
+void LauncherWindow::print()
+{
 #if !defined(QT_NO_PRINTER)
-        QPrintPreviewDialog dlg(this);
-        connect(&dlg, SIGNAL(paintRequested(QPrinter *)),
-                view, SLOT(print(QPrinter *)));
-        dlg.exec();
+    QPrintPreviewDialog dlg(this);
+    connect(&dlg, SIGNAL(paintRequested(QPrinter*)),
+            view, SLOT(print(QPrinter*)));
+    dlg.exec();
 #endif
-    }
+}
 
-    void screenshot()
-    {
-        QPixmap pixmap = QPixmap::grabWidget(view);
-        QLabel* label = new QLabel;
-        label->setAttribute(Qt::WA_DeleteOnClose);
-        label->setWindowTitle("Screenshot - Preview");
-        label->setPixmap(pixmap);
-        label->show();
-
-        QString fileName = QFileDialog::getSaveFileName(label, "Screenshot");
-        if (!fileName.isEmpty()) {
-            pixmap.save(fileName, "png");
-            label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName));
-        }
+void LauncherWindow::screenshot()
+{
+    QPixmap pixmap = QPixmap::grabWidget(view);
+    QLabel* label = new QLabel;
+    label->setAttribute(Qt::WA_DeleteOnClose);
+    label->setWindowTitle("Screenshot - Preview");
+    label->setPixmap(pixmap);
+    label->show();
+
+    QString fileName = QFileDialog::getSaveFileName(label, "Screenshot");
+    if (!fileName.isEmpty()) {
+        pixmap.save(fileName, "png");
+        label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName));
     }
+}
 
-    void setEditable(bool on)
-    {
-        view->page()->setContentEditable(on);
-        formatMenuAction->setVisible(on);
-    }
+void LauncherWindow::setEditable(bool on)
+{
+    view->page()->setContentEditable(on);
+    formatMenuAction->setVisible(on);
+}
 
-    /*
-    void dumpPlugins() {
-        QList<QWebPluginInfo> plugins = QWebSettings::pluginDatabase()->plugins();
-        foreach (const QWebPluginInfo plugin, plugins) {
-            qDebug() << "Plugin:" << plugin.name();
-            foreach (const QWebPluginInfo::MimeType mime, plugin.mimeTypes()) {
-                qDebug() << "   " << mime.name;
-            }
+/*
+void LauncherWindow::dumpPlugins() {
+    QList<QWebPluginInfo> plugins = QWebSettings::pluginDatabase()->plugins();
+    foreach (const QWebPluginInfo plugin, plugins) {
+        qDebug() << "Plugin:" << plugin.name();
+        foreach (const QWebPluginInfo::MimeType mime, plugin.mimeTypes()) {
+            qDebug() << "   " << mime.name;
         }
     }
-    */
-
-    void dumpHtml()
-    {
-        qDebug() << "HTML: " << page()->mainFrame()->toHtml();
-    }
+}
+*/
 
-    void selectElements()
-    {
-        bool ok;
-        QString str = QInputDialog::getText(this, "Select elements", "Choose elements",
-                                            QLineEdit::Normal, "a", &ok);
+void LauncherWindow::dumpHtml()
+{
+    qDebug() << "HTML: " << page()->mainFrame()->toHtml();
+}
 
-        if (ok && !str.isEmpty()) {
-            QWebElementCollection result =  page()->mainFrame()->findAllElements(str);
-            foreach (QWebElement e, result)
-                e.setStyleProperty("background-color", "yellow");
+void LauncherWindow::selectElements()
+{
+    bool ok;
+    QString str = QInputDialog::getText(this, "Select elements", "Choose elements",
+                                        QLineEdit::Normal, "a", &ok);
+
+    if (ok && !str.isEmpty()) {
+        QWebElementCollection result =  page()->mainFrame()->findAllElements(str);
+        foreach (QWebElement e, result)
+            e.setStyleProperty("background-color", "yellow");
 #ifndef Q_WS_MAEMO_5
-            statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000);
+        statusBar()->showMessage(QString("%1 element(s) selected").arg(result.count()), 5000);
 #endif
-        }
-    }
-
-    void setTouchMocking(bool on)
-    {
-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-        touchMocking = on;
-#endif
-    }
-
-public slots:
-
-    void newWindow(const QString& url = QString())
-    {
-        LauncherWindow* mw = new LauncherWindow(url);
-        mw->show();
     }
+}
 
-private:
-
-    QVector<int> zoomLevels;
-    int currentZoom;
-
-    // create the status bar, tool bar & menu
-    void setupUI()
-    {
-        QMenu* fileMenu = menuBar()->addMenu("&File");
-        fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New);
-        fileMenu->addAction(tr("Open File..."), this, SLOT(openFile()), QKeySequence::Open);
-        fileMenu->addAction("Close Window", this, SLOT(close()), QKeySequence::Close);
-        fileMenu->addSeparator();
-        fileMenu->addAction("Take Screen Shot...", this, SLOT(screenshot()));
-        fileMenu->addAction(tr("Print..."), this, SLOT(print()), QKeySequence::Print);
-        fileMenu->addSeparator();
-        fileMenu->addAction("Quit", QApplication::instance(), SLOT(closeAllWindows()), QKeySequence(Qt::CTRL | Qt::Key_Q));
-
-        QMenu* editMenu = menuBar()->addMenu("&Edit");
-        editMenu->addAction(page()->action(QWebPage::Undo));
-        editMenu->addAction(page()->action(QWebPage::Redo));
-        editMenu->addSeparator();
-        editMenu->addAction(page()->action(QWebPage::Cut));
-        editMenu->addAction(page()->action(QWebPage::Copy));
-        editMenu->addAction(page()->action(QWebPage::Paste));
-        editMenu->addSeparator();
-        QAction* setEditable = editMenu->addAction("Set Editable", this, SLOT(setEditable(bool)));
-        setEditable->setCheckable(true);
-
-        QMenu* viewMenu = menuBar()->addMenu("&View");
-        viewMenu->addAction(view->pageAction(QWebPage::Stop));
-        viewMenu->addAction(view->pageAction(QWebPage::Reload));
-        viewMenu->addSeparator();
-        QAction* zoomIn = viewMenu->addAction("Zoom &In", this, SLOT(zoomIn()));
-        QAction* zoomOut = viewMenu->addAction("Zoom &Out", this, SLOT(zoomOut()));
-        QAction* resetZoom = viewMenu->addAction("Reset Zoom", this, SLOT(resetZoom()));
-        QAction* zoomTextOnly = viewMenu->addAction("Zoom Text Only", this, SLOT(toggleZoomTextOnly(bool)));
-        zoomTextOnly->setCheckable(true);
-        zoomTextOnly->setChecked(false);
-        viewMenu->addSeparator();
-        viewMenu->addAction("Dump HTML", this, SLOT(dumpHtml()));
-        // viewMenu->addAction("Dump plugins", this, SLOT(dumpPlugins()));
-
-        QMenu* formatMenu = new QMenu("F&ormat", this);
-        formatMenuAction = menuBar()->addMenu(formatMenu);
-        formatMenuAction->setVisible(false);
-        formatMenu->addAction(page()->action(QWebPage::ToggleBold));
-        formatMenu->addAction(page()->action(QWebPage::ToggleItalic));
-        formatMenu->addAction(page()->action(QWebPage::ToggleUnderline));
-        QMenu* writingMenu = formatMenu->addMenu(tr("Writing Direction"));
-        writingMenu->addAction(page()->action(QWebPage::SetTextDirectionDefault));
-        writingMenu->addAction(page()->action(QWebPage::SetTextDirectionLeftToRight));
-        writingMenu->addAction(page()->action(QWebPage::SetTextDirectionRightToLeft));
-
-        zoomIn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus));
-        zoomOut->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus));
-        resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0));
-
-        QMenu* toolsMenu = menuBar()->addMenu("&Develop");
-        toolsMenu->addAction("Select Elements...", this, SLOT(selectElements()));
-        QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I));
-        showInspectorAction->setCheckable(true);
-        showInspectorAction->connect(inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool)));
-
+void LauncherWindow::setTouchMocking(bool on)
+{
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-        QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool)));
-        touchMockAction->setCheckable(true);
-        touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T));
+    touchMocking = on;
 #endif
-    }
+}
 
-private:
-    QWebView* view;
-    WebInspector* inspector;
+void LauncherWindow::newWindow(const QString& url)
+{
+    LauncherWindow* mw = new LauncherWindow(url);
+    mw->show();
+}
 
-    QAction* formatMenuAction;
+void LauncherWindow::setupUI()
+{
+    QMenu* fileMenu = menuBar()->addMenu("&File");
+    fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New);
+    fileMenu->addAction(tr("Open File..."), this, SLOT(openFile()), QKeySequence::Open);
+    fileMenu->addAction("Close Window", this, SLOT(close()), QKeySequence::Close);
+    fileMenu->addSeparator();
+    fileMenu->addAction("Take Screen Shot...", this, SLOT(screenshot()));
+    fileMenu->addAction(tr("Print..."), this, SLOT(print()), QKeySequence::Print);
+    fileMenu->addSeparator();
+    fileMenu->addAction("Quit", QApplication::instance(), SLOT(closeAllWindows()), QKeySequence(Qt::CTRL | Qt::Key_Q));
+
+    QMenu* editMenu = menuBar()->addMenu("&Edit");
+    editMenu->addAction(page()->action(QWebPage::Undo));
+    editMenu->addAction(page()->action(QWebPage::Redo));
+    editMenu->addSeparator();
+    editMenu->addAction(page()->action(QWebPage::Cut));
+    editMenu->addAction(page()->action(QWebPage::Copy));
+    editMenu->addAction(page()->action(QWebPage::Paste));
+    editMenu->addSeparator();
+    QAction* setEditable = editMenu->addAction("Set Editable", this, SLOT(setEditable(bool)));
+    setEditable->setCheckable(true);
+
+    QMenu* viewMenu = menuBar()->addMenu("&View");
+    viewMenu->addAction(view->pageAction(QWebPage::Stop));
+    viewMenu->addAction(view->pageAction(QWebPage::Reload));
+    viewMenu->addSeparator();
+    QAction* zoomIn = viewMenu->addAction("Zoom &In", this, SLOT(zoomIn()));
+    QAction* zoomOut = viewMenu->addAction("Zoom &Out", this, SLOT(zoomOut()));
+    QAction* resetZoom = viewMenu->addAction("Reset Zoom", this, SLOT(resetZoom()));
+    QAction* zoomTextOnly = viewMenu->addAction("Zoom Text Only", this, SLOT(toggleZoomTextOnly(bool)));
+    zoomTextOnly->setCheckable(true);
+    zoomTextOnly->setChecked(false);
+    viewMenu->addSeparator();
+    viewMenu->addAction("Dump HTML", this, SLOT(dumpHtml()));
+    // viewMenu->addAction("Dump plugins", this, SLOT(dumpPlugins()));
+
+    QMenu* formatMenu = new QMenu("F&ormat", this);
+    formatMenuAction = menuBar()->addMenu(formatMenu);
+    formatMenuAction->setVisible(false);
+    formatMenu->addAction(page()->action(QWebPage::ToggleBold));
+    formatMenu->addAction(page()->action(QWebPage::ToggleItalic));
+    formatMenu->addAction(page()->action(QWebPage::ToggleUnderline));
+    QMenu* writingMenu = formatMenu->addMenu(tr("Writing Direction"));
+    writingMenu->addAction(page()->action(QWebPage::SetTextDirectionDefault));
+    writingMenu->addAction(page()->action(QWebPage::SetTextDirectionLeftToRight));
+    writingMenu->addAction(page()->action(QWebPage::SetTextDirectionRightToLeft));
+
+    zoomIn->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus));
+    zoomOut->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus));
+    resetZoom->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0));
+
+    QMenu* toolsMenu = menuBar()->addMenu("&Develop");
+    toolsMenu->addAction("Select Elements...", this, SLOT(selectElements()));
+    QAction* showInspectorAction = toolsMenu->addAction("Show Web Inspector", inspector, SLOT(setVisible(bool)), QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_I));
+    showInspectorAction->setCheckable(true);
+    showInspectorAction->connect(inspector, SIGNAL(visibleChanged(bool)), SLOT(setChecked(bool)));
 
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-    QList<QTouchEvent::TouchPoint> touchPoints;
-    bool touchMocking;
+    QAction* touchMockAction = toolsMenu->addAction("Toggle multitouch mocking", this, SLOT(setTouchMocking(bool)));
+    touchMockAction->setCheckable(true);
+    touchMockAction->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_T));
 #endif
-};
-
+}
 
 QWebPage* WebPage::createWindow(QWebPage::WebWindowType)
 {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list