1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Merge branch 'next' of ssh://git.openpilot.org/OpenPilot into pt/CC3D_Release

This commit is contained in:
PT_Dreamer 2012-07-24 20:29:59 +01:00
commit 667276cd61
39 changed files with 2455 additions and 81 deletions

View File

@ -44,15 +44,15 @@ namespace Core {
ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, QTabWidget *modeStack) :
QWidget(mainWindow), // Pip
m_availableDevList(0),
QWidget(mainWindow), // Pip
m_availableDevList(0),
m_connectBtn(0),
m_ioDev(NULL),
m_mainWindow(mainWindow)
m_ioDev(NULL),
m_mainWindow(mainWindow)
{
// Q_UNUSED(mainWindow);
// Q_UNUSED(mainWindow);
/* QVBoxLayout *top = new QVBoxLayout;
/* QVBoxLayout *top = new QVBoxLayout;
top->setSpacing(0);
top->setMargin(0);*/
@ -72,7 +72,7 @@ ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, QTabWidge
m_connectBtn->setEnabled(false);
layout->addWidget(m_connectBtn);
/* Utils::StyledBar *bar = new Utils::StyledBar;
/* Utils::StyledBar *bar = new Utils::StyledBar;
bar->setLayout(layout);
top->addWidget(bar);*/
@ -81,33 +81,29 @@ ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, QTabWidge
// modeStack->insertCornerWidget(modeStack->cornerWidgetCount()-1, this);
modeStack->setCornerWidget(this, Qt::TopRightCorner);
QObject::connect(m_connectBtn, SIGNAL(pressed()), this, SLOT(onConnectPressed()));
QObject::connect(m_connectBtn, SIGNAL(pressed()), this, SLOT(onConnectPressed()));
}
ConnectionManager::~ConnectionManager()
{
disconnectDevice(); // Pip
suspendPolling(); // Pip
disconnectDevice(); // Pip
suspendPolling(); // Pip
}
void ConnectionManager::init()
{
//register to the plugin manager so we can receive
//new connection object from plugins
QObject::connect(ExtensionSystem::PluginManager::instance(), SIGNAL(objectAdded(QObject*)), this, SLOT(objectAdded(QObject*)));
QObject::connect(ExtensionSystem::PluginManager::instance(), SIGNAL(aboutToRemoveObject(QObject*)), this, SLOT(aboutToRemoveObject(QObject*)));
QObject::connect(ExtensionSystem::PluginManager::instance(), SIGNAL(objectAdded(QObject*)), this, SLOT(objectAdded(QObject*)));
QObject::connect(ExtensionSystem::PluginManager::instance(), SIGNAL(aboutToRemoveObject(QObject*)), this, SLOT(aboutToRemoveObject(QObject*)));
}
/**
* Method called when the user clicks the "Connect" button
*/
bool ConnectionManager::connectDevice()
bool ConnectionManager::connectDevice(devListItem device)
{
devListItem connection_device = findDevice(m_availableDevList->itemData(m_availableDevList->currentIndex(),Qt::ToolTipRole).toString());
if (!connection_device.connection)
return false;
QIODevice *io_dev = connection_device.connection->openDevice(connection_device.Name);
QIODevice *io_dev = device.connection->openDevice(device.Name);
if (!io_dev)
return false;
@ -115,23 +111,23 @@ bool ConnectionManager::connectDevice()
// check if opening the device worked
if (!io_dev->isOpen()) {
qDebug() << "Error: io_dev->isOpen() returned FALSE .. could not open connection to " << connection_device.devName
qDebug() << "Error: io_dev->isOpen() returned FALSE .. could not open connection to " << device.devName
<< ": " << io_dev->errorString();
// close the device
// EDOUARD: why do we close if we could not open ???
try {
connection_device.connection->closeDevice(connection_device.devName);
device.connection->closeDevice(device.devName);
}
catch (...) { // handle exception
qDebug() << "Exception: connection_device.connection->closeDevice(" << connection_device.devName << ")";
qDebug() << "Exception: connection_device.connection->closeDevice(" << device.devName << ")";
}
return false;
}
// we appear to have connected to the device OK
// remember the connection/device details
m_connectionDevice = connection_device;
m_connectionDevice = device;
m_ioDev = io_dev;
connect(m_connectionDevice.connection, SIGNAL(destroyed(QObject *)), this, SLOT(onConnectionDestroyed(QObject *)), Qt::QueuedConnection);
@ -171,6 +167,8 @@ bool ConnectionManager::disconnectDevice()
m_connectionDevice.connection = NULL;
m_ioDev = NULL;
emit deviceDisconnected();
m_connectBtn->setText("Connect");
m_availableDevList->setEnabled(true);
@ -184,7 +182,7 @@ void ConnectionManager::objectAdded(QObject *obj)
{
//Check if a plugin added a connection object to the pool
IConnection *connection = Aggregation::query<IConnection>(obj);
if (!connection) return;
if (!connection) return;
//qDebug() << "Connection object registered:" << connection->connectionName();
//qDebug() << connection->availableDevices();
@ -196,23 +194,23 @@ void ConnectionManager::objectAdded(QObject *obj)
// to do things
m_connectionsList.append(connection);
QObject::connect(connection, SIGNAL(availableDevChanged(IConnection *)), this, SLOT(devChanged(IConnection *)));
QObject::connect(connection, SIGNAL(availableDevChanged(IConnection *)), this, SLOT(devChanged(IConnection *)));
}
void ConnectionManager::aboutToRemoveObject(QObject *obj)
{
//Check if a plugin added a connection object to the pool
IConnection *connection = Aggregation::query<IConnection>(obj);
if (!connection) return;
if (!connection) return;
if (m_connectionDevice.connection && m_connectionDevice.connection == connection) // Pip
{ // we are currently using the one that is about to be removed
m_connectionDevice.connection = NULL;
m_ioDev = NULL;
}
if (m_connectionDevice.connection && m_connectionDevice.connection == connection) // Pip
{ // we are currently using the one that is about to be removed
m_connectionDevice.connection = NULL;
m_ioDev = NULL;
}
if (m_connectionsList.contains(connection))
m_connectionsList.removeAt(m_connectionsList.indexOf(connection));
if (m_connectionsList.contains(connection))
m_connectionsList.removeAt(m_connectionsList.indexOf(connection));
}
@ -230,8 +228,11 @@ void ConnectionManager::onConnectPressed()
{
// Check if we have a ioDev already created:
if (!m_ioDev)
{ // connecting
connectDevice();
{
// connecting to currently selected device
devListItem device = findDevice(m_availableDevList->itemData(m_availableDevList->currentIndex(), Qt::ToolTipRole).toString());
if (device.connection)
connectDevice(device);
}
else
{ // disconnecting
@ -244,9 +245,9 @@ void ConnectionManager::onConnectPressed()
*/
devListItem ConnectionManager::findDevice(const QString &devName)
{
foreach (devListItem d, m_devList)
foreach (devListItem d, m_devList)
{
if (d.devName == devName)
if (d.devName == devName)
return d;
}
@ -264,13 +265,13 @@ devListItem ConnectionManager::findDevice(const QString &devName)
*/
void ConnectionManager::suspendPolling()
{
foreach (IConnection *cnx, m_connectionsList)
{
foreach (IConnection *cnx, m_connectionsList)
{
cnx->suspendPolling();
}
m_connectBtn->setEnabled(false);
m_availableDevList->setEnabled(false);
m_connectBtn->setEnabled(false);
m_availableDevList->setEnabled(false);
}
/**
@ -279,13 +280,13 @@ void ConnectionManager::suspendPolling()
*/
void ConnectionManager::resumePolling()
{
foreach (IConnection *cnx, m_connectionsList)
{
foreach (IConnection *cnx, m_connectionsList)
{
cnx->resumePolling();
}
m_connectBtn->setEnabled(true);
m_availableDevList->setEnabled(true);
m_connectBtn->setEnabled(true);
m_availableDevList->setEnabled(true);
}
/**
@ -294,21 +295,21 @@ void ConnectionManager::resumePolling()
*/
void ConnectionManager::unregisterAll(IConnection *connection)
{
for (QLinkedList<devListItem>::iterator iter = m_devList.begin(); iter != m_devList.end(); )
{
if (iter->connection == connection)
{
if (m_connectionDevice.connection && m_connectionDevice.connection == connection)
{ // we are currently using the one we are about to erase
//onConnectionClosed(m_connectionDevice.connection);
disconnectDevice();
}
for (QLinkedList<devListItem>::iterator iter = m_devList.begin(); iter != m_devList.end(); )
{
if (iter->connection == connection)
{
if (m_connectionDevice.connection && m_connectionDevice.connection == connection)
{ // we are currently using the one we are about to erase
//onConnectionClosed(m_connectionDevice.connection);
disconnectDevice();
}
iter = m_devList.erase(iter);
}
else
++iter;
}
iter = m_devList.erase(iter);
}
else
++iter;
}
}
/**
@ -347,7 +348,7 @@ void ConnectionManager::devChanged(IConnection *connection)
unregisterAll(connection);
//and add them back in the list
QList <IConnection::device> availableDev = connection->availableDevices();
QList<IConnection::device> availableDev = connection->availableDevices();
foreach (IConnection::device dev, availableDev)
{
QString cbName = connection->shortName() + ": " + dev.name;
@ -355,32 +356,35 @@ void ConnectionManager::devChanged(IConnection *connection)
registerDevice(connection,cbName,dev.name,disp);
}
qDebug() << "# devices " << m_devList.count();
emit availableDevicesChanged(m_devList);
//add all the list again to the combobox
foreach (devListItem d, m_devList)
foreach (devListItem device, m_devList)
{
m_availableDevList->addItem(d.displayName);
m_availableDevList->setItemData(m_availableDevList->count()-1,(const QString)d.devName,Qt::ToolTipRole);
if(!m_ioDev && d.displayName.startsWith("USB"))
m_availableDevList->addItem(device.displayName);
m_availableDevList->setItemData(m_availableDevList->count() - 1, (const QString)device.devName,Qt::ToolTipRole);
if(!m_ioDev && device.displayName.startsWith("USB"))
{
if(m_mainWindow->generalSettings()->autoConnect() || m_mainWindow->generalSettings()->autoSelect())
m_availableDevList->setCurrentIndex(m_availableDevList->count()-1);
m_availableDevList->setCurrentIndex(m_availableDevList->count() - 1);
if(m_mainWindow->generalSettings()->autoConnect())
{
connectDevice();
qDebug()<<"ConnectionManager::devChanged autoconnected USB device";
connectDevice(device);
qDebug() << "ConnectionManager::devChanged autoconnected USB device";
}
}
}
if(m_ioDev)//if a device is connected make it the one selected on the dropbox
{
for(int x=0;x<m_availableDevList->count();++x)
for(int x=0; x < m_availableDevList->count(); ++x)
{
if(m_connectionDevice.devName==m_availableDevList->itemData(x,Qt::ToolTipRole).toString())
m_availableDevList->setCurrentIndex(x);
}
}
//disable connection button if the liNameif (m_availableDevList->count() > 0)
if (m_availableDevList->count() > 0)
m_connectBtn->setEnabled(true);
@ -388,7 +392,7 @@ void ConnectionManager::devChanged(IConnection *connection)
m_connectBtn->setEnabled(false);
}
}
void Core::ConnectionManager::connectionsCallBack()
{
@ -398,4 +402,5 @@ void Core::ConnectionManager::connectionsCallBack()
}
connectionBackup.clear();
disconnect(ExtensionSystem::PluginManager::instance(),SIGNAL(pluginsLoadEnded()),this,SLOT(connectionsCallBack()));
}
} //namespace Core

View File

@ -46,12 +46,12 @@ QT_END_NAMESPACE
namespace Core {
class IConnection;
class IConnection;
namespace Internal {
class FancyTabWidget;
class FancyActionBar;
class MainWindow;
class FancyTabWidget;
class FancyActionBar;
class MainWindow;
} // namespace Internal
@ -75,19 +75,28 @@ public:
void init();
QIODevice* getCurrentConnection() { return m_ioDev; }
devListItem getCurrentDevice() { return m_connectionDevice;}
devListItem getCurrentDevice() { return m_connectionDevice; }
devListItem findDevice(const QString &devName);
QLinkedList<devListItem> getAvailableDevices() { return m_devList; }
bool isConnected() { return m_ioDev != 0; }
bool connectDevice(devListItem device);
bool disconnectDevice();
void suspendPolling();
void resumePolling();
protected:
void unregisterAll(IConnection *connection);
void registerDevice(IConnection *conn, const QString &devN, const QString &name, const QString &disp);
devListItem findDevice(const QString &devName);
signals:
void deviceConnected(QIODevice *dev);
void deviceDisconnected();
void deviceAboutToDisconnect();
void availableDevicesChanged(const QLinkedList<Core::devListItem> devices);
private slots:
void objectAdded(QObject *obj);
@ -96,9 +105,9 @@ private slots:
void onConnectPressed();
void devChanged(IConnection *connection);
// void onConnectionClosed(QObject *obj);
void onConnectionDestroyed(QObject *obj);
void connectionsCallBack(); //used to call devChange after all the plugins are loaded
// void onConnectionClosed(QObject *obj);
void onConnectionDestroyed(QObject *obj);
void connectionsCallBack(); //used to call devChange after all the plugins are loaded
protected:
QComboBox *m_availableDevList;
QPushButton *m_connectBtn;
@ -112,9 +121,8 @@ protected:
QIODevice *m_ioDev;
private:
bool connectDevice();
Internal::MainWindow *m_mainWindow;
QList <IConnection *> connectionBackup;
Internal::MainWindow *m_mainWindow;
QList <IConnection *> connectionBackup;
};

View File

@ -210,6 +210,13 @@ plugin_uavobjectwidgetutils.depends += plugin_uavobjects
plugin_uavobjectwidgetutils.depends += plugin_uavsettingsimportexport
SUBDIRS += plugin_uavobjectwidgetutils
# Setup Wizard plugin
plugin_setupwizard.subdir = setupwizard
plugin_setupwizard.depends = plugin_coreplugin
plugin_setupwizard.depends += plugin_uavobjects
plugin_setupwizard.depends += plugin_uavsettingsimportexport
SUBDIRS += plugin_setupwizard
# Junsi Powerlog plugin
#plugin_powerlog.subdir = powerlog
#plugin_powerlog.depends = plugin_coreplugin

View File

@ -0,0 +1,10 @@
<plugin name="SetupWizard" version="1.0.0" compatVersion="1.0.0">
<vendor>The OpenPilot Project</vendor>
<copyright>(C) 2012 OpenPilot Project</copyright>
<license>The GNU Public License (GPL) Version 3</license>
<description>A plugin that provides a setup wizard for easy initial setup of airframes.</description>
<url>http://www.openpilot.org</url>
<dependencyList>
<dependency name="Core" version="1.0.0"/>
</dependencyList>
</plugin>

View File

@ -0,0 +1,35 @@
/**
******************************************************************************
*
* @file abstractwizardpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup AbstractWizardPage
* @{
* @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 "abstractwizardpage.h"
AbstractWizardPage::AbstractWizardPage(SetupWizard* wizard, QWidget *parent) :
QWizardPage(parent)
{
m_wizard = wizard;
setFixedSize(600, 400);
}

View File

@ -0,0 +1,48 @@
/**
******************************************************************************
*
* @file abstractwizardpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup AbstractWizardPage
* @{
* @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 ABSTRACTWIZARDPAGE_H
#define ABSTRACTWIZARDPAGE_H
#include <QWizardPage>
#include "setupwizard.h"
class AbstractWizardPage : public QWizardPage
{
Q_OBJECT
protected:
explicit AbstractWizardPage(SetupWizard *wizard, QWidget *parent = 0);
private:
SetupWizard *m_wizard;
public:
SetupWizard* getWizard() { return m_wizard; }
};
#endif // ABSTRACTWIZARDPAGE_H

View File

@ -0,0 +1,225 @@
/**
******************************************************************************
*
* @file controllerpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup ControllerPage
* @{
* @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 "controllerpage.h"
#include "ui_controllerpage.h"
#include "setupwizard.h"
#include <extensionsystem/pluginmanager.h>
#include <uavobjectutil/uavobjectutilmanager.h>
ControllerPage::ControllerPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::ControllerPage)
{
ui->setupUi(this);
m_connectionManager = Core::ICore::instance()->connectionManager();
Q_ASSERT(m_connectionManager);
connect(m_connectionManager, SIGNAL(availableDevicesChanged(QLinkedList<Core::devListItem>)), this, SLOT(devicesChanged(QLinkedList<Core::devListItem>)));
connect(m_connectionManager, SIGNAL(deviceConnected(QIODevice*)), this, SLOT(connectionStatusChanged()));
connect(m_connectionManager, SIGNAL(deviceDisconnected()), this, SLOT(connectionStatusChanged()));
connect(ui->manualCB, SIGNAL(toggled(bool)), this, SLOT(identificationModeChanged()));
connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectDisconnect()));
setupBoardTypes();
setupDeviceList();
}
ControllerPage::~ControllerPage()
{
delete ui;
}
void ControllerPage::initializePage()
{
if(anyControllerConnected()) {
SetupWizard::CONTROLLER_TYPE type = getControllerType();
setControllerType(type);
}
else {
setControllerType(SetupWizard::CONTROLLER_UNKNOWN);
}
emit completeChanged();
}
bool ControllerPage::isComplete() const
{
return (ui->manualCB->isChecked() && ui->boardTypeCombo->currentIndex() > 0) ||
(!ui->manualCB->isChecked() && m_connectionManager->isConnected() && ui->boardTypeCombo->currentIndex() > 0);
}
bool ControllerPage::validatePage()
{
getWizard()->setControllerType((SetupWizard::CONTROLLER_TYPE)ui->boardTypeCombo->itemData(ui->boardTypeCombo->currentIndex()).toInt());
return true;
}
bool ControllerPage::anyControllerConnected()
{
return m_connectionManager->isConnected();
}
SetupWizard::CONTROLLER_TYPE ControllerPage::getControllerType()
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
int id = utilMngr->getBoardModel();
switch (id) {
case 0x0301:
return SetupWizard::CONTROLLER_PIPX;
case 0x0401:
return SetupWizard::CONTROLLER_CC;
case 0x0402:
return SetupWizard::CONTROLLER_CC3D;
case 0x0901:
return SetupWizard::CONTROLLER_REVO;
default:
return SetupWizard::CONTROLLER_UNKNOWN;
}
}
void ControllerPage::setupDeviceList()
{
devicesChanged(m_connectionManager->getAvailableDevices());
connectionStatusChanged();
}
void ControllerPage::setupBoardTypes()
{
QVariant v(0);
ui->boardTypeCombo->addItem("<Unknown>", SetupWizard::CONTROLLER_UNKNOWN);
ui->boardTypeCombo->addItem("OpenPilot CopterControl (CC)", SetupWizard::CONTROLLER_CC);
ui->boardTypeCombo->addItem("OpenPilot CopterControl (CC3D)", SetupWizard::CONTROLLER_CC3D);
ui->boardTypeCombo->addItem("OpenPilot Revolution", SetupWizard::CONTROLLER_REVO);
ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(ui->boardTypeCombo->count() - 1, 0), v, Qt::UserRole - 1);
ui->boardTypeCombo->addItem("OP PipX Modem", SetupWizard::CONTROLLER_PIPX);
ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(ui->boardTypeCombo->count() - 1, 0), v, Qt::UserRole - 1);
}
void ControllerPage::setControllerType(SetupWizard::CONTROLLER_TYPE type)
{
for(int i = 0; i < ui->boardTypeCombo->count(); ++i) {
if(ui->boardTypeCombo->itemData(i) == type) {
ui->boardTypeCombo->setCurrentIndex(i);
break;
}
}
}
void ControllerPage::devicesChanged(QLinkedList<Core::devListItem> devices)
{
// Get the selected item before the update if any
QString currSelectedDeviceName = ui->deviceCombo->currentIndex() != -1 ?
ui->deviceCombo->itemData(ui->deviceCombo->currentIndex(), Qt::ToolTipRole).toString() : "";
// Clear the box
ui->deviceCombo->clear();
int indexOfSelectedItem = -1;
int i = 0;
// Loop and fill the combo with items from connectionmanager
foreach (Core::devListItem device, devices)
{
ui->deviceCombo->addItem(device.displayName);
QString deviceName = (const QString)device.devName;
ui->deviceCombo->setItemData(ui->deviceCombo->count() - 1, deviceName, Qt::ToolTipRole);
if(currSelectedDeviceName != "" && currSelectedDeviceName == deviceName) {
indexOfSelectedItem = i;
}
i++;
}
// Re select the item that was selected before if any
if(indexOfSelectedItem != -1) {
ui->deviceCombo->setCurrentIndex(indexOfSelectedItem);
}
connectionStatusChanged();
}
void ControllerPage::connectionStatusChanged()
{
if(m_connectionManager->isConnected()) {
ui->deviceCombo->setEnabled(false);
ui->connectButton->setText(tr("Disconnect"));
ui->boardTypeCombo->setEnabled(false);
ui->manualCB->setEnabled(false);
QString connectedDeviceName = m_connectionManager->getCurrentDevice().devName;
for(int i = 0; i < ui->deviceCombo->count(); ++i) {
if(connectedDeviceName == ui->deviceCombo->itemData(i, Qt::ToolTipRole).toString()) {
ui->deviceCombo->setCurrentIndex(i);
break;
}
}
SetupWizard::CONTROLLER_TYPE type = getControllerType();
setControllerType(type);
}
else {
ui->deviceCombo->setEnabled(true);
ui->connectButton->setText(tr("Connect"));
ui->boardTypeCombo->setEnabled(false);
ui->manualCB->setEnabled(true);
ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(0, 0), QVariant(0), Qt::UserRole - 1);
setControllerType(SetupWizard::CONTROLLER_UNKNOWN);
}
emit completeChanged();
}
void ControllerPage::identificationModeChanged()
{
if(ui->manualCB->isChecked()) {
ui->deviceCombo->setEnabled(false);
ui->boardTypeCombo->setEnabled(true);
ui->connectButton->setEnabled(false);
ui->boardTypeCombo->setCurrentIndex(1);
ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(0, 0), QVariant(0), Qt::UserRole - 1);
}
else {
ui->connectButton->setEnabled(ui->deviceCombo->count() > 0);
ui->deviceCombo->setEnabled(!m_connectionManager->isConnected());
ui->boardTypeCombo->model()->setData(ui->boardTypeCombo->model()->index(0, 0), QVariant(1), Qt::UserRole - 1);
ui->boardTypeCombo->setCurrentIndex(0);
ui->boardTypeCombo->setEnabled(false);
}
emit completeChanged();
}
void ControllerPage::connectDisconnect()
{
if(m_connectionManager->isConnected()) {
m_connectionManager->disconnectDevice();
}
else {
m_connectionManager->connectDevice(m_connectionManager->findDevice(ui->deviceCombo->itemData(ui->deviceCombo->currentIndex(), Qt::ToolTipRole).toString()));
}
emit completeChanged();
}

View File

@ -0,0 +1,67 @@
/**
******************************************************************************
*
* @file controllerpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup ControllerPage
* @{
* @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 CONTROLLERPAGE_H
#define CONTROLLERPAGE_H
#include <coreplugin/icore.h>
#include <coreplugin/connectionmanager.h>
#include "setupwizard.h"
#include "abstractwizardpage.h"
namespace Ui {
class ControllerPage;
}
class ControllerPage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit ControllerPage(SetupWizard *wizard, QWidget *parent = 0);
~ControllerPage();
void initializePage();
bool isComplete() const;
bool validatePage();
private:
Ui::ControllerPage *ui;
bool anyControllerConnected();
SetupWizard::CONTROLLER_TYPE getControllerType();
void setupDeviceList();
void setupBoardTypes();
void setControllerType(SetupWizard::CONTROLLER_TYPE type);
Core::ConnectionManager *m_connectionManager;
private slots:
void devicesChanged(QLinkedList<Core::devListItem> devices);
void connectionStatusChanged();
void identificationModeChanged();
void connectDisconnect();
};
#endif // CONTROLLERPAGE_H

View File

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ControllerPage</class>
<widget class="QWizardPage" name="ControllerPage">
<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="label">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>550</width>
<height>241</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot board identification&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;To continue we need to know what kind of OpenPilot board you want the wizard to create a configuration for. The wizard will try to automatically detect what type of board you have connected.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Please connect the board to a free usb port on your computer, or if a serial modem like BlueTooth, PipX or other is used, then power up the board and select the device to connect with from the list below. Then press Connect.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;If the board already is connected and succesfully detected the board type will allready be displayed. You can disconnect and select another device if you need to detect another board.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;If your board isnt detected or if you want to create a configuration for a board that is not connected. Then select the Manual selection option below and select the board type from the drop down menu.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>270</y>
<width>560</width>
<height>110</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="title">
<string>OpenPilot board type</string>
</property>
<widget class="QComboBox" name="boardTypeCombo">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>150</x>
<y>70</y>
<width>260</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="deviceCombo">
<property name="geometry">
<rect>
<x>150</x>
<y>30</y>
<width>260</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="connectButton">
<property name="geometry">
<rect>
<x>434</x>
<y>70</y>
<width>111</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Connect</string>
</property>
</widget>
<widget class="QCheckBox" name="manualCB">
<property name="geometry">
<rect>
<x>441</x>
<y>33</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Manual selection</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>32</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Connection device:</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>20</x>
<y>72</y>
<width>131</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Detected board type:</string>
</property>
</widget>
<zorder>deviceCombo</zorder>
<zorder>connectButton</zorder>
<zorder>boardTypeCombo</zorder>
<zorder>manualCB</zorder>
<zorder>label_2</zorder>
<zorder>label_3</zorder>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,41 @@
/**
******************************************************************************
*
* @file endpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup Setup Wizard Plugin
* @{
* @brief A Wizard to make the initial setup easy for everyone.
*****************************************************************************/
/*
* 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 "endpage.h"
#include "ui_endpage.h"
EndPage::EndPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::EndPage)
{
setFinalPage(true);
ui->setupUi(this);
}
EndPage::~EndPage()
{
delete ui;
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file endpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup
* @{
* @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 ENDPAGE_H
#define ENDPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class EndPage;
}
class EndPage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit EndPage(SetupWizard *wizard, QWidget *parent = 0);
~EndPage();
private:
Ui::EndPage *ui;
};
#endif // ENDPAGE_H

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EndPage</class>
<widget class="QWizardPage" name="EndPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>600</width>
<height>400</height>
</size>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>550</width>
<height>141</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Setup complete&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;The wizard have now gathered enough information to create a baseline configuration for your OpenPilot controller board to use with your vehicle.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;You now have two choices:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;- Upload configuration directly to the currently connected OpenPilot controller board.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;- Save the configuration to a file for later uploading using the configuration import plugin in GCS.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="saveButton">
<property name="geometry">
<rect>
<x>420</x>
<y>290</y>
<width>125</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Save configuration...</string>
</property>
</widget>
<widget class="QPushButton" name="uploadButton">
<property name="geometry">
<rect>
<x>420</x>
<y>340</y>
<width>125</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Upload configuration</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
*
* @file fixedwingpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup FixedWingPage
* @{
* @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 "fixedwingpage.h"
#include "ui_fixedwingpage.h"
FixedWingPage::FixedWingPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::FixedWingPage)
{
ui->setupUi(this);
setFinalPage(true);
}
FixedWingPage::~FixedWingPage()
{
delete ui;
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file fixedwingpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup FixedWingPage
* @{
* @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 FIXEDWINGPAGE_H
#define FIXEDWINGPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class FixedWingPage;
}
class FixedWingPage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit FixedWingPage(SetupWizard *wizard, QWidget *parent = 0);
~FixedWingPage();
private:
Ui::FixedWingPage *ui;
};
#endif // FIXEDWINGPAGE_H

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FixedWingPage</class>
<widget class="QWizardPage" name="FixedWingPage">
<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="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>160</y>
<width>500</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;The fixed wing part the OpenPilot Setup Wizard is not yet implemented&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
*
* @file helipage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup HeliPage
* @{
* @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 "helipage.h"
#include "ui_helipage.h"
HeliPage::HeliPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::HeliPage)
{
ui->setupUi(this);
setFinalPage(true);
}
HeliPage::~HeliPage()
{
delete ui;
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file helipage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup HeliPage
* @{
* @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 HELIPAGE_H
#define HELIPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class HeliPage;
}
class HeliPage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit HeliPage(SetupWizard *wizard, QWidget *parent = 0);
~HeliPage();
private:
Ui::HeliPage *ui;
};
#endif // HELIPAGE_H

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HeliPage</class>
<widget class="QWizardPage" name="HeliPage">
<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="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>160</y>
<width>500</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;The helicopter part the OpenPilot Setup Wizard is not yet implemented&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,125 @@
/**
******************************************************************************
*
* @file multipage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup MultiPage
* @{
* @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 "multipage.h"
#include "ui_multipage.h"
#include "setupwizard.h"
MultiPage::MultiPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::MultiPage)
{
ui->setupUi(this);
QSvgRenderer *renderer = new QSvgRenderer();
renderer->load(QString(":/configgadget/images/multirotor-shapes.svg"));
multiPic = new QGraphicsSvgItem();
multiPic->setSharedRenderer(renderer);
QGraphicsScene *scene = new QGraphicsScene(this);
scene->addItem(multiPic);
ui->typeGraphicsView->setScene(scene);
setupMultiTypesCombo();
// Default to Quad X since it is the most common setup
ui->typeCombo->setCurrentIndex(1);
connect(ui->typeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateImageAndDescription()));
}
MultiPage::~MultiPage()
{
delete ui;
}
void MultiPage::initializePage()
{
updateImageAndDescription();
}
void MultiPage::setupMultiTypesCombo()
{
ui->typeCombo->addItem("Tricopter", SetupWizard::MULTI_ROTOR_TRI_Y);
ui->typeCombo->addItem("Quadcopter X", SetupWizard::MULTI_ROTOR_QUAD_X);
ui->typeCombo->addItem("Quadcopter +", SetupWizard::MULTI_ROTOR_QUAD_PLUS);
ui->typeCombo->addItem("Hexacopter", SetupWizard::MULTI_ROTOR_HEXA);
ui->typeCombo->addItem("Hexacopter Coax", SetupWizard::MULTI_ROTOR_HEXA_COAX_Y);
ui->typeCombo->addItem("Hexacopter H", SetupWizard::MULTI_ROTOR_HEXA_H);
ui->typeCombo->addItem("Octocopter", SetupWizard::MULTI_ROTOR_OCTO);
ui->typeCombo->addItem("Octocopter Coax X", SetupWizard::MULTI_ROTOR_OCTO_COAX_X);
ui->typeCombo->addItem("Octocopter Coax +", SetupWizard::MULTI_ROTOR_OCTO_COAX_PLUS);
ui->typeCombo->addItem("Octocopter V", SetupWizard::MULTI_ROTOR_OCTO_V);
}
void MultiPage::updateImageAndDescription()
{
SetupWizard::MULTI_ROTOR_SUB_TYPE type = (SetupWizard::MULTI_ROTOR_SUB_TYPE) ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();
QString elementId = "";
QString description = "Descriptive text with information about ";
description.append(ui->typeCombo->currentText());
description.append(" multirotors.");
switch(type)
{
case SetupWizard::MULTI_ROTOR_TRI_Y:
elementId = "tri";
break;
case SetupWizard::MULTI_ROTOR_QUAD_X:
elementId = "quad-x";
break;
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
elementId = "quad-plus";
break;
case SetupWizard::MULTI_ROTOR_HEXA:
elementId = "quad-hexa";
break;
case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
elementId = "hexa-coax";
break;
case SetupWizard::MULTI_ROTOR_HEXA_H:
elementId = "quad-hexa-H";
break;
case SetupWizard::MULTI_ROTOR_OCTO:
elementId = "quad-octo";
break;
case SetupWizard::MULTI_ROTOR_OCTO_COAX_X:
elementId = "octo-coax-X";
break;
case SetupWizard::MULTI_ROTOR_OCTO_COAX_PLUS:
elementId = "octo-coax-P";
break;
case SetupWizard::MULTI_ROTOR_OCTO_V:
elementId = "quad-octo-v";
break;
default:
elementId = "";
break;
}
multiPic->setElementId(elementId);
ui->typeGraphicsView->setSceneRect(multiPic->boundingRect());
ui->typeGraphicsView->fitInView(multiPic, Qt::KeepAspectRatio);
ui->typeDescription->setText(description);
}

View File

@ -0,0 +1,59 @@
/**
******************************************************************************
*
* @file multipage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup MultiPage
* @{
* @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 MULTIPAGE_H
#define MULTIPAGE_H
#include <QtSvg/QGraphicsSvgItem>
#include <QtSvg/QSvgRenderer>
#include "abstractwizardpage.h"
namespace Ui {
class MultiPage;
}
class MultiPage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit MultiPage(SetupWizard *wizard, QWidget *parent = 0);
~MultiPage();
void initializePage();
private:
Ui::MultiPage *ui;
void setupMultiTypesCombo();
QGraphicsSvgItem *multiPic;
private slots:
void updateImageAndDescription();
};
#endif // MULTIPAGE_H

View File

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MultiPage</class>
<widget class="QWizardPage" name="MultiPage">
<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="label">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>541</width>
<height>151</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;OpenPilot multirotor configuration&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;This part of the wizard will set up the OpenPilot controller for use with a flying platform with multiple rotors. The wizard supports the most common types of multirotors. Other variants of multirotors can be configured by using custom configuration options in the configuration plugin in GCS.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Please select the type of multirotor you want to create a configuration for below:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>180</y>
<width>561</width>
<height>200</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="title">
<string>Multirotor type selection</string>
</property>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>32</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Multirotor type:</string>
</property>
</widget>
<widget class="QComboBox" name="typeCombo">
<property name="geometry">
<rect>
<x>150</x>
<y>30</y>
<width>220</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QGraphicsView" name="typeGraphicsView">
<property name="geometry">
<rect>
<x>390</x>
<y>30</y>
<width>150</width>
<height>150</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="interactive">
<bool>false</bool>
</property>
</widget>
<widget class="QTextEdit" name="typeDescription">
<property name="geometry">
<rect>
<x>20</x>
<y>69</y>
<width>351</width>
<height>111</height>
</rect>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
*
* @file notyetimplementedpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup NotYetImplementedPage
* @{
* @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 "notyetimplementedpage.h"
#include "ui_notyetimplementedpage.h"
NotYetImplementedPage::NotYetImplementedPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::NotYetImplementedPage)
{
ui->setupUi(this);
setFinalPage(true);
}
NotYetImplementedPage::~NotYetImplementedPage()
{
delete ui;
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file notyetimplementedpage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup NotYetImplementedPage
* @{
* @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 NOTYETIMPLEMENTEDPAGE_H
#define NOTYETIMPLEMENTEDPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class NotYetImplementedPage;
}
class NotYetImplementedPage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit NotYetImplementedPage(SetupWizard *wizard, QWidget *parent = 0);
~NotYetImplementedPage();
private:
Ui::NotYetImplementedPage *ui;
};
#endif // NOTYETIMPLEMENTEDPAGE_H

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NotYetImplementedPage</class>
<widget class="QWizardPage" name="NotYetImplementedPage">
<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="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>190</y>
<width>501</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;This part the OpenPilot Setup Wizard is not yet implemented&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,40 @@
/**
******************************************************************************
*
* @file startpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup Setup Wizard Plugin
* @{
* @brief A Wizard to make the initial setup easy for everyone.
*****************************************************************************/
/*
* 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 "startpage.h"
#include "ui_startpage.h"
StartPage::StartPage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::StartPage)
{
ui->setupUi(this);
}
StartPage::~StartPage()
{
delete ui;
}

View File

@ -0,0 +1,48 @@
/**
******************************************************************************
*
* @file startpage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup Setup Wizard Plugin
* @{
* @brief A Wizard to make the initial setup easy for everyone.
*****************************************************************************/
/*
* 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 STARTPAGE_H
#define STARTPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class StartPage;
}
class StartPage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit StartPage(SetupWizard *wizard, QWidget *parent = 0);
~StartPage();
private:
Ui::StartPage *ui;
};
#endif // STARTPAGE_H

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StartPage</class>
<widget class="QWizardPage" name="StartPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>400</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>640</width>
<height>400</height>
</size>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>550</width>
<height>350</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Welcome to the OpenPilot Setup Wizard&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;This wizard will guide you through the basic steps of setting up your OpenPilot controller board. The following pages contains simple questions about your vehicle and its characteristics. &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;From the information &lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;gathered&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; the wizard will create a baseline configuration that should be good enough for you to get a quick start using your OpenPilot product.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;The baseline configuration can, if desired, be uploaded to the OpenPilot Controller board at the end of this wizard.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;This wizard does not contain the full range of settings available in the GCS Config plugin. All configuration parameters can be changed at later by using the GCS Config plugin.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Ok, lets start the configuration by clicking on the 'Next' button below.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,42 @@
/**
******************************************************************************
*
* @file surfacepage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup SurfacePage
* @{
* @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 "surfacepage.h"
#include "ui_surfacepage.h"
SurfacePage::SurfacePage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::SurfacePage)
{
ui->setupUi(this);
setFinalPage(true);
}
SurfacePage::~SurfacePage()
{
delete ui;
}

View File

@ -0,0 +1,49 @@
/**
******************************************************************************
*
* @file surfacepage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup SurfacePage
* @{
* @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 SURFACEPAGE_H
#define SURFACEPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class SurfacePage;
}
class SurfacePage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit SurfacePage(SetupWizard *wizard, QWidget *parent = 0);
~SurfacePage();
private:
Ui::SurfacePage *ui;
};
#endif // SURFACEPAGE_H

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SurfacePage</class>
<widget class="QWizardPage" name="SurfacePage">
<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="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>160</y>
<width>500</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;The surface vehicle part the OpenPilot Setup Wizard is not yet implemented&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,61 @@
/**
******************************************************************************
*
* @file vehiclepage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup VehiclePage
* @{
* @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 "vehiclepage.h"
#include "ui_vehiclepage.h"
VehiclePage::VehiclePage(SetupWizard *wizard, QWidget *parent) :
AbstractWizardPage(wizard, parent),
ui(new Ui::VehiclePage)
{
ui->setupUi(this);
}
VehiclePage::~VehiclePage()
{
delete ui;
}
bool VehiclePage::validatePage()
{
if(ui->multirotorButton->isChecked()) {
getWizard()->setVehicleType(SetupWizard::VEHICLE_MULTI);
}
else if(ui->fixedwingButton->isChecked()) {
getWizard()->setVehicleType(SetupWizard::VEHICLE_FIXEDWING);
}
else if(ui->heliButton->isChecked()) {
getWizard()->setVehicleType(SetupWizard::VEHICLE_HELI);
}
else if(ui->surfaceButton->isChecked()) {
getWizard()->setVehicleType(SetupWizard::VEHICLE_SURFACE);
}
else {
getWizard()->setVehicleType(SetupWizard::VEHICLE_UNKNOWN);
}
return true;
}

View File

@ -0,0 +1,50 @@
/**
******************************************************************************
*
* @file vehiclepage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup
* @{
* @addtogroup VehiclePage
* @{
* @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 VEHICLEPAGE_H
#define VEHICLEPAGE_H
#include "abstractwizardpage.h"
namespace Ui {
class VehiclePage;
}
class VehiclePage : public AbstractWizardPage
{
Q_OBJECT
public:
explicit VehiclePage(SetupWizard *wizard, QWidget *parent = 0);
~VehiclePage();
bool validatePage();
private:
Ui::VehiclePage *ui;
};
#endif // VEHICLEPAGE_H

View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VehiclePage</class>
<widget class="QWizardPage" name="VehiclePage">
<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="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>550</width>
<height>131</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Vehicle type selection&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;To continue the wizard needs to know what type of vehicle that the OpenPilot controller board is going to be used with. This step is cruicial since most of the following configuration is unique per vehicle type.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;So go ahead and select the type of vehicle you want to create a configuration for.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>200</y>
<width>561</width>
<height>181</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Supported vehicle types</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<widget class="QPushButton" name="multirotorButton">
<property name="geometry">
<rect>
<x>50</x>
<y>40</y>
<width>100</width>
<height>100</height>
</rect>
</property>
<property name="toolTip">
<string>Tricopter, Quadcopter, Hexacopter, Octocopter</string>
</property>
<property name="text">
<string>Multirotor</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="fixedwingButton">
<property name="geometry">
<rect>
<x>170</x>
<y>40</y>
<width>100</width>
<height>100</height>
</rect>
</property>
<property name="toolTip">
<string>Airplane, Sloper, Jet</string>
</property>
<property name="text">
<string>Fixed wing</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="heliButton">
<property name="geometry">
<rect>
<x>290</x>
<y>40</y>
<width>100</width>
<height>100</height>
</rect>
</property>
<property name="text">
<string>Helicopter</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="surfaceButton">
<property name="geometry">
<rect>
<x>410</x>
<y>40</y>
<width>100</width>
<height>100</height>
</rect>
</property>
<property name="toolTip">
<string>Car, Boat, U-Boat</string>
</property>
<property name="text">
<string>Surface</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,99 @@
/**
******************************************************************************
*
* @file setupwizard.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup Setup Wizard Plugin
* @{
* @brief A Wizard to make the initial setup easy for everyone.
*****************************************************************************/
/*
* 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 "setupwizard.h"
#include "pages/startpage.h"
#include "pages/endpage.h"
#include "pages/controllerpage.h"
#include "pages/vehiclepage.h"
#include "pages/multipage.h"
#include "pages/fixedwingpage.h"
#include "pages/helipage.h"
#include "pages/surfacepage.h"
#include "pages/notyetimplementedpage.h"
SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent)
{
setWindowTitle("OpenPilot Setup Wizard");
m_controllerType = CONTROLLER_UNKNOWN;
m_vehicleType = VEHICLE_UNKNOWN;
createPages();
}
int SetupWizard::nextId() const
{
switch (currentId()) {
case PAGE_START:
return PAGE_CONTROLLER;
case PAGE_CONTROLLER: {
switch(getControllerType())
{
case CONTROLLER_CC:
case CONTROLLER_CC3D:
return PAGE_VEHICLES;
default:
return PAGE_NOTYETIMPLEMENTED;
}
}
case PAGE_VEHICLES: {
switch(getVehicleType())
{
case VEHICLE_FIXEDWING:
return PAGE_FIXEDWING;
case VEHICLE_HELI:
return PAGE_HELI;
case VEHICLE_SURFACE:
return PAGE_SURFACE;
case VEHICLE_MULTI:
return PAGE_MULTI;
default:
return PAGE_NOTYETIMPLEMENTED;
}
}
case PAGE_MULTI:
return PAGE_END;
case PAGE_NOTYETIMPLEMENTED:
return PAGE_END;
default:
return -1;
}
}
void SetupWizard::createPages()
{
setPage(PAGE_START, new StartPage(this));
setPage(PAGE_CONTROLLER, new ControllerPage(this));
setPage(PAGE_VEHICLES, new VehiclePage(this));
setPage(PAGE_MULTI, new MultiPage(this));
setPage(PAGE_FIXEDWING, new FixedWingPage(this));
setPage(PAGE_HELI, new HeliPage(this));
setPage(PAGE_SURFACE, new SurfacePage(this));
setPage(PAGE_NOTYETIMPLEMENTED, new NotYetImplementedPage(this));
setPage(PAGE_END, new EndPage(this));
setStartId(PAGE_START);
}

View File

@ -0,0 +1,61 @@
/**
******************************************************************************
*
* @file setupwizard.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup Setup Wizard Plugin
* @{
* @brief A Wizards to make the initial setup easy for everyone.
*****************************************************************************/
/*
* 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 SETUPWIZARD_H
#define SETUPWIZARD_H
#include <QWizard>
class SetupWizard : public QWizard
{
Q_OBJECT
public:
SetupWizard(QWidget *parent = 0);
int nextId() const;
enum CONTROLLER_TYPE {CONTROLLER_UNKNOWN, CONTROLLER_CC, CONTROLLER_CC3D, CONTROLLER_REVO, CONTROLLER_PIPX};
enum VEHICLE_TYPE {VEHICLE_UNKNOWN, VEHICLE_MULTI, VEHICLE_FIXEDWING, VEHICLE_HELI, VEHICLE_SURFACE};
enum MULTI_ROTOR_SUB_TYPE {MULTI_ROTOR_UNKNOWN, MULTI_ROTOR_TRI_Y, MULTI_ROTOR_QUAD_X, MULTI_ROTOR_QUAD_PLUS,
MULTI_ROTOR_HEXA, MULTI_ROTOR_HEXA_H, MULTI_ROTOR_HEXA_COAX_Y, MULTI_ROTOR_OCTO,
MULTI_ROTOR_OCTO_V, MULTI_ROTOR_OCTO_COAX_X, MULTI_ROTOR_OCTO_COAX_PLUS};
void setControllerType(SetupWizard::CONTROLLER_TYPE type) { m_controllerType = type; }
SetupWizard::CONTROLLER_TYPE getControllerType() const { return m_controllerType; }
void setVehicleType(SetupWizard::VEHICLE_TYPE type) { m_vehicleType = type; }
SetupWizard::VEHICLE_TYPE getVehicleType() const { return m_vehicleType; }
private:
enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
PAGE_HELI, PAGE_SURFACE, PAGE_NOTYETIMPLEMENTED, PAGE_END};
void createPages();
CONTROLLER_TYPE m_controllerType;
VEHICLE_TYPE m_vehicleType;
};
#endif // SETUPWIZARD_H

View File

@ -0,0 +1,49 @@
TEMPLATE = lib
TARGET = SetupWizard
QT += svg
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/uavobjectutil/uavobjectutil.pri)
HEADERS += setupwizardplugin.h \
setupwizard.h \
pages/startpage.h \
pages/endpage.h \
pages/controllerpage.h \
pages/vehiclepage.h \
pages/notyetimplementedpage.h \
pages/multipage.h \
pages/fixedwingpage.h \
pages/helipage.h \
pages/surfacepage.h \
pages/abstractwizardpage.h
SOURCES += setupwizardplugin.cpp \
setupwizard.cpp \
pages/startpage.cpp \
pages/endpage.cpp \
pages/controllerpage.cpp \
pages/vehiclepage.cpp \
pages/notyetimplementedpage.cpp \
pages/multipage.cpp \
pages/fixedwingpage.cpp \
pages/helipage.cpp \
pages/surfacepage.cpp \
pages/abstractwizardpage.cpp
OTHER_FILES += SetupWizard.pluginspec
FORMS += \
pages/startpage.ui \
pages/endpage.ui \
pages/controllerpage.ui \
pages/vehiclepage.ui \
pages/notyetimplementedpage.ui \
pages/multipage.ui \
pages/fixedwingpage.ui \
pages/helipage.ui \
pages/surfacepage.ui
RESOURCES += \
wizardResources.qrc

View File

@ -0,0 +1,85 @@
/**
******************************************************************************
*
* @file setupwizardplugin.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup SetupWizardPlugin
* @{
* @brief A Setup Wizard Plugin
*****************************************************************************/
/*
* 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 "setupwizardplugin.h"
#include <QDebug>
#include <QtPlugin>
#include <QStringList>
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/icore.h>
#include <QKeySequence>
SetupWizardPlugin::SetupWizardPlugin()
{
// Do nothing
}
SetupWizardPlugin::~SetupWizardPlugin()
{
}
bool SetupWizardPlugin::initialize(const QStringList& args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
// 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),
"SetupWizardPlugin.ShowSetupWizard",
QList<int>() <<
Core::Constants::C_GLOBAL_ID);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+W"));
cmd->action()->setText(tr("OpenPilot Setup Wizard"));
ac->menu()->addSeparator();
ac->appendGroup("Wizard");
ac->addAction(cmd, "Wizard");
connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(showSetupWizard()));
return true;
}
void SetupWizardPlugin::extensionsInitialized()
{
}
void SetupWizardPlugin::shutdown()
{
}
void SetupWizardPlugin::showSetupWizard()
{
SetupWizard().exec();
}
Q_EXPORT_PLUGIN(SetupWizardPlugin)

View File

@ -0,0 +1,50 @@
/**
******************************************************************************
*
* @file setupwizardplugin.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup SetupWizardPlugin
* @{
* @brief A Setup Wizard Plugin
*****************************************************************************/
/*
* 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 SETUPWIZARDPLUGIN_H
#define SETUPWIZARDPLUGIN_H
#include <extensionsystem/iplugin.h>
#include <QWizard>
#include "setupwizard.h"
class SetupWizardPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
public:
SetupWizardPlugin();
~SetupWizardPlugin();
void extensionsInitialized();
bool initialize(const QStringList & arguments, QString * errorString);
void shutdown();
private slots:
void showSetupWizard();
};
#endif // SETUPWIZARDPLUGIN_H

View File

@ -0,0 +1,3 @@
<RCC>
<qresource prefix="/images"/>
</RCC>