summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2025-06-05 17:35:58 +0200
committerFelix Morgner <felix.morgner@gmail.com>2025-06-05 17:35:58 +0200
commit51ba7f32ced89bde135127bef3e08dbc03ee6a24 (patch)
tree7c88a8d55dd33ca89b0304fc77319601a60a6de6 /gui
parent4dbac6b1c344cd2380378957e0fa65d0126eda0b (diff)
downloadturns-51ba7f32ced89bde135127bef3e08dbc03ee6a24.tar.xz
turns-51ba7f32ced89bde135127bef3e08dbc03ee6a24.zip
gui: reintroduce tracker
Diffstat (limited to 'gui')
-rw-r--r--gui/CMakeLists.txt3
-rw-r--r--gui/include/tracker.hpp38
-rw-r--r--gui/src/main.cpp67
-rw-r--r--gui/src/tracker.cpp134
-rw-r--r--gui/src/tracker_actions.cpp56
-rw-r--r--gui/src/tracker_event_handlers.cpp70
6 files changed, 175 insertions, 193 deletions
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index 902fdd0..2979224 100644
--- a/gui/CMakeLists.txt
+++ b/gui/CMakeLists.txt
@@ -70,6 +70,9 @@ add_library("gui_impl"
"src/participant_row.cpp"
"src/preferences.cpp"
"src/settings.cpp"
+ "src/tracker.cpp"
+ "src/tracker_actions.cpp"
+ "src/tracker_event_handlers.cpp"
"src/turn_order_view.cpp"
)
diff --git a/gui/include/tracker.hpp b/gui/include/tracker.hpp
index d639aee..2360f5d 100644
--- a/gui/include/tracker.hpp
+++ b/gui/include/tracker.hpp
@@ -3,24 +3,25 @@
* SPDX-License-Identifier: LGPL-2.1-only
*/
-#ifndef TURNS_UI_TRACKER_HPP
-#define TURNS_UI_TRACKER_HPP
+#ifndef TURNS_GUI_TRACKER_HPP
+#define TURNS_GUI_TRACKER_HPP
-#include "turns/core/turn_order_model.hpp"
-#include "turns/ui/template_widget.hpp"
-#include "turns/ui/turn_order_view.hpp"
+#include "template_widget.hpp"
+#include "turn_order_view.hpp"
-#include <glibmm/propertyproxy.h>
-#include <glibmm/refptr.h>
-#include <glibmm/ustring.h>
-#include <glibmm/variant.h>
+#include <turnsmm/turn-order.hpp>
+#include <adwaitamm/application.hpp>
+#include <adwaitamm/applicationwindow.hpp>
+#include <adwaitamm/toastoverlay.hpp>
+#include <adwaitamm/windowtitle.hpp>
#include <giomm/asyncresult.h>
#include <giomm/file.h>
#include <giomm/settings.h>
-
-#include <gtkmm/applicationwindow.h>
-#include <gtkmm/builder.h>
+#include <glibmm/propertyproxy.h>
+#include <glibmm/refptr.h>
+#include <glibmm/ustring.h>
+#include <glibmm/variant.h>
#include <gtkmm/button.h>
#include <gtkmm/cssprovider.h>
#include <gtkmm/filedialog.h>
@@ -28,16 +29,11 @@
#include <gtkmm/stack.h>
#include <gtkmm/widget.h>
-#include <adwaitamm/application.hpp>
-#include <adwaitamm/applicationwindow.hpp>
-#include <adwaitamm/toastoverlay.hpp>
-#include <adwaitamm/windowtitle.hpp>
-
#include <array>
#include <exception>
#include <string>
-namespace turns::ui
+namespace Turns::gui
{
struct Tracker : template_widget<Tracker, Adwaita::ApplicationWindow>
@@ -59,7 +55,7 @@ namespace turns::ui
friend auto register_types() -> void;
Tracker();
- /** Setup */
+ /** Setup */
auto setup_actions() -> void;
auto setup_colors() -> void;
@@ -92,7 +88,7 @@ namespace turns::ui
Gtk::Stack * m_stack;
Gtk::Button * m_start;
Adwaita::WindowTitle * m_title;
- Glib::RefPtr<core::TurnOderModel> m_turn_order;
+ Glib::RefPtr<TurnOrder> m_turn_order;
TurnOrderView * m_turn_order_view;
Glib::RefPtr<Gio::Settings> m_settings{};
Glib::PropertyProxy<Glib::ustring> m_subtitle;
@@ -104,6 +100,6 @@ namespace turns::ui
Glib::RefPtr<Gtk::CssProvider> m_css{};
};
-} // namespace turns::ui
+} // namespace Turns::gui
#endif \ No newline at end of file
diff --git a/gui/src/main.cpp b/gui/src/main.cpp
index 61fdde3..8931382 100644
--- a/gui/src/main.cpp
+++ b/gui/src/main.cpp
@@ -5,6 +5,7 @@
#include "init.hpp"
#include "settings.hpp"
+#include "tracker.hpp"
#include <turnsmm.hpp>
@@ -64,41 +65,35 @@ auto main(int argc, char ** argv) -> int
auto settings = Turns::gui::get_settings();
- // app->signal_activate().connect([app, settings] {
- // auto window = new turns::ui::Tracker{app, settings};
- // window->present();
- // });
+ app->signal_activate().connect([app, settings] {
+ auto window = new Turns::gui::Tracker{app, settings};
+ window->present();
+ });
+
+ app->signal_open().connect([app, settings](auto files, auto) {
+ auto windows = app->get_windows();
+ auto window = static_cast<Turns::gui::Tracker *>(nullptr);
+
+ if (windows.empty())
+ {
+ window = new Turns::gui::Tracker{app, settings};
+ }
+ else
+ {
+ window = dynamic_cast<Turns::gui::Tracker *>(windows[0]);
+ }
+
+ window->present();
+ window->load(files[0]);
+ });
+
+ app->signal_window_removed().connect([](auto window) {
+ auto tracker = dynamic_cast<Turns::gui::Tracker *>(window);
+ if (tracker)
+ {
+ delete tracker;
+ }
+ });
return app->run(argc, argv);
-}
-
-// auto main(int argc, char * argv[]) -> int
-// {
-
-// app->signal_open().connect([app, settings](auto files, auto) {
-// auto windows = app->get_windows();
-// auto window = static_cast<turns::ui::Tracker *>(nullptr);
-
-// if (windows.empty())
-// {
-// window = new turns::ui::Tracker{app, settings};
-// }
-// else
-// {
-// window = dynamic_cast<turns::ui::Tracker *>(windows[0]);
-// }
-
-// window->present();
-// window->load(files[0]);
-// });
-
-// app->signal_window_removed().connect([](auto window) {
-// auto tracker = dynamic_cast<turns::ui::Tracker *>(window);
-// if (tracker)
-// {
-// delete tracker;
-// }
-// });
-
-// return app->run(argc, argv);
-// } \ No newline at end of file
+} \ No newline at end of file
diff --git a/gui/src/tracker.cpp b/gui/src/tracker.cpp
index dd926b5..66970e9 100644
--- a/gui/src/tracker.cpp
+++ b/gui/src/tracker.cpp
@@ -3,17 +3,28 @@
* SPDX-License-Identifier: LGPL-2.1-only
*/
-#include "turns/ui/tracker.hpp"
+#include "tracker.hpp"
-#include "turns/core/settings.hpp"
-#include "turns/core/turn_order_model.hpp"
-#include "turns/lang/messages.hpp"
-#include "turns/ui/template_widget.hpp"
-#include "turns/ui/turn_order_view.hpp"
+#include "messages.hpp"
+#include "settings.hpp"
+#include "turn_order_view.hpp"
+
+#include <turnsmm/participant.hpp>
+#include <turnsmm/turn-order.hpp>
#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
+#include <gtk/gtk.h>
+
+#include <adwaitamm/application.hpp>
+#include <adwaitamm/applicationwindow.hpp>
+#include <adwaitamm/toast.hpp>
+#include <adwaitamm/toastoverlay.hpp>
+#include <adwaitamm/windowtitle.hpp>
+#include <giomm/file.h>
+#include <giomm/liststore.h>
+#include <giomm/settings.h>
#include <glibmm/binding.h>
#include <glibmm/i18n.h>
#include <glibmm/objectbase.h>
@@ -22,11 +33,6 @@
#include <glibmm/ustring.h>
#include <glibmm/varianttype.h>
#include <glibmm/wrap.h>
-
-#include <giomm/file.h>
-#include <giomm/liststore.h>
-#include <giomm/settings.h>
-
#include <gtkmm/applicationwindow.h>
#include <gtkmm/builder.h>
#include <gtkmm/button.h>
@@ -39,22 +45,14 @@
#include <gtkmm/styleprovider.h>
#include <gtkmm/widget.h>
-#include <adwaitamm/application.hpp>
-#include <adwaitamm/applicationwindow.hpp>
-#include <adwaitamm/toast.hpp>
-#include <adwaitamm/toastoverlay.hpp>
-#include <adwaitamm/windowtitle.hpp>
-
-#include <gtk/gtk.h>
-#include <nlohmann/json.hpp>
-
#include <exception>
#include <format>
+#include <memory>
#include <print>
#include <string>
#include <utility>
-namespace turns::ui
+namespace Turns::gui
{
namespace
{
@@ -63,7 +61,7 @@ namespace turns::ui
} // namespace
Tracker::Tracker()
- : Tracker{{}, core::get_settings()}
+ : Tracker{{}, gui::get_settings()}
{
}
@@ -76,7 +74,7 @@ namespace turns::ui
, m_stack{get_widget<Gtk::Stack>("stack")}
, m_start{get_widget<Gtk::Button>("start")}
, m_title{get_widget<Adwaita::WindowTitle>("title")}
- , m_turn_order{core::TurnOderModel::create()}
+ , m_turn_order{std::make_shared<TurnOrder>()}
, m_turn_order_view{Gtk::make_managed<TurnOrderView>(m_turn_order)}
, m_settings{std::move(settings)}
, m_subtitle{m_title->property_subtitle()}
@@ -87,22 +85,22 @@ namespace turns::ui
m_stack->add(*m_turn_order_view);
- m_turn_order->is_empty().signal_changed().connect(sigc::mem_fun(*this, &Tracker::update_subtitle));
- m_turn_order->round_number().signal_changed().connect(sigc::mem_fun(*this, &Tracker::update_subtitle));
+ m_turn_order->property_empty().signal_changed().connect(sigc::mem_fun(*this, &Tracker::update_subtitle));
+ // m_turn_order->round_number().signal_changed().connect(sigc::mem_fun(*this, &Tracker::update_subtitle));
update_subtitle();
// clang-format off
- Glib::Binding::bind_property(m_turn_order->is_empty(),
+ Glib::Binding::bind_property(m_turn_order->property_empty(),
m_stack->property_visible_child(),
Glib::Binding::Flags::SYNC_CREATE,
[this](auto empty) { return empty ? m_empty : m_turn_order_view; });
- Glib::Binding::bind_property(m_turn_order->is_running(),
+ Glib::Binding::bind_property(m_turn_order->property_running(),
m_controls->property_reveal_child(),
Glib::Binding::Flags::SYNC_CREATE);
// clang-format on
- m_settings->bind("skip-defeated", m_turn_order->skip_defeated());
+ // m_settings->bind("skip-defeated", m_turn_order->skip_defeated());
}
auto Tracker::setup_actions() -> void
@@ -112,57 +110,57 @@ namespace turns::ui
{
auto action = add_action("add_participant", sigc::mem_fun(*this, &Tracker::add_participant));
- Glib::Binding::bind_property(m_turn_order->is_running(),
+ Glib::Binding::bind_property(m_turn_order->property_running(),
action->property_enabled(),
Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
}
// win.clear
- // depends-on: turn_order:is_empty == false
+ // depends-on: turn_order:property_empty == false
{
- auto action = add_action("clear", sigc::mem_fun(*m_turn_order, &core::TurnOderModel::clear));
+ auto action = add_action("clear", sigc::mem_fun(*m_turn_order, &TurnOrder::clear));
- Glib::Binding::bind_property(m_turn_order->is_empty(),
+ Glib::Binding::bind_property(m_turn_order->property_empty(),
action->property_enabled(),
Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
}
- // win.next
- // depends-on: turn_order:state == running
- {
- auto action = add_action("next", sigc::mem_fun(*m_turn_order, &core::TurnOderModel::next));
+ // // win.next
+ // // depends-on: turn_order:state == running
+ // {
+ // auto action = add_action("next", sigc::mem_fun(*m_turn_order, &TurnOrder::next));
- Glib::Binding::bind_property(m_turn_order->is_running(), action->property_enabled(), Glib::Binding::Flags::SYNC_CREATE);
- }
+ // Glib::Binding::bind_property(m_turn_order->property_running(), action->property_enabled(), Glib::Binding::Flags::SYNC_CREATE);
+ // }
- // win.previous
- // depends-on: turn_order:has_previous == true
- {
- auto action = add_action("previous", sigc::mem_fun(*m_turn_order, &core::TurnOderModel::previous));
+ // // win.previous
+ // // depends-on: turn_order:has_previous == true
+ // {
+ // auto action = add_action("previous", sigc::mem_fun(*m_turn_order, &TurnOrder::previous));
- Glib::Binding::bind_property(m_turn_order->has_previous(), action->property_enabled(), Glib::Binding::Flags::SYNC_CREATE);
- }
+ // Glib::Binding::bind_property(m_turn_order->has_previous(), action->property_enabled(), Glib::Binding::Flags::SYNC_CREATE);
+ // }
- // win.start
- // depends-on: turn_order:is_empty == false
- {
- auto action = add_action("start", sigc::mem_fun(*m_turn_order, &core::TurnOderModel::start));
+ // // win.start
+ // // depends-on: turn_order:property_empty == false
+ // {
+ // auto action = add_action("start", sigc::mem_fun(*m_turn_order, &TurnOrder::start));
- Glib::Binding::bind_property(m_turn_order->is_empty(),
- action->property_enabled(),
- Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
+ // Glib::Binding::bind_property(m_turn_order->property_empty(),
+ // action->property_enabled(),
+ // Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
- Glib::Binding::bind_property(m_turn_order->is_running(),
- m_start->property_visible(),
- Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
- }
+ // Glib::Binding::bind_property(m_turn_order->property_running(),
+ // m_start->property_visible(),
+ // Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
+ // }
// win.stop
// depends-on: turn_order:running == true
{
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);
+ Glib::Binding::bind_property(m_turn_order->property_running(), action->property_enabled(), Glib::Binding::Flags::SYNC_CREATE);
}
// win.delete
@@ -177,21 +175,21 @@ namespace turns::ui
}
// win.save
- // depends-on: turn_order:is_empty == false
+ // depends-on: turn_order:property_empty == false
{
auto action = add_action("save", sigc::bind(sigc::mem_fun(*this, &Tracker::save), false));
- Glib::Binding::bind_property(m_turn_order->is_empty(),
+ Glib::Binding::bind_property(m_turn_order->property_empty(),
action->property_enabled(),
Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
}
// win.save-as
- // depends-on: turn_order:is_empty == false
+ // depends-on: turn_order:property_empty == false
{
auto action = add_action("save-as", sigc::bind(sigc::mem_fun(*this, &Tracker::save), true));
- Glib::Binding::bind_property(m_turn_order->is_empty(),
+ Glib::Binding::bind_property(m_turn_order->property_empty(),
action->property_enabled(),
Glib::Binding::Flags::SYNC_CREATE | Glib::Binding::Flags::INVERT_BOOLEAN);
}
@@ -206,14 +204,14 @@ namespace turns::ui
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);
+ // 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();
- show_toast(std::vformat(_(lang::saving_failed_format), std::make_format_args(error)));
+ show_toast(std::vformat(_(message::saving_failed_format), std::make_format_args(error)));
}
auto Tracker::show_toast(std::string const & message) -> void
@@ -236,14 +234,14 @@ namespace turns::ui
auto Tracker::update_subtitle() -> void
{
- if (m_turn_order->is_empty())
+ if (m_turn_order->property_empty())
{
- m_subtitle = _(lang::no_active_turn_order);
+ m_subtitle = _(message::no_active_turn_order);
}
else
{
- auto round_number = m_turn_order->round_number() + 1;
- m_subtitle = round_number == 0 ? "" : std::vformat(_(lang::round_number), std::make_format_args(round_number));
+ // auto round_number = m_turn_order->round_number() + 1;
+ // m_subtitle = round_number == 0 ? "" : std::vformat(_(message::round_number), std::make_format_args(round_number));
}
}
@@ -257,4 +255,4 @@ namespace turns::ui
}
}
-} // namespace turns::ui
+} // namespace Turns::gui
diff --git a/gui/src/tracker_actions.cpp b/gui/src/tracker_actions.cpp
index 7149f0e..8c9820a 100644
--- a/gui/src/tracker_actions.cpp
+++ b/gui/src/tracker_actions.cpp
@@ -3,40 +3,38 @@
* SPDX-License-Identifier: LGPL-2.1-only
*/
-#include "turns/core/participant.hpp"
-#include "turns/lang/messages.hpp"
-#include "turns/ui/participant_editor.hpp"
-#include "turns/ui/preferences.hpp"
-#include "turns/ui/tracker.hpp"
+#include "messages.hpp"
+#include "participant_editor.hpp"
+#include "preferences.hpp"
+#include "tracker.hpp"
+
+#include <turnsmm/participant.hpp>
#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+
+#include <adwaitamm/alertdialog.hpp>
+#include <adwaitamm/dialog.hpp>
+#include <adwaitamm/enums.hpp>
+#include <adwaitamm/preferencesdialog.hpp>
+#include <giomm/liststore.h>
+#include <giomm/settings.h>
#include <glibmm/i18n.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/variant.h>
#include <glibmm/wrap.h>
-
-#include <giomm/liststore.h>
-#include <giomm/settings.h>
-
#include <gtkmm/builder.h>
#include <gtkmm/filedialog.h>
#include <gtkmm/filefilter.h>
#include <gtkmm/object.h>
-#include <adwaitamm/alertdialog.hpp>
-#include <adwaitamm/dialog.hpp>
-#include <adwaitamm/enums.hpp>
-#include <adwaitamm/preferencesdialog.hpp>
-
-#include <gio/gio.h>
-#include <gtk/gtk.h>
-
#include <utility>
-namespace turns::ui
+namespace Turns::gui
{
namespace
{
@@ -54,20 +52,20 @@ namespace turns::ui
auto Tracker::add_participant() -> void
{
auto dialog = Gtk::make_managed<ParticipantEditor>(nullptr);
- dialog->signal_finished().connect([this](auto n, auto p, auto d) { m_turn_order->add(n, p, d); });
+ dialog->signal_finished().connect([this](auto n, auto p, auto d) { m_turn_order->add(Participant::create(n, p, d)); });
dialog->present(this);
}
auto Tracker::delete_participant(Glib::VariantBase param) -> void
{
auto index = Glib::VariantBase::cast_dynamic<Glib::Variant<int>>(param);
- m_turn_order->remove(index.get());
+ m_turn_order->remove_at(index.get());
}
auto Tracker::edit_participant(Glib::VariantBase param) -> void
{
auto index = Glib::VariantBase::cast_dynamic<Glib::Variant<int>>(param);
- auto participant = m_turn_order->get_typed_object<core::Participant>(index.get());
+ auto participant = m_turn_order->get_typed_object<Participant>(index.get());
auto dialog = Gtk::make_managed<ParticipantEditor>(participant);
dialog->present(this);
}
@@ -81,7 +79,7 @@ namespace turns::ui
auto Tracker::preferences() -> void
{
- auto preferences = Gtk::make_managed<struct Preferences>(m_settings);
+ auto preferences = Gtk::make_managed<Preferences>(m_settings);
auto dialog = Gtk::make_managed<Adwaita::PreferencesDialog>();
dialog->add(*preferences);
dialog->set_visible_page(*preferences);
@@ -97,7 +95,7 @@ namespace turns::ui
else
{
auto dialog = Gtk::FileDialog::create();
- m_file ? dialog->set_initial_file(m_file) : dialog->set_initial_name(_(lang::new_turn_order_file_name));
+ m_file ? dialog->set_initial_file(m_file) : dialog->set_initial_name(_(message::new_turn_order_file_name));
dialog->set_filters(file_filters());
dialog->save(*this, sigc::bind(sigc::mem_fun(*this, &Tracker::on_save_response), dialog));
}
@@ -105,12 +103,12 @@ namespace turns::ui
auto Tracker::stop() -> void
{
- auto dialog = Adwaita::AlertDialog::create(_(lang::stop_turn_order), _(lang::question_clear_turn_order));
- dialog->add_response("stop", _(lang::stop));
+ auto dialog = Adwaita::AlertDialog::create(_(message::stop_turn_order), _(message::question_clear_turn_order));
+ dialog->add_response("stop", _(message::stop));
dialog->set_response_appearance("stop", Adwaita::ResponseAppearance::Suggested);
- dialog->add_response("clear", _(lang::stop_and_clear));
+ dialog->add_response("clear", _(message::stop_and_clear));
dialog->set_response_appearance("clear", Adwaita::ResponseAppearance::Destructive);
- dialog->add_response("cancel", _(lang::cancel));
+ dialog->add_response("cancel", _(message::cancel));
dialog->set_response_appearance("cancel", Adwaita::ResponseAppearance::Default);
dialog->set_close_response("cancel");
dialog->set_default_response("cancel");
@@ -124,7 +122,7 @@ namespace turns::ui
{
m_turn_order->clear();
}
- m_turn_order->stop();
+ // m_turn_order->stop();
});
}
-} // namespace turns::ui \ No newline at end of file
+} // namespace Turns::gui \ No newline at end of file
diff --git a/gui/src/tracker_event_handlers.cpp b/gui/src/tracker_event_handlers.cpp
index ae0328c..571b7e3 100644
--- a/gui/src/tracker_event_handlers.cpp
+++ b/gui/src/tracker_event_handlers.cpp
@@ -3,55 +3,47 @@
* SPDX-License-Identifier: LGPL-2.1-only
*/
-#include "turns/lang/messages.hpp"
-#include "turns/ui/tracker.hpp"
+#include "messages.hpp"
+#include "tracker.hpp"
#include <sigc++/functors/mem_fun.h>
+#include <giomm/asyncresult.h>
+#include <giomm/error.h>
#include <glibmm/i18n.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
-
-#include <giomm/asyncresult.h>
-#include <giomm/error.h>
-
#include <gtkmm/filedialog.h>
-#include <nlohmann/json.hpp>
-
-#include <cstddef>
-#include <exception>
-#include <format>
-#include <string_view>
-
-namespace turns::ui
+namespace Turns::gui
{
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));
+ static_cast<void>(result);
+ // 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
@@ -68,8 +60,8 @@ namespace turns::ui
}
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));
+ show_toast(std::vformat(_(message::successfully_saved_format), std::make_format_args(name)));
+ set_title(std::format("{} - {}", _(message::turns), name));
}
auto Tracker::on_open_response(Glib::RefPtr<Gio::AsyncResult> result, Glib::RefPtr<Gtk::FileDialog> dialog) -> void