diff options
author | ck <qt-info@nokia.com> | 2010-05-19 11:00:43 +0200 |
---|---|---|
committer | ck <qt-info@nokia.com> | 2010-05-19 11:00:43 +0200 |
commit | de7bc1d9cfdfef41c8e8fbeef9edc84f94804d1b (patch) | |
tree | 420fabdb984dbe47a5b6f2bb7df517d1759c21b2 /src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp | |
parent | a9645059ee07204335c6c28a394c33de562047d2 (diff) | |
download | qt-creator-de7bc1d9cfdfef41c8e8fbeef9edc84f94804d1b.tar.gz |
Maemo: Give more information to user about Qemu state.
Reviewed-by: kh1
Diffstat (limited to 'src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp')
-rw-r--r-- | src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp | 58 |
1 files changed, 47 insertions, 11 deletions
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp index 4c25e303d0..d5f36137c6 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp @@ -51,6 +51,7 @@ #include <QtCore/QTextStream> #include <QtGui/QAction> +#include <QtGui/QMessageBox> namespace Qt4ProjectManager { namespace Internal { @@ -187,20 +188,55 @@ MaemoManager::triggered() } void -MaemoManager::updateQemuSimulatorStarter(bool running) +MaemoManager::qemuStatusChanged(QemuStatus status, const QString &error) { - if (m_qemuAction) { - QIcon::State state = QIcon::Off; - QString toolTip(tr("Start Maemo Emulator")); - if (running) { - state = QIcon::On; - toolTip = tr("Stop Maemo Emulator"); - } + if (!m_qemuAction) + return; - m_qemuAction->setToolTip(toolTip); - m_qemuAction->setIcon(icon.pixmap(iconSize, QIcon::Normal, state)); + bool running; + QString message; + switch (status) { + case QemuStarting: + running = true; + break; + case QemuFailedToStart: + running = false; + message = tr("Qemu failed to start: %1").arg(error); + break; + case QemuCrashed: + running = false; + message = tr("Qemu crashed"); + break; + case QemuFinished: + running = false; + break; + default: + Q_ASSERT(!"Missing handling of Qemu status"); } + + if (!message.isEmpty()) + QMessageBox::warning(0, tr("Qemu error"), message); + updateQemuIcon(running); +} + +void MaemoManager::updateQemuIcon(bool running) +{ + if (!m_qemuAction) + return; + + QIcon::State state; + QString toolTip; + if (running) { + state = QIcon::On; + toolTip = tr("Stop Maemo Emulator"); + } else { + state = QIcon::Off; + toolTip = tr("Start Maemo Emulator"); + } + + m_qemuAction->setToolTip(toolTip); + m_qemuAction->setIcon(icon.pixmap(iconSize, QIcon::Normal, state)); } - } // namespace Internal +} // namespace Internal } // namespace Qt4ProjectManager |