9 #include "ui_modelmatcherlogenable.h"
16 using namespace swift::core::context;
17 using namespace swift::misc::network;
18 using namespace swift::misc::simulation;
25 connect(ui->cb_LogReverseLookup, &QCheckBox::toggled,
this, &CModelMatcherLogEnable::enabledCheckboxChanged,
26 Qt::QueuedConnection);
27 connect(ui->cb_LogMatchingMessages, &QCheckBox::toggled,
this, &CModelMatcherLogEnable::enabledCheckboxChanged,
28 Qt::QueuedConnection);
29 connect(ui->cb_LogDetailed, &QCheckBox::toggled,
this, &CModelMatcherLogEnable::enabledCheckboxChanged,
30 Qt::QueuedConnection);
32 if (this->hasContexts())
35 &CModelMatcherLogEnable::valuesChanged, Qt::QueuedConnection);
37 &CModelMatcherLogEnable::valuesChanged, Qt::QueuedConnection);
39 &CModelMatcherLogEnable::connectionStatusChanged, Qt::QueuedConnection);
42 QPointer<CModelMatcherLogEnable> myself(
this);
44 if (!myself) {
return; }
55 void CModelMatcherLogEnable::enabledCheckboxChanged(
bool enabled)
57 if (!this->hasContexts()) {
return; }
58 const QObject *sender = QObject::sender();
60 const bool detailed = (sender == ui->cb_LogDetailed) ? enabled : ui->cb_LogDetailed->isChecked();
61 const bool reverse = (sender == ui->cb_LogReverseLookup) ? enabled : ui->cb_LogReverseLookup->isChecked();
63 (sender == ui->cb_LogMatchingMessages) ? enabled : ui->cb_LogMatchingMessages->isChecked();
64 const bool simplified = !detailed;
66 if (sender == ui->cb_LogReverseLookup || sender == ui->cb_LogDetailed)
68 ReverseLookupLogging revLog = RevLogDisabled;
69 if (reverse && simplified) { revLog = RevLogEnabledSimplified; }
70 else if (reverse) { revLog = RevLogEnabled; }
75 if (sender == ui->cb_LogMatchingMessages || sender == ui->cb_LogDetailed)
77 MatchingLog matchingLog = MatchingLogNothing;
78 if (matching && simplified) { matchingLog = MatchingLogSimplified; }
79 else if (matching) { matchingLog = MatchingLogAll; }
85 void CModelMatcherLogEnable::initGui()
87 if (this->hasContexts())
91 const bool revLogEnabled = revLog.testFlag(RevLogEnabled);
92 if (revLogEnabled != ui->cb_LogReverseLookup->isChecked())
94 ui->cb_LogReverseLookup->setChecked(revLogEnabled);
98 const bool matchingLogEnabled = matchingLog > 0;
99 if (matchingLogEnabled != ui->cb_LogMatchingMessages->isChecked())
101 ui->cb_LogMatchingMessages->setChecked(matchingLogEnabled);
104 const bool simplified = revLog.testFlag(RevLogSimplifiedInfo) || matchingLog == MatchingLogSimplified;
105 const bool detailed = !simplified;
106 if (detailed != ui->cb_LogDetailed->isChecked()) { ui->cb_LogDetailed->setChecked(detailed); }
110 bool CModelMatcherLogEnable::hasContexts()
const
116 void CModelMatcherLogEnable::valuesChanged() { this->initGui(); }
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.
virtual swift::misc::simulation::ReverseLookupLogging isReverseLookupMessagesEnabled() const =0
Enabled reverse lookup logging?
virtual void enableReverseLookupMessages(swift::misc::simulation::ReverseLookupLogging enable)=0
Enable reverse lookup logging.
virtual swift::misc::simulation::MatchingLog isMatchingMessagesEnabled() const =0
Enabled mapping logging?
virtual void enableMatchingMessages(swift::misc::simulation::MatchingLog enabled)=0
Enable mapping logging.
Enable/disable matching logs.
virtual ~CModelMatcherLogEnable()
Destructor.
bool isMatchingLogEnabled() const
Matching log.enabled.
bool isReverseLookupLogEnabled() const
Reverse lookup enabled?
Value object encapsulating information about a connection status.
bool isConnected() const
Query status.
bool isDisconnected() const
Query status.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...