Merge pull request #2712 from opentx/griebd/model_wizard_issue_2711
Griebd/model wizard issue 2711
This commit is contained in:
@@ -181,6 +181,16 @@ int StandardPage::nextFreeChannel(int channel)
|
|||||||
return -1;
|
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)
|
void StandardPage::populateCB(QComboBox *cb, int preferred)
|
||||||
{
|
{
|
||||||
cb->clear();
|
cb->clear();
|
||||||
@@ -708,11 +718,13 @@ TailPage::TailPage(WizardDialog *dlg, QString image, QString title, QString text
|
|||||||
elevatorCB = new QComboBox();
|
elevatorCB = new QComboBox();
|
||||||
rudderCB = new QComboBox();
|
rudderCB = new QComboBox();
|
||||||
|
|
||||||
QLayout *l = layout();
|
l = layout();
|
||||||
l->addWidget(new QLabel(tr("Rudder Channel:")));
|
l->addWidget(new QLabel(tr("Rudder Channel:")));
|
||||||
l->addWidget(rudderCB);
|
l->addWidget(rudderCB);
|
||||||
l->addWidget(new QLabel(tr("Elevator Channel:")));
|
l->addWidget(new QLabel(tr("Elevator Channel:")));
|
||||||
l->addWidget(elevatorCB);
|
l->addWidget(elevatorCB);
|
||||||
|
|
||||||
|
errorMessage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TailPage::initializePage()
|
void TailPage::initializePage()
|
||||||
@@ -720,6 +732,13 @@ void TailPage::initializePage()
|
|||||||
populateCB(elevatorCB, getDefaultChannel(ELEVATOR_INPUT));
|
populateCB(elevatorCB, getDefaultChannel(ELEVATOR_INPUT));
|
||||||
populateCB(rudderCB, getDefaultChannel(RUDDER_INPUT));
|
populateCB(rudderCB, getDefaultChannel(RUDDER_INPUT));
|
||||||
StandardPage::initializePage();
|
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()
|
bool TailPage::validatePage()
|
||||||
@@ -729,6 +748,17 @@ bool TailPage::validatePage()
|
|||||||
bookChannel(rudderCB, RUDDER_INPUT, 100));
|
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)
|
SimpleTailPage::SimpleTailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
|
||||||
: StandardPage(Page_Simpletail, dlg, image, title, text, nextPage)
|
: StandardPage(Page_Simpletail, dlg, image, title, text, nextPage)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class StandardPage: public QWizardPage
|
|||||||
int nextFreeChannel(int channel = 0);
|
int nextFreeChannel(int channel = 0);
|
||||||
void populateCB(QComboBox * cb, int preferred=-1);
|
void populateCB(QComboBox * cb, int preferred=-1);
|
||||||
bool bookChannel(QComboBox * cb, Input input1, int weight1, Input input2=NO_INPUT, int weight2=0);
|
bool bookChannel(QComboBox * cb, Input input1, int weight1, Input input2=NO_INPUT, int weight2=0);
|
||||||
|
int totalChannelsAvailable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *topLabel;
|
QLabel *topLabel;
|
||||||
@@ -231,10 +232,13 @@ class TailPage: public StandardPage
|
|||||||
public:
|
public:
|
||||||
TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
TailPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||||
void initializePage();
|
void initializePage();
|
||||||
|
void cleanupPage();
|
||||||
bool validatePage();
|
bool validatePage();
|
||||||
private:
|
private:
|
||||||
QComboBox *elevatorCB;
|
QComboBox *elevatorCB;
|
||||||
QComboBox *rudderCB;
|
QComboBox *rudderCB;
|
||||||
|
QLayout *l;
|
||||||
|
QLabel *errorMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VTailPage: public StandardPage
|
class VTailPage: public StandardPage
|
||||||
|
|||||||
Reference in New Issue
Block a user