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

OP-60: long-overdue renaming of the 'airspeed' plugin to 'dial'. Otherwise, no change.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@915 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-06-28 07:53:23 +00:00 committed by edouard
parent a56a9346b4
commit bc16c17026
18 changed files with 149 additions and 149 deletions

View File

@ -1,20 +0,0 @@
TEMPLATE = lib
TARGET = AirspeedGadget
QT += svg
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(airspeed_dependencies.pri)
HEADERS += airspeedplugin.h
HEADERS += airspeedgadget.h
HEADERS += airspeedgadgetwidget.h
HEADERS += airspeedgadgetfactory.h
HEADERS += airspeedgadgetconfiguration.h
HEADERS += airspeedgadgetoptionspage.h
SOURCES += airspeedplugin.cpp
SOURCES += airspeedgadget.cpp
SOURCES += airspeedgadgetfactory.cpp
SOURCES += airspeedgadgetwidget.cpp
SOURCES += airspeedgadgetconfiguration.cpp
SOURCES += airspeedgadgetoptionspage.cpp
OTHER_FILES += AirspeedGadget.pluginspec
FORMS += airspeedgadgetoptionspage.ui

View File

@ -1,4 +1,4 @@
<plugin name="AirspeedGadget" version="1.0.0" compatVersion="1.0.0">
<plugin name="DialGadget" version="1.0.0" compatVersion="1.0.0">
<vendor>The OpenPilot Project</vendor>
<copyright>(C) 2010 Edouard Lafargue and David Carlson</copyright>
<license>The GNU Public License (GPL) Version 3</license>

View File

