1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

LP-302 Small changes: move to QStringList and remove magic numbers.

This commit is contained in:
Laurent Lalanne 2016-05-05 13:20:45 +02:00
parent a0d4d811b8
commit 1b5dda3ee4
2 changed files with 8 additions and 6 deletions

View File

@ -190,7 +190,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
Q_ASSERT(m_aircraft); Q_ASSERT(m_aircraft);
Q_ASSERT(quad); Q_ASSERT(quad);
QList<QString> motorLabels; QStringList motorLabels;
if (frameType == "Tri" || frameType == "Tricopter Y") { if (frameType == "Tri" || frameType == "Tricopter Y") {
setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Tricopter Y")); setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Tricopter Y"));
@ -560,7 +560,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
/** /**
Helper function to update the UI MotorPositionLabels text Helper function to update the UI MotorPositionLabels text
*/ */
void ConfigMultiRotorWidget::updateMotorsPositionLabels(QList<QString> motorLabels) void ConfigMultiRotorWidget::updateMotorsPositionLabels(QStringList motorLabels)
{ {
QList<QLabel *> mpList; QList<QLabel *> mpList;
mpList << m_aircraft->motorPositionLabel1 << m_aircraft->motorPositionLabel2 mpList << m_aircraft->motorPositionLabel1 << m_aircraft->motorPositionLabel2
@ -568,10 +568,12 @@ void ConfigMultiRotorWidget::updateMotorsPositionLabels(QList<QString> motorLabe
<< m_aircraft->motorPositionLabel5 << m_aircraft->motorPositionLabel6 << m_aircraft->motorPositionLabel5 << m_aircraft->motorPositionLabel6
<< m_aircraft->motorPositionLabel7 << m_aircraft->motorPositionLabel8; << m_aircraft->motorPositionLabel7 << m_aircraft->motorPositionLabel8;
if (motorLabels.count() < 8) {
int motorCount = motorLabels.count(); int motorCount = motorLabels.count();
int uiLabelsCount = mpList.count();
if (motorCount < uiLabelsCount) {
// Fill labels for unused motors // Fill labels for unused motors
for (int index = motorCount; index < mpList.count(); index++) { for (int index = motorCount; index < uiLabelsCount; index++) {
motorLabels.insert(index, "Not used"); motorLabels.insert(index, "Not used");
} }
} }

View File

@ -79,7 +79,7 @@ private:
void setYawMixLevel(int); void setYawMixLevel(int);
void updateRcCurvesUsed(); void updateRcCurvesUsed();
void updateAirframe(QString multiRotorType); void updateAirframe(QString multiRotorType);
void updateMotorsPositionLabels(QList<QString> motorLabels); void updateMotorsPositionLabels(QStringList motorLabels);
void setupEnabledControls(QString multiRotorType); void setupEnabledControls(QString multiRotorType);
private slots: private slots: