summaryrefslogtreecommitdiff
path: root/src/ui/ui_settings.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-10-05 15:15:55 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-10-05 15:15:55 +0200
commitb278d242d03ba614779243ec9e9495fc95abea3d (patch)
tree0d3cd94a3a059b0754c61da075c7dcecc081f358 /src/ui/ui_settings.cpp
parent0a2b0e347d926ac0f29c9dd0f49e00634e822d0e (diff)
strops format
Diffstat (limited to 'src/ui/ui_settings.cpp')
-rw-r--r--src/ui/ui_settings.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/ui/ui_settings.cpp b/src/ui/ui_settings.cpp
index cb6cdf5..8177f07 100644
--- a/src/ui/ui_settings.cpp
+++ b/src/ui/ui_settings.cpp
@@ -15,13 +15,13 @@
*/
#include <stdlib.h>
-#include <stdio.h>
#include "strops.hpp"
#include "ui.hpp"
#include "imgui.h"
#include "administration.hpp"
#include "locales.hpp"
+#include "importer.hpp"
#include "administration_writer.hpp"
extern void draw_contact_form(contact* buffer, bool viewing_only = false);
@@ -103,7 +103,7 @@ static void draw_vat_rates()
ImGui::TableNextRow();
char locale_buf[20];
- snprintf(locale_buf, sizeof(locale_buf), "country.%s", c.country_code);
+ strops::format(locale_buf, sizeof(locale_buf), "country.%s", c.country_code);
ImGui::TableSetColumnIndex(0);
ImGui::Text(locale::get(locale_buf));
@@ -112,7 +112,7 @@ static void draw_vat_rates()
{
ImGui::SameLine();
char btn_name[20];
- snprintf(btn_name, sizeof(btn_name), "+##%d",i);
+ strops::format(btn_name, sizeof(btn_name), "+##%d",i);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0));
if (ImGui::Button(btn_name, ImVec2(20,20))) {
is_adding_item = true;
@@ -131,7 +131,7 @@ static void draw_vat_rates()
ImGui::TableSetColumnIndex(0);
char category_code_desc[MAX_LEN_LONG_DESC];
- snprintf(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", c.category_code);
+ strops::format(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", c.category_code);
ImGui::Text(can_be_modified ? "" : locale::get(category_code_desc));
@@ -338,18 +338,17 @@ static void draw_services()
// AI service
if (ImGui::CollapsingHeader(locale::get("settings.services.ai_service")))
{
- // TODO: get this from iterator over ai_get_impl
- char* services[2] = {
- "OpenAI",
- "DeepSeek",
- };
+ char* ai_service_names[AI_PROVIDER_END];
+ for (u32 i = 0; i < AI_PROVIDER_END; i++) {
+ ai_service_names[i] = importer::get_ai_provider_implementation((ai_provider)i).provider_name;
+ }
- if (ImGui::BeginCombo(locale::get("settings.services.ai_service.provider"), services[new_service.provider]))
+ if (ImGui::BeginCombo(locale::get("settings.services.ai_service.provider"), ai_service_names[new_service.provider]))
{
for (u32 n = 0; n < 2; n++)
{
bool is_selected = n == (uint32_t)new_service.provider;
- if (ImGui::Selectable(services[n], is_selected)) {
+ if (ImGui::Selectable(ai_service_names[n], is_selected)) {
new_service.provider = (ai_provider)n;
}
}