pub struct Config { /* private fields */ }Expand description
QCode’s settings file.
Implementations§
Source§impl Config
impl Config
Sourcepub const LANGUAGES: [&'static str; 9]
pub const LANGUAGES: [&'static str; 9]
Every language QCode speaks, in the order the setup wizard offers them.
The list lives with the settings file because this is where a chosen language stops being a choice on a screen and becomes text a schema has to accept. A screen that offers a language the file will not hold writes it once and loses it at the next start, so the screens read their list from here rather than keeping one of their own.
Sourcepub const RECENT_LIMIT: usize = 10
pub const RECENT_LIMIT: usize = 10
How many workspaces the recent list keeps. Beyond a screenful the list stops being a shortcut, and the full list of workspaces is one screen away.
Sourcepub fn load() -> Loaded<Self>
pub fn load() -> Loaded<Self>
Brings the settings over from where earlier versions kept them and reads them from the family’s folder. The diagnostics are the old files that stayed where they were, each with the reason; nothing was overwritten to move them. Without a home folder the settings stay in memory and say why.
Sourcepub fn load_in(folder: &Path, legacy: &Path) -> Loaded<Self>
pub fn load_in(folder: &Path, legacy: &Path) -> Loaded<Self>
load with folder as the family’s folder and legacy as the folder the
old settings.toml may be in, so a test never touches the person’s own settings.
Sourcepub fn parse_str(file: &str, text: &str) -> Self
pub fn parse_str(file: &str, text: &str) -> Self
Reads the settings from TOML text, reporting problems against file. Saving does
nothing.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Every problem found while reading the file, including every repair that was made.
Sourcepub fn save(&mut self) -> Result<()>
pub fn save(&mut self) -> Result<()>
Writes the settings to their file atomically.
§Errors
Returns the I/O error when the directory or the file cannot be written.
Sourcepub fn settings(&self) -> &Settings
pub fn settings(&self) -> &Settings
The framework settings underneath, for the screens that read the theme, the language or the icon mode and for applying them.
Sourcepub fn set_language(&mut self, code: &str) -> bool
pub fn set_language(&mut self, code: &str) -> bool
Records the language the application speaks. Answers whether anything changed.
The four settings the framework keeps for every Quvyta application are already in force by the time they reach here: the settings screen applies a choice to the running application and asks for it to be stored, and storing is this file’s part of that.
Sourcepub fn set_theme(&mut self, id: &str) -> bool
pub fn set_theme(&mut self, id: &str) -> bool
Records the theme the application wears. Answers whether anything changed.
Sourcepub fn set_icons(&mut self, mode: IconMode) -> bool
pub fn set_icons(&mut self, mode: IconMode) -> bool
Records which glyphs the application draws with. Answers whether anything changed.
Sourcepub fn set_reduced_motion(&mut self, reduced: bool) -> bool
pub fn set_reduced_motion(&mut self, reduced: bool) -> bool
Records whether the application moves as little as it can. Answers whether anything changed.
Sourcepub fn setup_completed(&self) -> bool
pub fn setup_completed(&self) -> bool
Whether the setup wizard has finished. Until it has, the wizard runs.
Sourcepub fn set_setup_completed(&mut self, completed: bool) -> bool
pub fn set_setup_completed(&mut self, completed: bool) -> bool
Records whether the setup wizard has finished. Answers whether anything changed.
Sourcepub fn setup_step(&self) -> SetupStep
pub fn setup_step(&self) -> SetupStep
The step the wizard stopped at, the first one until it says otherwise.
Sourcepub fn set_setup_step(&mut self, step: SetupStep) -> bool
pub fn set_setup_step(&mut self, step: SetupStep) -> bool
Records the step the wizard is on. Answers whether anything changed.
Sourcepub fn engine_kind(&self) -> Option<&str>
pub fn engine_kind(&self) -> Option<&str>
The chosen container engine, as the engine layer names it, or None while the user has
not chosen one.
Sourcepub fn set_engine_kind(&mut self, kind: &str) -> bool
pub fn set_engine_kind(&mut self, kind: &str) -> bool
Records the chosen engine. A word no engine answers to is refused rather than stored.
Sourcepub fn folder_path(&self) -> Option<PathBuf>
pub fn folder_path(&self) -> Option<PathBuf>
Where the store lives, once the wizard has placed it.
Sourcepub fn set_folder_path(&mut self, path: &Path) -> bool
pub fn set_folder_path(&mut self, path: &Path) -> bool
Records where the store lives. A relative path is refused: it would mean something different in every working directory the application is started from.
Sourcepub fn on_close(&self) -> OnClose
pub fn on_close(&self) -> OnClose
What happens to QCode’s containers once no QCode is open, stopping them until the person says otherwise.
Sourcepub fn set_on_close(&mut self, choice: OnClose) -> bool
pub fn set_on_close(&mut self, choice: OnClose) -> bool
Records what happens to the containers once no QCode is open. Answers whether anything changed.
Choosing the default takes the key out of the file rather than writing the default in, so a later change of the default reaches this installation too.
Sourcepub fn backup_every(&self) -> BackupEvery
pub fn backup_every(&self) -> BackupEvery
How often an open workspace is backed up, every fifteen minutes until the person says otherwise.
Sourcepub fn set_backup_every(&mut self, choice: BackupEvery) -> bool
pub fn set_backup_every(&mut self, choice: BackupEvery) -> bool
Records how often an open workspace is backed up. Answers whether anything changed.
Like set_on_close, choosing the default takes the key out of the
file.
Sourcepub fn recent_workspaces(&self) -> Vec<WorkspaceId>
pub fn recent_workspaces(&self) -> Vec<WorkspaceId>
The workspaces that were opened last, newest first.
Sourcepub fn remember_workspace(&mut self, id: &WorkspaceId)
pub fn remember_workspace(&mut self, id: &WorkspaceId)
Moves a workspace to the front of the recent list, dropping the oldest beyond
RECENT_LIMIT.
Sourcepub fn forget_workspace(&mut self, id: &WorkspaceId)
pub fn forget_workspace(&mut self, id: &WorkspaceId)
Takes a workspace out of the recent list, for one that is gone or was deleted.
Sourcepub fn editor(&self) -> Editor
pub fn editor(&self) -> Editor
The editor a text file opens in; nano until the person chooses otherwise.
Sourcepub fn set_editor(&mut self, editor: Editor) -> bool
pub fn set_editor(&mut self, editor: Editor) -> bool
Records the editor a text file opens in. Answers whether anything changed.
Choosing nano again takes the key out rather than writing the default down, so the file of a person who went back to the default is the file of one who never left it.
Sourcepub fn sound(&self) -> Sound
pub fn sound(&self) -> Sound
What opening a sound does; it plays until the person chooses otherwise.
Sourcepub fn set_sound(&mut self, sound: Sound) -> bool
pub fn set_sound(&mut self, sound: Sound) -> bool
Records what opening a sound does. Answers whether anything changed.
Playing is the default and is taken out rather than written down, as with the editor.
Sourcepub fn ask_first(&self) -> bool
pub fn ask_first(&self) -> bool
Whether the person is asked before one tab’s agent sends its first message to another. Off until the person turns it on.
Sourcepub fn set_ask_first(&mut self, ask: bool) -> bool
pub fn set_ask_first(&mut self, ask: bool) -> bool
Records whether the person is asked before the first message between two tabs. Answers whether anything changed.
Not asking is the default and is taken out rather than written down, as with the editor.
Sourcepub fn freeze_idle(&self) -> bool
pub fn freeze_idle(&self) -> bool
Whether a profile whose container is doing nothing is frozen in the background, and its memory written out to swap. On until the person turns it off.
Sourcepub fn set_freeze_idle(&mut self, freeze: bool) -> bool
pub fn set_freeze_idle(&mut self, freeze: bool) -> bool
Records whether a quiet profile’s container is frozen in the background. Answers whether anything changed.
Freezing is the default and is taken out of the file rather than written down, so the file of a person who turned it back on is the file of one who never turned it off.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Config
impl !UnwindSafe for Config
impl Freeze for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more