@@ -103,6 +103,7 @@ void FileReader::parameterValueChanged (Parameter* p)
103103{
104104 if (p->getName () == " selected_file" )
105105 {
106+ LOGC (" FileReader::parameterValueChanged - selected_file changed to: " , p->getValue ().toString ());
106107 setFile (p->getValue (), false );
107108 }
108109 else if (p->getName () == " active_stream" )
@@ -239,6 +240,8 @@ bool FileReader::setFile (String fullpath, bool shouldUpdateSignalChain)
239240 }
240241 }
241242
243+ LOGC (" [FileReader] set file: " , fullpath);
244+
242245 // Open file
243246 File file (fullpath);
244247
@@ -262,28 +265,31 @@ bool FileReader::setFile (String fullpath, bool shouldUpdateSignalChain)
262265 if (! input)
263266 {
264267 LOGE (" Error creating file source for extension " , ext);
268+ showWarningAsync (" Failed to open file" , " Error creating file source for extension " + ext);
265269 return false ;
266270 }
267271 }
268272 else
269273 {
270274 input = nullptr ;
275+ showWarningAsync (" Failed to open file" , " File type \" " + ext + " \" not supported" );
271276 CoreServices::sendStatusMessage (" File type not supported" );
272277 return false ;
273278 }
274279
275280 if (! input->openFile (file))
276281 {
277282 input = nullptr ;
283+ showWarningAsync (" Invalid file" , " The selected file is invalid. Please make sure the file is not corrupted and has valid format." );
278284 CoreServices::sendStatusMessage (" Invalid file" );
279-
280285 return false ;
281286 }
282287
283288 const bool isEmptyFile = input->getNumRecords () <= 0 ;
284289 if (isEmptyFile)
285290 {
286291 input = nullptr ;
292+ showWarningAsync (" Failed to open file" , " Continuous data file is missing or empty." );
287293 CoreServices::sendStatusMessage (" Empty file. Ignoring open operation" );
288294
289295 return false ;
@@ -318,6 +324,17 @@ bool FileReader::setFile (String fullpath, bool shouldUpdateSignalChain)
318324 return true ;
319325}
320326
327+ void FileReader::showWarningAsync (const String& title, const String& message) const
328+ {
329+ if (headlessMode)
330+ return ;
331+
332+ MessageManager::callAsync ([title, message]()
333+ { AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
334+ title,
335+ message); });
336+ }
337+
321338void FileReader::setActiveStream (int index, bool reset)
322339{
323340 // Resets the stream to the beginning if reset flag is true
0 commit comments