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/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/coreplugin/versiondialog.h b/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h
deleted file mode 100644
index 58fd217b7..000000000
--- a/ground/openpilotgcs/src/plugins/coreplugin/versiondialog.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- ******************************************************************************
- *
- * @file versiondialog.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
- * @{
- * @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
- */
-
-#ifndef VERSIONDIALOG_H
-#define VERSIONDIALOG_H
-
-#include
-
-namespace Core {
-namespace Internal {
-class VersionDialog : public QDialog {
- Q_OBJECT
-public:
- explicit VersionDialog(QWidget *parent);
-};
-} // namespace Internal
-} // namespace Core
-
-#endif // VERSIONDIALOG_H
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..30e803f33 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..131ab9b31 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..7f0262ad3 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);
- }
}
// 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/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..aa071e893 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..fe7fac302 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/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..e2c21956f 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..8821614dd 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);