mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
refs #707, added line number to HTML output
This commit is contained in:
@@ -84,7 +84,7 @@ namespace BlackGui
|
|||||||
void CModelMatcherLogComponent::ps_callsignEntered()
|
void CModelMatcherLogComponent::ps_callsignEntered()
|
||||||
{
|
{
|
||||||
if (!sGui || !ui->cb_LogReverseLookup->isChecked()) { return; }
|
if (!sGui || !ui->cb_LogReverseLookup->isChecked()) { return; }
|
||||||
static const CPropertyIndexList properties({ CStatusMessage::IndexMessage });
|
static const CPropertyIndexList properties({ CPropertyIndex::GlobalIndexLineNumber, CStatusMessage::IndexMessage });
|
||||||
const CCallsign cs(ui->le_Callsign->text().trimmed().toUpper());
|
const CCallsign cs(ui->le_Callsign->text().trimmed().toUpper());
|
||||||
const CStatusMessageList msgs = sGui->getIContextNetwork()->getReverseLookupMessages(cs);
|
const CStatusMessageList msgs = sGui->getIContextNetwork()->getReverseLookupMessages(cs);
|
||||||
const QString html = msgs.toHtml(properties);
|
const QString html = msgs.toHtml(properties);
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ namespace BlackMisc
|
|||||||
GlobalIndexCSettingsDockWidget = 14200,
|
GlobalIndexCSettingsDockWidget = 14200,
|
||||||
GlobalIndexCSettingsNavigator = 14300,
|
GlobalIndexCSettingsNavigator = 14300,
|
||||||
GlobalIndexCSettingsReaders = 14400,
|
GlobalIndexCSettingsReaders = 14400,
|
||||||
GlobalIndexAbuseMode = 20000 // property index abused as map key or otherwise, to be removed if no longer needed
|
GlobalIndexLineNumber = 20000, //!< pseudo index for line numbers
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
|
|||||||
@@ -169,10 +169,19 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if (indexes.isEmpty() || this->isEmpty()) { return ""; }
|
if (indexes.isEmpty() || this->isEmpty()) { return ""; }
|
||||||
QString html;
|
QString html;
|
||||||
|
int line = 1;
|
||||||
|
const bool withLineNumbers = indexes.contains(CPropertyIndex::GlobalIndexLineNumber);
|
||||||
|
CPropertyIndexList usedIndexes(indexes);
|
||||||
|
if (withLineNumbers) { usedIndexes.remove(CPropertyIndex::GlobalIndexLineNumber); }
|
||||||
for (const CStatusMessage &statusMessage : *this)
|
for (const CStatusMessage &statusMessage : *this)
|
||||||
{
|
{
|
||||||
QString rowHtml;
|
QString rowHtml;
|
||||||
for (const CPropertyIndex index : indexes)
|
if (withLineNumbers)
|
||||||
|
{
|
||||||
|
rowHtml += "<td>" + QString::number(line++) + "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const CPropertyIndex index : usedIndexes)
|
||||||
{
|
{
|
||||||
rowHtml += "<td>" + statusMessage.propertyByIndex(index).toQString(true) + "</td>";
|
rowHtml += "<td>" + statusMessage.propertyByIndex(index).toQString(true) + "</td>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user