Maemo: Start up Qemu if required.

We still fail in that case, because the connection can't succeed
due to Qemu's long start-up time.

Task-number: QTCREATORBUG-3607
This commit is contained in:
Christian Kandeler
2011-02-08 11:55:28 +01:00
parent 1c1ebe40a0
commit a57da84be8
5 changed files with 36 additions and 5 deletions

View File

@@ -38,6 +38,7 @@
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "maemopertargetdeviceconfigurationlistmodel.h"
#include "maemoqemumanager.h"
#include "maemoremotemounter.h"
#include "maemorunconfiguration.h"
#include "maemotoolchain.h"
@@ -354,6 +355,18 @@ void MaemoDeployStep::start()
}
if (m_needsInstall || !m_filesToCopy.isEmpty()) {
if (m_cachedDeviceConfig->type() == MaemoDeviceConfig::Simulator
&& !MaemoQemuManager::instance().qemuIsRunning()) {
MaemoQemuManager::instance().startRuntime();
raiseError(tr("Deployment failed: Qemu was not running. "
"It has now been started up for you, but it will take "
"a bit of time until it is ready."));
m_needsInstall = false;
m_filesToCopy.clear();
emit done();
return;
}
if (m_deployToSysroot)
installToSysroot();
else

View File

@@ -153,6 +153,11 @@ bool MaemoQemuManager::runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) c
return rt->isValid();
}
bool MaemoQemuManager::qemuIsRunning() const
{
return m_runningQtId != INT_MIN;
}
void MaemoQemuManager::qtVersionsChanged(const QList<int> &uniqueIds)
{
QtVersionManager *manager = QtVersionManager::instance();

View File

@@ -68,6 +68,8 @@ public:
static MaemoQemuManager& instance(QObject *parent = 0);
bool runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const;
bool qemuIsRunning() const;
Q_SLOT void startRuntime();
signals:
void qemuProcessStatus(QemuStatus, const QString &error = QString());
@@ -94,7 +96,6 @@ private slots:
void environmentChanged(); // needed to check for qt version
void deviceConfigurationChanged(ProjectExplorer::Target *target);
void startRuntime();
void terminateRuntime();
void qemuProcessFinished();

View File

@@ -36,6 +36,7 @@
#include "maemodeploystep.h"
#include "maemoglobal.h"
#include "maemoqemumanager.h"
#include "maemoremotemounter.h"
#include "maemoremotemountsmodel.h"
#include "maemorunconfiguration.h"
@@ -97,11 +98,20 @@ void MaemoSshRunner::start()
ASSERT_STATE(QList<State>() << Inactive << StopRequested);
if (m_remoteExecutable.isEmpty()) {
emitError(tr("Cannot run: No remote executable set."));
emitError(tr("Cannot run: No remote executable set."), true);
return;
}
if (!m_devConfig) {
emitError(tr("Cannot run: No device configuration set."));
emitError(tr("Cannot run: No device configuration set."), true);
return;
}
if (m_devConfig->type() == MaemoDeviceConfig::Simulator
&& !MaemoQemuManager::instance().qemuIsRunning()) {
MaemoQemuManager::instance().startRuntime();
emitError(tr("Cannot run: Qemu was not running. "
"It has now been started up for you, but it will take "
"a bit of time until it is ready."), true);
return;
}
@@ -317,11 +327,13 @@ void MaemoSshRunner::setState(State newState)
m_state = newState;
}
void MaemoSshRunner::emitError(const QString &errorMsg)
void MaemoSshRunner::emitError(const QString &errorMsg, bool force)
{
if (m_state != Inactive) {
setState(Inactive);
emit error(errorMsg);
} else if (force) {
emit error(errorMsg);
}
}

View File

@@ -105,7 +105,7 @@ private:
};
void setState(State newState);
void emitError(const QString &errorMsg);
void emitError(const QString &errorMsg, bool force = false);
void cleanup();
bool isConnectionUsable() const;