Skip to content

Commit

Permalink
Merge pull request #957 from oxygen-dioxide/drop-unsupported-dialog
Browse files Browse the repository at this point in the history
Show a dialog when dropping file if the file format is unsupported, Support ".midi" as an equivalent of ".mid" on dragging and dropping.
  • Loading branch information
stakira authored Nov 30, 2023
2 parents 47ccf84 + e2ec1b7 commit 94937e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions OpenUtau/Strings/Strings.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<system:String x:Key="dialogs.messagebox.yes">Yes</system:String>
<system:String x:Key="dialogs.noresampler.caption">No resampler</system:String>
<system:String x:Key="dialogs.noresampler.message">No resampler! Put your favourite resampler exe or dll in the Resamplers folder and choose it in Preferences!</system:String>
<system:String x:Key="dialogs.unsupportedfile.caption">Unsupported file format</system:String>
<system:String x:Key="dialogs.unsupportedfile.message">Unsupported file format: </system:String>
<system:String x:Key="dialogs.timesig.caption">Time Signature</system:String>
<system:String x:Key="dialogs.tracksettings.caption">Track Settings</system:String>
<system:String x:Key="dialogs.tracksettings.location">Location</system:String>
Expand Down
8 changes: 7 additions & 1 deletion OpenUtau/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ async void OnDrop(object? sender, DragEventArgs args) {
Log.Error(e, $"Failed to open file {file}");
_ = await MessageBox.ShowError(this, e);
}
} else if (ext == ".mid") {
} else if (ext == ".mid" || ext == ".midi") {
try {
viewModel.ImportMidi(file);
} catch (Exception e) {
Expand Down Expand Up @@ -804,6 +804,12 @@ async void OnDrop(object? sender, DragEventArgs args) {
Log.Error(e, "Failed to import audio");
_ = await MessageBox.ShowError(this, e);
}
} else {
_ = await MessageBox.Show(
this,
ThemeManager.GetString("dialogs.unsupportedfile.message") + ext,
ThemeManager.GetString("dialogs.unsupportedfile.caption"),
MessageBox.MessageBoxButtons.Ok);
}
}

Expand Down

0 comments on commit 94937e3

Please sign in to comment.