mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
follow up of refs #643, allow to display icon in overlay window
* some optimization to check if icon is available * menus for context menu * allow to display icon/image in overlay window
This commit is contained in:
@@ -49,6 +49,10 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
BlackMisc::Simulation::CAircraftModelList getAircraftModels() const;
|
||||
|
||||
//! The loaded models for given simulator
|
||||
//! \threadsafe
|
||||
BlackMisc::Simulation::CAircraftModelList getAircraftModels(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Count of loaded models
|
||||
//! \threadsafe
|
||||
int getAircraftModelsCount() const { return getAircraftModels().size(); }
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "aircraftcfgentries.h"
|
||||
#include "blackmisc/variant.h"
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -120,7 +121,7 @@ namespace BlackMisc
|
||||
model.setFileName(this->getFileName());
|
||||
model.setName(this->getSimName());
|
||||
model.setUtcTimestamp(this->getUtcTimestamp()); // aircraft.cfg file last modified
|
||||
model.setIconPath(this->getThumbnailFileName());
|
||||
model.setIconPath(this->getThumbnailFileNameChecked());
|
||||
|
||||
const QString designator(CAircraftIcaoCode::normalizeDesignator(getAtcModel()));
|
||||
CAircraftIcaoCode aircraft(
|
||||
@@ -143,7 +144,7 @@ namespace BlackMisc
|
||||
return model;
|
||||
}
|
||||
|
||||
QString CAircraftCfgEntries::getThumbnailFileName() const
|
||||
QString CAircraftCfgEntries::getThumbnailFileNameGuess() const
|
||||
{
|
||||
if (this->m_texture.isEmpty()) { return ""; }
|
||||
if (this->m_fileName.isEmpty()) { return ""; }
|
||||
@@ -151,6 +152,14 @@ namespace BlackMisc
|
||||
return fn;
|
||||
}
|
||||
|
||||
QString CAircraftCfgEntries::getThumbnailFileNameChecked() const
|
||||
{
|
||||
const QString f(getThumbnailFileNameGuess());
|
||||
if (f.isEmpty()) { return ""; }
|
||||
if (QFile(f).exists()) { return f; }
|
||||
return "";
|
||||
}
|
||||
|
||||
CVariant CAircraftCfgEntries::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
|
||||
@@ -155,7 +155,11 @@ namespace BlackMisc
|
||||
BlackMisc::Simulation::CAircraftModel toAircraftModel() const;
|
||||
|
||||
//! Thumbnail.jpg path if possible
|
||||
QString getThumbnailFileName() const;
|
||||
QString getThumbnailFileNameGuess() const;
|
||||
|
||||
//! Thumbnail.jpg path if possible, and checked if file exists
|
||||
//! \remark checks file existence, consider I/O load
|
||||
QString getThumbnailFileNameChecked() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
Reference in New Issue
Block a user