diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 74854579c0..2328f5d004 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -34,7 +34,7 @@ set(QFIELD_CORE_SRCS positioning/positioning.cpp positioning/positioningdevicemodel.cpp positioning/geofencer.cpp - positioning/positioningmodel.cpp + positioning/positioninginformationmodel.cpp processing/processingalgorithm.cpp processing/processingalgorithmparametersmodel.cpp processing/processingalgorithmsmodel.cpp @@ -153,7 +153,7 @@ set(QFIELD_CORE_HDRS positioning/tcpreceiver.h positioning/udpreceiver.h positioning/geofencer.h - positioning/positioningmodel.h + positioning/positioninginformationmodel.h processing/processingalgorithm.h processing/processingalgorithmparametersmodel.h processing/processingalgorithmsmodel.h diff --git a/src/core/positioning/positioningmodel.cpp b/src/core/positioning/positioninginformationmodel.cpp similarity index 75% rename from src/core/positioning/positioningmodel.cpp rename to src/core/positioning/positioninginformationmodel.cpp index edfed8c0f4..0d9770eee5 100644 --- a/src/core/positioning/positioningmodel.cpp +++ b/src/core/positioning/positioninginformationmodel.cpp @@ -1,22 +1,22 @@ #include "coordinatereferencesystemutils.h" #include "geometryutils.h" -#include "positioningmodel.h" +#include "positioninginformationmodel.h" #include #include -PositioningModel::PositioningModel( QObject *parent ) +PositioningInformationModel::PositioningInformationModel( QObject *parent ) : QStandardItemModel( parent ) { - connect( this, &QStandardItemModel::dataChanged, this, &PositioningModel::onDataChanged ); + connect( this, &QStandardItemModel::dataChanged, this, &PositioningInformationModel::onDataChanged ); } -void PositioningModel::setupConnections() +void PositioningInformationModel::setupConnections() { - connect( mPositioningSource, &Positioning::positionInformationChanged, this, &PositioningModel::refreshData ); + connect( mPositioningSource, &Positioning::positionInformationChanged, this, &PositioningInformationModel::refreshData ); } -void PositioningModel::refreshData() +void PositioningInformationModel::refreshData() { if ( !mPositioningSource ) { @@ -57,7 +57,7 @@ void PositioningModel::refreshData() } } -void PositioningModel::getCoordinateLabels( QString &coord1Label, QString &coord2Label, bool coordinatesIsXY, bool isGeographic ) +void PositioningInformationModel::getCoordinateLabels( QString &coord1Label, QString &coord2Label, bool coordinatesIsXY, bool isGeographic ) { if ( isGeographic ) { @@ -71,7 +71,7 @@ void PositioningModel::getCoordinateLabels( QString &coord1Label, QString &coord } } -void PositioningModel::getCoordinateValues( QString &coord1Value, QString &coord2Value, const QgsPoint &coordinates, bool coordinatesIsXY, bool isGeographic ) +void PositioningInformationModel::getCoordinateValues( QString &coord1Value, QString &coord2Value, const QgsPoint &coordinates, bool coordinatesIsXY, bool isGeographic ) { if ( coordinatesIsXY ) { @@ -99,7 +99,7 @@ void PositioningModel::getCoordinateValues( QString &coord1Value, QString &coord } } -QString PositioningModel::getAltitude( double distanceUnitFactor, const QString &distanceUnitAbbreviation ) +QString PositioningInformationModel::getAltitude( double distanceUnitFactor, const QString &distanceUnitAbbreviation ) { if ( positioningSource()->positionInformation().elevationValid() ) { @@ -127,22 +127,22 @@ QString PositioningModel::getAltitude( double distanceUnitFactor, const QString return tr( "N/A" ); } -QString PositioningModel::getSpeed() +QString PositioningInformationModel::getSpeed() { return positioningSource()->positionInformation().speedValid() ? QLocale::system().toString( positioningSource()->positionInformation().speed(), 'f', 3 ) + " m/s" : tr( "N/A" ); } -QString PositioningModel::getHorizontalAccuracy( double distanceUnitFactor, const QString &distanceUnitAbbreviation ) +QString PositioningInformationModel::getHorizontalAccuracy( double distanceUnitFactor, const QString &distanceUnitAbbreviation ) { return positioningSource()->positionInformation().haccValid() ? QLocale::system().toString( positioningSource()->positionInformation().hacc() * distanceUnitFactor, 'f', 3 ) + ' ' + distanceUnitAbbreviation : tr( "N/A" ); } -QString PositioningModel::getVerticalAccuracy( double distanceUnitFactor, const QString &distanceUnitAbbreviation ) +QString PositioningInformationModel::getVerticalAccuracy( double distanceUnitFactor, const QString &distanceUnitAbbreviation ) { return positioningSource()->positionInformation().vaccValid() ? QLocale::system().toString( positioningSource()->positionInformation().vacc() * distanceUnitFactor, 'f', 3 ) + ' ' + distanceUnitAbbreviation : tr( "N/A" ); } -void PositioningModel::updateInfo( const QString &name, const QVariant &value ) +void PositioningInformationModel::updateInfo( const QString &name, const QVariant &value ) { for ( int row = 0; row < rowCount(); ++row ) { @@ -161,7 +161,7 @@ void PositioningModel::updateInfo( const QString &name, const QVariant &value ) } -bool PositioningModel::setData( const QModelIndex &index, const QVariant &value, int role ) +bool PositioningInformationModel::setData( const QModelIndex &index, const QVariant &value, int role ) { QStandardItem *rowItem = item( index.row() ); if ( !rowItem ) @@ -197,7 +197,7 @@ bool PositioningModel::setData( const QModelIndex &index, const QVariant &value, return false; } -QHash PositioningModel::roleNames() const +QHash PositioningInformationModel::roleNames() const { QHash names = QStandardItemModel::roleNames(); names[NameRole] = "Name"; @@ -205,18 +205,18 @@ QHash PositioningModel::roleNames() const return names; } -void PositioningModel::onDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles ) +void PositioningInformationModel::onDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles ) { Q_UNUSED( bottomRight ) Q_UNUSED( roles ) } -Positioning *PositioningModel::positioningSource() const +Positioning *PositioningInformationModel::positioningSource() const { return mPositioningSource; } -void PositioningModel::setPositioningSource( Positioning *newPositioningSource ) +void PositioningInformationModel::setPositioningSource( Positioning *newPositioningSource ) { if ( mPositioningSource == newPositioningSource ) return; @@ -224,12 +224,12 @@ void PositioningModel::setPositioningSource( Positioning *newPositioningSource ) emit positioningSourceChanged(); } -double PositioningModel::antennaHeight() const +double PositioningInformationModel::antennaHeight() const { return mAntennaHeight; } -void PositioningModel::setAntennaHeight( double newAntennaHeight ) +void PositioningInformationModel::setAntennaHeight( double newAntennaHeight ) { if ( qFuzzyCompare( mAntennaHeight, newAntennaHeight ) ) return; @@ -237,12 +237,12 @@ void PositioningModel::setAntennaHeight( double newAntennaHeight ) emit antennaHeightChanged(); } -Qgis::DistanceUnit PositioningModel::distanceUnits() const +Qgis::DistanceUnit PositioningInformationModel::distanceUnits() const { return mDistanceUnits; } -void PositioningModel::setDistanceUnits( Qgis::DistanceUnit newDistanceUnits ) +void PositioningInformationModel::setDistanceUnits( Qgis::DistanceUnit newDistanceUnits ) { if ( mDistanceUnits == newDistanceUnits ) return; @@ -250,12 +250,12 @@ void PositioningModel::setDistanceUnits( Qgis::DistanceUnit newDistanceUnits ) emit distanceUnitsChanged(); } -QgsCoordinateReferenceSystem PositioningModel::coordinateDisplayCrs() const +QgsCoordinateReferenceSystem PositioningInformationModel::coordinateDisplayCrs() const { return mCoordinateDisplayCrs; } -void PositioningModel::setCoordinateDisplayCrs( const QgsCoordinateReferenceSystem &newCoordinateDisplayCrs ) +void PositioningInformationModel::setCoordinateDisplayCrs( const QgsCoordinateReferenceSystem &newCoordinateDisplayCrs ) { if ( mCoordinateDisplayCrs == newCoordinateDisplayCrs ) return; diff --git a/src/core/positioning/positioningmodel.h b/src/core/positioning/positioninginformationmodel.h similarity index 95% rename from src/core/positioning/positioningmodel.h rename to src/core/positioning/positioninginformationmodel.h index db2de5635a..ebf6fcc0ea 100644 --- a/src/core/positioning/positioningmodel.h +++ b/src/core/positioning/positioninginformationmodel.h @@ -5,7 +5,7 @@ #include #include -class PositioningModel : public QStandardItemModel +class PositioningInformationModel : public QStandardItemModel { Q_OBJECT @@ -22,7 +22,7 @@ class PositioningModel : public QStandardItemModel ValueRole = Qt::UserRole + 1, }; - PositioningModel( QObject *parent = nullptr ); + PositioningInformationModel( QObject *parent = nullptr ); bool setData( const QModelIndex &index, const QVariant &value, int role ) override; QHash roleNames() const override; diff --git a/src/core/qgismobileapp.cpp b/src/core/qgismobileapp.cpp index 4c72c60986..301f3a10ff 100644 --- a/src/core/qgismobileapp.cpp +++ b/src/core/qgismobileapp.cpp @@ -88,7 +88,7 @@ #include "platformutilities.h" #include "positioning.h" #include "positioningdevicemodel.h" -#include "positioningmodel.h" +#include "positioninginformationmodel.h" #include "positioningutils.h" #include "printlayoutlistmodel.h" #include "processingalgorithm.h" @@ -503,7 +503,7 @@ void QgisMobileapp::initDeclarative( QQmlEngine *engine ) qmlRegisterType( "org.qfield", 1, 0, "Navigation" ); qmlRegisterType( "org.qfield", 1, 0, "NavigationModel" ); qmlRegisterType( "org.qfield", 1, 0, "Positioning" ); - qmlRegisterType( "org.qfield", 1, 0, "PositioningModel" ); + qmlRegisterType( "org.qfield", 1, 0, "PositioningInformationModel" ); qmlRegisterType( "org.qfield", 1, 0, "PositioningDeviceModel" ); qmlRegisterType( "org.qfield", 1, 0, "AudioRecorder" ); qmlRegisterType( "org.qfield", 1, 0, "BarcodeDecoder" ); diff --git a/src/qml/PositioningInformationView.qml b/src/qml/PositioningInformationView.qml index bcef10d042..27cd1b5dc4 100644 --- a/src/qml/PositioningInformationView.qml +++ b/src/qml/PositioningInformationView.qml @@ -8,8 +8,8 @@ import Theme Rectangle { id: positioningInformationView - property alias positionSource: positioningModel.positioningSource - property alias antennaHeight: positioningModel.antennaHeight + property alias positionSource: positioningInformationModel.positioningSource + property alias antennaHeight: positioningInformationModel.antennaHeight property color backgroundColor: "transparent" property color alternateBackgroundColor: Theme.positionBackgroundColor @@ -28,8 +28,8 @@ Rectangle { readonly property real numberOfColumns: parent.width / cellWidth flow: GridView.FlowTopToBottom - model: PositioningModel { - id: positioningModel + model: PositioningInformationModel { + id: positioningInformationModel distanceUnits: projectInfo.distanceUnits coordinateDisplayCrs: projectInfo.coordinateDisplayCrs } @@ -49,7 +49,7 @@ Rectangle { ScrollBar.vertical: QfScrollBar { } Component.onCompleted: { - positioningModel.setupConnections(); + positioningInformationModel.setupConnections(); } delegate: Rectangle { readonly property real currentColumn: parseInt(index / (grid.count / grid.numberOfColumns))