CubicSDR/src/AppConfig.h

81 lines
1.7 KiB
C
Raw Normal View History

#pragma once
#include <wx/stdpaths.h>
#include <wx/dir.h>
#include <wx/filename.h>
2015-07-15 00:32:36 -04:00
#include <wx/panel.h>
#include <atomic>
#include <mutex>
#include "DataTree.h"
2015-04-21 23:19:45 -04:00
class DeviceConfig {
public:
2015-04-21 23:19:45 -04:00
DeviceConfig();
DeviceConfig(std::string deviceId);
void setPPM(int ppm);
int getPPM();
void setOffset(long long offset);
long long getOffset();
2015-04-21 23:19:45 -04:00
void setDeviceId(std::string deviceId);
std::string getDeviceId();
void save(DataNode *node);
void load(DataNode *node);
private:
std::string deviceId;
std::mutex busy_lock;
std::atomic_int ppm;
2015-07-14 19:44:19 -04:00
std::atomic_llong offset;
2015-04-21 23:19:45 -04:00
};
class AppConfig {
public:
2015-07-16 18:57:03 -04:00
AppConfig();
std::string getConfigDir();
2015-04-21 23:19:45 -04:00
DeviceConfig *getDevice(std::string deviceId);
2015-07-15 00:32:36 -04:00
void setWindow(wxPoint winXY, wxSize winWH);
wxRect *getWindow();
2015-07-16 18:57:03 -04:00
void setWindowMaximized(bool max);
bool getWindowMaximized();
2015-07-15 00:32:36 -04:00
void setTheme(int themeId);
int getTheme();
2015-07-18 21:49:53 -04:00
void setSnap(long long snapVal);
long long getSnap();
2015-07-20 22:51:19 -04:00
void setCenterFreq(long long freqVal);
long long getCenterFreq();
void setWaterfallLinesPerSec(int lps);
int getWaterfallLinesPerSec();
void setSpectrumAvgSpeed(float avgSpeed);
float getSpectrumAvgSpeed();
void setConfigName(std::string configName);
std::string getConfigFileName(bool ignoreName=false);
bool save();
bool load();
bool reset();
2015-04-21 23:19:45 -04:00
private:
std::string configName;
2015-07-14 19:44:19 -04:00
std::map<std::string, DeviceConfig *> deviceConfig;
2015-07-15 00:32:36 -04:00
std::atomic_int winX,winY,winW,winH;
2015-07-16 18:57:03 -04:00
std::atomic_bool winMax;
2015-07-15 00:32:36 -04:00
std::atomic_int themeId;
2015-07-18 21:49:53 -04:00
std::atomic_llong snap;
2015-07-20 22:51:19 -04:00
std::atomic_llong centerFreq;
std::atomic_int waterfallLinesPerSec;
std::atomic<float> spectrumAvgSpeed;
};