mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-13 20:45:25 +02:00
Switched to a custom logging lib instead of that spdlog junk
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#include <gui/colormaps.h>
|
||||
#include <filesystem>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utils/flog.h>
|
||||
#include <fstream>
|
||||
#include <json.hpp>
|
||||
|
||||
@ -11,7 +11,7 @@ namespace colormaps {
|
||||
|
||||
void loadMap(std::string path) {
|
||||
if (!std::filesystem::is_regular_file(path)) {
|
||||
spdlog::error("Could not load {0}, file doesn't exist", path);
|
||||
flog::error("Could not load {0}, file doesn't exist", path);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ namespace colormaps {
|
||||
mapTxt = data["map"].get<std::vector<std::string>>();
|
||||
}
|
||||
catch (const std::exception&) {
|
||||
spdlog::error("Could not load {0}", path);
|
||||
flog::error("Could not load {0}", path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include <imgui/stb_image.h>
|
||||
#include <filesystem>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utils/flog.h>
|
||||
|
||||
namespace icons {
|
||||
ImTextureID LOGO;
|
||||
@ -33,7 +33,7 @@ namespace icons {
|
||||
|
||||
bool load(std::string resDir) {
|
||||
if (!std::filesystem::is_directory(resDir)) {
|
||||
spdlog::error("Invalid resource directory: {0}", resDir);
|
||||
flog::error("Invalid resource directory: {0}", resDir);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -49,19 +49,19 @@ void MainWindow::init() {
|
||||
gui::menu.order.clear();
|
||||
for (auto& elem : menuElements) {
|
||||
if (!elem.contains("name")) {
|
||||
spdlog::error("Menu element is missing name key");
|
||||
flog::error("Menu element is missing name key");
|
||||
continue;
|
||||
}
|
||||
if (!elem["name"].is_string()) {
|
||||
spdlog::error("Menu element name isn't a string");
|
||||
flog::error("Menu element name isn't a string");
|
||||
continue;
|
||||
}
|
||||
if (!elem.contains("open")) {
|
||||
spdlog::error("Menu element is missing open key");
|
||||
flog::error("Menu element is missing open key");
|
||||
continue;
|
||||
}
|
||||
if (!elem["open"].is_boolean()) {
|
||||
spdlog::error("Menu element name isn't a string");
|
||||
flog::error("Menu element name isn't a string");
|
||||
continue;
|
||||
}
|
||||
Menu::MenuOption_t opt;
|
||||
@ -95,7 +95,7 @@ void MainWindow::init() {
|
||||
vfoCreatedHandler.ctx = this;
|
||||
sigpath::vfoManager.onVfoCreated.bindHandler(&vfoCreatedHandler);
|
||||
|
||||
spdlog::info("Loading modules");
|
||||
flog::info("Loading modules");
|
||||
|
||||
// Load modules from /module directory
|
||||
if (std::filesystem::is_directory(modulesDir)) {
|
||||
@ -105,13 +105,13 @@ void MainWindow::init() {
|
||||
continue;
|
||||
}
|
||||
if (!file.is_regular_file()) { continue; }
|
||||
spdlog::info("Loading {0}", path);
|
||||
flog::info("Loading {0}", path);
|
||||
LoadingScreen::show("Loading " + file.path().filename().string());
|
||||
core::moduleManager.loadModule(path);
|
||||
}
|
||||
}
|
||||
else {
|
||||
spdlog::warn("Module directory {0} does not exist, not loading modules from directory", modulesDir);
|
||||
flog::warn("Module directory {0} does not exist, not loading modules from directory", modulesDir);
|
||||
}
|
||||
|
||||
// Read module config
|
||||
@ -124,7 +124,7 @@ void MainWindow::init() {
|
||||
for (auto const& path : modules) {
|
||||
#ifndef __ANDROID__
|
||||
std::string apath = std::filesystem::absolute(path).string();
|
||||
spdlog::info("Loading {0}", apath);
|
||||
flog::info("Loading {0}", apath);
|
||||
LoadingScreen::show("Loading " + std::filesystem::path(path).filename().string());
|
||||
core::moduleManager.loadModule(apath);
|
||||
#else
|
||||
@ -136,7 +136,7 @@ void MainWindow::init() {
|
||||
for (auto const& [name, _module] : modList) {
|
||||
std::string mod = _module["module"];
|
||||
bool enabled = _module["enabled"];
|
||||
spdlog::info("Initializing {0} ({1})", name, mod);
|
||||
flog::info("Initializing {0} ({1})", name, mod);
|
||||
LoadingScreen::show("Initializing " + name + " (" + mod + ")");
|
||||
core::moduleManager.createInstance(name, mod);
|
||||
if (!enabled) { core::moduleManager.disableInstance(name); }
|
||||
@ -144,12 +144,12 @@ void MainWindow::init() {
|
||||
|
||||
// Load color maps
|
||||
LoadingScreen::show("Loading color maps");
|
||||
spdlog::info("Loading color maps");
|
||||
flog::info("Loading color maps");
|
||||
if (std::filesystem::is_directory(resourcesDir + "/colormaps")) {
|
||||
for (const auto& file : std::filesystem::directory_iterator(resourcesDir + "/colormaps")) {
|
||||
std::string path = file.path().generic_string();
|
||||
LoadingScreen::show("Loading " + file.path().filename().string());
|
||||
spdlog::info("Loading {0}", path);
|
||||
flog::info("Loading {0}", path);
|
||||
if (file.path().extension().generic_string() != ".json") {
|
||||
continue;
|
||||
}
|
||||
@ -158,7 +158,7 @@ void MainWindow::init() {
|
||||
}
|
||||
}
|
||||
else {
|
||||
spdlog::warn("Color map directory {0} does not exist, not loading modules from directory", modulesDir);
|
||||
flog::warn("Color map directory {0} does not exist, not loading modules from directory", modulesDir);
|
||||
}
|
||||
|
||||
gui::waterfall.updatePalletteFromArray(colormaps::maps["Turbo"].map, colormaps::maps["Turbo"].entryCount);
|
||||
@ -510,7 +510,7 @@ void MainWindow::draw() {
|
||||
// ImGui::Text("Buffering: %d", (sigpath::iqFrontEnd.inputBuffer.writeCur - sigpath::iqFrontEnd.inputBuffer.readCur + 32) % 32);
|
||||
|
||||
if (ImGui::Button("Test Bug")) {
|
||||
spdlog::error("Will this make the software crash?");
|
||||
flog::error("Will this make the software crash?");
|
||||
}
|
||||
|
||||
if (ImGui::Button("Testing something")) {
|
||||
|
@ -195,7 +195,7 @@ namespace SmGui {
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
spdlog::error("Invalid widget in Drawlist");
|
||||
flog::error("Invalid widget in Drawlist");
|
||||
}
|
||||
|
||||
if (elem.step != DRAW_STEP_FILL_WIDTH) { nextItemFillWidth = false; }
|
||||
@ -293,7 +293,7 @@ namespace SmGui {
|
||||
|
||||
// Validate and clear if invalid
|
||||
if (!validate()) {
|
||||
spdlog::error("Drawlist validation failed");
|
||||
flog::error("Drawlist validation failed");
|
||||
//elements.clear();
|
||||
return -1;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <config.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utils/flog.h>
|
||||
#include <filesystem>
|
||||
|
||||
namespace style {
|
||||
@ -22,7 +22,7 @@ namespace style {
|
||||
bool loadFonts(std::string resDir) {
|
||||
ImFontAtlas* fonts = ImGui::GetIO().Fonts;
|
||||
if (!std::filesystem::is_directory(resDir)) {
|
||||
spdlog::error("Invalid resource directory: {0}", resDir);
|
||||
flog::error("Invalid resource directory: {0}", resDir);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <json.hpp>
|
||||
#include <gui/theme_manager.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utils/flog.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
@ -23,7 +23,7 @@ bool ThemeManager::loadThemesFromDir(std::string path) {
|
||||
|
||||
|
||||
if (!std::filesystem::is_directory(path)) {
|
||||
spdlog::error("Theme directory doesn't exist: {0}", path);
|
||||
flog::error("Theme directory doesn't exist: {0}", path);
|
||||
return false;
|
||||
}
|
||||
themes.clear();
|
||||
@ -39,7 +39,7 @@ bool ThemeManager::loadThemesFromDir(std::string path) {
|
||||
|
||||
bool ThemeManager::loadTheme(std::string path) {
|
||||
if (!std::filesystem::is_regular_file(path)) {
|
||||
spdlog::error("Theme file doesn't exist: {0}", path);
|
||||
flog::error("Theme file doesn't exist: {0}", path);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -55,24 +55,24 @@ bool ThemeManager::loadTheme(std::string path) {
|
||||
|
||||
// Load theme name
|
||||
if (!data.contains("name")) {
|
||||
spdlog::error("Theme {0} is missing the name parameter", path);
|
||||
flog::error("Theme {0} is missing the name parameter", path);
|
||||
return false;
|
||||
}
|
||||
if (!data["name"].is_string()) {
|
||||
spdlog::error("Theme {0} contains invalid name field. Expected string", path);
|
||||
flog::error("Theme {0} contains invalid name field. Expected string", path);
|
||||
return false;
|
||||
}
|
||||
std::string name = data["name"];
|
||||
|
||||
if (themes.find(name) != themes.end()) {
|
||||
spdlog::error("A theme named '{0}' already exists", name);
|
||||
flog::error("A theme named '{0}' already exists", name);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load theme author if available
|
||||
if (data.contains("author")) {
|
||||
if (!data["author"].is_string()) {
|
||||
spdlog::error("Theme {0} contains invalid author field. Expected string", path);
|
||||
flog::error("Theme {0} contains invalid author field. Expected string", path);
|
||||
return false;
|
||||
}
|
||||
thm.author = data["author"];
|
||||
@ -86,7 +86,7 @@ bool ThemeManager::loadTheme(std::string path) {
|
||||
// Exception for non-imgu colors
|
||||
if (param == "WaterfallBackground" || param == "ClearColor" || param == "FFTHoldColor") {
|
||||
if (val[0] != '#' || !std::all_of(val.begin() + 1, val.end(), ::isxdigit) || val.length() != 9) {
|
||||
spdlog::error("Theme {0} contains invalid {1} field. Expected hex RGBA color", path, param);
|
||||
flog::error("Theme {0} contains invalid {1} field. Expected hex RGBA color", path, param);
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
@ -97,14 +97,14 @@ bool ThemeManager::loadTheme(std::string path) {
|
||||
// If param is a color, check that it's a valid RGBA hex value
|
||||
if (IMGUI_COL_IDS.find(param) != IMGUI_COL_IDS.end()) {
|
||||
if (val[0] != '#' || !std::all_of(val.begin() + 1, val.end(), ::isxdigit) || val.length() != 9) {
|
||||
spdlog::error("Theme {0} contains invalid {1} field. Expected hex RGBA color", path, param);
|
||||
flog::error("Theme {0} contains invalid {1} field. Expected hex RGBA color", path, param);
|
||||
return false;
|
||||
}
|
||||
isValid = true;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
spdlog::error("Theme {0} contains unknown {1} field.", path, param);
|
||||
flog::error("Theme {0} contains unknown {1} field.", path, param);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -117,7 +117,7 @@ bool ThemeManager::loadTheme(std::string path) {
|
||||
|
||||
bool ThemeManager::applyTheme(std::string name) {
|
||||
if (themes.find(name) == themes.end()) {
|
||||
spdlog::error("Unknown theme: {0}", name);
|
||||
flog::error("Unknown theme: {0}", name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <gui/widgets/bandplan.h>
|
||||
#include <fstream>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utils/flog.h>
|
||||
#include <filesystem>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
@ -56,7 +56,7 @@ namespace bandplan {
|
||||
}
|
||||
|
||||
void to_json(json& j, const BandPlanColor_t& ct) {
|
||||
spdlog::error("ImGui color to JSON not implemented!!!");
|
||||
flog::error("ImGui color to JSON not implemented!!!");
|
||||
}
|
||||
|
||||
void from_json(const json& j, BandPlanColor_t& ct) {
|
||||
@ -81,7 +81,7 @@ namespace bandplan {
|
||||
|
||||
BandPlan_t plan = data.get<BandPlan_t>();
|
||||
if (bandplans.find(plan.name) != bandplans.end()) {
|
||||
spdlog::error("Duplicate band plan name ({0}), not loading.", plan.name);
|
||||
flog::error("Duplicate band plan name ({0}), not loading.", plan.name);
|
||||
return;
|
||||
}
|
||||
bandplans[plan.name] = plan;
|
||||
@ -91,11 +91,11 @@ namespace bandplan {
|
||||
|
||||
void loadFromDir(std::string path) {
|
||||
if (!std::filesystem::exists(path)) {
|
||||
spdlog::error("Band Plan directory does not exist");
|
||||
flog::error("Band Plan directory does not exist");
|
||||
return;
|
||||
}
|
||||
if (!std::filesystem::is_directory(path)) {
|
||||
spdlog::error("Band Plan directory isn't a directory...");
|
||||
flog::error("Band Plan directory isn't a directory...");
|
||||
return;
|
||||
}
|
||||
bandplans.clear();
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <imutils.h>
|
||||
#include <algorithm>
|
||||
#include <volk/volk.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utils/flog.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/style.h>
|
||||
|
||||
@ -1292,7 +1292,7 @@ namespace ImGui {
|
||||
void WaterFall::showWaterfall() {
|
||||
buf_mtx.lock();
|
||||
if (rawFFTs == NULL) {
|
||||
spdlog::error("Null rawFFT");
|
||||
flog::error("Null rawFFT");
|
||||
}
|
||||
waterfallVisible = true;
|
||||
onResize();
|
||||
|
Reference in New Issue
Block a user