mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Yikes! Fixed a really, really bad first run bug I never noticed because I
never go through the first run process.
This commit is contained in:
parent
3641acd7bf
commit
c3653ffa19
@ -303,28 +303,31 @@ void SettingsLayout::OnVisibilityChanged(bool visible) {
|
||||
|
||||
void SettingsLayout::CheckShowFirstRunDialog() {
|
||||
if (!this->libraryPrefs->GetBool(box::prefs::keys::FirstRunSettingsDisplayed)) {
|
||||
std::shared_ptr<DialogOverlay> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <cursespp/SimpleScrollAdapter.h>
|
||||
#include <cursespp/TextLabel.h>
|
||||
#include <cursespp/TextInput.h>
|
||||
#include <cursespp/DialogOverlay.h>
|
||||
|
||||
#include <app/window/TrackListView.h>
|
||||
#include <app/service/PlaybackService.h>
|
||||
@ -124,6 +125,8 @@ namespace musik {
|
||||
std::shared_ptr<cursespp::TextLabel> hotkeyLabel;
|
||||
std::shared_ptr<cursespp::TextInput> hotkeyInput;
|
||||
|
||||
std::shared_ptr<cursespp::DialogOverlay> firstRunDialog;
|
||||
|
||||
cursespp::SimpleScrollAdapter addedPathsAdapter;
|
||||
DirectoryAdapter browseAdapter;
|
||||
};
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user