Rework Titlebar.

Show Album art in info button.
CQTexperiment
Dzmitry Neviadomski 2021-02-19 01:44:05 +03:00
parent d856e23a74
commit 18896dcc3e
6 changed files with 112 additions and 147 deletions

View File

@ -23,7 +23,6 @@
IBOutlet NSSplitView *mainView;
IBOutlet NSSegmentedControl *playbackButtons;
IBOutlet NSButton *infoButton;
IBOutlet NSButton *fileButton;
IBOutlet NSButton *shuffleButton;
IBOutlet NSButton *repeatButton;
@ -56,8 +55,8 @@
BOOL miniMode;
}
@property (strong) IBOutlet NSButton *nowPlayingBar;
@property (nonatomic) BOOL isNowPlayingHidden;
@property (strong) IBOutlet NSButton *infoButton;
@property (strong) IBOutlet NSButton *infoButtonMini;
- (IBAction)openURL:(id)sender;

View File

@ -25,13 +25,6 @@
void* kAppControllerContext = &kAppControllerContext;
@interface AppController ()
@property (nonatomic) BOOL isNowPlayingForceShown;
@end
@implementation AppController {
BOOL _isFullToolbarStyle;
}
@ -51,9 +44,6 @@ void* kAppControllerContext = &kAppControllerContext;
NSValueTransformer *miniModeMenuTitleTransformer = [[MiniModeMenuTitleTransformer alloc] init];
[NSValueTransformer setValueTransformer:miniModeMenuTitleTransformer
forName:@"MiniModeMenuTitleTransformer"];
NSValueTransformer *playbackStatusToHiddenTransformer = [[PlaybackStatusToHiddenTransformer alloc] init];
[NSValueTransformer setValueTransformer:playbackStatusToHiddenTransformer forName:@"PlaybackStatusToHiddenTransformer"];
}
@ -146,7 +136,8 @@ void* kAppControllerContext = &kAppControllerContext;
[[playbackButtons cell] setToolTip:NSLocalizedString(@"PlayButtonTooltip", @"") forSegment: 1];
[[playbackButtons cell] setToolTip:NSLocalizedString(@"PrevButtonTooltip", @"") forSegment: 0];
[[playbackButtons cell] setToolTip:NSLocalizedString(@"NextButtonTooltip", @"") forSegment: 2];
[infoButton setToolTip:NSLocalizedString(@"InfoButtonTooltip", @"")];
[self.infoButton setToolTip:NSLocalizedString(@"InfoButtonTooltip", @"")];
[self.infoButtonMini setToolTip:NSLocalizedString(@"InfoButtonTooltip", @"")];
[shuffleButton setToolTip:NSLocalizedString(@"ShuffleButtonTooltip", @"")];
[repeatButton setToolTip:NSLocalizedString(@"RepeatButtonTooltip", @"")];
[randomizeButton setToolTip:NSLocalizedString(@"RandomizeButtonTooltip", @"")];
@ -235,7 +226,7 @@ void* kAppControllerContext = &kAppControllerContext;
}
[self addObserver:self
forKeyPath:@"playbackController.playbackStatus"
forKeyPath:@"playlistController.currentEntry"
options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew
context:kAppControllerContext];
}
@ -244,11 +235,69 @@ void* kAppControllerContext = &kAppControllerContext;
ofObject:(id)object
change:(NSDictionary<NSKeyValueChangeKey,id> *)change
context:(void *)context {
if ([keyPath isEqualToString:@"playbackController.playbackStatus"]) {
NSValueTransformer *transformer =
[NSValueTransformer valueTransformerForName:@"PlaybackStatusToHiddenTransformer"];
NSNumber *value = [transformer transformedValue:@(playbackController.playbackStatus)];
self.isNowPlayingHidden = value.boolValue;
if (context != kAppControllerContext) {
return;
}
if ([keyPath isEqualToString:@"playlistController.currentEntry"]) {
PlaylistEntry *entry = playlistController.currentEntry;
if (!entry) {
miniWindow.title = @"Cog";
mainWindow.title = @"Cog";
if (@available(macOS 11.0, *)) {
miniWindow.subtitle = @"";
mainWindow.subtitle = @"";
}
self.infoButton.imageScaling = NSImageScaleNone;
self.infoButton.image = [NSImage imageNamed:@"infoTemplate"];
self.infoButtonMini.imageScaling = NSImageScaleNone;
self.infoButtonMini.image = [NSImage imageNamed:@"infoTemplate"];
}
if (@available(macOS 11.0, *)) {
NSString *title = @"Cog";
if (entry.title) {
title = entry.title;
}
miniWindow.title = title;
mainWindow.title = title;
NSString *subtitle = @"";
NSMutableArray<NSString *> *subtitleItems = [NSMutableArray array];
if (entry.album && ![entry.album isEqualToString:@""]) {
[subtitleItems addObject:entry.album];
}
if (entry.artist && ![entry.artist isEqualToString:@""]) {
[subtitleItems addObject:entry.artist];
}
if ([subtitleItems count]) {
subtitle = [subtitleItems componentsJoinedByString:@" - "];
}
miniWindow.subtitle = subtitle;
mainWindow.subtitle = subtitle;
} else {
NSString *title = @"Cog";
if (entry.display) {
title = entry.display;
}
miniWindow.title = title;
mainWindow.title = title;
}
if (entry.albumArt) {
self.infoButton.imageScaling = NSImageScaleProportionallyUpOrDown;
self.infoButton.image = playlistController.currentEntry.albumArt;
self.infoButtonMini.imageScaling = NSImageScaleProportionallyUpOrDown;
self.infoButtonMini.image = playlistController.currentEntry.albumArt;
} else {
self.infoButton.imageScaling = NSImageScaleNone;
self.infoButton.image = [NSImage imageNamed:@"infoTemplate"];
self.infoButtonMini.imageScaling = NSImageScaleNone;
self.infoButtonMini.image = [NSImage imageNamed:@"infoTemplate"];
}
}
}
@ -461,18 +510,6 @@ void* kAppControllerContext = &kAppControllerContext;
}];
}
- (void)windowDidEnterFullScreen:(NSNotification *)notification
{
DLog(@"Entering fullscreen");
self.isNowPlayingForceShown = YES;
}
- (void)windowDidExitFullScreen:(NSNotification *)notification
{
DLog(@"Exiting fullscreen");
self.isNowPlayingForceShown = NO;
}
- (void)clickPlay
{
[playbackController playPauseResume:self];
@ -559,32 +596,17 @@ void* kAppControllerContext = &kAppControllerContext;
if (@available(macOS 11.0, *)) {
NSWindowToolbarStyle style =
full ? NSWindowToolbarStyleExpanded : NSWindowToolbarStyleUnifiedCompact;
full ? NSWindowToolbarStyleExpanded : NSWindowToolbarStyleUnified;
mainWindow.toolbarStyle = style;
miniWindow.toolbarStyle = style;
} else {
NSWindowTitleVisibility titleVisibility = full ? NSWindowTitleVisible : NSWindowTitleHidden;
mainWindow.titleVisibility = titleVisibility;
miniWindow.titleVisibility = titleVisibility;
}
[self.nowPlayingBar setHidden:full];
NSWindowTitleVisibility visibility = full ? NSWindowTitleVisible : NSWindowTitleHidden;
mainWindow.titleVisibility = visibility;
miniWindow.titleVisibility = visibility;
// Fix empty area after changing toolbar style in mini window as it has no content view
[miniWindow setContentSize:NSMakeSize(miniWindow.frame.size.width, 0)];
}
- (BOOL)isNowPlayingHidden {
if (_isNowPlayingForceShown) {
return NO;
}
return _isNowPlayingHidden;
}
- (void)setIsNowPlayingForceShown:(BOOL)isNowPlayingForceShown {
[self willChangeValueForKey:@"isNowPlayingHidden"];
_isNowPlayingForceShown = isNowPlayingForceShown;
[self didChangeValueForKey:@"isNowPlayingHidden"];
}
@end

