mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
Ask for confirmation before closing if there are unsaved presets.
This commit is contained in:
parent
1409cbf7f7
commit
d0588c2ef8
2 changed files with 34 additions and 10 deletions
|
@ -223,4 +223,22 @@ sub load_config {
|
|||
$dlg->Destroy;
|
||||
}
|
||||
|
||||
sub on_close {
|
||||
my $self = shift;
|
||||
|
||||
my @dirty;
|
||||
foreach (keys %{$self->{options_tabs}}) {
|
||||
push (@dirty, $_) if $self->{options_tabs}{$_}->is_dirty;
|
||||
}
|
||||
|
||||
if (@dirty) {
|
||||
my $titles = join ', ', @dirty;
|
||||
my $confirm = Wx::MessageDialog->new($self, "You have unsaved changes ($titles). Exit anyway?",
|
||||
'Unsaved Presets', wxICON_QUESTION | wxOK | wxCANCEL);
|
||||
return ($confirm->ShowModal == wxID_OK);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue