mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Rename display_error() -> display_modal(), add title argument.
This commit is contained in:
parent
6a3cd4c144
commit
ac49726707
@ -140,7 +140,7 @@ AnalogAudioView::AnalogAudioView(
|
|||||||
};
|
};
|
||||||
|
|
||||||
record_view.on_error = [&nav](std::string message) {
|
record_view.on_error = [&nav](std::string message) {
|
||||||
nav.display_error(message);
|
nav.display_modal("Error", message);
|
||||||
};
|
};
|
||||||
|
|
||||||
audio::output::start();
|
audio::output::start();
|
||||||
|
@ -71,7 +71,7 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
|
|||||||
|
|
||||||
record_view.set_sampling_rate(sampling_rate / 8);
|
record_view.set_sampling_rate(sampling_rate / 8);
|
||||||
record_view.on_error = [&nav](std::string message) {
|
record_view.on_error = [&nav](std::string message) {
|
||||||
nav.display_error(message);
|
nav.display_modal("Error", message);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,10 +131,13 @@ void NavigationView::pop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationView::display_error(const std::string& message) {
|
void NavigationView::display_modal(
|
||||||
|
const std::string& title,
|
||||||
|
const std::string& message
|
||||||
|
) {
|
||||||
/* If a modal view is already visible, don't display another */
|
/* If a modal view is already visible, don't display another */
|
||||||
if( !modal_view ) {
|
if( !modal_view ) {
|
||||||
modal_view = push<ModalMessageView>(message);
|
modal_view = push<ModalMessageView>(title, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +293,12 @@ void NotImplementedView::focus() {
|
|||||||
|
|
||||||
/* ModalMessageView ******************************************************/
|
/* ModalMessageView ******************************************************/
|
||||||
|
|
||||||
ModalMessageView::ModalMessageView(NavigationView& nav, std::string message) {
|
ModalMessageView::ModalMessageView(
|
||||||
|
NavigationView& nav,
|
||||||
|
const std::string& title,
|
||||||
|
const std::string& message
|
||||||
|
) : title_ { title }
|
||||||
|
{
|
||||||
button_done.on_select = [&nav](Button&){
|
button_done.on_select = [&nav](Button&){
|
||||||
nav.pop();
|
nav.pop();
|
||||||
};
|
};
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
|
|
||||||
void pop();
|
void pop();
|
||||||
|
|
||||||
void display_error(const std::string& message);
|
void display_modal(const std::string& title, const std::string& message);
|
||||||
|
|
||||||
void focus() override;
|
void focus() override;
|
||||||
|
|
||||||
@ -210,11 +210,19 @@ private:
|
|||||||
|
|
||||||
class ModalMessageView : public View {
|
class ModalMessageView : public View {
|
||||||
public:
|
public:
|
||||||
ModalMessageView(NavigationView& nav, std::string message);
|
ModalMessageView(
|
||||||
|
NavigationView& nav,
|
||||||
|
const std::string& title,
|
||||||
|
const std::string& message
|
||||||
|
);
|
||||||
|
|
||||||
void focus() override;
|
void focus() override;
|
||||||
|
|
||||||
|
std::string title() const override { return title_; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const std::string title_;
|
||||||
|
|
||||||
Text text_message {
|
Text text_message {
|
||||||
{ 0 * 8, 7 * 16, 30 * 8, 16 },
|
{ 0 * 8, 7 * 16, 30 * 8, 16 },
|
||||||
""
|
""
|
||||||
|
Loading…
Reference in New Issue
Block a user