Skip to content

Commit

Permalink
fix show/hide waterfall keybind not working with the Display menu hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreRouma committed Feb 21, 2024
1 parent 7c933d5 commit 021928b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 2 additions & 0 deletions core/src/gui/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ void MainWindow::draw() {
}
}

// Process menu keybinds
displaymenu::checkKeybinds();

// Left Column
lockWaterfallControls = false;
Expand Down
23 changes: 16 additions & 7 deletions core/src/gui/menus/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,24 @@ namespace displaymenu {
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) {
float menuWidth = ImGui::GetContentRegionAvail().x;
bool homePressed = ImGui::IsKeyPressed(ImGuiKey_Home, false);
if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall) || homePressed) {
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("Show Waterfall##_sdrpp", &showWaterfall)) {
setWaterfallShown(showWaterfall);
}

if (ImGui::Checkbox("Full Waterfall Update##_sdrpp", &fullWaterfallUpdate)) {
Expand Down
1 change: 1 addition & 0 deletions core/src/gui/menus/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

namespace displaymenu {
void init();
void checkKeybinds();
void draw(void* ctx);
}

0 comments on commit 021928b

Please sign in to comment.