Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic model for PositioningInformationView #5604

Merged
merged 24 commits into from
Sep 5, 2024
Merged

Conversation

mohsenD98
Copy link
Collaborator

@mohsenD98 mohsenD98 commented Aug 30, 2024

Description:

This PR introduces enhancements to the PositioningInformationView.


Current State:

The current PositioningInformationView displays static Text { } elements in QML that vary in visibility based on the type of receiver (internal or external NMEA). The goal is to support displaying any details a receiver device can provide.

Internal devices feature information such as:

- Latitude/Longitude (x/y)
- Altitude
- Speed
- Horizontal Accuracy
- Vertical Accuracy

External NMEA receivers provide these, plus additional attributes like:

- PDOP
- HDOP
- VDOP
- Validity
- Fix Status
- Quality

New State:

We are replacing the static Text { } components with a dynamic GridView { } backed by a custom model, PositioningInformationModel. This model encompasses six core attributes that are common across all receivers: Latitude, Longitude, Altitude, Speed, Vertical Accuracy, and Horizontal Accuracy. Additionally, there's a deviceDetails variable of type QList<QPair<QString, QVariant>>.

The deviceDetails list will hold other parameters specific to each receiver. For instance, in the NmeaGnssReceiver, this implementation would look like:

QList<QPair<QString, QVariant>> NmeaGnssReceiver::details()
{
  QList<QPair<QString, QVariant>> dataList;

  dataList.append(qMakePair("PDOP", QLocale::system().toString(mCurrentNmeaGnssPositionInformation.pdop(), 'f', 1)));
  dataList.append(qMakePair("HDOP", QLocale::system().toString(mCurrentNmeaGnssPositionInformation.hdop(), 'f', 1)));
  dataList.append(qMakePair("VDOP", QLocale::system().toString(mCurrentNmeaGnssPositionInformation.vdop(), 'f', 1)));
  dataList.append(qMakePair("Valid", mCurrentNmeaGnssPositionInformation.isValid() ? "True" : "False"));
  dataList.append(qMakePair("Fix", mCurrentNmeaGnssPositionInformation.fixStatusDescription()));
  dataList.append(qMakePair("Quality", mCurrentNmeaGnssPositionInformation.qualityDescription()));

  return dataList;
}

With this update, when a new receiver type is introduced, the only requirement is to implement the details function, allowing the UI to update seamlessly and automatically.

for now we made a model and in next step we should add some static variables in that model ( to support internal device mode too )
@mohsenD98 mohsenD98 requested a review from nirvn August 30, 2024 18:25
@mohsenD98 mohsenD98 self-assigned this Aug 30, 2024
@qfield-fairy
Copy link
Collaborator

qfield-fairy commented Aug 30, 2024

@mohsenD98 mohsenD98 force-pushed the dynamic-positioning-info branch from ef1bb47 to e75383a Compare September 1, 2024 15:17
@mohsenD98 mohsenD98 marked this pull request as ready for review September 2, 2024 07:24
@mohsenD98 mohsenD98 changed the title WIP - Dynamic model for PositioningInformationView Dynamic model for PositioningInformationView Sep 2, 2024
src/core/positioning/positioninginformationmodel.h Outdated Show resolved Hide resolved
src/core/positioning/positioninginformationmodel.h Outdated Show resolved Hide resolved
src/core/positioning/positioninginformationmodel.cpp Outdated Show resolved Hide resolved
src/core/positioning/positioninginformationmodel.cpp Outdated Show resolved Hide resolved
src/core/positioning/positioninginformationmodel.cpp Outdated Show resolved Hide resolved
src/qml/InformationDrawer.qml Outdated Show resolved Hide resolved
src/qml/PositioningInformationView.qml Outdated Show resolved Hide resolved
Copy link
Member

@nirvn nirvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, let's merge this.

@nirvn nirvn merged commit 0559d23 into master Sep 5, 2024
22 of 23 checks passed
@nirvn nirvn deleted the dynamic-positioning-info branch September 5, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants