dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
simulationconfiguration.cpp
Go to the documentation of this file.
1 
11 /*
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, see <http://www.gnu.org/licenses/>
24  *
25  * Additional note on redistribution: The copyright and license notices above
26  * must be maintained in each individual source file that is a derivative work
27  * of this source file; otherwise redistribution is prohibited.
28  */
29 
32 #include "ui_simulationconfiguration.h"
33 
34 #include "hwsimulation.h"
35 
37  : ConfigTaskWidget(parent)
38  , ui(new Ui::SimulationConfiguration)
39 {
40  ui->setupUi(this);
41 
43  Q_ASSERT(hwSim);
44  connect(hwSim, &UAVObject::objectUpdated, this, &SimulationConfiguration::onLedStateUpdated);
45 }
46 
48 {
49  delete ui;
50 }
51 
52 void SimulationConfiguration::onLedStateUpdated(UAVObject *obj)
53 {
54  HwSimulation *hwSim = qobject_cast<HwSimulation *>(obj);
55  Q_ASSERT(hwSim);
56  if (hwSim->getLedState_Heartbeat() == HwSimulation::LEDSTATE_ON)
57  ui->lblHeartbeatLed->setPixmap(QPixmap(":/dronin/images/led_heartbeat_on.png"));
58  else
59  ui->lblHeartbeatLed->setPixmap(QPixmap(":/dronin/images/led_heartbeat_off.png"));
60  if (hwSim->getLedState_Alarm() == HwSimulation::LEDSTATE_ON)
61  ui->lblAlarmLed->setPixmap(QPixmap(":/dronin/images/led_alarm_on.png"));
62  else
63  ui->lblAlarmLed->setPixmap(QPixmap(":/dronin/images/led_alarm_off.png"));
64 }
65 
void objectUpdated(UAVObject *obj)
Signal sent whenever any field of the object is updated.
SimulationConfiguration(QWidget *parent=nullptr)
() NAME()
UAVObject * getObject(const QString &name, quint32 instId=0)
UAVObjectManager * getObjectManager()
ConfigTaskWidget::getObjectManager Utility function to get a pointer to the object manager...