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