diff options
author | Marcel Schuette <marcel.schuette@pelagicore.com> | 2013-08-07 16:04:49 +0200 |
---|---|---|
committer | Marcel Schuette <marcel.schuette@pelagicore.com> | 2013-08-07 16:04:49 +0200 |
commit | 8d2b7a281afa6c9e2e4574237217dba208c20a5e (patch) | |
tree | f5a4be11fe02fd4f09d504e6888de5a95cb8dc20 | |
parent | 94294f7f1283d3e27bcee23c38bc215016f47b7b (diff) | |
download | browser-poc-8d2b7a281afa6c9e2e4574237217dba208c20a5e.tar.gz |
added get/setGeometry functionality
-rw-r--r-- | browser/browserhelper.cpp | 14 | ||||
-rw-r--r-- | browser/webpagewindow.cpp | 19 | ||||
-rw-r--r-- | common/browserdefs.h | 98 |
3 files changed, 55 insertions, 76 deletions
diff --git a/browser/browserhelper.cpp b/browser/browserhelper.cpp index 3a828d7..8f974a9 100644 --- a/browser/browserhelper.cpp +++ b/browser/browserhelper.cpp @@ -36,6 +36,11 @@ browserhelper::browserhelper(QObject *parent) : 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>(); bookmarkmanager *bm = new bookmarkmanager(); new IBookmarkManagerAdaptor(bm); @@ -46,10 +51,6 @@ browserhelper::browserhelper(QObject *parent) : if(!connection.registerObject("/bookmarkmanager", bm)) qDebug() << "failed register object bookmarkmanager"; - - qDBusRegisterMetaType<conn::brw::DIALOG_RESULT>(); - qDBusRegisterMetaType<conn::brw::INPUT_ELEMENT_TYPE>(); - userinput *ui = new userinput(); new IUserInputAdaptor(ui); @@ -58,10 +59,6 @@ browserhelper::browserhelper(QObject *parent) : if(!connection.registerObject("/userinput", ui)) qDebug() << "failed register object userinput"; - - qDBusRegisterMetaType<conn::brw::SCROLL_DIRECTION>(); - qDBusRegisterMetaType<conn::brw::SCROLL_TYPE>(); - wpw = new webpagewindow(); new IWebPageWindowAdaptor(wpw); @@ -70,7 +67,6 @@ browserhelper::browserhelper(QObject *parent) : if(!connection.registerObject("/webpagewindow", wpw)) qDebug() << "failed register object userinput"; - browser *br = new browser(); new IBrowserAdaptor(br); diff --git a/browser/webpagewindow.cpp b/browser/webpagewindow.cpp index b00f060..cf0c9d8 100644 --- a/browser/webpagewindow.cpp +++ b/browser/webpagewindow.cpp @@ -95,14 +95,10 @@ conn::brw::ERROR_IDS webpagewindow::getContentSize(uint &a_u32Width, uint &a_u32 conn::brw::ERROR_IDS webpagewindow::getGeometry(conn::brw::Rect &a_sRect) { qDebug() << __PRETTY_FUNCTION__; - int width = webitem->property("width").toInt(); - int height = webitem->property("height").toInt(); - int x = webitem->property("x").toInt(); - int y = webitem->property("y").toInt(); - - QRect *temp_rect = new QRect(x, y, width, height); - - a_sRect = *temp_rect; + a_sRect.i32X = webitem->property("x").toInt(); + a_sRect.i32Y = webitem->property("y").toInt(); + a_sRect.i32Width = webitem->property("width").toInt(); + a_sRect.i32Height = webitem->property("height").toInt(); return conn::brw::EID_NO_ERROR; } @@ -110,7 +106,12 @@ conn::brw::ERROR_IDS webpagewindow::getGeometry(conn::brw::Rect &a_sRect) { conn::brw::ERROR_IDS webpagewindow::setGeometry(const conn::brw::Rect & a_sRect) { qDebug() << __PRETTY_FUNCTION__; - return conn::brw::EID_NOT_IMPLEMENTED; + webitem->setProperty("x", a_sRect.i32X); + webitem->setProperty("y", a_sRect.i32Y); + webitem->setProperty("width", a_sRect.i32Width); + webitem->setProperty("height", a_sRect.i32Height); + + return conn::brw::EID_NO_ERROR; } conn::brw::ERROR_IDS webpagewindow::scroll(conn::brw::SCROLL_DIRECTION a_eScrollDirection, conn::brw::SCROLL_TYPE a_eScrollType) { diff --git a/common/browserdefs.h b/common/browserdefs.h index cff5fec..2c134db 100644 --- a/common/browserdefs.h +++ b/common/browserdefs.h @@ -116,39 +116,16 @@ namespace conn { return argument; } - /*! - * - */ + //## type BookmarkItem struct BookmarkItem { - /*! - * - */ - int i32Uid; //## attribute i32Uid - /*! - * - */ - int i32Type; //## attribute eType - /*! - * - */ - QString strParentFolderPath; //## attribute strParentFolderPath - /*! - * - */ - QString strTitle; //## attribute strTitle - /*! - * - */ - QString strUrl; //## attribute strUrl - /*! - * - */ - QString strIconPath; //## attribute strIconPath - /*! - * - */ - QString strThumbnailPath; //## attribute strThumbnailPath + int i32Uid; //## attribute i32Uid + int i32Type; //## attribute eType + QString strParentFolderPath; //## attribute strParentFolderPath + QString strTitle; //## attribute strTitle + QString strUrl; //## attribute strUrl + QString strIconPath; //## attribute strIconPath + QString strThumbnailPath; //## attribute strThumbnailPath BookmarkItem() : i32Uid(0) @@ -182,12 +159,7 @@ namespace conn { //## class BookmarkItemList - /*! - * - */ - typedef QList<conn::brw::BookmarkItem> BookmarkItemList; - - + typedef QList<conn::brw::BookmarkItem> BookmarkItemList; /*! @@ -335,13 +307,37 @@ namespace conn { return argument; } - - /*! - * - */ + //## type Rect - typedef QRect Rect; - + struct Rect { + int i32X; //## attribute i32X + int i32Y; //## attribute i32Y + int i32Width; //## attribute i32Width + int i32Height; //## attribute i32Height + + Rect() : i32X(0), i32Y(0), i32Width(0), i32Height(0) {} + }; + + inline const QDBusArgument &operator>>(const QDBusArgument &argument, conn::brw::Rect &rect) + { + argument.beginStructure(); + argument >> rect.i32X >> rect.i32Y >> rect.i32Width >> + rect.i32Height; + argument.endStructure(); + return argument; + } + + inline QDBusArgument &operator<<(QDBusArgument &argument, const conn::brw::Rect &rect) + { + argument.beginStructure(); + argument << rect.i32X << rect.i32Y << rect.i32Width << + rect.i32Height; + argument.endStructure(); + return argument; + } + + + /*! * Defines type of the object handlers. */ @@ -349,9 +345,6 @@ namespace conn { typedef qlonglong OBJECT_HANDLE; //## class ObjectHandleList - /*! - * - */ typedef QList<conn::brw::OBJECT_HANDLE> ObjectHandleList; @@ -360,21 +353,9 @@ namespace conn { */ //## type BrowserScrollDirections struct BrowserScrollDirections { - /*! - * - */ uchar u8Left; //## attribute u8Left - /*! - * - */ uchar u8Right; //## attribute u8Right - /*! - * - */ uchar u8Top; //## attribute u8Top - /*! - * - */ uchar u8Bottom; //## attribute u8Bottom BrowserScrollDirections() @@ -494,6 +475,7 @@ Q_DECLARE_METATYPE(conn::brw::INPUT_ELEMENT_TYPE) Q_DECLARE_METATYPE(conn::brw::SCROLL_DIRECTION) Q_DECLARE_METATYPE(conn::brw::SCROLL_TYPE) +Q_DECLARE_METATYPE(conn::brw::Rect) Q_DECLARE_METATYPE(conn::brw::BrowserScrollDirections) Q_DECLARE_METATYPE(conn::brw::BrowserActions) |