summaryrefslogtreecommitdiff
path: root/tizen/src/ui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tizen/src/ui/mainwindow.cpp')
-rw-r--r--tizen/src/ui/mainwindow.cpp83
1 files changed, 52 insertions, 31 deletions
diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp
index 8667059807..54f441d46b 100644
--- a/tizen/src/ui/mainwindow.cpp
+++ b/tizen/src/ui/mainwindow.cpp
@@ -67,6 +67,8 @@ MainWindow::MainWindow(UiInformation *uiInfo, QWidget *parent) :
this->captureRequestData = NULL;
this->movingWidget = NULL;
+ this->isMovingMode = false;
+
/* windowing */
setWindowTitle(EMULATOR_TITLE);
setWindowIcon(QIcon(":/icons/emulator_icon.ico"));
@@ -97,7 +99,7 @@ MainWindow::MainWindow(UiInformation *uiInfo, QWidget *parent) :
}
/* display */
- updateDisplayMatrix();
+ updateDisplayTransform();
display = createDisplay(uiInfo->getMainFormDpyType());
/* set HW Key shortcut */
@@ -211,9 +213,9 @@ UIState *MainWindow::getUiState()
return uiInfo->getUiState();
}
-const QMatrix &MainWindow::getDisplayMatrix()
+const QTransform &MainWindow::getDisplayTransform()
{
- return dpyMatrix;
+ return dpyTransform;
}
MainView *MainWindow::getMainView()
@@ -412,12 +414,12 @@ void MainWindow::setMask(const QRegion &region)
}
}
-void MainWindow::updateDisplayMatrix()
+void MainWindow::updateDisplayTransform()
{
- dpyMatrix.reset();
- dpyMatrix.scale(
+ dpyTransform.reset();
+ dpyTransform.scale(
getUiState()->getScaleFactor(), getUiState()->getScaleFactor());
- dpyMatrix.rotate(uiInfo->getMainFormDpyType()->getAngle());
+ dpyTransform.rotate(uiInfo->getMainFormDpyType()->getAngle());
}
void MainWindow::switchForm(int index)
@@ -436,7 +438,7 @@ void MainWindow::switchForm(int index)
/* register new HW key shortcuts */
keyboardShortcut->registerHwKeyShortcuts(uiInfo->getMainForm()->getKeyList());
- updateDisplayMatrix();
+ updateDisplayTransform();
if (getDockingCon() != NULL) {
getDockingCon()->updateGeometry();
@@ -467,7 +469,7 @@ void MainWindow::scaleForm(int scale)
/* scale changing */
getUiState()->setScalePct(scale);
- updateDisplayMatrix();
+ updateDisplayTransform();
if (getDockingCon() != NULL) {
getDockingCon()->updateGeometry();
@@ -518,9 +520,12 @@ void MainWindow::processCaptured(bool captured, void *pixels,
if (captured) {
qDebug("save captured image: %p", pixels);
-
- QImage image = QImage((uchar *)pixels, width, height, QImage::Format_RGB32);
- QPixmap pixmap = QPixmap::fromImage(image); /* deep copy the data */
+ // pixels's format is ARGB32
+ QImage image =
+ QImage((uchar *)pixels, width, height, QImage::Format_ARGB32);
+ // deep copy from image & set all alpha channel value to 0xFF
+ QPixmap pixmap =
+ QPixmap::fromImage(image.convertToFormat(QImage::Format_RGB32));
QMetaObject::invokeMethod(popupMenu, "slotShowScreenshot",
Qt::QueuedConnection, Q_ARG(QPixmap, pixmap));
@@ -528,6 +533,8 @@ void MainWindow::processCaptured(bool captured, void *pixels,
qDebug("save blank image");
QPixmap pixmap(uiInfo->getResolution().width(), uiInfo->getResolution().height());
+ // fill the uninitialized buffer of the pixmap with 0xFF000000
+ pixmap.fill(QColor(0, 0, 0, 255));
QMetaObject::invokeMethod(popupMenu, "slotShowScreenshot",
Qt::QueuedConnection, Q_ARG(QPixmap, pixmap));
}
@@ -556,12 +563,17 @@ void MainWindow::turnOnMovingMode()
{
qDebug("enter the moving mode");
+ if (isMovingMode) {
+ return;
+ }
+
getDisplay()->turnOnMovingMode();
- if (isMovingMode() == false) {
+ if (movingWidget == NULL) {
movingWidget = new MovingWidget(this);
}
+ isMovingMode = true;
movingWidget->show();
}
@@ -569,17 +581,14 @@ void MainWindow::turnOffMovingMode()
{
qDebug("leave the moving mode");
- getDisplay()->turnOffMovingMode();
-
- if (isMovingMode() == true) {
- movingWidget->close();
- movingWidget = NULL;
+ if (!isMovingMode) {
+ return;
}
-}
-bool MainWindow::isMovingMode()
-{
- return (movingWidget != NULL);
+ getDisplay()->turnOffMovingMode();
+
+ movingWidget->close();
+ isMovingMode = false;
}
/* override */
@@ -599,17 +608,29 @@ void MainWindow::closeEvent(QCloseEvent *event)
}
}
-MainWindow::~MainWindow()
+QMessageBox *MainWindow::showMsgBox(
+ QMessageBox::Icon iconType, const QString &text,
+ QMessageBox::StandardButtons buttons,
+ QMessageBox::StandardButton defaultButton)
{
- qDebug("destroy main window");
+ qWarning() << text;
- if (popupMenu) {
- delete popupMenu;
- popupMenu = NULL;
+ QMessageBox *msgBox = new QMessageBox(iconType,
+ EMULATOR_TITLE, text, buttons, this);
+ if (defaultButton != QMessageBox::NoButton) {
+ msgBox->setDefaultButton(defaultButton);
}
+ msgBox->setAttribute(Qt::WA_DeleteOnClose);
+ msgBox->show(); /* non-blocking */
- if (rotary != NULL) {
- delete rotary;
- rotary = NULL;
- }
+#ifdef CONFIG_LINUX
+ popupMenu->slotOnTop(getUiState()->isOnTop());
+#endif
+
+ return msgBox;
+}
+
+MainWindow::~MainWindow()
+{
+ qDebug("destroy main window");
}