mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-03 11:24:10 +01:00
OP-39 Added code to jump from the SetupWizard directly to the InputWizard in the ConfigurationPlugin to complete the vehicle setup and realize the 1-2-Fly idea.
Re-factored some code in the ConfigurationPlugin. Fixed a bug in the Levelling page when performing levelling multiple times.
This commit is contained in:
parent
40d5761a1d
commit
86f210e7f4
@ -52,6 +52,7 @@ public:
|
||||
void insertCornerWidget(int index, QWidget *widget);
|
||||
int cornerWidgetCount() { return m_cornerWidgetCount; }
|
||||
QWidget * currentWidget(){return m_stackWidget->currentWidget();}
|
||||
QWidget * getWidget(int index) {return m_stackWidget->widget(index);}
|
||||
|
||||
signals:
|
||||
void currentAboutToShow(int index,bool * proceed);
|
||||
|
@ -25,14 +25,14 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "configgadgetfactory.h"
|
||||
#include "configgadgetwidget.h"
|
||||
#include "configgadget.h"
|
||||
#include "configgadgetconfiguration.h"
|
||||
#include "configgadgetoptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
ConfigGadgetFactory::ConfigGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("ConfigGadget"), tr("Config Gadget"), parent)
|
||||
IUAVGadgetFactory(QString("ConfigGadget"), tr("Config Gadget"), parent),
|
||||
gadgetWidget(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ ConfigGadgetFactory::~ConfigGadgetFactory()
|
||||
|
||||
Core::IUAVGadget* ConfigGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
ConfigGadgetWidget* gadgetWidget = new ConfigGadgetWidget(parent);
|
||||
gadgetWidget = new ConfigGadgetWidget(parent);
|
||||
return new ConfigGadget(QString("ConfigGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
@ -55,3 +55,8 @@ IOptionsPage *ConfigGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *co
|
||||
{
|
||||
return new ConfigGadgetOptionsPage(qobject_cast<ConfigGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
void ConfigGadgetFactory::startInputWizard()
|
||||
{
|
||||
gadgetWidget->startInputWizard();
|
||||
}
|
||||
|
@ -28,6 +28,9 @@
|
||||
#define CONFIGGADGETFACTORY_H
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
#include "configgadgetwidget.h"
|
||||
#include "config_global.h"
|
||||
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
@ -36,7 +39,7 @@ class IUAVGadgetFactory;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ConfigGadgetFactory: public Core::IUAVGadgetFactory
|
||||
class CONFIG_EXPORT ConfigGadgetFactory: public Core::IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -47,6 +50,10 @@ public:
|
||||
IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
void startInputWizard();
|
||||
|
||||
private:
|
||||
ConfigGadgetWidget* gadgetWidget;
|
||||
};
|
||||
|
||||
#endif // CONFIGGADGETFACTORY_H
|
||||
|
@ -127,6 +127,14 @@ ConfigGadgetWidget::~ConfigGadgetWidget()
|
||||
// TODO: properly delete all the tabs in ftw before exiting
|
||||
}
|
||||
|
||||
void ConfigGadgetWidget::startInputWizard()
|
||||
{
|
||||
ftw->setCurrentIndex(ConfigGadgetWidget::input);
|
||||
ConfigInputWidget* inputWidget = dynamic_cast<ConfigInputWidget*>(ftw->getWidget(ConfigGadgetWidget::input));
|
||||
Q_ASSERT(inputWidget);
|
||||
inputWidget->startInputWizard();
|
||||
}
|
||||
|
||||
void ConfigGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
ConfigGadgetWidget(QWidget *parent = 0);
|
||||
~ConfigGadgetWidget();
|
||||
enum widgetTabs {hardware=0, aircraft, input, output, sensors, stabilization, camerastabilization, txpid, pipxtreme};
|
||||
void startInputWizard();
|
||||
|
||||
public slots:
|
||||
void onAutopilotConnect();
|
||||
|
@ -280,6 +280,7 @@ void ConfigInputWidget::openHelp()
|
||||
|
||||
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Input+Configuration", QUrl::StrictMode) );
|
||||
}
|
||||
|
||||
void ConfigInputWidget::goToWizard()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
enum txMovements{moveLeftVerticalStick,moveRightVerticalStick,moveLeftHorizontalStick,moveRightHorizontalStick,moveAccess0,moveAccess1,moveAccess2,moveFlightMode,centerAll,moveAll,nothing};
|
||||
enum txMovementType{vertical,horizontal,jump,mix};
|
||||
enum txType {acro, heli};
|
||||
public slots:
|
||||
void startInputWizard() { goToWizard(); }
|
||||
|
||||
private:
|
||||
bool growing;
|
||||
@ -133,6 +133,7 @@ private:
|
||||
|
||||
void wizardSetUpStep(enum wizardSteps);
|
||||
void wizardTearDownStep(enum wizardSteps);
|
||||
|
||||
private slots:
|
||||
void wzNext();
|
||||
void wzBack();
|
||||
@ -150,11 +151,10 @@ private slots:
|
||||
void invertControls();
|
||||
void simpleCalibration(bool state);
|
||||
void updateCalibration();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
virtual void enableControls(bool enable);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -99,7 +99,7 @@ void ConfigPlugin::extensionsInitialized()
|
||||
|
||||
void ConfigPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,16 +26,32 @@
|
||||
*/
|
||||
#include "endpage.h"
|
||||
#include "ui_endpage.h"
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <configgadgetfactory.h>
|
||||
|
||||
EndPage::EndPage(SetupWizard *wizard, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent),
|
||||
ui(new Ui::EndPage)
|
||||
{
|
||||
setFinalPage(true);
|
||||
ui->setupUi(this);
|
||||
setFinalPage(true);
|
||||
connect(ui->inputWizardButton, SIGNAL(clicked()), this, SLOT(openInputWizard()));
|
||||
}
|
||||
|
||||
EndPage::~EndPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void EndPage::openInputWizard()
|
||||
{
|
||||
Core::ModeManager::instance()->activateModeByWorkspaceName("Configuration");
|
||||
|
||||
getWizard()->close();
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
ConfigGadgetFactory* configGadgetFactory = pm->getObject<ConfigGadgetFactory>();
|
||||
Q_ASSERT(configGadgetFactory);
|
||||
configGadgetFactory->startInputWizard();
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ public:
|
||||
explicit EndPage(SetupWizard *wizard, QWidget *parent = 0);
|
||||
~EndPage();
|
||||
|
||||
private slots:
|
||||
void openInputWizard();
|
||||
|
||||
private:
|
||||
Ui::EndPage *ui;
|
||||
};
|
||||
|
@ -51,16 +51,18 @@ bool LevellingPage::validatePage()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LevellingPage::isComplete()
|
||||
bool LevellingPage::isComplete() const
|
||||
{
|
||||
return getWizard()->isLevellingPerformed();
|
||||
return const_cast<LevellingPage *>(this)->getWizard()->isLevellingPerformed() &&
|
||||
ui->levelButton->isEnabled();
|
||||
}
|
||||
|
||||
void LevellingPage::performLevelling()
|
||||
{
|
||||
if(!getWizard()->getConnectionManager()->isConnected()) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("An OpenPilot controller must be connected to your computer to perform bias calculations.\nPlease connect your OpenPilot controller to continue."));
|
||||
msgBox.setText(tr("An OpenPilot controller must be connected to your computer to perform bias "
|
||||
"calculations.\nPlease connect your OpenPilot controller to continue."));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
@ -69,14 +71,14 @@ void LevellingPage::performLevelling()
|
||||
|
||||
if(!m_levellingUtil)
|
||||
{
|
||||
ui->levelButton->setEnabled(false);
|
||||
|
||||
// Measure every 100ms * 100times = 10s
|
||||
m_levellingUtil = new LevellingUtil(BIAS_CYCLES, BIAS_PERIOD);
|
||||
connect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long)));
|
||||
connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias)));
|
||||
connect(m_levellingUtil, SIGNAL(timeout(QString)), this, SLOT(levellingTimeout(QString)));
|
||||
}
|
||||
connect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long)));
|
||||
connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias)));
|
||||
connect(m_levellingUtil, SIGNAL(timeout(QString)), this, SLOT(levellingTimeout(QString)));
|
||||
ui->levelButton->setEnabled(false);
|
||||
emit completeChanged();
|
||||
m_levellingUtil->start();
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
explicit LevellingPage(SetupWizard *wizard, QWidget *parent = 0);
|
||||
~LevellingPage();
|
||||
bool validatePage();
|
||||
bool isComplete();
|
||||
bool isComplete() const;
|
||||
|
||||
private slots:
|
||||
void performLevelling();
|
||||
|
@ -172,7 +172,7 @@ QString SetupWizard::getSummaryText()
|
||||
|
||||
summary.append('\n');
|
||||
summary.append(tr("ESC type: "));
|
||||
switch (getInputType())
|
||||
switch (getESCType())
|
||||
{
|
||||
case ESC_DEFAULT:
|
||||
summary.append(tr("Default ESC (50 Hz)"));
|
||||
|
@ -6,6 +6,7 @@ QT += svg
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../plugins/uavobjectutil/uavobjectutil.pri)
|
||||
include(../../plugins/config/config.pri)
|
||||
|
||||
HEADERS += setupwizardplugin.h \
|
||||
setupwizard.h \
|
||||
|
Loading…
Reference in New Issue
Block a user