pub struct AppModel {Show 19 fields
core: Core,
context_page: ContextPage,
nav: Model,
key_binds: HashMap<KeyBind, MenuAction>,
config: Config,
status: String,
device_path: Option<Arc<OwnedObjectPath>>,
device_proxy: Option<DeviceProxy<'static>>,
connection: Option<Connection>,
busy: bool,
enrolling_finger: Option<Arc<String>>,
verifying_finger: bool,
enroll_progress: u32,
enroll_total_stages: Option<u32>,
users: Vec<UserOption>,
selected_user: Option<UserOption>,
selected_finger: Finger,
enrolled_fingers: Vec<String>,
confirm_clear: bool,
}Expand description
Application model stores app-specific state
Describes interface and drives its logic
Fields§
§core: CoreApplication state which is managed by the COSMIC runtime.
context_page: ContextPageDisplay a context drawer with the designated page if defined.
Contains items assigned to the nav bar panel.
key_binds: HashMap<KeyBind, MenuAction>Key bindings for the application’s menu bar.
config: Config§status: String§device_path: Option<Arc<OwnedObjectPath>>§device_proxy: Option<DeviceProxy<'static>>§connection: Option<Connection>§busy: bool§enrolling_finger: Option<Arc<String>>§verifying_finger: bool§enroll_progress: u32§enroll_total_stages: Option<u32>§users: Vec<UserOption>§selected_user: Option<UserOption>§selected_finger: Finger§enrolled_fingers: Vec<String>§confirm_clear: boolImplementations§
Source§impl AppModel
impl AppModel
Sourcepub(crate) fn on_cancel_clear(&mut self) -> Task<Action<Message>>
pub(crate) fn on_cancel_clear(&mut self) -> Task<Action<Message>>
Resets clear state
Returns Task()
Sourcepub(crate) fn on_clear_completion(
&mut self,
res: Result<(), AppError>,
) -> Task<Action<Message>>
pub(crate) fn on_clear_completion( &mut self, res: Result<(), AppError>, ) -> Task<Action<Message>>
After succesfully removal of all prints set status, empties enrolled_fingers
In case of an Error localizes the message and sets status
Returns Task()
Sourcepub(crate) fn on_clicked_link(&mut self) -> Task<Action<Message>>
pub(crate) fn on_clicked_link(&mut self) -> Task<Action<Message>>
Opens in a browser clicked hyperlink
Returns Task()
Sourcepub(crate) fn on_connection_ready(
&mut self,
conn: Connection,
) -> Task<Action<Message>>
pub(crate) fn on_connection_ready( &mut self, conn: Connection, ) -> Task<Action<Message>>
After DBus connection is established searches queries it for fprintd default device
Returns task_find_device(Connection)
Sourcepub(crate) fn on_context_page_toggle(
&mut self,
context_page: ContextPage,
) -> Task<Action<Message>>
pub(crate) fn on_context_page_toggle( &mut self, context_page: ContextPage, ) -> Task<Action<Message>>
Toggles the context page
Returns Task()
Sourcepub(crate) fn on_error(&mut self, err: AppError) -> Task<Action<Message>>
pub(crate) fn on_error(&mut self, err: AppError) -> Task<Action<Message>>
Localizes the error and stores it on status resetting everything
Returns Task()
Sourcepub(crate) fn on_fingers_listed(
&mut self,
fingers: Vec<String>,
) -> Task<Action<Message>>
pub(crate) fn on_fingers_listed( &mut self, fingers: Vec<String>, ) -> Task<Action<Message>>
Stores the results of list_fingers_task
Returns Task()
Sourcepub(crate) fn on_finger_selected(
&mut self,
finger: String,
) -> Task<Action<Message>>
pub(crate) fn on_finger_selected( &mut self, finger: String, ) -> Task<Action<Message>>
If device is not busy compares localized string to fingers and set matching to be the selected one
Returns Task()
Sourcepub(crate) fn on_device_found(
&mut self,
device_info: Option<(OwnedObjectPath, DeviceProxy<'static>)>,
) -> Task<Action<Message>>
pub(crate) fn on_device_found( &mut self, device_info: Option<(OwnedObjectPath, DeviceProxy<'static>)>, ) -> Task<Action<Message>>
Requests users enrolled prints
Returns either Task() or list_fingers_task()
Sourcepub(crate) fn on_verify_finger(&mut self) -> Task<Action<Message>>
pub(crate) fn on_verify_finger(&mut self) -> Task<Action<Message>>
Called to request verification of the selected print
Returns Task()
Sourcepub(crate) fn on_verify_status(
&mut self,
status: String,
done: bool,
) -> Task<Action<Message>>
pub(crate) fn on_verify_status( &mut self, status: String, done: bool, ) -> Task<Action<Message>>
Handles verification status updates
Returns Task()
Sourcepub(crate) fn on_enroll_start(
&mut self,
total: Option<u32>,
) -> Task<Action<Message>>
pub(crate) fn on_enroll_start( &mut self, total: Option<u32>, ) -> Task<Action<Message>>
Starts the enroll process, set status and enroll options
Returns Task()
Sourcepub(crate) fn on_enroll_status(
&mut self,
status: String,
done: bool,
) -> Task<Action<Message>>
pub(crate) fn on_enroll_status( &mut self, status: String, done: bool, ) -> Task<Action<Message>>
Takes responses from Fprintd API and converts them to localized strings
Set status and ends process when it is done
Returns Task()
Sourcepub(crate) fn on_enroll_stop(&self) -> Task<Action<Message>>
pub(crate) fn on_enroll_stop(&self) -> Task<Action<Message>>
Sends stop signal to end an ongoing enroll process
Returns either Task() or task_enroll_stop()
Sourcepub(crate) fn on_clear_device(&mut self) -> Task<Action<Message>>
pub(crate) fn on_clear_device(&mut self) -> Task<Action<Message>>
Clears all prints for all users
Returns either Task() or task_clear_device()
Sourcepub(crate) fn on_delete(&mut self) -> Task<Action<Message>>
pub(crate) fn on_delete(&mut self) -> Task<Action<Message>>
Deletes chosen print or users all prints depending on choices from the user
Returns either Task(), task_delete_print() or task_delete_prints()
Sourcepub(crate) fn on_delete_complete(
&mut self,
clear: bool,
) -> Task<Action<Message>>
pub(crate) fn on_delete_complete( &mut self, clear: bool, ) -> Task<Action<Message>>
Set state when deletion of prints was succesful and removes from enrolled_fingers
Returns Task()
Sourcepub(crate) fn on_open_link(&mut self, url: String) -> Task<Action<Message>>
pub(crate) fn on_open_link(&mut self, url: String) -> Task<Action<Message>>
Opens given Uniform Resourse Locator
Returns Task()
Sourcepub(crate) fn on_register(&mut self) -> Task<Action<Message>>
pub(crate) fn on_register(&mut self) -> Task<Action<Message>>
Sets state as busy and sets which finger is being registered for subscription
Returns Task()
Source§impl AppModel
impl AppModel
Sourcepub(crate) fn view_main(&self) -> Element<'_, Message>
pub(crate) fn view_main(&self) -> Element<'_, Message>
Used to construct the main view of application
Returns column with one or two rows of button widgets
Constructs custom_image_buttons for the main UI based on given height & Finger
Returns an instance of custom_image_button widget
Sourcepub(crate) fn view_old(&self) -> Element<'_, Message>
pub(crate) fn view_old(&self) -> Element<'_, Message>
The first UI version which can still be enabled from Settings
Sourcepub(crate) fn view_header(&self) -> Element<'_, Message>
pub(crate) fn view_header(&self) -> Element<'_, Message>
Title for the traditional UI
Sourcepub(crate) fn view_finger_picker(&self) -> Option<Element<'_, Message>>
pub(crate) fn view_finger_picker(&self) -> Option<Element<'_, Message>>
Generates a dropdown menu from which to choose which finger is registered
Returns pick_list widget with all Fingers localized names
Sourcepub(crate) fn view_icon(&self) -> Element<'_, Message>
pub(crate) fn view_icon(&self) -> Element<'_, Message>
Icon for traditional UI
Returns svg widget from FPRINT_ICON
Sourcepub(crate) fn view_status(&self) -> Element<'_, Message>
pub(crate) fn view_status(&self) -> Element<'_, Message>
Used to render the current AppModel status in main view
Returns text widget in a container
Sourcepub(crate) fn view_progress(&self) -> Option<Element<'_, Message>>
pub(crate) fn view_progress(&self) -> Option<Element<'_, Message>>
Generates a bar reflecting how many succesful attempts away enrolling print is
Returns progress_bar widget from 0 to num_enroll_steps
Sourcepub(crate) fn view_controls(&self) -> Element<'_, Message>
pub(crate) fn view_controls(&self) -> Element<'_, Message>
State dependent generation for main controls of the application:
Register, Delete, Verify & Cancel
Returns row widget containing text button widget
Trait Implementations§
Source§impl Application for AppModel
Turns AppModel to a COSMIC application
impl Application for AppModel
Turns AppModel to a COSMIC application
Source§const APP_ID: &'static str = "org.cosmic_utils.Enroll"
const APP_ID: &'static str = "org.cosmic_utils.Enroll"
Unique identifier in RDNN (reverse domain name notation) format.
Source§type Executor = Executor
type Executor = Executor
The async executor that will be used to run your application’s commands.
Source§fn init(core: Core, _flags: Self::Flags) -> (Self, Task<Action<Self::Message>>)
fn init(core: Core, _flags: Self::Flags) -> (Self, Task<Action<Self::Message>>)
Initializes the application with any given flags and startup commands.
Source§fn header_start(&self) -> Vec<Element<'_, Self::Message>> ⓘ
fn header_start(&self) -> Vec<Element<'_, Self::Message>> ⓘ
Elements to pack at the start of the header bar.
Enables the COSMIC application to create a nav bar with this model.
Source§fn context_drawer(&self) -> Option<ContextDrawer<'_, Self::Message>>
fn context_drawer(&self) -> Option<ContextDrawer<'_, Self::Message>>
Display a context drawer if the context page is requested.
Source§fn dialog(&self) -> Option<Element<'_, Self::Message>>
fn dialog(&self) -> Option<Element<'_, Self::Message>>
Display a dialog in the center of the application window when Some.
Source§fn subscription(&self) -> Subscription<Self::Message>
fn subscription(&self) -> Subscription<Self::Message>
Register subscriptions for this application.
Subscriptions are long-running async tasks running in the background which emit messages to the application through a channel. They are started at the beginning of the application, and persist through its lifetime.
Source§fn update(&mut self, message: Self::Message) -> Task<Action<Self::Message>>
fn update(&mut self, message: Self::Message) -> Task<Action<Self::Message>>
Handles messages emitted by the application and its widgets.
Tasks may be returned for asynchronous execution of code in the background on the application’s async runtime.
Called when a nav item is selected.
Some.Source§fn header_center(
&self,
) -> Vec<Element<'_, Self::Message, Theme, Renderer<Renderer, Renderer>>>
fn header_center( &self, ) -> Vec<Element<'_, Self::Message, Theme, Renderer<Renderer, Renderer>>>
Source§fn header_end(
&self,
) -> Vec<Element<'_, Self::Message, Theme, Renderer<Renderer, Renderer>>>
fn header_end( &self, ) -> Vec<Element<'_, Self::Message, Theme, Renderer<Renderer, Renderer>>>
Source§fn on_app_exit(&mut self) -> Option<Self::Message>
fn on_app_exit(&mut self) -> Option<Self::Message>
Source§fn on_close_requested(&self, id: Id) -> Option<Self::Message>
fn on_close_requested(&self, id: Id) -> Option<Self::Message>
fn on_context_drawer(&mut self) -> Task<Action<Self::Message>>
Source§fn on_search(&mut self) -> Task<Action<Self::Message>>
fn on_search(&mut self) -> Task<Action<Self::Message>>
Source§fn on_window_resize(&mut self, id: Id, width: f32, height: f32)
fn on_window_resize(&mut self, id: Id, width: f32, height: f32)
Source§fn system_theme_update(
&mut self,
keys: &[&'static str],
new_theme: &Theme,
) -> Task<Action<Self::Message>>
fn system_theme_update( &mut self, keys: &[&'static str], new_theme: &Theme, ) -> Task<Action<Self::Message>>
Source§fn system_theme_mode_update(
&mut self,
keys: &[&'static str],
new_theme: &ThemeMode,
) -> Task<Action<Self::Message>>
fn system_theme_mode_update( &mut self, keys: &[&'static str], new_theme: &ThemeMode, ) -> Task<Action<Self::Message>>
Source§fn view_window(
&self,
id: Id,
) -> Element<'_, Self::Message, Theme, Renderer<Renderer, Renderer>>
fn view_window( &self, id: Id, ) -> Element<'_, Self::Message, Theme, Renderer<Renderer, Renderer>>
Source§fn dbus_activation(&mut self, msg: Message) -> Task<Action<Self::Message>>
fn dbus_activation(&mut self, msg: Message) -> Task<Action<Self::Message>>
Source§fn dbus_connection(&mut self, conn: Connection) -> Task<Action<Self::Message>>
fn dbus_connection(&mut self, conn: Connection) -> Task<Action<Self::Message>>
Auto Trait Implementations§
impl Freeze for AppModel
impl !RefUnwindSafe for AppModel
impl !Send for AppModel
impl !Sync for AppModel
impl Unpin for AppModel
impl !UnwindSafe for AppModel
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<App> ApplicationExt for Appwhere
App: Application,
impl<App> ApplicationExt for Appwhere
App: Application,
Source§fn view_main(
&self,
) -> Element<'_, Action<<App as Application>::Message>, Theme, Renderer<Renderer, Renderer>>
fn view_main( &self, ) -> Element<'_, Action<<App as Application>::Message>, Theme, Renderer<Renderer, Renderer>>
Creates the view for the main window.
Source§fn set_window_title(
&mut self,
title: String,
id: Id,
) -> Task<Action<<App as Application>::Message>>
fn set_window_title( &mut self, title: String, id: Id, ) -> Task<Action<<App as Application>::Message>>
Source§fn set_show_context(&mut self, show: bool)
fn set_show_context(&mut self, show: bool)
Source§fn set_header_title(&mut self, title: String)
fn set_header_title(&mut self, title: String)
fn watch_config<T>(&self, id: &'static str) -> Subscription<Update<T>>
fn watch_state<T>(&self, id: &'static str) -> Subscription<Update<T>>
Source§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
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> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more