Fix info inspector to always display the first item of the current selection, or otherwise the currently playing track, or nothing at all, in that order
parent
7acfdf774d
commit
ea853109ed
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#import "InfoWindowController.h"
|
#import "InfoWindowController.h"
|
||||||
#import "MissingAlbumArtTransformer.h"
|
#import "MissingAlbumArtTransformer.h"
|
||||||
|
#import "PlaylistEntry.h"
|
||||||
#import "Logging.h"
|
#import "Logging.h"
|
||||||
#import "AppController.h"
|
#import "AppController.h"
|
||||||
|
|
||||||
|
@ -36,19 +37,13 @@
|
||||||
|
|
||||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||||
{
|
{
|
||||||
BOOL miniMode = [appController miniMode];
|
// Avoid "selection" because it creates a proxy that's hard to reason with when we don't need to write.
|
||||||
BOOL currentEntryChanged = (object == currentEntryController && [keyPath isEqualTo:@"content"]);
|
PlaylistEntry* currentSelection = [[playlistSelectionController selectedObjects] firstObject];
|
||||||
BOOL selectionChanged = (object == playlistSelectionController && [keyPath isEqualTo:@"selection"]);
|
if (currentSelection != NULL) {
|
||||||
BOOL miniModeSwitched = (object == appController && [keyPath isEqual:@"miniMode"]);
|
[self setValueToDisplay: currentSelection];
|
||||||
|
} else {
|
||||||
if (miniMode && (currentEntryChanged || miniModeSwitched))
|
|
||||||
{
|
|
||||||
[self setValueToDisplay:[currentEntryController content]];
|
[self setValueToDisplay:[currentEntryController content]];
|
||||||
}
|
}
|
||||||
else if (!miniMode && (selectionChanged || miniModeSwitched))
|
|
||||||
{
|
|
||||||
[self setValueToDisplay:[playlistSelectionController selection]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)toggleWindow:(id)sender
|
- (IBAction)toggleWindow:(id)sender
|
||||||
|
|
Loading…
Reference in New Issue