aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2024-07-26 20:16:33 +0200
committerFelix Morgner <felix.morgner@gmail.com>2024-07-26 20:16:33 +0200
commit08a8362a39a7b71c087f165a1079b5439c52d35e (patch)
treedde0b54f29e0737b7cb061746c3183164c653997
parent7a093920809394f7f31b75c444fe6009d1de7005 (diff)
downloadturns-08a8362a39a7b71c087f165a1079b5439c52d35e.tar.xz
turns-08a8362a39a7b71c087f165a1079b5439c52d35e.zip
turns: perform source cleanup
-rw-r--r--.clang-format8
-rw-r--r--.clangd5
-rw-r--r--.vscode/settings.json9
-rw-r--r--adw/src/application.cpp12
-rw-r--r--adw/src/wrap_init.cpp3
-rw-r--r--app/src/main.cpp8
-rw-r--r--core/include/turns/core/fwd.hpp2
-rw-r--r--core/include/turns/core/turn_order.hpp6
-rw-r--r--core/src/disposition.cpp1
-rw-r--r--core/src/participant.cpp4
-rw-r--r--core/src/turn_order.cpp16
-rw-r--r--core/tests/disposition.cpp1
-rw-r--r--core/tests/turn_order.cpp1
-rw-r--r--lang/include/turns/lang/messages.hpp4
-rw-r--r--lang/tests/intl_test_init.cpp2
-rw-r--r--lang/tests/messages.cpp1
-rw-r--r--ui/CMakeLists.txt2
-rw-r--r--ui/include/turns/ui/init.hpp2
-rw-r--r--ui/include/turns/ui/widgets/fwd.hpp2
-rw-r--r--ui/include/turns/ui/widgets/participant_row.hpp7
-rw-r--r--ui/include/turns/ui/widgets/template_widget.hpp2
-rw-r--r--ui/include/turns/ui/widgets/turn_order_view.hpp1
-rw-r--r--ui/include/turns/ui/windows/fwd.hpp2
-rw-r--r--ui/include/turns/ui/windows/participant_editor.hpp4
-rw-r--r--ui/include/turns/ui/windows/tracker.hpp49
-rw-r--r--ui/src/init.cpp4
-rw-r--r--ui/src/widgets/participant_row.cpp22
-rw-r--r--ui/src/widgets/turn_order_view.cpp17
-rw-r--r--ui/src/windows/participant_editor.cpp18
-rw-r--r--ui/src/windows/tracker.cpp238
-rw-r--r--ui/src/windows/tracker/actions.cpp123
-rw-r--r--ui/src/windows/tracker/event_handlers.cpp100
-rw-r--r--ui/tests/gtk_test_init.cpp3
-rw-r--r--ui/tests/widgets/participant_row.cpp6
-rw-r--r--ui/tests/windows/participant_editor.cpp5
-rw-r--r--ui/tests/windows/tracker.cpp4
36 files changed, 429 insertions, 265 deletions
diff --git a/.clang-format b/.clang-format
index 71b5a95..2b98760 100644
--- a/.clang-format
+++ b/.clang-format
@@ -75,16 +75,16 @@ IncludeCategories:
- Regex: '^<sigc\+\+/[[:alnum:]_/]+\.h(pp)?'
Priority: 340
# Glibmm Headers
- - Regex: '^<glibmm/[[:alnum:]/]+\.h(pp)?'
+ - Regex: '^<glibmm/[[:alnum:]_/]+\.h(pp)?'
Priority: 350
# Giomm Headers
- - Regex: '^<giomm/[[:alnum:]/]+\.h(pp)?'
+ - Regex: '^<giomm/[[:alnum:]_/]+\.h(pp)?'
Priority: 360
# Gtk Headers
- - Regex: '^<gtkmm/[[:alnum:]/]+\.h(pp)?'
+ - Regex: '^<gtkmm/[[:alnum:]_/]+\.h(pp)?'
Priority: 370
# General System Headers
- - Regex: '^<[[:alnum:]/+-]+\.h(pp)?'
+ - Regex: '^<[[:alnum:]/+-_]+\.h(pp)?'
Priority: 400
# STL Headers
- Regex: '^<[[:alnum:]_]+>'
diff --git a/.clangd b/.clangd
new file mode 100644
index 0000000..e26469f
--- /dev/null
+++ b/.clangd
@@ -0,0 +1,5 @@
+CompileFlags:
+ Remove: [-fmodules-ts, -fdeps-format=*, -fmodule-mapper=*, -fcondition-coverage]
+Diagnostics:
+ UnusedIncludes: Strict
+ MissingIncludes: Strict \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index b1a65b9..ccee2f6 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -7,6 +7,7 @@
"cSpell.words": [
"arknet",
"gobj",
+ "klass",
"refptr",
"sigc",
"ustring",
@@ -18,12 +19,20 @@
"cSpell.language": "en,de",
+ "clangd.arguments": [
+ "--background-index",
+ "--compile-commands-dir=${workspaceFolder}/build"
+ ],
+
"cmake.configureOnOpen": true,
"cmake.ctest.testExplorerIntegrationEnabled": false,
"cmake.configureArgs": [
+ "-DCMAKE_EXPORT_COMPILE_COMMANDS=YES",
"-DCMAKE_INSTALL_PREFIX=${env:HOME}/.local",
"-DTURNS_USE_INSTALLED_TRANSLATIONS=OFF"
],
"C_Cpp.autoAddFileAssociations": false,
+ "C_Cpp.codeAnalysis.clangTidy.enabled": false,
+ "C_Cpp.intelliSenseEngine": "disabled"
} \ No newline at end of file
diff --git a/adw/src/application.cpp b/adw/src/application.cpp
index 539f7bc..e8f6253 100644
--- a/adw/src/application.cpp
+++ b/adw/src/application.cpp
@@ -4,12 +4,20 @@
#include <glibmm/class.h>
#include <glibmm/object.h>
+#include <glibmm/objectbase.h>
+#include <glibmm/refptr.h>
+#include <glibmm/ustring.h>
+#include <glibmm/utility.h>
+#include <giomm/application.h>
+
+#include <gtkmm/application.h>
#include <gtkmm/init.h>
+#include <gtkmm/private/application_p.h>
#include <adwaita.h>
-
-#include <gtkmm/private/application_p.h>
+#include <gio/gio.h>
+#include <glib-object.h>
namespace turns::adw
{
diff --git a/adw/src/wrap_init.cpp b/adw/src/wrap_init.cpp
index 42ff1cf..24bfad9 100644
--- a/adw/src/wrap_init.cpp
+++ b/adw/src/wrap_init.cpp
@@ -2,7 +2,10 @@
#include "turns/adw/application.hpp"
+#include <glibmm/wrap.h>
+
#include <adwaita.h>
+#include <glib-object.h>
namespace turns::adw
{
diff --git a/app/src/main.cpp b/app/src/main.cpp
index de35e87..83840c1 100644
--- a/app/src/main.cpp
+++ b/app/src/main.cpp
@@ -1,13 +1,17 @@
#include "turns/adw/application.hpp"
-#include "turns/adw/wrap_init.hpp"
#include "turns/core/init.hpp"
#include "turns/ui/init.hpp"
#include "turns/ui/windows/tracker.hpp"
-#include <glibmm/i18n.h>
+#include <sigc++/functors/mem_fun.h>
#include <gtkmm/builder.h>
+#include <adwaita.h>
+#include <libintl.h>
+
+#include <clocale>
+
auto main(int argc, char * argv[]) -> int
{
setlocale(LC_ALL, "");
diff --git a/core/include/turns/core/fwd.hpp b/core/include/turns/core/fwd.hpp
index deac497..1646d4b 100644
--- a/core/include/turns/core/fwd.hpp
+++ b/core/include/turns/core/fwd.hpp
@@ -9,6 +9,6 @@ namespace turns::core
struct participant;
struct turn_order;
-}
+} // namespace turns::core
#endif \ No newline at end of file
diff --git a/core/include/turns/core/turn_order.hpp b/core/include/turns/core/turn_order.hpp
index a617312..52a7268 100644
--- a/core/include/turns/core/turn_order.hpp
+++ b/core/include/turns/core/turn_order.hpp
@@ -3,6 +3,7 @@
#include "turns/core/fwd.hpp"
+#include <glibmm/object.h>
#include <glibmm/property.h>
#include <glibmm/propertyproxy.h>
#include <glibmm/refptr.h>
@@ -10,12 +11,13 @@
#include <giomm/listmodel.h>
+#include <glib-object.h>
+#include <nlohmann/json_fwd.hpp>
+
#include <limits>
#include <optional>
#include <vector>
-#include <nlohmann/json_fwd.hpp>
-
namespace turns::core
{
diff --git a/core/src/disposition.cpp b/core/src/disposition.cpp
index 4eec33e..81fb410 100644
--- a/core/src/disposition.cpp
+++ b/core/src/disposition.cpp
@@ -1,6 +1,7 @@
#include "turns/core/disposition.hpp"
#include <glibmm/i18n.h>
+#include <glibmm/ustring.h>
namespace turns::core
{
diff --git a/core/src/participant.cpp b/core/src/participant.cpp
index 6b69754..63df96e 100644
--- a/core/src/participant.cpp
+++ b/core/src/participant.cpp
@@ -1,8 +1,12 @@
#include "turns/core/participant.hpp"
+#include "turns/core/disposition.hpp"
#include "turns/core/json_ext.hpp"
+#include <glibmm/object.h>
+#include <glibmm/objectbase.h>
#include <glibmm/refptr.h>
+#include <glibmm/ustring.h>
#include <nlohmann/json.hpp>
diff --git a/core/src/turn_order.cpp b/core/src/turn_order.cpp
index 3fb25d1..e7b92db 100644
--- a/core/src/turn_order.cpp
+++ b/core/src/turn_order.cpp
@@ -1,16 +1,28 @@
#include "turns/core/turn_order.hpp"
+#include "turns/core/disposition.hpp"
#include "turns/core/json_ext.hpp"
#include "turns/core/participant.hpp"
+#include <sigc++/adaptors/bind.h>
+#include <sigc++/functors/mem_fun.h>
+
+#include <glibmm/objectbase.h>
+#include <glibmm/propertyproxy.h>
#include <glibmm/refptr.h>
+#include <glibmm/ustring.h>
+
+#include <giomm/listmodel.h>
+#include <glib-object.h>
#include <nlohmann/json.hpp>
#include <algorithm>
#include <functional>
+#include <iterator>
#include <ranges>
#include <typeinfo>
+#include <vector>
using namespace std::placeholders;
@@ -22,10 +34,6 @@ namespace turns::core
auto constexpr comparator = [](auto lhs, auto rhs) {
return *lhs > *rhs;
};
-
- auto constexpr equal_comparator = [](auto lhs, auto rhs) {
- return (lhs->get_name() == rhs->get_name()) && (lhs->get_priority() && rhs->get_priority());
- };
} // namespace
/** Construction */
diff --git a/core/tests/disposition.cpp b/core/tests/disposition.cpp
index e003f7e..fda605c 100644
--- a/core/tests/disposition.cpp
+++ b/core/tests/disposition.cpp
@@ -8,6 +8,7 @@
#include <format>
#include <limits>
+#include <type_traits>
#include <utility>
namespace turns::core::tests
diff --git a/core/tests/turn_order.cpp b/core/tests/turn_order.cpp
index 4caf174..b4958c5 100644
--- a/core/tests/turn_order.cpp
+++ b/core/tests/turn_order.cpp
@@ -1,5 +1,6 @@
#include "turns/core/turn_order.hpp"
+#include "turns/core/disposition.hpp"
#include "turns/core/participant.hpp"
#include <catch2/catch_test_macros.hpp>
diff --git a/lang/include/turns/lang/messages.hpp b/lang/include/turns/lang/messages.hpp
index 8dc9981..42de7bb 100644
--- a/lang/include/turns/lang/messages.hpp
+++ b/lang/include/turns/lang/messages.hpp
@@ -6,8 +6,8 @@ namespace turns::lang
auto constexpr static add_participant = "Add participant";
auto constexpr static cancel = "Cancel";
auto constexpr static clear = "_Clear";
- auto constexpr static disposition = "Disposition";
auto constexpr static delete_participant = "Delete participant";
+ auto constexpr static disposition = "Disposition";
auto constexpr static edit_participant = "Edit participant";
auto constexpr static end_turn_order = "End turn order";
auto constexpr static finish = "Finish";
@@ -23,10 +23,10 @@ namespace turns::lang
auto constexpr static priority_number = "Priority {}";
auto constexpr static question_clear_turn_order = "Do you want to clear the turn order?";
auto constexpr static quit = "_Quit";
+ auto constexpr static round_number = "Round {}";
auto constexpr static save = "_Save";
auto constexpr static save_as = "Save as...";
auto constexpr static saving_failed_format = "Saving failed: {}";
- auto constexpr static round_number = "Round {}";
auto constexpr static start_turn_order = "Start turn order";
auto constexpr static stop = "Stop";
auto constexpr static stop_and_clear = "Stop and clear";
diff --git a/lang/tests/intl_test_init.cpp b/lang/tests/intl_test_init.cpp
index 6a79040..5438179 100644
--- a/lang/tests/intl_test_init.cpp
+++ b/lang/tests/intl_test_init.cpp
@@ -3,6 +3,8 @@
#include <libintl.h>
+#include <clocale>
+
namespace turns::lang::tests
{
diff --git a/lang/tests/messages.cpp b/lang/tests/messages.cpp
index 7db0e53..441a831 100644
--- a/lang/tests/messages.cpp
+++ b/lang/tests/messages.cpp
@@ -5,6 +5,7 @@
#include <libintl.h>
+#include <clocale>
#include <format>
#include <string>
diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt
index fa4bc02..b0f790d 100644
--- a/ui/CMakeLists.txt
+++ b/ui/CMakeLists.txt
@@ -6,6 +6,8 @@ add_library("ui"
"src/widgets/turn_order_view.cpp"
"src/windows/participant_editor.cpp"
"src/windows/tracker.cpp"
+ "src/windows/tracker/actions.cpp"
+ "src/windows/tracker/event_handlers.cpp"
$<TARGET_OBJECTS:ui-res>
)
diff --git a/ui/include/turns/ui/init.hpp b/ui/include/turns/ui/init.hpp
index a1b1184..b872063 100644
--- a/ui/include/turns/ui/init.hpp
+++ b/ui/include/turns/ui/init.hpp
@@ -6,6 +6,6 @@ namespace turns::ui
auto register_types() -> void;
-} // namespace turns::aop
+} // namespace turns::ui
#endif \ No newline at end of file
diff --git a/ui/include/turns/ui/widgets/fwd.hpp b/ui/include/turns/ui/widgets/fwd.hpp
index 4d2ddb7..353db58 100644
--- a/ui/include/turns/ui/widgets/fwd.hpp
+++ b/ui/include/turns/ui/widgets/fwd.hpp
@@ -5,6 +5,6 @@ namespace turns::ui::widgets
{
struct participant_row;
struct turn_order_view;
-} // namespace turns::ui::windows
+} // namespace turns::ui::widgets
#endif \ No newline at end of file
diff --git a/ui/include/turns/ui/widgets/participant_row.hpp b/ui/include/turns/ui/widgets/participant_row.hpp
index e7796d3..f33da34 100644
--- a/ui/include/turns/ui/widgets/participant_row.hpp
+++ b/ui/include/turns/ui/widgets/participant_row.hpp
@@ -1,10 +1,11 @@
#ifndef TURNS_UI_WIDGETS_PARTICIPANT_ROW_HPP
#define TURNS_UI_WIDGETS_PARTICIPANT_ROW_HPP
-#include "turns/ui/widgets/template_widget.hpp"
#include "turns/core/fwd.hpp"
+#include "turns/ui/widgets/template_widget.hpp"
#include <glibmm/property.h>
+#include <glibmm/propertyproxy.h>
#include <glibmm/refptr.h>
#include <gtkmm/button.h>
@@ -28,8 +29,8 @@ namespace turns::ui::widgets
participant_row(Glib::RefPtr<core::participant> participant);
- auto property_delete_enabled() -> Glib::PropertyProxy<bool>;
- auto property_edit_enabled() -> Glib::PropertyProxy<bool>;
+ auto delete_enabled() -> Glib::PropertyProxy<bool>;
+ auto edit_enabled() -> Glib::PropertyProxy<bool>;
private:
auto handle_delete() -> void;
diff --git a/ui/include/turns/ui/widgets/template_widget.hpp b/ui/include/turns/ui/widgets/template_widget.hpp
index b3e5195..c01fff2 100644
--- a/ui/include/turns/ui/widgets/template_widget.hpp
+++ b/ui/include/turns/ui/widgets/template_widget.hpp
@@ -6,6 +6,8 @@
#include <gtkmm/widget.h>
+#include <glib-object.h>
+#include <glib.h>
#include <gtk/gtk.h>
#include <algorithm>
diff --git a/ui/include/turns/ui/widgets/turn_order_view.hpp b/ui/include/turns/ui/widgets/turn_order_view.hpp
index 6790563..a9a3654 100644
--- a/ui/include/turns/ui/widgets/turn_order_view.hpp
+++ b/ui/include/turns/ui/widgets/turn_order_view.hpp
@@ -2,6 +2,7 @@
#define TURNS_UI_WIDGETS_TURN_ORDER_VIEW_HPP
#include "turns/core/fwd.hpp"
+#include "turns/core/turn_order.hpp"
#include "turns/ui/widgets/template_widget.hpp"
#include <glibmm/object.h>
diff --git a/ui/include/turns/ui/windows/fwd.hpp b/ui/include/turns/ui/windows/fwd.hpp
index b0eb69e..f228d7b 100644
--- a/ui/include/turns/ui/windows/fwd.hpp
+++ b/ui/include/turns/ui/windows/fwd.hpp
@@ -5,6 +5,6 @@ namespace turns::ui::windows
{
struct participant_editor;
struct tracker;
-} // namespace turns::app::windows
+} // namespace turns::ui::windows
#endif \ No newline at end of file
diff --git a/ui/include/turns/ui/windows/participant_editor.hpp b/ui/include/turns/ui/windows/participant_editor.hpp
index 3ef8729..8618a0e 100644
--- a/ui/include/turns/ui/windows/participant_editor.hpp
+++ b/ui/include/turns/ui/windows/participant_editor.hpp
@@ -22,7 +22,7 @@ namespace turns::ui::windows
struct participant_editor : Gtk::Widget
{
- using signal_finished_type = sigc::signal<void (Glib::ustring, float, core::disposition)>;
+ using signal_finished_type = sigc::signal<void(Glib::ustring, float, core::disposition)>;
participant_editor(BaseObjectType * base, Glib::RefPtr<Gtk::Builder> const builder, Glib::RefPtr<core::participant> obj = {});
@@ -49,6 +49,6 @@ namespace turns::ui::windows
signal_finished_type m_signal_finished{};
};
-} // namespace turns::app::windows
+} // namespace turns::ui::windows
#endif \ No newline at end of file
diff --git a/ui/include/turns/ui/windows/tracker.hpp b/ui/include/turns/ui/windows/tracker.hpp
index f520097..03260f1 100644
--- a/ui/include/turns/ui/windows/tracker.hpp
+++ b/ui/include/turns/ui/windows/tracker.hpp
@@ -4,6 +4,7 @@
#include "turns/core/turn_order.hpp"
#include "turns/ui/widgets/turn_order_view.hpp"
+#include <glibmm/propertyproxy.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/variant.h>
@@ -19,11 +20,8 @@
#include <gtkmm/stack.h>
#include <gtkmm/widget.h>
-#include <adwaita.h>
-
-#include <optional>
+#include <exception>
#include <string>
-#include <stdexcept>
namespace turns::ui::windows
{
@@ -33,39 +31,42 @@ namespace turns::ui::windows
tracker(BaseObjectType * base, Glib::RefPtr<Gtk::Builder> const builder);
private:
- auto do_save() -> void;
-
- auto handle_add_participant() -> void;
- auto handle_delete_participant(Glib::VariantBase param) -> void;
- auto handle_edit_participant(Glib::VariantBase param) -> void;
- auto handle_open() -> void;
- auto handle_open_done(Glib::RefPtr<Gio::AsyncResult> result) -> void;
- auto handle_open_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void;
- auto handle_save(bool force_ask) -> void;
- auto handle_save_done(Glib::RefPtr<Gio::AsyncResult> result) -> void;
- auto handle_save_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void;
- auto handle_stop() -> void;
-
-
+ /** Setup */
auto setup_actions() -> void;
- auto show_error_toast(std::exception const & e) -> void;
+ /** Actions */
+ auto add_participant() -> void;
+ auto delete_participant(Glib::VariantBase param) -> void;
+ auto edit_participant(Glib::VariantBase param) -> void;
+ auto open() -> void;
+ auto save(bool force_ask) -> void;
+ auto stop() -> void;
+
+ /** Event Handlers */
+ auto on_open_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void;
+ auto on_save_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void;
+ auto on_load_content_done(Glib::RefPtr<Gio::AsyncResult> result) -> void;
+ auto on_replace_content_done(Glib::RefPtr<Gio::AsyncResult> result) -> void;
+
+ /** Helpers */
+ auto show_error(std::exception const & e) -> void;
+ auto show_toast(std::string const & message) -> void;
+ auto start_replace_content() -> void;
auto update_subtitle() -> void;
- AdwApplicationWindow * m_adw;
Gtk::Revealer * m_controls;
Gtk::Widget * m_empty;
- AdwToastOverlay * m_overlay;
+ Gtk::Widget * m_overlay;
Gtk::Stack * m_stack;
Gtk::Button * m_start;
- AdwWindowTitle * m_title;
+ Gtk::Widget * m_title;
Glib::RefPtr<core::turn_order> m_turn_order;
widgets::turn_order_view * m_turn_order_view;
Glib::PropertyProxy<Glib::ustring> m_subtitle;
- std::string m_file_tag{};
Glib::RefPtr<Gio::File> m_file{};
- std::string m_buffer{};
+ std::string m_file_etag{};
+ std::string m_file_buffer{};
};
} // namespace turns::ui::windows
diff --git a/ui/src/init.cpp b/ui/src/init.cpp
index e1b8cc3..8d48ced 100644
--- a/ui/src/init.cpp
+++ b/ui/src/init.cpp
@@ -1,4 +1,4 @@
-#include "turns/core/init.hpp"
+#include "turns/ui/init.hpp"
#include "turns/ui/widgets/participant_row.hpp"
#include "turns/ui/widgets/turn_order_view.hpp"
@@ -12,4 +12,4 @@ namespace turns::ui
static_cast<void>(widgets::turn_order_view{{}});
}
-} // namespace turns::core \ No newline at end of file
+} // namespace turns::ui \ No newline at end of file
diff --git a/ui/src/widgets/participant_row.cpp b/ui/src/widgets/participant_row.cpp
index 29e9100..305336e 100644
--- a/ui/src/widgets/participant_row.cpp
+++ b/ui/src/widgets/participant_row.cpp
@@ -3,14 +3,26 @@
#include "turns/core/disposition.hpp"
#include "turns/core/participant.hpp"
#include "turns/lang/messages.hpp"
+#include "turns/ui/widgets/template_widget.hpp"
+
+#include <sigc++/functors/mem_fun.h>
#include <glibmm/binding.h>
#include <glibmm/i18n.h>
+#include <glibmm/objectbase.h>
+#include <glibmm/propertyproxy.h>
+#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/variant.h>
+#include <gtkmm/button.h>
+#include <gtkmm/label.h>
+#include <gtkmm/listboxrow.h>
+#include <gtkmm/togglebutton.h>
+
#include <algorithm>
#include <format>
+#include <vector>
namespace turns::ui::widgets
{
@@ -64,10 +76,10 @@ namespace turns::ui::widgets
[](auto active) { return active ? "face-sick-symbolic" : "face-smile-symbolic"; });
// clang-format off
- Glib::Binding::bind_property(property_delete_enabled(),
+ Glib::Binding::bind_property(delete_enabled(),
m_delete->property_sensitive(),
Glib::Binding::Flags::SYNC_CREATE);
- Glib::Binding::bind_property(property_edit_enabled(),
+ Glib::Binding::bind_property(edit_enabled(),
m_edit->property_sensitive(),
Glib::Binding::Flags::SYNC_CREATE);
// clang-format on
@@ -108,12 +120,12 @@ namespace turns::ui::widgets
}
}
- auto participant_row::property_delete_enabled() -> Glib::PropertyProxy<bool>
+ auto participant_row::delete_enabled() -> Glib::PropertyProxy<bool>
{
return m_delete_enabled.get_proxy();
}
- auto participant_row::property_edit_enabled() -> Glib::PropertyProxy<bool>
+ auto participant_row::edit_enabled() -> Glib::PropertyProxy<bool>
{
return m_edit_enabled.get_proxy();
}
@@ -130,4 +142,4 @@ namespace turns::ui::widgets
activate_action("win.edit", index);
}
-} // namespace turns::app::widgets \ No newline at end of file
+} // namespace turns::ui::widgets \ No newline at end of file
diff --git a/ui/src/widgets/turn_order_view.cpp b/ui/src/widgets/turn_order_view.cpp
index 66042da..f3db3c4 100644
--- a/ui/src/widgets/turn_order_view.cpp
+++ b/ui/src/widgets/turn_order_view.cpp
@@ -1,12 +1,21 @@
#include "turns/ui/widgets/turn_order_view.hpp"
#include "turns/core/participant.hpp"
-#include "turns/core/turn_order.hpp"
#include "turns/ui/widgets/participant_row.hpp"
+#include "turns/ui/widgets/template_widget.hpp"
#include <sigc++/functors/mem_fun.h>
#include <glibmm/binding.h>
+#include <glibmm/object.h>
+#include <glibmm/objectbase.h>
+#include <glibmm/refptr.h>
+
+#include <gtkmm/enums.h>
+#include <gtkmm/listbox.h>
+#include <gtkmm/object.h>
+#include <gtkmm/progressbar.h>
+#include <gtkmm/widget.h>
#include <memory>
@@ -42,14 +51,14 @@ namespace turns::ui::widgets
auto row = Gtk::make_managed<widgets::participant_row>(participant);
Glib::Binding::bind_property(m_model->is_running(),
- row->property_delete_enabled(),
+ row->delete_enabled(),
Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
Glib::Binding::bind_property(m_model->is_running(),
- row->property_edit_enabled(),
+ row->edit_enabled(),
Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
return row;
}
-} // namespace turns::app::widgets \ No newline at end of file
+} // namespace turns::ui::widgets \ No newline at end of file
diff --git a/ui/src/windows/participant_editor.cpp b/ui/src/windows/participant_editor.cpp
index 63c09c4..e41bc92 100644
--- a/ui/src/windows/participant_editor.cpp
+++ b/ui/src/windows/participant_editor.cpp
@@ -4,13 +4,29 @@
#include "turns/core/participant.hpp"
#include "turns/lang/messages.hpp"
+#include <sigc++/functors/mem_fun.h>
+
#include <glibmm/i18n.h>
+#include <glibmm/refptr.h>
+#include <gtkmm/builder.h>
+#include <gtkmm/button.h>
#include <gtkmm/editable.h>
#include <gtkmm/label.h>
#include <gtkmm/listboxrow.h>
+#include <gtkmm/listitem.h>
+#include <gtkmm/object.h>
+#include <gtkmm/signallistitemfactory.h>
+#include <gtkmm/stringlist.h>
#include <gtkmm/stringobject.h>
+#include <gtkmm/widget.h>
+
+#include <adwaita.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+#include <cstdint>
+#include <memory>
#include <ranges>
namespace turns::ui::windows
@@ -88,4 +104,4 @@ namespace turns::ui::windows
item->set_child(*Gtk::make_managed<Gtk::Label>());
}
-} // namespace turns::app::windows \ No newline at end of file
+} // namespace turns::ui::windows \ No newline at end of file
diff --git a/ui/src/windows/tracker.cpp b/ui/src/windows/tracker.cpp
index 6c248fe..e64eb18 100644
--- a/ui/src/windows/tracker.cpp
+++ b/ui/src/windows/tracker.cpp
@@ -1,68 +1,50 @@
#include "turns/ui/windows/tracker.hpp"
-#include "turns/core/participant.hpp"
#include "turns/core/turn_order.hpp"
#include "turns/lang/messages.hpp"
-#include "turns/ui/windows/participant_editor.hpp"
+#include "turns/ui/widgets/turn_order_view.hpp"
-#include <sigc++/bind.h>
+#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
#include <glibmm/binding.h>
#include <glibmm/i18n.h>
+#include <glibmm/refptr.h>
+#include <glibmm/varianttype.h>
#include <giomm/liststore.h>
+#include <gtkmm/applicationwindow.h>
+#include <gtkmm/builder.h>
+#include <gtkmm/button.h>
#include <gtkmm/error.h>
#include <gtkmm/filedialog.h>
+#include <gtkmm/object.h>
+#include <gtkmm/revealer.h>
+#include <gtkmm/stack.h>
+#include <gtkmm/widget.h>
#include <adwaita.h>
#include <nlohmann/json.hpp>
+#include <exception>
#include <format>
-#include <stdexcept>
-#include <string_view>
-#include <utility>
+#include <string>
namespace turns::ui::windows
{
- namespace
- {
- auto editor_for(Glib::RefPtr<core::participant> participant)
- {
- auto builder = Gtk::Builder::create_from_resource("/windows/participant_editor.ui");
- return std::pair{builder, Gtk::Builder::get_widget_derived<windows::participant_editor>(builder, "participant_editor", participant)};
- }
-
- auto stop_dialog_callback(AdwAlertDialog * dialog, GAsyncResult * result, core::turn_order * order)
- {
- auto response = Glib::ustring{adw_alert_dialog_choose_finish(dialog, result)};
- if (response == "cancel")
- {
- return;
- }
- if (response == "clear")
- {
- order->clear();
- }
- order->stop();
- }
-
- } // namespace
-
tracker::tracker(BaseObjectType * base, Glib::RefPtr<Gtk::Builder> const builder)
: Gtk::ApplicationWindow{base}
- , m_adw{ADW_APPLICATION_WINDOW(gobj())}
, m_controls{builder->get_widget<Gtk::Revealer>("controls")}
- , m_empty(builder->get_widget<Gtk::Widget>("empty"))
- , m_overlay{ADW_TOAST_OVERLAY(builder->get_widget<Gtk::Widget>("overlay")->gobj())}
+ , m_empty{builder->get_widget<Gtk::Widget>("empty")}
+ , m_overlay{builder->get_widget<Gtk::Widget>("overlay")}
, m_stack{builder->get_widget<Gtk::Stack>("stack")}
, m_start{builder->get_widget<Gtk::Button>("start")}
- , m_title(ADW_WINDOW_TITLE(builder->get_widget<Gtk::Widget>("title")->gobj()))
+ , m_title{builder->get_widget<Gtk::Widget>("title")}
, m_turn_order{core::turn_order::create()}
, m_turn_order_view{Gtk::make_managed<widgets::turn_order_view>(m_turn_order)}
- , m_subtitle{Glib::wrap(GTK_WIDGET(m_title)), "subtitle"}
+ , m_subtitle{m_title, "subtitle"}
{
setup_actions();
@@ -84,168 +66,12 @@ namespace turns::ui::windows
// clang-format on
}
- auto tracker::do_save() -> void
- {
- m_buffer = m_turn_order->serialize().dump(2);
- m_file->replace_contents_async(sigc::mem_fun(*this, &tracker::handle_save_done), m_buffer, m_file_tag);
- }
-
- auto tracker::handle_add_participant() -> void
- {
- auto [lifeline, dialog] = editor_for(nullptr);
- dialog->present(this);
- dialog->signal_finished().connect([this](auto n, auto p, auto d) { m_turn_order->add(n, p, d); });
- }
-
- auto tracker::handle_delete_participant(Glib::VariantBase param) -> void
- {
- auto index = Glib::VariantBase::cast_dynamic<Glib::Variant<int>>(param);
- m_turn_order->remove(index.get());
- }
-
- auto tracker::handle_edit_participant(Glib::VariantBase param) -> void
- {
- static_cast<void>(param);
- auto index = Glib::VariantBase::cast_dynamic<Glib::Variant<int>>(param);
- auto participant = m_turn_order->get_typed_object<core::participant>(index.get());
- auto [lifeline, dialog] = editor_for(participant);
- dialog->present(this);
- }
-
- auto tracker::handle_open() -> void
- {
- auto filters = Gio::ListStore<Gtk::FileFilter>::create();
- auto filter = Gtk::FileFilter::create();
- filter->set_name(_("Turns Files"));
- filter->add_pattern("*.trns");
- filters->append(filter);
-
- auto dialog = Gtk::FileDialog::create();
- dialog->set_filters(filters);
- dialog->open(sigc::bind(sigc::mem_fun(*this, &tracker::handle_open_response), dialog));
- }
-
- auto tracker::handle_open_done(Glib::RefPtr<Gio::AsyncResult> result) -> void
- try
- {
- set_sensitive();
- char * data{};
- auto size = std::size_t{};
- if (!m_file->load_contents_finish(result, data, size, m_file_tag))
- {
- m_file.reset();
- m_file_tag.clear();
- return;
- }
- auto deserialized = nlohmann::json::parse(std::string_view{data, size});
- m_turn_order->load(deserialized);
- auto name = m_file->get_basename();
- auto message = std::vformat(_(lang::successfully_opened_format), std::make_format_args(name));
- auto toast = adw_toast_new(message.c_str());
- adw_toast_overlay_add_toast(m_overlay, toast);
- set_title(std::format("{} - {}", _(lang::turns), name));
- }
- catch (std::exception const & e)
- {
- show_error_toast(e);
- }
-
- auto tracker::handle_open_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void
- try
- {
- m_file = dialog->open_finish(result);
- m_file->load_contents_async(sigc::mem_fun(*this, &tracker::handle_open_done));
- set_sensitive(false);
- }
- catch (std::exception const & e)
- {
- set_sensitive();
- show_error_toast(e);
- }
-
- auto tracker::handle_save(bool force_ask) -> void
- {
- if (m_file && !force_ask)
- {
- do_save();
- }
- else
- {
- auto filters = Gio::ListStore<Gtk::FileFilter>::create();
- auto filter = Gtk::FileFilter::create();
- filter->set_name(_("Turns Files"));
- filter->add_pattern("*.trns");
- filters->append(filter);
-
- auto dialog = Gtk::FileDialog::create();
- if (m_file)
- {
- dialog->set_initial_file(m_file);
- }
- else
- {
- dialog->set_initial_name(_(lang::new_turn_order_file_name));
- }
- dialog->set_filters(filters);
- dialog->save(*this, sigc::bind(sigc::mem_fun(*this, &tracker::handle_save_response), dialog));
- }
- }
-
- auto tracker::handle_save_done(Glib::RefPtr<Gio::AsyncResult> result) -> void
- try
- {
- set_sensitive();
- m_file->replace_contents_finish(result, m_file_tag);
- auto name = m_file->get_basename();
- auto message = std::vformat(_(lang::successfully_saved_format), std::make_format_args(name));
- auto toast = adw_toast_new(message.c_str());
- adw_toast_overlay_add_toast(m_overlay, toast);
- set_title(std::format("{} - {}", _(lang::turns), name));
- }
- catch (Gio::Error const & e)
- {
- show_error_toast(e);
- }
-
- auto tracker::handle_save_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void
- try
- {
- m_file = dialog->save_finish(result);
- do_save();
- set_sensitive(false);
- }
- catch (Gtk::DialogError const & e)
- {
- if (e.code() == Gtk::DialogError::FAILED)
- {
- show_error_toast(e);
- }
- }
-
- auto tracker::handle_stop() -> void
- {
- auto dialog = ADW_ALERT_DIALOG(adw_alert_dialog_new(_(lang::stop_turn_order), _(lang::question_clear_turn_order)));
- adw_alert_dialog_add_response(dialog, "stop", _(lang::stop));
- adw_alert_dialog_set_response_appearance(dialog, "stop", ADW_RESPONSE_SUGGESTED);
- adw_alert_dialog_add_response(dialog, "clear", _(lang::stop_and_clear));
- adw_alert_dialog_set_response_appearance(dialog, "clear", ADW_RESPONSE_DESTRUCTIVE);
- adw_alert_dialog_add_response(dialog, "cancel", _(lang::cancel));
- adw_alert_dialog_set_response_appearance(dialog, "cancel", ADW_RESPONSE_DEFAULT);
- adw_alert_dialog_set_close_response(dialog, "cancel");
- adw_alert_dialog_set_default_response(dialog, "cancel");
- adw_alert_dialog_choose(dialog,
- GTK_WIDGET(this->gobj()),
- NULL,
- reinterpret_cast<GAsyncReadyCallback>(stop_dialog_callback),
- m_turn_order.get());
- }
-
auto tracker::setup_actions() -> void
{
// win.add_participant
// depends-on: turn_order:state == stopped
{
- auto action = add_action("add_participant", sigc::mem_fun(*this, &tracker::handle_add_participant));
+ auto action = add_action("add_participant", sigc::mem_fun(*this, &tracker::add_participant));
Glib::Binding::bind_property(m_turn_order->is_running(),
action->property_enabled(),
@@ -295,7 +121,7 @@ namespace turns::ui::windows
// win.stop
// depends-on: turn_order:running == true
{
- auto action = add_action("stop", sigc::mem_fun(*this, &tracker::handle_stop));
+ auto action = add_action("stop", sigc::mem_fun(*this, &tracker::stop));
Glib::Binding::bind_property(m_turn_order->is_running(), action->property_enabled(), Glib::Binding::Flags::SYNC_CREATE);
}
@@ -304,15 +130,15 @@ namespace turns::ui::windows
// win.edit
// win.open
{
- add_action_with_parameter("delete", Glib::VARIANT_TYPE_INT32, sigc::mem_fun(*this, &tracker::handle_delete_participant));
- add_action_with_parameter("edit", Glib::VARIANT_TYPE_INT32, sigc::mem_fun(*this, &tracker::handle_edit_participant));
- add_action("open", sigc::mem_fun(*this, &tracker::handle_open));
+ add_action_with_parameter("delete", Glib::VARIANT_TYPE_INT32, sigc::mem_fun(*this, &tracker::delete_participant));
+ add_action_with_parameter("edit", Glib::VARIANT_TYPE_INT32, sigc::mem_fun(*this, &tracker::edit_participant));
+ add_action("open", sigc::mem_fun(*this, &tracker::open));
}
// win.save
// depends-on: turn_order:is_empty == false
{
- auto action = add_action("save", sigc::bind(sigc::mem_fun(*this, &tracker::handle_save), false));
+ auto action = add_action("save", sigc::bind(sigc::mem_fun(*this, &tracker::save), false));
Glib::Binding::bind_property(m_turn_order->is_empty(),
action->property_enabled(),
@@ -322,7 +148,7 @@ namespace turns::ui::windows
// win.save-as
// depends-on: turn_order:is_empty == false
{
- auto action = add_action("save-as", sigc::bind(sigc::mem_fun(*this, &tracker::handle_save), true));
+ auto action = add_action("save-as", sigc::bind(sigc::mem_fun(*this, &tracker::save), true));
Glib::Binding::bind_property(m_turn_order->is_empty(),
action->property_enabled(),
@@ -330,12 +156,22 @@ namespace turns::ui::windows
}
}
- auto tracker::show_error_toast(std::exception const & e) -> void
+ auto tracker::start_replace_content() -> void
+ {
+ m_file_buffer = m_turn_order->serialize().dump(2);
+ m_file->replace_contents_async(sigc::mem_fun(*this, &tracker::on_replace_content_done), m_file_buffer, m_file_etag);
+ }
+
+ auto tracker::show_error(std::exception const & e) -> void
{
auto error = e.what();
- auto message = std::vformat(_(lang::saving_failed_format), std::make_format_args(error));
+ show_toast(std::vformat(_(lang::saving_failed_format), std::make_format_args(error)));
+ }
+
+ auto tracker::show_toast(std::string const & message) -> void
+ {
auto toast = adw_toast_new(message.c_str());
- adw_toast_overlay_add_toast(m_overlay, toast);
+ adw_toast_overlay_add_toast(ADW_TOAST_OVERLAY(m_overlay->gobj()), toast);
}
auto tracker::update_subtitle() -> void
diff --git a/ui/src/windows/tracker/actions.cpp b/ui/src/windows/tracker/actions.cpp
new file mode 100644
index 0000000..9da2e0c
--- /dev/null
+++ b/ui/src/windows/tracker/actions.cpp
@@ -0,0 +1,123 @@
+#include "turns/core/participant.hpp"
+#include "turns/core/turn_order.hpp"
+#include "turns/lang/messages.hpp"
+#include "turns/ui/windows/participant_editor.hpp"
+#include "turns/ui/windows/tracker.hpp"
+
+#include <sigc++/adaptors/bind.h>
+#include <sigc++/functors/mem_fun.h>
+
+#include <glibmm/i18n.h>
+#include <glibmm/refptr.h>
+#include <glibmm/ustring.h>
+#include <glibmm/variant.h>
+
+#include <giomm/liststore.h>
+
+#include <gtkmm/builder.h>
+#include <gtkmm/filedialog.h>
+#include <gtkmm/filefilter.h>
+
+#include <adwaita.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+#include <utility>
+
+namespace turns::ui::windows
+{
+ namespace
+ {
+ auto editor_for(Glib::RefPtr<core::participant> participant)
+ {
+ auto builder = Gtk::Builder::create_from_resource("/windows/participant_editor.ui");
+ return std::pair{builder, Gtk::Builder::get_widget_derived<participant_editor>(builder, "participant_editor", participant)};
+ }
+
+ auto stop_dialog_callback(AdwAlertDialog * dialog, GAsyncResult * result, core::turn_order * order)
+ {
+ auto response = Glib::ustring{adw_alert_dialog_choose_finish(dialog, result)};
+ if (response == "cancel")
+ {
+ return;
+ }
+ if (response == "clear")
+ {
+ order->clear();
+ }
+ order->stop();
+ }
+
+ auto file_filters()
+ {
+ auto filters = Gio::ListStore<Gtk::FileFilter>::create();
+ auto filter = Gtk::FileFilter::create();
+ filter->set_name(_("Turns Files"));
+ filter->add_pattern("*.trns");
+ filters->append(filter);
+ return filters;
+ }
+ } // namespace
+
+ auto tracker::add_participant() -> void
+ {
+ auto [lifeline, dialog] = editor_for(nullptr);
+ dialog->present(this);
+ dialog->signal_finished().connect([this](auto n, auto p, auto d) { m_turn_order->add(n, p, d); });
+ }
+
+ auto tracker::delete_participant(Glib::VariantBase param) -> void
+ {
+ auto index = Glib::VariantBase::cast_dynamic<Glib::Variant<int>>(param);
+ m_turn_order->remove(index.get());
+ }
+
+ auto tracker::edit_participant(Glib::VariantBase param) -> void
+ {
+ static_cast<void>(param);
+ auto index = Glib::VariantBase::cast_dynamic<Glib::Variant<int>>(param);
+ auto participant = m_turn_order->get_typed_object<core::participant>(index.get());
+ auto [lifeline, dialog] = editor_for(participant);
+ dialog->present(this);
+ }
+
+ auto tracker::open() -> void
+ {
+ auto dialog = Gtk::FileDialog::create();
+ dialog->set_filters(file_filters());
+ dialog->open(sigc::bind(sigc::mem_fun(*this, &tracker::on_open_response), dialog));
+ }
+
+ auto tracker::save(bool force_ask) -> void
+ {
+ if (m_file && !force_ask)
+ {
+ start_replace_content();
+ }
+ else
+ {
+ auto dialog = Gtk::FileDialog::create();
+ m_file ? dialog->set_initial_file(m_file) : dialog->set_initial_name(_(lang::new_turn_order_file_name));
+ dialog->set_filters(file_filters());
+ dialog->save(*this, sigc::bind(sigc::mem_fun(*this, &tracker::on_save_response), dialog));
+ }
+ }
+
+ auto tracker::stop() -> void
+ {
+ auto dialog = ADW_ALERT_DIALOG(adw_alert_dialog_new(_(lang::stop_turn_order), _(lang::question_clear_turn_order)));
+ adw_alert_dialog_add_response(dialog, "stop", _(lang::stop));
+ adw_alert_dialog_set_response_appearance(dialog, "stop", ADW_RESPONSE_SUGGESTED);
+ adw_alert_dialog_add_response(dialog, "clear", _(lang::stop_and_clear));
+ adw_alert_dialog_set_response_appearance(dialog, "clear", ADW_RESPONSE_DESTRUCTIVE);
+ adw_alert_dialog_add_response(dialog, "cancel", _(lang::cancel));
+ adw_alert_dialog_set_response_appearance(dialog, "cancel", ADW_RESPONSE_DEFAULT);
+ adw_alert_dialog_set_close_response(dialog, "cancel");
+ adw_alert_dialog_set_default_response(dialog, "cancel");
+ adw_alert_dialog_choose(dialog,
+ GTK_WIDGET(this->gobj()),
+ nullptr,
+ reinterpret_cast<GAsyncReadyCallback>(stop_dialog_callback),
+ m_turn_order.get());
+ }
+} // namespace turns::ui::windows \ No newline at end of file
diff --git a/ui/src/windows/tracker/event_handlers.cpp b/ui/src/windows/tracker/event_handlers.cpp
new file mode 100644
index 0000000..3fc1c53
--- /dev/null
+++ b/ui/src/windows/tracker/event_handlers.cpp
@@ -0,0 +1,100 @@
+#include "turns/lang/messages.hpp"
+#include "turns/ui/windows/tracker.hpp"
+
+#include <sigc++/functors/mem_fun.h>
+
+#include <glibmm/i18n.h>
+#include <glibmm/refptr.h>
+
+#include <giomm/asyncresult.h>
+#include <giomm/error.h>
+
+#include <gtkmm/filedialog.h>
+
+#include <adwaita.h>
+#include <nlohmann/json.hpp>
+
+#include <cstddef>
+#include <exception>
+#include <format>
+#include <string_view>
+
+namespace turns::ui::windows
+{
+
+ auto tracker::on_load_content_done(Glib::RefPtr<Gio::AsyncResult> result) -> void
+ {
+ set_sensitive();
+ char * data{};
+ auto size = std::size_t{};
+
+ try
+ {
+ if (!m_file->load_contents_finish(result, data, size, m_file_etag))
+ {
+ m_file.reset();
+ m_file_etag.clear();
+ return;
+ }
+
+ m_turn_order->load(nlohmann::json::parse(std::string_view{data, size}));
+ }
+ catch (std::exception const & e)
+ {
+ return show_error(e);
+ }
+
+ auto name = m_file->get_basename();
+ show_toast(std::vformat(_(lang::successfully_opened_format), std::make_format_args(name)));
+ set_title(std::format("{} - {}", _(lang::turns), name));
+ }
+
+ auto tracker::on_replace_content_done(Glib::RefPtr<Gio::AsyncResult> result) -> void
+ {
+ set_sensitive();
+
+ try
+ {
+ m_file->replace_contents_finish(result, m_file_etag);
+ }
+ catch (Gio::Error const & e)
+ {
+ return show_error(e);
+ }
+
+ auto name = m_file->get_basename();
+ show_toast(std::vformat(_(lang::successfully_saved_format), std::make_format_args(name)));
+ set_title(std::format("{} - {}", _(lang::turns), name));
+ }
+
+ auto tracker::on_open_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void
+ {
+ try
+ {
+ m_file = dialog->open_finish(result);
+ }
+ catch (std::exception const & e)
+ {
+ return show_error(e);
+ }
+
+ m_file->load_contents_async(sigc::mem_fun(*this, &tracker::on_load_content_done));
+ set_sensitive(false);
+ }
+
+ auto tracker::on_save_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void
+ {
+ try
+ {
+ m_file = dialog->save_finish(result);
+ }
+ catch (std::exception const & e)
+ {
+ show_error(e);
+ }
+
+ start_replace_content();
+ set_sensitive(false);
+ }
+
+} // namespace turns::ui::windows \ No newline at end of file
diff --git a/ui/tests/gtk_test_init.cpp b/ui/tests/gtk_test_init.cpp
index 734de2f..4bf4303 100644
--- a/ui/tests/gtk_test_init.cpp
+++ b/ui/tests/gtk_test_init.cpp
@@ -9,6 +9,9 @@
#include <gtkmm/init.h>
#include <adwaita.h>
+#include <libintl.h>
+
+#include <clocale>
namespace turns::ui::tests
{
diff --git a/ui/tests/widgets/participant_row.cpp b/ui/tests/widgets/participant_row.cpp
index d3440d0..a8e4166 100644
--- a/ui/tests/widgets/participant_row.cpp
+++ b/ui/tests/widgets/participant_row.cpp
@@ -5,6 +5,10 @@
#include <catch2/catch_test_macros.hpp>
+#include <glibmm/refptr.h>
+
+#include <gtkmm/object.h>
+
namespace turns::ui::widgets::tests
{
@@ -21,4 +25,4 @@ namespace turns::ui::widgets::tests
}
}
-} // namespace turns::app::widgets::tests \ No newline at end of file
+} // namespace turns::ui::widgets::tests \ No newline at end of file
diff --git a/ui/tests/windows/participant_editor.cpp b/ui/tests/windows/participant_editor.cpp
index cd0a61c..2b3f5da 100644
--- a/ui/tests/windows/participant_editor.cpp
+++ b/ui/tests/windows/participant_editor.cpp
@@ -15,6 +15,9 @@
#include <gtkmm/window.h>
#include <adwaita.h>
+#include <gtk/gtk.h>
+
+#include <clocale>
namespace turns::ui::windows::tests
{
@@ -108,4 +111,4 @@ namespace turns::ui::windows::tests
}
}
-} // namespace turns::app::windows::tests \ No newline at end of file
+} // namespace turns::ui::windows::tests \ No newline at end of file
diff --git a/ui/tests/windows/tracker.cpp b/ui/tests/windows/tracker.cpp
index d61f868..dc81331 100644
--- a/ui/tests/windows/tracker.cpp
+++ b/ui/tests/windows/tracker.cpp
@@ -15,6 +15,8 @@
#include <adwaita.h>
+#include <clocale>
+
namespace turns::ui::windows::tests
{
@@ -72,4 +74,4 @@ namespace turns::ui::windows::tests
}
}
-} // namespace turns::app::windows::tests \ No newline at end of file
+} // namespace turns::ui::windows::tests \ No newline at end of file