mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-02 19:29:15 +01:00
Some Doxygen fixes, remove auto generated headers from config plugin, remove emptyplugin from the build. Just janitor work.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@862 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
4edc7a1cc2
commit
61c7be7765
@ -1,68 +1,68 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadget.cpp
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup airspeed
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "airspeedgadget.h"
|
||||
#include "airspeedgadgetwidget.h"
|
||||
#include "airspeedgadgetconfiguration.h"
|
||||
|
||||
AirspeedGadget::AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
AirspeedGadget::~AirspeedGadget()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
This is called when a configuration is loaded, and updates the plugin's settings.
|
||||
Careful: the plugin is already drawn before the loadConfiguration method is called the
|
||||
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)
|
||||
{
|
||||
AirspeedGadgetConfiguration *m = qobject_cast<AirspeedGadgetConfiguration*>(config);
|
||||
m_widget->setDialFile(m->dialFile(), m->dialBackground(), m->dialForeground(), m->dialNeedle1(),
|
||||
m->dialNeedle2(),m->dialNeedle3(),m->getN1Move(), m->getN2Move(),
|
||||
m->getN3Move());
|
||||
|
||||
m_widget->setN1Min(m->getN1Min());
|
||||
m_widget->setN1Max(m->getN1Max());
|
||||
m_widget->setN1Factor(m->getN1Factor());
|
||||
m_widget->setN2Min(m->getN2Min());
|
||||
m_widget->setN2Max(m->getN2Max());
|
||||
m_widget->setN2Factor(m->getN2Factor());
|
||||
m_widget->setN3Min(m->getN3Min());
|
||||
m_widget->setN3Max(m->getN3Max());
|
||||
m_widget->setN3Factor(m->getN3Factor());
|
||||
m_widget->connectNeedles(m->getN1DataObject(),m->getN1ObjField(),
|
||||
m->getN2DataObject(),m->getN2ObjField(),
|
||||
m->getN3DataObject(),m->getN3ObjField()
|
||||
);
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadget.cpp
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "airspeedgadget.h"
|
||||
#include "airspeedgadgetwidget.h"
|
||||
#include "airspeedgadgetconfiguration.h"
|
||||
|
||||
AirspeedGadget::AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
AirspeedGadget::~AirspeedGadget()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
This is called when a configuration is loaded, and updates the plugin's settings.
|
||||
Careful: the plugin is already drawn before the loadConfiguration method is called the
|
||||
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)
|
||||
{
|
||||
AirspeedGadgetConfiguration *m = qobject_cast<AirspeedGadgetConfiguration*>(config);
|
||||
m_widget->setDialFile(m->dialFile(), m->dialBackground(), m->dialForeground(), m->dialNeedle1(),
|
||||
m->dialNeedle2(),m->dialNeedle3(),m->getN1Move(), m->getN2Move(),
|
||||
m->getN3Move());
|
||||
|
||||
m_widget->setN1Min(m->getN1Min());
|
||||
m_widget->setN1Max(m->getN1Max());
|
||||
m_widget->setN1Factor(m->getN1Factor());
|
||||
m_widget->setN2Min(m->getN2Min());
|
||||
m_widget->setN2Max(m->getN2Max());
|
||||
m_widget->setN2Factor(m->getN2Factor());
|
||||
m_widget->setN3Min(m->getN3Min());
|
||||
m_widget->setN3Max(m->getN3Max());
|
||||
m_widget->setN3Factor(m->getN3Factor());
|
||||
m_widget->connectNeedles(m->getN1DataObject(),m->getN1ObjField(),
|
||||
m->getN2DataObject(),m->getN2ObjField(),
|
||||
m->getN3DataObject(),m->getN3ObjField()
|
||||
);
|
||||
}
|
||||
|
@ -1,56 +1,56 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadget.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup airspeed
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 AIRSPEEDGADGET_H_
|
||||
#define AIRSPEEDGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "airspeedgadgetwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class AirspeedGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class AirspeedGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent = 0);
|
||||
~AirspeedGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
AirspeedGadgetWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // AIRSPEEDGADGET_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadget.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 AIRSPEEDGADGET_H_
|
||||
#define AIRSPEEDGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "airspeedgadgetwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class AirspeedGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class AirspeedGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AirspeedGadget(QString classId, AirspeedGadgetWidget *widget, QWidget *parent = 0);
|
||||
~AirspeedGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
AirspeedGadgetWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // AIRSPEEDGADGET_H_
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Airspeed Plugin Gadget configuration
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup Airspeed
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Airspeed Plugin Gadget configuration
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup Airspeed
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -1,60 +1,60 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadgetfactory.cpp
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup airspeed
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "airspeedgadgetfactory.h"
|
||||
#include "airspeedgadgetwidget.h"
|
||||
#include "airspeedgadget.h"
|
||||
#include "airspeedgadgetconfiguration.h"
|
||||
#include "airspeedgadgetoptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
AirspeedGadgetFactory::AirspeedGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("AirspeedGadget"),
|
||||
tr("Analog Dial Gadget"),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
AirspeedGadgetFactory::~AirspeedGadgetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* AirspeedGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
AirspeedGadgetWidget* gadgetWidget = new AirspeedGadgetWidget(parent);
|
||||
return new AirspeedGadget(QString("AirspeedGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *AirspeedGadgetFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new AirspeedGadgetConfiguration(QString("AirspeedGadget"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *AirspeedGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new AirspeedGadgetOptionsPage(qobject_cast<AirspeedGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadgetfactory.cpp
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "airspeedgadgetfactory.h"
|
||||
#include "airspeedgadgetwidget.h"
|
||||
#include "airspeedgadget.h"
|
||||
#include "airspeedgadgetconfiguration.h"
|
||||
#include "airspeedgadgetoptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
AirspeedGadgetFactory::AirspeedGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("AirspeedGadget"),
|
||||
tr("Analog Dial Gadget"),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
AirspeedGadgetFactory::~AirspeedGadgetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* AirspeedGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
AirspeedGadgetWidget* gadgetWidget = new AirspeedGadgetWidget(parent);
|
||||
return new AirspeedGadget(QString("AirspeedGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *AirspeedGadgetFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new AirspeedGadgetConfiguration(QString("AirspeedGadget"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *AirspeedGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new AirspeedGadgetOptionsPage(qobject_cast<AirspeedGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
|
@ -1,52 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadgetfactory.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup airspeed
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 AIRSPEEDGADGETFACTORY_H_
|
||||
#define AIRSPEEDGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class AirspeedGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AirspeedGadgetFactory(QObject *parent = 0);
|
||||
~AirspeedGadgetFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // AIRSPEEDGADGETFACTORY_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadgetfactory.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 AIRSPEEDGADGETFACTORY_H_
|
||||
#define AIRSPEEDGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class AirspeedGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AirspeedGadgetFactory(QObject *parent = 0);
|
||||
~AirspeedGadgetFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // AIRSPEEDGADGETFACTORY_H_
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @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
|
||||
* @defgroup Airspeed
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @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
|
||||
* @defgroup Airspeed
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -1,458 +1,458 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadgetwidget.cpp
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup airspeed
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "airspeedgadgetwidget.h"
|
||||
#include <iostream>
|
||||
#include <QDebug>
|
||||
|
||||
AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(parent)
|
||||
{
|
||||
// TODO: create a proper "needle" object instead of hardcoding all this
|
||||
// which is ugly (but easy).
|
||||
|
||||
setMinimumSize(64,64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setScene(new QGraphicsScene(this));
|
||||
setRenderHints(QPainter::Antialiasing);
|
||||
|
||||
m_renderer = new QSvgRenderer();
|
||||
|
||||
obj1 = NULL;
|
||||
obj2 = NULL;
|
||||
obj3 = NULL;
|
||||
|
||||
// This timer mechanism makes needles rotate smoothly
|
||||
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles()));
|
||||
dialTimer.start(20);
|
||||
|
||||
}
|
||||
|
||||
AirspeedGadgetWidget::~AirspeedGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Connects the widget to the relevant UAVObjects
|
||||
*/
|
||||
void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1,
|
||||
QString object2, QString nfield2,
|
||||
QString object3, QString nfield3) {
|
||||
if (obj1 != NULL)
|
||||
disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle1(UAVObject*)));
|
||||
if (obj2 != NULL)
|
||||
disconnect(obj2,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle2(UAVObject*)));
|
||||
if (obj3 != NULL)
|
||||
disconnect(obj3,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle3(UAVObject*)));
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
|
||||
// Check validity of arguments first, reject empty args and unknown fields.
|
||||
if (!(object1.isEmpty() || nfield1.isEmpty())) {
|
||||
obj1 = dynamic_cast<UAVDataObject*>( objManager->getObject(object1) );
|
||||
if (obj1 != NULL ) {
|
||||
std::cout << "Connected Object 1 (" << object1.toStdString() << ")." << std::endl;
|
||||
connect(obj1, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle1(UAVObject*)));
|
||||
field1 = nfield1;
|
||||
} else {
|
||||
std::cout << "Error: Object is unknown (" << object1.toStdString() << ")." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// And do the same for the second needle.
|
||||
if (!(object2.isEmpty() || nfield2.isEmpty())) {
|
||||
obj2 = dynamic_cast<UAVDataObject*>( objManager->getObject(object2) );
|
||||
if (obj2 != NULL ) {
|
||||
std::cout << "Connected Object 2 (" << object2.toStdString() << ")." << std::endl;
|
||||
connect(obj2, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle2(UAVObject*)));
|
||||
field2 = nfield2;
|
||||
} else {
|
||||
std::cout << "Error: Object is unknown (" << object2.toStdString() << ")." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// And do the same for the third needle.
|
||||
if (!(object3.isEmpty() || nfield3.isEmpty())) {
|
||||
obj3 = dynamic_cast<UAVDataObject*>( objManager->getObject(object3) );
|
||||
if (obj3 != NULL ) {
|
||||
std::cout << "Connected Object 3 (" << object3.toStdString() << ")." << std::endl;
|
||||
connect(obj3, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle3(UAVObject*)));
|
||||
field3 = nfield3;
|
||||
} else {
|
||||
std::cout << "Error: Object is unknown (" << object3.toStdString() << ")." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
*/
|
||||
void AirspeedGadgetWidget::updateNeedle1(UAVObject *object1) {
|
||||
// Double check that the field exists:
|
||||
UAVObjectField* field = object1->getField(field1);
|
||||
if (field) {
|
||||
setNeedle1(field->getDouble());
|
||||
} else {
|
||||
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
*/
|
||||
void AirspeedGadgetWidget::updateNeedle2(UAVObject *object2) {
|
||||
UAVObjectField* field = object2->getField(field2);
|
||||
if (field) {
|
||||
setNeedle2(field->getDouble());
|
||||
} else {
|
||||
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
*/
|
||||
void AirspeedGadgetWidget::updateNeedle3(UAVObject *object3) {
|
||||
UAVObjectField* field = object3->getField(field3);
|
||||
if (field) {
|
||||
setNeedle3(field->getDouble());
|
||||
} else {
|
||||
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Initializes the dial file, and does all the one-time calculations for
|
||||
display later.
|
||||
*/
|
||||
void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2,
|
||||
QString n3, QString n1Move, QString n2Move, QString n3Move)
|
||||
{
|
||||
if (QFile::exists(dfn))
|
||||
{
|
||||
m_renderer->load(dfn);
|
||||
if(m_renderer->isValid())
|
||||
{
|
||||
fgenabled = false;
|
||||
n2enabled = false;
|
||||
n3enabled = false;
|
||||
QGraphicsScene *l_scene = scene();
|
||||
l_scene->clear(); // Deletes all items contained in the scene as well.
|
||||
m_background = new QGraphicsSvgItem();
|
||||
// All other items will be clipped to the shape of the background
|
||||
m_background->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
|
||||
QGraphicsItem::ItemClipsToShape);
|
||||
m_foreground = new QGraphicsSvgItem();
|
||||
m_needle1 = new QGraphicsSvgItem();
|
||||
m_needle2 = new QGraphicsSvgItem();
|
||||
m_needle3 = new QGraphicsSvgItem();
|
||||
m_needle1->setParentItem(m_background);
|
||||
m_needle2->setParentItem(m_background);
|
||||
m_needle3->setParentItem(m_background);
|
||||
m_foreground->setParentItem(m_background);
|
||||
|
||||
// We assume the dial contains at least the background
|
||||
// and needle1
|
||||
m_background->setSharedRenderer(m_renderer);
|
||||
m_background->setElementId(bg);
|
||||
l_scene->addItem(m_background);
|
||||
|
||||
m_needle1->setSharedRenderer(m_renderer);
|
||||
m_needle1->setElementId(n1);
|
||||
l_scene->addItem(m_needle1);
|
||||
|
||||
// The dial gadget allows Needle1 and Needle2 to be
|
||||
// the same element, for combined movement. Needle3
|
||||
// is always independent.
|
||||
if (n1 == n2) {
|
||||
m_needle2 = m_needle1;
|
||||
n2enabled = true;
|
||||
} else {
|
||||
if (m_renderer->elementExists(n2)) {
|
||||
m_needle2->setSharedRenderer(m_renderer);
|
||||
m_needle2->setElementId(n2);
|
||||
l_scene->addItem(m_needle2);
|
||||
n2enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_renderer->elementExists(n3)) {
|
||||
m_needle3->setSharedRenderer(m_renderer);
|
||||
m_needle3->setElementId(n3);
|
||||
l_scene->addItem(m_needle3);
|
||||
n3enabled = true;
|
||||
}
|
||||
|
||||
if (m_renderer->elementExists(fg)) {
|
||||
m_foreground->setSharedRenderer(m_renderer);
|
||||
m_foreground->setElementId(fg);
|
||||
l_scene->addItem(m_foreground);
|
||||
fgenabled = true;
|
||||
}
|
||||
|
||||
rotateN1 = false;
|
||||
horizN1 = false;
|
||||
vertN1 = false;
|
||||
rotateN2 = false;
|
||||
horizN2 = false;
|
||||
vertN2 = false;
|
||||
rotateN3 = false;
|
||||
horizN3 = false;
|
||||
vertN3 = false;
|
||||
|
||||
|
||||
// Now setup the rotation/translation settings:
|
||||
// this is UGLY UGLY UGLY, sorry...
|
||||
if (n1Move.contains("Rotate")) {
|
||||
rotateN1 = true;
|
||||
} else if (n1Move.contains("Horizontal")) {
|
||||
horizN1 = true;
|
||||
} else if (n1Move.contains("Vertical")) {
|
||||
vertN1 = true;
|
||||
}
|
||||
|
||||
if (n2Move.contains("Rotate")) {
|
||||
rotateN2 = true;
|
||||
} else if (n2Move.contains("Horizontal")) {
|
||||
horizN2 = true;
|
||||
} else if (n2Move.contains("Vertical")) {
|
||||
vertN2 = true;
|
||||
}
|
||||
|
||||
if (n3Move.contains("Rotate")) {
|
||||
rotateN3 = true;
|
||||
} else if (n3Move.contains("Horizontal")) {
|
||||
horizN3 = true;
|
||||
} else if (n3Move.contains("Vertical")) {
|
||||
vertN3 = true;
|
||||
}
|
||||
|
||||
l_scene->setSceneRect(m_background->boundingRect());
|
||||
|
||||
// Now Initialize the center for all transforms of the dial needles to the
|
||||
// center of the background:
|
||||
// - Move the center of the needle to the center of the background.
|
||||
QRectF rectB = m_background->boundingRect();
|
||||
QRectF rectN = m_needle1->boundingRect();
|
||||
m_needle1->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
|
||||
// - Put the transform origin point of the needle at its center.
|
||||
m_needle1->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
|
||||
if ((n1 != n2) && n2enabled) {
|
||||
// Only do it for needle1 if it is not the same as n2
|
||||
rectN = m_needle2->boundingRect();
|
||||
m_needle2->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
|
||||
m_needle2->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
|
||||
}
|
||||
if (n3enabled) {
|
||||
rectN = m_needle3->boundingRect();
|
||||
m_needle3->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
|
||||
m_needle3->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
|
||||
}
|
||||
|
||||
// Last: we just loaded the dial file which is by default valid for a "zero" value
|
||||
// of the needles, so we have to reset the needles too upon dial file loading, otherwise
|
||||
// we would end up with an offset when we change a dial file and the needle value
|
||||
// is not zero at that time.
|
||||
needle1Target = 0;
|
||||
needle2Target = 0;
|
||||
needle3Target = 0;
|
||||
needle1Value = 0;
|
||||
needle2Value = 0;
|
||||
needle3Value = 0;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{ std::cout<<"no file: "<<std::endl; }
|
||||
}
|
||||
|
||||
void AirspeedGadgetWidget::paint()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void AirspeedGadgetWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
// Skip painting until the dial file is loaded
|
||||
if (! m_renderer->isValid()) {
|
||||
std::cout<<"Dial file not loaded, not rendering"<<std::endl;
|
||||
return;
|
||||
}
|
||||
QGraphicsView::paintEvent(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)
|
||||
{
|
||||
fitInView(m_background, Qt::KeepAspectRatio );
|
||||
}
|
||||
|
||||
// Converts the value into an angle:
|
||||
// this enables smooth rotation in rotateNeedles below
|
||||
void AirspeedGadgetWidget::setNeedle1(double value) {
|
||||
if (rotateN1) {
|
||||
needle1Target = 360*value*n1Factor/(n1MaxValue-n1MinValue);
|
||||
}
|
||||
if (horizN1) {
|
||||
needle1Target = value*n1Factor/(n1MaxValue-n1MinValue);
|
||||
}
|
||||
if (vertN1) {
|
||||
needle1Target = value*n1Factor/(n1MaxValue-n1MinValue);
|
||||
}
|
||||
if (!dialTimer.isActive())
|
||||
dialTimer.start();
|
||||
}
|
||||
|
||||
void AirspeedGadgetWidget::setNeedle2(double value) {
|
||||
if (rotateN2) {
|
||||
needle2Target = 360*value*n2Factor/(n2MaxValue-n2MinValue);
|
||||
}
|
||||
if (horizN2) {
|
||||
needle2Target = value*n2Factor/(n2MaxValue-n2MinValue);
|
||||
}
|
||||
if (vertN2) {
|
||||
needle2Target = value*n2Factor/(n2MaxValue-n2MinValue);
|
||||
}
|
||||
if (!dialTimer.isActive())
|
||||
dialTimer.start();
|
||||
}
|
||||
|
||||
void AirspeedGadgetWidget::setNeedle3(double value) {
|
||||
if (rotateN3) {
|
||||
needle3Target = 360*value*n3Factor/(n3MaxValue-n3MinValue);
|
||||
}
|
||||
if (horizN3) {
|
||||
needle3Target = value*n3Factor/(n3MaxValue-n3MinValue);
|
||||
}
|
||||
if (vertN3) {
|
||||
needle3Target = value*n3Factor/(n3MaxValue-n3MinValue);
|
||||
}
|
||||
if (!dialTimer.isActive())
|
||||
dialTimer.start();
|
||||
}
|
||||
|
||||
// Take an input value and rotate the dial accordingly
|
||||
// Rotation is smooth, starts fast and slows down when
|
||||
// approaching the target.
|
||||
// We aim for a 0.5 degree precision.
|
||||
//
|
||||
// Note: this code is valid even if needle1 and needle2 point
|
||||
// to the same element.
|
||||
void AirspeedGadgetWidget::rotateNeedles()
|
||||
{
|
||||
int dialRun = 3;
|
||||
if (n2enabled) {
|
||||
if (abs((needle2Value-needle2Target)*10) > 5) {
|
||||
double needle2Diff;
|
||||
needle2Diff =(needle2Target - needle2Value)/5;
|
||||
if (rotateN2) {
|
||||
m_needle2->setRotation(m_needle2->rotation()+needle2Diff);
|
||||
} else {
|
||||
QPointF opd = QPointF(0,0);
|
||||
if (horizN2) {
|
||||
opd = QPointF(needle2Diff,0);
|
||||
}
|
||||
if (vertN2) {
|
||||
opd = QPointF(0,needle2Diff);
|
||||
}
|
||||
m_needle2->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true);
|
||||
// Since we have moved the needle, we need to move
|
||||
// the transform origin point the opposite way
|
||||
// so that it keeps rotating from the same point.
|
||||
// (this is only useful if needle1 and needle2 are the
|
||||
// same object, for combined movement such as attitude indicator).
|
||||
QPointF oop = m_needle2->transformOriginPoint();
|
||||
m_needle2->setTransformOriginPoint(oop.x()-opd.x(),oop.y()-opd.y());
|
||||
}
|
||||
needle2Value += needle2Diff;
|
||||
} else {
|
||||
needle2Value = needle2Target;
|
||||
dialRun--;
|
||||
}
|
||||
} else {
|
||||
dialRun--;
|
||||
}
|
||||
|
||||
// We assume that needle1 always exists!
|
||||
if ((abs((needle1Value-needle1Target)*10) > 5)) {
|
||||
double needle1Diff;
|
||||
needle1Diff = (needle1Target - needle1Value)/5;
|
||||
if (rotateN1) {
|
||||
m_needle1->setRotation(m_needle1->rotation()+needle1Diff);
|
||||
} else {
|
||||
QPointF opd = QPointF(0,0);
|
||||
if (horizN1) {
|
||||
opd = QPointF(needle1Diff,0);
|
||||
}
|
||||
if (vertN1) {
|
||||
opd = QPointF(0,needle1Diff);
|
||||
}
|
||||
m_needle1->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true);
|
||||
QPointF oop = m_needle1->transformOriginPoint();
|
||||
m_needle1->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y()));
|
||||
}
|
||||
needle1Value += needle1Diff;
|
||||
} else { // value is close enough to target, value to exact target
|
||||
// to cancel out any potential drift
|
||||
needle1Value = needle1Target;
|
||||
dialRun--;
|
||||
}
|
||||
|
||||
if (n3enabled) {
|
||||
if ((abs((needle3Value-needle3Target)*10) > 5)) {
|
||||
double needle3Diff;
|
||||
needle3Diff = (needle3Target - needle3Value)/5;
|
||||
if (rotateN3) {
|
||||
m_needle3->setRotation(m_needle3->rotation()+needle3Diff);
|
||||
} else {
|
||||
QPointF opd = QPointF(0,0);
|
||||
if (horizN3) {
|
||||
opd = QPointF(needle3Diff,0);
|
||||
}
|
||||
if (vertN3) {
|
||||
opd = QPointF(0,needle3Diff);
|
||||
}
|
||||
m_needle3->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true);
|
||||
QPointF oop = m_needle3->transformOriginPoint();
|
||||
m_needle3->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y()));
|
||||
}
|
||||
needle3Value += needle3Diff;
|
||||
} else {
|
||||
needle3Value = needle3Target;
|
||||
dialRun--;
|
||||
}
|
||||
} else {
|
||||
dialRun--;
|
||||
}
|
||||
update();
|
||||
// Now check: if dialRun is now zero, we should
|
||||
// just stop the timer since all needles have finished moving
|
||||
if (!dialRun) dialTimer.stop();
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadgetwidget.cpp
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "airspeedgadgetwidget.h"
|
||||
#include <iostream>
|
||||
#include <QDebug>
|
||||
|
||||
AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(parent)
|
||||
{
|
||||
// TODO: create a proper "needle" object instead of hardcoding all this
|
||||
// which is ugly (but easy).
|
||||
|
||||
setMinimumSize(64,64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setScene(new QGraphicsScene(this));
|
||||
setRenderHints(QPainter::Antialiasing);
|
||||
|
||||
m_renderer = new QSvgRenderer();
|
||||
|
||||
obj1 = NULL;
|
||||
obj2 = NULL;
|
||||
obj3 = NULL;
|
||||
|
||||
// This timer mechanism makes needles rotate smoothly
|
||||
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles()));
|
||||
dialTimer.start(20);
|
||||
|
||||
}
|
||||
|
||||
AirspeedGadgetWidget::~AirspeedGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Connects the widget to the relevant UAVObjects
|
||||
*/
|
||||
void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1,
|
||||
QString object2, QString nfield2,
|
||||
QString object3, QString nfield3) {
|
||||
if (obj1 != NULL)
|
||||
disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle1(UAVObject*)));
|
||||
if (obj2 != NULL)
|
||||
disconnect(obj2,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle2(UAVObject*)));
|
||||
if (obj3 != NULL)
|
||||
disconnect(obj3,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle3(UAVObject*)));
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
|
||||
// Check validity of arguments first, reject empty args and unknown fields.
|
||||
if (!(object1.isEmpty() || nfield1.isEmpty())) {
|
||||
obj1 = dynamic_cast<UAVDataObject*>( objManager->getObject(object1) );
|
||||
if (obj1 != NULL ) {
|
||||
std::cout << "Connected Object 1 (" << object1.toStdString() << ")." << std::endl;
|
||||
connect(obj1, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle1(UAVObject*)));
|
||||
field1 = nfield1;
|
||||
} else {
|
||||
std::cout << "Error: Object is unknown (" << object1.toStdString() << ")." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// And do the same for the second needle.
|
||||
if (!(object2.isEmpty() || nfield2.isEmpty())) {
|
||||
obj2 = dynamic_cast<UAVDataObject*>( objManager->getObject(object2) );
|
||||
if (obj2 != NULL ) {
|
||||
std::cout << "Connected Object 2 (" << object2.toStdString() << ")." << std::endl;
|
||||
connect(obj2, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle2(UAVObject*)));
|
||||
field2 = nfield2;
|
||||
} else {
|
||||
std::cout << "Error: Object is unknown (" << object2.toStdString() << ")." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// And do the same for the third needle.
|
||||
if (!(object3.isEmpty() || nfield3.isEmpty())) {
|
||||
obj3 = dynamic_cast<UAVDataObject*>( objManager->getObject(object3) );
|
||||
if (obj3 != NULL ) {
|
||||
std::cout << "Connected Object 3 (" << object3.toStdString() << ")." << std::endl;
|
||||
connect(obj3, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle3(UAVObject*)));
|
||||
field3 = nfield3;
|
||||
} else {
|
||||
std::cout << "Error: Object is unknown (" << object3.toStdString() << ")." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
*/
|
||||
void AirspeedGadgetWidget::updateNeedle1(UAVObject *object1) {
|
||||
// Double check that the field exists:
|
||||
UAVObjectField* field = object1->getField(field1);
|
||||
if (field) {
|
||||
setNeedle1(field->getDouble());
|
||||
} else {
|
||||
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
*/
|
||||
void AirspeedGadgetWidget::updateNeedle2(UAVObject *object2) {
|
||||
UAVObjectField* field = object2->getField(field2);
|
||||
if (field) {
|
||||
setNeedle2(field->getDouble());
|
||||
} else {
|
||||
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
*/
|
||||
void AirspeedGadgetWidget::updateNeedle3(UAVObject *object3) {
|
||||
UAVObjectField* field = object3->getField(field3);
|
||||
if (field) {
|
||||
setNeedle3(field->getDouble());
|
||||
} else {
|
||||
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Initializes the dial file, and does all the one-time calculations for
|
||||
display later.
|
||||
*/
|
||||
void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2,
|
||||
QString n3, QString n1Move, QString n2Move, QString n3Move)
|
||||
{
|
||||
if (QFile::exists(dfn))
|
||||
{
|
||||
m_renderer->load(dfn);
|
||||
if(m_renderer->isValid())
|
||||
{
|
||||
fgenabled = false;
|
||||
n2enabled = false;
|
||||
n3enabled = false;
|
||||
QGraphicsScene *l_scene = scene();
|
||||
l_scene->clear(); // Deletes all items contained in the scene as well.
|
||||
m_background = new QGraphicsSvgItem();
|
||||
// All other items will be clipped to the shape of the background
|
||||
m_background->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
|
||||
QGraphicsItem::ItemClipsToShape);
|
||||
m_foreground = new QGraphicsSvgItem();
|
||||
m_needle1 = new QGraphicsSvgItem();
|
||||
m_needle2 = new QGraphicsSvgItem();
|
||||
m_needle3 = new QGraphicsSvgItem();
|
||||
m_needle1->setParentItem(m_background);
|
||||
m_needle2->setParentItem(m_background);
|
||||
m_needle3->setParentItem(m_background);
|
||||
m_foreground->setParentItem(m_background);
|
||||
|
||||
// We assume the dial contains at least the background
|
||||
// and needle1
|
||||
m_background->setSharedRenderer(m_renderer);
|
||||
m_background->setElementId(bg);
|
||||
l_scene->addItem(m_background);
|
||||
|
||||
m_needle1->setSharedRenderer(m_renderer);
|
||||
m_needle1->setElementId(n1);
|
||||
l_scene->addItem(m_needle1);
|
||||
|
||||
// The dial gadget allows Needle1 and Needle2 to be
|
||||
// the same element, for combined movement. Needle3
|
||||
// is always independent.
|
||||
if (n1 == n2) {
|
||||
m_needle2 = m_needle1;
|
||||
n2enabled = true;
|
||||
} else {
|
||||
if (m_renderer->elementExists(n2)) {
|
||||
m_needle2->setSharedRenderer(m_renderer);
|
||||
m_needle2->setElementId(n2);
|
||||
l_scene->addItem(m_needle2);
|
||||
n2enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_renderer->elementExists(n3)) {
|
||||
m_needle3->setSharedRenderer(m_renderer);
|
||||
m_needle3->setElementId(n3);
|
||||
l_scene->addItem(m_needle3);
|
||||
n3enabled = true;
|
||||
}
|
||||
|
||||
if (m_renderer->elementExists(fg)) {
|
||||
m_foreground->setSharedRenderer(m_renderer);
|
||||
m_foreground->setElementId(fg);
|
||||
l_scene->addItem(m_foreground);
|
||||
fgenabled = true;
|
||||
}
|
||||
|
||||
rotateN1 = false;
|
||||
horizN1 = false;
|
||||
vertN1 = false;
|
||||
rotateN2 = false;
|
||||
horizN2 = false;
|
||||
vertN2 = false;
|
||||
rotateN3 = false;
|
||||
horizN3 = false;
|
||||
vertN3 = false;
|
||||
|
||||
|
||||
// Now setup the rotation/translation settings:
|
||||
// this is UGLY UGLY UGLY, sorry...
|
||||
if (n1Move.contains("Rotate")) {
|
||||
rotateN1 = true;
|
||||
} else if (n1Move.contains("Horizontal")) {
|
||||
horizN1 = true;
|
||||
} else if (n1Move.contains("Vertical")) {
|
||||
vertN1 = true;
|
||||
}
|
||||
|
||||
if (n2Move.contains("Rotate")) {
|
||||
rotateN2 = true;
|
||||
} else if (n2Move.contains("Horizontal")) {
|
||||
horizN2 = true;
|
||||
} else if (n2Move.contains("Vertical")) {
|
||||
vertN2 = true;
|
||||
}
|
||||
|
||||
if (n3Move.contains("Rotate")) {
|
||||
rotateN3 = true;
|
||||
} else if (n3Move.contains("Horizontal")) {
|
||||
horizN3 = true;
|
||||
} else if (n3Move.contains("Vertical")) {
|
||||
vertN3 = true;
|
||||
}
|
||||
|
||||
l_scene->setSceneRect(m_background->boundingRect());
|
||||
|
||||
// Now Initialize the center for all transforms of the dial needles to the
|
||||
// center of the background:
|
||||
// - Move the center of the needle to the center of the background.
|
||||
QRectF rectB = m_background->boundingRect();
|
||||
QRectF rectN = m_needle1->boundingRect();
|
||||
m_needle1->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
|
||||
// - Put the transform origin point of the needle at its center.
|
||||
m_needle1->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
|
||||
if ((n1 != n2) && n2enabled) {
|
||||
// Only do it for needle1 if it is not the same as n2
|
||||
rectN = m_needle2->boundingRect();
|
||||
m_needle2->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
|
||||
m_needle2->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
|
||||
}
|
||||
if (n3enabled) {
|
||||
rectN = m_needle3->boundingRect();
|
||||
m_needle3->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
|
||||
m_needle3->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
|
||||
}
|
||||
|
||||
// Last: we just loaded the dial file which is by default valid for a "zero" value
|
||||
// of the needles, so we have to reset the needles too upon dial file loading, otherwise
|
||||
// we would end up with an offset when we change a dial file and the needle value
|
||||
// is not zero at that time.
|
||||
needle1Target = 0;
|
||||
needle2Target = 0;
|
||||
needle3Target = 0;
|
||||
needle1Value = 0;
|
||||
needle2Value = 0;
|
||||
needle3Value = 0;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{ std::cout<<"no file: "<<std::endl; }
|
||||
}
|
||||
|
||||
void AirspeedGadgetWidget::paint()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void AirspeedGadgetWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
// Skip painting until the dial file is loaded
|
||||
if (! m_renderer->isValid()) {
|
||||
std::cout<<"Dial file not loaded, not rendering"<<std::endl;
|
||||
return;
|
||||
}
|
||||
QGraphicsView::paintEvent(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)
|
||||
{
|
||||
fitInView(m_background, Qt::KeepAspectRatio );
|
||||
}
|
||||
|
||||
// Converts the value into an angle:
|
||||
// this enables smooth rotation in rotateNeedles below
|
||||
void AirspeedGadgetWidget::setNeedle1(double value) {
|
||||
if (rotateN1) {
|
||||
needle1Target = 360*value*n1Factor/(n1MaxValue-n1MinValue);
|
||||
}
|
||||
if (horizN1) {
|
||||
needle1Target = value*n1Factor/(n1MaxValue-n1MinValue);
|
||||
}
|
||||
if (vertN1) {
|
||||
needle1Target = value*n1Factor/(n1MaxValue-n1MinValue);
|
||||
}
|
||||
if (!dialTimer.isActive())
|
||||
dialTimer.start();
|
||||
}
|
||||
|
||||
void AirspeedGadgetWidget::setNeedle2(double value) {
|
||||
if (rotateN2) {
|
||||
needle2Target = 360*value*n2Factor/(n2MaxValue-n2MinValue);
|
||||
}
|
||||
if (horizN2) {
|
||||
needle2Target = value*n2Factor/(n2MaxValue-n2MinValue);
|
||||
}
|
||||
if (vertN2) {
|
||||
needle2Target = value*n2Factor/(n2MaxValue-n2MinValue);
|
||||
}
|
||||
if (!dialTimer.isActive())
|
||||
dialTimer.start();
|
||||
}
|
||||
|
||||
void AirspeedGadgetWidget::setNeedle3(double value) {
|
||||
if (rotateN3) {
|
||||
needle3Target = 360*value*n3Factor/(n3MaxValue-n3MinValue);
|
||||
}
|
||||
if (horizN3) {
|
||||
needle3Target = value*n3Factor/(n3MaxValue-n3MinValue);
|
||||
}
|
||||
if (vertN3) {
|
||||
needle3Target = value*n3Factor/(n3MaxValue-n3MinValue);
|
||||
}
|
||||
if (!dialTimer.isActive())
|
||||
dialTimer.start();
|
||||
}
|
||||
|
||||
// Take an input value and rotate the dial accordingly
|
||||
// Rotation is smooth, starts fast and slows down when
|
||||
// approaching the target.
|
||||
// We aim for a 0.5 degree precision.
|
||||
//
|
||||
// Note: this code is valid even if needle1 and needle2 point
|
||||
// to the same element.
|
||||
void AirspeedGadgetWidget::rotateNeedles()
|
||||
{
|
||||
int dialRun = 3;
|
||||
if (n2enabled) {
|
||||
if (abs((needle2Value-needle2Target)*10) > 5) {
|
||||
double needle2Diff;
|
||||
needle2Diff =(needle2Target - needle2Value)/5;
|
||||
if (rotateN2) {
|
||||
m_needle2->setRotation(m_needle2->rotation()+needle2Diff);
|
||||
} else {
|
||||
QPointF opd = QPointF(0,0);
|
||||
if (horizN2) {
|
||||
opd = QPointF(needle2Diff,0);
|
||||
}
|
||||
if (vertN2) {
|
||||
opd = QPointF(0,needle2Diff);
|
||||
}
|
||||
m_needle2->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true);
|
||||
// Since we have moved the needle, we need to move
|
||||
// the transform origin point the opposite way
|
||||
// so that it keeps rotating from the same point.
|
||||
// (this is only useful if needle1 and needle2 are the
|
||||
// same object, for combined movement such as attitude indicator).
|
||||
QPointF oop = m_needle2->transformOriginPoint();
|
||||
m_needle2->setTransformOriginPoint(oop.x()-opd.x(),oop.y()-opd.y());
|
||||
}
|
||||
needle2Value += needle2Diff;
|
||||
} else {
|
||||
needle2Value = needle2Target;
|
||||
dialRun--;
|
||||
}
|
||||
} else {
|
||||
dialRun--;
|
||||
}
|
||||
|
||||
// We assume that needle1 always exists!
|
||||
if ((abs((needle1Value-needle1Target)*10) > 5)) {
|
||||
double needle1Diff;
|
||||
needle1Diff = (needle1Target - needle1Value)/5;
|
||||
if (rotateN1) {
|
||||
m_needle1->setRotation(m_needle1->rotation()+needle1Diff);
|
||||
} else {
|
||||
QPointF opd = QPointF(0,0);
|
||||
if (horizN1) {
|
||||
opd = QPointF(needle1Diff,0);
|
||||
}
|
||||
if (vertN1) {
|
||||
opd = QPointF(0,needle1Diff);
|
||||
}
|
||||
m_needle1->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true);
|
||||
QPointF oop = m_needle1->transformOriginPoint();
|
||||
m_needle1->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y()));
|
||||
}
|
||||
needle1Value += needle1Diff;
|
||||
} else { // value is close enough to target, value to exact target
|
||||
// to cancel out any potential drift
|
||||
needle1Value = needle1Target;
|
||||
dialRun--;
|
||||
}
|
||||
|
||||
if (n3enabled) {
|
||||
if ((abs((needle3Value-needle3Target)*10) > 5)) {
|
||||
double needle3Diff;
|
||||
needle3Diff = (needle3Target - needle3Value)/5;
|
||||
if (rotateN3) {
|
||||
m_needle3->setRotation(m_needle3->rotation()+needle3Diff);
|
||||
} else {
|
||||
QPointF opd = QPointF(0,0);
|
||||
if (horizN3) {
|
||||
opd = QPointF(needle3Diff,0);
|
||||
}
|
||||
if (vertN3) {
|
||||
opd = QPointF(0,needle3Diff);
|
||||
}
|
||||
m_needle3->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true);
|
||||
QPointF oop = m_needle3->transformOriginPoint();
|
||||
m_needle3->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y()));
|
||||
}
|
||||
needle3Value += needle3Diff;
|
||||
} else {
|
||||
needle3Value = needle3Target;
|
||||
dialRun--;
|
||||
}
|
||||
} else {
|
||||
dialRun--;
|
||||
}
|
||||
update();
|
||||
// Now check: if dialRun is now zero, we should
|
||||
// just stop the timer since all needles have finished moving
|
||||
if (!dialRun) dialTimer.stop();
|
||||
}
|
||||
|
@ -1,138 +1,138 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadgetwidget.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup airspeed
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 AIRSPEEDGADGETWIDGET_H_
|
||||
#define AIRSPEEDGADGETWIDGET_H_
|
||||
|
||||
#include "airspeedgadgetconfiguration.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/uavobject.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
|
||||
class AirspeedGadgetWidget : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AirspeedGadgetWidget(QWidget *parent = 0);
|
||||
~AirspeedGadgetWidget();
|
||||
void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n3,
|
||||
QString n1Move, QString n2Move, QString n3Move);
|
||||
void paint();
|
||||
// setNeedle1 and setNeedle2 use a timer to simulate
|
||||
// needle inertia
|
||||
void setNeedle1(double value);
|
||||
void setNeedle2(double value);
|
||||
void setNeedle3(double value);
|
||||
void setN1Min(double value) {n1MinValue = value;}
|
||||
void setN1Max(double value) {n1MaxValue = value;}
|
||||
void setN1Factor(double value) {n1Factor = value;}
|
||||
void setN2Min(double value) {n2MinValue = value;}
|
||||
void setN2Max(double value) {n2MaxValue = value;}
|
||||
void setN2Factor(double value) {n2Factor = value;}
|
||||
void setN3Min(double value) {n3MinValue = value;}
|
||||
void setN3Max(double value) {n3MaxValue = value;}
|
||||
void setN3Factor(double value) {n3Factor = value;}
|
||||
// Sets up needle/UAVObject connections:
|
||||
void connectNeedles(QString object1, QString field1,
|
||||
QString object2, QString field2,
|
||||
QString object3, QString field3);
|
||||
|
||||
public slots:
|
||||
void updateNeedle1(UAVObject *object1); // Called by the UAVObject
|
||||
void updateNeedle2(UAVObject *object2); // Called by the UAVObject
|
||||
void updateNeedle3(UAVObject *object3); // Called by the UAVObject
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
|
||||
private slots:
|
||||
void rotateNeedles();
|
||||
|
||||
private:
|
||||
QSvgRenderer *m_renderer;
|
||||
QGraphicsSvgItem *m_background;
|
||||
QGraphicsSvgItem *m_foreground;
|
||||
QGraphicsSvgItem *m_needle1;
|
||||
QGraphicsSvgItem *m_needle2;
|
||||
QGraphicsSvgItem *m_needle3;
|
||||
|
||||
bool n3enabled;
|
||||
bool n2enabled; // Simple flag to skip rendering if the
|
||||
bool fgenabled; // layer does not exist.
|
||||
|
||||
// Settings concerning move of the dials
|
||||
bool rotateN1;
|
||||
bool rotateN2;
|
||||
bool rotateN3;
|
||||
bool horizN1;
|
||||
bool horizN2;
|
||||
bool horizN3;
|
||||
bool vertN1;
|
||||
bool vertN2;
|
||||
bool vertN3;
|
||||
|
||||
double n1MinValue;
|
||||
double n1MaxValue;
|
||||
double n1Factor;
|
||||
double n2MinValue;
|
||||
double n2MaxValue;
|
||||
double n2Factor;
|
||||
double n3MinValue;
|
||||
double n3MaxValue;
|
||||
double n3Factor;
|
||||
|
||||
// The Value and target variables
|
||||
// are expressed in degrees
|
||||
double needle1Target;
|
||||
double needle1Value;
|
||||
double needle2Target;
|
||||
double needle2Value;
|
||||
double needle3Target;
|
||||
double needle3Value;
|
||||
|
||||
// Name of the fields to read when an update is received:
|
||||
UAVDataObject* obj1;
|
||||
UAVDataObject* obj2;
|
||||
UAVDataObject* obj3;
|
||||
QString field1;
|
||||
QString field2;
|
||||
QString field3;
|
||||
|
||||
// Rotation timer
|
||||
QTimer dialTimer;
|
||||
|
||||
};
|
||||
#endif /* AIRSPEEDGADGETWIDGET_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedgadgetwidget.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 AIRSPEEDGADGETWIDGET_H_
|
||||
#define AIRSPEEDGADGETWIDGET_H_
|
||||
|
||||
#include "airspeedgadgetconfiguration.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/uavobject.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
|
||||
class AirspeedGadgetWidget : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AirspeedGadgetWidget(QWidget *parent = 0);
|
||||
~AirspeedGadgetWidget();
|
||||
void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n3,
|
||||
QString n1Move, QString n2Move, QString n3Move);
|
||||
void paint();
|
||||
// setNeedle1 and setNeedle2 use a timer to simulate
|
||||
// needle inertia
|
||||
void setNeedle1(double value);
|
||||
void setNeedle2(double value);
|
||||
void setNeedle3(double value);
|
||||
void setN1Min(double value) {n1MinValue = value;}
|
||||
void setN1Max(double value) {n1MaxValue = value;}
|
||||
void setN1Factor(double value) {n1Factor = value;}
|
||||
void setN2Min(double value) {n2MinValue = value;}
|
||||
void setN2Max(double value) {n2MaxValue = value;}
|
||||
void setN2Factor(double value) {n2Factor = value;}
|
||||
void setN3Min(double value) {n3MinValue = value;}
|
||||
void setN3Max(double value) {n3MaxValue = value;}
|
||||
void setN3Factor(double value) {n3Factor = value;}
|
||||
// Sets up needle/UAVObject connections:
|
||||
void connectNeedles(QString object1, QString field1,
|
||||
QString object2, QString field2,
|
||||
QString object3, QString field3);
|
||||
|
||||
public slots:
|
||||
void updateNeedle1(UAVObject *object1); // Called by the UAVObject
|
||||
void updateNeedle2(UAVObject *object2); // Called by the UAVObject
|
||||
void updateNeedle3(UAVObject *object3); // Called by the UAVObject
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
|
||||
private slots:
|
||||
void rotateNeedles();
|
||||
|
||||
private:
|
||||
QSvgRenderer *m_renderer;
|
||||
QGraphicsSvgItem *m_background;
|
||||
QGraphicsSvgItem *m_foreground;
|
||||
QGraphicsSvgItem *m_needle1;
|
||||
QGraphicsSvgItem *m_needle2;
|
||||
QGraphicsSvgItem *m_needle3;
|
||||
|
||||
bool n3enabled;
|
||||
bool n2enabled; // Simple flag to skip rendering if the
|
||||
bool fgenabled; // layer does not exist.
|
||||
|
||||
// Settings concerning move of the dials
|
||||
bool rotateN1;
|
||||
bool rotateN2;
|
||||
bool rotateN3;
|
||||
bool horizN1;
|
||||
bool horizN2;
|
||||
bool horizN3;
|
||||
bool vertN1;
|
||||
bool vertN2;
|
||||
bool vertN3;
|
||||
|
||||
double n1MinValue;
|
||||
double n1MaxValue;
|
||||
double n1Factor;
|
||||
double n2MinValue;
|
||||
double n2MaxValue;
|
||||
double n2Factor;
|
||||
double n3MinValue;
|
||||
double n3MaxValue;
|
||||
double n3Factor;
|
||||
|
||||
// The Value and target variables
|
||||
// are expressed in degrees
|
||||
double needle1Target;
|
||||
double needle1Value;
|
||||
double needle2Target;
|
||||
double needle2Value;
|
||||
double needle3Target;
|
||||
double needle3Value;
|
||||
|
||||
// Name of the fields to read when an update is received:
|
||||
UAVDataObject* obj1;
|
||||
UAVDataObject* obj2;
|
||||
UAVDataObject* obj3;
|
||||
QString field1;
|
||||
QString field2;
|
||||
QString field3;
|
||||
|
||||
// Rotation timer
|
||||
QTimer dialTimer;
|
||||
|
||||
};
|
||||
#endif /* AIRSPEEDGADGETWIDGET_H_ */
|
||||
|
@ -1,66 +1,66 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedplugin.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup airspeed
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "airspeedplugin.h"
|
||||
#include "airspeedgadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
AirspeedPlugin::AirspeedPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
AirspeedPlugin::~AirspeedPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool AirspeedPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new AirspeedGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AirspeedPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void AirspeedPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(AirspeedPlugin)
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedplugin.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "airspeedplugin.h"
|
||||
#include "airspeedgadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
AirspeedPlugin::AirspeedPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
AirspeedPlugin::~AirspeedPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool AirspeedPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new AirspeedGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AirspeedPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void AirspeedPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(AirspeedPlugin)
|
||||
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedplugin.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup airspeed
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 AIRSPEEDPLUGIN_H_
|
||||
#define AIRSPEEDPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class AirspeedGadgetFactory;
|
||||
|
||||
class AirspeedPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
AirspeedPlugin();
|
||||
~AirspeedPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
AirspeedGadgetFactory *mf;
|
||||
};
|
||||
#endif /* AIRSPEEDPLUGIN_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file airspeedplugin.h
|
||||
* @author David "Buzz" Carlson Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup dialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 AIRSPEEDPLUGIN_H_
|
||||
#define AIRSPEEDPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class AirspeedGadgetFactory;
|
||||
|
||||
class AirspeedPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
AirspeedPlugin();
|
||||
~AirspeedPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
AirspeedGadgetFactory *mf;
|
||||
};
|
||||
#endif /* AIRSPEEDPLUGIN_H_ */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup map
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup map
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup map
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup config
|
||||
* @defgroup configplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -1,96 +0,0 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'configgadget.ui'
|
||||
**
|
||||
** Created: Wed 19. May 23:01:40 2010
|
||||
** by: Qt User Interface Compiler version 4.6.2
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef UI_CONFIGGADGET_H
|
||||
#define UI_CONFIGGADGET_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QFrame>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Ui_ConfigGadget
|
||||
{
|
||||
public:
|
||||
QWidget *horizontalLayoutWidget;
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QSpacerItem *horizontalSpacer;
|
||||
QPushButton *sendButtun;
|
||||
QTreeView *treeView;
|
||||
QFrame *frame;
|
||||
|
||||
void setupUi(QWidget *ConfigGadget)
|
||||
{
|
||||
if (ConfigGadget->objectName().isEmpty())
|
||||
ConfigGadget->setObjectName(QString::fromUtf8("ConfigGadget"));
|
||||
ConfigGadget->resize(500, 400);
|
||||
horizontalLayoutWidget = new QWidget(ConfigGadget);
|
||||
horizontalLayoutWidget->setObjectName(QString::fromUtf8("horizontalLayoutWidget"));
|
||||
horizontalLayoutWidget->setGeometry(QRect(10, 350, 481, 41));
|
||||
horizontalLayout = new QHBoxLayout(horizontalLayoutWidget);
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
horizontalLayout->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
horizontalLayout->addItem(horizontalSpacer);
|
||||
|
||||
sendButtun = new QPushButton(horizontalLayoutWidget);
|
||||
sendButtun->setObjectName(QString::fromUtf8("sendButtun"));
|
||||
|
||||
horizontalLayout->addWidget(sendButtun);
|
||||
|
||||
treeView = new QTreeView(ConfigGadget);
|
||||
treeView->setObjectName(QString::fromUtf8("treeView"));
|
||||
treeView->setGeometry(QRect(10, 10, 221, 331));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(treeView->sizePolicy().hasHeightForWidth());
|
||||
treeView->setSizePolicy(sizePolicy);
|
||||
frame = new QFrame(ConfigGadget);
|
||||
frame->setObjectName(QString::fromUtf8("frame"));
|
||||
frame->setGeometry(QRect(240, 10, 251, 331));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
sizePolicy1.setHorizontalStretch(0);
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(frame->sizePolicy().hasHeightForWidth());
|
||||
frame->setSizePolicy(sizePolicy1);
|
||||
frame->setFrameShape(QFrame::StyledPanel);
|
||||
frame->setFrameShadow(QFrame::Raised);
|
||||
|
||||
retranslateUi(ConfigGadget);
|
||||
|
||||
QMetaObject::connectSlotsByName(ConfigGadget);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QWidget *ConfigGadget)
|
||||
{
|
||||
ConfigGadget->setWindowTitle(QApplication::translate("ConfigGadget", "Form", 0, QApplication::UnicodeUTF8));
|
||||
sendButtun->setText(QApplication::translate("ConfigGadget", "Send", 0, QApplication::UnicodeUTF8));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class ConfigGadget: public Ui_ConfigGadget {};
|
||||
} // namespace Ui
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // UI_CONFIGGADGET_H
|
@ -1,96 +0,0 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'configgadgetwidget.ui'
|
||||
**
|
||||
** Created: Tue 18. May 19:44:42 2010
|
||||
** by: Qt User Interface Compiler version 4.6.2
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef UI_CONFIGGADGETWIDGET_H
|
||||
#define UI_CONFIGGADGETWIDGET_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QFrame>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Ui_ConfigGadgetWidget
|
||||
{
|
||||
public:
|
||||
QWidget *horizontalLayoutWidget;
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QSpacerItem *horizontalSpacer;
|
||||
QPushButton *sendButtun;
|
||||
QTreeView *treeView;
|
||||
QFrame *frame;
|
||||
|
||||
void setupUi(QWidget *ConfigGadgetWidget)
|
||||
{
|
||||
if (ConfigGadgetWidget->objectName().isEmpty())
|
||||
ConfigGadgetWidget->setObjectName(QString::fromUtf8("ConfigGadgetWidget"));
|
||||
ConfigGadgetWidget->resize(500, 400);
|
||||
horizontalLayoutWidget = new QWidget(ConfigGadgetWidget);
|
||||
horizontalLayoutWidget->setObjectName(QString::fromUtf8("horizontalLayoutWidget"));
|
||||
horizontalLayoutWidget->setGeometry(QRect(10, 350, 481, 41));
|
||||
horizontalLayout = new QHBoxLayout(horizontalLayoutWidget);
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
horizontalLayout->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
horizontalLayout->addItem(horizontalSpacer);
|
||||
|
||||
sendButtun = new QPushButton(horizontalLayoutWidget);
|
||||
sendButtun->setObjectName(QString::fromUtf8("sendButtun"));
|
||||
|
||||
horizontalLayout->addWidget(sendButtun);
|
||||
|
||||
treeView = new QTreeView(ConfigGadgetWidget);
|
||||
treeView->setObjectName(QString::fromUtf8("treeView"));
|
||||
treeView->setGeometry(QRect(10, 10, 221, 331));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(treeView->sizePolicy().hasHeightForWidth());
|
||||
treeView->setSizePolicy(sizePolicy);
|
||||
frame = new QFrame(ConfigGadgetWidget);
|
||||
frame->setObjectName(QString::fromUtf8("frame"));
|
||||
frame->setGeometry(QRect(240, 10, 251, 331));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
sizePolicy1.setHorizontalStretch(0);
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(frame->sizePolicy().hasHeightForWidth());
|
||||
frame->setSizePolicy(sizePolicy1);
|
||||
frame->setFrameShape(QFrame::StyledPanel);
|
||||
frame->setFrameShadow(QFrame::Raised);
|
||||
|
||||
retranslateUi(ConfigGadgetWidget);
|
||||
|
||||
QMetaObject::connectSlotsByName(ConfigGadgetWidget);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QWidget *ConfigGadgetWidget)
|
||||
{
|
||||
ConfigGadgetWidget->setWindowTitle(QApplication::translate("ConfigGadgetWidget", "Form", 0, QApplication::UnicodeUTF8));
|
||||
sendButtun->setText(QApplication::translate("ConfigGadgetWidget", "Send", 0, QApplication::UnicodeUTF8));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class ConfigGadgetWidget: public Ui_ConfigGadgetWidget {};
|
||||
} // namespace Ui
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // UI_CONFIGGADGETWIDGET_H
|
@ -1,51 +1,51 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "consolegadget.h"
|
||||
#include "consolegadgetwidget.h"
|
||||
#include "texteditloggerengine.h"
|
||||
|
||||
ConsoleGadget::ConsoleGadget(QString classId, ConsoleGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
m_logger = new TextEditLoggerEngine(widget);
|
||||
bool suitableName = false;
|
||||
int i = 0;
|
||||
QString loggerName;
|
||||
while (!suitableName) {
|
||||
loggerName = "TextEditLogger" + QVariant(i).toString();
|
||||
if (!qxtLog->isLoggerEngine(loggerName))
|
||||
suitableName = true;
|
||||
++i;
|
||||
}
|
||||
qxtLog->addLoggerEngine(loggerName, m_logger);
|
||||
}
|
||||
|
||||
ConsoleGadget::~ConsoleGadget()
|
||||
{
|
||||
qxtLog->removeLoggerEngine(m_logger);
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "consolegadget.h"
|
||||
#include "consolegadgetwidget.h"
|
||||
#include "texteditloggerengine.h"
|
||||
|
||||
ConsoleGadget::ConsoleGadget(QString classId, ConsoleGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
m_logger = new TextEditLoggerEngine(widget);
|
||||
bool suitableName = false;
|
||||
int i = 0;
|
||||
QString loggerName;
|
||||
while (!suitableName) {
|
||||
loggerName = "TextEditLogger" + QVariant(i).toString();
|
||||
if (!qxtLog->isLoggerEngine(loggerName))
|
||||
suitableName = true;
|
||||
++i;
|
||||
}
|
||||
qxtLog->addLoggerEngine(loggerName, m_logger);
|
||||
}
|
||||
|
||||
ConsoleGadget::~ConsoleGadget()
|
||||
{
|
||||
qxtLog->removeLoggerEngine(m_logger);
|
||||
}
|
||||
|
@ -1,59 +1,59 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 CONSOLEGADGET_H_
|
||||
#define CONSOLEGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
}
|
||||
class ConsoleGadgetWidget;
|
||||
class TextEditLoggerEngine;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ConsoleGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConsoleGadget(QString classId, ConsoleGadgetWidget *widget, QWidget *parent = 0);
|
||||
~ConsoleGadget();
|
||||
|
||||
QList<int> context() const { return m_context; }
|
||||
QWidget *widget() { return m_widget; }
|
||||
QString contextHelpId() const { return QString(); }
|
||||
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
QList<int> m_context;
|
||||
TextEditLoggerEngine *m_logger;
|
||||
};
|
||||
|
||||
|
||||
#endif // CONSOLEGADGET_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 CONSOLEGADGET_H_
|
||||
#define CONSOLEGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
}
|
||||
class ConsoleGadgetWidget;
|
||||
class TextEditLoggerEngine;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ConsoleGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConsoleGadget(QString classId, ConsoleGadgetWidget *widget, QWidget *parent = 0);
|
||||
~ConsoleGadget();
|
||||
|
||||
QList<int> context() const { return m_context; }
|
||||
QWidget *widget() { return m_widget; }
|
||||
QString contextHelpId() const { return QString(); }
|
||||
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
QList<int> m_context;
|
||||
TextEditLoggerEngine *m_logger;
|
||||
};
|
||||
|
||||
|
||||
#endif // CONSOLEGADGET_H_
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadgetfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "consolegadgetfactory.h"
|
||||
#include "consolegadgetwidget.h"
|
||||
#include "consolegadget.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
ConsoleGadgetFactory::ConsoleGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("ConsoleGadget"),
|
||||
tr("Console"),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
ConsoleGadgetFactory::~ConsoleGadgetFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
IUAVGadget* ConsoleGadgetFactory::createGadget(QWidget *parent) {
|
||||
ConsoleGadgetWidget* gadgetWidget = new ConsoleGadgetWidget(parent);
|
||||
return new ConsoleGadget(QString("ConsoleGadget"), gadgetWidget, parent);
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadgetfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "consolegadgetfactory.h"
|
||||
#include "consolegadgetwidget.h"
|
||||
#include "consolegadget.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
ConsoleGadgetFactory::ConsoleGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("ConsoleGadget"),
|
||||
tr("Console"),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
ConsoleGadgetFactory::~ConsoleGadgetFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
IUAVGadget* ConsoleGadgetFactory::createGadget(QWidget *parent) {
|
||||
ConsoleGadgetWidget* gadgetWidget = new ConsoleGadgetWidget(parent);
|
||||
return new ConsoleGadget(QString("ConsoleGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
@ -1,50 +1,50 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadgetfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 CONSOLEGADGETFACTORY_H_
|
||||
#define CONSOLEGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ConsoleGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConsoleGadgetFactory(QObject *parent = 0);
|
||||
~ConsoleGadgetFactory();
|
||||
|
||||
IUAVGadget *createGadget(QWidget *parent);
|
||||
};
|
||||
|
||||
#endif // CONSOLEGADGETFACTORY_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadgetfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 CONSOLEGADGETFACTORY_H_
|
||||
#define CONSOLEGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ConsoleGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConsoleGadgetFactory(QObject *parent = 0);
|
||||
~ConsoleGadgetFactory();
|
||||
|
||||
IUAVGadget *createGadget(QWidget *parent);
|
||||
};
|
||||
|
||||
#endif // CONSOLEGADGETFACTORY_H_
|
||||
|
@ -1,44 +1,44 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadgetwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "consolegadgetwidget.h"
|
||||
#include "qxtlogger.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtGui/QTextEdit>
|
||||
|
||||
ConsoleGadgetWidget::ConsoleGadgetWidget(QWidget *parent) : QTextEdit(parent)
|
||||
{
|
||||
setMinimumSize(64,64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setReadOnly(true);
|
||||
}
|
||||
|
||||
ConsoleGadgetWidget::~ConsoleGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadgetwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "consolegadgetwidget.h"
|
||||
#include "qxtlogger.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtGui/QTextEdit>
|
||||
|
||||
ConsoleGadgetWidget::ConsoleGadgetWidget(QWidget *parent) : QTextEdit(parent)
|
||||
{
|
||||
setMinimumSize(64,64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setReadOnly(true);
|
||||
}
|
||||
|
||||
ConsoleGadgetWidget::~ConsoleGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
@ -1,44 +1,44 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadgetwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 CONSOLEGADGETWIDGET_H_
|
||||
#define CONSOLEGADGETWIDGET_H_
|
||||
|
||||
#include <QtGui/QTextEdit>
|
||||
|
||||
class ConsoleGadgetWidget : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConsoleGadgetWidget(QWidget *parent = 0);
|
||||
~ConsoleGadgetWidget();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* CONSOLEGADGETWIDGET_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consolegadgetwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 CONSOLEGADGETWIDGET_H_
|
||||
#define CONSOLEGADGETWIDGET_H_
|
||||
|
||||
#include <QtGui/QTextEdit>
|
||||
|
||||
class ConsoleGadgetWidget : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConsoleGadgetWidget(QWidget *parent = 0);
|
||||
~ConsoleGadgetWidget();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* CONSOLEGADGETWIDGET_H_ */
|
||||
|
@ -1,65 +1,65 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consoleplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "consoleplugin.h"
|
||||
#include "consolegadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
ConsolePlugin::ConsolePlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
ConsolePlugin::~ConsolePlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool ConsolePlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new ConsoleGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConsolePlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void ConsolePlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(ConsolePlugin)
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consoleplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "consoleplugin.h"
|
||||
#include "consolegadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
ConsolePlugin::ConsolePlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
ConsolePlugin::~ConsolePlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool ConsolePlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new ConsoleGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConsolePlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void ConsolePlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(ConsolePlugin)
|
||||
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consoleplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 CONSOLEPLUGIN_H_
|
||||
#define CONSOLEPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class ConsoleGadgetFactory;
|
||||
|
||||
class ConsolePlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
ConsolePlugin();
|
||||
~ConsolePlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
ConsoleGadgetFactory *mf;
|
||||
};
|
||||
#endif /* CONSOLEPLUGIN_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file consoleplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 CONSOLEPLUGIN_H_
|
||||
#define CONSOLEPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class ConsoleGadgetFactory;
|
||||
|
||||
class ConsolePlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
ConsolePlugin();
|
||||
~ConsolePlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
ConsoleGadgetFactory *mf;
|
||||
};
|
||||
#endif /* CONSOLEPLUGIN_H_ */
|
||||
|
@ -1,135 +1,135 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file texteditloggerengine.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Qxt Foundation http://www.libqxt.org Copyright (C)
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "texteditloggerengine.h"
|
||||
#include <QTime>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtGui/QScrollBar>
|
||||
#include <QObject>
|
||||
|
||||
#define QXT_REQUIRED_LEVELS (QxtLogger::WarningLevel | QxtLogger::ErrorLevel | QxtLogger::CriticalLevel | QxtLogger::FatalLevel)
|
||||
|
||||
TextEditLoggerEngine::TextEditLoggerEngine(QTextEdit *textEdit) : m_textEdit(textEdit)
|
||||
{
|
||||
#ifndef QT_NO_DEBUG
|
||||
setLogLevelsEnabled(QXT_REQUIRED_LEVELS);
|
||||
#else
|
||||
setLogLevelsEnabled(QXT_REQUIRED_LEVELS | QxtLogger::DebugLevel);
|
||||
#endif
|
||||
enableLogging();
|
||||
}
|
||||
|
||||
TextEditLoggerEngine::~TextEditLoggerEngine()
|
||||
{
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::initLoggerEngine()
|
||||
{
|
||||
return; // Should work out of the box!
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::killLoggerEngine()
|
||||
{
|
||||
return; // I do nothing.
|
||||
}
|
||||
|
||||
bool TextEditLoggerEngine::isInitialized() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::setLogLevelEnabled(QxtLogger::LogLevels level, bool enable)
|
||||
{
|
||||
QxtLoggerEngine::setLogLevelsEnabled(level | QXT_REQUIRED_LEVELS, enable);
|
||||
if (!enable) QxtLoggerEngine::setLogLevelsEnabled(QXT_REQUIRED_LEVELS);
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::writeFormatted(QxtLogger::LogLevel level, const QList<QVariant> &msgs)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case QxtLogger::ErrorLevel:
|
||||
writeToTextEdit("Error", msgs, Qt::red);
|
||||
break;
|
||||
case QxtLogger::WarningLevel:
|
||||
writeToTextEdit("Warning", msgs, Qt::red);
|
||||
break;
|
||||
case QxtLogger::CriticalLevel:
|
||||
writeToTextEdit("Critical", msgs, Qt::red);
|
||||
break;
|
||||
case QxtLogger::FatalLevel:
|
||||
writeToTextEdit("!!FATAL!!", msgs, Qt::red);
|
||||
break;
|
||||
case QxtLogger::TraceLevel:
|
||||
writeToTextEdit("Trace", msgs, Qt::blue);
|
||||
break;
|
||||
case QxtLogger::DebugLevel:
|
||||
writeToTextEdit("DEBUG", msgs, Qt::blue);
|
||||
break;
|
||||
case QxtLogger::InfoLevel:
|
||||
writeToTextEdit("INFO", msgs);
|
||||
break;
|
||||
default:
|
||||
writeToTextEdit("", msgs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::writeToTextEdit(const QString& level, const QList<QVariant> &msgs, QColor color)
|
||||
{
|
||||
/* Message format...
|
||||
[time] [error level] First message.....
|
||||
second message
|
||||
third message
|
||||
*/
|
||||
if (msgs.isEmpty())
|
||||
return;
|
||||
QScrollBar *sb = m_textEdit->verticalScrollBar();
|
||||
bool scroll = sb->value() == sb->maximum();
|
||||
QString header = '[' + QTime::currentTime().toString("hh:mm:ss.zzz") + "] [" + level + "] ";
|
||||
QString padding;
|
||||
QString appendText;
|
||||
appendText.append(header);
|
||||
for (int i = 0; i < header.size(); i++) padding.append(' ');
|
||||
int count = 0;
|
||||
Q_FOREACH(const QVariant& out, msgs)
|
||||
{
|
||||
if (!out.isNull())
|
||||
{
|
||||
if (count != 0)
|
||||
appendText.append(padding);
|
||||
appendText.append(out.toString());
|
||||
}
|
||||
count++;
|
||||
}
|
||||
Q_ASSERT(m_textEdit);
|
||||
appendText = QString("<font color=%1>%2</font>").arg(color.name()).arg(appendText);
|
||||
m_textEdit->append(appendText);
|
||||
if (scroll)
|
||||
sb->setValue(sb->maximum());
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file texteditloggerengine.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Qxt Foundation http://www.libqxt.org Copyright (C)
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "texteditloggerengine.h"
|
||||
#include <QTime>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtGui/QScrollBar>
|
||||
#include <QObject>
|
||||
|
||||
#define QXT_REQUIRED_LEVELS (QxtLogger::WarningLevel | QxtLogger::ErrorLevel | QxtLogger::CriticalLevel | QxtLogger::FatalLevel)
|
||||
|
||||
TextEditLoggerEngine::TextEditLoggerEngine(QTextEdit *textEdit) : m_textEdit(textEdit)
|
||||
{
|
||||
#ifndef QT_NO_DEBUG
|
||||
setLogLevelsEnabled(QXT_REQUIRED_LEVELS);
|
||||
#else
|
||||
setLogLevelsEnabled(QXT_REQUIRED_LEVELS | QxtLogger::DebugLevel);
|
||||
#endif
|
||||
enableLogging();
|
||||
}
|
||||
|
||||
TextEditLoggerEngine::~TextEditLoggerEngine()
|
||||
{
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::initLoggerEngine()
|
||||
{
|
||||
return; // Should work out of the box!
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::killLoggerEngine()
|
||||
{
|
||||
return; // I do nothing.
|
||||
}
|
||||
|
||||
bool TextEditLoggerEngine::isInitialized() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::setLogLevelEnabled(QxtLogger::LogLevels level, bool enable)
|
||||
{
|
||||
QxtLoggerEngine::setLogLevelsEnabled(level | QXT_REQUIRED_LEVELS, enable);
|
||||
if (!enable) QxtLoggerEngine::setLogLevelsEnabled(QXT_REQUIRED_LEVELS);
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::writeFormatted(QxtLogger::LogLevel level, const QList<QVariant> &msgs)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case QxtLogger::ErrorLevel:
|
||||
writeToTextEdit("Error", msgs, Qt::red);
|
||||
break;
|
||||
case QxtLogger::WarningLevel:
|
||||
writeToTextEdit("Warning", msgs, Qt::red);
|
||||
break;
|
||||
case QxtLogger::CriticalLevel:
|
||||
writeToTextEdit("Critical", msgs, Qt::red);
|
||||
break;
|
||||
case QxtLogger::FatalLevel:
|
||||
writeToTextEdit("!!FATAL!!", msgs, Qt::red);
|
||||
break;
|
||||
case QxtLogger::TraceLevel:
|
||||
writeToTextEdit("Trace", msgs, Qt::blue);
|
||||
break;
|
||||
case QxtLogger::DebugLevel:
|
||||
writeToTextEdit("DEBUG", msgs, Qt::blue);
|
||||
break;
|
||||
case QxtLogger::InfoLevel:
|
||||
writeToTextEdit("INFO", msgs);
|
||||
break;
|
||||
default:
|
||||
writeToTextEdit("", msgs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditLoggerEngine::writeToTextEdit(const QString& level, const QList<QVariant> &msgs, QColor color)
|
||||
{
|
||||
/* Message format...
|
||||
[time] [error level] First message.....
|
||||
second message
|
||||
third message
|
||||
*/
|
||||
if (msgs.isEmpty())
|
||||
return;
|
||||
QScrollBar *sb = m_textEdit->verticalScrollBar();
|
||||
bool scroll = sb->value() == sb->maximum();
|
||||
QString header = '[' + QTime::currentTime().toString("hh:mm:ss.zzz") + "] [" + level + "] ";
|
||||
QString padding;
|
||||
QString appendText;
|
||||
appendText.append(header);
|
||||
for (int i = 0; i < header.size(); i++) padding.append(' ');
|
||||
int count = 0;
|
||||
Q_FOREACH(const QVariant& out, msgs)
|
||||
{
|
||||
if (!out.isNull())
|
||||
{
|
||||
if (count != 0)
|
||||
appendText.append(padding);
|
||||
appendText.append(out.toString());
|
||||
}
|
||||
count++;
|
||||
}
|
||||
Q_ASSERT(m_textEdit);
|
||||
appendText = QString("<font color=%1>%2</font>").arg(color.name()).arg(appendText);
|
||||
m_textEdit->append(appendText);
|
||||
if (scroll)
|
||||
sb->setValue(sb->maximum());
|
||||
}
|
||||
|
@ -1,57 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file texteditloggerengine.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Qxt Foundation http://www.libqxt.org Copyright (C)
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consolegadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 TEXTEDITLOGGERENGINE_H
|
||||
#define TEXTEDITLOGGERENGINE_H
|
||||
|
||||
|
||||
#include "qxtloggerengine.h"
|
||||
#include "qxtglobal.h"
|
||||
#include <QtGui/QColor>
|
||||
class QTextEdit;
|
||||
|
||||
class TextEditLoggerEngine : public QxtLoggerEngine
|
||||
{
|
||||
|
||||
public:
|
||||
TextEditLoggerEngine(QTextEdit *textEdit);
|
||||
~TextEditLoggerEngine();
|
||||
|
||||
void initLoggerEngine();
|
||||
void killLoggerEngine();
|
||||
void writeFormatted(QxtLogger::LogLevel level, const QList<QVariant> &messages);
|
||||
void setLogLevelEnabled(QxtLogger::LogLevels level, bool enable = true);
|
||||
|
||||
bool isInitialized() const;
|
||||
|
||||
private:
|
||||
virtual void writeToTextEdit(const QString& str_level, const QList<QVariant> &msgs, QColor color = QColor(0,0,0));
|
||||
QTextEdit *m_textEdit;
|
||||
};
|
||||
|
||||
#endif // TEXTEDITLOGGERENGINE_H
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file texteditloggerengine.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Qxt Foundation http://www.libqxt.org Copyright (C)
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup consoleplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 TEXTEDITLOGGERENGINE_H
|
||||
#define TEXTEDITLOGGERENGINE_H
|
||||
|
||||
|
||||
#include "qxtloggerengine.h"
|
||||
#include "qxtglobal.h"
|
||||
#include <QtGui/QColor>
|
||||
class QTextEdit;
|
||||
|
||||
class TextEditLoggerEngine : public QxtLoggerEngine
|
||||
{
|
||||
|
||||
public:
|
||||
TextEditLoggerEngine(QTextEdit *textEdit);
|
||||
~TextEditLoggerEngine();
|
||||
|
||||
void initLoggerEngine();
|
||||
void killLoggerEngine();
|
||||
void writeFormatted(QxtLogger::LogLevel level, const QList<QVariant> &messages);
|
||||
void setLogLevelEnabled(QxtLogger::LogLevels level, bool enable = true);
|
||||
|
||||
bool isInitialized() const;
|
||||
|
||||
private:
|
||||
virtual void writeToTextEdit(const QString& str_level, const QList<QVariant> &msgs, QColor color = QColor(0,0,0));
|
||||
QTextEdit *m_textEdit;
|
||||
};
|
||||
|
||||
#endif // TEXTEDITLOGGERENGINE_H
|
||||
|
@ -1,39 +1,39 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptygadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "emptygadget.h"
|
||||
#include "emptygadgetwidget.h"
|
||||
|
||||
EmptyGadget::EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
EmptyGadget::~EmptyGadget()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptyplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "emptygadget.h"
|
||||
#include "emptygadgetwidget.h"
|
||||
|
||||
EmptyGadget::EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
EmptyGadget::~EmptyGadget()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,59 +1,59 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptygadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 EMPTYGADGET_H_
|
||||
#define EMPTYGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
}
|
||||
//class QWidget;
|
||||
//class QString;
|
||||
class EmptyGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class EmptyGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent = 0);
|
||||
~EmptyGadget();
|
||||
|
||||
QList<int> context() const { return m_context; }
|
||||
QWidget *widget() { return m_widget; }
|
||||
QString contextHelpId() const { return QString(); }
|
||||
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
QList<int> m_context;
|
||||
};
|
||||
|
||||
|
||||
#endif // EMPTYGADGET_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptyplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 EMPTYGADGET_H_
|
||||
#define EMPTYGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
}
|
||||
//class QWidget;
|
||||
//class QString;
|
||||
class EmptyGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class EmptyGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EmptyGadget(QString classId, EmptyGadgetWidget *widget, QWidget *parent = 0);
|
||||
~EmptyGadget();
|
||||
|
||||
QList<int> context() const { return m_context; }
|
||||
QWidget *widget() { return m_widget; }
|
||||
QString contextHelpId() const { return QString(); }
|
||||
|
||||
private:
|
||||
QWidget *m_widget;
|
||||
QList<int> m_context;
|
||||
};
|
||||
|
||||
|
||||
#endif // EMPTYGADGET_H_
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadgetfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptygadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "emptygadgetfactory.h"
|
||||
#include "emptygadgetwidget.h"
|
||||
#include "emptygadget.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
EmptyGadgetFactory::EmptyGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("EmptyGadget"),
|
||||
tr("Choose Gadget..."),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
EmptyGadgetFactory::~EmptyGadgetFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
IUAVGadget* EmptyGadgetFactory::createGadget(QWidget *parent) {
|
||||
EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent);
|
||||
return new EmptyGadget(QString("EmptyGadget"), gadgetWidget, parent);
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadgetfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptyplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "emptygadgetfactory.h"
|
||||
#include "emptygadgetwidget.h"
|
||||
#include "emptygadget.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
EmptyGadgetFactory::EmptyGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("EmptyGadget"),
|
||||
tr("Choose Gadget..."),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
EmptyGadgetFactory::~EmptyGadgetFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
IUAVGadget* EmptyGadgetFactory::createGadget(QWidget *parent) {
|
||||
EmptyGadgetWidget* gadgetWidget = new EmptyGadgetWidget(parent);
|
||||
return new EmptyGadget(QString("EmptyGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
@ -1,50 +1,50 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadgetfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptygadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 EMPTYGADGETFACTORY_H_
|
||||
#define EMPTYGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class EmptyGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EmptyGadgetFactory(QObject *parent = 0);
|
||||
~EmptyGadgetFactory();
|
||||
|
||||
IUAVGadget *createGadget(QWidget *parent);
|
||||
};
|
||||
|
||||
#endif // EMPTYGADGETFACTORY_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadgetfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptyplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 EMPTYGADGETFACTORY_H_
|
||||
#define EMPTYGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class EmptyGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EmptyGadgetFactory(QObject *parent = 0);
|
||||
~EmptyGadgetFactory();
|
||||
|
||||
IUAVGadget *createGadget(QWidget *parent);
|
||||
};
|
||||
|
||||
#endif // EMPTYGADGETFACTORY_H_
|
||||
|
@ -1,50 +1,50 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadgetwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptygadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "emptygadgetwidget.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
EmptyGadgetWidget::EmptyGadgetWidget(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
setMinimumSize(64,64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
this->
|
||||
setText(tr("Choose a gadget to display in this view.\n") +
|
||||
tr("You can also split this view in two.\n\n") +
|
||||
tr("Maybe you first have to choose Edit Gadgets Mode in the Window menu."));
|
||||
}
|
||||
|
||||
EmptyGadgetWidget::~EmptyGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadgetwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptyplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "emptygadgetwidget.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
EmptyGadgetWidget::EmptyGadgetWidget(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
setMinimumSize(64,64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
this->
|
||||
setText(tr("Choose a gadget to display in this view.\n") +
|
||||
tr("You can also split this view in two.\n\n") +
|
||||
tr("Maybe you first have to choose Edit Gadgets Mode in the Window menu."));
|
||||
}
|
||||
|
||||
EmptyGadgetWidget::~EmptyGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
@ -1,44 +1,44 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadgetwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptygadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 EMPTYGADGETWIDGET_H_
|
||||
#define EMPTYGADGETWIDGET_H_
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
|
||||
class EmptyGadgetWidget : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EmptyGadgetWidget(QWidget *parent = 0);
|
||||
~EmptyGadgetWidget();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* EMPTYGADGETWIDGET_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptygadgetwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptyplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 EMPTYGADGETWIDGET_H_
|
||||
#define EMPTYGADGETWIDGET_H_
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
|
||||
class EmptyGadgetWidget : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EmptyGadgetWidget(QWidget *parent = 0);
|
||||
~EmptyGadgetWidget();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* EMPTYGADGETWIDGET_H_ */
|
||||
|
@ -1,65 +1,65 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptyplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptygadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "emptyplugin.h"
|
||||
#include "emptygadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
EmptyPlugin::EmptyPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
EmptyPlugin::~EmptyPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool EmptyPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new EmptyGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmptyPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void EmptyPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(EmptyPlugin)
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptyplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptyplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "emptyplugin.h"
|
||||
#include "emptygadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
EmptyPlugin::EmptyPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
EmptyPlugin::~EmptyPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool EmptyPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new EmptyGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmptyPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void EmptyPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(EmptyPlugin)
|
||||
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptyplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptygadget
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 EMPTYPLUGIN_H_
|
||||
#define EMPTYPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class EmptyGadgetFactory;
|
||||
|
||||
class EmptyPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
EmptyPlugin();
|
||||
~EmptyPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
EmptyGadgetFactory *mf;
|
||||
};
|
||||
#endif /* EMPTYPLUGIN_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file emptyplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup emptyplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 EMPTYPLUGIN_H_
|
||||
#define EMPTYPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class EmptyGadgetFactory;
|
||||
|
||||
class EmptyPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
EmptyPlugin();
|
||||
~EmptyPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
EmptyGadgetFactory *mf;
|
||||
};
|
||||
#endif /* EMPTYPLUGIN_H_ */
|
||||
|
@ -1,52 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file systemhealthgadget.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup systemhealth
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsdisplaygadget.h"
|
||||
#include "gpsdisplaywidget.h"
|
||||
#include "gpsdisplaygadgetconfiguration.h"
|
||||
|
||||
GpsDisplayGadget::GpsDisplayGadget(QString classId, GpsDisplayWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
GpsDisplayGadget::~GpsDisplayGadget()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
This is called when a configuration is loaded, and updates the plugin's settings.
|
||||
Careful: the plugin is already drawn before the loadConfiguration method is called the
|
||||
first time, so you have to be careful not to assume all the plugin values are initialized
|
||||
the first time you use them
|
||||
*/
|
||||
void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
GpsDisplayGadgetConfiguration *m = qobject_cast<GpsDisplayGadgetConfiguration*>(config);
|
||||
//m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaygadget.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief GPS gadget to display GPS Status
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsdisplaygadget.h"
|
||||
#include "gpsdisplaywidget.h"
|
||||
#include "gpsdisplaygadgetconfiguration.h"
|
||||
|
||||
GpsDisplayGadget::GpsDisplayGadget(QString classId, GpsDisplayWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
GpsDisplayGadget::~GpsDisplayGadget()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
This is called when a configuration is loaded, and updates the plugin's settings.
|
||||
Careful: the plugin is already drawn before the loadConfiguration method is called the
|
||||
first time, so you have to be careful not to assume all the plugin values are initialized
|
||||
the first time you use them
|
||||
*/
|
||||
void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
GpsDisplayGadgetConfiguration *m = qobject_cast<GpsDisplayGadgetConfiguration*>(config);
|
||||
//m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint
|
||||
}
|
||||
|
@ -1,56 +1,56 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaygadget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief Gps gadget to display GPS Status
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSDISPLAYGADGET_H_
|
||||
#define GPSDISPLAYGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "gpsdisplaywidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class GpsDisplayWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class GpsDisplayGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GpsDisplayGadget(QString classId, GpsDisplayWidget *widget, QWidget *parent = 0);
|
||||
~GpsDisplayGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
GpsDisplayWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // GPSDISPLAYGADGET_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaygadget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief GPS gadget to display GPS Status header
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSDISPLAYGADGET_H_
|
||||
#define GPSDISPLAYGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "gpsdisplaywidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class GpsDisplayWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class GpsDisplayGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GpsDisplayGadget(QString classId, GpsDisplayWidget *widget, QWidget *parent = 0);
|
||||
~GpsDisplayGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
GpsDisplayWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // GPSDISPLAYGADGET_H_
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief GPS Display Plugin Gadget configuration
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief GPS Display Plugin Gadget configuration
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -1,60 +1,60 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaygadgetfactory.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsdisplaygadgetfactory.h"
|
||||
#include "gpsdisplaywidget.h"
|
||||
#include "gpsdisplaygadget.h"
|
||||
#include "gpsdisplaygadgetconfiguration.h"
|
||||
#include "gpsdisplaygadgetoptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
GpsDisplayGadgetFactory::GpsDisplayGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("GpsDisplayGadget"),
|
||||
tr("GPS Display Gadget"),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
GpsDisplayGadgetFactory::~GpsDisplayGadgetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* GpsDisplayGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
GpsDisplayWidget* gadgetWidget = new GpsDisplayWidget(parent);
|
||||
return new GpsDisplayGadget(QString("GpsDisplayGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *GpsDisplayGadgetFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new GpsDisplayGadgetConfiguration(QString("GpsDisplayGadget"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *GpsDisplayGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new GpsDisplayGadgetOptionsPage(qobject_cast<GpsDisplayGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaygadgetfactory.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsdisplaygadgetfactory.h"
|
||||
#include "gpsdisplaywidget.h"
|
||||
#include "gpsdisplaygadget.h"
|
||||
#include "gpsdisplaygadgetconfiguration.h"
|
||||
#include "gpsdisplaygadgetoptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
GpsDisplayGadgetFactory::GpsDisplayGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("GpsDisplayGadget"),
|
||||
tr("GPS Display Gadget"),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
GpsDisplayGadgetFactory::~GpsDisplayGadgetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* GpsDisplayGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
GpsDisplayWidget* gadgetWidget = new GpsDisplayWidget(parent);
|
||||
return new GpsDisplayGadget(QString("GpsDisplayGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *GpsDisplayGadgetFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new GpsDisplayGadgetConfiguration(QString("GpsDisplayGadget"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *GpsDisplayGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new GpsDisplayGadgetOptionsPage(qobject_cast<GpsDisplayGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
|
@ -1,52 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaygadgetfactory.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSDISPLAYGADGETFACTORY_H_
|
||||
#define GPSDISPLAYGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class GpsDisplayGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GpsDisplayGadgetFactory(QObject *parent = 0);
|
||||
~GpsDisplayGadgetFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // GPSDISPLAYGADGETFACTORY_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaygadgetfactory.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSDISPLAYGADGETFACTORY_H_
|
||||
#define GPSDISPLAYGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class GpsDisplayGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GpsDisplayGadgetFactory(QObject *parent = 0);
|
||||
~GpsDisplayGadgetFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // GPSDISPLAYGADGETFACTORY_H_
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief GPS Display Plugin Gadget options page
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief GPS Display Gadget options page
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -1,65 +1,65 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file systemhealthplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup systemhealth
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsdisplayplugin.h"
|
||||
#include "gpsdisplaygadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
GpsDisplayPlugin::GpsDisplayPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
GpsDisplayPlugin::~GpsDisplayPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool GpsDisplayPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new GpsDisplayGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GpsDisplayPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void GpsDisplayPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(GpsDisplayPlugin)
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplayplugin.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsdisplayplugin.h"
|
||||
#include "gpsdisplaygadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
GpsDisplayPlugin::GpsDisplayPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
GpsDisplayPlugin::~GpsDisplayPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool GpsDisplayPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new GpsDisplayGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GpsDisplayPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void GpsDisplayPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(GpsDisplayPlugin)
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplayplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSDISPLAYPLUGIN_H_
|
||||
#define GPSDISPLAYPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class GpsDisplayGadgetFactory;
|
||||
|
||||
class GpsDisplayPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
GpsDisplayPlugin();
|
||||
~GpsDisplayPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
GpsDisplayGadgetFactory *mf;
|
||||
};
|
||||
#endif /* GPSDISPLAYPLUGIN_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplayplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSDISPLAYPLUGIN_H_
|
||||
#define GPSDISPLAYPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class GpsDisplayGadgetFactory;
|
||||
|
||||
class GpsDisplayPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
GpsDisplayPlugin();
|
||||
~GpsDisplayPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
GpsDisplayGadgetFactory *mf;
|
||||
};
|
||||
#endif /* GPSDISPLAYPLUGIN_H_ */
|
||||
|
@ -1,60 +1,60 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaywidget.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief GPS Display widget, does the actual drawing
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsdisplaywidget.h"
|
||||
#include "ui_gpsdisplaywidget.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QDebug>
|
||||
|
||||
/*
|
||||
* Initialize the widget
|
||||
*/
|
||||
GpsDisplayWidget::GpsDisplayWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setMinimumSize(128,128);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
|
||||
widget = new Ui_GpsDisplayWidget();
|
||||
widget->setupUi(this);
|
||||
|
||||
}
|
||||
|
||||
GpsDisplayWidget::~GpsDisplayWidget()
|
||||
{
|
||||
delete widget;
|
||||
}
|
||||
|
||||
|
||||
void GpsDisplayWidget::connectButtonClicked() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaywidget.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief GPS Display widget, does the actual drawing
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsdisplaywidget.h"
|
||||
#include "ui_gpsdisplaywidget.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QDebug>
|
||||
|
||||
/*
|
||||
* Initialize the widget
|
||||
*/
|
||||
GpsDisplayWidget::GpsDisplayWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
setMinimumSize(128,128);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
|
||||
widget = new Ui_GpsDisplayWidget();
|
||||
widget->setupUi(this);
|
||||
|
||||
}
|
||||
|
||||
GpsDisplayWidget::~GpsDisplayWidget()
|
||||
{
|
||||
delete widget;
|
||||
}
|
||||
|
||||
|
||||
void GpsDisplayWidget::connectButtonClicked() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,61 +1,61 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaywidget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplay
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSDISPLAYWIDGET_H_
|
||||
#define GPSDISPLAYWIDGET_H_
|
||||
|
||||
#include "gpsdisplaygadgetconfiguration.h"
|
||||
#include "uavobjects/uavobject.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
|
||||
class Ui_GpsDisplayWidget;
|
||||
|
||||
class GpsDisplayWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GpsDisplayWidget(QWidget *parent = 0);
|
||||
~GpsDisplayWidget();
|
||||
|
||||
// void setMode(QString mode); // Either UAVTalk or serial port
|
||||
|
||||
|
||||
private slots:
|
||||
void connectButtonClicked();
|
||||
|
||||
private:
|
||||
Ui_GpsDisplayWidget* widget;
|
||||
bool connected;
|
||||
|
||||
};
|
||||
#endif /* GPSDISPLAYWIDGET_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsdisplaywidget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup gpsdisplayplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSDISPLAYWIDGET_H_
|
||||
#define GPSDISPLAYWIDGET_H_
|
||||
|
||||
#include "gpsdisplaygadgetconfiguration.h"
|
||||
#include "uavobjects/uavobject.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
|
||||
class Ui_GpsDisplayWidget;
|
||||
|
||||
class GpsDisplayWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GpsDisplayWidget(QWidget *parent = 0);
|
||||
~GpsDisplayWidget();
|
||||
|
||||
// void setMode(QString mode); // Either UAVTalk or serial port
|
||||
|
||||
|
||||
private slots:
|
||||
void connectButtonClicked();
|
||||
|
||||
private:
|
||||
Ui_GpsDisplayWidget* widget;
|
||||
bool connected;
|
||||
|
||||
};
|
||||
#endif /* GPSDISPLAYWIDGET_H_ */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -1,49 +1,49 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitl.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitl.h"
|
||||
#include "hitlwidget.h"
|
||||
#include "hitlconfiguration.h"
|
||||
|
||||
HITL::HITL(QString classId, HITLWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
HITL::~HITL()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HITL::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
HITLConfiguration *m = qobject_cast<HITLConfiguration*>(config);
|
||||
m_widget->setFGPathBin( m->fgPathBin() );
|
||||
m_widget->setFGPathData( m->fgPathData() );
|
||||
m_widget->setFGManualControl( m->fgManualControl() );
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitl.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitl.h"
|
||||
#include "hitlwidget.h"
|
||||
#include "hitlconfiguration.h"
|
||||
|
||||
HITL::HITL(QString classId, HITLWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
HITL::~HITL()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HITL::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
HITLConfiguration *m = qobject_cast<HITLConfiguration*>(config);
|
||||
m_widget->setFGPathBin( m->fgPathBin() );
|
||||
m_widget->setFGPathData( m->fgPathData() );
|
||||
m_widget->setFGManualControl( m->fgManualControl() );
|
||||
}
|
||||
|
||||
|
@ -1,56 +1,56 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitl.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITL_H
|
||||
#define HITL_H
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "hitlwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class HITLWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITL : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HITL(QString classId, HITLWidget *widget, QWidget *parent = 0);
|
||||
~HITL();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
HITLWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // HITL_H
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitl.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITL_H
|
||||
#define HITL_H
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "hitlwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class HITLWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITL : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HITL(QString classId, HITLWidget *widget, QWidget *parent = 0);
|
||||
~HITL();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
HITLWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // HITL_H
|
||||
|
@ -1,67 +1,67 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlconfiguration.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitlconfiguration.h"
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
HITLConfiguration::HITLConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_fgPathBin(""), m_fgPathData(""), m_fgManualControl(false)
|
||||
{
|
||||
if (state.count() > 0) {
|
||||
QDataStream stream(state);
|
||||
QString fgPathBin;
|
||||
QString fgPathData;
|
||||
bool fgManualControl;
|
||||
stream >> fgPathBin;
|
||||
m_fgPathBin = fgPathBin;
|
||||
stream >> fgPathData;
|
||||
m_fgPathData = fgPathData;
|
||||
stream >> fgManualControl;
|
||||
m_fgManualControl = fgManualControl;
|
||||
}
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *HITLConfiguration::clone()
|
||||
{
|
||||
HITLConfiguration *m = new HITLConfiguration(this->classId());
|
||||
m->m_fgPathBin = m_fgPathBin;
|
||||
m->m_fgPathData = m_fgPathData;
|
||||
m->m_fgManualControl = m_fgManualControl;
|
||||
return m;
|
||||
}
|
||||
|
||||
QByteArray HITLConfiguration::saveState() const
|
||||
{
|
||||
QByteArray bytes;
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
stream << m_fgPathBin;
|
||||
stream << m_fgPathData;
|
||||
stream << m_fgManualControl;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlconfiguration.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitlconfiguration.h"
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
HITLConfiguration::HITLConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_fgPathBin(""), m_fgPathData(""), m_fgManualControl(false)
|
||||
{
|
||||
if (state.count() > 0) {
|
||||
QDataStream stream(state);
|
||||
QString fgPathBin;
|
||||
QString fgPathData;
|
||||
bool fgManualControl;
|
||||
stream >> fgPathBin;
|
||||
m_fgPathBin = fgPathBin;
|
||||
stream >> fgPathData;
|
||||
m_fgPathData = fgPathData;
|
||||
stream >> fgManualControl;
|
||||
m_fgManualControl = fgManualControl;
|
||||
}
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *HITLConfiguration::clone()
|
||||
{
|
||||
HITLConfiguration *m = new HITLConfiguration(this->classId());
|
||||
m->m_fgPathBin = m_fgPathBin;
|
||||
m->m_fgPathData = m_fgPathData;
|
||||
m->m_fgManualControl = m_fgManualControl;
|
||||
return m;
|
||||
}
|
||||
|
||||
QByteArray HITLConfiguration::saveState() const
|
||||
{
|
||||
QByteArray bytes;
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
stream << m_fgPathBin;
|
||||
stream << m_fgPathData;
|
||||
stream << m_fgManualControl;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
@ -1,68 +1,68 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlconfiguration.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLCONFIGURATION_H
|
||||
#define HITLCONFIGURATION_H
|
||||
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
#include <QtGui/QColor>
|
||||
#include <QString>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLConfiguration : public IUAVGadgetConfiguration
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString m_fgPathBin READ fgPathBin WRITE setFGPathBin)
|
||||
Q_PROPERTY(QString m_fgPathData READ fgPathData WRITE setFGPathData)
|
||||
Q_PROPERTY(bool m_fgManualControl READ fgManualControl WRITE setFGManualControl)
|
||||
|
||||
public:
|
||||
explicit HITLConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
|
||||
QString fgPathBin() const { return m_fgPathBin; }
|
||||
QString fgPathData() const { return m_fgPathData; }
|
||||
bool fgManualControl() const { return m_fgManualControl; }
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void setFGPathBin(QString fgPath) { m_fgPathBin = fgPath; }
|
||||
void setFGPathData(QString fgPath) { m_fgPathData = fgPath; }
|
||||
void setFGManualControl(bool val) { m_fgManualControl = val; }
|
||||
|
||||
private:
|
||||
QString m_fgPathBin;
|
||||
QString m_fgPathData;
|
||||
bool m_fgManualControl;
|
||||
|
||||
};
|
||||
|
||||
#endif // HITLCONFIGURATION_H
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlconfiguration.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLCONFIGURATION_H
|
||||
#define HITLCONFIGURATION_H
|
||||
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
#include <QtGui/QColor>
|
||||
#include <QString>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLConfiguration : public IUAVGadgetConfiguration
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString m_fgPathBin READ fgPathBin WRITE setFGPathBin)
|
||||
Q_PROPERTY(QString m_fgPathData READ fgPathData WRITE setFGPathData)
|
||||
Q_PROPERTY(bool m_fgManualControl READ fgManualControl WRITE setFGManualControl)
|
||||
|
||||
public:
|
||||
explicit HITLConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
|
||||
QString fgPathBin() const { return m_fgPathBin; }
|
||||
QString fgPathData() const { return m_fgPathData; }
|
||||
bool fgManualControl() const { return m_fgManualControl; }
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void setFGPathBin(QString fgPath) { m_fgPathBin = fgPath; }
|
||||
void setFGPathData(QString fgPath) { m_fgPathData = fgPath; }
|
||||
void setFGManualControl(bool val) { m_fgManualControl = val; }
|
||||
|
||||
private:
|
||||
QString m_fgPathBin;
|
||||
QString m_fgPathData;
|
||||
bool m_fgManualControl;
|
||||
|
||||
};
|
||||
|
||||
#endif // HITLCONFIGURATION_H
|
||||
|
@ -1,58 +1,58 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitlfactory.h"
|
||||
#include "hitlwidget.h"
|
||||
#include "hitl.h"
|
||||
#include "hitlconfiguration.h"
|
||||
#include "hitloptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
HITLFactory::HITLFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("HITL"), tr("HITL Simulation"), parent)
|
||||
{
|
||||
}
|
||||
|
||||
HITLFactory::~HITLFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* HITLFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
HITLWidget* gadgetWidget = new HITLWidget(parent);
|
||||
return new HITL(QString("HITL"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *HITLFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new HITLConfiguration(QString("HITL"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *HITLFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new HITLOptionsPage(qobject_cast<HITLConfiguration*>(config));
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitlfactory.h"
|
||||
#include "hitlwidget.h"
|
||||
#include "hitl.h"
|
||||
#include "hitlconfiguration.h"
|
||||
#include "hitloptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
HITLFactory::HITLFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("HITL"), tr("HITL Simulation"), parent)
|
||||
{
|
||||
}
|
||||
|
||||
HITLFactory::~HITLFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* HITLFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
HITLWidget* gadgetWidget = new HITLWidget(parent);
|
||||
return new HITL(QString("HITL"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *HITLFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new HITLConfiguration(QString("HITL"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *HITLFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new HITLOptionsPage(qobject_cast<HITLConfiguration*>(config));
|
||||
}
|
||||
|
||||
|
@ -1,52 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLFACTORY_H
|
||||
#define HITLFACTORY_H
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLFactory : public Core::IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HITLFactory(QObject *parent = 0);
|
||||
~HITLFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // HITLFACTORY_H
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLFACTORY_H
|
||||
#define HITLFACTORY_H
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class HITLFactory : public Core::IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HITLFactory(QObject *parent = 0);
|
||||
~HITLFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // HITLFACTORY_H
|
||||
|
@ -1,73 +1,73 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitloptionspage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitloptionspage.h"
|
||||
#include "hitlconfiguration.h"
|
||||
#include "ui_hitloptionspage.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QtAlgorithms>
|
||||
#include <QStringList>
|
||||
|
||||
HITLOptionsPage::HITLOptionsPage(HITLConfiguration *config, QObject *parent) :
|
||||
IOptionsPage(parent),
|
||||
m_config(config)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *HITLOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
// Create page
|
||||
m_optionsPage = new Ui::HITLOptionsPage();
|
||||
QWidget* optionsPageWidget = new QWidget;
|
||||
m_optionsPage->setupUi(optionsPageWidget);
|
||||
|
||||
m_optionsPage->executablePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_optionsPage->executablePathChooser->setPromptDialogTitle(tr("Choose FlightGear executable"));
|
||||
m_optionsPage->dataDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_optionsPage->dataDirectoryPathChooser->setPromptDialogTitle(tr("Choose FlightGear data directory"));
|
||||
|
||||
// Restore the contents from the settings:
|
||||
m_optionsPage->executablePathChooser->setPath(m_config->fgPathBin());
|
||||
m_optionsPage->dataDirectoryPathChooser->setPath(m_config->fgPathData());
|
||||
m_optionsPage->fgManualControl->setChecked(m_config->fgManualControl());
|
||||
|
||||
|
||||
return optionsPageWidget;
|
||||
}
|
||||
|
||||
void HITLOptionsPage::apply()
|
||||
{
|
||||
m_config->setFGPathBin( m_optionsPage->executablePathChooser->path());
|
||||
m_config->setFGPathData( m_optionsPage->dataDirectoryPathChooser->path());
|
||||
m_config->setFGManualControl( m_optionsPage->fgManualControl->isChecked());
|
||||
}
|
||||
|
||||
void HITLOptionsPage::finish()
|
||||
{
|
||||
delete m_optionsPage;
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitloptionspage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitloptionspage.h"
|
||||
#include "hitlconfiguration.h"
|
||||
#include "ui_hitloptionspage.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QtAlgorithms>
|
||||
#include <QStringList>
|
||||
|
||||
HITLOptionsPage::HITLOptionsPage(HITLConfiguration *config, QObject *parent) :
|
||||
IOptionsPage(parent),
|
||||
m_config(config)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *HITLOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
// Create page
|
||||
m_optionsPage = new Ui::HITLOptionsPage();
|
||||
QWidget* optionsPageWidget = new QWidget;
|
||||
m_optionsPage->setupUi(optionsPageWidget);
|
||||
|
||||
m_optionsPage->executablePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_optionsPage->executablePathChooser->setPromptDialogTitle(tr("Choose FlightGear executable"));
|
||||
m_optionsPage->dataDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_optionsPage->dataDirectoryPathChooser->setPromptDialogTitle(tr("Choose FlightGear data directory"));
|
||||
|
||||
// Restore the contents from the settings:
|
||||
m_optionsPage->executablePathChooser->setPath(m_config->fgPathBin());
|
||||
m_optionsPage->dataDirectoryPathChooser->setPath(m_config->fgPathData());
|
||||
m_optionsPage->fgManualControl->setChecked(m_config->fgManualControl());
|
||||
|
||||
|
||||
return optionsPageWidget;
|
||||
}
|
||||
|
||||
void HITLOptionsPage::apply()
|
||||
{
|
||||
m_config->setFGPathBin( m_optionsPage->executablePathChooser->path());
|
||||
m_config->setFGPathData( m_optionsPage->dataDirectoryPathChooser->path());
|
||||
m_config->setFGManualControl( m_optionsPage->fgManualControl->isChecked());
|
||||
}
|
||||
|
||||
void HITLOptionsPage::finish()
|
||||
{
|
||||
delete m_optionsPage;
|
||||
}
|
||||
|
@ -1,65 +1,65 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitloptionspage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLOPTIONSPAGE_H
|
||||
#define HITLOPTIONSPAGE_H
|
||||
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadgetConfiguration;
|
||||
}
|
||||
|
||||
class HITLConfiguration;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
namespace Ui {
|
||||
class HITLOptionsPage;
|
||||
}
|
||||
|
||||
class HITLOptionsPage : public IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HITLOptionsPage(HITLConfiguration *config, QObject *parent = 0);
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
signals:
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
HITLConfiguration* m_config;
|
||||
Ui::HITLOptionsPage* m_optionsPage;
|
||||
|
||||
};
|
||||
|
||||
#endif // HITLOPTIONSPAGE_H
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitloptionspage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLOPTIONSPAGE_H
|
||||
#define HITLOPTIONSPAGE_H
|
||||
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadgetConfiguration;
|
||||
}
|
||||
|
||||
class HITLConfiguration;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
namespace Ui {
|
||||
class HITLOptionsPage;
|
||||
}
|
||||
|
||||
class HITLOptionsPage : public IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HITLOptionsPage(HITLConfiguration *config, QObject *parent = 0);
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
signals:
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
HITLConfiguration* m_config;
|
||||
Ui::HITLOptionsPage* m_optionsPage;
|
||||
|
||||
};
|
||||
|
||||
#endif // HITLOPTIONSPAGE_H
|
||||
|
@ -1,63 +1,63 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file mapplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitlplugin.h"
|
||||
#include "hitlfactory.h"
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
HITLPlugin::HITLPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
HITLPlugin::~HITLPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool HITLPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new HITLFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HITLPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void HITLPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(HITLPlugin)
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file mapplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitlplugin.h"
|
||||
#include "hitlfactory.h"
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
HITLPlugin::HITLPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
HITLPlugin::~HITLPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool HITLPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new HITLFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HITLPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void HITLPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(HITLPlugin)
|
||||
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file browserplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLPLUGIN_H
|
||||
#define HITLPLUGIN_H
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class HITLFactory;
|
||||
|
||||
class HITLPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
HITLPlugin();
|
||||
~HITLPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
HITLFactory *mf;
|
||||
};
|
||||
#endif /* HITLPLUGIN_H */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file browserplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLPLUGIN_H
|
||||
#define HITLPLUGIN_H
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class HITLFactory;
|
||||
|
||||
class HITLPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
HITLPlugin();
|
||||
~HITLPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
HITLFactory *mf;
|
||||
};
|
||||
#endif /* HITLPLUGIN_H */
|
||||
|
@ -1,209 +1,209 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitlwidget.h"
|
||||
#include "ui_hitlwidget.h"
|
||||
#include "qxtlogger.h"
|
||||
#include <QDebug>
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
HITLWidget::HITLWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
// Note: Only tested on windows 7
|
||||
#if defined(Q_WS_WIN)
|
||||
cmdShell = QString("c:/windows/system32/cmd.exe");
|
||||
#else
|
||||
cmdShell = QString("bash");
|
||||
#endif
|
||||
fgProcess = NULL;
|
||||
widget = new Ui_HITLWidget();
|
||||
widget->setupUi(this);
|
||||
connect(widget->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
|
||||
connect(widget->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked()));
|
||||
}
|
||||
|
||||
HITLWidget::~HITLWidget()
|
||||
{
|
||||
delete widget;
|
||||
}
|
||||
|
||||
void HITLWidget::startButtonClicked()
|
||||
{
|
||||
// Stop running process if one is active
|
||||
if (fgProcess != NULL)
|
||||
{
|
||||
stopButtonClicked();
|
||||
}
|
||||
|
||||
// Copy FlightGear generic protocol configuration file to the FG protocol directory
|
||||
// NOTE: Not working on Windows 7, if FG is installed in the "Program Files",
|
||||
// likelly due to permissions. The file should be manually copied to data/Protocol/opfgprotocol.xml
|
||||
QFile xmlFile(":/flightgear/genericprotocol/opfgprotocol.xml");
|
||||
xmlFile.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
QString xml = xmlFile.readAll();
|
||||
xmlFile.close();
|
||||
QFile xmlFileOut(fgPathData + "/Protocol/opfgprotocol.xml");
|
||||
xmlFileOut.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
xmlFileOut.write(xml.toAscii());
|
||||
xmlFileOut.close();
|
||||
|
||||
// Setup process
|
||||
widget->textBrowser->append(QString("Starting FlightGear ...\n"));
|
||||
qxtLog->info("HITL: Starting FlightGear");
|
||||
fgProcess = new QProcess();
|
||||
fgProcess->setReadChannelMode(QProcess::MergedChannels);
|
||||
connect(fgProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(processReadyRead()));
|
||||
|
||||
// Start shell (Note: Could not start FG directly on Windows, only through terminal!)
|
||||
fgProcess->start(cmdShell);
|
||||
if (fgProcess->waitForStarted() == false)
|
||||
{
|
||||
widget->textBrowser->append("Error:" + fgProcess->errorString());
|
||||
}
|
||||
|
||||
// Setup arguments
|
||||
// Note: The input generic protocol is set to update at a much higher rate than the actual updates are sent by the GCS.
|
||||
// If this is not done then a lag will be introduced by FlightGear, likelly because the receive socket buffer builds up during startup.
|
||||
QString args("--fg-root=\"" + fgPathData + "\" --timeofday=dusk --httpd=5400 --enable-hud --in-air --altitude=2000 --vc=100 --generic=socket,out,50,localhost,5500,udp,opfgprotocol");
|
||||
if ( !fgManualControl )
|
||||
{
|
||||
args.append(" --generic=socket,in,400,localhost,5501,udp,opfgprotocol");
|
||||
}
|
||||
|
||||
// Start FlightGear
|
||||
QString cmd;
|
||||
cmd = "\"" + fgPathBin + "\" " + args + "\n";
|
||||
fgProcess->write(cmd.toAscii());
|
||||
|
||||
// Start bridge
|
||||
qxtLog->info("HITL: Starting bridge, initializing FlighGear and Autopilot connections");
|
||||
fgBridge = new FlightGearBridge();
|
||||
connect(fgBridge, SIGNAL(autopilotConnected()), this, SLOT(onAutopilotConnect()));
|
||||
connect(fgBridge, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
connect(fgBridge, SIGNAL(fgConnected()), this, SLOT(onFGConnect()));
|
||||
connect(fgBridge, SIGNAL(fgDisconnected()), this, SLOT(onFGDisconnect()));
|
||||
|
||||
// Initialize connection status
|
||||
if ( fgBridge->isAutopilotConnected() )
|
||||
{
|
||||
onAutopilotConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
onAutopilotDisconnect();
|
||||
}
|
||||
if ( fgBridge->isFGConnected() )
|
||||
{
|
||||
onFGConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
onFGDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::stopButtonClicked()
|
||||
{
|
||||
// NOTE: Does not currently work, may need to send control+c to through the terminal
|
||||
if (fgProcess != NULL)
|
||||
{
|
||||
fgProcess->disconnect(this);
|
||||
fgProcess->kill();
|
||||
delete fgProcess;
|
||||
fgBridge->disconnect(this);
|
||||
delete fgBridge;
|
||||
fgProcess = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::setFGPathBin(QString fgPath)
|
||||
{
|
||||
this->fgPathBin = fgPath;
|
||||
}
|
||||
|
||||
void HITLWidget::setFGPathData(QString fgPath)
|
||||
{
|
||||
this->fgPathData = fgPath;
|
||||
}
|
||||
|
||||
void HITLWidget::setFGManualControl(bool val)
|
||||
{
|
||||
this->fgManualControl = val;
|
||||
}
|
||||
|
||||
void HITLWidget::processReadyRead()
|
||||
{
|
||||
QByteArray bytes = fgProcess->readAllStandardOutput();
|
||||
QString str(bytes);
|
||||
if ( !str.contains("Error reading data") ) // ignore error
|
||||
{
|
||||
widget->textBrowser->append(str);
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::onAutopilotConnect()
|
||||
{
|
||||
QPalette pal(widget->apLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::green);
|
||||
widget->apLabel->setPalette(pal);
|
||||
widget->apLabel->setAutoFillBackground(true);
|
||||
widget->apLabel->setText("AutoPilot Connected");
|
||||
qxtLog->info("HITL: Autopilot connected, initializing for HITL simulation");
|
||||
}
|
||||
|
||||
void HITLWidget::onAutopilotDisconnect()
|
||||
{
|
||||
QPalette pal(widget->apLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::red);
|
||||
widget->apLabel->setPalette(pal);
|
||||
widget->apLabel->setAutoFillBackground(true);
|
||||
widget->apLabel->setText("AutoPilot Disconnected");
|
||||
qxtLog->info("HITL: Autopilot disconnected");
|
||||
}
|
||||
|
||||
void HITLWidget::onFGConnect()
|
||||
{
|
||||
QPalette pal(widget->fgLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::green);
|
||||
widget->fgLabel->setPalette(pal);
|
||||
widget->fgLabel->setAutoFillBackground(true);
|
||||
widget->fgLabel->setText("FlightGear Connected");
|
||||
qxtLog->info("HITL: FlighGear connected");
|
||||
}
|
||||
|
||||
void HITLWidget::onFGDisconnect()
|
||||
{
|
||||
QPalette pal(widget->fgLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::red);
|
||||
widget->fgLabel->setPalette(pal);
|
||||
widget->fgLabel->setAutoFillBackground(true);
|
||||
widget->fgLabel->setText("FlightGear Disconnected");
|
||||
qxtLog->info("HITL: FlighGear disconnected");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "hitlwidget.h"
|
||||
#include "ui_hitlwidget.h"
|
||||
#include "qxtlogger.h"
|
||||
#include <QDebug>
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
HITLWidget::HITLWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
// Note: Only tested on windows 7
|
||||
#if defined(Q_WS_WIN)
|
||||
cmdShell = QString("c:/windows/system32/cmd.exe");
|
||||
#else
|
||||
cmdShell = QString("bash");
|
||||
#endif
|
||||
fgProcess = NULL;
|
||||
widget = new Ui_HITLWidget();
|
||||
widget->setupUi(this);
|
||||
connect(widget->startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked()));
|
||||
connect(widget->stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked()));
|
||||
}
|
||||
|
||||
HITLWidget::~HITLWidget()
|
||||
{
|
||||
delete widget;
|
||||
}
|
||||
|
||||
void HITLWidget::startButtonClicked()
|
||||
{
|
||||
// Stop running process if one is active
|
||||
if (fgProcess != NULL)
|
||||
{
|
||||
stopButtonClicked();
|
||||
}
|
||||
|
||||
// Copy FlightGear generic protocol configuration file to the FG protocol directory
|
||||
// NOTE: Not working on Windows 7, if FG is installed in the "Program Files",
|
||||
// likelly due to permissions. The file should be manually copied to data/Protocol/opfgprotocol.xml
|
||||
QFile xmlFile(":/flightgear/genericprotocol/opfgprotocol.xml");
|
||||
xmlFile.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
QString xml = xmlFile.readAll();
|
||||
xmlFile.close();
|
||||
QFile xmlFileOut(fgPathData + "/Protocol/opfgprotocol.xml");
|
||||
xmlFileOut.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
xmlFileOut.write(xml.toAscii());
|
||||
xmlFileOut.close();
|
||||
|
||||
// Setup process
|
||||
widget->textBrowser->append(QString("Starting FlightGear ...\n"));
|
||||
qxtLog->info("HITL: Starting FlightGear");
|
||||
fgProcess = new QProcess();
|
||||
fgProcess->setReadChannelMode(QProcess::MergedChannels);
|
||||
connect(fgProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(processReadyRead()));
|
||||
|
||||
// Start shell (Note: Could not start FG directly on Windows, only through terminal!)
|
||||
fgProcess->start(cmdShell);
|
||||
if (fgProcess->waitForStarted() == false)
|
||||
{
|
||||
widget->textBrowser->append("Error:" + fgProcess->errorString());
|
||||
}
|
||||
|
||||
// Setup arguments
|
||||
// Note: The input generic protocol is set to update at a much higher rate than the actual updates are sent by the GCS.
|
||||
// If this is not done then a lag will be introduced by FlightGear, likelly because the receive socket buffer builds up during startup.
|
||||
QString args("--fg-root=\"" + fgPathData + "\" --timeofday=dusk --httpd=5400 --enable-hud --in-air --altitude=2000 --vc=100 --generic=socket,out,50,localhost,5500,udp,opfgprotocol");
|
||||
if ( !fgManualControl )
|
||||
{
|
||||
args.append(" --generic=socket,in,400,localhost,5501,udp,opfgprotocol");
|
||||
}
|
||||
|
||||
// Start FlightGear
|
||||
QString cmd;
|
||||
cmd = "\"" + fgPathBin + "\" " + args + "\n";
|
||||
fgProcess->write(cmd.toAscii());
|
||||
|
||||
// Start bridge
|
||||
qxtLog->info("HITL: Starting bridge, initializing FlighGear and Autopilot connections");
|
||||
fgBridge = new FlightGearBridge();
|
||||
connect(fgBridge, SIGNAL(autopilotConnected()), this, SLOT(onAutopilotConnect()));
|
||||
connect(fgBridge, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
connect(fgBridge, SIGNAL(fgConnected()), this, SLOT(onFGConnect()));
|
||||
connect(fgBridge, SIGNAL(fgDisconnected()), this, SLOT(onFGDisconnect()));
|
||||
|
||||
// Initialize connection status
|
||||
if ( fgBridge->isAutopilotConnected() )
|
||||
{
|
||||
onAutopilotConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
onAutopilotDisconnect();
|
||||
}
|
||||
if ( fgBridge->isFGConnected() )
|
||||
{
|
||||
onFGConnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
onFGDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::stopButtonClicked()
|
||||
{
|
||||
// NOTE: Does not currently work, may need to send control+c to through the terminal
|
||||
if (fgProcess != NULL)
|
||||
{
|
||||
fgProcess->disconnect(this);
|
||||
fgProcess->kill();
|
||||
delete fgProcess;
|
||||
fgBridge->disconnect(this);
|
||||
delete fgBridge;
|
||||
fgProcess = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::setFGPathBin(QString fgPath)
|
||||
{
|
||||
this->fgPathBin = fgPath;
|
||||
}
|
||||
|
||||
void HITLWidget::setFGPathData(QString fgPath)
|
||||
{
|
||||
this->fgPathData = fgPath;
|
||||
}
|
||||
|
||||
void HITLWidget::setFGManualControl(bool val)
|
||||
{
|
||||
this->fgManualControl = val;
|
||||
}
|
||||
|
||||
void HITLWidget::processReadyRead()
|
||||
{
|
||||
QByteArray bytes = fgProcess->readAllStandardOutput();
|
||||
QString str(bytes);
|
||||
if ( !str.contains("Error reading data") ) // ignore error
|
||||
{
|
||||
widget->textBrowser->append(str);
|
||||
}
|
||||
}
|
||||
|
||||
void HITLWidget::onAutopilotConnect()
|
||||
{
|
||||
QPalette pal(widget->apLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::green);
|
||||
widget->apLabel->setPalette(pal);
|
||||
widget->apLabel->setAutoFillBackground(true);
|
||||
widget->apLabel->setText("AutoPilot Connected");
|
||||
qxtLog->info("HITL: Autopilot connected, initializing for HITL simulation");
|
||||
}
|
||||
|
||||
void HITLWidget::onAutopilotDisconnect()
|
||||
{
|
||||
QPalette pal(widget->apLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::red);
|
||||
widget->apLabel->setPalette(pal);
|
||||
widget->apLabel->setAutoFillBackground(true);
|
||||
widget->apLabel->setText("AutoPilot Disconnected");
|
||||
qxtLog->info("HITL: Autopilot disconnected");
|
||||
}
|
||||
|
||||
void HITLWidget::onFGConnect()
|
||||
{
|
||||
QPalette pal(widget->fgLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::green);
|
||||
widget->fgLabel->setPalette(pal);
|
||||
widget->fgLabel->setAutoFillBackground(true);
|
||||
widget->fgLabel->setText("FlightGear Connected");
|
||||
qxtLog->info("HITL: FlighGear connected");
|
||||
}
|
||||
|
||||
void HITLWidget::onFGDisconnect()
|
||||
{
|
||||
QPalette pal(widget->fgLabel->palette());
|
||||
pal.setColor(QPalette::Window, Qt::red);
|
||||
widget->fgLabel->setPalette(pal);
|
||||
widget->fgLabel->setAutoFillBackground(true);
|
||||
widget->fgLabel->setText("FlightGear Disconnected");
|
||||
qxtLog->info("HITL: FlighGear disconnected");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,70 +1,70 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitl
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLWIDGET_H
|
||||
#define HITLWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QProcess>
|
||||
#include "flightgearbridge.h"
|
||||
|
||||
class Ui_HITLWidget;
|
||||
|
||||
class HITLWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HITLWidget(QWidget *parent = 0);
|
||||
~HITLWidget();
|
||||
|
||||
void setFGPathBin(QString fgPath);
|
||||
void setFGPathData(QString fgPath);
|
||||
void setFGManualControl(bool val);
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
void startButtonClicked();
|
||||
void stopButtonClicked();
|
||||
void processReadyRead();
|
||||
void onAutopilotConnect();
|
||||
void onAutopilotDisconnect();
|
||||
void onFGConnect();
|
||||
void onFGDisconnect();
|
||||
|
||||
private:
|
||||
Ui_HITLWidget* widget;
|
||||
FlightGearBridge* fgBridge;
|
||||
QProcess* fgProcess;
|
||||
QString fgPathBin;
|
||||
QString fgPathData;
|
||||
bool fgManualControl;
|
||||
QString cmdShell;
|
||||
};
|
||||
|
||||
#endif /* HITLWIDGET_H */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file hitlwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup hitlplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 HITLWIDGET_H
|
||||
#define HITLWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QProcess>
|
||||
#include "flightgearbridge.h"
|
||||
|
||||
class Ui_HITLWidget;
|
||||
|
||||
class HITLWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HITLWidget(QWidget *parent = 0);
|
||||
~HITLWidget();
|
||||
|
||||
void setFGPathBin(QString fgPath);
|
||||
void setFGPathData(QString fgPath);
|
||||
void setFGManualControl(bool val);
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
void startButtonClicked();
|
||||
void stopButtonClicked();
|
||||
void processReadyRead();
|
||||
void onAutopilotConnect();
|
||||
void onAutopilotDisconnect();
|
||||
void onFGConnect();
|
||||
void onFGDisconnect();
|
||||
|
||||
private:
|
||||
Ui_HITLWidget* widget;
|
||||
FlightGearBridge* fgBridge;
|
||||
QProcess* fgProcess;
|
||||
QString fgPathBin;
|
||||
QString fgPathData;
|
||||
bool fgManualControl;
|
||||
QString cmdShell;
|
||||
};
|
||||
|
||||
#endif /* HITLWIDGET_H */
|
||||
|
@ -1,58 +1,58 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadget.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "lineardialgadget.h"
|
||||
#include "lineardialgadgetwidget.h"
|
||||
#include "lineardialgadgetconfiguration.h"
|
||||
|
||||
LineardialGadget::LineardialGadget(QString classId, LineardialGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
LineardialGadget::~LineardialGadget()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
This is called when a configuration is loaded, and updates the plugin's settings.
|
||||
Careful: the plugin is already drawn before the loadConfiguration method is called the
|
||||
first time, so you have to be careful not to assume all the plugin values are initialized
|
||||
the first time you use them
|
||||
*/
|
||||
void LineardialGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
LineardialGadgetConfiguration *m = qobject_cast<LineardialGadgetConfiguration*>(config);
|
||||
m_widget->setRange(m->getMin(),m->getMax());
|
||||
m_widget->setGreenRange(m->getGreenMin(), m->getGreenMax());
|
||||
m_widget->setYellowRange(m->getYellowMin(), m->getYellowMax());
|
||||
m_widget->setRedRange(m->getRedMin(), m->getRedMax());
|
||||
m_widget->connectInput(m->getSourceDataObject(), m->getSourceObjectField());
|
||||
m_widget->setDialFile(m->getDialFile()); // Triggers widget repaint
|
||||
m_widget->setDialFont(m->getFont());
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadget.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "lineardialgadget.h"
|
||||
#include "lineardialgadgetwidget.h"
|
||||
#include "lineardialgadgetconfiguration.h"
|
||||
|
||||
LineardialGadget::LineardialGadget(QString classId, LineardialGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
LineardialGadget::~LineardialGadget()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
This is called when a configuration is loaded, and updates the plugin's settings.
|
||||
Careful: the plugin is already drawn before the loadConfiguration method is called the
|
||||
first time, so you have to be careful not to assume all the plugin values are initialized
|
||||
the first time you use them
|
||||
*/
|
||||
void LineardialGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
LineardialGadgetConfiguration *m = qobject_cast<LineardialGadgetConfiguration*>(config);
|
||||
m_widget->setRange(m->getMin(),m->getMax());
|
||||
m_widget->setGreenRange(m->getGreenMin(), m->getGreenMax());
|
||||
m_widget->setYellowRange(m->getYellowMin(), m->getYellowMax());
|
||||
m_widget->setRedRange(m->getRedMin(), m->getRedMax());
|
||||
m_widget->connectInput(m->getSourceDataObject(), m->getSourceObjectField());
|
||||
m_widget->setDialFile(m->getDialFile()); // Triggers widget repaint
|
||||
m_widget->setDialFont(m->getFont());
|
||||
}
|
||||
|
@ -1,56 +1,56 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief Bargraph gadget with red/yellow/green zones
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 LINEARDIALGADGET_H_
|
||||
#define LINEARDIALGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "lineardialgadgetwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class LineardialGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class LineardialGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LineardialGadget(QString classId, LineardialGadgetWidget *widget, QWidget *parent = 0);
|
||||
~LineardialGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
LineardialGadgetWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // LINEARDIALGADGET_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief Bargraph gadget with red/yellow/green zones
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 LINEARDIALGADGET_H_
|
||||
#define LINEARDIALGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "lineardialgadgetwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class LineardialGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class LineardialGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LineardialGadget(QString classId, LineardialGadgetWidget *widget, QWidget *parent = 0);
|
||||
~LineardialGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
LineardialGadgetWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // LINEARDIALGADGET_H_
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Linear dial Plugin Gadget configuration
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Airspeed Plugin Gadget configuration
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -1,60 +1,60 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadgetfactory.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "lineardialgadgetfactory.h"
|
||||
#include "lineardialgadgetwidget.h"
|
||||
#include "lineardialgadget.h"
|
||||
#include "lineardialgadgetconfiguration.h"
|
||||
#include "lineardialgadgetoptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
LineardialGadgetFactory::LineardialGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("LineardialGadget"),
|
||||
tr("Bargraph Dial Gadget"),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
LineardialGadgetFactory::~LineardialGadgetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* LineardialGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
LineardialGadgetWidget* gadgetWidget = new LineardialGadgetWidget(parent);
|
||||
return new LineardialGadget(QString("LineardialGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *LineardialGadgetFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new LineardialGadgetConfiguration(QString("LineardialGadget"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *LineardialGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new LineardialGadgetOptionsPage(qobject_cast<LineardialGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadgetfactory.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "lineardialgadgetfactory.h"
|
||||
#include "lineardialgadgetwidget.h"
|
||||
#include "lineardialgadget.h"
|
||||
#include "lineardialgadgetconfiguration.h"
|
||||
#include "lineardialgadgetoptionspage.h"
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
LineardialGadgetFactory::LineardialGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("LineardialGadget"),
|
||||
tr("Bargraph Dial Gadget"),
|
||||
parent)
|
||||
{
|
||||
}
|
||||
|
||||
LineardialGadgetFactory::~LineardialGadgetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* LineardialGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
LineardialGadgetWidget* gadgetWidget = new LineardialGadgetWidget(parent);
|
||||
return new LineardialGadget(QString("LineardialGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *LineardialGadgetFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new LineardialGadgetConfiguration(QString("LineardialGadget"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *LineardialGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new LineardialGadgetOptionsPage(qobject_cast<LineardialGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
|
@ -1,52 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadgetfactory.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 LINEARDIALGADGETFACTORY_H_
|
||||
#define LINEARDIALGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class LineardialGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LineardialGadgetFactory(QObject *parent = 0);
|
||||
~LineardialGadgetFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // LINEARDIALGADGETFACTORY_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadgetfactory.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 LINEARDIALGADGETFACTORY_H_
|
||||
#define LINEARDIALGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class LineardialGadgetFactory : public IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LineardialGadgetFactory(QObject *parent = 0);
|
||||
~LineardialGadgetFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // LINEARDIALGADGETFACTORY_H_
|
||||
|
@ -3,9 +3,9 @@
|
||||
*
|
||||
* @file lineardialgadgetoptionspage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Airspeed Plugin Gadget options page
|
||||
* @brief Linear Dial Plugin Gadget options page
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -3,9 +3,9 @@
|
||||
*
|
||||
* @file lineardialgadgetoptionspage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Airspeed Plugin Gadget options page
|
||||
* @brief Linear Dial Plugin Gadget options page
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
@ -1,320 +1,320 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadgetwidget.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "lineardialgadgetwidget.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QDebug>
|
||||
|
||||
LineardialGadgetWidget::LineardialGadgetWidget(QWidget *parent) : QGraphicsView(parent)
|
||||
{
|
||||
setMinimumSize(32,32);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setScene(new QGraphicsScene(this));
|
||||
|
||||
m_renderer = new QSvgRenderer();
|
||||
background = new QGraphicsSvgItem();
|
||||
foreground = new QGraphicsSvgItem();
|
||||
green = new QGraphicsSvgItem();
|
||||
yellow = new QGraphicsSvgItem();
|
||||
red = new QGraphicsSvgItem();
|
||||
index = new QGraphicsSvgItem();
|
||||
fieldName = new QGraphicsTextItem("Field");
|
||||
fieldName->setDefaultTextColor(QColor("White"));
|
||||
fieldValue = new QGraphicsTextItem("0.00");
|
||||
fieldValue->setDefaultTextColor(QColor("White"));
|
||||
verticalDial = false;
|
||||
|
||||
paint();
|
||||
|
||||
obj1 = NULL;
|
||||
indexTarget = 0;
|
||||
indexValue = 0;
|
||||
|
||||
// This timer mechanism makes the index rotate smoothly
|
||||
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(moveIndex()));
|
||||
dialTimer.start(30);
|
||||
|
||||
#if 0
|
||||
// Test code for timer to move the index
|
||||
testSpeed=0;
|
||||
connect(&m_testTimer, SIGNAL(timeout()), this, SLOT(testRotate()));
|
||||
m_testTimer.start(1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
LineardialGadgetWidget::~LineardialGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Connects the widget to the relevant UAVObjects
|
||||
*/
|
||||
void LineardialGadgetWidget::connectInput(QString object1, QString nfield1) {
|
||||
|
||||
if (obj1 != NULL)
|
||||
disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateIndex(UAVObject*)));
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
|
||||
std::cout << "Lineadial Connect needles - " << object1.toStdString() << "-"<< nfield1.toStdString() << std::endl;
|
||||
|
||||
// Check validity of arguments first, reject empty args and unknown fields.
|
||||
if (!(object1.isEmpty() || nfield1.isEmpty())) {
|
||||
obj1 = dynamic_cast<UAVDataObject*>( objManager->getObject(object1) );
|
||||
if (obj1 != NULL ) {
|
||||
connect(obj1, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateIndex(UAVObject*)));
|
||||
field1 = nfield1;
|
||||
fieldName->setPlainText(nfield1);
|
||||
} else {
|
||||
std::cout << "Error: Object is unknown (" << object1.toStdString() << ") this should not happen." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
*/
|
||||
void LineardialGadgetWidget::updateIndex(UAVObject *object1) {
|
||||
// Double check that the field exists:
|
||||
UAVObjectField* field = object1->getField(field1);
|
||||
if (field) {
|
||||
double v = field->getDouble();
|
||||
setIndex(v);
|
||||
QString s;
|
||||
s.sprintf("%.2f",v);
|
||||
fieldValue->setPlainText(s);
|
||||
} else {
|
||||
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void LineardialGadgetWidget::setDialFile(QString dfn)
|
||||
{
|
||||
if (QFile::exists(dfn))
|
||||
{
|
||||
m_renderer->load(dfn);
|
||||
if(m_renderer->isValid())
|
||||
{
|
||||
fgenabled = false;
|
||||
|
||||
background->setSharedRenderer(m_renderer);
|
||||
background->setElementId("background");
|
||||
index->setSharedRenderer(m_renderer);
|
||||
index->setElementId("needle");
|
||||
green->setSharedRenderer(m_renderer);
|
||||
green->setElementId("green");
|
||||
yellow->setSharedRenderer(m_renderer);
|
||||
yellow->setElementId("yellow");
|
||||
red->setSharedRenderer(m_renderer);
|
||||
red->setElementId("red");
|
||||
|
||||
if (m_renderer->elementExists("foreground")) {
|
||||
foreground->setSharedRenderer(m_renderer);
|
||||
foreground->setElementId("foreground");
|
||||
fgenabled = true;
|
||||
}
|
||||
//std::cout<<"Dial file loaded"<<std::endl;
|
||||
QGraphicsScene *l_scene = scene();
|
||||
|
||||
QMatrix textMatrix = m_renderer->matrixForElement("field");
|
||||
startX = textMatrix.mapRect(m_renderer->boundsOnElement("field")).x();
|
||||
startY = textMatrix.mapRect(m_renderer->boundsOnElement("field")).y();
|
||||
QTransform matrix;
|
||||
matrix.translate(startX,startY);
|
||||
fieldName->setTransform(matrix,false);
|
||||
|
||||
textMatrix = m_renderer->matrixForElement("value");
|
||||
startX = textMatrix.mapRect(m_renderer->boundsOnElement("value")).x();
|
||||
startY = textMatrix.mapRect(m_renderer->boundsOnElement("value")).y();
|
||||
matrix.reset();
|
||||
matrix.translate(startX,startY);
|
||||
fieldValue->setTransform(matrix,false);
|
||||
|
||||
// In order to properly render the Green/Yellow/Red graphs, we need to find out
|
||||
// the starting location of the bargraph rendering area:
|
||||
textMatrix = m_renderer->matrixForElement("bargraph");
|
||||
startX = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).x();
|
||||
startY = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).y();
|
||||
//std::cout << "StartX: " << startX << std::endl;
|
||||
//std::cout << "StartY: " << startY << std::endl;
|
||||
bargraphSize = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).width();
|
||||
// Detect if the bargraph is vertical or horizontal.
|
||||
qreal bargraphHeight = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).height();
|
||||
if (bargraphHeight > bargraphSize) {
|
||||
verticalDial = true;
|
||||
bargraphSize = bargraphHeight;
|
||||
} else {
|
||||
verticalDial = false;
|
||||
}
|
||||
|
||||
// Move the index to its base position:
|
||||
indexHeight = m_renderer->matrixForElement("needle").mapRect(m_renderer->boundsOnElement("needle")).height();
|
||||
indexWidth = m_renderer->matrixForElement("needle").mapRect(m_renderer->boundsOnElement("needle")).width();
|
||||
matrix.reset();
|
||||
matrix.translate(startX-indexWidth/2,startY-indexHeight/2);
|
||||
index->setTransform(matrix,false);
|
||||
|
||||
// Now adjust the red/yellow/green zones:
|
||||
double range = maxValue-minValue;
|
||||
|
||||
green->resetTransform();
|
||||
double greenScale = (greenMax-greenMin)/range;
|
||||
double greenStart = verticalDial ? (maxValue-greenMax)/range*green->boundingRect().height() :
|
||||
(greenMin-minValue)/range*green->boundingRect().width();
|
||||
matrix.reset();
|
||||
if (verticalDial) {
|
||||
matrix.scale(1,greenScale);
|
||||
matrix.translate(startX,(greenStart+startY)/greenScale);
|
||||
} else {
|
||||
matrix.scale(greenScale,1);
|
||||
matrix.translate((greenStart+startX)/greenScale,startY);
|
||||
}
|
||||
green->setTransform(matrix,false);
|
||||
|
||||
yellow->resetTransform();
|
||||
double yellowScale = (yellowMax-yellowMin)/range;
|
||||
double yellowStart = verticalDial ? (maxValue-yellowMax)/range*yellow->boundingRect().height() :
|
||||
(yellowMin-minValue)/range*yellow->boundingRect().width();
|
||||
matrix.reset();
|
||||
if (verticalDial) {
|
||||
matrix.scale(1,yellowScale);
|
||||
matrix.translate(startX,(yellowStart+startY)/yellowScale);
|
||||
} else {
|
||||
matrix.scale(yellowScale,1);
|
||||
matrix.translate((yellowStart+startX)/yellowScale,startY);
|
||||
}
|
||||
yellow->setTransform(matrix,false);
|
||||
|
||||
red->resetTransform();
|
||||
double redScale = (redMax-redMin)/range;
|
||||
double redStart = verticalDial ? (maxValue-redMax)/range*red->boundingRect().height() :
|
||||
(redMin-minValue)/range*red->boundingRect().width();
|
||||
matrix.reset();
|
||||
if (verticalDial) {
|
||||
matrix.scale(1,redScale);
|
||||
matrix.translate(startX,(redStart+startY)/redScale);
|
||||
} else {
|
||||
matrix.scale(redScale,1);
|
||||
matrix.translate((redStart+startX)/redScale,startY);
|
||||
}
|
||||
red->setTransform(matrix,false);
|
||||
|
||||
l_scene->setSceneRect(background->boundingRect());
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{ std::cout<<"no file: "<<std::endl; }
|
||||
}
|
||||
|
||||
|
||||
void LineardialGadgetWidget::setDialFont(QString fontProps)
|
||||
{
|
||||
QFont font = QFont("Arial",12);
|
||||
font.fromString(fontProps);
|
||||
fieldName->setFont(font);
|
||||
fieldValue->setFont(font);
|
||||
}
|
||||
|
||||
|
||||
void LineardialGadgetWidget::paint()
|
||||
{
|
||||
QGraphicsScene *l_scene = scene();
|
||||
l_scene->clear(); // Beware: clear also deletes all objects
|
||||
// which are currently in the scene
|
||||
l_scene->addItem(background);
|
||||
// Order is important: red, then yellow then green
|
||||
// overlayed on top of each other
|
||||
l_scene->addItem(red);
|
||||
l_scene->addItem(yellow);
|
||||
l_scene->addItem(green);
|
||||
l_scene->addItem(index);
|
||||
l_scene->addItem(fieldName);
|
||||
l_scene->addItem(fieldValue);
|
||||
l_scene->addItem(foreground);
|
||||
update();
|
||||
}
|
||||
|
||||
void LineardialGadgetWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
// Skip painting until the dial file is loaded
|
||||
if (! m_renderer->isValid()) {
|
||||
std::cout<<"Dial file not loaded, not rendering"<<std::endl;
|
||||
return;
|
||||
}
|
||||
QGraphicsView::paintEvent(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 LineardialGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
fitInView(background, Qt::KeepAspectRatio );
|
||||
}
|
||||
|
||||
// Converts the value into an percentage:
|
||||
// this enables smooth movement in moveIndex below
|
||||
void LineardialGadgetWidget::setIndex(double value) {
|
||||
if (verticalDial) {
|
||||
indexTarget = 100*(maxValue-value)/(maxValue-minValue);
|
||||
} else {
|
||||
indexTarget = 100*(value-minValue)/(maxValue-minValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Take an input value and move the index accordingly
|
||||
// Move is smooth, starts fast and slows down when
|
||||
// approaching the target.
|
||||
void LineardialGadgetWidget::moveIndex()
|
||||
{
|
||||
if ((abs((indexValue-indexTarget)*10) > 3)) {
|
||||
indexValue += (indexTarget - indexValue)/5;
|
||||
index->resetTransform();
|
||||
qreal factor = indexValue*bargraphSize/100;
|
||||
QTransform matrix;
|
||||
if (verticalDial) {
|
||||
matrix.translate(startX-indexWidth/2,factor+startY-indexHeight/2);
|
||||
} else {
|
||||
matrix.translate(factor+startX-indexWidth/2,startY-indexHeight/2);
|
||||
}
|
||||
index->setTransform(matrix,false);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Test function for timer to rotate needles
|
||||
void LineardialGadgetWidget::testRotate()
|
||||
{
|
||||
testVal=0;
|
||||
if (testVal > maxValue) testVal=minValue;
|
||||
setIndex((double)testVal);
|
||||
}
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadgetwidget.cpp
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "lineardialgadgetwidget.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QDebug>
|
||||
|
||||
LineardialGadgetWidget::LineardialGadgetWidget(QWidget *parent) : QGraphicsView(parent)
|
||||
{
|
||||
setMinimumSize(32,32);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setScene(new QGraphicsScene(this));
|
||||
|
||||
m_renderer = new QSvgRenderer();
|
||||
background = new QGraphicsSvgItem();
|
||||
foreground = new QGraphicsSvgItem();
|
||||
green = new QGraphicsSvgItem();
|
||||
yellow = new QGraphicsSvgItem();
|
||||
red = new QGraphicsSvgItem();
|
||||
index = new QGraphicsSvgItem();
|
||||
fieldName = new QGraphicsTextItem("Field");
|
||||
fieldName->setDefaultTextColor(QColor("White"));
|
||||
fieldValue = new QGraphicsTextItem("0.00");
|
||||
fieldValue->setDefaultTextColor(QColor("White"));
|
||||
verticalDial = false;
|
||||
|
||||
paint();
|
||||
|
||||
obj1 = NULL;
|
||||
indexTarget = 0;
|
||||
indexValue = 0;
|
||||
|
||||
// This timer mechanism makes the index rotate smoothly
|
||||
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(moveIndex()));
|
||||
dialTimer.start(30);
|
||||
|
||||
#if 0
|
||||
// Test code for timer to move the index
|
||||
testSpeed=0;
|
||||
connect(&m_testTimer, SIGNAL(timeout()), this, SLOT(testRotate()));
|
||||
m_testTimer.start(1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
LineardialGadgetWidget::~LineardialGadgetWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Connects the widget to the relevant UAVObjects
|
||||
*/
|
||||
void LineardialGadgetWidget::connectInput(QString object1, QString nfield1) {
|
||||
|
||||
if (obj1 != NULL)
|
||||
disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateIndex(UAVObject*)));
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
|
||||
std::cout << "Lineadial Connect needles - " << object1.toStdString() << "-"<< nfield1.toStdString() << std::endl;
|
||||
|
||||
// Check validity of arguments first, reject empty args and unknown fields.
|
||||
if (!(object1.isEmpty() || nfield1.isEmpty())) {
|
||||
obj1 = dynamic_cast<UAVDataObject*>( objManager->getObject(object1) );
|
||||
if (obj1 != NULL ) {
|
||||
connect(obj1, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateIndex(UAVObject*)));
|
||||
field1 = nfield1;
|
||||
fieldName->setPlainText(nfield1);
|
||||
} else {
|
||||
std::cout << "Error: Object is unknown (" << object1.toStdString() << ") this should not happen." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
*/
|
||||
void LineardialGadgetWidget::updateIndex(UAVObject *object1) {
|
||||
// Double check that the field exists:
|
||||
UAVObjectField* field = object1->getField(field1);
|
||||
if (field) {
|
||||
double v = field->getDouble();
|
||||
setIndex(v);
|
||||
QString s;
|
||||
s.sprintf("%.2f",v);
|
||||
fieldValue->setPlainText(s);
|
||||
} else {
|
||||
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void LineardialGadgetWidget::setDialFile(QString dfn)
|
||||
{
|
||||
if (QFile::exists(dfn))
|
||||
{
|
||||
m_renderer->load(dfn);
|
||||
if(m_renderer->isValid())
|
||||
{
|
||||
fgenabled = false;
|
||||
|
||||
background->setSharedRenderer(m_renderer);
|
||||
background->setElementId("background");
|
||||
index->setSharedRenderer(m_renderer);
|
||||
index->setElementId("needle");
|
||||
green->setSharedRenderer(m_renderer);
|
||||
green->setElementId("green");
|
||||
yellow->setSharedRenderer(m_renderer);
|
||||
yellow->setElementId("yellow");
|
||||
red->setSharedRenderer(m_renderer);
|
||||
red->setElementId("red");
|
||||
|
||||
if (m_renderer->elementExists("foreground")) {
|
||||
foreground->setSharedRenderer(m_renderer);
|
||||
foreground->setElementId("foreground");
|
||||
fgenabled = true;
|
||||
}
|
||||
//std::cout<<"Dial file loaded"<<std::endl;
|
||||
QGraphicsScene *l_scene = scene();
|
||||
|
||||
QMatrix textMatrix = m_renderer->matrixForElement("field");
|
||||
startX = textMatrix.mapRect(m_renderer->boundsOnElement("field")).x();
|
||||
startY = textMatrix.mapRect(m_renderer->boundsOnElement("field")).y();
|
||||
QTransform matrix;
|
||||
matrix.translate(startX,startY);
|
||||
fieldName->setTransform(matrix,false);
|
||||
|
||||
textMatrix = m_renderer->matrixForElement("value");
|
||||
startX = textMatrix.mapRect(m_renderer->boundsOnElement("value")).x();
|
||||
startY = textMatrix.mapRect(m_renderer->boundsOnElement("value")).y();
|
||||
matrix.reset();
|
||||
matrix.translate(startX,startY);
|
||||
fieldValue->setTransform(matrix,false);
|
||||
|
||||
// In order to properly render the Green/Yellow/Red graphs, we need to find out
|
||||
// the starting location of the bargraph rendering area:
|
||||
textMatrix = m_renderer->matrixForElement("bargraph");
|
||||
startX = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).x();
|
||||
startY = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).y();
|
||||
//std::cout << "StartX: " << startX << std::endl;
|
||||
//std::cout << "StartY: " << startY << std::endl;
|
||||
bargraphSize = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).width();
|
||||
// Detect if the bargraph is vertical or horizontal.
|
||||
qreal bargraphHeight = textMatrix.mapRect(m_renderer->boundsOnElement("bargraph")).height();
|
||||
if (bargraphHeight > bargraphSize) {
|
||||
verticalDial = true;
|
||||
bargraphSize = bargraphHeight;
|
||||
} else {
|
||||
verticalDial = false;
|
||||
}
|
||||
|
||||
// Move the index to its base position:
|
||||
indexHeight = m_renderer->matrixForElement("needle").mapRect(m_renderer->boundsOnElement("needle")).height();
|
||||
indexWidth = m_renderer->matrixForElement("needle").mapRect(m_renderer->boundsOnElement("needle")).width();
|
||||
matrix.reset();
|
||||
matrix.translate(startX-indexWidth/2,startY-indexHeight/2);
|
||||
index->setTransform(matrix,false);
|
||||
|
||||
// Now adjust the red/yellow/green zones:
|
||||
double range = maxValue-minValue;
|
||||
|
||||
green->resetTransform();
|
||||
double greenScale = (greenMax-greenMin)/range;
|
||||
double greenStart = verticalDial ? (maxValue-greenMax)/range*green->boundingRect().height() :
|
||||
(greenMin-minValue)/range*green->boundingRect().width();
|
||||
matrix.reset();
|
||||
if (verticalDial) {
|
||||
matrix.scale(1,greenScale);
|
||||
matrix.translate(startX,(greenStart+startY)/greenScale);
|
||||
} else {
|
||||
matrix.scale(greenScale,1);
|
||||
matrix.translate((greenStart+startX)/greenScale,startY);
|
||||
}
|
||||
green->setTransform(matrix,false);
|
||||
|
||||
yellow->resetTransform();
|
||||
double yellowScale = (yellowMax-yellowMin)/range;
|
||||
double yellowStart = verticalDial ? (maxValue-yellowMax)/range*yellow->boundingRect().height() :
|
||||
(yellowMin-minValue)/range*yellow->boundingRect().width();
|
||||
matrix.reset();
|
||||
if (verticalDial) {
|
||||
matrix.scale(1,yellowScale);
|
||||
matrix.translate(startX,(yellowStart+startY)/yellowScale);
|
||||
} else {
|
||||
matrix.scale(yellowScale,1);
|
||||
matrix.translate((yellowStart+startX)/yellowScale,startY);
|
||||
}
|
||||
yellow->setTransform(matrix,false);
|
||||
|
||||
red->resetTransform();
|
||||
double redScale = (redMax-redMin)/range;
|
||||
double redStart = verticalDial ? (maxValue-redMax)/range*red->boundingRect().height() :
|
||||
(redMin-minValue)/range*red->boundingRect().width();
|
||||
matrix.reset();
|
||||
if (verticalDial) {
|
||||
matrix.scale(1,redScale);
|
||||
matrix.translate(startX,(redStart+startY)/redScale);
|
||||
} else {
|
||||
matrix.scale(redScale,1);
|
||||
matrix.translate((redStart+startX)/redScale,startY);
|
||||
}
|
||||
red->setTransform(matrix,false);
|
||||
|
||||
l_scene->setSceneRect(background->boundingRect());
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{ std::cout<<"no file: "<<std::endl; }
|
||||
}
|
||||
|
||||
|
||||
void LineardialGadgetWidget::setDialFont(QString fontProps)
|
||||
{
|
||||
QFont font = QFont("Arial",12);
|
||||
font.fromString(fontProps);
|
||||
fieldName->setFont(font);
|
||||
fieldValue->setFont(font);
|
||||
}
|
||||
|
||||
|
||||
void LineardialGadgetWidget::paint()
|
||||
{
|
||||
QGraphicsScene *l_scene = scene();
|
||||
l_scene->clear(); // Beware: clear also deletes all objects
|
||||
// which are currently in the scene
|
||||
l_scene->addItem(background);
|
||||
// Order is important: red, then yellow then green
|
||||
// overlayed on top of each other
|
||||
l_scene->addItem(red);
|
||||
l_scene->addItem(yellow);
|
||||
l_scene->addItem(green);
|
||||
l_scene->addItem(index);
|
||||
l_scene->addItem(fieldName);
|
||||
l_scene->addItem(fieldValue);
|
||||
l_scene->addItem(foreground);
|
||||
update();
|
||||
}
|
||||
|
||||
void LineardialGadgetWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
// Skip painting until the dial file is loaded
|
||||
if (! m_renderer->isValid()) {
|
||||
std::cout<<"Dial file not loaded, not rendering"<<std::endl;
|
||||
return;
|
||||
}
|
||||
QGraphicsView::paintEvent(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 LineardialGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
fitInView(background, Qt::KeepAspectRatio );
|
||||
}
|
||||
|
||||
// Converts the value into an percentage:
|
||||
// this enables smooth movement in moveIndex below
|
||||
void LineardialGadgetWidget::setIndex(double value) {
|
||||
if (verticalDial) {
|
||||
indexTarget = 100*(maxValue-value)/(maxValue-minValue);
|
||||
} else {
|
||||
indexTarget = 100*(value-minValue)/(maxValue-minValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Take an input value and move the index accordingly
|
||||
// Move is smooth, starts fast and slows down when
|
||||
// approaching the target.
|
||||
void LineardialGadgetWidget::moveIndex()
|
||||
{
|
||||
if ((abs((indexValue-indexTarget)*10) > 3)) {
|
||||
indexValue += (indexTarget - indexValue)/5;
|
||||
index->resetTransform();
|
||||
qreal factor = indexValue*bargraphSize/100;
|
||||
QTransform matrix;
|
||||
if (verticalDial) {
|
||||
matrix.translate(startX-indexWidth/2,factor+startY-indexHeight/2);
|
||||
} else {
|
||||
matrix.translate(factor+startX-indexWidth/2,startY-indexHeight/2);
|
||||
}
|
||||
index->setTransform(matrix,false);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Test function for timer to rotate needles
|
||||
void LineardialGadgetWidget::testRotate()
|
||||
{
|
||||
testVal=0;
|
||||
if (testVal > maxValue) testVal=minValue;
|
||||
setIndex((double)testVal);
|
||||
}
|
||||
|
@ -1,125 +1,125 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadgetwidget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 LINEARDIALGADGETWIDGET_H_
|
||||
#define LINEARDIALGADGETWIDGET_H_
|
||||
|
||||
#include "lineardialgadgetconfiguration.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/uavobject.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
|
||||
class LineardialGadgetWidget : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LineardialGadgetWidget(QWidget *parent = 0);
|
||||
~LineardialGadgetWidget();
|
||||
void setDialFile(QString dfn);
|
||||
void paint();
|
||||
void setRange(double min, double max) { minValue=min; maxValue=max;}
|
||||
void setGreenRange(double min, double max) {greenMin=min; greenMax=max;}
|
||||
void setYellowRange(double min, double max) {yellowMin=min; yellowMax=max;}
|
||||
void setRedRange(double min, double max) {redMin=min; redMax=max;}
|
||||
void connectInput(QString obj, QString field);
|
||||
void setIndex(double val);
|
||||
void setDialFont(QString fontProps);
|
||||
|
||||
public slots:
|
||||
void updateIndex(UAVObject *object1);
|
||||
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
|
||||
private slots:
|
||||
// Test function
|
||||
void testRotate();
|
||||
void moveIndex();
|
||||
|
||||
private:
|
||||
QSvgRenderer *m_renderer;
|
||||
QGraphicsSvgItem *background;
|
||||
QGraphicsSvgItem *foreground;
|
||||
QGraphicsSvgItem *index;
|
||||
QGraphicsSvgItem *green;
|
||||
QGraphicsSvgItem *yellow;
|
||||
QGraphicsSvgItem *red;
|
||||
|
||||
QGraphicsTextItem *fieldName;
|
||||
QGraphicsTextItem *fieldValue;
|
||||
|
||||
// Simple flag to skip rendering if the
|
||||
bool fgenabled; // layer does not exist.
|
||||
bool verticalDial; // True if the dials scales vertically.
|
||||
|
||||
qreal startX; // Where we should draw the bargraph
|
||||
qreal startY; // green/yellow/red zones.
|
||||
qreal bargraphSize;
|
||||
qreal indexHeight;
|
||||
qreal indexWidth;
|
||||
|
||||
double testVal;
|
||||
|
||||
double minValue;
|
||||
double maxValue;
|
||||
double greenMin;
|
||||
double greenMax;
|
||||
double yellowMin;
|
||||
double yellowMax;
|
||||
double redMin;
|
||||
double redMax;
|
||||
|
||||
// The Value and target variables
|
||||
// are expressed in degrees
|
||||
double indexTarget;
|
||||
double indexValue;
|
||||
|
||||
// Rotation timer
|
||||
QTimer dialTimer;
|
||||
|
||||
// Name of the fields to read when an update is received:
|
||||
UAVDataObject* obj1;
|
||||
QString field1;
|
||||
|
||||
|
||||
// Test variables
|
||||
int testSpeed;
|
||||
QTimer m_testTimer;
|
||||
// End test variables
|
||||
};
|
||||
#endif /* LINEARDIALGADGETWIDGET_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialgadgetwidget.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 LINEARDIALGADGETWIDGET_H_
|
||||
#define LINEARDIALGADGETWIDGET_H_
|
||||
|
||||
#include "lineardialgadgetconfiguration.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/uavobject.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
|
||||
class LineardialGadgetWidget : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LineardialGadgetWidget(QWidget *parent = 0);
|
||||
~LineardialGadgetWidget();
|
||||
void setDialFile(QString dfn);
|
||||
void paint();
|
||||
void setRange(double min, double max) { minValue=min; maxValue=max;}
|
||||
void setGreenRange(double min, double max) {greenMin=min; greenMax=max;}
|
||||
void setYellowRange(double min, double max) {yellowMin=min; yellowMax=max;}
|
||||
void setRedRange(double min, double max) {redMin=min; redMax=max;}
|
||||
void connectInput(QString obj, QString field);
|
||||
void setIndex(double val);
|
||||
void setDialFont(QString fontProps);
|
||||
|
||||
public slots:
|
||||
void updateIndex(UAVObject *object1);
|
||||
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
|
||||
private slots:
|
||||
// Test function
|
||||
void testRotate();
|
||||
void moveIndex();
|
||||
|
||||
private:
|
||||
QSvgRenderer *m_renderer;
|
||||
QGraphicsSvgItem *background;
|
||||
QGraphicsSvgItem *foreground;
|
||||
QGraphicsSvgItem *index;
|
||||
QGraphicsSvgItem *green;
|
||||
QGraphicsSvgItem *yellow;
|
||||
QGraphicsSvgItem *red;
|
||||
|
||||
QGraphicsTextItem *fieldName;
|
||||
QGraphicsTextItem *fieldValue;
|
||||
|
||||
// Simple flag to skip rendering if the
|
||||
bool fgenabled; // layer does not exist.
|
||||
bool verticalDial; // True if the dials scales vertically.
|
||||
|
||||
qreal startX; // Where we should draw the bargraph
|
||||
qreal startY; // green/yellow/red zones.
|
||||
qreal bargraphSize;
|
||||
qreal indexHeight;
|
||||
qreal indexWidth;
|
||||
|
||||
double testVal;
|
||||
|
||||
double minValue;
|
||||
double maxValue;
|
||||
double greenMin;
|
||||
double greenMax;
|
||||
double yellowMin;
|
||||
double yellowMax;
|
||||
double redMin;
|
||||
double redMax;
|
||||
|
||||
// The Value and target variables
|
||||
// are expressed in degrees
|
||||
double indexTarget;
|
||||
double indexValue;
|
||||
|
||||
// Rotation timer
|
||||
QTimer dialTimer;
|
||||
|
||||
// Name of the fields to read when an update is received:
|
||||
UAVDataObject* obj1;
|
||||
QString field1;
|
||||
|
||||
|
||||
// Test variables
|
||||
int testSpeed;
|
||||
QTimer m_testTimer;
|
||||
// End test variables
|
||||
};
|
||||
#endif /* LINEARDIALGADGETWIDGET_H_ */
|
||||
|
@ -1,66 +1,66 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "lineardialplugin.h"
|
||||
#include "lineardialgadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
LineardialPlugin::LineardialPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
LineardialPlugin::~LineardialPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool LineardialPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new LineardialGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LineardialPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void LineardialPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(LineardialPlugin)
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "lineardialplugin.h"
|
||||
#include "lineardialgadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
LineardialPlugin::LineardialPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
LineardialPlugin::~LineardialPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool LineardialPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mf = new LineardialGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LineardialPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void LineardialPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(LineardialPlugin)
|
||||
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardial
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 LINEARDIALPLUGIN_H_
|
||||
#define LINEARDIALPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class LineardialGadgetFactory;
|
||||
|
||||
class LineardialPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
LineardialPlugin();
|
||||
~LineardialPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
LineardialGadgetFactory *mf;
|
||||
};
|
||||
#endif /* LINEARDIALPLUGIN_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file lineardialplugin.h
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup lineardialplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 LINEARDIALPLUGIN_H_
|
||||
#define LINEARDIALPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class LineardialGadgetFactory;
|
||||
|
||||
class LineardialPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
LineardialPlugin();
|
||||
~LineardialPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
LineardialGadgetFactory *mf;
|
||||
};
|
||||
#endif /* LINEARDIALPLUGIN_H_ */
|
||||
|
@ -1,50 +1,50 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadget.h"
|
||||
#include "modelviewgadgetwidget.h"
|
||||
#include "modelviewgadgetconfiguration.h"
|
||||
|
||||
ModelViewGadget::ModelViewGadget(QString classId, ModelViewGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
ModelViewGadget::~ModelViewGadget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ModelViewGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
ModelViewGadgetConfiguration *m = qobject_cast<ModelViewGadgetConfiguration*>(config);
|
||||
m_widget->setAcFilename(m->acFilename());
|
||||
m_widget->setBgFilename(m->bgFilename());
|
||||
m_widget->setVboEnable(m->vboEnabled());
|
||||
m_widget->reloadScene();
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadget.h"
|
||||
#include "modelviewgadgetwidget.h"
|
||||
#include "modelviewgadgetconfiguration.h"
|
||||
|
||||
ModelViewGadget::ModelViewGadget(QString classId, ModelViewGadgetWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent),
|
||||
m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
ModelViewGadget::~ModelViewGadget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ModelViewGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
{
|
||||
ModelViewGadgetConfiguration *m = qobject_cast<ModelViewGadgetConfiguration*>(config);
|
||||
m_widget->setAcFilename(m->acFilename());
|
||||
m_widget->setBgFilename(m->bgFilename());
|
||||
m_widget->setVboEnable(m->vboEnabled());
|
||||
m_widget->reloadScene();
|
||||
}
|
||||
|
||||
|
@ -1,56 +1,56 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGET_H_
|
||||
#define MODELVIEWGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "modelviewgadgetwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class ModelViewGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ModelViewGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModelViewGadget(QString classId, ModelViewGadgetWidget *widget, QWidget *parent = 0);
|
||||
~ModelViewGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
ModelViewGadgetWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // MODELVIEWGADGET_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGET_H_
|
||||
#define MODELVIEWGADGET_H_
|
||||
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "modelviewgadgetwidget.h"
|
||||
|
||||
class IUAVGadget;
|
||||
class QWidget;
|
||||
class QString;
|
||||
class ModelViewGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ModelViewGadget : public Core::IUAVGadget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModelViewGadget(QString classId, ModelViewGadgetWidget *widget, QWidget *parent = 0);
|
||||
~ModelViewGadget();
|
||||
|
||||
QWidget *widget() { return m_widget; }
|
||||
void loadConfiguration(IUAVGadgetConfiguration* config);
|
||||
|
||||
private:
|
||||
ModelViewGadgetWidget *m_widget;
|
||||
};
|
||||
|
||||
|
||||
#endif // MODELVIEWGADGET_H_
|
||||
|
@ -1,64 +1,64 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetconfiguration.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadgetconfiguration.h"
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
ModelViewGadgetConfiguration::ModelViewGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_acFilename("../artwork/3D Model/quad.dae"),
|
||||
m_bgFilename("../artwork/3D Model/default_background.png"),
|
||||
m_enableVbo(false)
|
||||
{
|
||||
if (state.count() > 0) {
|
||||
QDataStream stream(state);
|
||||
stream >> m_acFilename;
|
||||
stream >> m_bgFilename;
|
||||
stream >> m_enableVbo;
|
||||
}
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *ModelViewGadgetConfiguration::clone()
|
||||
{
|
||||
ModelViewGadgetConfiguration *mv = new ModelViewGadgetConfiguration(this->classId());
|
||||
mv->m_acFilename = m_acFilename;
|
||||
mv->m_bgFilename = m_bgFilename;
|
||||
mv->m_enableVbo = m_enableVbo;
|
||||
return mv;
|
||||
}
|
||||
|
||||
QByteArray ModelViewGadgetConfiguration::saveState() const
|
||||
{
|
||||
|
||||
QByteArray bytes;
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
stream << m_acFilename;
|
||||
stream << m_bgFilename;
|
||||
stream << m_enableVbo;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetconfiguration.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadgetconfiguration.h"
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
ModelViewGadgetConfiguration::ModelViewGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_acFilename("../artwork/3D Model/quad.dae"),
|
||||
m_bgFilename("../artwork/3D Model/default_background.png"),
|
||||
m_enableVbo(false)
|
||||
{
|
||||
if (state.count() > 0) {
|
||||
QDataStream stream(state);
|
||||
stream >> m_acFilename;
|
||||
stream >> m_bgFilename;
|
||||
stream >> m_enableVbo;
|
||||
}
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *ModelViewGadgetConfiguration::clone()
|
||||
{
|
||||
ModelViewGadgetConfiguration *mv = new ModelViewGadgetConfiguration(this->classId());
|
||||
mv->m_acFilename = m_acFilename;
|
||||
mv->m_bgFilename = m_bgFilename;
|
||||
mv->m_enableVbo = m_enableVbo;
|
||||
return mv;
|
||||
}
|
||||
|
||||
QByteArray ModelViewGadgetConfiguration::saveState() const
|
||||
{
|
||||
|
||||
QByteArray bytes;
|
||||
QDataStream stream(&bytes, QIODevice::WriteOnly);
|
||||
stream << m_acFilename;
|
||||
stream << m_bgFilename;
|
||||
stream << m_enableVbo;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
@ -1,58 +1,58 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetconfiguration.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGETCONFIGURATION_H
|
||||
#define MODELVIEWGADGETCONFIGURATION_H
|
||||
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ModelViewGadgetConfiguration : public IUAVGadgetConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ModelViewGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
QString acFilename() {return m_acFilename;}
|
||||
void setAcFilename(QString acFile) { m_acFilename = acFile; }
|
||||
QString bgFilename() { return m_bgFilename; }
|
||||
void setBgFilename(QString bgFile) { m_bgFilename = bgFile; }
|
||||
bool vboEnabled() { return m_enableVbo; }
|
||||
void setVboEnabled(bool vboEnable) { m_enableVbo = vboEnable; }
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QString m_acFilename;
|
||||
QString m_bgFilename;
|
||||
bool m_enableVbo; // Vertex buffer objects, a few GPUs crash if enabled
|
||||
};
|
||||
|
||||
#endif // MODELVIEWGADGETCONFIGURATION_H
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetconfiguration.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGETCONFIGURATION_H
|
||||
#define MODELVIEWGADGETCONFIGURATION_H
|
||||
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ModelViewGadgetConfiguration : public IUAVGadgetConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ModelViewGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||
QByteArray saveState() const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
QString acFilename() {return m_acFilename;}
|
||||
void setAcFilename(QString acFile) { m_acFilename = acFile; }
|
||||
QString bgFilename() { return m_bgFilename; }
|
||||
void setBgFilename(QString bgFile) { m_bgFilename = bgFile; }
|
||||
bool vboEnabled() { return m_enableVbo; }
|
||||
void setVboEnabled(bool vboEnable) { m_enableVbo = vboEnable; }
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QString m_acFilename;
|
||||
QString m_bgFilename;
|
||||
bool m_enableVbo; // Vertex buffer objects, a few GPUs crash if enabled
|
||||
};
|
||||
|
||||
#endif // MODELVIEWGADGETCONFIGURATION_H
|
||||
|
@ -1,59 +1,59 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadgetfactory.h"
|
||||
#include "modelviewgadgetwidget.h"
|
||||
#include "modelviewgadget.h"
|
||||
#include "modelviewgadgetconfiguration.h"
|
||||
#include "modelviewgadgetoptionspage.h"
|
||||
#include <coreplugin/uavgadgetoptionspagedecorator.h>
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
ModelViewGadgetFactory::ModelViewGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("ModelViewGadget"), tr("ModelView Gadget"), parent)
|
||||
{
|
||||
}
|
||||
|
||||
ModelViewGadgetFactory::~ModelViewGadgetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* ModelViewGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
ModelViewGadgetWidget* gadgetWidget = new ModelViewGadgetWidget(parent);
|
||||
return new ModelViewGadget(QString("ModelViewGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *ModelViewGadgetFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new ModelViewGadgetConfiguration(QString("ModelViewGadget"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *ModelViewGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new ModelViewGadgetOptionsPage(qobject_cast<ModelViewGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetfactory.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadgetfactory.h"
|
||||
#include "modelviewgadgetwidget.h"
|
||||
#include "modelviewgadget.h"
|
||||
#include "modelviewgadgetconfiguration.h"
|
||||
#include "modelviewgadgetoptionspage.h"
|
||||
#include <coreplugin/uavgadgetoptionspagedecorator.h>
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
ModelViewGadgetFactory::ModelViewGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("ModelViewGadget"), tr("ModelView Gadget"), parent)
|
||||
{
|
||||
}
|
||||
|
||||
ModelViewGadgetFactory::~ModelViewGadgetFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Core::IUAVGadget* ModelViewGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
ModelViewGadgetWidget* gadgetWidget = new ModelViewGadgetWidget(parent);
|
||||
return new ModelViewGadget(QString("ModelViewGadget"), gadgetWidget, parent);
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *ModelViewGadgetFactory::createConfiguration(const QByteArray &state)
|
||||
{
|
||||
return new ModelViewGadgetConfiguration(QString("ModelViewGadget"), state);
|
||||
}
|
||||
|
||||
IOptionsPage *ModelViewGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
return new ModelViewGadgetOptionsPage(qobject_cast<ModelViewGadgetConfiguration*>(config));
|
||||
}
|
||||
|
||||
|
@ -1,52 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGETFACTORY_H_
|
||||
#define MODELVIEWGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ModelViewGadgetFactory : public Core::IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModelViewGadgetFactory(QObject *parent = 0);
|
||||
~ModelViewGadgetFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // MODELVIEWGADGETFACTORY_H_
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetfactory.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGETFACTORY_H_
|
||||
#define MODELVIEWGADGETFACTORY_H_
|
||||
|
||||
#include <coreplugin/iuavgadgetfactory.h>
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ModelViewGadgetFactory : public Core::IUAVGadgetFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModelViewGadgetFactory(QObject *parent = 0);
|
||||
~ModelViewGadgetFactory();
|
||||
|
||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||
IUAVGadgetConfiguration *createConfiguration(const QByteArray &state);
|
||||
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
|
||||
};
|
||||
|
||||
#endif // MODELVIEWGADGETFACTORY_H_
|
||||
|
@ -1,71 +1,71 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetoptionspage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadgetoptionspage.h"
|
||||
#include "modelviewgadgetconfiguration.h"
|
||||
|
||||
#include "ui_modelviewoptionspage.h"
|
||||
|
||||
|
||||
ModelViewGadgetOptionsPage::ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent) :
|
||||
IOptionsPage(parent),
|
||||
m_config(config)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *ModelViewGadgetOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
m_page = new Ui::ModelViewOptionsPage();
|
||||
QWidget *w = new QWidget(parent);
|
||||
m_page->setupUi(w);
|
||||
|
||||
m_page->modelPathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_page->modelPathChooser->setPromptDialogFilter(tr("3D model (*.dae *.3ds)"));
|
||||
m_page->modelPathChooser->setPromptDialogTitle(tr("Choose 3D model"));
|
||||
m_page->backgroundPathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_page->backgroundPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)"));
|
||||
m_page->backgroundPathChooser->setPromptDialogTitle(tr("Choose background image"));
|
||||
|
||||
|
||||
m_page->modelPathChooser->setPath(m_config->acFilename());
|
||||
m_page->backgroundPathChooser->setPath(m_config->bgFilename());
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void ModelViewGadgetOptionsPage::apply()
|
||||
{
|
||||
m_config->setAcFilename(m_page->modelPathChooser->path());
|
||||
m_config->setBgFilename(m_page->backgroundPathChooser->path());
|
||||
m_config->setVboEnabled(m_page->enableVbo->isChecked());
|
||||
}
|
||||
|
||||
void ModelViewGadgetOptionsPage::finish()
|
||||
{
|
||||
delete m_page;
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetoptionspage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadgetoptionspage.h"
|
||||
#include "modelviewgadgetconfiguration.h"
|
||||
|
||||
#include "ui_modelviewoptionspage.h"
|
||||
|
||||
|
||||
ModelViewGadgetOptionsPage::ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent) :
|
||||
IOptionsPage(parent),
|
||||
m_config(config)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *ModelViewGadgetOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
m_page = new Ui::ModelViewOptionsPage();
|
||||
QWidget *w = new QWidget(parent);
|
||||
m_page->setupUi(w);
|
||||
|
||||
m_page->modelPathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_page->modelPathChooser->setPromptDialogFilter(tr("3D model (*.dae *.3ds)"));
|
||||
m_page->modelPathChooser->setPromptDialogTitle(tr("Choose 3D model"));
|
||||
m_page->backgroundPathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_page->backgroundPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)"));
|
||||
m_page->backgroundPathChooser->setPromptDialogTitle(tr("Choose background image"));
|
||||
|
||||
|
||||
m_page->modelPathChooser->setPath(m_config->acFilename());
|
||||
m_page->backgroundPathChooser->setPath(m_config->bgFilename());
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void ModelViewGadgetOptionsPage::apply()
|
||||
{
|
||||
m_config->setAcFilename(m_page->modelPathChooser->path());
|
||||
m_config->setBgFilename(m_page->backgroundPathChooser->path());
|
||||
m_config->setVboEnabled(m_page->enableVbo->isChecked());
|
||||
}
|
||||
|
||||
void ModelViewGadgetOptionsPage::finish()
|
||||
{
|
||||
delete m_page;
|
||||
}
|
||||
|
||||
|
@ -1,74 +1,74 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetoptionspage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGETOPTIONSPAGE_H
|
||||
#define MODELVIEWGADGETOPTIONSPAGE_H
|
||||
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
|
||||
class ModelViewGadgetConfiguration;
|
||||
class QFileDialog;
|
||||
namespace Core {
|
||||
class IUAVGadgetConfiguration;
|
||||
}
|
||||
namespace Ui {
|
||||
class ModelViewOptionsPage;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ModelViewGadgetOptionsPage : public IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent = 0);
|
||||
QString id() const { return ""; }
|
||||
QString trName() const { return ""; }
|
||||
QString category() const { return ""; }
|
||||
QString trCategory() const { return ""; }
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
private:
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
private slots:
|
||||
|
||||
private:
|
||||
ModelViewGadgetConfiguration *m_config;
|
||||
Ui::ModelViewOptionsPage *m_page;
|
||||
};
|
||||
|
||||
#endif // MODELVIEWGADGETOPTIONSPAGE_H
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetoptionspage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGETOPTIONSPAGE_H
|
||||
#define MODELVIEWGADGETOPTIONSPAGE_H
|
||||
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
|
||||
class ModelViewGadgetConfiguration;
|
||||
class QFileDialog;
|
||||
namespace Core {
|
||||
class IUAVGadgetConfiguration;
|
||||
}
|
||||
namespace Ui {
|
||||
class ModelViewOptionsPage;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class ModelViewGadgetOptionsPage : public IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent = 0);
|
||||
QString id() const { return ""; }
|
||||
QString trName() const { return ""; }
|
||||
QString category() const { return ""; }
|
||||
QString trCategory() const { return ""; }
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
private:
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
private slots:
|
||||
|
||||
private:
|
||||
ModelViewGadgetConfiguration *m_config;
|
||||
Ui::ModelViewOptionsPage *m_page;
|
||||
};
|
||||
|
||||
#endif // MODELVIEWGADGETOPTIONSPAGE_H
|
||||
|
@ -1,200 +1,200 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadgetwidget.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include <iostream>
|
||||
|
||||
ModelViewGadgetWidget::ModelViewGadgetWidget(QWidget *parent)
|
||||
: QGLWidget(parent)
|
||||
, m_pFactory(GLC_Factory::instance(this->context()))
|
||||
, m_Light()
|
||||
, m_World()
|
||||
, m_GlView(this)
|
||||
, m_MoverController()
|
||||
, m_ModelBoundingBox()
|
||||
, m_MotionTimer()
|
||||
{
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
|
||||
|
||||
m_Light.setPosition(4000.0, 40000.0, 80000.0);
|
||||
m_Light.setAmbientColor(Qt::lightGray);
|
||||
|
||||
QColor repColor;
|
||||
repColor.setRgbF(1.0, 0.11372, 0.11372, 0.0);
|
||||
m_MoverController= m_pFactory->createDefaultMoverController(repColor, &m_GlView);
|
||||
|
||||
m_GlView.cameraHandle()->setDefaultUpVector(glc::Y_AXIS);
|
||||
m_GlView.cameraHandle()->setRightView();
|
||||
//m_GlView.cameraHandle()->setIsoView();
|
||||
|
||||
// Get required UAVObjects
|
||||
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
|
||||
attActual = AttitudeActual::GetInstance(objManager);
|
||||
|
||||
// Create objects to display
|
||||
CreateScene();
|
||||
connect(&m_MotionTimer, SIGNAL(timeout()), this, SLOT(updateAttitude()));
|
||||
}
|
||||
|
||||
ModelViewGadgetWidget::~ModelViewGadgetWidget()
|
||||
{
|
||||
delete m_pFactory;
|
||||
}
|
||||
|
||||
//// Public funcitons ////
|
||||
void ModelViewGadgetWidget::reloadScene()
|
||||
{
|
||||
CreateScene();
|
||||
}
|
||||
|
||||
//// Private functions ////
|
||||
void ModelViewGadgetWidget::initializeGL()
|
||||
{
|
||||
// OpenGL initialization
|
||||
m_GlView.initGl();
|
||||
if (!vboEnable)
|
||||
{
|
||||
GLC_State::setVboUsage(false);
|
||||
qDebug("VBOs disabled. Enable for better performance if GPU supports it.");
|
||||
}
|
||||
|
||||
m_GlView.reframe(m_ModelBoundingBox);
|
||||
// Calculate camera depth of view
|
||||
m_GlView.setDistMinAndMax(m_World.boundingBox());
|
||||
glEnable(GL_NORMALIZE);
|
||||
|
||||
m_MotionTimer.start(100);
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
// m_GlView.setWinGLSize(width(), height());
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::paintGL()
|
||||
{
|
||||
// Clear screen
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// Load identity matrix
|
||||
glLoadIdentity();
|
||||
|
||||
// define the light
|
||||
m_Light.enable();
|
||||
|
||||
// define view matrix
|
||||
m_GlView.glExecuteCam();
|
||||
m_Light.glExecute();
|
||||
|
||||
// Display the collection of GLC_Object
|
||||
m_World.glExecute(0, false);
|
||||
|
||||
// Display UI Info (orbit circle)
|
||||
m_MoverController.drawActiveMoverRep();
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::resizeGL(int width, int height)
|
||||
{
|
||||
m_GlView.setWinGLSize(width, height); // Compute window aspect ratio
|
||||
}
|
||||
|
||||
// Create GLC_Object to display
|
||||
void ModelViewGadgetWidget::CreateScene()
|
||||
{
|
||||
if (QFile::exists(bgFilename))
|
||||
{
|
||||
m_GlView.loadBackGroundImage(bgFilename);
|
||||
}
|
||||
//else { std::cout << "File doesn't exist" << bgFilename.toStdString() << std::endl; }
|
||||
|
||||
if (QFile::exists(acFilename))
|
||||
{
|
||||
QFile aircraft(acFilename);
|
||||
|
||||
GLC_World* pWorld= m_pFactory->createWorld(aircraft);
|
||||
m_World= *pWorld;
|
||||
delete pWorld;
|
||||
|
||||
m_ModelBoundingBox= m_World.boundingBox();
|
||||
}
|
||||
//else { std::cout << "File doesn't exist" << acFilename.toStdString() << std::endl; }
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
if (m_MoverController.hasActiveMover()) return;
|
||||
|
||||
switch (e->button())
|
||||
{
|
||||
case (Qt::LeftButton):
|
||||
m_MotionTimer.stop();
|
||||
m_MoverController.setActiveMover(GLC_MoverController::TurnTable, e->x(), e->y());
|
||||
updateGL();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::mouseMoveEvent(QMouseEvent * e)
|
||||
{
|
||||
if (not m_MoverController.hasActiveMover()) return;
|
||||
m_MoverController.move(e->x(), e->y());
|
||||
m_GlView.setDistMinAndMax(m_World.boundingBox());
|
||||
updateGL();
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::mouseReleaseEvent(QMouseEvent*)
|
||||
{
|
||||
if (not m_MoverController.hasActiveMover()) return;
|
||||
m_MoverController.setNoMover();
|
||||
m_MotionTimer.start();
|
||||
updateGL();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private slots Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void ModelViewGadgetWidget::updateAttitude()
|
||||
{
|
||||
// Reset view to zero angles
|
||||
// NOTE: Some aircraft 3D models have different orientation and axis
|
||||
m_GlView.cameraHandle()->setTopView();
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::X_AXIS, 180.0*glc::PI/180.0);
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::Z_AXIS, 90.0*glc::PI/180.0);
|
||||
// Rotate to the actual angles (if a gimbal lock at yaw 90/270 deg, change sequence of rotations)
|
||||
AttitudeActual::DataFields data = attActual->getData();
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::Z_AXIS, data.Yaw*glc::PI/180.0);
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::X_AXIS, data.Roll*glc::PI/180.0);
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::Y_AXIS, -data.Pitch*glc::PI/180.0);
|
||||
updateGL();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetwidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewgadgetwidget.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include <iostream>
|
||||
|
||||
ModelViewGadgetWidget::ModelViewGadgetWidget(QWidget *parent)
|
||||
: QGLWidget(parent)
|
||||
, m_pFactory(GLC_Factory::instance(this->context()))
|
||||
, m_Light()
|
||||
, m_World()
|
||||
, m_GlView(this)
|
||||
, m_MoverController()
|
||||
, m_ModelBoundingBox()
|
||||
, m_MotionTimer()
|
||||
{
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
|
||||
|
||||
m_Light.setPosition(4000.0, 40000.0, 80000.0);
|
||||
m_Light.setAmbientColor(Qt::lightGray);
|
||||
|
||||
QColor repColor;
|
||||
repColor.setRgbF(1.0, 0.11372, 0.11372, 0.0);
|
||||
m_MoverController= m_pFactory->createDefaultMoverController(repColor, &m_GlView);
|
||||
|
||||
m_GlView.cameraHandle()->setDefaultUpVector(glc::Y_AXIS);
|
||||
m_GlView.cameraHandle()->setRightView();
|
||||
//m_GlView.cameraHandle()->setIsoView();
|
||||
|
||||
// Get required UAVObjects
|
||||
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager* objManager = pm->getObject<UAVObjectManager>();
|
||||
attActual = AttitudeActual::GetInstance(objManager);
|
||||
|
||||
// Create objects to display
|
||||
CreateScene();
|
||||
connect(&m_MotionTimer, SIGNAL(timeout()), this, SLOT(updateAttitude()));
|
||||
}
|
||||
|
||||
ModelViewGadgetWidget::~ModelViewGadgetWidget()
|
||||
{
|
||||
delete m_pFactory;
|
||||
}
|
||||
|
||||
//// Public funcitons ////
|
||||
void ModelViewGadgetWidget::reloadScene()
|
||||
{
|
||||
CreateScene();
|
||||
}
|
||||
|
||||
//// Private functions ////
|
||||
void ModelViewGadgetWidget::initializeGL()
|
||||
{
|
||||
// OpenGL initialization
|
||||
m_GlView.initGl();
|
||||
if (!vboEnable)
|
||||
{
|
||||
GLC_State::setVboUsage(false);
|
||||
qDebug("VBOs disabled. Enable for better performance if GPU supports it.");
|
||||
}
|
||||
|
||||
m_GlView.reframe(m_ModelBoundingBox);
|
||||
// Calculate camera depth of view
|
||||
m_GlView.setDistMinAndMax(m_World.boundingBox());
|
||||
glEnable(GL_NORMALIZE);
|
||||
|
||||
m_MotionTimer.start(100);
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
// m_GlView.setWinGLSize(width(), height());
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::paintGL()
|
||||
{
|
||||
// Clear screen
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// Load identity matrix
|
||||
glLoadIdentity();
|
||||
|
||||
// define the light
|
||||
m_Light.enable();
|
||||
|
||||
// define view matrix
|
||||
m_GlView.glExecuteCam();
|
||||
m_Light.glExecute();
|
||||
|
||||
// Display the collection of GLC_Object
|
||||
m_World.glExecute(0, false);
|
||||
|
||||
// Display UI Info (orbit circle)
|
||||
m_MoverController.drawActiveMoverRep();
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::resizeGL(int width, int height)
|
||||
{
|
||||
m_GlView.setWinGLSize(width, height); // Compute window aspect ratio
|
||||
}
|
||||
|
||||
// Create GLC_Object to display
|
||||
void ModelViewGadgetWidget::CreateScene()
|
||||
{
|
||||
if (QFile::exists(bgFilename))
|
||||
{
|
||||
m_GlView.loadBackGroundImage(bgFilename);
|
||||
}
|
||||
//else { std::cout << "File doesn't exist" << bgFilename.toStdString() << std::endl; }
|
||||
|
||||
if (QFile::exists(acFilename))
|
||||
{
|
||||
QFile aircraft(acFilename);
|
||||
|
||||
GLC_World* pWorld= m_pFactory->createWorld(aircraft);
|
||||
m_World= *pWorld;
|
||||
delete pWorld;
|
||||
|
||||
m_ModelBoundingBox= m_World.boundingBox();
|
||||
}
|
||||
//else { std::cout << "File doesn't exist" << acFilename.toStdString() << std::endl; }
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
if (m_MoverController.hasActiveMover()) return;
|
||||
|
||||
switch (e->button())
|
||||
{
|
||||
case (Qt::LeftButton):
|
||||
m_MotionTimer.stop();
|
||||
m_MoverController.setActiveMover(GLC_MoverController::TurnTable, e->x(), e->y());
|
||||
updateGL();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::mouseMoveEvent(QMouseEvent * e)
|
||||
{
|
||||
if (not m_MoverController.hasActiveMover()) return;
|
||||
m_MoverController.move(e->x(), e->y());
|
||||
m_GlView.setDistMinAndMax(m_World.boundingBox());
|
||||
updateGL();
|
||||
}
|
||||
|
||||
void ModelViewGadgetWidget::mouseReleaseEvent(QMouseEvent*)
|
||||
{
|
||||
if (not m_MoverController.hasActiveMover()) return;
|
||||
m_MoverController.setNoMover();
|
||||
m_MotionTimer.start();
|
||||
updateGL();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private slots Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void ModelViewGadgetWidget::updateAttitude()
|
||||
{
|
||||
// Reset view to zero angles
|
||||
// NOTE: Some aircraft 3D models have different orientation and axis
|
||||
m_GlView.cameraHandle()->setTopView();
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::X_AXIS, 180.0*glc::PI/180.0);
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::Z_AXIS, 90.0*glc::PI/180.0);
|
||||
// Rotate to the actual angles (if a gimbal lock at yaw 90/270 deg, change sequence of rotations)
|
||||
AttitudeActual::DataFields data = attActual->getData();
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::Z_AXIS, data.Yaw*glc::PI/180.0);
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::X_AXIS, data.Roll*glc::PI/180.0);
|
||||
m_GlView.cameraHandle()->rotateAroundTarget(glc::Y_AXIS, -data.Pitch*glc::PI/180.0);
|
||||
updateGL();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,96 +1,96 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGETWIDGET_H_
|
||||
#define MODELVIEWGADGETWIDGET_H_
|
||||
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QTimer>
|
||||
|
||||
#include <GLC_Factory>
|
||||
#include <GLC_Viewport>
|
||||
#include <GLC_MoverController>
|
||||
#include <GLC_Light>
|
||||
#include <GLC_World>
|
||||
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/attitudeactual.h"
|
||||
|
||||
|
||||
|
||||
class ModelViewGadgetWidget : public QGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModelViewGadgetWidget(QWidget *parent = 0);
|
||||
~ModelViewGadgetWidget();
|
||||
void setAcFilename(QString acf) { acFilename = acf; }
|
||||
void setBgFilename(QString bgf) { bgFilename = bgf; }
|
||||
void setVboEnable(bool eVbo) { vboEnable = eVbo; }
|
||||
void reloadScene();
|
||||
void updateAttitude(int value);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void resizeGL(int width, int height);
|
||||
// Create GLC_Object to display
|
||||
void CreateScene();
|
||||
|
||||
//Mouse events
|
||||
void mousePressEvent(QMouseEvent * e);
|
||||
void mouseMoveEvent(QMouseEvent * e);
|
||||
void mouseReleaseEvent(QMouseEvent * e);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private slots Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
private slots:
|
||||
void updateAttitude();
|
||||
|
||||
private:
|
||||
GLC_Factory* m_pFactory;
|
||||
GLC_Light m_Light;
|
||||
GLC_World m_World;
|
||||
GLC_Viewport m_GlView;
|
||||
GLC_MoverController m_MoverController;
|
||||
GLC_BoundingBox m_ModelBoundingBox;
|
||||
//! The timer used for motion
|
||||
QTimer m_MotionTimer;
|
||||
|
||||
QString acFilename;
|
||||
QString bgFilename;
|
||||
bool vboEnable;
|
||||
|
||||
AttitudeActual* attActual;
|
||||
};
|
||||
|
||||
#endif /* MODELVIEWGADGETWIDGET_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewgadgetwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWGADGETWIDGET_H_
|
||||
#define MODELVIEWGADGETWIDGET_H_
|
||||
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QTimer>
|
||||
|
||||
#include <GLC_Factory>
|
||||
#include <GLC_Viewport>
|
||||
#include <GLC_MoverController>
|
||||
#include <GLC_Light>
|
||||
#include <GLC_World>
|
||||
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/attitudeactual.h"
|
||||
|
||||
|
||||
|
||||
class ModelViewGadgetWidget : public QGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModelViewGadgetWidget(QWidget *parent = 0);
|
||||
~ModelViewGadgetWidget();
|
||||
void setAcFilename(QString acf) { acFilename = acf; }
|
||||
void setBgFilename(QString bgf) { bgFilename = bgf; }
|
||||
void setVboEnable(bool eVbo) { vboEnable = eVbo; }
|
||||
void reloadScene();
|
||||
void updateAttitude(int value);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void resizeGL(int width, int height);
|
||||
// Create GLC_Object to display
|
||||
void CreateScene();
|
||||
|
||||
//Mouse events
|
||||
void mousePressEvent(QMouseEvent * e);
|
||||
void mouseMoveEvent(QMouseEvent * e);
|
||||
void mouseReleaseEvent(QMouseEvent * e);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private slots Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
private slots:
|
||||
void updateAttitude();
|
||||
|
||||
private:
|
||||
GLC_Factory* m_pFactory;
|
||||
GLC_Light m_Light;
|
||||
GLC_World m_World;
|
||||
GLC_Viewport m_GlView;
|
||||
GLC_MoverController m_MoverController;
|
||||
GLC_BoundingBox m_ModelBoundingBox;
|
||||
//! The timer used for motion
|
||||
QTimer m_MotionTimer;
|
||||
|
||||
QString acFilename;
|
||||
QString bgFilename;
|
||||
bool vboEnable;
|
||||
|
||||
AttitudeActual* attActual;
|
||||
};
|
||||
|
||||
#endif /* MODELVIEWGADGETWIDGET_H_ */
|
||||
|
@ -1,65 +1,65 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewplugin.h"
|
||||
#include "modelviewgadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
ModelViewPlugin::ModelViewPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
ModelViewPlugin::~ModelViewPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool ModelViewPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mvf = new ModelViewGadgetFactory(this);
|
||||
addAutoReleasedObject(mvf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ModelViewPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void ModelViewPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(ModelViewPlugin)
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewplugin.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "modelviewplugin.h"
|
||||
#include "modelviewgadgetfactory.h"
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
|
||||
ModelViewPlugin::ModelViewPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
ModelViewPlugin::~ModelViewPlugin()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
bool ModelViewPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
Q_UNUSED(errMsg);
|
||||
mvf = new ModelViewGadgetFactory(this);
|
||||
addAutoReleasedObject(mvf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ModelViewPlugin::extensionsInitialized()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void ModelViewPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
Q_EXPORT_PLUGIN(ModelViewPlugin)
|
||||
|
||||
|
@ -1,47 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelview
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWPLUGIN_H_
|
||||
#define MODELVIEWPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class ModelViewGadgetFactory;
|
||||
|
||||
class ModelViewPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
ModelViewPlugin();
|
||||
~ModelViewPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
ModelViewGadgetFactory *mvf;
|
||||
};
|
||||
#endif /* MODELVIEWPLUGIN_H_ */
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file modelviewplugin.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup modelviewplugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 MODELVIEWPLUGIN_H_
|
||||
#define MODELVIEWPLUGIN_H_
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
class ModelViewGadgetFactory;
|
||||
|
||||
class ModelViewPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
public:
|
||||
ModelViewPlugin();
|
||||
~ModelViewPlugin();
|
||||
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList & arguments, QString * errorString);
|
||||
void shutdown();
|
||||
private:
|
||||
ModelViewGadgetFactory *mvf;
|
||||
};
|
||||
#endif /* MODELVIEWPLUGIN_H_ */
|
||||
|
@ -10,6 +10,13 @@ SUBDIRS = plugin_coreplugin
|
||||
#plugin_donothing.subdir = donothing
|
||||
#plugin_donothing.depends = plugin_coreplugin
|
||||
|
||||
# Another example, with more details such as options page
|
||||
# Empty UAVGadget
|
||||
#plugin_emptygadget.subdir = emptygadget
|
||||
#plugin_emptygadget.depends = plugin_coreplugin
|
||||
#SUBDIRS += plugin_emptygadget
|
||||
|
||||
|
||||
# Core Plugin
|
||||
plugin_coreplugin.subdir = coreplugin
|
||||
|
||||
@ -39,11 +46,6 @@ plugin_uavtalk.subdir = uavtalk
|
||||
plugin_uavtalk.depends = plugin_uavobjects
|
||||
plugin_uavtalk.depends += plugin_coreplugin
|
||||
|
||||
# Empty UAVGadget
|
||||
plugin_emptygadget.subdir = emptygadget
|
||||
plugin_emptygadget.depends = plugin_coreplugin
|
||||
SUBDIRS += plugin_emptygadget
|
||||
|
||||
# Map UAVGadget
|
||||
plugin_map.subdir = map
|
||||
plugin_map.depends = plugin_coreplugin
|
||||
@ -103,7 +105,7 @@ plugin_notify.depends = plugin_coreplugin
|
||||
plugin_notify.depends = plugin_uavobjects
|
||||
SUBDIRS += plugin_notify
|
||||
|
||||
#HITL simulation Gadget
|
||||
#HITL Simulation Gadget
|
||||
plugin_hitl.subdir = hitl
|
||||
plugin_hitl.depends = plugin_coreplugin
|
||||
plugin_hitl.depends += plugin_uavobjects
|
||||
|
Loading…
x
Reference in New Issue
Block a user