Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitk::IPreferencesService Class Referenceabstract

A service for persistent application preferences. More...

#include <mitkIPreferencesService.h>

Inheritance diagram for mitk::IPreferencesService:

Public Member Functions

virtual ~IPreferencesService ()
 If initialized, ask the preferences backend to flush preferences, i.e. write them to disk. More...
 
virtual void InitializeStorage (const fs::path &filename)=0
 Initialize the preferences backend. More...
 
virtual void UninitializeStorage (bool removeFile=true)=0
 For internal use only. More...
 
virtual IPreferencesGetSystemPreferences ()=0
 Access preferences. More...
 
virtual bool OpenPreferencesDialog (const std::string &page={})
 Opens the preferences dialog, if available. More...
 

Detailed Description

A service for persistent application preferences.

See also
CoreServices::GetPreferencesService()
IPreferences

Definition at line 33 of file mitkIPreferencesService.h.

Constructor & Destructor Documentation

◆ ~IPreferencesService()

virtual mitk::IPreferencesService::~IPreferencesService ( )
virtual

If initialized, ask the preferences backend to flush preferences, i.e. write them to disk.

Member Function Documentation

◆ GetSystemPreferences()

virtual IPreferences* mitk::IPreferencesService::GetSystemPreferences ( )
pure virtual

Access preferences.

The system preferences should be considered as resource and as such their lifetime is coupled to this service. It is recommended to access the preferences always through this method as needed instead of keeping a pointer permanently.

Note
The term "system preferences" is kept for historical reasons to stay as API-compatible as possible to the previous preferences service. A more precise term would be "application preferences".
Returns
The root node of the preferences tree.

Implemented in mitk::PreferencesService.

◆ InitializeStorage()

virtual void mitk::IPreferencesService::InitializeStorage ( const fs::path &  filename)
pure virtual

Initialize the preferences backend.

Load preferences from the specified file. If the file does not yet exist, create an empty preferences storage.

This method must be called once at the start of an application before accessing any preferences via GetSystemPreferences().

Exceptions
ExceptionThe method is called more than once.
See also
IPreferencesStorage

Implemented in mitk::PreferencesService.

◆ OpenPreferencesDialog()

virtual bool mitk::IPreferencesService::OpenPreferencesDialog ( const std::string &  page = {})
virtual

Opens the preferences dialog, if available.

This method attempts to open the preferences dialog. The exact behavior depends on the implementation - it may be non-blocking (e.g., using QDialog::open()) or blocking until the dialog is closed (e.g., using QDialog::exec()).

Parameters
pageOptional. The ID of the preference page to display initially. This should correspond to a page ID defined in a plugin.xml file. If empty, the default preferences page will be shown.
Returns
true if the preferences dialog was successfully opened; otherwise false.

◆ UninitializeStorage()

virtual void mitk::IPreferencesService::UninitializeStorage ( bool  removeFile = true)
pure virtual

For internal use only.

This method is only used for testing purposes. Do not use in production code.

Implemented in mitk::PreferencesService.


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