diff options
author | Adriano Rezende <adriano.rezende@openbossa.org> | 2009-10-27 20:31:33 -0300 |
---|---|---|
committer | Adriano Rezende <adriano.rezende@openbossa.org> | 2009-10-29 18:25:06 -0300 |
commit | bade920d37f84f90c0d2845da983b199ef87e138 (patch) | |
tree | cdc9a59f78cd3a0e6def085670a621bb370932c8 /hyperui | |
parent | e8575e25487bd9fa6c323e0d05dd76e80c0eb54d (diff) |
HiperUI: Adjusted main menu organization following design mockup
The icons now are placed in a specific order to simulate a diagonal menu.
TODO: In order to not handle clicks in the transparent area the button must
support mask shape.
Diffstat (limited to 'hyperui')
28 files changed, 42 insertions, 41 deletions
diff --git a/hyperui/menuview.cpp b/hyperui/menuview.cpp index 9ed83dc..0173b72 100644 --- a/hyperui/menuview.cpp +++ b/hyperui/menuview.cpp @@ -29,65 +29,60 @@ ** ****************************************************************************/ -#include <QGraphicsGridLayout> - #include "global.h" #include "button.h" #include "menuview.h" #include "phoneview.h" +#define FPOS(i, j) QPointF(leftMargin + vSpacing * i, \ + topMargin + hSpacing * j) + MenuView::MenuView(QGraphicsItem *parent) : View(parent) { setTitle(tr("MENU")); + setFlag(QGraphicsItem::ItemHasNoContents); + setFlag(QGraphicsItem::ItemClipsChildrenToShape); // read settings const int topMargin = Resource::intValue("menu-view/margin-top"); const int leftMargin = Resource::intValue("menu-view/margin-left"); const int vSpacing = Resource::intValue("menu-view/spacing-vertical"); const int hSpacing = Resource::intValue("menu-view/spacing-horizontal"); + const QPointF &mainIconPos = Resource::value("menu-view/main-icon-pos").toPoint(); // initialize interface - setFlag(QGraphicsItem::ItemHasNoContents); + addIcon(Resource::pixmap("menu_bt_twitter.png"), FPOS(0, 0)); - Button *phoneButton = new Button(Resource::pixmap("menu_bt_phone.png")); - Button *chatButton = new Button(Resource::pixmap("menu_bt_chat.png")); - Button *emailButton = new Button(Resource::pixmap("menu_bt_email.png")); - Button *musicButton = new Button(Resource::pixmap("menu_bt_music.png")); - Button *gamesButton = new Button(Resource::pixmap("menu_bt_games.png")); - Button *navigationButton = new Button(Resource::pixmap("menu_bt_navigation.png")); - Button *folderButton = new Button(Resource::pixmap("menu_bt_folder.png")); - Button *calendarButton = new Button(Resource::pixmap("menu_bt_calendar.png")); - Button *settingsButton = new Button(Resource::pixmap("menu_bt_settings.png")); - Button *cameraButton = new Button(Resource::pixmap("menu_bt_camera.png")); - Button *webButton = new Button(Resource::pixmap("menu_bt_web.png")); - Button *twitterButton = new Button(Resource::pixmap("menu_bt_twitter.png")); + addIcon(Resource::pixmap("menu_bt_email.png"), FPOS(0, 2)); + addIcon(Resource::pixmap("menu_bt_settings.png"), FPOS(1, 1)); + addIcon(Resource::pixmap("menu_bt_music.png"), FPOS(2, 0)); - connect(phoneButton, SIGNAL(clicked()), SLOT(onPhoneClicked())); + addIcon(Resource::pixmap("menu_bt_navigation.png"), FPOS(0, 4)); + addIcon(Resource::pixmap("menu_bt_chat.png"), FPOS(1, 3)); + addIcon(Resource::pixmap("menu_bt_games.png"), FPOS(2, 2)); + addIcon(Resource::pixmap("menu_bt_web.png"), FPOS(3, 1)); - QGraphicsGridLayout *layout = new QGraphicsGridLayout(); - layout->setVerticalSpacing(vSpacing); - layout->setHorizontalSpacing(hSpacing); - layout->setContentsMargins(leftMargin, topMargin, 0, 0); + addIcon(Resource::pixmap("menu_bt_folder.png"), FPOS(1, 5)); + addIcon(Resource::pixmap("menu_bt_calendar.png"), FPOS(2, 4)); + addIcon(Resource::pixmap("menu_bt_camera.png"), FPOS(3, 3)); - layout->addItem(phoneButton, 0, 0); - layout->addItem(chatButton, 0, 1); - layout->addItem(emailButton, 0, 2); - - layout->addItem(musicButton, 1, 0); - layout->addItem(gamesButton, 1, 1); - layout->addItem(navigationButton, 1, 2); + addIcon(Resource::pixmap("menu_bt_phone.png"), + mainIconPos, SLOT(onPhoneClicked())); +} - layout->addItem(folderButton, 2, 0); - layout->addItem(calendarButton, 2, 1); - layout->addItem(settingsButton, 2, 2); +Button *MenuView::addIcon(const QPixmap &pixmap, const QPointF &pos, + const char *slot) +{ + Button *button = new Button(pixmap); + button->setParentItem(this); + button->setPos(pos); - layout->addItem(cameraButton, 3, 0); - layout->addItem(webButton, 3, 1); - layout->addItem(twitterButton, 3, 2); + if (slot) + connect(button, SIGNAL(clicked()), slot); - setLayout(layout); + return button; } void MenuView::onPhoneClicked() diff --git a/hyperui/menuview.h b/hyperui/menuview.h index 62478f3..f649d33 100644 --- a/hyperui/menuview.h +++ b/hyperui/menuview.h @@ -44,6 +44,10 @@ public: protected slots: void onPhoneClicked(); + +protected: + Button *addIcon(const QPixmap &pixmap, const QPointF &pos, + const char *slot = 0); }; #endif diff --git a/hyperui/resource/640x360/hyperui.ini b/hyperui/resource/640x360/hyperui.ini index 9d11953..0a864da 100644 --- a/hyperui/resource/640x360/hyperui.ini +++ b/hyperui/resource/640x360/hyperui.ini @@ -18,9 +18,10 @@ margin-top=90 [menu-view] margin-top=10 -margin-left=18 -spacing-vertical=38 -spacing-horizontal=23 +margin-left=10 +spacing-vertical=72 +spacing-horizontal=72 +main-icon-pos=@Point(-53 416) [clock-widget] update-timeout=5000 diff --git a/hyperui/resource/640x360/images/menu_bt_calendar.png b/hyperui/resource/640x360/images/menu_bt_calendar.png Binary files differindex 99963e1..cf77d08 100644 --- a/hyperui/resource/640x360/images/menu_bt_calendar.png +++ b/hyperui/resource/640x360/images/menu_bt_calendar.png diff --git a/hyperui/resource/640x360/images/menu_bt_camera.png b/hyperui/resource/640x360/images/menu_bt_camera.png Binary files differindex b1623e4..69742f9 100644 --- a/hyperui/resource/640x360/images/menu_bt_camera.png +++ b/hyperui/resource/640x360/images/menu_bt_camera.png diff --git a/hyperui/resource/640x360/images/menu_bt_chat.png b/hyperui/resource/640x360/images/menu_bt_chat.png Binary files differindex 61e1cea..b653d6c 100644 --- a/hyperui/resource/640x360/images/menu_bt_chat.png +++ b/hyperui/resource/640x360/images/menu_bt_chat.png diff --git a/hyperui/resource/640x360/images/menu_bt_email.png b/hyperui/resource/640x360/images/menu_bt_email.png Binary files differindex c1b5b38..615b063 100644 --- a/hyperui/resource/640x360/images/menu_bt_email.png +++ b/hyperui/resource/640x360/images/menu_bt_email.png diff --git a/hyperui/resource/640x360/images/menu_bt_folder.png b/hyperui/resource/640x360/images/menu_bt_folder.png Binary files differindex a15aac4..001df25 100644 --- a/hyperui/resource/640x360/images/menu_bt_folder.png +++ b/hyperui/resource/640x360/images/menu_bt_folder.png diff --git a/hyperui/resource/640x360/images/menu_bt_games.png b/hyperui/resource/640x360/images/menu_bt_games.png Binary files differindex 0c32bc2..a225d48 100644 --- a/hyperui/resource/640x360/images/menu_bt_games.png +++ b/hyperui/resource/640x360/images/menu_bt_games.png diff --git a/hyperui/resource/640x360/images/menu_bt_music.png b/hyperui/resource/640x360/images/menu_bt_music.png Binary files differindex b01fd47..bdaaf8d 100644 --- a/hyperui/resource/640x360/images/menu_bt_music.png +++ b/hyperui/resource/640x360/images/menu_bt_music.png diff --git a/hyperui/resource/640x360/images/menu_bt_navigation.png b/hyperui/resource/640x360/images/menu_bt_navigation.png Binary files differindex ca4cf44..5b0fb5f 100644 --- a/hyperui/resource/640x360/images/menu_bt_navigation.png +++ b/hyperui/resource/640x360/images/menu_bt_navigation.png diff --git a/hyperui/resource/640x360/images/menu_bt_phone.png b/hyperui/resource/640x360/images/menu_bt_phone.png Binary files differindex 7c0ee82..1a1eb10 100644 --- a/hyperui/resource/640x360/images/menu_bt_phone.png +++ b/hyperui/resource/640x360/images/menu_bt_phone.png diff --git a/hyperui/resource/640x360/images/menu_bt_settings.png b/hyperui/resource/640x360/images/menu_bt_settings.png Binary files differindex 7cb3231..2654eea 100644 --- a/hyperui/resource/640x360/images/menu_bt_settings.png +++ b/hyperui/resource/640x360/images/menu_bt_settings.png diff --git a/hyperui/resource/640x360/images/menu_bt_twitter.png b/hyperui/resource/640x360/images/menu_bt_twitter.png Binary files differindex 564d024..0b2aa98 100644 --- a/hyperui/resource/640x360/images/menu_bt_twitter.png +++ b/hyperui/resource/640x360/images/menu_bt_twitter.png diff --git a/hyperui/resource/640x360/images/menu_bt_web.png b/hyperui/resource/640x360/images/menu_bt_web.png Binary files differindex bfe9737..a3f590d 100644 --- a/hyperui/resource/640x360/images/menu_bt_web.png +++ b/hyperui/resource/640x360/images/menu_bt_web.png diff --git a/hyperui/resource/864x480/hyperui.ini b/hyperui/resource/864x480/hyperui.ini index 9994d22..51b09e7 100644 --- a/hyperui/resource/864x480/hyperui.ini +++ b/hyperui/resource/864x480/hyperui.ini @@ -17,10 +17,11 @@ label-rect=@Rect(10 10 267 35) margin-top=120 [menu-view] -margin-top=10 -margin-left=25 -spacing-vertical=50 -spacing-horizontal=28 +margin-top=18 +margin-left=18 +spacing-vertical=98 +spacing-horizontal=98 +main-icon-pos=@Point(-68 569) [clock-widget] update-timeout=5000 diff --git a/hyperui/resource/864x480/images/menu_bt_calendar.png b/hyperui/resource/864x480/images/menu_bt_calendar.png Binary files differindex c7f0f5d..cdc4f18 100644 --- a/hyperui/resource/864x480/images/menu_bt_calendar.png +++ b/hyperui/resource/864x480/images/menu_bt_calendar.png diff --git a/hyperui/resource/864x480/images/menu_bt_camera.png b/hyperui/resource/864x480/images/menu_bt_camera.png Binary files differindex 234b399..0bb2b73 100644 --- a/hyperui/resource/864x480/images/menu_bt_camera.png +++ b/hyperui/resource/864x480/images/menu_bt_camera.png diff --git a/hyperui/resource/864x480/images/menu_bt_chat.png b/hyperui/resource/864x480/images/menu_bt_chat.png Binary files differindex eab4a48..b5912f5 100644 --- a/hyperui/resource/864x480/images/menu_bt_chat.png +++ b/hyperui/resource/864x480/images/menu_bt_chat.png diff --git a/hyperui/resource/864x480/images/menu_bt_email.png b/hyperui/resource/864x480/images/menu_bt_email.png Binary files differindex 97f2047..9168c48 100644 --- a/hyperui/resource/864x480/images/menu_bt_email.png +++ b/hyperui/resource/864x480/images/menu_bt_email.png diff --git a/hyperui/resource/864x480/images/menu_bt_folder.png b/hyperui/resource/864x480/images/menu_bt_folder.png Binary files differindex 689e5d3..80acd14 100644 --- a/hyperui/resource/864x480/images/menu_bt_folder.png +++ b/hyperui/resource/864x480/images/menu_bt_folder.png diff --git a/hyperui/resource/864x480/images/menu_bt_games.png b/hyperui/resource/864x480/images/menu_bt_games.png Binary files differindex 6d265c8..64facc0 100644 --- a/hyperui/resource/864x480/images/menu_bt_games.png +++ b/hyperui/resource/864x480/images/menu_bt_games.png diff --git a/hyperui/resource/864x480/images/menu_bt_music.png b/hyperui/resource/864x480/images/menu_bt_music.png Binary files differindex 073e9a3..4d14fdf 100644 --- a/hyperui/resource/864x480/images/menu_bt_music.png +++ b/hyperui/resource/864x480/images/menu_bt_music.png diff --git a/hyperui/resource/864x480/images/menu_bt_navigation.png b/hyperui/resource/864x480/images/menu_bt_navigation.png Binary files differindex da37631..90835be 100644 --- a/hyperui/resource/864x480/images/menu_bt_navigation.png +++ b/hyperui/resource/864x480/images/menu_bt_navigation.png diff --git a/hyperui/resource/864x480/images/menu_bt_phone.png b/hyperui/resource/864x480/images/menu_bt_phone.png Binary files differindex 567c76c..f6978f5 100644 --- a/hyperui/resource/864x480/images/menu_bt_phone.png +++ b/hyperui/resource/864x480/images/menu_bt_phone.png diff --git a/hyperui/resource/864x480/images/menu_bt_settings.png b/hyperui/resource/864x480/images/menu_bt_settings.png Binary files differindex 3bcecc4..87bba74 100644 --- a/hyperui/resource/864x480/images/menu_bt_settings.png +++ b/hyperui/resource/864x480/images/menu_bt_settings.png diff --git a/hyperui/resource/864x480/images/menu_bt_twitter.png b/hyperui/resource/864x480/images/menu_bt_twitter.png Binary files differindex 8cddefb..7904c00 100644 --- a/hyperui/resource/864x480/images/menu_bt_twitter.png +++ b/hyperui/resource/864x480/images/menu_bt_twitter.png diff --git a/hyperui/resource/864x480/images/menu_bt_web.png b/hyperui/resource/864x480/images/menu_bt_web.png Binary files differindex ecbbdf8..4e11f6a 100644 --- a/hyperui/resource/864x480/images/menu_bt_web.png +++ b/hyperui/resource/864x480/images/menu_bt_web.png |