mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-09 18:45:22 +02:00
More fixes
This commit is contained in:
@ -7,16 +7,42 @@
|
||||
#include <iomanip>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
namespace config {
|
||||
void load(std::string path);
|
||||
void startAutoSave();
|
||||
void stopAutoSave();
|
||||
void setRootDirectory(std::string dir);
|
||||
std::string getRootDirectory();
|
||||
//#define DEV_BUILD
|
||||
|
||||
#ifndef ROOT_DIR
|
||||
#ifdef DEV_BUILD
|
||||
#define ROOT_DIR "../root_dev"
|
||||
#elif _WIN32
|
||||
#define ROOT_DIR "."
|
||||
#else
|
||||
#define ROOT_DIR "/etc/sdrpp"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class ConfigManager {
|
||||
public:
|
||||
ConfigManager();
|
||||
void setPath(std::string file);
|
||||
void load(json default, bool lock = true);
|
||||
void save(bool lock = true);
|
||||
void enableAutoSave();
|
||||
void disableAutoSave();
|
||||
void aquire();
|
||||
void release(bool changed = false);
|
||||
|
||||
json conf;
|
||||
|
||||
private:
|
||||
static void autoSaveWorker(ConfigManager* _this);
|
||||
|
||||
std::string path = "";
|
||||
bool changed = false;
|
||||
bool autoSaveEnabled = false;
|
||||
std::thread autoSaveThread;
|
||||
std::mutex mtx;
|
||||
|
||||
extern bool configModified;
|
||||
extern json config;
|
||||
};
|
Reference in New Issue
Block a user