diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-07-16 13:23:18 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-07-16 13:59:52 +0200 |
| commit | 16d6aa1d19415ee4a782baea143c71a9a1bbe02d (patch) | |
| tree | c53d819fdf49baa4a6affaa3ef4ad59ab9c23e4e | |
| parent | 44d2614a260d2b029a79c59ee7fdd45e1958feb8 (diff) | |
| download | turns-16d6aa1d19415ee4a782baea143c71a9a1bbe02d.tar.xz turns-16d6aa1d19415ee4a782baea143c71a9a1bbe02d.zip | |
res: automatically export UI files
| -rw-r--r-- | .gitlab-ci.yml | 2 | ||||
| -rw-r--r-- | CMakeLists.txt | 3 | ||||
| -rw-r--r-- | Containerfile.ci | 11 | ||||
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | cmake/Modules/Cambalache.cmake | 28 | ||||
| -rw-r--r-- | res/.gitignore | 1 | ||||
| -rw-r--r-- | res/CMakeLists.txt | 11 | ||||
| -rw-r--r-- | res/widgets/participant_row.ui | 86 | ||||
| -rw-r--r-- | res/widgets/turn_order_view.ui | 24 | ||||
| -rw-r--r-- | res/windows/main.ui | 81 | ||||
| -rw-r--r-- | res/windows/participant_editor.ui | 73 |
11 files changed, 50 insertions, 271 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4aaede..1132bb7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ default: - image: registry.source.arknet.ch/fmorgner/turns/ci:1.1.0 + image: registry.source.arknet.ch/fmorgner/turns/ci:latest build: stage: build diff --git a/CMakeLists.txt b/CMakeLists.txt index 76b9015..3ccf083 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ enable_testing() list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules") +include("Cambalache") include("CheckIPOSupported") include("GlibCompileResources") include("GNUInstallDirs") @@ -23,7 +24,7 @@ check_ipo_supported(RESULT CAN_DO_IPO LANGUAGES CXX) set(CMAKE_CXX_STANDARD "23") set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${CAN_DO_IPO}) +set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${CAN_DO_IPO}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib") diff --git a/Containerfile.ci b/Containerfile.ci index eab8e5f..59a07f3 100644 --- a/Containerfile.ci +++ b/Containerfile.ci @@ -20,9 +20,16 @@ RUN pacman-key --init \ 'pkgconf' \ 'weston' \ && locale-gen \ - && yes | pacman -Sccdd \ && useradd -m builduser \ - && echo 'builduser ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers + && echo 'builduser ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \ + && mkdir aur && chown builduser: aur \ + && cd aur \ + && sudo -u builduser git clone 'https://aur.archlinux.org/cambalache.git' \ + && cd cambalache \ + && sudo -u builduser makepkg -irs --noconfirm --noprogressbar --needed \ + && cd ../.. \ + && rm -rf aur \ + && yes | pacman -Sccdd ENV XDG_RUNTIME_DIR=/tmp \ WAYLAND_DISPLAY=wl-test-env @@ -12,6 +12,7 @@ bookie depends on the following libraries: - `libadwaita` >= 1.5 and tools: + - `cambalache` >= 0.90.4 - `cmake` >= 3.29 - `gcc` >= 14.1 - `ninja` >= 1.11 diff --git a/cmake/Modules/Cambalache.cmake b/cmake/Modules/Cambalache.cmake new file mode 100644 index 0000000..8f83375 --- /dev/null +++ b/cmake/Modules/Cambalache.cmake @@ -0,0 +1,28 @@ +find_program(CAMBALACHE_BIN "cambalache" REQUIRED) + +function(export_cambalache_files SOURCE_FILE) + set(SINGLE_VALUE_ARGS "") + set(MULTI_VALUE_ARGS "UI_FILES") + cmake_parse_arguments( + PARSE_ARGV 1 + "" + "${OPTIONS}" + "${SINGLE_VALUE_ARGS}" + "${MULTI_VALUE_ARGS}" + ) + + foreach(FILE IN LISTS _UI_FILES) + list(APPEND ABSOULUTE_UI_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}") + endforeach() + + add_custom_command(OUTPUT + ${ABSOULUTE_UI_FILES} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND "${CAMBALACHE_BIN}" + ARGS + "-E" + "${SOURCE_FILE}" + VERBATIM + MAIN_DEPENDENCY "${SOURCE_FILE}" + ) +endfunction()
\ No newline at end of file diff --git a/res/.gitignore b/res/.gitignore new file mode 100644 index 0000000..25284c2 --- /dev/null +++ b/res/.gitignore @@ -0,0 +1 @@ +*.ui
\ No newline at end of file diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt index fda52b8..325c584 100644 --- a/res/CMakeLists.txt +++ b/res/CMakeLists.txt @@ -2,13 +2,18 @@ add_library("res") -target_add_glib_resources("res" - PREFIX "ch/arknet/Turns" - UI_FILES +set(UI_FILES "widgets/participant_row.ui" "widgets/turn_order_view.ui" "windows/main.ui" "windows/participant_editor.ui" +) + +export_cambalache_files("ui.cmb" UI_FILES ${UI_FILES}) + +target_add_glib_resources("res" + PREFIX "ch/arknet/Turns" + UI_FILES ${UI_FILES} CSS_FILES "style.css" "style-dark.css" diff --git a/res/widgets/participant_row.ui b/res/widgets/participant_row.ui deleted file mode 100644 index 7948eab..0000000 --- a/res/widgets/participant_row.ui +++ /dev/null @@ -1,86 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Created with Cambalache 0.90.4 --> -<interface> - <requires lib="gtk" version="4.14"/> - <template class="gtkmm__CustomObject_participant_row" parent="GtkListBoxRow"> - <property name="activatable">False</property> - <property name="child"> - <object class="GtkBox"> - <child> - <object class="GtkBox"> - <child> - <object class="GtkToggleButton" id="toggle_defeated"> - <property name="halign">center</property> - <property name="icon-name">face-smile-symbolic</property> - <property name="tooltip-text" translatable="yes">Mark as defeated</property> - <property name="valign">center</property> - <style> - <class name="circular"/> - </style> - </object> - </child> - <style> - <class name="prefixes"/> - </style> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="hexpand">True</property> - <property name="orientation">vertical</property> - <property name="valign">center</property> - <child> - <object class="GtkLabel" id="title"> - <property name="wrap-mode">word-char</property> - <property name="xalign">0.0</property> - <style> - <class name="title"/> - </style> - </object> - </child> - <child> - <object class="GtkLabel" id="subtitle"> - <property name="wrap-mode">word-char</property> - <property name="xalign">0.0</property> - <style> - <class name="subtitle"/> - </style> - </object> - </child> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="valign">center</property> - <child> - <object class="GtkButton" id="delete"> - <property name="icon-name">edit-delete-symbolic</property> - <property name="tooltip-text" translatable="yes">Delete participant</property> - <style> - <class name="circular"/> - <class name="destructive-action"/> - </style> - </object> - </child> - <child> - <object class="GtkButton" id="edit"> - <property name="icon-name">document-edit-symbolic</property> - <style> - <class name="circular"/> - <class name="suggested-action"/> - </style> - </object> - </child> - <style> - <class name="suffixes"/> - </style> - </object> - </child> - <style> - <class name="header"/> - </style> - </object> - </property> - <property name="valign">center</property> - </template> -</interface> diff --git a/res/widgets/turn_order_view.ui b/res/widgets/turn_order_view.ui deleted file mode 100644 index d00c3c8..0000000 --- a/res/widgets/turn_order_view.ui +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Created with Cambalache 0.90.4 --> -<interface> - <requires lib="gtk" version="4.0"/> - <requires lib="libadwaita" version="1.4"/> - <template class="gtkmm__CustomObject_turn_order_view" parent="GtkScrolledWindow"> - <property name="child"> - <object class="AdwClamp"> - <property name="child"> - <object class="GtkListBox" id="view"> - <property name="valign">start</property> - <style> - <class name="boxed-list"/> - </style> - </object> - </property> - <property name="margin-bottom">18</property> - <property name="margin-end">12</property> - <property name="margin-start">12</property> - <property name="margin-top">12</property> - </object> - </property> - </template> -</interface> diff --git a/res/windows/main.ui b/res/windows/main.ui deleted file mode 100644 index e01c8d1..0000000 --- a/res/windows/main.ui +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Created with Cambalache 0.90.4 --> -<interface> - <requires lib="gtk" version="4.14"/> - <requires lib="libadwaita" version="1.5"/> - <requires lib="gio" version="2.0"/> - <object class="AdwApplicationWindow" id="main"> - <property name="content"> - <object class="AdwToolbarView"> - <property name="content"> - <object class="GtkStack" id="stack"> - <property name="transition-type">crossfade</property> - <child> - <object class="AdwStatusPage" id="empty"> - <property name="child"> - <object class="GtkButton"> - <property name="action-name">win.add_participant</property> - <property name="halign">center</property> - <property name="label" translatable="yes">Add participant</property> - <style> - <class name="pill"/> - <class name="suggested-action"/> - </style> - </object> - </property> - <property name="icon-name">contact-new-symbolic</property> - </object> - </child> - </object> - </property> - <child type="top"> - <object class="AdwHeaderBar" id="header"> - <property name="title-widget"> - <object class="AdwWindowTitle" id="title"> - <property name="subtitle" translatable="yes">No active turn order</property> - <property name="title" translatable="yes">Turns</property> - </object> - </property> - <child type="end"> - <object class="GtkMenuButton" id="open_main_menu"> - <property name="icon-name">open-menu</property> - <property name="menu-model">main_menu</property> - <property name="tooltip-text" translatable="yes">Main Menu</property> - </object> - </child> - <child type="start"> - <object class="GtkButton" id="add_participant"> - <property name="action-name">win.add_participant</property> - <property name="icon-name">contact-new</property> - <property name="tooltip-text" translatable="yes">Add participant</property> - </object> - </child> - <child type="start"> - <object class="GtkButton" id="start"> - <property name="action-name">win.start</property> - <property name="icon-name">media-playback-start-symbolic</property> - <property name="tooltip-text" translatable="yes">Start turn order</property> - </object> - </child> - <style/> - </object> - </child> - <style/> - </object> - </property> - <property name="default-height">720</property> - <property name="default-width">360</property> - <property name="height-request">480</property> - <property name="width-request">360</property> - </object> - <menu id="main_menu"> - <item> - <attribute name="action">win.clear</attribute> - <attribute name="label" translatable="yes">_Clear</attribute> - </item> - <item> - <attribute name="action">app.quit</attribute> - <attribute name="label" translatable="yes">_Quit</attribute> - </item> - </menu> -</interface> diff --git a/res/windows/participant_editor.ui b/res/windows/participant_editor.ui deleted file mode 100644 index 3b483b4..0000000 --- a/res/windows/participant_editor.ui +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Created with Cambalache 0.90.4 --> -<interface> - <requires lib="gtk" version="4.14"/> - <requires lib="libadwaita" version="1.5"/> - <object class="AdwDialog" id="participant_editor"> - <property name="child"> - <object class="AdwToolbarView"> - <property name="content"> - <object class="AdwClamp"> - <property name="child"> - <object class="GtkBox"> - <property name="hexpand">True</property> - <property name="margin-bottom">18</property> - <property name="margin-end">12</property> - <property name="margin-start">12</property> - <property name="margin-top">18</property> - <property name="orientation">vertical</property> - <property name="spacing">18</property> - <property name="valign">start</property> - <child> - <object class="GtkListBox"> - <child> - <object class="AdwEntryRow" id="name"> - <property name="title" translatable="yes">Name</property> - </object> - </child> - <child> - <object class="AdwSpinRow" id="priority"> - <property name="adjustment"> - <object class="GtkAdjustment"> - <property name="lower">-1000.0</property> - <property name="step-increment">1.0</property> - <property name="upper">1000.0</property> - </object> - </property> - <property name="digits">1</property> - <property name="numeric">True</property> - <property name="title" translatable="yes">Priority</property> - </object> - </child> - <child> - <object class="AdwComboRow" id="disposition"> - <property name="title" translatable="yes">Disposition</property> - </object> - </child> - <style> - <class name="boxed-list"/> - </style> - </object> - </child> - <child> - <object class="GtkButton" id="finish"> - <property name="hexpand">True</property> - <property name="label" translatable="yes">Finish</property> - <style> - <class name="pill"/> - <class name="suggested-action"/> - </style> - </object> - </child> - </object> - </property> - </object> - </property> - <child type="top"> - <object class="AdwHeaderBar"/> - </child> - </object> - </property> - <property name="hexpand">True</property> - </object> -</interface> |
