Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::AppSettings Class Reference

Persistent application settings (window size, device selection, preferences). More...

#include <app_framework.hpp>

Classes

struct  WindowState

Public Member Functions

 AppSettings (const std::string &app_name)
std::optional< std::string > get_string (const std::string &key) const
 Get a string setting.
std::optional< int > get_int (const std::string &key) const
 Get an int setting.
std::optional< float > get_float (const std::string &key) const
 Get a float setting.
std::optional< bool > get_bool (const std::string &key) const
 Get a bool setting.
void set_string (const std::string &key, const std::string &value)
 Set values (not persisted until save() is called).
void set_int (const std::string &key, int value)
void set_float (const std::string &key, float value)
void set_bool (const std::string &key, bool value)
bool save ()
 Persist to disk.
bool load ()
 Load from disk.
void save_window_state (int x, int y, int width, int height)
 Convenience: save/restore window geometry.
std::optional< WindowState > load_window_state () const
std::filesystem::path settings_path () const
 Settings file path.

Detailed Description

Persistent application settings (window size, device selection, preferences).

Settings are stored as JSON in platform-standard locations:

  • macOS: ~/Library/Application Support/<app_name>/settings.json
  • Windows: APPDATA%/<app_name>/settings.json
  • Linux: ~/.config/<app_name>/settings.json

Constructor & Destructor Documentation

◆ AppSettings()

pulp::view::AppSettings::AppSettings ( const std::string & app_name)
explicit

Member Function Documentation

◆ get_bool()

std::optional< bool > pulp::view::AppSettings::get_bool ( const std::string & key) const

Get a bool setting.

◆ get_float()

std::optional< float > pulp::view::AppSettings::get_float ( const std::string & key) const

Get a float setting.

◆ get_int()

std::optional< int > pulp::view::AppSettings::get_int ( const std::string & key) const

Get an int setting.

◆ get_string()

std::optional< std::string > pulp::view::AppSettings::get_string ( const std::string & key) const

Get a string setting.

◆ load()

bool pulp::view::AppSettings::load ( )

Load from disk.

◆ load_window_state()

std::optional< WindowState > pulp::view::AppSettings::load_window_state ( ) const

◆ save()

bool pulp::view::AppSettings::save ( )

Persist to disk.

◆ save_window_state()

void pulp::view::AppSettings::save_window_state ( int x,
int y,
int width,
int height )

Convenience: save/restore window geometry.

◆ set_bool()

void pulp::view::AppSettings::set_bool ( const std::string & key,
bool value )

◆ set_float()

void pulp::view::AppSettings::set_float ( const std::string & key,
float value )

◆ set_int()

void pulp::view::AppSettings::set_int ( const std::string & key,
int value )

◆ set_string()

void pulp::view::AppSettings::set_string ( const std::string & key,
const std::string & value )

Set values (not persisted until save() is called).

◆ settings_path()

std::filesystem::path pulp::view::AppSettings::settings_path ( ) const
inline

Settings file path.


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