|
SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
|
Main application window for SedSAT3 source apportionment analysis. More...
#include </home/runner/work/SedSat3/SedSat3/mainwindow.h>


Public Member Functions | |
| MainWindow (QWidget *parent=nullptr) | |
| Constructs the main window. | |
| ~MainWindow () | |
| Destructor - cleans up UI resources. | |
| void | SetSinkSheet (int i) |
| Sets the sink sheet index for Excel import. | |
| void | WriteMessageOnScreen (const QString &text, QColor color=Qt::black) |
| Writes a message to the application's message display area. | |
| SourceSinkData * | Data () |
| Returns pointer to the main data collection. | |
| const SourceSinkData * | Data () const |
| bool | Execute (const std::string &command, const std::map< std::string, std::string > &arguments) |
| Executes a specified analysis command. | |
Private Member Functions | |
| void | setupConnections () |
| Sets up all signal-slot connections for UI elements. | |
| void | setupToolsView () |
| Initializes the tools tree view. | |
| void | setupResultsView () |
| Initializes the results tree view and context menu. | |
| void | setupToolBar () |
| Initializes the general toolbar. | |
| bool | ReadExcel (const QString &filename) |
| Reads elemental profile data from Excel file. | |
| QString | resourcesPath () const |
| QStandardItemModel * | ToQStandardItemModel (const SourceSinkData *srcsinkdata) |
| QStandardItem * | ToQStandardItem (const QString &key, const SourceSinkData *srcsinkdata) |
| QStandardItem * | ElementsToQStandardItem (const QString &key, const SourceSinkData *srcsinkdata) |
| QStandardItem * | ToQStandardItem (const QString &key, const QJsonObject &json) |
| QStandardItemModel * | ToQStandardItemModel (const QJsonDocument &jsondocument) |
| QString | TreeQStringSelectedType () |
| QJsonDocument | loadJson (const QString &fileName) |
| void | saveJson (const QJsonDocument &document, const QString &fileName) |
| void | InitiateTables () |
| void | readRecentFilesList () |
| void | addToRecentFiles (const QString &fileName, bool addToFile) |
| void | writeRecentFilesList () |
| void | removeFromRecentList (QAction *selectedFileAction) |
| bool | CreateFileIfDoesNotExist (const QString &fileName) |
| bool | LoadModel (const QString &fileName) |
| void | Populate_General_ToolBar () |
| void | on_import_excel () |
| void | on_plot_raw_elemental_profiles () |
| void | on_tree_selectionChanged (const QItemSelection &changed) |
| void | preparetreeviewMenu (const QPoint &pos) |
| void | showdistributionsforelements () |
| void | on_constituent_properties_triggered () |
| void | onSetTargetGroup () |
| void | onIncludeExcludeSample () |
| void | onOMSizeCorrection () |
| void | on_tool_executed (const QModelIndex &index) |
| void | on_old_result_requested (const QModelIndex &index) |
| void | onAboutTriggered () |
| void | on_Options_triggered () |
| QString | getSaveFilePath (bool promptUser) |
| Gets the file path for saving, prompting user if needed. | |
| bool | saveProjectToFile (const QString &filePath) |
| Saves project data to the specified file. | |
| QJsonObject | buildProjectJson () const |
| Builds the complete project JSON object. | |
| QJsonObject | buildResultsJson () const |
| Builds the results section of the project JSON. | |
| void | onSaveProject () |
| void | onSaveProjectAs () |
| void | onOpenProject () |
| void | on_actionRecent_triggered () |
| void | DeleteResults () |
| void | onCustomContextMenu (const QPoint &pos) |
| void | on_show_data_as_table () |
| void | on_ZoomExtends () |
| void | addToolBarAction (const QString &text, const QString &iconPath, const QString &toolTip, void(MainWindow::*slot)()) |
| Helper to add an action to the toolbar with icon and connection. | |
Private Attributes | |
| Ui::MainWindow * | ui |
| SourceSinkData | dataCollection |
| Main data collection for analysis. | |
| int | sinkSheet = -1 |
| Index of sink sheet in Excel import. | |
| GeneralPlotter * | plotter = nullptr |
| Main plotting widget. | |
| std::unique_ptr< Interface > | plottedData |
| Currently plotted data interface. | |
| std::unique_ptr< QStandardItemModel > | columnViewModel |
| Model for column/data tree view. | |
| std::unique_ptr< QStandardItemModel > | resultsViewModel |
| Model for results tree view. | |
| QMenu * | ResultscontextMenu = nullptr |
| Context menu for results view. | |
| QAction * | DeleteAction = nullptr |
| Delete action for results. | |
| QJsonDocument | formsstructure |
| Forms structure definitions. | |
| QString | selectedTreeItemType = "None" |
| Currently selected tree item type. | |
| bool | treeItemChangedProgramatically = false |
| Flag for programmatic tree changes. | |
| QString | ProjectFileName |
| Current project file path. | |
| QStringList | recentFiles |
| List of recently opened files. | |
| std::unique_ptr< QMenu > | menu |
| Main menu. | |
| std::unique_ptr< QWidget > | centralform |
| Central form widget. | |
| std::unique_ptr< GuiHost > | analysis_host |
| Reports analyses through this window. | |
| std::unique_ptr< Conductor > | conductor |
| Analysis command coordinator. | |
| QModelIndex | indexresultselected |
| Currently selected result index. | |
Main application window for SedSAT3 source apportionment analysis.
Provides the primary user interface for importing data, configuring analyses, executing source apportionment algorithms, and visualizing results. Manages data models, plotting, project file I/O, and coordinates with the Conductor class for computational operations.
Definition at line 44 of file mainwindow.h.
|
explicit |
Constructs the main window.
| parent | Parent widget (typically nullptr for main window) |
Definition at line 62 of file mainwindow.cpp.
References MainWindow(), analysis_host, centralform, columnViewModel, conductor, DeleteAction, plotter, readRecentFilesList(), resourcesPath(), ResultscontextMenu, resultsViewModel, selectedTreeItemType, setupConnections(), setupResultsView(), setupToolBar(), setupToolsView(), sinkSheet, treeItemChangedProgramatically, and ui.
Referenced by MainWindow(), and addToolBarAction().
| MainWindow::~MainWindow | ( | ) |
|
private |
Helper to add an action to the toolbar with icon and connection.
Creates a toolbar action with the specified text, icon, and tooltip, then connects it to the given member function slot.
| text | Action text and object name |
| iconPath | Path to icon file relative to resources folder |
| toolTip | Tooltip text displayed on hover |
| slot | Member function pointer to connect to triggered signal |
Definition at line 1598 of file mainwindow.cpp.
References MainWindow(), and ui.
Referenced by Populate_General_ToolBar().
|
private |
Definition at line 1429 of file mainwindow.cpp.
References CreateFileIfDoesNotExist(), max_num_recent_files, on_actionRecent_triggered(), RECENT, recentFiles, ui, and writeRecentFilesList().
Referenced by on_actionRecent_triggered(), onOpenProject(), readRecentFilesList(), and saveProjectToFile().
|
private |
Builds the complete project JSON object.
Definition at line 285 of file mainwindow.cpp.
References buildResultsJson(), Data(), SourceSinkData::ElementDataToJsonObject(), SourceSinkData::ElementInformationToJsonObject(), SourceSinkData::OptionsToJsonObject(), and SourceSinkData::ToolsUsedToJsonObject().
Referenced by saveProjectToFile().
|
private |
Builds the results section of the project JSON.
Definition at line 255 of file mainwindow.cpp.
References ResultSetItem::result, resultsViewModel, and Results::toJsonObject().
Referenced by buildProjectJson().
|
private |
Definition at line 1578 of file mainwindow.cpp.
Referenced by addToRecentFiles().
|
inline |
Returns pointer to the main data collection.
Definition at line 77 of file mainwindow.h.
References dataCollection.
Referenced by GenericForm::GenericForm(), buildProjectJson(), LoadModel(), on_Options_triggered(), onIncludeExcludeSample(), and ToQStandardItem().
|
inline |
Definition at line 78 of file mainwindow.h.
References dataCollection.
|
private |
Definition at line 1356 of file mainwindow.cpp.
References indexresultselected, and resultsViewModel.
Referenced by setupConnections().
|
private |
Definition at line 724 of file mainwindow.cpp.
References dataCollection, elementRole, and groupRole.
Referenced by InitiateTables().
| bool MainWindow::Execute | ( | const std::string & | command, |
| const std::map< std::string, std::string > & | arguments ) |
Executes a specified analysis command.
| command | Command name identifying the analysis type |
| arguments | Map of parameter names to values |
Definition at line 1280 of file mainwindow.cpp.
References ResultsWindow::AppendResult(), conductor, dataCollection, Results::GetName(), ResultSetItem::result, resultsViewModel, and ResultsWindow::SetResults().
Referenced by GenericForm::onProceed().
|
private |
Gets the file path for saving, prompting user if needed.
| promptUser | If true, always show save dialog; if false, use existing ProjectFileName |
Definition at line 222 of file mainwindow.cpp.
References ProjectFileName.
Referenced by onSaveProject(), and onSaveProjectAs().
|
private |
Definition at line 570 of file mainwindow.cpp.
References columnViewModel, dataCollection, ElementsToQStandardItem(), on_tree_selectionChanged(), preparetreeviewMenu(), ToQStandardItem(), and ui.
Referenced by LoadModel(), and on_import_excel().
|
private |
Definition at line 904 of file mainwindow.cpp.
Referenced by setupToolsView().
|
private |
Definition at line 398 of file mainwindow.cpp.
References conductor, Data(), dataCollection, InitiateTables(), mlrset, ProjectFileName, SourceSinkData::ReadFromFile(), Results::ReadFromJson(), ResultSetItem::result, resultsViewModel, SourceSinkData::SetOMandSizeConstituents(), SourceSinkData::SetTargetGroup(), and ui.
Referenced by on_actionRecent_triggered(), and onOpenProject().
|
private |
Definition at line 1550 of file mainwindow.cpp.
References addToRecentFiles(), and LoadModel().
Referenced by addToRecentFiles().
|
private |
Definition at line 1096 of file mainwindow.cpp.
References centralform, dataCollection, FormElementInformation::setModel(), FormElementInformation::table(), and ui.
Referenced by on_import_excel(), Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 537 of file mainwindow.cpp.
References conductor, InitiateTables(), on_constituent_properties_triggered(), ProjectFileName, and ReadExcel().
Referenced by Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 1246 of file mainwindow.cpp.
References ResultsWindow::AppendResult(), ResultSetItem::result, resultsViewModel, and ResultsWindow::SetResults().
Referenced by setupConnections().
|
private |
Definition at line 1709 of file mainwindow.cpp.
References Data().
Referenced by onIncludeExcludeSample(), and setupConnections().
|
private |
Definition at line 597 of file mainwindow.cpp.
Referenced by setupConnections().
|
private |
Definition at line 1679 of file mainwindow.cpp.
References plottedData, and ResultTableViewer::SetTable().
Referenced by setupConnections().
|
private |
Definition at line 1215 of file mainwindow.cpp.
References centralform, dataCollection, formsstructure, GenericForm::SetCommand(), and ui.
Referenced by setupConnections().
|
private |
Definition at line 786 of file mainwindow.cpp.
References dataCollection, profiles_data::element_names, log, normal, plottedData, plotter, profiles_data::sample_names, selectedTreeItemType, treeItemChangedProgramatically, TreeQStringSelectedType(), ui, and profiles_data::values.
Referenced by InitiateTables().
|
private |
Definition at line 1697 of file mainwindow.cpp.
References plotter.
Referenced by setupConnections().
|
private |
Definition at line 1339 of file mainwindow.cpp.
References date_compiled, AboutDialog::setBuildDate(), AboutDialog::setVersion(), and version.
Referenced by setupConnections().
|
private |
Definition at line 1348 of file mainwindow.cpp.
References indexresultselected, ResultscontextMenu, and ui.
Referenced by setupConnections().
|
private |
Definition at line 1154 of file mainwindow.cpp.
References SourceSinkData::BracketTest(), centralform, Data(), dataCollection, SourceSinkData::GetOptions(), on_Options_triggered(), SourceSinkData::OutlierAnalysisForAll(), samples, SelectSamples::SetData(), SelectSamples::SetMode(), and ui.
Referenced by Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 1190 of file mainwindow.cpp.
References centralform, dataCollection, regressions, SelectSamples::SetData(), SelectSamples::SetMode(), and ui.
Referenced by Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 375 of file mainwindow.cpp.
References addToRecentFiles(), LoadModel(), and ProjectFileName.
Referenced by Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 345 of file mainwindow.cpp.
References getSaveFilePath(), and saveProjectToFile().
Referenced by Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 360 of file mainwindow.cpp.
References getSaveFilePath(), and saveProjectToFile().
Referenced by setupConnections().
|
private |
Definition at line 1109 of file mainwindow.cpp.
References dataCollection, and WriteMessageOnScreen().
Referenced by setupConnections().
|
private |
Definition at line 1623 of file mainwindow.cpp.
References addToolBarAction(), on_constituent_properties_triggered(), on_import_excel(), onIncludeExcludeSample(), onOMSizeCorrection(), onOpenProject(), onSaveProject(), resourcesPath(), and ui.
Referenced by setupToolBar().
|
private |
Definition at line 978 of file mainwindow.cpp.
References elementRole, groupRole, menu, sampleRole, showdistributionsforelements(), and ui.
Referenced by InitiateTables().
|
private |
Reads elemental profile data from Excel file.
| filename | Path to Excel file |
Definition at line 603 of file mainwindow.cpp.
References dataCollection, sinkSheet, and WriteMessageOnScreen().
Referenced by on_import_excel().
|
private |
Definition at line 1382 of file mainwindow.cpp.
References addToRecentFiles(), max_num_recent_files, and RECENT.
Referenced by MainWindow().
|
private |
Definition at line 1566 of file mainwindow.cpp.
References recentFiles, ui, and writeRecentFilesList().
|
private |
Definition at line 1716 of file mainwindow.cpp.
Referenced by MainWindow(), Populate_General_ToolBar(), setupToolBar(), and setupToolsView().
|
private |
Definition at line 911 of file mainwindow.cpp.
|
private |
Saves project data to the specified file.
| filePath | Path to save the project file |
Definition at line 299 of file mainwindow.cpp.
References addToRecentFiles(), buildProjectJson(), conductor, and ProjectFileName.
Referenced by onSaveProject(), and onSaveProjectAs().
|
inline |
Sets the sink sheet index for Excel import.
| i | Sheet index |
Definition at line 64 of file mainwindow.h.
References sinkSheet.
|
private |
Sets up all signal-slot connections for UI elements.
Connects menu actions, toolbar buttons, and tree views to their respective slot handlers. Uses modern Qt5 function pointer syntax for type safety.
Definition at line 101 of file mainwindow.cpp.
References DeleteAction, DeleteResults(), on_constituent_properties_triggered(), on_import_excel(), on_old_result_requested(), on_Options_triggered(), on_plot_raw_elemental_profiles(), on_show_data_as_table(), on_tool_executed(), on_ZoomExtends(), onAboutTriggered(), onCustomContextMenu(), onIncludeExcludeSample(), onOMSizeCorrection(), onOpenProject(), onSaveProject(), onSaveProjectAs(), onSetTargetGroup(), and ui.
Referenced by MainWindow().
|
private |
Initializes the results tree view and context menu.
Sets up the results tree view model and configures the context menu for result management (delete, etc.).
Definition at line 184 of file mainwindow.cpp.
References DeleteAction, ResultscontextMenu, resultsViewModel, and ui.
Referenced by MainWindow().
|
private |
Initializes the general toolbar.
Configures toolbar buttons with icons and initial enabled states.
Definition at line 199 of file mainwindow.cpp.
References Populate_General_ToolBar(), resourcesPath(), and ui.
Referenced by MainWindow().
|
private |
Initializes the tools tree view.
Loads tool definitions from JSON configuration file and populates the tools tree view with available analysis operations.
Definition at line 152 of file mainwindow.cpp.
References formsstructure, loadJson(), resourcesPath(), ToQStandardItemModel(), and ui.
Referenced by MainWindow().
|
private |
Definition at line 1016 of file mainwindow.cpp.
References dataCollection, and PlotWindow::Plotter().
Referenced by preparetreeviewMenu().
|
private |
Definition at line 927 of file mainwindow.cpp.
References Data(), name, ToolDisplayName(), and ToQStandardItem().
|
private |
Definition at line 691 of file mainwindow.cpp.
References dataCollection, groupRole, and sampleRole.
Referenced by InitiateTables(), ToQStandardItem(), and ToQStandardItemModel().
|
private |
Definition at line 955 of file mainwindow.cpp.
References ToQStandardItem().
|
private |
Definition at line 754 of file mainwindow.cpp.
References columnViewModel, dataCollection, elementRole, and groupRole.
Referenced by setupToolsView().
|
private |
Definition at line 966 of file mainwindow.cpp.
References ui.
Referenced by on_tree_selectionChanged().
| void MainWindow::WriteMessageOnScreen | ( | const QString & | text, |
| QColor | color = Qt::black ) |
Writes a message to the application's message display area.
| text | Message text to display |
| color | Text color (default: black) |
Definition at line 685 of file mainwindow.cpp.
References ui.
Referenced by onSetTargetGroup(), and ReadExcel().
|
private |
Definition at line 1522 of file mainwindow.cpp.
References RECENT, and recentFiles.
Referenced by addToRecentFiles(), and removeFromRecentList().
|
private |
Reports analyses through this window.
Definition at line 280 of file mainwindow.h.
Referenced by MainWindow().
|
private |
Central form widget.
Definition at line 279 of file mainwindow.h.
Referenced by MainWindow(), on_constituent_properties_triggered(), on_tool_executed(), onIncludeExcludeSample(), and onOMSizeCorrection().
|
private |
Model for column/data tree view.
Definition at line 261 of file mainwindow.h.
Referenced by MainWindow(), InitiateTables(), and ToQStandardItemModel().
|
private |
Analysis command coordinator.
Definition at line 281 of file mainwindow.h.
Referenced by MainWindow(), Execute(), LoadModel(), on_import_excel(), and saveProjectToFile().
|
private |
Main data collection for analysis.
Definition at line 247 of file mainwindow.h.
Referenced by Data(), Data(), ElementsToQStandardItem(), Execute(), InitiateTables(), LoadModel(), on_constituent_properties_triggered(), on_tool_executed(), on_tree_selectionChanged(), onIncludeExcludeSample(), onOMSizeCorrection(), onSetTargetGroup(), ReadExcel(), showdistributionsforelements(), ToQStandardItem(), and ToQStandardItemModel().
|
private |
Delete action for results.
Definition at line 266 of file mainwindow.h.
Referenced by MainWindow(), setupConnections(), and setupResultsView().
|
private |
Forms structure definitions.
Definition at line 269 of file mainwindow.h.
Referenced by on_tool_executed(), and setupToolsView().
|
private |
Currently selected result index.
Definition at line 282 of file mainwindow.h.
Referenced by DeleteResults(), and onCustomContextMenu().
|
private |
|
private |
Currently plotted data interface.
Definition at line 258 of file mainwindow.h.
Referenced by on_show_data_as_table(), and on_tree_selectionChanged().
|
private |
Main plotting widget.
Definition at line 254 of file mainwindow.h.
Referenced by MainWindow(), on_tree_selectionChanged(), and on_ZoomExtends().
|
private |
Current project file path.
Definition at line 274 of file mainwindow.h.
Referenced by getSaveFilePath(), LoadModel(), on_import_excel(), onOpenProject(), and saveProjectToFile().
|
private |
List of recently opened files.
Definition at line 275 of file mainwindow.h.
Referenced by addToRecentFiles(), removeFromRecentList(), and writeRecentFilesList().
|
private |
Context menu for results view.
Definition at line 265 of file mainwindow.h.
Referenced by MainWindow(), onCustomContextMenu(), and setupResultsView().
|
private |
Model for results tree view.
Definition at line 262 of file mainwindow.h.
Referenced by MainWindow(), buildResultsJson(), DeleteResults(), Execute(), LoadModel(), on_old_result_requested(), and setupResultsView().
|
private |
Currently selected tree item type.
Definition at line 272 of file mainwindow.h.
Referenced by MainWindow(), and on_tree_selectionChanged().
|
private |
Index of sink sheet in Excel import.
Definition at line 248 of file mainwindow.h.
Referenced by MainWindow(), ReadExcel(), and SetSinkSheet().
|
private |
Flag for programmatic tree changes.
Definition at line 273 of file mainwindow.h.
Referenced by MainWindow(), and on_tree_selectionChanged().
|
private |
Definition at line 244 of file mainwindow.h.
Referenced by MainWindow(), ~MainWindow(), addToolBarAction(), addToRecentFiles(), InitiateTables(), LoadModel(), on_constituent_properties_triggered(), on_tool_executed(), on_tree_selectionChanged(), onCustomContextMenu(), onIncludeExcludeSample(), onOMSizeCorrection(), Populate_General_ToolBar(), preparetreeviewMenu(), removeFromRecentList(), setupConnections(), setupResultsView(), setupToolBar(), setupToolsView(), TreeQStringSelectedType(), and WriteMessageOnScreen().