mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
uncrustification
This commit is contained in:
parent
37dab0e4fc
commit
b627b71d0e
@ -40,7 +40,6 @@
|
||||
#include <QEventLoop>
|
||||
|
||||
namespace Core {
|
||||
|
||||
ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow) :
|
||||
QWidget(mainWindow),
|
||||
m_availableDevList(0),
|
||||
@ -97,7 +96,8 @@ void ConnectionManager::init()
|
||||
// TODO needs documentation?
|
||||
void ConnectionManager::addWidget(QWidget *widget)
|
||||
{
|
||||
QHBoxLayout *l = (QHBoxLayout *) layout();
|
||||
QHBoxLayout *l = (QHBoxLayout *)layout();
|
||||
|
||||
l->insertWidget(0, widget, 0, Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include <QTimer>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class IConnection;
|
||||
|
||||
namespace Internal {
|
||||
|
@ -39,13 +39,11 @@ using namespace Core::Internal;
|
||||
const int WorkspaceSettings::MAX_WORKSPACES = 10;
|
||||
|
||||
WorkspaceSettings::WorkspaceSettings(QObject *parent) :
|
||||
IOptionsPage(parent)
|
||||
{
|
||||
}
|
||||
IOptionsPage(parent)
|
||||
{}
|
||||
|
||||
WorkspaceSettings::~WorkspaceSettings()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
// IOptionsPage
|
||||
|
||||
|
@ -30,9 +30,8 @@
|
||||
#include "monitorwidget.h"
|
||||
|
||||
MonitorGadget::MonitorGadget(QString classId, MonitorWidget *widget, QWidget *parent) :
|
||||
IUAVGadget(classId, parent), m_widget(widget)
|
||||
{
|
||||
}
|
||||
IUAVGadget(classId, parent), m_widget(widget)
|
||||
{}
|
||||
|
||||
MonitorGadget::~MonitorGadget()
|
||||
{
|
||||
@ -40,14 +39,14 @@ MonitorGadget::~MonitorGadget()
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
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 MonitorGadget::loadConfiguration(IUAVGadgetConfiguration *config)
|
||||
{
|
||||
//MonitorGadgetConfiguration *m = qobject_cast<MonitorGadgetConfiguration *>(config);
|
||||
// MonitorGadgetConfiguration *m = qobject_cast<MonitorGadgetConfiguration *>(config);
|
||||
|
||||
//m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint
|
||||
// m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint
|
||||
}
|
||||
|
@ -31,14 +31,14 @@
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
#include "monitorwidget.h"
|
||||
|
||||
//class IUAVGadget;
|
||||
//class QWidget;
|
||||
//class QString;
|
||||
// class IUAVGadget;
|
||||
// class QWidget;
|
||||
// class QString;
|
||||
// class NotifyPluginGadgetWidget;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class MonitorGadget: public IUAVGadget {
|
||||
class MonitorGadget : public IUAVGadget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MonitorGadget(QString classId, MonitorWidget *widget, QWidget *parent = 0);
|
||||
|
@ -31,8 +31,7 @@ MonitorGadgetConfiguration::MonitorGadgetConfiguration(QString classId, QSetting
|
||||
IUAVGadgetConfiguration(classId, parent)
|
||||
{
|
||||
// if a saved configuration exists load it
|
||||
if (qSettings != 0) {
|
||||
}
|
||||
if (qSettings != 0) {}
|
||||
}
|
||||
|
||||
IUAVGadgetConfiguration *MonitorGadgetConfiguration::clone()
|
||||
@ -48,7 +47,7 @@ IUAVGadgetConfiguration *MonitorGadgetConfiguration::clone()
|
||||
*/
|
||||
void MonitorGadgetConfiguration::saveConfig(QSettings *qSettings) const
|
||||
{
|
||||
// qSettings->setValue("acFilename", Utils::PathUtils().RemoveDataPath(m_acFilename));
|
||||
// qSettings->setValue("bgFilename", Utils::PathUtils().RemoveDataPath(m_bgFilename));
|
||||
// qSettings->setValue("enableVbo", m_enableVbo);
|
||||
// qSettings->setValue("acFilename", Utils::PathUtils().RemoveDataPath(m_acFilename));
|
||||
// qSettings->setValue("bgFilename", Utils::PathUtils().RemoveDataPath(m_bgFilename));
|
||||
// qSettings->setValue("enableVbo", m_enableVbo);
|
||||
}
|
||||
|
@ -35,13 +35,11 @@
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
MonitorGadgetFactory::MonitorGadgetFactory(QObject *parent) :
|
||||
IUAVGadgetFactory(QString("TelemetryMonitorGadget"), tr("Telemetry Monitor"), parent)
|
||||
{
|
||||
}
|
||||
IUAVGadgetFactory(QString("TelemetryMonitorGadget"), tr("Telemetry Monitor"), parent)
|
||||
{}
|
||||
|
||||
MonitorGadgetFactory::~MonitorGadgetFactory()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Core::IUAVGadget *MonitorGadgetFactory::createGadget(QWidget *parent)
|
||||
{
|
||||
|
@ -33,14 +33,14 @@
|
||||
|
||||
|
||||
namespace Core {
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
class IUAVGadget;
|
||||
class IUAVGadgetFactory;
|
||||
}
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class MonitorGadgetFactory: public IUAVGadgetFactory {
|
||||
Q_OBJECT
|
||||
class MonitorGadgetFactory : public IUAVGadgetFactory {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MonitorGadgetFactory(QObject *parent = 0);
|
||||
~MonitorGadgetFactory();
|
||||
|
@ -27,81 +27,78 @@
|
||||
|
||||
#include "monitorgadgetoptionspage.h"
|
||||
#include <coreplugin/icore.h>
|
||||
//#include "ui_telemetrypluginoptionspage.h"
|
||||
// #include "ui_telemetrypluginoptionspage.h"
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
|
||||
MonitorGadgetOptionsPage::MonitorGadgetOptionsPage(MonitorGadgetConfiguration *config, QObject *parent)
|
||||
: IOptionsPage(parent)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
MonitorGadgetOptionsPage::~MonitorGadgetOptionsPage()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
QWidget *MonitorGadgetOptionsPage::createPage(QWidget * /* parent */)
|
||||
{
|
||||
// _optionsPage.reset(new Ui::TelemetryPluginOptionsPage());
|
||||
// // main widget
|
||||
// QWidget *optionsPageWidget = new QWidget;
|
||||
// _dynamicFieldWidget = NULL;
|
||||
// _dynamicFieldCondition = NULL;
|
||||
// resetFieldType();
|
||||
// // save ref to form, needed for binding dynamic fields in future
|
||||
// _form = optionsPageWidget;
|
||||
// // main layout
|
||||
// _optionsPage->setupUi(optionsPageWidget);
|
||||
// _optionsPage.reset(new Ui::TelemetryPluginOptionsPage());
|
||||
//// main widget
|
||||
// QWidget *optionsPageWidget = new QWidget;
|
||||
// _dynamicFieldWidget = NULL;
|
||||
// _dynamicFieldCondition = NULL;
|
||||
// resetFieldType();
|
||||
//// save ref to form, needed for binding dynamic fields in future
|
||||
// _form = optionsPageWidget;
|
||||
//// main layout
|
||||
// _optionsPage->setupUi(optionsPageWidget);
|
||||
//
|
||||
// _optionsPage->SoundDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
// _optionsPage->SoundDirectoryPathChooser->setPromptDialogTitle(tr("Choose sound collection directory"));
|
||||
// _optionsPage->SoundDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
// _optionsPage->SoundDirectoryPathChooser->setPromptDialogTitle(tr("Choose sound collection directory"));
|
||||
//
|
||||
// connect(_optionsPage->SoundDirectoryPathChooser, SIGNAL(changed(const QString &)),
|
||||
// this, SLOT(on_clicked_buttonSoundFolder(const QString &)));
|
||||
// connect(_optionsPage->SoundCollectionList, SIGNAL(currentIndexChanged(int)),
|
||||
// this, SLOT(on_changedIndex_soundLanguage(int)));
|
||||
// connect(_optionsPage->SoundDirectoryPathChooser, SIGNAL(changed(const QString &)),
|
||||
// this, SLOT(on_clicked_buttonSoundFolder(const QString &)));
|
||||
// connect(_optionsPage->SoundCollectionList, SIGNAL(currentIndexChanged(int)),
|
||||
// this, SLOT(on_changedIndex_soundLanguage(int)));
|
||||
//
|
||||
// connect(this, SIGNAL(updateNotifications(QList<NotificationItem *>)),
|
||||
// _owner, SLOT(updateNotificationList(QList<NotificationItem *>)));
|
||||
// // connect(this, SIGNAL(resetNotification()),owner, SLOT(resetNotification()));
|
||||
// connect(this, SIGNAL(updateNotifications(QList<NotificationItem *>)),
|
||||
// _owner, SLOT(updateNotificationList(QList<NotificationItem *>)));
|
||||
//// connect(this, SIGNAL(resetNotification()),owner, SLOT(resetNotification()));
|
||||
//
|
||||
// _privListNotifications = _owner->getListNotifications();
|
||||
// _privListNotifications = _owner->getListNotifications();
|
||||
//
|
||||
//
|
||||
// // [1]
|
||||
// setSelectedNotification(_owner->getCurrentNotification());
|
||||
// addDynamicFieldLayout();
|
||||
// // [2]
|
||||
// updateConfigView(_selectedNotification);
|
||||
//// [1]
|
||||
// setSelectedNotification(_owner->getCurrentNotification());
|
||||
// addDynamicFieldLayout();
|
||||
//// [2]
|
||||
// updateConfigView(_selectedNotification);
|
||||
//
|
||||
// initRulesTable();
|
||||
// initButtons();
|
||||
// initPhononPlayer();
|
||||
// initRulesTable();
|
||||
// initButtons();
|
||||
// initPhononPlayer();
|
||||
//
|
||||
// int curr_row = _privListNotifications.indexOf(_selectedNotification);
|
||||
// _telemetryRulesSelection->setCurrentIndex(_telemetryRulesModel->index(curr_row, 0, QModelIndex()),
|
||||
// QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
// int curr_row = _privListNotifications.indexOf(_selectedNotification);
|
||||
// _telemetryRulesSelection->setCurrentIndex(_telemetryRulesModel->index(curr_row, 0, QModelIndex()),
|
||||
// QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
//
|
||||
// return optionsPageWidget;
|
||||
// return optionsPageWidget;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void MonitorGadgetOptionsPage::apply()
|
||||
{
|
||||
// getOptionsPageValues(_owner->getCurrentNotification());
|
||||
// _owner->setEnableSound(_optionsPage->chkEnableSound->isChecked());
|
||||
// emit updateNotifications(_privListNotifications);
|
||||
// getOptionsPageValues(_owner->getCurrentNotification());
|
||||
// _owner->setEnableSound(_optionsPage->chkEnableSound->isChecked());
|
||||
// emit updateNotifications(_privListNotifications);
|
||||
}
|
||||
|
||||
void MonitorGadgetOptionsPage::finish()
|
||||
{
|
||||
// disconnect(_optionsPage->UAVObjectField, SIGNAL(currentIndexChanged(QString)),
|
||||
// this, SLOT(on_changedIndex_UAVField(QString)));
|
||||
// disconnect(_optionsPage->UAVObjectField, SIGNAL(currentIndexChanged(QString)),
|
||||
// this, SLOT(on_changedIndex_UAVField(QString)));
|
||||
//
|
||||
// disconnect(_testSound.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)),
|
||||
// this, SLOT(on_changed_playButtonText(Phonon::State, Phonon::State)));
|
||||
// if (_testSound) {
|
||||
// _testSound->stop();
|
||||
// _testSound->clear();
|
||||
// }
|
||||
// disconnect(_testSound.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)),
|
||||
// this, SLOT(on_changed_playButtonText(Phonon::State, Phonon::State)));
|
||||
// if (_testSound) {
|
||||
// _testSound->stop();
|
||||
// _testSound->clear();
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -7,102 +7,101 @@
|
||||
#include <QtGui/QFont>
|
||||
|
||||
namespace {
|
||||
/**
|
||||
* Create an SVG item and connect it to an element of the SVG file previously loaded into the parent item.
|
||||
* This then allows to show, hide, move, scale and rotate the element.
|
||||
* Opacity can also be changed.
|
||||
* Other characteristics (color, ...) of the element cannot be modified.
|
||||
*/
|
||||
// TODO move to some utility class that can be reused by other SVG manipulating code
|
||||
QGraphicsSvgItem *createSvgItem(QGraphicsSvgItem *parent, QString elementId)
|
||||
{
|
||||
QGraphicsSvgItem *item = new QGraphicsSvgItem(parent);
|
||||
|
||||
/**
|
||||
* Create an SVG item and connect it to an element of the SVG file previously loaded into the parent item.
|
||||
* This then allows to show, hide, move, scale and rotate the element.
|
||||
* Opacity can also be changed.
|
||||
* Other characteristics (color, ...) of the element cannot be modified.
|
||||
*/
|
||||
// TODO move to some utility class that can be reused by other SVG manipulating code
|
||||
QGraphicsSvgItem *createSvgItem(QGraphicsSvgItem *parent, QString elementId)
|
||||
{
|
||||
QGraphicsSvgItem *item = new QGraphicsSvgItem(parent);
|
||||
QSvgRenderer *renderer = parent->renderer();
|
||||
|
||||
QSvgRenderer *renderer = parent->renderer();
|
||||
// connect item to its corresponding element
|
||||
item->setSharedRenderer(renderer);
|
||||
item->setElementId(elementId);
|
||||
|
||||
// connect item to its corresponding element
|
||||
item->setSharedRenderer(renderer);
|
||||
item->setElementId(elementId);
|
||||
// move item to its location
|
||||
QMatrix elementMatrix = renderer->matrixForElement(elementId);
|
||||
QRectF elementRect = elementMatrix.mapRect(renderer->boundsOnElement(elementId));
|
||||
item->setPos(elementRect.x(), elementRect.y());
|
||||
|
||||
// move item to its location
|
||||
QMatrix elementMatrix = renderer->matrixForElement(elementId);
|
||||
QRectF elementRect = elementMatrix.mapRect(renderer->boundsOnElement(elementId));
|
||||
item->setPos(elementRect.x(), elementRect.y());
|
||||
return item;
|
||||
}
|
||||
|
||||
return item;
|
||||
/**
|
||||
* Create a text item based on a svg rectangle.
|
||||
* The rectangle must be in the correct location (hint: use a "text" layer on top of the "background layer")
|
||||
* The font size will be set to match as well as possible the rectangle height but it is not guaranteed.
|
||||
*
|
||||
* It is possible to show the text rectangle to help understand layout issues.
|
||||
*
|
||||
*/
|
||||
// TODO move to some utility class that can be reused by other SVG manipulating code
|
||||
QGraphicsTextItem *createTextItem(QGraphicsSvgItem *parent, QString elementId, QString fontName,
|
||||
bool showRect = false)
|
||||
{
|
||||
if (showRect) {
|
||||
// create and display the text rectangle
|
||||
// needs to be done first otherwise the rectangle will blank out the text.
|
||||
createSvgItem(parent, elementId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a text item based on a svg rectangle.
|
||||
* The rectangle must be in the correct location (hint: use a "text" layer on top of the "background layer")
|
||||
* The font size will be set to match as well as possible the rectangle height but it is not guaranteed.
|
||||
*
|
||||
* It is possible to show the text rectangle to help understand layout issues.
|
||||
*
|
||||
*/
|
||||
// TODO move to some utility class that can be reused by other SVG manipulating code
|
||||
QGraphicsTextItem *createTextItem(QGraphicsSvgItem *parent, QString elementId, QString fontName,
|
||||
bool showRect = false)
|
||||
{
|
||||
if (showRect) {
|
||||
// create and display the text rectangle
|
||||
// needs to be done first otherwise the rectangle will blank out the text.
|
||||
createSvgItem(parent, elementId);
|
||||
}
|
||||
QGraphicsTextItem *item = new QGraphicsTextItem();
|
||||
|
||||
QGraphicsTextItem *item = new QGraphicsTextItem();
|
||||
QSvgRenderer *renderer = parent->renderer();
|
||||
|
||||
QSvgRenderer *renderer = parent->renderer();
|
||||
// move new text item to location of rectangle element
|
||||
QMatrix elementMatrix = renderer->matrixForElement(elementId);
|
||||
QRectF elementRect = elementMatrix.mapRect(renderer->boundsOnElement(elementId));
|
||||
|
||||
// move new text item to location of rectangle element
|
||||
QMatrix elementMatrix = renderer->matrixForElement(elementId);
|
||||
QRectF elementRect = elementMatrix.mapRect(renderer->boundsOnElement(elementId));
|
||||
qreal fontPointSizeF = elementRect.height();
|
||||
|
||||
qreal fontPointSizeF = elementRect.height();
|
||||
QTransform matrix;
|
||||
matrix.translate(elementRect.x(), elementRect.y() - (fontPointSizeF / 2.0));
|
||||
|
||||
QTransform matrix;
|
||||
matrix.translate(elementRect.x(), elementRect.y() - (fontPointSizeF / 2.0));
|
||||
item->setParentItem(parent);
|
||||
item->setTransform(matrix, false);
|
||||
// to right align or center text we must provide a text width
|
||||
// item->setTextWidth(elementRect.width());
|
||||
|
||||
item->setParentItem(parent);
|
||||
item->setTransform(matrix, false);
|
||||
// to right align or center text we must provide a text width
|
||||
//item->setTextWidth(elementRect.width());
|
||||
// create font to match the rectangle height
|
||||
// there is not guaranteed that all fonts will play well...
|
||||
QFont font(fontName);
|
||||
// not sure if PreferMatch helps to get the correct font size (i.e. that fits the text rectangle nicely)
|
||||
font.setStyleStrategy(QFont::PreferMatch);
|
||||
font.setPointSizeF(fontPointSizeF);
|
||||
|
||||
// create font to match the rectangle height
|
||||
// there is not guaranteed that all fonts will play well...
|
||||
QFont font(fontName);
|
||||
// not sure if PreferMatch helps to get the correct font size (i.e. that fits the text rectangle nicely)
|
||||
font.setStyleStrategy(QFont::PreferMatch);
|
||||
font.setPointSizeF(fontPointSizeF);
|
||||
|
||||
item->setFont(font);
|
||||
item->setFont(font);
|
||||
|
||||
#ifdef DEBUG_FONT
|
||||
// just in case
|
||||
qDebug() << "Font point size: " << fontPointSizeF;
|
||||
qDebug() << "Font pixel size: " << font.pixelSize();
|
||||
qDebug() << "Font point size: " << font.pointSize();
|
||||
qDebug() << "Font point size F: " << font.pointSizeF();
|
||||
qDebug() << "Font exact match: " << font.exactMatch();
|
||||
// just in case
|
||||
qDebug() << "Font point size: " << fontPointSizeF;
|
||||
qDebug() << "Font pixel size: " << font.pixelSize();
|
||||
qDebug() << "Font point size: " << font.pointSize();
|
||||
qDebug() << "Font point size F: " << font.pointSizeF();
|
||||
qDebug() << "Font exact match: " << font.exactMatch();
|
||||
|
||||
QFontInfo fontInfo(font);
|
||||
qDebug() << "Font info pixel size: " << fontInfo.pixelSize();
|
||||
qDebug() << "Font info point size: " << fontInfo.pointSize();
|
||||
qDebug() << "Font info point size F: " << fontInfo.pointSizeF();
|
||||
qDebug() << "Font info exact match: " << fontInfo.exactMatch();
|
||||
QFontInfo fontInfo(font);
|
||||
qDebug() << "Font info pixel size: " << fontInfo.pixelSize();
|
||||
qDebug() << "Font info point size: " << fontInfo.pointSize();
|
||||
qDebug() << "Font info point size F: " << fontInfo.pointSizeF();
|
||||
qDebug() << "Font info exact match: " << fontInfo.exactMatch();
|
||||
#endif
|
||||
return item;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
MonitorWidget::MonitorWidget(QWidget *parent) :
|
||||
QGraphicsView(parent), aspectRatioMode(Qt::KeepAspectRatio)
|
||||
QGraphicsView(parent), aspectRatioMode(Qt::KeepAspectRatio)
|
||||
{
|
||||
//setMinimumWidth(180);
|
||||
// setMinimumWidth(180);
|
||||
|
||||
QGraphicsScene *scene = new QGraphicsScene();
|
||||
|
||||
setScene(scene);
|
||||
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
|
||||
@ -132,7 +131,7 @@ MonitorWidget::MonitorWidget(QWidget *parent) :
|
||||
// create tx nodes
|
||||
i = 0;
|
||||
while (true) {
|
||||
QString id = QString("tx%0").arg(i);
|
||||
QString id = QString("tx%0").arg(i);
|
||||
QString bgId = QString("tx_bg%0").arg(i);
|
||||
if (!renderer->elementExists(id) || !renderer->elementExists(bgId)) {
|
||||
break;
|
||||
@ -146,7 +145,7 @@ MonitorWidget::MonitorWidget(QWidget *parent) :
|
||||
// create rx nodes
|
||||
i = 0;
|
||||
while (true) {
|
||||
QString id = QString("rx%0").arg(i);
|
||||
QString id = QString("rx%0").arg(i);
|
||||
QString bgId = QString("rx_bg%0").arg(i);
|
||||
if (!renderer->elementExists(id) || !renderer->elementExists(bgId)) {
|
||||
break;
|
||||
@ -170,7 +169,7 @@ MonitorWidget::MonitorWidget(QWidget *parent) :
|
||||
} else {
|
||||
rxSpeed = NULL;
|
||||
}
|
||||
//scene->setSceneRect(graph->boundingRect());
|
||||
// scene->setSceneRect(graph->boundingRect());
|
||||
}
|
||||
|
||||
connected = false;
|
||||
@ -200,14 +199,14 @@ MonitorWidget::~MonitorWidget()
|
||||
/*!
|
||||
\brief Enables/Disables OpenGL
|
||||
*/
|
||||
//void LineardialGadgetWidget::enableOpenGL(bool flag)
|
||||
//{
|
||||
// if (flag) {
|
||||
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||
// } else {
|
||||
// setViewport(new QWidget);
|
||||
// }
|
||||
//}
|
||||
// void LineardialGadgetWidget::enableOpenGL(bool flag)
|
||||
// {
|
||||
// if (flag) {
|
||||
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||
// } else {
|
||||
// setViewport(new QWidget);
|
||||
// }
|
||||
// }
|
||||
|
||||
void MonitorWidget::telemetryConnected()
|
||||
{
|
||||
@ -236,9 +235,9 @@ void MonitorWidget::telemetryDisconnected()
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Called by the UAVObject which got updated
|
||||
\brief Called by the UAVObject which got updated
|
||||
|
||||
Updates the numeric value and/or the icon if the dial wants this.
|
||||
Updates the numeric value and/or the icon if the dial wants this.
|
||||
*/
|
||||
void MonitorWidget::telemetryUpdated(double txRate, double rxRate)
|
||||
{
|
||||
@ -251,7 +250,7 @@ void MonitorWidget::telemetryUpdated(double txRate, double rxRate)
|
||||
|
||||
for (int i = 0; i < txNodes.count(); i++) {
|
||||
QGraphicsItem *node = txNodes.at(i);
|
||||
bool visible = (/*connected &&*/ (i < txIndex));
|
||||
bool visible = ( /*connected &&*/ (i < txIndex));
|
||||
if (visible != node->isVisible()) {
|
||||
node->setVisible(visible);
|
||||
node->update();
|
||||
@ -260,7 +259,7 @@ void MonitorWidget::telemetryUpdated(double txRate, double rxRate)
|
||||
|
||||
for (int i = 0; i < rxNodes.count(); i++) {
|
||||
QGraphicsItem *node = rxNodes.at(i);
|
||||
bool visible = (/*connected &&*/ (i < rxIndex));
|
||||
bool visible = ( /*connected &&*/ (i < rxIndex));
|
||||
if (visible != node->isVisible()) {
|
||||
node->setVisible(visible);
|
||||
node->update();
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
class MonitorWidget: public QGraphicsView {
|
||||
Q_OBJECT
|
||||
class MonitorWidget : public QGraphicsView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MonitorWidget(QWidget *parent = 0);
|
||||
~MonitorWidget();
|
||||
@ -54,8 +54,8 @@ private:
|
||||
QPointer<QGraphicsTextItem> txSpeed;
|
||||
QPointer<QGraphicsTextItem> rxSpeed;
|
||||
|
||||
QList<QGraphicsSvgItem*> txNodes;
|
||||
QList<QGraphicsSvgItem*> rxNodes;
|
||||
QList<QGraphicsSvgItem *> txNodes;
|
||||
QList<QGraphicsSvgItem *> rxNodes;
|
||||
|
||||
Qt::AspectRatioMode aspectRatioMode;
|
||||
};
|
||||
|
@ -43,12 +43,11 @@
|
||||
#include <coreplugin/iuavgadget.h>
|
||||
|
||||
TelemetryPlugin::TelemetryPlugin()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
TelemetryPlugin::~TelemetryPlugin()
|
||||
{
|
||||
// Core::ICore::instance()->saveSettings(this);
|
||||
// Core::ICore::instance()->saveSettings(this);
|
||||
}
|
||||
|
||||
bool TelemetryPlugin::initialize(const QStringList & args, QString *errMsg)
|
||||
@ -59,15 +58,15 @@ bool TelemetryPlugin::initialize(const QStringList & args, QString *errMsg)
|
||||
MonitorGadgetFactory *mf = new MonitorGadgetFactory(this);
|
||||
addAutoReleasedObject(mf);
|
||||
|
||||
// mop = new TelemetryPluginOptionsPage(this);
|
||||
//addAutoReleasedObject(mop);
|
||||
// mop = new TelemetryPluginOptionsPage(this);
|
||||
// addAutoReleasedObject(mop);
|
||||
|
||||
// TODO not so good... g is probalby leaked...
|
||||
MonitorWidget *w = mf->createMonitorWidget(NULL);
|
||||
w->setMaximumWidth(180);
|
||||
|
||||
//
|
||||
//setAlignment(Qt::AlignCenter);
|
||||
// setAlignment(Qt::AlignCenter);
|
||||
|
||||
// no border
|
||||
w->setFrameStyle(QFrame::NoFrame);
|
||||
@ -82,8 +81,8 @@ bool TelemetryPlugin::initialize(const QStringList & args, QString *errMsg)
|
||||
|
||||
// add monitor widget to connection manager
|
||||
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
|
||||
// connect(cm, SIGNAL(deviceConnected(QIODevice *)), w, SLOT(telemetryConnected()));
|
||||
// connect(cm, SIGNAL(deviceDisconnected()), w, SLOT(telemetryDisconnected()));
|
||||
// connect(cm, SIGNAL(deviceConnected(QIODevice *)), w, SLOT(telemetryConnected()));
|
||||
// connect(cm, SIGNAL(deviceDisconnected()), w, SLOT(telemetryDisconnected()));
|
||||
|
||||
cm->addWidget(w);
|
||||
|
||||
@ -92,156 +91,156 @@ bool TelemetryPlugin::initialize(const QStringList & args, QString *errMsg)
|
||||
|
||||
void TelemetryPlugin::extensionsInitialized()
|
||||
{
|
||||
// Core::ICore::instance()->readSettings(this);
|
||||
// Core::ICore::instance()->readSettings(this);
|
||||
|
||||
//ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
|
||||
// connect(pm, SIGNAL(objectAdded(QObject *)), this, SLOT(onTelemetryManagerAdded(QObject *)));
|
||||
// _toRemoveNotifications.clear();
|
||||
// connectNotifications();
|
||||
// connect(pm, SIGNAL(objectAdded(QObject *)), this, SLOT(onTelemetryManagerAdded(QObject *)));
|
||||
// _toRemoveNotifications.clear();
|
||||
// connectNotifications();
|
||||
}
|
||||
|
||||
//void TelemetryPlugin::saveConfig(QSettings *settings, UAVConfigInfo *configInfo)
|
||||
//{
|
||||
// configInfo->setVersion(VERSION);
|
||||
// void TelemetryPlugin::saveConfig(QSettings *settings, UAVConfigInfo *configInfo)
|
||||
// {
|
||||
// configInfo->setVersion(VERSION);
|
||||
//
|
||||
// settings->beginWriteArray("Current");
|
||||
// settings->setArrayIndex(0);
|
||||
// currentNotification.saveState(settings);
|
||||
// settings->endArray();
|
||||
// settings->beginWriteArray("Current");
|
||||
// settings->setArrayIndex(0);
|
||||
// currentNotification.saveState(settings);
|
||||
// settings->endArray();
|
||||
//
|
||||
// settings->beginGroup("listNotifies");
|
||||
// settings->remove("");
|
||||
// settings->endGroup();
|
||||
// settings->beginGroup("listNotifies");
|
||||
// settings->remove("");
|
||||
// settings->endGroup();
|
||||
//
|
||||
// settings->beginWriteArray("listNotifies");
|
||||
// for (int i = 0; i < _notificationList.size(); i++) {
|
||||
// settings->setArrayIndex(i);
|
||||
// _notificationList.at(i)->saveState(settings);
|
||||
// }
|
||||
// settings->endArray();
|
||||
// settings->setValue(QLatin1String("Enable"), enable);
|
||||
//}
|
||||
// settings->beginWriteArray("listNotifies");
|
||||
// for (int i = 0; i < _notificationList.size(); i++) {
|
||||
// settings->setArrayIndex(i);
|
||||
// _notificationList.at(i)->saveState(settings);
|
||||
// }
|
||||
// settings->endArray();
|
||||
// settings->setValue(QLatin1String("Enable"), enable);
|
||||
// }
|
||||
|
||||
//void TelemetryPlugin::readConfig(QSettings *settings, UAVConfigInfo * /* configInfo */)
|
||||
//{
|
||||
// // Just for migration to the new format.
|
||||
// // Q_ASSERT(configInfo->version() == UAVConfigVersion());
|
||||
// void TelemetryPlugin::readConfig(QSettings *settings, UAVConfigInfo * /* configInfo */)
|
||||
// {
|
||||
//// Just for migration to the new format.
|
||||
//// Q_ASSERT(configInfo->version() == UAVConfigVersion());
|
||||
//
|
||||
// settings->beginReadArray("Current");
|
||||
// settings->setArrayIndex(0);
|
||||
// currentNotification.restoreState(settings);
|
||||
// settings->endArray();
|
||||
// settings->beginReadArray("Current");
|
||||
// settings->setArrayIndex(0);
|
||||
// currentNotification.restoreState(settings);
|
||||
// settings->endArray();
|
||||
//
|
||||
// // read list of notifications from settings
|
||||
// int size = settings->beginReadArray("listNotifies");
|
||||
// for (int i = 0; i < size; ++i) {
|
||||
// settings->setArrayIndex(i);
|
||||
// NotificationItem *notification = new NotificationItem;
|
||||
// notification->restoreState(settings);
|
||||
// _notificationList.append(notification);
|
||||
// }
|
||||
// settings->endArray();
|
||||
// setEnable(settings->value(QLatin1String("Enable"), 0).toBool());
|
||||
//}
|
||||
//// read list of notifications from settings
|
||||
// int size = settings->beginReadArray("listNotifies");
|
||||
// for (int i = 0; i < size; ++i) {
|
||||
// settings->setArrayIndex(i);
|
||||
// NotificationItem *notification = new NotificationItem;
|
||||
// notification->restoreState(settings);
|
||||
// _notificationList.append(notification);
|
||||
// }
|
||||
// settings->endArray();
|
||||
// setEnable(settings->value(QLatin1String("Enable"), 0).toBool());
|
||||
// }
|
||||
|
||||
//void TelemetryPlugin::onTelemetryManagerAdded(QObject *obj)
|
||||
//{
|
||||
// telMngr = qobject_cast<TelemetryManager *>(obj);
|
||||
// if (telMngr) {
|
||||
// connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
// }
|
||||
//}
|
||||
// void TelemetryPlugin::onTelemetryManagerAdded(QObject *obj)
|
||||
// {
|
||||
// telMngr = qobject_cast<TelemetryManager *>(obj);
|
||||
// if (telMngr) {
|
||||
// connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
// }
|
||||
// }
|
||||
|
||||
void TelemetryPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
//void TelemetryPlugin::onAutopilotDisconnect()
|
||||
//{
|
||||
// connectNotifications();
|
||||
//}
|
||||
// void TelemetryPlugin::onAutopilotDisconnect()
|
||||
// {
|
||||
// connectNotifications();
|
||||
// }
|
||||
|
||||
///*!
|
||||
// clear any telemetry timers from previous flight;
|
||||
// reset will be perform on start of option page
|
||||
// clear any telemetry timers from previous flight;
|
||||
// reset will be perform on start of option page
|
||||
// */
|
||||
//void TelemetryPlugin::resetNotification(void)
|
||||
//{
|
||||
// // first, reject empty args and unknown fields.
|
||||
// foreach(NotificationItem * ntf, _notificationList) {
|
||||
// ntf->disposeTimer();
|
||||
// disconnect(ntf->getTimer(), SIGNAL(timeout()), this, SLOT(on_timerRepeated_Notification()));
|
||||
// ntf->disposeExpireTimer();
|
||||
// disconnect(ntf->getExpireTimer(), SIGNAL(timeout()), this, SLOT(on_timerRepeated_Notification()));
|
||||
// }
|
||||
//}
|
||||
// void TelemetryPlugin::resetNotification(void)
|
||||
// {
|
||||
//// first, reject empty args and unknown fields.
|
||||
// foreach(NotificationItem * ntf, _notificationList) {
|
||||
// ntf->disposeTimer();
|
||||
// disconnect(ntf->getTimer(), SIGNAL(timeout()), this, SLOT(on_timerRepeated_Notification()));
|
||||
// ntf->disposeExpireTimer();
|
||||
// disconnect(ntf->getExpireTimer(), SIGNAL(timeout()), this, SLOT(on_timerRepeated_Notification()));
|
||||
// }
|
||||
// }
|
||||
|
||||
//void TelemetryPlugin::connectNotifications()
|
||||
//{
|
||||
// foreach(UAVDataObject * obj, lstNotifiedUAVObjects) {
|
||||
// if (obj != NULL) {
|
||||
// disconnect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(on_arrived_Notification(UAVObject *)));
|
||||
// }
|
||||
// }
|
||||
// if (phonon.mo != NULL) {
|
||||
// delete phonon.mo;
|
||||
// phonon.mo = NULL;
|
||||
// }
|
||||
// void TelemetryPlugin::connectNotifications()
|
||||
// {
|
||||
// foreach(UAVDataObject * obj, lstNotifiedUAVObjects) {
|
||||
// if (obj != NULL) {
|
||||
// disconnect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(on_arrived_Notification(UAVObject *)));
|
||||
// }
|
||||
// }
|
||||
// if (phonon.mo != NULL) {
|
||||
// delete phonon.mo;
|
||||
// phonon.mo = NULL;
|
||||
// }
|
||||
//
|
||||
// if (!enable) {
|
||||
// return;
|
||||
// }
|
||||
// if (!enable) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
// UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
// UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
//
|
||||
// lstNotifiedUAVObjects.clear();
|
||||
// _pendingNotifications.clear();
|
||||
// _notificationList.append(_toRemoveNotifications);
|
||||
// _toRemoveNotifications.clear();
|
||||
// lstNotifiedUAVObjects.clear();
|
||||
// _pendingNotifications.clear();
|
||||
// _notificationList.append(_toRemoveNotifications);
|
||||
// _toRemoveNotifications.clear();
|
||||
//
|
||||
// // first, reject empty args and unknown fields.
|
||||
// foreach(NotificationItem * telemetry, _notificationList) {
|
||||
// telemetry->_isPlayed = false;
|
||||
// telemetry->isNowPlaying = false;
|
||||
//// first, reject empty args and unknown fields.
|
||||
// foreach(NotificationItem * telemetry, _notificationList) {
|
||||
// telemetry->_isPlayed = false;
|
||||
// telemetry->isNowPlaying = false;
|
||||
//
|
||||
// if (telemetry->mute()) {
|
||||
// continue;
|
||||
// }
|
||||
// // check is all sounds presented for notification,
|
||||
// // if not - we must not subscribe to it at all
|
||||
// if (telemetry->toList().isEmpty()) {
|
||||
// continue;
|
||||
// }
|
||||
// if (telemetry->mute()) {
|
||||
// continue;
|
||||
// }
|
||||
//// check is all sounds presented for notification,
|
||||
//// if not - we must not subscribe to it at all
|
||||
// if (telemetry->toList().isEmpty()) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject(telemetry->getDataObject()));
|
||||
// if (obj != NULL) {
|
||||
// if (!lstNotifiedUAVObjects.contains(obj)) {
|
||||
// lstNotifiedUAVObjects.append(obj);
|
||||
// UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject(telemetry->getDataObject()));
|
||||
// if (obj != NULL) {
|
||||
// if (!lstNotifiedUAVObjects.contains(obj)) {
|
||||
// lstNotifiedUAVObjects.append(obj);
|
||||
//
|
||||
// connect(obj, SIGNAL(objectUpdated(UAVObject *)),
|
||||
// this, SLOT(on_arrived_Notification(UAVObject *)),
|
||||
// Qt::QueuedConnection);
|
||||
// }
|
||||
// } else {
|
||||
// qTelemetryDebug() << "Error: Object is unknown (" << telemetry->getDataObject() << ").";
|
||||
// }
|
||||
// }
|
||||
// connect(obj, SIGNAL(objectUpdated(UAVObject *)),
|
||||
// this, SLOT(on_arrived_Notification(UAVObject *)),
|
||||
// Qt::QueuedConnection);
|
||||
// }
|
||||
// } else {
|
||||
// qTelemetryDebug() << "Error: Object is unknown (" << telemetry->getDataObject() << ").";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (_notificationList.isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
// // set notification message to current event
|
||||
// phonon.mo = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
// phonon.mo->clearQueue();
|
||||
// phonon.firstPlay = true;
|
||||
// QList<Phonon::AudioOutputDevice> audioOutputDevices =
|
||||
// Phonon::BackendCapabilities::availableAudioOutputDevices();
|
||||
// foreach(Phonon::AudioOutputDevice dev, audioOutputDevices) {
|
||||
// qTelemetryDebug() << "Telemetry: Audio Output device: " << dev.name() << " - " << dev.description();
|
||||
// }
|
||||
// connect(phonon.mo, SIGNAL(stateChanged(Phonon::State, Phonon::State)),
|
||||
// this, SLOT(stateChanged(Phonon::State, Phonon::State)));
|
||||
//}
|
||||
// if (_notificationList.isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
//// set notification message to current event
|
||||
// phonon.mo = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
// phonon.mo->clearQueue();
|
||||
// phonon.firstPlay = true;
|
||||
// QList<Phonon::AudioOutputDevice> audioOutputDevices =
|
||||
// Phonon::BackendCapabilities::availableAudioOutputDevices();
|
||||
// foreach(Phonon::AudioOutputDevice dev, audioOutputDevices) {
|
||||
// qTelemetryDebug() << "Telemetry: Audio Output device: " << dev.name() << " - " << dev.description();
|
||||
// }
|
||||
// connect(phonon.mo, SIGNAL(stateChanged(Phonon::State, Phonon::State)),
|
||||
// this, SLOT(stateChanged(Phonon::State, Phonon::State)));
|
||||
// }
|
||||
|
@ -33,7 +33,7 @@ class MonitorGadgetFactory;
|
||||
|
||||
class TelemetryPlugin : public ExtensionSystem::IPlugin {
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "OpenPilot.Telemetry")
|
||||
Q_PLUGIN_METADATA(IID "OpenPilot.Telemetry")
|
||||
|
||||
|
||||
public:
|
||||
|
@ -114,7 +114,8 @@ public:
|
||||
QWidget *createEditor(QWidget *parent)
|
||||
{
|
||||
QComboBox *editor = new QComboBox(parent);
|
||||
// Setting ClickFocus lets the ComboBox stay open on Mac OSX.
|
||||
|
||||
// Setting ClickFocus lets the ComboBox stay open on Mac OSX.
|
||||
editor->setFocusPolicy(Qt::ClickFocus);
|
||||
foreach(QString option, m_enumOptions)
|
||||
editor->addItem(option);
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <coreplugin/threadmanager.h>
|
||||
|
||||
TelemetryManager::TelemetryManager() :
|
||||
autopilotConnected(false)
|
||||
autopilotConnected(false)
|
||||
{
|
||||
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
|
||||
// Get UAVObjectManager instance
|
||||
@ -44,8 +44,7 @@ TelemetryManager::TelemetryManager() :
|
||||
}
|
||||
|
||||
TelemetryManager::~TelemetryManager()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool TelemetryManager::isConnected()
|
||||
{
|
||||
@ -60,8 +59,8 @@ void TelemetryManager::start(QIODevice *dev)
|
||||
|
||||
void TelemetryManager::onStart()
|
||||
{
|
||||
utalk = new UAVTalk(device, objMngr);
|
||||
telemetry = new Telemetry(utalk, objMngr);
|
||||
utalk = new UAVTalk(device, objMngr);
|
||||
telemetry = new Telemetry(utalk, objMngr);
|
||||
telemetryMon = new TelemetryMonitor(objMngr, telemetry);
|
||||
connect(telemetryMon, SIGNAL(connected()), this, SLOT(onConnect()));
|
||||
connect(telemetryMon, SIGNAL(disconnected()), this, SLOT(onDisconnect()));
|
||||
|
@ -232,7 +232,7 @@ void TelemetryMonitor::processStatsUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
emit telemetryUpdated((double) gcsStats.TxDataRate, (double) gcsStats.RxDataRate);
|
||||
emit telemetryUpdated((double)gcsStats.TxDataRate, (double)gcsStats.RxDataRate);
|
||||
|
||||
// Set data
|
||||
gcsStatsObj->setData(gcsStats);
|
||||
|
Loading…
x
Reference in New Issue
Block a user