mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Use QStringBuilder in livery
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
/* Copyright (C) 2017
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_SETTINGS_VIEWDIRECTORYSETTINGS_H
|
||||
#define BLACKGUI_SETTINGS_VIEWDIRECTORYSETTINGS_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include <QString>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
//! Trait for directory settings
|
||||
struct TViewDirectorySettings : public BlackMisc::TSettingTrait<QString>
|
||||
{
|
||||
//! \copydoc BlackCore::TSettingTrait::key
|
||||
static const char *key() { return "guiviewdirectory/%Application%"; }
|
||||
|
||||
//! \copydoc BlackCore::TSettingTrait::humanReadable
|
||||
static const QString &humanReadable() { static const QString name("View directory"); return name; }
|
||||
|
||||
//! \copydoc BlackCore::TSettingTrait::isValid
|
||||
static bool isValid(const QString &directory) { Q_UNUSED(directory); return true; }
|
||||
|
||||
//! \copydoc BlackCore::TSettingTrait::defaultValue
|
||||
static const QString &defaultValue() { return BlackMisc::CDirectoryUtils::documentationDirectory(); }
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -239,7 +239,7 @@ namespace BlackMisc
|
||||
return CLivery();
|
||||
}
|
||||
|
||||
const QString combinedCode(json.value(prefix + "combinedcode").toString());
|
||||
const QString combinedCode(json.value(prefix % QStringLiteral("combinedcode")).toString());
|
||||
if (combinedCode.isEmpty())
|
||||
{
|
||||
CLivery liveryStub; // only consists of id, maybe key and timestamp
|
||||
@@ -248,10 +248,10 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
const bool isColorLivery = combinedCode.startsWith(colorLiveryMarker());
|
||||
const QString description(json.value(prefix + "description").toString());
|
||||
const CRgbColor colorFuselage(json.value(prefix + "colorfuselage").toString());
|
||||
const CRgbColor colorTail(json.value(prefix + "colortail").toString());
|
||||
const bool military = CDatastoreUtility::dbBoolStringToBool(json.value(prefix + "military").toString());
|
||||
const QString description(json.value(prefix % QStringLiteral("description")).toString());
|
||||
const CRgbColor colorFuselage(json.value(prefix % QStringLiteral("colorfuselage")).toString());
|
||||
const CRgbColor colorTail(json.value(prefix % QStringLiteral("colortail")).toString());
|
||||
const bool military = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % QStringLiteral("military")).toString());
|
||||
CAirlineIcaoCode airline;
|
||||
if (!isColorLivery) { airline = CAirlineIcaoCode::fromDatabaseJson(json, "al_"); }
|
||||
CLivery livery(combinedCode, airline, description, colorFuselage, colorTail, military);
|
||||
@@ -367,9 +367,9 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
if (!m_colorFuselage.isValid()) { this->setColorFuselage(otherLivery.getColorFuselage()); }
|
||||
if (!m_colorTail.isValid()) { this->setColorTail(otherLivery.getColorTail()); }
|
||||
if (m_combinedCode.isEmpty()) { this->setCombinedCode(otherLivery.getCombinedCode());}
|
||||
if (m_description.isEmpty()) { this->setDescription(otherLivery.getDescription());}
|
||||
if (!m_colorTail.isValid()) { this->setColorTail(otherLivery.getColorTail()); }
|
||||
if (m_combinedCode.isEmpty()) { this->setCombinedCode(otherLivery.getCombinedCode());}
|
||||
if (m_description.isEmpty()) { this->setDescription(otherLivery.getDescription());}
|
||||
|
||||
m_airline.updateMissingParts(otherLivery.getAirlineIcaoCode());
|
||||
if (!this->hasValidDbKey())
|
||||
|
||||
Reference in New Issue
Block a user