|
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, 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 | 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 41 of file mainwindow.h.
|
explicit |
Constructs the main window.
| parent | Parent widget (typically nullptr for main window) |
Definition at line 57 of file mainwindow.cpp.
References analysis_host, centralform, conductor, readRecentFilesList(), resourcesPath(), setupConnections(), setupResultsView(), setupToolBar(), setupToolsView(), and ui.
| 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 1556 of file mainwindow.cpp.
References ui.
Referenced by Populate_General_ToolBar().
|
private |
Definition at line 1387 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 278 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 248 of file mainwindow.cpp.
References ResultSetItem::result, resultsViewModel, and Results::toJsonObject().
Referenced by buildProjectJson().
|
private |
Definition at line 1536 of file mainwindow.cpp.
Referenced by addToRecentFiles().
|
inline |
Returns pointer to the main data collection.
Definition at line 74 of file mainwindow.h.
References dataCollection.
Referenced by GenericForm::GenericForm(), buildProjectJson(), LoadModel(), on_Options_triggered(), onIncludeExcludeSample(), and ToQStandardItem().
|
inline |
Definition at line 75 of file mainwindow.h.
References dataCollection.
|
private |
Definition at line 1314 of file mainwindow.cpp.
References indexresultselected, and resultsViewModel.
Referenced by setupConnections().
|
private |
Definition at line 784 of file mainwindow.cpp.
References dataCollection, elementRole, SourceSinkData::GetElementNames(), SourceSinkData::GetGroupNames(), and groupRole.
Referenced by InitiateTables().
| bool MainWindow::Execute | ( | const std::string & | command, |
| 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 1257 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 215 of file mainwindow.cpp.
References ProjectFileName.
Referenced by onSaveProject(), and onSaveProjectAs().
|
private |
Definition at line 518 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 951 of file mainwindow.cpp.
Referenced by setupToolsView().
|
private |
Definition at line 391 of file mainwindow.cpp.
References SourceSinkData::AssignAllDistributions(), conductor, Data(), dataCollection, InitiateTables(), mlrset, SourceSinkData::PopulateElementDistributions(), ProjectFileName, SourceSinkData::ReadFromFile(), Results::ReadFromJson(), ResultSetItem::result, resultsViewModel, SourceSinkData::SetOMandSizeConstituents(), and ui.
Referenced by on_actionRecent_triggered(), and onOpenProject().
|
private |
Definition at line 1508 of file mainwindow.cpp.
References addToRecentFiles(), and LoadModel().
Referenced by addToRecentFiles().
|
private |
Definition at line 1131 of file mainwindow.cpp.
References centralform, dataCollection, FormElementInformation::table(), and ui.
Referenced by on_import_excel(), Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 485 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 1223 of file mainwindow.cpp.
References ResultsWindow::AppendResult(), ResultSetItem::result, resultsViewModel, and ResultsWindow::SetResults().
Referenced by setupConnections().
|
private |
Definition at line 1667 of file mainwindow.cpp.
References Data().
Referenced by onIncludeExcludeSample(), and setupConnections().
|
private |
Definition at line 545 of file mainwindow.cpp.
Referenced by setupConnections().
|
private |
Definition at line 1637 of file mainwindow.cpp.
References plottedData, and ResultTableViewer::SetTable().
Referenced by setupConnections().
|
private |
Definition at line 1192 of file mainwindow.cpp.
References centralform, dataCollection, formsstructure, SourceSinkData::GetElementNames(), and ui.
Referenced by setupConnections().
|
private |
Definition at line 846 of file mainwindow.cpp.
References GeneralPlotter::AddNonUniformScatter(), GeneralPlotter::AddScatters(), GeneralPlotter::Clear(), dataCollection, profiles_data::element_names, SourceSinkData::ExtractConcentrationData(), SourceSinkData::ExtractElementDataByGroup(), SourceSinkData::ExtractSamplesAsProfileSet(), Elemental_Profile_Set::GetSampleNames(), SourceSinkData::GetSampleSet(), log, plottedData, plotter, profiles_data::sample_names, selectedTreeItemType, GeneralPlotter::SetYAxisScaleType(), treeItemChangedProgramatically, TreeQStringSelectedType(), ui, and profiles_data::values.
Referenced by InitiateTables().
|
private |
Definition at line 1655 of file mainwindow.cpp.
References plotter, and GeneralPlotter::ZoomExtends().
Referenced by setupConnections().
|
private |
Definition at line 1297 of file mainwindow.cpp.
References date_compiled, AboutDialog::setBuildDate(), AboutDialog::setVersion(), and version.
Referenced by setupConnections().
|
private |
Definition at line 1306 of file mainwindow.cpp.
References indexresultselected, ResultscontextMenu, and ui.
Referenced by setupConnections().
|
private |
Definition at line 1144 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 1167 of file mainwindow.cpp.
References centralform, dataCollection, SourceSinkData::OMandSizeConstituents(), regressions, SelectSamples::SetData(), SelectSamples::SetMode(), and ui.
Referenced by Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 368 of file mainwindow.cpp.
References addToRecentFiles(), LoadModel(), and ProjectFileName.
Referenced by Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 338 of file mainwindow.cpp.
References getSaveFilePath(), and saveProjectToFile().
Referenced by Populate_General_ToolBar(), and setupConnections().
|
private |
Definition at line 353 of file mainwindow.cpp.
References getSaveFilePath(), and saveProjectToFile().
Referenced by setupConnections().
|
private |
Definition at line 1581 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 1013 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 551 of file mainwindow.cpp.
References Elemental_Profile::AppendElement(), Elemental_Profile_Set::AppendProfile(), SourceSinkData::AppendSampleSet(), SourceSinkData::AssignAllDistributions(), SourceSinkData::Clear(), dataCollection, SourceSinkData::PopulateElementDistributions(), SourceSinkData::PopulateElementInformation(), sinkSheet, and WriteMessageOnScreen().
Referenced by on_import_excel().
|
private |
Definition at line 1340 of file mainwindow.cpp.
References addToRecentFiles(), max_num_recent_files, and RECENT.
Referenced by MainWindow().
|
private |
Definition at line 1524 of file mainwindow.cpp.
References recentFiles, ui, and writeRecentFilesList().
|
private |
Definition at line 1674 of file mainwindow.cpp.
Referenced by MainWindow(), Populate_General_ToolBar(), setupToolBar(), and setupToolsView().
|
private |
Definition at line 957 of file mainwindow.cpp.
|
private |
Saves project data to the specified file.
| filePath | Path to save the project file |
Definition at line 292 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 61 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 96 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(), 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 177 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 192 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 145 of file mainwindow.cpp.
References formsstructure, loadJson(), resourcesPath(), ToQStandardItemModel(), and ui.
Referenced by MainWindow().
|
private |
Definition at line 1051 of file mainwindow.cpp.
References dataCollection, Distribution::EvaluateAsTimeSeries(), Elemental_Profile_Set::GetElementDistribution(), SourceSinkData::GetFittedDistribution(), SourceSinkData::GetSampleSet(), and PlotWindow::Plotter().
Referenced by preparetreeviewMenu().
|
private |
Definition at line 963 of file mainwindow.cpp.
References Data(), and ToQStandardItem().
|
private |
Definition at line 751 of file mainwindow.cpp.
References dataCollection, SourceSinkData::GetGroupNames(), SourceSinkData::GetSampleSet(), groupRole, and sampleRole.
Referenced by InitiateTables(), ToQStandardItem(), and ToQStandardItemModel().
|
private |
Definition at line 990 of file mainwindow.cpp.
References ToQStandardItem().
|
private |
Definition at line 814 of file mainwindow.cpp.
References columnViewModel, dataCollection, elementRole, SourceSinkData::GetGroupNames(), SourceSinkData::GetSampleSet(), and groupRole.
Referenced by setupToolsView().
|
private |
Definition at line 1001 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 745 of file mainwindow.cpp.
References ui.
Referenced by ReadExcel().
|
private |
Definition at line 1480 of file mainwindow.cpp.
References RECENT, and recentFiles.
Referenced by addToRecentFiles(), and removeFromRecentList().
|
private |
Reports analyses through this window.
Definition at line 276 of file mainwindow.h.
Referenced by MainWindow().
|
private |
Central form widget.
Definition at line 275 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 257 of file mainwindow.h.
Referenced by InitiateTables(), and ToQStandardItemModel().
|
private |
Analysis command coordinator.
Definition at line 277 of file mainwindow.h.
Referenced by MainWindow(), Execute(), LoadModel(), on_import_excel(), and saveProjectToFile().
|
private |
Main data collection for analysis.
Definition at line 243 of file mainwindow.h.
Referenced by Data(), Data(), ElementsToQStandardItem(), Execute(), InitiateTables(), LoadModel(), on_constituent_properties_triggered(), on_tool_executed(), on_tree_selectionChanged(), onIncludeExcludeSample(), onOMSizeCorrection(), ReadExcel(), showdistributionsforelements(), ToQStandardItem(), and ToQStandardItemModel().
|
private |
Delete action for results.
Definition at line 262 of file mainwindow.h.
Referenced by setupConnections(), and setupResultsView().
|
private |
Forms structure definitions.
Definition at line 265 of file mainwindow.h.
Referenced by on_tool_executed(), and setupToolsView().
|
private |
Currently selected result index.
Definition at line 278 of file mainwindow.h.
Referenced by DeleteResults(), and onCustomContextMenu().
|
private |
|
private |
Currently plotted data interface.
Definition at line 254 of file mainwindow.h.
Referenced by on_show_data_as_table(), and on_tree_selectionChanged().
|
private |
Main plotting widget.
Definition at line 250 of file mainwindow.h.
Referenced by on_tree_selectionChanged(), and on_ZoomExtends().
|
private |
Current project file path.
Definition at line 270 of file mainwindow.h.
Referenced by getSaveFilePath(), LoadModel(), on_import_excel(), onOpenProject(), and saveProjectToFile().
|
private |
List of recently opened files.
Definition at line 271 of file mainwindow.h.
Referenced by addToRecentFiles(), removeFromRecentList(), and writeRecentFilesList().
|
private |
Context menu for results view.
Definition at line 261 of file mainwindow.h.
Referenced by onCustomContextMenu(), and setupResultsView().
|
private |
Model for results tree view.
Definition at line 258 of file mainwindow.h.
Referenced by buildResultsJson(), DeleteResults(), Execute(), LoadModel(), on_old_result_requested(), and setupResultsView().
|
private |
Currently selected tree item type.
Definition at line 268 of file mainwindow.h.
Referenced by on_tree_selectionChanged().
|
private |
Index of sink sheet in Excel import.
Definition at line 244 of file mainwindow.h.
Referenced by ReadExcel(), and SetSinkSheet().
|
private |
Flag for programmatic tree changes.
Definition at line 269 of file mainwindow.h.
Referenced by on_tree_selectionChanged().
|
private |
Definition at line 240 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().