mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 05:38:39 -05:00
Cleanup: appframe, bookmarks, sessions, core app
This commit is contained in:
parent
7aa7daa55f
commit
f97f368a6a
@ -6,35 +6,35 @@
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
DeviceConfig::DeviceConfig() : deviceId("") {
|
||||
DeviceConfig::DeviceConfig() {
|
||||
ppm.store(0);
|
||||
offset.store(0);
|
||||
agcMode.store(true);
|
||||
sampleRate.store(0);
|
||||
}
|
||||
|
||||
DeviceConfig::DeviceConfig(std::string deviceId) : DeviceConfig() {
|
||||
this->deviceId = deviceId;
|
||||
DeviceConfig::DeviceConfig(std::string deviceId_in) : DeviceConfig() {
|
||||
deviceId = deviceId_in;
|
||||
}
|
||||
|
||||
void DeviceConfig::setPPM(int ppm) {
|
||||
this->ppm.store(ppm);
|
||||
void DeviceConfig::setPPM(int ppm_in) {
|
||||
ppm.store(ppm_in);
|
||||
}
|
||||
|
||||
int DeviceConfig::getPPM() {
|
||||
return ppm.load();
|
||||
}
|
||||
|
||||
void DeviceConfig::setOffset(long long offset) {
|
||||
this->offset.store(offset);
|
||||
void DeviceConfig::setOffset(long long offset_in) {
|
||||
offset.store(offset_in);
|
||||
}
|
||||
|
||||
long long DeviceConfig::getOffset() {
|
||||
return offset.load();
|
||||
}
|
||||
|
||||
void DeviceConfig::setSampleRate(long srate) {
|
||||
sampleRate.store(srate);
|
||||
void DeviceConfig::setSampleRate(long sampleRate_in) {
|
||||
sampleRate.store(sampleRate_in);
|
||||
}
|
||||
|
||||
long DeviceConfig::getSampleRate() {
|
||||
@ -49,8 +49,8 @@ const std::string& DeviceConfig::getAntennaName() {
|
||||
return antennaName;
|
||||
}
|
||||
|
||||
void DeviceConfig::setAGCMode(bool agcMode) {
|
||||
this->agcMode.store(agcMode);
|
||||
void DeviceConfig::setAGCMode(bool agcMode_in) {
|
||||
agcMode.store(agcMode_in);
|
||||
}
|
||||
|
||||
bool DeviceConfig::getAGCMode() {
|
||||
@ -58,9 +58,9 @@ bool DeviceConfig::getAGCMode() {
|
||||
}
|
||||
|
||||
|
||||
void DeviceConfig::setDeviceId(std::string deviceId) {
|
||||
void DeviceConfig::setDeviceId(std::string deviceId_in) {
|
||||
std::lock_guard < std::mutex > lock(busy_lock);
|
||||
this->deviceId = deviceId;
|
||||
deviceId = deviceId_in;
|
||||
|
||||
}
|
||||
|
||||
@ -74,18 +74,16 @@ std::string DeviceConfig::getDeviceId() {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void DeviceConfig::setDeviceName(std::string deviceName) {
|
||||
void DeviceConfig::setDeviceName(std::string deviceName_in) {
|
||||
std::lock_guard < std::mutex > lock(busy_lock);
|
||||
this->deviceName = deviceName;
|
||||
|
||||
deviceName = deviceName_in;
|
||||
}
|
||||
|
||||
std::string DeviceConfig::getDeviceName() {
|
||||
std::string tmp;
|
||||
|
||||
std::lock_guard < std::mutex > lock(busy_lock);
|
||||
tmp = (deviceName=="")?deviceId:deviceName;
|
||||
|
||||
tmp = deviceName.empty()?deviceId:deviceName;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
@ -105,19 +103,19 @@ void DeviceConfig::save(DataNode *node) {
|
||||
*node->newChild("antenna") = antennaName;
|
||||
}
|
||||
|
||||
if (streamOpts.size()) {
|
||||
if (!streamOpts.empty()) {
|
||||
DataNode *streamOptsNode = node->newChild("streamOpts");
|
||||
for (ConfigSettings::const_iterator opt_i = streamOpts.begin(); opt_i != streamOpts.end(); opt_i++) {
|
||||
*streamOptsNode->newChild(opt_i->first.c_str()) = opt_i->second;
|
||||
}
|
||||
}
|
||||
if (settings.size()) {
|
||||
if (!settings.empty()) {
|
||||
DataNode *settingsNode = node->newChild("settings");
|
||||
for (ConfigSettings::const_iterator set_i = settings.begin(); set_i != settings.end(); set_i++) {
|
||||
*settingsNode->newChild(set_i->first.c_str()) = set_i->second;
|
||||
}
|
||||
}
|
||||
if (rigIF.size()) {
|
||||
if (!rigIF.empty()) {
|
||||
DataNode *rigIFs = node->newChild("rig_ifs");
|
||||
for (std::map<int, long long>::const_iterator rigIF_i = rigIF.begin(); rigIF_i != rigIF.end(); rigIF_i++) {
|
||||
DataNode *ifNode = rigIFs->newChild("rig_if");
|
||||
@ -125,7 +123,7 @@ void DeviceConfig::save(DataNode *node) {
|
||||
*ifNode->newChild("sdr_if") = rigIF_i->second;
|
||||
}
|
||||
}
|
||||
if (gains.size()) {
|
||||
if (!gains.empty()) {
|
||||
DataNode *gainsNode = node->newChild("gains");
|
||||
for (ConfigGains::const_iterator gain_i = gains.begin(); gain_i != gains.end(); gain_i++) {
|
||||
DataNode *gainNode = gainsNode->newChild("gain");
|
||||
@ -157,7 +155,7 @@ void DeviceConfig::load(DataNode *node) {
|
||||
DataNode *agc_node = node->getNext("agc_mode");
|
||||
int agcModeValue = 0;
|
||||
agc_node->element()->get(agcModeValue);
|
||||
setAGCMode(agcModeValue?true:false);
|
||||
setAGCMode(agcModeValue != 0);
|
||||
}
|
||||
if (node->hasAnother("sample_rate")) {
|
||||
DataNode *sample_rate_node = node->getNext("sample_rate");
|
||||
@ -178,7 +176,7 @@ void DeviceConfig::load(DataNode *node) {
|
||||
std::string keyName = streamOptNode->getName();
|
||||
std::string strSettingValue = streamOptNode->element()->toString();
|
||||
|
||||
if (keyName != "") {
|
||||
if (!keyName.empty()) {
|
||||
setStreamOpt(keyName, strSettingValue);
|
||||
}
|
||||
}
|
||||
@ -190,7 +188,7 @@ void DeviceConfig::load(DataNode *node) {
|
||||
std::string keyName = settingNode->getName();
|
||||
std::string strSettingValue = settingNode->element()->toString();
|
||||
|
||||
if (keyName != "") {
|
||||
if (!keyName.empty()) {
|
||||
setSetting(keyName, strSettingValue);
|
||||
}
|
||||
}
|
||||
@ -201,7 +199,7 @@ void DeviceConfig::load(DataNode *node) {
|
||||
DataNode *rigIFNode = rigIFNodes->getNext("rig_if");
|
||||
if (rigIFNode->hasAnother("model") && rigIFNode->hasAnother("sdr_if")) {
|
||||
int load_model;
|
||||
long long load_freq;
|
||||
long long load_freq = 0;
|
||||
|
||||
rigIFNode->getNext("model")->element()->get(load_model);
|
||||
rigIFNode->getNext("sdr_if")->element()->get(load_freq);
|
||||
@ -215,12 +213,12 @@ void DeviceConfig::load(DataNode *node) {
|
||||
while (gainsNode->hasAnother("gain")) {
|
||||
DataNode *gainNode = gainsNode->getNext("gain");
|
||||
std::string keyName;
|
||||
float fltSettingValue;
|
||||
|
||||
float fltSettingValue = 0;
|
||||
|
||||
gainNode->getNext("id")->element()->get(keyName);
|
||||
gainNode->getNext("value")->element()->get(fltSettingValue);
|
||||
|
||||
if (keyName != "" && !(fltSettingValue!=fltSettingValue)) {
|
||||
if (!keyName.empty() && !(fltSettingValue!=fltSettingValue)) {
|
||||
setGain(keyName, fltSettingValue);
|
||||
}
|
||||
}
|
||||
@ -236,11 +234,11 @@ ConfigSettings DeviceConfig::getStreamOpts() {
|
||||
return streamOpts;
|
||||
}
|
||||
|
||||
void DeviceConfig::setStreamOpt(std::string key, std::string value) {
|
||||
void DeviceConfig::setStreamOpt(const std::string& key, std::string value) {
|
||||
streamOpts[key] = value;
|
||||
}
|
||||
|
||||
std::string DeviceConfig::getStreamOpt(std::string key, std::string defaultValue) {
|
||||
std::string DeviceConfig::getStreamOpt(const std::string& key, std::string defaultValue) {
|
||||
if (streamOpts.find(key) == streamOpts.end()) {
|
||||
return defaultValue;
|
||||
}
|
||||
@ -248,15 +246,15 @@ std::string DeviceConfig::getStreamOpt(std::string key, std::string defaultValue
|
||||
return streamOpts[key];
|
||||
}
|
||||
|
||||
void DeviceConfig::setSettings(ConfigSettings settings) {
|
||||
this->settings = settings;
|
||||
void DeviceConfig::setSettings(ConfigSettings settings_in) {
|
||||
settings = settings_in;
|
||||
}
|
||||
|
||||
void DeviceConfig::setSetting(std::string key, std::string value) {
|
||||
this->settings[key] = value;
|
||||
void DeviceConfig::setSetting(const std::string& key, std::string value) {
|
||||
settings[key] = value;
|
||||
}
|
||||
|
||||
std::string DeviceConfig::getSetting(std::string key, std::string defaultValue) {
|
||||
std::string DeviceConfig::getSetting(const std::string& key, std::string defaultValue) {
|
||||
if (settings.find(key) == settings.end()) {
|
||||
return defaultValue;
|
||||
}
|
||||
@ -268,19 +266,19 @@ ConfigSettings DeviceConfig::getSettings() {
|
||||
}
|
||||
|
||||
|
||||
void DeviceConfig::setGains(ConfigGains gains) {
|
||||
this->gains = gains;
|
||||
void DeviceConfig::setGains(ConfigGains gains_in) {
|
||||
gains = gains_in;
|
||||
}
|
||||
|
||||
ConfigGains DeviceConfig::getGains() {
|
||||
return gains;
|
||||
}
|
||||
|
||||
void DeviceConfig::setGain(std::string key, float value) {
|
||||
void DeviceConfig::setGain(const std::string& key, float value) {
|
||||
gains[key] = value;
|
||||
}
|
||||
|
||||
float DeviceConfig::getGain(std::string key, float defaultValue) {
|
||||
float DeviceConfig::getGain(const std::string& key, float defaultValue) {
|
||||
if (gains.find(key) != gains.end()) {
|
||||
return gains[key];
|
||||
}
|
||||
@ -299,7 +297,7 @@ long long DeviceConfig::getRigIF(int rigType) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
AppConfig::AppConfig() : configName("") {
|
||||
AppConfig::AppConfig() {
|
||||
winX.store(0);
|
||||
winY.store(0);
|
||||
winW.store(0);
|
||||
@ -334,7 +332,7 @@ AppConfig::AppConfig() : configName("") {
|
||||
#endif
|
||||
}
|
||||
|
||||
DeviceConfig *AppConfig::getDevice(std::string deviceId) {
|
||||
DeviceConfig *AppConfig::getDevice(const std::string& deviceId) {
|
||||
if (deviceConfig.find(deviceId) == deviceConfig.end()) {
|
||||
deviceConfig[deviceId] = new DeviceConfig();
|
||||
}
|
||||
@ -402,23 +400,23 @@ AppConfig::PerfModeEnum AppConfig::getPerfMode() {
|
||||
}
|
||||
|
||||
wxRect *AppConfig::getWindow() {
|
||||
wxRect *r = NULL;
|
||||
wxRect *r = nullptr;
|
||||
if (winH.load() && winW.load()) {
|
||||
r = new wxRect(winX.load(),winY.load(),winW.load(),winH.load());
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void AppConfig::setTheme(int themeId) {
|
||||
this->themeId.store(themeId);
|
||||
void AppConfig::setTheme(int themeId_in) {
|
||||
themeId.store(themeId_in);
|
||||
}
|
||||
|
||||
int AppConfig::getTheme() {
|
||||
return themeId.load();
|
||||
}
|
||||
|
||||
void AppConfig::setFontScale(int fontScale) {
|
||||
this->fontScale.store(fontScale);
|
||||
void AppConfig::setFontScale(int fontScale_in) {
|
||||
fontScale.store(fontScale_in);
|
||||
}
|
||||
|
||||
int AppConfig::getFontScale() {
|
||||
@ -540,7 +538,7 @@ void AppConfig::setRecordingSquelchOption(int enumChoice) {
|
||||
recordingSquelchOption = enumChoice;
|
||||
}
|
||||
|
||||
int AppConfig::getRecordingSquelchOption() {
|
||||
int AppConfig::getRecordingSquelchOption() const {
|
||||
return recordingSquelchOption;
|
||||
}
|
||||
|
||||
@ -548,13 +546,13 @@ void AppConfig::setRecordingFileTimeLimit(int nbSeconds) {
|
||||
recordingFileTimeLimitSeconds = nbSeconds;
|
||||
}
|
||||
|
||||
int AppConfig::getRecordingFileTimeLimit() {
|
||||
int AppConfig::getRecordingFileTimeLimit() const {
|
||||
return recordingFileTimeLimitSeconds;
|
||||
}
|
||||
|
||||
|
||||
void AppConfig::setConfigName(std::string configName) {
|
||||
this->configName = configName;
|
||||
void AppConfig::setConfigName(std::string configName_in) {
|
||||
configName = configName_in;
|
||||
}
|
||||
|
||||
std::string AppConfig::getConfigFileName(bool ignoreName) {
|
||||
@ -597,7 +595,7 @@ bool AppConfig::save() {
|
||||
*window_node->newChild("center_freq") = centerFreq.load();
|
||||
*window_node->newChild("waterfall_lps") = waterfallLinesPerSec.load();
|
||||
*window_node->newChild("spectrum_avg") = spectrumAvgSpeed.load();
|
||||
*window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();;
|
||||
*window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();
|
||||
*window_node->newChild("db_offset") = dbOffset.load();
|
||||
|
||||
*window_node->newChild("main_split") = mainSplit.load();
|
||||
@ -620,12 +618,12 @@ bool AppConfig::save() {
|
||||
device_config_i->second->save(device_node);
|
||||
}
|
||||
|
||||
if (manualDevices.size()) {
|
||||
if (!manualDevices.empty()) {
|
||||
DataNode *manual_node = cfg.rootNode()->newChild("manual_devices");
|
||||
for (std::vector<SDRManualDef>::const_iterator i = manualDevices.begin(); i != manualDevices.end(); i++) {
|
||||
for (const auto & manualDevice : manualDevices) {
|
||||
DataNode *rig_node = manual_node->newChild("device");
|
||||
*rig_node->newChild("factory") = i->factory;
|
||||
*rig_node->newChild("params") = i->params;
|
||||
*rig_node->newChild("factory") = manualDevice.factory;
|
||||
*rig_node->newChild("params") = manualDevice.params;
|
||||
}
|
||||
}
|
||||
|
||||
@ -708,12 +706,12 @@ bool AppConfig::load() {
|
||||
|
||||
if (win_node->hasAnother("max")) {
|
||||
win_node->getNext("max")->element()->get(max);
|
||||
winMax.store(max?true:false);
|
||||
winMax.store(max != 0);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("tips")) {
|
||||
win_node->getNext("tips")->element()->get(tips);
|
||||
showTips.store(tips?true:false);
|
||||
showTips.store(tips != 0);
|
||||
}
|
||||
|
||||
// default:
|
||||
@ -730,31 +728,31 @@ bool AppConfig::load() {
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("theme")) {
|
||||
int theme;
|
||||
int theme = 0;
|
||||
win_node->getNext("theme")->element()->get(theme);
|
||||
themeId.store(theme);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("font_scale")) {
|
||||
int fscale;
|
||||
int fscale = 0;
|
||||
win_node->getNext("font_scale")->element()->get(fscale);
|
||||
fontScale.store(fscale);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("snap")) {
|
||||
long long snapVal;
|
||||
long long snapVal = 0;
|
||||
win_node->getNext("snap")->element()->get(snapVal);
|
||||
snap.store(snapVal);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("center_freq")) {
|
||||
long long freqVal;
|
||||
long long freqVal = 0;
|
||||
win_node->getNext("center_freq")->element()->get(freqVal);
|
||||
centerFreq.store(freqVal);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("waterfall_lps")) {
|
||||
int lpsVal;
|
||||
int lpsVal = 30;
|
||||
win_node->getNext("waterfall_lps")->element()->get(lpsVal);
|
||||
waterfallLinesPerSec.store(lpsVal);
|
||||
}
|
||||
@ -767,7 +765,7 @@ bool AppConfig::load() {
|
||||
|
||||
if (win_node->hasAnother("modemprops_collapsed")) {
|
||||
win_node->getNext("modemprops_collapsed")->element()->get(mpc);
|
||||
modemPropsCollapsed.store(mpc?true:false);
|
||||
modemPropsCollapsed.store(mpc != 0);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("db_offset")) {
|
||||
@ -858,7 +856,7 @@ bool AppConfig::load() {
|
||||
if (rig_node->hasAnother("enabled")) {
|
||||
int loadEnabled;
|
||||
rig_node->getNext("enabled")->element()->get(loadEnabled);
|
||||
rigEnabled.store(loadEnabled?true:false);
|
||||
rigEnabled.store(loadEnabled != 0);
|
||||
}
|
||||
if (rig_node->hasAnother("model")) {
|
||||
int loadModel;
|
||||
@ -876,22 +874,22 @@ bool AppConfig::load() {
|
||||
if (rig_node->hasAnother("control")) {
|
||||
int loadControl;
|
||||
rig_node->getNext("control")->element()->get(loadControl);
|
||||
rigControlMode.store(loadControl?true:false);
|
||||
rigControlMode.store(loadControl != 0);
|
||||
}
|
||||
if (rig_node->hasAnother("follow")) {
|
||||
int loadFollow;
|
||||
rig_node->getNext("follow")->element()->get(loadFollow);
|
||||
rigFollowMode.store(loadFollow?true:false);
|
||||
rigFollowMode.store(loadFollow != 0);
|
||||
}
|
||||
if (rig_node->hasAnother("center_lock")) {
|
||||
int loadCenterLock;
|
||||
rig_node->getNext("center_lock")->element()->get(loadCenterLock);
|
||||
rigCenterLock.store(loadCenterLock?true:false);
|
||||
rigCenterLock.store(loadCenterLock != 0);
|
||||
}
|
||||
if (rig_node->hasAnother("follow_modem")) {
|
||||
int loadFollow;
|
||||
rig_node->getNext("follow_modem")->element()->get(loadFollow);
|
||||
rigFollowModem.store(loadFollow?true:false);
|
||||
rigFollowModem.store(loadFollow != 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -912,24 +910,24 @@ int AppConfig::getRigModel() {
|
||||
return rigModel.load();
|
||||
}
|
||||
|
||||
void AppConfig::setRigModel(int rigModel) {
|
||||
this->rigModel.store(rigModel);
|
||||
void AppConfig::setRigModel(int rigModel_in) {
|
||||
rigModel.store(rigModel_in);
|
||||
}
|
||||
|
||||
int AppConfig::getRigRate() {
|
||||
return rigRate.load();
|
||||
}
|
||||
|
||||
void AppConfig::setRigRate(int rigRate) {
|
||||
this->rigRate.store(rigRate);
|
||||
void AppConfig::setRigRate(int rigRate_in) {
|
||||
rigRate.store(rigRate_in);
|
||||
}
|
||||
|
||||
std::string AppConfig::getRigPort() {
|
||||
return rigPort;
|
||||
}
|
||||
|
||||
void AppConfig::setRigPort(std::string rigPort) {
|
||||
this->rigPort = rigPort;
|
||||
void AppConfig::setRigPort(std::string rigPort_in) {
|
||||
rigPort = rigPort_in;
|
||||
}
|
||||
|
||||
void AppConfig::setRigControlMode(bool cMode) {
|
||||
|
@ -20,43 +20,43 @@ typedef std::map<std::string, float> ConfigGains;
|
||||
class DeviceConfig {
|
||||
public:
|
||||
DeviceConfig();
|
||||
DeviceConfig(std::string deviceId);
|
||||
explicit DeviceConfig(std::string deviceId_in);
|
||||
|
||||
void setPPM(int ppm);
|
||||
void setPPM(int ppm_in);
|
||||
int getPPM();
|
||||
|
||||
void setOffset(long long offset);
|
||||
void setOffset(long long offset_in);
|
||||
long long getOffset();
|
||||
|
||||
void setSampleRate(long srate);
|
||||
void setSampleRate(long sampleRate_in);
|
||||
long getSampleRate();
|
||||
|
||||
void setAntennaName(const std::string& name);
|
||||
const std::string& getAntennaName();
|
||||
|
||||
void setAGCMode(bool agcMode);
|
||||
void setAGCMode(bool agcMode_in);
|
||||
bool getAGCMode();
|
||||
|
||||
void setDeviceId(std::string deviceId);
|
||||
void setDeviceId(std::string deviceId_in);
|
||||
std::string getDeviceId();
|
||||
|
||||
void setDeviceName(std::string deviceName);
|
||||
void setDeviceName(std::string deviceName_in);
|
||||
std::string getDeviceName();
|
||||
|
||||
void setStreamOpts(ConfigSettings opts);
|
||||
ConfigSettings getStreamOpts();
|
||||
void setStreamOpt(std::string key, std::string value);
|
||||
std::string getStreamOpt(std::string key, std::string defaultValue);
|
||||
void setStreamOpt(const std::string& key, std::string value);
|
||||
std::string getStreamOpt(const std::string& key, std::string defaultValue);
|
||||
|
||||
void setSettings(ConfigSettings settings);
|
||||
void setSettings(ConfigSettings settings_in);
|
||||
ConfigSettings getSettings();
|
||||
void setSetting(std::string key, std::string value);
|
||||
std::string getSetting(std::string key, std::string defaultValue);
|
||||
void setSetting(const std::string& key, std::string value);
|
||||
std::string getSetting(const std::string& key, std::string defaultValue);
|
||||
|
||||
void setGains(ConfigGains gains);
|
||||
void setGains(ConfigGains gains_in);
|
||||
ConfigGains getGains();
|
||||
void setGain(std::string key, float value);
|
||||
float getGain(std::string key, float defaultValue);
|
||||
void setGain(const std::string& key, float value);
|
||||
float getGain(const std::string& key, float defaultValue);
|
||||
|
||||
void setRigIF(int rigType, long long freq);
|
||||
long long getRigIF(int rigType);
|
||||
@ -70,10 +70,10 @@ private:
|
||||
|
||||
std::mutex busy_lock;
|
||||
|
||||
std::atomic_int ppm;
|
||||
std::atomic_llong offset;
|
||||
std::atomic_bool agcMode;
|
||||
std::atomic_long sampleRate;
|
||||
std::atomic_int ppm{};
|
||||
std::atomic_llong offset{};
|
||||
std::atomic_bool agcMode{};
|
||||
std::atomic_long sampleRate{};
|
||||
std::string antennaName;
|
||||
ConfigSettings streamOpts;
|
||||
ConfigGains gains;
|
||||
@ -93,7 +93,7 @@ public:
|
||||
|
||||
AppConfig();
|
||||
std::string getConfigDir();
|
||||
DeviceConfig *getDevice(std::string deviceId);
|
||||
DeviceConfig *getDevice(const std::string& deviceId);
|
||||
|
||||
void setWindow(wxPoint winXY, wxSize winWH);
|
||||
wxRect *getWindow();
|
||||
@ -110,10 +110,10 @@ public:
|
||||
void setPerfMode(PerfModeEnum mode);
|
||||
PerfModeEnum getPerfMode();
|
||||
|
||||
void setTheme(int themeId);
|
||||
void setTheme(int themeId_in);
|
||||
int getTheme();
|
||||
|
||||
void setFontScale(int scaleValue);
|
||||
void setFontScale(int fontScale_in);
|
||||
int getFontScale();
|
||||
|
||||
void setSnap(long long snapVal);
|
||||
@ -152,20 +152,20 @@ public:
|
||||
bool verifyRecordingPath();
|
||||
|
||||
void setRecordingSquelchOption(int enumChoice);
|
||||
int getRecordingSquelchOption();
|
||||
int getRecordingSquelchOption() const;
|
||||
|
||||
void setRecordingFileTimeLimit(int nbSeconds);
|
||||
int getRecordingFileTimeLimit();
|
||||
int getRecordingFileTimeLimit() const;
|
||||
|
||||
#if USE_HAMLIB
|
||||
int getRigModel();
|
||||
void setRigModel(int rigModel);
|
||||
void setRigModel(int rigModel_in);
|
||||
|
||||
int getRigRate();
|
||||
void setRigRate(int rigRate);
|
||||
void setRigRate(int rigRate_in);
|
||||
|
||||
std::string getRigPort();
|
||||
void setRigPort(std::string rigPort);
|
||||
void setRigPort(std::string rigPort_in);
|
||||
|
||||
void setRigControlMode(bool cMode);
|
||||
bool getRigControlMode();
|
||||
@ -183,7 +183,7 @@ public:
|
||||
bool getRigEnabled();
|
||||
#endif
|
||||
|
||||
void setConfigName(std::string configName);
|
||||
void setConfigName(std::string configName_in);
|
||||
std::string getConfigFileName(bool ignoreName=false);
|
||||
bool save();
|
||||
bool load();
|
||||
@ -192,26 +192,26 @@ public:
|
||||
private:
|
||||
std::string configName;
|
||||
std::map<std::string, DeviceConfig *> deviceConfig;
|
||||
std::atomic_int winX,winY,winW,winH;
|
||||
std::atomic_bool winMax, showTips, modemPropsCollapsed;
|
||||
std::atomic_int themeId;
|
||||
std::atomic_int fontScale;
|
||||
std::atomic_llong snap;
|
||||
std::atomic_llong centerFreq;
|
||||
std::atomic_int waterfallLinesPerSec;
|
||||
std::atomic<float> spectrumAvgSpeed, mainSplit, visSplit, bookmarkSplit;
|
||||
std::atomic_int dbOffset;
|
||||
std::atomic_int winX{},winY{},winW{},winH{};
|
||||
std::atomic_bool winMax{}, showTips{}, modemPropsCollapsed{};
|
||||
std::atomic_int themeId{};
|
||||
std::atomic_int fontScale{};
|
||||
std::atomic_llong snap{};
|
||||
std::atomic_llong centerFreq{};
|
||||
std::atomic_int waterfallLinesPerSec{};
|
||||
std::atomic<float> spectrumAvgSpeed{}, mainSplit{}, visSplit{}, bookmarkSplit{};
|
||||
std::atomic_int dbOffset{};
|
||||
std::vector<SDRManualDef> manualDevices;
|
||||
std::atomic_bool bookmarksVisible;
|
||||
std::atomic_bool bookmarksVisible{};
|
||||
|
||||
std::atomic<PerfModeEnum> perfMode;
|
||||
std::atomic<PerfModeEnum> perfMode{};
|
||||
|
||||
std::string recordingPath = "";
|
||||
std::string recordingPath;
|
||||
int recordingSquelchOption = 0;
|
||||
int recordingFileTimeLimitSeconds = 0;
|
||||
#if USE_HAMLIB
|
||||
std::atomic_int rigModel, rigRate;
|
||||
std::atomic_int rigModel{}, rigRate{};
|
||||
std::string rigPort;
|
||||
std::atomic_bool rigEnabled, rigFollowMode, rigControlMode, rigCenterLock, rigFollowModem;
|
||||
std::atomic_bool rigEnabled{}, rigFollowMode{}, rigControlMode{}, rigCenterLock{}, rigFollowModem{};
|
||||
#endif
|
||||
};
|
||||
|
217
src/AppFrame.cpp
217
src/AppFrame.cpp
@ -32,7 +32,7 @@
|
||||
|
||||
#include <wx/panel.h>
|
||||
#include <wx/numformatter.h>
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#include "CubicSDR.xpm"
|
||||
@ -61,7 +61,7 @@ public:
|
||||
m_questionText->SetLabelText(wxT("Resetting bookmarks will erase all current bookmarks; are you sure?"));
|
||||
}
|
||||
|
||||
void doClickOK() {
|
||||
void doClickOK() override {
|
||||
wxGetApp().getBookmarkMgr().resetBookmarks();
|
||||
wxGetApp().getBookmarkMgr().updateBookmarks();
|
||||
wxGetApp().getBookmarkMgr().updateActiveList();
|
||||
@ -73,7 +73,7 @@ public:
|
||||
#define APPFRAME_MODEMPROPS_MAXSIZE 240
|
||||
|
||||
AppFrame::AppFrame() :
|
||||
wxFrame(NULL, wxID_ANY, CUBICSDR_TITLE), activeDemodulator(nullptr) {
|
||||
wxFrame(nullptr, wxID_ANY, CUBICSDR_TITLE), activeDemodulator(nullptr) {
|
||||
|
||||
initIcon();
|
||||
|
||||
@ -81,8 +81,8 @@ AppFrame::AppFrame() :
|
||||
modemPropertiesUpdated.store(false);
|
||||
|
||||
demodTray = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *demodTunerTray = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto *demodScopeTray = new wxBoxSizer(wxVERTICAL);
|
||||
auto *demodTunerTray = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// OpenGL settings:
|
||||
//deprecated format: std::vector<int> attribList = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
|
||||
@ -93,7 +93,7 @@ AppFrame::AppFrame() :
|
||||
mainSplitter->SetSashGravity(10.0f / 37.0f);
|
||||
mainSplitter->SetMinimumPaneSize(1);
|
||||
|
||||
wxPanel *demodPanel = new wxPanel(mainSplitter, wxID_ANY);
|
||||
auto *demodPanel = new wxPanel(mainSplitter, wxID_ANY);
|
||||
|
||||
#ifdef CUBICSDR_HEADER_IMAGE
|
||||
wxFileName exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath());
|
||||
@ -143,7 +143,7 @@ AppFrame::AppFrame() :
|
||||
|
||||
#if CUBICSDR_ENABLE_VIEW_DEMOD
|
||||
// Demodulator View
|
||||
wxBoxSizer *demodVisuals = new wxBoxSizer(wxVERTICAL);
|
||||
auto *demodVisuals = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// Demod Spectrum
|
||||
demodSpectrumCanvas = makeDemodSpectrumCanvas(demodPanel, attribList);
|
||||
@ -203,7 +203,7 @@ AppFrame::AppFrame() :
|
||||
demodTray->Add(demodScopeTray, 30, wxEXPAND | wxALL, 0);
|
||||
demodTray->AddSpacer(1);
|
||||
|
||||
wxBoxSizer *demodGainTray = new wxBoxSizer(wxVERTICAL);
|
||||
auto *demodGainTray = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// Demod Gain Meter
|
||||
demodGainMeter = makeModemGainMeter(demodPanel, attribList);
|
||||
@ -231,8 +231,8 @@ AppFrame::AppFrame() :
|
||||
mainVisSplitter->SetMinimumPaneSize(1);
|
||||
mainVisSplitter->SetSashGravity(6.0f / 25.0f);
|
||||
|
||||
wxPanel *spectrumPanel = new wxPanel(mainVisSplitter, wxID_ANY);
|
||||
wxBoxSizer *spectrumSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto *spectrumPanel = new wxPanel(mainVisSplitter, wxID_ANY);
|
||||
auto *spectrumSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// Spectrum Canvas
|
||||
spectrumCanvas = makeSpectrumCanvas(spectrumPanel, attribList);
|
||||
@ -243,7 +243,7 @@ AppFrame::AppFrame() :
|
||||
spectrumSizer->Add(spectrumCanvas, 63, wxEXPAND | wxALL, 0);
|
||||
spectrumSizer->AddSpacer(1);
|
||||
|
||||
wxBoxSizer *spectrumCtlTray = new wxBoxSizer(wxVERTICAL);
|
||||
auto *spectrumCtlTray = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// Peak Hold
|
||||
peakHoldButton = makePeakHoldButton(spectrumPanel, attribList);
|
||||
@ -256,8 +256,8 @@ AppFrame::AppFrame() :
|
||||
spectrumSizer->Add(spectrumCtlTray, 1, wxEXPAND | wxALL, 0);
|
||||
spectrumPanel->SetSizer(spectrumSizer);
|
||||
|
||||
wxPanel *waterfallPanel = new wxPanel(mainVisSplitter, wxID_ANY);
|
||||
wxBoxSizer *waterfallSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto *waterfallPanel = new wxPanel(mainVisSplitter, wxID_ANY);
|
||||
auto *waterfallSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// Waterfall
|
||||
waterfallCanvas = makeWaterfall(waterfallPanel, attribList);
|
||||
@ -291,7 +291,7 @@ AppFrame::AppFrame() :
|
||||
spectrumCanvas->attachWaterfallCanvas(waterfallCanvas);
|
||||
|
||||
// Primary sizer for the window
|
||||
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
|
||||
auto *vbox = new wxBoxSizer(wxVERTICAL);
|
||||
vbox->Add(mainSplitter, 1, wxEXPAND | wxALL, 0);
|
||||
|
||||
/* * /
|
||||
@ -451,7 +451,7 @@ void AppFrame::initConfigurationSettings() {
|
||||
}
|
||||
|
||||
ModemProperties *AppFrame::makeModemProperties(wxPanel *parent) {
|
||||
ModemProperties *pProperties = new ModemProperties(parent, wxID_ANY);
|
||||
auto *pProperties = new ModemProperties(parent, wxID_ANY);
|
||||
pProperties->SetMinSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE, -1));
|
||||
pProperties->SetMaxSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE, -1));
|
||||
|
||||
@ -462,7 +462,7 @@ ModemProperties *AppFrame::makeModemProperties(wxPanel *parent) {
|
||||
}
|
||||
|
||||
ModeSelectorCanvas *AppFrame::makeModemAdvSelectorPanel(wxPanel *parent, const wxGLAttributes &attribList) {
|
||||
ModeSelectorCanvas *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
auto *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
pCanvas->addChoice("ASK");
|
||||
pCanvas->addChoice("APSK");
|
||||
pCanvas->addChoice("BPSK");
|
||||
@ -578,7 +578,7 @@ wxMenu *AppFrame::makeRigMenu() {
|
||||
|
||||
|
||||
ScopeCanvas *AppFrame::makeScopeCanvas(wxPanel *parent, const wxGLAttributes &attribList) {
|
||||
ScopeCanvas *pCanvas = new ScopeCanvas(parent, attribList);
|
||||
auto *pCanvas = new ScopeCanvas(parent, attribList);
|
||||
pCanvas->setHelpTip("Audio Visuals, drag left/right to toggle Scope or Spectrum, 'B' to toggle decibels display.");
|
||||
pCanvas->SetMinSize(wxSize(128, -1));
|
||||
return pCanvas;
|
||||
@ -587,8 +587,8 @@ ScopeCanvas *AppFrame::makeScopeCanvas(wxPanel *parent, const wxGLAttributes &at
|
||||
wxMenu *AppFrame::makeDisplayMenu() {
|
||||
|
||||
//Add Display menu
|
||||
wxMenu *dispMenu = new wxMenu;
|
||||
wxMenu *fontMenu = new wxMenu;
|
||||
auto *dispMenu = new wxMenu;
|
||||
auto *fontMenu = new wxMenu;
|
||||
|
||||
int fontScale = wxGetApp().getConfig()->getFontScale();
|
||||
|
||||
@ -598,7 +598,7 @@ wxMenu *AppFrame::makeDisplayMenu() {
|
||||
|
||||
dispMenu->AppendSubMenu(fontMenu, "&Text Size");
|
||||
|
||||
wxMenu *themeMenu = new wxMenu;
|
||||
auto *themeMenu = new wxMenu;
|
||||
|
||||
int themeId = wxGetApp().getConfig()->getTheme();
|
||||
|
||||
@ -621,48 +621,47 @@ wxMenu *AppFrame::makeDisplayMenu() {
|
||||
|
||||
wxMenu *AppFrame::makeAudioSampleRateMenu() {
|
||||
// Audio Sample Rates
|
||||
wxMenu *pMenu = new wxMenu;
|
||||
auto *pMenu = new wxMenu;
|
||||
|
||||
auto outputDevices = wxGetApp().getDemodMgr().getOutputDevices();
|
||||
|
||||
#define NUM_RATES_DEFAULT 4
|
||||
unsigned int desired_rates[NUM_RATES_DEFAULT] = { 48000, 44100, 96000, 192000 };
|
||||
|
||||
for (auto mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) {
|
||||
for (auto & outputDevice : outputDevices) {
|
||||
unsigned int desired_rate = 0;
|
||||
unsigned int desired_rank = NUM_RATES_DEFAULT + 1;
|
||||
|
||||
for (auto srate = mdevices_i->second.sampleRates.begin(); srate != mdevices_i->second.sampleRates.end();
|
||||
srate++) {
|
||||
for (unsigned int & sampleRate : outputDevice.second.sampleRates) {
|
||||
for (unsigned int i = 0; i < NUM_RATES_DEFAULT; i++) {
|
||||
if (desired_rates[i] == (*srate)) {
|
||||
if (desired_rates[i] == sampleRate) {
|
||||
if (desired_rank > i) {
|
||||
desired_rank = i;
|
||||
desired_rate = (*srate);
|
||||
desired_rate = sampleRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (desired_rank > NUM_RATES_DEFAULT) {
|
||||
desired_rate = mdevices_i->second.sampleRates.back();
|
||||
desired_rate = outputDevice.second.sampleRates.back();
|
||||
}
|
||||
AudioThread::deviceSampleRate[mdevices_i->first] = desired_rate;
|
||||
AudioThread::deviceSampleRate[outputDevice.first] = desired_rate;
|
||||
}
|
||||
|
||||
for (auto mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) {
|
||||
int menu_id = wxID_AUDIO_BANDWIDTH_BASE + wxID_AUDIO_DEVICE_MULTIPLIER * mdevices_i->first;
|
||||
wxMenu *subMenu = new wxMenu;
|
||||
pMenu->AppendSubMenu(subMenu, mdevices_i->second.name, wxT("Description?"));
|
||||
for (auto & outputDevice : outputDevices) {
|
||||
int menu_id = wxID_AUDIO_BANDWIDTH_BASE + wxID_AUDIO_DEVICE_MULTIPLIER * outputDevice.first;
|
||||
auto *subMenu = new wxMenu;
|
||||
pMenu->AppendSubMenu(subMenu, outputDevice.second.name, wxT("Description?"));
|
||||
|
||||
int j = 0;
|
||||
for (auto srate = mdevices_i->second.sampleRates.begin(); srate != mdevices_i->second.sampleRates.end();
|
||||
for (auto srate = outputDevice.second.sampleRates.begin(); srate != outputDevice.second.sampleRates.end();
|
||||
srate++) {
|
||||
stringstream srateName;
|
||||
srateName << ((float) (*srate) / 1000.0f) << "kHz";
|
||||
wxMenuItem *itm = subMenu->AppendRadioItem(menu_id + j, srateName.str(), wxT("Description?"));
|
||||
|
||||
if ((int)(*srate) == AudioThread::deviceSampleRate[mdevices_i->first]) {
|
||||
if ((int)(*srate) == AudioThread::deviceSampleRate[outputDevice.first]) {
|
||||
itm->Check(true);
|
||||
}
|
||||
audioSampleRateMenuItems[menu_id + j] = itm;
|
||||
@ -674,7 +673,7 @@ wxMenu *AppFrame::makeAudioSampleRateMenu() {
|
||||
}
|
||||
|
||||
MeterCanvas *AppFrame::makeWaterfallSpeedMeter(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
MeterCanvas *pCanvas = new MeterCanvas(parent, attribList);
|
||||
auto *pCanvas = new MeterCanvas(parent, attribList);
|
||||
pCanvas->setHelpTip("Waterfall speed, click or drag to adjust (max 1024 lines per second)");
|
||||
pCanvas->setMax(sqrt(1024));
|
||||
pCanvas->setLevel(sqrt(DEFAULT_WATERFALL_LPS));
|
||||
@ -684,13 +683,13 @@ MeterCanvas *AppFrame::makeWaterfallSpeedMeter(wxWindow *parent, const wxGLAttri
|
||||
}
|
||||
|
||||
WaterfallCanvas *AppFrame::makeWaterfall(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
WaterfallCanvas *pCanvas = new WaterfallCanvas(parent, attribList);
|
||||
auto *pCanvas = new WaterfallCanvas(parent, attribList);
|
||||
pCanvas->setup(DEFAULT_FFT_SIZE, DEFAULT_MAIN_WATERFALL_LINES_NB);
|
||||
return pCanvas;
|
||||
}
|
||||
|
||||
MeterCanvas * AppFrame::makeSpectrumAvgMeter(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
MeterCanvas *pCanvas = new MeterCanvas(parent, attribList);
|
||||
auto *pCanvas = new MeterCanvas(parent, attribList);
|
||||
pCanvas->setHelpTip("Spectrum averaging speed, click or drag to adjust.");
|
||||
pCanvas->setMax(1.0);
|
||||
pCanvas->setLevel(0.65f);
|
||||
@ -700,7 +699,7 @@ MeterCanvas * AppFrame::makeSpectrumAvgMeter(wxWindow *parent, const wxGLAttribu
|
||||
}
|
||||
|
||||
SpectrumCanvas *AppFrame::makeSpectrumCanvas(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
SpectrumCanvas *pCanvas = new SpectrumCanvas(parent, attribList);
|
||||
auto *pCanvas = new SpectrumCanvas(parent, attribList);
|
||||
pCanvas->setShowDb(true);
|
||||
pCanvas->setUseDBOfs(true);
|
||||
pCanvas->setScaleFactorEnabled(true);
|
||||
@ -708,7 +707,7 @@ SpectrumCanvas *AppFrame::makeSpectrumCanvas(wxWindow *parent, const wxGLAttribu
|
||||
}
|
||||
|
||||
ModeSelectorCanvas *AppFrame::makePeakHoldButton(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
ModeSelectorCanvas *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
auto *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
pCanvas->addChoice(1, "P");
|
||||
pCanvas->setPadding(-1, -1);
|
||||
pCanvas->setHighlightColor(RGBA4f(0.2f, 0.8f, 0.2f));
|
||||
@ -720,7 +719,7 @@ ModeSelectorCanvas *AppFrame::makePeakHoldButton(wxWindow *parent, const wxGLAtt
|
||||
}
|
||||
|
||||
ModeSelectorCanvas *AppFrame::makeModemMuteButton(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
ModeSelectorCanvas *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
auto *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
pCanvas->addChoice(1, "M");
|
||||
pCanvas->setPadding(-1, -1);
|
||||
pCanvas->setHighlightColor(RGBA4f(0.8f, 0.2f, 0.2f));
|
||||
@ -732,7 +731,7 @@ ModeSelectorCanvas *AppFrame::makeModemMuteButton(wxWindow *parent, const wxGLAt
|
||||
}
|
||||
|
||||
ModeSelectorCanvas *AppFrame::makeSoloModeButton(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
ModeSelectorCanvas *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
auto *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
pCanvas->addChoice(1, "S");
|
||||
pCanvas->setPadding(-1, -1);
|
||||
pCanvas->setHighlightColor(RGBA4f(0.8f, 0.8f, 0.2f));
|
||||
@ -744,7 +743,7 @@ ModeSelectorCanvas *AppFrame::makeSoloModeButton(wxWindow *parent, const wxGLAtt
|
||||
}
|
||||
|
||||
MeterCanvas *AppFrame::makeModemGainMeter(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
MeterCanvas *pCanvas = new MeterCanvas(parent, attribList);
|
||||
auto *pCanvas = new MeterCanvas(parent, attribList);
|
||||
pCanvas->setMax(2.0);
|
||||
pCanvas->setHelpTip("Current Demodulator Gain Level. Click / Drag to set Gain level.");
|
||||
pCanvas->setShowUserInput(false);
|
||||
@ -753,13 +752,13 @@ MeterCanvas *AppFrame::makeModemGainMeter(wxWindow *parent, const wxGLAttributes
|
||||
}
|
||||
|
||||
TuningCanvas *AppFrame::makeModemTuner(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
TuningCanvas *pCanvas = new TuningCanvas(parent, attribList);
|
||||
auto *pCanvas = new TuningCanvas(parent, attribList);
|
||||
pCanvas->SetMinClientSize(wxSize(200, 28));
|
||||
return pCanvas;
|
||||
}
|
||||
|
||||
ModeSelectorCanvas * AppFrame::makeDeltaLockButton(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
ModeSelectorCanvas *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
auto *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
pCanvas->addChoice(1, "V");
|
||||
pCanvas->setPadding(-1, -1);
|
||||
pCanvas->setHighlightColor(RGBA4f(0.8f, 0.8f, 0.2f));
|
||||
@ -771,7 +770,7 @@ ModeSelectorCanvas * AppFrame::makeDeltaLockButton(wxWindow *parent, const wxGLA
|
||||
}
|
||||
|
||||
MeterCanvas *AppFrame::makeSignalMeter(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
MeterCanvas *pCanvas = new MeterCanvas(parent, attribList);
|
||||
auto *pCanvas = new MeterCanvas(parent, attribList);
|
||||
pCanvas->setMax(DEMOD_SIGNAL_MAX);
|
||||
pCanvas->setMin(DEMOD_SIGNAL_MIN);
|
||||
pCanvas->setLevel(DEMOD_SIGNAL_MIN);
|
||||
@ -782,13 +781,13 @@ MeterCanvas *AppFrame::makeSignalMeter(wxWindow *parent, const wxGLAttributes &a
|
||||
}
|
||||
|
||||
SpectrumCanvas *AppFrame::makeDemodSpectrumCanvas(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
SpectrumCanvas *pCanvas = new SpectrumCanvas(parent, attribList);
|
||||
auto *pCanvas = new SpectrumCanvas(parent, attribList);
|
||||
pCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000);
|
||||
return pCanvas;
|
||||
}
|
||||
|
||||
WaterfallCanvas *AppFrame::makeWaterfallCanvas(wxWindow *parent, const wxGLAttributes &attribList) {
|
||||
WaterfallCanvas *pCanvas = new WaterfallCanvas(parent, attribList);
|
||||
auto *pCanvas = new WaterfallCanvas(parent, attribList);
|
||||
pCanvas->setup(DEFAULT_DMOD_FFT_SIZE, DEFAULT_DEMOD_WATERFALL_LINES_NB);
|
||||
pCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000);
|
||||
pCanvas->setMinBandwidth(8000);
|
||||
@ -811,9 +810,9 @@ ModeSelectorCanvas *AppFrame::makeModemSelectorPanel(wxWindow *parent, const wxG
|
||||
}
|
||||
#endif
|
||||
|
||||
ModeSelectorCanvas *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
auto *pCanvas = new ModeSelectorCanvas(parent, attribList);
|
||||
|
||||
for (auto mt_i : modemList) {
|
||||
for (const auto& mt_i : modemList) {
|
||||
pCanvas->addChoice(mt_i);
|
||||
}
|
||||
|
||||
@ -837,7 +836,7 @@ AppFrame::~AppFrame() {
|
||||
|
||||
wxMenu *AppFrame::makeFileMenu() {
|
||||
|
||||
wxMenu *menu = new wxMenu;
|
||||
auto *menu = new wxMenu;
|
||||
#ifndef __APPLE__
|
||||
#ifdef CUBICSDR_ENABLE_ABOUT_DIALOG
|
||||
menu->Append(wxID_ABOUT_CUBICSDR, "About " CUBICSDR_INSTALL_NAME);
|
||||
@ -848,7 +847,7 @@ wxMenu *AppFrame::makeFileMenu() {
|
||||
menu->Append(wxID_SDR_START_STOP, "Stop / Start Device");
|
||||
menu->AppendSeparator();
|
||||
|
||||
wxMenu *sessionMenu = new wxMenu;
|
||||
auto *sessionMenu = new wxMenu;
|
||||
|
||||
sessionMenu->Append(wxID_OPEN, "&Open Session");
|
||||
sessionMenu->Append(wxID_SAVE, "&Save Session");
|
||||
@ -860,7 +859,7 @@ wxMenu *AppFrame::makeFileMenu() {
|
||||
|
||||
menu->AppendSeparator();
|
||||
|
||||
wxMenu *bookmarkMenu = new wxMenu;
|
||||
auto *bookmarkMenu = new wxMenu;
|
||||
|
||||
bookmarkMenu->Append(wxID_OPEN_BOOKMARKS, "Open Bookmarks");
|
||||
bookmarkMenu->Append(wxID_SAVE_BOOKMARKS, "Save Bookmarks");
|
||||
@ -890,14 +889,14 @@ wxMenu *AppFrame::makeRecordingMenu() {
|
||||
|
||||
recordingMenuItems.clear();
|
||||
|
||||
wxMenu *menu = new wxMenu;
|
||||
auto *menu = new wxMenu;
|
||||
|
||||
recordingMenuItems[wxID_RECORDING_PATH] = menu->Append(wxID_RECORDING_PATH, getSettingsLabel("Set Recording Path", "<Not Set>"));
|
||||
|
||||
menu->AppendSeparator();
|
||||
|
||||
//Squelch options as sub-menu:
|
||||
wxMenu *subMenu = new wxMenu;
|
||||
auto *subMenu = new wxMenu;
|
||||
recordingMenuItems[wxID_RECORDING_SQUELCH_BASE] = menu->AppendSubMenu(subMenu, "Squelch");
|
||||
|
||||
recordingMenuItems[wxID_RECORDING_SQUELCH_SILENCE] = subMenu->AppendRadioItem(wxID_RECORDING_SQUELCH_SILENCE, "Record Silence",
|
||||
@ -962,8 +961,8 @@ void AppFrame::updateRecordingMenu() {
|
||||
}
|
||||
}
|
||||
|
||||
void AppFrame::initDeviceParams(SDRDeviceInfo *devInfo) {
|
||||
this->devInfo = devInfo;
|
||||
void AppFrame::initDeviceParams(SDRDeviceInfo *devInfo_in) {
|
||||
devInfo = devInfo_in;
|
||||
deviceChanged.store(true);
|
||||
}
|
||||
|
||||
@ -981,14 +980,14 @@ void AppFrame::handleUpdateDeviceParams() {
|
||||
SoapySDR::Device *soapyDev = devInfo->getSoapyDevice();
|
||||
|
||||
// Build settings menu
|
||||
wxMenu *newSettingsMenu = new wxMenu;
|
||||
auto *newSettingsMenu = new wxMenu;
|
||||
showTipMenuItem = newSettingsMenu->AppendCheckItem(wxID_SET_TIPS, "Show Hover Tips");
|
||||
showTipMenuItem->Check(wxGetApp().getConfig()->getShowTips());
|
||||
|
||||
// CPU usage menu:
|
||||
performanceMenuItems.clear();
|
||||
|
||||
wxMenu *subMenu = new wxMenu;
|
||||
auto *subMenu = new wxMenu;
|
||||
|
||||
performanceMenuItems[wxID_PERF_BASE + (int)AppConfig::PERF_HIGH] = subMenu->AppendRadioItem(wxID_PERF_BASE + (int)AppConfig::PERF_HIGH, "High (+enhanced DSP)");
|
||||
performanceMenuItems[wxID_PERF_BASE + (int)AppConfig::PERF_NORMAL] = subMenu->AppendRadioItem(wxID_PERF_BASE + (int)AppConfig::PERF_NORMAL, "Normal");
|
||||
@ -1026,7 +1025,7 @@ void AppFrame::handleUpdateDeviceParams() {
|
||||
}
|
||||
|
||||
agcMenuItem = nullptr;
|
||||
if (soapyDev->listGains(SOAPY_SDR_RX, 0).size()) {
|
||||
if (!soapyDev->listGains(SOAPY_SDR_RX, 0).empty()) {
|
||||
agcMenuItem = newSettingsMenu->AppendCheckItem(wxID_AGC_CONTROL, "Automatic Gain");
|
||||
agcMenuItem->Check(wxGetApp().getAGCMode());
|
||||
} else if (!wxGetApp().getAGCMode()) {
|
||||
@ -1044,11 +1043,11 @@ void AppFrame::handleUpdateDeviceParams() {
|
||||
|
||||
antennaNames = availableAntennas;
|
||||
|
||||
wxMenu *subMenu = new wxMenu;
|
||||
auto *subMenu = new wxMenu;
|
||||
|
||||
int i = 0;
|
||||
std::string antennaChecked;
|
||||
for (std::string currentAntenna : availableAntennas) {
|
||||
for (const std::string& currentAntenna : availableAntennas) {
|
||||
|
||||
antennaMenuItems[wxID_ANTENNAS_BASE + i] = subMenu->AppendRadioItem(wxID_ANTENNAS_BASE + i, currentAntenna);
|
||||
|
||||
@ -1083,7 +1082,7 @@ void AppFrame::handleUpdateDeviceParams() {
|
||||
SoapySDR::ArgInfoList::const_iterator args_i;
|
||||
settingArgs = soapyDev->getSettingInfo();
|
||||
|
||||
if (settingArgs.size()) {
|
||||
if (!settingArgs.empty()) {
|
||||
newSettingsMenu->AppendSeparator();
|
||||
}
|
||||
//for each Runtime option of index i:
|
||||
@ -1105,16 +1104,16 @@ void AppFrame::handleUpdateDeviceParams() {
|
||||
settingsMenuItems[wxID_SETTINGS_BASE + i] = newSettingsMenu->Append(wxID_SETTINGS_BASE + i, getSettingsLabel(arg.name, currentVal, arg.units), arg.description);
|
||||
i++;
|
||||
} else if (arg.type == SoapySDR::ArgInfo::STRING) {
|
||||
if (arg.options.size()) {
|
||||
wxMenu *subMenu = new wxMenu;
|
||||
if (!arg.options.empty()) {
|
||||
auto *subMenu = new wxMenu;
|
||||
int j = 0;
|
||||
std::vector<int> subItemsIds;
|
||||
//for each of this options
|
||||
for (std::string optName : arg.options) {
|
||||
for (const std::string& optName : arg.options) {
|
||||
//by default the option name is the same as the displayed name.
|
||||
std::string displayName = optName;
|
||||
|
||||
if (arg.optionNames.size()) {
|
||||
if (!arg.optionNames.empty()) {
|
||||
displayName = arg.optionNames[j];
|
||||
}
|
||||
wxMenuItem *item = subMenu->AppendRadioItem(wxID_SETTINGS_BASE+i, displayName);
|
||||
@ -1146,7 +1145,7 @@ void AppFrame::handleUpdateDeviceParams() {
|
||||
sampleRates = devInfo->getSampleRates(SOAPY_SDR_RX, 0);
|
||||
sampleRateMenuItems.clear();
|
||||
|
||||
wxMenu *newSampleRateMenu = new wxMenu;
|
||||
auto *newSampleRateMenu = new wxMenu;
|
||||
int ofs = 0;
|
||||
|
||||
//Current sample rate, try to keep it as is.
|
||||
@ -1167,11 +1166,11 @@ void AppFrame::handleUpdateDeviceParams() {
|
||||
}
|
||||
|
||||
bool checked = false;
|
||||
for (vector<long>::iterator i = sampleRates.begin(); i != sampleRates.end(); i++) {
|
||||
for (long & i : sampleRates) {
|
||||
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_BASE+ofs] = newSampleRateMenu->AppendRadioItem(wxID_BANDWIDTH_BASE+ofs, frequencyToStr(*i));
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_BASE+ofs] = newSampleRateMenu->AppendRadioItem(wxID_BANDWIDTH_BASE+ofs, frequencyToStr(i));
|
||||
|
||||
if (sampleRate == (*i)) {
|
||||
if (sampleRate == i) {
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_BASE+ofs]->Check(true);
|
||||
checked = true;
|
||||
}
|
||||
@ -1262,11 +1261,11 @@ void AppFrame::disableRig() {
|
||||
wxGetApp().getConfig()->setRigEnabled(false);
|
||||
}
|
||||
|
||||
void AppFrame::setRigControlPort(std::string portName) {
|
||||
void AppFrame::setRigControlPort(const std::string& portName) {
|
||||
if (rigPortDialog == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (portName != "") {
|
||||
if (!portName.empty()) {
|
||||
rigPort = portName;
|
||||
|
||||
wxGetApp().stopRig();
|
||||
@ -1321,7 +1320,7 @@ bool AppFrame::actionOnMenuDisplay(wxCommandEvent& event) {
|
||||
if (event.GetId() == wxID_THEME_DEFAULT) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_DEFAULT);
|
||||
}
|
||||
else if (event.GetId() == wxID_THEME_DEFAULT_JET) {
|
||||
else if (event.GetId() == wxID_THEME_DEFAULT_JET) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_DEFAULT_JET);
|
||||
}
|
||||
else if (event.GetId() == wxID_THEME_SHARP) {
|
||||
@ -1437,8 +1436,8 @@ bool AppFrame::actionOnMenuAbout(wxCommandEvent& event) {
|
||||
aboutDlg->SetFocus();
|
||||
}
|
||||
else {
|
||||
aboutDlg = new AboutDialog(NULL);
|
||||
aboutDlg->Connect(wxEVT_CLOSE_WINDOW, wxCommandEventHandler(AppFrame::OnAboutDialogClose), NULL, this);
|
||||
aboutDlg = new AboutDialog(nullptr);
|
||||
aboutDlg->Connect(wxEVT_CLOSE_WINDOW, wxCommandEventHandler(AppFrame::OnAboutDialogClose), nullptr, this);
|
||||
|
||||
aboutDlg->Show();
|
||||
}
|
||||
@ -1465,10 +1464,8 @@ bool AppFrame::actionOnMenuSettings(wxCommandEvent& event) {
|
||||
int setIdx = event.GetId() - wxID_SETTINGS_BASE;
|
||||
int menuIdx = 0;
|
||||
|
||||
for (std::vector<SoapySDR::ArgInfo>::iterator arg_i = settingArgs.begin(); arg_i != settingArgs.end(); arg_i++) {
|
||||
SoapySDR::ArgInfo &arg = (*arg_i);
|
||||
|
||||
if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size() && setIdx >= menuIdx && setIdx < menuIdx + (int)arg.options.size()) {
|
||||
for (auto & arg : settingArgs) {
|
||||
if (arg.type == SoapySDR::ArgInfo::STRING && !arg.options.empty() && setIdx >= menuIdx && setIdx < menuIdx + (int)arg.options.size()) {
|
||||
int optIdx = setIdx - menuIdx;
|
||||
wxGetApp().getSDRThread()->writeSetting(arg.key, arg.options[optIdx]);
|
||||
|
||||
@ -1476,7 +1473,7 @@ bool AppFrame::actionOnMenuSettings(wxCommandEvent& event) {
|
||||
settingsMenuItems[menuIdx + wxID_SETTINGS_BASE]->SetItemLabel(getSettingsLabel(arg.name, arg.options[optIdx], arg.units));
|
||||
break;
|
||||
}
|
||||
else if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
|
||||
else if (arg.type == SoapySDR::ArgInfo::STRING && !arg.options.empty()) {
|
||||
menuIdx += arg.options.size();
|
||||
}
|
||||
else if (menuIdx == setIdx) {
|
||||
@ -1489,7 +1486,7 @@ bool AppFrame::actionOnMenuSettings(wxCommandEvent& event) {
|
||||
|
||||
settingsMenuItems[menuIdx + wxID_SETTINGS_BASE]->SetItemLabel(getSettingsLabel(arg.name, stringVal.ToStdString(), arg.units));
|
||||
|
||||
if (stringVal.ToStdString() != "") {
|
||||
if (!stringVal.ToStdString().empty()) {
|
||||
wxGetApp().getSDRThread()->writeSetting(arg.key, stringVal.ToStdString());
|
||||
}
|
||||
break;
|
||||
@ -1499,7 +1496,7 @@ bool AppFrame::actionOnMenuSettings(wxCommandEvent& event) {
|
||||
try {
|
||||
currentVal = std::stoi(wxGetApp().getSDRThread()->readSetting(arg.key));
|
||||
}
|
||||
catch (std::invalid_argument e) {
|
||||
catch (const std::invalid_argument &e) {
|
||||
currentVal = 0;
|
||||
}
|
||||
int intVal = wxGetNumberFromUser(arg.description, arg.units, arg.name, currentVal, arg.range.minimum(), arg.range.maximum(), this);
|
||||
@ -1516,7 +1513,7 @@ bool AppFrame::actionOnMenuSettings(wxCommandEvent& event) {
|
||||
try {
|
||||
wxGetApp().getSDRThread()->writeSetting(arg.key, floatVal.ToStdString());
|
||||
}
|
||||
catch (std::invalid_argument e) {
|
||||
catch (const std::invalid_argument &e) {
|
||||
// ...
|
||||
}
|
||||
settingsMenuItems[menuIdx + wxID_SETTINGS_BASE]->SetItemLabel(getSettingsLabel(arg.name, floatVal.ToStdString(), arg.units));
|
||||
@ -1541,7 +1538,7 @@ bool AppFrame::actionOnMenuAGC(wxCommandEvent& event) {
|
||||
|
||||
if (event.GetId() == wxID_AGC_CONTROL) {
|
||||
|
||||
if (wxGetApp().getDevice() == NULL) {
|
||||
if (wxGetApp().getDevice() == nullptr) {
|
||||
agcMenuItem->Check(true);
|
||||
return true;
|
||||
}
|
||||
@ -1582,15 +1579,15 @@ bool AppFrame::actionOnMenuSampleRate(wxCommandEvent& event) {
|
||||
SDRDeviceInfo *dev = wxGetApp().getDevice();
|
||||
if (dev != nullptr) {
|
||||
|
||||
std::vector<long> sampleRates = dev->getSampleRates(SOAPY_SDR_RX, 0);
|
||||
std::vector<long> sampleRateList = dev->getSampleRates(SOAPY_SDR_RX, 0);
|
||||
|
||||
//default
|
||||
rateLow = MANUAL_SAMPLE_RATE_MIN;
|
||||
rateHigh = MANUAL_SAMPLE_RATE_MAX;
|
||||
|
||||
if (sampleRates.size()) {
|
||||
rateLow = sampleRates.front();
|
||||
rateHigh = sampleRates.back();
|
||||
if (!sampleRateList.empty()) {
|
||||
rateLow = sampleRateList.front();
|
||||
rateHigh = sampleRateList.back();
|
||||
}
|
||||
|
||||
long bw = wxGetNumberFromUser("\n" + dev->getName() + "\n\n "
|
||||
@ -1635,17 +1632,17 @@ bool AppFrame::actionOnMenuAudioSampleRate(wxCommandEvent& event) {
|
||||
auto outputDevices = wxGetApp().getDemodMgr().getOutputDevices();
|
||||
|
||||
int i = 0;
|
||||
for (auto mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) {
|
||||
int menu_id = wxID_AUDIO_BANDWIDTH_BASE + wxID_AUDIO_DEVICE_MULTIPLIER * mdevices_i->first;
|
||||
for (auto & outputDevice : outputDevices) {
|
||||
int menu_id = wxID_AUDIO_BANDWIDTH_BASE + wxID_AUDIO_DEVICE_MULTIPLIER * outputDevice.first;
|
||||
|
||||
int j = 0;
|
||||
for (std::vector<unsigned int>::iterator srate = mdevices_i->second.sampleRates.begin(); srate != mdevices_i->second.sampleRates.end();
|
||||
for (auto srate = outputDevice.second.sampleRates.begin(); srate != outputDevice.second.sampleRates.end();
|
||||
srate++) {
|
||||
|
||||
if (evId == menu_id + j) {
|
||||
//audioSampleRateMenuItems[menu_id+j];
|
||||
//std::cout << "Would set audio sample rate on device " << mdevices_i->second.name << " (" << mdevices_i->first << ") to " << (*srate) << "Hz" << std::endl;
|
||||
AudioThread::setDeviceSampleRate(mdevices_i->first, *srate);
|
||||
AudioThread::setDeviceSampleRate(outputDevice.first, *srate);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1696,7 +1693,7 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
|
||||
}
|
||||
|
||||
//save mecanic for bookmark files
|
||||
else if (event.GetId() == wxID_SAVE_BOOKMARKS) {
|
||||
else if (event.GetId() == wxID_SAVE_BOOKMARKS) {
|
||||
|
||||
if (!currentBookmarkFile.empty()) {
|
||||
wxGetApp().getBookmarkMgr().saveToFile(currentBookmarkFile, false, true);
|
||||
@ -1723,7 +1720,7 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (event.GetId() == wxID_OPEN_BOOKMARKS) {
|
||||
else if (event.GetId() == wxID_OPEN_BOOKMARKS) {
|
||||
|
||||
wxFileDialog openFileDialog(this, _("Open XML Bookmark file"), "", "", "XML files (*.xml)|*.xml", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (openFileDialog.ShowModal() == wxID_CANCEL) {
|
||||
@ -1743,7 +1740,7 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (event.GetId() == wxID_SAVEAS_BOOKMARKS) {
|
||||
else if (event.GetId() == wxID_SAVEAS_BOOKMARKS) {
|
||||
|
||||
wxFileDialog saveFileDialog(this, _("Save XML Bookmark file"), "", "", "XML files (*.xml)|*.xml", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (saveFileDialog.ShowModal() == wxID_CANCEL) {
|
||||
@ -1765,7 +1762,7 @@ bool AppFrame::actionOnMenuLoadSave(wxCommandEvent& event) {
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (event.GetId() == wxID_RESET_BOOKMARKS) {
|
||||
else if (event.GetId() == wxID_RESET_BOOKMARKS) {
|
||||
|
||||
ActionDialog::showDialog(new ActionDialogBookmarkReset());
|
||||
|
||||
@ -2271,7 +2268,7 @@ void AppFrame::handleModemProperties() {
|
||||
modemProps->fitColumns();
|
||||
#if ENABLE_DIGITAL_LAB
|
||||
if (demod->getModemType() == "digital") {
|
||||
ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *) demod->getOutput();
|
||||
auto *outp = (ModemDigitalOutputConsole *) demod->getOutput();
|
||||
if (!outp->getDialog()) {
|
||||
outp->setTitle(demod->getDemodulatorType() + ": " + frequencyToStr(demod->getFrequency()));
|
||||
outp->setDialog(new DigitalConsole(this, outp));
|
||||
@ -2404,14 +2401,14 @@ void AppFrame::handleModeSelector() {
|
||||
string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
|
||||
|
||||
// basic demodulators
|
||||
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
||||
if (!dSelection.empty() && dSelection != mgr->getLastDemodulatorType()) {
|
||||
mgr->setLastDemodulatorType(dSelection);
|
||||
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelection));
|
||||
demodTuner->setHalfBand(dSelection == "USB" || dSelection == "LSB");
|
||||
demodModeSelectorAdv->setSelection(-1);
|
||||
}
|
||||
// advanced demodulators
|
||||
else if (dSelectionadv != "" && dSelectionadv != mgr->getLastDemodulatorType()) {
|
||||
else if (!dSelectionadv.empty() && dSelectionadv != mgr->getLastDemodulatorType()) {
|
||||
mgr->setLastDemodulatorType(dSelectionadv);
|
||||
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelectionadv));
|
||||
demodTuner->setHalfBand(false);
|
||||
@ -2507,13 +2504,13 @@ void AppFrame::handleCurrentModem() {
|
||||
string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
|
||||
|
||||
// basic demodulators
|
||||
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
||||
if (!dSelection.empty() && dSelection != demod->getDemodulatorType()) {
|
||||
demod->setDemodulatorType(dSelection);
|
||||
demodTuner->setHalfBand(dSelection == "USB" || dSelection == "LSB");
|
||||
demodModeSelectorAdv->setSelection(-1);
|
||||
}
|
||||
// advanced demodulators
|
||||
else if (dSelectionadv != "" && dSelectionadv != demod->getDemodulatorType()) {
|
||||
else if (!dSelectionadv.empty() && dSelectionadv != demod->getDemodulatorType()) {
|
||||
demod->setDemodulatorType(dSelectionadv);
|
||||
demodTuner->setHalfBand(false);
|
||||
demodModeSelector->setSelection(-1);
|
||||
@ -2609,7 +2606,7 @@ void AppFrame::handleCurrentModem() {
|
||||
void AppFrame::OnDoubleClickSash(wxSplitterEvent& event)
|
||||
{
|
||||
wxWindow *a, *b;
|
||||
wxSplitterWindow *w = NULL;
|
||||
wxSplitterWindow *w = nullptr;
|
||||
float g = 0.5;
|
||||
|
||||
if (event.GetId() == wxID_MAIN_SPLITTER) {
|
||||
@ -2620,7 +2617,7 @@ void AppFrame::OnDoubleClickSash(wxSplitterEvent& event)
|
||||
g = 6.0f/25.0f;
|
||||
}
|
||||
|
||||
if (w != NULL) {
|
||||
if (w != nullptr) {
|
||||
a = w->GetWindow1();
|
||||
b = w->GetWindow2();
|
||||
w->Unsplit();
|
||||
@ -2643,7 +2640,7 @@ void AppFrame::OnAboutDialogClose(wxCommandEvent& /* event */) {
|
||||
aboutDlg = nullptr;
|
||||
}
|
||||
|
||||
void AppFrame::saveSession(std::string fileName) {
|
||||
void AppFrame::saveSession(const std::string& fileName) {
|
||||
wxGetApp().getSessionMgr().saveSession(fileName);
|
||||
|
||||
currentSessionFile = fileName;
|
||||
@ -2659,7 +2656,7 @@ void AppFrame::saveSession(std::string fileName) {
|
||||
SetTitle(titleBar);
|
||||
}
|
||||
|
||||
bool AppFrame::loadSession(std::string fileName) {
|
||||
bool AppFrame::loadSession(const std::string& fileName) {
|
||||
bool result = wxGetApp().getSessionMgr().loadSession(fileName);
|
||||
|
||||
int sample_rate = wxGetApp().getSampleRate();
|
||||
@ -2794,7 +2791,7 @@ FrequencyDialog::FrequencyDialogTarget AppFrame::getFrequencyDialogTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
void AppFrame::gkNudge(DemodulatorInstancePtr demod, int snap) {
|
||||
void AppFrame::gkNudge(const DemodulatorInstancePtr& demod, int snap) {
|
||||
if (demod) {
|
||||
auto demodFreq = demod->getFrequency()+snap;
|
||||
auto demodBw = demod->getBandwidth();
|
||||
@ -3114,14 +3111,14 @@ void AppFrame::toggleAllActiveDemodRecording() {
|
||||
//by default, do a false => true for all:
|
||||
bool stateToSet = true;
|
||||
|
||||
for (auto i : allDemods) {
|
||||
for (const auto& i : allDemods) {
|
||||
if (i->isRecording()) {
|
||||
stateToSet = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto i : allDemods) {
|
||||
for (const auto& i : allDemods) {
|
||||
|
||||
i->setRecording(stateToSet);
|
||||
}
|
||||
@ -3161,7 +3158,7 @@ int AppFrame::getViewBandwidth() {
|
||||
}
|
||||
|
||||
|
||||
void AppFrame::setStatusText(wxWindow* window, std::string statusText) {
|
||||
void AppFrame::setStatusText(wxWindow* window, const std::string& statusText) {
|
||||
GetStatusBar()->SetStatusText(statusText);
|
||||
if (wxGetApp().getConfig()->getShowTips()) {
|
||||
if (statusText != lastToolTip) {
|
||||
@ -3178,7 +3175,7 @@ void AppFrame::setStatusText(wxWindow* window, std::string statusText) {
|
||||
}
|
||||
}
|
||||
|
||||
void AppFrame::setStatusText(std::string statusText, int value) {
|
||||
void AppFrame::setStatusText(const std::string& statusText, int value) {
|
||||
GetStatusBar()->SetStatusText(
|
||||
wxString::Format(statusText.c_str(), wxNumberFormatter::ToString((long)value, wxNumberFormatter::Style_WithThousandsSep)));
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ class PortSelectorDialog;
|
||||
class AppFrame: public wxFrame {
|
||||
public:
|
||||
AppFrame();
|
||||
~AppFrame();
|
||||
~AppFrame() override;
|
||||
|
||||
void initDeviceParams(SDRDeviceInfo *devInfo);
|
||||
void initDeviceParams(SDRDeviceInfo *devInfo_in);
|
||||
|
||||
FFTVisualDataThread *getWaterfallDataThread();
|
||||
WaterfallCanvas *getWaterfallCanvas();
|
||||
@ -80,12 +80,12 @@ public:
|
||||
bool canFocus();
|
||||
#endif
|
||||
//set tooltip to window
|
||||
void setStatusText(wxWindow* window, std::string statusText);
|
||||
void setStatusText(std::string statusText, int value);
|
||||
void setStatusText(wxWindow* window, const std::string& statusText);
|
||||
void setStatusText(const std::string& statusText, int value);
|
||||
|
||||
|
||||
#ifdef USE_HAMLIB
|
||||
void setRigControlPort(std::string portName);
|
||||
void setRigControlPort(const std::string& portName);
|
||||
void dismissRigControlPortDialog();
|
||||
#endif
|
||||
|
||||
@ -192,13 +192,13 @@ private:
|
||||
/**
|
||||
* Session Management
|
||||
*/
|
||||
void saveSession(std::string fileName);
|
||||
bool loadSession(std::string fileName);
|
||||
void saveSession(const std::string& fileName);
|
||||
bool loadSession(const std::string& fileName);
|
||||
|
||||
/**
|
||||
* Keyboard handlers
|
||||
*/
|
||||
void gkNudge(DemodulatorInstancePtr demod, int snap);
|
||||
void gkNudge(const DemodulatorInstancePtr& demod, int snap);
|
||||
|
||||
void toggleActiveDemodRecording();
|
||||
void toggleAllActiveDemodRecording();
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "BookmarkMgr.h"
|
||||
#include "CubicSDR.h"
|
||||
#include "DataTree.h"
|
||||
#include <wx/string.h>
|
||||
|
||||
#define BOOKMARK_RECENTS_MAX 25
|
||||
|
||||
@ -16,7 +15,7 @@ BookmarkMgr::BookmarkMgr() {
|
||||
rangesSorted = false;
|
||||
}
|
||||
//
|
||||
void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpath) {
|
||||
void BookmarkMgr::saveToFile(const std::string& bookmarkFn, bool backup, bool useFullpath) {
|
||||
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
@ -33,7 +32,7 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpa
|
||||
|
||||
DataNode *view_ranges = s.rootNode()->newChild("ranges");
|
||||
|
||||
for (auto re_i : ranges) {
|
||||
for (const auto& re_i : ranges) {
|
||||
DataNode *range = view_ranges->newChild("range");
|
||||
*range->newChild("label") = re_i->label;
|
||||
*range->newChild("freq") = re_i->freq;
|
||||
@ -69,7 +68,7 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpa
|
||||
|
||||
DataNode *recent_modems = s.rootNode()->newChild("recent_modems");
|
||||
|
||||
for (auto demod : wxGetApp().getDemodMgr().getDemodulators()) {
|
||||
for (const auto& demod : wxGetApp().getDemodMgr().getDemodulators()) {
|
||||
wxGetApp().getDemodMgr().saveInstance(recent_modems->newChild("modem"),demod);
|
||||
}
|
||||
|
||||
@ -98,7 +97,7 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpa
|
||||
}
|
||||
}
|
||||
|
||||
bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFullpath) {
|
||||
bool BookmarkMgr::loadFromFile(const std::string& bookmarkFn, bool backup, bool useFullpath) {
|
||||
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
@ -157,10 +156,10 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
|
||||
if (branches->hasAnother("range")) branches->getNext("range")->element()->get(bRange);
|
||||
if (branches->hasAnother("bookmark")) branches->getNext("bookmark")->element()->get(bBookmark);
|
||||
if (branches->hasAnother("recent")) branches->getNext("recent")->element()->get(bRecent);
|
||||
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("active", bActive?true:false);
|
||||
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("range", bRange?true:false);
|
||||
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("bookmark", bBookmark?true:false);
|
||||
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("recent", bRecent?true:false);
|
||||
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("active", bActive != 0);
|
||||
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("range", bRange != 0);
|
||||
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("bookmark", bBookmark != 0);
|
||||
wxGetApp().getAppFrame()->getBookmarkView()->setExpandState("recent", bRecent != 0);
|
||||
}
|
||||
|
||||
if (s.rootNode()->hasAnother("ranges")) {
|
||||
@ -183,20 +182,20 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
|
||||
DataNode *modems = s.rootNode()->getNext("modems");
|
||||
while (modems->hasAnother("group")) {
|
||||
DataNode *group = modems->getNext("group");
|
||||
std::string expandState = "true";
|
||||
std::string groupExpandState = "true";
|
||||
std::string groupName = "Unnamed";
|
||||
if (group->hasAnother("@name")) {
|
||||
groupName = group->getNext("@name")->element()->toString();
|
||||
}
|
||||
if (group->hasAnother("@expanded")) {
|
||||
expandState = group->getNext("@expanded")->element()->toString();
|
||||
groupExpandState = group->getNext("@expanded")->element()->toString();
|
||||
}
|
||||
setExpandState(groupName, (expandState == "true"));
|
||||
setExpandState(groupName, (groupExpandState == "true"));
|
||||
while (group->hasAnother("modem")) {
|
||||
DataNode *modem = group->getNext("modem");
|
||||
BookmarkEntryPtr be = nodeToBookmark(modem);
|
||||
if (be) {
|
||||
addBookmark(groupName.c_str(), be);
|
||||
addBookmark(groupName, be);
|
||||
} else {
|
||||
std::cout << "error loading bookmarked modem.." << std::endl;
|
||||
loadStatusOk = false;
|
||||
@ -227,7 +226,7 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
|
||||
wxCopyFile(loadFile.GetFullPath(wxPATH_NATIVE).ToStdString(), lastLoaded.GetFullPath(wxPATH_NATIVE).ToStdString());
|
||||
}
|
||||
}
|
||||
} else if (!loadStatusOk) {
|
||||
} else {
|
||||
if (loadFile.IsDirWritable()) { // Load failed; keep a copy of the failed bookmark file for analysis?
|
||||
if (loadFile.FileExists() && (!failFile.FileExists() || failFile.IsFileWritable())) {
|
||||
wxCopyFile(loadFile.GetFullPath(wxPATH_NATIVE).ToStdString(), failFile.GetFullPath(wxPATH_NATIVE).ToStdString());
|
||||
@ -278,17 +277,17 @@ void BookmarkMgr::resetBookmarks() {
|
||||
|
||||
}
|
||||
|
||||
bool BookmarkMgr::hasLastLoad(std::string bookmarkFn) {
|
||||
bool BookmarkMgr::hasLastLoad(const std::string& bookmarkFn) {
|
||||
wxFileName lastLoaded(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".lastloaded");
|
||||
return lastLoaded.FileExists() && lastLoaded.IsFileReadable();
|
||||
}
|
||||
|
||||
bool BookmarkMgr::hasBackup(std::string bookmarkFn) {
|
||||
bool BookmarkMgr::hasBackup(const std::string& bookmarkFn) {
|
||||
wxFileName backupFile(wxGetApp().getConfig()->getConfigDir(), bookmarkFn + ".backup");
|
||||
return backupFile.FileExists() && backupFile.IsFileReadable();
|
||||
}
|
||||
|
||||
void BookmarkMgr::addBookmark(std::string group, DemodulatorInstancePtr demod) {
|
||||
void BookmarkMgr::addBookmark(const std::string& group, const DemodulatorInstancePtr& demod) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
//Create a BookmarkEntry from demod data, saving its
|
||||
@ -299,7 +298,7 @@ void BookmarkMgr::addBookmark(std::string group, DemodulatorInstancePtr demod) {
|
||||
bmDataSorted[group] = false;
|
||||
}
|
||||
|
||||
void BookmarkMgr::addBookmark(std::string group, BookmarkEntryPtr be) {
|
||||
void BookmarkMgr::addBookmark(const std::string& group, const BookmarkEntryPtr& be) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
bmData[group].push_back(be);
|
||||
@ -307,14 +306,14 @@ void BookmarkMgr::addBookmark(std::string group, BookmarkEntryPtr be) {
|
||||
}
|
||||
|
||||
|
||||
void BookmarkMgr::removeBookmark(std::string group, BookmarkEntryPtr be) {
|
||||
void BookmarkMgr::removeBookmark(const std::string& group, const BookmarkEntryPtr& be) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
if (bmData.find(group) == bmData.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BookmarkList::iterator i = std::find(bmData[group].begin(), bmData[group].end(), be);
|
||||
auto i = std::find(bmData[group].begin(), bmData[group].end(), be);
|
||||
|
||||
if (i != bmData[group].end()) {
|
||||
|
||||
@ -322,22 +321,22 @@ void BookmarkMgr::removeBookmark(std::string group, BookmarkEntryPtr be) {
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkMgr::removeBookmark(BookmarkEntryPtr be) {
|
||||
void BookmarkMgr::removeBookmark(const BookmarkEntryPtr& be) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
for (auto &bmd_i : bmData) {
|
||||
BookmarkList::iterator i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
|
||||
auto i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
|
||||
if (i != bmd_i.second.end()) {
|
||||
bmd_i.second.erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkMgr::moveBookmark(BookmarkEntryPtr be, std::string group) {
|
||||
void BookmarkMgr::moveBookmark(const BookmarkEntryPtr& be, const std::string& group) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
for (auto &bmd_i : bmData) {
|
||||
BookmarkList::iterator i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
|
||||
auto i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
|
||||
if (i != bmd_i.second.end()) {
|
||||
if (bmd_i.first == group) {
|
||||
return;
|
||||
@ -352,7 +351,7 @@ void BookmarkMgr::moveBookmark(BookmarkEntryPtr be, std::string group) {
|
||||
}
|
||||
|
||||
|
||||
void BookmarkMgr::addGroup(std::string group) {
|
||||
void BookmarkMgr::addGroup(const std::string& group) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
if (bmData.find(group) == bmData.end()) {
|
||||
@ -360,10 +359,10 @@ void BookmarkMgr::addGroup(std::string group) {
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkMgr::removeGroup(std::string group) {
|
||||
void BookmarkMgr::removeGroup(const std::string& group) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
BookmarkMap::iterator i = bmData.find(group);
|
||||
auto i = bmData.find(group);
|
||||
|
||||
if (i != bmData.end()) {
|
||||
|
||||
@ -371,18 +370,18 @@ void BookmarkMgr::removeGroup(std::string group) {
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkMgr::renameGroup(std::string group, std::string ngroup) {
|
||||
void BookmarkMgr::renameGroup(const std::string& group, const std::string& ngroup) {
|
||||
if (group == ngroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
BookmarkMap::iterator i = bmData.find(group);
|
||||
BookmarkMap::iterator it = bmData.find(ngroup);
|
||||
auto i = bmData.find(group);
|
||||
auto it = bmData.find(ngroup);
|
||||
|
||||
if (i != bmData.end() && it != bmData.end()) {
|
||||
for (auto ii : bmData[group]) {
|
||||
for (const auto& ii : bmData[group]) {
|
||||
bmData[ngroup].push_back(ii);
|
||||
}
|
||||
bmData.erase(group);
|
||||
@ -392,7 +391,7 @@ void BookmarkMgr::renameGroup(std::string group, std::string ngroup) {
|
||||
}
|
||||
}
|
||||
|
||||
BookmarkList BookmarkMgr::getBookmarks(std::string group) {
|
||||
BookmarkList BookmarkMgr::getBookmarks(const std::string& group) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
if (bmData.find(group) == bmData.end()) {
|
||||
@ -411,28 +410,28 @@ BookmarkList BookmarkMgr::getBookmarks(std::string group) {
|
||||
void BookmarkMgr::getGroups(BookmarkNames &arr) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
for (BookmarkMap::iterator i = bmData.begin(); i!= bmData.end(); ++i) {
|
||||
arr.push_back(i->first);
|
||||
for (auto & i : bmData) {
|
||||
arr.push_back(i.first);
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkMgr::getGroups(wxArrayString &arr) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
for (BookmarkMap::iterator i = bmData.begin(); i!= bmData.end(); ++i) {
|
||||
arr.push_back(i->first);
|
||||
for (auto & i : bmData) {
|
||||
arr.push_back(i.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BookmarkMgr::setExpandState(std::string groupName, bool state) {
|
||||
void BookmarkMgr::setExpandState(const std::string& groupName, bool state) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
expandState[groupName] = state;
|
||||
}
|
||||
|
||||
|
||||
bool BookmarkMgr::getExpandState(std::string groupName) {
|
||||
bool BookmarkMgr::getExpandState(const std::string& groupName) {
|
||||
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
@ -465,7 +464,7 @@ void BookmarkMgr::updateBookmarks() {
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkMgr::updateBookmarks(std::string group) {
|
||||
void BookmarkMgr::updateBookmarks(const std::string& group) {
|
||||
|
||||
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
|
||||
|
||||
@ -475,7 +474,7 @@ void BookmarkMgr::updateBookmarks(std::string group) {
|
||||
}
|
||||
|
||||
|
||||
void BookmarkMgr::addRecent(DemodulatorInstancePtr demod) {
|
||||
void BookmarkMgr::addRecent(const DemodulatorInstancePtr& demod) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
recents.push_back(demodToBookmarkEntry(demod));
|
||||
@ -483,7 +482,7 @@ void BookmarkMgr::addRecent(DemodulatorInstancePtr demod) {
|
||||
trimRecents();
|
||||
}
|
||||
|
||||
void BookmarkMgr::addRecent(BookmarkEntryPtr be) {
|
||||
void BookmarkMgr::addRecent(const BookmarkEntryPtr& be) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
recents.push_back(be);
|
||||
@ -493,10 +492,10 @@ void BookmarkMgr::addRecent(BookmarkEntryPtr be) {
|
||||
|
||||
|
||||
|
||||
void BookmarkMgr::removeRecent(BookmarkEntryPtr be) {
|
||||
void BookmarkMgr::removeRecent(const BookmarkEntryPtr& be) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
BookmarkList::iterator bm_i = std::find(recents.begin(),recents.end(), be);
|
||||
auto bm_i = std::find(recents.begin(),recents.end(), be);
|
||||
|
||||
if (bm_i != recents.end()) {
|
||||
recents.erase(bm_i);
|
||||
@ -526,17 +525,17 @@ void BookmarkMgr::trimRecents() {
|
||||
}
|
||||
|
||||
|
||||
void BookmarkMgr::addRange(BookmarkRangeEntryPtr re) {
|
||||
void BookmarkMgr::addRange(const BookmarkRangeEntryPtr& re) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
ranges.push_back(re);
|
||||
rangesSorted = false;
|
||||
}
|
||||
|
||||
void BookmarkMgr::removeRange(BookmarkRangeEntryPtr re) {
|
||||
void BookmarkMgr::removeRange(const BookmarkRangeEntryPtr& re) {
|
||||
std::lock_guard < std::recursive_mutex > lock(busy_lock);
|
||||
|
||||
BookmarkRangeList::iterator re_i = std::find(ranges.begin(), ranges.end(), re);
|
||||
auto re_i = std::find(ranges.begin(), ranges.end(), re);
|
||||
|
||||
if (re_i != ranges.end()) {
|
||||
|
||||
@ -564,7 +563,7 @@ void BookmarkMgr::clearRanges() {
|
||||
}
|
||||
|
||||
|
||||
BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(DemodulatorInstancePtr demod) {
|
||||
BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(const DemodulatorInstancePtr& demod) {
|
||||
|
||||
BookmarkEntryPtr be(new BookmarkEntry);
|
||||
|
||||
@ -583,7 +582,7 @@ BookmarkEntryPtr BookmarkMgr::demodToBookmarkEntry(DemodulatorInstancePtr demod)
|
||||
|
||||
std::wstring BookmarkMgr::getSafeWstringValue(DataNode* node, const std::string& childNodeName) {
|
||||
|
||||
std::wstring decodedWString = L"";
|
||||
std::wstring decodedWString;
|
||||
|
||||
if (node != nullptr) {
|
||||
|
||||
@ -593,7 +592,7 @@ std::wstring BookmarkMgr::getSafeWstringValue(DataNode* node, const std::string&
|
||||
try {
|
||||
childNode->element()->get(decodedWString);
|
||||
|
||||
} catch (DataTypeMismatchException e) {
|
||||
} catch (const DataTypeMismatchException &e) {
|
||||
//2) wstring decode fail, try simple std::string
|
||||
std::string decodedStdString;
|
||||
try {
|
||||
@ -603,7 +602,7 @@ std::wstring BookmarkMgr::getSafeWstringValue(DataNode* node, const std::string&
|
||||
//use wxString for a clean conversion to a wstring:
|
||||
decodedWString = wxString(decodedStdString).ToStdWstring();
|
||||
|
||||
} catch (DataTypeMismatchException e) {
|
||||
} catch (const DataTypeMismatchException &e) {
|
||||
//nothing works, return an empty string.
|
||||
decodedWString = L"";
|
||||
}
|
||||
@ -639,10 +638,10 @@ BookmarkEntryPtr BookmarkMgr::nodeToBookmark(DataNode *node) {
|
||||
}
|
||||
|
||||
|
||||
std::wstring BookmarkMgr::getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt) {
|
||||
std::wstring BookmarkMgr::getBookmarkEntryDisplayName(const BookmarkEntryPtr& bmEnt) {
|
||||
std::wstring dispName = bmEnt->label;
|
||||
|
||||
if (dispName == L"") {
|
||||
if (dispName.empty()) {
|
||||
std::string freqStr = frequencyToStr(bmEnt->frequency) + " " + bmEnt->type;
|
||||
|
||||
dispName = wxString(freqStr).ToStdWstring();
|
||||
@ -651,10 +650,10 @@ std::wstring BookmarkMgr::getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt) {
|
||||
return dispName;
|
||||
}
|
||||
|
||||
std::wstring BookmarkMgr::getActiveDisplayName(DemodulatorInstancePtr demod) {
|
||||
std::wstring BookmarkMgr::getActiveDisplayName(const DemodulatorInstancePtr& demod) {
|
||||
std::wstring activeName = demod->getDemodulatorUserLabel();
|
||||
|
||||
if (activeName == L"") {
|
||||
if (activeName.empty()) {
|
||||
std::string wstr = frequencyToStr(demod->getFrequency()) + " " + demod->getDemodulatorType();
|
||||
|
||||
activeName = wxString(wstr).ToStdWstring();
|
||||
@ -663,7 +662,7 @@ std::wstring BookmarkMgr::getActiveDisplayName(DemodulatorInstancePtr demod) {
|
||||
return activeName;
|
||||
}
|
||||
|
||||
void BookmarkMgr::removeActive(DemodulatorInstancePtr demod) {
|
||||
void BookmarkMgr::removeActive(const DemodulatorInstancePtr& demod) {
|
||||
|
||||
if (demod == nullptr) {
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
class BookmarkRangeEntry {
|
||||
public:
|
||||
BookmarkRangeEntry() : label(L""), freq(0), startFreq(0), endFreq(0) {
|
||||
BookmarkRangeEntry() : freq(0), startFreq(0), endFreq(0) {
|
||||
|
||||
}
|
||||
BookmarkRangeEntry(std::wstring label, long long freq, long long startFreq, long long endFreq) : label(label), freq(freq), startFreq(startFreq), endFreq(endFreq) {
|
||||
@ -60,57 +60,57 @@ public:
|
||||
BookmarkMgr();
|
||||
//if useFullpath = false, use the application config dir.
|
||||
//else assume bookmarkFn is a full path and use it for location.
|
||||
void saveToFile(std::string bookmarkFn, bool backup = true, bool useFullpath = false);
|
||||
bool loadFromFile(std::string bookmarkFn, bool backup = true, bool useFullpath = false);
|
||||
void saveToFile(const std::string& bookmarkFn, bool backup = true, bool useFullpath = false);
|
||||
bool loadFromFile(const std::string& bookmarkFn, bool backup = true, bool useFullpath = false);
|
||||
|
||||
void resetBookmarks();
|
||||
|
||||
bool hasLastLoad(std::string bookmarkFn);
|
||||
bool hasBackup(std::string bookmarkFn);
|
||||
bool hasLastLoad(const std::string& bookmarkFn);
|
||||
bool hasBackup(const std::string& bookmarkFn);
|
||||
|
||||
void addBookmark(std::string group, DemodulatorInstancePtr demod);
|
||||
void addBookmark(std::string group, BookmarkEntryPtr be);
|
||||
void removeBookmark(std::string group, BookmarkEntryPtr be);
|
||||
void removeBookmark(BookmarkEntryPtr be);
|
||||
void moveBookmark(BookmarkEntryPtr be, std::string group);
|
||||
void addBookmark(const std::string& group, const DemodulatorInstancePtr& demod);
|
||||
void addBookmark(const std::string& group, const BookmarkEntryPtr& be);
|
||||
void removeBookmark(const std::string& group, const BookmarkEntryPtr& be);
|
||||
void removeBookmark(const BookmarkEntryPtr& be);
|
||||
void moveBookmark(const BookmarkEntryPtr& be, const std::string& group);
|
||||
|
||||
void addGroup(std::string group);
|
||||
void removeGroup(std::string group);
|
||||
void renameGroup(std::string group, std::string ngroup);
|
||||
void addGroup(const std::string& group);
|
||||
void removeGroup(const std::string& group);
|
||||
void renameGroup(const std::string& group, const std::string& ngroup);
|
||||
//return an independent copy on purpose
|
||||
BookmarkList getBookmarks(std::string group);
|
||||
BookmarkList getBookmarks(const std::string& group);
|
||||
|
||||
void getGroups(BookmarkNames &arr);
|
||||
void getGroups(wxArrayString &arr);
|
||||
|
||||
void setExpandState(std::string groupName, bool state);
|
||||
bool getExpandState(std::string groupName);
|
||||
void setExpandState(const std::string& groupName, bool state);
|
||||
bool getExpandState(const std::string& groupName);
|
||||
|
||||
void updateActiveList();
|
||||
void updateBookmarks();
|
||||
void updateBookmarks(std::string group);
|
||||
void updateBookmarks(const std::string& group);
|
||||
|
||||
void addRecent(DemodulatorInstancePtr demod);
|
||||
void addRecent(BookmarkEntryPtr be);
|
||||
void removeRecent(BookmarkEntryPtr be);
|
||||
void addRecent(const DemodulatorInstancePtr& demod);
|
||||
void addRecent(const BookmarkEntryPtr& be);
|
||||
void removeRecent(const BookmarkEntryPtr& be);
|
||||
|
||||
//return an independent copy on purpose
|
||||
BookmarkList getRecents();
|
||||
|
||||
void clearRecents();
|
||||
|
||||
void removeActive(DemodulatorInstancePtr demod);
|
||||
void removeActive(const DemodulatorInstancePtr& demod);
|
||||
|
||||
void addRange(BookmarkRangeEntryPtr re);
|
||||
void removeRange(BookmarkRangeEntryPtr re);
|
||||
void addRange(const BookmarkRangeEntryPtr& re);
|
||||
void removeRange(const BookmarkRangeEntryPtr& re);
|
||||
|
||||
//return an independent copy on purpose
|
||||
BookmarkRangeList getRanges();
|
||||
|
||||
void clearRanges();
|
||||
|
||||
static std::wstring getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt);
|
||||
static std::wstring getActiveDisplayName(DemodulatorInstancePtr demod);
|
||||
static std::wstring getBookmarkEntryDisplayName(const BookmarkEntryPtr& bmEnt);
|
||||
static std::wstring getActiveDisplayName(const DemodulatorInstancePtr& demod);
|
||||
|
||||
|
||||
protected:
|
||||
@ -122,7 +122,7 @@ protected:
|
||||
//return an empty string.
|
||||
static std::wstring getSafeWstringValue(DataNode* node, const std::string& childNodeName);
|
||||
|
||||
BookmarkEntryPtr demodToBookmarkEntry(DemodulatorInstancePtr demod);
|
||||
BookmarkEntryPtr demodToBookmarkEntry(const DemodulatorInstancePtr& demod);
|
||||
BookmarkEntryPtr nodeToBookmark(DataNode *node);
|
||||
|
||||
BookmarkMap bmData;
|
||||
|
@ -81,7 +81,7 @@ std::string frequencyToStr(long long freq) {
|
||||
long double freqTemp;
|
||||
|
||||
freqTemp = freq;
|
||||
std::string suffix("");
|
||||
std::string suffix;
|
||||
std::stringstream freqStr;
|
||||
|
||||
if (freqTemp >= 1.0e9) {
|
||||
@ -133,7 +133,7 @@ long long strToFrequency(std::string freqStr) {
|
||||
} else if (suffixStr.find_first_of("Hh") != std::string::npos) {
|
||||
// ...
|
||||
}
|
||||
} else if (numPartStr.find_first_of(".") != std::string::npos || freqTemp <= 3000) {
|
||||
} else if (numPartStr.find_first_of('.') != std::string::npos || freqTemp <= 3000) {
|
||||
freqTemp *= 1.0e6;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ public:
|
||||
m_questionText->SetLabelText(wxT("All attempts to recover bookmarks have failed. \nWould you like to exit without touching any more save files?\nClick OK to exit without saving; or Cancel to continue anyways."));
|
||||
}
|
||||
|
||||
void doClickOK() {
|
||||
void doClickOK() override {
|
||||
wxGetApp().getAppFrame()->disableSave(true);
|
||||
wxGetApp().getAppFrame()->Close(false);
|
||||
}
|
||||
@ -162,7 +162,7 @@ public:
|
||||
m_questionText->SetLabelText(wxT("Sorry; unable to load your bookmarks backup file. \nWould you like to attempt to load the last succssfully loaded bookmarks file?"));
|
||||
}
|
||||
|
||||
void doClickOK() {
|
||||
void doClickOK() override {
|
||||
if (wxGetApp().getBookmarkMgr().hasLastLoad("bookmarks.xml")) {
|
||||
if (wxGetApp().getBookmarkMgr().loadFromFile("bookmarks.xml.lastloaded",false)) {
|
||||
wxGetApp().getBookmarkMgr().updateBookmarks();
|
||||
@ -181,7 +181,7 @@ public:
|
||||
m_questionText->SetLabelText(wxT("Sorry; unable to load your bookmarks file. \nWould you like to attempt to load the backup file?"));
|
||||
}
|
||||
|
||||
void doClickOK() {
|
||||
void doClickOK() override {
|
||||
bool loadOk = false;
|
||||
if (wxGetApp().getBookmarkMgr().hasBackup("bookmarks.xml")) {
|
||||
loadOk = wxGetApp().getBookmarkMgr().loadFromFile("bookmarks.xml.backup",false);
|
||||
@ -201,11 +201,11 @@ public:
|
||||
|
||||
class ActionDialogRigError : public ActionDialog {
|
||||
public:
|
||||
ActionDialogRigError(std::string message) : ActionDialog(wxGetApp().getAppFrame(), wxID_ANY, wxT("Rig Control Error")) {
|
||||
explicit ActionDialogRigError(const std::string& message) : ActionDialog(wxGetApp().getAppFrame(), wxID_ANY, wxT("Rig Control Error")) {
|
||||
m_questionText->SetLabelText(message);
|
||||
}
|
||||
|
||||
void doClickOK() {
|
||||
void doClickOK() override {
|
||||
}
|
||||
};
|
||||
|
||||
@ -238,12 +238,12 @@ void CubicSDR::initAudioDevices() const {
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (auto devices_i = devices.begin(); devices_i != devices.end(); devices_i++) {
|
||||
if (devices_i->inputChannels) {
|
||||
inputDevices[i] = *devices_i;
|
||||
for (auto & device : devices) {
|
||||
if (device.inputChannels) {
|
||||
inputDevices[i] = device;
|
||||
}
|
||||
if (devices_i->outputChannels) {
|
||||
outputDevices[i] = *devices_i;
|
||||
if (device.outputChannels) {
|
||||
outputDevices[i] = device;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -541,7 +541,7 @@ int CubicSDR::OnExit() {
|
||||
PrimaryGLContext& CubicSDR::GetContext(wxGLCanvas *canvas) {
|
||||
PrimaryGLContext *glContext;
|
||||
if (!m_glContext) {
|
||||
m_glContext = new PrimaryGLContext(canvas, NULL, GetContextAttributes());
|
||||
m_glContext = new PrimaryGLContext(canvas, nullptr, GetContextAttributes());
|
||||
}
|
||||
glContext = m_glContext;
|
||||
|
||||
@ -559,9 +559,9 @@ void CubicSDR::OnInitCmdLine(wxCmdLineParser& parser) {
|
||||
}
|
||||
|
||||
bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) {
|
||||
wxString *confName = new wxString;
|
||||
auto *confName = new wxString;
|
||||
if (parser.Found("c",confName)) {
|
||||
if (confName) {
|
||||
if (!confName->empty()) {
|
||||
config.setConfigName(confName->ToStdString());
|
||||
}
|
||||
}
|
||||
@ -576,10 +576,10 @@ bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) {
|
||||
useLocalMod.store(true);
|
||||
#endif
|
||||
|
||||
wxString *modPath = new wxString;
|
||||
auto *modPath = new wxString;
|
||||
|
||||
if (parser.Found("m",modPath)) {
|
||||
if (modPath) {
|
||||
if (!modPath->empty()) {
|
||||
modulePath = modPath->ToStdString();
|
||||
} else {
|
||||
modulePath = "";
|
||||
@ -611,17 +611,17 @@ void CubicSDR::deviceSelector() {
|
||||
deviceSelectorDialog->Show();
|
||||
}
|
||||
|
||||
void CubicSDR::addRemote(std::string remoteAddr) {
|
||||
void CubicSDR::addRemote(const std::string& remoteAddr) {
|
||||
SDREnumerator::addRemote(remoteAddr);
|
||||
devicesReady.store(false);
|
||||
t_SDREnum = new std::thread(&SDREnumerator::threadMain, sdrEnum);
|
||||
}
|
||||
|
||||
void CubicSDR::removeRemote(std::string remoteAddr) {
|
||||
void CubicSDR::removeRemote(const std::string& remoteAddr) {
|
||||
SDREnumerator::removeRemote(remoteAddr);
|
||||
}
|
||||
|
||||
void CubicSDR::sdrThreadNotify(SDRThread::SDRThreadState state, std::string message) {
|
||||
void CubicSDR::sdrThreadNotify(SDRThread::SDRThreadState state, const std::string& message) {
|
||||
|
||||
std::lock_guard < std::mutex > lock(notify_busy);
|
||||
|
||||
@ -912,7 +912,7 @@ long long CubicSDR::getSampleRate() {
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
void CubicSDR::removeDemodulator(DemodulatorInstancePtr demod) {
|
||||
void CubicSDR::removeDemodulator(const DemodulatorInstancePtr& demod) {
|
||||
if (!demod) {
|
||||
return;
|
||||
}
|
||||
@ -949,7 +949,7 @@ int CubicSDR::getPPM() {
|
||||
return ppm;
|
||||
}
|
||||
|
||||
void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode, wxString initString) {
|
||||
void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode, const wxString& initString) {
|
||||
const wxString demodTitle("Set Demodulator Frequency");
|
||||
const wxString freqTitle("Set Center Frequency");
|
||||
const wxString bwTitle("Modem Bandwidth (150Hz - 500KHz)");
|
||||
@ -976,7 +976,7 @@ void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetM
|
||||
break;
|
||||
case FrequencyDialog::FDIALOG_TARGET_GAIN:
|
||||
title = gainTitle;
|
||||
if (wxGetApp().getActiveGainEntry() == "") {
|
||||
if (wxGetApp().getActiveGainEntry().empty()) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -1005,11 +1005,11 @@ AppFrame *CubicSDR::getAppFrame() {
|
||||
return appframe;
|
||||
}
|
||||
|
||||
void CubicSDR::setFrequencySnap(int snap) {
|
||||
if (snap > 1000000) {
|
||||
snap = 1000000;
|
||||
void CubicSDR::setFrequencySnap(int snap_in) {
|
||||
if (snap_in > 1000000) {
|
||||
snap_in = 1000000;
|
||||
}
|
||||
this->snap = snap;
|
||||
this->snap = snap_in;
|
||||
}
|
||||
|
||||
int CubicSDR::getFrequencySnap() {
|
||||
@ -1065,11 +1065,11 @@ bool CubicSDR::getAGCMode() {
|
||||
}
|
||||
|
||||
|
||||
void CubicSDR::setGain(std::string name, float gain_in) {
|
||||
void CubicSDR::setGain(const std::string& name, float gain_in) {
|
||||
sdrThread->setGain(name,gain_in);
|
||||
}
|
||||
|
||||
float CubicSDR::getGain(std::string name) {
|
||||
float CubicSDR::getGain(const std::string& name) {
|
||||
return sdrThread->getGain(name);
|
||||
}
|
||||
|
||||
|
@ -75,14 +75,14 @@ public:
|
||||
PrimaryGLContext &GetContext(wxGLCanvas *canvas);
|
||||
wxGLContextAttrs* GetContextAttributes();
|
||||
|
||||
virtual bool OnInit();
|
||||
virtual int OnExit();
|
||||
bool OnInit() override;
|
||||
int OnExit() override;
|
||||
|
||||
virtual void OnInitCmdLine(wxCmdLineParser& parser);
|
||||
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
|
||||
void OnInitCmdLine(wxCmdLineParser& parser) override;
|
||||
bool OnCmdLineParsed(wxCmdLineParser& parser) override;
|
||||
|
||||
void deviceSelector();
|
||||
void sdrThreadNotify(SDRThread::SDRThreadState state, std::string message);
|
||||
void sdrThreadNotify(SDRThread::SDRThreadState state, const std::string& message);
|
||||
void sdrEnumThreadNotify(SDREnumerator::SDREnumState state, std::string message);
|
||||
|
||||
void setFrequency(long long freq);
|
||||
@ -128,9 +128,9 @@ public:
|
||||
|
||||
void notifyDemodulatorsChanged();
|
||||
|
||||
void removeDemodulator(DemodulatorInstancePtr demod);
|
||||
void removeDemodulator(const DemodulatorInstancePtr& demod);
|
||||
|
||||
void setFrequencySnap(int snap);
|
||||
void setFrequencySnap(int snap_in);
|
||||
int getFrequencySnap();
|
||||
|
||||
AppConfig *getConfig();
|
||||
@ -139,7 +139,7 @@ public:
|
||||
void setPPM(int ppm_in);
|
||||
int getPPM();
|
||||
|
||||
void showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode = FrequencyDialog::FDIALOG_TARGET_DEFAULT, wxString initString = "");
|
||||
void showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetMode = FrequencyDialog::FDIALOG_TARGET_DEFAULT, const wxString& initString = "");
|
||||
void showLabelInput();
|
||||
AppFrame *getAppFrame();
|
||||
|
||||
@ -150,8 +150,8 @@ public:
|
||||
|
||||
void notifyMainUIOfDeviceChange(bool forceRefreshOfGains = false);
|
||||
|
||||
void addRemote(std::string remoteAddr);
|
||||
void removeRemote(std::string remoteAddr);
|
||||
void addRemote(const std::string& remoteAddr);
|
||||
void removeRemote(const std::string& remoteAddr);
|
||||
|
||||
void setDeviceSelectorClosed();
|
||||
void reEnumerateDevices();
|
||||
@ -161,8 +161,8 @@ public:
|
||||
void setAGCMode(bool mode);
|
||||
bool getAGCMode();
|
||||
|
||||
void setGain(std::string name, float gain_in);
|
||||
float getGain(std::string name);
|
||||
void setGain(const std::string& name, float gain_in);
|
||||
float getGain(const std::string& name);
|
||||
|
||||
void setStreamArgs(SoapySDR::Kwargs streamArgs_in);
|
||||
void setDeviceArgs(SoapySDR::Kwargs settingArgs_in);
|
||||
@ -186,7 +186,7 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
int FilterEvent(wxEvent& event);
|
||||
int FilterEvent(wxEvent& event) override;
|
||||
|
||||
AppFrame *appframe = nullptr;
|
||||
AppConfig config;
|
||||
|
@ -19,7 +19,7 @@ DemodLabelDialog::DemodLabelDialog(wxWindow * parent, wxWindowID id, const wxStr
|
||||
|
||||
wxString labelStr;
|
||||
|
||||
//by construction, is allways != nullptr
|
||||
//by construction, is always != nullptr
|
||||
activeDemod = demod;
|
||||
|
||||
labelStr = activeDemod->getDemodulatorUserLabel();
|
||||
@ -39,7 +39,7 @@ DemodLabelDialog::DemodLabelDialog(wxWindow * parent, wxWindowID id, const wxStr
|
||||
int titleX = this->GetTextExtent(title).GetWidth();
|
||||
dialogText->SetMinSize(wxSize(max(int(2.0 * titleX), int(2.0 * textCtrlX)), -1));
|
||||
|
||||
wxBoxSizer* dialogsizer = new wxBoxSizer(wxALL);
|
||||
auto* dialogsizer = new wxBoxSizer(wxALL);
|
||||
dialogsizer->Add(dialogText, wxSizerFlags(1).Expand().Border(wxALL, 5));
|
||||
SetSizerAndFit(dialogsizer);
|
||||
Centre();
|
||||
|
@ -25,7 +25,6 @@ public:
|
||||
|
||||
private:
|
||||
DemodulatorInstancePtr activeDemod = nullptr;
|
||||
void OnEnter ( wxCommandEvent &event );
|
||||
void OnChar ( wxKeyEvent &event );
|
||||
void OnShow(wxShowEvent &event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
@ -13,8 +13,8 @@ EVT_CHAR_HOOK(FrequencyDialog::OnChar)
|
||||
EVT_SHOW(FrequencyDialog::OnShow)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstancePtr demod, const wxPoint & position,
|
||||
const wxSize & size, long style, FrequencyDialogTarget targetMode, wxString initString) :
|
||||
FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxString & title, DemodulatorInstancePtr demod, const wxPoint & /*position*/,
|
||||
const wxSize & /*size*/, long style, FrequencyDialogTarget targetMode, wxString initString) :
|
||||
wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, style) {
|
||||
wxString freqStr;
|
||||
|
||||
@ -49,7 +49,7 @@ FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxStrin
|
||||
}
|
||||
|
||||
if (targetMode == FDIALOG_TARGET_GAIN) {
|
||||
if (wxGetApp().getActiveGainEntry() != "") {
|
||||
if (!wxGetApp().getActiveGainEntry().empty()) {
|
||||
freqStr = std::to_string((int)wxGetApp().getGain(wxGetApp().getActiveGainEntry()));
|
||||
}
|
||||
}
|
||||
@ -63,17 +63,17 @@ FrequencyDialog::FrequencyDialog(wxWindow * parent, wxWindowID id, const wxStrin
|
||||
int titleX = this->GetTextExtent(title).GetWidth();
|
||||
dialogText->SetMinSize(wxSize(max(int(2.0 * titleX), int(2.0 * std::max(textCtrlX, initTextCtrlX))), -1));
|
||||
|
||||
wxBoxSizer* dialogsizer = new wxBoxSizer(wxALL);
|
||||
auto* dialogsizer = new wxBoxSizer(wxALL);
|
||||
dialogsizer->Add(dialogText, wxSizerFlags(1).Expand().Border(wxALL, 5));
|
||||
SetSizerAndFit(dialogsizer);
|
||||
Centre();
|
||||
|
||||
if (initString != "" && initString.length() == 1) {
|
||||
if (!initString.empty() && initString.length() == 1) {
|
||||
dialogText->SetValue(initString);
|
||||
dialogText->SetSelection(2, 2);
|
||||
dialogText->SetFocus();
|
||||
} else {
|
||||
if (initString != "") {
|
||||
if (!initString.empty()) {
|
||||
dialogText->SetValue(initString);
|
||||
}
|
||||
dialogText->SetSelection(-1, -1);
|
||||
@ -87,7 +87,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
|
||||
double dblval;
|
||||
std::string lastDemodType = activeDemod?activeDemod->getDemodulatorType():wxGetApp().getDemodMgr().getLastDemodulatorType();
|
||||
std::string strValue = dialogText->GetValue().ToStdString();
|
||||
bool ranged = false;
|
||||
bool ranged;
|
||||
std::string strValue2;
|
||||
size_t range_pos;
|
||||
|
||||
@ -170,7 +170,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
|
||||
if (targetMode == FDIALOG_TARGET_WATERFALL_LPS) {
|
||||
try {
|
||||
freq = std::stoi(strValue);
|
||||
} catch (exception e) {
|
||||
} catch (const exception &e) {
|
||||
Close();
|
||||
break;
|
||||
}
|
||||
@ -185,7 +185,7 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
|
||||
if (targetMode == FDIALOG_TARGET_SPECTRUM_AVG) {
|
||||
try {
|
||||
dblval = std::stod(strValue);
|
||||
} catch (exception e) {
|
||||
} catch (const exception &e) {
|
||||
Close();
|
||||
break;
|
||||
}
|
||||
@ -201,12 +201,12 @@ void FrequencyDialog::OnChar(wxKeyEvent& event) {
|
||||
if (targetMode == FDIALOG_TARGET_GAIN) {
|
||||
try {
|
||||
freq = std::stoi(strValue);
|
||||
} catch (exception e) {
|
||||
} catch (const exception &e) {
|
||||
break;
|
||||
}
|
||||
SDRDeviceInfo *devInfo = wxGetApp().getDevice();
|
||||
std::string gainName = wxGetApp().getActiveGainEntry();
|
||||
if (gainName == "") {
|
||||
if (gainName.empty()) {
|
||||
break;
|
||||
}
|
||||
SDRRangeMap gains = devInfo->getGains(SOAPY_SDR_RX, 0);
|
||||
|
@ -35,7 +35,6 @@ public:
|
||||
|
||||
private:
|
||||
DemodulatorInstancePtr activeDemod;
|
||||
void OnEnter ( wxCommandEvent &event );
|
||||
void OnChar ( wxKeyEvent &event );
|
||||
void OnShow(wxShowEvent &event);
|
||||
FrequencyDialogTarget targetMode;
|
||||
|
@ -2,7 +2,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
#include "IOThread.h"
|
||||
#include <typeinfo>
|
||||
#include <memory>
|
||||
|
||||
#define SPIN_WAIT_SLEEP_MS 5
|
||||
@ -53,51 +52,51 @@ void IOThread::threadMain() {
|
||||
|
||||
terminated.store(true);
|
||||
stopping.store(true);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
void IOThread::setup() {
|
||||
//redefined in subclasses
|
||||
};
|
||||
}
|
||||
|
||||
void IOThread::run() {
|
||||
//redefined in subclasses
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void IOThread::terminate() {
|
||||
stopping.store(true);
|
||||
};
|
||||
}
|
||||
|
||||
void IOThread::onBindOutput(std::string /* name */, ThreadQueueBasePtr /* threadQueue */) {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
void IOThread::onBindInput(std::string /* name */, ThreadQueueBasePtr /* threadQueue */) {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
void IOThread::setInputQueue(std::string qname, ThreadQueueBasePtr threadQueue) {
|
||||
void IOThread::setInputQueue(const std::string& qname, const ThreadQueueBasePtr& threadQueue) {
|
||||
std::lock_guard < std::mutex > lock(m_queue_bindings_mutex);
|
||||
input_queues[qname] = threadQueue;
|
||||
this->onBindInput(qname, threadQueue);
|
||||
};
|
||||
}
|
||||
|
||||
ThreadQueueBasePtr IOThread::getInputQueue(std::string qname) {
|
||||
ThreadQueueBasePtr IOThread::getInputQueue(const std::string& qname) {
|
||||
std::lock_guard < std::mutex > lock(m_queue_bindings_mutex);
|
||||
return input_queues[qname];
|
||||
};
|
||||
}
|
||||
|
||||
void IOThread::setOutputQueue(std::string qname, ThreadQueueBasePtr threadQueue) {
|
||||
void IOThread::setOutputQueue(const std::string& qname, const ThreadQueueBasePtr& threadQueue) {
|
||||
std::lock_guard < std::mutex > lock(m_queue_bindings_mutex);
|
||||
output_queues[qname] = threadQueue;
|
||||
this->onBindOutput(qname, threadQueue);
|
||||
};
|
||||
}
|
||||
|
||||
ThreadQueueBasePtr IOThread::getOutputQueue(std::string qname) {
|
||||
ThreadQueueBasePtr IOThread::getOutputQueue(const std::string& qname) {
|
||||
std::lock_guard < std::mutex > lock(m_queue_bindings_mutex);
|
||||
return output_queues[qname];
|
||||
};
|
||||
}
|
||||
|
||||
bool IOThread::isTerminated(int waitMs) {
|
||||
|
||||
@ -109,13 +108,12 @@ bool IOThread::isTerminated(int waitMs) {
|
||||
}
|
||||
|
||||
//this is a stupid busy plus sleep loop
|
||||
int nbCyclesToWait = 0;
|
||||
int nbCyclesToWait;
|
||||
|
||||
if (waitMs < 0) {
|
||||
nbCyclesToWait = std::numeric_limits<int>::max();
|
||||
}
|
||||
else {
|
||||
|
||||
nbCyclesToWait = (waitMs / SPIN_WAIT_SLEEP_MS) + 1;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
PtrType ptr;
|
||||
int age;
|
||||
|
||||
virtual ~ReBufferAge() {};
|
||||
virtual ~ReBufferAge() = default;;
|
||||
};
|
||||
|
||||
#define REBUFFER_GC_LIMIT 100
|
||||
@ -51,12 +51,10 @@ class ReBuffer {
|
||||
public:
|
||||
|
||||
//Virtual destructor to assure correct freeing of all descendants.
|
||||
virtual ~ReBuffer() {
|
||||
//nothing
|
||||
}
|
||||
virtual ~ReBuffer() = default;
|
||||
|
||||
//constructor
|
||||
ReBuffer(std::string bufferId) : bufferId(bufferId) {
|
||||
explicit ReBuffer(std::string bufferId) : bufferId(bufferId) {
|
||||
//nothing
|
||||
}
|
||||
|
||||
@ -187,10 +185,10 @@ public:
|
||||
virtual void onBindOutput(std::string name, ThreadQueueBasePtr threadQueue);
|
||||
virtual void onBindInput(std::string name, ThreadQueueBasePtr threadQueue);
|
||||
|
||||
void setInputQueue(std::string qname, ThreadQueueBasePtr threadQueue);
|
||||
ThreadQueueBasePtr getInputQueue(std::string qname);
|
||||
void setOutputQueue(std::string qname, ThreadQueueBasePtr threadQueue);
|
||||
ThreadQueueBasePtr getOutputQueue(std::string qname);
|
||||
void setInputQueue(const std::string& qname, const ThreadQueueBasePtr& threadQueue);
|
||||
ThreadQueueBasePtr getInputQueue(const std::string& qname);
|
||||
void setOutputQueue(const std::string& qname, const ThreadQueueBasePtr& threadQueue);
|
||||
ThreadQueueBasePtr getOutputQueue(const std::string& qname);
|
||||
|
||||
protected:
|
||||
std::map<std::string, ThreadQueueBasePtr, map_string_less> input_queues;
|
||||
|
@ -15,13 +15,13 @@ ModemProperties::ModemProperties(wxWindow *parent, wxWindowID winid,
|
||||
|
||||
this->SetSizer(bSizer);
|
||||
|
||||
m_propertyGrid->Connect( wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEventHandler( ModemProperties::OnCollapse ), NULL, this );
|
||||
m_propertyGrid->Connect( wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEventHandler( ModemProperties::OnExpand ), NULL, this );
|
||||
m_propertyGrid->Connect( wxEVT_PG_CHANGED, wxPropertyGridEventHandler( ModemProperties::OnChange ), NULL, this );
|
||||
this->Connect( wxEVT_SHOW, wxShowEventHandler( ModemProperties::OnShow ), NULL, this );
|
||||
m_propertyGrid->Connect( wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEventHandler( ModemProperties::OnCollapse ), nullptr, this );
|
||||
m_propertyGrid->Connect( wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEventHandler( ModemProperties::OnExpand ), nullptr, this );
|
||||
m_propertyGrid->Connect( wxEVT_PG_CHANGED, wxPropertyGridEventHandler( ModemProperties::OnChange ), nullptr, this );
|
||||
this->Connect( wxEVT_SHOW, wxShowEventHandler( ModemProperties::OnShow ), nullptr, this );
|
||||
|
||||
this->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( ModemProperties::OnMouseEnter ), NULL, this);
|
||||
this->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( ModemProperties::OnMouseLeave ), NULL, this);
|
||||
this->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( ModemProperties::OnMouseEnter ), nullptr, this);
|
||||
this->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( ModemProperties::OnMouseLeave ), nullptr, this);
|
||||
|
||||
updateTheme();
|
||||
|
||||
@ -48,14 +48,12 @@ void ModemProperties::updateTheme() {
|
||||
m_propertyGrid->SetLineColour(btn);
|
||||
}
|
||||
|
||||
ModemProperties::~ModemProperties() {
|
||||
|
||||
}
|
||||
ModemProperties::~ModemProperties() = default;
|
||||
|
||||
|
||||
void ModemProperties::initDefaultProperties() {
|
||||
|
||||
if (!audioOutputDevices.size()) {
|
||||
if (audioOutputDevices.empty()) {
|
||||
std::vector<string> outputOpts;
|
||||
std::vector<string> outputOptNames;
|
||||
|
||||
@ -63,7 +61,7 @@ void ModemProperties::initDefaultProperties() {
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (auto aDev : audioDevices) {
|
||||
for (const auto& aDev : audioDevices) {
|
||||
if (aDev.inputChannels) {
|
||||
audioInputDevices[i] = aDev;
|
||||
}
|
||||
@ -76,7 +74,7 @@ void ModemProperties::initDefaultProperties() {
|
||||
// int defaultDevice = 0;
|
||||
// int dc = 0;
|
||||
|
||||
for (auto mdevices_i : audioOutputDevices) {
|
||||
for (const auto& mdevices_i : audioOutputDevices) {
|
||||
outputOpts.push_back(std::to_string(mdevices_i.first));
|
||||
outputOptNames.push_back(mdevices_i.second.name);
|
||||
|
||||
@ -101,7 +99,7 @@ void ModemProperties::initDefaultProperties() {
|
||||
defaultProps["._audio_output"] = addArgInfoProperty(m_propertyGrid, outputArg);
|
||||
}
|
||||
|
||||
void ModemProperties::initProperties(ModemArgInfoList newArgs, DemodulatorInstancePtr demodInstance) {
|
||||
void ModemProperties::initProperties(ModemArgInfoList newArgs, const DemodulatorInstancePtr& demodInstance) {
|
||||
args = newArgs;
|
||||
demodContext = demodInstance;
|
||||
|
||||
@ -142,7 +140,7 @@ wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgIn
|
||||
case ModemArgInfo::INT:
|
||||
try {
|
||||
intVal = std::stoi(arg.value);
|
||||
} catch (std::invalid_argument e) {
|
||||
} catch (const std::invalid_argument &e) {
|
||||
intVal = 0;
|
||||
}
|
||||
prop = pg->Append( new wxIntProperty(arg.name, wxPG_LABEL, intVal) );
|
||||
@ -154,7 +152,7 @@ wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgIn
|
||||
case ModemArgInfo::FLOAT:
|
||||
try {
|
||||
floatVal = std::stod(arg.value);
|
||||
} catch (std::invalid_argument e) {
|
||||
} catch (const std::invalid_argument &e) {
|
||||
floatVal = 0;
|
||||
}
|
||||
prop = pg->Append( new wxFloatProperty(arg.name, wxPG_LABEL, floatVal) );
|
||||
@ -167,13 +165,13 @@ wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgIn
|
||||
prop = pg->Append( new wxBoolProperty(arg.name, wxPG_LABEL, (arg.value=="true")) );
|
||||
break;
|
||||
case ModemArgInfo::STRING:
|
||||
if (arg.options.size()) {
|
||||
if (!arg.options.empty()) {
|
||||
intVal = 0;
|
||||
prop = pg->Append( new wxEnumProperty(arg.name, wxPG_LABEL) );
|
||||
for (stringIter = arg.options.begin(); stringIter != arg.options.end(); stringIter++) {
|
||||
std::string optName = (*stringIter);
|
||||
std::string displayName = optName;
|
||||
if (arg.optionNames.size()) {
|
||||
if (!arg.optionNames.empty()) {
|
||||
displayName = arg.optionNames[intVal];
|
||||
}
|
||||
|
||||
@ -196,14 +194,14 @@ wxPGProperty *ModemProperties::addArgInfoProperty(wxPropertyGrid *pg, ModemArgIn
|
||||
break;
|
||||
}
|
||||
|
||||
if (prop != NULL) {
|
||||
if (prop != nullptr) {
|
||||
prop->SetHelpString(arg.name + ": " + arg.description);
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
std::string ModemProperties::readProperty(std::string key) {
|
||||
std::string ModemProperties::readProperty(const std::string& key) {
|
||||
int i = 0;
|
||||
ModemArgInfoList::const_iterator args_i;
|
||||
|
||||
@ -212,8 +210,8 @@ std::string ModemProperties::readProperty(std::string key) {
|
||||
if (arg.key == key) {
|
||||
wxPGProperty *prop = props[key];
|
||||
|
||||
std::string result = "";
|
||||
if (arg.type == ModemArgInfo::STRING && arg.options.size()) {
|
||||
std::string result;
|
||||
if (arg.type == ModemArgInfo::STRING && !arg.options.empty()) {
|
||||
return arg.options[prop->GetChoiceSelection()];
|
||||
} else if (arg.type == ModemArgInfo::BOOL) {
|
||||
return (prop->GetValueAsString()=="True")?"true":"false";
|
||||
@ -241,7 +239,7 @@ void ModemProperties::OnChange(wxPropertyGridEvent &event) {
|
||||
if (demodContext) {
|
||||
try {
|
||||
demodContext->setOutputDevice(std::stoi(outputArg.value));
|
||||
} catch (exception e) {
|
||||
} catch (const exception &e) {
|
||||
// .. this should never happen ;)
|
||||
}
|
||||
|
||||
@ -292,7 +290,7 @@ void ModemProperties::setCollapsed(bool state) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ModemProperties::isCollapsed() {
|
||||
bool ModemProperties::isCollapsed() const {
|
||||
return collapsed;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
class ModemProperties : public wxPanel {
|
||||
public:
|
||||
ModemProperties(
|
||||
explicit ModemProperties(
|
||||
wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
@ -21,20 +21,20 @@ public:
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = wxPanelNameStr
|
||||
);
|
||||
~ModemProperties();
|
||||
~ModemProperties() override;
|
||||
|
||||
void initDefaultProperties();
|
||||
void initProperties(ModemArgInfoList newArgs, DemodulatorInstancePtr demodInstance);
|
||||
void initProperties(ModemArgInfoList newArgs, const DemodulatorInstancePtr& demodInstance);
|
||||
bool isMouseInView();
|
||||
void setCollapsed(bool state);
|
||||
bool isCollapsed();
|
||||
bool isCollapsed() const;
|
||||
void fitColumns();
|
||||
|
||||
void updateTheme();
|
||||
|
||||
private:
|
||||
wxPGProperty *addArgInfoProperty(wxPropertyGrid *pg, ModemArgInfo arg);
|
||||
std::string readProperty(std::string);
|
||||
std::string readProperty(const std::string&);
|
||||
void OnChange(wxPropertyGridEvent &event);
|
||||
void OnShow(wxShowEvent &event);
|
||||
void OnCollapse(wxPropertyGridEvent &event);
|
||||
|
@ -45,7 +45,7 @@ void SessionMgr::saveSession(std::string fileName) {
|
||||
s.SaveToFileXML(fileName);
|
||||
}
|
||||
|
||||
bool SessionMgr::loadSession(std::string fileName) {
|
||||
bool SessionMgr::loadSession(const std::string& fileName) {
|
||||
|
||||
DataTree l;
|
||||
if (!l.LoadFromFileXML(fileName)) {
|
||||
@ -88,7 +88,7 @@ bool SessionMgr::loadSession(std::string fileName) {
|
||||
|
||||
if (header->hasAnother("sample_rate")) {
|
||||
|
||||
long sample_rate = *header->getNext("sample_rate");
|
||||
long sample_rate = (long)*header->getNext("sample_rate");
|
||||
|
||||
SDRDeviceInfo *dev = wxGetApp().getSDRThread()->getDevice();
|
||||
if (dev) {
|
||||
@ -120,7 +120,7 @@ bool SessionMgr::loadSession(std::string fileName) {
|
||||
|
||||
if (header->hasAnother("solo_mode")) {
|
||||
|
||||
int solo_mode_activated = *header->getNext("solo_mode");
|
||||
int solo_mode_activated = (int)*header->getNext("solo_mode");
|
||||
|
||||
wxGetApp().setSoloMode(solo_mode_activated > 0);
|
||||
}
|
||||
@ -162,7 +162,7 @@ bool SessionMgr::loadSession(std::string fileName) {
|
||||
} // if l.rootNode()->hasAnother("demodulators")
|
||||
|
||||
if (header->hasAnother("center_freq")) {
|
||||
long long center_freq = *header->getNext("center_freq");
|
||||
long long center_freq = (long long)*header->getNext("center_freq");
|
||||
wxGetApp().setFrequency(center_freq);
|
||||
// std::cout << "\tCenter Frequency: " << center_freq << std::endl;
|
||||
}
|
||||
@ -171,8 +171,8 @@ bool SessionMgr::loadSession(std::string fileName) {
|
||||
DataNode *viewState = header->getNext("view_state");
|
||||
|
||||
if (viewState->hasAnother("center_freq") && viewState->hasAnother("bandwidth")) {
|
||||
long long center_freq = *viewState->getNext("center_freq");
|
||||
int bandwidth = *viewState->getNext("bandwidth");
|
||||
auto center_freq = (long long)*viewState->getNext("center_freq");
|
||||
auto bandwidth = (int)*viewState->getNext("bandwidth");
|
||||
spectrumCanvas->setView(center_freq, bandwidth);
|
||||
waterfallCanvas->setView(center_freq, bandwidth);
|
||||
}
|
||||
|
@ -10,5 +10,5 @@
|
||||
class SessionMgr {
|
||||
public:
|
||||
void saveSession(std::string fileName);
|
||||
bool loadSession(std::string fileName);
|
||||
bool loadSession(const std::string& fileName);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user