Manages open/save file dialogs and background file loading.
More...
#include <FileIOHandler.hpp>
|
| | FileIOHandler (::AppWindow &window, TrajectoryLoader &loader, AnalysisDispatcher &dispatcher, ProgramOptions &options, AppController &controller) |
| | Constructs the FileIOHandler with injected services.
|
| | ~FileIOHandler () |
| | Destructor. Ensures background threads are joined.
|
| void | handleBrowseFile () |
| | Displays file open dialog asynchronously and triggers background loading of selected structure/trajectory file.
|
| void | handleReloadFile () |
| | Reloads the currently loaded structure/trajectory file from disk asynchronously.
|
| void | handleWriteFiles () |
| | Displays file save dialog asynchronously and exports active structural data.
|
| void | handleExportStructure () |
| | Displays file save dialog asynchronously and exports/converts the active structure to POSCAR, CELL, CIF, or CAR format.
|
| void | startLoadingTrajectory (const std::string &filepath, std::function< void(bool)> on_complete=nullptr) |
| | Initiates asynchronous trajectory loading on the background worker thread.
|
| void | startLoadingTrajectories (const std::vector< std::string > &filepaths, std::function< void(bool)> on_complete=nullptr) |
| | Initiates asynchronous trajectory loading for multiple files on the background worker thread.
|
| void | updateBoxDiagnostics (const core::Cell *cell) |
| | Updates simulation cell diagnostics (volume, dimensions, density) on the UI.
|
| void | updateBoxDiagnosticsForFrame (size_t frame_index) |
| | Updates simulation cell diagnostics on the UI for a specific trajectory frame.
|
| void | handleRenameElement (const std::string &old_symbol, const std::string &new_symbol) |
| | Renames an element species across the loaded trajectory and refreshes UI models.
|
|
| void | refreshAtomCountsUI () |
| | Populates UI AtomCount vector model with species counts, CPK colors, and unknown flags.
|
| void | onTrajectoryLoadSuccess (const std::string &filepath) |
| | Updates UI components and analysis options after successful trajectory loading.
|
| void | updateFileMetadata (const std::string &filepath) |
| | Updates loaded file metadata (basename, frame counts, atom counts) on the UI.
|
| void | updateStructure3DView () |
| | Updates 3D structure/trajectory view with loaded cell or trajectory.
|
| void | executeWriteFiles (const std::string &filepath) |
| | Executes export of active structural datasets based on the selected file path extension.
|
Manages open/save file dialogs and background file loading.
◆ FileIOHandler()
Constructs the FileIOHandler with injected services.
- Parameters
-
| [in,out] | window | Reference to the UI window. |
| [in,out] | loader | Reference to the trajectory loader. |
| [in,out] | dispatcher | Reference to the analysis dispatcher. |
| [in,out] | options | Reference to program options. |
| [in,out] | controller | Reference to the main AppController. |
◆ ~FileIOHandler()
| correlation::app::FileIOHandler::~FileIOHandler |
( |
| ) |
|
Destructor. Ensures background threads are joined.
◆ executeWriteFiles()
| void correlation::app::FileIOHandler::executeWriteFiles |
( |
const std::string & | filepath | ) |
|
|
private |
Executes export of active structural datasets based on the selected file path extension.
- Parameters
-
| [in] | filepath | Absolute base path for writing files. |
◆ handleBrowseFile()
| void correlation::app::FileIOHandler::handleBrowseFile |
( |
| ) |
|
Displays file open dialog asynchronously and triggers background loading of selected structure/trajectory file.
◆ handleExportStructure()
| void correlation::app::FileIOHandler::handleExportStructure |
( |
| ) |
|
Displays file save dialog asynchronously and exports/converts the active structure to POSCAR, CELL, CIF, or CAR format.
◆ handleReloadFile()
| void correlation::app::FileIOHandler::handleReloadFile |
( |
| ) |
|
Reloads the currently loaded structure/trajectory file from disk asynchronously.
◆ handleRenameElement()
| void correlation::app::FileIOHandler::handleRenameElement |
( |
const std::string & | old_symbol, |
|
|
const std::string & | new_symbol ) |
Renames an element species across the loaded trajectory and refreshes UI models.
- Parameters
-
| [in] | old_symbol | Existing element symbol (e.g., "1"). |
| [in] | new_symbol | Replacement element symbol (e.g., "Cu"). |
◆ handleWriteFiles()
| void correlation::app::FileIOHandler::handleWriteFiles |
( |
| ) |
|
Displays file save dialog asynchronously and exports active structural data.
◆ onTrajectoryLoadSuccess()
| void correlation::app::FileIOHandler::onTrajectoryLoadSuccess |
( |
const std::string & | filepath | ) |
|
|
private |
Updates UI components and analysis options after successful trajectory loading.
- Parameters
-
| [in] | filepath | Path to the loaded structure or trajectory file. |
◆ refreshAtomCountsUI()
| void correlation::app::FileIOHandler::refreshAtomCountsUI |
( |
| ) |
|
|
private |
Populates UI AtomCount vector model with species counts, CPK colors, and unknown flags.
◆ startLoadingTrajectories()
| void correlation::app::FileIOHandler::startLoadingTrajectories |
( |
const std::vector< std::string > & | filepaths, |
|
|
std::function< void(bool)> | on_complete = nullptr ) |
Initiates asynchronous trajectory loading for multiple files on the background worker thread.
- Parameters
-
| [in] | filepaths | Collection of paths to trajectory files. |
| [in] | on_complete | Optional callback invoked on event loop when loading finishes. |
◆ startLoadingTrajectory()
| void correlation::app::FileIOHandler::startLoadingTrajectory |
( |
const std::string & | filepath, |
|
|
std::function< void(bool)> | on_complete = nullptr ) |
Initiates asynchronous trajectory loading on the background worker thread.
- Parameters
-
| [in] | filepath | Absolute path to structure or trajectory file. |
| [in] | on_complete | Optional callback invoked on event loop when loading finishes. |
◆ updateBoxDiagnostics()
| void correlation::app::FileIOHandler::updateBoxDiagnostics |
( |
const core::Cell * | cell | ) |
|
Updates simulation cell diagnostics (volume, dimensions, density) on the UI.
- Parameters
-
| [in] | cell | Pointer to the simulation cell, or nullptr if unavailable. |
◆ updateBoxDiagnosticsForFrame()
| void correlation::app::FileIOHandler::updateBoxDiagnosticsForFrame |
( |
size_t | frame_index | ) |
|
Updates simulation cell diagnostics on the UI for a specific trajectory frame.
- Parameters
-
| [in] | frame_index | Zero-based trajectory frame index. |
◆ updateFileMetadata()
| void correlation::app::FileIOHandler::updateFileMetadata |
( |
const std::string & | filepath | ) |
|
|
private |
Updates loaded file metadata (basename, frame counts, atom counts) on the UI.
- Parameters
-
| [in] | filepath | Path to the loaded structure or trajectory file. |
◆ updateStructure3DView()
| void correlation::app::FileIOHandler::updateStructure3DView |
( |
| ) |
|
|
private |
Updates 3D structure/trajectory view with loaded cell or trajectory.
◆ alive_
| std::shared_ptr<std::atomic<bool> > correlation::app::FileIOHandler::alive_ |
|
private |
Initial value:{
std::make_shared<std::atomic<bool>>(true)}
Lifetime guard for queued UI callbacks.
◆ controller_
◆ dialog_active_
| std::atomic<bool> correlation::app::FileIOHandler::dialog_active_ |
|
private |
Initial value:
Concurrency guard preventing duplicate dialog launches.
◆ dialog_thread_
| std::jthread correlation::app::FileIOHandler::dialog_thread_ |
|
private |
Background worker thread for native file dialogs.
◆ dispatcher_
◆ load_thread_
| std::jthread correlation::app::FileIOHandler::load_thread_ |
|
private |
Background thread for loading files without blocking UI.
◆ loaded_filepaths_
| std::vector<std::string> correlation::app::FileIOHandler::loaded_filepaths_ |
|
private |
Active single or multi-file trajectory paths.
◆ loader_
◆ options_
◆ window_
| ::AppWindow& correlation::app::FileIOHandler::window_ |
|
private |
The documentation for this class was generated from the following files: