Maemo: Fix deploy and run behavior when Qemu is missing.

Change-Id: I791494506777f718d39ccc4e5fe08ec0dde55cce
Reviewed-on: http://codereview.qt.nokia.com/820
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-06-28 10:00:20 +02:00
parent a42ad1db04
commit 3e02f2a4d9
3 changed files with 27 additions and 9 deletions

View File

@@ -249,10 +249,18 @@ void AbstractMaemoDeployStep::start()
if (isDeploymentNeeded(deviceConfiguration()->sshParameters().host)) { if (isDeploymentNeeded(deviceConfiguration()->sshParameters().host)) {
if (deviceConfiguration()->type() == LinuxDeviceConfiguration::Emulator if (deviceConfiguration()->type() == LinuxDeviceConfiguration::Emulator
&& !MaemoQemuManager::instance().qemuIsRunning()) { && !MaemoQemuManager::instance().qemuIsRunning()) {
MaemoQemuRuntime rt;
const int qtId = qt4BuildConfiguration() && qt4BuildConfiguration()->qtVersion()
? qt4BuildConfiguration()->qtVersion()->uniqueId() : -1;
if (MaemoQemuManager::instance().runtimeForQtVersion(qtId, &rt)) {
MaemoQemuManager::instance().startRuntime(); MaemoQemuManager::instance().startRuntime();
raiseError(tr("Cannot deploy: Qemu was not running. " raiseError(tr("Cannot deploy: Qemu was not running. "
"It has now been started up for you, but it will take " "It has now been started up for you, but it will take "
"a bit of time until it is ready.")); "a bit of time until it is ready. Please try again then."));
} else {
raiseError(tr("Cannot deploy: You want to deploy to Qemu, but it is not enabled "
"for this Qt version."));
}
emit done(); emit done();
return; return;
} }

View File

@@ -37,6 +37,9 @@
#include "maemoremotemountsmodel.h" #include "maemoremotemountsmodel.h"
#include "remotelinuxrunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(MountState, state, m_mountState) #define ASSERT_STATE(state) ASSERT_STATE_GENERIC(MountState, state, m_mountState)
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
@@ -51,7 +54,9 @@ MaemoSshRunner::MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig
m_mountSpecs(runConfig->remoteMounts()->mountSpecs()), m_mountSpecs(runConfig->remoteMounts()->mountSpecs()),
m_mountState(InactiveMountState) m_mountState(InactiveMountState)
{ {
m_mounter->setBuildConfiguration(runConfig->activeQt4BuildConfiguration()); const Qt4BuildConfiguration * const bc = runConfig->activeQt4BuildConfiguration();
m_qtId = bc && bc->qtVersion() ? bc->qtVersion()->uniqueId() : -1;
m_mounter->setBuildConfiguration(bc);
connect(m_mounter, SIGNAL(mounted()), this, SLOT(handleMounted())); connect(m_mounter, SIGNAL(mounted()), this, SLOT(handleMounted()));
connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted())); connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
connect(m_mounter, SIGNAL(error(QString)), this, connect(m_mounter, SIGNAL(error(QString)), this,
@@ -71,9 +76,14 @@ bool MaemoSshRunner::canRun(QString &whyNot) const
if (devConfig()->type() == LinuxDeviceConfiguration::Emulator if (devConfig()->type() == LinuxDeviceConfiguration::Emulator
&& !MaemoQemuManager::instance().qemuIsRunning()) { && !MaemoQemuManager::instance().qemuIsRunning()) {
MaemoQemuRuntime rt;
if (MaemoQemuManager::instance().runtimeForQtVersion(m_qtId, &rt)) {
MaemoQemuManager::instance().startRuntime(); MaemoQemuManager::instance().startRuntime();
whyNot = tr("Qemu was not running. It has now been started up for you, but it will take " whyNot = tr("Qemu was not running. It has now been started up for you, but it will "
"a bit of time until it is ready."); "take a bit of time until it is ready. Please try again then.");
} else {
whyNot = tr("You want to run on Qemu, but it is not enabled for this Qt version.");
}
return false; return false;
} }

View File

@@ -69,8 +69,8 @@ private:
MaemoRemoteMounter * const m_mounter; MaemoRemoteMounter * const m_mounter;
QList<MaemoMountSpecification> m_mountSpecs; QList<MaemoMountSpecification> m_mountSpecs;
MountState m_mountState; MountState m_mountState;
int m_qtId;
}; };
} // namespace Internal } // namespace Internal