mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 07:15:34 +08:00
Ref T292, Ref T285 function to set file timestamp
This commit is contained in:
@@ -449,12 +449,29 @@ namespace BlackMisc
|
||||
|
||||
void CAircraftModel::setFileTimestamp(const QDateTime ×tampUtc)
|
||||
{
|
||||
m_fileTimestamp = timestampUtc.toMSecsSinceEpoch();
|
||||
m_fileTimestamp = timestampUtc.isValid() ? timestampUtc.toMSecsSinceEpoch() : -1;
|
||||
}
|
||||
|
||||
void CAircraftModel::setFileTimestamp(qint64 timestamp)
|
||||
{
|
||||
m_fileTimestamp = timestamp;
|
||||
m_fileTimestamp = (timestamp < 0) ? -1 : timestamp;
|
||||
}
|
||||
|
||||
void CAircraftModel::setFileDetailsAndTimestamp(const QFileInfo &fileInfo)
|
||||
{
|
||||
this->setFileName(fileInfo.absoluteFilePath());
|
||||
const QDateTime modified = fileInfo.lastModified();
|
||||
if (modified.isValid())
|
||||
{
|
||||
this->setFileTimestamp(modified);
|
||||
this->setUtcTimestamp(modified);
|
||||
}
|
||||
else
|
||||
{
|
||||
const QDateTime created = fileInfo.lastModified();
|
||||
this->setFileTimestamp(created);
|
||||
this->setUtcTimestamp(created);
|
||||
}
|
||||
}
|
||||
|
||||
CPixmap CAircraftModel::loadIcon(CStatusMessage &success) const
|
||||
@@ -504,6 +521,7 @@ namespace BlackMisc
|
||||
this->setSimulator(otherModel.getSimulator());
|
||||
}
|
||||
|
||||
ITimestampBased::updateMissingParts(otherModel);
|
||||
m_livery.updateMissingParts(otherModel.getLivery());
|
||||
m_aircraftIcao.updateMissingParts(otherModel.getAircraftIcaoCode());
|
||||
m_distributor.updateMissingParts(otherModel.getDistributor());
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <Qt>
|
||||
#include <QFileInfo>
|
||||
#include <tuple>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -397,6 +398,9 @@ namespace BlackMisc
|
||||
//! Set file timestamp
|
||||
void setFileTimestamp(qint64 timestamp);
|
||||
|
||||
//! Set file timestamp, timestamp and file name
|
||||
void setFileDetailsAndTimestamp(const QFileInfo &fileInfo);
|
||||
|
||||
//! Load icon from disk
|
||||
CPixmap loadIcon(CStatusMessage &success) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user