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

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


The following commit has been merged in the webkit-1.1 branch:
commit c9772509b8de93f41b2c23e5f74ba177bc8c87a5
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 29 16:49:39 2010 +0000

    2010-01-29  Andreas Kling  <andreas.kling at nokia.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Display page loading progress inside the QtLauncher location bar
    
            https://bugs.webkit.org/show_bug.cgi?id=34210
    
            * QtLauncher/QtLauncher.pro:
            * QtLauncher/locationedit.cpp: Added.
            (LocationEdit::LocationEdit):
            (LocationEdit::setProgress):
            (LocationEdit::paintEvent):
            * QtLauncher/locationedit.h: Added.
            * QtLauncher/mainwindow.cpp:
            (MainWindow::buildUI):
            * QtLauncher/mainwindow.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54065 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 585d9a1..a81861c 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -2,6 +2,24 @@
 
         Reviewed by Kenneth Rohde Christiansen.
 
+        [Qt] Display page loading progress inside the QtLauncher location bar
+
+        https://bugs.webkit.org/show_bug.cgi?id=34210
+
+        * QtLauncher/QtLauncher.pro:
+        * QtLauncher/locationedit.cpp: Added.
+        (LocationEdit::LocationEdit):
+        (LocationEdit::setProgress):
+        (LocationEdit::paintEvent):
+        * QtLauncher/locationedit.h: Added.
+        * QtLauncher/mainwindow.cpp:
+        (MainWindow::buildUI):
+        * QtLauncher/mainwindow.h:
+
+2010-01-29  Andreas Kling  <andreas.kling at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
         [Qt] Add support for Maemo zoom keys in QtLauncher
 
         https://bugs.webkit.org/show_bug.cgi?id=34160
diff --git a/WebKitTools/QtLauncher/QtLauncher.pro b/WebKitTools/QtLauncher/QtLauncher.pro
index 8894e0a..e448f69 100644
--- a/WebKitTools/QtLauncher/QtLauncher.pro
+++ b/WebKitTools/QtLauncher/QtLauncher.pro
@@ -1,6 +1,7 @@
 TEMPLATE = app
 
 SOURCES += \
+    locationedit.cpp \
     main.cpp \
     mainwindow.cpp \
     urlloader.cpp \
@@ -9,6 +10,7 @@ SOURCES += \
     webview.cpp \
 
 HEADERS += \
+    locationedit.h \
     mainwindow.h \
     urlloader.h \
     utils.h \
diff --git a/WebKitTools/QtLauncher/locationedit.cpp b/WebKitTools/QtLauncher/locationedit.cpp
new file mode 100644
index 0000000..977f39b
--- /dev/null
+++ b/WebKitTools/QtLauncher/locationedit.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 "locationedit.h"
+
+LocationEdit::LocationEdit(QWidget* parent)
+    : QLineEdit(parent),
+      m_progress(0)
+{
+}
+
+void LocationEdit::setProgress(int progress)
+{
+    m_progress = progress;
+    update();
+}
+
+void LocationEdit::paintEvent(QPaintEvent* ev)
+{
+    QColor backgroundColor = QApplication::palette().color(QPalette::Base);
+    QColor progressColor = QColor(120, 180, 240);
+    QPalette p = palette();
+
+    if (!m_progress || m_progress == 100)
+        p.setBrush(QPalette::Base, backgroundColor);
+    else {
+        QLinearGradient gradient(0, 0, width(), 0);
+        gradient.setColorAt(0, progressColor);
+        gradient.setColorAt(((double)m_progress) / 100, progressColor);
+        gradient.setColorAt(((double)m_progress) / 100 + 0.001, backgroundColor);
+        p.setBrush(QPalette::Base, gradient);
+    }
+    setPalette(p);
+
+    QLineEdit::paintEvent(ev);
+}
diff --git a/WebKitTools/QtLauncher/locationedit.h b/WebKitTools/QtLauncher/locationedit.h
new file mode 100644
index 0000000..93cbe88
--- /dev/null
+++ b/WebKitTools/QtLauncher/locationedit.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 locationedit_h
+#define locationedit_h
+
+#include <QtGui>
+
+class LocationEdit : public QLineEdit {
+    Q_OBJECT
+
+public:
+    LocationEdit(QWidget* parent = 0);
+
+public slots:
+    void setProgress(int progress);
+
+protected:
+    void paintEvent(QPaintEvent*);
+
+private:
+    int m_progress;
+};
+
+#endif
diff --git a/WebKitTools/QtLauncher/mainwindow.cpp b/WebKitTools/QtLauncher/mainwindow.cpp
index 1487f1c..2662f5e 100644
--- a/WebKitTools/QtLauncher/mainwindow.cpp
+++ b/WebKitTools/QtLauncher/mainwindow.cpp
@@ -32,6 +32,7 @@
 
 #include "mainwindow.h"
 
+#include "locationedit.h"
 #include "utils.h"
 
 MainWindow::MainWindow(const QString& url)
@@ -54,7 +55,7 @@ void MainWindow::buildUI()
     bar->addAction(page()->action(QWebPage::Reload));
     bar->addAction(page()->action(QWebPage::Stop));
 
-    urlEdit = new QLineEdit(this);
+    urlEdit = new LocationEdit(this);
     urlEdit->setSizePolicy(QSizePolicy::Expanding, urlEdit->sizePolicy().verticalPolicy());
     connect(urlEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));
     QCompleter* completer = new QCompleter(this);
@@ -62,18 +63,9 @@ void MainWindow::buildUI()
     completer->setModel(&urlModel);
     bar->addWidget(urlEdit);
 
-    progress = new QProgressBar(this);
-    progress->setRange(0, 100);
-    progress->setMinimumSize(100, 20);
-    progress->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-    progress->hide();
-    statusBar()->addPermanentWidget(progress);
-
     connect(page()->mainFrame(), SIGNAL(titleChanged(const QString&)),
             this, SLOT(setWindowTitle(const QString&)));
-    connect(page(), SIGNAL(loadProgress(int)), progress, SLOT(show()));
-    connect(page(), SIGNAL(loadProgress(int)), progress, SLOT(setValue(int)));
-    connect(page(), SIGNAL(loadFinished(bool)), progress, SLOT(hide()));
+    connect(page(), SIGNAL(loadProgress(int)), urlEdit, SLOT(setProgress(int)));
     connect(page(), SIGNAL(windowCloseRequested()), this, SLOT(close()));
 
     // short-cuts
diff --git a/WebKitTools/QtLauncher/mainwindow.h b/WebKitTools/QtLauncher/mainwindow.h
index 2b5941d..1a30a09 100644
--- a/WebKitTools/QtLauncher/mainwindow.h
+++ b/WebKitTools/QtLauncher/mainwindow.h
@@ -36,6 +36,8 @@
 #include <QtGui>
 #include "webpage.h"
 
+class LocationEdit;
+
 class MainWindow : public QMainWindow {
     Q_OBJECT
 
@@ -59,9 +61,7 @@ private:
 
     QStringListModel urlModel;
     QStringList urlList;
-    QLineEdit* urlEdit;
-
-    QProgressBar* progress;
+    LocationEdit* urlEdit;
 
     WebPage* m_page;
 };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list