improve the doxygen docu of PmuppGui.* (musredit_qt6).

This commit is contained in:
2025-11-25 12:23:33 +01:00
parent 70fad101fb
commit 4c7cf616a8
2 changed files with 613 additions and 98 deletions

View File

@@ -27,6 +27,38 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file PmuppGui.cpp
*
* @brief Implementation of the main GUI for mupp (MusrFit Parameter Plotter).
*
* This file implements the graphical user interface for the mupp application,
* providing an interactive environment for visualizing and analyzing parameter
* data from MusrFit analysis files.
*
* Key functionality implemented:
* - GUI construction and layout management using Qt widgets
* - Data collection and parameter management
* - X-Y axis parameter selection for plotting
* - Variable expression handling and evaluation
* - Command-line interface with history navigation
* - ROOT macro generation for plotting
* - Integration with external ROOT plotting process via IPC
* - Theme detection and icon management (light/dark modes)
* - Drag-and-drop support for parameter selection
* - Recent files management
*
* The implementation includes three main classes:
* - PmuppXY: Data structure for X-Y axis associations
* - PVarErrorDialog: Error message dialog for variable parsing
* - PmuppGui: Main window with complete GUI functionality
*
* Communication with the plotting backend:
* The application communicates with an external ROOT-based plotting process
* (mupp_plot) using System V message queues for inter-process communication.
* Each mupp instance has a unique identifier for isolated message routing.
*/
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
@@ -66,7 +98,11 @@
//----------------------------------------------------------------------------------------------------
/**
* @brief PmuppXY::init the xy object
* @brief Initializes the PmuppXY object to default state.
*
* Sets the collection tag to -1 (invalid), clears the X-axis label, and
* empties the Y-axis label vector. This provides a clean starting state
* for the X-Y configuration.
*/
void PmuppXY::init()
{
@@ -77,9 +113,13 @@ void PmuppXY::init()
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::setYlabel. Set the y-label
* @param idx index of the y-label
* @param str name of the y-label
* @brief Sets a Y-axis label at a specific index.
*
* Replaces the Y-axis label at the given index with a new value.
* If the index is out of bounds, the operation is silently ignored.
*
* @param idx zero-based index of the Y-label to modify
* @param str new Y-axis parameter label string
*/
void PmuppXY::setYlabel(int idx, QString str)
{
@@ -91,8 +131,12 @@ void PmuppXY::setYlabel(int idx, QString str)
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::removeYlabel. Remove the y-label at position idx.
* @param idx index of the y-label to be removed.
* @brief Removes a Y-axis label by index.
*
* Deletes the Y-axis label at the specified position from the vector.
* If the index is out of bounds, the operation is silently ignored.
*
* @param idx zero-based index of the Y-label to remove
*/
void PmuppXY::removeYlabel(int idx)
{
@@ -104,8 +148,13 @@ void PmuppXY::removeYlabel(int idx)
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::removeYlabel. Remove the y-label with name str.
* @param str name of the y-label to be removed.
* @brief Removes a Y-axis label by name.
*
* Searches for a Y-axis label matching the given string and removes it
* if found. Only the first matching label is removed. If no match is
* found, the vector remains unchanged.
*
* @param str Y-axis parameter label string to remove
*/
void PmuppXY::removeYlabel(QString str)
{
@@ -119,10 +168,15 @@ void PmuppXY::removeYlabel(QString str)
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::getYlabel. Get the y-label with index idx
* @param idx index of the requested y-label.
* @brief Gets a Y-axis label by index.
*
* @return requested y-label if found, empty string otherwise.
* Returns the Y-axis parameter label at the specified position. If the
* index is out of bounds, returns an empty string instead of causing
* an error.
*
* @param idx zero-based index of the Y-label to retrieve
*
* @return Y-axis label string if valid index, empty string otherwise
*/
QString PmuppXY::getYlabel(int idx)
{
@@ -134,8 +188,19 @@ QString PmuppXY::getYlabel(int idx)
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::getXlabelIdx. Get the x-label index.
* @return x-label index if found, otherwise -1.
* @brief Extracts the parameter index from the X-axis label.
*
* Parameter labels are formatted as "name (-index-)" where index is the
* parameter number. This method parses the label string to extract the
* numeric index value.
*
* The parsing process:
* 1. Finds the closing marker "-)"
* 2. Finds the opening marker "(-"
* 3. Extracts the numeric string between them
* 4. Converts to integer
*
* @return parameter index on success, -1 on parsing error or invalid format
*/
int PmuppXY::getXlabelIdx()
{
@@ -164,9 +229,22 @@ int PmuppXY::getXlabelIdx()
//-----------------------------------------------------------------------------
/**
* @brief PmuppXY::getYlabelIdx. Get y-label index of index idx.
* @param idx index of the y-label.
* @return y-label index on success, -1 otherwise.
* @brief Extracts the parameter index from a Y-axis label.
*
* Similar to getXlabelIdx(), this method parses a Y-axis label formatted
* as "name (-index-)" to extract the parameter number. The method first
* validates that the requested Y-label exists in the vector.
*
* The parsing process:
* 1. Validates the Y-label index is in range
* 2. Finds the closing marker "-)"
* 3. Finds the opening marker "(-"
* 4. Extracts the numeric string between them
* 5. Converts to integer
*
* @param idx zero-based index of the Y-label to process
*
* @return parameter index on success, -1 on error or invalid format
*/
int PmuppXY::getYlabelIdx(int idx)
{
@@ -198,8 +276,20 @@ int PmuppXY::getYlabelIdx(int idx)
//-----------------------------------------------------------------------------
/**
* @brief PVarErrorDialog::PVarErrorDialog. Ctor
* @param errMsg error message(s) to be displayed
* @brief Constructor for the variable error dialog.
*
* Creates a modal dialog displaying variable parsing error messages.
* The dialog contains:
* - A read-only text area showing the error message(s)
* - A "Done" button to close the dialog
*
* The dialog width is automatically calculated based on the message
* content to ensure readability:
* - Minimum width: 300 pixels
* - Maximum width: 900 pixels
* - Width scales with message length and line breaks
*
* @param errMsg error message text to display (may contain newlines)
*/
PVarErrorDialog::PVarErrorDialog(QString errMsg)
{
@@ -231,11 +321,24 @@ PVarErrorDialog::PVarErrorDialog(QString errMsg)
//-----------------------------------------------------------------------------
/**
* <p>Constructor
* @brief Constructor for the main mupp GUI window.
*
* \param fln file names to be loaded
* \param parent pointer to the parent object
* \param f qt windows flags
* Initializes the complete graphical user interface for mupp, including:
* - Data handler for parameter collections
* - Configuration manager (PmuppAdmin)
* - Theme detection and icon setup
* - Menu system (File, Tools, Help)
* - Widget layout (collections, parameters, X-Y selection, command line)
* - Command history management
* - IPC message queue initialization
*
* If file names are provided at startup, they are loaded immediately and
* the GUI is populated with the corresponding data collections and parameters.
*
* The constructor also determines a unique instance identifier for this
* mupp session to enable multiple concurrent instances with isolated IPC.
*
* @param fln list of parameter data file names to load at startup (may be empty)
*/
PmuppGui::PmuppGui(QStringList fln)
{

View File

@@ -27,6 +27,33 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file PmuppGui.h
*
* @brief Main GUI interface for the mupp (MusrFit Parameter Plotter) application.
*
* This header defines the main graphical user interface components for mupp,
* a tool for visualizing and plotting parameter data from MusrFit analysis files.
*
* Key features:
* - Interactive collection and parameter management
* - X-Y axis selection and configuration for plotting
* - Variable handling and normalization support
* - Command-line interface with history
* - Recent files management
* - Integration with ROOT plotting via external process
*
* Main classes:
* - PmuppXY: Data structure for X-Y axis label associations
* - PVarErrorDialog: Dialog for displaying variable parsing errors
* - PmuppGui: Main window class with full GUI functionality
*
* GUI Layout:
* The interface is organized with collection/parameter lists on the left,
* X-Y axis selection controls on the right, command history display, and
* command input at the bottom.
*/
#ifndef _PMUPPGUI_H_
#define _PMUPPGUI_H_
@@ -57,216 +84,601 @@
//-----------------------------------------------------------------------------
/**
* @brief The PmuppXY class.
* @brief Data structure for X-Y axis label associations.
*
* PmuppXY stores the relationship between X-axis and Y-axis parameter labels
* for plotting. Each instance represents one plot configuration with:
* - One X-axis parameter (independent variable)
* - Multiple Y-axis parameters (dependent variables)
* - Association with a specific data collection
*
* The class supports:
* - Managing multiple Y-labels for a single X-label
* - Extracting parameter indices from formatted label strings
* - Dynamic addition/removal of Y-axis parameters
*/
class PmuppXY
{
public:
/**
* @brief Default constructor. Initializes with invalid collection tag.
*/
PmuppXY() { init(); }
/**
* @brief Sets the collection tag (identifier).
* @param tag collection identifier
*/
void setCollectionTag(int tag) { fCollectionTag = tag; }
/**
* @brief Sets the X-axis label.
* @param str X-axis parameter label
*/
void setXlabel(QString str) { fXlabel = str; }
/**
* @brief Adds a Y-axis label to the list.
* @param str Y-axis parameter label to add
*/
void addYlabel(QString str) { fYlabel.push_back(str); }
/**
* @brief Sets the Y-axis label at a specific index.
* @param idx index of the Y-label to modify
* @param str new Y-axis parameter label
*/
void setYlabel(int idx, QString str);
/**
* @brief Removes a Y-axis label by index.
* @param idx index of the Y-label to remove
*/
void removeYlabel(int idx);
/**
* @brief Removes a Y-axis label by name.
* @param str Y-axis parameter label to remove
*/
void removeYlabel(QString str);
/**
* @brief Gets the collection tag.
* @return collection identifier
*/
int getCollectionTag() { return fCollectionTag; }
/**
* @brief Gets the X-axis label.
* @return X-axis parameter label
*/
QString getXlabel() { return fXlabel; }
/**
* @brief Extracts the parameter index from the X-axis label.
* @return parameter index, or -1 on error
*/
int getXlabelIdx();
/**
* @brief Gets the number of Y-axis labels.
* @return count of Y-labels
*/
int getYlabelSize() { return fYlabel.size(); }
/**
* @brief Gets a Y-axis label by index.
* @param idx index of the Y-label
* @return Y-axis parameter label, or empty string if invalid index
*/
QString getYlabel(int idx);
/**
* @brief Extracts the parameter index from a Y-axis label.
* @param idx index of the Y-label
* @return parameter index, or -1 on error
*/
int getYlabelIdx(int idx);
/**
* @brief Gets all Y-axis labels.
* @return vector of all Y-axis parameter labels
*/
QVector<QString> getYlabels() { return fYlabel; }
private:
int fCollectionTag;
QString fXlabel;
QVector<QString> fYlabel;
int fCollectionTag; ///< identifier for the associated data collection
QString fXlabel; ///< X-axis parameter label
QVector<QString> fYlabel; ///< vector of Y-axis parameter labels
/**
* @brief Initializes the object to default state.
*/
void init();
};
//-----------------------------------------------------------------------------
/**
* @brief The PVarErrorDialog class. It is used to display error messages from
* the variable parsing.
* @brief Dialog for displaying variable parsing error messages.
*
* PVarErrorDialog presents a modal dialog showing error messages that occur
* during variable expression parsing and evaluation. The dialog includes:
* - A read-only text area displaying the error message(s)
* - An "OK" button to dismiss the dialog
* - Automatic width adjustment based on message content
*
* Used by the variable handler system to report syntax errors, undefined
* variables, or evaluation failures to the user.
*/
class PVarErrorDialog : public QDialog
{
Q_OBJECT
public:
/**
* @brief Constructor that creates and displays the error dialog.
* @param errMsg error message text to display
*/
PVarErrorDialog(QString errMsg);
private:
QPlainTextEdit *fErrMsg;
QPushButton *fOK;
QPlainTextEdit *fErrMsg; ///< text widget displaying the error message
QPushButton *fOK; ///< button to close the dialog
};
//-----------------------------------------------------------------------------
// Layout Scheme of PmuppGui:
// |--------------------------------------------------------------------|
// | Main |
// | |----------------------------------------------------------------| |
// | | Top | |
// | | |----------------------------| |-----------------------------| | |
// | | | Grid Left (2 cols, 3 rows) | | Grid Right (2 cols, 6 rows) | | |
// | | | +++++++++ | | ++++++++++ | | |
// | | | | | | | |
// | | |----------------------------| |-----------------------------| | |
// | |----------------------------------------------------------------| |
// | |
// | |----------------------------------------------------------------| |
// | | History | |
// | |----------------------------------------------------------------| |
// | | Cmd | |
// | |----------------------------------------------------------------| |
// ----------------------------------------------------------------------
//
// Grid Left contains: fColLabel, fColParamSplitter,
// fRemoveCollection, fRefreshCollection
// Grid Right contains: f(X,Y)axisLabel, fView(X,Y), fAdd(X,Y), fRemove(X,Y),
// fAddDitto, fPlot
//-----------------------------------------------------------------------------
/**
* @brief Main GUI window for the mupp application.
*
* PmuppGui provides the complete graphical interface for the MusrFit Parameter
* Plotter (mupp). It manages:
* - Data collections and parameter visualization
* - X-Y axis parameter selection for plotting
* - Variable definition and normalization
* - Command-line interface with history
* - Integration with ROOT-based plotting backend
* - File I/O for parameter data files
*
* GUI Layout Scheme:
* @code
* |--------------------------------------------------------------------|
* | Main Window |
* | |----------------------------------------------------------------| |
* | | Top Panel | |
* | | |----------------------------| |-----------------------------| | |
* | | | Grid Left (2 cols, 3 rows) | | Grid Right (2 cols, 6 rows) | | |
* | | | - Collection/Param Lists | | - X/Y Axis Selection | | |
* | | | - Remove/Refresh Buttons | | - Add/Remove/Plot Buttons | | |
* | | |----------------------------| |-----------------------------| | |
* | |----------------------------------------------------------------| |
* | | Command History Display | |
* | |----------------------------------------------------------------| |
* | | Command Input Line | |
* | |----------------------------------------------------------------| |
* ----------------------------------------------------------------------
* @endcode
*
* Grid Left contains:
* - fColLabel, fColParamSplitter (collection/parameter list widgets)
* - fRemoveCollection, fRefreshCollection (control buttons)
*
* Grid Right contains:
* - f(X,Y)axisLabel (axis labels)
* - fView(X,Y) (current X/Y selections)
* - fAdd(X,Y), fRemove(X,Y) (parameter management buttons)
* - fAddDitto, fPlot (special action buttons)
*
* The application supports command-line style interaction through the
* command input field, with history navigation and macro generation.
*/
class PmuppGui : public QMainWindow
{
Q_OBJECT
public:
/**
* @brief Constructor. Creates the main GUI window.
* @param fln list of parameter data files to load at startup
*/
PmuppGui(QStringList fln);
/**
* @brief Destructor. Cleans up resources and saves command history.
*/
virtual ~PmuppGui();
public slots:
/**
* @brief Slot called when application is about to quit. Saves state.
*/
void aboutToQuit();
/**
* @brief Opens a file dialog to select parameter data files to load.
*/
void fileOpen();
/**
* @brief Opens a recently used parameter file.
*/
void fileOpenRecent();
/**
* @brief Exits the application after cleanup.
*/
void fileExit();
/**
* @brief Dumps collection information for debugging purposes.
*/
void toolDumpCollections();
/**
* @brief Dumps X-Y axis information for debugging purposes.
*/
void toolDumpXY();
/**
* @brief Opens dialog to add/manage variable definitions.
*/
void addVar();
/**
* @brief Toggles normalization mode for plot data.
*/
void normalize();
/**
* @brief Shows help dialog with available commands.
*/
void helpCmds();
/**
* @brief Shows about dialog with application information.
*/
void helpAbout();
/**
* @brief Shows Qt framework information dialog.
*/
void helpAboutQt();
protected:
/**
* @brief Event filter for handling keyboard and mouse events.
* @param o object that received the event
* @param e the event to process
* @return true if event was handled, false otherwise
*/
bool eventFilter(QObject *o, QEvent *e);
private:
enum EAxis {kXaxis, kYaxis};
/**
* @brief Enumeration for axis type identification.
*/
enum EAxis {kXaxis, ///< X-axis (independent variable)
kYaxis}; ///< Y-axis (dependent variable)
PmuppAdmin *fAdmin;
bool fIgnoreThemeAutoDetection{false};
bool fDarkThemeIconsMenu{false};
bool fDarkThemeIconsToolbar{false};
bool fNormalize{false};
PmuppAdmin *fAdmin; ///< administration object managing configuration
bool fIgnoreThemeAutoDetection{false}; ///< flag to override automatic theme detection
bool fDarkThemeIconsMenu{false}; ///< flag for dark theme menu icons
bool fDarkThemeIconsToolbar{false}; ///< flag for dark theme toolbar icons
bool fNormalize{false}; ///< flag indicating normalization mode
qint64 fDatime;
uint fMuppInstance;
qint64 fDatime; ///< timestamp for IPC message queue identification
uint fMuppInstance; ///< unique instance identifier for this mupp session
PParamDataHandler *fParamDataHandler;
QVector<PmuppXY> fXY;
QVector<PVarHandler> fVarHandler;
PParamDataHandler *fParamDataHandler; ///< handler for parameter data collections
QVector<PmuppXY> fXY; ///< vector of X-Y axis configurations
QVector<PVarHandler> fVarHandler; ///< vector of variable handlers
QString fMacroPath;
QString fMacroName;
QString fMacroPath; ///< directory path for ROOT macro generation
QString fMacroName; ///< name of the generated ROOT macro file
std::unique_ptr<QWidget> fCentralWidget;
std::unique_ptr<QWidget> fCentralWidget; ///< central widget containing all GUI elements
QMenu *fRecentFilesMenu; ///< recent file menu
QAction *fRecentFilesAction[MAX_RECENT_FILES]; ///< array of the recent file actions
std::unique_ptr<QAction> fNormalizeAction;
std::unique_ptr<QAction> fNormalizeAction; ///< action for normalize toggle
std::unique_ptr<QBoxLayout> fBoxLayout_Main; // top->bottom (0)
std::unique_ptr<QBoxLayout> fBoxLayout_Top; // left->right (1)
std::unique_ptr<QGridLayout> fGridLayout_Left; // 2 columns, 3 rows
std::unique_ptr<QGridLayout> fGridLayout_Right; // 2 columns, 6 rows
std::unique_ptr<QBoxLayout> fBoxLayout_Cmd; // left->right (1)
std::unique_ptr<QBoxLayout> fBoxLayout_Main; ///< main vertical layout (top->bottom)
std::unique_ptr<QBoxLayout> fBoxLayout_Top; ///< top horizontal layout (left->right)
std::unique_ptr<QGridLayout> fGridLayout_Left; ///< left grid layout (2 columns, 3 rows)
std::unique_ptr<QGridLayout> fGridLayout_Right; ///< right grid layout (2 columns, 6 rows)
std::unique_ptr<QBoxLayout> fBoxLayout_Cmd; ///< command area horizontal layout (left->right)
std::unique_ptr<QLabel> fColLabel;
std::unique_ptr<QSplitter> fColParamSplitter;
std::unique_ptr<QListWidget> fColList;
std::unique_ptr<QListWidget> fParamList;
std::unique_ptr<QPushButton> fRemoveCollection;
std::unique_ptr<QPushButton> fRefreshCollection;
std::unique_ptr<QLabel> fXaxisLabel;
std::unique_ptr<QLabel> fYaxisLabel;
std::unique_ptr<QListWidget> fViewX;
std::unique_ptr<QListWidget> fViewY;
std::unique_ptr<QPushButton> fAddX;
std::unique_ptr<QPushButton> fAddY;
std::unique_ptr<QPushButton> fAddDitto;
std::unique_ptr<QPushButton> fRemoveX;
std::unique_ptr<QPushButton> fRemoveY;
std::unique_ptr<QPushButton> fPlot;
std::unique_ptr<QSplitter> fCmdSplitter;
std::unique_ptr<QPlainTextEdit> fCmdLineHistory;
std::unique_ptr<QLineEdit> fCmdLine;
std::unique_ptr<QPushButton> fExitButton;
std::unique_ptr<QLabel> fColLabel; ///< label for collection/parameter section
std::unique_ptr<QSplitter> fColParamSplitter; ///< splitter between collection and parameter lists
std::unique_ptr<QListWidget> fColList; ///< list widget displaying data collections
std::unique_ptr<QListWidget> fParamList; ///< list widget displaying parameters in selected collection
std::unique_ptr<QPushButton> fRemoveCollection; ///< button to remove selected collection
std::unique_ptr<QPushButton> fRefreshCollection; ///< button to refresh collection list
std::unique_ptr<QLabel> fXaxisLabel; ///< label for X-axis selection area
std::unique_ptr<QLabel> fYaxisLabel; ///< label for Y-axis selection area
std::unique_ptr<QListWidget> fViewX; ///< list widget showing current X-axis parameter
std::unique_ptr<QListWidget> fViewY; ///< list widget showing current Y-axis parameters
std::unique_ptr<QPushButton> fAddX; ///< button to add parameter to X-axis
std::unique_ptr<QPushButton> fAddY; ///< button to add parameter to Y-axis
std::unique_ptr<QPushButton> fAddDitto; ///< button to copy X-axis parameter to Y-axis
std::unique_ptr<QPushButton> fRemoveX; ///< button to remove X-axis parameter
std::unique_ptr<QPushButton> fRemoveY; ///< button to remove Y-axis parameter
std::unique_ptr<QPushButton> fPlot; ///< button to generate and display plot
std::unique_ptr<QSplitter> fCmdSplitter; ///< splitter between history and command input
std::unique_ptr<QPlainTextEdit> fCmdLineHistory; ///< text area displaying command history
std::unique_ptr<QLineEdit> fCmdLine; ///< line edit for command input
std::unique_ptr<QPushButton> fExitButton; ///< button to exit application
QVector<QString> fCmdHistory; ///< command history buffer
QVector<QString> fCmdHistory; ///< command history buffer for navigation
std::unique_ptr<PVarDialog> fVarDlg; ///< variable dialog
std::unique_ptr<PVarDialog> fVarDlg; ///< variable definition dialog
std::unique_ptr<QProcess> fMuppPlot; ///< mupp plotter
std::unique_ptr<QProcess> fMuppPlot; ///< external process for ROOT-based plotting
/**
* @brief Sets up File menu actions (Open, Recent Files, Exit).
*/
void setupFileActions();
/**
* @brief Sets up Tools menu actions (Dump, Variables, Normalize).
*/
void setupToolActions();
/**
* @brief Sets up Help menu actions (Commands, About).
*/
void setupHelpActions();
/**
* @brief Detects system theme (light/dark) and configures icons accordingly.
*/
void getTheme();
/**
* @brief Populates the recent files menu from configuration.
*/
void fillRecentFiles();
/**
* @brief Reads command history from disk at startup.
*/
void readCmdHistory();
/**
* @brief Writes command history to disk before exit.
*/
void writeCmdHistory();
/**
* @brief Checks if a collection is new (not already in the list).
* @param coll collection to check
* @return true if collection is new, false otherwise
*/
bool isNewCollection(PmuppCollection &coll);
/**
* @brief Gets the index of an X-axis label in the XY list.
* @param label X-axis label to search for
* @return index if found, -1 otherwise
*/
int getXlabelIndex(QString label);
/**
* @brief Finds minimum and maximum values in a data vector.
* @param data vector of data values
* @param min output parameter: minimum value
* @param max output parameter: maximum value
*/
void getMinMax(QVector<double> &data, double &min, double &max);
/**
* @brief Substitutes default parameter labels with descriptive names.
* @param label original parameter label
* @return substituted label string
*/
QString substituteDefaultLabels(QString label);
/**
* @brief Selects a collection based on command string.
* @param cmd command string specifying collection
*/
void selectCollection(QString cmd);
/**
* @brief Finds the first available mupp instance number for IPC.
* @return available instance identifier
*/
uint getFirstAvailableMuppInstance();
/**
* @brief Updates the collection list widget from data handler.
*/
void updateCollectionList();
/**
* @brief Updates the X-Y axis configuration for a specific index.
* @param idx index of the XY configuration to update
*/
void updateXYList(int idx);
/**
* @brief Updates the X-Y axis list widgets in the GUI.
*/
void updateXYListGui();
/**
* @brief Finds parameter value in a run structure.
* @param run the run data structure to search
* @param tag axis type (X or Y)
* @return true if value found, false otherwise
*/
bool findValue(PmuppRun &run, EAxis tag);
/**
* @brief Checks if all X-Y configurations are identical.
* @return true if all XY configs match, false otherwise
*/
bool allXYEqual();
/**
* @brief Checks if an index is already present in XY list.
* @param idx index to check
* @return true if index exists, false otherwise
*/
bool indexAlreadyPresent(int idx);
/**
* @brief Replaces an index in the XY data structure.
* @param data XY data structure to modify
* @param idx new index value
*/
void replaceIndex(PmuppXY &data, const int idx);
/**
* @brief Starts the external ROOT plotting process.
*/
void startMuppPlot();
/**
* @brief Displays a dialog with variable parsing error messages.
*/
void parseErrMsgDlg();
/**
* @brief Extracts variable names from a parse string.
* @param parseStr string containing variable expressions
* @return list of variable names found
*/
QStringList getVarNames(QString parseStr);
/**
* @brief Gets parameter values from a collection.
* @param collName collection name
* @param paramName parameter name
* @param ok output parameter: true if successful, false on error
* @return vector of parameter values
*/
QVector<double> getValues(QString collName, QString paramName, bool &ok);
/**
* @brief Gets positive error values for a parameter.
* @param collName collection name
* @param paramName parameter name
* @param ok output parameter: true if successful, false on error
* @return vector of positive error values
*/
QVector<double> getPosErr(QString collName, QString paramName, bool &ok);
/**
* @brief Gets negative error values for a parameter.
* @param collName collection name
* @param paramName parameter name
* @param ok output parameter: true if successful, false on error
* @return vector of negative error values
*/
QVector<double> getNegErr(QString collName, QString paramName, bool &ok);
private slots:
/**
* @brief Copies X-axis parameter to Y-axis (ditto function).
*/
void addDitto();
/**
* @brief Adds a parameter to the X-axis.
* @param param parameter name (empty uses selected parameter)
*/
void addX(QString param="");
/**
* @brief Adds a parameter to the Y-axis.
* @param param parameter name (empty uses selected parameter)
*/
void addY(QString param="");
/**
* @brief Creates a ROOT macro file from current plot configuration.
*/
void createMacro();
/**
* @brief Processes commands entered in the command line.
*/
void handleCmds();
/**
* @brief Generates and displays the plot using current configuration.
*/
void plot();
/**
* @brief Refreshes the collection list from data handler.
*/
void refresh();
/**
* @brief Removes the selected collection from the list.
*/
void remove();
/**
* @brief Removes a parameter from the X-axis.
* @param param parameter name (empty uses current X-axis parameter)
*/
void removeX(QString param="");
/**
* @brief Removes a parameter from the Y-axis.
* @param param parameter name (empty uses selected Y-axis parameter)
*/
void removeY(QString param="");
/**
* @brief Handles newly loaded data by updating GUI components.
*/
void handleNewData();
/**
* @brief Updates the parameter list based on selected collection.
* @param currentRow currently selected row in collection list
*/
void updateParamList(int currentRow);
/**
* @brief Handles editing of collection name via double-click.
* @param item the list item being edited
*/
void editCollName(QListWidgetItem *item);
/**
* @brief Handles drag-and-drop onto X-axis view.
* @param item the dropped list item
*/
void dropOnViewX(QListWidgetItem *item);
/**
* @brief Handles drag-and-drop onto Y-axis view.
* @param item the dropped list item
*/
void dropOnViewY(QListWidgetItem *item);
/**
* @brief Refreshes the Y-axis list after variable changes.
*/
void refreshY();
/**
* @brief Checks variable expressions for validity.
* @param varStr variable expression string
* @param idx indices of collections involved
*/
void check(QString varStr, QVector<int> idx);
/**
* @brief Adds a validated variable expression.
* @param varStr variable expression string
* @param idx indices of collections involved
*/
void add(QString varStr, QVector<int> idx);
};