mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 07:15:34 +08:00
Formatting, QStringBuilder
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a61abfcb8b
commit
ec23863d53
@@ -17,6 +17,7 @@
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/uppercasevalidator.h"
|
||||
#include <QCompleter>
|
||||
#include <QStringBuilder>
|
||||
#include <QStringListModel>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -106,7 +107,6 @@ namespace BlackGui
|
||||
{
|
||||
if (!this->hasContexts()) { return; }
|
||||
if (isBeingModified) { return; }
|
||||
static const CPropertyIndexList properties({ CStatusMessage::IndexUtcTimestampFormattedHms, CStatusMessage::IndexMessage });
|
||||
const CCallsign cs(ui->le_Callsign->text().trimmed().toUpper());
|
||||
if (cs.isEmpty()) { return; }
|
||||
const auto currentAircraftParts = sGui->getIContextNetwork()->getRemoteAircraftParts(cs, -1).frontOrDefault();
|
||||
@@ -115,37 +115,37 @@ namespace BlackGui
|
||||
QString html;
|
||||
if (currentAircraftParts == CAircraftParts() && aircraftPartsHistory.isEmpty())
|
||||
{
|
||||
html = cs.toQString() + QString(" does not support aircraft parts or nothing received yet.");
|
||||
html = cs.toQString() % QLatin1Literal(" does not support aircraft parts or nothing received yet.");
|
||||
}
|
||||
else
|
||||
{
|
||||
QString s;
|
||||
s += "lights on:";
|
||||
s += "<br>";
|
||||
s += " ";
|
||||
s += currentAircraftParts.getLights().toQString();
|
||||
s += "<br>";
|
||||
s += "gear down: ";
|
||||
s += BlackMisc::boolToYesNo(currentAircraftParts.isGearDown());
|
||||
s += "<br>";
|
||||
s += "flaps pct: ";
|
||||
s += QString::number(currentAircraftParts.getFlapsPercent());
|
||||
s += "<br>";
|
||||
s += "spoilers out: ";
|
||||
s += BlackMisc::boolToYesNo(currentAircraftParts.isSpoilersOut());
|
||||
s += "<br>";
|
||||
s += "engines on: ";
|
||||
s += "<br>";
|
||||
s += " ";
|
||||
s += currentAircraftParts.getEngines().toQString();
|
||||
s += "<br>";
|
||||
s += " on ground: ";
|
||||
s += BlackMisc::boolToYesNo(currentAircraftParts.isOnGround());
|
||||
const QString s =
|
||||
QLatin1Literal("lights on:") %
|
||||
QLatin1Literal("<br>") %
|
||||
QLatin1Literal(" ") %
|
||||
currentAircraftParts.getLights().toQString() %
|
||||
QLatin1Literal("<br>") %
|
||||
QLatin1Literal("gear down: ") %
|
||||
BlackMisc::boolToYesNo(currentAircraftParts.isGearDown()) %
|
||||
QLatin1Literal("<br>") %
|
||||
QLatin1Literal("flaps pct: ") %
|
||||
QString::number(currentAircraftParts.getFlapsPercent()) %
|
||||
QLatin1Literal("<br>") %
|
||||
QLatin1Literal("spoilers out: ") %
|
||||
BlackMisc::boolToYesNo(currentAircraftParts.isSpoilersOut()) %
|
||||
QLatin1Literal("<br>") %
|
||||
QLatin1Literal("engines on: ") %
|
||||
QLatin1Literal("<br>") %
|
||||
QLatin1Literal(" ") %
|
||||
currentAircraftParts.getEngines().toQString() %
|
||||
QLatin1Literal("<br>") %
|
||||
QLatin1Literal(" on ground: ") %
|
||||
BlackMisc::boolToYesNo(currentAircraftParts.isOnGround());
|
||||
html += s;
|
||||
if (ui->cb_PartsHistoryEnabled->isChecked())
|
||||
{
|
||||
html +="<hr>";
|
||||
html += aircraftPartsHistory.toHtml(properties);
|
||||
html += QLatin1Literal("<hr>") %
|
||||
aircraftPartsHistory.toHtml(CStatusMessageList::timestampHtmlOutput());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackGui
|
||||
explicit CAircraftPartsHistory(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CAircraftPartsHistory();
|
||||
virtual ~CAircraftPartsHistory();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftPartsHistory> ui;
|
||||
|
||||
@@ -105,7 +105,6 @@ namespace BlackGui
|
||||
void CModelMatcherLogComponent::ps_callsignEntered()
|
||||
{
|
||||
if (!this->hasContexts()) { return; }
|
||||
static const CPropertyIndexList properties({ CPropertyIndex::GlobalIndexLineNumber, CStatusMessage::IndexMessage });
|
||||
const CCallsign cs(ui->le_Callsign->text().trimmed().toUpper());
|
||||
const CStatusMessageList reverseLookupMessages = sGui->getIContextNetwork()->getReverseLookupMessages(cs);
|
||||
const CStatusMessageList matchingMessages = sGui->getIContextSimulator()->getMatchingMessages(cs);
|
||||
@@ -113,7 +112,7 @@ namespace BlackGui
|
||||
CStatusMessageList allMessages(reverseLookupMessages);
|
||||
allMessages.push_back(matchingMessages);
|
||||
|
||||
const QString html = allMessages.toHtml(properties);
|
||||
const QString html = allMessages.toHtml();
|
||||
this->m_text.setHtml(html);
|
||||
ui->te_Messages->setDocument(&this->m_text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user