From f79daccb1ec5518fc663fb746636d7678af826ff Mon Sep 17 00:00:00 2001 From: Casey Langen Date: Sun, 6 Nov 2016 21:54:41 -0800 Subject: [PATCH] Added an error dialog if no visualizers are installed. --- .../app/overlay/VisualizerOverlay.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/musikbox/app/overlay/VisualizerOverlay.cpp b/src/musikbox/app/overlay/VisualizerOverlay.cpp index 346164539..86b4ea00d 100644 --- a/src/musikbox/app/overlay/VisualizerOverlay.cpp +++ b/src/musikbox/app/overlay/VisualizerOverlay.cpp @@ -41,15 +41,35 @@ #include #include #include +#include using namespace musik::box; using namespace musik::core::audio; using namespace cursespp; +static void showNoVisualizersMessage() { + std::shared_ptr dialog(new DialogOverlay()); + + (*dialog) + .SetTitle("musikbox") + .SetMessage("no visualizers found!") + .AddButton( + "KEY_ENTER", + "ENTER", + "ok"); + + App::Overlays().Push(dialog); +} + VisualizerOverlay::VisualizerOverlay() { } void VisualizerOverlay::Show() { + if (!vis::VisualizerCount()) { + showNoVisualizersMessage(); + return; + } + using Adapter = cursespp::SimpleScrollAdapter; using ListOverlay = cursespp::ListOverlay;