Verified Commit cd069b69 authored by Michaël KUGLER's avatar Michaël KUGLER Committed by Flavien BRIDAULT-LOUCHEZ
Browse files

enh(ui): add fullpath option for camera selection in Scamera


style: apply sheldon


style: apply review suggestion
style: correct variable name


style: apply coding style


style: apply coding style


style: correct comment
parent 2251c60c
......@@ -64,6 +64,7 @@ static const core::com::Slots::SlotKeyType s_CONFIGURE_FILE_SLOT = "configureF
static const core::com::Slots::SlotKeyType s_CONFIGURE_STREAM_SLOT = "configureStream";
static const std::string s_VIDEO_SUPPORT_CONFIG = "videoSupport";
static const std::string s_USE_ABSOLUTE_PATH = "useAbsolutePath";
static const std::string s_CREATE_CAMERA_NUMBER_CONFIG = "createCameraNumber";
static const std::string s_LABEL_CONFIG = "label";
......@@ -94,6 +95,7 @@ void SCamera::configuring()
const service::IService::ConfigType config = this->getConfigTree();
m_bVideoSupport = config.get<bool>(s_VIDEO_SUPPORT_CONFIG, false);
m_useAbsolutePath = config.get<bool>(s_USE_ABSOLUTE_PATH, false);
m_numCreateCameras = config.get<size_t>(s_CREATE_CAMERA_NUMBER_CONFIG, m_numCreateCameras);
m_label = config.get<std::string>(s_LABEL_CONFIG, m_label);
......@@ -303,21 +305,24 @@ void SCamera::onChooseFile()
{
if(std::filesystem::is_directory(videoDirPreferencePath))
{
const auto videoRelativePath = std::filesystem::relative(
videoPath,
videoDirPreferencePath
);
const std::filesystem::path concatenatedPath = videoDirPreferencePath / videoRelativePath;
if(std::filesystem::exists(concatenatedPath))
{
videoPath = videoRelativePath;
}
else
if(!m_useAbsolutePath)
{
SIGHT_WARN(
"Relative path '" + videoRelativePath.string()
+ "' genrerated with preference is not valid."
const auto videoRelativePath = std::filesystem::relative(
videoPath,
videoDirPreferencePath
);
const std::filesystem::path concatenatedPath = videoDirPreferencePath / videoRelativePath;
if(std::filesystem::exists(concatenatedPath))
{
videoPath = videoRelativePath;
}
else
{
SIGHT_WARN(
"Relative path '" + videoRelativePath.string()
+ "' generated from preferences is not valid."
);
}
}
}
else
......
......@@ -77,6 +77,7 @@ namespace video
<inout key="cameraSeries" uid="..."/>
<createCameraNumber>2</createCameraNumber>
<videoSupport>true</videoSupport>
<useAbsolutePath>false</useAbsolutePath>
<label>Video source: </label>
</service>
@endcode
......@@ -87,6 +88,8 @@ namespace video
*
* @subsection Configuration Configuration
* - \b videoSupport (optional, default="false"): if we can open a video file in addition with cameras.
* - \b useAbsolutePath (optional, default="false"): when using a file input, tells if the path should be stored as
* absolute or relative to the video preferences directory.
* - \b createCameraNumber (optional, default="0"): number of cameras to create. If the parameter is set and the
* camera series already contains camera data, an assertion will be raised.
* - \b label (optional, default="Video source: "): label of the selector.
......@@ -152,6 +155,9 @@ private:
/// Number of cameras to create when using a camera series as input.
size_t m_numCreateCameras {0};
// Sets the file path as absolute ones
bool m_useAbsolutePath {false};
/// Signal emitted when the cameraSeries has been configured.
ConfiguredSignalType::sptr m_sigConfiguredCameras;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment