From 9a26654878709d2e814b15bd6e61095e6dbc59b7 Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Tue, 30 Nov 2010 14:14:55 +0100 Subject: [PATCH] Maemo: Rename "Runtime" class to make the name more unique. --- .../qt-maemo/maemoqemumanager.cpp | 44 +++++++++---------- .../qt-maemo/maemoqemumanager.h | 23 +++++----- .../qt-maemo/maemorunconfiguration.cpp | 2 +- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp index dffe4bc06dc..acedb44bdb4 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp @@ -144,9 +144,9 @@ MaemoQemuManager &MaemoQemuManager::instance(QObject *parent) return *m_instance; } -bool MaemoQemuManager::runtimeForQtVersion(int uniqueId, Runtime *rt) const +bool MaemoQemuManager::runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const { - *rt = m_runtimes.value(uniqueId, Runtime()); + *rt = m_runtimes.value(uniqueId, MaemoQemuRuntime()); return rt->isValid(); } @@ -157,7 +157,7 @@ void MaemoQemuManager::qtVersionsChanged(const QList<int> &uniqueIds) if (manager->isValidId(uniqueId)) { QtVersion *version = manager->version(uniqueId); if (version->supportsTargetId(Constants::MAEMO_DEVICE_TARGET_ID)) { - Runtime runtime = createRuntime(version); + MaemoQemuRuntime runtime = createRuntime(version); if (runtime.isValid()) { runtime.m_watchPath = runtime.m_root.left(runtime.m_root.lastIndexOf(QLatin1Char('/'))); @@ -359,7 +359,7 @@ void MaemoQemuManager::startRuntime() const QString root = QDir::toNativeSeparators(maddeRoot(version->qmakeCommand()) + QLatin1Char('/')); - const Runtime rt = m_runtimes.value(version->uniqueId()); + const MaemoQemuRuntime rt = m_runtimes.value(version->uniqueId()); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); #ifdef Q_OS_WIN const QLatin1Char colon(';'); @@ -475,14 +475,14 @@ void MaemoQemuManager::qemuOutput() void MaemoQemuManager::runtimeRootChanged(const QString &directory) { QList<int> uniqueIds; - QMap<int, Runtime>::const_iterator it; + QMap<int, MaemoQemuRuntime>::const_iterator it; for (it = m_runtimes.constBegin(); it != m_runtimes.constEnd(); ++it) { if (QDir(it.value().m_watchPath) == QDir(directory)) uniqueIds.append(it.key()); } foreach (int uniqueId, uniqueIds) { - Runtime runtime = m_runtimes.value(uniqueId, Runtime()); + MaemoQemuRuntime runtime = m_runtimes.value(uniqueId, MaemoQemuRuntime()); if (runtime.isValid()) { if (QFile::exists(runtime.m_root)) { // nothing changed, so we can remove it @@ -505,7 +505,7 @@ void MaemoQemuManager::runtimeFolderChanged(const QString &directory) { if (QFile::exists(directory + QLatin1String("/information"))) { QList<int> uniqueIds; - QMap<int, Runtime>::const_iterator it; + QMap<int, MaemoQemuRuntime>::const_iterator it; for (it = m_runtimes.constBegin(); it != m_runtimes.constEnd(); ++it) { if (QDir(it.value().m_root) == QDir(directory)) uniqueIds.append(it.key()); @@ -553,7 +553,7 @@ void MaemoQemuManager::toggleStarterButton(Target *target) if (m_runningQtId == uniqueId) isRunning = false; - m_qemuAction->setEnabled(m_runtimes.value(uniqueId, Runtime()).isValid() + m_qemuAction->setEnabled(m_runtimes.value(uniqueId, MaemoQemuRuntime()).isValid() && targetUsesMatchingRuntimeConfig(target) && !isRunning); m_qemuAction->setVisible(!m_runtimes.isEmpty() && sessionHasMaemoTarget()); } @@ -583,7 +583,7 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target, if (!bc) return false; QtVersion *version = bc->qtVersion(); - if (!version || !m_runtimes.value(version->uniqueId(), Runtime()).isValid()) + if (!version || !m_runtimes.value(version->uniqueId(), MaemoQemuRuntime()).isValid()) return false; if (qtVersion) @@ -605,7 +605,7 @@ QString MaemoQemuManager::targetRoot(const QString &qmake) const return target.mid(target.lastIndexOf(QLatin1Char('/')) + 1); } -bool MaemoQemuManager::fillRuntimeInformationForOldMadInfo(Runtime *runtime) const +bool MaemoQemuManager::fillRuntimeInformationForOldMadInfo(MaemoQemuRuntime *runtime) const { const QStringList files = QDir(runtime->m_root).entryList(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot); @@ -643,7 +643,7 @@ bool MaemoQemuManager::fillRuntimeInformationForOldMadInfo(Runtime *runtime) con return false; } -void MaemoQemuManager::setEnvironment(Runtime *runTime, +void MaemoQemuManager::setEnvironment(MaemoQemuRuntime *runTime, const QString &envSpec) const { QString remainingEnvSpec = envSpec; @@ -672,9 +672,9 @@ void MaemoQemuManager::setEnvironment(Runtime *runTime, } } -Runtime MaemoQemuManager::createRuntime(const QtVersion *qtVersion) const +MaemoQemuRuntime MaemoQemuManager::createRuntime(const QtVersion *qtVersion) const { - Runtime runtime; + MaemoQemuRuntime runtime; const QString maddeRootPath = maddeRoot(qtVersion->qmakeCommand()); const QString madCommand = maddeRootPath + QLatin1String("/bin/mad"); if (!QFileInfo(madCommand).exists()) @@ -700,12 +700,12 @@ Runtime MaemoQemuManager::createRuntime(const QtVersion *qtVersion) const } } -Runtime MaemoQemuManager::parseRuntimeFromMadInfo(const QByteArray &output, +MaemoQemuRuntime MaemoQemuManager::parseRuntimeFromMadInfo(const QByteArray &output, const QString &targetName) const { QXmlStreamReader infoReader(output); QString runtimeName; - QList<Runtime> runtimes; + QList<MaemoQemuRuntime> runtimes; while (infoReader.readNextStartElement()) { if (infoReader.name() == QLatin1String("madde")) { while (infoReader.readNextStartElement()) { @@ -714,7 +714,7 @@ Runtime MaemoQemuManager::parseRuntimeFromMadInfo(const QByteArray &output, handleMadInfoTargetTag(infoReader, runtimeName, targetName); } else if (infoReader.name() == QLatin1String("runtimes")) { while (infoReader.readNextStartElement()) { - const Runtime &rt = handleMadInfoRuntimeTag(infoReader); + const MaemoQemuRuntime &rt = handleMadInfoRuntimeTag(infoReader); if (!rt.m_name.isEmpty() && !rt.m_bin.isEmpty() && !rt.m_args.isEmpty()) { runtimes << rt; @@ -726,14 +726,14 @@ Runtime MaemoQemuManager::parseRuntimeFromMadInfo(const QByteArray &output, } } } - foreach (const Runtime &rt, runtimes) { + foreach (const MaemoQemuRuntime &rt, runtimes) { if (rt.m_name == runtimeName) return rt; } - return Runtime(); + return MaemoQemuRuntime(); } -Runtime MaemoQemuManager::parseRuntimeFromOldMadInfo(const QString &output, +MaemoQemuRuntime MaemoQemuManager::parseRuntimeFromOldMadInfo(const QString &output, const QString &maddeRootPath, const QString &targetName) const { QXmlStreamReader infoReader(output); @@ -770,7 +770,7 @@ Runtime MaemoQemuManager::parseRuntimeFromOldMadInfo(const QString &output, } } - Runtime runtime; + MaemoQemuRuntime runtime; if (installedRuntimes.contains(targetRuntime)) { runtime.m_name = targetRuntime; runtime.m_root = maddeRootPath + QLatin1String("/runtimes/") @@ -799,9 +799,9 @@ void MaemoQemuManager::handleMadInfoTargetTag(QXmlStreamReader &infoReader, } } -Runtime MaemoQemuManager::handleMadInfoRuntimeTag(QXmlStreamReader &infoReader) const +MaemoQemuRuntime MaemoQemuManager::handleMadInfoRuntimeTag(QXmlStreamReader &infoReader) const { - Runtime runtime; + MaemoQemuRuntime runtime; const QXmlStreamAttributes &attrs = infoReader.attributes(); if (infoReader.name() != QLatin1String("runtime") || attrs.value(QLatin1String("installed")) != QLatin1String("true")) { diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h index 605af072fe3..b83296bfe55 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.h @@ -57,11 +57,10 @@ namespace Qt4ProjectManager { namespace Internal { class MaemoRunConfiguration; -// TODO: Rename to something more unique -struct Runtime +struct MaemoQemuRuntime { - Runtime() {} - Runtime(const QString &root) + MaemoQemuRuntime() {} + MaemoQemuRuntime(const QString &root) : m_root(root) {} bool isValid() const { return !m_bin.isEmpty(); @@ -84,7 +83,7 @@ class MaemoQemuManager : public QObject public: static MaemoQemuManager& instance(QObject *parent = 0); - bool runtimeForQtVersion(int uniqueId, Runtime *rt) const; + bool runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const; signals: void qemuProcessStatus(QemuStatus, const QString &error = QString()); @@ -136,16 +135,16 @@ private: QString maddeRoot(const QString &qmake) const; QString targetRoot(const QString &qmake) const; - bool fillRuntimeInformationForOldMadInfo(Runtime *runtime) const; - void setEnvironment(Runtime *runTime, const QString &envSpec) const; - Runtime createRuntime(const QtVersion *qtVersion) const; - Runtime parseRuntimeFromMadInfo(const QByteArray &output, + bool fillRuntimeInformationForOldMadInfo(MaemoQemuRuntime *runtime) const; + void setEnvironment(MaemoQemuRuntime *runTime, const QString &envSpec) const; + MaemoQemuRuntime createRuntime(const QtVersion *qtVersion) const; + MaemoQemuRuntime parseRuntimeFromMadInfo(const QByteArray &output, const QString &targetName) const; - Runtime parseRuntimeFromOldMadInfo(const QString &output, + MaemoQemuRuntime parseRuntimeFromOldMadInfo(const QString &output, const QString &maddeRootPath, const QString &targetName) const; void handleMadInfoTargetTag(QXmlStreamReader &infoReader, QString &runtimeName, const QString &targetName) const; - Runtime handleMadInfoRuntimeTag(QXmlStreamReader &infoReader) const; + MaemoQemuRuntime handleMadInfoRuntimeTag(QXmlStreamReader &infoReader) const; QHash<QString, QString> handleMadInfoEnvironmentTag(QXmlStreamReader &infoReader) const; QPair<QString, QString> handleMadInfoVariableTag(QXmlStreamReader &infoReader) const; MaemoPortList handleMadInfoTcpPortListTag(QXmlStreamReader &infoReader) const; @@ -161,7 +160,7 @@ private: int m_runningQtId; bool m_userTerminated; QIcon m_qemuStarterIcon; - QMap<int, Runtime> m_runtimes; + QMap<int, MaemoQemuRuntime> m_runtimes; static MaemoQemuManager *m_instance; QFileSystemWatcher *m_runtimeRootWatcher; QFileSystemWatcher *m_runtimeFolderWatcher; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index fe118baee0f..7afbaca9daa 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -322,7 +322,7 @@ MaemoPortList MaemoRunConfiguration::freePorts() const const MaemoDeviceConfig &devConfig = deviceConfig(); const Qt4BuildConfiguration * const qt4bc = activeQt4BuildConfiguration(); if (devConfig.type == MaemoDeviceConfig::Simulator && qt4bc) { - Runtime rt; + MaemoQemuRuntime rt; const int id = qt4bc->qtVersion()->uniqueId(); if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt)) return rt.m_freePorts; -- GitLab