1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +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>
<copyright>(C) 2010 OpenPilot Project</copyright>
<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_uavobjects
plugin_setupwizard.depends += plugin_config
plugin_setupwizard.depends += plugin_uavsettingsimportexport
SUBDIRS += plugin_setupwizard
# Junsi Powerlog plugin

View File

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

View File

@ -1,11 +1,11 @@
/**
******************************************************************************
*
* @file flashpage.cpp
* @file savepage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup FlashPage
* @addtogroup SavePage
* @{
* @brief
*****************************************************************************/
@ -26,35 +26,35 @@
*/
#include <QMessageBox>
#include "flashpage.h"
#include "ui_flashpage.h"
#include "savepage.h"
#include "ui_savepage.h"
#include "setupwizard.h"
#include "vehicleconfigurationhelper.h"
FlashPage::FlashPage(SetupWizard *wizard, QWidget *parent) :
SavePage::SavePage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::FlashPage), m_successfulWrite(false)
ui(new Ui::SavePage), m_successfulWrite(false)
{
ui->setupUi(this);
connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(writeToController()));
}
FlashPage::~FlashPage()
SavePage::~SavePage()
{
delete ui;
}
bool FlashPage::validatePage()
bool SavePage::validatePage()
{
return true;
}
bool FlashPage::isComplete() const
bool SavePage::isComplete() const
{
return m_successfulWrite;
}
void FlashPage::writeToController()
void SavePage::writeToController()
{
if(!getWizard()->getConnectionManager()->isConnected()) {
QMessageBox msgBox;
@ -79,7 +79,7 @@ void FlashPage::writeToController()
emit completeChanged();
}
void FlashPage::enableButtons(bool enable)
void SavePage::enableButtons(bool enable)
{
ui->saveButton->setEnabled(enable);
getWizard()->button(QWizard::NextButton)->setEnabled(enable);
@ -88,7 +88,7 @@ void FlashPage::enableButtons(bool enable)
QApplication::processEvents();
}
void FlashPage::saveProgress(int total, int current, QString description)
void SavePage::saveProgress(int total, int current, QString description)
{
qDebug() << "Progress " << current << "(" << 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.
* @addtogroup
* @{
* @addtogroup FlashPage
* @addtogroup SavePage
* @{
* @brief
*****************************************************************************/
@ -25,27 +25,27 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FLASHPAGE_H
#define FLASHPAGE_H
#ifndef SAVEPAGE_H
#define SAVEPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class FlashPage;
class SavePage;
}
class FlashPage : public AbstractWizardPage
class SavePage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit FlashPage(SetupWizard *wizard, QWidget *parent = 0);
~FlashPage();
explicit SavePage(SetupWizard *wizard, QWidget *parent = 0);
~SavePage();
bool validatePage();
bool isComplete() const;
private:
Ui::FlashPage *ui;
Ui::SavePage *ui;
bool m_successfulWrite;
void enableButtons(bool enable);
@ -54,4 +54,4 @@ private slots:
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"?>
<ui version="4.0">
<class>FlashPage</class>
<widget class="QWizardPage" name="FlashPage">
<class>SavePage</class>
<widget class="QWizardPage" name="SavePage">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -38,7 +38,7 @@
#include "pages/outputpage.h"
#include "pages/levellingpage.h"
#include "pages/summarypage.h"
#include "pages/flashpage.h"
#include "pages/savepage.h"
#include "pages/notyetimplementedpage.h"
#include "pages/rebootpage.h"
#include "pages/outputcalibrationpage.h"
@ -111,10 +111,10 @@ int SetupWizard::nextId() const
case PAGE_LEVELLING:
return PAGE_CALIBRATION;
case PAGE_CALIBRATION:
return PAGE_FLASH;
return PAGE_SAVE;
case PAGE_SUMMARY:
return PAGE_LEVELLING;
case PAGE_FLASH:
case PAGE_SAVE:
return PAGE_END;
case PAGE_NOTYETIMPLEMENTED:
return PAGE_END;
@ -268,7 +268,7 @@ void SetupWizard::createPages()
setPage(PAGE_LEVELLING, new LevellingPage(this));
setPage(PAGE_CALIBRATION, new OutputCalibrationPage(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_NOTYETIMPLEMENTED, new NotYetImplementedPage(this));
setPage(PAGE_END, new EndPage(this));
@ -278,9 +278,9 @@ void SetupWizard::createPages()
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;
button_layout << QWizard::Stretch << QWizard::CustomButton1 << QWizard::NextButton << QWizard::CancelButton << QWizard::FinishButton;
setButtonLayout(button_layout);
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int)));
}
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
{
VehicleConfigurationHelper helper(const_cast<SetupWizard *>(this));

View File

@ -78,12 +78,14 @@ public:
}
return m_connectionManager;
}
private slots:
void customBackClicked();
void pageChanged(int currId);
private:
enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
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();
bool saveHardwareSettings() const;

View File

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