Skip to main content

SettingsApp

Struct SettingsApp 

Source
pub struct SettingsApp {
Show 26 fields selected_layout: KeyboardLayout, selected_theme: String, selected_fonts: [String; 3], selected_sound: bool, repeat_first_delay: u32, repeat_first_interval: u32, repeat_second_count: u32, repeat_second_delay: u32, repeat_second_interval: u32, selected_caps_ctrl: bool, last_win_w: u32, last_win_h: u32, active_tab_idx: usize, selected_auto_dhcp: bool, focused_item_idx: Option<usize>, ssid_box: TextBox, password_box: TextBox, wifi_focused: u8, wifi_status_msg: String, wifi_connecting: bool, status_msg: String, status_is_error: bool, custom_theme: ThemeConfig, custom_edit_idx: usize, enable_custom_colors: bool, available_themes: Vec<String>,
}

Fields§

§selected_layout: KeyboardLayout§selected_theme: String§selected_fonts: [String; 3]

フォントのフォールバック順([0]=プライマリ)。設定アプリで3段セレクトする。

§selected_sound: bool§repeat_first_delay: u32§repeat_first_interval: u32§repeat_second_count: u32§repeat_second_delay: u32§repeat_second_interval: u32§selected_caps_ctrl: bool§last_win_w: u32§last_win_h: u32§active_tab_idx: usize§selected_auto_dhcp: bool§focused_item_idx: Option<usize>§ssid_box: TextBox§password_box: TextBox§wifi_focused: u8§wifi_status_msg: String§wifi_connecting: bool§status_msg: String

保存・適用の結果表示。失敗を黙って捨てず、必ずユーザーへ見せる。

§status_is_error: bool

status_msg が失敗の通知かどうか(表示色の切り替え用)。

§custom_theme: ThemeConfig§custom_edit_idx: usize§enable_custom_colors: bool§available_themes: Vec<String>

Implementations§

Source§

impl SettingsApp

Source

pub fn new() -> Self

Source

fn get_item_count(&self) -> usize

Source

fn draw_focus_rect( &self, screen: &Screen, x: u32, y: u32, w: u32, h: u32, is_focused: bool, focus_color: Color, )

Source

fn draw_text_field( &self, screen: &Screen, x: u32, y: u32, w: u32, tb: &TextBox, focused: bool, placeholder: &str, mask: bool, )

Source

fn apply_and_save(&mut self)

設定を適用・保存する。

失敗を握り潰さない: 以前は保存結果を捨てて常に完了音を鳴らし 「Config applied and saved!」と表示していたため、書き込めていなくても ユーザーには成功に見えていた。成功したときだけ成功を名乗る。

Source

fn try_apply_and_save(&self) -> Result<(), &'static str>

Source

fn get_color_rgb(c: u32) -> (u8, u8, u8)

Source

fn make_color_u32(r: u8, g: u8, b: u8) -> u32

Source

fn get_custom_color_by_idx(&self, idx: usize) -> u32

Source

fn set_custom_color_by_idx(&mut self, idx: usize, color: u32)

Source

fn adjust_channel(val: u8, dir: i32) -> u8

Source

fn get_custom_color_name(idx: usize) -> &'static str

Source

fn get_theme_preview_colors(name: &str) -> (u32, u32, u32)

Source

fn start_wifi_connect(&mut self)

Source

fn cycle_font(&mut self, slot: usize, dir: i32)

Source

fn apply_theme_colorset(&mut self, theme_name: &str) -> Result<(), &'static str>

指定テーマのカラーセット /os/<name>.json/os/colorset.json へ複製し、 設定を再読み込みする。読み出し・書き込み・再読み込みのどの失敗も 呼び出し側へ返す(従来は 3 段すべて let _ = で捨てていたため、 テーマを選んでも色が変わらない理由が分からなかった)。

Source

fn select_theme(&mut self, theme_name: &str)

テーマ選択(キーボード操作・マウス操作の共通処理)。

Source

fn toggle_custom_colors(&mut self)

カスタムカラーの有効・無効を切り替える(キーボード・マウス共通処理)。

Source

fn handle_action(&mut self, idx: usize)

Trait Implementations§

Source§

impl App for SettingsApp

Source§

fn name(&self) -> &str

Source§

fn tabs(&self) -> Vec<String>

タブタイトル一覧。空を返すとタブなし扱い(非推奨: 全アプリは最低1タブ持つ)
Source§

fn active_tab(&self) -> usize

Source§

fn switch_tab(&mut self, idx: usize)

Source§

fn draw( &mut self, screen: &Screen, win_x: u32, win_y: u32, win_w: u32, win_h: u32, )

ウィンドウ内の描画要求
Source§

fn on_mouse( &mut self, local_x: i32, local_y: i32, btn_left: bool, _btn_right: bool, _wheel: i32, )

マウスイベント。ローカル座標とホイール移動量が渡される。
Source§

fn on_key(&mut self, keycode: u8, pressed: bool, ascii: Option<char>)

キーボードイベント
Source§

fn is_proxy(&self) -> bool

ProxyApp であるかどうか
Source§

fn get_shared_buffer(&self) -> Option<Arc<Mutex<Vec<u32>>>>

共有されるバックバッファを返す
Source§

fn instance_info(&self) -> String

インスタンス特有の情報(ファイル名やURLなど)を返す
Source§

fn add_tab(&mut self)

Source§

fn close_tab(&mut self, _idx: usize) -> bool

タブを閉じる。最後のタブが閉じられウィンドウも閉じる場合は true を返す。
Source§

fn open_file_dialog(&mut self)

Alt+O: ファイルオープンダイアログを開く(未実装アプリはno-op)
Source§

fn save_file(&mut self)

Alt+S: ファイルを保存する(未実装アプリはno-op)
Source§

fn tab_thread_fn(&self) -> Option<fn()>

このアプリの各タブ用バックグラウンドスレッド関数を返す。 Some(fn) を返したアプリはタブ追加時にスケジューラでスレッドを起動する。 スレッド関数は引数なしの fn() で、グローバル Mutex 経由でアプリ状態と通信する。
Source§

fn get_dom_value(&self, _id: &str) -> Option<String>

Source§

fn set_dom_value(&mut self, _id: &str, _val: &str)

Source§

fn needs_timer_redraw(&self) -> bool

Source§

fn get_buffer_updated_flag(&self) -> Option<Arc<AtomicBool>>

ProxyApp の shared_buffer が更新されたことを通知する AtomicBool を返す。 ProxyApp でない通常のアプリは None を返す(デフォルト実装)。 Core 0 の dirty 判定がこのフラグを読んで矩形を登録する。
Source§

fn get_dom_content(&self, _id: &str) -> Option<String>

Source§

fn set_dom_content(&mut self, _id: &str, _val: &str)

Source§

fn on_resize(&mut self, _width: u32, _height: u32)

ウィンドウサイズ変更の通知
Source§

impl Default for SettingsApp

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.