Fixed needless config saves

pull/973/head
AlexandreRouma 2023-01-13 22:43:42 +01:00
rodzic a53dc1a6ae
commit bad8ecba49
2 zmienionych plików z 15 dodań i 10 usunięć

Wyświetl plik

@ -548,22 +548,27 @@ 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;
}
core::configManager.acquire();
core::configManager.conf["frequency"] = gui::waterfall.getCenterFrequency();
if (vfo != NULL) {
core::configManager.conf["vfoOffsets"][gui::waterfall.selectedVFO] = vfo->generalOffset;
if (freqChanged) {
core::configManager.acquire();
core::configManager.conf["frequency"] = gui::waterfall.getCenterFrequency();
if (vfo != NULL) {
core::configManager.conf["vfoOffsets"][gui::waterfall.selectedVFO] = vfo->generalOffset;
}
core::configManager.release(true);
}
core::configManager.release(true);
}
// Handle scrollwheel

Wyświetl plik

@ -145,11 +145,11 @@ 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);
if (!_this->selectedRecorder.empty()) {
config.acquire();
config.conf[_this->name]["recorder"] = _this->selectedRecorder;
config.release(true);
}
}
}