-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Conversation
546b3d9
to
a025d5e
Compare
@@ -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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
a025d5e
to
186563a
Compare
186563a
to
c27ddf3
Compare
c27ddf3
to
0e3ea45
Compare
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. |
0e3ea45
to
8a2e820
Compare
Done |
src/Camera/QGCCameraManager.cc
Outdated
QList<CameraMetaData*> cameraList; | ||
|
||
QFile file(jsonFilePath); | ||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
8a2e820
to
e1adabb
Compare
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