mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-39 Fixed Wizard Style so that it looks ok on Mac and Windows
Changed the output calibration part of the wizard so that it is a part of the wizard flow instead of a separate flow inside one page.
This commit is contained in:
parent
3ef26a633a
commit
e7e95412e8
@ -42,6 +42,8 @@ private:
|
||||
|
||||
public:
|
||||
SetupWizard* getWizard() { return m_wizard; }
|
||||
virtual bool isFinished() { return true; }
|
||||
virtual quint16 stage() { return 0; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -55,6 +55,9 @@ p, li { white-space: pre-wrap; }
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
@ -70,6 +73,24 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="backgroundBrush">
|
||||
<brush brushstyle="NoBrush">
|
||||
<color alpha="0">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</property>
|
||||
<property name="foregroundBrush">
|
||||
<brush brushstyle="NoBrush">
|
||||
<color alpha="0">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</property>
|
||||
<property name="interactive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -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();
|
||||
|
@ -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<QString> m_vehicleElementIds;
|
||||
QList<QGraphicsSvgItem*> m_vehicleItems;
|
||||
|
@ -19,7 +19,7 @@
|
||||
<x>300</x>
|
||||
<y>40</y>
|
||||
<width>270</width>
|
||||
<height>270</height>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
@ -32,7 +32,7 @@
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>270</width>
|
||||
<height>291</height>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
@ -45,7 +45,7 @@
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>261</width>
|
||||
<height>281</height>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -94,7 +94,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<y>250</y>
|
||||
<width>241</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
@ -128,7 +128,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>240</y>
|
||||
<y>290</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -171,7 +171,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<y>250</y>
|
||||
<width>241</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
@ -214,7 +214,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>240</y>
|
||||
<y>290</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -235,7 +235,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>240</y>
|
||||
<y>290</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -276,7 +276,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<y>250</y>
|
||||
<width>241</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -321,7 +321,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>240</y>
|
||||
<y>290</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -343,7 +343,7 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<y>250</y>
|
||||
<width>241</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -426,35 +426,6 @@ p, li { white-space: pre-wrap; }
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="nextPageButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>340</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="backPageButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>340</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
@ -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("<br>");
|
||||
summary.append("<b>").append(tr("Reboot required: ")).append("</b>");
|
||||
summary.append(isRestartNeeded() ? tr("<font color='red'>Yes</font>") : tr("<font color='green'>No</font>"));
|
||||
*/
|
||||
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<QWizard::WizardButton> button_layout;
|
||||
button_layout << QWizard::Stretch << QWizard::CustomButton1 << QWizard::NextButton << QWizard::CancelButton;
|
||||
setButtonLayout(button_layout);
|
||||
|
||||
}
|
||||
|
||||
void SetupWizard::customBackClicked()
|
||||
{
|
||||
if(currentId() == PAGE_CALIBRATION) {
|
||||
static_cast<OutputCalibrationPage*>(currentPage())->customBackClicked();
|
||||
}
|
||||
else {
|
||||
back();
|
||||
}
|
||||
}
|
||||
|
||||
bool SetupWizard::saveHardwareSettings() const
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user