mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-03 06:38:52 +00:00
feat!: use more new adw 1.4 widgets
This commit is contained in:
parent
376c7ce01f
commit
f4b317251a
5 changed files with 100 additions and 117 deletions
|
@ -53,82 +53,83 @@ impl SimpleComponent for BuildWindow {
|
||||||
set_modal: true,
|
set_modal: true,
|
||||||
set_default_size: (520, 400),
|
set_default_size: (520, 400),
|
||||||
set_hide_on_close: true,
|
set_hide_on_close: true,
|
||||||
gtk::Box {
|
adw::ToolbarView {
|
||||||
|
set_top_bar_style: adw::ToolbarStyle::Flat,
|
||||||
|
set_bottom_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_vexpand: true,
|
set_vexpand: true,
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
add_top_bar: top_bar = &adw::HeaderBar {
|
||||||
set_spacing: 12,
|
set_show_end_title_buttons: false,
|
||||||
gtk::WindowHandle {
|
set_show_start_title_buttons: false,
|
||||||
set_vexpand: false,
|
#[wrap(Some)]
|
||||||
set_hexpand: true,
|
set_title_widget: title_label = &adw::WindowTitle {
|
||||||
adw::HeaderBar {
|
#[track = "model.changed(BuildWindow::title())"]
|
||||||
set_show_end_title_buttons: false,
|
set_title: &model.title,
|
||||||
set_show_start_title_buttons: false,
|
|
||||||
add_css_class: "flat",
|
|
||||||
#[wrap(Some)]
|
|
||||||
set_title_widget: title_label = >k::Label {
|
|
||||||
#[track = "model.changed(BuildWindow::title())"]
|
|
||||||
set_markup: &model.title,
|
|
||||||
add_css_class: "title",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
gtk::Box {
|
|
||||||
set_orientation: gtk::Orientation::Horizontal,
|
|
||||||
set_hexpand: true,
|
|
||||||
set_halign: gtk::Align::Center,
|
|
||||||
set_spacing: 12,
|
|
||||||
#[name(build_status_label)]
|
|
||||||
gtk::Label {
|
|
||||||
#[track = "model.changed(BuildWindow::build_status())"]
|
|
||||||
set_markup: match &model.build_status {
|
|
||||||
BuildStatus::Building => "Build in progress...".to_string(),
|
|
||||||
BuildStatus::Done => "Build done, you can close this window".to_string(),
|
|
||||||
BuildStatus::Error(code) => {
|
|
||||||
format!("Build failed: \"{c}\"", c = code)
|
|
||||||
}
|
|
||||||
}.as_str(),
|
|
||||||
add_css_class: "title-2",
|
|
||||||
set_wrap: true,
|
|
||||||
set_wrap_mode: gtk::pango::WrapMode::Word,
|
|
||||||
set_justify: gtk::Justification::Center,
|
|
||||||
},
|
|
||||||
gtk::Button {
|
|
||||||
#[track = "model.changed(BuildWindow::build_status())"]
|
|
||||||
set_visible: match &model.build_status {
|
|
||||||
BuildStatus::Building => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
add_css_class: "destructive-action",
|
|
||||||
add_css_class: "circular",
|
|
||||||
set_icon_name: "window-close-symbolic",
|
|
||||||
set_tooltip_text: Some("Cancel build"),
|
|
||||||
connect_clicked[sender] => move |_| {
|
|
||||||
sender.output(Self::Output::CancelBuild);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
#[name(scrolledwin)]
|
#[wrap(Some)]
|
||||||
gtk::ScrolledWindow {
|
set_content: content = >k::Box {
|
||||||
set_hexpand: true,
|
set_orientation: gtk::Orientation::Vertical,
|
||||||
set_vexpand: true,
|
set_vexpand: true,
|
||||||
|
set_hexpand: true,
|
||||||
set_margin_all: 12,
|
set_margin_all: 12,
|
||||||
add_css_class: "card",
|
gtk::Box {
|
||||||
set_overflow: gtk::Overflow::Hidden,
|
set_orientation: gtk::Orientation::Horizontal,
|
||||||
#[name(textview)]
|
set_hexpand: true,
|
||||||
gtk::TextView {
|
set_halign: gtk::Align::Center,
|
||||||
|
set_spacing: 12,
|
||||||
|
#[name(build_status_label)]
|
||||||
|
gtk::Label {
|
||||||
|
#[track = "model.changed(BuildWindow::build_status())"]
|
||||||
|
set_markup: match &model.build_status {
|
||||||
|
BuildStatus::Building => "Build in progress...".to_string(),
|
||||||
|
BuildStatus::Done => "Build done, you can close this window".to_string(),
|
||||||
|
BuildStatus::Error(code) => {
|
||||||
|
format!("Build failed: \"{c}\"", c = code)
|
||||||
|
}
|
||||||
|
}.as_str(),
|
||||||
|
add_css_class: "title-2",
|
||||||
|
set_wrap: true,
|
||||||
|
set_wrap_mode: gtk::pango::WrapMode::Word,
|
||||||
|
set_justify: gtk::Justification::Center,
|
||||||
|
},
|
||||||
|
gtk::Button {
|
||||||
|
#[track = "model.changed(BuildWindow::build_status())"]
|
||||||
|
set_visible: match &model.build_status {
|
||||||
|
BuildStatus::Building => true,
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
|
add_css_class: "destructive-action",
|
||||||
|
add_css_class: "circular",
|
||||||
|
set_icon_name: "window-close-symbolic",
|
||||||
|
set_tooltip_text: Some("Cancel build"),
|
||||||
|
connect_clicked[sender] => move |_| {
|
||||||
|
sender.output(Self::Output::CancelBuild);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
#[name(scrolledwin)]
|
||||||
|
gtk::ScrolledWindow {
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
set_vexpand: true,
|
set_vexpand: true,
|
||||||
set_editable: false,
|
set_margin_all: 12,
|
||||||
set_monospace: true,
|
add_css_class: "card",
|
||||||
set_left_margin: 6,
|
set_overflow: gtk::Overflow::Hidden,
|
||||||
set_right_margin: 6,
|
#[name(textview)]
|
||||||
set_top_margin: 6,
|
gtk::TextView {
|
||||||
set_bottom_margin: 6,
|
set_hexpand: true,
|
||||||
set_buffer: Some(&model.textbuf),
|
set_vexpand: true,
|
||||||
|
set_editable: false,
|
||||||
|
set_monospace: true,
|
||||||
|
set_left_margin: 6,
|
||||||
|
set_right_margin: 6,
|
||||||
|
set_top_margin: 6,
|
||||||
|
set_bottom_margin: 6,
|
||||||
|
set_buffer: Some(&model.textbuf),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
gtk::Button {
|
add_bottom_bar: bottom_bar = >k::Button {
|
||||||
add_css_class: "pill",
|
add_css_class: "pill",
|
||||||
set_halign: gtk::Align::Center,
|
set_halign: gtk::Align::Center,
|
||||||
set_label: "Close",
|
set_label: "Close",
|
||||||
|
|
|
@ -7,10 +7,7 @@ use crate::{
|
||||||
withclones,
|
withclones,
|
||||||
};
|
};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use relm4::{
|
use relm4::{factory::AsyncFactoryVecDeque, prelude::*};
|
||||||
factory::{AsyncFactoryVecDeque, FactoryVecDeque},
|
|
||||||
prelude::*,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[tracker::track]
|
#[tracker::track]
|
||||||
pub struct FbtConfigEditor {
|
pub struct FbtConfigEditor {
|
||||||
|
@ -50,23 +47,16 @@ impl SimpleComponent for FbtConfigEditor {
|
||||||
set_transient_for: Some(&init.root_win),
|
set_transient_for: Some(&init.root_win),
|
||||||
set_default_height: 500,
|
set_default_height: 500,
|
||||||
set_default_width: 600,
|
set_default_width: 600,
|
||||||
gtk::Box {
|
adw::ToolbarView {
|
||||||
set_vexpand: true,
|
set_top_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_hexpand: true,
|
add_top_bar: headerbar = &adw::HeaderBar {
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
|
||||||
gtk::WindowHandle {
|
|
||||||
set_vexpand: false,
|
set_vexpand: false,
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
#[name(headerbar)]
|
add_css_class: "flat",
|
||||||
adw::HeaderBar {
|
pack_start: &add_btn,
|
||||||
set_vexpand: false,
|
pack_end: &save_btn,
|
||||||
set_hexpand: true,
|
|
||||||
add_css_class: "flat",
|
|
||||||
pack_start: &add_btn,
|
|
||||||
pack_end: &save_btn,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
append: model.tracker_role_groups.widget(),
|
set_content: Some(&model.tracker_role_groups.widget().clone().upcast::<gtk::Widget>()),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,24 +97,18 @@ impl SimpleComponent for LibsurviveSetupWindow {
|
||||||
set_modal: true,
|
set_modal: true,
|
||||||
set_default_size: (520, 400),
|
set_default_size: (520, 400),
|
||||||
set_hide_on_close: true,
|
set_hide_on_close: true,
|
||||||
gtk::Box {
|
adw::ToolbarView {
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
set_top_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_hexpand: true,
|
set_bottom_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_vexpand: true,
|
add_top_bar: top_bar = &adw::HeaderBar {
|
||||||
set_spacing: 12,
|
add_css_class: "flat",
|
||||||
set_margin_all: 12,
|
#[wrap(Some)]
|
||||||
gtk::WindowHandle {
|
set_title_widget: title_label = &adw::WindowTitle {
|
||||||
adw::HeaderBar {
|
set_title: "Setup Lighthouses",
|
||||||
add_css_class: "flat",
|
},
|
||||||
#[wrap(Some)]
|
|
||||||
set_title_widget: title_label = >k::Label {
|
|
||||||
set_label: "Setup Lighthouses",
|
|
||||||
add_css_class: "title",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
#[name(carousel)]
|
#[wrap(Some)]
|
||||||
adw::Carousel {
|
set_content: carousel = &adw::Carousel {
|
||||||
set_allow_long_swipes: false,
|
set_allow_long_swipes: false,
|
||||||
set_allow_scroll_wheel: false,
|
set_allow_scroll_wheel: false,
|
||||||
set_allow_mouse_drag: false,
|
set_allow_mouse_drag: false,
|
||||||
|
@ -344,7 +338,9 @@ impl SimpleComponent for LibsurviveSetupWindow {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
adw::CarouselIndicatorDots {
|
add_bottom_bar: dots = &adw::CarouselIndicatorDots {
|
||||||
|
set_margin_top: 12,
|
||||||
|
set_margin_bottom: 12,
|
||||||
set_carousel: Some(&carousel),
|
set_carousel: Some(&carousel),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,8 @@ pub fn path_row<F: Fn(Option<String>) + 'static + Clone>(
|
||||||
.title(title)
|
.title(title)
|
||||||
.subtitle_lines(0)
|
.subtitle_lines(0)
|
||||||
.activatable(true)
|
.activatable(true)
|
||||||
.icon_name(GString::from("folder-open-symbolic"))
|
|
||||||
.build();
|
.build();
|
||||||
|
row.add_prefix(>k::Image::from_icon_name("folder-open-symbolic"));
|
||||||
|
|
||||||
if let Some(d) = description {
|
if let Some(d) = description {
|
||||||
row.set_subtitle(d);
|
row.set_subtitle(d);
|
||||||
|
|
|
@ -55,26 +55,22 @@ impl SimpleComponent for ProfileEditor {
|
||||||
set_title: Some(model.profile.borrow().name.as_str()),
|
set_title: Some(model.profile.borrow().name.as_str()),
|
||||||
set_default_height: 500,
|
set_default_height: 500,
|
||||||
set_default_width: 600,
|
set_default_width: 600,
|
||||||
gtk::Box {
|
adw::ToolbarView {
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
set_top_bar_style: adw::ToolbarStyle::Flat,
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
set_vexpand: true,
|
set_vexpand: true,
|
||||||
gtk::WindowHandle {
|
add_top_bar: top_bar = &adw::HeaderBar {
|
||||||
set_hexpand: true,
|
|
||||||
set_vexpand: false,
|
set_vexpand: false,
|
||||||
adw::HeaderBar {
|
pack_end: save_btn = >k::Button {
|
||||||
set_vexpand: false,
|
set_label: "Save",
|
||||||
add_css_class: "flat",
|
add_css_class: "suggested-action",
|
||||||
pack_end: save_btn = >k::Button {
|
connect_clicked[sender] => move |_| {
|
||||||
set_label: "Save",
|
sender.input(Self::Input::SaveProfile);
|
||||||
add_css_class: "suggested-action",
|
|
||||||
connect_clicked[sender] => move |_| {
|
|
||||||
sender.input(Self::Input::SaveProfile);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
adw::PreferencesPage {
|
#[wrap(Some)]
|
||||||
|
set_content: pref_page = &adw::PreferencesPage {
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
set_vexpand: true,
|
set_vexpand: true,
|
||||||
add: maingrp = &adw::PreferencesGroup {
|
add: maingrp = &adw::PreferencesGroup {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue