Skip to main content

WorkspaceScreen

Struct WorkspaceScreen 

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

The workspace screen.

Implementations§

Source§

impl WorkspaceScreen

Source

pub fn new( engine: Option<Engine>, user: HostUser, workspaces: Vec<OpenWorkspace>, ) -> Self

A screen showing workspaces, entering their containers through engine.

Without an engine the screen still opens: the design asks that a missing engine leave the application usable, so every action that would touch a container is drawn faint and says why instead of failing when it is pressed.

Source

pub fn watching(self, live: bool) -> Self

The same screen following the disk when live is true: the folders the open workspace’s tree shows are watched, and what other programs change in them shows at once.

It is off unless asked for because a watch waits for the disk on a background thread, and a test harness runs background work in line, where that wait would never end. Tests of the watch bound each wait instead.

Source

pub fn bridging(self, bridging: bool) -> Self

The same screen, listening for the agents of each open workspace’s tabs when bridging is true, so they can send each other messages.

It is off unless asked for for the same reason as WorkspaceScreen::watching: a listener waits on a background thread, which a test harness would run in line. Tests hand the screen its calls by hand instead.

Source

pub fn with_registry(self, path: Option<PathBuf>) -> Self

The same screen, noting every container it starts in the list at path, which is what lets them be stopped once no QCode is open. None notes nothing.

Source

pub fn with_providers_path(self, path: Option<PathBuf>) -> Self

The same screen, reading providers.toml at path rather than this machine’s own data folder before a provider tab starts, so a test can say what it holds without ever touching a real one.

Source

pub fn with_upstream(self, upstream: Upstream) -> Self

The same screen, asking every provider of every open workspace with upstream rather than over the network, which is what lets a test say what a provider answers without one.

It is set before a workspace opens its relay, since that is the moment the relay is opened with it; afterwards the listeners already running keep the upstream they were given.

Source

pub fn backing_up(self, every: BackupEvery) -> Self

The same screen, backing its workspaces up as often as every says.

Source

pub fn backup_every(&self) -> BackupEvery

How often the open workspaces are backed up.

Source

pub fn workspace(&self) -> Option<&OpenWorkspace>

The workspace the rail has open.

Source

pub fn workspaces(&self) -> &[OpenWorkspace]

Every workspace of the rail, in its order.

Source

pub fn set_editor(&mut self, editor: Editor)

Makes editor the one a file opens in from now on. Tabs already open keep the editor they started with until they are opened again.

Source

pub fn editor(&self) -> Editor

The editor a file opens in.

Source

pub fn set_sound(&mut self, sound: Sound)

Makes sound what opening a sound does from now on. A sound tab already open keeps what it does until it is started again.

Source

pub fn sound(&self) -> Sound

What opening a sound does.

Source

pub fn set_ask_first(&mut self, ask: bool)

Makes the first message from one tab to another ask the person when ask is true, and go without asking otherwise. What the person already answered about a pair still holds.

Source

pub fn ask_first(&self) -> bool

Whether the first message from one tab to another asks the person.

Source

pub fn set_freeze_idle(&mut self, freeze: bool)

Makes a profile whose container is doing nothing be frozen in the background, and its memory written out to swap, when freeze is true; nothing of the kind when it is false.

Source

pub fn freezes_idle(&self) -> bool

Whether a quiet profile’s container is frozen in the background.

Source

pub fn settled(&mut self) -> Command<Msg>

Asks on the screen’s own account whether this machine can freeze a container at all, which is asked once, on a background thread, the first time the screen is opened, and then keeps the answer. Without an engine there is nothing to ask and the answer stays unknown, which runs no timer at all.

Source

pub fn hearing_in(self, runtime: Option<PathBuf>) -> Self

The same screen, looking for the sound server’s socket in runtime rather than in the runtime folder this process was given.

Source

pub fn showing_on(self, display: Result<Display, NoDisplay>) -> Self

The same screen, opening windows on display rather than on the session this process was started in.

The application never calls this: the screen reads the session itself. It exists so that what a window’s tab does can be checked on a machine with no compositor, and what it says when there is none on a machine that has one.

Source

pub fn set_active(&mut self, index: usize)

Opens the workspace at index of the rail, when there is one there.

Source

pub fn restore_tabs(&mut self, index: usize, record: &SessionWorkspace)

Gives the workspace at index the tabs record lists, each waiting to be shown before it starts, with the tab the record had open open again.

A profile tab whose profile is gone from the store is left out: there is no container it could enter, and a tab that can only ever fail is not worth bringing back. A blank tab comes back blank; it never had a container. A tab of one of the workspace’s files comes back whether or not the file is still there, and says so when it is shown; one whose path climbs out of the workspace is left out, because nothing QCode wrote would name one.

A tab keeps the id and the name it had. One whose id the record does not give, or gives to an earlier tab as well, is given a new one after every id the record gives.

Source

pub fn session(&self) -> Session

What is open, in the shape the session file keeps it: the workspaces in rail order, the one that is open, and the tabs of each.

Source

pub fn engine(&self) -> Option<&Engine>

The engine the screen enters containers through.

Source

pub fn panel(&self) -> &Panel

The widget panel’s state.

Source

pub fn launch_command(&self, key: TabKey) -> Option<EngineCommand>

The command the tab key spawns, which is always the engine entering a container.

This is the one place a tab’s program is decided, so a test can read it back and see for itself that no tab runs anything on the machine QCode runs on.

Source

pub fn read_command(&self, key: TabKey) -> Option<EngineCommand>

The command that takes the text out of the file the tab key shows, which is always the engine running a program in the workspace’s own container, without a terminal; None for a tab that shows no such text.

Source§

impl WorkspaceScreen

Source

pub fn attach(&mut self, key: TabKey, session: TerminalSession)

Attaches session to the tab key and marks the tab running, which is what the screen does itself once a tab’s container is up. A program started some other way, such as the shell of a demonstration, is shown in the tab the same way.

Source

pub fn reading(&self, profile: &str) -> u64

The number of the reading of profile’s conversations last started in the open workspace. An answer, Msg::HistoryRead, is only taken when it carries this number.

Source

pub fn backups_reading(&self) -> u64

The number of the reading of the list of backups last started. An answer, Msg::BackupsRead, is only taken when it carries this number.

Trait Implementations§

Source§

impl Debug for WorkspaceScreen

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> 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, 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.