mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-16 01:18:50 +00:00
added the base for the settings page
This commit is contained in:
parent
ce50bf00e4
commit
1a6bb86cb5
@ -38,6 +38,7 @@ struct MainWindow {
|
||||
game_state: GameState,
|
||||
setup_page: AsyncController<pages::steps::SetupPage>,
|
||||
game_page: AsyncController<pages::game::GamePage>,
|
||||
settings_page: AsyncConnector<pages::settings::SettingsPage>,
|
||||
about_page: AsyncConnector<pages::about::AboutPage>,
|
||||
current_page: Pages,
|
||||
is_menu_visible: bool,
|
||||
@ -55,10 +56,13 @@ impl MainWindow {
|
||||
|
||||
let about_page = pages::about::AboutPage::builder().launch(());
|
||||
|
||||
let settings_page = pages::settings::SettingsPage::builder().launch(());
|
||||
|
||||
MainWindow {
|
||||
game_state,
|
||||
setup_page,
|
||||
game_page,
|
||||
settings_page,
|
||||
about_page,
|
||||
current_page: Pages::GamePage,
|
||||
is_menu_visible: false,
|
||||
@ -69,6 +73,7 @@ impl MainWindow {
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
enum Pages {
|
||||
GamePage,
|
||||
SettingsPage,
|
||||
AboutPage,
|
||||
}
|
||||
|
||||
@ -129,6 +134,16 @@ impl SimpleAsyncComponent for MainWindow {
|
||||
model.game_page.widget(),
|
||||
},
|
||||
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
set_vexpand: true,
|
||||
|
||||
#[watch]
|
||||
set_visible: model.current_page == Pages::SettingsPage,
|
||||
|
||||
model.settings_page.widget(),
|
||||
},
|
||||
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
set_vexpand: true,
|
||||
@ -183,7 +198,7 @@ impl SimpleAsyncComponent for MainWindow {
|
||||
set_margin_vertical: 5,
|
||||
set_label: "Settings",
|
||||
|
||||
connect_clicked => MainWindowMsg::SelectPage(Pages::GamePage),
|
||||
connect_clicked => MainWindowMsg::SelectPage(Pages::SettingsPage),
|
||||
},
|
||||
|
||||
gtk::Button {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
pub mod about;
|
||||
pub mod game;
|
||||
pub mod settings;
|
||||
pub mod steps;
|
||||
|
||||
44
babylonia-terminal-gui/src/ui/pages/settings.rs
Normal file
44
babylonia-terminal-gui/src/ui/pages/settings.rs
Normal file
@ -0,0 +1,44 @@
|
||||
use relm4::{
|
||||
gtk::prelude::{OrientableExt, WidgetExt},
|
||||
prelude::{gtk, AsyncComponentParts, SimpleAsyncComponent},
|
||||
};
|
||||
|
||||
pub struct SettingsPage;
|
||||
|
||||
#[relm4::component(pub, async)]
|
||||
impl SimpleAsyncComponent for SettingsPage {
|
||||
type Input = ();
|
||||
|
||||
type Output = ();
|
||||
|
||||
type Init = ();
|
||||
|
||||
view! {
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
|
||||
gtk::Label {
|
||||
set_label: "This page is under construction!",
|
||||
add_css_class: "title-1",
|
||||
},
|
||||
|
||||
gtk::Label {
|
||||
set_margin_top: 24,
|
||||
|
||||
set_label: "Please wait patiently :)",
|
||||
add_css_class: "title-4",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
async fn init(
|
||||
_: Self::Init,
|
||||
root: Self::Root,
|
||||
sender: relm4::AsyncComponentSender<Self>,
|
||||
) -> relm4::prelude::AsyncComponentParts<Self> {
|
||||
let model = SettingsPage {};
|
||||
let widgets = view_output!();
|
||||
|
||||
AsyncComponentParts { model, widgets }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user