Commit a57da84b authored by Christian Kandeler's avatar Christian Kandeler
Browse files

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
parent 1c1ebe40
......@@ -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
......
......@@ -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();
......
......@@ -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();
......
......@@ -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);
}
}
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment