mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T698, display network statistics in UI (internals)
This commit is contained in:
committed by
Mat Sutcliffe
parent
f754154455
commit
ab83d55d7c
@@ -90,6 +90,10 @@ namespace BlackGui
|
||||
connect(ui->pb_DisplayLog, &QPushButton::released, this, &CInternalsComponent::displayLogInSimulator);
|
||||
connect(ui->pb_SendAtis, &QPushButton::released, this, &CInternalsComponent::sendAtis);
|
||||
|
||||
connect(ui->pb_NetworkUpdateAndReset, &QPushButton::released, this, &CInternalsComponent::networkStatistics);
|
||||
connect(ui->pb_NetworkUpdate, &QPushButton::released, this, &CInternalsComponent::networkStatistics);
|
||||
connect(ui->cb_NetworkStatistics, &QCheckBox::stateChanged, this, &CInternalsComponent::onNetworkStatisticsToggled);
|
||||
|
||||
connect(ui->comp_RemoteAircraftSelector, &CRemoteAircraftSelector::changedCallsign, this, &CInternalsComponent::selectorChanged);
|
||||
|
||||
if (sGui && sGui->isSupportingCrashpad())
|
||||
@@ -354,5 +358,20 @@ namespace BlackGui
|
||||
sGui->enableCrashDumpUpload(checked);
|
||||
}
|
||||
}
|
||||
|
||||
void CInternalsComponent::networkStatistics()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextNetwork()) { return; }
|
||||
const bool reset = (QObject::sender() == ui->pb_NetworkUpdateAndReset);
|
||||
const QString statistics = sGui->getIContextNetwork()->getNetworkStatistics(reset, "\n");
|
||||
ui->pte_NetworkCalls->setPlainText(statistics);
|
||||
}
|
||||
|
||||
void CInternalsComponent::onNetworkStatisticsToggled(bool checked)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextNetwork()) { return; }
|
||||
const bool on = sGui->getIContextNetwork()->setNetworkStatisticsEnable(checked);
|
||||
CLogMessage(this).info(u"Network statistics is %1") << boolToOnOff(on);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -81,6 +81,12 @@ namespace BlackGui
|
||||
//! Checkbox toggled
|
||||
void onCrashDumpUploadToggled(bool checked);
|
||||
|
||||
//! Show network statistics
|
||||
void networkStatistics();
|
||||
|
||||
//! Enable/disable statistics
|
||||
void onNetworkStatisticsToggled(bool checked);
|
||||
|
||||
QScopedPointer<Ui::CInternalsComponent> ui;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="vs_Debug">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
@@ -343,13 +343,6 @@
|
||||
<string>Statistics / Logs</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gl_Statistics" columnstretch="0,0,0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pb_LatestInterpolationLog">
|
||||
<property name="text">
|
||||
<string>show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pb_LatestPartsLog">
|
||||
<property name="text">
|
||||
@@ -364,10 +357,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_LatestInterpolationLog">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pb_LatestInterpolationLog">
|
||||
<property name="text">
|
||||
<string>Latest interpolation log</string>
|
||||
<string>show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -384,7 +377,14 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_LatestInterpolationLog">
|
||||
<property name="text">
|
||||
<string>Latest interpolation log</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="vs_Statistics">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -397,6 +397,30 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="pte_NetworkCalls"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pb_NetworkUpdateAndReset">
|
||||
<property name="text">
|
||||
<string>update and reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="pb_NetworkUpdate">
|
||||
<property name="text">
|
||||
<string>update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="cb_NetworkStatistics">
|
||||
<property name="text">
|
||||
<string>network statistics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tb_AircraftParts">
|
||||
@@ -705,6 +729,7 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>tw_Internals</tabstop>
|
||||
<tabstop>le_StatusMessage</tabstop>
|
||||
<tabstop>tb_LogStatusMessage</tabstop>
|
||||
<tabstop>rb_StatusMessageInfo</tabstop>
|
||||
@@ -728,14 +753,17 @@
|
||||
<tabstop>pb_SimulateCrash</tabstop>
|
||||
<tabstop>pb_LatestInterpolationLog</tabstop>
|
||||
<tabstop>pb_LatestPartsLog</tabstop>
|
||||
<tabstop>pte_NetworkCalls</tabstop>
|
||||
<tabstop>cb_NetworkStatistics</tabstop>
|
||||
<tabstop>pb_NetworkUpdate</tabstop>
|
||||
<tabstop>pb_NetworkUpdateAndReset</tabstop>
|
||||
<tabstop>pb_DisplayLog</tabstop>
|
||||
<tabstop>pb_RequestFromNetwork</tabstop>
|
||||
<tabstop>tb_History</tabstop>
|
||||
<tabstop>cb_AircraftPartsIncremental</tabstop>
|
||||
<tabstop>pb_CurrentParts</tabstop>
|
||||
<tabstop>pb_SendAircraftPartsJson</tabstop>
|
||||
<tabstop>pb_SendAircraftPartsGui</tabstop>
|
||||
<tabstop>tw_Internals</tabstop>
|
||||
<tabstop>pb_CurrentParts</tabstop>
|
||||
<tabstop>cb_AircraftPartsIncremental</tabstop>
|
||||
<tabstop>pb_SendAircraftPartsJson</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
|
||||
Reference in New Issue
Block a user