MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / openFilesDialog

Function openFilesDialog

source/MRViewer/MRFileDialog.cpp:517–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517std::vector<std::filesystem::path> openFilesDialog( const FileParameters& params )
518{
519 FileDialog::Parameters parameters{ params };
520 parameters.folderDialog = false;
521 parameters.multiselect = true;
522 parameters.saveDialog = false;
523 if ( parameters.filters.empty() )
524 parameters.filters = { { "All files", "*.*" } };
525
526 const auto results = runDialog( parameters );
527 if ( results.empty() )
528 spdlog::info( "Open dialog canceled" );
529 else
530 {
531 spdlog::info( "Open dialog returned {} items", results.size() );
532 for ( size_t i = 0; i < results.size(); ++i )
533 {
534 std::error_code ec;
535 auto sz = file_size( results[i], ec );
536 if ( ec )
537 spdlog::info( " item #{}: {}, access error {}", i, MR::utf8string( results[i] ), ec.message() );
538 else
539 spdlog::info( " item #{}: {}, filesize={}", i, MR::utf8string( results[i] ), sz );
540 }
541 FileDialogSignals::instance().onOpenFiles( results );
542 }
543 return results;
544}
545
546void openFilesDialogAsync( std::function<void( const std::vector<std::filesystem::path>& )> callback, const FileParameters& params /*= {} */ )
547{

Callers 1

openFilesDialogAsyncFunction · 0.85

Calls 5

runDialogFunction · 0.85
utf8stringFunction · 0.85
instanceFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected