1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-31 16:52:10 +01:00

Merged in f5soh/librepilot/LP-379_Show_ReveiverActivity (pull request #300)

LP-379 Display ReceiverActivity in Rc Input tab
This commit is contained in:
Philippe Renon 2016-08-28 18:46:36 +02:00
commit 9d90e1b749
3 changed files with 196 additions and 108 deletions

View File

@ -203,6 +203,10 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) :
connect(wizardUi->wzCancel, SIGNAL(clicked()), this, SLOT(wzCancel())); connect(wizardUi->wzCancel, SIGNAL(clicked()), this, SLOT(wzCancel()));
connect(wizardUi->wzBack, SIGNAL(clicked()), this, SLOT(wzBack())); connect(wizardUi->wzBack, SIGNAL(clicked()), this, SLOT(wzBack()));
connect(ReceiverActivity::GetInstance(getObjectManager()), SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateReceiverActivityStatus()));
ui->receiverActivityStatus->setStyleSheet("QLabel { background-color: darkGreen; color: rgb(255, 255, 255); \
border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}");
ui->stackedWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(0);
QList<QWidget *> widgets = QList<QWidget *>() << ui->fmsModePos1 << ui->fmsModePos2 << ui->fmsModePos3 << QList<QWidget *> widgets = QList<QWidget *>() << ui->fmsModePos1 << ui->fmsModePos2 << ui->fmsModePos3 <<
ui->fmsModePos4 << ui->fmsModePos5 << ui->fmsModePos6; ui->fmsModePos4 << ui->fmsModePos5 << ui->fmsModePos6;
@ -2117,6 +2121,32 @@ void ConfigInputWidget::forceOneFlightMode()
manualSettingsObj->setData(manualSettingsData); manualSettingsObj->setData(manualSettingsData);
} }
void ConfigInputWidget::updateReceiverActivityStatus()
{
ReceiverActivity *receiverActivity = ReceiverActivity::GetInstance(getObjectManager());
Q_ASSERT(receiverActivity);
UAVObjectField *activeGroup = receiverActivity->getField(QString("ActiveGroup"));
Q_ASSERT(activeGroup);
UAVObjectField *activeChannel = receiverActivity->getField(QString("ActiveChannel"));
Q_ASSERT(activeChannel);
QString activeGroupText = activeGroup->getValue().toString();
QString activeChannelText = activeChannel->getValue().toString();
if (activeGroupText != "None") {
ui->receiverActivityStatus->setText(tr("%1 input - Channel %2").arg(activeGroupText).arg(activeChannelText));
ui->receiverActivityStatus->setStyleSheet("QLabel { background-color: green; color: rgb(255, 255, 255); \
border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}");
} else {
ui->receiverActivityStatus->setText(tr("No activity"));
ui->receiverActivityStatus->setStyleSheet("QLabel { background-color: darkGreen; color: rgb(255, 255, 255); \
border: 1px solid grey; border-radius: 5; margin:1px; font:bold;}");
}
}
void ConfigInputWidget::failsafeFlightModeChanged(int index) void ConfigInputWidget::failsafeFlightModeChanged(int index)
{ {
ui->failsafeFlightMode->setEnabled(index != -1); ui->failsafeFlightMode->setEnabled(index != -1);

View File

@ -230,6 +230,7 @@ private slots:
void resetFlightModeSettings(); void resetFlightModeSettings();
void resetActuatorSettings(); void resetActuatorSettings();
void forceOneFlightMode(); void forceOneFlightMode();
void updateReceiverActivityStatus();
void failsafeFlightModeChanged(int index); void failsafeFlightModeChanged(int index);
void failsafeFlightModeCbToggled(bool checked); void failsafeFlightModeCbToggled(bool checked);

View File

@ -136,7 +136,7 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="0"> <item row="3" column="0">
<widget class="QGroupBox" name="groupBox_5"> <widget class="QGroupBox" name="groupBox_5">
<property name="title"> <property name="title">
<string>Input Channel Configuration</string> <string>Input Channel Configuration</string>
@ -281,114 +281,171 @@
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="groupBox_3"> <layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="title"> <property name="topMargin">
<string>Calibration and Configuration Options</string> <number>0</number>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_7"> <item>
<item> <widget class="QGroupBox" name="groupBox_3">
<spacer name="horizontalSpacer_10"> <property name="title">
<property name="orientation"> <string>Calibration and Configuration Options</string>
<enum>Qt::Horizontal</enum> </property>
</property> <layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="sizeHint" stdset="0"> <item>
<size> <spacer name="horizontalSpacer_10">
<width>40</width> <property name="orientation">
<height>20</height> <enum>Qt::Horizontal</enum>
</size> </property>
</property> <property name="sizeHint" stdset="0">
</spacer> <size>
</item> <width>40</width>
<item> <height>20</height>
<widget class="QPushButton" name="configurationWizard"> </size>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> </spacer>
<horstretch>0</horstretch> </item>
<verstretch>0</verstretch> <item>
</sizepolicy> <widget class="QPushButton" name="configurationWizard">
</property> <property name="sizePolicy">
<property name="minimumSize"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<size> <horstretch>0</horstretch>
<width>210</width> <verstretch>0</verstretch>
<height>0</height> </sizepolicy>
</size> </property>
</property> <property name="minimumSize">
<property name="text"> <size>
<string>Start Transmitter Setup Wizard</string> <width>240</width>
</property> <height>0</height>
<property name="checkable"> </size>
<bool>false</bool> </property>
</property> <property name="text">
<property name="checked"> <string>Start Transmitter Setup Wizard</string>
<bool>false</bool> </property>
</property> <property name="checkable">
<property name="autoDefault"> <bool>false</bool>
<bool>false</bool> </property>
</property> <property name="checked">
<property name="default"> <bool>false</bool>
<bool>false</bool> </property>
</property> <property name="autoDefault">
<property name="flat"> <bool>false</bool>
<bool>false</bool> </property>
</property> <property name="default">
</widget> <bool>false</bool>
</item> </property>
<item> <property name="flat">
<spacer name="horizontalSpacer_7"> <bool>false</bool>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> </widget>
</property> </item>
<property name="sizeHint" stdset="0"> <item>
<size> <spacer name="horizontalSpacer_7">
<width>40</width> <property name="orientation">
<height>20</height> <enum>Qt::Horizontal</enum>
</size> </property>
</property> <property name="sizeHint" stdset="0">
</spacer> <size>
</item> <width>40</width>
<item> <height>20</height>
<widget class="QPushButton" name="runCalibration"> </size>
<property name="enabled"> </property>
<bool>true</bool> </spacer>
</property> </item>
<property name="sizePolicy"> <item>
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <widget class="QPushButton" name="runCalibration">
<horstretch>0</horstretch> <property name="enabled">
<verstretch>0</verstretch> <bool>true</bool>
</sizepolicy> </property>
</property> <property name="sizePolicy">
<property name="minimumSize"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<size> <horstretch>0</horstretch>
<width>210</width> <verstretch>0</verstretch>
<height>0</height> </sizepolicy>
</size> </property>
</property> <property name="minimumSize">
<property name="autoFillBackground"> <size>
<bool>false</bool> <width>240</width>
</property> <height>0</height>
<property name="text"> </size>
<string>Start Manual Calibration</string> </property>
</property> <property name="autoFillBackground">
<property name="checkable"> <bool>false</bool>
<bool>true</bool> </property>
</property> <property name="text">
</widget> <string>Start Manual Calibration</string>
</item> </property>
<item> <property name="checkable">
<spacer name="horizontalSpacer_9"> <bool>true</bool>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> </widget>
</property> </item>
<property name="sizeHint" stdset="0"> <item>
<size> <spacer name="horizontalSpacer_9">
<width>40</width> <property name="orientation">
<height>20</height> <enum>Qt::Horizontal</enum>
</size> </property>
</property> <property name="sizeHint" stdset="0">
</spacer> <size>
</item> <width>40</width>
</layout> <height>20</height>
</widget> </size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Receiver Activity</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="receiverActivityStatus">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Show receiver activity, input and channel
while moving one stick or switch at once.</string>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid grey;
border-radius: 5;
margin:1px;
font:bold;</string>
</property>
<property name="text">
<string>No activity</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>