Commit 2e25571e authored by ck's avatar ck
Browse files

Maemo: Make deployment timestamps per host.

Reviewed-by: kh1
parent e6ab80a9
......@@ -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,
......
......@@ -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;
};
......
......@@ -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);
}
......
......@@ -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;
......
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