From 2e25571edb1a306ce1874535a7222c2cba28df9b Mon Sep 17 00:00:00 2001 From: ck <qt-info@nokia.com> Date: Fri, 5 Mar 2010 16:06:47 +0100 Subject: [PATCH] Maemo: Make deployment timestamps per host. Reviewed-by: kh1 --- .../qt-maemo/maemorunconfiguration.cpp | 51 +++++++++++++------ .../qt-maemo/maemorunconfiguration.h | 19 ++++--- .../qt-maemo/maemoruncontrol.cpp | 7 +-- .../qt-maemo/maemoruncontrol.h | 2 +- 4 files changed, 54 insertions(+), 25 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index f4572b079bc..b9c9a67c75a 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -157,9 +157,9 @@ QVariantMap MaemoRunConfiguration::toMap() const map.insert(DeviceIdKey, m_devConfig.internalId); map.insert(ArgumentsKey, m_arguments); - map.insert(LastDeployedKey, m_lastDeployed); - map.insert(DebuggingHelpersLastDeployedKey, - m_debuggingHelpersLastDeployed); + addDeployTimesToMap(LastDeployedKey, m_lastDeployed, map); + addDeployTimesToMap(DebuggingHelpersLastDeployedKey, + m_debuggingHelpersLastDeployed, map); map.insert(SimulatorPathKey, m_simulatorPath); @@ -170,6 +170,16 @@ QVariantMap MaemoRunConfiguration::toMap() const return map; } +void MaemoRunConfiguration::addDeployTimesToMap(const QString &key, + const QMap<QString, QDateTime> &deployTimes, QVariantMap &map) const +{ + QMap<QString, QVariant> variantMap; + QMap<QString, QDateTime>::ConstIterator it = deployTimes.begin(); + for (; it != deployTimes.end(); ++it) + variantMap.insert(it.key(), it.value()); + map.insert(key, variantMap); +} + bool MaemoRunConfiguration::fromMap(const QVariantMap &map) { if (!RunConfiguration::fromMap(map)) @@ -179,9 +189,9 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map) find(map.value(DeviceIdKey, 0).toInt())); m_arguments = map.value(ArgumentsKey).toStringList(); - m_lastDeployed = map.value(LastDeployedKey).toDateTime(); - m_debuggingHelpersLastDeployed = - map.value(DebuggingHelpersLastDeployedKey).toDateTime(); + getDeployTimesFromMap(LastDeployedKey, m_lastDeployed, map); + getDeployTimesFromMap(DebuggingHelpersLastDeployedKey, + m_debuggingHelpersLastDeployed, map); m_simulatorPath = map.value(SimulatorPathKey).toString(); @@ -192,14 +202,23 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map) return true; } -bool MaemoRunConfiguration::currentlyNeedsDeployment() const +void MaemoRunConfiguration::getDeployTimesFromMap(const QString &key, + QMap<QString, QDateTime> &deployTimes, const QVariantMap &map) { - return fileNeedsDeployment(executable(), m_lastDeployed); + const QVariantMap &variantMap = map.value(key).toMap(); + for (QVariantMap::ConstIterator it = variantMap.begin(); + it != variantMap.end(); ++it) + deployTimes.insert(it.key(), it.value().toDateTime()); } -void MaemoRunConfiguration::wasDeployed() +bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host) const { - m_lastDeployed = QDateTime::currentDateTime(); + return fileNeedsDeployment(executable(), m_lastDeployed.value(host)); +} + +void MaemoRunConfiguration::wasDeployed(const QString &host) +{ + m_lastDeployed.insert(host, QDateTime::currentDateTime()); } bool MaemoRunConfiguration::hasDebuggingHelpers() const @@ -208,16 +227,18 @@ bool MaemoRunConfiguration::hasDebuggingHelpers() const return qt4bc->qtVersion()->hasDebuggingHelper(); } -bool MaemoRunConfiguration::debuggingHelpersNeedDeployment() const +bool MaemoRunConfiguration::debuggingHelpersNeedDeployment(const QString &host) const { - if (hasDebuggingHelpers()) - return fileNeedsDeployment(dumperLib(), m_debuggingHelpersLastDeployed); + if (hasDebuggingHelpers()) { + return fileNeedsDeployment(dumperLib(), + m_debuggingHelpersLastDeployed.value(host)); + } return false; } -void MaemoRunConfiguration::debuggingHelpersDeployed() +void MaemoRunConfiguration::debuggingHelpersDeployed(const QString &host) { - m_debuggingHelpersLastDeployed = QDateTime::currentDateTime(); + m_debuggingHelpersLastDeployed.insert(host, QDateTime::currentDateTime()); } bool MaemoRunConfiguration::fileNeedsDeployment(const QString &path, diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h index fd621aab647..0e50c834721 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h @@ -68,12 +68,12 @@ public: Qt4Target *qt4Target() const; Qt4BuildConfiguration *activeQt4BuildConfiguration() const; - bool currentlyNeedsDeployment() const; - void wasDeployed(); + bool currentlyNeedsDeployment(const QString &host) const; + void wasDeployed(const QString &host); bool hasDebuggingHelpers() const; - bool debuggingHelpersNeedDeployment() const; - void debuggingHelpersDeployed(); + bool debuggingHelpersNeedDeployment(const QString &host) const; + void debuggingHelpersDeployed(const QString &host); QString maddeRoot() const; QString executable() const; @@ -125,6 +125,12 @@ private: const QString cmd(const QString &cmdName) const; const MaemoToolChain *toolchain() const; bool fileNeedsDeployment(const QString &path, const QDateTime &lastDeployed) const; + void addDeployTimesToMap(const QString &key, + const QMap<QString, QDateTime> &deployTimes, + QVariantMap &map) const; + void getDeployTimesFromMap(const QString &key, + QMap<QString, QDateTime> &deployTimes, + const QVariantMap &map); mutable QString m_executable; QString m_proFilePath; @@ -144,8 +150,9 @@ private: MaemoDeviceConfig m_devConfig; QStringList m_arguments; - QDateTime m_lastDeployed; - QDateTime m_debuggingHelpersLastDeployed; + // These map host names to deploy times. + QMap<QString, QDateTime> m_lastDeployed; + QMap<QString, QDateTime> m_debuggingHelpersLastDeployed; QProcess *qemu; }; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp index b21b020be75..531d413f0ba 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp @@ -67,12 +67,13 @@ void AbstractMaemoRunControl::startDeployment(bool forDebugging) if (devConfig.isValid()) { deployables.clear(); - if (runConfig->currentlyNeedsDeployment()) { + if (runConfig->currentlyNeedsDeployment(devConfig.host)) { deployables.append(Deployable(executableFileName(), QFileInfo(executableOnHost()).canonicalPath(), &MaemoRunConfiguration::wasDeployed)); } - if (forDebugging && runConfig->debuggingHelpersNeedDeployment()) { + if (forDebugging + && runConfig->debuggingHelpersNeedDeployment(devConfig.host)) { const QFileInfo &info(runConfig->dumperLib()); deployables.append(Deployable(info.fileName(), info.canonicalPath(), &MaemoRunConfiguration::debuggingHelpersDeployed)); @@ -119,7 +120,7 @@ void AbstractMaemoRunControl::deploy() void AbstractMaemoRunControl::handleFileCopied() { Deployable deployable = deployables.takeFirst(); - (runConfig->*deployable.updateTimestamp)(); + (runConfig->*deployable.updateTimestamp)(devConfig.host); m_progress.setProgressValue(m_progress.progressValue() + 1); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h index 5a17c3d36e8..8557c00be54 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h @@ -90,7 +90,7 @@ private: struct Deployable { - typedef void (MaemoRunConfiguration::*updateFunc)(); + typedef void (MaemoRunConfiguration::*updateFunc)(const QString&); Deployable(const QString &f, const QString &d, updateFunc u) : fileName(f), dir(d), updateTimestamp(u) {} QString fileName; -- GitLab