The wizard should use the channel order defined in preferences
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
|
||||
WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelId, QWidget *parent)
|
||||
: QWizard(parent),
|
||||
mix(settings, modelId)
|
||||
mix(settings, modelId),
|
||||
settings(settings)
|
||||
{
|
||||
setWindowTitle(tr("Model Wizard"));
|
||||
|
||||
@@ -123,14 +124,13 @@ void WizardDialog::showHelp()
|
||||
}
|
||||
|
||||
StandardPage::StandardPage(WizardPage currentPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage )
|
||||
: QWizardPage()
|
||||
: QWizardPage(),
|
||||
wizDlg(dlg),
|
||||
pageCurrent(currentPage),
|
||||
pageFollower(nextPage)
|
||||
{
|
||||
pageCurrent = currentPage;
|
||||
pageFollower = nextPage;
|
||||
wizDlg = dlg;
|
||||
|
||||
setTitle(title);
|
||||
setPixmap(QWizard::WatermarkPixmap, QPixmap(QString(":/images/wizard/") + image + QString(".png")));
|
||||
setPixmap(QWizard::WatermarkPixmap, QPixmap(QString(":/images/wizard/%1.png").arg(image)));
|
||||
topLabel = new QLabel(text+"<br>");
|
||||
topLabel->setWordWrap(true);
|
||||
|
||||
@@ -139,14 +139,27 @@ StandardPage::StandardPage(WizardPage currentPage, WizardDialog *dlg, QString im
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void StandardPage::populateCB( QComboBox *CB )
|
||||
int StandardPage::getDefaultChannel(const Input input)
|
||||
{
|
||||
for (int j=0; j<WIZ_MAX_CHANNELS; j++)
|
||||
CB->removeItem(0);
|
||||
for (int channel=0; channel<4; channel++) {
|
||||
unsigned int stick_index = chout_ar[4*wizDlg->settings.templateSetup + channel];
|
||||
if (input == stick_index)
|
||||
return channel;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void StandardPage::populateCB(QComboBox *cb, int preferred)
|
||||
{
|
||||
cb->clear();
|
||||
|
||||
for (int i=0; i<WIZ_MAX_CHANNELS; i++) {
|
||||
if (wizDlg->mix.channel[i].page == Page_None) {
|
||||
CB->addItem(tr("Channel %1").arg(i+1), i);
|
||||
// this channel is not already used
|
||||
cb->addItem(tr("Channel %1").arg(i+1), i);
|
||||
if (preferred == i) {
|
||||
cb->setCurrentIndex(cb->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,7 +336,7 @@ ThrottlePage::ThrottlePage(WizardDialog *dlg, QString image, QString title, QStr
|
||||
|
||||
void ThrottlePage::initializePage()
|
||||
{
|
||||
populateCB(throttleCB);
|
||||
populateCB(throttleCB, getDefaultChannel(THROTTLE));
|
||||
}
|
||||
|
||||
bool ThrottlePage::validatePage()
|
||||
|
||||
@@ -28,10 +28,11 @@ QT_END_NAMESPACE
|
||||
class WizardDialog : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
WizMix mix;
|
||||
WizardDialog(const GeneralSettings & settings, const unsigned int modelId, QWidget *parent = 0);
|
||||
public:
|
||||
WizMix mix;
|
||||
WizardDialog(const GeneralSettings & settings, const unsigned int modelId, QWidget *parent = 0);
|
||||
const GeneralSettings & settings;
|
||||
|
||||
private slots:
|
||||
void showHelp();
|
||||
@@ -40,18 +41,25 @@ public:
|
||||
class StandardPage: public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
StandardPage(WizardPage curPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
WizardDialog *wizDlg;
|
||||
void populateCB( QComboBox *);
|
||||
bool bookChannel(QString label, Input input1, int weight1, Input input2=NOINPUT, int weight2=0 );
|
||||
void releaseChannels();
|
||||
void cleanupPage();
|
||||
private:
|
||||
QLabel *topLabel;
|
||||
WizardPage pageCurrent;
|
||||
int pageFollower;
|
||||
int nextId() const;
|
||||
|
||||
public:
|
||||
StandardPage(WizardPage curPage, WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
|
||||
WizardDialog *wizDlg;
|
||||
|
||||
// TODO public for these 3 ones?
|
||||
bool bookChannel(QString label, Input input1, int weight1, Input input2=NOINPUT, int weight2=0 );
|
||||
void releaseChannels();
|
||||
void cleanupPage();
|
||||
|
||||
protected:
|
||||
int getDefaultChannel(const Input input);
|
||||
void populateCB(QComboBox * cb, int preferred=-1);
|
||||
|
||||
private:
|
||||
QLabel *topLabel;
|
||||
WizardPage pageCurrent;
|
||||
int pageFollower;
|
||||
int nextId() const;
|
||||
};
|
||||
|
||||
class ModelSelectionPage: public StandardPage
|
||||
|
||||
Reference in New Issue
Block a user