View File

@ -14,48 +14,35 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Cog" separatorStyle="none" allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="Cog" animationBehavior="default" toolbarStyle="compact" titleVisibility="hidden" id="21" userLabel="Window" customClass="MainWindow">
<window title="Cog" separatorStyle="none" allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="Cog" animationBehavior="default" toolbarStyle="unified" id="21" userLabel="Window" customClass="MainWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
<windowPositionMask key="initialPositionMask" topStrut="YES"/>
<rect key="contentRect" x="331" y="367" width="847" height="400"/>
<rect key="contentRect" x="331" y="367" width="1000" height="400"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
<value key="minSize" type="size" width="400" height="200"/>
<stackView key="contentView" orientation="vertical" alignment="centerX" spacing="4" hasEqualSpacing="YES" detachesHiddenViews="YES" id="2">
<rect key="frame" x="0.0" y="0.0" width="847" height="400"/>
<value key="minSize" type="size" width="750" height="200"/>
<stackView key="contentView" distribution="equalSpacing" orientation="vertical" alignment="centerX" spacing="0.0" detachesHiddenViews="YES" id="2">
<rect key="frame" x="0.0" y="0.0" width="1000" height="400"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<edgeInsets key="edgeInsets" left="0.0" right="0.0" top="0.0" bottom="4"/>
<middleViews>
<button toolTip="Click to select currently playing track" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gev-jg-41I">
<rect key="frame" x="337" y="384" width="174" height="16"/>
<buttonCell key="cell" type="bevel" title="Now Playing Track title here" bezelStyle="rounded" alignment="center" lineBreakMode="truncatingTail" imageScaling="proportionallyDown" inset="2" id="oXd-7z-UQS">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="scrollToCurrentEntry:" target="207" id="e2T-5R-8Eo"/>
<binding destination="1897" name="title" keyPath="content.display" id="fno-Aq-DvV"/>
<binding destination="226" name="hidden" keyPath="isNowPlayingHidden" id="nmX-cN-bua"/>
</connections>
</button>
<splitView fixedFrame="YES" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2123">
<rect key="frame" x="24" y="22" width="800" height="358"/>
<subviews>
<splitView dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2123">
<rect key="frame" x="0.0" y="22" width="1000" height="378"/>
<subviews>
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="24" horizontalPageScroll="0.0" verticalLineScroll="24" verticalPageScroll="0.0" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="206" userLabel="Scroll View - Playlist View">
<rect key="frame" x="0.0" y="0.0" width="800" height="358"/>
<rect key="frame" x="0.0" y="0.0" width="1000" height="378"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="KWC-Ti-8KY">
<rect key="frame" x="0.0" y="0.0" width="800" height="358"/>
<rect key="frame" x="0.0" y="0.0" width="1000" height="378"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveName="Playlist" rowHeight="18" headerView="1517" id="207" customClass="PlaylistView">
<rect key="frame" x="0.0" y="0.0" width="800" height="341"/>
<rect key="frame" x="0.0" y="0.0" width="1000" height="361"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="6"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="index" editable="NO" width="36" minWidth="28" maxWidth="64" id="209">
<tableColumn identifier="index" editable="NO" width="64" minWidth="28" maxWidth="64" id="209">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="#">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
@ -93,7 +80,7 @@
</binding>
</connections>
</tableColumn>
<tableColumn identifier="title" editable="NO" width="121" minWidth="96" maxWidth="1024" id="208">
<tableColumn identifier="title" editable="NO" width="152" minWidth="96" maxWidth="1024" id="208">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Title">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
@ -114,7 +101,7 @@
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="1914"/>
</connections>
</tableColumn>
<tableColumn identifier="artist" editable="NO" width="120.5" minWidth="96" maxWidth="1024" id="391">
<tableColumn identifier="artist" editable="NO" width="149.5" minWidth="96" maxWidth="1024" id="391">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Artist">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@ -135,7 +122,7 @@
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="1916"/>
</connections>
</tableColumn>
<tableColumn identifier="album" editable="NO" width="121.5" minWidth="96" maxWidth="1024" id="806">
<tableColumn identifier="album" editable="NO" width="150.5" minWidth="96" maxWidth="1024" id="806">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Album">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@ -156,7 +143,7 @@
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="1917"/>
</connections>
</tableColumn>
<tableColumn identifier="length" editable="NO" width="67.5" minWidth="43.62012" maxWidth="96" id="807">
<tableColumn identifier="length" editable="NO" width="95.5" minWidth="43.62012" maxWidth="96" id="807">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Length">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@ -176,7 +163,7 @@
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="1919"/>
</connections>
</tableColumn>
<tableColumn identifier="year" editable="NO" width="67.5" minWidth="42" maxWidth="96" id="848">
<tableColumn identifier="year" editable="NO" width="93.5" minWidth="42" maxWidth="96" id="848">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Year">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@ -192,7 +179,7 @@
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="1921"/>
</connections>
</tableColumn>
<tableColumn identifier="genre" editable="NO" width="119.5" minWidth="96" maxWidth="512" id="849">
<tableColumn identifier="genre" editable="NO" width="144" minWidth="96" maxWidth="512" id="849">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Genre">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@ -209,7 +196,7 @@
<binding destination="1689" name="fontSize" keyPath="values.fontSize" id="1922"/>
</connections>
</tableColumn>
<tableColumn identifier="track" editable="NO" width="67.5" minWidth="24" maxWidth="72" id="850">
<tableColumn identifier="track" editable="NO" width="72" minWidth="24" maxWidth="72" id="850">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="№">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@ -292,7 +279,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" wantsLayer="YES" id="1517" customClass="PlaylistHeaderView">
<rect key="frame" x="0.0" y="0.0" width="800" height="17"/>
<rect key="frame" x="0.0" y="0.0" width="1000" height="17"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
@ -304,10 +291,8 @@
<outlet property="delegate" destination="2172" id="2182"/>
</connections>
</splitView>
</middleViews>
<endViews>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="778">
<rect key="frame" x="293" y="4" width="261" height="14"/>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="778">
<rect key="frame" x="370" y="4" width="261" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="center" title="Total Duration: 00 hours 00 minutes 00 seconds" bezelStyle="round" id="1473">
<font key="font" metaFont="controlContent" size="11"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@ -321,16 +306,18 @@
</binding>
</connections>
</textField>
</endViews>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="2123" secondAttribute="bottom" constant="22" id="CIQ-D5-aGm"/>
<constraint firstAttribute="bottom" secondItem="778" secondAttribute="bottom" constant="4" id="WM0-sc-crj"/>
</constraints>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<toolbar key="toolbar" implicitIdentifier="B4998081-90DD-45DD-8243-0F7039C7DEA2" displayMode="iconOnly" sizeMode="regular" id="1523">
@ -451,7 +438,7 @@
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="2F487D99-16E9-4BF8-9A98-637FABEB2716" label="Info Inspector" paletteLabel="Info Inspector" image="infoTemplate" sizingBehavior="auto" id="1629">
<toolbarItem implicitItemIdentifier="2F487D99-16E9-4BF8-9A98-637FABEB2716" label="Info Inspector" paletteLabel="Info Inspector" image="infoTemplate" sizingBehavior="auto" navigational="YES" id="1629">
<nil key="toolTip"/>
<button key="view" verticalHuggingPriority="750" id="1627">
<rect key="frame" x="26" y="14" width="28" height="23"/>
@ -465,7 +452,7 @@
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="6EE50288-54ED-448F-BB25-347479AE119F" label="File Tree" paletteLabel="File Tree" image="navigatorTemplate" sizingBehavior="auto" id="1630">
<toolbarItem implicitItemIdentifier="6EE50288-54ED-448F-BB25-347479AE119F" label="File Tree" paletteLabel="File Tree" image="navigatorTemplate" sizingBehavior="auto" navigational="YES" id="1630">
<nil key="toolTip"/>
<button key="view" verticalHuggingPriority="750" id="1631">
<rect key="frame" x="12" y="14" width="28" height="23"/>
@ -482,7 +469,7 @@
<toolbarItem implicitItemIdentifier="972E4070-D310-48FE-BA9B-C06B248FF020" label="Randomize" paletteLabel="Randomize" image="randomizeTemplate" sizingBehavior="auto" id="2466">
<nil key="toolTip"/>
<button key="view" verticalHuggingPriority="750" id="2467">
<rect key="frame" x="18" y="14" width="29" height="23"/>
<rect key="frame" x="19" y="14" width="28" height="23"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="randomizeTemplate" imagePosition="only" alignment="center" borderStyle="border" id="2468">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@ -553,8 +540,8 @@
<toolbarItem reference="1639"/>
<toolbarItem reference="2466"/>
<toolbarItem reference="1552"/>
<toolbarItem reference="1629"/>
<toolbarItem reference="1630"/>
<toolbarItem reference="1629"/>
<toolbarItem reference="1529"/>
<toolbarItem reference="1568"/>
<toolbarItem reference="1551"/>
@ -578,12 +565,12 @@
</connections>
<point key="canvasLocation" x="130.5" y="131"/>
</window>
<window title="Cog" separatorStyle="none" allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="Mini Window" animationBehavior="default" titlebarAppearsTransparent="YES" toolbarStyle="expanded" id="2234" userLabel="Mini Window (Window)" customClass="MiniWindow">
<window title="Cog" separatorStyle="none" allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="Mini Window" animationBehavior="default" titlebarAppearsTransparent="YES" toolbarStyle="unified" id="2234" userLabel="Mini Window (Window)" customClass="MiniWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="192" y="547" width="480" height="0.0"/>
<rect key="contentRect" x="192" y="547" width="640" height="0.0"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
<view key="contentView" hidden="YES" wantsLayer="YES" id="2235">
<rect key="frame" x="0.0" y="0.0" width="480" height="0.0"/>
<rect key="frame" x="0.0" y="0.0" width="640" height="0.0"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<toolbar key="toolbar" implicitIdentifier="35998ECE-5AD8-429E-8479-657249B22C9C" displayMode="iconOnly" sizeMode="regular" id="2222" userLabel="Mini Toolbar">
@ -709,7 +696,7 @@
<action selector="toggleMiniMode:" target="226" id="2531"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="0649F8CF-02D0-4D43-9FB4-CCAFAFA03B49" label="Info Inspector" paletteLabel="Info Inspector" image="infoTemplate" sizingBehavior="auto" id="2429">
<toolbarItem implicitItemIdentifier="0649F8CF-02D0-4D43-9FB4-CCAFAFA03B49" label="Info Inspector" paletteLabel="Info Inspector" image="infoTemplate" sizingBehavior="auto" navigational="YES" id="2429">
<nil key="toolTip"/>
<button key="view" verticalHuggingPriority="750" id="2430">
<rect key="frame" x="26" y="14" width="28" height="23"/>
@ -729,6 +716,7 @@
<defaultToolbarItems>
<toolbarItem reference="2272"/>
<toolbarItem reference="2228"/>
<toolbarItem reference="2429"/>
<toolbarItem reference="2278"/>
<toolbarItem reference="2279"/>
<toolbarItem reference="2228"/>
@ -747,7 +735,7 @@
</binding>
<outlet property="playbackController" destination="705" id="vo7-mK-yQe"/>
</connections>
<point key="canvasLocation" x="-35" y="444"/>
<point key="canvasLocation" x="45" y="444"/>
</window>
<menu title="MainMenu" systemMenu="main" id="29" userLabel="MainMenu">
<items>
@ -1476,10 +1464,10 @@ Gw
<outlet property="fileButton" destination="1631" id="1661"/>
<outlet property="fileTreeViewController" destination="2172" id="2460"/>
<outlet property="infoButton" destination="1627" id="1663"/>
<outlet property="infoButtonMini" destination="2430" id="8ur-Rl-qzm"/>
<outlet property="mainView" destination="2123" id="2458"/>
<outlet property="mainWindow" destination="21" id="359"/>
<outlet property="miniWindow" destination="2234" id="2517"/>
<outlet property="nowPlayingBar" destination="gev-jg-41I" id="Fqh-sm-eiO"/>
<outlet property="playbackController" destination="705" id="1300"/>
<outlet property="playlistController" destination="218" id="236"/>
<outlet property="playlistLoader" destination="1319" id="1322"/>

