|
mupp 1.1.0
|
Main administration class for mupp configuration management. More...
#include <PmuppAdmin.h>


Public Member Functions | |
| PmuppAdmin () | |
| Constructor. Loads configuration from mupp_startup.xml. | |
| virtual | ~PmuppAdmin () |
| Destructor. Saves recent files list before destruction. | |
| void | addRecentFile (const QString str) |
| Adds a file to the recent files list. | |
| int | getNumRecentFiles () |
| Gets the number of recent files. | |
| QString | getRecentFile (int idx) |
| Gets a recent file path by index. | |
| int | getNoOfMarkers () |
| Gets the number of configured markers. | |
| QVector< PmuppMarker > | getMarkers () |
| Gets all markers. | |
| PmuppMarker | getMarker (int idx) |
| Gets a marker definition by index. | |
| int | getNoOfColors () |
| Gets the number of configured colors. | |
| QVector< PmuppColor > | getColors () |
| Gets all colors. | |
| void | getColor (QString name, int &r, int &g, int &b) |
| Gets a color by name. | |
| void | getColor (int idx, int &r, int &g, int &b) |
| Gets a color by index. | |
| bool | getIgnoreThemeAutoDetection () |
| Checks if theme auto-detection should be ignored. | |
| bool | getDarkThemeIconsMenuFlag () |
| Checks if dark theme icons should be used for menus. | |
| bool | getDarkThemeIconsToolbarFlag () |
| Checks if dark theme icons should be used for toolbars. | |
| void | setIgnoreThemeAutoDetection (const bool theme) |
| Sets the theme auto-detection preference. | |
| void | setThemeIconsMenu (const bool theme) |
| Sets the menu icon theme preference. | |
| void | setThemeIconsToolbar (const bool theme) |
| Sets the toolbar icon theme preference. | |
| void | setMarker (const int marker, const double size) |
| Adds a marker definition to the configuration. | |
| void | setColor (const int r, const int g, const int b, QString name="") |
| Adds a color definition to the configuration. | |
Private Member Functions | |
| void | saveRecentFiles () |
| Saves the recent files list to the configuration file. | |
| void | createMuppStartupFile () |
| Creates a default mupp_startup.xml configuration file. | |
Private Attributes | |
| QVector< QString > | fRecentFile |
| ring buffer of recent file paths (max MAX_RECENT_FILES) | |
| 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 | |
| QVector< PmuppMarker > | fMarker |
| vector of configured plot markers | |
| QVector< PmuppColor > | fColor |
| vector of configured plot colors | |
Friends | |
| class | PmuppAdminXMLParser |
Main administration class for mupp configuration management.
The PmuppAdmin class manages all configuration settings and user preferences for the mupp application. It loads settings from the XML startup file (mupp_startup.xml) and provides access to:
Configuration file search order:
If no configuration file is found, a default one is created in the user's home directory (~/.musrfit/mupp/).
The class automatically saves the recent file list when destroyed, updating the configuration file with the current session's file history.
Definition at line 323 of file PmuppAdmin.h.
| PmuppAdmin::PmuppAdmin | ( | ) |
Constructor. Loads configuration from mupp_startup.xml.
Constructor for PmuppAdmin.
Initializes the administration object and searches for a configuration file in multiple standard locations. The search proceeds in order:
If no configuration file is found, creates a default one in the user's home directory using the embedded resource template.
The constructor loads all configuration settings including recent files, markers, colors, and theme preferences via the PmuppAdminXMLParser.
Definition at line 388 of file PmuppAdmin.cpp.
|
virtual |
Destructor. Saves recent files list before destruction.
Destructor for PmuppAdmin.
Saves the current recent file list to the configuration file before destruction. This ensures that the file history is preserved across application sessions.
Definition at line 442 of file PmuppAdmin.cpp.
| void PmuppAdmin::addRecentFile | ( | const QString | str | ) |
Adds a file to the recent files list.
| str | the file path to add |
Adds a file path to the front of the recent files ring buffer. If the file is already in the list, it is not added again (no duplicates). The list is limited to MAX_RECENT_FILES entries; older entries are removed when the limit is exceeded.
| str | the full path and filename to add to recent files |
Definition at line 458 of file PmuppAdmin.cpp.
|
private |
Creates a default mupp_startup.xml configuration file.
Called when no configuration file is found. Creates the file in $HOME/.musrfit/mupp/ using the embedded resource template.
This method is called when no configuration file is found in any of the standard locations. It creates a new default configuration file in the user's home directory ($HOME/.musrfit/mupp/mupp_startup.xml).
The implementation:
The default configuration includes standard marker styles, color definitions, and empty recent file list, providing a working baseline for new users or clean installations.
Definition at line 722 of file PmuppAdmin.cpp.
| void PmuppAdmin::getColor | ( | int | idx, |
| int & | r, | ||
| int & | g, | ||
| int & | b ) |
Gets a color by index.
Retrieves a color by index.
| idx | zero-based index into the color list |
| r | output parameter: red component (0-255, or -1 if invalid) |
| g | output parameter: green component (0-255, or -1 if invalid) |
| b | output parameter: blue component (0-255, or -1 if invalid) |
Returns the RGB values of the color at the specified index in the color list. If the index is out of range, all RGB components are set to -1.
| idx | zero-based index into the color list |
| r | output parameter: red component (0-255, or -1 if invalid index) |
| g | output parameter: green component (0-255, or -1 if invalid index) |
| b | output parameter: blue component (0-255, or -1 if invalid index) |
Definition at line 556 of file PmuppAdmin.cpp.
| void PmuppAdmin::getColor | ( | QString | name, |
| int & | r, | ||
| int & | g, | ||
| int & | b ) |
Gets a color by name.
Retrieves a color by name.
| name | the color name to search for |
| r | output parameter: red component (0-255, or -1 if not found) |
| g | output parameter: green component (0-255, or -1 if not found) |
| b | output parameter: blue component (0-255, or -1 if not found) |
Searches for a color with the specified name and returns its RGB values. If the color is not found, all RGB components are set to -1.
| name | the name of the color to retrieve |
| r | output parameter: red component (0-255, or -1 if not found) |
| g | output parameter: green component (0-255, or -1 if not found) |
| b | output parameter: blue component (0-255, or -1 if not found) |
Definition at line 524 of file PmuppAdmin.cpp.
|
inline |
Gets all colors.
Definition at line 384 of file PmuppAdmin.h.
|
inline |
Checks if dark theme icons should be used for menus.
Definition at line 414 of file PmuppAdmin.h.
|
inline |
Checks if dark theme icons should be used for toolbars.
Definition at line 420 of file PmuppAdmin.h.
|
inline |
Checks if theme auto-detection should be ignored.
Definition at line 408 of file PmuppAdmin.h.
| PmuppMarker PmuppAdmin::getMarker | ( | int | idx | ) |
Gets a marker definition by index.
Retrieves a marker definition by index.
| idx | zero-based index into the marker list |
Returns the marker at the specified index in the marker list. Markers are used to define the visual appearance of data points in plots.
| idx | zero-based index into the marker list |
Definition at line 503 of file PmuppAdmin.cpp.
|
inline |
Gets all markers.
Definition at line 365 of file PmuppAdmin.h.
|
inline |
Gets the number of configured colors.
Definition at line 378 of file PmuppAdmin.h.
|
inline |
Gets the number of configured markers.
Definition at line 359 of file PmuppAdmin.h.
|
inline |
Gets the number of recent files.
Definition at line 346 of file PmuppAdmin.h.
| QString PmuppAdmin::getRecentFile | ( | int | idx | ) |
Gets a recent file path by index.
Retrieves a recent file path by index.
| idx | zero-based index (0 is most recent) |
Returns the file path at the specified position in the recent files list. Index 0 refers to the most recently accessed file.
| idx | zero-based index into the recent files list (0 is most recent) |
Definition at line 482 of file PmuppAdmin.cpp.
|
private |
Saves the recent files list to the configuration file.
Updates mupp_startup.xml with current recent file history while preserving other configuration settings.
Updates the mupp_startup.xml file with the current recent file list. The method first searches for a local configuration file in the current directory; if not found, it uses the user's home directory version ($HOME/.musrfit/mupp/mupp_startup.xml).
The implementation:
This preserves all other configuration settings while updating only the recent file history.
Definition at line 640 of file PmuppAdmin.cpp.
| void PmuppAdmin::setColor | ( | const int | r, |
| const int | g, | ||
| const int | b, | ||
| QString | name = "" ) |
Adds a color definition to the configuration.
| r | red component (0-255) |
| g | green component (0-255) |
| b | blue component (0-255) |
| name | optional name for the color |
Creates a new color with the specified RGB values and optional name, validates it, and adds it to the color list. RGB values must be in the range 0-255. Invalid colors are rejected with a warning.
| r | red component (0-255) |
| g | green component (0-255) |
| b | blue component (0-255) |
| name | optional name for the color (empty by default) |
Definition at line 606 of file PmuppAdmin.cpp.
|
inline |
Sets the theme auto-detection preference.
| theme | true to ignore auto-detection, false to enable it |
Definition at line 426 of file PmuppAdmin.h.
| void PmuppAdmin::setMarker | ( | const int | marker, |
| const double | size ) |
Adds a marker definition to the configuration.
| marker | the marker code (1-49, ROOT style) |
| size | the marker size multiplier |
Creates a new marker with the specified code and size, validates it, and adds it to the marker list. Marker codes must be in the range 1-49 (following ROOT conventions). Invalid markers are rejected with a warning.
| marker | the marker code (1-49, ROOT style marker codes) |
| size | the marker size multiplier |
Definition at line 578 of file PmuppAdmin.cpp.
|
inline |
Sets the menu icon theme preference.
| theme | true for dark theme icons, false for light theme icons |
Definition at line 432 of file PmuppAdmin.h.
|
inline |
Sets the toolbar icon theme preference.
| theme | true for dark theme icons, false for light theme icons |
Definition at line 438 of file PmuppAdmin.h.
|
friend |
Definition at line 457 of file PmuppAdmin.h.
|
private |
vector of configured plot colors
Definition at line 465 of file PmuppAdmin.h.
|
private |
flag for dark theme menu icons
Definition at line 462 of file PmuppAdmin.h.
|
private |
flag for dark theme toolbar icons
Definition at line 463 of file PmuppAdmin.h.
|
private |
flag to override automatic theme detection
Definition at line 461 of file PmuppAdmin.h.
|
private |
vector of configured plot markers
Definition at line 464 of file PmuppAdmin.h.
|
private |
ring buffer of recent file paths (max MAX_RECENT_FILES)
Definition at line 459 of file PmuppAdmin.h.