Skip to content
Snippets Groups Projects
Commit 37dcce74 authored by Claudio Cambra's avatar Claudio Cambra Committed by Steve Lhomme
Browse files

macosx: Use library window method to show/hide loading overlay view in audio view controller


Signed-off-by: default avatarClaudio Cambra <developer@claudiocambra.com>
parent 3663f7c3
No related branches found
No related tags found
1 merge request!6136macosx: Unify handling of various view's presentation
......@@ -600,53 +600,22 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
- (void)libraryModelLongLoadStarted:(NSNotification *)notification
{
if ([self.libraryTargetView.subviews containsObject:self.loadingOverlayView]) {
return;
}
if (self.connected) {
[self.audioDataSource disconnect];
[self.audioGroupDataSource disconnect];
}
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 0.0;
NSArray * const views = [self.libraryTargetView.subviews arrayByAddingObject:self.loadingOverlayView];
self.libraryTargetView.subviews = views;
[self.libraryTargetView addConstraints:self.libraryWindow.loadingOverlayViewConstraints];
[NSAnimationContext runAnimationGroup:^(NSAnimationContext * const context) {
context.duration = 0.5;
self.loadingOverlayView.animator.alphaValue = 1.0;
} completionHandler:nil];
[self.loadingOverlayView.indicator startAnimation:self];
[self.libraryWindow showLoadingOverlay];
}
- (void)libraryModelLongLoadFinished:(NSNotification *)notification
{
if (![self.libraryTargetView.subviews containsObject:self.loadingOverlayView]) {
return;
}
if (self.connected) {
[self.audioDataSource connect];
[self.audioGroupDataSource connect];
}
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 1.0;
[NSAnimationContext runAnimationGroup:^(NSAnimationContext * const context) {
context.duration = 1.0;
self.loadingOverlayView.animator.alphaValue = 0.0;
} completionHandler:^{
[self.libraryTargetView removeConstraints:self.libraryWindow.loadingOverlayViewConstraints];
NSMutableArray * const views = self.libraryTargetView.subviews.mutableCopy;
[views removeObject:self.loadingOverlayView];
self.libraryTargetView.subviews = views.copy;
[self.loadingOverlayView.indicator stopAnimation:self];
}];
[self.libraryWindow hideLoadingOverlay];
}
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment