diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/abstractwizardpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/abstractwizardpage.h
index 072d619e7..bb4960a32 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/pages/abstractwizardpage.h
+++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/abstractwizardpage.h
@@ -42,6 +42,8 @@ private:
public:
SetupWizard* getWizard() { return m_wizard; }
+ virtual bool isFinished() { return true; }
+ virtual quint16 stage() { return 0; }
};
diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui
index 0b00607c6..22e244836 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui
+++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui
@@ -55,6 +55,9 @@ p, li { white-space: pre-wrap; }
0
+
+ false
+
QFrame::NoFrame
@@ -70,6 +73,24 @@ p, li { white-space: pre-wrap; }
Qt::ScrollBarAlwaysOff
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
false
diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp
index 812694f66..d91dddc81 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp
+++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp
@@ -32,7 +32,7 @@
OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent), ui(new Ui::OutputCalibrationPage), m_vehicleBoundsItem(0),
- m_currentWizardIndex(0), m_calibrationUtil(0)
+ m_currentWizardIndex(-1), m_calibrationUtil(0)
{
ui->setupUi(this);
@@ -171,8 +171,6 @@ void OutputCalibrationPage::setWizardPage()
{
qDebug() << "Wizard index: " << m_currentWizardIndex;
m_calibrationUtil->stopChannelOutput();
- ui->backPageButton->setEnabled(m_currentWizardIndex > 0);
- ui->nextPageButton->setEnabled(m_currentWizardIndex < m_wizardIndexes.size() - 1);
QApplication::processEvents();
@@ -211,8 +209,14 @@ void OutputCalibrationPage::initializePage()
bool OutputCalibrationPage::validatePage()
{
- getWizard()->setActuatorSettings(m_actuatorSettings);
- return true;
+ if(isFinished()) {
+ getWizard()->setActuatorSettings(m_actuatorSettings);
+ return true;
+ } else {
+ m_currentWizardIndex++;
+ setWizardPage();
+ return false;
+ }
}
void OutputCalibrationPage::showEvent(QShowEvent *event)
@@ -224,20 +228,17 @@ void OutputCalibrationPage::showEvent(QShowEvent *event)
}
}
-void OutputCalibrationPage::on_nextPageButton_clicked()
+void OutputCalibrationPage::customBackClicked()
{
- if(m_currentWizardIndex < m_wizardIndexes.size() - 1) {
- m_currentWizardIndex++;
- setWizardPage();
- }
-}
-
-void OutputCalibrationPage::on_backPageButton_clicked()
-{
- if(m_currentWizardIndex > 0) {
+ if(m_currentWizardIndex > 0)
+ {
m_currentWizardIndex--;
setWizardPage();
}
+ else
+ {
+ getWizard()->back();
+ }
}
quint16 OutputCalibrationPage::getCurrentChannel()
@@ -247,9 +248,8 @@ quint16 OutputCalibrationPage::getCurrentChannel()
void OutputCalibrationPage::enableButtons(bool enable)
{
- ui->nextPageButton->setEnabled(enable && (m_currentWizardIndex < m_wizardIndexes.size() - 1));
- ui->backPageButton->setEnabled(enable && (m_currentWizardIndex > 0));
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
+ getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
getWizard()->button(QWizard::BackButton)->setEnabled(enable);
QApplication::processEvents();
diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h
index bf646e2f1..76af9534e 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h
+++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h
@@ -48,13 +48,15 @@ public:
void initializePage();
bool validatePage();
+ bool isFinished() { return m_currentWizardIndex >= m_wizardIndexes.size() - 1; }
+
protected:
void showEvent(QShowEvent *event);
-private slots:
- void on_nextPageButton_clicked();
- void on_backPageButton_clicked();
+public slots:
+ void customBackClicked();
+private slots:
void on_motorNeutralButton_toggled(bool checked);
void on_motorNeutralSlider_valueChanged(int value);
@@ -84,7 +86,7 @@ private:
QGraphicsScene *m_vehicleScene;
QGraphicsSvgItem *m_vehicleBoundsItem;
- quint16 m_currentWizardIndex;
+ qint16 m_currentWizardIndex;
QList m_vehicleElementIds;
QList m_vehicleItems;
diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui
index 5947e6e3c..22e0f0eec 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui
+++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui
@@ -19,7 +19,7 @@
300
40
270
- 270
+ 341
@@ -32,7 +32,7 @@
20
40
270
- 291
+ 341
@@ -45,7 +45,7 @@
0
10
261
- 281
+ 321
@@ -94,7 +94,7 @@ p, li { white-space: pre-wrap; }
10
- 200
+ 250
241
19
@@ -128,7 +128,7 @@ p, li { white-space: pre-wrap; }
90
- 240
+ 290
75
23
@@ -171,7 +171,7 @@ p, li { white-space: pre-wrap; }
10
- 200
+ 250
241
19
@@ -214,7 +214,7 @@ p, li { white-space: pre-wrap; }
90
- 240
+ 290
75
23
@@ -235,7 +235,7 @@ p, li { white-space: pre-wrap; }
90
- 240
+ 290
75
23
@@ -276,7 +276,7 @@ p, li { white-space: pre-wrap; }
10
- 200
+ 250
241
20
@@ -321,7 +321,7 @@ p, li { white-space: pre-wrap; }
90
- 240
+ 290
75
23
@@ -343,7 +343,7 @@ p, li { white-space: pre-wrap; }
10
- 200
+ 250
241
20
@@ -426,35 +426,6 @@ p, li { white-space: pre-wrap; }
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
-
-
- 150
- 340
- 75
- 23
-
-
-
- >
-
-
-
-
- false
-
-
-
- 70
- 340
- 75
- 23
-
-
-
- <
-
-
diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp
index 7d30b6d1a..888e64035 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp
+++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp
@@ -39,9 +39,9 @@
#include "pages/levellingpage.h"
#include "pages/summarypage.h"
#include "pages/flashpage.h"
-#include "pages/outputcalibrationpage.h"
#include "pages/notyetimplementedpage.h"
#include "pages/rebootpage.h"
+#include "pages/outputcalibrationpage.h"
#include "extensionsystem/pluginmanager.h"
#include "vehicleconfigurationhelper.h"
#include "actuatorsettings.h"
@@ -53,12 +53,13 @@ SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfiguratio
{
setWindowTitle(tr("OpenPilot Setup Wizard"));
setOption(QWizard::IndependentPages, false);
- setFixedSize(640, 530);
for(quint16 i = 0; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++)
{
m_actuatorSettings << actuatorChannelSettings();
}
createPages();
+ setWizardStyle(QWizard::ModernStyle);
+ setFixedSize(640, 530);
}
int SetupWizard::nextId() const
@@ -245,9 +246,11 @@ QString SetupWizard::getSummaryText()
summary.append(tr("Unknown"));
}
+ /*
summary.append("
");
summary.append("").append(tr("Reboot required: ")).append("");
summary.append(isRestartNeeded() ? tr("Yes") : tr("No"));
+ */
return summary;
}
@@ -271,6 +274,23 @@ void SetupWizard::createPages()
setPage(PAGE_END, new EndPage(this));
setStartId(PAGE_START);
+
+ connect(button(QWizard::CustomButton1), SIGNAL(clicked()), this, SLOT(customBackClicked()));
+ setButtonText(QWizard::CustomButton1, buttonText(QWizard::BackButton));
+ QList button_layout;
+ button_layout << QWizard::Stretch << QWizard::CustomButton1 << QWizard::NextButton << QWizard::CancelButton;
+ setButtonLayout(button_layout);
+
+}
+
+void SetupWizard::customBackClicked()
+{
+ if(currentId() == PAGE_CALIBRATION) {
+ static_cast(currentPage())->customBackClicked();
+ }
+ else {
+ back();
+ }
}
bool SetupWizard::saveHardwareSettings() const
diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h
index 72458ffe6..1a8728714 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h
+++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h
@@ -35,7 +35,6 @@
#include "vehicleconfigurationsource.h"
#include "vehicleconfigurationhelper.h"
-
class SetupWizard : public QWizard, public VehicleConfigurationSource
{
Q_OBJECT
@@ -79,7 +78,8 @@ public:
}
return m_connectionManager;
}
-
+private slots:
+ void customBackClicked();
private:
enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_LEVELLING, PAGE_CALIBRATION,
@@ -101,6 +101,8 @@ private:
bool m_restartNeeded;
+ bool m_back;
+
Core::ConnectionManager *m_connectionManager;
};