View File

@ -158,7 +158,6 @@
83849172180843B200E7332D /* pauseDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 8384916F180843B200E7332D /* pauseDockBadgeColorful.png */; };
83849173180843B200E7332D /* playDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 83849170180843B200E7332D /* playDockBadgeColorful.png */; };
83849174180843B200E7332D /* stopDockBadgeColorful.png in Resources */ = {isa = PBXBuildFile; fileRef = 83849171180843B200E7332D /* stopDockBadgeColorful.png */; };
838F850125687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 838F850025687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift */; };
838F851C256B4AC400C3E614 /* icon_blank.icns in Resources */ = {isa = PBXBuildFile; fileRef = 838F851B256B4AC400C3E614 /* icon_blank.icns */; };
838F851E256B4E5E00C3E614 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 838F851D256B4E5E00C3E614 /* Sparkle.framework */; };
838F851F256B4E8B00C3E614 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 838F851D256B4E5E00C3E614 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@ -913,7 +912,6 @@
83849171180843B200E7332D /* stopDockBadgeColorful.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = stopDockBadgeColorful.png; path = Images/stopDockBadgeColorful.png; sourceTree = "<group>"; };
83859520234FEB35004E9946 /* Cog.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Cog.entitlements; sourceTree = "<group>"; };
838F84FF25687C5C00C3E614 /* Cog-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Cog-Bridging-Header.h"; sourceTree = "<group>"; };
838F850025687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PlaybackStatusToHiddenTransformer.swift; path = Transformers/PlaybackStatusToHiddenTransformer.swift; sourceTree = "<group>"; };
838F851B256B4AC400C3E614 /* icon_blank.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon_blank.icns; sourceTree = "<group>"; };
838F851D256B4E5E00C3E614 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = ThirdParty/Frameworks/Sparkle.framework; sourceTree = "<group>"; };
8399D4E01805A55000B503B1 /* XmlContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XmlContainer.m; sourceTree = "<group>"; };
@ -1352,7 +1350,6 @@
17E0D6130F520F87005B6FED /* FontSizetoLineHeightTransformer.m */,
17E0D6140F520F87005B6FED /* StringToURLTransformer.h */,
17E0D6150F520F87005B6FED /* StringToURLTransformer.m */,
838F850025687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift */,
838F84FF25687C5C00C3E614 /* Cog-Bridging-Header.h */,
);
name = Transformers;
@ -2307,7 +2304,6 @@
07E18DF30D62B38400BB0E11 /* NSArray+ShuffleUtils.m in Sources */,
56C63D910D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.m in Sources */,
56DB084C0D6717DC00453B6A /* NSNumber+CogSort.m in Sources */,
838F850125687C5C00C3E614 /* PlaybackStatusToHiddenTransformer.swift in Sources */,
56DB08550D67185300453B6A /* NSArray+CogSort.m in Sources */,
170B55940D6E5E7B006B9E92 /* StatusImageTransformer.m in Sources */,
17249F0F0D82E17700F33392 /* ToggleQueueTitleTransformer.m in Sources */,

