diff --git a/src/musikbox/app/layout/SettingsLayout.cpp b/src/musikbox/app/layout/SettingsLayout.cpp index adfdf0161..563387f88 100755 --- a/src/musikbox/app/layout/SettingsLayout.cpp +++ b/src/musikbox/app/layout/SettingsLayout.cpp @@ -303,28 +303,31 @@ void SettingsLayout::OnVisibilityChanged(bool visible) { void SettingsLayout::CheckShowFirstRunDialog() { if (!this->libraryPrefs->GetBool(box::prefs::keys::FirstRunSettingsDisplayed)) { - std::shared_ptr dialog(new DialogOverlay()); + if (!this->firstRunDialog) { + this->firstRunDialog.reset(new DialogOverlay()); - (*dialog) - .SetTitle("welcome to musikbox!") - .SetMessage(boost::str(boost::format( - "add some directories that contain music files, " - "then press '%s' to show the library view and start listening!\n\n" - "for troubleshooting, press '%s' to enter the console view.\n\n" - "other keyboard shorcuts are displayed in the command bar at the " - "bottom of the screen. toggle command mode by pressing 'ESC'.\n\n" - "select 'ok' to get started.") + (*this->firstRunDialog) + .SetTitle("welcome to musikbox!") + .SetMessage(boost::str(boost::format( + "add some directories that contain music files, " + "then press '%s' to show the library view and start listening!\n\n" + "for troubleshooting, press '%s' to enter the console view.\n\n" + "other keyboard shorcuts are displayed in the command bar at the " + "bottom of the screen. toggle command mode by pressing 'ESC'.\n\n" + "select 'ok' to get started.") % Hotkeys::Get(Hotkeys::NavigateLibrary) % Hotkeys::Get(Hotkeys::NavigateConsole))) - .AddButton( - "KEY_ENTER", - "ENTER", - "ok", - [this](std::string key) { - this->libraryPrefs->SetBool(box::prefs::keys::FirstRunSettingsDisplayed, true); - }); + .AddButton( + "KEY_ENTER", + "ENTER", + "ok", + [this](std::string key) { + this->libraryPrefs->SetBool(box::prefs::keys::FirstRunSettingsDisplayed, true); + this->firstRunDialog.reset(); + }); - App::Overlays().Push(dialog); + App::Overlays().Push(this->firstRunDialog); + } } } diff --git a/src/musikbox/app/layout/SettingsLayout.h b/src/musikbox/app/layout/SettingsLayout.h index 1b71b4e74..8e4977f73 100755 --- a/src/musikbox/app/layout/SettingsLayout.h +++ b/src/musikbox/app/layout/SettingsLayout.h @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -124,6 +125,8 @@ namespace musik { std::shared_ptr hotkeyLabel; std::shared_ptr hotkeyInput; + std::shared_ptr firstRunDialog; + cursespp::SimpleScrollAdapter addedPathsAdapter; DirectoryAdapter browseAdapter; }; diff --git a/src/musikbox/cursespp/DialogOverlay.cpp b/src/musikbox/cursespp/DialogOverlay.cpp index 7335cc517..39730f388 100644 --- a/src/musikbox/cursespp/DialogOverlay.cpp +++ b/src/musikbox/cursespp/DialogOverlay.cpp @@ -137,12 +137,6 @@ bool DialogOverlay::KeyPress(const std::string& key) { return LayoutBase::KeyPress(key); } -void DialogOverlay::OnVisibilityChanged(bool visible) { - if (visible) { - this->Redraw(); - } -} - void DialogOverlay::RecalculateSize() { int lastWidth = this->width; diff --git a/src/musikbox/cursespp/DialogOverlay.h b/src/musikbox/cursespp/DialogOverlay.h index c201e70ff..34b2039f9 100644 --- a/src/musikbox/cursespp/DialogOverlay.h +++ b/src/musikbox/cursespp/DialogOverlay.h @@ -68,9 +68,6 @@ namespace cursespp { virtual void Layout(); virtual bool KeyPress(const std::string& key); - protected: - virtual void OnVisibilityChanged(bool visible); - private: void Redraw(); void RecalculateSize();