Finish implementing Widgets on C++ side

This commit is contained in:
Alex Spataru 2020-11-27 00:11:24 -06:00
parent 2f06ff8e21
commit b42d3ac1d6
16 changed files with 669 additions and 146 deletions

View File

@ -140,17 +140,22 @@ SOURCES += \
src/main.cpp
DISTFILES += \
assets/qml/About.qml \
assets/qml/Components/Console.qml \
assets/qml/Components/DataGrid.qml \
assets/qml/Components/DeviceManager.qml \
assets/qml/Components/GraphGrid.qml \
assets/qml/Components/ToolBar.qml \
assets/qml/Components/WidgetGrid.qml \
assets/qml/UI.qml \
assets/qml/Widgets/AccelerometerDelegate.qml \
assets/qml/Widgets/BarDelegate.qml \
assets/qml/Widgets/DataDelegate.qml \
assets/qml/Widgets/GaugeDelegate.qml \
assets/qml/Widgets/GraphDelegate.qml \
assets/qml/Widgets/GroupDelegate.qml \
assets/qml/Widgets/GyroDelegate.qml \
assets/qml/Widgets/LED.qml \
assets/qml/Widgets/MapDelegate.qml \
assets/qml/Widgets/TankDelegate.qml \
assets/qml/Widgets/Window.qml \
assets/qml/main.qml \
assets/qml/About.qml
assets/qml/main.qml

View File

@ -43,11 +43,17 @@
<file>qml/Components/DataGrid.qml</file>
<file>qml/Components/DeviceManager.qml</file>
<file>qml/Components/ToolBar.qml</file>
<file>qml/Components/WidgetGrid.qml</file>
<file>qml/Widgets/AccelerometerDelegate.qml</file>
<file>qml/Widgets/BarDelegate.qml</file>
<file>qml/Widgets/DataDelegate.qml</file>
<file>qml/Widgets/GaugeDelegate.qml</file>
<file>qml/Widgets/GraphDelegate.qml</file>
<file>qml/Widgets/GroupDelegate.qml</file>
<file>qml/Widgets/GyroDelegate.qml</file>
<file>qml/Widgets/LED.qml</file>
<file>qml/Widgets/MapDelegate.qml</file>
<file>qml/Widgets/TankDelegate.qml</file>
<file>qml/Widgets/Window.qml</file>
<file>qml/About.qml</file>
<file>qml/main.qml</file>

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2020 Alex Spataru <https://github.com/alex-spataru>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import Group 1.0
import Dataset 1.0
import "../Widgets"
Item {
}

View File

