Skip to content

Conversation

HTRamsey
Copy link
Collaborator

@HTRamsey HTRamsey commented Oct 7, 2024

Resolves an old TODO by moving camera metadata list to the rest of the camera stuff
Convert to Q_GADGET since a Q_OBJECT isn't needed

@HTRamsey HTRamsey requested a review from DonLakeFlyer October 7, 2024 06:22
@HTRamsey HTRamsey force-pushed the dev-camerametadata branch from 546b3d9 to a025d5e Compare October 9, 2024 08:37

/// Returns a list of CameraMetaData objects for available cameras on the vehicle.
/// TODO: This should go into QGCCameraManager
virtual const QVariantList& cameraList(const Vehicle* vehicle);
Copy link
Contributor

Choose a reason for hiding this comment

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

So how does a custom build override the list of available cameras now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True, I will re-enable that ability. Personally I think it would be better to read some kinda resource file for this kinda stuff, like a json or whatever. But lemme think about it some first. I do think it's at least nice to have all the camera code together as long as we keep the same functionality.

Copy link
Contributor

Choose a reason for hiding this comment

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

"Personally I think it would be better to read some kinda resource file for this kinda stuff, like a json or whatever."

I agree. In general for custom build tweaking I've been moving away from C++ code when possible to resource based stuff which can be overridden. Json for this certainly makes sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So now they can override the json file in the resource system

@DonLakeFlyer
Copy link
Contributor

Can you make the camera json file follow the specs for the internal QGC json files (version, type and so forth) and use the helper routines to validate/load? This provides versioning and translation support.

@HTRamsey
Copy link
Collaborator Author

Done

QList<CameraMetaData*> cameraList;

QFile file(jsonFilePath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
Copy link
Contributor

@DonLakeFlyer DonLakeFlyer Nov 19, 2024

Choose a reason for hiding this comment

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

You need to use JsonHelper::openInternalQGCJsonFile to get the translation support. This will do this for you:

  • Open file
  • Validation
  • Translation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll get it right eventually

@HTRamsey HTRamsey merged commit 6521176 into mavlink:master Nov 19, 2024
7 checks passed
@HTRamsey HTRamsey deleted the dev-camerametadata branch November 19, 2024 22:04
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.

2 participants