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

Added functionality for skipping autoupdate page if no firmware is available in resource bundle.

This commit is contained in:
Fredrik Arvidsson 2012-10-07 21:49:07 +02:00
parent 4ef8b78ff8
commit c03ac35780
3 changed files with 20 additions and 5 deletions

View File

@ -11,10 +11,10 @@ AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
ui(new Ui::AutoUpdatePage)
{
ui->setupUi(this);
ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance();
UploaderGadgetFactory * uploader=pm->getObject<UploaderGadgetFactory>();
if(!uploader->isAutoUpdateCapable())
wizard->next();//FIXME DOESN'T WORK
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm);
UploaderGadgetFactory *uploader = pm->getObject<UploaderGadgetFactory>();
Q_ASSERT(uploader);
connect(ui->startUpdate,SIGNAL(clicked()),uploader,SIGNAL(autoUpdate()));
connect(uploader,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)),this,SLOT(updateStatus(uploader::AutoUpdateStep,QVariant)));
}

View File

@ -46,6 +46,7 @@
#include "vehicleconfigurationhelper.h"
#include "actuatorsettings.h"
#include "pages/autoupdatepage.h"
#include "uploader/uploadergadgetfactory.h"
SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfigurationSource(),
m_controllerType(CONTROLLER_UNKNOWN),
@ -67,7 +68,11 @@ int SetupWizard::nextId() const
{
switch (currentId()) {
case PAGE_START:
return PAGE_UPDATE;
if(canAutoUpdate()) {
return PAGE_UPDATE;
} else {
return PAGE_CONTROLLER;
}
case PAGE_UPDATE:
return PAGE_CONTROLLER;
case PAGE_CONTROLLER: {
@ -308,3 +313,12 @@ bool SetupWizard::saveHardwareSettings() const
VehicleConfigurationHelper helper(const_cast<SetupWizard *>(this));
return helper.setupHardwareSettings();
}
bool SetupWizard::canAutoUpdate() const
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm);
UploaderGadgetFactory *uploader = pm->getObject<UploaderGadgetFactory>();
Q_ASSERT(uploader);
return uploader->isAutoUpdateCapable();
}

View File

@ -88,6 +88,7 @@ private:
PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END, PAGE_UPDATE};
void createPages();
bool saveHardwareSettings() const;
bool canAutoUpdate() const;
CONTROLLER_TYPE m_controllerType;
VEHICLE_TYPE m_vehicleType;