{
offGuideShown = true;
- offGuide = new QLabel(win);
- offGuide->setAttribute(Qt::WA_DeleteOnClose);
- offGuide->setStyleSheet(
- "background-color: black; border-style: none;");
- offGuide->setAlignment(Qt::AlignCenter);
-
- offGuide->setGeometry(getGeometry());
- offGuide->setPixmap(offGuideImg.scaled(
- getGeometry().width(), getGeometry().height(),
- Qt::KeepAspectRatio, Qt::SmoothTransformation));
-
- if (maskImage.size() != QSize(0, 0)) {
- offGuide->setMask(maskImage.scaled(
- maskImage.width() * scaleFactor,
- maskImage.height() * scaleFactor).mask());
+ if (!offGuide) {
+ offGuide = new QLabel(win);
+ offGuide->setStyleSheet(
+ "background-color: black; border-style: none;");
+ offGuide->setAlignment(Qt::AlignCenter);
+
+ offGuide->setGeometry(getGeometry());
+ offGuide->setPixmap(offGuideImg.scaled(
+ getGeometry().width(), getGeometry().height(),
+ Qt::KeepAspectRatio, Qt::SmoothTransformation));
+
+ if (maskImage.size() != QSize(0, 0)) {
+ offGuide->setMask(maskImage.scaled(
+ maskImage.width() * scaleFactor,
+ maskImage.height() * scaleFactor).mask());
+ }
}
offGuide->show();
{
if (offGuide != NULL) {
offGuide->close();
- offGuide = NULL;
}
offGuideShown = false;
this->captureRequestData = NULL;
this->movingWidget = NULL;
+ this->isMovingMode = false;
+
/* windowing */
setWindowTitle(EMULATOR_TITLE);
setWindowIcon(QIcon(":/icons/emulator_icon.ico"));
{
qDebug("enter the moving mode");
+ if (isMovingMode) {
+ return;
+ }
+
getDisplay()->turnOnMovingMode();
- if (isMovingMode() == false) {
+ if (movingWidget == NULL) {
movingWidget = new MovingWidget(this);
}
+ isMovingMode = true;
movingWidget->show();
}
{
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 */
}
}
-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");
}
Q_OBJECT
public:
+ bool isMovingMode;
+
explicit MainWindow(UiInformation *uiInfo, QWidget *parent = 0);
~MainWindow();
DisplayBase *getDisplay();
KeyboardShortcut *getKeyboardShortcut();
QLabel *getScreenWidget();
+ QMessageBox *showMsgBox(QMessageBox::Icon iconType, const QString &text,
+ QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
+ QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
void updateDisplayTransform();
void switchForm(int angle);
void turnOnMovingMode();
void turnOffMovingMode();
- bool isMovingMode();
public slots:
void slotContextMenu(const QPoint &pos);
QFileInfo sdbFileInfo(sdbPath);
if (sdbFileInfo.exists() == false) {
- showMsgBox(QMessageBox::Warning, MSG_SDB_NOT_EXIST + sdbPath);
+ parent->showMsgBox(QMessageBox::Warning, MSG_SDB_NOT_EXIST + sdbPath);
return;
}
if (!is_sdb_daemon_initialized()) {
- showMsgBox(QMessageBox::Warning, MSG_SDB_NOT_READY);
+ parent->showMsgBox(QMessageBox::Warning, MSG_SDB_NOT_READY);
return;
}
try {
QProcess::startDetached(command, arguments, workingDir);
} catch (QString &error) {
- showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error);
+ parent->showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error);
return;
}
#else
QString error = QString::number(GetLastError());
qWarning() << qPrintable(QString("error occured during launching \
ECP: ") + error);
- showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error);
+ parent->showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error);
}
CloseHandle(pinfo.hThread);
command = QString::fromLocal8Bit(path);
} else {
// can not enter here...
- showMsgBox(QMessageBox::Warning, MSG_INVALID_JAVA_PATH);
+ parent->showMsgBox(QMessageBox::Warning, MSG_INVALID_JAVA_PATH);
return;
}
}
// we can not launch ControlPanel
- showMsgBox(QMessageBox::Warning, MSG_ECP_NOT_EXIST);
+ parent->showMsgBox(QMessageBox::Warning, MSG_ECP_NOT_EXIST);
return;
}
return controllerMapper;
}
-QMessageBox *ContextMenu::showMsgBox(
- QMessageBox::Icon iconType, const QString &text,
- QMessageBox::StandardButtons buttons,
- QMessageBox::StandardButton defaultButton)
-{
- qWarning() << text;
-
- QMessageBox *msgBox = new QMessageBox(iconType,
- EMULATOR_TITLE, text, buttons, parent);
- if (defaultButton != QMessageBox::NoButton) {
- msgBox->setDefaultButton(defaultButton);
- }
- msgBox->setAttribute(Qt::WA_DeleteOnClose);
- msgBox->show(); /* non-blocking */
-
-#ifdef CONFIG_LINUX
- slotOnTop(parent->getUiState()->isOnTop());
-#endif
-
- return msgBox;
-}
-
ContextMenu::~ContextMenu()
{
qDebug("destroy menu");
- if (infoDialog) {
- delete infoDialog;
- infoDialog = NULL;
- }
-
delete sdbHelper;
longPressTimer->stop();
const QString &text, QShortcut *shortcut, const char *slot);
void attachShortcut(QAction *action, QShortcut *shortcut, const char *slot);
- QMessageBox *showMsgBox(QMessageBox::Icon iconType, const QString &text,
- QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
- QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
-
MainWindow *parent;
QString vmName;
DetailedInfoDialog *infoDialog;
#include "config-host.h"
#include "mainwindow.h"
+#include "displaybase.h"
#include "sdbhelper.h"
#include "sdbhelperthread.h"
#include "resource/ui_strings.h"
*/
#include "sdbhelperthread.h"
+#include "mainwindow.h"
#include "sdbhelper.h"
#include "displaybase.h"
#include "resource/ui_strings.h"
{
qDebug() << "exitcode: " << exitCode;
//FIXME: (sdb) cannot returns exit code like "no space left"
- showMsgBox(QMessageBox::Warning, MSG_SDB_FAILED_PROCESSING + errString);
-}
-
-QMessageBox *SdbHelperThread::showMsgBox(
- QMessageBox::Icon iconType, const QString &text,
- QMessageBox::StandardButtons buttons,
- QMessageBox::StandardButton defaultButton)
-{
- qWarning() << text;
-
- QMessageBox *msgBox = new QMessageBox(iconType,
- EMULATOR_TITLE, text, buttons, (QWidget *)parent->getMainWindow());
- if (defaultButton != QMessageBox::NoButton) {
- msgBox->setDefaultButton(defaultButton);
- }
- msgBox->setAttribute(Qt::WA_DeleteOnClose);
- msgBox->setModal(false);
- msgBox->show(); /* non-blocking */
-
- return msgBox;
+ ((MainWindow *)parent->getMainWindow())->showMsgBox(QMessageBox::Warning, MSG_SDB_FAILED_PROCESSING + errString);
}
int command;
QString errorMsg;
QString outMsg;
- QMessageBox *showMsgBox(QMessageBox::Icon iconType, const QString &text,
- QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
- QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
signals:
void errorOccured(QString errString, int exitCode);
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_TranslucentBackground);
- setAttribute(Qt::WA_DeleteOnClose);
resize(win->size());
qDebug() << "moving widget size:" << win->size();