Skip to content

Commit f066eea

Browse files
committed
Add isRequired flag to PathParameter
1 parent b10b793 commit f066eea

8 files changed

Lines changed: 17 additions & 4 deletions

File tree

Source/Processors/DataThreads/DataThread.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ void DataThread::addPathParameter (Parameter::ParameterScope scope,
120120
const String& defaultValue,
121121
const StringArray& validFileExtensions,
122122
bool isDirectory,
123+
bool isRequired,
123124
bool deactivateDuringAcquisition)
124125
{
125-
sn->addPathParameter (scope, name, displayName, description, defaultValue, validFileExtensions, isDirectory, deactivateDuringAcquisition);
126+
sn->addPathParameter (scope, name, displayName, description, defaultValue, validFileExtensions, isDirectory, isRequired, deactivateDuringAcquisition);
126127
}
127128

128129
void DataThread::addSelectedStreamParameter (Parameter::ParameterScope scope,

Source/Processors/DataThreads/DataThread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ class PLUGIN_API DataThread : public Thread
193193
const String& defaultValue,
194194
const StringArray& validFileExtensions,
195195
bool isDirectory,
196+
bool isRequired,
196197
bool deactivateDuringAcquisition = true);
197198

198199
/** Adds a selected stream parameter which holds the currentlu selected stream */

Source/Processors/FileReader/FileReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ FileReader::~FileReader()
109109
void FileReader::registerParameters()
110110
{
111111
/* Add parameters */
112-
addPathParameter (Parameter::PROCESSOR_SCOPE, "selected_file", "Selected File", "File to load data from", defaultFile, getSupportedExtensions(), false);
112+
addPathParameter (Parameter::PROCESSOR_SCOPE, "selected_file", "Selected File", "File to load data from", defaultFile, getSupportedExtensions(), false, true);
113113
addSelectedStreamParameter (Parameter::PROCESSOR_SCOPE, "active_stream", "Active Stream", "Currently active stream", {}, 0);
114114
addTimeParameter (Parameter::PROCESSOR_SCOPE, "start_time", "Start Time", "Time to start playback");
115115
addTimeParameter (Parameter::PROCESSOR_SCOPE, "end_time", "Stop Time", "Time to end playback");

Source/Processors/GenericProcessor/GenericProcessor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ void GenericProcessor::addPathParameter (
422422
const File& defaultValue,
423423
const StringArray& validFileExtensions,
424424
bool isDirectory,
425+
bool isRequired,
425426
bool deactivateDuringAcquisition)
426427
{
427428
PathParameter* p =
@@ -433,6 +434,7 @@ void GenericProcessor::addPathParameter (
433434
defaultValue,
434435
validFileExtensions,
435436
isDirectory,
437+
isRequired,
436438
deactivateDuringAcquisition);
437439

438440
if (scope == Parameter::PROCESSOR_SCOPE)

Source/Processors/GenericProcessor/GenericProcessor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ class PLUGIN_API GenericProcessor : public GenericProcessorBase, public PluginCl
377377
const File& defaultValue,
378378
const StringArray& validFileExtensions,
379379
bool isDirectory,
380+
bool isRequired,
380381
bool deactivateDuringAcquisition = true);
381382

382383
/** Adds a selected stream parameter which holds the currentlu selected stream */

Source/Processors/Parameter/Parameter.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,7 @@ PathParameter::PathParameter (ParameterOwner* owner,
11841184
const File& defaultValue_,
11851185
const StringArray& fileExtensions_,
11861186
bool isDirectory_,
1187+
bool isRequired_,
11871188
bool deactivateDuringAcquisition)
11881189
: Parameter (owner,
11891190
ParameterType::PATH_PARAM,
@@ -1194,7 +1195,8 @@ PathParameter::PathParameter (ParameterOwner* owner,
11941195
defaultValue_.getFullPathName(),
11951196
deactivateDuringAcquisition),
11961197
filePatternsAllowed (fileExtensions_),
1197-
isDirectory (isDirectory_)
1198+
isDirectory (isDirectory_),
1199+
isRequired (isRequired_)
11981200
{
11991201
currentValue = defaultValue;
12001202
}
@@ -1257,6 +1259,10 @@ bool PathParameter::isValid()
12571259
{
12581260
return true;
12591261
}
1262+
else if (! isRequired)
1263+
{
1264+
return true;
1265+
}
12601266

12611267
return false;
12621268
}

Source/Processors/Parameter/Parameter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ class PLUGIN_API PathParameter : public Parameter
883883
const File& defaultValue,
884884
const StringArray& filePatternsAllowed,
885885
const bool isDirectory,
886+
const bool isRequired = true,
886887
bool deactivateDuringAcquisition = true);
887888

888889
/** Sets the current value*/
@@ -912,6 +913,7 @@ class PLUGIN_API PathParameter : public Parameter
912913
private:
913914
StringArray filePatternsAllowed;
914915
bool isDirectory;
916+
bool isRequired;
915917
};
916918

917919
/**

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ RecordNode::~RecordNode()
106106
void RecordNode::registerParameters()
107107
{
108108
String defaultRecordDirectory = CoreServices::getRecordingParentDirectory().getFullPathName();
109-
addPathParameter (Parameter::PROCESSOR_SCOPE, "directory", "Directory", "Path to write data to", defaultRecordDirectory, {}, true);
109+
addPathParameter (Parameter::PROCESSOR_SCOPE, "directory", "Directory", "Path to write data to", defaultRecordDirectory, {}, true, true);
110110

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

0 commit comments

Comments
 (0)