@ -70,13 +70,11 @@ Page {
TabBar {
id: tabBar
contentHeight: 32
palette.button: Qt.rgba(45/255, 96/255, 115/255, 1)
visible: CppQmlBridge.gpsSupported
enabled: CppQmlBridge.groupCount > 0
opacity: CppQmlBridge.groupCount > 0 ? 1 : 0
Behavior on opacity {NumberAnimation{}}
enabled: opacity > 0
onVisibleChanged: dataButton.clicked()
opacity: CppSerialManager.connected ? 1 : 0
palette.button: Qt.rgba(45/255, 96/255, 115/255, 1)
Behavior on opacity {NumberAnimation{}}
anchors {
leftMargin: 3
@ -93,8 +91,7 @@ Page {
}
TabButton {
text: qsTr("GPS Map")
enabled: CppQmlBridge.gpsSupported
text: qsTr("Widgets")
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2020 Alex Spataru <https://github.com/alex-spataru>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import QtQuick 2.12
Item {
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2020 Alex Spataru <https://github.com/alex-spataru>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import QtQuick 2.12
Item {
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2020 Alex Spataru <https://github.com/alex-spataru>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import QtQuick 2.12
Item {
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2020 Alex Spataru <https://github.com/alex-spataru>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import QtQuick 2.12
Item {
}

View File

@ -37,8 +37,8 @@ ColumnLayout {
//
// Real-time GPS coordinates components
//
property real latitude: CppQmlBridge.gpsLatitude
property real longitude: CppQmlBridge.gpsLongitude
property real latitude: 0
property real longitude: 0
//
// Will be true if GPS coordinates are different from (0,0)

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2020 Alex Spataru <https://github.com/alex-spataru>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import QtQuick 2.12
Item {
}

View File

@ -82,7 +82,7 @@ bool Dataset::read(const QJsonObject &object)
auto units = object.value("u").toVariant().toString();
auto widget = object.value("w").toVariant().toString();
if (!title.isEmpty() && !value.isEmpty())
if (!value.isEmpty())
{
m_graph = graph;
m_title = title;

View File

@ -114,10 +114,7 @@ bool Export::isOpen() const
/**
* Open a CSV file in the Explorer/Finder window
*/
void Export::openCsv()
{
}
void Export::openCsv() { }
/**
* Open the current CSV file in the Explorer/Finder window

View File

@ -62,7 +62,7 @@ QString Group::title() const
*/
QString Group::widget() const
{
return m_widget;
return m_widget;
}
/**

View File

@ -21,120 +21,457 @@
*/
#include "Group.h"
#include "Dataset.h"
#include "Widgets.h"
#include "QmlBridge.h"
static Widgets* INSTANCE = Q_NULLPTR;
#include <cfloat>
#include <climits>
Widgets* Widgets::getInstance() {
if (!INSTANCE)
INSTANCE = new Widgets;
static Widgets *INSTANCE = Q_NULLPTR;
return INSTANCE;
Widgets::Widgets()
{
auto bridge = QmlBridge::getInstance();
connect(bridge, SIGNAL(updated()), this, SLOT(updateModels()));
}
QList<Group*> Widgets::barGroups() const {
return m_barGroups;
Widgets *Widgets::getInstance()
{
if (!INSTANCE)
INSTANCE = new Widgets;
return INSTANCE;
}
QList<Group*> Widgets::mapGroups() const {
return m_mapGroups;
QList<Group *> Widgets::barGroup() const
{
return m_barGroups;
}
QList<Group*> Widgets::gyroGroups() const {
return m_gyroGroups;
QList<Group *> Widgets::mapGroup() const
{
return m_mapGroups;
}
QList<Group*> Widgets::tankGroups() const {
return m_tankGroups;
QList<Group *> Widgets::gyroGroup() const
{
return m_gyroGroups;
}
QList<Group*> Widgets::gaugeGroups() const {
return m_gaugeGroups;
QList<Group *> Widgets::tankGroup() const
{
return m_tankGroups;
}
QList<Group*> Widgets::accelerometerGroups() const {
return m_accelerometerGroups;
QList<Group *> Widgets::gaugeGroup() const
{
return m_gaugeGroups;
}
Group* Widgets::barGroupAt(const int index) {
if (barGroups().count() > index)
return barGroups().at(index);
return Q_NULLPTR;
QList<Group *> Widgets::accelerometerGroup() const
{
return m_accelerometerGroups;
}
Group* Widgets::mapGroupAt(const int index) {
if (mapGroups().count() > index)
return mapGroups().at(index);
return Q_NULLPTR;
int Widgets::barGroupCount() const
{
return barGroup().count();
}
Group* Widgets::gyroGroupAt(const int index) {
if (gyroGroups().count() > index)
return gyroGroups().at(index);
return Q_NULLPTR;
int Widgets::mapGroupCount() const
{
return mapGroup().count();
}
Group* Widgets::tankGroupAt(const int index) {
if (tankGroups().count() > index)
return tankGroups().at(index);
return Q_NULLPTR;
int Widgets::gyroGroupCount() const
{
return gyroGroup().count();
}
Group* Widgets::gaugeGroupAt(const int index) {
if (gaugeGroups().count() > index)
return gaugeGroups().at(index);
return Q_NULLPTR;
int Widgets::tankGroupCount() const
{
return tankGroup().count();
}
Group* Widgets::accelerometerGroupAt(const int index) {
if (accelerometerGroups().count() > index)
return accelerometerGroups().at(index);
return Q_NULLPTR;
int Widgets::gaugeGroupCount() const
{
return gaugeGroup().count();
}
qreal Widgets::gyroX(const int index) const {}
qreal Widgets::gyroY(const int index) const {}
qreal Widgets::gyroZ(const int index) const {}
qreal Widgets::accelerometerX(const int index) const {}
qreal Widgets::accelerometerY(const int index) const {}
qreal Widgets::accelerometerZ(const int index) const {}
qreal Widgets::bar(const int index) const {}
qreal Widgets::tank(const int index) const {}
qreal Widgets::gauge(const int index) const {}
qreal Widgets::barMin(const int index) const {}
qreal Widgets::barMax(const int index) const {}
qreal Widgets::tankMin(const int index) const {}
qreal Widgets::tankMax(const int index) const {}
qreal Widgets::gaugeMin(const int index) const {}
qreal Widgets::gaugeMax(const int index) const {}
qreal Widgets::mapLatitude(const int index) const {}
qreal Widgets::mapLongitude(const int index) const {}
void Widgets::updateModels() {}
QList<Group*> Widgets::getWidgetGroup(const QString& handle) {
int Widgets::accelerometerGroupCount() const
{
return accelerometerGroup().count();
}
Group *Widgets::barGroupAt(const int index)
{
if (barGroup().count() > index)
return barGroup().at(index);
return Q_NULLPTR;
}
Group *Widgets::mapGroupAt(const int index)
{
if (mapGroup().count() > index)
return mapGroup().at(index);
return Q_NULLPTR;
}
Group *Widgets::gyroGroupAt(const int index)
{
if (gyroGroup().count() > index)
return gyroGroup().at(index);
return Q_NULLPTR;
}
Group *Widgets::tankGroupAt(const int index)
{
if (tankGroup().count() > index)
return tankGroup().at(index);
return Q_NULLPTR;
}
Group *Widgets::gaugeGroupAt(const int index)
{
if (gaugeGroup().count() > index)
return gaugeGroup().at(index);
return Q_NULLPTR;
}
Group *Widgets::accelerometerGroupAt(const int index)
{
if (accelerometerGroup().count() > index)
return accelerometerGroup().at(index);
return Q_NULLPTR;
}
double Widgets::gyroX(const int index)
{
auto gyro = gyroGroupAt(index);
if (gyro)
{
foreach (auto dataset, gyro->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "x")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::gyroY(const int index)
{
auto gyro = gyroGroupAt(index);
if (gyro)
{
foreach (auto dataset, gyro->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "y")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::gyroZ(const int index)
{
auto gyro = gyroGroupAt(index);
if (gyro)
{
foreach (auto dataset, gyro->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "z")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::accelerometerX(const int index)
{
auto accelerometer = accelerometerGroupAt(index);
if (accelerometer)
{
foreach (auto dataset, accelerometer->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "x")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::accelerometerY(const int index)
{
auto accelerometer = accelerometerGroupAt(index);
if (accelerometer)
{
foreach (auto dataset, accelerometer->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "y")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::accelerometerZ(const int index)
{
auto accelerometer = accelerometerGroupAt(index);
if (accelerometer)
{
foreach (auto dataset, accelerometer->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "z")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::bar(const int index)
{
auto bar = barGroupAt(index);
if (bar)
{
foreach (auto dataset, bar->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "value")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::tank(const int index)
{
auto tank = tankGroupAt(index);
if (tank)
{
foreach (auto dataset, tank->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "value")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::gauge(const int index)
{
auto gauge = gaugeGroupAt(index);
if (gauge)
{
foreach (auto dataset, gauge->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "value")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::barMin(const int index)
{
auto bar = barGroupAt(index);
if (bar)
{
foreach (auto dataset, bar->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "min")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::barMax(const int index)
{
auto bar = barGroupAt(index);
if (bar)
{
foreach (auto dataset, bar->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "max")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::tankMin(const int index)
{
auto tank = tankGroupAt(index);
if (tank)
{
foreach (auto dataset, tank->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "min")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::tankMax(const int index)
{
auto tank = tankGroupAt(index);
if (tank)
{
foreach (auto dataset, tank->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "max")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::gaugeMin(const int index)
{
auto gauge = gaugeGroupAt(index);
if (gauge)
{
foreach (auto dataset, gauge->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "min")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::gaugeMax(const int index)
{
auto gauge = gaugeGroupAt(index);
if (gauge)
{
foreach (auto dataset, gauge->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "max")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::mapLatitude(const int index)
{
auto map = mapGroupAt(index);
if (map)
{
foreach (auto dataset, map->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "lat")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
double Widgets::mapLongitude(const int index)
{
auto map = mapGroupAt(index);
if (map)
{
foreach (auto dataset, map->datasets())
{
auto widget = dataset->widget();
if (widget.toLower() == "lon")
return dataset->value().toDouble();
}
}
return DBL_MAX;
}
void Widgets::updateModels()
{
// Clear current groups
m_barGroups.clear();
m_mapGroups.clear();
m_gyroGroups.clear();
m_tankGroups.clear();
m_gaugeGroups.clear();
m_accelerometerGroups.clear();
// Update groups
m_barGroups = getWidgetGroup("bar");
m_mapGroups = getWidgetGroup("map");
m_gyroGroups = getWidgetGroup("gyro");
m_tankGroups = getWidgetGroup("tank");
m_gaugeGroups = getWidgetGroup("gauge");
m_accelerometerGroups = getWidgetGroup("accelerometer");
// Update UI
emit dataChanged();
}
QList<Group *> Widgets::getWidgetGroup(const QString &handle)
{
QList<Group *> widgetGroup;
foreach (auto group, QmlBridge::getInstance()->groups())
{
if (group->widget().toLower() == handle)
widgetGroup.append(group);
}
return widgetGroup;
}

View File

@ -27,63 +27,72 @@
#include <QObject>
class Group;
class Widgets : public QObject {
Q_OBJECT
class Widgets : public QObject
{
Q_OBJECT
signals:
void dataChanged();
void dataChanged();
public:
static Widgets* getInstance();
static Widgets *getInstance();
QList<Group*> barGroups() const;
QList<Group*> mapGroups() const;
QList<Group*> gyroGroups() const;
QList<Group*> tankGroups() const;
QList<Group*> gaugeGroups() const;
QList<Group*> accelerometerGroups() const;
QList<Group *> barGroup() const;
QList<Group *> mapGroup() const;
QList<Group *> gyroGroup() const;
QList<Group *> tankGroup() const;
QList<Group *> gaugeGroup() const;
QList<Group *> accelerometerGroup() const;
Group* barGroupAt(const int index);
Group* mapGroupAt(const int index);
Group* gyroGroupAt(const int index);
Group* tankGroupAt(const int index);
Group* gaugeGroupAt(const int index);
Group* accelerometerGroupAt(const int index);
int barGroupCount() const;
int mapGroupCount() const;
int gyroGroupCount() const;
int tankGroupCount() const;
int gaugeGroupCount() const;
int accelerometerGroupCount() const;
qreal gyroX(const int index) const;
qreal gyroY(const int index) const;
qreal gyroZ(const int index) const;
Group *barGroupAt(const int index);
Group *mapGroupAt(const int index);
Group *gyroGroupAt(const int index);
Group *tankGroupAt(const int index);
Group *gaugeGroupAt(const int index);
Group *accelerometerGroupAt(const int index);
qreal accelerometerX(const int index) const;
qreal accelerometerY(const int index) const;
qreal accelerometerZ(const int index) const;
double gyroX(const int index);
double gyroY(const int index);
double gyroZ(const int index);
qreal bar(const int index) const;
qreal tank(const int index) const;
qreal gauge(const int index) const;
qreal barMin(const int index) const;
qreal barMax(const int index) const;
qreal tankMin(const int index) const;
qreal tankMax(const int index) const;
qreal gaugeMin(const int index) const;
qreal gaugeMax(const int index) const;
double accelerometerX(const int index);
double accelerometerY(const int index);
double accelerometerZ(const int index);
qreal mapLatitude(const int index) const;
qreal mapLongitude(const int index) const;
double bar(const int index);
double tank(const int index);
double gauge(const int index);
double barMin(const int index);
double barMax(const int index);
double tankMin(const int index);
double tankMax(const int index);
double gaugeMin(const int index);
double gaugeMax(const int index);
double mapLatitude(const int index);
double mapLongitude(const int index);
private slots:
void updateModels();
void updateModels();
private:
QList<Group*> getWidgetGroup(const QString& handle);
Widgets();
QList<Group *> getWidgetGroup(const QString &handle);
private:
QList<Group*> m_barGroups;
QList<Group*> m_mapGroups;
QList<Group*> m_gyroGroups;
QList<Group*> m_tankGroups;
QList<Group*> m_gaugeGroups;
QList<Group*> m_accelerometerGroups;
QList<Group *> m_barGroups;
QList<Group *> m_mapGroups;
QList<Group *> m_gyroGroups;
QList<Group *> m_tankGroups;
QList<Group *> m_gaugeGroups;
QList<Group *> m_accelerometerGroups;
};
#endif

View File

@ -32,6 +32,7 @@
#include "Export.h"
#include "AppInfo.h"
#include "Widgets.h"
#include "QmlBridge.h"
#include "GraphProvider.h"
#include "SerialManager.h"
@ -60,6 +61,7 @@ int main(int argc, char **argv)
// Init application modules
QQmlApplicationEngine engine;
auto widgets = Widgets::getInstance();
auto csvExport = Export::getInstance();
auto qmlBridge = QmlBridge::getInstance();
auto updater = QSimpleUpdater::getInstance();
@ -72,8 +74,9 @@ int main(int argc, char **argv)
// Init QML interface
QQuickStyle::setStyle("Fusion");
engine.rootContext()->setContextProperty("CppExport", csvExport);
engine.rootContext()->setContextProperty("CppUpdater", updater);
engine.rootContext()->setContextProperty("CppWidgets", widgets);
engine.rootContext()->setContextProperty("CppExport", csvExport);
engine.rootContext()->setContextProperty("CppQmlBridge", qmlBridge);
engine.rootContext()->setContextProperty("CppGraphProvider", graphProvider);
engine.rootContext()->setContextProperty("CppSerialManager", serialManager);