summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeokYeon Hwang <syeon.hwang@samsung.com>2014-10-28 01:22:47 -0700
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2014-10-28 01:22:47 -0700
commit21c8f6d13fb67054412b7741b12bc8b1fab9c2f1 (patch)
treec0dd0f144d343d0fe907a27625e7ed410d635e9d
parent10389ee6eb1216e29d90a45aed1c583817620195 (diff)
parent08d0e7efbc0c134c3a5fb00b9211f2ffb2c8bf1b (diff)
downloadqemu-21c8f6d13fb67054412b7741b12bc8b1fab9c2f1.tar.gz
qemu-21c8f6d13fb67054412b7741b12bc8b1fab9c2f1.tar.bz2
qemu-21c8f6d13fb67054412b7741b12bc8b1fab9c2f1.zip
Merge "controller: additional docking position support" into features/qt_dr
-rw-r--r--tizen/src/ui/dockingcontroller.cpp28
-rw-r--r--tizen/src/ui/dockingcontroller.h3
-rw-r--r--tizen/src/ui/dockingconview.cpp9
-rw-r--r--tizen/src/ui/dockingconview.h3
-rw-r--r--tizen/src/ui/floatingcontroller.cpp16
-rw-r--r--tizen/src/ui/floatingcontroller.h4
-rw-r--r--tizen/src/ui/floatingconview.cpp11
-rw-r--r--tizen/src/ui/floatingconview.h3
-rw-r--r--tizen/src/ui/mainwindow.cpp6
-rw-r--r--tizen/src/ui/skinview.cpp4
-rw-r--r--tizen/src/ui/uiinformation.cpp72
-rw-r--r--tizen/src/ui/uiinformation.h4
12 files changed, 105 insertions, 58 deletions
diff --git a/tizen/src/ui/dockingcontroller.cpp b/tizen/src/ui/dockingcontroller.cpp
index fa1dd45903..283e6babde 100644
--- a/tizen/src/ui/dockingcontroller.cpp
+++ b/tizen/src/ui/dockingcontroller.cpp
@@ -44,6 +44,14 @@ DockingController::DockingController(ControllerForm *conForm,
layout->setMargin(0);
layout->setSpacing(0);
+ if (dockPos & Qt::AlignCenter) {
+ layout->setAlignment(Qt::AlignCenter);
+ } else if (dockPos & Qt::AlignTop) {
+ layout->setAlignment(Qt::AlignTop);
+ } else if (dockPos & Qt::AlignBottom) {
+ layout->setAlignment(Qt::AlignBottom);
+ }
+
QGraphicsScene *conScene = new QGraphicsScene(this);
conScene->setBackgroundBrush(Qt::black);
@@ -52,6 +60,11 @@ DockingController::DockingController(ControllerForm *conForm,
layout->addWidget(conView);
}
+DockingConView *DockingController::getConView()
+{
+ return conView;
+}
+
int DockingController::getDockPos()
{
return dockPos;
@@ -73,21 +86,6 @@ void DockingController::closeEvent(QCloseEvent *event) {
win->getUIState()->conState.dockingCon = NULL;
}
-void DockingController::setRegion(QImage baseImage)
-{
- qDebug("set region");
-
- /*
- if (baseImage.isNull() == true) {
- qWarning("invalid image for region");
- return;
- }
-
- QImage region = baseImage.createAlphaMask();
- setMask(QRegion(QBitmap::fromImage(region)));
- */
-}
-
DockingController::~DockingController()
{
qDebug("destroy docking contoller");
diff --git a/tizen/src/ui/dockingcontroller.h b/tizen/src/ui/dockingcontroller.h
index b218f8c904..a388030f56 100644
--- a/tizen/src/ui/dockingcontroller.h
+++ b/tizen/src/ui/dockingcontroller.h
@@ -44,14 +44,13 @@ public:
QAction *menu, int dockPos, QWidget *parent = 0);
~DockingController();
+ DockingConView *getConView();
int getDockPos();
protected:
void showEvent(QShowEvent *event);
void closeEvent(QCloseEvent *event);
- void setRegion(QImage baseImage);
-
private:
DockingConView *conView;
ControllerForm *conForm;
diff --git a/tizen/src/ui/dockingconview.cpp b/tizen/src/ui/dockingconview.cpp
index e56c514f9c..81919de264 100644
--- a/tizen/src/ui/dockingconview.cpp
+++ b/tizen/src/ui/dockingconview.cpp
@@ -34,6 +34,8 @@
DockingConView::DockingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent)
: QGraphicsView(scene, parent)
{
+ this->parent = (DockingController *)parent;
+
setStyleSheet("background: transparent");
setStyleSheet("border-style: none");
@@ -83,11 +85,12 @@ void DockingConView::mousePressEvent(QMouseEvent *event)
}
if (event->button() == Qt::LeftButton) {
- QWidget *win = ((QWidget *)this->parent()->parent());
+ QWidget *win = ((QWidget *)parent->parent());
grabPos = event->globalPos();
eventPos = event->pos();
- rubberPos = win->pos() + ((QWidget *)this->parent())->pos();
+ rubberPos.setX(win->pos().x() + parent->pos().x());
+ rubberPos.setY(win->pos().y() + pos().y());
if (rubberBand != NULL) {
rubberBand->setGeometry(QRect(rubberPos, size()));
@@ -111,7 +114,7 @@ void DockingConView::mouseReleaseEvent(QMouseEvent *event)
}
/* toggle */
- MainWindow *win = ((MainWindow *)this->parent()->parent());
+ MainWindow *win = ((MainWindow *)parent->parent());
win->getUIState()->conState.recentlyFloatPos = event->globalPos() - eventPos;
win->openController(win->getUIState()->conState.conFormIndex, -1);
diff --git a/tizen/src/ui/dockingconview.h b/tizen/src/ui/dockingconview.h
index e4dc7d0c48..691400da41 100644
--- a/tizen/src/ui/dockingconview.h
+++ b/tizen/src/ui/dockingconview.h
@@ -36,6 +36,8 @@
#include "skinbezelitem.h"
#include "controllerform.h"
+class DockingController;
+
class DockingConView : public QGraphicsView
{
public:
@@ -55,6 +57,7 @@ protected:
private:
void createItems(ControllerForm *conForm);
+ DockingController *parent;
SkinBezelItem *bezelItem;
QRubberBand *rubberBand;
};
diff --git a/tizen/src/ui/floatingcontroller.cpp b/tizen/src/ui/floatingcontroller.cpp
index 36091f5c19..0616eff4e7 100644
--- a/tizen/src/ui/floatingcontroller.cpp
+++ b/tizen/src/ui/floatingcontroller.cpp
@@ -54,13 +54,18 @@ FloatingController::FloatingController(ControllerForm *conForm,
layout->addWidget(conView);
}
+FloatingConView *FloatingController::getConView()
+{
+ return conView;
+}
+
void FloatingController::showEvent(QShowEvent *event)
{
if (menu != NULL) {
menu->setChecked(true);
}
- setRegion(conForm->conImg[ControllerForm::normal]);
+ setRegion(&(conForm->conImg[ControllerForm::normal]));
}
void FloatingController::closeEvent(QCloseEvent *event) {
@@ -72,17 +77,16 @@ void FloatingController::closeEvent(QCloseEvent *event) {
win->getUIState()->conState.floatingCon = NULL;
}
-void FloatingController::setRegion(QImage baseImage)
+void FloatingController::setRegion(QImage *baseImage)
{
- //qDebug("set region");
+ qDebug("set region");
- if (baseImage.isNull() == true) {
+ if (baseImage->isNull() == true) {
qWarning("invalid image for region");
return;
}
- QImage region = baseImage.createAlphaMask();
- setMask(QRegion(QBitmap::fromImage(region)));
+ setMask(QRegion(QBitmap::fromImage(baseImage->createAlphaMask())));
}
FloatingController::~FloatingController()
diff --git a/tizen/src/ui/floatingcontroller.h b/tizen/src/ui/floatingcontroller.h
index d70f6ee174..d9e7bf50c0 100644
--- a/tizen/src/ui/floatingcontroller.h
+++ b/tizen/src/ui/floatingcontroller.h
@@ -43,11 +43,13 @@ public:
explicit FloatingController(ControllerForm *conForm, QAction *menu, QWidget *parent = 0);
~FloatingController();
+ FloatingConView *getConView();
+
protected:
void showEvent(QShowEvent *event);
void closeEvent(QCloseEvent *event);
- void setRegion(QImage baseImage);
+ void setRegion(QImage *baseImage);
private:
FloatingConView *conView;
diff --git a/tizen/src/ui/floatingconview.cpp b/tizen/src/ui/floatingconview.cpp
index 16038b7e39..ca1c6b2219 100644
--- a/tizen/src/ui/floatingconview.cpp
+++ b/tizen/src/ui/floatingconview.cpp
@@ -36,6 +36,8 @@
FloatingConView::FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent)
: QGraphicsView(scene, parent)
{
+ this->parent = (FloatingController *)parent;
+
setStyleSheet("background: transparent");
setStyleSheet("border-style: none");
@@ -121,10 +123,8 @@ void FloatingConView::mousePressEvent(QMouseEvent *event)
}
if (event->button() == Qt::LeftButton) {
- QWidget *con = ((QWidget *) this->parent());
-
grabPos = event->globalPos();
- conPos = con->pos();
+ conPos = parent->pos();
}
}
@@ -140,7 +140,7 @@ void FloatingConView::mouseReleaseEvent(QMouseEvent *event)
grabPos = QPoint(-1, -1);
}
- QWidget *con = ((QWidget *)this->parent());
+ QWidget *con = ((QWidget *)parent);
QWidget *dst = ((QWidget *)con->parent());
int dockPos = isDockable(dst, con);
@@ -160,9 +160,8 @@ void FloatingConView::mouseMoveEvent(QMouseEvent *event)
return;
}
- QWidget *con = ((QWidget *)this->parent());
if (grabPos != QPoint(-1, -1)) {
- con->move(conPos + (event->globalPos() - grabPos));
+ parent->move(conPos + (event->globalPos() - grabPos));
}
}
diff --git a/tizen/src/ui/floatingconview.h b/tizen/src/ui/floatingconview.h
index 02830e1da4..71ef154bb3 100644
--- a/tizen/src/ui/floatingconview.h
+++ b/tizen/src/ui/floatingconview.h
@@ -34,6 +34,8 @@
#include "skinbezelitem.h"
#include "controllerform.h"
+class FloatingController;
+
class FloatingConView : public QGraphicsView
{
public:
@@ -54,6 +56,7 @@ protected:
private:
void createItems(ControllerForm *conForm);
+ FloatingController *parent;
SkinBezelItem *bezelItem;
};
diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp
index 08819c9e38..54628de9b7 100644
--- a/tizen/src/ui/mainwindow.cpp
+++ b/tizen/src/ui/mainwindow.cpp
@@ -256,7 +256,6 @@ void MainWindow::openController(int index, int dockPos)
getFloatingCon()->show();
} else {
- // TODO: alignment
winLayout->addWidget(getDockingCon());
}
}
@@ -286,8 +285,7 @@ void MainWindow::resizeEvent(QResizeEvent *event)
{
qDebug("resize main window");
- resize(uiInfo->getMainSize().width(),
- uiInfo->getMainSize().height());
+ resize(uiInfo->getUiSize());
setRegion();
}
@@ -296,7 +294,7 @@ void MainWindow::setRegion()
{
//qDebug("set region");
- setMask(uiInfo->getMainRegion());
+ setMask(uiInfo->getUiRegion());
}
void MainWindow::rotate(int angle)
diff --git a/tizen/src/ui/skinview.cpp b/tizen/src/ui/skinview.cpp
index 720e937fa5..c06f7566a1 100644
--- a/tizen/src/ui/skinview.cpp
+++ b/tizen/src/ui/skinview.cpp
@@ -89,8 +89,8 @@ void SkinView::resizeEvent(QResizeEvent *event)
MainWindow *win = ((MainWindow *)this->parent());
/* geometry */
- const int width = win->uiInfo->getMainSize().width();
- const int height = win->uiInfo->getMainSize().height();
+ const int width = win->uiInfo->getUiSize().width();
+ const int height = win->uiInfo->getUiSize().height();
setGeometry(0, 0, width, height);
/* scaling */
diff --git a/tizen/src/ui/uiinformation.cpp b/tizen/src/ui/uiinformation.cpp
index ea2a93fd38..0b7e878eb9 100644
--- a/tizen/src/ui/uiinformation.cpp
+++ b/tizen/src/ui/uiinformation.cpp
@@ -70,19 +70,31 @@ QSize UIInformation::getMainSize()
return QSize(0, 0);
}
- QSize mainSize = mainForm->skinImg[MainForm::normal].size() * uiState.getScaleFactor();
+ return mainForm->skinImg[MainForm::normal].size() * uiState.getScaleFactor();
+}
+
+QSize UIInformation::getConSize()
+{
+ ControllerForm *conForm = getConForm();
+ if (conForm == NULL) {
+ qWarning("controller form is null");
+ return QSize(0, 0);
+ }
+
+ return conForm->conImg[ControllerForm::normal].size();
+}
+
+QSize UIInformation::getUiSize()
+{
+ QSize uiSize = getMainSize();
/* docking controller */
if (uiState.conState.dockingCon != NULL) {
- ControllerForm *conForm = getConForm();
- if (conForm != NULL) {
- QSize conSize = conForm->conImg[ControllerForm::normal].size();
-
- mainSize.setWidth(mainSize.width() + conSize.width());
- }
+ QSize conSize = getConSize();
+ uiSize.setWidth(uiSize.width() + conSize.width());
}
- return mainSize;
+ return uiSize;
}
QRegion UIInformation::getMainRegion()
@@ -94,28 +106,50 @@ QRegion UIInformation::getMainRegion()
}
QImage *mainImage = &(mainForm->skinImg[MainForm::normal]);
-
QImage regionImage = mainImage->scaled(
mainImage->width() * uiState.getScaleFactor(),
mainImage->height() * uiState.getScaleFactor()).createAlphaMask();
- QRegion region(QBitmap::fromImage(regionImage));
+ return QRegion(QBitmap::fromImage(regionImage));
+}
+
+QRegion UIInformation::getConRegion()
+{
+ ControllerForm *conForm = getConForm();
+ if (conForm == NULL) {
+ qWarning("controller form is null");
+ return QRegion(0, 0, 0, 0);
+ }
+
+ QImage *conImage = &(conForm->conImg[ControllerForm::normal]);
+
+ return QRegion(QBitmap::fromImage(conImage->createAlphaMask()));
+}
+
+QRegion UIInformation::getUiRegion()
+{
+ QRegion uiRegion = getMainRegion();
/* docking controller */
DockingController *con = uiState.conState.dockingCon;
if (con != NULL) {
- ControllerForm *conForm = getConForm();
- if (conForm != NULL) {
- QImage *conImage = &(conForm->conImg[ControllerForm::normal]);
- QRegion regionCon(QBitmap::fromImage(conImage->createAlphaMask()));
-
- // TODO: height shift
- regionCon.translate(regionImage.width() + 1, 0);
- region = region.united(regionCon);
+ QRegion conRegion = getConRegion();
+
+ int vShift = 0;
+ if (getMainSize().height() > getConSize().height()) {
+ if (con->getDockPos() & Qt::AlignCenter) {
+ vShift = (getMainSize().height() / 2)
+ - (getConSize().height() / 2);
+ } else if (con->getDockPos() & Qt::AlignBottom) {
+ vShift = getMainSize().height() - getConSize().height();
+ }
}
+
+ conRegion.translate(getMainSize().width() + 1, vShift);
+ uiRegion = uiRegion.united(conRegion);
}
- return region;
+ return uiRegion;
}
UIInformation::~UIInformation()
diff --git a/tizen/src/ui/uiinformation.h b/tizen/src/ui/uiinformation.h
index 221338e80c..14e7fa3225 100644
--- a/tizen/src/ui/uiinformation.h
+++ b/tizen/src/ui/uiinformation.h
@@ -58,7 +58,11 @@ public:
MainForm *getMainForm(); /* current */
ControllerForm *getConForm();
QSize getMainSize();
+ QSize getConSize();
+ QSize getUiSize(); /* size included main, docking con */
QRegion getMainRegion();
+ QRegion getConRegion();
+ QRegion getUiRegion(); /* size included main, docking con */
};
#endif // UIINFORMATION_H