8 #include <QDesktopServices>
10 #include <QPushButton>
17 #include "ui_internalscomponent.h"
38 using namespace swift::config;
40 using namespace swift::misc::aviation;
41 using namespace swift::misc::network;
42 using namespace swift::misc::math;
43 using namespace swift::misc::physical_quantities;
44 using namespace swift::misc::simulation;
51 ui->tw_Internals->setCurrentIndex(0);
78 &CInternalsComponent::onNetworkStatisticsToggled);
82 ui->cb_CrashDumpUpload->setChecked(CCrashHandler::instance()->isCrashDumpUploadEnabled());
91 ui->pb_SimulateCrash->setEnabled(
false);
92 ui->cb_CrashDumpUpload->setEnabled(
false);
95 this->contextFlagsToGui();
103 this->contextFlagsToGui();
125 void CInternalsComponent::sendTextMessage()
128 if (ui->le_TxtMsgFrom->text().isEmpty()) {
return; }
129 if (ui->pte_TxtMsg->toPlainText().isEmpty()) {
return; }
130 if (ui->le_TxtMsgTo->text().isEmpty() && ui->dsb_TxtMsgFrequency->text().isEmpty()) {
return; }
134 if (senderObj == ui->pb_SendTextMessageDeferred)
141 const CCallsign recipient(ui->le_TxtMsgTo->text().trimmed());
142 const QString msgTxt(ui->pte_TxtMsg->toPlainText().trimmed());
143 const double freqMHz = CMathUtils::round(ui->dsb_TxtMsgFrequency->value(), 3);
145 if (recipient.isEmpty() && freqMHz >= 117.995)
149 CComSystem::roundToChannelSpacing(f, CComSystem::ChannelSpacing8_33KHz);
157 void CInternalsComponent::sendAtis()
160 if (ui->le_AtisCallsign->text().isEmpty()) {
return; }
161 if (ui->pte_Atis->toPlainText().isEmpty()) {
return; }
162 const CCallsign cs(ui->le_AtisCallsign->text());
163 const QString text(ui->pte_Atis->toPlainText());
169 void CInternalsComponent::logStatusMessage()
171 if (ui->le_StatusMessage->text().isEmpty()) {
return; }
173 if (ui->rb_StatusMessageError->isChecked()) { s = CStatusMessage::SeverityError; }
174 else if (ui->rb_StatusMessageWarning->isChecked()) { s = CStatusMessage::SeverityWarning; }
175 else if (ui->rb_StatusMessageInfo->isChecked()) { s = CStatusMessage::SeverityInfo; }
177 CLogMessage::preformatted(sm);
180 void CInternalsComponent::showLogFiles()
184 if (
sender == ui->pb_LatestInterpolationLog) { file = CInterpolationLogger::getLatestLogFiles().
first(); }
185 else if (
sender == ui->pb_LatestPartsLog) { file = CInterpolationLogger::getLatestLogFiles().
last(); }
187 if (file.
isEmpty()) {
return; }
191 void CInternalsComponent::contextFlagsToGui()
199 void CInternalsComponent::simulateCrash()
201 if (CBuildConfig::isReleaseBuild())
210 sGui->simulateCrash();
213 void CInternalsComponent::simulateAssert()
215 if (CBuildConfig::isReleaseBuild())
224 sGui->simulateAssert();
227 void CInternalsComponent::onCrashDumpUploadToggled(
bool checked)
231 const bool current = CCrashHandler::instance()->isCrashDumpUploadEnabled();
232 if (current == checked) {
return; }
237 void CInternalsComponent::networkStatistics()
242 ui->pte_NetworkCalls->setPlainText(statistics);
245 void CInternalsComponent::onNetworkStatisticsToggled(
bool checked)
const context::IContextAudio * getIContextAudio() const
Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextOwnAircraft * getIContextOwnAircraft() const
Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextApplication * getIContextApplication() const
Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
const context::IContextSimulator * getIContextSimulator() const
Direct access to contexts if a CCoreFacade has been initialized.
void enableCrashDumpUpload(bool enable)
Enable crash upload.
bool isSupportingCrashpad() const
Has crashpad support?
void setDebugEnabled(bool debug)
Set debug flag.
bool isDebugEnabled() const
Debug enabled?
virtual QString getNetworkStatistics(bool reset, const QString &separator)=0
Statistics info.
virtual void testReceivedTextMessages(const swift::misc::network::CTextMessageList &textMessages)=0
Inject a text message as received.
virtual void testReceivedAtisMessage(const swift::misc::aviation::CCallsign &callsign, const swift::misc::aviation::CInformationMessage &msg)=0
Inject an ATIS.
virtual bool setNetworkStatisticsEnable(bool enabled)=0
Statistics enable/disable.
Internals for debugging, statistics.
virtual ~CInternalsComponent()
Destructor.
virtual void showEvent(QShowEvent *event)
Class for emitting a log message.
Derived & info(const char16_t(&format)[N])
Set the severity to info, providing a format string.
Streamable status message, e.g.
void setCurrentUtcTime()
Set the current time as timestamp.
Value object encapsulating information of a callsign.
Value object encapsulating information of a text message.
Value object encapsulating a list of text messages.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
High level reusable GUI components.
Free functions in swift::misc.
SWIFT_MISC_EXPORT const QString & boolToOnOff(bool v)
Bool to on/off.
StatusSeverity
Status severities.
void checkStateChanged(Qt::CheckState state)
bool openUrl(const QUrl &url)
QMessageBox::StandardButton question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * sender() const const
QString first(qsizetype n) &&
bool isEmpty() const const
QString last(qsizetype n) &&
QTextStream & reset(QTextStream &stream)
QUrl fromLocalFile(const QString &localFile)