Skip to content

Commit

Permalink
Add isRequired flag to PathParameter
Browse files Browse the repository at this point in the history
  • Loading branch information
medengineer committed Dec 24, 2024
1 parent b10b793 commit f066eea
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Source/Processors/DataThreads/DataThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ void DataThread::addPathParameter (Parameter::ParameterScope scope,
const String& defaultValue,
const StringArray& validFileExtensions,
bool isDirectory,
bool isRequired,
bool deactivateDuringAcquisition)
{
sn->addPathParameter (scope, name, displayName, description, defaultValue, validFileExtensions, isDirectory, deactivateDuringAcquisition);
sn->addPathParameter (scope, name, displayName, description, defaultValue, validFileExtensions, isDirectory, isRequired, deactivateDuringAcquisition);
}

void DataThread::addSelectedStreamParameter (Parameter::ParameterScope scope,
Expand Down
1 change: 1 addition & 0 deletions Source/Processors/DataThreads/DataThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class PLUGIN_API DataThread : public Thread
const String& defaultValue,
const StringArray& validFileExtensions,
bool isDirectory,
bool isRequired,
bool deactivateDuringAcquisition = true);

/** Adds a selected stream parameter which holds the currentlu selected stream */
Expand Down
2 changes: 1 addition & 1 deletion Source/Processors/FileReader/FileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ FileReader::~FileReader()
void FileReader::registerParameters()
{
/* Add parameters */
addPathParameter (Parameter::PROCESSOR_SCOPE, "selected_file", "Selected File", "File to load data from", defaultFile, getSupportedExtensions(), false);
addPathParameter (Parameter::PROCESSOR_SCOPE, "selected_file", "Selected File", "File to load data from", defaultFile, getSupportedExtensions(), false, true);
addSelectedStreamParameter (Parameter::PROCESSOR_SCOPE, "active_stream", "Active Stream", "Currently active stream", {}, 0);
addTimeParameter (Parameter::PROCESSOR_SCOPE, "start_time", "Start Time", "Time to start playback");
addTimeParameter (Parameter::PROCESSOR_SCOPE, "end_time", "Stop Time", "Time to end playback");
Expand Down
2 changes: 2 additions & 0 deletions Source/Processors/GenericProcessor/GenericProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ void GenericProcessor::addPathParameter (
const File& defaultValue,
const StringArray& validFileExtensions,
bool isDirectory,
bool isRequired,
bool deactivateDuringAcquisition)
{
PathParameter* p =
Expand All @@ -433,6 +434,7 @@ void GenericProcessor::addPathParameter (
defaultValue,
validFileExtensions,
isDirectory,
isRequired,
deactivateDuringAcquisition);

if (scope == Parameter::PROCESSOR_SCOPE)
Expand Down
1 change: 1 addition & 0 deletions Source/Processors/GenericProcessor/GenericProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ class PLUGIN_API GenericProcessor : public GenericProcessorBase, public PluginCl
const File& defaultValue,
const StringArray& validFileExtensions,
bool isDirectory,
bool isRequired,
bool deactivateDuringAcquisition = true);

/** Adds a selected stream parameter which holds the currentlu selected stream */
Expand Down
8 changes: 7 additions & 1 deletion Source/Processors/Parameter/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,7 @@ PathParameter::PathParameter (ParameterOwner* owner,
const File& defaultValue_,
const StringArray& fileExtensions_,
bool isDirectory_,
bool isRequired_,
bool deactivateDuringAcquisition)
: Parameter (owner,
ParameterType::PATH_PARAM,
Expand All @@ -1194,7 +1195,8 @@ PathParameter::PathParameter (ParameterOwner* owner,
defaultValue_.getFullPathName(),
deactivateDuringAcquisition),
filePatternsAllowed (fileExtensions_),
isDirectory (isDirectory_)
isDirectory (isDirectory_),
isRequired (isRequired_)
{
currentValue = defaultValue;
}
Expand Down Expand Up @@ -1257,6 +1259,10 @@ bool PathParameter::isValid()
{
return true;
}
else if (! isRequired)
{
return true;
}

return false;
}
Expand Down
2 changes: 2 additions & 0 deletions Source/Processors/Parameter/Parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ class PLUGIN_API PathParameter : public Parameter
const File& defaultValue,
const StringArray& filePatternsAllowed,
const bool isDirectory,
const bool isRequired = true,
bool deactivateDuringAcquisition = true);

/** Sets the current value*/
Expand Down Expand Up @@ -912,6 +913,7 @@ class PLUGIN_API PathParameter : public Parameter
private:
StringArray filePatternsAllowed;
bool isDirectory;
bool isRequired;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion Source/Processors/RecordNode/RecordNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ RecordNode::~RecordNode()
void RecordNode::registerParameters()
{
String defaultRecordDirectory = CoreServices::getRecordingParentDirectory().getFullPathName();
addPathParameter (Parameter::PROCESSOR_SCOPE, "directory", "Directory", "Path to write data to", defaultRecordDirectory, {}, true);
addPathParameter (Parameter::PROCESSOR_SCOPE, "directory", "Directory", "Path to write data to", defaultRecordDirectory, {}, true, true);

Array<String> recordEngines;
std::vector<RecordEngineManager*> engines = getAvailableRecordEngines();
Expand Down

0 comments on commit f066eea

Please sign in to comment.