From 559be15142c5d6ef425b855aeee673a181ad023f Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Wed, 11 Jul 2012 01:00:41 +0200 Subject: [PATCH] OP-39 Start and End pages added. Placeholder text added. --- .../src/plugins/setupwizard/pages/endpage.cpp | 15 ++++ .../src/plugins/setupwizard/pages/endpage.h | 22 +++++ .../src/plugins/setupwizard/pages/endpage.ui | 80 +++++++++++++++++++ .../plugins/setupwizard/pages/startpage.cpp | 14 ++++ .../src/plugins/setupwizard/pages/startpage.h | 22 +++++ .../plugins/setupwizard/pages/startpage.ui | 56 +++++++++++++ .../src/plugins/setupwizard/setupwizard.cpp | 27 +++++-- .../src/plugins/setupwizard/setupwizard.h | 8 +- .../src/plugins/setupwizard/setupwizard.pro | 14 +++- .../plugins/setupwizard/setupwizardplugin.cpp | 4 +- .../plugins/setupwizard/setupwizardplugin.h | 4 +- 11 files changed, 252 insertions(+), 14 deletions(-) create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.cpp create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.h create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.ui create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.cpp create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.h create mode 100644 ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.ui diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.cpp new file mode 100644 index 000000000..3270e23ff --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.cpp @@ -0,0 +1,15 @@ +#include "endpage.h" +#include "ui_endpage.h" + +EndPage::EndPage(QWidget *parent) : + QWizardPage(parent), + ui(new Ui::EndPage) +{ + setFinalPage(true); + ui->setupUi(this); +} + +EndPage::~EndPage() +{ + delete ui; +} diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.h new file mode 100644 index 000000000..e4179e677 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.h @@ -0,0 +1,22 @@ +#ifndef ENDPAGE_H +#define ENDPAGE_H + +#include + +namespace Ui { +class EndPage; +} + +class EndPage : public QWizardPage +{ + Q_OBJECT + +public: + explicit EndPage(QWidget *parent = 0); + ~EndPage(); + +private: + Ui::EndPage *ui; +}; + +#endif // ENDPAGE_H diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.ui new file mode 100644 index 000000000..cc0a5c162 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/endpage.ui @@ -0,0 +1,80 @@ + + + EndPage + + + + 0 + 0 + 600 + 400 + + + + + 600 + 400 + + + + WizardPage + + + + + 20 + 20 + 550 + 141 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Setup complete</span></p> +<p style="-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;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The wizard have now gathered enough information to create a baseline configuration for your OpenPilot controller board to use with your vehicle.</span></p> +<p style="-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;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">You now have two choices:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">- Upload configuration directly to the currently connected OpenPilot controller board.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">- Save the configuration to a file for later uploading using the configuration import plugin in GCS.</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + 420 + 290 + 125 + 23 + + + + Save configuration... + + + + + + 420 + 340 + 125 + 23 + + + + Uppload configuration + + + + + + diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.cpp new file mode 100644 index 000000000..f36631bb0 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.cpp @@ -0,0 +1,14 @@ +#include "startpage.h" +#include "ui_startpage.h" + +StartPage::StartPage(QWidget *parent) : + QWizardPage(parent), + ui(new Ui::StartPage) +{ + ui->setupUi(this); +} + +StartPage::~StartPage() +{ + delete ui; +} diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.h new file mode 100644 index 000000000..f6cf9b6cd --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.h @@ -0,0 +1,22 @@ +#ifndef STARTPAGE_H +#define STARTPAGE_H + +#include + +namespace Ui { +class StartPage; +} + +class StartPage : public QWizardPage +{ + Q_OBJECT + +public: + explicit StartPage(QWidget *parent = 0); + ~StartPage(); + +private: + Ui::StartPage *ui; +}; + +#endif // STARTPAGE_H diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.ui new file mode 100644 index 000000000..0f656f35c --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/startpage.ui @@ -0,0 +1,56 @@ + + + StartPage + + + + 0 + 0 + 640 + 400 + + + + + 640 + 400 + + + + WizardPage + + + + + 20 + 20 + 550 + 350 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Welcome to the OpenPilot Setup Wizard</span></p> +<p style="-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;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">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. </span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">From the information </span><span style=" font-size:10pt;">gathered</span><span style=" font-size:10pt;"> the wizard will create a baseline configuration that should be good enough for you to get a quick start using your OpenPilot product.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The baseline configuration can, if desired, be uploaded to the OpenPilot Controller board at the end of this wizard.</span></p> +<p style="-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;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">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.</span></p> +<p style="-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;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Ok, lets start the configuration by clicking on the 'Next' button below.</span></p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp index 1513b40b2..26a5e386a 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp @@ -7,7 +7,7 @@ * @{ * @addtogroup Setup Wizard Plugin * @{ - * @brief A Wizards to make the initial setup easy for everyone. + * @brief A Wizard to make the initial setup easy for everyone. *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -26,12 +26,29 @@ */ #include "setupwizard.h" +#include "pages/startpage.h" +#include "pages/endpage.h" SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent) { - setWindowTitle("GCS Setup Wizard"); - QWizardPage* page = new QWizardPage(); - page->setFixedSize(300, 300); - addPage(page); + setWindowTitle("OpenPilot Setup Wizard"); + createPages(); } +int SetupWizard::nextId() const +{ + switch (currentId()) { + case PAGE_START: + return PAGE_END; + default: + return -1; + } +} + +void SetupWizard::createPages() +{ + setPage(PAGE_START, new StartPage()); + setPage(PAGE_END, new EndPage()); + + setStartId(PAGE_START); +} diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h index 7bd907cad..42f75556a 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h @@ -32,10 +32,14 @@ class SetupWizard : public QWizard { - Q_OBJECT + Q_OBJECT public: - SetupWizard(QWidget *parent = 0); + SetupWizard(QWidget *parent = 0); + int nextId() const; +private: + enum {PAGE_START, PAGE_END}; + void createPages(); }; #endif // SETUPWIZARD_H diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro index cc5122a25..20d13155d 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro @@ -6,8 +6,16 @@ include(../../openpilotgcsplugin.pri) include(../../plugins/coreplugin/coreplugin.pri) HEADERS += setupwizardplugin.h \ - setupwizard.h + setupwizard.h \ + pages/startpage.h \ + pages/endpage.h SOURCES += setupwizardplugin.cpp \ - setupwizard.cpp + setupwizard.cpp \ + pages/startpage.cpp \ + pages/endpage.cpp -OTHER_FILES += SetupWizard.pluginspec \ No newline at end of file +OTHER_FILES += SetupWizard.pluginspec + +FORMS += \ + pages/startpage.ui \ + pages/endpage.ui \ No newline at end of file diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizardplugin.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizardplugin.cpp index 5ac0b4c6c..a6dddbd4c 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizardplugin.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizardplugin.cpp @@ -5,7 +5,7 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ - * @addtogroup SetupWizardPlugin Do Nothing Plugin + * @addtogroup SetupWizardPlugin * @{ * @brief A Setup Wizard Plugin *****************************************************************************/ @@ -59,7 +59,7 @@ bool SetupWizardPlugin::initialize(const QStringList& args, QString *errMsg) QList() << Core::Constants::C_GLOBAL_ID); cmd->setDefaultKeySequence(QKeySequence("Ctrl+W")); - cmd->action()->setText(tr("GCS Setup Wizard")); + cmd->action()->setText(tr("OpenPilot Setup Wizard")); ac->menu()->addSeparator(); ac->appendGroup("Wizard"); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizardplugin.h b/ground/openpilotgcs/src/plugins/setupwizard/setupwizardplugin.h index dcff10a60..4caecbcd0 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizardplugin.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizardplugin.h @@ -5,9 +5,9 @@ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ - * @addtogroup DoNothingPlugin Do Nothing Plugin + * @addtogroup SetupWizardPlugin * @{ - * @brief A minimal example plugin + * @brief A Setup Wizard Plugin *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify