summaryrefslogtreecommitdiff
path: root/iced_builder/src/dialogs.rs
blob: c9a5ba2e3358ebdbf897dd13390e8514435be3fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use rfd::{MessageButtons, MessageDialog, MessageDialogResult, MessageLevel};

pub fn error_dialog(description: impl Into<String>) {
    let _ = MessageDialog::new()
        .set_level(MessageLevel::Error)
        .set_buttons(MessageButtons::Ok)
        .set_title("Oops! Something went wrong.")
        .set_description(description)
        .show();
}

pub fn warning_dialog(description: impl Into<String>) {
    let _ = MessageDialog::new()
        .set_level(MessageLevel::Warning)
        .set_buttons(MessageButtons::Ok)
        .set_title("Heads up!")
        .set_description(description)
        .show();
}

pub fn unsaved_changes_dialog(
    description: impl Into<String>,
) -> MessageDialogResult {
    MessageDialog::new()
        .set_level(MessageLevel::Warning)
        .set_buttons(MessageButtons::OkCancel)
        .set_title("Unsaved changes")
        .set_description(description)
        .show()
}