@ -0,0 +1,20 @@
TEMPLATE = lib
TARGET = DialGadget
QT += svg
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(dial_dependencies.pri)
HEADERS += dialplugin.h
HEADERS += dialgadget.h
HEADERS += dialgadgetwidget.h
HEADERS += dialgadgetfactory.h
HEADERS += dialgadgetconfiguration.h
HEADERS += dialgadgetoptionspage.h
SOURCES += dialplugin.cpp
SOURCES += dialgadget.cpp
SOURCES += dialgadgetfactory.cpp
SOURCES += dialgadgetwidget.cpp
SOURCES += dialgadgetconfiguration.cpp
SOURCES += dialgadgetoptionspage.cpp
OTHER_FILES += DialGadget.pluginspec
FORMS += dialgadgetoptionspage.ui

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file airspeedgadget.cpp
* @file dialgadget.cpp
* @author Edouard Lafargue and David Carlson Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
@ -25,17 +25,17 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "airspeedgadget.h"
#include "airspeedgadgetwidget.h"
#include "airspeedgadgetconfiguration.h"
#include "dialgadget.h"
#include "dialgadgetwidget.h"
#include "dialgadgetconfiguration.h"
AirspeedGadget::AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent) :
DialGadget::DialGadget(QString classId, DialGadgetWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
{
}
AirspeedGadget::~AirspeedGadget()
DialGadget::~DialGadget()
{
}
@ -45,9 +45,9 @@ AirspeedGadget::~AirspeedGadget()
first time, so you have to be careful not to assume all the plugin values are initialized
the first time you use them
*/
void AirspeedGadget::loadConfiguration(IUAVGadgetConfiguration* config)
void DialGadget::loadConfiguration(IUAVGadgetConfiguration* config)
{
AirspeedGadgetConfiguration *m = qobject_cast<AirspeedGadgetConfiguration*>(config);
DialGadgetConfiguration *m = qobject_cast<DialGadgetConfiguration*>(config);
m_widget->setDialFile(m->dialFile(), m->dialBackground(), m->dialForeground(), m->dialNeedle1(),
m->dialNeedle2(),m->dialNeedle3(),m->getN1Move(), m->getN2Move(),
m->getN3Move());

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file airspeedgadget.h
* @file dialgadget.h
* @author Edouard Lafargue and David Carlson Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
@ -25,32 +25,32 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AIRSPEEDGADGET_H_
#define AIRSPEEDGADGET_H_
#ifndef DIALGADGET_H_
#define DIALGADGET_H_
#include <coreplugin/iuavgadget.h>
#include "airspeedgadgetwidget.h"
#include "dialgadgetwidget.h"
class IUAVGadget;
class QWidget;
class QString;
class AirspeedGadgetWidget;
class DialGadgetWidget;
using namespace Core;
class AirspeedGadget : public Core::IUAVGadget
class DialGadget : public Core::IUAVGadget
{
Q_OBJECT
public:
AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent = 0);
~AirspeedGadget();
DialGadget(QString classId, DialGadgetWidget *widget, QWidget *parent = 0);
~DialGadget();
QWidget *widget() { return m_widget; }
void loadConfiguration(IUAVGadgetConfiguration* config);
private:
AirspeedGadgetWidget *m_widget;
DialGadgetWidget *m_widget;
};
#endif // AIRSPEEDGADGET_H_
#endif // DIALGADGET_H_

View File

@ -1,9 +1,9 @@
/**
******************************************************************************
*
* @file airspeedgadgetconfiguration.cpp
* @file dialgadgetconfiguration.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Airspeed Plugin Gadget configuration
* @brief Dial Plugin Gadget configuration
* @see The GNU Public License (GPL) Version 3
* @defgroup dialplugin
* @{
@ -25,14 +25,14 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "airspeedgadgetconfiguration.h"
#include "dialgadgetconfiguration.h"
#include <QtCore/QDataStream>
/**
* Loads a saved configuration or defaults if non exist.
*
*/
AirspeedGadgetConfiguration::AirspeedGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
DialGadgetConfiguration::DialGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
IUAVGadgetConfiguration(classId, parent),
m_defaultDial("Unknown"),
dialBackgroundID("background"),
@ -90,9 +90,9 @@ AirspeedGadgetConfiguration::AirspeedGadgetConfiguration(QString classId, const
* Clones a configuration.
*
*/
IUAVGadgetConfiguration *AirspeedGadgetConfiguration::clone()
IUAVGadgetConfiguration *DialGadgetConfiguration::clone()
{
AirspeedGadgetConfiguration *m = new AirspeedGadgetConfiguration(this->classId());
DialGadgetConfiguration *m = new DialGadgetConfiguration(this->classId());
m->m_defaultDial=m_defaultDial;
return m;
}
@ -100,7 +100,7 @@ IUAVGadgetConfiguration *AirspeedGadgetConfiguration::clone()
* Saves a configuration.
*
*/
QByteArray AirspeedGadgetConfiguration::saveState() const
QByteArray DialGadgetConfiguration::saveState() const
{
QByteArray bytes;
QDataStream stream(&bytes, QIODevice::WriteOnly);

View File

@ -1,9 +1,9 @@
/**
******************************************************************************
*
* @file airspeedgadgetconfiguration.h
* @file dialgadgetconfiguration.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Airspeed Plugin Gadget configuration
* @brief Dial Plugin Gadget configuration
* @see The GNU Public License (GPL) Version 3
* @defgroup dialplugin
* @{
@ -25,8 +25,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AIRSPEEDGADGETCONFIGURATION_H
#define AIRSPEEDGADGETCONFIGURATION_H
#ifndef DIALGADGETCONFIGURATION_H
#define DIALGADGETCONFIGURATION_H
#include <coreplugin/iuavgadgetconfiguration.h>
@ -35,11 +35,11 @@ using namespace Core;
/* Despite its name, this is actually a generic analog dial
supporting up to two rotating "needle" indicators.
*/
class AirspeedGadgetConfiguration : public IUAVGadgetConfiguration
class DialGadgetConfiguration : public IUAVGadgetConfiguration
{
Q_OBJECT
public:
explicit AirspeedGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
explicit DialGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
//set dial configuration functions
void setDialFile(QString dialFile){m_defaultDial=dialFile;}
@ -134,4 +134,4 @@ private:
QString needle3Move;
};
#endif // AIRSPEEDGADGETCONFIGURATION_H
#endif // DIALGADGETCONFIGURATION_H

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file airspeedgadgetfactory.cpp
* @file dialgadgetfactory.cpp
* @author Edouard Lafargue and David Carlson Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
@ -24,37 +24,37 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "airspeedgadgetfactory.h"
#include "airspeedgadgetwidget.h"
#include "airspeedgadget.h"
#include "airspeedgadgetconfiguration.h"
#include "airspeedgadgetoptionspage.h"
#include "dialgadgetfactory.h"
#include "dialgadgetwidget.h"
#include "dialgadget.h"
#include "dialgadgetconfiguration.h"
#include "dialgadgetoptionspage.h"
#include <coreplugin/iuavgadget.h>
AirspeedGadgetFactory::AirspeedGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("AirspeedGadget"),
DialGadgetFactory::DialGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("DialGadget"),
tr("Analog Dial Gadget"),
parent)
{
}
AirspeedGadgetFactory::~AirspeedGadgetFactory()
DialGadgetFactory::~DialGadgetFactory()
{
}
Core::IUAVGadget* AirspeedGadgetFactory::createGadget(QWidget *parent)
Core::IUAVGadget* DialGadgetFactory::createGadget(QWidget *parent)
{
AirspeedGadgetWidget* gadgetWidget = new AirspeedGadgetWidget(parent);
return new AirspeedGadget(QString("AirspeedGadget"), gadgetWidget, parent);
DialGadgetWidget* gadgetWidget = new DialGadgetWidget(parent);
return new DialGadget(QString("DialGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *AirspeedGadgetFactory::createConfiguration(const QByteArray &state)
IUAVGadgetConfiguration *DialGadgetFactory::createConfiguration(const QByteArray &state)
{
return new AirspeedGadgetConfiguration(QString("AirspeedGadget"), state);
return new DialGadgetConfiguration(QString("DialGadget"), state);
}
IOptionsPage *AirspeedGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
IOptionsPage *DialGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
{
return new AirspeedGadgetOptionsPage(qobject_cast<AirspeedGadgetConfiguration*>(config));
return new DialGadgetOptionsPage(qobject_cast<DialGadgetConfiguration*>(config));
}

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file airspeedgadgetfactory.h
* @file dialgadgetfactory.h
* @author Edouard Lafargue and David Carlson Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
@ -25,8 +25,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AIRSPEEDGADGETFACTORY_H_
#define AIRSPEEDGADGETFACTORY_H_
#ifndef DIALGADGETFACTORY_H_
#define DIALGADGETFACTORY_H_
#include <coreplugin/iuavgadgetfactory.h>
@ -37,16 +37,16 @@ class IUAVGadgetFactory;
using namespace Core;
class AirspeedGadgetFactory : public IUAVGadgetFactory
class DialGadgetFactory : public IUAVGadgetFactory
{
Q_OBJECT
public:
AirspeedGadgetFactory(QObject *parent = 0);
~AirspeedGadgetFactory();
DialGadgetFactory(QObject *parent = 0);
~DialGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};
#endif // AIRSPEEDGADGETFACTORY_H_
#endif // DIALGADGETFACTORY_H_

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file airspeedgadgetoptionspage.cpp
* @file dialgadgetoptionspage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Airspeed Plugin Gadget options page
* @see The GNU Public License (GPL) Version 3
@ -25,9 +25,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "airspeedgadgetoptionspage.h"
#include "airspeedgadgetconfiguration.h"
#include "ui_airspeedgadgetoptionspage.h"
#include "dialgadgetoptionspage.h"
#include "dialgadgetconfiguration.h"
#include "ui_dialgadgetoptionspage.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/uavdataobject.h"
@ -37,17 +37,17 @@
#include <QtAlgorithms>
#include <QStringList>
AirspeedGadgetOptionsPage::AirspeedGadgetOptionsPage(AirspeedGadgetConfiguration *config, QObject *parent) :
DialGadgetOptionsPage::DialGadgetOptionsPage(DialGadgetConfiguration *config, QObject *parent) :
IOptionsPage(parent),
m_config(config)
{
}
//creates options page widget (uses the UI file)
QWidget *AirspeedGadgetOptionsPage::createPage(QWidget *parent)
QWidget *DialGadgetOptionsPage::createPage(QWidget *parent)
{
options_page = new Ui::AirspeedGadgetOptionsPage();
options_page = new Ui::DialGadgetOptionsPage();
//main widget
QWidget *optionsPageWidget = new QWidget;
//main layout
@ -154,7 +154,7 @@ QWidget *AirspeedGadgetOptionsPage::createPage(QWidget *parent)
* Saves the current values
*
*/
void AirspeedGadgetOptionsPage::apply()
void DialGadgetOptionsPage::apply()
{
m_config->setDialFile(options_page->svgSourceFile->text());
m_config->setDialBackgroundID(options_page->backgroundID->text());
@ -188,7 +188,7 @@ void AirspeedGadgetOptionsPage::apply()
* Opens a font picker.
*
*/
void AirspeedGadgetOptionsPage::on_fontPicker_clicked()
void DialGadgetOptionsPage::on_fontPicker_clicked()
{
bool ok;
font = QFontDialog::getFont(&ok, QFont("Arial", 12), qobject_cast<QWidget*>(this));
@ -199,7 +199,7 @@ void AirspeedGadgetOptionsPage::on_fontPicker_clicked()
Fills in the field1 combo box when value is changed in the
object1 field
*/
void AirspeedGadgetOptionsPage::on_uavObject1_currentIndexChanged(QString val) {
void DialGadgetOptionsPage::on_uavObject1_currentIndexChanged(QString val) {
options_page->objectField1->clear();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
@ -214,7 +214,7 @@ void AirspeedGadgetOptionsPage::on_uavObject1_currentIndexChanged(QString val) {
Fills in the field2 combo box when value is changed in the
object2 field
*/
void AirspeedGadgetOptionsPage::on_uavObject2_currentIndexChanged(QString val) {
void DialGadgetOptionsPage::on_uavObject2_currentIndexChanged(QString val) {
options_page->objectField2->clear();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
@ -229,7 +229,7 @@ void AirspeedGadgetOptionsPage::on_uavObject2_currentIndexChanged(QString val) {
Fills in the field3 combo box when value is changed in the
object3 field
*/
void AirspeedGadgetOptionsPage::on_uavObject3_currentIndexChanged(QString val) {
void DialGadgetOptionsPage::on_uavObject3_currentIndexChanged(QString val) {
options_page->objectField3->clear();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
@ -245,7 +245,7 @@ void AirspeedGadgetOptionsPage::on_uavObject3_currentIndexChanged(QString val) {
Opens an open file dialog.
*/
void AirspeedGadgetOptionsPage::on_loadFile_clicked()
void DialGadgetOptionsPage::on_loadFile_clicked()
{
QFileDialog::Options options;
QString selectedFilter;
@ -260,7 +260,7 @@ void AirspeedGadgetOptionsPage::on_loadFile_clicked()
}
void AirspeedGadgetOptionsPage::finish()
void DialGadgetOptionsPage::finish()
{
}

View File

@ -1,9 +1,9 @@
/**
******************************************************************************
*
* @file airspeedgadgetoptionspage.h
* @file dialgadgetoptionspage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Airspeed Plugin Gadget options page
* @brief Dial Plugin Gadget options page
* @see The GNU Public License (GPL) Version 3
* @defgroup dialplugin
* @{
@ -25,8 +25,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AIRSPEEDGADGETOPTIONSPAGE_H
#define AIRSPEEDGADGETOPTIONSPAGE_H
#ifndef DIALGADGETOPTIONSPAGE_H
#define DIALGADGETOPTIONSPAGE_H
#include "coreplugin/dialogs/ioptionspage.h"
#include "QString"
@ -39,27 +39,27 @@ namespace Core {
class IUAVGadgetConfiguration;
}
class AirspeedGadgetConfiguration;
class DialGadgetConfiguration;
namespace Ui {
class AirspeedGadgetOptionsPage;
class DialGadgetOptionsPage;
}
using namespace Core;
class AirspeedGadgetOptionsPage : public IOptionsPage
class DialGadgetOptionsPage : public IOptionsPage
{
Q_OBJECT
public:
explicit AirspeedGadgetOptionsPage(AirspeedGadgetConfiguration *config, QObject *parent = 0);
explicit DialGadgetOptionsPage(DialGadgetConfiguration *config, QObject *parent = 0);
QWidget *createPage(QWidget *parent);
void apply();
void finish();
private:
Ui::AirspeedGadgetOptionsPage *options_page;
AirspeedGadgetConfiguration *m_config;
Ui::DialGadgetOptionsPage *options_page;
DialGadgetConfiguration *m_config;
QFont font;
private slots:
@ -70,4 +70,4 @@ private slots:
void on_uavObject3_currentIndexChanged(QString val);
};
#endif // AIRSPEEDGADGETOPTIONSPAGE_H
#endif // DIALGADGETOPTIONSPAGE_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AirspeedGadgetOptionsPage</class>
<widget class="QWidget" name="AirspeedGadgetOptionsPage">
<class>DialGadgetOptionsPage</class>
<widget class="QWidget" name="DialGadgetOptionsPage">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -1,9 +1,9 @@
/**
******************************************************************************
*
* @file airspeedgadgetwidget.cpp
* @file dialgadgetwidget.cpp
* @author Edouard Lafargue and David Carlson Copyright (C) 2010.
* @brief
* @brief The main widget, where most action takes place
* @see The GNU Public License (GPL) Version 3
* @defgroup dialplugin
* @{
@ -25,11 +25,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "airspeedgadgetwidget.h"
#include "dialgadgetwidget.h"
#include <iostream>
#include <QDebug>
AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(parent)
DialGadgetWidget::DialGadgetWidget(QWidget *parent) : QGraphicsView(parent)
{
// TODO: create a proper "needle" object instead of hardcoding all this
// which is ugly (but easy).
@ -53,7 +53,7 @@ AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(pare
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles()));
}
AirspeedGadgetWidget::~AirspeedGadgetWidget()
DialGadgetWidget::~DialGadgetWidget()
{
// Do nothing
}
@ -61,7 +61,7 @@ AirspeedGadgetWidget::~AirspeedGadgetWidget()
/*!
\brief Connects the widget to the relevant UAVObjects
*/
void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1,
void DialGadgetWidget::connectNeedles(QString object1, QString nfield1,
QString object2, QString nfield2,
QString object3, QString nfield3) {
if (obj1 != NULL)
@ -114,7 +114,7 @@ void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1,
/*!
\brief Called by the UAVObject which got updated
*/
void AirspeedGadgetWidget::updateNeedle1(UAVObject *object1) {
void DialGadgetWidget::updateNeedle1(UAVObject *object1) {
// Double check that the field exists:
UAVObjectField* field = object1->getField(field1);
if (field) {
@ -127,7 +127,7 @@ void AirspeedGadgetWidget::updateNeedle1(UAVObject *object1) {
/*!
\brief Called by the UAVObject which got updated
*/
void AirspeedGadgetWidget::updateNeedle2(UAVObject *object2) {
void DialGadgetWidget::updateNeedle2(UAVObject *object2) {
UAVObjectField* field = object2->getField(field2);
if (field) {
setNeedle2(field->getDouble());
@ -139,7 +139,7 @@ void AirspeedGadgetWidget::updateNeedle2(UAVObject *object2) {
/*!
\brief Called by the UAVObject which got updated
*/
void AirspeedGadgetWidget::updateNeedle3(UAVObject *object3) {
void DialGadgetWidget::updateNeedle3(UAVObject *object3) {
UAVObjectField* field = object3->getField(field3);
if (field) {
setNeedle3(field->getDouble());
@ -152,7 +152,7 @@ void AirspeedGadgetWidget::updateNeedle3(UAVObject *object3) {
Initializes the dial file, and does all the one-time calculations for
display later. This is the method which really initializes the dial.
*/
void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2,
void DialGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2,
QString n3, QString n1Move, QString n2Move, QString n3Move)
{
if (QFile::exists(dfn))
@ -340,12 +340,12 @@ void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QStr
{ std::cout<<"no file: "<<std::endl; }
}
void AirspeedGadgetWidget::paint()
void DialGadgetWidget::paint()
{
update();
}
void AirspeedGadgetWidget::paintEvent(QPaintEvent *event)
void DialGadgetWidget::paintEvent(QPaintEvent *event)
{
// Skip painting until the dial file is loaded
if (! m_renderer->isValid()) {
@ -358,12 +358,12 @@ void AirspeedGadgetWidget::paintEvent(QPaintEvent *event)
// This event enables the dial to be dynamically resized
// whenever the gadget is resized, taking advantage of the vector
// nature of SVG dials.
void AirspeedGadgetWidget::resizeEvent(QResizeEvent *event)
void DialGadgetWidget::resizeEvent(QResizeEvent *event)
{
fitInView(m_background, Qt::KeepAspectRatio );
}
void AirspeedGadgetWidget::setDialFont(QString fontProps)
void DialGadgetWidget::setDialFont(QString fontProps)
{
QFont font = QFont("Arial",12);
font.fromString(fontProps);
@ -375,7 +375,7 @@ void AirspeedGadgetWidget::setDialFont(QString fontProps)
// Converts the value into an angle:
// this enables smooth rotation in rotateNeedles below
void AirspeedGadgetWidget::setNeedle1(double value) {
void DialGadgetWidget::setNeedle1(double value) {
if (rotateN1) {
needle1Target = 360*value*n1Factor/(n1MaxValue-n1MinValue);
}
@ -394,7 +394,7 @@ void AirspeedGadgetWidget::setNeedle1(double value) {
}
}
void AirspeedGadgetWidget::setNeedle2(double value) {
void DialGadgetWidget::setNeedle2(double value) {
if (rotateN2) {
needle2Target = 360*value*n2Factor/(n2MaxValue-n2MinValue);
}
@ -414,7 +414,7 @@ void AirspeedGadgetWidget::setNeedle2(double value) {
}
void AirspeedGadgetWidget::setNeedle3(double value) {
void DialGadgetWidget::setNeedle3(double value) {
if (rotateN3) {
needle3Target = 360*value*n3Factor/(n3MaxValue-n3MinValue);
}
@ -440,7 +440,7 @@ void AirspeedGadgetWidget::setNeedle3(double value) {
//
// Note: this code is valid even if needle1 and needle2 point
// to the same element.
void AirspeedGadgetWidget::rotateNeedles()
void DialGadgetWidget::rotateNeedles()
{
int dialRun = 3;
if (n2enabled) {

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file airspeedgadgetwidget.h
* @file dialgadgetwidget.h
* @author Edouard Lafargue and David Carlson Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
@ -25,10 +25,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AIRSPEEDGADGETWIDGET_H_
#define AIRSPEEDGADGETWIDGET_H_
#ifndef DIALGADGETWIDGET_H_
#define DIALGADGETWIDGET_H_
#include "airspeedgadgetconfiguration.h"
#include "dialgadgetconfiguration.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/uavobject.h"
@ -39,13 +39,13 @@
#include <QFile>
#include <QTimer>
class AirspeedGadgetWidget : public QGraphicsView
class DialGadgetWidget : public QGraphicsView
{
Q_OBJECT
public:
AirspeedGadgetWidget(QWidget *parent = 0);
~AirspeedGadgetWidget();
DialGadgetWidget(QWidget *parent = 0);
~DialGadgetWidget();
void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n3,
QString n1Move, QString n2Move, QString n3Move);
void paint();
@ -139,4 +139,4 @@ private:
QTimer dialTimer;
};
#endif /* AIRSPEEDGADGETWIDGET_H_ */
#endif /* DIALGADGETWIDGET_H_ */

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file airspeedplugin.h
* @file dialplugin.h
* @author Edouard Lafargue and David Carlson Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
@ -25,42 +25,42 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "airspeedplugin.h"
#include "airspeedgadgetfactory.h"
#include "dialplugin.h"
#include "dialgadgetfactory.h"
#include <QDebug>
#include <QtPlugin>
#include <QStringList>
#include <extensionsystem/pluginmanager.h>
AirspeedPlugin::AirspeedPlugin()
DialPlugin::DialPlugin()
{
// Do nothing
}
AirspeedPlugin::~AirspeedPlugin()
DialPlugin::~DialPlugin()
{
// Do nothing
}
bool AirspeedPlugin::initialize(const QStringList& args, QString *errMsg)
bool DialPlugin::initialize(const QStringList& args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
mf = new AirspeedGadgetFactory(this);
mf = new DialGadgetFactory(this);
addAutoReleasedObject(mf);
return true;
}
void AirspeedPlugin::extensionsInitialized()
void DialPlugin::extensionsInitialized()
{
// Do nothing
}
void AirspeedPlugin::shutdown()
void DialPlugin::shutdown()
{
// Do nothing
}
Q_EXPORT_PLUGIN(AirspeedPlugin)
Q_EXPORT_PLUGIN(DialPlugin)

View File

@ -1,7 +1,7 @@
/**
******************************************************************************
*
* @file airspeedplugin.h
* @file dialplugin.h
* @author Edouard Lafargue and David Carlson Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
@ -25,23 +25,23 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AIRSPEEDPLUGIN_H_
#define AIRSPEEDPLUGIN_H_
#ifndef DIALPLUGIN_H_
#define DIALPLUGIN_H_
#include <extensionsystem/iplugin.h>
class AirspeedGadgetFactory;
class DialGadgetFactory;
class AirspeedPlugin : public ExtensionSystem::IPlugin
class DialPlugin : public ExtensionSystem::IPlugin
{
public:
AirspeedPlugin();
~AirspeedPlugin();
DialPlugin();
~DialPlugin();
void extensionsInitialized();
bool initialize(const QStringList & arguments, QString * errorString);
void shutdown();
private:
AirspeedGadgetFactory *mf;
DialGadgetFactory *mf;
};
#endif /* AIRSPEEDPLUGIN_H_ */
#endif /* DIALPLUGIN_H_ */

View File

@ -81,7 +81,7 @@ plugin_uploader.depends = plugin_coreplugin
SUBDIRS += plugin_uploader
#Dial Gadget
plugin_dial.subdir = airspeed
plugin_dial.subdir = dial
plugin_dial.depends = plugin_coreplugin
plugin_dial.depends = plugin_uavobjects
SUBDIRS += plugin_dial