diff --git a/Screenshot from 2024-06-24 23-13-28.png b/Screenshot from 2024-06-24 23-13-28.png deleted file mode 100644 index 8f068a8..0000000 Binary files a/Screenshot from 2024-06-24 23-13-28.png and /dev/null differ diff --git a/Screenshot from 2024-06-24 23-13-36.png b/Screenshot from 2024-06-24 23-13-36.png deleted file mode 100644 index 6bc3e6d..0000000 Binary files a/Screenshot from 2024-06-24 23-13-36.png and /dev/null differ diff --git a/Screenshot from 2024-06-24 23-13-42.png b/Screenshot from 2024-06-24 23-13-42.png deleted file mode 100644 index 6221b7d..0000000 Binary files a/Screenshot from 2024-06-24 23-13-42.png and /dev/null differ diff --git a/Screenshot from 2024-06-24 23-13-52.png b/Screenshot from 2024-06-24 23-13-52.png deleted file mode 100644 index 6aceeba..0000000 Binary files a/Screenshot from 2024-06-24 23-13-52.png and /dev/null differ diff --git a/Screenshot from 2024-07-01 21-01-00.png b/Screenshot from 2024-07-01 21-01-00.png new file mode 100644 index 0000000..9877341 Binary files /dev/null and b/Screenshot from 2024-07-01 21-01-00.png differ diff --git a/Screenshot from 2024-07-01 21-01-12.png b/Screenshot from 2024-07-01 21-01-12.png new file mode 100644 index 0000000..5b23ea1 Binary files /dev/null and b/Screenshot from 2024-07-01 21-01-12.png differ diff --git a/Screenshot from 2024-07-01 21-01-21.png b/Screenshot from 2024-07-01 21-01-21.png new file mode 100644 index 0000000..10c96cf Binary files /dev/null and b/Screenshot from 2024-07-01 21-01-21.png differ diff --git a/Screenshot from 2024-07-01 21-01-31.png b/Screenshot from 2024-07-01 21-01-31.png new file mode 100644 index 0000000..f52f078 Binary files /dev/null and b/Screenshot from 2024-07-01 21-01-31.png differ diff --git a/lib/JapaChar.pm b/lib/JapaChar.pm index 48a6574..7b89a5c 100644 --- a/lib/JapaChar.pm +++ b/lib/JapaChar.pm @@ -49,6 +49,10 @@ has _counter => ( is => 'rw', ); +has _headerbar => ( + is => 'rw', +); + sub config($class) { my $ypp = YAML::PP->new; $ypp->load_file(''.path(__FILE__)->parent->parent->child('config.yml')); @@ -87,6 +91,49 @@ sub _new_challenge_generic_code($self, $window, $type, $show, $guess) { $kana_label->set_valign('center'); $grid->attach($kana_label, 0, 0, 12, 1); $self->_window_set_child($window, $grid); + my $back_button = Gtk::Button->new_from_icon_name('go-previous-symbolic'); + $back_button->signal_connect('clicked', sub { + my $dialog = Adw::Dialog->new; + $dialog->set_content_width(460); + $dialog->set_content_height(400); + my $main_box = Gtk::Box->new('vertical', 0); + $main_box->set_vexpand(1); + my $grid = Gtk::Grid->new; + my $headerbar = Adw::HeaderBar->new; + $main_box->append($headerbar); + my $label = Gtk::Label->new('You are about to exit the lesson'); + $main_box->append($label); + $label->set_property('height_request', 250); + $label->set_valign('center'); + $label->set_halign('center'); + my $attr_list = Pango::AttrList->new; + my $size = Pango::AttrSize->new(18 * PANGO_SCALE); + $attr_list->insert($size); + $label->set_attributes($attr_list); + my $button_box = Gtk::Box->new('horizontal', 15); + $button_box->set_halign('center'); + $button_box->set_property('height_request', 50); + $button_box->set_valign('end'); + my $button_accept = Gtk::Button->new_with_label('Lose all progress'); + my $button_reject = Gtk::Button->new_with_label('Continue the lesson'); + $button_accept->signal_connect('clicked', sub { + $dialog->close; + $self->_create_main_menu($window); + }); + $button_reject->signal_connect('clicked', sub { + $dialog->close; + }); + $button_accept->set_valign('end'); + $button_reject->set_valign('end'); + $button_accept->add_css_class('destructive-action'); + $button_reject->add_css_class('suggested-action'); + $main_box->append($button_box); + $button_box->append($button_accept); + $button_box->append($button_reject); + $dialog->set_child($main_box); + $dialog->present($window); + }); + $self->_headerbar->pack_start($back_button); my $incorrect_chars = JapaChar::Characters->new->get_4_incorrect_answers($char); my @buttons; my $continue_button = Gtk::Button->new_with_label('Continue'); @@ -223,6 +270,7 @@ sub _window_set_child($self, $window, $child) { $box->append($child); $child->set_vexpand(1); $window->set_content($box); + $self->_headerbar($headerbar); } sub _application_start($self, $app) {