summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tizen/src/ui/controller/dockingcontroller.cpp5
-rw-r--r--tizen/src/ui/controller/dockingcontroller.h1
-rw-r--r--tizen/src/ui/controller/dockingconview.cpp9
-rw-r--r--tizen/src/ui/controller/floatingcontroller.cpp6
-rw-r--r--tizen/src/ui/controller/floatingcontroller.h4
-rw-r--r--tizen/src/ui/controller/floatingconview.cpp9
-rw-r--r--tizen/src/ui/controller/generalpurposecon.cpp14
-rw-r--r--tizen/src/ui/controller/hwkeybutton.cpp35
-rw-r--r--tizen/src/ui/controller/hwkeybutton.h2
-rw-r--r--tizen/src/ui/layout/controllerform.cpp5
-rw-r--r--tizen/src/ui/layout/controllerform.h2
-rw-r--r--tizen/src/ui/layout/keycodetype.cpp4
-rw-r--r--tizen/src/ui/resource/resource.qrc12
-rw-r--r--tizen/src/ui/resource/skins/mobile/mobile-general-3btn/controller/key-window/layout.xml16
-rw-r--r--tizen/src/ui/resource/skins/wearable/wearable-general-2btn/controller/key-window/layout.xml16
-rw-r--r--tizen/src/ui/skinpainter.cpp13
-rw-r--r--tizen/src/ui/skinpainter.h10
-rw-r--r--tizen/src/ui/xmllayoutparser.cpp32
18 files changed, 180 insertions, 15 deletions
diff --git a/tizen/src/ui/controller/dockingcontroller.cpp b/tizen/src/ui/controller/dockingcontroller.cpp
index 51d4daf0f5..ad06118f5c 100644
--- a/tizen/src/ui/controller/dockingcontroller.cpp
+++ b/tizen/src/ui/controller/dockingcontroller.cpp
@@ -58,6 +58,11 @@ DockingConView *DockingController::getConView()
return conView;
}
+MainWindow *DockingController::getMainWindow()
+{
+ return win;
+}
+
int DockingController::getDockPos()
{
return dockPos;
diff --git a/tizen/src/ui/controller/dockingcontroller.h b/tizen/src/ui/controller/dockingcontroller.h
index cd1673034a..57bb4cb266 100644
--- a/tizen/src/ui/controller/dockingcontroller.h
+++ b/tizen/src/ui/controller/dockingcontroller.h
@@ -48,6 +48,7 @@ public:
ControllerForm *getConForm();
DockingConView *getConView();
+ MainWindow *getMainWindow();
int getDockPos();
void updateGeometry();
diff --git a/tizen/src/ui/controller/dockingconview.cpp b/tizen/src/ui/controller/dockingconview.cpp
index 98a032858c..217108c634 100644
--- a/tizen/src/ui/controller/dockingconview.cpp
+++ b/tizen/src/ui/controller/dockingconview.cpp
@@ -69,6 +69,15 @@ void DockingConView::createItems(ControllerForm *conForm)
GeneralPurposeCon *generalCon = new GeneralPurposeCon();
QList<HWKeyButton *> buttons
= generalCon->createButtons(parentWidget(), conForm);
+
+ for (int i = 0; i < buttons.count(); i++) {
+ HWKeyButton *button = buttons.at(i);
+ if (button->getSlot() == NULL) {
+ continue;
+ }
+ connect(button, SIGNAL(clicked()),
+ parent->getMainWindow()->getPopupMenu(), button->getSlot());
+ }
}
}
diff --git a/tizen/src/ui/controller/floatingcontroller.cpp b/tizen/src/ui/controller/floatingcontroller.cpp
index 1f807d85eb..238517faea 100644
--- a/tizen/src/ui/controller/floatingcontroller.cpp
+++ b/tizen/src/ui/controller/floatingcontroller.cpp
@@ -33,6 +33,7 @@
FloatingController::FloatingController(ControllerForm *conForm,
QAction *menu, QWidget *parent) : QDialog(parent)
{
+ this->win = (MainWindow *)parent;
this->conForm = conForm;
this->menu = menu;
@@ -57,6 +58,11 @@ FloatingConView *FloatingController::getConView()
return conView;
}
+MainWindow *FloatingController::getMainWindow()
+{
+ return win;
+}
+
/* override */
void FloatingController::showEvent(QShowEvent *event)
{
diff --git a/tizen/src/ui/controller/floatingcontroller.h b/tizen/src/ui/controller/floatingcontroller.h
index 25c9121640..9c91ffe9c0 100644
--- a/tizen/src/ui/controller/floatingcontroller.h
+++ b/tizen/src/ui/controller/floatingcontroller.h
@@ -35,6 +35,8 @@
#include "layout/controllerform.h"
#include "floatingconview.h"
+class MainWindow;
+
class FloatingController : public QDialog
{
Q_OBJECT
@@ -45,6 +47,7 @@ public:
ControllerForm *getConForm();
FloatingConView *getConView();
+ MainWindow *getMainWindow();
protected:
void showEvent(QShowEvent *event);
@@ -53,6 +56,7 @@ protected:
void reject();
private:
+ MainWindow *win;
FloatingConView *conView;
ControllerForm *conForm;
QAction *menu;
diff --git a/tizen/src/ui/controller/floatingconview.cpp b/tizen/src/ui/controller/floatingconview.cpp
index bf38d32102..e4b9f80d66 100644
--- a/tizen/src/ui/controller/floatingconview.cpp
+++ b/tizen/src/ui/controller/floatingconview.cpp
@@ -69,6 +69,15 @@ void FloatingConView::createItems(ControllerForm *conForm)
GeneralPurposeCon *generalCon = new GeneralPurposeCon();
QList<HWKeyButton *> buttons
= generalCon->createButtons(parentWidget(), conForm);
+
+ for (int i = 0; i < buttons.count(); i++) {
+ HWKeyButton *button = buttons.at(i);
+ if (button->getSlot() == NULL) {
+ continue;
+ }
+ connect(button, SIGNAL(clicked()),
+ parent->getMainWindow()->getPopupMenu(), button->getSlot());
+ }
}
}
diff --git a/tizen/src/ui/controller/generalpurposecon.cpp b/tizen/src/ui/controller/generalpurposecon.cpp
index aacb467771..e4925e22dd 100644
--- a/tizen/src/ui/controller/generalpurposecon.cpp
+++ b/tizen/src/ui/controller/generalpurposecon.cpp
@@ -44,13 +44,25 @@ QList<HWKeyButton *> GeneralPurposeCon::createButtons(QWidget *parent, Controlle
topLeft.setY(topLeft.y() + GPC_HEAD_SPACING);
QList<HWKeyButton *> buttonList;
+
// H/W key list
createKeyList(parent, form->getKeyList(), topLeft, buttonList);
+ topLeft.setY(topLeft.y()
+ + (GPC_KEYBUTTON_VSPACING + GPC_KEYBUTTON_HEIGHT) * form->getKeyList().count());
+
+ // Menu key list
+ for (int i = 0; i < form->getSubFormList().count(); i++) {
+ ControllerForm *subForm = form->getSubFormList().at(i);
+ createKeyList(parent, subForm->getKeyList(), topLeft, buttonList);
+ topLeft.setY(topLeft.y()
+ + (GPC_KEYBUTTON_VSPACING + GPC_KEYBUTTON_HEIGHT) * subForm->getKeyList().count());
+ }
return buttonList;
}
-void GeneralPurposeCon::createKeyList(QWidget *parent, QList<HardwareKey *> keyList, QPoint topLeft, QList<HWKeyButton *> &buttonList)
+void GeneralPurposeCon::createKeyList(QWidget *parent, QList<HardwareKey *> keyList,
+ QPoint topLeft, QList<HWKeyButton *> &buttonList)
{
HardwareKey *hwKey = NULL;
HWKeyButton *keyButton = NULL;
diff --git a/tizen/src/ui/controller/hwkeybutton.cpp b/tizen/src/ui/controller/hwkeybutton.cpp
index 5b81849b20..16c109bc0c 100644
--- a/tizen/src/ui/controller/hwkeybutton.cpp
+++ b/tizen/src/ui/controller/hwkeybutton.cpp
@@ -60,6 +60,24 @@ HWKeyButton::HWKeyButton(QWidget *parent, HardwareKey *hwKey, QSize size) :
"color:#2E2E2E; background-color:#CCCCCC;"
"}"
);
+
+ //FIXME: set slot for menu button
+ if (hwKey->getKeycode() == 0) {
+ QString name = hwKey->getName();
+ if (QString::compare(name, "Control Panel") == 0) {
+ slot = SLOT(slotControlPanel());
+ } else if (QString::compare(name, "Screen Shot") == 0) {
+ slot = SLOT(slotRequestScreenshot());
+ } else if (QString::compare(name, "Rotate") == 0) {
+ slot = SLOT(slotSwitchShortcutNext());
+ } else if (QString::compare(name, "Shell") == 0) {
+ slot = SLOT(slotShell());
+ } else {
+ slot = NULL;
+ }
+ } else {
+ slot = NULL;
+ }
}
/* override */
@@ -67,8 +85,10 @@ void HWKeyButton::mousePressEvent(QMouseEvent *event)
{
const int keycode = hwKey->getKeycode();
- qDebug() << hwKey->getName() << "key button pressed:" << keycode;
- do_hw_key_event(KEY_PRESSED, keycode);
+ if (keycode > 0) {
+ qDebug() << hwKey->getName() << "key button pressed:" << keycode;
+ do_hw_key_event(KEY_PRESSED, keycode);
+ }
QPushButton::mousePressEvent(event);
}
@@ -78,12 +98,19 @@ void HWKeyButton::mouseReleaseEvent(QMouseEvent *event)
{
const int keycode = hwKey->getKeycode();
- qDebug() << hwKey->getName() << "key button released:" << keycode;
- do_hw_key_event(KEY_RELEASED, keycode);
+ if (keycode > 0) {
+ qDebug() << hwKey->getName() << "key button released:" << keycode;
+ do_hw_key_event(KEY_RELEASED, keycode);
+ }
QPushButton::mouseReleaseEvent(event);
}
+const char *HWKeyButton::getSlot()
+{
+ return slot;
+}
+
HWKeyButton::~HWKeyButton()
{
/* do nothing */
diff --git a/tizen/src/ui/controller/hwkeybutton.h b/tizen/src/ui/controller/hwkeybutton.h
index b758c2672f..807ae0aeaa 100644
--- a/tizen/src/ui/controller/hwkeybutton.h
+++ b/tizen/src/ui/controller/hwkeybutton.h
@@ -40,6 +40,7 @@ class HWKeyButton : public QPushButton
public:
HWKeyButton(QWidget *parent, HardwareKey *hwKey, QSize size);
~HWKeyButton();
+ virtual const char *getSlot();
protected:
void mousePressEvent(QMouseEvent *event);
@@ -47,6 +48,7 @@ protected:
private:
HardwareKey *hwKey;
+ const char *slot;
};
#endif // HWKEYBUTTON_H
diff --git a/tizen/src/ui/layout/controllerform.cpp b/tizen/src/ui/layout/controllerform.cpp
index 0cc8380a02..fffcf4d625 100644
--- a/tizen/src/ui/layout/controllerform.cpp
+++ b/tizen/src/ui/layout/controllerform.cpp
@@ -44,6 +44,11 @@ QRect ControllerForm::getCenteralRect()
return centeralRect;
}
+QList<ControllerForm *> &ControllerForm::getSubFormList()
+{
+ return subFormList;
+}
+
ControllerForm::~ControllerForm()
{
qDebug("destroy con layout");
diff --git a/tizen/src/ui/layout/controllerform.h b/tizen/src/ui/layout/controllerform.h
index 45482b687a..9cb3b4fc05 100644
--- a/tizen/src/ui/layout/controllerform.h
+++ b/tizen/src/ui/layout/controllerform.h
@@ -44,9 +44,11 @@ public:
void setCenteralRect(const QRect &rect);
QRect getCenteralRect();
+ QList<ControllerForm *> &getSubFormList();
private:
QRect centeralRect;
+ QList<ControllerForm *> subFormList;
};
#endif // CONTROLLERFORM_H
diff --git a/tizen/src/ui/layout/keycodetype.cpp b/tizen/src/ui/layout/keycodetype.cpp
index fd8bf97320..d59745e6fb 100644
--- a/tizen/src/ui/layout/keycodetype.cpp
+++ b/tizen/src/ui/layout/keycodetype.cpp
@@ -51,8 +51,8 @@ KeycodeType::KeycodeType(int shortPress, int longPress)
int KeycodeType::getShortPressKeycode()
{
- if (shortPress <= 0) {
- qWarning() << "invalid short press keycode:" << shortPress;
+ if (shortPress < 0) {
+ qWarning() << "invalid short press key code:" << shortPress;
}
return shortPress;
diff --git a/tizen/src/ui/resource/resource.qrc b/tizen/src/ui/resource/resource.qrc
index b888348d4a..637465b24e 100644
--- a/tizen/src/ui/resource/resource.qrc
+++ b/tizen/src/ui/resource/resource.qrc
@@ -36,6 +36,18 @@
<file>images/controller-skin/VolumeUp_hover.png</file>
<file>images/controller-skin/VolumeUp_normal.png</file>
<file>images/controller-skin/VolumeUp_pushed.png</file>
+ <file>images/controller-skin/Shell_hover.png</file>
+ <file>images/controller-skin/Shell_normal.png</file>
+ <file>images/controller-skin/Shell_pushed.png</file>
+ <file>images/controller-skin/Rotate_hover.png</file>
+ <file>images/controller-skin/Rotate_normal.png</file>
+ <file>images/controller-skin/Rotate_pushed.png</file>
+ <file>images/controller-skin/Screen Shot_hover.png</file>
+ <file>images/controller-skin/Screen Shot_normal.png</file>
+ <file>images/controller-skin/Screen Shot_pushed.png</file>
+ <file>images/controller-skin/Control Panel_hover.png</file>
+ <file>images/controller-skin/Control Panel_normal.png</file>
+ <file>images/controller-skin/Control Panel_pushed.png</file>
<file>icons/emulator_icon.ico</file>
<file>icons/shell.png</file>
diff --git a/tizen/src/ui/resource/skins/mobile/mobile-general-3btn/controller/key-window/layout.xml b/tizen/src/ui/resource/skins/mobile/mobile-general-3btn/controller/key-window/layout.xml
index e49c6ffca6..2145206a41 100644
--- a/tizen/src/ui/resource/skins/mobile/mobile-general-3btn/controller/key-window/layout.xml
+++ b/tizen/src/ui/resource/skins/mobile/mobile-general-3btn/controller/key-window/layout.xml
@@ -30,5 +30,21 @@
<shortcut>Ctrl+Shift+[</shortcut>
</key>
</keyList>
+ <form name="Menu Window">
+ <keyList>
+ <key name="Rotate">
+ <shortcut>Ctrl+Shift+Left</shortcut>
+ </key>
+ <key name="Shell">
+ <shortcut>Ctrl+Shift+S</shortcut>
+ </key>
+ <key name="Control Panel">
+ <shortcut>Ctrl+Shift+P</shortcut>
+ </key>
+ <key name="Screen Shot">
+ <shortcut>Ctrl+Shift+F12</shortcut>
+ </key>
+ </keyList>
+ </form>
</form>
</ControllerUI>
diff --git a/tizen/src/ui/resource/skins/wearable/wearable-general-2btn/controller/key-window/layout.xml b/tizen/src/ui/resource/skins/wearable/wearable-general-2btn/controller/key-window/layout.xml
index f4db577977..fbac90fdbb 100644
--- a/tizen/src/ui/resource/skins/wearable/wearable-general-2btn/controller/key-window/layout.xml
+++ b/tizen/src/ui/resource/skins/wearable/wearable-general-2btn/controller/key-window/layout.xml
@@ -13,5 +13,21 @@
<shortcut>Ctrl+Shift+F8</shortcut>
</key>
</keyList>
+ <form name="Menu Window">
+ <keyList>
+ <key name="Rotate">
+ <shortcut>Ctrl+Shift+Left</shortcut>
+ </key>
+ <key name="Shell">
+ <shortcut>Ctrl+Shift+S</shortcut>
+ </key>
+ <key name="Control Panel">
+ <shortcut>Ctrl+Shift+P</shortcut>
+ </key>
+ <key name="Screen Shot">
+ <shortcut>Ctrl+Shift+F12</shortcut>
+ </key>
+ </keyList>
+ </form>
</form>
</ControllerUI>
diff --git a/tizen/src/ui/skinpainter.cpp b/tizen/src/ui/skinpainter.cpp
index e55d3a27af..c78d4962c1 100644
--- a/tizen/src/ui/skinpainter.cpp
+++ b/tizen/src/ui/skinpainter.cpp
@@ -43,12 +43,12 @@ SkinPainter::SkinPainter(const QString &patchPath,
drawSkin(path, centerPatch, degree, tagLeftTop, tagColor);
}
-SkinPainter::SkinPainter(QSize centerPatch, int degree)
+SkinPainter::SkinPainter(QSize centerPatch, int degree, QList<Separator *> separators)
{
- drawSkin(centerPatch, degree);
+ drawSkin(centerPatch, degree, separators);
}
-void SkinPainter::drawSkin(QSize center, int degree) {
+void SkinPainter::drawSkin(QSize center, int degree, QList<Separator *> separators) {
qDebug() << "draw skin surface";
QRect centeralRect(0, 0, center.width(), center.height());
@@ -58,6 +58,13 @@ void SkinPainter::drawSkin(QSize center, int degree) {
QPainter painter(&image);
painter.fillRect(centeralRect, QBrush(QColor(244, 244, 244)));
+ // add separators
+ for (int i = 0; i < separators.count(); i++) {
+ Separator *s = separators.at(i);
+ painter.setPen(s->pen);
+ painter.drawLine(0, s->hOffset, center.width(), s->hOffset);
+ }
+
/* rotate */
QTransform transform;
skin = new QPixmap(image.transformed(transform.rotate(degree)));
diff --git a/tizen/src/ui/skinpainter.h b/tizen/src/ui/skinpainter.h
index 8adde2d954..03e91fc781 100644
--- a/tizen/src/ui/skinpainter.h
+++ b/tizen/src/ui/skinpainter.h
@@ -34,12 +34,18 @@
#include "layout/displaytype.h"
+struct Separator
+{
+ int hOffset;
+ QPen pen;
+};
+
class SkinPainter
{
public:
SkinPainter(const QString &patchPath, QSize centerPatch, int degree,
QPoint tagLeftTop, QColor tagColor);
- SkinPainter(QSize centerPatch, int degree);
+ SkinPainter(QSize centerPatch, int degree, QList<Separator *> separators);
~SkinPainter();
QImage getSkinImage() const;
@@ -48,7 +54,7 @@ public:
private:
void drawSkin(QString patchPath, QSize center, int degree,
QPoint tagLeftTop, QColor tagColor);
- void drawSkin(QSize center, int degree);
+ void drawSkin(QSize center, int degree, QList<Separator *> separators);
QPixmap *skin;
QRect centeralRect;
diff --git a/tizen/src/ui/xmllayoutparser.cpp b/tizen/src/ui/xmllayoutparser.cpp
index d7e82ced2b..59e81b1c99 100644
--- a/tizen/src/ui/xmllayoutparser.cpp
+++ b/tizen/src/ui/xmllayoutparser.cpp
@@ -720,6 +720,13 @@ ControllerForm *XmlLayoutParser::parseControllerForm(
} else if (xml.name() == HOVER_KEYWORD) {
/* hover */
form->setHoverType(parseHover(xml, depth + 1));
+ } else if (xml.name() == FORM_KEYWORD) {
+ /* sub form */
+ QWARN_INDENT(depth + 1) << "undefined element: " << xml.name();
+ ControllerForm *subform = parseControllerForm(xml, depth + 1);
+ if (subform != NULL) {
+ form->getSubFormList().append(subform);
+ }
} else {
QWARN_INDENT(depth + 1) << "undefined element: " << xml.name();
}
@@ -788,14 +795,33 @@ QString XmlLayoutParser::parseControllerUI(QXmlStreamReader &xml)
void XmlLayoutParser::makeGeneralCon(ControllerForm *form)
{
- const int keyCount = form->getKeyList().count();
+ int keyCount = form->getKeyList().count();
int width = GPC_KEYBUTTON_WIDTH + GPC_KEYBUTTON_HSPACING;
int height = GPC_HEAD_SPACING;
height += (GPC_KEYBUTTON_HEIGHT * keyCount) +
- (GPC_KEYBUTTON_VSPACING * (keyCount - 1)) + GPC_TAIL_SPACING;
+ (GPC_KEYBUTTON_VSPACING * (keyCount - 1));
+
+ // add sub form
+ QList<Separator *> sList;
+ QPen pen(QColor(205, 205, 205), 1, Qt::SolidLine);
+ for (int i = 0; i < form->getSubFormList().count(); i++) {
+ // for separator
+ Separator *s = new Separator();
+ s->pen = pen;
+ s->hOffset = height + GPC_KEYBUTTON_VSPACING / 2;
+ sList.append(s);
+
+ ControllerForm *subForm = form->getSubFormList().at(i);
+ keyCount = subForm->getKeyList().count();
+
+ height += (GPC_KEYBUTTON_HEIGHT * keyCount) +
+ (GPC_KEYBUTTON_VSPACING * keyCount);
+ }
+
+ height += GPC_TAIL_SPACING;
- SkinPainter painter(QSize(width, qMax(height, QT_LAYOUT_MINIMUM - 20)), 0);
+ SkinPainter painter(QSize(width, qMax(height, QT_LAYOUT_MINIMUM - 20)), 0, sList);
form->skinImg[LayoutForm::normal] = painter.getSkinImage();
form->setCenteralRect(painter.getCenteralRect());