diff options
author | Marcel Schuette <marcel.schuette@pelagicore.com> | 2013-08-22 10:56:39 +0200 |
---|---|---|
committer | Marcel Schuette <marcel.schuette@pelagicore.com> | 2013-08-22 10:56:39 +0200 |
commit | bf3499741f4619c69352db584fe690b3676725dc (patch) | |
tree | 77cf576aeafec425d1d8415d0d788458a5ad3830 | |
parent | ae8308917ada1036d8aa2dbdd1b04a4dd2b77d14 (diff) | |
download | browser-poc-bf3499741f4619c69352db584fe690b3676725dc.tar.gz |
test app continued
-rw-r--r-- | browser/browser.pro | 9 | ||||
-rw-r--r-- | browser/webpagewindow.cpp | 2 | ||||
-rw-r--r-- | common/browserdbus.cpp | 370 | ||||
-rw-r--r-- | common/browserdbus.h | 104 | ||||
-rw-r--r-- | common/common.pri | 6 | ||||
-rw-r--r-- | demoui/demoui.pro | 4 | ||||
-rw-r--r-- | testapp/main.cpp | 10 | ||||
-rw-r--r-- | testapp/qml/testapp/BookmarkManager.qml | 2 | ||||
-rw-r--r-- | testapp/qml/testapp/Browser.qml | 2 | ||||
-rw-r--r-- | testapp/qml/testapp/UserInput.qml | 2 | ||||
-rw-r--r-- | testapp/qml/testapp/WebPageWindow.qml | 349 | ||||
-rw-r--r-- | testapp/qml/testapp/main.qml | 4 |
12 files changed, 714 insertions, 150 deletions
diff --git a/browser/browser.pro b/browser/browser.pro index f91efc2..23a1098 100644 --- a/browser/browser.pro +++ b/browser/browser.pro @@ -18,21 +18,22 @@ my_dbus_browser_adaptors.source_flags = -l browser DBUS_ADAPTORS += my_dbus_bookmark_adaptors my_dbus_userinput_adaptors my_dbus_webpagewindow_adaptors my_dbus_browser_adaptors -include(../common/common.pri) - SOURCES += main.cpp \ bookmarkmanager.cpp \ userinput.cpp \ webpagewindow.cpp \ browser.cpp \ - browserhelper.cpp + browserhelper.cpp \ + ../common/bookmark.cpp \ HEADERS += \ bookmarkmanager.h \ userinput.h \ webpagewindow.h \ browser.h \ - browserhelper.h + browserhelper.h \ + ../common/bookmark.h \ + ../common/browserdefs.h \ OTHER_FILES += \ qml/browser/main.qml \ diff --git a/browser/webpagewindow.cpp b/browser/webpagewindow.cpp index 77ac266..421ae69 100644 --- a/browser/webpagewindow.cpp +++ b/browser/webpagewindow.cpp @@ -160,7 +160,7 @@ bool webpagewindow::getVisible() { } conn::brw::ERROR_IDS webpagewindow::setVisible(bool a_bVisible) { - qDebug() << __PRETTY_FUNCTION__; + qDebug() << __PRETTY_FUNCTION__ << a_bVisible; webitem->setProperty("visible", a_bVisible); diff --git a/common/browserdbus.cpp b/common/browserdbus.cpp new file mode 100644 index 0000000..7cc7603 --- /dev/null +++ b/common/browserdbus.cpp @@ -0,0 +1,370 @@ +/** + * Copyright (C) 2013, Pelagicore + * + * Author: Marcel Schuette <marcel.schuette@pelagicore.com> + * + * This file is part of the GENIVI project Browser Proof-Of-Concept + * For further information, see http://genivi.org/ + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <QDBusMetaType> +#include <QtQml> + +#include "browserdbus.h" + +#include "../common/browserdefs.h" + + +#define NUMBER_OF_BOOKMARKS 20 + +BrowserDbus::BrowserDbus(QObject *parent) : + QObject(parent) +{ + qDBusRegisterMetaType<conn::brw::ERROR_IDS>(); + qDBusRegisterMetaType<conn::brw::BOOKMARK_SORT_TYPE>(); + qDBusRegisterMetaType<conn::brw::BookmarkItem>(); + qDBusRegisterMetaType<conn::brw::BookmarkItemList>(); + qDBusRegisterMetaType<conn::brw::DIALOG_RESULT>(); + qDBusRegisterMetaType<conn::brw::INPUT_ELEMENT_TYPE>(); + qDBusRegisterMetaType<conn::brw::Rect>(); + qDBusRegisterMetaType<conn::brw::SCROLL_DIRECTION>(); + qDBusRegisterMetaType<conn::brw::SCROLL_TYPE>(); + + bookmark = new conn::brw::IBookmarkManager("conn.brw.IBookmarkManager", "/bookmarkmanager", + QDBusConnection::sessionBus(), this); + + userinput = new conn::brw::IUserInput("conn.brw.IUserInput", "/userinput", + QDBusConnection::sessionBus(), this); + + webpagewindow = new conn::brw::IWebPageWindow("conn.brw.IWebPageWindow", "/webpagewindow", + QDBusConnection::sessionBus(), this); + + browser = new conn::brw::IBrowser("conn.brw.IBrowser", "/browser", + QDBusConnection::sessionBus(), this); + + connect(webpagewindow, SIGNAL(onLoadStarted()), this, SLOT(pageloadingstarted())); + connect(webpagewindow, SIGNAL(onLoadFinished(bool)), this, SLOT(pageloadingfinished(bool))); + connect(webpagewindow, SIGNAL(onLoadProgress(int)), this, SLOT(pageloadingprogress(int))); +} + + +void BrowserDbus::getGeometry() { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS, conn::brw::Rect> reply = webpagewindow->getGeometry(); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + conn::brw::Rect rect = reply.argumentAt<1>(); + + qDebug() << "ERROR_IDS " << ret << rect.i32X << rect.i32X << rect.i32Width << rect.i32Height; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } + +} + +void BrowserDbus::setGeometry(int x, int y, int width, int height) { + qDebug() << __PRETTY_FUNCTION__ << x << y << width << height; + + conn::brw::Rect *rect = new conn::brw::Rect(); + rect->i32X = x; + rect->i32Y = y; + rect->i32Width = width; + rect->i32Height = height; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = webpagewindow->setGeometry(*rect); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + + +void BrowserDbus::setVisible(bool visible) { + qDebug() << __PRETTY_FUNCTION__ << visible; + QDBusPendingReply<conn::brw::ERROR_IDS> reply = webpagewindow->setVisible(visible); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::getVisible() { + qDebug() << __PRETTY_FUNCTION__; + QDBusPendingReply<bool> reply = webpagewindow->getVisible(); + reply.waitForFinished(); + if(reply.isValid()) { + bool ret = reply.value(); + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::pageloadingstarted() { + qDebug() << __PRETTY_FUNCTION__; + setPageLoading(true); + emit pageloadingChanged(); +} + +void BrowserDbus::pageloadingfinished(bool success) { + qDebug() << __PRETTY_FUNCTION__ << success; + if(success) { + getCurrentUrlAndTitle(); + emit urlChanged(); + qDebug() << __PRETTY_FUNCTION__ << url() << title(); + } + setPageLoading(false); + emit pageloadingChanged(); +} + +void BrowserDbus::pageloadingprogress(int progress) { + qDebug() << __PRETTY_FUNCTION__ << progress << pageloading(); + setProgress(progress); + emit progressChanged(); +} + +void BrowserDbus::openBrowserWindow() { + qDebug() << __PRETTY_FUNCTION__; + + conn::brw::Rect *windowrect = new conn::brw::Rect(); + windowrect->i32X = 0; + windowrect->i32Y = 80; + windowrect->i32Width = 800; + windowrect->i32Height = 520; + + QDBusPendingReply<conn::brw::ERROR_IDS, conn::brw::OBJECT_HANDLE> reply = browser->createPageWindow(1, *windowrect); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + conn::brw::OBJECT_HANDLE handle = reply.argumentAt<1>(); + + qDebug() << "ERROR_IDS " << ret << handle; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::goDown() { + qDebug() << __PRETTY_FUNCTION__; + + scrollpage(conn::brw::SD_BOTTOM, conn::brw::ST_SYMBOL); +} +void BrowserDbus::goUp() { + qDebug() << __PRETTY_FUNCTION__; + + scrollpage(conn::brw::SD_TOP, conn::brw::ST_SYMBOL); +} +void BrowserDbus::goLeft() { + qDebug() << __PRETTY_FUNCTION__; + + scrollpage(conn::brw::SD_LEFT, conn::brw::ST_SYMBOL); +} +void BrowserDbus::goRight() { + qDebug() << __PRETTY_FUNCTION__; + + scrollpage(conn::brw::SD_RIGHT, conn::brw::ST_SYMBOL); +} +void BrowserDbus::goDownPage() { + qDebug() << __PRETTY_FUNCTION__; + + scrollpage(conn::brw::SD_BOTTOM, conn::brw::ST_PAGE); +} +void BrowserDbus::goUpPage() { + qDebug() << __PRETTY_FUNCTION__; + + scrollpage(conn::brw::SD_TOP, conn::brw::ST_PAGE); +} +void BrowserDbus::scrollpage(conn::brw::SCROLL_DIRECTION direction, conn::brw::SCROLL_TYPE type) { + qDebug() << __PRETTY_FUNCTION__ << direction; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = webpagewindow->scroll(direction, type); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::goBack() { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = webpagewindow->back(); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::goForward() { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = webpagewindow->forward(); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::reload() { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = webpagewindow->reload(); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::stop() { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = webpagewindow->stop(); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + + +void BrowserDbus::loadurl(QString url) { + qDebug() << __PRETTY_FUNCTION__ << url; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = webpagewindow->load(url); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::addBookmark(QString bookmarkurl, QString bookmarktitle) { + qDebug() << __PRETTY_FUNCTION__ << bookmarkurl << bookmarktitle; + + conn::brw::BookmarkItem tmpbookmark; + tmpbookmark.i32Uid = 0; + tmpbookmark.i32Type = 1; + tmpbookmark.strParentFolderPath = ""; + tmpbookmark.strTitle = bookmarktitle; + tmpbookmark.strUrl = bookmarkurl; + tmpbookmark.strIconPath = ""; + tmpbookmark.strThumbnailPath = ""; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = bookmark->addItem(tmpbookmark); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "reply " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::getBookmarks() { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS, conn::brw::BookmarkItemList> reply = bookmark->getItems("", 1, conn::brw::BST_UNSORTED, 1, NUMBER_OF_BOOKMARKS); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + conn::brw::BookmarkItemList bookmarklist = reply.argumentAt<1>(); + + m_bookmarkList.clear(); + for (int i = 0; i < bookmarklist.size(); ++i) { + qDebug() << "BookmarkItemList " << bookmarklist.at(i).i32Uid << bookmarklist.at(i).strTitle << bookmarklist.at(i).strUrl << bookmarklist.at(i).strParentFolderPath; + m_bookmarkList.append(new Bookmark(bookmarklist.at(i).strTitle, bookmarklist.at(i).strUrl, bookmarklist.at(i).i32Uid)); + emit bookmarkListChanged(); + } + qDebug() << "ERROR_IDS " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::deleteAllBookmarks() { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = bookmark->deleteAllItems(1); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + m_bookmarkList.clear(); + emit bookmarkListChanged(); + qDebug() << "reply " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } +} + +void BrowserDbus::deleteBookmark(int index) { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS> reply = bookmark->deleteItem(m_bookmarkList.at(index)->uid()); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + qDebug() << "reply " << ret; + } else { + QDBusError error = reply.error(); + qDebug() << "ERROR " << error.name() << error.message(); + } + + m_bookmarkList.removeAt(index); + emit bookmarkListChanged(); +} + +void BrowserDbus::getCurrentUrlAndTitle() { + qDebug() << __PRETTY_FUNCTION__; + + QDBusPendingReply<conn::brw::ERROR_IDS, QString, QString> reply = webpagewindow->getCurrentUrlTitle(); + reply.waitForFinished(); + if(reply.isValid()) { + conn::brw::ERROR_IDS ret = reply.value(); + setUrl(reply.argumentAt<1>()); + setTitle(reply.argumentAt<2>()); + + qDebug() << __PRETTY_FUNCTION__ << url() << title(); + } +} diff --git a/common/browserdbus.h b/common/browserdbus.h new file mode 100644 index 0000000..d968364 --- /dev/null +++ b/common/browserdbus.h @@ -0,0 +1,104 @@ +/** + * Copyright (C) 2013, Pelagicore + * + * Author: Marcel Schuette <marcel.schuette@pelagicore.com> + * + * This file is part of the GENIVI project Browser Proof-Of-Concept + * For further information, see http://genivi.org/ + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef BROWSERDBUS_H +#define BROWSERDBUS_H + +#include <QObject> +#include <QQmlListProperty> + +#include "ibookmarkmanager_interface.h" +#include "iuserinput_interface.h" +#include "iwebpagewindow_interface.h" +#include "ibrowser_interface.h" +#include "../common/bookmark.h" + +class BrowserDbus : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString title READ title NOTIFY titleChanged) + Q_PROPERTY(QString url READ url NOTIFY urlChanged) + Q_PROPERTY(QQmlListProperty<Bookmark> bookmarkList READ getBookmarkList NOTIFY bookmarkListChanged) + Q_PROPERTY(bool pageloading READ pageloading NOTIFY pageloadingChanged) + Q_PROPERTY(int progress READ progress NOTIFY progressChanged) + +public: + explicit BrowserDbus(QObject *parent = 0); + + Q_INVOKABLE void goBack(); + Q_INVOKABLE void goForward(); + Q_INVOKABLE void reload(); + Q_INVOKABLE void stop(); + Q_INVOKABLE void loadurl(QString url); + Q_INVOKABLE void getBookmarks(); + Q_INVOKABLE void addBookmark(QString url, QString title); + Q_INVOKABLE void deleteAllBookmarks(); + Q_INVOKABLE void getCurrentUrlAndTitle(); + + Q_INVOKABLE void goRight(); + Q_INVOKABLE void goLeft(); + Q_INVOKABLE void goUp(); + Q_INVOKABLE void goDown(); + Q_INVOKABLE void goDownPage(); + Q_INVOKABLE void goUpPage(); + + Q_INVOKABLE void openBrowserWindow(); + + Q_INVOKABLE void setVisible(bool visible); + Q_INVOKABLE void getVisible(); + + Q_INVOKABLE void getGeometry(); + Q_INVOKABLE void setGeometry(int x, int y, int width, int height); + + Q_INVOKABLE void deleteBookmark(int index); + + QString title() { return m_title; } + void setTitle(QString title) { m_title = title; } + QString url() const { return m_url; } + void setUrl(const QString &url) { m_url = url; } + bool pageloading() { return m_pageloading; } + void setPageLoading(bool loading) { m_pageloading = loading; } + int progress() { return m_progress; } + void setProgress(int prog) { m_progress = prog; } + + QQmlListProperty<Bookmark> getBookmarkList() { return QQmlListProperty<Bookmark>(this, m_bookmarkList); } + +signals: + void bookmarkListChanged(); + void urlChanged(); + void titleChanged(); + void pageloadingChanged(); + void progressChanged(); + +public slots: + void pageloadingstarted(); + void pageloadingfinished(bool success); + void pageloadingprogress(int progress); + +private: + conn::brw::IBookmarkManager *bookmark; + conn::brw::IUserInput *userinput; + conn::brw::IWebPageWindow *webpagewindow; + conn::brw::IBrowser *browser; + + QString m_title; + QString m_url; + QList<Bookmark*> m_bookmarkList; + bool m_pageloading; + int m_progress; + + void scrollpage(conn::brw::SCROLL_DIRECTION direction, conn::brw::SCROLL_TYPE type); +}; + +#endif // BROWSERDBUS_H diff --git a/common/common.pri b/common/common.pri index ec7785b..21019a8 100644 --- a/common/common.pri +++ b/common/common.pri @@ -1,4 +1,6 @@ -SOURCES += ../common/bookmark.cpp +SOURCES += ../common/bookmark.cpp \ + ../common/browserdbus.cpp HEADERS += ../common/bookmark.h \ - ../common/browserdefs.h + ../common/browserdefs.h \ + ../common/browserdbus.h diff --git a/demoui/demoui.pro b/demoui/demoui.pro index 7611ceb..56f67a2 100644 --- a/demoui/demoui.pro +++ b/demoui/demoui.pro @@ -6,7 +6,6 @@ DEPLOYMENTFOLDERS = folder_01 # Additional import path used to resolve QML modules in Creator's code model QML_IMPORT_PATH = - my_dbus_interfaces.files += ../common/IBookmarkManager.xml \ ../common/IUserInput.xml \ ../common/IWebPageWindow.xml \ @@ -19,9 +18,6 @@ QT += core dbus include(../common/common.pri) SOURCES += main.cpp \ - browserdbus.cpp - -HEADERS += browserdbus.h \ # Please do not modify the following two lines. Required for deployment. include(qtquick2applicationviewer/qtquick2applicationviewer.pri) diff --git a/testapp/main.cpp b/testapp/main.cpp index 5b45eb7..3d28d2b 100644 --- a/testapp/main.cpp +++ b/testapp/main.cpp @@ -20,6 +20,10 @@ //#include "../common/browserdefs.h" + +#include "../common/browserdbus.h" +#include <QtQml> + int main(int argc, char *argv[]) { // QApplication app(argc, argv); @@ -41,6 +45,12 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); + +// BrowserDbus browserdbushelper; + + qmlRegisterType<BrowserDbus>("browserdbusinterface",1,0,"BrowserInterface"); + qmlRegisterType<Bookmark>("browserdbusinterface",1,0,"Tmp"); + QQmlApplicationEngine engine("qml/testapp/main.qml"); QObject *topLevel = engine.rootObjects().value(0); diff --git a/testapp/qml/testapp/BookmarkManager.qml b/testapp/qml/testapp/BookmarkManager.qml index a1c0b3f..ac57083 100644 --- a/testapp/qml/testapp/BookmarkManager.qml +++ b/testapp/qml/testapp/BookmarkManager.qml @@ -10,7 +10,7 @@ Item { title: "addItem(const conn::brw::BookmarkItem & a_oItem)" width: children.width + 250 anchors.top: parent.top - anchors.topMargin: 30 + anchors.topMargin: 15 anchors.left: parent.left anchors.leftMargin: 30 diff --git a/testapp/qml/testapp/Browser.qml b/testapp/qml/testapp/Browser.qml index f5a81c4..41c353f 100644 --- a/testapp/qml/testapp/Browser.qml +++ b/testapp/qml/testapp/Browser.qml @@ -10,7 +10,7 @@ Item { title: "createPageWindow(int a_eDeviceId, const conn::brw::Rect & a_oGeometry, qlonglong &a_hPageWindowHandle)" width: children.width + 250 anchors.top: parent.top - anchors.topMargin: 30 + anchors.topMargin: 15 anchors.left: parent.left anchors.leftMargin: 30 diff --git a/testapp/qml/testapp/UserInput.qml b/testapp/qml/testapp/UserInput.qml index 125ea91..be6b38b 100644 --- a/testapp/qml/testapp/UserInput.qml +++ b/testapp/qml/testapp/UserInput.qml @@ -9,7 +9,7 @@ Item { id: groupuserinput title: "inputText(conn::brw::DIALOG_RESULT a_eResult, const QString &a_strInputValue)" anchors.top: parent.top - anchors.topMargin: 30 + anchors.topMargin: 15 anchors.left: parent.left anchors.leftMargin: 30 diff --git a/testapp/qml/testapp/WebPageWindow.qml b/testapp/qml/testapp/WebPageWindow.qml index 77fd327..1b45735 100644 --- a/testapp/qml/testapp/WebPageWindow.qml +++ b/testapp/qml/testapp/WebPageWindow.qml @@ -5,158 +5,235 @@ Item { id: root anchors.fill: parent - Button { - id: buttonback - width: 130 - height: 50 + GroupBox { + id: groupcontrolbuttons + title: "back()/forward()/reload()/stop() " + width: 4 * 130 + 3 * 20 + 3 * 10 anchors.top: parent.top - anchors.topMargin: 30 + anchors.topMargin: 15 anchors.left: parent.left anchors.leftMargin: 30 - text: "Back" - } - Button { - id: buttonforward - width: 130 - height: 50 - anchors.top: buttonback.top - anchors.left: buttonback.right - anchors.leftMargin: 30 - text: "Forward" - } - Button { - id: buttonreload - width: 130 - height: 50 - anchors.top: buttonback.top - anchors.left: buttonforward.right - anchors.leftMargin: 30 - text: "Reload" - } - Button { - id: buttonstop - width: 130 - height: 50 - anchors.top: buttonback.top - anchors.left: buttonreload.right - anchors.leftMargin: 30 - text: "Stop" - } - TextField { - id: inputfieldurl - width: 400 - height: 50 - anchors.top: buttonback.bottom - anchors.topMargin: 30 - anchors.left: buttonback.left - font.pixelSize: 20 - } - Button { - width: 130 - height: inputfieldurl.height - anchors.top: inputfieldurl.top - anchors.left: inputfieldurl.right - anchors.leftMargin: 30 - text: "Load" + Button { + id: buttonback + width: 130 + height: 50 + text: "Back" + anchors.left: parent.left + anchors.leftMargin: 10 + onClicked: browserinterface.goBack() + } + Button { + id: buttonforward + width: 130 + height: 50 + anchors.top: buttonback.top + anchors.left: buttonback.right + anchors.leftMargin: 20 + text: "Forward" + onClicked: browserinterface.goForward() + } + Button { + id: buttonreload + width: 130 + height: 50 + anchors.top: buttonback.top + anchors.left: buttonforward.right + anchors.leftMargin: 20 + text: "Reload" + onClicked: browserinterface.reload() + } + Button { + id: buttonstop + width: 130 + height: 50 + anchors.top: buttonback.top + anchors.left: buttonreload.right + anchors.leftMargin: 20 + text: "Stop" + onClicked: browserinterface.stop() + } } - ComboBox { - id: combo - width: 70 - height: 50 - model: [ "True", "False" ] - anchors.top: inputfieldurl.bottom - anchors.topMargin: 30 - anchors.left: inputfieldurl.left - } - Button { - width: 130 - height: combo.height - anchors.top: combo.top - anchors.left: combo.right - anchors.leftMargin: 30 - text: "setVisible" - } + GroupBox { + id: groupload + title: "load(const QString &a_Url)" + width: 400 + 130 + 20 + 30 + anchors.top: groupcontrolbuttons.bottom + anchors.topMargin: 10 + anchors.left: groupcontrolbuttons.left - Button { - id: buttongetgeometry - width: 130 - height: 50 - anchors.top: combo.bottom - anchors.topMargin: 30 - anchors.left: combo.left - text: "getGeometry" + TextField { + id: inputfieldurl + width: 400 + height: 50 + anchors.left: parent.left + anchors.leftMargin: 10 + font.pixelSize: 20 + text: "http://" + } + Button { + width: 130 + height: inputfieldurl.height + anchors.top: inputfieldurl.top + anchors.left: inputfieldurl.right + anchors.leftMargin: 20 + text: "Load Url" + onClicked: browserinterface.loadurl(inputfieldurl.text) + } } - Button { - id: buttongetcontentsize - width: 130 - height: buttongetgeometry.height - anchors.top: buttongetgeometry.top - anchors.left: buttongetgeometry.right - anchors.leftMargin: 30 - text: "getContentSize" - } + GroupBox { + id: groupsetvisible + title: "setVisible(bool a_bVisible)" + width: 70 + 130 + 20 + 30 + anchors.top: groupload.bottom + anchors.topMargin: 10 + anchors.left: groupload.left - Button { - width: 130 - height: buttongetgeometry.height - anchors.top: buttongetgeometry.top - anchors.left: buttongetcontentsize.right - anchors.leftMargin: 30 - text: "getBrowserActionState" + ComboBox { + id: combo + width: 70 + height: 50 + model: [ "True", "False" ] + anchors.left: parent.left + anchors.leftMargin: 10 + } + Button { + width: 130 + height: combo.height + anchors.top: combo.top + anchors.left: combo.right + anchors.leftMargin: 20 + text: "Set Visible" + onClicked: { + if(combo.currentText == "True") + browserinterface.setVisible(true) + else + browserinterface.setVisible(false) + } + } } - TextField { - id: inputfieldx - width: 50 - height: 50 - anchors.top: buttongetgeometry.bottom - anchors.topMargin: 30 - anchors.left: buttongetgeometry.left - font.pixelSize: 20 - } - TextField { - id: inputfieldy - width: 50 - height: inputfieldx.height - anchors.top: inputfieldx.top - anchors.left: inputfieldx.right - anchors.leftMargin: 30 - font.pixelSize: 20 - } - TextField { - id: inputfieldwidth - width: 50 - height: inputfieldx.height - anchors.top: inputfieldx.top - anchors.left: inputfieldy.right - anchors.leftMargin: 30 - font.pixelSize: 20 - } - TextField { - id: inputfieldheight - width: 50 - height: inputfieldx.height - anchors.top: inputfieldx.top - anchors.left: inputfieldwidth.right - anchors.leftMargin: 30 - font.pixelSize: 20 + GroupBox { + id: groupcontrolbuttons2 + title: "getVisible()/getGeometry()/getContentSize()/getBrowserActionsState()" + width: 4 * 130 + 3 * 20 + 30 + anchors.top: groupsetvisible.bottom + anchors.topMargin: 10 + anchors.left: groupsetvisible.left + + Button { + id: buttongetvisible + width: 130 + height: 50 + anchors.left: parent.left + anchors.leftMargin: 10 + text: "Get Visible" + onClicked: browserinterface.getVisible() + } + + Button { + id: buttongetgeometry + width: 130 + height: 50 + anchors.top: buttongetvisible.top + anchors.left: buttongetvisible.right + anchors.leftMargin: 20 + text: "Get Geometry" + onClicked: browserinterface.getGeometry() + } + + Button { + id: buttongetcontentsize + width: 130 + height: buttongetgeometry.height + anchors.top: buttongetgeometry.top + anchors.left: buttongetgeometry.right + anchors.leftMargin: 20 + text: "Get ContentSize" + } + + Button { + width: 130 + height: buttongetgeometry.height + anchors.top: buttongetgeometry.top + anchors.left: buttongetcontentsize.right + anchors.leftMargin: 20 + text: "Get Browser ActionState" + } } - Button { - width: 130 - height: inputfieldx.height - anchors.top: inputfieldx.top - anchors.left: inputfieldheight.right - anchors.leftMargin: 30 - text: "setgeometry" + + GroupBox { + id: groupsetgeometry + title: "setGeometry(conn::brw::Rect & a_sRect)" + width: 4 * 50 + 130 + 4 * 20 + 30 + anchors.top: groupcontrolbuttons2.bottom + anchors.topMargin: 10 + anchors.left: groupcontrolbuttons2.left + + TextField { + id: inputfieldx + width: 50 + height: 50 + anchors.left: parent.left + anchors.leftMargin: 10 + font.pixelSize: 20 + maximumLength: 3 + inputMask: "999" + text: "0" + } + TextField { + id: inputfieldy + width: 50 + height: inputfieldx.height + anchors.top: inputfieldx.top + anchors.left: inputfieldx.right + anchors.leftMargin: 20 + font.pixelSize: 20 + maximumLength: 3 + inputMask: "999" + text: "0" + } + TextField { + id: inputfieldwidth + width: 50 + height: inputfieldx.height + anchors.top: inputfieldx.top + anchors.left: inputfieldy.right + anchors.leftMargin: 20 + font.pixelSize: 20 + maximumLength: 3 + inputMask: "999" + text: "800" + } + TextField { + id: inputfieldheight + width: 50 + height: inputfieldx.height + anchors.top: inputfieldx.top + anchors.left: inputfieldwidth.right + anchors.leftMargin: 20 + font.pixelSize: 20 + maximumLength: 3 + inputMask: "999" + text: "520" + } + Button { + width: 130 + height: inputfieldx.height + anchors.top: inputfieldx.top + anchors.left: inputfieldheight.right + anchors.leftMargin: 20 + text: "Set Geometry" + onClicked: browserinterface.setGeometry(inputfieldx.text, inputfieldy.text, inputfieldwidth.text, inputfieldheight.text) + } } Text { - anchors.top: inputfieldx.bottom - anchors.topMargin: 30 - anchors.left: inputfieldx.left + anchors.top: groupsetgeometry.bottom + anchors.topMargin: 10 + anchors.left: groupsetgeometry.left text: "scrolling to be done" font.pixelSize: 20 } diff --git a/testapp/qml/testapp/main.qml b/testapp/qml/testapp/main.qml index c42554f..8c48434 100644 --- a/testapp/qml/testapp/main.qml +++ b/testapp/qml/testapp/main.qml @@ -1,5 +1,6 @@ import QtQuick 2.0 import QtQuick.Controls 1.0 +import browserdbusinterface 1.0 ApplicationWindow { id: root @@ -8,6 +9,9 @@ ApplicationWindow { height: 700 color: "gray" + BrowserInterface { + id: browserinterface + } TabView { anchors.top: parent.top anchors.left: parent.left |