fix show/hide waterfall keybind not working with the Display menu hidden

This commit is contained in:
AlexandreRouma 2024-02-21 21:59:55 +01:00
parent 7c933d5103
commit 021928bbda
3 changed files with 19 additions and 7 deletions

View File

@ -463,6 +463,8 @@ void MainWindow::draw() {
} }
} }
// Process menu keybinds
displaymenu::checkKeybinds();
// Left Column // Left Column
lockWaterfallControls = false; lockWaterfallControls = false;

View File

@ -127,15 +127,24 @@ namespace displaymenu {
uiScaleId = uiScales.valueId(style::uiScale); uiScaleId = uiScales.valueId(style::uiScale);
} }
void setWaterfallShown(bool shown) {
showWaterfall = shown;
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
core::configManager.acquire();
core::configManager.conf["showWaterfall"] = showWaterfall;
core::configManager.release(true);
}
void checkKeybinds() {
if (ImGui::IsKeyPressed(ImGuiKey_Home, false)) {
setWaterfallShown(!showWaterfall);
}
}
void draw(void* ctx) { void draw(void* ctx) {
float menuWidth = ImGui::GetContentRegionAvail().x; float menuWidth = ImGui::GetContentRegionAvail().x;
bool homePressed = ImGui::IsKeyPressed(ImGuiKey_Home, false); if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall)) {
if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall) || homePressed) { setWaterfallShown(showWaterfall);
if (homePressed) { showWaterfall = !showWaterfall; }
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
core::configManager.acquire();
core::configManager.conf["showWaterfall"] = showWaterfall;
core::configManager.release(true);
} }
if (ImGui::Checkbox("Full Waterfall Update##_sdrpp", &fullWaterfallUpdate)) { if (ImGui::Checkbox("Full Waterfall Update##_sdrpp", &fullWaterfallUpdate)) {

View File

@ -2,5 +2,6 @@
namespace displaymenu { namespace displaymenu {
void init(); void init();
void checkKeybinds();
void draw(void* ctx); void draw(void* ctx);
} }