diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h b/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h index ec5637dc27fb598d37e2b1ba5e7a28b1b0c900fa..0696d187a80905dbfc5109492ef11a7cc613c944 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h @@ -61,8 +61,9 @@ static const QLatin1String MAEMO_RC_ID_PREFIX(PREFIX "."); static const QLatin1String ArgumentsKey(PREFIX ".Arguments"); static const QLatin1String SimulatorPathKey(PREFIX ".Simulator"); static const QLatin1String DeviceIdKey(PREFIX ".DeviceId"); -static const QLatin1String LastDeployedKey(PREFIX ".LastDeployed"); -static const QLatin1String DebuggingHelpersLastDeployedKey(PREFIX ".DebuggingHelpersLastDeployed"); +static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts"); +static const QLatin1String LastDeployedFilesKey(PREFIX ".LastDeployedFiles"); +static const QLatin1String LastDeployedTimesKey(PREFIX ".LastDeployedTimes"); static const QLatin1String ProFileKey(".ProFile"); } // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index bf00f0334d3fc46b6919a46aea9f47e04cbf7a95..2fb1d87bfca16030437e9d2b66fc2a334e38cbf0 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -68,7 +68,6 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent, , m_devConfig(source->m_devConfig) , m_arguments(source->m_arguments) , m_lastDeployed(source->m_lastDeployed) - , m_debuggingHelpersLastDeployed(source->m_debuggingHelpersLastDeployed) { init(); } @@ -124,25 +123,27 @@ QVariantMap MaemoRunConfiguration::toMap() const QVariantMap map(RunConfiguration::toMap()); map.insert(DeviceIdKey, m_devConfig.internalId); map.insert(ArgumentsKey, m_arguments); - - addDeployTimesToMap(LastDeployedKey, m_lastDeployed, map); - addDeployTimesToMap(DebuggingHelpersLastDeployedKey, - m_debuggingHelpersLastDeployed, map); - + addDeployTimesToMap(map); const QDir dir = QDir(target()->project()->projectDirectory()); map.insert(ProFileKey, dir.relativeFilePath(m_proFilePath)); return map; } -void MaemoRunConfiguration::addDeployTimesToMap(const QString &key, - const QMap<QString, QDateTime> &deployTimes, QVariantMap &map) const +void MaemoRunConfiguration::addDeployTimesToMap(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); + QVariantList hostList; + QVariantList fileList; + QVariantList timeList; + typedef QMap<DeployablePerHost, QDateTime>::ConstIterator DepIt; + for (DepIt it = m_lastDeployed.begin(); it != m_lastDeployed.end(); ++it) { + hostList << it.key().first; + fileList << it.key().second; + timeList << it.value(); + } + map.insert(LastDeployedHostsKey, hostList); + map.insert(LastDeployedFilesKey, fileList); + map.insert(LastDeployedTimesKey, timeList); } bool MaemoRunConfiguration::fromMap(const QVariantMap &map) @@ -153,62 +154,40 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map) setDeviceConfig(MaemoDeviceConfigurations::instance(). find(map.value(DeviceIdKey, 0).toInt())); m_arguments = map.value(ArgumentsKey).toStringList(); - - getDeployTimesFromMap(LastDeployedKey, m_lastDeployed, map); - getDeployTimesFromMap(DebuggingHelpersLastDeployedKey, - m_debuggingHelpersLastDeployed, map); - + getDeployTimesFromMap(map); const QDir dir = QDir(target()->project()->projectDirectory()); m_proFilePath = dir.filePath(map.value(ProFileKey).toString()); return true; } -void MaemoRunConfiguration::getDeployTimesFromMap(const QString &key, - QMap<QString, QDateTime> &deployTimes, const QVariantMap &map) +void MaemoRunConfiguration::getDeployTimesFromMap(const QVariantMap &map) { - const QVariantMap &variantMap = map.value(key).toMap(); - for (QVariantMap::ConstIterator it = variantMap.begin(); - it != variantMap.end(); ++it) - deployTimes.insert(it.key(), it.value().toDateTime()); -} - -bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host) const -{ - return fileNeedsDeployment(packageStep()->packageFilePath(), - m_lastDeployed.value(host)); -} - -void MaemoRunConfiguration::wasDeployed(const QString &host) -{ - m_lastDeployed.insert(host, QDateTime::currentDateTime()); -} - -bool MaemoRunConfiguration::hasDebuggingHelpers() const -{ - Qt4BuildConfiguration *qt4bc = activeQt4BuildConfiguration(); - return qt4bc->qtVersion()->hasDebuggingHelper(); -} - -bool MaemoRunConfiguration::debuggingHelpersNeedDeployment(const QString &host) const -{ - if (hasDebuggingHelpers()) { - return fileNeedsDeployment(dumperLib(), - m_debuggingHelpersLastDeployed.value(host)); + const QVariantList &hostList = map.value(LastDeployedHostsKey).toList(); + const QVariantList &fileList = map.value(LastDeployedFilesKey).toList(); + const QVariantList &timeList = map.value(LastDeployedTimesKey).toList(); + const int elemCount + = qMin(qMin(hostList.size(), fileList.size()), timeList.size()); + for (int i = 0; i < elemCount; ++i) { + m_lastDeployed.insert(DeployablePerHost(hostList.at(i).toString(), + fileList.at(i).toString()), timeList.at(i).toDateTime()); } - return false; } -void MaemoRunConfiguration::debuggingHelpersDeployed(const QString &host) +bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host, + const QString &file) const { - m_debuggingHelpersLastDeployed.insert(host, QDateTime::currentDateTime()); + const QDateTime &lastDeployed + = m_lastDeployed.value(DeployablePerHost(host, file)); + return !lastDeployed.isValid() + || QFileInfo(file).lastModified() > lastDeployed; } -bool MaemoRunConfiguration::fileNeedsDeployment(const QString &path, - const QDateTime &lastDeployed) const +void MaemoRunConfiguration::setDeployed(const QString &host, + const QString &file) { - return !lastDeployed.isValid() - || QFileInfo(path).lastModified() > lastDeployed; + m_lastDeployed.insert(DeployablePerHost(host, file), + QDateTime::currentDateTime()); } void MaemoRunConfiguration::setDeviceConfig(const MaemoDeviceConfig &devConf) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h index 2b7c9e45b76a3160bb13ecd7404a7726efe336ac..e76a8593382b613644bea190583ab4c9af370469 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h @@ -69,12 +69,9 @@ public: Qt4Target *qt4Target() const; Qt4BuildConfiguration *activeQt4BuildConfiguration() const; - bool currentlyNeedsDeployment(const QString &host) const; - void wasDeployed(const QString &host); - - bool hasDebuggingHelpers() const; - bool debuggingHelpersNeedDeployment(const QString &host) const; - void debuggingHelpersDeployed(const QString &host); + bool currentlyNeedsDeployment(const QString &host, + const QString &file) const; + void setDeployed(const QString &host, const QString &file); const MaemoPackageCreationStep *packageStep() const; @@ -112,13 +109,8 @@ private: void init(); 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); + void addDeployTimesToMap(QVariantMap &map) const; + void getDeployTimesFromMap(const QVariantMap &map); QString m_proFilePath; mutable QString m_gdbPath; @@ -126,9 +118,8 @@ private: MaemoDeviceConfig m_devConfig; QStringList m_arguments; - // These map host names to deploy times. - QMap<QString, QDateTime> m_lastDeployed; - QMap<QString, QDateTime> m_debuggingHelpersLastDeployed; + typedef QPair<QString, QString> DeployablePerHost; + QMap<DeployablePerHost, QDateTime> m_lastDeployed; }; } // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp index ee08c98e6653addfc8cbe4c2f1e8d40e82be48b9..37635de223f3c7c853a64a4e9a0c13811cbd42ee 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp @@ -124,21 +124,22 @@ void AbstractMaemoRunControl::startDeployment(bool forDebugging) emit finished(); } else { m_deployables.clear(); - if (m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host)) { + if (m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host, + packageFilePath())) { m_deployables.append(Deployable(packageFileName(), - QFileInfo(executableOnHost()).canonicalPath(), - &MaemoRunConfiguration::wasDeployed)); + QFileInfo(executableOnHost()).canonicalPath())); m_needsInstall = true; } else { m_needsInstall = false; } - if (forDebugging - && m_runConfig->debuggingHelpersNeedDeployment(m_devConfig.server.host)) { - const QFileInfo &info(m_runConfig->dumperLib()); - m_deployables.append(Deployable(info.fileName(), info.canonicalPath(), - &MaemoRunConfiguration::debuggingHelpersDeployed)); + if (forDebugging) { + const QFileInfo info(m_runConfig->dumperLib()); + if (info.exists() + && m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host, + info.filePath())) { + m_deployables.append(Deployable(info.fileName(), info.canonicalPath())); + } } - deploy(); } } @@ -179,7 +180,8 @@ void AbstractMaemoRunControl::deploy() void AbstractMaemoRunControl::handleFileCopied() { Deployable deployable = m_deployables.takeFirst(); - (m_runConfig->*deployable.updateTimestamp)(m_devConfig.server.host); + m_runConfig->setDeployed(m_devConfig.server.host, + deployable.dir + QLatin1Char('/') + deployable.fileName); 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 4fe9744afaddc21cc3a09961adc387b726bda506..e53a8b456ea2846f6a39761c20e6c1865262e82b 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h @@ -117,12 +117,10 @@ private: struct Deployable { - typedef void (MaemoRunConfiguration::*updateFunc)(const QString&); - Deployable(const QString &f, const QString &d, updateFunc u) - : fileName(f), dir(d), updateTimestamp(u) {} + Deployable(const QString &f, const QString &d) + : fileName(f), dir(d) {} QString fileName; QString dir; - updateFunc updateTimestamp; }; QList<Deployable> m_deployables; bool m_needsInstall;