| <large>libXpertMassCore and libXpertMassGui Developer Documentation</large>

- libXpertMassGui
- IsotopicClusterGeneratorDlg

# MsXpS::libXpertMassGui::IsotopicClusterGeneratorDlg Class

class MsXpS::libXpertMassGui::IsotopicClusterGeneratorDlg

The IsotopicClusterGeneratorDlg class provides a graphical user interface for the generation of an isotopic cluster. More...

Header: | `#include <IsotopicClusterGeneratorDlg.hpp>`

- List of all members, including inherited members
- IsotopicClusterGeneratorDlg is part of libXpertMassGui Mass calculations.

## Public Functions

| IsotopicClusterGeneratorDlg(QWidget *program_window_p, const QString &applicationName, const QString &description)
virtual | ~IsotopicClusterGeneratorDlg()
bool | initializeUserManualConfigurationWidgets(const MsXpS::libXpertMassCore::IsotopicDataManualConfigHandler &config_handler)

## Public Slots

int * | addElementGroupBox()
int * | addElementSkeletonGroupBox()
int | addIsotopeFrame()
void | addLibraryFormula()
void | addUserConfigFormula()
int * | createIsotopeFrame(int *elementGroupBox = nullptr)
void | removeElementGroupBox()
void | removeIsotopeFrame()
void | removeLibraryFormula()
void | removeUserConfigFormula()
bool | runLibrary()
bool | runUserConfig()
bool | runUserManualConfig()
void | toIsotopicClusterShaper()
void | traceColorPushButtonClicked()

## Protected Functions

bool | checkParameters()
void | closeEvent(int *event)
bool | loadUserConfig()
bool | loadUserManualConfig()
void | message(const QString &message, int timeout = 3000)
void | readSettings(const QString &config_settings_file_path)
void | reportResults()
bool | saveLibrary()
bool | saveUserConfig()
bool | saveUserManualConfig()
bool | setupDialog()
void | setupIsoSpecStandardStaticTableView()
void | setupIsoSpecStandardUserTableView()
std::size_t | validateManualConfig(MsXpS::libXpertMassCore::IsotopicDataManualConfigHandler &config_handler)
void | writeSettings(const QString &config_settings_file_path)

## Protected Variables

QString | m_applicationName
int | m_charge
QByteArray | m_colorByteArray
MsXpS::libXpertMassCore::Formula | m_formula
pappso::Enums::SortOrder | m_sortOrder
pappso::Enums::SortType | m_sortType
QWidget * | mp_programWindow
Ui::IsotopicClusterGeneratorDlg * | mp_ui

## Detailed Description

The isotopic cluster is generated starting from a Formula.

## Member Function Documentation

### IsotopicClusterGeneratorDlg::IsotopicClusterGeneratorDlg(QWidget *program_window_p, const QString &applicationName, const QString &description)

Constructs a IsotopicClusterGeneratorDlg instance.

- program_window_p: the program's main window.
- applicationName: the name of the application, typically massXpert2 or mineXpert2, for example.
- description: the string describing what this dialog window is for (used for the window title).

### `[virtual noexcept]` IsotopicClusterGeneratorDlg::~IsotopicClusterGeneratorDlg()

Destructs this IsotopicClusterGeneratorDlg instance.

### `[slot]` int *IsotopicClusterGeneratorDlg::addElementGroupBox()

Creates a group box that will enshrine a chemical element definition.

The group box is populated with a line edit widget for the element symbol and with a spin box for the count of the atoms in the final elemental composition defined here.

The isotope-related frame is then created inside the newly created group box.

See also addElementSkeletonGroupBox().

### `[slot]` int *IsotopicClusterGeneratorDlg::addElementSkeletonGroupBox()

Creates a group box that will enshrine a chemical element definition.

The group box is populated with a line edit widget for the element symbol and with a spin box for the count of the atoms in the final elemental composition defined here.

The isotope-related widgets are not created.

See also addElementGroupBox().

### `[slot]` int IsotopicClusterGeneratorDlg::addIsotopeFrame()

Adds a frame for the definition of an isotope.

Returns a pair of spin box widgets, the first for the isotope mass and the second for the probability (abundance).

### `[slot]` void IsotopicClusterGeneratorDlg::addLibraryFormula()

Adds the currently displayed formula for the IsoSpec-based table view to the corresponding combo box widget.

### `[slot]` void IsotopicClusterGeneratorDlg::addUserConfigFormula()

Adds the currently displayed formula for the IsoSpec-like user-modified table view to the corresponding combo box widget.

### `[protected]` bool IsotopicClusterGeneratorDlg::checkParameters()

Returns true if all the parameters are correct and consistent, false otherwise.

### `[protected]` void IsotopicClusterGeneratorDlg::closeEvent(int *event)

Upon closing of the dialog window (unused event), writes the settings to the application configuration file.

### `[slot]` int *IsotopicClusterGeneratorDlg::createIsotopeFrame(int *elementGroupBox = nullptr)

Returns a newly created frame inside elementGroupBox that will enshrine all the specifications about the isotopes being configured.

### bool IsotopicClusterGeneratorDlg::initializeUserManualConfigurationWidgets(const MsXpS::libXpertMassCore::IsotopicDataManualConfigHandler &config_handler)

Initializes all the widgets required to host the user manually-configured isotopic data.

This function should be called right after having loaded a user manually-defined isotopic data configuration. config_handler is the isotopic data configuration handler that had previously loaded the data.

Returns true upon success, false if the user manual configuration is empty.

See also loadUserManualConfig().

### `[protected]` bool IsotopicClusterGeneratorDlg::loadUserConfig()

Loads the user-configured IsoSpec-like data.

Returns true if successful, false otherwise.

### `[protected]` bool IsotopicClusterGeneratorDlg::loadUserManualConfig()

