mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-39 Added reboot page to wizard. User needing to reboot should NOT forget it now.
Added code to invoke Vehicle Setup Wizard and Radio Wizard from Welcome page.
This commit is contained in:
parent
098c0d43fd
commit
806097fd56
@ -29,6 +29,10 @@
|
||||
#include "configgadgetconfiguration.h"
|
||||
#include "configgadgetoptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
|
||||
ConfigGadgetFactory::ConfigGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("ConfigGadget"), tr("Config Gadget"), parent),
|
||||
@ -43,6 +47,25 @@ ConfigGadgetFactory::~ConfigGadgetFactory()
|
||||
Core::IUAVGadget* ConfigGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
gadgetWidget = new ConfigGadgetWidget(parent);
|
||||
|
||||
// Add Menu entry
|
||||
Core::ActionManager* am = Core::ICore::instance()->actionManager();
|
||||
Core::ActionContainer* ac = am->actionContainer(Core::Constants::M_TOOLS);
|
||||
|
||||
Core::Command* cmd = am->registerAction(new QAction(this),
|
||||
"ConfigPlugin.ShowInputWizard",
|
||||
QList<int>() <<
|
||||
Core::Constants::C_GLOBAL_ID);
|
||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+R"));
|
||||
cmd->action()->setText(tr("Radio Setup Wizard"));
|
||||
|
||||
Core::ModeManager::instance()->addAction(cmd, 1);
|
||||
|
||||
ac->appendGroup("Wizard");
|
||||
ac->addAction(cmd, "Wizard");
|
||||
|
||||
connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(startInputWizard()));
|
||||
|
||||
return new ConfigGadget(QString("ConfigGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
@ -60,6 +83,7 @@ void ConfigGadgetFactory::startInputWizard()
|
||||
{
|
||||
if(gadgetWidget)
|
||||
{
|
||||
Core::ModeManager::instance()->activateModeByWorkspaceName("Configuration");
|
||||
gadgetWidget->startInputWizard();
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
|
||||
public slots:
|
||||
void startInputWizard();
|
||||
|
||||
private:
|
||||
|
@ -326,3 +326,13 @@ void ModeManager::setFocusToCurrentMode()
|
||||
widget->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void ModeManager::triggerAction(const QString &actionId)
|
||||
{
|
||||
foreach(Command * command, m_actions.keys()){
|
||||
if(command->action()->objectName() == actionId) {
|
||||
command->action()->trigger();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ public slots:
|
||||
void activateMode(const QString &id);
|
||||
void activateModeByWorkspaceName(const QString &id);
|
||||
void setFocusToCurrentMode();
|
||||
void triggerAction(const QString &actionId);
|
||||
|
||||
private slots:
|
||||
void objectAdded(QObject *obj);
|
||||
|
@ -51,7 +51,7 @@ void EndPage::openInputWizard()
|
||||
ConfigGadgetFactory* configGadgetFactory = pm->getObject<ConfigGadgetFactory>();
|
||||
|
||||
if(configGadgetFactory) {
|
||||
Core::ModeManager::instance()->activateModeByWorkspaceName("Configuration");
|
||||
//Core::ModeManager::instance()->activateModeByWorkspaceName("Configuration");
|
||||
getWizard()->close();
|
||||
configGadgetFactory->startInputWizard();
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file rebootpage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup
|
||||
* @{
|
||||
* @addtogroup RebootPage
|
||||
* @{
|
||||
* @brief
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "rebootpage.h"
|
||||
#include "ui_rebootpage.h"
|
||||
|
||||
RebootPage::RebootPage(SetupWizard *wizard, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent),
|
||||
ui(new Ui::RebootPage), m_toggl(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->yellowLabel->setVisible(false);
|
||||
ui->redLabel->setVisible(true);
|
||||
}
|
||||
|
||||
RebootPage::~RebootPage()
|
||||
{
|
||||
disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(toggleLabel()));
|
||||
m_timer.stop();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RebootPage::initializePage()
|
||||
{
|
||||
connect(&m_timer, SIGNAL(timeout()), this, SLOT(toggleLabel()));
|
||||
m_timer.setInterval(500);
|
||||
m_timer.setSingleShot(false);
|
||||
m_timer.start();
|
||||
}
|
||||
|
||||
bool RebootPage::validatePage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void RebootPage::toggleLabel()
|
||||
{
|
||||
m_toggl = !m_toggl;
|
||||
ui->yellowLabel->setVisible(m_toggl);
|
||||
ui->redLabel->setVisible(!m_toggl);
|
||||
qDebug() << "Toggle = " << m_toggl;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file rebootpage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup
|
||||
* @{
|
||||
* @addtogroup RebootPage
|
||||
* @{
|
||||
* @brief
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef REBOOTPAGE_H
|
||||
#define REBOOTPAGE_H
|
||||
|
||||
#include "abstractwizardpage.h"
|
||||
|
||||
namespace Ui {
|
||||
class RebootPage;
|
||||
}
|
||||
|
||||
class RebootPage : public AbstractWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RebootPage(SetupWizard *wizard, QWidget *parent = 0);
|
||||
~RebootPage();
|
||||
|
||||
void initializePage();
|
||||
bool validatePage();
|
||||
|
||||
private:
|
||||
Ui::RebootPage *ui;
|
||||
QTimer m_timer;
|
||||
bool m_toggl;
|
||||
|
||||
private slots:
|
||||
void toggleLabel();
|
||||
};
|
||||
|
||||
#endif // REBOOTPAGE_H
|
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RebootPage</class>
|
||||
<widget class="QWizardPage" name="RebootPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="redLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>130</y>
|
||||
<width>501</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:18pt; color:#ff0000;">PLEASE REBOOT YOUR CONTROLLER</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>180</y>
|
||||
<width>501</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">The configuration created by the wizard contains settings that require a reboot of your controller. Please power cycle the controller before continuing.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="yellowLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>130</y>
|
||||
<width>501</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:18pt; color:#ffd500;">PLEASE REBOOT YOUR CONTROLLER</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>yellowLabel</zorder>
|
||||
<zorder>redLabel</zorder>
|
||||
<zorder>label_3</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -41,6 +41,7 @@
|
||||
#include "pages/flashpage.h"
|
||||
#include "pages/outputcalibrationpage.h"
|
||||
#include "pages/notyetimplementedpage.h"
|
||||
#include "pages/rebootpage.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "vehicleconfigurationhelper.h"
|
||||
#include "actuatorsettings.h"
|
||||
@ -105,6 +106,13 @@ int SetupWizard::nextId() const
|
||||
case PAGE_SUMMARY:
|
||||
return PAGE_LEVELLING;
|
||||
case PAGE_FLASH:
|
||||
if(isRestartNeeded()) {
|
||||
return PAGE_REBOOT;
|
||||
}
|
||||
else {
|
||||
return PAGE_END;
|
||||
}
|
||||
case PAGE_REBOOT:
|
||||
return PAGE_END;
|
||||
case PAGE_NOTYETIMPLEMENTED:
|
||||
return PAGE_END;
|
||||
@ -251,6 +259,7 @@ void SetupWizard::createPages()
|
||||
setPage(PAGE_CALIBRATION, new OutputCalibrationPage(this));
|
||||
setPage(PAGE_SUMMARY, new SummaryPage(this));
|
||||
setPage(PAGE_FLASH, new FlashPage(this));
|
||||
setPage(PAGE_REBOOT, new RebootPage(this));
|
||||
setPage(PAGE_NOTYETIMPLEMENTED, new NotYetImplementedPage(this));
|
||||
setPage(PAGE_END, new EndPage(this));
|
||||
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
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_END};
|
||||
PAGE_FLASH, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END};
|
||||
void createPages();
|
||||
|
||||
CONTROLLER_TYPE m_controllerType;
|
||||
|
@ -30,7 +30,8 @@ HEADERS += setupwizardplugin.h \
|
||||
vehicleconfigurationhelper.h \
|
||||
connectiondiagram.h \
|
||||
pages/outputcalibrationpage.h \
|
||||
outputcalibrationutil.h
|
||||
outputcalibrationutil.h \
|
||||
pages/rebootpage.h
|
||||
|
||||
SOURCES += setupwizardplugin.cpp \
|
||||
setupwizard.cpp \
|
||||
@ -54,7 +55,8 @@ SOURCES += setupwizardplugin.cpp \
|
||||
vehicleconfigurationhelper.cpp \
|
||||
connectiondiagram.cpp \
|
||||
pages/outputcalibrationpage.cpp \
|
||||
outputcalibrationutil.cpp
|
||||
outputcalibrationutil.cpp \
|
||||
pages/rebootpage.cpp
|
||||
|
||||
OTHER_FILES += SetupWizard.pluginspec
|
||||
|
||||
@ -74,7 +76,8 @@ FORMS += \
|
||||
pages/flashpage.ui \
|
||||
pages/levellingpage.ui \
|
||||
connectiondiagram.ui \
|
||||
pages/outputcalibrationpage.ui
|
||||
pages/outputcalibrationpage.ui \
|
||||
pages/rebootpage.ui
|
||||
|
||||
RESOURCES += \
|
||||
wizardResources.qrc
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <QKeySequence>
|
||||
#include <coreplugin/modemanager.h>
|
||||
|
||||
SetupWizardPlugin::SetupWizardPlugin()
|
||||
{
|
||||
@ -58,8 +59,10 @@ bool SetupWizardPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
"SetupWizardPlugin.ShowSetupWizard",
|
||||
QList<int>() <<
|
||||
Core::Constants::C_GLOBAL_ID);
|
||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+W"));
|
||||
cmd->action()->setText(tr("OpenPilot Setup Wizard"));
|
||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+V"));
|
||||
cmd->action()->setText(tr("Vehicle Setup Wizard"));
|
||||
|
||||
Core::ModeManager::instance()->addAction(cmd, 1);
|
||||
|
||||
ac->menu()->addSeparator();
|
||||
ac->appendGroup("Wizard");
|
||||
|
@ -36,12 +36,12 @@ Rectangle {
|
||||
|
||||
WelcomePageButton {
|
||||
baseIconName: "bttn-vehwizard"
|
||||
onClicked: welcomePlugin.openPage("VehWizard")
|
||||
onClicked: welcomePlugin.triggerAction("SetupWizardPlugin.ShowSetupWizard")
|
||||
}
|
||||
|
||||
WelcomePageButton {
|
||||
baseIconName: "bttn-txwizard"
|
||||
onClicked: welcomePlugin.openPage("TxWizard")
|
||||
onClicked: welcomePlugin.triggerAction("ConfigPlugin.ShowInputWizard")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,4 +127,9 @@ void WelcomeMode::openPage(const QString &page)
|
||||
Core::ModeManager::instance()->activateModeByWorkspaceName(page);
|
||||
}
|
||||
|
||||
void WelcomeMode::triggerAction(const QString &actionId)
|
||||
{
|
||||
Core::ModeManager::instance()->triggerAction(actionId);
|
||||
}
|
||||
|
||||
} // namespace Welcome
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
public slots:
|
||||
void openUrl(const QString &url);
|
||||
void openPage(const QString &page);
|
||||
void triggerAction(const QString &actionId);
|
||||
|
||||
private:
|
||||
WelcomeModePrivate *m_d;
|
||||
|
Loading…
x
Reference in New Issue
Block a user