1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-39 Added correct dependencies to SetupWizard plugin specification.

Renamed FlashPage to FlashDance, eeh, no SavePage :)
Removed unnecessary dependency in setupwizard.pro
Fixed a bug with the Next button on the first page.
Fixed a bug with the cancel button on the last page.
This commit is contained in:
Fredrik Arvidsson 2012-10-02 23:17:56 +02:00
parent 13f10949e8
commit a47687cff8
9 changed files with 48 additions and 39 deletions

View File

@ -1,4 +1,4 @@
<plugin name="Config" version="0.0.1" compatVersion="1.0.0"> <plugin name="Config" version="1.0.0" compatVersion="1.0.0">
<vendor>The OpenPilot Project</vendor> <vendor>The OpenPilot Project</vendor>
<copyright>(C) 2010 OpenPilot Project</copyright> <copyright>(C) 2010 OpenPilot Project</copyright>
<license>GNU Public License (GPL) Version 3</license> <license>GNU Public License (GPL) Version 3</license>

View File

@ -228,7 +228,6 @@ plugin_setupwizard.subdir = setupwizard
plugin_setupwizard.depends = plugin_coreplugin plugin_setupwizard.depends = plugin_coreplugin
plugin_setupwizard.depends += plugin_uavobjects plugin_setupwizard.depends += plugin_uavobjects
plugin_setupwizard.depends += plugin_config plugin_setupwizard.depends += plugin_config
plugin_setupwizard.depends += plugin_uavsettingsimportexport
SUBDIRS += plugin_setupwizard SUBDIRS += plugin_setupwizard
# Junsi Powerlog plugin # Junsi Powerlog plugin

View File

@ -6,5 +6,7 @@
<url>http://www.openpilot.org</url> <url>http://www.openpilot.org</url>
<dependencyList> <dependencyList>
<dependency name="Core" version="1.0.0"/> <dependency name="Core" version="1.0.0"/>
<dependency name="Config" version="1.0.0"/>
<dependency name="UAVObjects" version="1.0.0"/>
</dependencyList> </dependencyList>
</plugin> </plugin>

View File

