musredit 1.0.0
Loading...
Searching...
No Matches
PChangeDefaultPathsDialog Class Reference

Dialog for editing default data file search paths. More...

#include <PChangeDefaultPathsDialog.h>

Inheritance diagram for PChangeDefaultPathsDialog:
Collaboration diagram for PChangeDefaultPathsDialog:

Public Member Functions

 PChangeDefaultPathsDialog ()
 Constructs the default paths dialog.
 

Private Slots

void deleteItem ()
 Remove the currently selected path from the list.
 
void addItem ()
 Add a new directory path via file browser dialog.
 
void saveDefaultPathList ()
 Save the modified path list to the configuration file.
 

Private Attributes

std::unique_ptr< PDefaultPathsfDefaultPath
 Manages the default paths data.
 

Detailed Description

Dialog for editing default data file search paths.

This dialog provides a graphical interface for users to view, add, and remove the default directory paths where musrfit searches for muon spin rotation data files.

Features:
  • Displays current search paths in a list widget
  • Add new paths via directory browser dialog
  • Delete selected paths from the list
  • Save changes back to the configuration file

The dialog is modal and changes are persisted to musrfit_startup.xml when the user accepts the dialog (clicks OK).

UI Elements:
The dialog UI is defined in PChangeDefaultPathsDialog.ui and includes:
  • A list widget (fSearchPath_listWidget) showing current paths
  • Add button (fAdd_pushButton) to add new directories
  • Delete button (fDelete_pushButton) to remove selected path
  • Standard OK/Cancel button box
See also
PDefaultPaths For path storage and loading

Definition at line 209 of file PChangeDefaultPathsDialog.h.

Constructor & Destructor Documentation

◆ PChangeDefaultPathsDialog()

PChangeDefaultPathsDialog::PChangeDefaultPathsDialog ( )

Constructs the default paths dialog.

Initializes the dialog by:

  1. Creating a PDefaultPaths object to load current paths
  2. Setting up the UI from the .ui file
  3. Populating the list widget with existing paths
  4. Connecting button signals to handler slots

The dialog is created as modal, blocking interaction with other windows until closed.

Note
If path loading fails (PDefaultPaths invalid), the constructor returns early without fully initializing the dialog.

Definition at line 298 of file PChangeDefaultPathsDialog.cpp.

Member Function Documentation

◆ addItem

void PChangeDefaultPathsDialog::addItem ( )
privateslot

Add a new directory path via file browser dialog.

Slot to add a new directory path to the list.

Opens a directory selection dialog allowing the user to browse for and select a directory. If the user selects a directory (doesn't cancel), the path is inserted into the list widget immediately after the currently selected item.

Note
Uses QFileDialog configured to show only directories and not resolve symbolic links.

Definition at line 334 of file PChangeDefaultPathsDialog.cpp.

◆ deleteItem

void PChangeDefaultPathsDialog::deleteItem ( )
privateslot

Remove the currently selected path from the list.

Slot to remove the currently selected path from the list.

Removes the currently selected item from the list widget and frees its memory. If no item is selected, the method has no effect.

Definition at line 359 of file PChangeDefaultPathsDialog.cpp.

◆ saveDefaultPathList

void PChangeDefaultPathsDialog::saveDefaultPathList ( )
privateslot

Save the modified path list to the configuration file.

Slot to save the modified path list to the configuration file.

Persists the current list of data paths to the musrfit_startup.xml configuration file. The method:

  1. Reads the existing configuration file content
  2. Removes all existing <data_path> elements
  3. Inserts the current list widget entries as new <data_path> elements
  4. Writes the modified content back to the file

If no <data_path> elements existed in the original file, the new paths are inserted just before the closing </musrfit> tag.

Note
This slot is connected to the dialog's accept signal, so it is called automatically when the user clicks OK.

Definition at line 383 of file PChangeDefaultPathsDialog.cpp.

Member Data Documentation

◆ fDefaultPath

std::unique_ptr<PDefaultPaths> PChangeDefaultPathsDialog::fDefaultPath
private

Manages the default paths data.

Definition at line 233 of file PChangeDefaultPathsDialog.h.


The documentation for this class was generated from the following files: