ui: fix network scroll and title paddings, fix title buttons hovering, set resolution on app start, update metrics translation.
This commit is contained in:
parent
917b4b743d
commit
9d97d466ff
5 changed files with 23 additions and 9 deletions
|
@ -3,7 +3,7 @@ screen_accounts:
|
||||||
network:
|
network:
|
||||||
self: Network
|
self: Network
|
||||||
node: Integrated node
|
node: Integrated node
|
||||||
metrics: Chain metrics
|
metrics: Metrics
|
||||||
mining: Mining
|
mining: Mining
|
||||||
settings: Node settings
|
settings: Node settings
|
||||||
enable_node: Enable node
|
enable_node: Enable node
|
||||||
|
@ -47,7 +47,7 @@ network_node:
|
||||||
size: Size (GB)
|
size: Size (GB)
|
||||||
peers: Peers
|
peers: Peers
|
||||||
network_metrics:
|
network_metrics:
|
||||||
loading: Chain metrics will be available after the synchronization
|
loading: Metrics will be available after the synchronization
|
||||||
emission: Emission
|
emission: Emission
|
||||||
inflation: Inflation
|
inflation: Inflation
|
||||||
supply: Supply
|
supply: Supply
|
||||||
|
|
|
@ -3,7 +3,7 @@ screen_accounts:
|
||||||
network:
|
network:
|
||||||
self: Сеть
|
self: Сеть
|
||||||
node: Встроенный узел
|
node: Встроенный узел
|
||||||
metrics: Показатели цепи
|
metrics: Показатели
|
||||||
mining: Майнинг
|
mining: Майнинг
|
||||||
settings: Настройки узла
|
settings: Настройки узла
|
||||||
enable_node: Включить узел
|
enable_node: Включить узел
|
||||||
|
@ -47,7 +47,7 @@ network_node:
|
||||||
size: Размер (ГБ)
|
size: Размер (ГБ)
|
||||||
peers: Пиры
|
peers: Пиры
|
||||||
network_metrics:
|
network_metrics:
|
||||||
loading: Показатели цепи будут доступны после синхронизации
|
loading: Показатели будут доступны после синхронизации
|
||||||
emission: Эмиссия
|
emission: Эмиссия
|
||||||
inflation: Инфляция
|
inflation: Инфляция
|
||||||
supply: Предложение
|
supply: Предложение
|
||||||
|
|
|
@ -149,7 +149,12 @@ impl NetworkContainer {
|
||||||
egui::CentralPanel::default()
|
egui::CentralPanel::default()
|
||||||
.frame(egui::Frame {
|
.frame(egui::Frame {
|
||||||
stroke: View::DEFAULT_STROKE,
|
stroke: View::DEFAULT_STROKE,
|
||||||
inner_margin: Margin::same(4.0),
|
inner_margin: Margin {
|
||||||
|
left: 4.0,
|
||||||
|
right: 4.0,
|
||||||
|
top: 3.0,
|
||||||
|
bottom: 4.0,
|
||||||
|
},
|
||||||
fill: Colors::WHITE,
|
fill: Colors::WHITE,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
|
@ -229,15 +234,16 @@ impl NetworkContainer {
|
||||||
fn title_text_ui(&self, builder: StripBuilder) {
|
fn title_text_ui(&self, builder: StripBuilder) {
|
||||||
builder
|
builder
|
||||||
.size(Size::remainder())
|
.size(Size::remainder())
|
||||||
.size(Size::exact(32.0))
|
.size(Size::exact(30.0))
|
||||||
.vertical(|mut strip| {
|
.vertical(|mut strip| {
|
||||||
strip.cell(|ui| {
|
strip.cell(|ui| {
|
||||||
ui.add_space(2.0);
|
ui.add_space(3.0);
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
ui.label(RichText::new(self.current_tab.get_type().name().to_uppercase())
|
ui.label(RichText::new(self.current_tab.get_type().name().to_uppercase())
|
||||||
.size(18.0)
|
.size(18.0)
|
||||||
.color(Colors::TITLE));
|
.color(Colors::TITLE));
|
||||||
});
|
});
|
||||||
|
ui.add_space(1.0);
|
||||||
});
|
});
|
||||||
strip.cell(|ui| {
|
strip.cell(|ui| {
|
||||||
ui.centered_and_justified(|ui| {
|
ui.centered_and_justified(|ui| {
|
||||||
|
|
|
@ -78,9 +78,15 @@ impl View {
|
||||||
/// Title button with transparent background fill color, contains only icon.
|
/// Title button with transparent background fill color, contains only icon.
|
||||||
pub fn title_button(ui: &mut egui::Ui, icon: &str, action: impl FnOnce()) {
|
pub fn title_button(ui: &mut egui::Ui, icon: &str, action: impl FnOnce()) {
|
||||||
ui.scope(|ui| {
|
ui.scope(|ui| {
|
||||||
// Disable stroke around title buttons on hover
|
// Disable stroke around title buttons on click.
|
||||||
ui.style_mut().visuals.widgets.active.bg_stroke = Stroke::NONE;
|
ui.style_mut().visuals.widgets.active.bg_stroke = Stroke::NONE;
|
||||||
|
// Disable rounding on hover.
|
||||||
|
ui.style_mut().visuals.widgets.hovered.rounding = Rounding::none();
|
||||||
|
// Disable stroke color on hover.
|
||||||
|
ui.style_mut().visuals.widgets.hovered.bg_stroke = Self::DEFAULT_STROKE;
|
||||||
|
// Setup text.
|
||||||
let wt = RichText::new(icon.to_string()).size(24.0).color(Colors::TITLE);
|
let wt = RichText::new(icon.to_string()).size(24.0).color(Colors::TITLE);
|
||||||
|
// Draw button.
|
||||||
let br = Button::new(wt)
|
let br = Button::new(wt)
|
||||||
.fill(Colors::TRANSPARENT)
|
.fill(Colors::TRANSPARENT)
|
||||||
.ui(ui);
|
.ui(ui);
|
||||||
|
|
|
@ -21,6 +21,7 @@ use winit::platform::android::activity::AndroidApp;
|
||||||
pub use settings::{AppConfig, Settings};
|
pub use settings::{AppConfig, Settings};
|
||||||
|
|
||||||
use crate::gui::{App, PlatformApp};
|
use crate::gui::{App, PlatformApp};
|
||||||
|
use crate::gui::platform::PlatformCallbacks;
|
||||||
use crate::node::Node;
|
use crate::node::Node;
|
||||||
|
|
||||||
i18n!("locales");
|
i18n!("locales");
|
||||||
|
@ -59,7 +60,7 @@ fn android_main(app: AndroidApp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn app_creator<T: 'static>(app: PlatformApp<T>) -> eframe::AppCreator
|
pub fn app_creator<T: 'static>(app: PlatformApp<T>) -> eframe::AppCreator
|
||||||
where PlatformApp<T>: eframe::App {
|
where PlatformApp<T>: eframe::App, T: PlatformCallbacks {
|
||||||
Box::new(|cc| {
|
Box::new(|cc| {
|
||||||
App::setup_visuals(&cc.egui_ctx);
|
App::setup_visuals(&cc.egui_ctx);
|
||||||
App::setup_fonts(&cc.egui_ctx);
|
App::setup_fonts(&cc.egui_ctx);
|
||||||
|
@ -71,6 +72,7 @@ pub fn app_creator<T: 'static>(app: PlatformApp<T>) -> eframe::AppCreator
|
||||||
pub fn start(mut options: eframe::NativeOptions, app_creator: eframe::AppCreator) {
|
pub fn start(mut options: eframe::NativeOptions, app_creator: eframe::AppCreator) {
|
||||||
options.default_theme = eframe::Theme::Light;
|
options.default_theme = eframe::Theme::Light;
|
||||||
options.renderer = eframe::Renderer::Wgpu;
|
options.renderer = eframe::Renderer::Wgpu;
|
||||||
|
options.initial_window_size = Some(egui::Vec2::new(1200.0, 720.0));
|
||||||
|
|
||||||
setup_i18n();
|
setup_i18n();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue