From b01e2489715881661618f51ec2de03c507b26be4 Mon Sep 17 00:00:00 2001 From: leca Date: Tue, 2 Apr 2024 02:35:52 +0300 Subject: [PATCH] implemented labled switch --- resources/guessing/setup/ui.xml | 19 +++++++++++++++++-- .../widgets/labled_switch/template.ui.xml | 4 +--- src/labled_switch/imp.rs | 7 ++++++- src/ui/guessing/setup/imp.rs | 10 +++++++++- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/resources/guessing/setup/ui.xml b/resources/guessing/setup/ui.xml index 17f9098..23a59c1 100644 --- a/resources/guessing/setup/ui.xml +++ b/resources/guessing/setup/ui.xml @@ -6,8 +6,23 @@ vertical - - + + Enable hiragana? + + + + + Enable katakana? + + + + + Enable kana to romaji? + + + + + Enable romaji to kana? diff --git a/resources/widgets/labled_switch/template.ui.xml b/resources/widgets/labled_switch/template.ui.xml index 5930a6f..56a25bc 100644 --- a/resources/widgets/labled_switch/template.ui.xml +++ b/resources/widgets/labled_switch/template.ui.xml @@ -1,15 +1,13 @@ diff --git a/src/labled_switch/imp.rs b/src/labled_switch/imp.rs index c060ea1..5789865 100644 --- a/src/labled_switch/imp.rs +++ b/src/labled_switch/imp.rs @@ -25,17 +25,22 @@ impl ObjectSubclass for LabledSwitch { fn class_init(klass: &mut Self::Class) { klass.bind_template(); + klass.set_layout_manager_type::(); } fn instance_init(obj: &InitializingObject) { obj.init_template(); } } - +#[glib::derived_properties] impl ObjectImpl for LabledSwitch { fn constructed(&self) { self.parent_constructed(); + // let a = LayoutManager:: ; + + // self.obj().set_layout_manager(a); + let l: &Label = self.label_obj.as_ref(); self.obj().bind_property("label_text", l, "label").sync_create().build(); } diff --git a/src/ui/guessing/setup/imp.rs b/src/ui/guessing/setup/imp.rs index ffe87c2..9499316 100644 --- a/src/ui/guessing/setup/imp.rs +++ b/src/ui/guessing/setup/imp.rs @@ -10,7 +10,13 @@ use gtk::{glib, CompositeTemplate}; #[template(resource = "/org/foxarmy/learn-hieroglyph/guessing/setup/ui.xml")] pub struct GuessingSetupScene { #[template_child] - pub question_label: TemplateChild, + pub hiragana_enable: TemplateChild, + #[template_child] + pub katakana_enable: TemplateChild, + #[template_child] + pub ktr_enable: TemplateChild, + #[template_child] + pub rtk_enable: TemplateChild, } #[glib::object_subclass] @@ -31,6 +37,8 @@ impl ObjectSubclass for GuessingSetupScene { impl ObjectImpl for GuessingSetupScene { fn constructed(&self) { self.parent_constructed(); + + //TODO: tie switches to settings and make "start" button } }