@ -1,11 +1,11 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file flashpage.cpp * @file savepage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup * @addtogroup
* @{ * @{
* @addtogroup FlashPage * @addtogroup SavePage
* @{ * @{
* @brief * @brief
*****************************************************************************/ *****************************************************************************/
@ -26,35 +26,35 @@
*/ */
#include <QMessageBox> #include <QMessageBox>
#include "flashpage.h" #include "savepage.h"
#include "ui_flashpage.h" #include "ui_savepage.h"
#include "setupwizard.h" #include "setupwizard.h"
#include "vehicleconfigurationhelper.h" #include "vehicleconfigurationhelper.h"
FlashPage::FlashPage(SetupWizard *wizard, QWidget *parent) : SavePage::SavePage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent), AbstractWizardPage(wizard, parent),
ui(new Ui::FlashPage), m_successfulWrite(false) ui(new Ui::SavePage), m_successfulWrite(false)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(writeToController())); connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(writeToController()));
} }
FlashPage::~FlashPage() SavePage::~SavePage()
{ {
delete ui; delete ui;
} }
bool FlashPage::validatePage() bool SavePage::validatePage()
{ {
return true; return true;
} }
bool FlashPage::isComplete() const bool SavePage::isComplete() const
{ {
return m_successfulWrite; return m_successfulWrite;
} }
void FlashPage::writeToController() void SavePage::writeToController()
{ {
if(!getWizard()->getConnectionManager()->isConnected()) { if(!getWizard()->getConnectionManager()->isConnected()) {
QMessageBox msgBox; QMessageBox msgBox;
@ -79,7 +79,7 @@ void FlashPage::writeToController()
emit completeChanged(); emit completeChanged();
} }
void FlashPage::enableButtons(bool enable) void SavePage::enableButtons(bool enable)
{ {
ui->saveButton->setEnabled(enable); ui->saveButton->setEnabled(enable);
getWizard()->button(QWizard::NextButton)->setEnabled(enable); getWizard()->button(QWizard::NextButton)->setEnabled(enable);
@ -88,7 +88,7 @@ void FlashPage::enableButtons(bool enable)
QApplication::processEvents(); QApplication::processEvents();
} }
void FlashPage::saveProgress(int total, int current, QString description) void SavePage::saveProgress(int total, int current, QString description)
{ {
qDebug() << "Progress " << current << "(" << total << ")"; qDebug() << "Progress " << current << "(" << total << ")";
if(ui->saveProgressBar->maximum() != total) { if(ui->saveProgressBar->maximum() != total) {

View File

@ -1,11 +1,11 @@
/** /**
****************************************************************************** ******************************************************************************
* *
* @file flashpage.h * @file savepage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup * @addtogroup
* @{ * @{
* @addtogroup FlashPage * @addtogroup SavePage
* @{ * @{
* @brief * @brief
*****************************************************************************/ *****************************************************************************/
@ -25,27 +25,27 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef FLASHPAGE_H #ifndef SAVEPAGE_H
#define FLASHPAGE_H #define SAVEPAGE_H
#include "abstractwizardpage.h" #include "abstractwizardpage.h"
namespace Ui { namespace Ui {
class FlashPage; class SavePage;
} }
class FlashPage : public AbstractWizardPage class SavePage : public AbstractWizardPage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit FlashPage(SetupWizard *wizard, QWidget *parent = 0); explicit SavePage(SetupWizard *wizard, QWidget *parent = 0);
~FlashPage(); ~SavePage();
bool validatePage(); bool validatePage();
bool isComplete() const; bool isComplete() const;
private: private:
Ui::FlashPage *ui; Ui::SavePage *ui;
bool m_successfulWrite; bool m_successfulWrite;
void enableButtons(bool enable); void enableButtons(bool enable);
@ -54,4 +54,4 @@ private slots:
void saveProgress(int total, int current, QString description); void saveProgress(int total, int current, QString description);
}; };
#endif // FLASHPAGE_H #endif // SAVEPAGE_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>FlashPage</class> <class>SavePage</class>
<widget class="QWizardPage" name="FlashPage"> <widget class="QWizardPage" name="SavePage">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@ -38,7 +38,7 @@
#include "pages/outputpage.h" #include "pages/outputpage.h"
#include "pages/levellingpage.h" #include "pages/levellingpage.h"
#include "pages/summarypage.h" #include "pages/summarypage.h"
#include "pages/flashpage.h" #include "pages/savepage.h"
#include "pages/notyetimplementedpage.h" #include "pages/notyetimplementedpage.h"
#include "pages/rebootpage.h" #include "pages/rebootpage.h"
#include "pages/outputcalibrationpage.h" #include "pages/outputcalibrationpage.h"
@ -111,10 +111,10 @@ int SetupWizard::nextId() const
case PAGE_LEVELLING: case PAGE_LEVELLING:
return PAGE_CALIBRATION; return PAGE_CALIBRATION;
case PAGE_CALIBRATION: case PAGE_CALIBRATION:
return PAGE_FLASH; return PAGE_SAVE;
case PAGE_SUMMARY: case PAGE_SUMMARY:
return PAGE_LEVELLING; return PAGE_LEVELLING;
case PAGE_FLASH: case PAGE_SAVE:
return PAGE_END; return PAGE_END;
case PAGE_NOTYETIMPLEMENTED: case PAGE_NOTYETIMPLEMENTED:
return PAGE_END; return PAGE_END;
@ -268,7 +268,7 @@ void SetupWizard::createPages()
setPage(PAGE_LEVELLING, new LevellingPage(this)); setPage(PAGE_LEVELLING, new LevellingPage(this));
setPage(PAGE_CALIBRATION, new OutputCalibrationPage(this)); setPage(PAGE_CALIBRATION, new OutputCalibrationPage(this));
setPage(PAGE_SUMMARY, new SummaryPage(this)); setPage(PAGE_SUMMARY, new SummaryPage(this));
setPage(PAGE_FLASH, new FlashPage(this)); setPage(PAGE_SAVE, new SavePage(this));
setPage(PAGE_REBOOT, new RebootPage(this)); setPage(PAGE_REBOOT, new RebootPage(this));
setPage(PAGE_NOTYETIMPLEMENTED, new NotYetImplementedPage(this)); setPage(PAGE_NOTYETIMPLEMENTED, new NotYetImplementedPage(this));
setPage(PAGE_END, new EndPage(this)); setPage(PAGE_END, new EndPage(this));
@ -278,9 +278,9 @@ void SetupWizard::createPages()
connect(button(QWizard::CustomButton1), SIGNAL(clicked()), this, SLOT(customBackClicked())); connect(button(QWizard::CustomButton1), SIGNAL(clicked()), this, SLOT(customBackClicked()));
setButtonText(QWizard::CustomButton1, buttonText(QWizard::BackButton)); setButtonText(QWizard::CustomButton1, buttonText(QWizard::BackButton));
QList<QWizard::WizardButton> button_layout; QList<QWizard::WizardButton> button_layout;
button_layout << QWizard::Stretch << QWizard::CustomButton1 << QWizard::NextButton << QWizard::CancelButton; button_layout << QWizard::Stretch << QWizard::CustomButton1 << QWizard::NextButton << QWizard::CancelButton << QWizard::FinishButton;
setButtonLayout(button_layout); setButtonLayout(button_layout);
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int)));
} }
void SetupWizard::customBackClicked() void SetupWizard::customBackClicked()
@ -293,6 +293,12 @@ void SetupWizard::customBackClicked()
} }
} }
void SetupWizard::pageChanged(int currId)
{
button(QWizard::CustomButton1)->setVisible(currId != PAGE_START);
button(QWizard::CancelButton)->setVisible(currId != PAGE_END);
}
bool SetupWizard::saveHardwareSettings() const bool SetupWizard::saveHardwareSettings() const
{ {
VehicleConfigurationHelper helper(const_cast<SetupWizard *>(this)); VehicleConfigurationHelper helper(const_cast<SetupWizard *>(this));

View File

@ -78,12 +78,14 @@ public:
} }
return m_connectionManager; return m_connectionManager;
} }
private slots: private slots:
void customBackClicked(); void customBackClicked();
void pageChanged(int currId);
private: private:
enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING, enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_LEVELLING, PAGE_CALIBRATION, PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_LEVELLING, PAGE_CALIBRATION,
PAGE_FLASH, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END}; PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END};
void createPages(); void createPages();
bool saveHardwareSettings() const; bool saveHardwareSettings() const;

