Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }
Expand description

QCode’s settings file.

Implementations§

Source§

impl Config

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn parse_str(file: &str, text: &str) -> Self

Reads the settings from TOML text, reporting problems against file. Saving does nothing.

Source

pub fn diagnostics(&self) -> &[Diagnostic]

Every problem found while reading the file, including every repair that was made.

Source

pub fn is_clean(&self) -> bool

Whether the file was read without a single problem.

Source

pub fn to_toml(&self) -> String

The settings as TOML text, which is what saving writes.

Source

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.

Source

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.

Source

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.

Source

pub fn set_theme(&mut self, id: &str) -> bool

Records the theme the application wears. Answers whether anything changed.

Source

pub fn set_icons(&mut self, mode: IconMode) -> bool

Records which glyphs the application draws with. Answers whether anything changed.

Source

pub fn set_reduced_motion(&mut self, reduced: bool) -> bool

Records whether the application moves as little as it can. Answers whether anything changed.

Source

pub fn setup_completed(&self) -> bool

Whether the setup wizard has finished. Until it has, the wizard runs.

Source

pub fn set_setup_completed(&mut self, completed: bool) -> bool

Records whether the setup wizard has finished. Answers whether anything changed.

Source

pub fn setup_step(&self) -> SetupStep

The step the wizard stopped at, the first one until it says otherwise.

Source

pub fn set_setup_step(&mut self, step: SetupStep) -> bool

Records the step the wizard is on. Answers whether anything changed.

Source

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.

Source

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.

Source

pub fn folder_path(&self) -> Option<PathBuf>

Where the store lives, once the wizard has placed it.

Source

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.

Source

pub fn on_close(&self) -> OnClose

What happens to QCode’s containers once no QCode is open, stopping them until the person says otherwise.

Source

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.

Source

pub fn backup_every(&self) -> BackupEvery

How often an open workspace is backed up, every fifteen minutes until the person says otherwise.

Source

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.

Source

pub fn recent_workspaces(&self) -> Vec<WorkspaceId>

The workspaces that were opened last, newest first.

Source

pub fn remember_workspace(&mut self, id: &WorkspaceId)

Moves a workspace to the front of the recent list, dropping the oldest beyond RECENT_LIMIT.

Source

pub fn forget_workspace(&mut self, id: &WorkspaceId)

Takes a workspace out of the recent list, for one that is gone or was deleted.

Source

pub fn editor(&self) -> Editor

The editor a text file opens in; nano until the person chooses otherwise.

Source

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.

Source

pub fn sound(&self) -> Sound

What opening a sound does; it plays until the person chooses otherwise.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.