View File

@ -1,40 +0,0 @@
//
// PlaybackStatusToHiddenTransformer.swift
// Cog
//
// Created by Christopher Snowhill on 11/20/20.
//
import Foundation
class PlaybackStatusToHiddenTransformer : ValueTransformer {
override class func transformedValueClass() -> AnyClass {
return NSNumber.self
}
override class func allowsReverseTransformation() -> Bool {
return false
}
override func transformedValue(_ value: Any?) -> Any? {
let titleShown = UserDefaults.standard.bool(forKey: "toolbarStyleFull");
if titleShown {
return NSNumber(booleanLiteral: true)
}
guard let intValue = value as? Int,
let status = CogStatus(rawValue: intValue) else {
return NSNumber(booleanLiteral: true)
}
switch status {
case .stopped:
return NSNumber(booleanLiteral: true)
case .paused,
.playing,
.stopping:
return NSNumber(booleanLiteral: false)
@unknown default:
return NSNumber(booleanLiteral: false)
}
}
}

View File

@ -19,7 +19,7 @@
[self setExcludedFromWindowsMenu:YES];
[[self standardWindowButton:NSWindowZoomButton] setEnabled:NO];
// Disallow height resize.
[self setContentMinSize:NSMakeSize(280, 0)];
[self setContentMinSize:NSMakeSize(675, 0)];
[self setContentMaxSize:NSMakeSize(CGFLOAT_MAX, 0)];
[self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];
}