From c8105608ef8e45b3c7cd230ea25082a7eb6a4507 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Fri, 14 Mar 2025 23:41:36 +0900 Subject: [PATCH 1/4] Initial work for keyboard shortcuts window --- .gitignore | 1 + README.md | 1 + .../com.github.ryonakano.reco.Devel.yml | 13 ++++++++ .../com.github.ryonakano.reco.Devel.yml | 13 ++++++++ com.github.ryonakano.reco.yml | 13 ++++++++ data/meson.build | 15 +++++++++ data/reco.gresource.xml | 3 ++ data/ui/help-overlay.blp | 32 +++++++++++++++++++ src/MainWindow.vala | 1 + subprojects/blueprint-compiler.wrap | 8 +++++ 10 files changed, 100 insertions(+) create mode 100644 data/ui/help-overlay.blp create mode 100644 subprojects/blueprint-compiler.wrap diff --git a/.gitignore b/.gitignore index cb86cc1..9a947b1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ builddir* # subprojects subprojects/live-chart subprojects/ryokucha +subprojects/blueprint-compiler diff --git a/README.md b/README.md index ce221d7..532b899 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ flatpak run com.github.ryonakano.reco.Devel ### From Source Code (Native) You'll need the following dependencies to build: +* blueprint-compiler * libadwaita-1-dev * libgee-0.8-dev * libglib2.0-dev (>= 2.74) diff --git a/build-aux/appcenter/com.github.ryonakano.reco.Devel.yml b/build-aux/appcenter/com.github.ryonakano.reco.Devel.yml index d7ae953..ef9dcf0 100644 --- a/build-aux/appcenter/com.github.ryonakano.reco.Devel.yml +++ b/build-aux/appcenter/com.github.ryonakano.reco.Devel.yml @@ -44,6 +44,19 @@ modules: type: git tag-pattern: '^([\d.]+)$' + - name: blueprint-compiler + buildsystem: meson + cleanup: + - '*' + sources: + - type: git + url: https://gitlab.gnome.org/jwestman/blueprint-compiler.git + tag: v0.16.0 + commit: 04ef0944db56ab01307a29aaa7303df6067cb3c0 + x-checker-data: + type: git + tag-pattern: ^v([\d.]+)$ + - name: reco buildsystem: meson config-opts: diff --git a/build-aux/flathub/com.github.ryonakano.reco.Devel.yml b/build-aux/flathub/com.github.ryonakano.reco.Devel.yml index c633416..c3ed6fb 100644 --- a/build-aux/flathub/com.github.ryonakano.reco.Devel.yml +++ b/build-aux/flathub/com.github.ryonakano.reco.Devel.yml @@ -44,6 +44,19 @@ modules: type: git tag-pattern: '^([\d.]+)$' + - name: blueprint-compiler + buildsystem: meson + cleanup: + - '*' + sources: + - type: git + url: https://gitlab.gnome.org/jwestman/blueprint-compiler.git + tag: v0.16.0 + commit: 04ef0944db56ab01307a29aaa7303df6067cb3c0 + x-checker-data: + type: git + tag-pattern: ^v([\d.]+)$ + - name: reco buildsystem: meson config-opts: diff --git a/com.github.ryonakano.reco.yml b/com.github.ryonakano.reco.yml index 2b58e3f..c4a6149 100644 --- a/com.github.ryonakano.reco.yml +++ b/com.github.ryonakano.reco.yml @@ -45,6 +45,19 @@ modules: type: git tag-pattern: '^([\d.]+)$' + - name: blueprint-compiler + buildsystem: meson + cleanup: + - '*' + sources: + - type: git + url: https://gitlab.gnome.org/jwestman/blueprint-compiler.git + tag: v0.16.0 + commit: 04ef0944db56ab01307a29aaa7303df6067cb3c0 + x-checker-data: + type: git + tag-pattern: ^v([\d.]+)$ + - name: reco buildsystem: meson config-opts: diff --git a/data/meson.build b/data/meson.build index 57009c4..d244fe8 100644 --- a/data/meson.build +++ b/data/meson.build @@ -59,9 +59,24 @@ install_data( install_dir: get_option('datadir') / 'glib-2.0' / 'schemas' ) +blueprints = custom_target('blueprints', + input: files( + 'ui/help-overlay.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@' + ] +) + asresources = gnome.compile_resources( 'as-resources', 'reco.gresource.xml', + dependencies: blueprints, source_dir: 'data', c_name: 'as' ) diff --git a/data/reco.gresource.xml b/data/reco.gresource.xml index 7170698..1a0e334 100644 --- a/data/reco.gresource.xml +++ b/data/reco.gresource.xml @@ -2,7 +2,10 @@ Application.css + + ui/help-overlay.ui + icons/record-completed-symbolic.svg diff --git a/data/ui/help-overlay.blp b/data/ui/help-overlay.blp new file mode 100644 index 0000000..8bcacb9 --- /dev/null +++ b/data/ui/help-overlay.blp @@ -0,0 +1,32 @@ +using Gtk 4.0; + +ShortcutsWindow help_overlay { + modal: true; + + ShortcutsSection { + section-name: "shortcuts"; + + ShortcutsGroup { + title: C_("shortcut window", "General"); + + ShortcutsShortcut { + title: C_("shortcut window", "Keyboard Shortcuts"); + action-name: "win.show-help-overlay"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Quit"); + action-name: "app.quit"; + } + } + + ShortcutsGroup { + title: C_("shortcut window", "Recording"); + + ShortcutsShortcut { + title: C_("shortcut window", "Toggle recording"); + accelerator: "R"; + } + } + } +} diff --git a/src/MainWindow.vala b/src/MainWindow.vala index d0b6823..3777936 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -35,6 +35,7 @@ public class MainWindow : Adw.ApplicationWindow { var main_menu = new Menu (); main_menu.append_submenu (_("_Style"), style_submenu); + main_menu.append (_("_Keyboard Shortcuts"), "win.show-help-overlay"); var menu_button = new Gtk.MenuButton () { tooltip_text = _("Main Menu"), diff --git a/subprojects/blueprint-compiler.wrap b/subprojects/blueprint-compiler.wrap new file mode 100644 index 0000000..05c2c3c --- /dev/null +++ b/subprojects/blueprint-compiler.wrap @@ -0,0 +1,8 @@ +[wrap-git] +directory = blueprint-compiler +url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git +revision = v0.16.0 +depth = 1 + +[provide] +program_names = blueprint-compiler From b93b3838491a1d4543978ddefdbc629d91b4b6e6 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sun, 16 Mar 2025 14:17:37 +0900 Subject: [PATCH 2/4] Use 4 spaces for indendation --- data/ui/help-overlay.blp | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/data/ui/help-overlay.blp b/data/ui/help-overlay.blp index 8bcacb9..30a37ba 100644 --- a/data/ui/help-overlay.blp +++ b/data/ui/help-overlay.blp @@ -1,32 +1,32 @@ using Gtk 4.0; ShortcutsWindow help_overlay { - modal: true; + modal: true; - ShortcutsSection { - section-name: "shortcuts"; + ShortcutsSection { + section-name: "shortcuts"; - ShortcutsGroup { - title: C_("shortcut window", "General"); + ShortcutsGroup { + title: C_("shortcut window", "General"); - ShortcutsShortcut { - title: C_("shortcut window", "Keyboard Shortcuts"); - action-name: "win.show-help-overlay"; - } + ShortcutsShortcut { + title: C_("shortcut window", "Keyboard Shortcuts"); + action-name: "win.show-help-overlay"; + } - ShortcutsShortcut { - title: C_("shortcut window", "Quit"); - action-name: "app.quit"; - } - } + ShortcutsShortcut { + title: C_("shortcut window", "Quit"); + action-name: "app.quit"; + } + } - ShortcutsGroup { - title: C_("shortcut window", "Recording"); + ShortcutsGroup { + title: C_("shortcut window", "Recording"); - ShortcutsShortcut { - title: C_("shortcut window", "Toggle recording"); - accelerator: "R"; - } + ShortcutsShortcut { + title: C_("shortcut window", "Toggle recording"); + accelerator: "R"; + } + } } - } } From 8b3318c746d5ae8e6d7c9e6d7e3ae2d73d8ebc15 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sun, 16 Mar 2025 14:18:13 +0900 Subject: [PATCH 3/4] Explicit start/stop --- data/ui/help-overlay.blp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/ui/help-overlay.blp b/data/ui/help-overlay.blp index 30a37ba..e6748bc 100644 --- a/data/ui/help-overlay.blp +++ b/data/ui/help-overlay.blp @@ -24,7 +24,7 @@ ShortcutsWindow help_overlay { title: C_("shortcut window", "Recording"); ShortcutsShortcut { - title: C_("shortcut window", "Toggle recording"); + title: C_("shortcut window", "Start/Stop recording"); accelerator: "R"; } } From badd9c0c7ecf20b645c2bd65b85ae116226ad1ab Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sun, 16 Mar 2025 14:20:59 +0900 Subject: [PATCH 4/4] Remove shortcuts in tooltip in favor of Keyboard Shortcuts window --- src/View/RecordView.vala | 4 ---- src/View/WelcomeView.vala | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/View/RecordView.vala b/src/View/RecordView.vala index d1d797c..c8e559a 100644 --- a/src/View/RecordView.vala +++ b/src/View/RecordView.vala @@ -54,11 +54,7 @@ public class View.RecordView : AbstractView { stop_button = new Gtk.Button () { icon_name = "media-playback-stop-symbolic", -#if USE_GRANITE - tooltip_markup = Granite.markup_accel_tooltip ({"R"}, _("Finish recording")), -#else tooltip_text = _("Finish recording"), -#endif halign = Gtk.Align.CENTER, width_request = 48, height_request = 48 diff --git a/src/View/WelcomeView.vala b/src/View/WelcomeView.vala index a9dcd81..5c85a55 100644 --- a/src/View/WelcomeView.vala +++ b/src/View/WelcomeView.vala @@ -153,11 +153,7 @@ public class View.WelcomeView : AbstractView { record_button = new Gtk.Button () { icon_name = "audio-input-microphone-symbolic", -#if USE_GRANITE - tooltip_markup = Granite.markup_accel_tooltip ({"R"}, _("Start recording")), -#else tooltip_text = _("Start recording"), -#endif halign = Gtk.Align.CENTER, margin_top = 12, width_request = 48,