Fix #2091
This commit is contained in:
@@ -181,6 +181,16 @@ int StandardPage::nextFreeChannel(int channel)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int StandardPage::totalChannelsAvailable()
|
||||
{
|
||||
int c = 0;
|
||||
for(int i=0; i<WIZ_MAX_CHANNELS; i++)
|
||||
if (wizDlg->mix.channel[i].page == Page_None)
|
||||
c++;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void StandardPage::populateCB(QComboBox *cb, int preferred)
|
||||
{
|
||||
cb->clear();
|
||||
@@ -708,11 +718,13 @@ TailPage::TailPage(WizardDialog *dlg, QString image, QString title, QString text
|
||||
elevatorCB = new QComboBox();
|
||||
rudderCB = new QComboBox();
|
||||
|
||||
QLayout *l = layout();
|
||||
l = layout();
|
||||
l->addWidget(new QLabel(tr("Rudder Channel:")));
|
||||
l->addWidget(rudderCB);
|
||||
l->addWidget(new QLabel(tr("Elevator Channel:")));
|
||||
l->addWidget(elevatorCB);
|
||||
|
||||
errorMessage = NULL;
|
||||
}
|
||||
|
||||
void TailPage::initializePage()
|
||||
@@ -720,6 +732,13 @@ void TailPage::initializePage()
|
||||
populateCB(elevatorCB, getDefaultChannel(ELEVATOR_INPUT));
|
||||
populateCB(rudderCB, getDefaultChannel(RUDDER_INPUT));
|
||||
StandardPage::initializePage();
|
||||
|
||||
if (totalChannelsAvailable() < 2) {
|
||||
errorMessage = new QLabel(tr("Only one channel still available!<br>"
|
||||
"You probably should configure your model without using the wizard."));
|
||||
errorMessage->setStyleSheet("QLabel { color : red; }");
|
||||
l->addWidget(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
bool TailPage::validatePage()
|
||||
@@ -729,6 +748,17 @@ bool TailPage::validatePage()
|
||||
bookChannel(rudderCB, RUDDER_INPUT, 100));
|
||||
}
|
||||
|
||||
void TailPage::cleanupPage()
|
||||
{
|
||||
if (errorMessage)
|
||||
{
|
||||
l->removeWidget(errorMessage);
|
||||
delete errorMessage;
|
||||
errorMessage = NULL;
|
||||
}
|
||||
StandardPage::cleanupPage();
|
||||
}
|
||||
|
||||
SimpleTailPage::SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||
: StandardPage(Page_Simpletail, dlg, image, title, text, nextPage)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ class StandardPage: public QWizardPage
|
||||
int nextFreeChannel(int channel = 0);
|
||||
void populateCB(QComboBox * cb, int preferred=-1);
|
||||
bool bookChannel(QComboBox * cb, Input input1, int weight1, Input input2=NO_INPUT, int weight2=0);
|
||||
int totalChannelsAvailable();
|
||||
|
||||
private:
|
||||
QLabel *topLabel;
|
||||
@@ -231,10 +232,13 @@ class TailPage: public StandardPage
|
||||
public:
|
||||
TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
void initializePage();
|
||||
void cleanupPage();
|
||||
bool validatePage();
|
||||
private:
|
||||
QComboBox *elevatorCB;
|
||||
QComboBox *rudderCB;
|
||||
QLayout *l;
|
||||
QLabel *errorMessage;
|
||||
};
|
||||
|
||||
class VTailPage: public StandardPage
|
||||
|
||||
Reference in New Issue
Block a user