diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cam/main.cpp | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/cam/main.cpp b/src/cam/main.cpp index e01be63a..994fbb34 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -377,23 +377,38 @@ int CamApp::run() std::string const CamApp::cameraName(const Camera *camera) { const ControlList &props = camera->properties(); + bool addModel = true; std::string name; - switch (props.get(properties::Location)) { - case properties::CameraLocationFront: - name = "Internal front camera"; - break; - case properties::CameraLocationBack: - name = "Internal back camera"; - break; - case properties::CameraLocationExternal: - name = "External camera"; - if (props.contains(properties::Model)) - name += " '" + props.get(properties::Model) + "'"; - break; + /* + * Construct the name from the camera location, model and ID. The model + * is only used if the location isn't present or is set to External. + */ + if (props.contains(properties::Location)) { + switch (props.get(properties::Location)) { + case properties::CameraLocationFront: + addModel = false; + name = "Internal front camera "; + break; + case properties::CameraLocationBack: + addModel = false; + name = "Internal back camera "; + break; + case properties::CameraLocationExternal: + name = "External camera "; + break; + } + } + + if (addModel && props.contains(properties::Model)) { + /* + * If the camera location is not availble use the camera model + * to build the camera name. + */ + name = "'" + props.get(properties::Model) + "' "; } - name += " (" + camera->id() + ")"; + name += "(" + camera->id() + ")"; return name; } |