Skip to content

Commit

Permalink
[Companion][ModulePanel] Clean up some layout issues in outputs/train…
Browse files Browse the repository at this point in the history
…er protocol setup UI; Make sure proper form fields are shown for radios with only one external radio system (eg. PPM on 9X). (opentx#4424)
  • Loading branch information
mpaperno authored and bsongis committed Feb 7, 2017
1 parent 3a026a8 commit 4e24d0e
Show file tree
Hide file tree
Showing 3 changed files with 614 additions and 567 deletions.
15 changes: 10 additions & 5 deletions companion/src/modeledit/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
ui->label_trainerMode->hide();
ui->trainerMode->hide();
}
ui->formLayout_col1->setSpacing(0);
}
else {
ui->label_trainerMode->hide();
Expand Down Expand Up @@ -201,10 +202,10 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
for (int i=0; i<PULSES_PROTOCOL_LAST; i++) {
if (firmware->isAvailable((PulsesProtocol)i, moduleIdx)) {
ui->protocol->addItem(ModelPrinter::printModuleProtocol(i), (QVariant)i);
if (i == module.protocol) ui->protocol->setCurrentIndex(ui->protocol->count()-1);
if (i == module.protocol)
ui->protocol->setCurrentIndex(ui->protocol->count()-1);
}
}

for (int i=0; i<=MM_RF_PROTO_LAST; i++) {
ui->multiProtocol->addItem(ModelPrinter::printMultiRfProtocol(i, false), (QVariant) i);
}
Expand Down Expand Up @@ -240,6 +241,11 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
disableMouseScrolling();

lock = false;

// a change will not register if only one item was added
if (ui->protocol->count() == 1)
on_protocol_currentIndexChanged(ui->protocol->currentIndex());

}

ModulePanel::~ModulePanel()
Expand Down Expand Up @@ -378,7 +384,7 @@ void ModulePanel::update()
ui->label_failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setVisible(mask & MASK_FAILSAFES);
ui->failsafeMode->setCurrentIndex(module.failsafeMode);
ui->failsafesFrame->setEnabled(module.failsafeMode == FAILSAFE_CUSTOM);
ui->failsafesGroupBox->setEnabled(module.failsafeMode == FAILSAFE_CUSTOM);
if (firmware->getCapability(ChannelsName) > 0) {
for(int i=0; i<maxChannels;i++) {
QString name = QString(model->limitData[i+module.channelsStart].name).trimmed();
Expand All @@ -395,8 +401,7 @@ void ModulePanel::update()
mask = 0;
}

ui->failsafesLayoutLabel->setVisible(mask & MASK_FAILSAFES);
ui->failsafesFrame->setVisible(mask & MASK_FAILSAFES);
ui->failsafesGroupBox->setVisible((mask & MASK_FAILSAFES) && module.failsafeMode == FAILSAFE_CUSTOM);

if (mask & MASK_CHANNELS_RANGE) {
ui->channelsStart->setMaximum(33 - ui->channelsCount->value());
Expand Down
8 changes: 4 additions & 4 deletions companion/src/modeledit/setup.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>840</width>
<height>520</height>
<height>371</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -206,7 +206,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>0</height>
</size>
</property>
</spacer>
Expand Down Expand Up @@ -251,7 +251,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>0</height>
</size>
</property>
</spacer>
Expand Down Expand Up @@ -615,7 +615,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>0</height>
</size>
</property>
</spacer>
Expand Down
Loading

0 comments on commit 4e24d0e

Please sign in to comment.