From 167b222f604842a610e61230bcadd7c45a9a0b68 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Thu, 20 Jun 2024 22:52:12 +0300 Subject: [PATCH] ui: remove unused eframe argument --- Cargo.lock | 312 ++++----------------- Cargo.toml | 19 +- src/gui/app.rs | 23 +- src/gui/mod.rs | 2 +- src/gui/views/network/connections.rs | 5 +- src/gui/views/network/content.rs | 20 +- src/gui/views/network/metrics.rs | 2 +- src/gui/views/network/mining.rs | 4 +- src/gui/views/network/node.rs | 2 +- src/gui/views/network/settings.rs | 15 +- src/gui/views/network/setup/dandelion.rs | 5 +- src/gui/views/network/setup/node.rs | 5 +- src/gui/views/network/setup/p2p.rs | 5 +- src/gui/views/network/setup/pool.rs | 5 +- src/gui/views/network/setup/stratum.rs | 5 +- src/gui/views/network/types.rs | 2 +- src/gui/views/root.rs | 9 +- src/gui/views/title_panel.rs | 11 +- src/gui/views/types.rs | 4 +- src/gui/views/wallets/content.rs | 18 +- src/gui/views/wallets/creation/creation.rs | 14 +- src/gui/views/wallets/creation/mnemonic.rs | 12 +- src/gui/views/wallets/setup/common.rs | 6 +- src/gui/views/wallets/setup/connection.rs | 35 +-- src/gui/views/wallets/setup/recovery.rs | 6 +- src/gui/views/wallets/wallet/content.rs | 3 +- src/gui/views/wallets/wallet/messages.rs | 6 +- src/gui/views/wallets/wallet/settings.rs | 7 +- src/gui/views/wallets/wallet/transport.rs | 1 - src/gui/views/wallets/wallet/txs.rs | 6 +- src/gui/views/wallets/wallet/types.rs | 1 - src/lib.rs | 14 +- src/main.rs | 15 +- 33 files changed, 173 insertions(+), 426 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eac38b9..36585ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1394,9 +1394,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.16.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" dependencies = [ "bytemuck_derive", ] @@ -2080,16 +2080,15 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if 1.0.0", "cpufeatures", "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", - "platforms", "rustc_version", "subtle", "zeroize", @@ -2629,7 +2628,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.3", "ed25519 2.2.3", "merlin", "rand_core 0.6.4", @@ -3838,7 +3837,7 @@ dependencies = [ "arti-hyper", "built", "chrono", - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.3", "dark-light", "dirs 5.0.1", "ed25519-dalek 2.1.1", @@ -4598,9 +4597,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0e7a4dd27b9476dc40cb050d3632d3bba3a70ddbff012285f7f8559a1e7e545" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -4862,124 +4861,6 @@ dependencies = [ "objc2 0.4.1", ] -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2 1.0.85", - "quote 1.0.36", - "syn 2.0.66", -] - [[package]] name = "id-arena" version = "2.2.1" @@ -4994,14 +4875,12 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "1.0.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "icu_normalizer", - "icu_properties", - "smallvec", - "utf8_iter", + "unicode-bidi", + "unicode-normalization", ] [[package]] @@ -5499,12 +5378,6 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "litemap" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" - [[package]] name = "litrs" version = "0.4.1" @@ -5807,9 +5680,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", "simd-adler32", @@ -6981,12 +6854,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "platforms" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" - [[package]] name = "png" version = "0.17.13" @@ -8796,12 +8663,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "static_assertions" version = "1.1.0" @@ -8952,17 +8813,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2 1.0.85", - "quote 1.0.36", - "syn 2.0.66", -] - [[package]] name = "sys-locale" version = "0.3.1" @@ -9216,9 +9066,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ "displaydoc", - "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tls-api" version = "0.9.0" @@ -10101,7 +9965,7 @@ dependencies = [ "aes", "base64ct", "ctr", - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.3", "derive_more", "digest 0.10.7", "ed25519-dalek 2.1.1", @@ -10602,12 +10466,27 @@ dependencies = [ "version_check", ] +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.11.0" @@ -10684,9 +10563,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -10744,18 +10623,6 @@ dependencies = [ "tiny-skia-path", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" @@ -11721,18 +11588,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" - [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -11812,7 +11667,7 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" dependencies = [ - "curve25519-dalek 4.1.2", + "curve25519-dalek 4.1.3", "rand_core 0.6.4", "serde", "zeroize", @@ -11900,30 +11755,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "yoke" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" -dependencies = [ - "proc-macro2 1.0.85", - "quote 1.0.36", - "syn 2.0.66", - "synstructure", -] - [[package]] name = "zbus" version = "3.15.2" @@ -12072,27 +11903,6 @@ dependencies = [ "syn 2.0.66", ] -[[package]] -name = "zerofrom" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" -dependencies = [ - "proc-macro2 1.0.85", - "quote 1.0.36", - "syn 2.0.66", - "synstructure", -] - [[package]] name = "zeroize" version = "1.8.1" @@ -12113,28 +11923,6 @@ dependencies = [ "syn 2.0.66", ] -[[package]] -name = "zerovec" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" -dependencies = [ - "proc-macro2 1.0.85", - "quote 1.0.36", - "syn 2.0.66", -] - [[package]] name = "zip" version = "0.5.13" @@ -12166,9 +11954,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.10+zstd.1.5.6" +version = "2.0.11+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 3d74509..ac6a081 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -85,11 +85,6 @@ tls-api-native-tls = "0.9.0" ## stratum server tokio-util = { version = "0.7.8", features = ["codec"] } -### patch grin store -#grin_store = "5.3.1" -#[patch.crates-io] -#grin_store = { path = "../grin-store" } - [build-dependencies] built = "0.7.0" @@ -103,10 +98,6 @@ nokhwa = { version = "0.10.4", default-features = false, features = ["input-msmf tls-api-openssl = "0.9.0" openpnp_capture_sys = "0.4.0" -[patch.crates-io] -### fix cross-compilation support for macos -openpnp_capture_sys = { git = "https://github.com/ardocrat/openpnp-capture-rs", branch = "cross_compilation_support" } - [target.'cfg(not(target_os = "android"))'.dependencies] env_logger = "0.11.3" winit = { version = "0.29.15" } @@ -121,4 +112,12 @@ jni = "0.21.1" android-activity = { version = "0.6.0", features = ["game-activity"] } wgpu = "0.19.1" winit = { version = "0.29.15", features = ["android-game-activity"] } -eframe = { version = "0.27.2", features = ["wgpu", "android-game-activity"] } \ No newline at end of file +eframe = { version = "0.27.2", features = ["wgpu", "android-game-activity"] } + +### patch grin store +#grin_store = "5.3.1" +#[patch.crates-io] +#grin_store = { path = "../grin-store" } +[patch.crates-io] +### fix cross-compilation support for macos +openpnp_capture_sys = { git = "https://github.com/ardocrat/openpnp-capture-rs", branch = "cross_compilation_support" } \ No newline at end of file diff --git a/src/gui/app.rs b/src/gui/app.rs index 3e59f64..6c85f8d 100644 --- a/src/gui/app.rs +++ b/src/gui/app.rs @@ -27,31 +27,29 @@ lazy_static! { } /// Implements ui entry point and contains platform-specific callbacks. -pub struct PlatformApp { +pub struct App { /// Platform specific callbacks handler. pub(crate) platform: Platform, /// Main ui content. root: Root } -impl PlatformApp { +impl App { pub fn new(platform: Platform) -> Self { Self { platform, root: Root::default() } } -} -impl eframe::App for PlatformApp { - fn update(&mut self, ctx: &Context, frame: &mut eframe::Frame) { + /// Draw application content. + pub fn ui(&mut self, ctx: &Context) { // Handle Esc keyboard key event and platform Back button key event. let back_button_pressed = BACK_BUTTON_PRESSED.load(Ordering::Relaxed); if ctx.input_mut(|i| i.consume_key(Modifiers::NONE, egui::Key::Escape)) || back_button_pressed { self.root.on_back(); - // Request repaint to update previous content. - ctx.request_repaint(); - if back_button_pressed { BACK_BUTTON_PRESSED.store(false, Ordering::Relaxed); } + // Request repaint to update previous content. + ctx.request_repaint(); } // Handle Close event (on desktop). @@ -77,11 +75,18 @@ impl eframe::App for PlatformApp { ..Default::default() }) .show(ctx, |ui| { - self.root.ui(ui, frame, &self.platform); + self.root.ui(ui, &self.platform); }); } } +/// To draw with egui`s eframe (for wgpu, glow backends and wasm target). +impl eframe::App for App { + fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) { + self.ui(ctx); + } +} + #[allow(dead_code)] #[cfg(target_os = "android")] #[allow(non_snake_case)] diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 0fc208c..cf6c7a8 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -14,7 +14,7 @@ mod app; -pub use app::PlatformApp; +pub use app::App; mod colors; pub use colors::Colors; diff --git a/src/gui/views/network/connections.rs b/src/gui/views/network/connections.rs index cf231f1..dbe8d7e 100644 --- a/src/gui/views/network/connections.rs +++ b/src/gui/views/network/connections.rs @@ -66,7 +66,6 @@ impl ModalContainer for ConnectionsContent { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -80,9 +79,9 @@ impl ConnectionsContent { /// External connection [`Modal`] identifier. pub const NETWORK_EXT_CONNECTION_MODAL: &'static str = "network_ext_connection_modal"; - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); ui.add_space(2.0); diff --git a/src/gui/views/network/content.rs b/src/gui/views/network/content.rs index 168eda6..9db3618 100644 --- a/src/gui/views/network/content.rs +++ b/src/gui/views/network/content.rs @@ -43,12 +43,12 @@ impl Default for NetworkContent { } impl NetworkContent { - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Flag to show connections or integrated node content. let show_connections = AppConfig::show_connections_network_panel(); // Show title panel. - self.title_ui(ui, frame, show_connections, cb); + self.title_ui(ui, show_connections); // Show integrated node tabs content. egui::TopBottomPanel::bottom("node_tabs_panel") @@ -94,7 +94,7 @@ impl NetworkContent { }) .show_inside(ui, |ui| { // Draw node tab content. - self.node_tab_content.ui(ui, frame, cb); + self.node_tab_content.ui(ui, cb); }); }); @@ -140,7 +140,7 @@ impl NetworkContent { ui.available_width() }; View::max_width_ui(ui, max_width, |ui| { - self.connections.ui(ui, frame, cb); + self.connections.ui(ui, cb); }); }); }); @@ -188,11 +188,7 @@ impl NetworkContent { } /// Draw title content. - fn title_ui(&mut self, - ui: &mut egui::Ui, - frame: &mut eframe::Frame, - show_connections: bool, - _: &dyn PlatformCallbacks) { + fn title_ui(&mut self, ui: &mut egui::Ui, show_connections: bool) { // Setup values for title panel. let title_text = self.node_tab_content.get_type().title().to_uppercase(); let subtitle_text = Node::get_sync_status_text(); @@ -204,7 +200,7 @@ impl NetworkContent { }; // Draw title panel. - TitlePanel::ui(TitleType::Single(title_content), |ui, _| { + TitlePanel::ui(TitleType::Single(title_content), |ui| { if !show_connections { View::title_button(ui, DOTS_THREE_OUTLINE_VERTICAL, || { AppConfig::toggle_show_connections_network_panel(); @@ -213,13 +209,13 @@ impl NetworkContent { } }); } - }, |ui, _| { + }, |ui| { if !Root::is_dual_panel_mode(ui) { View::title_button(ui, BRIEFCASE, || { Root::toggle_network_panel(); }); } - }, ui, frame); + }, ui); } /// Content to draw when node is disabled. diff --git a/src/gui/views/network/metrics.rs b/src/gui/views/network/metrics.rs index d7fab7d..3cb79ed 100644 --- a/src/gui/views/network/metrics.rs +++ b/src/gui/views/network/metrics.rs @@ -36,7 +36,7 @@ impl NetworkTab for NetworkMetrics { NetworkTabType::Metrics } - fn ui(&mut self, ui: &mut egui::Ui, _: &mut eframe::Frame, _: &dyn PlatformCallbacks) { + fn ui(&mut self, ui: &mut egui::Ui, _: &dyn PlatformCallbacks) { // Show an error content when available. let node_err = Node::get_error(); if node_err.is_some() { diff --git a/src/gui/views/network/mining.rs b/src/gui/views/network/mining.rs index 62b5eb7..f02a5da 100644 --- a/src/gui/views/network/mining.rs +++ b/src/gui/views/network/mining.rs @@ -44,7 +44,7 @@ impl NetworkTab for NetworkMining { NetworkTabType::Mining } - fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Show an error content when available. let node_err = Node::get_error(); if node_err.is_some() { @@ -83,7 +83,7 @@ impl NetworkTab for NetworkMining { ui.add_space(1.0); ui.vertical_centered(|ui| { View::max_width_ui(ui, Root::SIDE_PANEL_WIDTH * 1.3, |ui| { - self.stratum_server_setup.ui(ui, frame, cb); + self.stratum_server_setup.ui(ui, cb); }); }); }); diff --git a/src/gui/views/network/node.rs b/src/gui/views/network/node.rs index c29cfcc..ba40bad 100644 --- a/src/gui/views/network/node.rs +++ b/src/gui/views/network/node.rs @@ -32,7 +32,7 @@ impl NetworkTab for NetworkNode { NetworkTabType::Node } - fn ui(&mut self, ui: &mut egui::Ui, _: &mut eframe::Frame, _: &dyn PlatformCallbacks) { + fn ui(&mut self, ui: &mut egui::Ui, _: &dyn PlatformCallbacks) { // Show an error content when available. let node_err = Node::get_error(); if node_err.is_some() { diff --git a/src/gui/views/network/settings.rs b/src/gui/views/network/settings.rs index d8391e2..6f40452 100644 --- a/src/gui/views/network/settings.rs +++ b/src/gui/views/network/settings.rs @@ -66,7 +66,6 @@ impl ModalContainer for NetworkSettings { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, _: &dyn PlatformCallbacks) { match modal.id { @@ -81,9 +80,9 @@ impl NetworkTab for NetworkSettings { NetworkTabType::Settings } - fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); ScrollArea::vertical() .id_source("network_settings") @@ -94,35 +93,35 @@ impl NetworkTab for NetworkSettings { ui.vertical_centered(|ui| { View::max_width_ui(ui, Root::SIDE_PANEL_WIDTH * 1.3, |ui| { // Draw node setup section. - self.node.ui(ui, frame, cb); + self.node.ui(ui, cb); ui.add_space(6.0); View::horizontal_line(ui, Colors::stroke()); ui.add_space(4.0); // Draw P2P server setup section. - self.p2p.ui(ui, frame, cb); + self.p2p.ui(ui, cb); ui.add_space(6.0); View::horizontal_line(ui, Colors::stroke()); ui.add_space(4.0); // Draw Stratum server setup section. - self.stratum.ui(ui, frame, cb); + self.stratum.ui(ui, cb); ui.add_space(6.0); View::horizontal_line(ui, Colors::stroke()); ui.add_space(4.0); // Draw pool setup section. - self.pool.ui(ui, frame, cb); + self.pool.ui(ui, cb); ui.add_space(6.0); View::horizontal_line(ui, Colors::stroke()); ui.add_space(4.0); // Draw Dandelion server setup section. - self.dandelion.ui(ui, frame, cb); + self.dandelion.ui(ui, cb); ui.add_space(6.0); View::horizontal_line(ui, Colors::stroke()); diff --git a/src/gui/views/network/setup/dandelion.rs b/src/gui/views/network/setup/dandelion.rs index 2906c8f..5194432 100644 --- a/src/gui/views/network/setup/dandelion.rs +++ b/src/gui/views/network/setup/dandelion.rs @@ -73,7 +73,6 @@ impl ModalContainer for DandelionSetup { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -87,9 +86,9 @@ impl ModalContainer for DandelionSetup { } impl DandelionSetup { - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); View::sub_title(ui, format!("{} {}", GRAPH, "Dandelion")); View::horizontal_line(ui, Colors::stroke()); diff --git a/src/gui/views/network/setup/node.rs b/src/gui/views/network/setup/node.rs index 45705e1..5ba145b 100644 --- a/src/gui/views/network/setup/node.rs +++ b/src/gui/views/network/setup/node.rs @@ -84,7 +84,6 @@ impl ModalContainer for NodeSetup { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -98,9 +97,9 @@ impl ModalContainer for NodeSetup { } impl NodeSetup { - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); View::sub_title(ui, format!("{} {}", COMPUTER_TOWER, t!("network_settings.server"))); View::horizontal_line(ui, Colors::stroke()); diff --git a/src/gui/views/network/setup/p2p.rs b/src/gui/views/network/setup/p2p.rs index 3c056c6..06bd3e6 100644 --- a/src/gui/views/network/setup/p2p.rs +++ b/src/gui/views/network/setup/p2p.rs @@ -132,7 +132,6 @@ impl ModalContainer for P2PSetup { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -153,9 +152,9 @@ impl P2PSetup { /// Title for custom DNS Seeds setup section. const DNS_SEEDS_TITLE: &'static str = "DNS Seeds"; - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); View::sub_title(ui, format!("{} {}", HANDSHAKE, t!("network_settings.p2p_server"))); View::horizontal_line(ui, Colors::stroke()); diff --git a/src/gui/views/network/setup/pool.rs b/src/gui/views/network/setup/pool.rs index 05e6a94..375caa9 100644 --- a/src/gui/views/network/setup/pool.rs +++ b/src/gui/views/network/setup/pool.rs @@ -80,7 +80,6 @@ impl ModalContainer for PoolSetup { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -95,9 +94,9 @@ impl ModalContainer for PoolSetup { } impl PoolSetup { - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); View::sub_title(ui, format!("{} {}", CHART_SCATTER, t!("network_settings.tx_pool"))); View::horizontal_line(ui, Colors::stroke()); diff --git a/src/gui/views/network/setup/stratum.rs b/src/gui/views/network/setup/stratum.rs index aaf4db3..474b17d 100644 --- a/src/gui/views/network/setup/stratum.rs +++ b/src/gui/views/network/setup/stratum.rs @@ -79,7 +79,6 @@ impl ModalContainer for StratumSetup { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -92,9 +91,9 @@ impl ModalContainer for StratumSetup { } impl StratumSetup { - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); View::sub_title(ui, format!("{} {}", HARD_DRIVES, t!("network_mining.server"))); View::horizontal_line(ui, Colors::stroke()); diff --git a/src/gui/views/network/types.rs b/src/gui/views/network/types.rs index c368951..419bbb0 100644 --- a/src/gui/views/network/types.rs +++ b/src/gui/views/network/types.rs @@ -17,7 +17,7 @@ use crate::gui::platform::PlatformCallbacks; /// Network tab content interface. pub trait NetworkTab { fn get_type(&self) -> NetworkTabType; - fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks); + fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks); } /// Type of [`NetworkTab`] content. diff --git a/src/gui/views/root.rs b/src/gui/views/root.rs index c6e18b0..bc2c26e 100644 --- a/src/gui/views/root.rs +++ b/src/gui/views/root.rs @@ -76,7 +76,6 @@ impl ModalContainer for Root { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, _: &dyn PlatformCallbacks) { match modal.id { @@ -100,9 +99,9 @@ impl Root { /// Default width of side panel at application UI. pub const SIDE_PANEL_WIDTH: f32 = 400.0; - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); let (is_panel_open, panel_width) = Self::network_panel_state_width(ui); // Show network content. @@ -119,7 +118,7 @@ impl Root { let window_size = View::window_size(ui); rect.set_height(window_size.1); ui.allocate_ui_at_rect(rect, |ui| { - self.network.ui(ui, frame, cb); + self.network.ui(ui, cb); }); }); @@ -135,7 +134,7 @@ impl Root { let window_size = View::window_size(ui); rect.set_height(window_size.1); ui.allocate_ui_at_rect(rect, |ui| { - self.wallets.ui(ui, frame, cb); + self.wallets.ui(ui, cb); }); }); diff --git a/src/gui/views/title_panel.rs b/src/gui/views/title_panel.rs index ae3a549..881ef75 100644 --- a/src/gui/views/title_panel.rs +++ b/src/gui/views/title_panel.rs @@ -27,10 +27,9 @@ impl TitlePanel { pub const DEFAULT_HEIGHT: f32 = 54.0; pub fn ui(title: TitleType, - mut left_content: impl FnMut(&mut egui::Ui, &mut eframe::Frame), - mut right_content: impl FnMut(&mut egui::Ui, &mut eframe::Frame), - ui: &mut egui::Ui, - frame: &mut eframe::Frame) { + mut left_content: impl FnMut(&mut egui::Ui), + mut right_content: impl FnMut(&mut egui::Ui), + ui: &mut egui::Ui) { // Setup identifier and title type. let (id, dual_title) = match &title { TitleType::Single(content) => { @@ -85,7 +84,7 @@ impl TitlePanel { strip.cell(|ui| { // Draw left panel action content. ui.centered_and_justified(|ui| { - (left_content)(ui, frame); + (left_content)(ui); }); }); // Draw title text content. @@ -104,7 +103,7 @@ impl TitlePanel { strip.cell(|ui| { // Draw right panel action content. ui.centered_and_justified(|ui| { - (right_content)(ui, frame); + (right_content)(ui); }); }); }); diff --git a/src/gui/views/types.rs b/src/gui/views/types.rs index 710b3d5..730e6a1 100644 --- a/src/gui/views/types.rs +++ b/src/gui/views/types.rs @@ -54,20 +54,18 @@ pub trait ModalContainer { /// Draw modal ui content. fn modal_ui(&mut self, ui: &mut egui::Ui, - frame: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks); /// Draw [`Modal`] for current ui container if it's possible. fn current_modal_ui(&mut self, ui: &mut egui::Ui, - frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { let modal_id = Modal::opened(); let draw = modal_id.is_some() && self.modal_ids().contains(&modal_id.unwrap()); if draw { Modal::ui(ui.ctx(), |ui, modal| { - self.modal_ui(ui, frame, modal, cb); + self.modal_ui(ui, modal, cb); }); } } diff --git a/src/gui/views/wallets/content.rs b/src/gui/views/wallets/content.rs index b9d9773..bd5f612 100644 --- a/src/gui/views/wallets/content.rs +++ b/src/gui/views/wallets/content.rs @@ -76,7 +76,6 @@ impl ModalContainer for WalletsContent { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -90,9 +89,9 @@ impl ModalContainer for WalletsContent { } impl WalletsContent { - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); // Setup wallet content flags. let empty_list = self.wallets.is_current_list_empty(); @@ -106,7 +105,7 @@ impl WalletsContent { let content_width = ui.available_width(); // Show title panel. - self.title_ui(ui, frame, dual_panel, create_wallet, show_wallet); + self.title_ui(ui, dual_panel, create_wallet, show_wallet); // Show wallet panel content. egui::SidePanel::right("wallet_panel") @@ -132,7 +131,7 @@ impl WalletsContent { } if create_wallet || !show_wallet { // Show wallet creation content. - self.creation_content.ui(ui, frame, cb, |wallet| { + self.creation_content.ui(ui, cb, |wallet| { // Add created wallet to list. self.wallets.add(wallet); // Reset wallet content. @@ -153,7 +152,7 @@ impl WalletsContent { rect.set_width(width); // Show wallet content. ui.allocate_ui_at_rect(rect, |ui| { - self.wallet_content.ui(ui, frame, wallet, cb); + self.wallet_content.ui(ui, wallet, cb); }); break; } @@ -224,7 +223,6 @@ impl WalletsContent { /// Draw [`TitlePanel`] content. fn title_ui(&mut self, ui: &mut egui::Ui, - frame: &mut eframe::Frame, dual_panel: bool, create_wallet: bool, show_wallet: bool) { @@ -263,7 +261,7 @@ impl WalletsContent { }; // Draw title panel. - TitlePanel::ui(title_content, |ui, _| { + TitlePanel::ui(title_content, |ui| { if show_wallet && !dual_panel { View::title_button(ui, ARROW_LEFT, || { self.wallets.select(None); @@ -287,7 +285,7 @@ impl WalletsContent { Root::toggle_network_panel(); }); }; - }, |ui, _| { + }, |ui| { View::title_button(ui, GEAR, || { // Show settings modal. Modal::new(Root::SETTINGS_MODAL) @@ -295,7 +293,7 @@ impl WalletsContent { .title(t!("settings")) .show(); }); - }, ui, frame); + }, ui); } /// Calculate [`WalletContent`] panel width. diff --git a/src/gui/views/wallets/creation/creation.rs b/src/gui/views/wallets/creation/creation.rs index cef6ac6..59e14f6 100644 --- a/src/gui/views/wallets/creation/creation.rs +++ b/src/gui/views/wallets/creation/creation.rs @@ -66,7 +66,6 @@ impl WalletCreation { /// Draw wallet creation content. pub fn ui(&mut self, ui: &mut egui::Ui, - frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks, on_create: impl FnOnce(Wallet)) { // Show wallet creation step description and confirmation panel. @@ -125,7 +124,7 @@ impl WalletCreation { Root::SIDE_PANEL_WIDTH * 2.0 }; View::max_width_ui(ui, max_width, |ui| { - self.step_content_ui(ui, frame, cb); + self.step_content_ui(ui, cb); }); }); }); @@ -312,10 +311,7 @@ impl WalletCreation { } /// Draw wallet creation [`Step`] content. - fn step_content_ui(&mut self, - ui: &mut egui::Ui, - frame: &mut eframe::Frame, - cb: &dyn PlatformCallbacks) { + fn step_content_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { match &self.step { None => { // Show wallet creation message if step is empty. @@ -339,14 +335,14 @@ impl WalletCreation { } Some(step) => { match step { - Step::EnterMnemonic => self.mnemonic_setup.ui(ui, frame, cb), - Step::ConfirmMnemonic => self.mnemonic_setup.confirm_ui(ui, frame, cb), + Step::EnterMnemonic => self.mnemonic_setup.ui(ui, cb), + Step::ConfirmMnemonic => self.mnemonic_setup.confirm_ui(ui, cb), Step::SetupConnection => { // Redraw if node is running. if Node::is_running() { ui.ctx().request_repaint_after(Node::STATS_UPDATE_DELAY); } - self.network_setup.create_ui(ui, frame, cb) + self.network_setup.create_ui(ui, cb) } } } diff --git a/src/gui/views/wallets/creation/mnemonic.rs b/src/gui/views/wallets/creation/mnemonic.rs index 8a078b6..7100ae1 100644 --- a/src/gui/views/wallets/creation/mnemonic.rs +++ b/src/gui/views/wallets/creation/mnemonic.rs @@ -77,7 +77,6 @@ impl ModalContainer for MnemonicSetup { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -90,9 +89,9 @@ impl ModalContainer for MnemonicSetup { impl MnemonicSetup { /// Draw content for phrase input step. - pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); ui.add_space(10.0); @@ -108,12 +107,9 @@ impl MnemonicSetup { } /// Draw content for phrase confirmation step. - pub fn confirm_ui(&mut self, - ui: &mut egui::Ui, - frame: &mut eframe::Frame, - cb: &dyn PlatformCallbacks) { + pub fn confirm_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); ui.add_space(4.0); ui.vertical_centered(|ui| { diff --git a/src/gui/views/wallets/setup/common.rs b/src/gui/views/wallets/setup/common.rs index 6b2765c..4f63e6d 100644 --- a/src/gui/views/wallets/setup/common.rs +++ b/src/gui/views/wallets/setup/common.rs @@ -60,11 +60,7 @@ impl Default for CommonSetup { } impl CommonSetup { - pub fn ui(&mut self, - ui: &mut egui::Ui, - _: &mut eframe::Frame, - wallet: &mut Wallet, - cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, wallet: &mut Wallet, cb: &dyn PlatformCallbacks) { // Show modal content for this ui container. self.modal_content_ui(ui, wallet, cb); diff --git a/src/gui/views/wallets/setup/connection.rs b/src/gui/views/wallets/setup/connection.rs index b37f1f7..2a82739 100644 --- a/src/gui/views/wallets/setup/connection.rs +++ b/src/gui/views/wallets/setup/connection.rs @@ -70,7 +70,6 @@ impl ModalContainer for ConnectionSetup { fn modal_ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, modal: &Modal, cb: &dyn PlatformCallbacks) { match modal.id { @@ -82,41 +81,34 @@ impl ModalContainer for ConnectionSetup { impl ConnectionSetup { /// Draw wallet creation setup content. - pub fn create_ui(&mut self, - ui: &mut egui::Ui, - frame: &mut eframe::Frame, - cb: &dyn PlatformCallbacks) { - self.ui(ui, frame, None, cb); + pub fn create_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { + self.ui(ui, None, cb); } /// Draw existing wallet connection setup content. - pub fn wallet_ui(&mut self, - ui: &mut egui::Ui, - frame: &mut eframe::Frame, - wallet: &mut Wallet, - cb: &dyn PlatformCallbacks) { + pub fn wallet_ui(&mut self, ui: &mut egui::Ui, w: &mut Wallet, cb: &dyn PlatformCallbacks) { // Setup connection value from provided wallet. - match wallet.get_config().ext_conn_id { + match w.get_config().ext_conn_id { None => self.method = ConnectionMethod::Integrated, Some(id) => self.method = ConnectionMethod::External(id) } // Draw setup content. - self.ui(ui, frame, Some(wallet), cb); + self.ui(ui, Some(w), cb); // Setup wallet connection value after change. let changed = match self.method { ConnectionMethod::Integrated => { - let changed = wallet.get_current_ext_conn().is_some(); + let changed = w.get_current_ext_conn().is_some(); if changed { - wallet.update_ext_conn_id(None); + w.update_ext_conn_id(None); } changed } ConnectionMethod::External(id) => { - let changed = wallet.get_config().ext_conn_id != Some(id); + let changed = w.get_config().ext_conn_id != Some(id); if changed { - wallet.update_ext_conn_id(Some(id)); + w.update_ext_conn_id(Some(id)); } changed } @@ -124,9 +116,9 @@ impl ConnectionSetup { // Reopen wallet if connection changed. if changed { - if !wallet.reopen_needed() { - wallet.set_reopen(true); - wallet.close(); + if !w.reopen_needed() { + w.set_reopen(true); + w.close(); } } } @@ -134,11 +126,10 @@ impl ConnectionSetup { /// Draw connection setup content. fn ui(&mut self, ui: &mut egui::Ui, - frame: &mut eframe::Frame, wallet: Option<&Wallet>, cb: &dyn PlatformCallbacks) { // Draw modal content for current ui container. - self.current_modal_ui(ui, frame, cb); + self.current_modal_ui(ui, cb); ui.add_space(2.0); View::sub_title(ui, format!("{} {}", GLOBE, t!("wallets.conn_method"))); diff --git a/src/gui/views/wallets/setup/recovery.rs b/src/gui/views/wallets/setup/recovery.rs index 231e600..40e29c2 100644 --- a/src/gui/views/wallets/setup/recovery.rs +++ b/src/gui/views/wallets/setup/recovery.rs @@ -51,11 +51,7 @@ impl Default for RecoverySetup { } impl RecoverySetup { - pub fn ui(&mut self, - ui: &mut egui::Ui, - _: &mut eframe::Frame, - wallet: &mut Wallet, - cb: &dyn PlatformCallbacks) { + pub fn ui(&mut self, ui: &mut egui::Ui, wallet: &mut Wallet, cb: &dyn PlatformCallbacks) { // Show modal content for this ui container. self.modal_content_ui(ui, wallet, cb); diff --git a/src/gui/views/wallets/wallet/content.rs b/src/gui/views/wallets/wallet/content.rs index 3bfc6c1..9c1fd78 100644 --- a/src/gui/views/wallets/wallet/content.rs +++ b/src/gui/views/wallets/wallet/content.rs @@ -75,7 +75,6 @@ impl WalletContent { /// Draw wallet content. pub fn ui(&mut self, ui: &mut egui::Ui, - frame: &mut eframe::Frame, wallet: &mut Wallet, cb: &dyn PlatformCallbacks) { // Show modal content for this ui container. @@ -153,7 +152,7 @@ impl WalletContent { ..Default::default() }) .show_inside(ui, |ui| { - self.current_tab.ui(ui, frame, wallet, cb); + self.current_tab.ui(ui, wallet, cb); }); // Refresh content after 1 second for synced wallet. diff --git a/src/gui/views/wallets/wallet/messages.rs b/src/gui/views/wallets/wallet/messages.rs index 48654eb..0ad9335 100644 --- a/src/gui/views/wallets/wallet/messages.rs +++ b/src/gui/views/wallets/wallet/messages.rs @@ -117,11 +117,7 @@ impl WalletTab for WalletMessages { WalletTabType::Messages } - fn ui(&mut self, - ui: &mut egui::Ui, - _: &mut eframe::Frame, - wallet: &mut Wallet, - cb: &dyn PlatformCallbacks) { + fn ui(&mut self, ui: &mut egui::Ui, wallet: &mut Wallet, cb: &dyn PlatformCallbacks) { if WalletContent::sync_ui(ui, wallet) { return; } diff --git a/src/gui/views/wallets/wallet/settings.rs b/src/gui/views/wallets/wallet/settings.rs index ed8bab9..ca7e095 100644 --- a/src/gui/views/wallets/wallet/settings.rs +++ b/src/gui/views/wallets/wallet/settings.rs @@ -52,7 +52,6 @@ impl WalletTab for WalletSettings { fn ui(&mut self, ui: &mut egui::Ui, - frame: &mut eframe::Frame, wallet: &mut Wallet, cb: &dyn PlatformCallbacks) { // Show loading progress if navigation is blocked. @@ -83,11 +82,11 @@ impl WalletTab for WalletSettings { ui.vertical_centered(|ui| { View::max_width_ui(ui, Root::SIDE_PANEL_WIDTH * 1.3, |ui| { // Show common wallet setup. - self.common_setup.ui(ui, frame, wallet, cb); + self.common_setup.ui(ui, wallet, cb); // Show wallet connections setup. - self.conn_setup.wallet_ui(ui, frame, wallet, cb); + self.conn_setup.wallet_ui(ui, wallet, cb); // Show wallet recovery setup. - self.recovery_setup.ui(ui, frame, wallet, cb); + self.recovery_setup.ui(ui, wallet, cb); }); }); }); diff --git a/src/gui/views/wallets/wallet/transport.rs b/src/gui/views/wallets/wallet/transport.rs index 065a16e..1d1ebb9 100644 --- a/src/gui/views/wallets/wallet/transport.rs +++ b/src/gui/views/wallets/wallet/transport.rs @@ -77,7 +77,6 @@ impl WalletTab for WalletTransport { fn ui(&mut self, ui: &mut egui::Ui, - _: &mut eframe::Frame, wallet: &mut Wallet, cb: &dyn PlatformCallbacks) { if WalletContent::sync_ui(ui, wallet) { diff --git a/src/gui/views/wallets/wallet/txs.rs b/src/gui/views/wallets/wallet/txs.rs index 2c3146d..20a54a7 100644 --- a/src/gui/views/wallets/wallet/txs.rs +++ b/src/gui/views/wallets/wallet/txs.rs @@ -97,11 +97,7 @@ impl WalletTab for WalletTransactions { WalletTabType::Txs } - fn ui(&mut self, - ui: &mut egui::Ui, - _: &mut eframe::Frame, - wallet: &mut Wallet, - cb: &dyn PlatformCallbacks) { + fn ui(&mut self, ui: &mut egui::Ui, wallet: &mut Wallet, cb: &dyn PlatformCallbacks) { if WalletContent::sync_ui(ui, wallet) { return; } diff --git a/src/gui/views/wallets/wallet/types.rs b/src/gui/views/wallets/wallet/types.rs index d94d6be..e9f5a4d 100644 --- a/src/gui/views/wallets/wallet/types.rs +++ b/src/gui/views/wallets/wallet/types.rs @@ -25,7 +25,6 @@ pub trait WalletTab { fn get_type(&self) -> WalletTabType; fn ui(&mut self, ui: &mut egui::Ui, - frame: &mut eframe::Frame, wallet: &mut Wallet, cb: &dyn PlatformCallbacks); } diff --git a/src/lib.rs b/src/lib.rs index 6cadcbc..959b254 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,7 +24,7 @@ use winit::platform::android::activity::AndroidApp; pub use settings::AppConfig; pub use settings::Settings; -use crate::gui::{Colors, PlatformApp}; +use crate::gui::{Colors, App}; use crate::gui::platform::PlatformCallbacks; use crate::gui::views::View; use crate::node::Node; @@ -62,7 +62,7 @@ fn android_main(app: AndroidApp) { // Setup system theme if not set. if let None = AppConfig::dark_theme() { - let use_dark = system_dark_theme(&platform); + let use_dark = use_dark_theme(&platform); AppConfig::set_dark_theme(use_dark); } @@ -89,21 +89,21 @@ fn android_main(app: AndroidApp) { builder.with_android_app(app); })); - let app = PlatformApp::new(platform); + let app = App::new(platform); start(options, app_creator(app)).unwrap(); } /// Check if system is using dark theme. #[allow(dead_code)] #[cfg(target_os = "android")] -fn system_dark_theme(platform: &gui::platform::Android) -> bool { +fn use_dark_theme(platform: &gui::platform::Android) -> bool { let res = platform.call_java_method("useDarkTheme", "()Z", &[]).unwrap(); unsafe { res.z != 0 } } -/// [`PlatformApp`] setup for [`eframe`]. -pub fn app_creator(app: PlatformApp) -> eframe::AppCreator - where PlatformApp: eframe::App, T: PlatformCallbacks { +/// [`App`] setup for [`eframe`]. +pub fn app_creator(app: App) -> eframe::AppCreator + where App: eframe::App, T: PlatformCallbacks { Box::new(|cc| { // Setup images support. egui_extras::install_image_loaders(&cc.egui_ctx); diff --git a/src/main.rs b/src/main.rs index 204de9c..3d63438 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use grim::gui::App; +use grim::gui::platform::Desktop; + pub fn main() { #[allow(dead_code)] #[cfg(not(target_os = "android"))] @@ -28,7 +31,7 @@ fn real_main() { .init(); use grim::gui::platform::Desktop; - use grim::gui::PlatformApp; + use grim::gui::App; use grim::AppConfig; use std::sync::Arc; @@ -69,12 +72,18 @@ fn real_main() { ..Default::default() }; options.renderer = eframe::Renderer::Wgpu; - match grim::start(options.clone(), grim::app_creator(PlatformApp::new(platform.clone()))) { + + match grim::start(options.clone(), grim::app_creator(App::new(platform.clone()))) { Ok(_) => {} Err(_) => { // Start with Glow renderer on error. options.renderer = eframe::Renderer::Glow; - grim::start(options, grim::app_creator(PlatformApp::new(platform))).unwrap(); + match grim::start(options, grim::app_creator(App::new(platform))) { + Ok(_) => {} + Err(_) => { + panic!("Impossible to render"); + } + } } } } \ No newline at end of file