diff --git a/.gitmodules b/.gitmodules index 654268b..834c95d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "external/assimp"] path = external/assimp url = https://github.com/assimp/assimp.git -[submodule "external/spdlog"] - path = external/spdlog - url = https://github.com/gabime/spdlog.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 0979898..f258d06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,14 +60,6 @@ else () endif () add_subdirectory(external/assimp EXCLUDE_FROM_ALL) -option(SPDLOG_ENABLE_PCH "Build static or shared library using precompiled header to speed up compilation time" ON) -option(SPDLOG_BUILD_WARNINGS "Enable compiler warnings" ON) -option(SPDLOG_PREVENT_CHILD_FD "Prevent from child processes to inherit log file descriptors" ON) -option(SPDLOG_NO_THREAD_ID "prevent spdlog from querying the thread id on each log call if thread id is not needed" ON) -option(SPDLOG_NO_TLS "prevent spdlog from using thread local storage" ON) -option(SPDLOG_NO_ATOMIC_LEVELS "prevent spdlog from using of std::atomic log levels (use only if your code never modifies log levels concurrently" ON) -add_subdirectory(external/spdlog EXCLUDE_FROM_ALL) - add_executable(LearnGtk4 main.cpp hello_world.cpp hello_world.hpp @@ -75,7 +67,7 @@ add_executable(LearnGtk4 main.cpp app_win_2_back.hpp ) -set_target_properties(LearnGtk4 assimp spdlog_header_only PROPERTIES +set_target_properties(LearnGtk4 assimp PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF @@ -86,4 +78,4 @@ target_compile_definitions(LearnGtk4 PUBLIC $<$:_GLIBCXX_DEBUG>) target_compile_definitions(assimp PUBLIC $<$:_GLIBCXX_DEBUG>) target_compile_options(LearnGtk4 PUBLIC ${COMPILE_FLAGS}) target_link_options(LearnGtk4 PUBLIC ${LINKER_OPTIONS}) -target_link_libraries(LearnGtk4 PkgConfig::GTKMM4 assimp spdlog_header_only) +target_link_libraries(LearnGtk4 PkgConfig::GTKMM4 assimp) diff --git a/app_win_2_back.cpp b/app_win_2_back.cpp index ff5dac1..bd005a2 100644 --- a/app_win_2_back.cpp +++ b/app_win_2_back.cpp @@ -1,8 +1,7 @@ #include "app_win_2_back.hpp" #include "hello_world.hpp" +#include #include -#include -#include namespace gui_to_app { AppWin2Back::AppWin2Back() : Gtk::Application("org.billy_adventures.character_sheet", Flags::HANDLES_OPEN) { @@ -16,12 +15,12 @@ namespace gui_to_app { const auto builder = Gtk::Builder::create_from_file("menu_bar.ui"); return builder->get_object("menu"); } catch (const std::exception &e) { - spdlog::error("Error occurred while loader menu bar: {}", e.what()); + std::cerr << e.what() << '\n'; return nullptr; } }(); if (!menu_bar) { - spdlog::error("Error occured while loading menu bar's."); + std::cerr << "Error occured while loading menu bar's.\n"; } else { set_menubar(menu_bar); add_action("quit", sigc::mem_fun(*this, &AppWin2Back::on_quit)); @@ -36,17 +35,17 @@ namespace gui_to_app { void AppWin2Back::on_activate() { Application::on_activate(); - app_builder = [this]() -> Glib::RefPtr { + const auto app_builder = [this]() -> Glib::RefPtr { try { return Gtk::Builder::create_from_file("window_ui.ui"); } catch (const std::exception &e) { - spdlog::critical("Error occurred while loading Window's UI: {}", e.what()); + std::cerr << e.what() << std::endl; quit(); return nullptr; } }(); if (!app_builder) { - spdlog::critical("Error while loading UI"); + std::cerr << "Error while loading UI.\n"; quit(); return; } @@ -56,65 +55,16 @@ namespace gui_to_app { main_window->set_show_menubar(true); main_window->set_visible(true); } else { - spdlog::critical("Error while getting window from builder"); on_quit(); - return; - } - sword_switch = app_builder->get_widget("sword_switch"); - lance_switch = app_builder->get_widget("lance_switch"); - morgen_switch = app_builder->get_widget("morgenstern_switch"); - bow_switch = app_builder->get_widget("arc_switch"); - chainmail_switch = app_builder->get_widget("chainmail_switch"); - cookpot_switch = app_builder->get_widget("cookingpot_switch"); - pamphlet_switch = app_builder->get_widget("pamphlet_tourist_switch"); - medkit_switch = app_builder->get_widget("medkit_switch"); - fourche_switch = app_builder->get_widget("fourche_switch"); - dagger_switch = app_builder->get_widget("dagger_switch"); - rock_kit_switch = app_builder->get_widget("rock_kit_switch"); - sack_switch = app_builder->get_widget("sack_switch"); - - const auto test_result = [this]() -> std::vector { - const std::array test_ptrs{ - std::pair{ "sword_switch", sword_switch == nullptr }, - std::pair{ "lance_switch", lance_switch == nullptr }, - std::pair{ "morgen_switch", morgen_switch == nullptr }, - std::pair{ "bow_switch", bow_switch == nullptr }, - std::pair{ "chainmail_switch", chainmail_switch == nullptr }, - std::pair{ "cookpot_switch", cookpot_switch == nullptr }, - std::pair{ "pamphlet_switch", pamphlet_switch == nullptr }, - std::pair{ "medkit_switch", medkit_switch == nullptr }, - std::pair{ "fourche_switch", fourche_switch == nullptr }, - std::pair{ "dagger_switch", dagger_switch == nullptr }, - std::pair{ "rock_kit_switch", rock_kit_switch == nullptr }, - std::pair{ "sack_switch", sack_switch == nullptr }, - }; - std::vector local_test_result; - local_test_result.reserve(test_ptrs.size()); - std::for_each(test_ptrs.cbegin(), - test_ptrs.cend(), - [&local_test_result](const auto &a) { - if (a.second) { - local_test_result.emplace_back(a.first); - } - }); - return local_test_result; - }(); - if (!test_result.empty()) { - spdlog::critical("Error occurred, at least one switch is not available. See logs below"); - for (const auto result: test_result) { - spdlog::critical(result); - } - on_quit(); - return; } } - void AppWin2Back::on_quit() noexcept { + void AppWin2Back::on_quit() { auto windows = get_windows(); for (auto *window: windows) { window->set_visible(false); - delete window; } quit(); } -} // gui_to_app + +} // gui_to_app \ No newline at end of file diff --git a/app_win_2_back.hpp b/app_win_2_back.hpp index fdb5d21..fbc2d67 100644 --- a/app_win_2_back.hpp +++ b/app_win_2_back.hpp @@ -8,12 +8,8 @@ namespace learn_gtkmm4 { class HelloWorld; } -namespace Gtk { - class Builder; - class Switch; -} - namespace gui_to_app { + class AppWin2Back final : public Gtk::Application { public: ~AppWin2Back() noexcept final = default; @@ -28,25 +24,11 @@ namespace gui_to_app { void on_activate() final; private: - void on_quit() noexcept; + void on_quit(); - Glib::RefPtr app_builder; learn_gtkmm4::HelloWorld *main_window{ nullptr }; - Gtk::Switch *sword_switch{ nullptr }; - Gtk::Switch *lance_switch{ nullptr }; - Gtk::Switch *morgen_switch{ nullptr }; - Gtk::Switch *bow_switch{ nullptr }; - - Gtk::Switch *chainmail_switch{ nullptr }; - Gtk::Switch *cookpot_switch{ nullptr }; - Gtk::Switch *pamphlet_switch{ nullptr }; - Gtk::Switch *medkit_switch{ nullptr }; - - Gtk::Switch *fourche_switch{ nullptr }; - Gtk::Switch *dagger_switch{ nullptr }; - Gtk::Switch *rock_kit_switch{ nullptr }; - Gtk::Switch *sack_switch{ nullptr }; }; + } // gui_to_app #endif //LEARNGTK4_APP_WIN_2_BACK_HPP diff --git a/external/spdlog b/external/spdlog deleted file mode 160000 index 27cb4c7..0000000 --- a/external/spdlog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 27cb4c76708608465c413f6d0e6b8d99a4d84302 diff --git a/window_ui.ui b/window_ui.ui index dae0b80..0731722 100644 --- a/window_ui.ui +++ b/window_ui.ui @@ -343,7 +343,7 @@ - + end 1