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

Camera: Move CameraMetaData list from FirmwarePlugin to CameraManager #11976

Merged
merged 1 commit into from
Nov 19, 2024

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

@@ -307,10 +307,6 @@ class FirmwarePlugin : public QObject
/// @return A list of QUrl with the indicators
virtual const QVariantList& modeIndicators(const Vehicle* vehicle);

/// 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