From f046879194f8031c93d7e13585728f0ab2d751f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc=20Serf=C5=91z=C5=91?= Date: Wed, 11 Dec 2024 20:15:11 +0100 Subject: [PATCH] refactor(deps): Using std::format instead of libfmt --- .github/workflows/ci.yml | 1 - CMakeLists.txt | 5 +- data/packaging/xyz.safeworlds.midiconn.yml | 14 +--- docs/BUILD.md | 5 +- po/hu.po | 96 +++++++++++----------- po/midiconn.pot | 96 +++++++++++----------- src/Application.cpp | 36 ++++---- src/Licenses.cpp | 28 ------- src/LogNode.cpp | 37 ++++----- src/Version.cpp | 2 +- src/Version.hpp.in | 13 ++- src/midi/CMakeLists.txt | 2 +- src/midi/ChannelMap.hpp | 2 - src/midi/ChannelMapNode.cpp | 3 - src/midi/Note.hpp | 6 +- 15 files changed, 149 insertions(+), 197 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd94d17..ddd9eb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,6 @@ jobs: - name: Install prerequisites run: sudo apt-get update -y && sudo apt-get install -y libasound2-dev - libfmt-dev libfreetype-dev libsdl2-dev libspdlog-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index c02323c..b00c3de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,7 @@ project(midiconn VERSION 0.3.0 LANGUAGES CXX) option(MC_CHECK_FOR_UPDATES "Build ${PROJECT_NAME} to check for updates on start" OFF) -find_package(fmt REQUIRED) -find_package(spdlog REQUIRED) +find_package(spdlog 1.15.0 REQUIRED) find_package(SDL2 REQUIRED) find_package(nlohmann_json REQUIRED) if(WIN32) @@ -109,7 +108,6 @@ target_link_libraries(midiconn PRIVATE spdlog::spdlog spng_static SDL2::SDL2 - fmt::fmt freetype resources midi @@ -120,6 +118,7 @@ if(NOT WIN32 AND MC_CHECK_FOR_UPDATES) endif() target_compile_definitions(midiconn PRIVATE SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG + SPDLOG_USE_STD_FORMAT=1 IMGUI_ENABLE_FREETYPE ) diff --git a/data/packaging/xyz.safeworlds.midiconn.yml b/data/packaging/xyz.safeworlds.midiconn.yml index fc02d87..a4d9911 100644 --- a/data/packaging/xyz.safeworlds.midiconn.yml +++ b/data/packaging/xyz.safeworlds.midiconn.yml @@ -22,25 +22,15 @@ finish-args: - --device=dri - --share=ipc modules: - - name: fmt - buildsystem: cmake-ninja - config-opts: - - -DFMT_DOC=OFF - - -DFMT_INSTALL=ON - - -DFMT_TEST=OFF - - -DCMAKE_BUILD_TYPE=Release - sources: - - type: git - url: https://github.com/fmtlib/fmt - tag: '8.1.1' - name: spdlog buildsystem: cmake-ninja config-opts: - -DCMAKE_BUILD_TYPE=Release + - -DSPDLOG_USE_STD_FORMAT=ON sources: - type: git url: https://github.com/gabime/spdlog - tag: v1.10.0 + tag: v1.15.0 - name: nlohmann_json buildsystem: cmake-ninja config-opts: diff --git a/docs/BUILD.md b/docs/BUILD.md index 59cc507..8860e88 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -21,7 +21,6 @@ Make sure that the development packages of the dependencies are installed. The list of library dependencies is the following: - ALSA - JSON for Modern C++ ([nlohmann/json](https://github.com/nlohmann/json)) -- libfmt - libfreetype - libsdl2 (>= 2.0.17) - libspdlog @@ -33,13 +32,13 @@ On Ubuntu (version 22.04 or later), the following script installs these prerequi ```shell $ sudo apt-get update -$ sudo apt-get install -y git build-essential cmake libasound2-dev libfmt-dev libfreetype-dev libsdl2-dev libspdlog-dev nlohmann-json3-dev +$ sudo apt-get install -y git build-essential cmake libasound2-dev libfreetype-dev libsdl2-dev libspdlog-dev nlohmann-json3-dev ``` On Fedora (version 36 or later), the following script installs these prerequisites: ```shell -$ sudo dnf install -y git gcc-c++ cmake alsa-lib-devel fmt-devel freetype-devel json-devel SDL2-devel spdlog-devel +$ sudo dnf install -y git gcc-c++ cmake alsa-lib-devel freetype-devel json-devel SDL2-devel spdlog-devel ``` Once the prerequisites are installed, **midiconn** can be built and packaged: diff --git a/po/hu.po b/po/hu.po index 0c4b5bb..13eaf3b 100644 --- a/po/hu.po +++ b/po/hu.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: midiconn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-18 17:27+0200\n" +"POT-Creation-Date: 2024-12-11 19:57+0100\n" "PO-Revision-Date: 2024-06-17 12:09+0200\n" "Last-Translator: <>\n" "Language-Team: Hungarian\n" @@ -198,200 +198,200 @@ msgid "The change of display language is applied after restart" msgstr "A nyelv megváltoztatása a program újraindítása után jut érvényre" #. Translators: The name of the log node -#: src/LogNode.cpp:38 +#: src/LogNode.cpp:37 msgid "Message log" msgstr "Üzenetlista" #. Translators: The caption of the MIDI input pin on the node -#: src/LogNode.cpp:55 src/MidiChannelNode.cpp:68 +#: src/LogNode.cpp:54 src/MidiChannelNode.cpp:68 msgid "MIDI in" msgstr "MIDI be" #. Translators: The button to clear the buffer of the log node -#: src/LogNode.cpp:60 +#: src/LogNode.cpp:59 msgid "Clear" msgstr "Törlés" #. Translators: The input field to set the buffer size of the log node -#: src/LogNode.cpp:68 +#: src/LogNode.cpp:67 msgid "Buffer Size" msgstr "Pufferméret" #. Translators: The header of the message arrive time column -#: src/LogNode.cpp:94 +#: src/LogNode.cpp:93 msgid "Time" msgstr "Időpont" #. Translators: The header of the message type column -#: src/LogNode.cpp:98 src/LogNode.cpp:282 +#: src/LogNode.cpp:97 src/LogNode.cpp:281 msgid "Type" msgstr "Típus" #. Translators: The header of the message channel column -#: src/LogNode.cpp:100 +#: src/LogNode.cpp:99 msgid "Channel" msgstr "Csatorna" #. Translators: The header of the first message data column -#: src/LogNode.cpp:104 +#: src/LogNode.cpp:103 msgid "Data #0" msgstr "Adat 0" #. Translators: The header of the second message data column -#: src/LogNode.cpp:106 +#: src/LogNode.cpp:105 msgid "Data #1" msgstr "Adat 1" #. Translators: Name of an unrecognized MIDI message -#: src/LogNode.cpp:171 +#: src/LogNode.cpp:170 msgid "Unknown" msgstr "Ismeretlen" -#: src/LogNode.cpp:186 +#: src/LogNode.cpp:185 msgid "Note On" msgstr "Billentyűleütés" -#: src/LogNode.cpp:189 src/LogNode.cpp:196 +#: src/LogNode.cpp:188 src/LogNode.cpp:195 msgid "Velocity" msgstr "Leütés erőssége" -#: src/LogNode.cpp:193 +#: src/LogNode.cpp:192 msgid "Note Off" msgstr "Billentyűfelengedés" -#: src/LogNode.cpp:200 +#: src/LogNode.cpp:199 msgid "Poly Aftertouch" msgstr "Polifonikus Aftertouch" -#: src/LogNode.cpp:203 src/LogNode.cpp:254 +#: src/LogNode.cpp:202 src/LogNode.cpp:253 msgid "Pressure" msgstr "Nyomás" -#: src/LogNode.cpp:206 +#: src/LogNode.cpp:205 msgid "All Sound Off" msgstr "Minden hang elhallgat" -#: src/LogNode.cpp:209 +#: src/LogNode.cpp:208 msgid "Reset All Controllers" msgstr "Minden kontroller alaphelyzetbe állítása" -#: src/LogNode.cpp:213 +#: src/LogNode.cpp:212 msgid "Local Control" msgstr "Lokális vezérlés" -#: src/LogNode.cpp:215 +#: src/LogNode.cpp:214 msgid "On" msgstr "Be" -#: src/LogNode.cpp:215 +#: src/LogNode.cpp:214 msgid "Off" msgstr "Ki" -#: src/LogNode.cpp:218 +#: src/LogNode.cpp:217 msgid "All Notes Off" msgstr "Minden hangjegy elhallgat" -#: src/LogNode.cpp:221 +#: src/LogNode.cpp:220 msgid "Omni Mode Off" msgstr "Omni mód ki" -#: src/LogNode.cpp:224 +#: src/LogNode.cpp:223 msgid "Omni Mode On" msgstr "Omni mód be" -#: src/LogNode.cpp:228 +#: src/LogNode.cpp:227 msgid "Mono Mode On" msgstr "Monó mód be" -#: src/LogNode.cpp:230 +#: src/LogNode.cpp:229 msgid "Channels" msgstr "Csatornák" -#: src/LogNode.cpp:233 +#: src/LogNode.cpp:232 msgid "Poly Mode On" msgstr "Polifónikus mód be" -#: src/LogNode.cpp:237 +#: src/LogNode.cpp:236 msgid "Control Change" msgstr "Kontrollváltás" -#: src/LogNode.cpp:242 src/LogNode.cpp:260 +#: src/LogNode.cpp:241 src/LogNode.cpp:259 msgid "Value" msgstr "Érték" -#: src/LogNode.cpp:246 +#: src/LogNode.cpp:245 msgid "Program Change" msgstr "Programváltás" -#: src/LogNode.cpp:248 +#: src/LogNode.cpp:247 msgid "Program" msgstr "Program" -#: src/LogNode.cpp:252 +#: src/LogNode.cpp:251 msgid "Channel Aftertouch" msgstr "Csatorna Aftertouch" -#: src/LogNode.cpp:258 +#: src/LogNode.cpp:257 msgid "Pitch bend" msgstr "Hajlítás" -#: src/LogNode.cpp:263 +#: src/LogNode.cpp:262 msgid "Unknown channel message" msgstr "Ismeretlen csatorna üzenet" -#: src/LogNode.cpp:275 +#: src/LogNode.cpp:274 msgid "System Exclusive" msgstr "Rendszer exkluzív" -#: src/LogNode.cpp:277 +#: src/LogNode.cpp:276 msgid "bytes" msgstr "bájt" -#: src/LogNode.cpp:281 +#: src/LogNode.cpp:280 msgid "Timecode Quarter Frame" msgstr "Timekód negyed" -#: src/LogNode.cpp:283 +#: src/LogNode.cpp:282 msgid "Values" msgstr "Értékek" -#: src/LogNode.cpp:286 +#: src/LogNode.cpp:285 msgid "Song Position" msgstr "Dal pozíció" -#: src/LogNode.cpp:290 +#: src/LogNode.cpp:289 msgid "Song Select" msgstr "Dal kiválasztás" -#: src/LogNode.cpp:293 +#: src/LogNode.cpp:292 msgid "Tune Request" msgstr "Hangolási kérelem" -#: src/LogNode.cpp:296 +#: src/LogNode.cpp:295 msgid "Timing Clock" msgstr "Időzítő óra" -#: src/LogNode.cpp:299 +#: src/LogNode.cpp:298 msgid "Start Sequence" msgstr "Szekvencia elindítása" -#: src/LogNode.cpp:302 +#: src/LogNode.cpp:301 msgid "Continue Sequence" msgstr "Szekvencia folytatása" -#: src/LogNode.cpp:305 +#: src/LogNode.cpp:304 msgid "Stop Sequence" msgstr "Szekvencia leállítása" -#: src/LogNode.cpp:308 +#: src/LogNode.cpp:307 msgid "Active Sensing" msgstr "Aktív érzékelés" -#: src/LogNode.cpp:311 +#: src/LogNode.cpp:310 msgid "Reset everything" msgstr "Minden alaphelyzetbe állítása" -#: src/LogNode.cpp:314 +#: src/LogNode.cpp:313 msgid "Unknown system message" msgstr "Ismeretlen rendszerüzenet" diff --git a/po/midiconn.pot b/po/midiconn.pot index d17fb01..3d6188f 100644 --- a/po/midiconn.pot +++ b/po/midiconn.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-18 17:27+0200\n" +"POT-Creation-Date: 2024-12-11 20:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -199,200 +199,200 @@ msgid "The change of display language is applied after restart" msgstr "" #. Translators: The name of the log node -#: src/LogNode.cpp:38 +#: src/LogNode.cpp:37 msgid "Message log" msgstr "" #. Translators: The caption of the MIDI input pin on the node -#: src/LogNode.cpp:55 src/MidiChannelNode.cpp:68 +#: src/LogNode.cpp:54 src/MidiChannelNode.cpp:68 msgid "MIDI in" msgstr "" #. Translators: The button to clear the buffer of the log node -#: src/LogNode.cpp:60 +#: src/LogNode.cpp:59 msgid "Clear" msgstr "" #. Translators: The input field to set the buffer size of the log node -#: src/LogNode.cpp:68 +#: src/LogNode.cpp:67 msgid "Buffer Size" msgstr "" #. Translators: The header of the message arrive time column -#: src/LogNode.cpp:94 +#: src/LogNode.cpp:93 msgid "Time" msgstr "" #. Translators: The header of the message type column -#: src/LogNode.cpp:98 src/LogNode.cpp:282 +#: src/LogNode.cpp:97 src/LogNode.cpp:281 msgid "Type" msgstr "" #. Translators: The header of the message channel column -#: src/LogNode.cpp:100 +#: src/LogNode.cpp:99 msgid "Channel" msgstr "" #. Translators: The header of the first message data column -#: src/LogNode.cpp:104 +#: src/LogNode.cpp:103 msgid "Data #0" msgstr "" #. Translators: The header of the second message data column -#: src/LogNode.cpp:106 +#: src/LogNode.cpp:105 msgid "Data #1" msgstr "" #. Translators: Name of an unrecognized MIDI message -#: src/LogNode.cpp:171 +#: src/LogNode.cpp:170 msgid "Unknown" msgstr "" -#: src/LogNode.cpp:186 +#: src/LogNode.cpp:185 msgid "Note On" msgstr "" -#: src/LogNode.cpp:189 src/LogNode.cpp:196 +#: src/LogNode.cpp:188 src/LogNode.cpp:195 msgid "Velocity" msgstr "" -#: src/LogNode.cpp:193 +#: src/LogNode.cpp:192 msgid "Note Off" msgstr "" -#: src/LogNode.cpp:200 +#: src/LogNode.cpp:199 msgid "Poly Aftertouch" msgstr "" -#: src/LogNode.cpp:203 src/LogNode.cpp:254 +#: src/LogNode.cpp:202 src/LogNode.cpp:253 msgid "Pressure" msgstr "" -#: src/LogNode.cpp:206 +#: src/LogNode.cpp:205 msgid "All Sound Off" msgstr "" -#: src/LogNode.cpp:209 +#: src/LogNode.cpp:208 msgid "Reset All Controllers" msgstr "" -#: src/LogNode.cpp:213 +#: src/LogNode.cpp:212 msgid "Local Control" msgstr "" -#: src/LogNode.cpp:215 +#: src/LogNode.cpp:214 msgid "On" msgstr "" -#: src/LogNode.cpp:215 +#: src/LogNode.cpp:214 msgid "Off" msgstr "" -#: src/LogNode.cpp:218 +#: src/LogNode.cpp:217 msgid "All Notes Off" msgstr "" -#: src/LogNode.cpp:221 +#: src/LogNode.cpp:220 msgid "Omni Mode Off" msgstr "" -#: src/LogNode.cpp:224 +#: src/LogNode.cpp:223 msgid "Omni Mode On" msgstr "" -#: src/LogNode.cpp:228 +#: src/LogNode.cpp:227 msgid "Mono Mode On" msgstr "" -#: src/LogNode.cpp:230 +#: src/LogNode.cpp:229 msgid "Channels" msgstr "" -#: src/LogNode.cpp:233 +#: src/LogNode.cpp:232 msgid "Poly Mode On" msgstr "" -#: src/LogNode.cpp:237 +#: src/LogNode.cpp:236 msgid "Control Change" msgstr "" -#: src/LogNode.cpp:242 src/LogNode.cpp:260 +#: src/LogNode.cpp:241 src/LogNode.cpp:259 msgid "Value" msgstr "" -#: src/LogNode.cpp:246 +#: src/LogNode.cpp:245 msgid "Program Change" msgstr "" -#: src/LogNode.cpp:248 +#: src/LogNode.cpp:247 msgid "Program" msgstr "" -#: src/LogNode.cpp:252 +#: src/LogNode.cpp:251 msgid "Channel Aftertouch" msgstr "" -#: src/LogNode.cpp:258 +#: src/LogNode.cpp:257 msgid "Pitch bend" msgstr "" -#: src/LogNode.cpp:263 +#: src/LogNode.cpp:262 msgid "Unknown channel message" msgstr "" -#: src/LogNode.cpp:275 +#: src/LogNode.cpp:274 msgid "System Exclusive" msgstr "" -#: src/LogNode.cpp:277 +#: src/LogNode.cpp:276 msgid "bytes" msgstr "" -#: src/LogNode.cpp:281 +#: src/LogNode.cpp:280 msgid "Timecode Quarter Frame" msgstr "" -#: src/LogNode.cpp:283 +#: src/LogNode.cpp:282 msgid "Values" msgstr "" -#: src/LogNode.cpp:286 +#: src/LogNode.cpp:285 msgid "Song Position" msgstr "" -#: src/LogNode.cpp:290 +#: src/LogNode.cpp:289 msgid "Song Select" msgstr "" -#: src/LogNode.cpp:293 +#: src/LogNode.cpp:292 msgid "Tune Request" msgstr "" -#: src/LogNode.cpp:296 +#: src/LogNode.cpp:295 msgid "Timing Clock" msgstr "" -#: src/LogNode.cpp:299 +#: src/LogNode.cpp:298 msgid "Start Sequence" msgstr "" -#: src/LogNode.cpp:302 +#: src/LogNode.cpp:301 msgid "Continue Sequence" msgstr "" -#: src/LogNode.cpp:305 +#: src/LogNode.cpp:304 msgid "Stop Sequence" msgstr "" -#: src/LogNode.cpp:308 +#: src/LogNode.cpp:307 msgid "Active Sensing" msgstr "" -#: src/LogNode.cpp:311 +#: src/LogNode.cpp:310 msgid "Reset everything" msgstr "" -#: src/LogNode.cpp:314 +#: src/LogNode.cpp:313 msgid "Unknown system message" msgstr "" diff --git a/src/Application.cpp b/src/Application.cpp index 3513e96..670cdcb 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -167,19 +167,19 @@ void Application::render_main_menu() if (ImGui::BeginMenuBar()) { // Translators: File menu label - static auto begin_menu_label = fmt::format("{} {}", ICON_FK_FILE_O, gettext("File")); + static auto begin_menu_label = std::format("{} {}", ICON_FK_FILE_O, gettext("File")); if (ImGui::BeginMenu(begin_menu_label.c_str())) { static auto new_preset_label = // Translators: Menu entry to initialize an empty preset - fmt::format("{} {}", ICON_FK_FILE_O, gettext("New preset")); + std::format("{} {}", ICON_FK_FILE_O, gettext("New preset")); if (ImGui::MenuItem(new_preset_label.c_str(), "Ctrl+N")) { new_preset(); } static auto open_preset_label = // Translators: Menu entry to open a preset file - fmt::format("{} {}", ICON_FK_FOLDER_OPEN_O, gettext("Open preset")); + std::format("{} {}", ICON_FK_FOLDER_OPEN_O, gettext("Open preset")); if (ImGui::MenuItem(open_preset_label.c_str(), "Ctrl+O")) { open_preset(); @@ -187,14 +187,14 @@ void Application::render_main_menu() static auto save_preset_label = // Translators: Menu entry to save the current preset to file where it was already // saved - fmt::format("{} {}", ICON_FK_FLOPPY_O, gettext("Save preset")); + std::format("{} {}", ICON_FK_FLOPPY_O, gettext("Save preset")); if (ImGui::MenuItem(save_preset_label.c_str(), "Ctrl+S")) { save_preset(); } static auto save_preset_as_label = // Translators: Menu entry to save the current preset to file (query location) - fmt::format("{} {}", ICON_FK_FLOPPY_O, gettext("Save preset as")); + std::format("{} {}", ICON_FK_FLOPPY_O, gettext("Save preset as")); if (ImGui::MenuItem(save_preset_as_label.c_str(), "Ctrl+Shift+S")) { save_preset_as(); @@ -202,7 +202,7 @@ void Application::render_main_menu() ImGui::Separator(); static auto exit_label = // Translators: Menu entry to exit the program - fmt::format("{} {}", ICON_FK_TIMES, gettext("Exit")); + std::format("{} {}", ICON_FK_TIMES, gettext("Exit")); if (ImGui::MenuItem(exit_label.c_str(), "Alt+F4")) { exit(); @@ -211,18 +211,18 @@ void Application::render_main_menu() } static auto settings_label = // Translators: Settings menu label - fmt::format("{} {}", ICON_FK_COG, gettext("Settings")); + std::format("{} {}", ICON_FK_COG, gettext("Settings")); if (ImGui::BeginMenu(settings_label.c_str())) { static auto theme_label = // Translators: Theme menu label - fmt::format("{} {}", ICON_FK_PAINT_BRUSH, gettext("Theme")); + std::format("{} {}", ICON_FK_PAINT_BRUSH, gettext("Theme")); if (ImGui::BeginMenu(theme_label.c_str())) { const auto current_theme = m_theme_control.get_theme(); static auto dark_theme_label = // Translators: Menu entry for selecting the dark theme - fmt::format("{} {}", ICON_FK_MOON_O, gettext("Dark theme")); + std::format("{} {}", ICON_FK_MOON_O, gettext("Dark theme")); if (ImGui::MenuItem( dark_theme_label.c_str(), nullptr, current_theme == Theme::Dark)) { @@ -230,7 +230,7 @@ void Application::render_main_menu() } static auto light_theme_label = // Translators: Menu entry for selecting the light theme - fmt::format("{} {}", ICON_FK_SUN_O, gettext("Light theme")); + std::format("{} {}", ICON_FK_SUN_O, gettext("Light theme")); if (ImGui::MenuItem( light_theme_label.c_str(), nullptr, current_theme == Theme::Light)) { @@ -238,7 +238,7 @@ void Application::render_main_menu() } static auto classic_theme_label = // Translators: Menu entry for selecting the classic theme - fmt::format("{} {}", ICON_FK_STAR_O, gettext("Classic theme")); + std::format("{} {}", ICON_FK_STAR_O, gettext("Classic theme")); if (ImGui::MenuItem( classic_theme_label.c_str(), nullptr, current_theme == Theme::Classic)) { @@ -248,7 +248,7 @@ void Application::render_main_menu() } static auto interface_scale_label = // Translators: Menu entry for selecting the interface scale - fmt::format("{} {}", ICON_FK_EYE, gettext("Interface Scale")); + std::format("{} {}", ICON_FK_EYE, gettext("Interface Scale")); if (ImGui::BeginMenu(interface_scale_label.c_str())) { const auto current_scale = m_theme_control.get_scale(); @@ -268,7 +268,7 @@ void Application::render_main_menu() #ifndef _WIN32 static auto language_label = // Translators: Menu entry for selecting the display language - fmt::format("{} {}", ICON_FK_LANGUAGE, gettext("Language")); + std::format("{} {}", ICON_FK_LANGUAGE, gettext("Language")); if (ImGui::BeginMenu(language_label.c_str())) { const auto& current_locale = m_config.get_locale(); @@ -300,12 +300,12 @@ void Application::render_main_menu() } static auto help_label = // Translators: Menu entry for the help submenu - fmt::format("{} {}", ICON_FK_QUESTION, gettext("Help")); + std::format("{} {}", ICON_FK_QUESTION, gettext("Help")); if (ImGui::BeginMenu(help_label.c_str())) { static auto debug_log_label = // Translators: Menu entry to enable and disable debug logging - fmt::format("{} {}", ICON_FK_PENCIL, gettext("Enable debug log")); + std::format("{} {}", ICON_FK_PENCIL, gettext("Enable debug log")); if (ImGui::MenuItem(debug_log_label.c_str(), nullptr, &m_debug_log_enabled)) { spdlog::set_level(m_debug_log_enabled ? spdlog::level::debug : spdlog::level::info); @@ -313,21 +313,21 @@ void Application::render_main_menu() } static auto open_logfile_label = // Translators: Menu entry to open the log file with the default application - fmt::format("{} {}", ICON_FK_PENCIL_SQUARE, gettext("Open logfile")); + std::format("{} {}", ICON_FK_PENCIL_SQUARE, gettext("Open logfile")); if (ImGui::MenuItem(open_logfile_label.c_str())) { platform::open_logfile_external(); } static auto visit_website_label = // Translators: Menu entry to open the project's website with the browser - fmt::format("{} {}", ICON_FK_GLOBE, gettext("Visit website")); + std::format("{} {}", ICON_FK_GLOBE, gettext("Visit website")); if (ImGui::MenuItem(visit_website_label.c_str())) { SDL_OpenURL(MC_WEBSITE_URL); } static auto about_label = // Translators: Menu entry to open the about window - fmt::format("{} {}", ICON_FK_QUESTION, gettext("About")); + std::format("{} {}", ICON_FK_QUESTION, gettext("About")); if (ImGui::MenuItem(about_label.c_str())) { m_welcome_enabled = true; diff --git a/src/Licenses.cpp b/src/Licenses.cpp index 5d9c7f6..2065dce 100644 --- a/src/Licenses.cpp +++ b/src/Licenses.cpp @@ -172,34 +172,6 @@ std::vector g_licenses{ "2. Altered source versions must be plainly marked as such, and must not be\n" " misrepresented as being the original software.\n" "3. This notice may not be removed or altered from any source distribution.\n"}, - {"fmt", - "Copyright (c) 2012 - present, Victor Zverovich\n" - "\n" - "Permission is hereby granted, free of charge, to any person obtaining\n" - "a copy of this software and associated documentation files (the\n" - "\" Software \"), to deal in the Software without restriction, including\n" - "without limitation the rights to use, copy, modify, merge, publish,\n" - "distribute, sublicense, and/or sell copies of the Software, and to\n" - "permit persons to whom the Software is furnished to do so, subject to\n" - "the following conditions:\n" - "\n" - "The above copyright notice and this permission notice shall be\n" - "included in all copies or substantial portions of the Software.\n" - "\n" - "THE SOFTWARE IS PROVIDED \" AS IS \", WITHOUT WARRANTY OF ANY KIND,\n" - "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" - "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" - "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" - "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" - "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" - "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n" - "\n" - "--- Optional exception to the license ---\n" - "\n" - "As an exception, if, as a result of your compiling your source code, portions\n" - "of this Software are embedded into a machine-executable object form of such\n" - "source code, you may redistribute such embedded portions in such object form\n" - "without including the above copyright and permission notices.\n" }, {"libspng", "BSD 2-Clause License\n" "\n" diff --git a/src/LogNode.cpp b/src/LogNode.cpp index 5f61bb6..9e41c98 100644 --- a/src/LogNode.cpp +++ b/src/LogNode.cpp @@ -7,11 +7,10 @@ #include "imgui.h" #include "imnodes.h" - -#include "fmt/format.h" - #include "libintl.h" +#include + std::string_view mc::LogNode::LogMidiNode::name() { return "Log Node"; @@ -185,22 +184,22 @@ mc::LogNode::BufferElement mc::LogNode::parse_channel_message( return BufferElement{ gettext("Note On"), note_on.get_channel_human(), - fmt::format("{}", midi::Note(note_on.get_note())), - fmt::format("{}: {}", gettext("Velocity"), note_on.get_velocity())}; + std::format("{}", midi::Note(note_on.get_note())), + std::format("{}: {}", gettext("Velocity"), note_on.get_velocity())}; }, [](midi::NoteOffMessageViewTag, auto note_off) -> BufferElement { return BufferElement{ gettext("Note Off"), note_off.get_channel_human(), - fmt::format("{}", midi::Note(note_off.get_note())), - fmt::format("{}: {}", gettext("Velocity"), note_off.get_velocity())}; + std::format("{}", midi::Note(note_off.get_note())), + std::format("{}: {}", gettext("Velocity"), note_off.get_velocity())}; }, [](midi::PolyKeyPressureMessageViewTag, auto poly_key_pressure) -> BufferElement { return BufferElement{ gettext("Poly Aftertouch"), poly_key_pressure.get_channel_human(), - fmt::format("{}", midi::Note(poly_key_pressure.get_note())), - fmt::format("{}: {}", gettext("Pressure"), poly_key_pressure.get_pressure())}; + std::format("{}", midi::Note(poly_key_pressure.get_note())), + std::format("{}: {}", gettext("Pressure"), poly_key_pressure.get_pressure())}; }, [](midi::AllSoundOffMessageViewTag, auto all_sound_off) -> BufferElement { return BufferElement{gettext("All Sound Off"), all_sound_off.get_channel_human()}; @@ -227,7 +226,7 @@ mc::LogNode::BufferElement mc::LogNode::parse_channel_message( return BufferElement{ gettext("Mono Mode On"), mono_mode.get_channel_human(), - fmt::format("{}: {}", gettext("Channels"), mono_mode.get_num_channels())}; + std::format("{}: {}", gettext("Channels"), mono_mode.get_num_channels())}; }, [](midi::PolyModeOnMessageViewTag, auto poly_mode) -> BufferElement { return BufferElement{gettext("Poly Mode On"), poly_mode.get_channel_human()}; @@ -236,28 +235,28 @@ mc::LogNode::BufferElement mc::LogNode::parse_channel_message( return BufferElement{ gettext("Control Change"), control_change.get_channel_human(), - fmt::format("CC {} ({})", + std::format("CC {} ({})", control_change.get_controller(), control_change.get_function_name()), - fmt::format("{}: {}", gettext("Value"), control_change.get_value())}; + std::format("{}: {}", gettext("Value"), control_change.get_value())}; }, [](midi::ProgramChangeMessageViewTag, auto program_change) -> BufferElement { return BufferElement{ gettext("Program Change"), program_change.get_channel_human(), - fmt::format("{}: {}", gettext("Program"), program_change.get_program_number())}; + std::format("{}: {}", gettext("Program"), program_change.get_program_number())}; }, [](midi::ChannelPressureMessageViewTag, auto channel_pressure) -> BufferElement { return BufferElement{ gettext("Channel Aftertouch"), channel_pressure.get_channel_human(), - fmt::format("{}: {}", gettext("Pressure"), channel_pressure.get_pressure())}; + std::format("{}: {}", gettext("Pressure"), channel_pressure.get_pressure())}; }, [](midi::PitchBendMessageViewTag, auto pitch_bend) -> BufferElement { return BufferElement{ gettext("Pitch bend"), pitch_bend.get_channel_human(), - fmt::format("{}: {}", gettext("Value"), pitch_bend.get_value_human())}; + std::format("{}: {}", gettext("Value"), pitch_bend.get_value_human())}; }, [](auto, auto) -> BufferElement { return BufferElement{gettext("Unknown channel message")}; @@ -273,14 +272,14 @@ mc::LogNode::BufferElement mc::LogNode::parse_system_message( [](midi::SystemExclusiveMessageViewTag, auto system_exclusive) -> BufferElement { return BufferElement{ gettext("System Exclusive"), - fmt::format("ID: {}", system_exclusive.get_manufacturer_id()), - fmt::format("{} {}", system_exclusive.get_length(), gettext("bytes"))}; + std::format("ID: {}", system_exclusive.get_manufacturer_id()), + std::format("{} {}", system_exclusive.get_length(), gettext("bytes"))}; }, [](midi::TimeCodeQuarterFrameMessageViewTag, auto timecode_quarter) -> BufferElement { return BufferElement{ gettext("Timecode Quarter Frame"), - fmt::format("{}: {}", gettext("Type"), timecode_quarter.get_type()), - fmt::format("{}: {}", gettext("Values"), timecode_quarter.get_values())}; + std::format("{}: {}", gettext("Type"), timecode_quarter.get_type()), + std::format("{}: {}", gettext("Values"), timecode_quarter.get_values())}; }, [](midi::SongPositionPointerMessageViewTag, auto song_position) -> BufferElement { return BufferElement{gettext("Song Position"), diff --git a/src/Version.cpp b/src/Version.cpp index 33df13b..15d56c3 100644 --- a/src/Version.cpp +++ b/src/Version.cpp @@ -56,6 +56,6 @@ Version Version::parse(std::string_view str) } const Version g_current_version = Version::parse(MC_FULL_VERSION); -const std::string g_current_version_str = fmt::format("{}", g_current_version); +const std::string g_current_version_str = std::format("{}", g_current_version); } // namespace mc diff --git a/src/Version.hpp.in b/src/Version.hpp.in index 8053a71..904e7a1 100644 --- a/src/Version.hpp.in +++ b/src/Version.hpp.in @@ -1,10 +1,9 @@ #pragma once #include +#include #include -#include #include -#include "fmt/format.h" #define MC_MAJOR_VERSION "@CMAKE_PROJECT_VERSION_MAJOR@" #define MC_MINOR_VERSION "@CMAKE_PROJECT_VERSION_MINOR@" @@ -51,23 +50,23 @@ private: int m_patch; std::optional m_build_num; - friend struct fmt::formatter; + friend struct std::formatter; }; } // namespace mc template <> -struct fmt::formatter +struct std::formatter { constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } - auto format(const mc::Version& v, format_context& ctx) + auto format(const mc::Version& v, format_context& ctx) const { if (v.m_build_num.has_value()) { - return fmt::format_to(ctx.out(), "{}.{}.{}.{}", v.m_major, v.m_minor, v.m_patch, *v.m_build_num); + return std::format_to(ctx.out(), "{}.{}.{}.{}", v.m_major, v.m_minor, v.m_patch, *v.m_build_num); } - return fmt::format_to(ctx.out(), "{}.{}.{}", v.m_major, v.m_minor, v.m_patch); + return std::format_to(ctx.out(), "{}.{}.{}", v.m_major, v.m_minor, v.m_patch); } }; diff --git a/src/midi/CMakeLists.txt b/src/midi/CMakeLists.txt index 344f41f..092af1d 100644 --- a/src/midi/CMakeLists.txt +++ b/src/midi/CMakeLists.txt @@ -9,4 +9,4 @@ add_library(midi STATIC ) target_compile_features(midi PUBLIC cxx_std_20) -target_link_libraries(midi PRIVATE fmt::fmt rtmidi spdlog::spdlog) +target_link_libraries(midi PRIVATE rtmidi spdlog::spdlog) diff --git a/src/midi/ChannelMap.hpp b/src/midi/ChannelMap.hpp index 7679583..0cd8add 100644 --- a/src/midi/ChannelMap.hpp +++ b/src/midi/ChannelMap.hpp @@ -1,10 +1,8 @@ #pragma once -#include "fmt/format.h" #include #include -#include namespace mc::midi { diff --git a/src/midi/ChannelMapNode.cpp b/src/midi/ChannelMapNode.cpp index 1868b5f..44eeeab 100644 --- a/src/midi/ChannelMapNode.cpp +++ b/src/midi/ChannelMapNode.cpp @@ -2,9 +2,6 @@ #include "MessageView.hpp" -#include "fmt/format.h" - -#include #include mc::midi::ChannelMapNode::ChannelMapNode(const ChannelMap& map) : m_map(map) diff --git a/src/midi/Note.hpp b/src/midi/Note.hpp index 03d7fa3..c54e4c9 100644 --- a/src/midi/Note.hpp +++ b/src/midi/Note.hpp @@ -1,6 +1,6 @@ #pragma once -#include "fmt/format.h" +#include #include #include @@ -16,13 +16,13 @@ class Note final private: unsigned char m_note; - friend struct fmt::formatter; + friend struct std::formatter; }; } // namespace mc::midi template <> -struct fmt::formatter +struct std::formatter { template constexpr ParseContext::iterator parse(ParseContext& ctx)