diff options
Diffstat (limited to 'tizen/src/ui/controller/generalpurposecon.cpp')
-rw-r--r-- | tizen/src/ui/controller/generalpurposecon.cpp | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/tizen/src/ui/controller/generalpurposecon.cpp b/tizen/src/ui/controller/generalpurposecon.cpp index 9a5c31e4cf..5c7efbc149 100644 --- a/tizen/src/ui/controller/generalpurposecon.cpp +++ b/tizen/src/ui/controller/generalpurposecon.cpp @@ -27,6 +27,7 @@ * */ +#include <math.h> #include "config-host.h" #include "generalpurposecon.h" @@ -58,7 +59,7 @@ void GeneralPurposeCon::createHeaderBarAndBorder(QGraphicsScene *scene, UiInform } } -QList<HWKeyButton *> GeneralPurposeCon::createButtons(QWidget *parent, ControllerForm *form) +QList<HWKeyButton *> GeneralPurposeCon::createButtons(QGraphicsScene *scene, QWidget *parent, ControllerForm *form) { QPoint topLeft = form->getCenteralRect().topLeft(); topLeft.setX(topLeft.x() + GPC_LEFT_SPACING + GPC_BORDER_SIZE); @@ -67,32 +68,49 @@ QList<HWKeyButton *> GeneralPurposeCon::createButtons(QWidget *parent, Controlle QList<HWKeyButton *> buttonList; // H/W key list - createKeyList(parent, form->getKeyList(), topLeft, buttonList); + createKeyList(parent, form->getKeyList(), topLeft, form->getRowCount(), buttonList); topLeft.setY(topLeft.y() - + (GPC_KEYBUTTON_VSPACING + GPC_KEYBUTTON_HEIGHT) * form->getKeyList().count()); + + (GPC_KEYBUTTON_HEIGHT + GPC_KEYBUTTON_VSPACING) * form->getRowCount()); // Menu key list for (int i = 0; i < form->getSubFormList().count(); i++) { + // draw separator + QPen borderPen(QColor(153, 153, 153), 1, Qt::SolidLine); + scene->addLine(0, topLeft.y() - (GPC_KEYBUTTON_VSPACING / 2), + form->getCenteralRect().width() - GPC_BORDER_SIZE, + topLeft.y() - (GPC_KEYBUTTON_VSPACING / 2), borderPen); + // ControllerForm *subForm = form->getSubFormList().at(i); - createKeyList(parent, subForm->getKeyList(), topLeft, buttonList); + createKeyList(parent, subForm->getKeyList(), topLeft, subForm->getRowCount(), buttonList); topLeft.setY(topLeft.y() - + (GPC_KEYBUTTON_VSPACING + GPC_KEYBUTTON_HEIGHT) * subForm->getKeyList().count()); + + (GPC_KEYBUTTON_HEIGHT + GPC_KEYBUTTON_VSPACING) * form->getRowCount()); } return buttonList; } void GeneralPurposeCon::createKeyList(QWidget *parent, QList<HardwareKey *> keyList, - QPoint topLeft, QList<HWKeyButton *> &buttonList) + QPoint topLeft, int count, QList<HWKeyButton *> &buttonList) { + if (count == 0) { + return; + } + HardwareKey *hwKey = NULL; HWKeyButton *keyButton = NULL; - for (int i = 0; i < keyList.count(); i++) { - hwKey = keyList.at(i); - if (hwKey != NULL) { + int index = 0; + int loop = ceil(keyList.count() / (float) count); + + for (int c = 0; c < loop; c++) { + for (int i = 0; i < count && index < keyList.count(); i++) { + hwKey = keyList.at(index++); + if (hwKey == NULL) { + continue; + } + keyButton = new HWKeyButton(parent, hwKey, - QSize(GPC_KEYBUTTON_WIDTH, GPC_KEYBUTTON_HEIGHT)); + QSize(GPC_KEYBUTTON_WIDTH, GPC_KEYBUTTON_HEIGHT)); QString tooltip = hwKey->getTooltip(); if (tooltip.isEmpty() == true) { if (hwKey->getKeySequence().isEmpty() == false) { @@ -104,8 +122,8 @@ void GeneralPurposeCon::createKeyList(QWidget *parent, QList<HardwareKey *> keyL } keyButton->setToolTip(hwKey->getName() + " " + tooltip); - keyButton->move(topLeft.x(), topLeft.y() - + (GPC_KEYBUTTON_VSPACING + GPC_KEYBUTTON_HEIGHT) * i); + keyButton->move(topLeft.x() + (GPC_KEYBUTTON_WIDTH + GPC_KEYBUTTON_HSPACING) * c, + topLeft.y() + (GPC_KEYBUTTON_HEIGHT + GPC_KEYBUTTON_VSPACING) * i); buttonList.append(keyButton); } } |