Patch from Qing Zhao to export more of the progress details and expose it from
authorstaikos <staikos@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Sep 2007 14:49:02 +0000 (14:49 +0000)
committerstaikos <staikos@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Sep 2007 14:49:02 +0000 (14:49 +0000)
QWebPage

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25411 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/loader/ProgressTracker.h
WebKitQt/Api/qwebpage.cpp
WebKitQt/Api/qwebpage.h
WebKitQt/Api/qwebpage_p.h
WebKitQt/ChangeLog

index ed95f02..b4947f0 100644 (file)
@@ -1,3 +1,13 @@
+2007-09-07  Qing Zhao  <qing@staikos.net>
+
+        Reviewed by Anders and George.
+
+        Add accessors for these two variables.
+
+        * loader/ProgressTracker.h:
+        (WebCore::ProgressTracker::totalPageAndResourseBytesToLoad):
+        (WebCore::ProgressTracker::totalBytesReceived):
+
 2007-09-06  Tristan O'Tierney  <tristan@apple.com>
 
         Reviewed by Maciej Stachowiak.
index f456db5..42bc5a2 100644 (file)
@@ -52,6 +52,9 @@ public:
     void incrementProgress(unsigned long identifier, const char*, int);
     void completeProgress(unsigned long identifier);
 
+    long long totalPageAndResourseBytesToLoad() const { return m_totalPageAndResourceBytesToLoad; }
+    long long totalBytesReceived() const { return m_totalBytesReceived; }
+
 private:
     void reset();
     void finalProgressComplete();
index ef6ad2a..281433c 100644 (file)
@@ -49,6 +49,7 @@
 #include "Editor.h"
 #include "PlatformScrollBar.h"
 #include "PlatformKeyboardEvent.h"
+#include "ProgressTracker.h"
 
 #include <QDebug>
 #include <QDragEnterEvent>
@@ -123,6 +124,7 @@ QWebPage::QWebPage(QWidget *parent)
 
     setPalette(pal);
     setAcceptDrops(true);
+    connect(this, SIGNAL(loadProgressChanged(int)), this, SLOT(onLoadProgressChanged(int)));
 }
 
 QWebPage::~QWebPage()
@@ -683,3 +685,17 @@ QString QWebPage::userAgentStringForUrl(const QUrl& forUrl) const {
 }
 
 
+void QWebPage::onLoadProgressChanged(int) {
+    d->m_totalBytes = d->page->progress()->totalPageAndResourseBytesToLoad();
+    d->m_bytesReceived = d->page->progress()->totalBytesReceived();
+}
+
+
+quint64 QWebPage::totalBytes() const {
+    return d->m_bytesReceived;
+}
+
+
+quint64 QWebPage::bytesReceived() const {
+    return d->m_totalBytes;
+}
index 1469414..87abe18 100644 (file)
@@ -104,6 +104,9 @@ public:
     bool canCopy() const;
     bool canPaste() const;
 
+    quint64 totalBytes() const;
+    quint64 bytesReceived() const;
+
 public slots:
     /**
      * Stops loading of the page, if loading.
@@ -168,6 +171,9 @@ signals:
 
     void addToHistory(const QUrl&);
 
+private slots:
+    void onLoadProgressChanged(int);
+
 protected:
     virtual QWebFrame *createFrame(QWebFrame *parentFrame, QWebFrameData *frameData);
     virtual QWebPage *createWindow();
index 5060c19..52a59bd 100644 (file)
@@ -60,6 +60,9 @@ public:
     bool modified;
 
     bool insideOpenCall;
+    quint64 m_totalBytes;
+    quint64 m_bytesReceived;
+
     QWebPage::NavigationRequestResponse navigationRequested(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type);
 #ifndef QT_NO_NETWORKPROXY
     QNetworkProxy networkProxy;
index 4fbded5..1c4db8d 100644 (file)
@@ -1,3 +1,17 @@
+2007-09-07  Qing Zhao  <qing@staikos.net>
+
+        Reviewed by Anders and George.
+
+        Export page size and load progress in bytes.
+
+        * Api/qwebpage.cpp:
+        (QWebPage::QWebPage):
+        (QWebPage::onLoadProgressChanged):
+        (QWebPage::totalBytes):
+        (QWebPage::bytesReceived):
+        * Api/qwebpage.h:
+        * Api/qwebpage_p.h:
+
 2007-09-06  George Staikos  <staikos@kde.org>
 
         Reviewed by Anders.