mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
refs #822, set file ts in parser/modelloader
This commit is contained in:
@@ -39,8 +39,9 @@ namespace BlackMisc
|
||||
QString CAircraftCfgEntries::convertToQString(bool) const
|
||||
{
|
||||
QString s = "{%1, %2, %3, %4, %5, %6}";
|
||||
s = s.arg(this->m_fileName).arg(this->m_index).arg(this->m_title)
|
||||
.arg(this->m_atcModel).arg(this->m_atcType).arg(this->m_atcParkingCode);
|
||||
s = s.
|
||||
arg(this->m_fileName).arg(this->m_index).
|
||||
arg(this->m_title, this->m_atcModel, this->m_atcType, this->m_atcParkingCode);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -51,8 +52,8 @@ namespace BlackMisc
|
||||
QString CAircraftCfgEntries::getFileDirectory() const
|
||||
{
|
||||
if (this->m_fileName.isEmpty()) { return ""; }
|
||||
QFileInfo fi(this->m_fileName);
|
||||
return fi.absolutePath();
|
||||
const QFileInfo fileInfo(this->m_fileName);
|
||||
return fileInfo.absolutePath();
|
||||
}
|
||||
|
||||
QString CAircraftCfgEntries::getUiCombinedDescription() const
|
||||
@@ -133,7 +134,9 @@ namespace BlackMisc
|
||||
model.setDescription(this->getUiCombinedDescription()); // Manufacturer, variation, type
|
||||
model.setFileName(this->getFileName());
|
||||
model.setName(this->getSimName());
|
||||
model.setUtcTimestamp(this->getUtcTimestamp()); // aircraft.cfg file last modified
|
||||
Q_ASSERT_X(this->m_timestampMSecsSinceEpoch >= 0, Q_FUNC_INFO, "Missing file timestamp");
|
||||
model.setMSecsSinceEpoch(this->m_timestampMSecsSinceEpoch); // aircraft.cfg file timestamp
|
||||
model.setFileTimestamp(this->m_timestampMSecsSinceEpoch);
|
||||
model.setIconPath(this->getThumbnailFileNameChecked());
|
||||
|
||||
const QString designator(CAircraftIcaoCode::normalizeDesignator(this->getAtcModel()));
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace BlackMisc
|
||||
CAircraftCfgEntriesList CAircraftCfgParser::performParsing(const QString &directory, const QStringList &excludeDirectories, CStatusMessageList &messages, bool *ok)
|
||||
{
|
||||
//
|
||||
// function has to be thread safe
|
||||
// function has to be threadsafe
|
||||
//
|
||||
|
||||
*ok = false;
|
||||
@@ -323,7 +323,13 @@ namespace BlackMisc
|
||||
file.close();
|
||||
|
||||
// store all entries
|
||||
for (const CAircraftCfgEntries &e : tempEntries)
|
||||
QDateTime fileTimestamp(fileInfo.lastModified());
|
||||
if (!fileTimestamp.isValid() || fileInfo.created() > fileTimestamp)
|
||||
{
|
||||
fileTimestamp = fileInfo.created();
|
||||
}
|
||||
Q_ASSERT_X(fileTimestamp.isValid(), Q_FUNC_INFO, "Missing file timestamp");
|
||||
for (const CAircraftCfgEntries &e : as_const(tempEntries))
|
||||
{
|
||||
if (e.getTitle().isEmpty())
|
||||
{
|
||||
@@ -333,7 +339,7 @@ namespace BlackMisc
|
||||
CAircraftCfgEntries newEntries(e);
|
||||
newEntries.setAtcModel(atcModel);
|
||||
newEntries.setAtcType(atcType);
|
||||
newEntries.setUtcTimestamp(fileInfo.lastModified());
|
||||
newEntries.setUtcTimestamp(fileTimestamp);
|
||||
result.push_back(newEntries);
|
||||
}
|
||||
*ok = true;
|
||||
|
||||
@@ -91,8 +91,8 @@ namespace BlackMisc
|
||||
//! Files to be used
|
||||
static const QString &fileFilter();
|
||||
|
||||
CAircraftCfgEntriesList m_parsedCfgEntriesList; //!< parsed entries
|
||||
QPointer<BlackMisc::CWorker> m_parserWorker; //!< worker will destroy itself, so weak pointer
|
||||
CAircraftCfgEntriesList m_parsedCfgEntriesList; //!< parsed entries
|
||||
QPointer<BlackMisc::CWorker> m_parserWorker; //!< worker will destroy itself, so weak pointer
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user