Loads the user manually-configured isotopic data configuration.

All the widgets required to actually display the user manual configuration are created and configured automatically.

Returns true upon success, false otherwise.

### `[protected]` void IsotopicClusterGeneratorDlg::message(const QString &message, int timeout = 3000)

Prints message in the message line edit widget, that will be erased after the timeout.

### `[protected]` void IsotopicClusterGeneratorDlg::readSettings(const QString &config_settings_file_path)

Reads the settings of this dialog window from the application configuration file (config_settings_file_path).

The configuration is read from the file to set back the dialog window in the same status.

### `[slot]` void IsotopicClusterGeneratorDlg::removeElementGroupBox()

Removes an element group box.

The group box to be removed is determined from the identity of the push button that triggered this function.

### `[slot]` void IsotopicClusterGeneratorDlg::removeIsotopeFrame()

Removes an isotope frame.

The isotope frame to be removed is determined from the identity of the push button that triggered this function.

### `[slot]` void IsotopicClusterGeneratorDlg::removeLibraryFormula()

Removes the currently displayed formula for the IsoSpec-based table view from the corresponding combo box widget.

### `[slot]` void IsotopicClusterGeneratorDlg::removeUserConfigFormula()

Removes the currently displayed formula for the IsoSpec-like user-modified table view from the corresponding combo box widget.

### `[protected]` void IsotopicClusterGeneratorDlg::reportResults()

Exports the computation results to a string that is set to the plain text edit widget in the results tab widget tab.

### `[slot]` bool IsotopicClusterGeneratorDlg::runLibrary()

Runs the computation using the IsoSpec-based isotopic data.

Returns true upon success, false otherwise.

### `[slot]` bool IsotopicClusterGeneratorDlg::runUserConfig()

Runs the computation using the IsoSpec-like user-modified isotopic data.

Returns true upon success, false otherwise.

### `[slot]` bool IsotopicClusterGeneratorDlg::runUserManualConfig()

Runs the computation using the user manually-configured isotopic data.

Returns true upon success, false otherwise.

### `[protected]` bool IsotopicClusterGeneratorDlg::saveLibrary()

Returns true if the IsoSpec isotopic data could be written to file, false otherwise.

### `[protected]` bool IsotopicClusterGeneratorDlg::saveUserConfig()

Returns true if the IsoSpec-like user-modified isotopic data could be written to file, false otherwise.

### `[protected]` bool IsotopicClusterGeneratorDlg::saveUserManualConfig()

Saves the user manually-entered isotopic data configuration to file.

The user is provided with a file selection dialog window.

Returns true upon succes, false if the manual isotopic data configuration does not validate successfully.

### `[protected]` bool IsotopicClusterGeneratorDlg::setupDialog()

Sets up the dialog window.

Returns true upon success, or false if the IsoSpec-based isotopic data could not be loaded.

### `[protected]` void IsotopicClusterGeneratorDlg::setupIsoSpecStandardStaticTableView()

Sets up the IsoSpec tables model and table view.

### `[protected]` void IsotopicClusterGeneratorDlg::setupIsoSpecStandardUserTableView()

Sets up the user-configured IsoSpec-like tables model and table view.

### `[slot]` void IsotopicClusterGeneratorDlg::toIsotopicClusterShaper()

Copies the results of the computation to an IsotopicClusterShaperDlg instance.

### `[slot]` void IsotopicClusterGeneratorDlg::traceColorPushButtonClicked()

Reacts to a click onto the push button.

Allows selecting a color for the mass spectrum trace to be created later on the basis of the isotopic cluster calculated here.

### `[protected]` std::size_t IsotopicClusterGeneratorDlg::validateManualConfig(MsXpS::libXpertMassCore::IsotopicDataManualConfigHandler &config_handler)

Validates the user manual isotopic data configuration using the config_handler configuration handler.

The manual configuration is performed by entering by hand the chemical elements (as a symbol) and their isotope (mass,prob) pairs. The element is defined using the symbol. The count of the element in the formula is set in a spin box.

Validating the manual configuration means iterating in all the widgets that have been created by the user, extracting from them all the isotopic data.

Returns the count of elements in the configuration.

### `[protected]` void IsotopicClusterGeneratorDlg::writeSettings(const QString &config_settings_file_path)

Saves the settings of this dialog window to the application configuration file (config_settings_file_path).

The saved configuration is read from the file to set back the dialog window in the same status.

## Member Variable Documentation

### QString IsotopicClusterGeneratorDlg::m_applicationName

This variable holds the name of the application.

### int IsotopicClusterGeneratorDlg::m_charge

This variable holds the charge of the analyte for which the calculations are performed.

### QByteArray IsotopicClusterGeneratorDlg::m_colorByteArray

This variable holds the color that should be used for displaying the mass spectrum when the isotopic cluster is later shaped into a mass spectrum.

### MsXpS::libXpertMassCore::Formula IsotopicClusterGeneratorDlg::m_formula

This variable holds the formula that is used as the starting point for the calculations.

The formula holds the elemental composition of the analyte for which the calculation should be performed. It must account for the chemical agent responsible for its ionization.

### pappso::Enums::SortOrder IsotopicClusterGeneratorDlg::m_sortOrder

This variable holds the order for the sorting (if any) of the obtained isotopic cluster's peak centroids.

### pappso::Enums::SortType IsotopicClusterGeneratorDlg::m_sortType

This variable holds the type of sorting to use to sort the obtained isotopic cluster's peak centroids.

### QWidget *IsotopicClusterGeneratorDlg::mp_programWindow

This variable holds the main program window.

### Ui::IsotopicClusterGeneratorDlg *IsotopicClusterGeneratorDlg::mp_ui

This variable holds the graphical user interface definition.