Commit 7311e425 authored by Alessandro Portale's avatar Alessandro Portale
Browse files

Replaced enum updateFiles with more logical bool getters.

parent aaae1420
......@@ -99,10 +99,24 @@ GeneratedFileInfo::GeneratedFileInfo()
, version(-1)
, dataChecksum(0)
, statedChecksum(0)
, updateReason(Undefined)
{
}
bool GeneratedFileInfo::isUpToDate() const
{
return !isOutdated() && !wasModified();
}
bool GeneratedFileInfo::isOutdated() const
{
return version < QmlStandaloneApp::stubVersion();
}
bool GeneratedFileInfo::wasModified() const
{
return dataChecksum != statedChecksum;
}
QmlStandaloneApp::QmlStandaloneApp()
: m_loadDummyData(false)
, m_orientation(Auto)
......@@ -635,15 +649,8 @@ QList<GeneratedFileInfo> QmlStandaloneApp::fileUpdates(const QString &mainProFil
data.replace('\x0D', "");
data.replace('\x0A', "");
newFile.dataChecksum = qChecksum(data.constData(), data.length());
if (newFile.version < stubVersion())
newFile.updateReason = GeneratedFileInfo::HasOutdatedVersion;
else if (newFile.version > stubVersion())
newFile.updateReason = GeneratedFileInfo::HasFutureVersion;
else if (newFile.dataChecksum != newFile.statedChecksum)
newFile.updateReason = GeneratedFileInfo::ContentChanged;
else
newFile.updateReason = GeneratedFileInfo::IsUpToDate;
result.append(newFile);
if (!newFile.isUpToDate())
result.append(newFile);
}
return result;
}
......
......@@ -88,22 +88,17 @@ struct GeneratedFileInfo
SymbianSvgIconFile
};
enum UpdateReason {
Undefined,
IsUpToDate,
HasOutdatedVersion,
HasFutureVersion,
ContentChanged
};
GeneratedFileInfo();
bool isUpToDate() const;
bool isOutdated() const;
bool wasModified() const;
File file;
QFileInfo fileInfo;
int version;
quint16 dataChecksum;
quint16 statedChecksum;
UpdateReason updateReason;
};
class QmlStandaloneApp: public QObject
......
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