View File

@ -23,7 +23,6 @@ HEADERS += setupwizardplugin.h \
pages/outputpage.h \ pages/outputpage.h \
pages/inputpage.h \ pages/inputpage.h \
pages/summarypage.h \ pages/summarypage.h \
pages/flashpage.h \
pages/levellingpage.h \ pages/levellingpage.h \
levellingutil.h \ levellingutil.h \
vehicleconfigurationsource.h \ vehicleconfigurationsource.h \
@ -31,7 +30,8 @@ HEADERS += setupwizardplugin.h \
connectiondiagram.h \ connectiondiagram.h \
pages/outputcalibrationpage.h \ pages/outputcalibrationpage.h \
outputcalibrationutil.h \ outputcalibrationutil.h \
pages/rebootpage.h pages/rebootpage.h \
pages/savepage.h
SOURCES += setupwizardplugin.cpp \ SOURCES += setupwizardplugin.cpp \
setupwizard.cpp \ setupwizard.cpp \
@ -48,7 +48,6 @@ SOURCES += setupwizardplugin.cpp \
pages/outputpage.cpp \ pages/outputpage.cpp \
pages/inputpage.cpp \ pages/inputpage.cpp \
pages/summarypage.cpp \ pages/summarypage.cpp \
pages/flashpage.cpp \
pages/levellingpage.cpp \ pages/levellingpage.cpp \
levellingutil.cpp \ levellingutil.cpp \
vehicleconfigurationsource.cpp \ vehicleconfigurationsource.cpp \
@ -56,7 +55,8 @@ SOURCES += setupwizardplugin.cpp \
connectiondiagram.cpp \ connectiondiagram.cpp \
pages/outputcalibrationpage.cpp \ pages/outputcalibrationpage.cpp \
outputcalibrationutil.cpp \ outputcalibrationutil.cpp \
pages/rebootpage.cpp pages/rebootpage.cpp \
pages/savepage.cpp
OTHER_FILES += SetupWizard.pluginspec OTHER_FILES += SetupWizard.pluginspec
@ -73,11 +73,11 @@ FORMS += \
pages/outputpage.ui \ pages/outputpage.ui \
pages/inputpage.ui \ pages/inputpage.ui \
pages/summarypage.ui \ pages/summarypage.ui \
pages/flashpage.ui \
pages/levellingpage.ui \ pages/levellingpage.ui \
connectiondiagram.ui \ connectiondiagram.ui \
pages/outputcalibrationpage.ui \ pages/outputcalibrationpage.ui \
pages/rebootpage.ui pages/rebootpage.ui \
pages/savepage.ui
RESOURCES += \ RESOURCES += \
wizardResources.qrc wizardResources.qrc