2021-06-12 17:49:53 +02:00
|
|
|
#include "settingsui.h"
|
|
|
|
|
#include "imgui/imgui.h"
|
|
|
|
|
#include "settings.h"
|
2021-06-21 18:13:40 +02:00
|
|
|
#include "module.h"
|
2021-06-12 17:49:53 +02:00
|
|
|
|
2021-06-12 21:14:32 +02:00
|
|
|
bool use_light_theme;
|
2021-06-25 14:52:03 +02:00
|
|
|
float manual_dpi_scaling;
|
2021-06-12 21:14:32 +02:00
|
|
|
|
|
|
|
|
void parseSettingsOrDefaults()
|
|
|
|
|
{
|
|
|
|
|
if (settings.contains("use_light_theme"))
|
|
|
|
|
use_light_theme = settings["use_light_theme"].get<int>();
|
|
|
|
|
else
|
|
|
|
|
use_light_theme = false;
|
2021-06-21 18:13:40 +02:00
|
|
|
|
|
|
|
|
if (settings.contains("demod_constellation_size"))
|
|
|
|
|
demod_constellation_size = settings["demod_constellation_size"].get<int>();
|
|
|
|
|
else
|
|
|
|
|
demod_constellation_size = 200;
|
2021-06-25 14:52:03 +02:00
|
|
|
|
|
|
|
|
if (settings.contains("manual_dpi_scaling"))
|
|
|
|
|
manual_dpi_scaling = settings["manual_dpi_scaling"].get<float>();
|
|
|
|
|
else
|
|
|
|
|
manual_dpi_scaling = 1.0f;
|
2021-06-12 21:14:32 +02:00
|
|
|
}
|
|
|
|
|
|
2021-06-12 17:49:53 +02:00
|
|
|
void renderSettings(int wwidth, int wheight)
|
|
|
|
|
{
|
2021-06-12 21:14:32 +02:00
|
|
|
ImGui::Checkbox("Use Light Theme", &use_light_theme);
|
2021-06-25 14:52:03 +02:00
|
|
|
ImGui::SetNextItemWidth(200 * ui_scale);
|
2021-06-21 18:13:40 +02:00
|
|
|
ImGui::InputInt("Demod constellation size", &demod_constellation_size);
|
2021-06-25 14:52:03 +02:00
|
|
|
ImGui::SetNextItemWidth(200 * ui_scale);
|
|
|
|
|
ImGui::InputFloat("Manual DPI Scaling", &manual_dpi_scaling, 0.1f);
|
2021-06-12 21:14:32 +02:00
|
|
|
|
2021-06-12 17:49:53 +02:00
|
|
|
ImGui::BeginGroup();
|
|
|
|
|
if (ImGui::Button("Save"))
|
2021-06-12 21:14:32 +02:00
|
|
|
{
|
|
|
|
|
settings["use_light_theme"] = use_light_theme;
|
2021-06-21 18:13:40 +02:00
|
|
|
settings["demod_constellation_size"] = demod_constellation_size;
|
2021-06-25 14:52:03 +02:00
|
|
|
settings["manual_dpi_scaling"] = manual_dpi_scaling;
|
2021-06-12 21:14:32 +02:00
|
|
|
|
2021-06-12 17:49:53 +02:00
|
|
|
saveSettings();
|
2021-06-12 21:14:32 +02:00
|
|
|
}
|
2021-06-12 17:49:53 +02:00
|
|
|
ImGui::SameLine();
|
2021-06-12 21:14:32 +02:00
|
|
|
ImGui::TextColored(ImColor::HSV(0 / 360.0, 1, 1, 1.0), "Restarting SatDump may be necessary to apply some settings properly!");
|
2021-06-12 17:49:53 +02:00
|
|
|
ImGui::EndGroup();
|
|
|
|
|
}
|