summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonatan Pålsson <jonatan.palsson@pelagicore.com>2014-02-06 09:31:35 +0100
committerJonatan Pålsson <jonatan.palsson@pelagicore.com>2014-02-06 09:31:35 +0100
commit435c2c6da1436b4e5bd4f6929c62f3aca78770bb (patch)
treeef517d6c145bcb59a047de9648ef7413fdcf00dd
parent31254b583364bb14204584d24ce5eb02356d4479 (diff)
downloadbrowser-poc-435c2c6da1436b4e5bd4f6929c62f3aca78770bb.tar.gz
Added onActionStateChanged, onContentSizeChanged, onFaviconReceived
-rw-r--r--browser/browser.cpp3
-rw-r--r--browser/browserview.cpp8
-rw-r--r--browser/browserview.h4
-rw-r--r--browser/unit-tests/browserdbus/testbrowserdbus.cpp19
-rw-r--r--browser/unit-tests/browserdbus/testbrowserdbus.h3
-rw-r--r--browser/webpagewindow.h3
-rw-r--r--common/browserdbus.cpp3
-rw-r--r--common/browserdbus.h3
8 files changed, 46 insertions, 0 deletions
diff --git a/browser/browser.cpp b/browser/browser.cpp
index 29783b4..cce4982 100644
--- a/browser/browser.cpp
+++ b/browser/browser.cpp
@@ -53,6 +53,9 @@ conn::brw::ERROR_IDS browser::createPageWindow(int a_eDeviceId, const conn::brw:
connect(bvi, SIGNAL(onInputText(QString, QString, int, int, int, int, int)), ui, SLOT(inputTextReceived(QString, QString, int, int, int, int, int)));
connect(this,SIGNAL(onPageWindowDestroyed(qlonglong)), wpw, SIGNAL(onClose()));
connect(bvi, SIGNAL(onScrollPositionChanged(uint,uint)), wpw, SIGNAL(onScrollPositionChanged(uint,uint)));
+ connect(bvi, SIGNAL(onActionStateChanged(uint)), wpw, SIGNAL(onActionStateChanged(uint)));
+ connect(bvi, SIGNAL(onContentSizeChanged(uint, uint)),wpw,SIGNAL(onContentSizeChanged(uint,uint)));
+ connect(bvi, SIGNAL(onFaviconReceived()), wpw, SIGNAL(onFaviconReceived()));
QString *webpagewindowservice = new QString("/Browser/IWebPageWindow" + QString::number(a_hPageWindowHandle));
qDebug() << *webpagewindowservice;
diff --git a/browser/browserview.cpp b/browser/browserview.cpp
index 9be9659..4bda8ee 100644
--- a/browser/browserview.cpp
+++ b/browser/browserview.cpp
@@ -29,6 +29,8 @@ BrowserView::BrowserView()
}
this->scene()->addItem (&m_webview);
+ QWebSettings::setIconDatabasePath(".");
+
this->load("http://www.bmw.com");
this->installEventFilter(this);
@@ -46,6 +48,8 @@ BrowserView::BrowserView()
connect(m_webview.page(), SIGNAL (selectionChanged(void)), this, SIGNAL(onSelectionChanged(void)));
connect(m_webview.page(), SIGNAL (linkHovered(const QString&,const QString&,const QString&)), this, SIGNAL(onLinkHovered(QString)));
+ connect(m_webview.page()->mainFrame(), SIGNAL (contentsSizeChanged(const QSize &)), this, SLOT (contentSizeChanged(const QSize&)));
+ connect(&m_webview, SIGNAL (iconChanged()), this, SIGNAL (onFaviconReceived()));
connect(&m_inputHandler, SIGNAL (onInputText(QString, QString, int, int, int, int, int)),
this, SIGNAL (onInputText(QString, QString, int, int, int, int, int)));
@@ -243,3 +247,7 @@ QString BrowserView::getFaviconFilePath(QString url) {
return outFile.fileName();
}
+
+void BrowserView::contentSizeChanged(const QSize &size) {
+ emit onContentSizeChanged(size.width(), size.height());
+}
diff --git a/browser/browserview.h b/browser/browserview.h
index a488c0e..13a992a 100644
--- a/browser/browserview.h
+++ b/browser/browserview.h
@@ -94,6 +94,9 @@ signals:
void onScrollPositionChanged(uint,uint);
void onZoomFactorChanged(double);
void onLinkHovered(QString);
+ void onActionStateChanged(uint);
+ void onContentSizeChanged(uint, uint);
+ void onFaviconReceived();
protected:
virtual void resizeEvent (QResizeEvent *event);
@@ -106,6 +109,7 @@ protected slots:
void titleChanged(QString);
void linkClicked(QUrl);
void scrollPositionChanged(uint x, uint y);
+ void contentSizeChanged(const QSize&);
private:
QGraphicsWebView m_webview;
diff --git a/browser/unit-tests/browserdbus/testbrowserdbus.cpp b/browser/unit-tests/browserdbus/testbrowserdbus.cpp
index f790dc2..ece127a 100644
--- a/browser/unit-tests/browserdbus/testbrowserdbus.cpp
+++ b/browser/unit-tests/browserdbus/testbrowserdbus.cpp
@@ -87,6 +87,7 @@ void TestBrowserDBus::testGetsNotifiedWhenLinkIsHovered() {
m_bdb->loadurl(testFileUrl());
QTest::qSleep(200);
+ QProcess::execute("xdotool mousemove 0 0");
QProcess::execute("xdotool mousemove 100 100");
bool success = false;
@@ -214,4 +215,22 @@ void TestBrowserDBus::testCanGetFavicon() {
QVERIFY(iconPath.compare(QString("")) != 0);
}
+void TestBrowserDBus::testOnContentSizeChanged() {
+ m_bdb->createPageWindow(1,0,0,800,600);
+ QSignalSpy spy (m_bdb, SIGNAL (onContentSizeChanged (uint, uint)));
+ m_bdb->loadurl(testFileUrl());
+ m_bdb->loadurl("http://google.com");
+ QVERIFY(spy.wait(1000));
+}
+
+void TestBrowserDBus::testOnActionStateChanged() {}
+void TestBrowserDBus::testOnFaviconReceived() {
+ m_bdb->createPageWindow(1,0,0,800,600);
+ QSignalSpy spy (m_bdb, SIGNAL (onFaviconReceived()));
+ m_bdb->loadurl(testFileUrl());
+ m_bdb->loadurl("http://google.com");
+ qDebug() << spy;
+ QVERIFY(spy.wait(1000));
+}
+
QTEST_MAIN (TestBrowserDBus);
diff --git a/browser/unit-tests/browserdbus/testbrowserdbus.h b/browser/unit-tests/browserdbus/testbrowserdbus.h
index d112bbf..3faab69 100644
--- a/browser/unit-tests/browserdbus/testbrowserdbus.h
+++ b/browser/unit-tests/browserdbus/testbrowserdbus.h
@@ -37,6 +37,9 @@ private slots:
void testCanSetAndGetScrollPosition();
void testCanGeneratePageIcon();
void testCanGetFavicon();
+ void testOnActionStateChanged();
+ void testOnContentSizeChanged();
+ void testOnFaviconReceived();
private:
QString testFileUrl() {
diff --git a/browser/webpagewindow.h b/browser/webpagewindow.h
index 24edbb1..cd650b5 100644
--- a/browser/webpagewindow.h
+++ b/browser/webpagewindow.h
@@ -46,6 +46,9 @@ signals:
void onScrollPositionChanged(uint,uint);
void onZoomFactorChanged(double);
void onLinkHovered(QString);
+ void onActionStateChanged(uint);
+ void onContentSizeChanged(uint, uint);
+ void onFaviconReceived();
public Q_SLOTS:
diff --git a/common/browserdbus.cpp b/common/browserdbus.cpp
index 186c77e..c33e1f2 100644
--- a/common/browserdbus.cpp
+++ b/common/browserdbus.cpp
@@ -200,6 +200,9 @@ void BrowserDbus::createPageWindow(int deviceid, int x, int y, int width, int he
connect(actualtab, SIGNAL(onScrollPositionChanged(uint,uint)), this, SIGNAL(onScrollPositionChanged(uint,uint)));
connect(actualtab, SIGNAL(onZoomFactorChanged(double)), this, SIGNAL(onZoomFactorChanged(double)));
connect(actualtab, SIGNAL(onLinkHovered(QString)), this, SIGNAL(linkHovered(QString)));
+ connect(actualtab, SIGNAL(onActionStateChanged(uint)), this, SIGNAL(onActionStateChanged(uint)));
+ connect(actualtab, SIGNAL(onContentSizeChanged(uint, uint)), this, SIGNAL(onContentSizeChanged(uint,uint)));
+ connect(actualtab, SIGNAL(onFaviconReceived()), this, SIGNAL(onFaviconReceived()));
QString *userinputservice = new QString(*webpagewindowservice + "/IUserInput");
diff --git a/common/browserdbus.h b/common/browserdbus.h
index 8a11710..1d5dd99 100644
--- a/common/browserdbus.h
+++ b/common/browserdbus.h
@@ -96,6 +96,9 @@ signals:
void onScrollPositionChanged(uint,uint);
void onZoomFactorChanged(double);
void linkHovered(QString);
+ void onActionStateChanged(uint);
+ void onContentSizeChanged(uint, uint);
+ void onFaviconReceived();
public slots:
void pageloadingstarted();