ui: optimize paddings for mobile
This commit is contained in:
@@ -56,7 +56,7 @@ pub struct TextEdit {
|
||||
|
||||
impl TextEdit {
|
||||
/// Default height of [`egui::TextEdit`] view.
|
||||
const TEXT_EDIT_HEIGHT: f32 = 41.0;
|
||||
const TEXT_EDIT_HEIGHT: f32 = 42.0;
|
||||
|
||||
pub fn new(id: egui::Id) -> Self {
|
||||
Self {
|
||||
@@ -170,6 +170,11 @@ impl TextEdit {
|
||||
.id(self.id)
|
||||
.font(TextStyle::Heading)
|
||||
.min_size(edit_rect.size())
|
||||
.margin(if View::is_desktop() {
|
||||
egui::Margin::symmetric(4, 2)
|
||||
} else {
|
||||
egui::Margin::symmetric(8, 8)
|
||||
})
|
||||
.horizontal_align(if self.h_center { Align::Center } else { Align::Min })
|
||||
.vertical_align(Align::Center)
|
||||
.password(hide_input)
|
||||
|
||||
@@ -58,16 +58,22 @@ impl NetworkContent {
|
||||
|
||||
// Show integrated node tabs content.
|
||||
if !show_connections && !show_settings {
|
||||
let side_padding = View::TAB_ITEMS_PADDING + if View::is_desktop() {
|
||||
0.0
|
||||
} else {
|
||||
4.0
|
||||
};
|
||||
let tabs_margin = Margin {
|
||||
left: (View::get_left_inset() + side_padding) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + side_padding) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
};
|
||||
egui::TopBottomPanel::bottom("network_tabs_content")
|
||||
.min_height(0.5)
|
||||
.resizable(false)
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: (View::get_left_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + View::TAB_ITEMS_PADDING) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
},
|
||||
inner_margin: tabs_margin,
|
||||
fill: Colors::fill(),
|
||||
..Default::default()
|
||||
})
|
||||
@@ -79,9 +85,9 @@ impl NetworkContent {
|
||||
// Draw content divider line.
|
||||
let r = {
|
||||
let mut r = rect.clone();
|
||||
r.min.x -= View::get_left_inset() + View::TAB_ITEMS_PADDING;
|
||||
r.min.y -= View::TAB_ITEMS_PADDING;
|
||||
r.max.x += View::far_right_inset_margin(ui) + View::TAB_ITEMS_PADDING;
|
||||
r.min.x -= tabs_margin.left as f32;
|
||||
r.min.y -= tabs_margin.top as f32;
|
||||
r.max.x += tabs_margin.right as f32;
|
||||
r
|
||||
};
|
||||
View::line(ui, LinePosition::TOP, &r, Colors::stroke());
|
||||
@@ -99,8 +105,9 @@ impl NetworkContent {
|
||||
egui::CentralPanel::default()
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: (View::get_left_inset() + 4.0) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + 4.0) as i8,
|
||||
left: (View::get_left_inset() + View::content_padding()) as i8,
|
||||
right: (View::far_right_inset_margin(ui) +
|
||||
View::content_padding()) as i8,
|
||||
top: 3.0 as i8,
|
||||
bottom: 4.0 as i8,
|
||||
},
|
||||
@@ -141,13 +148,12 @@ impl NetworkContent {
|
||||
} else {
|
||||
self.node_tab_content.tab_ui(ui, cb);
|
||||
}
|
||||
|
||||
// Draw content divider line.
|
||||
let r = {
|
||||
let mut r = rect.clone();
|
||||
r.min.y -= 3.0;
|
||||
r.max.x += 4.0;
|
||||
r.max.y += 4.0;
|
||||
r.max.x += View::content_padding();
|
||||
r.max.y += View::content_padding();
|
||||
r
|
||||
};
|
||||
if dual_panel {
|
||||
@@ -161,17 +167,17 @@ impl NetworkContent {
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: if show_connections {
|
||||
View::get_left_inset() + 4.0
|
||||
View::get_left_inset() + View::content_padding()
|
||||
} else {
|
||||
0.0
|
||||
} as i8,
|
||||
right: if show_connections {
|
||||
View::far_right_inset_margin(ui) + 4.0
|
||||
View::far_right_inset_margin(ui) + View::content_padding()
|
||||
} else {
|
||||
0.0
|
||||
} as i8,
|
||||
top: 3.0 as i8,
|
||||
bottom:(4.0 + View::get_bottom_inset()) as i8,
|
||||
bottom: 0.0 as i8,
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
@@ -193,13 +199,14 @@ impl NetworkContent {
|
||||
self.connections.ui(ui, cb);
|
||||
});
|
||||
});
|
||||
ui.add_space(32.0);
|
||||
});
|
||||
// Draw content divider line.
|
||||
let r = {
|
||||
let mut r = rect.clone();
|
||||
r.min.y -= 3.0;
|
||||
r.max.x += 4.0;
|
||||
r.max.y += 4.0 + View::get_bottom_inset();
|
||||
r.max.x += View::content_padding();
|
||||
r.max.y += View::content_padding() + View::get_bottom_inset();
|
||||
r
|
||||
};
|
||||
if show_connections && dual_panel {
|
||||
@@ -233,8 +240,6 @@ impl NetworkContent {
|
||||
ui.vertical_centered(|ui| {
|
||||
// Setup spacing between tabs.
|
||||
ui.style_mut().spacing.item_spacing = egui::vec2(View::TAB_ITEMS_PADDING, 0.0);
|
||||
// Setup vertical padding inside tab button.
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(0.0, 4.0);
|
||||
|
||||
// Draw tab buttons.
|
||||
let current_type = self.node_tab_content.get_type();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Align, Layout, RichText, ScrollArea, StrokeKind};
|
||||
|
||||
use crate::gui::icons::{CHECK, CHECK_FAT, PENCIL, TRANSLATE};
|
||||
use crate::gui::icons::{CHECK, PENCIL, TRANSLATE};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::types::{ContentContainer, ModalPosition};
|
||||
use crate::gui::views::{Modal, View};
|
||||
@@ -178,9 +178,7 @@ impl InterfaceSettingsContent {
|
||||
Modal::close();
|
||||
});
|
||||
} else {
|
||||
ui.add_space(14.0);
|
||||
ui.label(RichText::new(CHECK_FAT).size(20.0).color(Colors::green()));
|
||||
ui.add_space(14.0);
|
||||
View::selected_item_check(ui);
|
||||
}
|
||||
|
||||
let layout_size = ui.available_size();
|
||||
|
||||
+45
-3
@@ -23,7 +23,7 @@ use egui::text::{LayoutJob, TextFormat};
|
||||
use egui::{lerp, Button, CornerRadius, CursorIcon, Rect, Response, Rgba, RichText, Sense, SizeHint, Spinner, StrokeKind, TextureHandle, TextureOptions, UiBuilder, Widget};
|
||||
use egui_extras::image::load_svg_bytes_with_size;
|
||||
|
||||
use crate::gui::icons::{CHECK_SQUARE, SQUARE};
|
||||
use crate::gui::icons::{CHECK_FAT, CHECK_SQUARE, SQUARE};
|
||||
use crate::gui::views::types::LinePosition;
|
||||
use crate::gui::Colors;
|
||||
use crate::AppConfig;
|
||||
@@ -109,6 +109,15 @@ impl View {
|
||||
}
|
||||
}
|
||||
|
||||
/// Content padding for current platform.
|
||||
pub fn content_padding() -> f32 {
|
||||
if View::is_desktop() {
|
||||
4.0
|
||||
} else {
|
||||
8.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Cut long text with ﹍ character.
|
||||
fn ellipsize(text: String, size: f32, color: Color32) -> LayoutJob {
|
||||
let mut job = LayoutJob::single_section(text, TextFormat {
|
||||
@@ -170,6 +179,10 @@ impl View {
|
||||
/// Draw title button with transparent background color, contains only icon.
|
||||
fn title_button(ui: &mut egui::Ui, size: f32, icon: &str, action: impl FnOnce(&mut egui::Ui)) {
|
||||
ui.scope(|ui| {
|
||||
// Setup padding for title buttons.
|
||||
if !View::is_desktop() {
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(20.0, 8.0);
|
||||
}
|
||||
// Disable strokes.
|
||||
ui.style_mut().visuals.widgets.inactive.bg_stroke = Stroke::NONE;
|
||||
ui.style_mut().visuals.widgets.hovered.bg_stroke = Stroke::NONE;
|
||||
@@ -181,11 +194,16 @@ impl View {
|
||||
let wt = RichText::new(icon.to_string()).size(size).color(Colors::title(true));
|
||||
// Draw button.
|
||||
let br = Button::new(wt)
|
||||
.sense(if View::is_desktop() {
|
||||
Sense::click()
|
||||
} else {
|
||||
Sense::click_and_drag()
|
||||
})
|
||||
.fill(Colors::TRANSPARENT)
|
||||
.ui(ui)
|
||||
.on_hover_cursor(CursorIcon::PointingHand);
|
||||
br.surrender_focus();
|
||||
if br.clicked() {
|
||||
if br.clicked() || (!View::is_desktop() && br.drag_stopped()) {
|
||||
action(ui);
|
||||
}
|
||||
});
|
||||
@@ -237,6 +255,13 @@ impl View {
|
||||
button = button.fill(Colors::fill()).stroke(Stroke::NONE);
|
||||
}
|
||||
|
||||
// Setup paddings for tab buttons.
|
||||
if Self::is_desktop() {
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(10.0, 4.0);
|
||||
} else {
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(14.0, 8.0);
|
||||
};
|
||||
|
||||
// Setup pointer style.
|
||||
let br = if active_not_selected {
|
||||
button.ui(ui).on_hover_cursor(CursorIcon::PointingHand)
|
||||
@@ -328,7 +353,12 @@ impl View {
|
||||
|
||||
ui.scope(|ui| {
|
||||
// Setup padding for item buttons.
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(14.0, 0.0);
|
||||
let padding = if Self::is_desktop() {
|
||||
14.0
|
||||
} else {
|
||||
18.0
|
||||
};
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(padding, 0.0);
|
||||
// Disable expansion on click/hover.
|
||||
ui.style_mut().visuals.widgets.hovered.expansion = 0.0;
|
||||
ui.style_mut().visuals.widgets.active.expansion = 0.0;
|
||||
@@ -397,6 +427,18 @@ impl View {
|
||||
}
|
||||
}
|
||||
|
||||
/// Draw selected item check.
|
||||
pub fn selected_item_check(ui: &mut egui::Ui) {
|
||||
let padding = if View::is_desktop() {
|
||||
14.0
|
||||
} else {
|
||||
18.0
|
||||
};
|
||||
ui.add_space(padding);
|
||||
ui.label(RichText::new(CHECK_FAT).size(20.0).color(Colors::green()));
|
||||
ui.add_space(padding);
|
||||
}
|
||||
|
||||
/// Draw rounded box with some value and label in the middle,
|
||||
/// where is r = (top_left, top_right, bottom_left, bottom_right).
|
||||
/// | VALUE |
|
||||
|
||||
@@ -188,14 +188,21 @@ impl ContentContainer for WalletsContent {
|
||||
}
|
||||
});
|
||||
|
||||
// Show wallet list tabs.
|
||||
let side_padding = View::TAB_ITEMS_PADDING + if View::is_desktop() {
|
||||
0.0
|
||||
} else {
|
||||
4.0
|
||||
};
|
||||
let tabs_margin = Margin {
|
||||
left: (View::far_left_inset_margin(ui) + side_padding) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + side_padding) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
};
|
||||
egui::TopBottomPanel::bottom("wallets_bottom_panel")
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: (View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + View::TAB_ITEMS_PADDING) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
},
|
||||
inner_margin: tabs_margin,
|
||||
fill: Colors::fill(),
|
||||
..Default::default()
|
||||
})
|
||||
@@ -205,8 +212,6 @@ impl ContentContainer for WalletsContent {
|
||||
|
||||
// Setup spacing between tabs.
|
||||
ui.style_mut().spacing.item_spacing = egui::vec2(View::TAB_ITEMS_PADDING, 0.0);
|
||||
// Setup vertical padding inside buttons.
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(10.0, 4.0);
|
||||
|
||||
ui.vertical_centered(|ui| {
|
||||
let pressed = Modal::opened() == Some(ADD_WALLET_MODAL);
|
||||
@@ -218,9 +223,9 @@ impl ContentContainer for WalletsContent {
|
||||
// Draw content divider line.
|
||||
let r = {
|
||||
let mut r = rect.clone();
|
||||
r.min.y -= View::TAB_ITEMS_PADDING;
|
||||
r.min.x -= View::TAB_ITEMS_PADDING;
|
||||
r.max.x += View::TAB_ITEMS_PADDING;
|
||||
r.min.y -= tabs_margin.top as f32;
|
||||
r.min.x -= tabs_margin.left as f32;
|
||||
r.max.x += tabs_margin.right as f32;
|
||||
r
|
||||
};
|
||||
View::line(ui, LinePosition::TOP, &r, Colors::stroke());
|
||||
@@ -235,8 +240,8 @@ impl ContentContainer for WalletsContent {
|
||||
.resizable(false)
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + 4.0) as i8,
|
||||
left: (View::far_left_inset_margin(ui) + View::content_padding()) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + View::content_padding()) as i8,
|
||||
top: 3.0 as i8,
|
||||
bottom: 4.0 as i8,
|
||||
},
|
||||
@@ -252,8 +257,8 @@ impl ContentContainer for WalletsContent {
|
||||
.frame(egui::Frame {
|
||||
inner_margin: if self.showing_settings() {
|
||||
Margin {
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + 4.0) as i8,
|
||||
left: (View::far_left_inset_margin(ui) + View::content_padding()) as i8,
|
||||
right: (View::far_right_inset_margin(ui) + View::content_padding()) as i8,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Align, Layout, RichText, ScrollArea, StrokeKind};
|
||||
|
||||
use crate::gui::icons::{CHECK, CHECK_FAT, COMPUTER_TOWER, FOLDER_OPEN, GLOBE_SIMPLE, PLUGS_CONNECTED};
|
||||
use crate::gui::icons::{CHECK, COMPUTER_TOWER, FOLDER_OPEN, GLOBE_SIMPLE, PLUGS_CONNECTED};
|
||||
use crate::gui::views::wallets::wallet::types::wallet_status_text;
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::Colors;
|
||||
@@ -111,10 +111,8 @@ impl WalletListModal {
|
||||
});
|
||||
} else {
|
||||
// Draw button to select wallet.
|
||||
let current = self.selected_id.unwrap_or(0) == id;
|
||||
if current {
|
||||
ui.add_space(12.0);
|
||||
ui.label(RichText::new(CHECK_FAT).size(20.0).color(Colors::green()));
|
||||
if self.selected_id.unwrap_or(0) == id {
|
||||
View::selected_item_check(ui);
|
||||
} else {
|
||||
View::item_button(ui, View::item_rounding(0, 1, true), CHECK, None, || {
|
||||
on_select();
|
||||
|
||||
@@ -12,19 +12,19 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{RichText, ScrollArea};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{RichText, ScrollArea};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CHECK, CHECK_FAT, PLUS_CIRCLE, TRASH};
|
||||
use crate::gui::icons::{CHECK, PLUS_CIRCLE, TRASH};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::ConnectionsContent;
|
||||
use crate::gui::views::network::modals::ExternalConnectionModal;
|
||||
use crate::gui::views::network::ConnectionsContent;
|
||||
use crate::gui::views::types::ModalPosition;
|
||||
use crate::gui::views::wallets::WalletsContent;
|
||||
use crate::wallet::{ConnectionsConfig, ExternalConnection};
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::Colors;
|
||||
use crate::wallet::types::ConnectionMethod;
|
||||
use crate::wallet::{ConnectionsConfig, ExternalConnection};
|
||||
|
||||
/// Wallet connection selection [`Modal`] content.
|
||||
pub struct WalletSettingsModal {
|
||||
@@ -82,9 +82,7 @@ impl WalletSettingsModal {
|
||||
ConnectionsContent::integrated_node_item_ui(ui, |ui| {
|
||||
match self.conn {
|
||||
ConnectionMethod::Integrated => {
|
||||
ui.add_space(14.0);
|
||||
ui.label(RichText::new(CHECK_FAT).size(20.0).color(Colors::green()));
|
||||
ui.add_space(14.0);
|
||||
View::selected_item_check(ui);
|
||||
}
|
||||
_ => {
|
||||
View::item_button(ui, View::item_rounding(0, 1, true), CHECK, None, || {
|
||||
@@ -119,7 +117,9 @@ impl WalletSettingsModal {
|
||||
ConnectionMethod::Integrated => false,
|
||||
ConnectionMethod::External(id, _) => id == conn.id
|
||||
};
|
||||
if !current_ext_conn {
|
||||
if current_ext_conn {
|
||||
View::selected_item_check(ui);
|
||||
} else {
|
||||
let button_rounding = View::item_rounding(index, len, true);
|
||||
View::item_button(ui, button_rounding, CHECK, None, || {
|
||||
on_select(
|
||||
@@ -127,11 +127,6 @@ impl WalletSettingsModal {
|
||||
);
|
||||
Modal::close();
|
||||
});
|
||||
} else {
|
||||
ui.add_space(12.0);
|
||||
ui.label(RichText::new(CHECK_FAT)
|
||||
.size(20.0)
|
||||
.color(Colors::green()));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::gui::icons::{CHECK, CHECK_FAT, FOLDER_USER, PATH};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Align, Layout, RichText, ScrollArea, StrokeKind};
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
|
||||
use crate::gui::icons::{CHECK, FOLDER_USER, PATH};
|
||||
use crate::gui::views::wallets::wallet::types::GRIN;
|
||||
use crate::gui::views::View;
|
||||
use crate::gui::Colors;
|
||||
use crate::wallet::types::WalletAccount;
|
||||
use crate::wallet::WalletConfig;
|
||||
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Align, Layout, RichText, ScrollArea, StrokeKind};
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
|
||||
/// Wallet account list content.
|
||||
pub struct WalletAccountsContent {
|
||||
/// List of wallet accounts.
|
||||
@@ -83,15 +83,13 @@ impl WalletAccountsContent {
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
// Draw button to select account.
|
||||
let is_current_account = self.current_label == acc.label;
|
||||
if !is_current_account {
|
||||
if self.current_label == acc.label {
|
||||
View::selected_item_check(ui);
|
||||
} else {
|
||||
let button_rounding = View::item_rounding(index, size, true);
|
||||
View::item_button(ui, button_rounding, CHECK, None, || {
|
||||
on_select();
|
||||
});
|
||||
} else {
|
||||
ui.add_space(12.0);
|
||||
ui.label(RichText::new(CHECK_FAT).size(20.0).color(Colors::green()));
|
||||
}
|
||||
|
||||
let layout_size = ui.available_size();
|
||||
|
||||
@@ -109,14 +109,20 @@ impl WalletContentContainer for WalletContent {
|
||||
}
|
||||
|
||||
// Show wallet tabs.
|
||||
let side_padding = View::TAB_ITEMS_PADDING + if View::is_desktop() {
|
||||
0.0
|
||||
} else {
|
||||
4.0
|
||||
};
|
||||
let tabs_margin = Margin {
|
||||
left: (View::far_left_inset_margin(ui) + side_padding) as i8,
|
||||
right: (View::get_right_inset() + side_padding) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
};
|
||||
egui::TopBottomPanel::bottom("wallet_tabs")
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: (View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING) as i8,
|
||||
right: (View::get_right_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
top: View::TAB_ITEMS_PADDING as i8,
|
||||
bottom: (View::get_bottom_inset() + View::TAB_ITEMS_PADDING) as i8,
|
||||
},
|
||||
inner_margin: tabs_margin,
|
||||
fill: Colors::fill(),
|
||||
..Default::default()
|
||||
})
|
||||
@@ -127,10 +133,10 @@ impl WalletContentContainer for WalletContent {
|
||||
});
|
||||
let rect = {
|
||||
let mut r = r.clone();
|
||||
r.min.x -= View::far_left_inset_margin(ui) + View::TAB_ITEMS_PADDING;
|
||||
r.min.y -= View::TAB_ITEMS_PADDING;
|
||||
r.max.x += View::get_right_inset() + View::TAB_ITEMS_PADDING;
|
||||
r.max.y += View::get_bottom_inset() + View::TAB_ITEMS_PADDING;
|
||||
r.min.x -= tabs_margin.left as f32;
|
||||
r.min.y -= tabs_margin.top as f32;
|
||||
r.max.x += tabs_margin.right as f32;
|
||||
r.max.y += tabs_margin.bottom as f32;
|
||||
r
|
||||
};
|
||||
// Draw cover for content below opened panel.
|
||||
@@ -158,9 +164,9 @@ impl WalletContentContainer for WalletContent {
|
||||
egui::TopBottomPanel::top(Id::from("wallet_account").with(wallet.identifier()))
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::get_right_inset() + 4.0) as i8,
|
||||
top: 4.0 as i8,
|
||||
left: (View::far_left_inset_margin(ui) + View::content_padding()) as i8,
|
||||
right: (View::get_right_inset() + View::content_padding()) as i8,
|
||||
top: View::content_padding() as i8,
|
||||
bottom: 0.0 as i8,
|
||||
},
|
||||
fill: if top_panel_expanded {
|
||||
@@ -176,9 +182,9 @@ impl WalletContentContainer for WalletContent {
|
||||
// Draw content divider lines.
|
||||
let r = {
|
||||
let mut r = rect.clone();
|
||||
r.min.x -= 4.0 + View::far_left_inset_margin(ui);
|
||||
r.min.y -= 4.0;
|
||||
r.max.x += 4.0 + View::get_right_inset();
|
||||
r.min.x -= View::content_padding() + View::far_left_inset_margin(ui);
|
||||
r.min.y -= View::content_padding();
|
||||
r.max.x += View::content_padding() + View::get_right_inset();
|
||||
r
|
||||
};
|
||||
if dual_panel && show_wallets_dual {
|
||||
@@ -192,8 +198,8 @@ impl WalletContentContainer for WalletContent {
|
||||
egui::TopBottomPanel::top(Id::from("wallet_transport").with(wallet.identifier()))
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::get_right_inset() + 4.0) as i8,
|
||||
left: (View::far_left_inset_margin(ui) + View::content_padding()) as i8,
|
||||
right: (View::get_right_inset() + View::content_padding()) as i8,
|
||||
top: 1.0 as i8,
|
||||
bottom: 1.0 as i8,
|
||||
},
|
||||
@@ -212,9 +218,9 @@ impl WalletContentContainer for WalletContent {
|
||||
// Draw content divider lines.
|
||||
let r = {
|
||||
let mut r = rect.clone();
|
||||
r.min.x -= 4.0 + View::far_left_inset_margin(ui);
|
||||
r.min.x -= View::content_padding() + View::far_left_inset_margin(ui);
|
||||
r.min.y -= 1.0;
|
||||
r.max.x += 4.0 + View::get_right_inset();
|
||||
r.max.x += View::content_padding() + View::get_right_inset();
|
||||
r
|
||||
};
|
||||
if dual_panel && show_wallets_dual {
|
||||
@@ -227,8 +233,8 @@ impl WalletContentContainer for WalletContent {
|
||||
egui::CentralPanel::default()
|
||||
.frame(egui::Frame {
|
||||
inner_margin: Margin {
|
||||
left: (View::far_left_inset_margin(ui) + 4.0) as i8,
|
||||
right: (View::get_right_inset() + 4.0) as i8,
|
||||
left: (View::far_left_inset_margin(ui) + View::content_padding()) as i8,
|
||||
right: (View::get_right_inset() + View::content_padding()) as i8,
|
||||
top: 0.0 as i8,
|
||||
bottom: 4.0 as i8,
|
||||
},
|
||||
@@ -272,8 +278,8 @@ impl WalletContentContainer for WalletContent {
|
||||
}
|
||||
let rect = {
|
||||
let mut r = rect.clone();
|
||||
r.min.x -= View::far_left_inset_margin(ui) + 4.0;
|
||||
r.max.x += View::get_right_inset() + 4.0;
|
||||
r.min.x -= View::far_left_inset_margin(ui) + View::content_padding();
|
||||
r.max.x += View::get_right_inset() + View::content_padding();
|
||||
r.max.y += 4.0;
|
||||
r
|
||||
};
|
||||
@@ -356,9 +362,6 @@ impl WalletContent {
|
||||
// Setup spacing between tabs.
|
||||
ui.style_mut().spacing.item_spacing = egui::vec2(View::TAB_ITEMS_PADDING, 0.0);
|
||||
|
||||
// Setup vertical padding inside buttons.
|
||||
ui.style_mut().spacing.button_padding = egui::vec2(0.0, 4.0);
|
||||
|
||||
let has_wallet_data = wallet.get_data().is_some();
|
||||
let can_send = if has_wallet_data {
|
||||
wallet.get_data().unwrap().info.amount_currently_spendable > 0
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
use egui::{Align, Layout, RichText, StrokeKind};
|
||||
|
||||
use crate::gui::icons::{CHECK, CHECK_CIRCLE, CHECK_FAT, DOTS_THREE_CIRCLE, GLOBE, GLOBE_SIMPLE, PLUS_CIRCLE, X_CIRCLE};
|
||||
use crate::gui::icons::{CHECK, CHECK_CIRCLE, DOTS_THREE_CIRCLE, GLOBE, GLOBE_SIMPLE, PLUS_CIRCLE, X_CIRCLE};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::network::modals::ExternalConnectionModal;
|
||||
use crate::gui::views::network::ConnectionsContent;
|
||||
@@ -77,9 +77,7 @@ impl ContentContainer for ConnectionSettings {
|
||||
self.method = ConnectionMethod::Integrated;
|
||||
});
|
||||
} else {
|
||||
ui.add_space(14.0);
|
||||
ui.label(RichText::new(CHECK_FAT).size(20.0).color(Colors::green()));
|
||||
ui.add_space(14.0);
|
||||
View::selected_item_check(ui);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -165,8 +163,7 @@ impl ConnectionSettings {
|
||||
ui.vertical(|ui| {
|
||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
||||
if is_current {
|
||||
ui.add_space(12.0);
|
||||
ui.label(RichText::new(CHECK_FAT).size(20.0).color(Colors::green()));
|
||||
View::selected_item_check(ui);
|
||||
} else {
|
||||
// Draw button to select connection.
|
||||
let button_rounding = View::item_rounding(index, len, true);
|
||||
|
||||
+5
-1
@@ -126,7 +126,11 @@ pub fn setup_visuals(ctx: &Context) {
|
||||
style.interaction.selectable_labels = false;
|
||||
style.interaction.multi_widget_text_select = false;
|
||||
// Setup spacing for buttons.
|
||||
style.spacing.button_padding = egui::vec2(12.0, 8.0);
|
||||
if View::is_desktop() {
|
||||
style.spacing.button_padding = egui::vec2(12.0, 8.0);
|
||||
} else {
|
||||
style.spacing.button_padding = egui::vec2(14.0, 10.0);
|
||||
}
|
||||
// Make scroll-bar thinner and lighter.
|
||||
style.spacing.scroll.bar_width = 4.0;
|
||||
style.spacing.scroll.bar_outer_margin = -2.0;
|
||||
|
||||
+2
-4
@@ -14,8 +14,6 @@
|
||||
|
||||
#![windows_subsystem = "windows"]
|
||||
|
||||
use log::error;
|
||||
|
||||
pub fn main() {
|
||||
#[allow(dead_code)]
|
||||
#[cfg(not(target_os = "android"))]
|
||||
@@ -250,7 +248,7 @@ fn start_app_socket(platform: grim::gui::platform::Desktop) {
|
||||
let opts = ListenerOptions::new().name(name);
|
||||
let listener = match opts.create_tokio() {
|
||||
Err(e) if e.kind() == io::ErrorKind::AddrInUse => {
|
||||
error!("Socket file is occupied.");
|
||||
log::error!("Socket file is occupied.");
|
||||
return Err::<Listener, io::Error>(e);
|
||||
}
|
||||
x => x?,
|
||||
@@ -260,7 +258,7 @@ fn start_app_socket(platform: grim::gui::platform::Desktop) {
|
||||
let conn = match listener.accept().await {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
error!("{:?}", e);
|
||||
log::error!("{:?}", e);
|
||||
continue
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user