mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Fixed most Qt 5.14 deprecation warnings
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <QStringBuilder>
|
||||
#include <QtGlobal>
|
||||
#include <QSysInfo>
|
||||
#include <QOperatingSystemVersion>
|
||||
|
||||
namespace BlackConfig
|
||||
{
|
||||
@@ -50,13 +51,8 @@ namespace BlackConfig
|
||||
|
||||
bool CBuildConfig::isRunningOnWindows10()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// QSysInfo::WindowsVersion only available on Win platforms
|
||||
if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return false; }
|
||||
return (QSysInfo::WindowsVersion == QSysInfo::WV_10_0);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10);
|
||||
}
|
||||
|
||||
const QString &CBuildConfig::getPlatformString()
|
||||
@@ -186,7 +182,7 @@ namespace BlackConfig
|
||||
{
|
||||
// Mar 27 2017 20:17:06 (needs to be on english locale, otherwise fails - e.g.
|
||||
QDateTime dt = QLocale(QLocale::English).toDateTime(CBuildConfig::buildDateAndTime().simplified(), "MMM d yyyy hh:mm:ss");
|
||||
dt.setUtcOffset(0);
|
||||
dt.setOffsetFromUtc(0);
|
||||
return dt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ namespace BlackCore
|
||||
dto.sequenceCounter = args.sequenceCounter;
|
||||
dto.audio = std::vector<char>(args.audio.begin(), args.audio.end());
|
||||
dto.lastPacket = false;
|
||||
dto.transceivers = transmittingTransceivers.toStdVector();
|
||||
dto.transceivers = std::vector<TxTransceiverDto>(transmittingTransceivers.begin(), transmittingTransceivers.end());
|
||||
QMutexLocker lock(&m_mutexConnection);
|
||||
m_connection->sendToVoiceServer(dto);
|
||||
}
|
||||
@@ -758,7 +758,7 @@ namespace BlackCore
|
||||
dto.sequenceCounter = args.sequenceCounter;
|
||||
dto.audio = std::vector<char>(args.audio.begin(), args.audio.end());
|
||||
dto.lastPacket = true;
|
||||
dto.transceivers = transmittingTransceivers.toStdVector();
|
||||
dto.transceivers = std::vector<TxTransceiverDto>(transmittingTransceivers.begin(), transmittingTransceivers.end());
|
||||
QMutexLocker lock(&m_mutexConnection);
|
||||
m_connection->sendToVoiceServer(dto);
|
||||
}
|
||||
@@ -775,7 +775,7 @@ namespace BlackCore
|
||||
audioData.sequenceCounter = dto.sequenceCounter;
|
||||
|
||||
QMutexLocker lock(&m_mutex);
|
||||
m_soundcardSampleProvider->addOpusSamples(audioData, QVector<RxTransceiverDto>::fromStdVector(dto.transceivers));
|
||||
m_soundcardSampleProvider->addOpusSamples(audioData, QVector<RxTransceiverDto>(dto.transceivers.begin(), dto.transceivers.end()));
|
||||
}
|
||||
|
||||
void CAfvClient::inputVolumeStream(const InputVolumeStreamArgs &args)
|
||||
|
||||
@@ -1203,7 +1203,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
const QSet<QString> allIcaos = aircraft.allDesignators();
|
||||
const QString allIcaosStr = allIcaos.toList().join(", ");
|
||||
const QString allIcaosStr = allIcaos.values().join(", ");
|
||||
CLogUtilities::addLogDetailsToList(log, callsign, QStringLiteral("Aircraft '%1' known for airline '%2'").arg(allIcaosStr, airline.getDesignator()));
|
||||
|
||||
const CAircraftIcaoCode code = aircraft.findBestFuzzyMatchOrDefault(candidateString);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <QObject>
|
||||
#include <QStringBuilder>
|
||||
#include <QString>
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -82,7 +82,7 @@ namespace BlackCore
|
||||
if (m_initalized || m_shuttingDown) { return; }
|
||||
|
||||
QMap<QString, int> times;
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
CCoreFacade::registerMetadata();
|
||||
|
||||
// either use explicit setting or last value
|
||||
@@ -178,7 +178,7 @@ namespace BlackCore
|
||||
{
|
||||
bool c = false;
|
||||
Q_UNUSED(c) // for release version
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
|
||||
times.insert("Post setup, connects first", time.restart());
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include <QNetworkReply>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFileInfo>
|
||||
#include <QPointer>
|
||||
|
||||
@@ -106,7 +107,7 @@ namespace BlackCore
|
||||
{
|
||||
const CAirportList airports = CAirportList::fromMultipleJsonFormats(airportsJson);
|
||||
c = airports.size();
|
||||
msgs.push_back(m_airportCache.set(airports, fi.created().toUTC().toMSecsSinceEpoch()));
|
||||
msgs.push_back(m_airportCache.set(airports, fi.birthTime().toUTC().toMSecsSinceEpoch()));
|
||||
|
||||
emit dataRead(CEntityFlags::AirportEntity, CEntityFlags::ReadFinished, c);
|
||||
reallyRead |= CEntityFlags::AirportEntity;
|
||||
@@ -211,7 +212,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
airports = CAirportList::fromDatabaseJson(res, &inconsistent);
|
||||
this->logParseMessage("airports", airports.size(), time.elapsed(), res);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "blackmisc/threadutils.h"
|
||||
#include "blackmisc/eventloop.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -125,7 +125,7 @@ namespace BlackCore
|
||||
dbModelsConsidered;
|
||||
if (dbModels.isEmpty()) { return; }
|
||||
const QSet<CSimulatorInfo> simulatorsSet = simulators.asSingleSimulatorSet();
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
for (const CSimulatorInfo &singleSimulator : simulatorsSet)
|
||||
{
|
||||
if (!this->doWorkCheck()) { return; }
|
||||
|
||||
@@ -650,10 +650,10 @@ namespace BlackCore
|
||||
|
||||
bool CDatabaseReader::overrideCacheFromFile(bool overrideNewerOnly, const QFileInfo &fileInfo, CEntityFlags::Entity entity, CStatusMessageList &msgs) const
|
||||
{
|
||||
if (!fileInfo.created().isValid()) { return false; }
|
||||
if (!fileInfo.birthTime().isValid()) { return false; }
|
||||
if (!overrideNewerOnly) { return true; }
|
||||
|
||||
const qint64 fileTs = fileInfo.created().toUTC().toMSecsSinceEpoch();
|
||||
const qint64 fileTs = fileInfo.birthTime().toUTC().toMSecsSinceEpoch();
|
||||
const QDateTime cacheDateTime(this->getCacheTimestamp(entity));
|
||||
if (!cacheDateTime.isValid()) { return true; } // no cache
|
||||
const qint64 cacheTs = cacheDateTime.toUTC().toMSecsSinceEpoch();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/compressutils.h"
|
||||
#include <QElapsedTimer>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Json;
|
||||
@@ -162,7 +163,7 @@ namespace BlackCore
|
||||
{
|
||||
if (models.isEmpty() || simulatorModels.isEmpty()) { return models; }
|
||||
|
||||
QTime timer;
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
const QSet<QString> allOwnModelsModelStrings = simulatorModels.getModelStringSet();
|
||||
CAircraftModelList consolidatedModels;
|
||||
@@ -204,7 +205,7 @@ namespace BlackCore
|
||||
{
|
||||
if (models.isEmpty() || simulatorModels.isEmpty()) { return models; }
|
||||
|
||||
QTime timer;
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
const QSet<QString> allOwnModelsModelStrings = simulatorModels.getModelStringSet();
|
||||
CAircraftModelList consolidatedModels;
|
||||
@@ -252,7 +253,7 @@ namespace BlackCore
|
||||
|
||||
int CDatabaseUtils::consolidateModelsWithDbDataAllowsGuiRefresh(CAircraftModelList &models, bool force, bool processEvents)
|
||||
{
|
||||
QTime timer;
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
int c = 0;
|
||||
if (models.isEmpty()) { return c; }
|
||||
@@ -275,7 +276,7 @@ namespace BlackCore
|
||||
{
|
||||
if (dbModels.isEmpty() || simulatorModels.isEmpty()) { return 0; }
|
||||
|
||||
QTime timer;
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
const QSet<QString> dbModelsModelStrings = dbModels.getModelStringSet();
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "blackmisc/statusmessage.h"
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include <QElapsedTimer>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QFlags>
|
||||
@@ -316,7 +317,7 @@ namespace BlackCore
|
||||
else
|
||||
{
|
||||
// normally read from special DB view which already filters incomplete
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
codes = CAircraftIcaoCodeList::fromDatabaseJson(res, categories, true, &inconsistent);
|
||||
this->logParseMessage("aircraft ICAO", codes.size(), time.elapsed(), res);
|
||||
@@ -371,7 +372,7 @@ namespace BlackCore
|
||||
else
|
||||
{
|
||||
// normally read from special DB view which already filters incomplete
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
codes = CAirlineIcaoCodeList::fromDatabaseJson(res, true, &inconsistent);
|
||||
this->logParseMessage("airline ICAO", codes.size(), time.elapsed(), res);
|
||||
@@ -423,7 +424,7 @@ namespace BlackCore
|
||||
else
|
||||
{
|
||||
// normally read from special DB view which already filters incomplete
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
countries = CCountryList::fromDatabaseJson(res);
|
||||
this->logParseMessage("countries", countries.size(), time.elapsed(), res);
|
||||
@@ -468,7 +469,7 @@ namespace BlackCore
|
||||
else
|
||||
{
|
||||
// normally read from special DB view which already filters incomplete
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
categories = CAircraftCategoryList::fromDatabaseJson(res);
|
||||
this->logParseMessage("categories", categories.size(), time.elapsed(), res);
|
||||
@@ -526,7 +527,7 @@ namespace BlackCore
|
||||
{
|
||||
const CCountryList countries = CCountryList::fromMultipleJsonFormats(countriesJson);
|
||||
const int c = countries.size();
|
||||
msgs.push_back(m_countryCache.set(countries, fi.created().toUTC().toMSecsSinceEpoch()));
|
||||
msgs.push_back(m_countryCache.set(countries, fi.birthTime().toUTC().toMSecsSinceEpoch()));
|
||||
reallyRead |= CEntityFlags::CountryEntity;
|
||||
emit this->dataRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFinished, c);
|
||||
}
|
||||
@@ -564,7 +565,7 @@ namespace BlackCore
|
||||
{
|
||||
const CAircraftIcaoCodeList aircraftIcaos = CAircraftIcaoCodeList::fromMultipleJsonFormats(aircraftJson);
|
||||
const int c = aircraftIcaos.size();
|
||||
msgs.push_back(m_aircraftIcaoCache.set(aircraftIcaos, fi.created().toUTC().toMSecsSinceEpoch()));
|
||||
msgs.push_back(m_aircraftIcaoCache.set(aircraftIcaos, fi.birthTime().toUTC().toMSecsSinceEpoch()));
|
||||
reallyRead |= CEntityFlags::AircraftIcaoEntity;
|
||||
emit this->dataRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, c);
|
||||
}
|
||||
@@ -602,7 +603,7 @@ namespace BlackCore
|
||||
{
|
||||
const CAirlineIcaoCodeList airlineIcaos = CAirlineIcaoCodeList::fromMultipleJsonFormats(airlineJson);
|
||||
const int c = airlineIcaos.size();
|
||||
msgs.push_back(m_airlineIcaoCache.set(airlineIcaos, fi.created().toUTC().toMSecsSinceEpoch()));
|
||||
msgs.push_back(m_airlineIcaoCache.set(airlineIcaos, fi.birthTime().toUTC().toMSecsSinceEpoch()));
|
||||
reallyRead |= CEntityFlags::AirlineIcaoEntity;
|
||||
emit this->dataRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, c);
|
||||
}
|
||||
@@ -640,7 +641,7 @@ namespace BlackCore
|
||||
{
|
||||
const CAircraftCategoryList aircraftCategories = CAircraftCategoryList::fromMultipleJsonFormats(aircraftCategory);
|
||||
const int c = aircraftCategories.size();
|
||||
msgs.push_back(m_categoryCache.set(aircraftCategories, fi.created().toUTC().toMSecsSinceEpoch()));
|
||||
msgs.push_back(m_categoryCache.set(aircraftCategories, fi.birthTime().toUTC().toMSecsSinceEpoch()));
|
||||
reallyRead |= CEntityFlags::AircraftCategoryEntity;
|
||||
emit this->dataRead(CEntityFlags::AircraftCategoryEntity, CEntityFlags::ReadFinished, c);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <QScopedPointer>
|
||||
#include <QScopedPointerDeleteLater>
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QPointer>
|
||||
#include <QUrl>
|
||||
#include <QWriteLocker>
|
||||
@@ -318,7 +318,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
liveries = CLiveryList::fromDatabaseJson(res);
|
||||
this->logParseMessage("liveries", liveries.size(), time.elapsed(), res);
|
||||
@@ -366,7 +366,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
distributors = CDistributorList::fromDatabaseJson(res);
|
||||
this->logParseMessage("distributors", distributors.size(), time.elapsed(), res);
|
||||
@@ -424,7 +424,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
QTime time;
|
||||
QElapsedTimer time;
|
||||
time.start();
|
||||
models = CAircraftModelList::fromDatabaseJsonCaching(res, icaos, categories, liveries, distributors);
|
||||
this->logParseMessage("models", models.size(), time.elapsed(), res);
|
||||
@@ -483,7 +483,7 @@ namespace BlackCore
|
||||
{
|
||||
const CLiveryList liveries = CLiveryList::fromMultipleJsonFormats(liveriesJson);
|
||||
const int c = liveries.size();
|
||||
msgs.push_back(m_liveryCache.set(liveries, fi.created().toUTC().toMSecsSinceEpoch()));
|
||||
msgs.push_back(m_liveryCache.set(liveries, fi.birthTime().toUTC().toMSecsSinceEpoch()));
|
||||
emit this->dataRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, c);
|
||||
reallyRead |= CEntityFlags::LiveryEntity;
|
||||
}
|
||||
@@ -521,7 +521,7 @@ namespace BlackCore
|
||||
{
|
||||
const CAircraftModelList models = CAircraftModelList::fromMultipleJsonFormats(modelsJson);
|
||||
const int c = models.size();
|
||||
msgs.push_back(m_modelCache.set(models, fi.created().toUTC().toMSecsSinceEpoch()));
|
||||
msgs.push_back(m_modelCache.set(models, fi.birthTime().toUTC().toMSecsSinceEpoch()));
|
||||
emit this->dataRead(CEntityFlags::ModelEntity, CEntityFlags::ReadFinished, c);
|
||||
reallyRead |= CEntityFlags::ModelEntity;
|
||||
}
|
||||
@@ -559,7 +559,7 @@ namespace BlackCore
|
||||
{
|
||||
const CDistributorList distributors = CDistributorList::fromMultipleJsonFormats(distributorsJson);
|
||||
const int c = distributors.size();
|
||||
msgs.push_back(m_distributorCache.set(distributors, fi.created().toUTC().toMSecsSinceEpoch()));
|
||||
msgs.push_back(m_distributorCache.set(distributors, fi.birthTime().toUTC().toMSecsSinceEpoch()));
|
||||
emit this->dataRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, c);
|
||||
reallyRead |= CEntityFlags::DistributorEntity;
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ namespace BlackGui
|
||||
const QFileSystemModel *sourceModel = qobject_cast<QFileSystemModel *>(ui->tv_Source->model());
|
||||
if (!sourceModel) { return; }
|
||||
|
||||
QStringList select = comp.missingInTarget.toList();
|
||||
select.append(comp.newerInSource.toList());
|
||||
QStringList select = comp.missingInTarget.values();
|
||||
select.append(comp.newerInSource.values());
|
||||
for (const QString &file : as_const(comp.missingInTarget))
|
||||
{
|
||||
const QModelIndex index = sourceModel->index(file);
|
||||
|
||||
@@ -1068,7 +1068,7 @@ namespace BlackGui
|
||||
void CFlightPlanComponent::initCompleters()
|
||||
{
|
||||
if (!sGui || !sGui->hasWebDataServices()) { return; }
|
||||
const QStringList aircraft(sGui->getWebDataServices()->getAircraftIcaoCodes().allDesignators().toList());
|
||||
const QStringList aircraft(sGui->getWebDataServices()->getAircraftIcaoCodes().allDesignators().values());
|
||||
QCompleter *aircraftCompleter = new QCompleter(aircraft, this);
|
||||
aircraftCompleter->setMaxVisibleItems(10);
|
||||
aircraftCompleter->popup()->setMinimumWidth(75);
|
||||
|
||||
@@ -128,11 +128,11 @@ namespace BlackGui
|
||||
if (sGui->getWebDataServices()->getAircraftIcaoCodesCount() < 1) { return; }
|
||||
m_hasCompleters = true;
|
||||
const CAircraftIcaoCodeList codes = sGui->getWebDataServices()->getAircraftIcaoCodes();
|
||||
const QStringList designators = codes.allDesignators().toList();
|
||||
const QStringList designators = codes.allDesignators().values();
|
||||
ui->le_Designator->setCompleter(new QCompleter(designators, ui->le_Designator));
|
||||
const QStringList families = codes.allFamilies().toList();
|
||||
const QStringList families = codes.allFamilies().values();
|
||||
ui->le_Family->setCompleter(new QCompleter(families, ui->le_Family));
|
||||
const QStringList manufacturers = codes.allManufacturers().toList();
|
||||
const QStringList manufacturers = codes.allManufacturers().values();
|
||||
ui->le_Manufacturer->setCompleter(new QCompleter(manufacturers, ui->le_Manufacturer));
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -829,7 +829,7 @@ namespace BlackGui
|
||||
label->setToolTip(longText);
|
||||
const QFontMetrics metrics(label->font());
|
||||
const int width = qMax(label->width() - 2, 0);
|
||||
const int wl = metrics.width(longText);
|
||||
const int wl = metrics.horizontalAdvance(longText);
|
||||
if (wl >= width) { label->setText(longText); return; }
|
||||
if (qRound(wl * 0.85) > wl)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <QColor>
|
||||
#include <QObject>
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFrame>
|
||||
|
||||
class QPaintEvent;
|
||||
@@ -76,7 +76,7 @@ namespace BlackGui
|
||||
double m_peakLevel = 0.0;
|
||||
|
||||
//! Time at which m_peakLevel was last changed.
|
||||
QTime m_peakLevelChanged;
|
||||
QElapsedTimer m_peakLevelChanged;
|
||||
|
||||
static constexpr double High = 0.60;
|
||||
static constexpr double DecayValue = 0.10;
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BlackMisc
|
||||
{
|
||||
const QSet<QString> levels = this->getLevelStrings();
|
||||
if (levels.isEmpty()) {return {}; }
|
||||
return levels.toList().join(separator);
|
||||
return levels.values().join(separator);
|
||||
}
|
||||
|
||||
QList<int> CAircraftCategoryList::getFirstLevels() const
|
||||
@@ -72,7 +72,7 @@ namespace BlackMisc
|
||||
levels.insert(category.getFirstLevel());
|
||||
}
|
||||
levels.remove(0);
|
||||
QList<int> ll = levels.toList();
|
||||
QList<int> ll = levels.values();
|
||||
std::sort(ll.begin(), ll.end());
|
||||
return ll;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace BlackMisc
|
||||
levels.insert(category.getSecondLevel());
|
||||
}
|
||||
levels.remove(0);
|
||||
QList<int> ll = levels.toList();
|
||||
QList<int> ll = levels.values();
|
||||
std::sort(ll.begin(), ll.end());
|
||||
return ll;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace BlackMisc
|
||||
locations.insert(airport.getLocation());
|
||||
}
|
||||
|
||||
QStringList locs = locations.toList();
|
||||
QStringList locs = locations.values();
|
||||
if (sorted) { locs.sort(); }
|
||||
return locs;
|
||||
}
|
||||
|
||||
@@ -906,9 +906,9 @@ namespace BlackMisc
|
||||
{
|
||||
static const QStringList e = []
|
||||
{
|
||||
QSet<QString> el(CFlightPlan::faaEquipmentCodes().toSet());
|
||||
el.unite(CFlightPlan::squawkBoxEquipmentCodes().toSet());
|
||||
return el.toList();
|
||||
QSet<QString> el(CFlightPlan::faaEquipmentCodes().begin(), CFlightPlan::faaEquipmentCodes().end());
|
||||
el.unite(QSet<QString>(CFlightPlan::squawkBoxEquipmentCodes().begin(), CFlightPlan::squawkBoxEquipmentCodes().end()));
|
||||
return el.values();
|
||||
}();
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ namespace BlackMisc
|
||||
auto deferrals = fromJson(json.value("deferrals").toArray());
|
||||
m_admittedValues.unite(m_admittedQueue);
|
||||
if (updateUuid) { m_admittedQueue.clear(); }
|
||||
else if (! m_admittedQueue.isEmpty()) { m_admittedQueue.intersect(QSet<QString>::fromList(m_timestamps.keys())); }
|
||||
else if (! m_admittedQueue.isEmpty()) { m_admittedQueue.intersect(QSet<QString>(m_timestamps.keyBegin(), m_timestamps.keyEnd())); }
|
||||
|
||||
for (const auto &key : m_timestamps.keys()) // clazy:exclude=container-anti-pattern,range-loop
|
||||
{
|
||||
@@ -548,7 +548,7 @@ namespace BlackMisc
|
||||
QMutexLocker lock(&m_mutex);
|
||||
|
||||
Q_ASSERT(m_updateInProgress);
|
||||
return QSet<QString>::fromList(m_timestamps.keys());
|
||||
return QSet<QString>(m_timestamps.keyBegin(), m_timestamps.keyEnd());
|
||||
}
|
||||
|
||||
const QMap<QString, qint64> &CDataCacheRevision::newerTimestamps() const
|
||||
|
||||
@@ -407,7 +407,7 @@ namespace BlackMisc
|
||||
|
||||
auto it = std::max_element(files.cbegin(), files.cend(), [](const QFileInfo & a, const QFileInfo & b)
|
||||
{
|
||||
return a.created() < b.created();
|
||||
return a.birthTime() < b.birthTime();
|
||||
});
|
||||
return *it;
|
||||
}
|
||||
|
||||
@@ -101,14 +101,16 @@ namespace BlackMisc
|
||||
{
|
||||
if (categories.size() == 0) { return empty(); }
|
||||
if (categories.size() == 1) { return exactMatch(categories[0]); }
|
||||
return { AnyOf, QSet<QString>::fromList(categories.toQStringList()) };
|
||||
const QStringList strList = categories.toQStringList();
|
||||
return { AnyOf, QSet<QString>(strList.begin(), strList.end()) };
|
||||
}
|
||||
|
||||
CLogPattern CLogPattern::allOf(const CLogCategoryList &categories)
|
||||
{
|
||||
if (categories.size() == 0) { return {}; }
|
||||
if (categories.size() == 1) { return exactMatch(categories[0]); }
|
||||
return { AllOf, QSet<QString>::fromList(categories.toQStringList()) };
|
||||
const QStringList strList = categories.toQStringList();
|
||||
return { AnyOf, QSet<QString>(strList.begin(), strList.end()) };
|
||||
}
|
||||
|
||||
CLogPattern CLogPattern::startsWith(const QString &prefix)
|
||||
@@ -321,7 +323,7 @@ namespace BlackMisc
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QString strategy;
|
||||
QString categories = QStringList(m_strings.toList()).join("|"); // clazy:exclude=container-anti-pattern
|
||||
QString categories = m_strings.values().join("|"); // clazy:exclude=container-anti-pattern
|
||||
switch (m_strategy)
|
||||
{
|
||||
case Everything: strategy = "none"; break;
|
||||
@@ -343,7 +345,7 @@ namespace BlackMisc
|
||||
quint8 severities = 0;
|
||||
for (auto s : m_severities) { severities |= (1 << static_cast<int>(s)); }
|
||||
|
||||
argument << severities << m_strategy << m_strings.toList();
|
||||
argument << severities << m_strategy << m_strings.values();
|
||||
}
|
||||
|
||||
void CLogPattern::unmarshallFromDbus(const QDBusArgument &argument)
|
||||
@@ -351,7 +353,7 @@ namespace BlackMisc
|
||||
quint8 severities;
|
||||
QStringList strings;
|
||||
argument >> severities >> m_strategy >> strings;
|
||||
m_strings = strings.toSet();
|
||||
m_strings = QSet<QString>(strings.begin(), strings.end());
|
||||
|
||||
m_severities.clear();
|
||||
for (int s : { 0, 1, 2, 3 })
|
||||
@@ -365,7 +367,7 @@ namespace BlackMisc
|
||||
quint8 severities = 0;
|
||||
for (auto s : m_severities) { severities |= (1 << static_cast<int>(s)); }
|
||||
|
||||
stream << severities << m_strategy << m_strings.toList();
|
||||
stream << severities << m_strategy << m_strings.values();
|
||||
}
|
||||
|
||||
void CLogPattern::unmarshalFromDataStream(QDataStream &stream)
|
||||
@@ -373,7 +375,7 @@ namespace BlackMisc
|
||||
quint8 severities;
|
||||
QStringList strings;
|
||||
stream >> severities >> m_strategy >> strings;
|
||||
m_strings = strings.toSet();
|
||||
m_strings = QSet<QString>(strings.begin(), strings.end());
|
||||
|
||||
m_severities.clear();
|
||||
for (int s : { 0, 1, 2, 3 })
|
||||
|
||||
@@ -188,9 +188,9 @@ bool QJsonWebToken::setAlgorithmStr(const QString &strAlgorithm)
|
||||
// set algorithm
|
||||
m_strAlgorithm = strAlgorithm;
|
||||
// modify header
|
||||
m_jdocHeader = QJsonDocument::fromJson(QObject::trUtf8("{\"typ\": \"JWT\", \"alg\" : \"").toUtf8()
|
||||
m_jdocHeader = QJsonDocument::fromJson(QObject::tr("{\"typ\": \"JWT\", \"alg\" : \"").toUtf8()
|
||||
+ m_strAlgorithm.toUtf8()
|
||||
+ QObject::trUtf8("\"}").toUtf8());
|
||||
+ QObject::tr("\"}").toUtf8());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ namespace BlackMisc
|
||||
{
|
||||
s.insert(symbol.toLower());
|
||||
}
|
||||
return s.toList();
|
||||
return s.values();
|
||||
}();
|
||||
return symbols;
|
||||
}
|
||||
|
||||
@@ -1762,7 +1762,7 @@ namespace BlackMisc
|
||||
if (aircraftStats)
|
||||
{
|
||||
const CAircraftIcaoCodeList icaos = this->getAircraftIcaoCodesFromDb();
|
||||
QStringList designators(icaos.allDesignators().toList());
|
||||
QStringList designators(icaos.allDesignators().values());
|
||||
designators.sort();
|
||||
stats += sep % sep %
|
||||
u"Aircraft ICAOs from DB: " % sep %
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace BlackMisc
|
||||
|
||||
// to HTML
|
||||
QString html("<table>\n");
|
||||
QStringList airlineIcaos = models.getAirlineVDesignators().toList();
|
||||
QStringList airlineIcaos = models.getAirlineVDesignators().values();
|
||||
airlineIcaos.sort();
|
||||
airlineIcaos.push_front(colorLiveryDesignator);
|
||||
airlineIcaos.push_back(emptyDesignator);
|
||||
|
||||
@@ -209,8 +209,8 @@ namespace BlackMisc
|
||||
|
||||
QSet<QString> CAutoPublishData::allModelStrings() const
|
||||
{
|
||||
QSet<QString> allStrings(m_modelStringVsCG.keys().toSet());
|
||||
allStrings.unite(m_modelStringVsSimulatorInfo.keys().toSet());
|
||||
QSet<QString> allStrings(m_modelStringVsCG.keyBegin(), m_modelStringVsCG.keyEnd());
|
||||
allStrings.unite(QSet<QString>(m_modelStringVsSimulatorInfo.keyBegin(), m_modelStringVsSimulatorInfo.keyEnd()));
|
||||
return allStrings;
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace BlackMisc
|
||||
{
|
||||
const QFileInfo fi(fn.contains(dir.absolutePath()) ? fn : CFileUtils::appendFilePathsAndFixUnc(dir.absolutePath(), fn));
|
||||
if (!fi.exists()) { continue; }
|
||||
const QDateTime created = fi.created().toUTC();
|
||||
const QDateTime created = fi.birthTime().toUTC();
|
||||
if (deadline < created)
|
||||
{
|
||||
correctedList << fn;
|
||||
|
||||
@@ -371,9 +371,9 @@ namespace BlackMisc
|
||||
// store all entries
|
||||
const QFileInfo fileInfo(fnFixed);
|
||||
QDateTime fileTimestamp(fileInfo.lastModified());
|
||||
if (!fileTimestamp.isValid() || fileInfo.created() > fileTimestamp)
|
||||
if (!fileTimestamp.isValid() || fileInfo.birthTime() > fileTimestamp)
|
||||
{
|
||||
fileTimestamp = fileInfo.created();
|
||||
fileTimestamp = fileInfo.birthTime();
|
||||
}
|
||||
Q_ASSERT_X(fileTimestamp.isValid(), Q_FUNC_INFO, "Missing file timestamp");
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace BlackMisc
|
||||
QStringList CFsCommonUtil::fsxSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir)
|
||||
{
|
||||
// finding the user settings only works on P3D machine
|
||||
QStringList allPaths = CFsCommonUtil::allFsxSimObjectPaths().toList();
|
||||
QStringList allPaths = CFsCommonUtil::allFsxSimObjectPaths().values();
|
||||
const QString sod = CFileUtils::normalizeFilePathToQtStandard(simObjectsDir.isEmpty() ? CFsCommonUtil::fsxSimObjectsDir() : simObjectsDir);
|
||||
if (!sod.isEmpty() && !allPaths.contains(sod, Qt::CaseInsensitive))
|
||||
{
|
||||
@@ -242,7 +242,7 @@ namespace BlackMisc
|
||||
QStringList CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir, const QString &versionHint)
|
||||
{
|
||||
// finding the user settings only works on P3D machine
|
||||
QStringList allPaths = CFsCommonUtil::allP3dAddOnXmlSimObjectPaths(versionHint).toList();
|
||||
QStringList allPaths = CFsCommonUtil::allP3dAddOnXmlSimObjectPaths(versionHint).values();
|
||||
const QString sod = CFileUtils::normalizeFilePathToQtStandard(simObjectsDir.isEmpty() ? CFsCommonUtil::p3dSimObjectsDir() : simObjectsDir);
|
||||
if (!sod.isEmpty() && !allPaths.contains(sod, Qt::CaseInsensitive))
|
||||
{
|
||||
@@ -549,10 +549,10 @@ namespace BlackMisc
|
||||
QSet<QString> CFsCommonUtil::allP3dAddOnXmlSimObjectPaths(const QString &versionHint)
|
||||
{
|
||||
// all add-ons.cfg files
|
||||
const QStringList addOnConfigFiles = CFsCommonUtil::findP3dAddOnConfigFiles(versionHint).toList();
|
||||
const QStringList addOnConfigFiles = CFsCommonUtil::findP3dAddOnConfigFiles(versionHint).values();
|
||||
|
||||
// all PATH values in those files
|
||||
const QStringList addOnPaths = CFsCommonUtil::allConfigFilesPathValues(addOnConfigFiles, true, {}).toList();
|
||||
const QStringList addOnPaths = CFsCommonUtil::allConfigFilesPathValues(addOnConfigFiles, true, {}).values();
|
||||
|
||||
// based on all paths of all config files search the XML files
|
||||
const QSet<QString> all = CFsCommonUtil::allP3dAddOnXmlSimObjectPaths(addOnPaths, true);
|
||||
@@ -704,15 +704,15 @@ namespace BlackMisc
|
||||
CStatusMessageList CFsCommonUtil::validateP3DSimObjectsPath(const CAircraftModelList &models, CAircraftModelList &validModels, CAircraftModelList &invalidModels, bool ignoreEmptyFileNames, int stopAtFailedFiles, bool &stopped, const QString &simulatorDir)
|
||||
{
|
||||
const QString simObjectsDir = simulatorDir.isEmpty() ? CFsCommonUtil::p3dSimObjectsDir() : CFsCommonUtil::p3dSimObjectsDirFromSimDir(simulatorDir);
|
||||
const QSet<QString> simObjectPaths = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(simObjectsDir, "v4").toSet();
|
||||
return CFsCommonUtil::validateSimObjectsPath(simObjectPaths, models, validModels, invalidModels, ignoreEmptyFileNames, stopAtFailedFiles, stopped);
|
||||
const QStringList simObjectPaths = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(simObjectsDir, "v4");
|
||||
return CFsCommonUtil::validateSimObjectsPath(QSet<QString>(simObjectPaths.begin(), simObjectPaths.end()), models, validModels, invalidModels, ignoreEmptyFileNames, stopAtFailedFiles, stopped);
|
||||
}
|
||||
|
||||
CStatusMessageList CFsCommonUtil::validateFSXSimObjectsPath(const CAircraftModelList &models, CAircraftModelList &validModels, CAircraftModelList &invalidModels, bool ignoreEmptyFileNames, int stopAtFailedFiles, bool &stopped, const QString &simulatorDir)
|
||||
{
|
||||
Q_UNUSED(simulatorDir);
|
||||
const QSet<QString> simObjectPaths = CFsCommonUtil::fsxSimObjectsDirPlusAddOnXmlSimObjectsPaths().toSet();
|
||||
return CFsCommonUtil::validateSimObjectsPath(simObjectPaths, models, validModels, invalidModels, ignoreEmptyFileNames, stopAtFailedFiles, stopped);
|
||||
const QStringList simObjectPaths = CFsCommonUtil::fsxSimObjectsDirPlusAddOnXmlSimObjectsPaths();
|
||||
return CFsCommonUtil::validateSimObjectsPath(QSet<QString>(simObjectPaths.begin(), simObjectPaths.end()), models, validModels, invalidModels, ignoreEmptyFileNames, stopAtFailedFiles, stopped);
|
||||
}
|
||||
|
||||
const QString CFsCommonUtil::airFileFilter()
|
||||
|
||||
@@ -91,7 +91,8 @@ namespace BlackMisc
|
||||
QStringList remove(toUpper(modelsToBeRemoved));
|
||||
remove.sort();
|
||||
|
||||
QSet<QString> removeSet(knownModels.toSet() & remove.toSet());
|
||||
QSet<QString> removeSet(knownModels.begin(), knownModels.end());
|
||||
removeSet &= QSet<QString>(remove.begin(), remove.end());
|
||||
int c = 0;
|
||||
for (const QString &model : removeSet)
|
||||
{
|
||||
@@ -108,7 +109,8 @@ namespace BlackMisc
|
||||
QStringList keep(toUpper(modelsToBeKept));
|
||||
keep.sort();
|
||||
|
||||
QSet<QString> removeSet(knownModels.toSet().subtract(keep.toSet()));
|
||||
QSet<QString> removeSet(knownModels.begin(), knownModels.end());
|
||||
removeSet.subtract(QSet<QString>(keep.begin(), keep.end()));
|
||||
int c = 0;
|
||||
for (const QString &model : removeSet)
|
||||
{
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace BlackMisc
|
||||
if (min == SeverityDebug && max == SeverityError) { static const QString all("all severities"); return all; }
|
||||
if (min == SeverityDebug) { return u"at or below " % severityToString(max); }
|
||||
if (max == SeverityError) { return u"at or above " % severityToString(min); }
|
||||
auto list = severities.toList();
|
||||
auto list = severities.values();
|
||||
std::sort(list.begin(), list.end());
|
||||
QStringList ret;
|
||||
std::transform(list.cbegin(), list.cend(), std::back_inserter(ret), severityToString);
|
||||
|
||||
@@ -414,7 +414,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (set.isEmpty()) { return {}; }
|
||||
if (set.size() == 1) { return *set.begin(); }
|
||||
return set.toList().join(separator);
|
||||
return set.values().join(separator);
|
||||
}
|
||||
|
||||
QMap<QString, QString> parseIniValues(const QString &data)
|
||||
|
||||
@@ -527,7 +527,7 @@ namespace BlackMisc
|
||||
auto values = getAllValues();
|
||||
QSet<QString> files;
|
||||
for (auto it = values.begin(); it != values.end(); ++it) { files.insert(dir + "/" + filenameForKey(it.key())); }
|
||||
return files.toList();
|
||||
return files.values();
|
||||
}
|
||||
|
||||
void CValueCache::clearAllValues(const QString &keyPrefix)
|
||||
|
||||
Reference in New Issue
Block a user