Fixed needless config saves

This commit is contained in:
AlexandreRouma 2023-01-13 22:43:42 +01:00
parent a53dc1a6ae
commit bad8ecba49
2 changed files with 15 additions and 10 deletions

View File

@ -548,16 +548,20 @@ void MainWindow::draw() {
if (!lockWaterfallControls) {
// Handle arrow keys
if (vfo != NULL && (gui::waterfall.mouseInFFT || gui::waterfall.mouseInWaterfall)) {
bool freqChanged = false;
if (ImGui::IsKeyPressed(ImGuiKey_LeftArrow) && !gui::freqSelect.digitHovered) {
double nfreq = gui::waterfall.getCenterFrequency() + vfo->generalOffset - vfo->snapInterval;
nfreq = roundl(nfreq / vfo->snapInterval) * vfo->snapInterval;
tuner::tune(tuningMode, gui::waterfall.selectedVFO, nfreq);
freqChanged = true;
}
if (ImGui::IsKeyPressed(ImGuiKey_RightArrow) && !gui::freqSelect.digitHovered) {
double nfreq = gui::waterfall.getCenterFrequency() + vfo->generalOffset + vfo->snapInterval;
nfreq = roundl(nfreq / vfo->snapInterval) * vfo->snapInterval;
tuner::tune(tuningMode, gui::waterfall.selectedVFO, nfreq);
freqChanged = true;
}
if (freqChanged) {
core::configManager.acquire();
core::configManager.conf["frequency"] = gui::waterfall.getCenterFrequency();
if (vfo != NULL) {
@ -565,6 +569,7 @@ void MainWindow::draw() {
}
core::configManager.release(true);
}
}
// Handle scrollwheel
int wheel = ImGui::GetIO().MouseWheel;

View File

@ -145,13 +145,13 @@ private:
std::lock_guard lck(_this->vfoMtx);
if (ImGui::Combo(CONCAT("##_rigctl_srv_rec_", _this->name), &_this->recorderId, _this->recorderNamesTxt.c_str())) {
_this->selectRecorderByName(_this->recorderNames[_this->recorderId], false);
}
if (!_this->selectedRecorder.empty()) {
config.acquire();
config.conf[_this->name]["recorder"] = _this->selectedRecorder;
config.release(true);
}
}
}
ImGui::BeginTable(CONCAT("Stop##_rigctl_srv_tbl_", _this->name), 2);
ImGui::TableNextRow();