Skip to main content

DriveApp

Struct DriveApp 

Source
pub struct DriveApp {
Show 22 fields auth: GdriveAuth, remote: Vec<DriveFile>, local: Vec<String>, remote_sel: usize, local_sel: usize, pane: Pane, scroll: usize, folder_path: Vec<(String, String)>, device_user_code: String, device_url: String, device_code: String, awaiting_auth: bool, viewer_open: bool, viewer_title: String, viewer_text: String, viewer_scroll: usize, status: String, last_win_w: u32, setup_mode: bool, setup_focus: SetupField, setup_id_box: TextBox, setup_secret_box: TextBox,
}

Fields§

§auth: GdriveAuth§remote: Vec<DriveFile>§local: Vec<String>§remote_sel: usize§local_sel: usize§pane: Pane§scroll: usize§folder_path: Vec<(String, String)>§device_user_code: String§device_url: String§device_code: String§awaiting_auth: bool§viewer_open: bool§viewer_title: String§viewer_text: String§viewer_scroll: usize§status: String§last_win_w: u32§setup_mode: bool§setup_focus: SetupField§setup_id_box: TextBox§setup_secret_box: TextBox

Implementations§

Source§

impl DriveApp

Source

pub fn new() -> Self

Source

fn reload_local(&mut self)

Source

fn try_refresh(&mut self) -> bool

access_token が空、または期限切れ時に refresh_token で更新を試みる。成功で true。

Source

fn action_login(&mut self)

Source

fn action_poll(&mut self)

Source

fn current_folder_id(&self) -> Option<&str>

現在のフォルダ(folder_path の末尾。空ならルート)の直下一覧を取得する。

Source

fn action_refresh_remote(&mut self)

Source

fn action_enter_folder(&mut self, id: String, name: String)

フォルダに入る(folder_path に積んで再読み込み)。

Source

fn action_leave_folder(&mut self)

1階層上に戻る(folder_path から1つ pop して再読み込み)。ルートなら何もしない。

Source

fn action_open_remote(&mut self)

Source

fn action_download_remote(&mut self)

選択中の remote ファイルの生バイトをそのままローカル FS に保存する (画像/zip など、テキストビューアでは壊れるファイル向け)。

Source

fn action_upload_local(&mut self)

Source

fn action_delete_remote(&mut self)

Source

fn action_logout(&mut self)

Source

fn action_enter_setup(&mut self)

client_id/secret 設定モードに入る。現在の値を入力欄の初期値にする (gdrive_auth.json を手動編集しなくても、アプリ内でこの入力から書き込める)。

Source

fn action_save_setup(&mut self)

入力欄の内容を client_id/secret として保存する。

Source§

impl DriveApp

Source

fn move_sel(&mut self, delta: i32)

Source

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

Source

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

Trait Implementations§

Source§

impl App for DriveApp

Source§

fn name(&self) -> &str

Source§

fn instance_info(&self) -> String

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

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

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

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

キーボードイベント
Source§

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

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

fn is_proxy(&self) -> bool

ProxyApp であるかどうか
Source§

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

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

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

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

fn active_tab(&self) -> usize

Source§

fn switch_tab(&mut self, _idx: usize)

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 DriveApp

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.