From b627b71d0ec3a826531463f4537fa00b2897b80f Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 2 Dec 2013 23:47:27 +0100 Subject: [PATCH] uncrustification --- .../plugins/coreplugin/connectionmanager.cpp | 4 +- .../plugins/coreplugin/connectionmanager.h | 1 - .../plugins/coreplugin/workspacesettings.cpp | 8 +- .../src/plugins/telemetry/monitorgadget.cpp | 17 +- .../src/plugins/telemetry/monitorgadget.h | 8 +- .../telemetry/monitorgadgetconfiguration.cpp | 9 +- .../telemetry/monitorgadgetfactory.cpp | 8 +- .../plugins/telemetry/monitorgadgetfactory.h | 8 +- .../telemetry/monitorgadgetoptionspage.cpp | 95 +++---- .../src/plugins/telemetry/monitorwidget.cpp | 173 ++++++------ .../src/plugins/telemetry/monitorwidget.h | 8 +- .../src/plugins/telemetry/telemetryplugin.cpp | 263 +++++++++--------- .../src/plugins/telemetry/telemetryplugin.h | 2 +- .../plugins/uavobjectbrowser/fieldtreeitem.h | 3 +- .../src/plugins/uavtalk/telemetrymanager.cpp | 9 +- .../src/plugins/uavtalk/telemetrymonitor.cpp | 2 +- 16 files changed, 303 insertions(+), 315 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp index 02e3a3302..b8f2714c6 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp @@ -40,7 +40,6 @@ #include 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); } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h index 0d9a3b24b..0d72cb71d 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h @@ -43,7 +43,6 @@ #include namespace Core { - class IConnection; namespace Internal { diff --git a/ground/openpilotgcs/src/plugins/coreplugin/workspacesettings.cpp b/ground/openpilotgcs/src/plugins/coreplugin/workspacesettings.cpp index 345d53039..6ffaa4a0b 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/workspacesettings.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/workspacesettings.cpp @@ -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 diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp index b8adfba17..e23591da2 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp @@ -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(config); + // MonitorGadgetConfiguration *m = qobject_cast(config); - //m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint + // m_widget->setSystemFile(m->getSystemFile()); // Triggers widget repaint } diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.h b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.h index 90f9dcb74..e85c15ade 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.h +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.h @@ -31,14 +31,14 @@ #include #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); diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp index 9c15744a8..6a69905af 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp @@ -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); } diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp index 6506ce521..94faf597a 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp @@ -35,13 +35,11 @@ #include 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) { diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.h b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.h index f1663156b..0b44e8b53 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.h +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.h @@ -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(); diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp index fcd4bd37f..6601efd54 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp @@ -27,81 +27,78 @@ #include "monitorgadgetoptionspage.h" #include -//#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)), -// _owner, SLOT(updateNotificationList(QList))); -// // connect(this, SIGNAL(resetNotification()),owner, SLOT(resetNotification())); +// connect(this, SIGNAL(updateNotifications(QList)), +// _owner, SLOT(updateNotificationList(QList))); +//// 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(); +// } } - diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.cpp index c75e301c2..722869652 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.cpp @@ -7,102 +7,101 @@ #include 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(); diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.h b/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.h index 380cd3b00..729d25775 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.h +++ b/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.h @@ -8,8 +8,8 @@ #include #include -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 txSpeed; QPointer rxSpeed; - QList txNodes; - QList rxNodes; + QList txNodes; + QList rxNodes; Qt::AspectRatioMode aspectRatioMode; }; diff --git a/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.cpp b/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.cpp index 8a4991e95..4a68a2734 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.cpp +++ b/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.cpp @@ -43,12 +43,11 @@ #include 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(obj); -// if (telMngr) { -// connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect())); -// } -//} +// void TelemetryPlugin::onTelemetryManagerAdded(QObject *obj) +// { +// telMngr = qobject_cast(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(); +// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); +// UAVObjectManager *objManager = pm->getObject(); // -// 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(objManager->getObject(telemetry->getDataObject())); -// if (obj != NULL) { -// if (!lstNotifiedUAVObjects.contains(obj)) { -// lstNotifiedUAVObjects.append(obj); +// UAVDataObject *obj = dynamic_cast(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 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 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))); +// } diff --git a/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.h b/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.h index 86cffe320..300c08ad7 100644 --- a/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.h +++ b/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.h @@ -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: diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h index 2876c6f0f..31cf9ecb3 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h @@ -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); diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp index c38566db8..3eeb7e5a8 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp @@ -31,7 +31,7 @@ #include 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())); diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp index 0c8f94a38..8342d5001 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp @@ -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);