2025-06-22 17:18:53 +02:00
# include "explorer.h"
2024-12-29 20:13:58 +01:00
// #include "image_handler.h"
// #include "radiation_handler.h"
// #include "scatterometer_handler.h"
2024-12-31 17:01:12 +01:00
// #include "core/config.h"
// #include "products/dataset.h"
2024-12-29 20:13:58 +01:00
# include "common/utils.h"
2025-05-25 14:30:24 +02:00
// #include "core/resources.h"
2025-04-15 19:06:12 +01:00
# include "core/plugin.h"
2024-12-29 20:13:58 +01:00
2025-04-27 12:24:09 +02:00
# include "core/style.h"
2025-04-15 19:06:12 +01:00
# include "dsp/cyclo_test.h"
2025-04-21 23:17:21 +02:00
# include "dsp/flowgraph/dsp_flowgraph_handler.h"
2025-05-19 22:26:32 +02:00
# include "handlers/dataset/dataset_handler.h"
# include "handlers/dummy_handler.h"
# include "handlers/product/image_product_handler.h" // TODOREWORK CLEAN
# include "handlers/projection/projection_handler.h"
# include "handlers/trash/trash_handler.h"
# include "handlers/vector/shapefile_handler.h"
2025-03-14 11:12:18 +01:00
// TODOREWORK
2025-05-25 14:30:24 +02:00
# include "core/resources.h"
2025-06-09 00:06:07 +02:00
# include "imgui/imgui.h"
2024-12-29 20:13:58 +01:00
2025-03-15 23:37:59 +01:00
// TODOREWORK
2025-03-22 11:51:53 +01:00
# include "dsp/newrec.h"
2025-04-15 19:06:12 +01:00
# include "dsp/waterfall_test.h"
2025-03-15 23:37:59 +01:00
2025-05-25 14:30:24 +02:00
# include "image/io.h"
2025-04-06 10:27:54 +02:00
2025-04-15 19:06:12 +01:00
# include "imgui/imgui_filedrop.h"
2024-12-29 20:13:58 +01:00
namespace satdump
{
2025-06-22 17:18:53 +02:00
namespace explorer
2024-12-29 20:13:58 +01:00
{
2025-06-22 17:18:53 +02:00
ExplorerApplication : : ExplorerApplication ( ) : Application ( " explorer " )
2024-12-29 20:13:58 +01:00
{
2025-06-22 17:18:53 +02:00
master_handler = std : : make_shared < handlers : : DummyHandler > ( " MasterHandlerExplorer " ) ;
2025-03-22 11:51:53 +01:00
// Add trashcan
2025-06-22 17:18:53 +02:00
trash_handler = std : : make_shared < handlers : : DummyHandler > ( " TrashHandlerExplorer " ) ;
2025-05-19 22:26:32 +02:00
auto trash_h = std : : make_shared < handlers : : TrashHandler > ( ) ;
2025-03-14 14:39:05 +01:00
trash_h - > setCanBeDragged ( false ) ;
2025-03-22 11:51:53 +01:00
trash_handler - > addSubHandler ( trash_h ) ;
trash_handler - > setCanBeDraggedTo ( false ) ;
2025-01-31 10:34:47 +01:00
2025-06-22 17:18:53 +02:00
// Enable dropping files onto the explorer. TODOREWORK, check the explorer IS active!?
2025-04-15 19:06:12 +01:00
eventBus - > register_handler < imgui_utils : : FileDropEvent > (
[ this ] ( const imgui_utils : : FileDropEvent & v )
{
for ( auto & f : v . files )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( f ) ;
2025-04-15 19:06:12 +01:00
} ) ;
2025-06-22 17:18:53 +02:00
// Enable adding handlers to the explorer externally
2025-07-08 21:33:14 +02:00
eventBus - > register_handler < ExplorerAddHandlerEvent > (
[ this ] ( const ExplorerAddHandlerEvent & e )
{
master_handler - > addSubHandler ( e . h ) ;
if ( e . open )
curr_handler = e . h ;
} ) ;
2025-06-14 21:56:36 +02:00
2025-05-19 22:26:32 +02:00
// TODOREWORK. Returns the last selected handler of a specific type if available
2025-05-15 14:04:34 +02:00
eventBus - > register_handler < GetLastSelectedOfTypeEvent > (
[ this ] ( const GetLastSelectedOfTypeEvent & v )
{
if ( last_selected_handler . count ( v . type ) )
v . h = last_selected_handler [ v . type ] ;
else
2025-05-19 22:26:32 +02:00
v . h = nullptr ;
2025-05-15 14:04:34 +02:00
} ) ;
2025-05-19 22:26:32 +02:00
// TODOREWORK remove
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/SatDump_NEWPRODS/metop_test/dataset.json " ) ;
2024-12-31 17:01:12 +01:00
}
2024-12-29 20:13:58 +01:00
2025-06-22 17:18:53 +02:00
ExplorerApplication : : ~ ExplorerApplication ( )
2024-12-29 20:13:58 +01:00
{
2025-01-03 10:03:04 +01:00
if ( file_open_thread . joinable ( ) )
file_open_thread . join ( ) ;
2024-12-29 20:13:58 +01:00
}
2025-06-22 17:18:53 +02:00
void ExplorerApplication : : drawPanel ( )
2024-12-29 20:13:58 +01:00
{
2024-12-31 17:01:12 +01:00
ImGui : : SetNextItemWidth ( ImGui : : GetWindowWidth ( ) / 2 ) ;
2024-12-29 20:13:58 +01:00
2024-12-31 17:01:12 +01:00
if ( ImGui : : CollapsingHeader ( " General " , ImGuiTreeNodeFlags_DefaultOpen ) )
2024-12-29 20:13:58 +01:00
{
2025-05-15 14:04:34 +02:00
auto prev_curr = curr_handler ;
2024-12-31 17:01:12 +01:00
if ( ImGui : : BeginTable ( " ##masterhandlertable " , 1 , ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders ) )
{
ImGui : : TableSetupColumn ( " ##masterhandlertable_col " , ImGuiTableColumnFlags_None ) ;
ImGui : : TableNextColumn ( ) ;
2024-12-29 20:13:58 +01:00
2024-12-31 17:01:12 +01:00
master_handler - > drawTreeMenu ( curr_handler ) ;
2025-03-22 11:51:53 +01:00
trash_handler - > drawTreeMenu ( curr_handler ) ;
2024-12-29 20:13:58 +01:00
2024-12-31 17:01:12 +01:00
ImGui : : EndTable ( ) ;
}
2024-12-29 20:13:58 +01:00
2025-05-15 14:04:34 +02:00
if ( prev_curr ! = curr_handler )
last_selected_handler . insert_or_assign ( curr_handler - > getID ( ) , curr_handler ) ;
2025-01-02 17:04:32 +01:00
}
2025-07-08 22:01:05 +02:00
if ( curr_handler )
curr_handler - > drawMenu ( ) ;
2025-01-02 17:04:32 +01:00
}
2025-06-22 17:18:53 +02:00
void ExplorerApplication : : drawMenuBar ( )
2025-01-02 17:04:32 +01:00
{
2025-01-03 10:03:04 +01:00
// Handle File Stuff TODOREWORK?
{
2025-05-19 22:26:32 +02:00
if ( file_open_dialog . update ( ) )
2025-01-03 10:03:04 +01:00
{
2025-05-19 22:26:32 +02:00
std : : string prod_path = file_open_dialog . getPath ( ) ;
2025-05-03 12:12:36 +02:00
if ( prod_path . size ( ) > 0 )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( prod_path ) ;
2025-05-03 12:12:36 +02:00
else
logger - > trace ( " No file selected " ) ;
2025-01-03 10:03:04 +01:00
}
}
2025-01-02 17:04:32 +01:00
if ( ImGui : : BeginMenuBar ( ) )
{
2025-05-19 22:26:32 +02:00
// Main "Open" menu, for files, other handlers, etc
2025-01-02 17:04:32 +01:00
if ( ImGui : : BeginMenu ( " File " ) )
2025-01-01 05:57:58 +01:00
{
2025-05-19 22:26:32 +02:00
file_open_dialog . render ( " Open File " , " Open File " , " " , { { " All Files " , " * " } } ) ;
2025-01-02 17:04:32 +01:00
2025-05-23 12:30:42 +02:00
if ( ImGui : : BeginMenu ( " Quick Open " ) )
{
ImGui : : InputText ( " ##quickvieweropen " , & quickOpenString ) ;
2025-06-25 20:23:10 +02:00
bool go = ImGui : : IsItemDeactivatedAfterEdit ( ) ;
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Go##loadfromhttpgo " ) | | go )
2025-05-23 12:30:42 +02:00
{
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( quickOpenString ) ;
2025-05-23 12:30:42 +02:00
quickOpenString . clear ( ) ;
}
2025-06-25 20:23:10 +02:00
ImGui : : SameLine ( ) ;
2025-06-09 00:06:07 +02:00
if ( ImGui : : Button ( " Paste & Load " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( std : : string ( ImGui : : GetClipboardText ( ) ) ) ;
2025-05-23 12:30:42 +02:00
ImGui : : EndMenu ( ) ;
}
2025-05-19 22:26:32 +02:00
// TODOREWORK remove
2025-01-02 17:04:32 +01:00
if ( ImGui : : BeginMenu ( " Hardcoded " ) )
2025-01-01 05:57:58 +01:00
{
2025-01-02 17:04:32 +01:00
if ( ImGui : : MenuItem ( " Load KMSS " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/SatDump_NEWPRODS/KMSS_24/dataset.json " ) ;
2025-01-02 17:04:32 +01:00
if ( ImGui : : MenuItem ( " Load Sterna " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/SatDump_NEWPRODS/aws_pfm_cadu/dataset.json " ) ;
2025-01-02 17:04:32 +01:00
if ( ImGui : : MenuItem ( " Load MSUGS " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/20241231_132953_ARKTIKA-M 2_dat/MSUGS_VIS1/product.cbor " ) ;
2025-01-02 17:04:32 +01:00
if ( ImGui : : MenuItem ( " Load MSUGS 2 " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/SatDump_NEWPRODS/20250104_071415_ELEKTRO-L_3_dat/dataset.json " ) ;
2025-01-03 16:26:39 +01:00
if ( ImGui : : MenuItem ( " Load MetOp " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/SatDump_NEWPRODS/metop_test/dataset.json " ) ;
2025-01-05 19:57:26 +01:00
if ( ImGui : : MenuItem ( " Load L3 " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /data_ssd/ELEKTRO-L3/20250104_071415_ELEKTRO-L 3.dat_OUT/dataset.json " ) ;
2025-01-09 20:34:51 +01:00
if ( ImGui : : MenuItem ( " Load JPSS-1 " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/SatDump_NEWPRODS/202411271228_NOAA_20/dataset.json " ) ;
2025-01-09 20:34:51 +01:00
if ( ImGui : : MenuItem ( " Load JPSS-2 " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/SatDump_NEWPRODS/n21_day/dataset.json " ) ;
2025-01-14 19:05:15 +01:00
if ( ImGui : : MenuItem ( " Load APT " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/audio_137912500Hz_11-39-56_04-03-2024_wav/dataset.json " ) ;
2025-01-15 22:00:47 +01:00
if ( ImGui : : MenuItem ( " Load GOES " ) )
2025-06-22 17:18:53 +02:00
tryOpenFileInExplorer ( " /home/alan/Downloads/SatDump_NEWPRODS/goes_hrit_jvital2013_cadu/IMAGES/GOES-16/Full Disk/2024-04-17_18-00-20/product.cbor " ) ;
2025-02-03 07:48:52 +01:00
if ( ImGui : : MenuItem ( " Load Shapefile " ) )
{
2025-05-19 22:26:32 +02:00
auto shp_h = std : : make_shared < handlers : : ShapefileHandler > ( resources : : getResourcePath ( " maps/ne_10m_admin_0_countries.shp " ) ) ;
2025-02-03 07:48:52 +01:00
master_handler - > addSubHandler ( shp_h ) ;
}
2025-01-03 10:03:04 +01:00
2025-02-07 14:31:18 +01:00
if ( ImGui : : MenuItem ( " Load Shapefile FRA_1 " ) )
{
2025-05-19 22:26:32 +02:00
auto shp_h = std : : make_shared < handlers : : ShapefileHandler > ( " /home/alan/Downloads/gadm41_FRA_shp/gadm41_FRA_1.shp " ) ;
2025-02-07 14:31:18 +01:00
master_handler - > addSubHandler ( shp_h ) ;
}
if ( ImGui : : MenuItem ( " Load Shapefile FRA_2 " ) )
{
2025-05-19 22:26:32 +02:00
auto shp_h = std : : make_shared < handlers : : ShapefileHandler > ( " /home/alan/Downloads/gadm41_FRA_shp/gadm41_FRA_2.shp " ) ;
2025-02-07 14:31:18 +01:00
master_handler - > addSubHandler ( shp_h ) ;
}
2025-01-02 17:04:32 +01:00
ImGui : : EndMenu ( ) ;
2025-01-01 05:57:58 +01:00
}
2025-01-02 17:04:32 +01:00
2025-06-22 18:09:25 +02:00
if ( ImGui : : BeginMenu ( " Tools " ) )
2025-05-19 22:26:32 +02:00
{ // TODOREWORK?
2025-02-09 16:34:06 +01:00
if ( ImGui : : MenuItem ( " Projection " ) )
2025-05-19 22:26:32 +02:00
master_handler - > addSubHandler ( std : : make_shared < handlers : : ProjectionHandler > ( ) ) ;
2025-03-09 10:16:40 +01:00
if ( ImGui : : MenuItem ( " DSP Flowgraph " ) )
2025-05-19 22:26:32 +02:00
master_handler - > addSubHandler ( std : : make_shared < handlers : : DSPFlowGraphHandler > ( ) ) ;
2025-03-15 23:37:59 +01:00
if ( ImGui : : MenuItem ( " Waterfall TEST " ) )
2025-05-19 22:26:32 +02:00
master_handler - > addSubHandler ( std : : make_shared < handlers : : WaterfallTestHandler > ( ) ) ;
2025-03-22 11:51:53 +01:00
if ( ImGui : : MenuItem ( " NewRec TEST " ) )
2025-05-19 22:26:32 +02:00
master_handler - > addSubHandler ( std : : make_shared < handlers : : NewRecHandler > ( ) ) ;
2025-04-12 09:07:02 +02:00
if ( ImGui : : MenuItem ( " CycloHelper TEST " ) )
2025-05-19 22:26:32 +02:00
master_handler - > addSubHandler ( std : : make_shared < handlers : : CycloHelperHandler > ( ) ) ;
2025-01-02 17:04:32 +01:00
ImGui : : EndMenu ( ) ;
2025-01-01 05:57:58 +01:00
}
2025-05-19 22:26:32 +02:00
2025-06-22 18:09:25 +02:00
ImGui : : EndMenu ( ) ;
}
if ( ImGui : : BeginMenu ( " Handler " , bool ( curr_handler ) ) )
{
2025-01-04 23:03:13 +01:00
if ( curr_handler & & ImGui : : BeginMenu ( " Config " ) )
{
if ( ImGui : : MenuItem ( " JSON To Clipboard " ) )
2025-06-22 11:50:58 +02:00
{
2025-01-04 23:03:13 +01:00
ImGui : : SetClipboardText ( curr_handler - > getConfig ( ) . dump ( 4 ) . c_str ( ) ) ;
2025-06-22 11:50:58 +02:00
logger - > warn ( " Copied to clipboard! " ) ;
}
2025-01-04 23:03:13 +01:00
if ( ImGui : : MenuItem ( " JSON From Clipboard " ) )
2025-06-22 11:50:58 +02:00
{
2025-01-04 23:03:13 +01:00
curr_handler - > setConfig ( nlohmann : : json : : parse ( ImGui : : GetClipboardText ( ) ) ) ;
2025-06-22 11:50:58 +02:00
logger - > warn ( " Copied from clipboard! " ) ;
}
2025-01-04 23:03:13 +01:00
ImGui : : EndMenu ( ) ;
}
2025-01-02 17:04:32 +01:00
ImGui : : EndMenu ( ) ;
}
2025-06-22 18:09:25 +02:00
// TODOREWORK
2025-01-02 17:04:32 +01:00
if ( curr_handler )
{
if ( ImGui : : BeginMenu ( " Current " ) )
2025-01-01 05:57:58 +01:00
{
2025-01-02 17:04:32 +01:00
curr_handler - > drawMenuBar ( ) ;
ImGui : : EndMenu ( ) ;
2025-01-01 05:57:58 +01:00
}
}
2024-12-29 20:13:58 +01:00
2025-05-18 20:05:55 +02:00
eventBus - > fire_event < RenderLoadMenuElementsEvent > ( { curr_handler , master_handler } ) ;
2025-03-25 21:33:06 +01:00
2025-01-02 17:04:32 +01:00
ImGui : : EndMenuBar ( ) ;
2024-12-29 20:13:58 +01:00
}
}
2025-06-22 17:18:53 +02:00
void ExplorerApplication : : drawContents ( ) { ImGui : : Text ( " No handler selected! " ) ; }
2024-12-29 20:13:58 +01:00
2025-06-22 17:18:53 +02:00
void ExplorerApplication : : drawUI ( )
2024-12-29 20:13:58 +01:00
{
2025-07-05 22:22:17 +02:00
drawMenuBar ( ) ;
2025-06-22 17:18:53 +02:00
ImVec2 explorer_size = ImGui : : GetContentRegionAvail ( ) ;
2024-12-29 20:13:58 +01:00
2025-01-03 10:03:04 +01:00
if ( ImGui : : BeginTable ( " ##wiever_table " , 2 , ImGuiTableFlags_Resizable | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_BordersInnerV ) )
2024-12-29 20:13:58 +01:00
{
2025-06-22 17:18:53 +02:00
ImGui : : TableSetupColumn ( " ##panel_v " , ImGuiTableColumnFlags_None , explorer_size . x * panel_ratio ) ;
ImGui : : TableSetupColumn ( " ##view " , ImGuiTableColumnFlags_None , explorer_size . x * ( 1.0f - panel_ratio ) ) ;
2024-12-31 17:01:12 +01:00
ImGui : : TableNextColumn ( ) ;
2024-12-29 20:13:58 +01:00
2024-12-31 17:01:12 +01:00
float left_width = ImGui : : GetColumnWidth ( 0 ) ;
2025-06-22 17:18:53 +02:00
float right_width = explorer_size . x - left_width ;
2024-12-31 17:01:12 +01:00
if ( left_width ! = last_width & & last_width ! = - 1 )
2025-06-22 17:18:53 +02:00
panel_ratio = left_width / explorer_size . x ;
2024-12-31 17:01:12 +01:00
last_width = left_width ;
2024-12-29 20:13:58 +01:00
2025-07-05 22:22:17 +02:00
ImGui : : BeginChild ( " ExplorerChildPanel " , { left_width , float ( explorer_size . y - 10 ) } , false ) ;
2024-12-31 17:01:12 +01:00
drawPanel ( ) ;
ImGui : : EndChild ( ) ;
2024-12-29 20:13:58 +01:00
2024-12-31 17:01:12 +01:00
ImGui : : TableNextColumn ( ) ;
ImGui : : BeginGroup ( ) ;
2024-12-29 20:13:58 +01:00
2024-12-31 17:01:12 +01:00
if ( curr_handler )
2025-06-22 17:18:53 +02:00
curr_handler - > drawContents ( { float ( right_width - 9 * ui_scale ) , float ( explorer_size . y ) } ) ;
2025-01-02 17:04:32 +01:00
else
drawContents ( ) ;
2024-12-29 20:13:58 +01:00
2024-12-31 17:01:12 +01:00
ImGui : : EndGroup ( ) ;
ImGui : : EndTable ( ) ;
2024-12-29 20:13:58 +01:00
}
}
2025-01-03 10:03:04 +01:00
2025-06-22 17:18:53 +02:00
void ExplorerApplication : : tryOpenFileInExplorer ( std : : string path )
2025-01-03 10:03:04 +01:00
{
if ( file_open_thread . joinable ( ) )
file_open_thread . join ( ) ;
auto fun = [ this , path ] ( )
{
2025-04-06 10:27:54 +02:00
try
2025-01-03 10:03:04 +01:00
{
2025-04-06 10:27:54 +02:00
if ( ! std : : filesystem : : path ( path ) . has_extension ( ) )
{
logger - > error ( " Invalid file, no extension! " ) ;
return ;
}
2025-01-03 10:03:04 +01:00
2025-04-06 10:27:54 +02:00
if ( std : : filesystem : : path ( path ) . extension ( ) . string ( ) = = " .cbor " )
2025-01-03 22:43:40 +01:00
{
2025-06-22 17:18:53 +02:00
logger - > trace ( " Explorer loading product " + path ) ;
2025-05-09 14:02:46 +02:00
2025-04-06 10:27:54 +02:00
try
{
2025-05-19 22:26:32 +02:00
auto prod_h = handlers : : getProductHandlerForProduct ( products : : loadProduct ( path ) ) ;
2025-04-06 10:27:54 +02:00
master_handler - > addSubHandler ( prod_h ) ;
}
catch ( std : : exception & e )
{
2025-06-25 20:26:29 +02:00
logger - > error ( " Error loading product! Maybe not a valid product? (Reminder : Pre-2.0.0 products are NOT compatible with 2.0.0) Details : %s " , e . what ( ) ) ;
2025-04-06 10:27:54 +02:00
}
2025-01-03 22:43:40 +01:00
}
2025-04-06 10:27:54 +02:00
else if ( std : : filesystem : : path ( path ) . extension ( ) . string ( ) = = " .json " )
2025-01-03 22:43:40 +01:00
{
2025-05-09 14:02:46 +02:00
logger - > trace ( " Viewer loading dataset " + path ) ;
2025-04-06 10:27:54 +02:00
try
{
products : : DataSet dataset ;
dataset . load ( path ) ;
2025-05-19 22:26:32 +02:00
std : : shared_ptr < handlers : : DatasetHandler > dat_h = std : : make_shared < handlers : : DatasetHandler > ( std : : filesystem : : path ( path ) . parent_path ( ) . string ( ) , dataset ) ;
2025-04-06 10:27:54 +02:00
master_handler - > addSubHandler ( dat_h ) ;
}
catch ( std : : exception & e )
{
2025-06-25 20:26:29 +02:00
logger - > error ( " Error loading dataset! Maybe not a valid dataset? (Reminder : Pre-2.0.0 datasets are NOT compatible with 2.0.0) Details : %s " , e . what ( ) ) ;
2025-04-06 10:27:54 +02:00
}
2025-01-03 22:43:40 +01:00
}
2025-04-06 10:27:54 +02:00
else if ( std : : filesystem : : path ( path ) . extension ( ) . string ( ) = = " .shp " )
2025-01-03 22:43:40 +01:00
{
2025-05-09 14:02:46 +02:00
logger - > trace ( " Viewer loading shapefile " + path ) ;
2025-05-19 22:26:32 +02:00
master_handler - > addSubHandler ( std : : make_shared < handlers : : ShapefileHandler > ( path ) ) ;
2025-01-03 22:43:40 +01:00
}
2025-04-06 10:27:54 +02:00
else
2025-01-03 22:43:40 +01:00
{
2025-05-09 14:02:46 +02:00
logger - > trace ( " Viewer loading image " + path ) ;
2025-04-06 10:27:54 +02:00
image : : Image img ;
image : : load_img ( img , path ) ;
if ( img . size ( ) > 0 )
2025-05-19 22:26:32 +02:00
master_handler - > addSubHandler ( std : : make_shared < handlers : : ImageHandler > ( img , std : : filesystem : : path ( path ) . stem ( ) . string ( ) ) ) ;
2025-04-06 10:27:54 +02:00
else
2025-05-24 20:17:10 +02:00
logger - > error ( " Could not open this file as image! " ) ;
2025-01-03 22:43:40 +01:00
}
2025-01-03 10:03:04 +01:00
}
2025-04-06 10:27:54 +02:00
catch ( std : : exception & e )
2025-02-03 07:52:21 +01:00
{
2025-04-06 10:27:54 +02:00
logger - > error ( " Error opening file! => %s " , e . what ( ) ) ;
2025-02-03 07:52:21 +01:00
}
2025-01-03 10:03:04 +01:00
} ;
file_open_thread = std : : thread ( fun ) ;
}
2025-06-22 17:18:53 +02:00
} // namespace explorer
2025-04-15 19:06:12 +01:00
} ; // namespace satdump