nonEditorFileFactories = getNonEditorFileFactories();
-
- foreach (const QString &fileName, fileNames) {
- const QFileInfo fi(fileName);
- const QString absoluteFilePath = fi.absoluteFilePath();
- if (IFileFactory *fileFactory = findFileFactory(nonEditorFileFactories, mimeDatabase(), fi)) {
- fileFactory->open(absoluteFilePath);
- } else {
-
- }
- }
- }*/
-
void MainWindow::setFocusToEditor()
{}
@@ -1401,43 +1363,24 @@ void MainWindow::openRecentFile()
if (!fileName.isEmpty()) {}
}
-void MainWindow::aboutOpenPilotGCS()
+void MainWindow::showAboutDialog()
{
- if (!m_versionDialog) {
- m_versionDialog = new VersionDialog(this);
- connect(m_versionDialog, SIGNAL(finished(int)),
- this, SLOT(destroyVersionDialog()));
+ if (!m_aboutDialog) {
+ m_aboutDialog = new AboutDialog(this);
+ connect(m_aboutDialog, SIGNAL(finished(int)),
+ this, SLOT(destroyAboutDialog()));
}
- m_versionDialog->show();
+ m_aboutDialog->show();
}
-void MainWindow::destroyVersionDialog()
+void MainWindow::destroyAboutDialog()
{
- if (m_versionDialog) {
- m_versionDialog->deleteLater();
- m_versionDialog = 0;
+ if (m_aboutDialog) {
+ m_aboutDialog->deleteLater();
+ m_aboutDialog = 0;
}
}
-void MainWindow::aboutOpenPilotAuthors()
-{
- if (!m_authorsDialog) {
- m_authorsDialog = new AuthorsDialog(this);
- connect(m_authorsDialog, SIGNAL(finished(int)),
- this, SLOT(destroyAuthorsDialog()));
- }
- m_authorsDialog->show();
-}
-
-void MainWindow::destroyAuthorsDialog()
-{
- if (m_authorsDialog) {
- m_authorsDialog->deleteLater();
- m_authorsDialog = 0;
- }
-}
-
-
void MainWindow::aboutPlugins()
{
PluginDialog dialog(this);
@@ -1453,12 +1396,8 @@ void MainWindow::setFullScreen(bool on)
if (on) {
setWindowState(windowState() | Qt::WindowFullScreen);
- // statusBar()->hide();
- // menuBar()->hide();
} else {
setWindowState(windowState() & ~Qt::WindowFullScreen);
- // menuBar()->show();
- // statusBar()->show();
}
}
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h
index a1aa1f508..c19903424 100644
--- a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h
+++ b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h
@@ -43,6 +43,8 @@ class QToolButton;
class MyTabWidget;
QT_END_NAMESPACE
+class AboutDialog;
+
namespace Core {
class ActionManager;
class BaseMode;
@@ -72,8 +74,6 @@ class FancyTabWidget;
class GeneralSettings;
class ShortcutSettings;
class WorkspaceSettings;
-class VersionDialog;
-class AuthorsDialog;
class CORE_EXPORT MainWindow : public EventFilteringMainWindow {
Q_OBJECT
@@ -154,12 +154,10 @@ private slots:
void openRecentFile();
void setFocusToEditor();
void saveAll();
- void aboutOpenPilotGCS();
+ void showAboutDialog();
+ void destroyAboutDialog();
void aboutPlugins();
- void aboutOpenPilotAuthors();
void updateFocusWidget(QWidget *old, QWidget *now);
- void destroyVersionDialog();
- void destroyAuthorsDialog();
void modeChanged(Core::IMode *mode);
void showUavGadgetMenus(bool show, bool hasSplitter);
void applyTabBarSettings(QTabWidget::TabPosition pos, bool movable);
@@ -191,8 +189,7 @@ private:
MimeDatabase *m_mimeDatabase;
MyTabWidget *m_modeStack;
Core::BaseView *m_outputView;
- VersionDialog *m_versionDialog;
- AuthorsDialog *m_authorsDialog;
+ AboutDialog *m_aboutDialog;
IContext *m_activeContext;
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml
index 9e1d64f20..bd3d9c9e6 100644
--- a/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml
+++ b/ground/openpilotgcs/src/plugins/coreplugin/qml/AboutDialog.qml
@@ -1,110 +1,140 @@
- /****************************************************************************
- **
- ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
- ** All rights reserved.
- ** Contact: Nokia Corporation (qt-info@nokia.com)
- **
- ** This file is part of the examples of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:BSD$
- ** You may use this file under the terms of the BSD license as follows:
- **
- ** "Redistribution and use in source and binary forms, with or without
- ** modification, are permitted provided that the following conditions are
- ** met:
- ** * Redistributions of source code must retain the above copyright
- ** notice, this list of conditions and the following disclaimer.
- ** * Redistributions in binary form must reproduce the above copyright
- ** notice, this list of conditions and the following disclaimer in
- ** the documentation and/or other materials provided with the
- ** distribution.
- ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
- ** the names of its contributors may be used to endorse or promote
- ** products derived from this software without specific prior written
- ** permission.
- **
- ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
+/**
+ ******************************************************************************
+ *
+ * @file aboutdialog.qml
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013.
+ *
+ *****************************************************************************/
+/*
+ * 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
+ */
+import QtQuick 2.1
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 1.0
- import QtQuick 1.1
-
- // This is a tabbed pane element. Add a nested Rectangle to add a tab.
- TabWidget {
- // Define AuthorsModel as type
- property AuthorsModel authors: AuthorsModel {}
-
- id: tabs
- width: 640; height: 480
- // This tab is for the GCS version information
- Rectangle {
- property string title: "OpenPilot GCS"
- anchors.fill: parent
- color: "#e3e3e3"
-
- Rectangle {
- anchors.fill: parent; anchors.margins: 20
- color: "#e3e3e3"
- Image {
- source: "../images/openpilot_logo_128.png"
- x: 0; y: 0; z: 100
- fillMode: Image.PreserveAspectFit
- }
- Flickable {
- anchors.fill: parent
- anchors.centerIn: parent
- Text {
- id: versionLabel
- x: 156; y: 0
- width: 430; height: 379
- horizontalAlignment: Qt.AlignLeft
- font.pixelSize: 12
- wrapMode: Text.WordWrap
- // @var version exposed in authorsdialog.cpp
- text: version
- }
+Rectangle {
+ id: container
+ width: 600
+ height: 400
+
+ property AuthorsModel authors: AuthorsModel {}
+
+ ColumnLayout {
+ id: columnLayout1
+ anchors.fill: parent
+ spacing: 10
+ RowLayout {
+ id: rowLayout1
+ opacity: 1
+ Image {
+ id: logo
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+ anchors.top: parent.top
+ anchors.topMargin: 10
+ source: "../images/openpilot_logo_128.png"
+ z: 100
+ fillMode: Image.PreserveAspectFit
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ onClicked: {
+ dialog.openUrl("http://www.openpilot.org")
+ }
+ }
+ }
+
+ Rectangle {
+ anchors.left: logo.right
+ anchors.margins: 10
+ anchors.right: parent.right
+ anchors.top: parent.top
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ anchors.bottom: parent.bottom
+ color: "transparent"
+
+ ColumnLayout {
+ anchors.fill: parent
+ Text {
+ id: headerLabel
+ text: qsTr("OpenPilot Ground Control Station")
+ Layout.fillWidth: true
+ font.pixelSize: 14
+ font.bold: true
+
+ }
+ Text {
+ id: versionLabel
+ Layout.fillWidth: true
+ font.pixelSize: 12
+ wrapMode: Text.WordWrap
+ text: version
+ }
+ Text {
+ id: licenseLabel
+ Layout.fillWidth: true
+ font.pixelSize: 9
+ wrapMode: Text.WordWrap
+ text: qsTr("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.\n" +
+ "The program is provided AS IS with NO WARRANTY OF ANY KIND, " +
+ "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.")
+ }
+
+ Text {
+ id: contributorLabel
+ text: qsTr("Contributors")
+ Layout.fillWidth: true
+ font.pixelSize: 14
+ font.bold: true
+
+ }
+ ScrollView {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ frameVisible: true
+ ListView {
+ id: authorsView
+ anchors.fill: parent
+
+ spacing: 3
+ model: authors
+ delegate: Text {
+ font.pixelSize: 12
+ text: name
+ }
+ clip: true
+ }
+ }
}
}
}
- // This tab is for the authors/contributors/credits
- Rectangle {
- property string title: "Contributors"
- anchors.fill: parent; color: "#e3e3e3"
- Rectangle {
- anchors.fill: parent; anchors.margins: 20
- color: "#e3e3e3"
- Text {
- id: description
- text: "These people have been key contributors to the OpenPilot project. Without the work of the people in this list, OpenPilot would not be what it is today. This list is sorted alphabetically by name
"
- width: 600
- wrapMode: Text.WordWrap
-
- }
- ListView {
- id: authorsView
- y: description.y + description.height + 20
- width: parent.width; height: parent.height - description.height - 20
- spacing: 3
- model: authors
- delegate: Text {
- text: name
- }
- clip: true
- }
- ScrollDecorator {
- flickableItem: authorsView
- }
- }
- }
+ Button {
+ id: button
+ text: qsTr("Ok")
+ activeFocusOnPress: true
+ anchors.right: parent.right
+ anchors.rightMargin: 10
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 10
+ onClicked: dialog.close()
+ }
+ }
}
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml.template b/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml.template
index 63d7e45cc..8bbabc0ab 100644
--- a/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml.template
+++ b/ground/openpilotgcs/src/plugins/coreplugin/qml/AuthorsModel.qml.template
@@ -1,7 +1,7 @@
/*
This list model was created for the AuthorsDialog.
*/
-import QtQuick 1.1
+import QtQuick 2.0
ListModel {
${LIST_ELEMENTS}
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml
deleted file mode 100644
index 24c79c927..000000000
--- a/ground/openpilotgcs/src/plugins/coreplugin/qml/ScrollDecorator.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-import QtQuick 1.1
-
-Rectangle {
- id: scrollDecorator
-
- property Flickable flickableItem: null
-
- Loader {
- id: scrollLoader
- sourceComponent: scrollDecorator.flickableItem ? scrollBar : undefined
- }
-
- Component.onDestruction: scrollLoader.sourceComponent = undefined
-
- Component {
- id: scrollBar
- Rectangle {
- property Flickable flickable: scrollDecorator.flickableItem
-
- parent: flickable
- anchors.right: parent.right
-
- smooth: true
- radius: 2
- color: "gray"
- border.color: "lightgray"
- border.width: 1.0
- opacity: flickable.moving ? 0.8 : 0.4
-
- Behavior on opacity {
- NumberAnimation { duration: 500 }
- }
-
- width: 4
- height: flickable.height * (flickable.height / flickable.contentHeight)
- y: flickable.height * (flickable.contentY / flickable.contentHeight)
- visible: flickable.height < flickable.contentHeight
- }
- }
-}
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/qml/TabWidget.qml b/ground/openpilotgcs/src/plugins/coreplugin/qml/TabWidget.qml
deleted file mode 100644
index b6ce6bd41..000000000
--- a/ground/openpilotgcs/src/plugins/coreplugin/qml/TabWidget.qml
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.1
-
-Item {
- id: tabWidget
-
- // Setting the default property to stack.children means any child items
- // of the TabWidget are actually added to the 'stack' item's children.
- // See the "Property Binding"
- // documentation for details on default properties.
- default property alias content: stack.children
-
- property int current: 0
-
- onCurrentChanged: setOpacities()
- Component.onCompleted: setOpacities()
-
- function setOpacities() {
- for (var i = 0; i < stack.children.length; ++i) {
- stack.children[i].opacity = (i == current ? 1 : 0)
- }
- }
-
- Row {
- id: header
-
- Repeater {
- model: stack.children.length
- delegate: Rectangle {
- width: tabWidget.width / stack.children.length; height: 36
-
- Rectangle {
- width: parent.width; height: 1
- anchors { bottom: parent.bottom; bottomMargin: 1 }
- color: "#acb2c2"
- }
- BorderImage {
- anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 }
- border { left: 7; right: 7 }
- source: "images/tab.png"
- visible: tabWidget.current == index
- }
- Text {
- horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter
- anchors.fill: parent
- text: stack.children[index].title
- elide: Text.ElideRight
- font.bold: tabWidget.current == index
- }
- MouseArea {
- anchors.fill: parent
- onClicked: tabWidget.current = index
- }
- }
- }
- }
-
- Item {
- id: stack
- width: tabWidget.width
- anchors.top: header.bottom; anchors.bottom: tabWidget.bottom
- }
-}
\ No newline at end of file
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/telemetrymonitorwidget.cpp b/ground/openpilotgcs/src/plugins/coreplugin/telemetrymonitorwidget.cpp
deleted file mode 100644
index 1307bbb4e..000000000
--- a/ground/openpilotgcs/src/plugins/coreplugin/telemetrymonitorwidget.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-#include "telemetrymonitorwidget.h"
-
-#include
-#include
-#include
-#include
-
-TelemetryMonitorWidget::TelemetryMonitorWidget(QWidget *parent) : QGraphicsView(parent)
-{
- setMinimumSize(180, 25); // From 100->25 to shorten the qwidget.
- setMaximumSize(180, 25); // as above.
- setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setAlignment(Qt::AlignCenter);
- setFrameStyle(QFrame::NoFrame);
- setStyleSheet("background:transparent;");
- setAttribute(Qt::WA_TranslucentBackground);
- setWindowFlags(Qt::FramelessWindowHint);
-
- QGraphicsScene *scene = new QGraphicsScene(0, 0, 180, 25, this); // keeping the scene in line with the widget for testing.
-
- QSvgRenderer *renderer = new QSvgRenderer();
- if (renderer->load(QString(":/core/images/tx-rx.svg"))) {
- graph = new QGraphicsSvgItem();
- graph->setSharedRenderer(renderer);
- graph->setElementId("txrxBackground");
-
- QString name;
- QGraphicsSvgItem *pt;
-
- for (int i = 0; i < NODE_NUMELEM; i++) {
- name = QString("tx%0").arg(i);
- if (renderer->elementExists(name)) {
- pt = new QGraphicsSvgItem();
- pt->setSharedRenderer(renderer);
- pt->setElementId(name);
- pt->setParentItem(graph);
- txNodes.append(pt);
- }
-
- name = QString("rx%0").arg(i);
- if (renderer->elementExists(name)) {
- pt = new QGraphicsSvgItem();
- pt->setSharedRenderer(renderer);
- pt->setElementId(name);
- pt->setParentItem(graph);
- rxNodes.append(pt);
- }
- }
-
- scene->addItem(graph);
-
- txSpeed = new QGraphicsTextItem();
- txSpeed->setDefaultTextColor(Qt::white);
- txSpeed->setFont(QFont("Helvetica", 22, 2));
- txSpeed->setParentItem(graph);
- scene->addItem(txSpeed);
-
- rxSpeed = new QGraphicsTextItem();
- rxSpeed->setDefaultTextColor(Qt::white);
- rxSpeed->setFont(QFont("Helvetica", 22, 2));
- rxSpeed->setParentItem(graph);
- scene->addItem(rxSpeed);
-
- scene->setSceneRect(graph->boundingRect());
- setScene(scene);
- }
-
- connected = false;
- txValue = 0.0;
- rxValue = 0.0;
-
- setMin(0.0);
- setMax(1200.0);
-
- showTelemetry();
-}
-
-TelemetryMonitorWidget::~TelemetryMonitorWidget()
-{
- while (!txNodes.isEmpty()) {
- delete txNodes.takeFirst();
- }
-
- while (!rxNodes.isEmpty()) {
- delete rxNodes.takeFirst();
- }
-}
-
-void TelemetryMonitorWidget::connect()
-{
- connected = true;
-
- // flash the lights
- updateTelemetry(maxValue, maxValue);
-}
-
-void TelemetryMonitorWidget::disconnect()
-{
- // flash the lights
- updateTelemetry(maxValue, maxValue);
-
- connected = false;
- updateTelemetry(0.0, 0.0);
-}
-/*!
- \brief Called by the UAVObject which got updated
-
- Updates the numeric value and/or the icon if the dial wants this.
- */
-void TelemetryMonitorWidget::updateTelemetry(double txRate, double rxRate)
-{
- txValue = txRate;
- rxValue = rxRate;
-
- showTelemetry();
-}
-
-// Converts the value into an percentage:
-// this enables smooth movement in moveIndex below
-void TelemetryMonitorWidget::showTelemetry()
-{
- txIndex = (txValue - minValue) / (maxValue - minValue) * NODE_NUMELEM;
- rxIndex = (rxValue - minValue) / (maxValue - minValue) * NODE_NUMELEM;
-
- if (connected) {
- this->setToolTip(QString("Tx: %0 bytes/sec\nRx: %1 bytes/sec").arg(txValue).arg(rxValue));
- } else {
- this->setToolTip(QString("Disconnected"));
- }
-
- int i;
- int nodeMargin = 8;
- int leftMargin = 60;
- QGraphicsItem *node;
-
- for (i = 0; i < txNodes.count(); i++) {
- node = txNodes.at(i);
- node->setPos((i * (node->boundingRect().width() + nodeMargin)) + leftMargin, (node->boundingRect().height() / 2) - 2);
- node->setVisible(connected && i < txIndex);
- node->update();
- }
-
- for (i = 0; i < rxNodes.count(); i++) {
- node = rxNodes.at(i);
- node->setPos((i * (node->boundingRect().width() + nodeMargin)) + leftMargin, (node->boundingRect().height() * 2) - 2);
- node->setVisible(connected && i < rxIndex);
- node->update();
- }
-
- QRectF rect = graph->boundingRect();
- txSpeed->setPos(rect.right() - 110, rect.top());
- txSpeed->setPlainText(QString("%0").arg(txValue));
- txSpeed->setVisible(connected);
-
- rxSpeed->setPos(rect.right() - 110, rect.top() + (rect.height() / 2));
- rxSpeed->setPlainText(QString("%0").arg(rxValue));
- rxSpeed->setVisible(connected);
-
- update();
-}
-
-void TelemetryMonitorWidget::showEvent(QShowEvent *event)
-{
- Q_UNUSED(event);
-
- fitInView(graph, Qt::KeepAspectRatio);
-}
-
-void TelemetryMonitorWidget::resizeEvent(QResizeEvent *event)
-{
- Q_UNUSED(event);
-
- fitInView(graph, Qt::KeepAspectRatio);
-}
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp
deleted file mode 100644
index 6887239fe..000000000
--- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- ******************************************************************************
- *
- * @file versiondialog.cpp
- * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
- * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
- * @addtogroup GCSPlugins GCS Plugins
- * @{
- * @addtogroup CorePlugin Core Plugin
- * @{
- * @brief The Core GCS plugin
- *****************************************************************************/
-/*
- * 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 "versiondialog.h"
-#include "version_info/version_info.h"
-#include "coreconstants.h"
-#include "icore.h"
-
-#include
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-using namespace Core;
-using namespace Core::Internal;
-using namespace Core::Constants;
-
-VersionDialog::VersionDialog(QWidget *parent)
- : QDialog(parent)
-{
- // We need to set the window icon explicitly here since for some reason the
- // application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
- setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
-
- setWindowTitle(tr("About OpenPilot GCS"));
- setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
- QGridLayout *layout = new QGridLayout(this);
- layout->setSizeConstraint(QLayout::SetFixedSize);
-
- const QString description = tr(
- "OpenPilot Ground Control Station "
- "GCS Revision: %1 "
- "UAVO Hash: %2 "
- " "
- "Built from %3 "
- "Built on %4 at %5 "
- "Based on Qt %6 (%7 bit) "
- " "
- "© %8, 2010-%9. All rights reserved. "
- " "
- "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. "
- " "
- "The program is provided AS IS with NO WARRANTY OF ANY KIND, "
- "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
- "PARTICULAR PURPOSE. "
- ).arg(
- VersionInfo::revision().left(60), // %1
- VersionInfo::uavoHash().left(8), // %2
- VersionInfo::origin(), // $3
- QLatin1String(__DATE__), // %4
- QLatin1String(__TIME__), // %5
- QLatin1String(QT_VERSION_STR), // %6
- QString::number(QSysInfo::WordSize), // %7
- QLatin1String(GCS_AUTHOR), // %8
- VersionInfo::year() // %9
- );
-
- QLabel *copyRightLabel = new QLabel(description);
- copyRightLabel->setWordWrap(true);
- copyRightLabel->setOpenExternalLinks(true);
- copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
-
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
- QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
- QTC_ASSERT(closeButton, /**/);
- buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
-
- QLabel *logoLabel = new QLabel;
- logoLabel->setPixmap(QPixmap(QLatin1String(":/core/images/openpilot_logo_128.png")));
- layout->addWidget(logoLabel, 0, 0, 1, 1);
- layout->addWidget(copyRightLabel, 0, 1, 4, 4);
- layout->addWidget(buttonBox, 4, 0, 1, 5);
-}
diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLog.pluginspec b/ground/openpilotgcs/src/plugins/flightlog/FlightLog.pluginspec
new file mode 100644
index 000000000..8baef7f37
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLog.pluginspec
@@ -0,0 +1,10 @@
+
+ The OpenPilot Project
+ (C) 2013 OpenPilot Project
+ The GNU Public License (GPL) Version 3
+ A plugin to manage flight side logs, viewing and downloading.
+ http://www.openpilot.org
+
+
+
+
diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml
new file mode 100644
index 000000000..9f33efebd
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml
@@ -0,0 +1,189 @@
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Layouts 1.0
+
+import org.openpilot 1.0
+
+import "functions.js" as Functions
+
+Rectangle {
+ width: 600
+ height: 400
+
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 10
+ spacing: 10
+ Rectangle {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ border.width: 1
+ radius: 4
+ ColumnLayout {
+ anchors.margins: 10
+ anchors.fill: parent
+ Text {
+ Layout.fillWidth: true
+ text: "" + qsTr("Log entries") + " "
+ font.pixelSize: 12
+ }
+ TableView {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ model: logManager.logEntries
+
+ itemDelegate: Text {
+ anchors.fill: parent
+ anchors.margins: 2
+ anchors.leftMargin: 5
+ font.pixelSize: 12
+ text: styleData.value
+ }
+
+ TableViewColumn {
+ role: "Flight"; title: qsTr("Flight"); width: 50;
+ delegate:
+ Text {
+ anchors.fill: parent
+ anchors.margins: 2
+ anchors.leftMargin: 5
+ font.pixelSize: 12
+ text: styleData.value + 1
+ }
+
+ }
+ TableViewColumn {
+ role: "FlightTime"; title: qsTr("Time"); width: 80;
+ delegate:
+ Text {
+ anchors.fill: parent
+ anchors.margins: 2
+ anchors.leftMargin: 5
+ font.pixelSize: 12
+ text: Functions.millisToTime(styleData.value)
+ }
+ }
+ TableViewColumn {
+ role: "Type"; title: "Type"; width: 50;
+ delegate:
+ Text {
+ anchors.fill: parent
+ anchors.margins: 2
+ anchors.leftMargin: 5
+ font.pixelSize: 12
+ text: {
+ switch(styleData.value) {
+ case 0 : text: qsTr("Empty"); break;
+ case 1 : text: qsTr("Text"); break;
+ case 2 : text: qsTr("UAVO"); break;
+ default: text: qsTr("Unknown"); break;
+ }
+ }
+ }
+
+ }
+ TableViewColumn { role: "LogString"; title: qsTr("Data"); width: 280}
+ }
+
+ RowLayout {
+ anchors.margins: 10
+ spacing: 10
+ ColumnLayout {
+ spacing: 10
+ Text {
+ id: totalFlights
+ font.pixelSize: 12
+ text: "" + qsTr("Flights recorded: ") + " " + (logStatus.Flight + 1)
+ }
+ Text {
+ id: totalEntries
+ font.pixelSize: 12
+ text: "" + qsTr("Entries logged (free): ") + " " +
+ logStatus.UsedSlots + " (" + logStatus.FreeSlots + ")"
+ }
+ }
+ Rectangle {
+ Layout.fillWidth: true
+ }
+ ColumnLayout {
+ spacing: 10
+ RowLayout {
+ Rectangle {
+ Layout.fillWidth: true
+ }
+ Text {
+ font.pixelSize: 12
+ text: "" + qsTr("Flight to download:") + " "
+ }
+
+ ComboBox {
+ id: flightCombo
+ enabled: !logManager.disableControls
+ model: logManager.flightEntries
+ }
+ }
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Rectangle {
+ Layout.fillWidth: true
+ }
+ Button {
+ text: qsTr("Download logs")
+ enabled: !logManager.disableControls
+ activeFocusOnPress: true
+ onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ RowLayout {
+ Layout.fillWidth: true
+ height: 40
+ Button {
+ id: exportButton
+ enabled: !logManager.disableControls && !logManager.disableExport
+ text: qsTr("Export...")
+ activeFocusOnPress: true
+ onClicked: logManager.exportLogs()
+ }
+ CheckBox {
+ id: exportRelativeTimeCB
+ enabled: !logManager.disableControls && !logManager.disableExport
+ text: qsTr("Adjust timestamps")
+ activeFocusOnPress: true
+ checked: logManager.adjustExportedTimestamps
+ onCheckedChanged: logManager.setAdjustExportedTimestamps(checked)
+ }
+
+ Button {
+ id: clearButton
+ enabled: !logManager.disableControls
+ text: qsTr("Clear all logs")
+ activeFocusOnPress: true
+ onClicked: logManager.clearAllLogs()
+ }
+ Rectangle {
+ Layout.fillWidth: true
+ }
+ Button {
+ id: cancelButton
+ enabled: logManager.disableControls
+ text: qsTr("Cancel")
+ activeFocusOnPress: true
+ onClicked: logManager.cancelExportLogs()
+ }
+ Button {
+ id: okButton
+ enabled: !logManager.disableControls
+ text: qsTr("OK")
+ isDefault: true
+ activeFocusOnPress: true
+ onClicked: dialog.close()
+ }
+ }
+ }
+}
diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightLog.qrc b/ground/openpilotgcs/src/plugins/flightlog/flightLog.qrc
new file mode 100644
index 000000000..4283127f5
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/flightLog.qrc
@@ -0,0 +1,6 @@
+
+
+ FlightLogDialog.qml
+ functions.js
+
+
diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlog.pro b/ground/openpilotgcs/src/plugins/flightlog/flightlog.pro
new file mode 100644
index 000000000..dfae3248b
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/flightlog.pro
@@ -0,0 +1,25 @@
+TEMPLATE = lib
+TARGET = FlightLog
+
+QT += qml quick
+
+include(../../openpilotgcsplugin.pri)
+include(../../plugins/coreplugin/coreplugin.pri)
+include(../../plugins/uavobjects/uavobjects.pri)
+include(../../plugins/uavtalk/uavtalk.pri)
+
+HEADERS += flightlogplugin.h \
+ flightlogmanager.h \
+ flightlogdialog.h
+SOURCES += flightlogplugin.cpp \
+ flightlogmanager.cpp \
+ flightlogdialog.cpp
+
+OTHER_FILES += Flightlog.pluginspec \
+ FlightLogDialog.qml \
+ functions.js
+
+FORMS +=
+
+RESOURCES += \
+ flightLog.qrc
diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp
new file mode 100644
index 000000000..65f04f575
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp
@@ -0,0 +1,66 @@
+/**
+ ******************************************************************************
+ *
+ * @file flightlogdialog.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
+ * @addtogroup [Group]
+ * @{
+ * @addtogroup FlightLogDialog
+ * @{
+ * @brief [Brief]
+ *****************************************************************************/
+/*
+ * 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 "flightlogdialog.h"
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include "flightlogmanager.h"
+
+FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogManager) :
+ QDialog(parent)
+{
+ qmlRegisterType("org.openpilot", 1, 0, "DebugLogEntry");
+
+ setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
+ setWindowTitle(tr("Manage flight side logs"));
+ setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+ setMinimumSize(600, 400);
+
+ QQuickView *view = new QQuickView();
+ view->rootContext()->setContextProperty("dialog", this);
+ view->rootContext()->setContextProperty("logStatus", flightLogManager->flightLogStatus());
+ view->rootContext()->setContextProperty("logManager", flightLogManager);
+ view->setResizeMode(QQuickView::SizeRootObjectToView);
+ view->setSource(QUrl("qrc:/flightlog/FlightLogDialog.qml"));
+
+ QWidget *container = QWidget::createWindowContainer(view);
+ container->setMinimumSize(600, 400);
+ container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ QVBoxLayout *lay = new QVBoxLayout();
+ lay->setContentsMargins(0, 0, 0, 0);
+ setLayout(lay);
+ layout()->addWidget(container);
+}
+
+FlightLogDialog::~FlightLogDialog()
+{}
diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.h
new file mode 100644
index 000000000..d1b2fd18e
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.h
@@ -0,0 +1,15 @@
+#ifndef FLIGHTLOGDIALOG_H
+#define FLIGHTLOGDIALOG_H
+
+#include
+#include "flightlogmanager.h"
+
+class FlightLogDialog : public QDialog {
+ Q_OBJECT
+
+public:
+ explicit FlightLogDialog(QWidget *parent, FlightLogManager *flightLogManager);
+ ~FlightLogDialog();
+};
+
+#endif // FLIGHTLOGDIALOG_H
diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp
new file mode 100644
index 000000000..60578532a
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp
@@ -0,0 +1,310 @@
+/**
+ ******************************************************************************
+ *
+ * @file flightlogmanager.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
+ * @addtogroup [Group]
+ * @{
+ * @addtogroup FlightLogManager
+ * @{
+ * @brief [Brief]
+ *****************************************************************************/
+/*
+ * 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 "flightlogmanager.h"
+#include "extensionsystem/pluginmanager.h"
+
+#include
+#include
+
+#include "debuglogcontrol.h"
+#include "uavobjecthelper.h"
+#include "uavtalk/uavtalk.h"
+#include "utils/logfile.h"
+
+FlightLogManager::FlightLogManager(QObject *parent) :
+ QObject(parent), m_disableControls(false),
+ m_disableExport(true), m_cancelDownload(false),
+ m_adjustExportedTimestamps(true)
+{
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+
+ m_objectManager = pm->getObject();
+ Q_ASSERT(m_objectManager);
+
+ m_flightLogControl = DebugLogControl::GetInstance(m_objectManager);
+ Q_ASSERT(m_flightLogControl);
+
+ m_flightLogStatus = DebugLogStatus::GetInstance(m_objectManager);
+ Q_ASSERT(m_flightLogStatus);
+ connect(m_flightLogStatus, SIGNAL(FlightChanged(quint16)), this, SLOT(updateFlightEntries(quint16)));
+
+ m_flightLogEntry = DebugLogEntry::GetInstance(m_objectManager);
+ Q_ASSERT(m_flightLogEntry);
+
+ updateFlightEntries(m_flightLogStatus->getFlight());
+}
+
+FlightLogManager::~FlightLogManager()
+{
+ while (!m_logEntries.isEmpty()) {
+ delete m_logEntries.takeFirst();
+ }
+}
+
+void addLogEntries(QQmlListProperty *list, ExtendedDebugLogEntry *entry)
+{
+ Q_UNUSED(list);
+ Q_UNUSED(entry);
+}
+
+int countLogEntries(QQmlListProperty *list)
+{
+ return static_cast< QList *>(list->data)->size();
+}
+
+ExtendedDebugLogEntry *logEntryAt(QQmlListProperty *list, int index)
+{
+ return static_cast< QList *>(list->data)->at(index);
+}
+
+void clearLogEntries(QQmlListProperty *list)
+{
+ return static_cast< QList *>(list->data)->clear();
+}
+
+QQmlListProperty FlightLogManager::logEntries()
+{
+ return QQmlListProperty(this, &m_logEntries, &addLogEntries, &countLogEntries, &logEntryAt, &clearLogEntries);
+}
+
+QStringList FlightLogManager::flightEntries()
+{
+ return m_flightEntries;
+}
+
+void FlightLogManager::clearAllLogs()
+{
+ setDisableControls(true);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+
+ // Clear on flight side
+ UAVObjectUpdaterHelper updateHelper;
+
+ m_flightLogControl->setFlight(0);
+ m_flightLogControl->setEntry(0);
+ m_flightLogControl->setOperation(DebugLogControl::OPERATION_FORMATFLASH);
+ if (updateHelper.doObjectAndWait(m_flightLogControl, UAVTALK_TIMEOUT) == UAVObjectUpdaterHelper::SUCCESS) {
+ // Then empty locally
+ clearLogList();
+ }
+
+ QApplication::restoreOverrideCursor();
+ setDisableControls(false);
+}
+
+void FlightLogManager::clearLogList()
+{
+ QList tmpList(m_logEntries);
+ m_logEntries.clear();
+
+ emit logEntriesChanged();
+ setDisableExport(true);
+
+ while (!tmpList.isEmpty()) {
+ delete tmpList.takeFirst();
+ }
+}
+
+void FlightLogManager::retrieveLogs(int flightToRetrieve)
+{
+ setDisableControls(true);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ m_cancelDownload = false;
+ UAVObjectUpdaterHelper updateHelper;
+ UAVObjectRequestHelper requestHelper;
+
+ clearLogList();
+
+ // Set up what to retrieve
+ int startFlight = (flightToRetrieve == -1) ? 0 : flightToRetrieve;
+ int endFlight = (flightToRetrieve == -1) ? m_flightLogStatus->getFlight() : flightToRetrieve;
+
+ // Prepare to send request for event retrieval
+ m_flightLogControl->setOperation(DebugLogControl::OPERATION_RETRIEVE);
+ for (int flight = startFlight; flight <= endFlight; flight++) {
+ m_flightLogControl->setFlight(flight);
+ bool gotLast = false;
+ int entry = 0;
+ while (!gotLast) {
+ // Send request for loading flight entry on flight side and wait for ack/nack
+ m_flightLogControl->setEntry(entry);
+
+ if (updateHelper.doObjectAndWait(m_flightLogControl, UAVTALK_TIMEOUT) == UAVObjectUpdaterHelper::SUCCESS &&
+ requestHelper.doObjectAndWait(m_flightLogEntry, UAVTALK_TIMEOUT) == UAVObjectUpdaterHelper::SUCCESS) {
+ if (m_flightLogEntry->getType() != DebugLogEntry::TYPE_EMPTY) {
+ // Ok, we retrieved the entry, and it was the correct one. clone it and add it to the list
+ ExtendedDebugLogEntry *logEntry = new ExtendedDebugLogEntry();
+ logEntry->setData(m_flightLogEntry->getData(), m_objectManager);
+ m_logEntries << logEntry;
+
+ // Increment to get next entry from flight side
+ entry++;
+ } else {
+ // We are done, not more entries on this flight
+ gotLast = true;
+ }
+ } else {
+ // We failed for some reason
+ break;
+ }
+ if (m_cancelDownload) {
+ break;
+ }
+ }
+ if (m_cancelDownload) {
+ break;
+ }
+ }
+
+ if (m_cancelDownload) {
+ clearLogList();
+ m_cancelDownload = false;
+ }
+
+ emit logEntriesChanged();
+ setDisableExport(m_logEntries.count() == 0);
+
+ QApplication::restoreOverrideCursor();
+ setDisableControls(false);
+}
+
+void FlightLogManager::exportLogs()
+{
+ if (m_logEntries.isEmpty()) {
+ return;
+ }
+
+ setDisableControls(true);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+
+ QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log"),
+ tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")),
+ tr("OpenPilot Log (*.opl)"));
+ if (!fileName.isEmpty()) {
+ // Loop and create a new file for each flight.
+ fileName = fileName.replace(QString(".opl"), QString("%1.opl"));
+ int currentEntry = 0;
+ int currentFlight = 0;
+ quint32 adjustedBaseTime = 0;
+ // Continue until all entries are exported
+ while (currentEntry < m_logEntries.count()) {
+ if (m_adjustExportedTimestamps) {
+ adjustedBaseTime = m_logEntries[currentEntry]->getFlightTime();
+ }
+
+ // Get current flight
+ currentFlight = m_logEntries[currentEntry]->getFlight();
+
+ LogFile logFile;
+ logFile.useProvidedTimeStamp(true);
+
+ // Set the file name to contain flight number
+ logFile.setFileName(fileName.arg(tr("_flight-%1").arg(currentFlight + 1)));
+ logFile.open(QIODevice::WriteOnly);
+ UAVTalk uavTalk(&logFile, m_objectManager);
+
+ // Export entries until no more available or flight changes
+ while (currentEntry < m_logEntries.count() && m_logEntries[currentEntry]->getFlight() == currentFlight) {
+ ExtendedDebugLogEntry *entry = m_logEntries[currentEntry];
+
+ // Only log uavobjects
+ if (entry->getType() == ExtendedDebugLogEntry::TYPE_UAVOBJECT) {
+ // Set timestamp that should be logged for this entry
+ logFile.setNextTimeStamp(entry->getFlightTime() - adjustedBaseTime);
+
+ // Use UAVTalk to log complete message to file
+ uavTalk.sendObject(entry->uavObject(), false, false);
+ qDebug() << entry->getFlightTime() - adjustedBaseTime << "=" << entry->toStringBrief();
+ }
+ currentEntry++;
+ }
+
+ logFile.close();
+ }
+ }
+
+ QApplication::restoreOverrideCursor();
+ setDisableControls(false);
+}
+
+void FlightLogManager::cancelExportLogs()
+{
+ m_cancelDownload = true;
+}
+
+void FlightLogManager::updateFlightEntries(quint16 currentFlight)
+{
+ Q_UNUSED(currentFlight);
+
+ int flights = m_flightLogStatus->getFlight();
+ if (m_flightEntries.count() == 0 || (m_flightEntries.count() - 1 != flights)) {
+ m_flightEntries.clear();
+
+ m_flightEntries << tr("All");
+ for (int i = 0; i <= flights; i++) {
+ m_flightEntries << QString::number(i + 1);
+ }
+
+ emit flightEntriesChanged();
+ }
+}
+
+ExtendedDebugLogEntry::ExtendedDebugLogEntry() : DebugLogEntry(),
+ m_object(0)
+{}
+
+ExtendedDebugLogEntry::~ExtendedDebugLogEntry()
+{
+ if (m_object) {
+ delete m_object;
+ m_object = 0;
+ }
+}
+
+QString ExtendedDebugLogEntry::getLogString()
+{
+ if (getType() == DebugLogEntry::TYPE_TEXT) {
+ return QString((const char *)getData().Data);
+ } else if (getType() == DebugLogEntry::TYPE_UAVOBJECT) {
+ return m_object->toString().replace("\n", " ").replace("\t", " ");
+ } else {
+ return "";
+ }
+}
+
+void ExtendedDebugLogEntry::setData(const DebugLogEntry::DataFields &data, UAVObjectManager *objectManager)
+{
+ DebugLogEntry::setData(data);
+
+ if (getType() == DebugLogEntry::TYPE_UAVOBJECT) {
+ UAVDataObject *object = (UAVDataObject *)objectManager->getObject(getObjectID(), getInstanceID());
+ Q_ASSERT(object);
+ m_object = object->clone(getInstanceID());
+ m_object->unpack(getData().Data);
+ }
+}
diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h
new file mode 100644
index 000000000..af01dd7e7
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h
@@ -0,0 +1,162 @@
+/**
+ ******************************************************************************
+ *
+ * @file flightlogmanager.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
+ * @addtogroup [Group]
+ * @{
+ * @addtogroup FlightLogManager
+ * @{
+ * @brief [Brief]
+ *****************************************************************************/
+/*
+ * 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 FLIGHTLOGMANAGER_H
+#define FLIGHTLOGMANAGER_H
+
+#include
+#include
+#include
+#include
+
+#include "uavobjectmanager.h"
+#include "debuglogentry.h"
+#include "debuglogstatus.h"
+#include "debuglogcontrol.h"
+
+class ExtendedDebugLogEntry : public DebugLogEntry {
+ Q_OBJECT Q_PROPERTY(QString LogString READ getLogString WRITE setLogString NOTIFY LogStringUpdated)
+
+public:
+ explicit ExtendedDebugLogEntry();
+ ~ExtendedDebugLogEntry();
+
+ QString getLogString();
+ UAVDataObject *uavObject()
+ {
+ return m_object;
+ }
+
+ void setData(const DataFields & data, UAVObjectManager *objectManager);
+
+public slots:
+ void setLogString(QString arg)
+ {
+ Q_UNUSED(arg);
+ }
+
+signals:
+ void LogStringUpdated(QString arg);
+
+private:
+ UAVDataObject *m_object;
+};
+
+class FlightLogManager : public QObject {
+ Q_OBJECT Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus)
+ Q_PROPERTY(QQmlListProperty logEntries READ logEntries NOTIFY logEntriesChanged)
+ Q_PROPERTY(QStringList flightEntries READ flightEntries NOTIFY flightEntriesChanged)
+ Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged)
+ Q_PROPERTY(bool disableExport READ disableExport WRITE setDisableExport NOTIFY disableExportChanged)
+ Q_PROPERTY(bool adjustExportedTimestamps READ adjustExportedTimestamps WRITE setAdjustExportedTimestamps NOTIFY adjustExportedTimestampsChanged)
+
+public:
+ explicit FlightLogManager(QObject *parent = 0);
+ ~FlightLogManager();
+
+ QQmlListProperty logEntries();
+ QStringList flightEntries();
+
+ DebugLogStatus *flightLogStatus() const
+ {
+ return m_flightLogStatus;
+ }
+
+ bool disableControls() const
+ {
+ return m_disableControls;
+ }
+
+ bool disableExport() const
+ {
+ return m_disableExport;
+ }
+
+ void clearLogList();
+
+ bool adjustExportedTimestamps() const
+ {
+ return m_adjustExportedTimestamps;
+ }
+
+signals:
+ void logEntriesChanged();
+ void flightEntriesChanged();
+ void disableControlsChanged(bool arg);
+ void disableExportChanged(bool arg);
+
+ void adjustExportedTimestampsChanged(bool arg);
+
+public slots:
+ void clearAllLogs();
+ void retrieveLogs(int flightToRetrieve = -1);
+ void exportLogs();
+ void cancelExportLogs();
+
+ void setDisableControls(bool arg)
+ {
+ if (m_disableControls != arg) {
+ m_disableControls = arg;
+ emit disableControlsChanged(arg);
+ }
+ }
+
+ void setDisableExport(bool arg)
+ {
+ if (m_disableExport != arg) {
+ m_disableExport = arg;
+ emit disableExportChanged(arg);
+ }
+ }
+
+ void setAdjustExportedTimestamps(bool arg)
+ {
+ if (m_adjustExportedTimestamps != arg) {
+ m_adjustExportedTimestamps = arg;
+ emit adjustExportedTimestampsChanged(arg);
+ }
+ }
+
+private slots:
+ void updateFlightEntries(quint16 currentFlight);
+
+private:
+ UAVObjectManager *m_objectManager;
+ DebugLogControl *m_flightLogControl;
+ DebugLogStatus *m_flightLogStatus;
+ DebugLogEntry *m_flightLogEntry;
+ QList m_logEntries;
+ QStringList m_flightEntries;
+
+ static const int UAVTALK_TIMEOUT = 4000;
+ bool m_disableControls;
+ bool m_disableExport;
+ bool m_cancelDownload;
+ bool m_adjustExportedTimestamps;
+};
+
+#endif // FLIGHTLOGMANAGER_H
diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.cpp
new file mode 100644
index 000000000..5b8e9def6
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.cpp
@@ -0,0 +1,98 @@
+/**
+ ******************************************************************************
+ *
+ * @file flightlogplugin.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup GCSPlugins GCS Plugins
+ * @brief A plugin to view and download flight side logs.
+ *****************************************************************************/
+/*
+ * 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 "flightlogplugin.h"
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "flightlogdialog.h"
+
+FlightLogPlugin::FlightLogPlugin() : m_logDialog(0)
+{}
+
+FlightLogPlugin::~FlightLogPlugin()
+{
+ shutdown();
+}
+
+bool FlightLogPlugin::initialize(const QStringList & args, QString *errMsg)
+{
+ Q_UNUSED(args);
+ Q_UNUSED(errMsg);
+
+ // Add Menu entry
+ Core::ActionManager *am = Core::ICore::instance()->actionManager();
+ Core::ActionContainer *ac = am->actionContainer(Core::Constants::M_TOOLS);
+
+ Core::Command *cmd = am->registerAction(new QAction(this),
+ "FlightLogPlugin.ShowFlightLogDialog",
+ QList() <<
+ Core::Constants::C_GLOBAL_ID);
+ cmd->setDefaultKeySequence(QKeySequence("Ctrl+F"));
+ cmd->action()->setText(tr("Manage flight side logs..."));
+
+ Core::ModeManager::instance()->addAction(cmd, 1);
+
+ ac->menu()->addSeparator();
+ ac->appendGroup("FlightLogs");
+ ac->addAction(cmd, "FlightLogs");
+
+ connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(ShowLogManagementDialog()));
+ return true;
+}
+
+void FlightLogPlugin::ShowLogManagementDialog()
+{
+ if (!m_logDialog) {
+ m_logDialog = new FlightLogDialog(0, new FlightLogManager());
+ connect(m_logDialog, SIGNAL(finished(int)), this, SLOT(LogManagementDialogClosed()));
+ m_logDialog->show();
+ }
+}
+
+void FlightLogPlugin::LogManagementDialogClosed()
+{
+ if (m_logDialog) {
+ m_logDialog->deleteLater();
+ m_logDialog = 0;
+ }
+}
+
+void FlightLogPlugin::extensionsInitialized()
+{}
+
+void FlightLogPlugin::shutdown()
+{
+ if (m_logDialog) {
+ m_logDialog->close();
+ LogManagementDialogClosed();
+ }
+}
diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.h
new file mode 100644
index 000000000..b78c58836
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogplugin.h
@@ -0,0 +1,53 @@
+/**
+ ******************************************************************************
+ *
+ * @file flightlogplugin.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup GCSPlugins GCS Plugins
+ * @{
+ * @brief A plugin to view and download flight side logs.
+ *****************************************************************************/
+/*
+ * 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 FLIGHTLOGPLUGIN_H_
+#define FLIGHTLOGPLUGIN_H_
+
+#include
+#include "flightlogmanager.h"
+#include "flightlogdialog.h"
+
+class FlightLogPlugin : public ExtensionSystem::IPlugin {
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "OpenPilot.FlightLog")
+
+public:
+ FlightLogPlugin();
+ ~FlightLogPlugin();
+
+ void extensionsInitialized();
+ bool initialize(const QStringList & arguments, QString *errorString);
+ void shutdown();
+
+private slots:
+ void ShowLogManagementDialog();
+ void LogManagementDialogClosed();
+
+private:
+ FlightLogDialog *m_logDialog;
+};
+
+#endif /* FLIGHTLOGPLUGIN_H_ */
diff --git a/ground/openpilotgcs/src/plugins/flightlog/functions.js b/ground/openpilotgcs/src/plugins/flightlog/functions.js
new file mode 100644
index 000000000..47884432b
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/flightlog/functions.js
@@ -0,0 +1,20 @@
+.pragma library
+
+function millisToTime(ms) {
+ var secs = Math.floor(ms / 1000);
+ var msleft = ms % 1000;
+ var hours = Math.floor(secs / (60 * 60));
+ var divisor_for_minutes = secs % (60 * 60);
+ var minutes = Math.floor(divisor_for_minutes / 60);
+ var divisor_for_seconds = divisor_for_minutes % 60;
+ var seconds = Math.ceil(divisor_for_seconds);
+ return pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + ":" + pad(msleft, 3);
+}
+
+function pad(number, length) {
+ var str = '' + number;
+ while (str.length < length) {
+ str = '0' + str;
+ }
+ return str;
+}
diff --git a/ground/openpilotgcs/src/plugins/logging/logging.pro b/ground/openpilotgcs/src/plugins/logging/logging.pro
index 8d10d54a3..5514f4034 100644
--- a/ground/openpilotgcs/src/plugins/logging/logging.pro
+++ b/ground/openpilotgcs/src/plugins/logging/logging.pro
@@ -1,25 +1,22 @@
TEMPLATE = lib
+
TARGET = LoggingGadget
DEFINES += LOGGING_LIBRARY
QT += svg
+
include(../../openpilotgcsplugin.pri)
include(logging_dependencies.pri)
HEADERS += loggingplugin.h \
- logfile.h \
logginggadgetwidget.h \
logginggadget.h \
logginggadgetfactory.h
-# logginggadgetconfiguration.h
-# logginggadgetoptionspage.h
SOURCES += loggingplugin.cpp \
- logfile.cpp \
logginggadgetwidget.cpp \
logginggadget.cpp \
logginggadgetfactory.cpp
-# logginggadgetconfiguration.cpp \
-# logginggadgetoptionspage.cpp
+
OTHER_FILES += LoggingGadget.pluginspec
+
FORMS += logging.ui
-# logginggadgetwidget.ui \
-# loggingdialog.ui
+
diff --git a/ground/openpilotgcs/src/plugins/logging/loggingplugin.cpp b/ground/openpilotgcs/src/plugins/logging/loggingplugin.cpp
index fc88cbe98..74239e5c6 100644
--- a/ground/openpilotgcs/src/plugins/logging/loggingplugin.cpp
+++ b/ground/openpilotgcs/src/plugins/logging/loggingplugin.cpp
@@ -323,7 +323,7 @@ bool LoggingPlugin::initialize(const QStringList & args, QString *errMsg)
QList() <<
Core::Constants::C_GLOBAL_ID);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+L"));
- cmd->action()->setText("Start logging...");
+ cmd->action()->setText(tr("Start logging..."));
ac->menu()->addSeparator();
ac->appendGroup("Logging");
diff --git a/ground/openpilotgcs/src/plugins/logging/loggingplugin.h b/ground/openpilotgcs/src/plugins/logging/loggingplugin.h
index ed697714e..7c2ed7406 100644
--- a/ground/openpilotgcs/src/plugins/logging/loggingplugin.h
+++ b/ground/openpilotgcs/src/plugins/logging/loggingplugin.h
@@ -35,7 +35,7 @@
#include "uavobjectmanager.h"
#include "gcstelemetrystats.h"
#include
-#include
+#include
#include
#include
diff --git a/ground/openpilotgcs/src/plugins/ophid/src/ophid.cpp b/ground/openpilotgcs/src/plugins/ophid/src/ophid.cpp
index afcc28446..447fa2f98 100644
--- a/ground/openpilotgcs/src/plugins/ophid/src/ophid.cpp
+++ b/ground/openpilotgcs/src/plugins/ophid/src/ophid.cpp
@@ -205,6 +205,8 @@ qint64 RawHIDReadThread::getBytesAvailable()
return m_readBuffer.size();
}
+// *********************************************************************************
+
RawHIDWriteThread::RawHIDWriteThread(RawHID *hid)
: m_hid(hid),
hiddev(&hid->dev),
@@ -212,8 +214,6 @@ RawHIDWriteThread::RawHIDWriteThread(RawHID *hid)
m_running(true)
{}
-// *********************************************************************************
-
RawHIDWriteThread::~RawHIDWriteThread()
{
m_running = false;
@@ -227,29 +227,31 @@ void RawHIDWriteThread::run()
{
while (m_running) {
char buffer[WRITE_SIZE] = { 0 };
+ int size;
- m_writeBufMtx.lock();
- int size = qMin(WRITE_SIZE - 2, m_writeBuffer.size());
- while (size <= 0) {
- // wait on new data to write condition, the timeout
- // enable the thread to shutdown properly
- m_newDataToWrite.wait(&m_writeBufMtx, 200);
- if (!m_running) {
- return;
+ {
+ QMutexLocker lock(&m_writeBufMtx);
+ size = qMin(WRITE_SIZE - 2, m_writeBuffer.size());
+ while (size <= 0) {
+ // wait on new data to write condition, the timeout
+ // enable the thread to shutdown properly
+ m_newDataToWrite.wait(&m_writeBufMtx, 200);
+ if (!m_running) {
+ return;
+ }
+
+ size = m_writeBuffer.size();
}
- size = m_writeBuffer.size();
+ // NOTE: data size is limited to 2 bytes less than the
+ // usb packet size (64 bytes for interrupt) to make room
+ // for the reportID and valid data length
+ size = qMin(WRITE_SIZE - 2, m_writeBuffer.size());
+ memcpy(&buffer[2], m_writeBuffer.constData(), size);
+ buffer[1] = size; // valid data length
+ buffer[0] = 2; // reportID
}
- // NOTE: data size is limited to 2 bytes less than the
- // usb packet size (64 bytes for interrupt) to make room
- // for the reportID and valid data length
- size = qMin(WRITE_SIZE - 2, m_writeBuffer.size());
- memcpy(&buffer[2], m_writeBuffer.constData(), size);
- buffer[1] = size; // valid data length
- buffer[0] = 2; // reportID
- m_writeBufMtx.unlock();
-
// must hold lock through the send to know how much was sent
int ret = hiddev->send(hidno, buffer, WRITE_SIZE, WRITE_TIMEOUT);
diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqml.pro b/ground/openpilotgcs/src/plugins/pfdqml/pfdqml.pro
index 55f15b4d2..0d7da9e26 100644
--- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqml.pro
+++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqml.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
TARGET = PfdQml
QT += svg
QT += opengl
-QT += declarative
+QT += qml quick
OSG {
DEFINES += USE_OSG
}
diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.cpp b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.cpp
index 365a323b7..e28257ff5 100644
--- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.cpp
+++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.cpp
@@ -21,7 +21,10 @@
PfdQmlGadget::PfdQmlGadget(QString classId, PfdQmlGadgetWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
-{}
+{
+ m_container = NULL;
+ m_parent = parent;
+}
PfdQmlGadget::~PfdQmlGadget()
{
diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h
index b6525007f..f36bbb6fe 100644
--- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h
+++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadget.h
@@ -35,11 +35,18 @@ public:
QWidget *widget()
{
- return m_widget;
+ if (!m_container) {
+ m_container = QWidget::createWindowContainer(m_widget, m_parent);
+ m_container->setMinimumSize(64, 64);
+ m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ }
+ return m_container;
}
void loadConfiguration(IUAVGadgetConfiguration *config);
private:
+ QWidget *m_container;
+ QWidget *m_parent;
PfdQmlGadgetWidget *m_widget;
};
diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp
index f7d6b1f66..197f1929d 100644
--- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp
+++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetfactory.cpp
@@ -31,7 +31,7 @@ PfdQmlGadgetFactory::~PfdQmlGadgetFactory()
Core::IUAVGadget *PfdQmlGadgetFactory::createGadget(QWidget *parent)
{
- PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget(parent);
+ PfdQmlGadgetWidget *gadgetWidget = new PfdQmlGadgetWidget();
return new PfdQmlGadget(QString("PfdQmlGadget"), gadgetWidget, parent);
}
diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp
index aa6879b7e..96fa900a4 100644
--- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp
@@ -27,13 +27,13 @@
#include
#include
#include
+#include
-#include
-#include
-#include
+#include
+#include
-PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
- QDeclarativeView(parent),
+PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWindow *parent) :
+ QQuickView(parent),
m_openGLEnabled(false),
m_terrainEnabled(false),
m_actualPositionUsed(false),
@@ -45,14 +45,13 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
m_altitudeUnit("m"),
m_altitudeFactor(1.0)
{
- setMinimumSize(64, 64);
- setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setResizeMode(SizeRootObjectToView);
// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
QStringList objectsToExport;
- objectsToExport << "VelocityState" <<
+ objectsToExport <<
+ "VelocityState" <<
"PositionState" <<
"AttitudeState" <<
"AccelState" <<
@@ -61,6 +60,8 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
"AltitudeHoldDesired" <<
"GPSPositionSensor" <<
"GCSTelemetryStats" <<
+ "SystemAlarms" <<
+ "NedAccel" <<
"FlightBatteryState";
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@@ -94,6 +95,8 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn)
SvgImageProvider *svgProvider = new SvgImageProvider(fn);
engine()->addImageProvider("svg", svgProvider);
+ engine()->clearComponentCache();
+
// it's necessary to allow qml side to query svg element position
engine()->rootContext()->setContextProperty("svgRenderer", svgProvider);
engine()->setBaseUrl(QUrl::fromLocalFile(fn));
@@ -101,7 +104,7 @@ void PfdQmlGadgetWidget::setQmlFile(QString fn)
qDebug() << Q_FUNC_INFO << fn;
setSource(QUrl::fromLocalFile(fn));
- foreach(const QDeclarativeError &error, errors()) {
+ foreach(const QQmlError &error, errors()) {
qDebug() << error.description();
}
}
@@ -159,19 +162,7 @@ void PfdQmlGadgetWidget::setAltitudeFactor(double factor)
void PfdQmlGadgetWidget::setOpenGLEnabled(bool arg)
{
- if (m_openGLEnabled != arg) {
- m_openGLEnabled = arg;
-
- qDebug() << Q_FUNC_INFO << "Set OPENGL" << m_openGLEnabled;
- if (m_openGLEnabled) {
- setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
- } else {
- setViewport(new QWidget);
- }
-
- // update terrainEnabled status with opengl status chaged
- setTerrainEnabled(m_terrainEnabled);
- }
+ setTerrainEnabled(m_terrainEnabled);
}
// Switch between PositionState UAVObject position
@@ -184,6 +175,16 @@ void PfdQmlGadgetWidget::setActualPositionUsed(bool arg)
}
}
+void PfdQmlGadgetWidget::mouseReleaseEvent(QMouseEvent *event)
+{
+ // Reload the schene on the middle mouse button click.
+ if (event->button() == Qt::MiddleButton) {
+ setQmlFile(m_qmlFileName);
+ }
+
+ QQuickView::mouseReleaseEvent(event);
+}
+
void PfdQmlGadgetWidget::setLatitude(double arg)
{
// not sure qFuzzyCompare is accurate enough for geo coordinates
diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h
index 46d540345..222fb8ce4 100644
--- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h
+++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.h
@@ -18,9 +18,9 @@
#define PFDQMLGADGETWIDGET_H_
#include "pfdqmlgadgetconfiguration.h"
-#include
+#include
-class PfdQmlGadgetWidget : public QDeclarativeView {
+class PfdQmlGadgetWidget : public QQuickView {
Q_OBJECT Q_PROPERTY(QString earthFile READ earthFile WRITE setEarthFile NOTIFY earthFileChanged)
Q_PROPERTY(bool terrainEnabled READ terrainEnabled WRITE setTerrainEnabled NOTIFY terrainEnabledChanged)
@@ -37,7 +37,7 @@ class PfdQmlGadgetWidget : public QDeclarativeView {
Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged)
public:
- PfdQmlGadgetWidget(QWidget *parent = 0);
+ PfdQmlGadgetWidget(QWindow *parent = 0);
~PfdQmlGadgetWidget();
void setQmlFile(QString fn);
@@ -115,6 +115,9 @@ signals:
void altitudeUnitChanged(QString arg);
void altitudeFactorChanged(double arg);
+protected:
+ void mouseReleaseEvent(QMouseEvent *event);
+
private:
QString m_qmlFileName;
QString m_earthFile;
diff --git a/ground/openpilotgcs/src/plugins/plugins.pro b/ground/openpilotgcs/src/plugins/plugins.pro
index 73bea8c59..c09d5567d 100644
--- a/ground/openpilotgcs/src/plugins/plugins.pro
+++ b/ground/openpilotgcs/src/plugins/plugins.pro
@@ -49,6 +49,12 @@ plugin_uavtalk.subdir = uavtalk
plugin_uavtalk.depends = plugin_uavobjects
plugin_uavtalk.depends += plugin_coreplugin
+# Telemetry plugin
+SUBDIRS += plugin_telemetry
+plugin_telemetry.subdir = telemetry
+plugin_telemetry.depends += plugin_uavtalk
+plugin_telemetry.depends += plugin_coreplugin
+
# OPMap UAVGadget
plugin_opmap.subdir = opmap
plugin_opmap.depends = plugin_coreplugin
@@ -238,3 +244,10 @@ plugin_setupwizard.depends += plugin_config
plugin_setupwizard.depends += plugin_uploader
SUBDIRS += plugin_setupwizard
+# Flight Logs plugin
+plugin_flightlog.subdir = flightlog
+plugin_flightlog.depends = plugin_coreplugin
+plugin_flightlog.depends += plugin_uavobjects
+plugin_flightlog.depends += plugin_uavtalk
+SUBDIRS += plugin_flightlog
+
diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlview.pro b/ground/openpilotgcs/src/plugins/qmlview/qmlview.pro
index c2897f3a0..de95a7218 100644
--- a/ground/openpilotgcs/src/plugins/qmlview/qmlview.pro
+++ b/ground/openpilotgcs/src/plugins/qmlview/qmlview.pro
@@ -2,7 +2,7 @@ TEMPLATE = lib
TARGET = QMLView
QT += svg
QT += opengl
-QT += declarative
+QT += qml quick
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.cpp b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.cpp
index d5aa1749c..0bc9eca42 100644
--- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.cpp
+++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.cpp
@@ -33,7 +33,10 @@
QmlViewGadget::QmlViewGadget(QString classId, QmlViewGadgetWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
-{}
+{
+ m_container = NULL;
+ m_parent = parent;
+}
QmlViewGadget::~QmlViewGadget()
{
diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h
index 152c58042..076cd8d99 100644
--- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h
+++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadget.h
@@ -46,11 +46,18 @@ public:
QWidget *widget()
{
- return m_widget;
+ if (!m_container) {
+ m_container = QWidget::createWindowContainer(m_widget, m_parent);
+ m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ m_container->setMinimumSize(64, 64);
+ }
+ return m_container;
}
void loadConfiguration(IUAVGadgetConfiguration *config);
private:
+ QWidget *m_container;
+ QWidget *m_parent;
QmlViewGadgetWidget *m_widget;
};
diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetfactory.cpp b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetfactory.cpp
index 20b7693bb..619f15179 100644
--- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetfactory.cpp
+++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetfactory.cpp
@@ -42,7 +42,7 @@ QmlViewGadgetFactory::~QmlViewGadgetFactory()
Core::IUAVGadget *QmlViewGadgetFactory::createGadget(QWidget *parent)
{
- QmlViewGadgetWidget *gadgetWidget = new QmlViewGadgetWidget(parent);
+ QmlViewGadgetWidget *gadgetWidget = new QmlViewGadgetWidget();
return new QmlViewGadget(QString("QmlViewGadget"), gadgetWidget, parent);
}
diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp
index 9abbb4b23..808cf3e80 100644
--- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp
@@ -38,14 +38,12 @@
#include
#include
-#include
-#include
+#include
+#include
-QmlViewGadgetWidget::QmlViewGadgetWidget(QWidget *parent) :
- QDeclarativeView(parent)
+QmlViewGadgetWidget::QmlViewGadgetWidget(QWindow *parent) :
+ QQuickView(parent)
{
- setMinimumSize(64, 64);
- setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setResizeMode(SizeRootObjectToView);
QStringList objectsToExport;
@@ -90,7 +88,7 @@ void QmlViewGadgetWidget::setQmlFile(QString fn)
qDebug() << Q_FUNC_INFO << fn;
setSource(QUrl::fromLocalFile(fn));
- foreach(const QDeclarativeError &error, errors()) {
+ foreach(const QQmlError &error, errors()) {
qDebug() << error.description();
}
}
@@ -100,9 +98,5 @@ void QmlViewGadgetWidget::setQmlFile(QString fn)
*/
void QmlViewGadgetWidget::enableOpenGL(bool flag)
{
- if (flag) {
- setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
- } else {
- setViewport(new QWidget);
- }
+ Q_UNUSED(flag)
}
diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.h b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.h
index 783cc963e..ef54fcf1b 100644
--- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.h
+++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.h
@@ -30,7 +30,7 @@
#include "qmlviewgadgetconfiguration.h"
-#include
+#include
#include
#include
@@ -40,11 +40,11 @@
class UAVObject;
-class QmlViewGadgetWidget : public QDeclarativeView {
+class QmlViewGadgetWidget : public QQuickView {
Q_OBJECT
public:
- QmlViewGadgetWidget(QWidget *parent = 0);
+ QmlViewGadgetWidget(QWindow *parent = 0);
~QmlViewGadgetWidget();
void setQmlFile(QString fn);
diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui
index b4da7c0a7..0883ec4d5 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui
+++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/multipage.ui
@@ -21,7 +21,7 @@
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot multirotor configuration</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot Multirotor Configuration</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">This part of the wizard will set up the OpenPilot controller for use with a flying platform utilizing multiple rotors. The wizard supports the most common types of multirotors. Other variants of multirotors can be configured by using custom configuration options in the Configuration plugin in the GCS.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui
index 6699ad531..0f0dd1707 100644
--- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui
+++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui
@@ -66,7 +66,7 @@ p, li { white-space: pre-wrap; }
-
- <html><head/><body><p>In this step we will set the neutral rate for the motor highlighted in the illustration to the right. <br/>Plase pay attention to the details and in particular the motors position and its rotation direction.</p><p>To find the neutral rate for this engine, press the Start button below and slide the slider to the right until the engine just starts to spin stably. <br/><br/>When done press button again to stop.</p></body></html>
+ <html><head/><body><p>In this step we will set the neutral rate for the motor highlighted in the illustration to the right. <br/>Please pay attention to the details and in particular the motors position and its rotation direction. Ensure the motors are spinning in the correct direction as shown in the diagram. Swap any 2 motor wires to change the direction of a motor. </p><p>To find the neutral rate for this engine, press the Start button below and slide the slider to the right until the engine just starts to spin stable. <br/><br/>When done press button again to stop.</p></body></html>
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
diff --git a/ground/openpilotgcs/src/plugins/telemetry/Telemetry.pluginspec b/ground/openpilotgcs/src/plugins/telemetry/Telemetry.pluginspec
new file mode 100644
index 000000000..0a003600e
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/Telemetry.pluginspec
@@ -0,0 +1,11 @@
+
+ The OpenPilot Project
+ (C) 2010 OpenPilot Project
+ The GNU Public License (GPL) Version 3
+ UAVTalk telemetry protocol
+ http://www.openpilot.org
+
+
+
+
+
diff --git a/ground/openpilotgcs/src/plugins/telemetry/images/tx-rx.svg b/ground/openpilotgcs/src/plugins/telemetry/images/tx-rx.svg
new file mode 100644
index 000000000..babda9af1
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/images/tx-rx.svg
@@ -0,0 +1,397 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ image/svg+xml
+
+
+
+
+
+
+ transform="translate(0,0)"
+
+
+ Tx
+
+
+
+
+
+
+
+ Rx
+
+
+
+
+
+
+
+
+
+
+
+ inkscape:label="txSpeed" />
+
+ inkscape:label="rxSpeed" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp
new file mode 100644
index 000000000..e23591da2
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.cpp
@@ -0,0 +1,52 @@
+/**
+ ******************************************************************************
+ *
+ * @file monitorgadget.cpp
+ * @author Philippe Renon
+ * @addtogroup GCSPlugins GCS Plugins
+ * @{
+ * @addtogroup MonitorPlugin Telemetry Plugin
+ * @{
+ * @brief The Telemetry Monitor gadget
+ *****************************************************************************/
+/*
+ * 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 "monitorgadget.h"
+#include "monitorgadgetconfiguration.h"
+#include "monitorwidget.h"
+
+MonitorGadget::MonitorGadget(QString classId, MonitorWidget *widget, QWidget *parent) :
+ IUAVGadget(classId, parent), m_widget(widget)
+{}
+
+MonitorGadget::~MonitorGadget()
+{
+ delete m_widget;
+}
+
+/*
+ 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);
+
+ // 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
new file mode 100644
index 000000000..e85c15ade
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadget.h
@@ -0,0 +1,58 @@
+/**
+ ******************************************************************************
+ *
+ * @file monitorgadget.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @brief
+ * @see The GNU Public License (GPL) Version 3
+ * @defgroup telemetry
+ * @{
+ *
+ *****************************************************************************/
+/*
+ * 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 MONITORGADGET_H
+#define MONITORGADGET_H
+
+#include
+#include "monitorwidget.h"
+
+// class IUAVGadget;
+// class QWidget;
+// class QString;
+// class NotifyPluginGadgetWidget;
+
+using namespace Core;
+
+class MonitorGadget : public IUAVGadget {
+ Q_OBJECT
+public:
+ MonitorGadget(QString classId, MonitorWidget *widget, QWidget *parent = 0);
+ ~MonitorGadget();
+
+ QWidget *widget()
+ {
+ return m_widget;
+ }
+
+ void loadConfiguration(IUAVGadgetConfiguration *config);
+
+private:
+ MonitorWidget *m_widget;
+};
+
+#endif // MONITORGADGET_H
diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp
new file mode 100644
index 000000000..6a69905af
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.cpp
@@ -0,0 +1,53 @@
+/**
+ ******************************************************************************
+ *
+ * @file monitorgadgetconfiguration.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup GCSPlugins GCS Plugins
+ * @{
+ * @addtogroup TelemetryPlugin Telemetry Plugin
+ * @{
+ * @brief A gadget that displays a 3D representation of the UAV
+ *****************************************************************************/
+/*
+ * 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 "monitorgadgetconfiguration.h"
+
+MonitorGadgetConfiguration::MonitorGadgetConfiguration(QString classId, QSettings *qSettings, QObject *parent) :
+ IUAVGadgetConfiguration(classId, parent)
+{
+ // if a saved configuration exists load it
+ if (qSettings != 0) {}
+}
+
+IUAVGadgetConfiguration *MonitorGadgetConfiguration::clone()
+{
+ MonitorGadgetConfiguration *mv = new MonitorGadgetConfiguration(this->classId());
+
+ return mv;
+}
+
+/**
+ * Saves a configuration.
+ *
+ */
+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);
+}
diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.h b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.h
new file mode 100644
index 000000000..20c570a78
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetconfiguration.h
@@ -0,0 +1,44 @@
+/**
+ ******************************************************************************
+ *
+ * @file monitorgadgetconfiguration.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @addtogroup GCSPlugins GCS Plugins
+ * @{
+ * @addtogroup TelemetryPlugin Telemetry Plugin
+ * @{
+ * @brief A gadget that displays telemetry connection speed monitoring
+ *****************************************************************************/
+/*
+ * 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 MONITORGADGETCONFIGURATION_H
+#define MONITORGADGETCONFIGURATION_H
+
+#include
+
+using namespace Core;
+
+class MonitorGadgetConfiguration : public IUAVGadgetConfiguration {
+ Q_OBJECT
+public:
+ explicit MonitorGadgetConfiguration(QString classId, QSettings *qSettings = 0, QObject *parent = 0);
+
+ void saveConfig(QSettings *settings) const;
+ IUAVGadgetConfiguration *clone();
+};
+
+#endif // MONITORGADGETCONFIGURATION_H
diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp
new file mode 100644
index 000000000..94faf597a
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.cpp
@@ -0,0 +1,84 @@
+/**
+ ******************************************************************************
+ *
+ * @file monitorgadgetfactory.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @brief
+ * @see The GNU Public License (GPL) Version 3
+ * @defgroup telemetryplugin
+ * @{
+ *
+ *****************************************************************************/
+/*
+ * 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 "monitorgadgetfactory.h"
+#include "uavtalk/telemetrymanager.h"
+#include "extensionsystem/pluginmanager.h"
+#include "monitorgadgetconfiguration.h"
+#include "monitorgadget.h"
+#include "monitorgadgetoptionspage.h"
+
+#include
+#include
+
+MonitorGadgetFactory::MonitorGadgetFactory(QObject *parent) :
+ IUAVGadgetFactory(QString("TelemetryMonitorGadget"), tr("Telemetry Monitor"), parent)
+{}
+
+MonitorGadgetFactory::~MonitorGadgetFactory()
+{}
+
+Core::IUAVGadget *MonitorGadgetFactory::createGadget(QWidget *parent)
+{
+ MonitorWidget *widget = createMonitorWidget(parent);
+
+ return new MonitorGadget(QString("TelemetryMonitorGadget"), widget, parent);
+}
+
+MonitorWidget *MonitorGadgetFactory::createMonitorWidget(QWidget *parent)
+{
+ MonitorWidget *widget = new MonitorWidget(parent);
+
+ // connect widget to telemetry manager
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ TelemetryManager *tm = pm->getObject();
+
+ connect(tm, SIGNAL(connected()), widget, SLOT(telemetryConnected()));
+ connect(tm, SIGNAL(disconnected()), widget, SLOT(telemetryDisconnected()));
+ connect(tm, SIGNAL(telemetryUpdated(double, double)), widget, SLOT(telemetryUpdated(double, double)));
+
+ // and connect widget to connection manager (for retro compatibility)
+ Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
+
+ connect(cm, SIGNAL(deviceConnected(QIODevice *)), widget, SLOT(telemetryConnected()));
+ connect(cm, SIGNAL(deviceDisconnected()), widget, SLOT(telemetryDisconnected()));
+
+ if (tm->isConnected()) {
+ widget->telemetryConnected();
+ }
+
+ return widget;
+}
+
+IUAVGadgetConfiguration *MonitorGadgetFactory::createConfiguration(QSettings *qSettings)
+{
+ return new MonitorGadgetConfiguration(QString("TelemetryMonitorGadget"), qSettings);
+}
+
+IOptionsPage *MonitorGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
+{
+ return new MonitorGadgetOptionsPage(qobject_cast(config));
+}
diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.h b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.h
new file mode 100644
index 000000000..0b44e8b53
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetfactory.h
@@ -0,0 +1,55 @@
+/**
+ ******************************************************************************
+ *
+ * @file monitorgadgetfactory.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @brief
+ * @see The GNU Public License (GPL) Version 3
+ * @defgroup monitorgadget
+ * @{
+ *
+ *****************************************************************************/
+/*
+ * 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 MONITORGADGETFACTORY_H
+#define MONITORGADGETFACTORY_H
+
+#include "monitorwidget.h"
+#include
+
+
+namespace Core {
+class IUAVGadget;
+class IUAVGadgetFactory;
+}
+
+using namespace Core;
+
+class MonitorGadgetFactory : public IUAVGadgetFactory {
+ Q_OBJECT
+public:
+ MonitorGadgetFactory(QObject *parent = 0);
+ ~MonitorGadgetFactory();
+
+ Core::IUAVGadget *createGadget(QWidget *parent);
+ IUAVGadgetConfiguration *createConfiguration(QSettings *qSettings);
+ IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
+
+ MonitorWidget *createMonitorWidget(QWidget *parent);
+};
+
+#endif // MONITORGADGETFACTORY_H
diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp
new file mode 100644
index 000000000..6601efd54
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.cpp
@@ -0,0 +1,104 @@
+/**
+ ******************************************************************************
+ *
+ * @file monitorgadgetoptionspage.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @brief Telemetry Gadget options page
+ * @see The GNU Public License (GPL) Version 3
+ * @defgroup monitorgadget
+ * @{
+ *
+ *****************************************************************************/
+/*
+ * 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 "monitorgadgetoptionspage.h"
+#include
+// #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->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(this, SIGNAL(updateNotifications(QList)),
+// _owner, SLOT(updateNotificationList(QList)));
+//// connect(this, SIGNAL(resetNotification()),owner, SLOT(resetNotification()));
+//
+// _privListNotifications = _owner->getListNotifications();
+//
+//
+//// [1]
+// setSelectedNotification(_owner->getCurrentNotification());
+// addDynamicFieldLayout();
+//// [2]
+// updateConfigView(_selectedNotification);
+//
+// initRulesTable();
+// initButtons();
+// initPhononPlayer();
+//
+// int curr_row = _privListNotifications.indexOf(_selectedNotification);
+// _telemetryRulesSelection->setCurrentIndex(_telemetryRulesModel->index(curr_row, 0, QModelIndex()),
+// QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
+//
+// return optionsPageWidget;
+ return NULL;
+}
+
+void MonitorGadgetOptionsPage::apply()
+{
+// 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(_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/monitorgadgetoptionspage.h b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.h
new file mode 100644
index 000000000..107e83fc8
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorgadgetoptionspage.h
@@ -0,0 +1,61 @@
+/**
+ ******************************************************************************
+ *
+ * @file monitorgadgetoptionspage.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @brief Telemetry Gadget options page header
+ * @see The GNU Public License (GPL) Version 3
+ * @defgroup telemetry
+ * @{
+ *
+ *****************************************************************************/
+/*
+ * 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 MONITORGADGETOPTIONSPAGE_H
+#define MONITORGADGETOPTIONSPAGE_H
+
+#include "coreplugin/dialogs/ioptionspage.h"
+#include "uavobjectmanager.h"
+#include "uavobject.h"
+
+#include "QString"
+#include
+#include
+
+namespace Ui {
+class MonitorGadgetOptionsPage;
+};
+
+class MonitorGadgetConfiguration;
+
+using namespace Core;
+
+class MonitorGadgetOptionsPage : public IOptionsPage {
+ Q_OBJECT
+
+public:
+ MonitorGadgetOptionsPage(MonitorGadgetConfiguration *config, QObject *parent = 0);
+ ~MonitorGadgetOptionsPage();
+
+ QWidget *createPage(QWidget *parent);
+ void apply();
+ void finish();
+
+private:
+};
+
+#endif // MONITORGADGETOPTIONSPAGE_H
diff --git a/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.cpp b/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.cpp
new file mode 100644
index 000000000..722869652
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.cpp
@@ -0,0 +1,300 @@
+#include "monitorwidget.h"
+
+#include
+
+#include
+#include
+#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);
+
+ QSvgRenderer *renderer = parent->renderer();
+
+ // 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());
+
+ 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);
+ }
+
+ QGraphicsTextItem *item = new QGraphicsTextItem();
+
+ 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));
+
+ qreal fontPointSizeF = elementRect.height();
+
+ 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());
+
+ // 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);
+
+#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();
+
+ 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;
+}
+} // anonymous namespace
+
+MonitorWidget::MonitorWidget(QWidget *parent) :
+ QGraphicsView(parent), aspectRatioMode(Qt::KeepAspectRatio)
+{
+ // setMinimumWidth(180);
+
+ QGraphicsScene *scene = new QGraphicsScene();
+
+ setScene(scene);
+
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
+
+ // no scroll bars
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ setBackgroundBrush(QBrush(Utils::StyleHelper::baseColor()));
+
+ setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
+
+ QSvgRenderer *renderer = new QSvgRenderer();
+
+ if (renderer->load(QString(":/telemetry/images/tx-rx.svg"))) {
+ // create graph
+ graph = new QGraphicsSvgItem();
+ graph->setSharedRenderer(renderer);
+ graph->setElementId("background");
+
+ graph->setFlags(QGraphicsItem::ItemClipsChildrenToShape | QGraphicsItem::ItemClipsToShape);
+
+ scene->addItem(graph);
+
+ int i;
+
+ // create tx nodes
+ i = 0;
+ while (true) {
+ QString id = QString("tx%0").arg(i);
+ QString bgId = QString("tx_bg%0").arg(i);
+ if (!renderer->elementExists(id) || !renderer->elementExists(bgId)) {
+ break;
+ }
+ QGraphicsSvgItem *item = createSvgItem(graph, bgId);
+ item->setElementId(id);
+ txNodes.append(item);
+ i++;
+ }
+
+ // create rx nodes
+ i = 0;
+ while (true) {
+ QString id = QString("rx%0").arg(i);
+ QString bgId = QString("rx_bg%0").arg(i);
+ if (!renderer->elementExists(id) || !renderer->elementExists(bgId)) {
+ break;
+ }
+ QGraphicsSvgItem *item = createSvgItem(graph, bgId);
+ item->setElementId(id);
+ rxNodes.append(item);
+ i++;
+ }
+
+ if (renderer->elementExists("txSpeed")) {
+ txSpeed = createTextItem(graph, "txSpeed", "Helvetica");
+ txSpeed->setDefaultTextColor(Qt::white);
+ } else {
+ txSpeed = NULL;
+ }
+
+ if (renderer->elementExists("rxSpeed")) {
+ rxSpeed = createTextItem(graph, "rxSpeed", "Helvetica");
+ rxSpeed->setDefaultTextColor(Qt::white);
+ } else {
+ rxSpeed = NULL;
+ }
+ // scene->setSceneRect(graph->boundingRect());
+ }
+
+ connected = false;
+
+ setMin(0.0);
+ setMax(1200.0);
+
+ telemetryUpdated(0.0, 0.0);
+}
+
+MonitorWidget::~MonitorWidget()
+{
+ while (!txNodes.isEmpty()) {
+ delete txNodes.takeFirst();
+ }
+ while (!rxNodes.isEmpty()) {
+ delete rxNodes.takeFirst();
+ }
+ if (txSpeed) {
+ delete txSpeed;
+ }
+ if (rxSpeed) {
+ delete rxSpeed;
+ }
+}
+
+/*!
+ \brief Enables/Disables OpenGL
+ */
+// void LineardialGadgetWidget::enableOpenGL(bool flag)
+// {
+// if (flag) {
+// setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+// } else {
+// setViewport(new QWidget);
+// }
+// }
+
+void MonitorWidget::telemetryConnected()
+{
+ qDebug() << "telemetry connected";
+ if (!connected) {
+ // flash the lights
+ setToolTip(tr("Connected"));
+ telemetryUpdated(maxValue, maxValue);
+ connected = true;
+ }
+}
+
+void MonitorWidget::telemetryDisconnected()
+{
+ qDebug() << "telemetry disconnected";
+ if (connected) {
+ connected = false;
+
+ setToolTip(tr("Disconnected"));
+
+ // flash the lights???
+ telemetryUpdated(maxValue, maxValue);
+
+ telemetryUpdated(0.0, 0.0);
+ }
+}
+
+/*!
+ \brief Called by the UAVObject which got updated
+
+ Updates the numeric value and/or the icon if the dial wants this.
+ */
+void MonitorWidget::telemetryUpdated(double txRate, double rxRate)
+{
+ double txIndex = (txRate - minValue) / (maxValue - minValue) * txNodes.count();
+ double rxIndex = (rxRate - minValue) / (maxValue - minValue) * rxNodes.count();
+
+ if (connected) {
+ this->setToolTip(QString("Tx: %0 bytes/s, Rx: %1 bytes/s").arg(txRate).arg(rxRate));
+ }
+
+ for (int i = 0; i < txNodes.count(); i++) {
+ QGraphicsItem *node = txNodes.at(i);
+ bool visible = ( /*connected &&*/ (i < txIndex));
+ if (visible != node->isVisible()) {
+ node->setVisible(visible);
+ node->update();
+ }
+ }
+
+ for (int i = 0; i < rxNodes.count(); i++) {
+ QGraphicsItem *node = rxNodes.at(i);
+ bool visible = ( /*connected &&*/ (i < rxIndex));
+ if (visible != node->isVisible()) {
+ node->setVisible(visible);
+ node->update();
+ }
+ }
+
+ if (txSpeed) {
+ if (connected) {
+ txSpeed->setPlainText(QString("%0").arg(txRate));
+ }
+ txSpeed->setVisible(connected);
+ txSpeed->update();
+ }
+
+ if (rxSpeed) {
+ if (connected) {
+ rxSpeed->setPlainText(QString("%0").arg(rxRate));
+ }
+ rxSpeed->setVisible(connected);
+ rxSpeed->update();
+ }
+
+ update();
+}
+
+void MonitorWidget::showEvent(QShowEvent *event)
+{
+ Q_UNUSED(event);
+
+ fitInView(graph, aspectRatioMode);
+}
+
+void MonitorWidget::resizeEvent(QResizeEvent *event)
+{
+ Q_UNUSED(event);
+
+ fitInView(graph, aspectRatioMode);
+}
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/telemetrymonitorwidget.h b/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.h
similarity index 59%
rename from ground/openpilotgcs/src/plugins/coreplugin/telemetrymonitorwidget.h
rename to ground/openpilotgcs/src/plugins/telemetry/monitorwidget.h
index b157d734d..729d25775 100644
--- a/ground/openpilotgcs/src/plugins/coreplugin/telemetrymonitorwidget.h
+++ b/ground/openpilotgcs/src/plugins/telemetry/monitorwidget.h
@@ -1,5 +1,5 @@
-#ifndef TELEMETRYMONITORWIDGET_H
-#define TELEMETRYMONITORWIDGET_H
+#ifndef MONITORWIDGET_H
+#define MONITORWIDGET_H
#include
#include
@@ -8,59 +8,56 @@
#include
#include
-class TelemetryMonitorWidget : public QGraphicsView {
+class MonitorWidget : public QGraphicsView {
Q_OBJECT
public:
- explicit TelemetryMonitorWidget(QWidget *parent = 0);
- ~TelemetryMonitorWidget();
+ explicit MonitorWidget(QWidget *parent = 0);
+ ~MonitorWidget();
void setMin(double min)
{
minValue = min;
}
+
double getMin()
{
return minValue;
}
+
void setMax(double max)
{
maxValue = max;
}
+
double getMax()
{
return maxValue;
}
- // number of tx/rx nodes in the graph
- static const int NODE_NUMELEM = 7;
-
-signals:
-
public slots:
- void connect();
- void disconnect();
-
- void updateTelemetry(double txRate, double rxRate);
- void showTelemetry();
+ void telemetryConnected();
+ void telemetryDisconnected();
+ void telemetryUpdated(double txRate, double rxRate);
protected:
void showEvent(QShowEvent *event);
void resizeEvent(QResizeEvent *event);
private:
+ bool connected;
+
+ double minValue;
+ double maxValue;
+
QGraphicsSvgItem *graph;
+
QPointer txSpeed;
QPointer rxSpeed;
+
QList txNodes;
QList rxNodes;
- bool connected;
- double txIndex;
- double txValue;
- double rxIndex;
- double rxValue;
- double minValue;
- double maxValue;
+ Qt::AspectRatioMode aspectRatioMode;
};
-#endif // TELEMETRYMONITORWIDGET_H
+#endif // MONITORWIDGET_H
diff --git a/ground/openpilotgcs/src/plugins/telemetry/telemetry.pri b/ground/openpilotgcs/src/plugins/telemetry/telemetry.pri
new file mode 100644
index 000000000..c5054c34f
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/telemetry.pri
@@ -0,0 +1,3 @@
+include(telemetry_dependencies.pri)
+
+LIBS *= -l$$qtLibraryName(Telemetry)
diff --git a/ground/openpilotgcs/src/plugins/telemetry/telemetry.pro b/ground/openpilotgcs/src/plugins/telemetry/telemetry.pro
new file mode 100644
index 000000000..f8e4d2331
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/telemetry.pro
@@ -0,0 +1,29 @@
+TEMPLATE = lib
+TARGET = Telemetry
+
+QT += svg
+
+include(../../openpilotgcsplugin.pri)
+include(../../plugins/coreplugin/coreplugin.pri)
+include(telemetry_dependencies.pri)
+
+HEADERS += telemetry_global.h \
+ telemetryplugin.h \
+ monitorwidget.h \
+ monitorgadgetconfiguration.h \
+ monitorgadget.h \
+ monitorgadgetfactory.h \
+ monitorgadgetoptionspage.h
+
+SOURCES += telemetryplugin.cpp \
+ monitorwidget.cpp \
+ monitorgadgetconfiguration.cpp \
+ monitorgadget.cpp \
+ monitorgadgetfactory.cpp \
+ monitorgadgetoptionspage.cpp
+
+DEFINES += TELEMETRY_LIBRARY
+
+RESOURCES += telemetry.qrc
+
+OTHER_FILES += Telemetry.pluginspec
diff --git a/ground/openpilotgcs/src/plugins/telemetry/telemetry.qrc b/ground/openpilotgcs/src/plugins/telemetry/telemetry.qrc
new file mode 100644
index 000000000..a21691073
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/telemetry.qrc
@@ -0,0 +1,5 @@
+
+
+ images/tx-rx.svg
+
+
diff --git a/ground/openpilotgcs/src/plugins/telemetry/telemetry_dependencies.pri b/ground/openpilotgcs/src/plugins/telemetry/telemetry_dependencies.pri
new file mode 100644
index 000000000..883e47127
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/telemetry_dependencies.pri
@@ -0,0 +1,3 @@
+include(../../plugins/uavtalk/uavtalk.pri)
+include(../../plugins/uavobjects/uavobjects.pri)
+
diff --git a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h b/ground/openpilotgcs/src/plugins/telemetry/telemetry_global.h
similarity index 68%
rename from ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h
rename to ground/openpilotgcs/src/plugins/telemetry/telemetry_global.h
index 58fd217b7..ee868c9e5 100644
--- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h
+++ b/ground/openpilotgcs/src/plugins/telemetry/telemetry_global.h
@@ -1,14 +1,13 @@
/**
******************************************************************************
*
- * @file versiondialog.h
+ * @file telemetry_global.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
- * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @addtogroup GCSPlugins GCS Plugins
* @{
- * @addtogroup CorePlugin Core Plugin
+ * @addtogroup TelemetryPlugin Telemetry Plugin
* @{
- * @brief The Core GCS plugin
+ * @brief The Telemetry plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
@@ -26,19 +25,15 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef VERSIONDIALOG_H
-#define VERSIONDIALOG_H
+#ifndef TELEMETRY_GLOBAL_H
+#define TELEMETRY_GLOBAL_H
-#include
+#include
-namespace Core {
-namespace Internal {
-class VersionDialog : public QDialog {
- Q_OBJECT
-public:
- explicit VersionDialog(QWidget *parent);
-};
-} // namespace Internal
-} // namespace Core
+#if defined(TELEMETRY_LIBRARY)
+# define TELEMETRY_EXPORT Q_DECL_EXPORT
+#else
+# define TELEMETRY_EXPORT Q_DECL_IMPORT
+#endif
-#endif // VERSIONDIALOG_H
+#endif // TELEMETRY_GLOBAL_H
diff --git a/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.cpp b/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.cpp
new file mode 100644
index 000000000..4a68a2734
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.cpp
@@ -0,0 +1,246 @@
+/**
+ ******************************************************************************
+ *
+ * @file telemetryplugin.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @brief
+ * @see The GNU Public License (GPL) Version 3
+ * @defgroup telemetryplugin
+ * @{
+ *
+ *****************************************************************************/
+/*
+ * 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 "telemetryplugin.h"
+#include "monitorgadgetfactory.h"
+
+#include "extensionsystem/pluginmanager.h"
+#include "uavobjectmanager.h"
+#include "uavobject.h"
+#include "coreplugin/icore.h"
+#include "coreplugin/connectionmanager.h"
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+TelemetryPlugin::TelemetryPlugin()
+{}
+
+TelemetryPlugin::~TelemetryPlugin()
+{
+// Core::ICore::instance()->saveSettings(this);
+}
+
+bool TelemetryPlugin::initialize(const QStringList & args, QString *errMsg)
+{
+ Q_UNUSED(args);
+ Q_UNUSED(errMsg);
+
+ MonitorGadgetFactory *mf = new MonitorGadgetFactory(this);
+ addAutoReleasedObject(mf);
+
+ // 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);
+
+ // no border
+ w->setFrameStyle(QFrame::NoFrame);
+ w->setWindowFlags(Qt::FramelessWindowHint);
+
+ // set svg background translucent
+ w->setStyleSheet("background:transparent;");
+ // set widget background translucent
+ w->setAttribute(Qt::WA_TranslucentBackground);
+
+ w->setBackgroundBrush(Qt::NoBrush);
+
+ // 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()));
+
+ cm->addWidget(w);
+
+ return true;
+}
+
+void TelemetryPlugin::extensionsInitialized()
+{
+// Core::ICore::instance()->readSettings(this);
+
+ // ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+
+// connect(pm, SIGNAL(objectAdded(QObject *)), this, SLOT(onTelemetryManagerAdded(QObject *)));
+// _toRemoveNotifications.clear();
+// connectNotifications();
+}
+
+// void TelemetryPlugin::saveConfig(QSettings *settings, UAVConfigInfo *configInfo)
+// {
+// configInfo->setVersion(VERSION);
+//
+// settings->beginWriteArray("Current");
+// settings->setArrayIndex(0);
+// currentNotification.saveState(settings);
+// settings->endArray();
+//
+// 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);
+// }
+
+// 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();
+//
+//// 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::shutdown()
+{
+ // Do nothing
+}
+
+// void TelemetryPlugin::onAutopilotDisconnect()
+// {
+// connectNotifications();
+// }
+
+///*!
+// 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::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;
+// }
+//
+// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+// UAVObjectManager *objManager = pm->getObject();
+//
+// 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;
+//
+// 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);
+//
+// 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)));
+// }
diff --git a/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.h b/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.h
new file mode 100644
index 000000000..300c08ad7
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/telemetry/telemetryplugin.h
@@ -0,0 +1,51 @@
+/**
+ ******************************************************************************
+ *
+ * @file telemetryplugin.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
+ * @brief
+ * @see The GNU Public License (GPL) Version 3
+ * @defgroup telemetryplugin
+ * @{
+ *
+ *****************************************************************************/
+/*
+ * 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 TELEMETRYPLUGIN_H
+#define TELEMETRYPLUGIN_H
+
+#include
+
+class MonitorGadgetFactory;
+
+class TelemetryPlugin : public ExtensionSystem::IPlugin {
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "OpenPilot.Telemetry")
+
+
+public:
+ TelemetryPlugin();
+ ~TelemetryPlugin();
+
+ void extensionsInitialized();
+ bool initialize(const QStringList &arguments, QString *errorString);
+ void shutdown();
+
+private:
+ MonitorGadgetFactory *mf;
+};
+
+#endif // TELEMETRYPLUGIN_H
diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h
index cbdab0cb5..31cf9ecb3 100644
--- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h
+++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/fieldtreeitem.h
@@ -115,6 +115,8 @@ public:
{
QComboBox *editor = new QComboBox(parent);
+ // Setting ClickFocus lets the ComboBox stay open on Mac OSX.
+ editor->setFocusPolicy(Qt::ClickFocus);
foreach(QString option, m_enumOptions)
editor->addItem(option);
return editor;
diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp
index 92c6d8c3b..80e4d5ed6 100644
--- a/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp
+++ b/ground/openpilotgcs/src/plugins/uavobjects/uavmetaobject.cpp
@@ -39,7 +39,7 @@ UAVMetaObject::UAVMetaObject(quint32 objID, const QString & name, UAVObject *par
UAVObject::MetadataInitialize(ownMetadata);
// Setup fields
QStringList modesBitField;
- modesBitField << tr("FlightReadOnly") << tr("GCSReadOnly") << tr("FlightTelemetryAcked") << tr("GCSTelemetryAcked") << tr("FlightUpdatePeriodic") << tr("FlightUpdateOnChange") << tr("GCSUpdatePeriodic") << tr("GCSUpdateOnChange");
+ modesBitField << tr("FlightReadOnly") << tr("GCSReadOnly") << tr("FlightTelemetryAcked") << tr("GCSTelemetryAcked") << tr("FlightUpdatePeriodic") << tr("FlightUpdateOnChange") << tr("GCSUpdatePeriodic") << tr("GCSUpdateOnChange") << tr("LoggingUpdatePeriodic") << tr("LoggingUpdateOnChange");
QList fields;
fields.append(new UAVObjectField(tr("Modes"), tr("boolean"), UAVObjectField::BITFIELD, modesBitField, QStringList()));
fields.append(new UAVObjectField(tr("Flight Telemetry Update Period"), tr("ms"), UAVObjectField::UINT16, 1, QStringList()));
diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp
index d795e8cb3..7f6c02a15 100644
--- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp
+++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp
@@ -36,6 +36,7 @@
#define UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT 3
#define UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT 4
#define UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT 6
+#define UAVOBJ_LOGGING_UPDATE_MODE_SHIFT 8
#define UAVOBJ_UPDATE_MODE_MASK 0x3
// Macros
@@ -498,7 +499,8 @@ void UAVObject::MetadataInitialize(UAVObject::Metadata & metadata)
1 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
UPDATEMODE_ONCHANGE << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
- UPDATEMODE_ONCHANGE << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
+ UPDATEMODE_ONCHANGE << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT |
+ UPDATEMODE_ONCHANGE << UAVOBJ_LOGGING_UPDATE_MODE_SHIFT;
metadata.flightTelemetryUpdatePeriod = 0;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.loggingUpdatePeriod = 0;
diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp.template b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp.template
index df78735bb..a91754136 100644
--- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp.template
+++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.cpp.template
@@ -71,7 +71,8 @@ UAVObject::Metadata $(NAME)::getDefaultMetadata()
$(FLIGHTTELEM_ACKED) << UAVOBJ_TELEMETRY_ACKED_SHIFT |
$(GCSTELEM_ACKED) << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
$(FLIGHTTELEM_UPDATEMODE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
- $(GCSTELEM_UPDATEMODE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
+ $(GCSTELEM_UPDATEMODE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT |
+ $(LOGGING_UPDATEMODE) << UAVOBJ_LOGGING_UPDATE_MODE_SHIFT;
metadata.flightTelemetryUpdatePeriod = $(FLIGHTTELEM_UPDATEPERIOD);
metadata.gcsTelemetryUpdatePeriod = $(GCSTELEM_UPDATEPERIOD);
metadata.loggingUpdatePeriod = $(LOGGING_UPDATEPERIOD);
diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h
index 882378e7a..c7d9941d2 100644
--- a/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h
+++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobject.h
@@ -45,6 +45,7 @@
#define UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT 3
#define UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT 4
#define UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT 6
+#define UAVOBJ_LOGGING_UPDATE_MODE_SHIFT 8
#define UAVOBJ_UPDATE_MODE_MASK 0x3
class UAVObjectField;
@@ -87,9 +88,10 @@ public:
* 3 gcsTelemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked)
* 4-5 telemetryUpdateMode Update mode used by the telemetry module (UAVObjUpdateMode)
* 6-7 gcsTelemetryUpdateMode Update mode used by the GCS (UAVObjUpdateMode)
+ * 8-9 loggingUpdateMode Update mode used by the logging module (UAVObjUpdateMode)
*/
typedef struct {
- quint8 flags; /** Defines flags for update and logging modes and whether an update should be ACK'd (bits defined above) */
+ quint16 flags; /** Defines flags for update and logging modes and whether an update should be ACK'd (bits defined above) */
quint16 flightTelemetryUpdatePeriod; /** Update period used by the telemetry module (only if telemetry mode is PERIODIC) */
quint16 gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */
quint16 loggingUpdatePeriod; /** Update period used by the logging module (only if logging mode is PERIODIC) */
diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.cpp
new file mode 100644
index 000000000..25ff5f805
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.cpp
@@ -0,0 +1,100 @@
+/**
+ ******************************************************************************
+ *
+ * @file uavobjecthelper.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
+ * @addtogroup [Group]
+ * @{
+ * @addtogroup UAVObjectHelper
+ * @{
+ * @brief [Brief]
+ *****************************************************************************/
+/*
+ * 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 "uavobjecthelper.h"
+#include
+
+AbstractUAVObjectHelper::AbstractUAVObjectHelper(QObject *parent) :
+ QObject(parent), m_transactionResult(false), m_transactionCompleted(false)
+{}
+
+AbstractUAVObjectHelper::Result AbstractUAVObjectHelper::doObjectAndWait(UAVObject *object, int timeout)
+{
+ // Lock, we can't call this twice from different threads
+ QMutexLocker locker(&m_mutex);
+
+ m_object = object;
+
+ // Reset variables
+ m_transactionResult = false;
+ m_transactionCompleted = false;
+
+ // Create timer and connect it, connect object tx completed to local slot
+ QTimer timeoutTimer;
+ timeoutTimer.setSingleShot(true);
+ connect(&timeoutTimer, SIGNAL(timeout()), &m_eventLoop, SLOT(quit()));
+ connect(object, SIGNAL(transactionCompleted(UAVObject *, bool)), this, SLOT(transactionCompleted(UAVObject *, bool)));
+
+ // Start timeout timer
+ timeoutTimer.start(timeout);
+
+ // Call the actual implementation in concrete subclass
+ doObjectAndWaitImpl();
+
+ // Wait if not completed
+ if (!m_transactionCompleted) {
+ m_eventLoop.exec();
+ }
+ timeoutTimer.stop();
+
+ // Disconnect
+ disconnect(object, SIGNAL(transactionCompleted(UAVObject *, bool)), this, SLOT(transactionCompleted(UAVObject *, bool)));
+ disconnect(&timeoutTimer, SIGNAL(timeout()), &m_eventLoop, SLOT(quit()));
+
+ // Return result
+ if (!m_transactionCompleted) {
+ return TIMEOUT;
+ } else {
+ return m_transactionResult ? SUCCESS : FAIL;
+ }
+}
+
+void AbstractUAVObjectHelper::transactionCompleted(UAVObject *object, bool success)
+{
+ Q_UNUSED(object)
+
+ // Set variables and quit event loop
+ m_transactionResult = success;
+ m_transactionCompleted = true;
+ m_eventLoop.quit();
+}
+
+UAVObjectUpdaterHelper::UAVObjectUpdaterHelper(QObject *parent) : AbstractUAVObjectHelper(parent)
+{}
+
+void UAVObjectUpdaterHelper::doObjectAndWaitImpl()
+{
+ m_object->updated();
+}
+
+UAVObjectRequestHelper::UAVObjectRequestHelper(QObject *parent) : AbstractUAVObjectHelper(parent)
+{}
+
+void UAVObjectRequestHelper::doObjectAndWaitImpl()
+{
+ m_object->requestUpdate();
+}
diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.h
new file mode 100644
index 000000000..bf2739e09
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecthelper.h
@@ -0,0 +1,78 @@
+/**
+ ******************************************************************************
+ *
+ * @file uavobjecthelper.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
+ * @addtogroup [Group]
+ * @{
+ * @addtogroup UAVObjectHelper
+ * @{
+ * @brief [Brief]
+ *****************************************************************************/
+/*
+ * 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 UAVOBJECTHELPER_H
+#define UAVOBJECTHELPER_H
+
+#include
+#include
+#include
+#include
+
+#include "uavobject.h"
+
+class UAVOBJECTS_EXPORT AbstractUAVObjectHelper : public QObject {
+ Q_OBJECT
+public:
+ explicit AbstractUAVObjectHelper(QObject *parent = 0);
+
+ enum Result { SUCCESS, FAIL, TIMEOUT };
+ Result doObjectAndWait(UAVObject *object, int timeout);
+
+protected:
+ virtual void doObjectAndWaitImpl() = 0;
+ UAVObject *m_object;
+
+private slots:
+ void transactionCompleted(UAVObject *object, bool success);
+
+private:
+ QMutex m_mutex;
+ QEventLoop m_eventLoop;
+ bool m_transactionResult;
+ bool m_transactionCompleted;
+};
+
+class UAVOBJECTS_EXPORT UAVObjectUpdaterHelper : public AbstractUAVObjectHelper {
+ Q_OBJECT
+public:
+ explicit UAVObjectUpdaterHelper(QObject *parent = 0);
+
+protected:
+ virtual void doObjectAndWaitImpl();
+};
+
+class UAVOBJECTS_EXPORT UAVObjectRequestHelper : public AbstractUAVObjectHelper {
+ Q_OBJECT
+public:
+ explicit UAVObjectRequestHelper(QObject *parent = 0);
+
+protected:
+ virtual void doObjectAndWaitImpl();
+};
+
+#endif // UAVOBJECTHELPER_H
diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro
index 44b96a580..d1b002994 100644
--- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro
+++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro
@@ -11,14 +11,16 @@ HEADERS += uavobjects_global.h \
uavdataobject.h \
uavobjectfield.h \
uavobjectsinit.h \
- uavobjectsplugin.h
+ uavobjectsplugin.h \
+ uavobjecthelper.h
SOURCES += uavobject.cpp \
uavmetaobject.cpp \
uavobjectmanager.cpp \
uavdataobject.cpp \
uavobjectfield.cpp \
- uavobjectsplugin.cpp
+ uavobjectsplugin.cpp \
+ uavobjecthelper.cpp
OTHER_FILES += UAVObjects.pluginspec
@@ -34,6 +36,10 @@ HEADERS += $$UAVOBJECT_SYNTHETICS/accessorydesired.h \
$$UAVOBJECT_SYNTHETICS/altitudeholddesired.h \
$$UAVOBJECT_SYNTHETICS/altitudeholdsettings.h \
$$UAVOBJECT_SYNTHETICS/altitudefiltersettings.h \
+ $$UAVOBJECT_SYNTHETICS/debuglogsettings.h \
+ $$UAVOBJECT_SYNTHETICS/debuglogcontrol.h \
+ $$UAVOBJECT_SYNTHETICS/debuglogstatus.h \
+ $$UAVOBJECT_SYNTHETICS/debuglogentry.h \
$$UAVOBJECT_SYNTHETICS/ekfconfiguration.h \
$$UAVOBJECT_SYNTHETICS/ekfstatevariance.h \
$$UAVOBJECT_SYNTHETICS/revocalibration.h \
@@ -120,6 +126,10 @@ SOURCES += $$UAVOBJECT_SYNTHETICS/accessorydesired.cpp \
$$UAVOBJECT_SYNTHETICS/altholdsmoothed.cpp \
$$UAVOBJECT_SYNTHETICS/altitudeholddesired.cpp \
$$UAVOBJECT_SYNTHETICS/altitudeholdsettings.cpp \
+ $$UAVOBJECT_SYNTHETICS/debuglogsettings.cpp \
+ $$UAVOBJECT_SYNTHETICS/debuglogcontrol.cpp \
+ $$UAVOBJECT_SYNTHETICS/debuglogstatus.cpp \
+ $$UAVOBJECT_SYNTHETICS/debuglogentry.cpp \
$$UAVOBJECT_SYNTHETICS/altitudefiltersettings.cpp \
$$UAVOBJECT_SYNTHETICS/ekfconfiguration.cpp \
$$UAVOBJECT_SYNTHETICS/ekfstatevariance.cpp \
diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp
index 008e3af73..3eeb7e5a8 100644
--- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp
+++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.cpp
@@ -64,9 +64,9 @@ void TelemetryManager::onStart()
telemetryMon = new TelemetryMonitor(objMngr, telemetry);
connect(telemetryMon, SIGNAL(connected()), this, SLOT(onConnect()));
connect(telemetryMon, SIGNAL(disconnected()), this, SLOT(onDisconnect()));
+ connect(telemetryMon, SIGNAL(telemetryUpdated(double, double)), this, SLOT(onTelemetryUpdate(double, double)));
}
-
void TelemetryManager::stop()
{
emit myStop();
@@ -92,3 +92,8 @@ void TelemetryManager::onDisconnect()
autopilotConnected = false;
emit disconnected();
}
+
+void TelemetryManager::onTelemetryUpdate(double txRate, double rxRate)
+{
+ emit telemetryUpdated(txRate, rxRate);
+}
diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.h b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.h
index c4e7301ec..be956bf4f 100644
--- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.h
+++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymanager.h
@@ -50,12 +50,14 @@ public:
signals:
void connected();
void disconnected();
+ void telemetryUpdated(double txRate, double rxRate);
void myStart();
void myStop();
private slots:
void onConnect();
void onDisconnect();
+ void onTelemetryUpdate(double txRate, double rxRate);
void onStart();
void onStop();
diff --git a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp
index 9bfe7cf7d..8342d5001 100644
--- a/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp
+++ b/ground/openpilotgcs/src/plugins/uavtalk/telemetrymonitor.cpp
@@ -49,11 +49,6 @@ TelemetryMonitor::TelemetryMonitor(UAVObjectManager *objMngr, Telemetry *tel) :
// Start update timer
connect(statsTimer, SIGNAL(timeout()), this, SLOT(processStatsUpdates()));
statsTimer->start(STATS_CONNECT_PERIOD_MS);
-
- Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
- connect(this, SIGNAL(connected()), cm, SLOT(telemetryConnected()));
- connect(this, SIGNAL(disconnected()), cm, SLOT(telemetryDisconnected()));
- connect(this, SIGNAL(telemetryUpdated(double, double)), cm, SLOT(telemetryUpdated(double, double)));
}
TelemetryMonitor::~TelemetryMonitor()
diff --git a/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.pro b/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.pro
index 731cdf0ed..64fd2289e 100644
--- a/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.pro
+++ b/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.pro
@@ -1,18 +1,24 @@
-QT += network
TEMPLATE = lib
TARGET = UAVTalk
+
+QT += network
+
include(../../openpilotgcsplugin.pri)
include(uavtalk_dependencies.pri)
+
HEADERS += uavtalk.h \
uavtalkplugin.h \
telemetrymonitor.h \
telemetrymanager.h \
uavtalk_global.h \
telemetry.h
+
SOURCES += uavtalk.cpp \
uavtalkplugin.cpp \
telemetrymonitor.cpp \
telemetrymanager.cpp \
telemetry.cpp
+
DEFINES += UAVTALK_LIBRARY
+
OTHER_FILES += UAVTalk.pluginspec
diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/ActivityPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/ActivityPanel.qml
index 111c4d7e9..fdc258500 100644
--- a/ground/openpilotgcs/src/plugins/welcome/qml/ActivityPanel.qml
+++ b/ground/openpilotgcs/src/plugins/welcome/qml/ActivityPanel.qml
@@ -1,4 +1,5 @@
-import QtQuick 1.1
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
Item {
id: container
diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/CommunityPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/CommunityPanel.qml
index caa3678b2..20f19fd70 100644
--- a/ground/openpilotgcs/src/plugins/welcome/qml/CommunityPanel.qml
+++ b/ground/openpilotgcs/src/plugins/welcome/qml/CommunityPanel.qml
@@ -1,5 +1,5 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 1.1
+import QtQuick 2.0
Item {
property alias sourceSize: background.sourceSize
diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml
index 6d794b210..0e6a8ef99 100644
--- a/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml
+++ b/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml
@@ -1,5 +1,6 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 1.1
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
Item {
id: container
diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/ScrollDecorator.qml b/ground/openpilotgcs/src/plugins/welcome/qml/ScrollDecorator.qml
index 24c79c927..5e4e7e8d9 100644
--- a/ground/openpilotgcs/src/plugins/welcome/qml/ScrollDecorator.qml
+++ b/ground/openpilotgcs/src/plugins/welcome/qml/ScrollDecorator.qml
@@ -1,4 +1,4 @@
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
id: scrollDecorator
diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml
index c94f243e2..00f2e3664 100644
--- a/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml
+++ b/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml
@@ -1,5 +1,5 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 1.1
+import QtQuick 2.0
Item {
id: container
diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml b/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml
index 9e5c1a74f..618baee73 100644
--- a/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml
+++ b/ground/openpilotgcs/src/plugins/welcome/qml/WelcomePageButton.qml
@@ -1,5 +1,5 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 1.1
+import QtQuick 2.0
Item {
id: welcomeButton
diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/main.qml b/ground/openpilotgcs/src/plugins/welcome/qml/main.qml
index 82e7b1064..7a58a8fa3 100644
--- a/ground/openpilotgcs/src/plugins/welcome/qml/main.qml
+++ b/ground/openpilotgcs/src/plugins/welcome/qml/main.qml
@@ -1,4 +1,4 @@
-import QtQuick 1.1
+import QtQuick 2.0
Rectangle {
id: container
diff --git a/ground/openpilotgcs/src/plugins/welcome/welcome.pro b/ground/openpilotgcs/src/plugins/welcome/welcome.pro
index eb44bc8da..40eba229c 100644
--- a/ground/openpilotgcs/src/plugins/welcome/welcome.pro
+++ b/ground/openpilotgcs/src/plugins/welcome/welcome.pro
@@ -1,6 +1,6 @@
TEMPLATE = lib
TARGET = Welcome
-QT += network declarative
+QT += network qml quick
include(../../openpilotgcsplugin.pri)
include(welcome_dependencies.pri)
diff --git a/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp b/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp
index 501c4ba7a..381fd226a 100644
--- a/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp
+++ b/ground/openpilotgcs/src/plugins/welcome/welcomemode.cpp
@@ -45,10 +45,10 @@
#include
#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
#include
@@ -59,7 +59,7 @@ namespace Welcome {
struct WelcomeModePrivate {
WelcomeModePrivate();
- QDeclarativeView *declarativeView;
+ QQuickView *quickView;
};
WelcomeModePrivate::WelcomeModePrivate()
@@ -70,15 +70,16 @@ WelcomeMode::WelcomeMode() :
m_d(new WelcomeModePrivate),
m_priority(Core::Constants::P_MODE_WELCOME)
{
- m_d->declarativeView = new QDeclarativeView;
- m_d->declarativeView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
- m_d->declarativeView->engine()->rootContext()->setContextProperty("welcomePlugin", this);
- m_d->declarativeView->setSource(QUrl("qrc:/welcome/qml/main.qml"));
+ m_d->quickView = new QQuickView;
+ m_d->quickView->setResizeMode(QQuickView::SizeRootObjectToView);
+ m_d->quickView->engine()->rootContext()->setContextProperty("welcomePlugin", this);
+ m_d->quickView->setSource(QUrl("qrc:/welcome/qml/main.qml"));
+ m_container = NULL;
}
WelcomeMode::~WelcomeMode()
{
- delete m_d->declarativeView;
+ delete m_d->quickView;
delete m_d;
}
@@ -99,7 +100,12 @@ int WelcomeMode::priority() const
QWidget *WelcomeMode::widget()
{
- return m_d->declarativeView;
+ if (!m_container) {
+ m_container = QWidget::createWindowContainer(m_d->quickView);
+ m_container->setMinimumSize(64, 64);
+ m_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ }
+ return m_container;
}
const char *WelcomeMode::uniqueModeName() const
diff --git a/ground/openpilotgcs/src/plugins/welcome/welcomemode.h b/ground/openpilotgcs/src/plugins/welcome/welcomemode.h
index fa3f22856..b6e837cc9 100644
--- a/ground/openpilotgcs/src/plugins/welcome/welcomemode.h
+++ b/ground/openpilotgcs/src/plugins/welcome/welcomemode.h
@@ -72,6 +72,7 @@ public slots:
void triggerAction(const QString &actionId);
private:
+ QWidget *m_container;
WelcomeModePrivate *m_d;
int m_priority;
};
diff --git a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp
index 2b1eb5d14..7265d411a 100644
--- a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp
+++ b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp
@@ -127,6 +127,9 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *info)
type = fieldTypeStrCPP[field->type];
// Append field
if (field->numElements > 1) {
+ // add both field(elementIndex)/setField(elemntIndex,value) and field_element properties
+ // field_element is more convenient if only certain element is used
+ // and much easier to use from the qml side
propertyGetters +=
QString(" Q_INVOKABLE %1 get%2(quint32 index) const;\n")
.arg(type).arg(field->name);
@@ -153,6 +156,42 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *info)
propertyNotifications +=
QString(" void %1Changed(quint32 index, %2 value);\n")
.arg(field->name).arg(type);
+
+ for (int elementIndex = 0; elementIndex < field->numElements; elementIndex++) {
+ QString elementName = field->elementNames[elementIndex];
+ properties += QString(" Q_PROPERTY(%1 %2 READ get%2 WRITE set%2 NOTIFY %2Changed);\n")
+ .arg(type).arg(field->name + "_" + elementName);
+ propertyGetters +=
+ QString(" Q_INVOKABLE %1 get%2_%3() const;\n")
+ .arg(type).arg(field->name).arg(elementName);
+ propertiesImpl +=
+ QString("%1 %2::get%3_%4() const\n"
+ "{\n"
+ " QMutexLocker locker(mutex);\n"
+ " return data.%3[%5];\n"
+ "}\n")
+ .arg(type).arg(info->name).arg(field->name).arg(elementName).arg(elementIndex);
+ propertySetters +=
+ QString(" void set%1_%2(%3 value);\n")
+ .arg(field->name).arg(elementName).arg(type);
+ propertiesImpl +=
+ QString("void %1::set%2_%3(%4 value)\n"
+ "{\n"
+ " mutex->lock();\n"
+ " bool changed = data.%2[%5] != value;\n"
+ " data.%2[%5] = value;\n"
+ " mutex->unlock();\n"
+ " if (changed) emit %2_%3Changed(value);\n"
+ "}\n\n")
+ .arg(info->name).arg(field->name).arg(elementName).arg(type).arg(elementIndex);
+ propertyNotifications +=
+ QString(" void %1_%2Changed(%3 value);\n")
+ .arg(field->name).arg(elementName).arg(type);
+ propertyNotificationsImpl +=
+ QString(" //if (data.%1[%2] != oldData.%1[%2])\n"
+ " emit %1_%3Changed(data.%1[%2]);\n")
+ .arg(field->name).arg(elementIndex).arg(elementName);
+ }
} else {
properties += QString(" Q_PROPERTY(%1 %2 READ get%2 WRITE set%2 NOTIFY %2Changed);\n")
.arg(type).arg(field->name);
diff --git a/make/apps-defs.mk b/make/apps-defs.mk
index 54e2e991e..b326b218d 100644
--- a/make/apps-defs.mk
+++ b/make/apps-defs.mk
@@ -81,6 +81,7 @@ SRC += $(PIOSCOMMON)/pios_com_msg.c
SRC += $(PIOSCOMMON)/pios_crc.c
SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c
SRC += $(PIOSCOMMON)/pios_flash_jedec.c
+SRC += $(PIOSCOMMON)/pios_debuglog.c
SRC += $(PIOSCOMMON)/pios_rcvr.c
SRC += $(PIOSCOMMON)/pios_rfm22b.c
SRC += $(PIOSCOMMON)/pios_rfm22b_com.c
@@ -102,6 +103,7 @@ SRC += $(FLIGHTLIB)/sanitycheck.c
SRC += $(FLIGHTLIB)/CoordinateConversions.c
SRC += $(MATHLIB)/sin_lookup.c
SRC += $(MATHLIB)/pid.c
+SRC += $(FLIGHTLIB)/printf-stdarg.c
## Modules
SRC += $(foreach mod, $(MODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c)))
diff --git a/make/tools.mk b/make/tools.mk
index 806365e9b..addc6ef61 100644
--- a/make/tools.mk
+++ b/make/tools.mk
@@ -12,6 +12,7 @@
# mingw_install (Windows only - NOT USED for Qt-5.1.x)
# python_install (Windows only - NOT USED for Qt-5.1.x)
# nsis_install (Windows only)
+# openssl_install (Windows only)
# uncrustify_install
# doxygen_install
# gtest_install
@@ -77,6 +78,7 @@ else ifeq ($(UNAME), Windows)
ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2013q1-20130313-windows.tar.bz2
QT_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/qt-5.1.1-windows.tar.bz2
NSIS_URL := http://wiki.openpilot.org/download/attachments/18612236/nsis-2.46-unicode.tar.bz2
+ OPENSSL_URL := http://wiki.openpilot.org/download/attachments/18612236/openssl-1.0.1e-win32.tar.bz2
UNCRUSTIFY_URL := http://wiki.openpilot.org/download/attachments/18612236/uncrustify-0.60-windows.tar.bz2
DOXYGEN_URL := http://wiki.openpilot.org/download/attachments/18612236/doxygen-1.8.3.1-windows.tar.bz2
endif
@@ -89,11 +91,13 @@ QT_SDK_DIR := $(TOOLS_DIR)/qt-5.1.1
MINGW_DIR := $(QT_SDK_DIR)/Tools/mingw48_32
PYTHON_DIR := $(QT_SDK_DIR)/Tools/mingw48_32/opt/bin
NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode
+OPENSSL_DIR := $(TOOLS_DIR)/openssl-1.0.1e-win32
UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.60
DOXYGEN_DIR := $(TOOLS_DIR)/doxygen-1.8.3.1
GTEST_DIR := $(TOOLS_DIR)/gtest-1.6.0
QT_SDK_PREFIX := $(QT_SDK_DIR)
+
##############################
#
# Build only and all toolchains available for the platform
@@ -102,7 +106,7 @@ QT_SDK_PREFIX := $(QT_SDK_DIR)
BUILD_SDK_TARGETS := arm_sdk qt_sdk
ifeq ($(UNAME), Windows)
- BUILD_SDK_TARGETS += mingw python nsis
+ BUILD_SDK_TARGETS += mingw python nsis openssl
endif
ALL_SDK_TARGETS := $(BUILD_SDK_TARGETS) gtest uncrustify doxygen
@@ -223,6 +227,7 @@ endif
# $(2) = string compare operator, e.g. = or !=
#
##############################
+
define MD5_CHECK_TEMPLATE
"`test -f \"$(1)\" && $(OPENSSL) dgst -md5 \"$(1)\" | $(CUT) -f2 -d' '`" $(2) "`$(CUT) -f1 -d' ' < \"$(1).md5\"`"
endef
@@ -526,7 +531,7 @@ python_version:
##############################
#
-# NSIS Unicode
+# NSIS Unicode (Windows only)
#
##############################
@@ -548,6 +553,25 @@ nsis_version:
endif
+##############################
+#
+# OpenSSL (Windows only)
+#
+##############################
+
+ifeq ($(UNAME), Windows)
+
+$(eval $(call TOOL_INSTALL_TEMPLATE,openssl,$(OPENSSL_DIR),$(OPENSSL_URL),$(notdir $(OPENSSL_URL))))
+
+ifeq ($(shell [ -d "$(OPENSSL_DIR)" ] && $(ECHO) "exists"), exists)
+ export OPENSSL := $(OPENSSL_DIR)
+else
+ # not installed, hope it's in the path...
+ # $(info $(EMPTY) WARNING $(call toprel, $(OPENSSL_DIR)) not found (make openssl_install), using system PATH)
+endif
+
+endif
+
##############################
#
# Uncrustify
diff --git a/make/winx86/README.txt b/make/winx86/README.txt
index 3bc070ee1..1dc0a1668 100644
--- a/make/winx86/README.txt
+++ b/make/winx86/README.txt
@@ -27,7 +27,7 @@ OpenPilot.
------------------
Fortunately, it requires only few small text files since all others components
should already be installed on your system as parts of msysGit, QtSDK and
-CodeSourcery G++ packages required to build the OpenPilot.
+Arm compiler packages required to build the OpenPilot.
It is expected that you have the following tools installed into the listed
locations (but any other locations are fine as well):
@@ -39,8 +39,8 @@ locations (but any other locations are fine as well):
- Unicode NSIS in %ProgramFiles%\NSIS\Unicode
- OpenOCD in C:\OpenOCD\0.4.0\bin (optional)
-The SDL library and headers should be installed into Qt directories to build
-the GCS. Check the wiki or ground/openpilotgcs/copydata.pro for details.
+The SDL and SSL libraries and headers should be installed into Qt directories to
+build the GCS. Check the wiki or ground/openpilotgcs/copydata.pro for details.
Also it is assumed that you have the C:\Program Files\Git\cmd\ directory in
the PATH. Usually this is the case for msysGit installation if you have chosen
diff --git a/package/linux/45-openpilot-permissions.rules b/package/linux/45-openpilot-permissions.rules
index 74e415c39..9015612a6 100644
--- a/package/linux/45-openpilot-permissions.rules
+++ b/package/linux/45-openpilot-permissions.rules
@@ -5,6 +5,15 @@
SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415b", MODE="0664", GROUP="plugdev"
# OpenPilot OPLink Mini radio modem board
SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415c", MODE="0664", GROUP="plugdev"
+ # OpenPilot Revolution board
+ SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415e", MODE="0664", GROUP="plugdev"
+
+ # Other OpenPilot reserved pids
+ SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="415d", MODE="0664", GROUP="plugdev"
+ SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="4194", MODE="0664", GROUP="plugdev"
+ SUBSYSTEM=="usb", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="4195", MODE="0664", GROUP="plugdev"
+
+
# unprogrammed openpilot flight control board
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5750", MODE="0664", GROUP="plugdev"
# FTDI FT2232C Dual USB-UART/FIFO IC
diff --git a/package/winx86/openpilotgcs.nsi b/package/winx86/openpilotgcs.nsi
index df5d34152..c0ffdb797 100644
--- a/package/winx86/openpilotgcs.nsi
+++ b/package/winx86/openpilotgcs.nsi
@@ -238,7 +238,7 @@ SectionEnd
; Copy driver files
Section "-Drivers" InSecDrivers
SetOutPath "$INSTDIR\drivers"
- File "${PROJECT_ROOT}\flight\Project\Windows USB\OpenPilot-CDC.inf"
+ File /r "${PROJECT_ROOT}\flight\Project\Windows USB\*"
SectionEnd
; Preinstall OpenPilot CDC driver
@@ -368,8 +368,8 @@ Section "un.Maps cache" UnSecCache
RMDir /r /rebootok "$APPDATA\OpenPilot\mapscache"
SectionEnd
-Section /o "un.Configuration" UnSecConfig
- ; Remove configuration
+Section "un.GCS Layout" UnSecConfig
+ ; Remove GCS configuration files
SetShellVarContext current
Delete /rebootok "$APPDATA\OpenPilot\OpenPilotGCS*.db"
Delete /rebootok "$APPDATA\OpenPilot\OpenPilotGCS*.xml"
diff --git a/package/winx86/translations/strings_en.nsh b/package/winx86/translations/strings_en.nsh
index e8aa794b0..efa553d3e 100644
--- a/package/winx86/translations/strings_en.nsh
+++ b/package/winx86/translations/strings_en.nsh
@@ -42,4 +42,4 @@
LangString DESC_UnSecProgram ${LANG_ENGLISH} "OpenPilot GCS application and all components."
LangString DESC_UnSecCache ${LANG_ENGLISH} "OpenPilot GCS cached maps data."
- LangString DESC_UnSecConfig ${LANG_ENGLISH} "OpenPilot GCS configuration files."
+ LangString DESC_UnSecConfig ${LANG_ENGLISH} "OpenPilot GCS layout files."
diff --git a/shared/uavobjectdefinition/airspeedstate.xml b/shared/uavobjectdefinition/airspeedstate.xml
index 3a7db51d9..f38473bae 100644
--- a/shared/uavobjectdefinition/airspeedstate.xml
+++ b/shared/uavobjectdefinition/airspeedstate.xml
@@ -6,6 +6,6 @@
-
+
diff --git a/shared/uavobjectdefinition/altitudeholddesired.xml b/shared/uavobjectdefinition/altitudeholddesired.xml
index cf056cfa0..af2dafe94 100644
--- a/shared/uavobjectdefinition/altitudeholddesired.xml
+++ b/shared/uavobjectdefinition/altitudeholddesired.xml
@@ -8,6 +8,6 @@
-
+
diff --git a/shared/uavobjectdefinition/debuglogcontrol.xml b/shared/uavobjectdefinition/debuglogcontrol.xml
new file mode 100644
index 000000000..2a4b5a84a
--- /dev/null
+++ b/shared/uavobjectdefinition/debuglogcontrol.xml
@@ -0,0 +1,20 @@
+
+
+ Log Control Object - Used to issue commands to the on board logging system
+
+
+
+
+
+
+
+
+
+
diff --git a/shared/uavobjectdefinition/debuglogentry.xml b/shared/uavobjectdefinition/debuglogentry.xml
new file mode 100644
index 000000000..9a9acda83
--- /dev/null
+++ b/shared/uavobjectdefinition/debuglogentry.xml
@@ -0,0 +1,17 @@
+
+
+ Log Entry in Flash
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/shared/uavobjectdefinition/debuglogsettings.xml b/shared/uavobjectdefinition/debuglogsettings.xml
new file mode 100644
index 000000000..cb5fef6ed
--- /dev/null
+++ b/shared/uavobjectdefinition/debuglogsettings.xml
@@ -0,0 +1,11 @@
+
+
+ Configure On Board Logging Facilities
+
+
+
+
+
+
+
+
diff --git a/shared/uavobjectdefinition/debuglogstatus.xml b/shared/uavobjectdefinition/debuglogstatus.xml
new file mode 100644
index 000000000..0d510a332
--- /dev/null
+++ b/shared/uavobjectdefinition/debuglogstatus.xml
@@ -0,0 +1,13 @@
+
+
+ Log Status Object, contains log partition status information
+
+
+
+
+
+
+
+
+
+
diff --git a/shared/uavobjectdefinition/flighttelemetrystats.xml b/shared/uavobjectdefinition/flighttelemetrystats.xml
index 352bb7de0..2e371b7de 100644
--- a/shared/uavobjectdefinition/flighttelemetrystats.xml
+++ b/shared/uavobjectdefinition/flighttelemetrystats.xml
@@ -10,6 +10,6 @@
-
+
diff --git a/shared/uavobjectdefinition/gpspositionsensor.xml b/shared/uavobjectdefinition/gpspositionsensor.xml
index 8686a76ef..cfaba9db0 100644
--- a/shared/uavobjectdefinition/gpspositionsensor.xml
+++ b/shared/uavobjectdefinition/gpspositionsensor.xml
@@ -15,6 +15,6 @@
-
+
diff --git a/shared/uavobjectdefinition/gpssatellites.xml b/shared/uavobjectdefinition/gpssatellites.xml
index 47c4c0f56..8d3ecb8e3 100644
--- a/shared/uavobjectdefinition/gpssatellites.xml
+++ b/shared/uavobjectdefinition/gpssatellites.xml
@@ -9,6 +9,6 @@
-
+
diff --git a/shared/uavobjectdefinition/gpstime.xml b/shared/uavobjectdefinition/gpstime.xml
index ab93d4e9c..1408ba2d8 100644
--- a/shared/uavobjectdefinition/gpstime.xml
+++ b/shared/uavobjectdefinition/gpstime.xml
@@ -10,6 +10,6 @@
-
+
diff --git a/shared/uavobjectdefinition/gpsvelocitysensor.xml b/shared/uavobjectdefinition/gpsvelocitysensor.xml
index c94474ca2..a9fa3ce2b 100644
--- a/shared/uavobjectdefinition/gpsvelocitysensor.xml
+++ b/shared/uavobjectdefinition/gpsvelocitysensor.xml
@@ -7,6 +7,6 @@
-
+
diff --git a/shared/uavobjectdefinition/i2cstats.xml b/shared/uavobjectdefinition/i2cstats.xml
index 3e79d79ea..f5cc5318a 100644
--- a/shared/uavobjectdefinition/i2cstats.xml
+++ b/shared/uavobjectdefinition/i2cstats.xml
@@ -14,6 +14,6 @@
-
+
diff --git a/shared/uavobjectdefinition/mixerstatus.xml b/shared/uavobjectdefinition/mixerstatus.xml
index c7491a92e..0c33d7f24 100644
--- a/shared/uavobjectdefinition/mixerstatus.xml
+++ b/shared/uavobjectdefinition/mixerstatus.xml
@@ -16,6 +16,6 @@
-
+
diff --git a/shared/uavobjectdefinition/oplinkstatus.xml b/shared/uavobjectdefinition/oplinkstatus.xml
index a0d2fded5..bcceb3751 100644
--- a/shared/uavobjectdefinition/oplinkstatus.xml
+++ b/shared/uavobjectdefinition/oplinkstatus.xml
@@ -31,6 +31,6 @@
-
+
diff --git a/shared/uavobjectdefinition/overosyncsettings.xml b/shared/uavobjectdefinition/overosyncsettings.xml
index 2d884bc1a..9c70d47bb 100644
--- a/shared/uavobjectdefinition/overosyncsettings.xml
+++ b/shared/uavobjectdefinition/overosyncsettings.xml
@@ -5,6 +5,6 @@
-
+
diff --git a/shared/uavobjectdefinition/overosyncstats.xml b/shared/uavobjectdefinition/overosyncstats.xml
index de069e38c..ce87c306d 100644
--- a/shared/uavobjectdefinition/overosyncstats.xml
+++ b/shared/uavobjectdefinition/overosyncstats.xml
@@ -11,6 +11,6 @@
-
+
diff --git a/shared/uavobjectdefinition/pathaction.xml b/shared/uavobjectdefinition/pathaction.xml
index 983863650..16ed7a569 100644
--- a/shared/uavobjectdefinition/pathaction.xml
+++ b/shared/uavobjectdefinition/pathaction.xml
@@ -25,6 +25,6 @@
-
+
diff --git a/shared/uavobjectdefinition/pathstatus.xml b/shared/uavobjectdefinition/pathstatus.xml
index 746d15c47..52352dc4a 100644
--- a/shared/uavobjectdefinition/pathstatus.xml
+++ b/shared/uavobjectdefinition/pathstatus.xml
@@ -11,6 +11,6 @@
-
+
diff --git a/shared/uavobjectdefinition/poilocation.xml b/shared/uavobjectdefinition/poilocation.xml
index 6ab6f0273..52298f017 100644
--- a/shared/uavobjectdefinition/poilocation.xml
+++ b/shared/uavobjectdefinition/poilocation.xml
@@ -7,6 +7,6 @@
-
+
diff --git a/shared/uavobjectdefinition/positionstate.xml b/shared/uavobjectdefinition/positionstate.xml
index f6d689741..2a054a648 100644
--- a/shared/uavobjectdefinition/positionstate.xml
+++ b/shared/uavobjectdefinition/positionstate.xml
@@ -7,6 +7,6 @@
-
+
diff --git a/shared/uavobjectdefinition/ratedesired.xml b/shared/uavobjectdefinition/ratedesired.xml
index 5d68597ee..6c297c3e5 100644
--- a/shared/uavobjectdefinition/ratedesired.xml
+++ b/shared/uavobjectdefinition/ratedesired.xml
@@ -7,6 +7,6 @@
-
+
diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml
index faa1cc9b1..34c353d64 100644
--- a/shared/uavobjectdefinition/systemalarms.xml
+++ b/shared/uavobjectdefinition/systemalarms.xml
@@ -43,6 +43,6 @@
-
+
diff --git a/shared/uavobjectdefinition/systemstats.xml b/shared/uavobjectdefinition/systemstats.xml
index e09c817a4..4d305a471 100644
--- a/shared/uavobjectdefinition/systemstats.xml
+++ b/shared/uavobjectdefinition/systemstats.xml
@@ -16,6 +16,6 @@
-
+
diff --git a/shared/uavobjectdefinition/taskinfo.xml b/shared/uavobjectdefinition/taskinfo.xml
index 1886967fc..7dc843c0a 100644
--- a/shared/uavobjectdefinition/taskinfo.xml
+++ b/shared/uavobjectdefinition/taskinfo.xml
@@ -113,6 +113,6 @@
-
+
diff --git a/shared/uavobjectdefinition/velocitydesired.xml b/shared/uavobjectdefinition/velocitydesired.xml
index d20f43cb6..957c09b1a 100644
--- a/shared/uavobjectdefinition/velocitydesired.xml
+++ b/shared/uavobjectdefinition/velocitydesired.xml
@@ -7,6 +7,6 @@
-
+
diff --git a/shared/uavobjectdefinition/velocitystate.xml b/shared/uavobjectdefinition/velocitystate.xml
index 90a89a4dd..9b922f6a9 100644
--- a/shared/uavobjectdefinition/velocitystate.xml
+++ b/shared/uavobjectdefinition/velocitystate.xml
@@ -7,6 +7,6 @@
-
+
diff --git a/shared/uavobjectdefinition/watchdogstatus.xml b/shared/uavobjectdefinition/watchdogstatus.xml
index 2adef2c87..8bbc275e5 100644
--- a/shared/uavobjectdefinition/watchdogstatus.xml
+++ b/shared/uavobjectdefinition/watchdogstatus.xml
@@ -6,6 +6,6 @@
-
+
diff --git a/shared/uavobjectdefinition/waypoint.xml b/shared/uavobjectdefinition/waypoint.xml
index 2a27f7fd5..e2c5b944a 100644
--- a/shared/uavobjectdefinition/waypoint.xml
+++ b/shared/uavobjectdefinition/waypoint.xml
@@ -7,6 +7,6 @@
-
+
diff --git a/shared/uavobjectdefinition/waypointactive.xml b/shared/uavobjectdefinition/waypointactive.xml
index 3343715b5..d38b82713 100644
--- a/shared/uavobjectdefinition/waypointactive.xml
+++ b/shared/uavobjectdefinition/waypointactive.xml
@@ -5,6 +5,6 @@
-
+