Skip to content
Snippets Groups Projects
Commit e4fb0aaf authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Merge branch 'fix/image-directory-in-image-monitor' into 'master'

Save images in $HOME/Pictures instead of $HOME

See merge request !150
parents a6098179 09d3372e
No related branches found
No related tags found
1 merge request!150Save images in $HOME/Pictures instead of $HOME
......@@ -86,7 +86,18 @@ namespace visionx
providerName = "";
frameRate = -1.0f;
outputPath = armarx::ArmarXDataPath::getHomePath();
// Qt Moc does not seem to accept outputDirectory being a std::filesystem::path().
{
if (const char* home = std::getenv("HOME"))
{
// ToDo: Replace with XDG_PICTURES_DIR standards when available.
outputDirectory = std::filesystem::path(home) / "Pictures";
}
else
{
outputDirectory = std::filesystem::absolute(".");
}
}
imageBufferSize = 100;
bufferFps = 5;
......@@ -273,7 +284,7 @@ namespace visionx
{
properties.providerName = settings->value("providerName", "").toString().toStdString();
properties.frameRate = settings->value("frameRate", -1).toInt();
properties.outputPath = settings->value("outputPath", ".").toString().toStdString();
properties.outputDirectory = settings->value("outputPath", ".").toString().toStdString();
properties.imageBufferSize = settings->value("imageBufferSize", 99).toInt();
properties.bufferFps = settings->value("bufferFps", 5.0f).toFloat();
auto imagesToShowStringList = settings->value("imagesToShow", 0).toStringList();
......@@ -297,7 +308,7 @@ namespace visionx
{
settings->setValue("providerName", QString(properties.providerName.c_str()));
settings->setValue("frameRate", properties.frameRate);
settings->setValue("outputPath", QString(properties.outputPath.c_str()));
settings->setValue("outputPath", QString(properties.outputDirectory.c_str()));
settings->setValue("imageBufferSize", properties.imageBufferSize);
settings->setValue("bufferFps", QString::number(static_cast<double>(properties.bufferFps)));
QStringList l;
......@@ -447,7 +458,7 @@ namespace visionx
std::string ImageMonitorWidgetController::getAbsoluteOutputPath()
{
namespace fs = std::filesystem;
fs::path absPath = fs::absolute(fs::path(properties.outputPath));
fs::path absPath = fs::absolute(fs::path(properties.outputDirectory));
return absPath.string();
}
......
......@@ -27,11 +27,15 @@
// STD/STL
#include <mutex>
#include <optional>
// <filesystem> needs to be down here. Otherwise, for some reason,
// the Qt AutoMoc will say: 'Parse error at "std"'
#include <filesystem>
#include <queue>
#include <set>
#include <string>
#include <vector>
// Boost
#include <boost/circular_buffer.hpp>
......@@ -89,7 +93,7 @@ namespace visionx
std::string providerName;
int frameRate;
std::string outputPath;
std::filesystem::path outputDirectory;
int imageBufferSize;
float bufferFps;
std::set<size_t> imagesToShow;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment