diff options
author | Jonatan Pålsson <jonatan.palsson@pelagicore.com> | 2014-02-06 09:31:35 +0100 |
---|---|---|
committer | Jonatan Pålsson <jonatan.palsson@pelagicore.com> | 2014-02-16 15:26:15 +0100 |
commit | 4a175ff7659768225b56865a66776f784331ea39 (patch) | |
tree | fcdc7bd65570470fb7aabdeb8c1959548cd29873 | |
parent | 2d10d4c4a12645a1a92fcd4137ce928b5b4405ef (diff) | |
download | browser-poc-4a175ff7659768225b56865a66776f784331ea39.tar.gz |
Added onActionStateChanged, onContentSizeChanged, onFaviconReceived
-rw-r--r-- | browser/browser.cpp | 3 | ||||
-rw-r--r-- | browser/browserview.cpp | 8 | ||||
-rw-r--r-- | browser/browserview.h | 4 | ||||
-rw-r--r-- | browser/unit-tests/browserdbus/testbrowserdbus.cpp | 19 | ||||
-rw-r--r-- | browser/unit-tests/browserdbus/testbrowserdbus.h | 3 | ||||
-rw-r--r-- | browser/webpagewindow.h | 3 | ||||
-rw-r--r-- | common/browserdbus.cpp | 3 | ||||
-rw-r--r-- | common/browserdbus.h | 3 |
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 a398292..1a927b8 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 d77afc6..2bbd147 100644 --- a/common/browserdbus.cpp +++ b/common/browserdbus.cpp @@ -202,6 +202,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 0cd7811..b19af39 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(); |