mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-13 01:03:54 +01:00
ui: text edit refactoring
This commit is contained in:
@@ -12,14 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Id, RichText, TextStyle, Widget};
|
||||
use egui::{Id, RichText};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CLOCK_COUNTDOWN, GRAPH, TIMER, WATCH};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition, TextEditOptions};
|
||||
use crate::node::NodeConfig;
|
||||
|
||||
/// Dandelion server setup section content.
|
||||
@@ -165,16 +165,8 @@ impl DandelionSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw epoch text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.epoch_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(52.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let epoch_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.epoch_edit, epoch_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.epoch_edit.parse::<u16>().is_err() {
|
||||
@@ -250,16 +242,8 @@ impl DandelionSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw embargo text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.embargo_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(52.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let embargo_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.embargo_edit, embargo_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.embargo_edit.parse::<u16>().is_err() {
|
||||
@@ -335,16 +319,8 @@ impl DandelionSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw aggregation period text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.aggregation_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(42.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let aggregation_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.aggregation_edit, aggregation_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.aggregation_edit.parse::<u16>().is_err() {
|
||||
@@ -420,16 +396,8 @@ impl DandelionSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw stem phase probability text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.stem_prob_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(42.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let stem_prob_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.stem_prob_edit, stem_prob_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.stem_prob_edit.parse::<u8>().is_err() {
|
||||
|
||||
@@ -12,17 +12,16 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Id, RichText, TextStyle, Widget};
|
||||
use egui_extras::{Size, StripBuilder};
|
||||
use egui::{Id, RichText};
|
||||
use grin_core::global::ChainTypes;
|
||||
|
||||
use crate::AppConfig;
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{CLIPBOARD_TEXT, CLOCK_CLOCKWISE, COMPUTER_TOWER, COPY, PLUG, POWER, SHIELD, SHIELD_SLASH};
|
||||
use crate::gui::icons::{CLOCK_CLOCKWISE, COMPUTER_TOWER, PLUG, POWER, SHIELD, SHIELD_SLASH};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, NetworkContent, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition, TextEditOptions};
|
||||
use crate::node::{Node, NodeConfig};
|
||||
|
||||
/// Integrated node general setup section content.
|
||||
@@ -286,15 +285,8 @@ impl NodeSetup {
|
||||
ui.add_space(6.0);
|
||||
|
||||
// Draw API port text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.api_port_edit)
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(64.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let api_port_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.api_port_edit, api_port_edit_opts);
|
||||
|
||||
// Show error when specified port is unavailable or reminder to restart enabled node.
|
||||
if !self.api_port_available_edit {
|
||||
@@ -390,49 +382,11 @@ impl NodeSetup {
|
||||
};
|
||||
ui.label(RichText::new(description).size(17.0).color(Colors::GRAY));
|
||||
ui.add_space(8.0);
|
||||
StripBuilder::new(ui)
|
||||
.size(Size::exact(42.0))
|
||||
.vertical(|mut strip| {
|
||||
strip.strip(|builder| {
|
||||
builder
|
||||
.size(Size::remainder())
|
||||
.size(Size::exact(48.0))
|
||||
.size(Size::exact(48.0))
|
||||
.horizontal(|mut strip| {
|
||||
strip.cell(|ui| {
|
||||
ui.add_space(2.0);
|
||||
// Draw API secret token value text edit.
|
||||
let edit = egui::TextEdit::singleline(&mut self.secret_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Button)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
edit.request_focus();
|
||||
if edit.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
});
|
||||
strip.cell(|ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
// Draw copy button.
|
||||
let copy_icon = COPY.to_string();
|
||||
View::button(ui, copy_icon, Colors::WHITE, || {
|
||||
cb.copy_string_to_buffer(self.secret_edit.clone());
|
||||
});
|
||||
});
|
||||
});
|
||||
strip.cell(|ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
// Draw paste button.
|
||||
let paste_icon = CLIPBOARD_TEXT.to_string();
|
||||
View::button(ui, paste_icon, Colors::WHITE, || {
|
||||
self.secret_edit = cb.get_string_from_buffer();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
// Draw API secret token value text edit.
|
||||
let secret_edit_opts = TextEditOptions::new(Id::from(modal.id)).copy().paste();
|
||||
View::text_edit(ui, cb, &mut self.secret_edit, secret_edit_opts);
|
||||
ui.add_space(6.0);
|
||||
|
||||
// Show reminder to restart enabled node.
|
||||
if Node::is_running() {
|
||||
@@ -440,7 +394,7 @@ impl NodeSetup {
|
||||
.size(16.0)
|
||||
.color(Colors::GREEN)
|
||||
);
|
||||
ui.add_space(8.0);
|
||||
ui.add_space(6.0);
|
||||
}
|
||||
ui.add_space(4.0);
|
||||
});
|
||||
@@ -516,16 +470,8 @@ impl NodeSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw ftl value text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.ftl_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(52.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let ftl_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.ftl_edit, ftl_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.ftl_edit.parse::<u64>().is_err() {
|
||||
|
||||
@@ -12,17 +12,16 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Align, Id, Layout, RichText, TextStyle, Widget};
|
||||
use egui_extras::{Size, StripBuilder};
|
||||
use egui::{Align, Id, Layout, RichText};
|
||||
use grin_core::global::ChainTypes;
|
||||
|
||||
use crate::AppConfig;
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{ARROW_FAT_LINE_UP, ARROW_FAT_LINES_DOWN, ARROW_FAT_LINES_UP, CLIPBOARD_TEXT, GLOBE_SIMPLE, HANDSHAKE, PLUG, PLUS_CIRCLE, PROHIBIT_INSET, TRASH};
|
||||
use crate::gui::icons::{ARROW_FAT_LINE_UP, ARROW_FAT_LINES_DOWN, ARROW_FAT_LINES_UP, GLOBE_SIMPLE, HANDSHAKE, PLUG, PLUS_CIRCLE, PROHIBIT_INSET, TRASH};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition, TextEditOptions};
|
||||
use crate::node::{NodeConfig, PeersConfig};
|
||||
|
||||
/// Type of peer.
|
||||
@@ -283,16 +282,8 @@ impl P2PSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw p2p port text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.port_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(64.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let text_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.port_edit, text_edit_opts);
|
||||
|
||||
// Show error when specified port is unavailable.
|
||||
if !self.port_available_edit {
|
||||
@@ -389,6 +380,7 @@ impl P2PSetup {
|
||||
};
|
||||
View::button(ui, add_text, Colors::BUTTON, || {
|
||||
// Setup values for modal.
|
||||
self.is_correct_address_edit = true;
|
||||
self.peer_edit = "".to_string();
|
||||
// Select modal id.
|
||||
let modal_id = match peer_type {
|
||||
@@ -425,50 +417,19 @@ impl P2PSetup {
|
||||
};
|
||||
ui.label(RichText::new(label_text).size(17.0).color(Colors::GRAY));
|
||||
ui.add_space(8.0);
|
||||
StripBuilder::new(ui)
|
||||
.size(Size::exact(42.0))
|
||||
.vertical(|mut strip| {
|
||||
strip.strip(|builder| {
|
||||
builder
|
||||
.size(Size::remainder())
|
||||
.size(Size::exact(48.0))
|
||||
.horizontal(|mut strip| {
|
||||
strip.cell(|ui| {
|
||||
ui.add_space(2.0);
|
||||
// Draw peer address text edit.
|
||||
let text_edit = egui::TextEdit::singleline(&mut self.peer_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Button)
|
||||
.desired_width(ui.available_width())
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit.request_focus();
|
||||
if text_edit.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
});
|
||||
strip.cell(|ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
// Draw paste button.
|
||||
let paste_icon = CLIPBOARD_TEXT.to_string();
|
||||
View::button(ui, paste_icon, Colors::WHITE, || {
|
||||
self.peer_edit = cb.get_string_from_buffer();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
// Draw peer address text edit.
|
||||
let peer_text_edit_opts = TextEditOptions::new(Id::from(modal.id)).paste();
|
||||
View::text_edit(ui, cb, &mut self.peer_edit, peer_text_edit_opts);
|
||||
|
||||
// Show error when specified address is incorrect.
|
||||
if !self.is_correct_address_edit {
|
||||
ui.add_space(10.0);
|
||||
ui.label(RichText::new(t!("network_settings.peer_address_error"))
|
||||
.size(16.0)
|
||||
.color(Colors::RED));
|
||||
ui.add_space(6.0);
|
||||
}
|
||||
|
||||
ui.add_space(4.0);
|
||||
ui.add_space(12.0);
|
||||
|
||||
// Show modal buttons.
|
||||
ui.scope(|ui| {
|
||||
@@ -572,16 +533,8 @@ impl P2PSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw ban window text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.ban_window_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(84.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let text_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.ban_window_edit, text_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.ban_window_edit.parse::<i64>().is_err() {
|
||||
@@ -658,16 +611,8 @@ impl P2PSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw maximum number of inbound peers text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.max_inbound_count)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(42.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let text_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.max_inbound_count, text_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.max_inbound_count.parse::<u32>().is_err() {
|
||||
@@ -744,16 +689,8 @@ impl P2PSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw maximum number of outbound peers text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.max_outbound_count)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(42.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let text_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.max_outbound_count, text_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.max_outbound_count.parse::<u32>().is_err() {
|
||||
@@ -834,16 +771,8 @@ impl P2PSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw maximum number of outbound peers text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.min_outbound_count)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(42.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let text_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.min_outbound_count, text_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.min_outbound_count.parse::<u32>().is_err() {
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Id, RichText, TextStyle, Widget};
|
||||
use egui::{Id, RichText};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{BEZIER_CURVE, BOUNDING_BOX, CHART_SCATTER, CIRCLES_THREE, CLOCK_COUNTDOWN, HAND_COINS};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition, TextEditOptions};
|
||||
use crate::node::NodeConfig;
|
||||
|
||||
/// Memory pool setup section content.
|
||||
@@ -169,16 +169,8 @@ impl PoolSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw fee base text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.fee_base_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(84.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let fee_base_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.fee_base_edit, fee_base_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.fee_base_edit.parse::<u64>().is_err() {
|
||||
@@ -254,16 +246,8 @@ impl PoolSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw reorg period text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.reorg_period_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(42.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let reorg_period_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.reorg_period_edit, reorg_period_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.reorg_period_edit.parse::<u32>().is_err() {
|
||||
@@ -339,16 +323,8 @@ impl PoolSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw pool size text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.pool_size_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(72.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let pool_size_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.pool_size_edit, pool_size_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.pool_size_edit.parse::<usize>().is_err() {
|
||||
@@ -424,16 +400,8 @@ impl PoolSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw stempool size text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.stempool_size_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(72.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let stem_pool_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.stempool_size_edit, stem_pool_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.stempool_size_edit.parse::<usize>().is_err() {
|
||||
@@ -509,16 +477,8 @@ impl PoolSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw tx weight text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.max_weight_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(72.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let mac_weight_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.max_weight_edit, mac_weight_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.max_weight_edit.parse::<u64>().is_err() {
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use egui::{Id, RichText, TextStyle, Widget};
|
||||
use egui::{Id, RichText};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{BARBELL, HARD_DRIVES, PLUG, POWER, TIMER};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
use crate::gui::views::{Modal, View};
|
||||
use crate::gui::views::network::settings::NetworkSettings;
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition};
|
||||
use crate::gui::views::types::{ModalContainer, ModalPosition, TextEditOptions};
|
||||
use crate::node::{Node, NodeConfig};
|
||||
|
||||
/// Stratum server setup section content.
|
||||
@@ -224,16 +224,8 @@ impl StratumSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw stratum port text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.stratum_port_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(64.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let text_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.stratum_port_edit, text_edit_opts);
|
||||
|
||||
// Show error when specified port is unavailable.
|
||||
if !self.stratum_port_available_edit {
|
||||
@@ -327,16 +319,8 @@ impl StratumSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw attempt time text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.attempt_time_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(42.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let text_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.attempt_time_edit, text_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.attempt_time_edit.parse::<u32>().is_err() {
|
||||
@@ -413,16 +397,8 @@ impl StratumSetup {
|
||||
ui.add_space(8.0);
|
||||
|
||||
// Draw share difficulty text edit.
|
||||
let text_edit_resp = egui::TextEdit::singleline(&mut self.min_share_diff_edit)
|
||||
.id(Id::from(modal.id))
|
||||
.font(TextStyle::Heading)
|
||||
.desired_width(42.0)
|
||||
.cursor_at_end(true)
|
||||
.ui(ui);
|
||||
text_edit_resp.request_focus();
|
||||
if text_edit_resp.clicked() {
|
||||
cb.show_keyboard();
|
||||
}
|
||||
let text_edit_opts = TextEditOptions::new(Id::from(modal.id)).h_center();
|
||||
View::text_edit(ui, cb, &mut self.min_share_diff_edit, text_edit_opts);
|
||||
|
||||
// Show error when specified value is not valid or reminder to restart enabled node.
|
||||
if self.min_share_diff_edit.parse::<u64>().is_err() {
|
||||
|
||||
Reference in New Issue
Block a user