@@ -48,7 +48,7 @@ ConfigAutoTuneWidget::ConfigAutoTuneWidget(QWidget *parent) : ConfigTaskWidget(p
4848 // must be done before auto binding !
4949 setWikiURL (" AutoTune+Configuration" );
5050
51- // Add HwSettings before auto binding and give priority while saving
51+ // Add HwSettings before auto binding to give priority while saving
5252 addUAVObject (" HwSettings" );
5353
5454 addAutoBindings ();
@@ -85,27 +85,33 @@ void ConfigAutoTuneWidget::refreshWidgetsValuesImpl(UAVObject *obj)
8585
8686 if (obj == systemIdentStateObj) {
8787 m_autotune->stateComplete ->setText ((systemIdentStateObj->getComplete () == SystemIdentState::COMPLETE_TRUE) ? tr (" True" ) : tr (" False" ));
88+
89+ QString message;
90+ QString tooltip_message;
91+ QString color;
8892 if (moduleRunning && moduleEnabled) {
89- m_autotune->autotuneModuleStatus ->setText (tr (" Running" ));
90- m_autotune->autotuneModuleStatus ->setToolTip (tr (" Module is running because is enabled to be started all the time." ));
91- m_autotune->autotuneModuleStatus ->setStyleSheet (" QLabel { background-color: green; color: rgb(255, 255, 255); \
92- border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}" );
93+ message = tr (" Running" );
94+ tooltip_message = tr (" Module is running because it is enabled to be started at all times" );
95+ color = " green" ;
9396 } else if (moduleRunning && !moduleEnabled) {
94- m_autotune->autotuneModuleStatus ->setText (tr (" Running" ));
95- m_autotune->autotuneModuleStatus ->setToolTip (tr (" Module is running, due to a Flightmode setup with Autotune on it." ));
96- m_autotune->autotuneModuleStatus ->setStyleSheet (" QLabel { background-color: green; color: rgb(255, 255, 255); \
97- border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}" );
97+ message = tr (" Running" );
98+ tooltip_message = tr (" Module is running, due to a Flightmode setup with Autotune on it." );
99+ color = " green" ;
98100 } else if (!moduleRunning && moduleEnabled) {
99- m_autotune->autotuneModuleStatus ->setText (tr (" Please Reboot" ));
100- m_autotune->autotuneModuleStatus ->setToolTip (tr (" Module is enabled but not running yet, need a reboot." ));
101- m_autotune->autotuneModuleStatus ->setStyleSheet (" QLabel { background-color: orange; color: rgb(255, 255, 255); \
102- border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}" );
101+ message = tr (" Please Reboot" );
102+ tooltip_message = tr (" Module is enabled but not running yet, needs a reboot." );
103+ color = " orange" ;
103104 } else {
104- m_autotune->autotuneModuleStatus ->setText (tr (" Stopped" ));
105- m_autotune->autotuneModuleStatus ->setToolTip (tr (" Module is stopped. He can be enabled by adding a Autotune flightmode or force the module to be started all the time." ));
106- m_autotune->autotuneModuleStatus ->setStyleSheet (" QLabel { background-color: gray; color: rgb(255, 255, 255); \
107- border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}" );
105+ message = tr (" Stopped" );
106+ tooltip_message = tr (" Module is stopped. It can be enabled by adding an AutoTune flightmode or force the module to be started at all times." );
107+ color = " gray" ;
108108 }
109+
110+ QString style = QString (" QLabel { background-color: %1; color: rgb(255, 255, 255); \
111+ border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}" ).arg (color);
112+ m_autotune->autotuneModuleStatus ->setStyleSheet (style);
113+ m_autotune->autotuneModuleStatus ->setText (message);
114+ m_autotune->autotuneModuleStatus ->setToolTip (tooltip_message);
109115 } else {
110116 m_autotune->AutotuneEnable ->setChecked (moduleEnabled);
111117 // Request TaskInfo update at start
0 commit comments