vlc | branch: master | Felix Paul Kühne <[email protected]> | Sat Jun 1 11:48:59 2019 +0200| [7a706f2031cd58b8f199d16053d0077dcd9fb4a6] | committer: Felix Paul Kühne
macosx/library: adapt large-text setting and print everything smaller > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a706f2031cd58b8f199d16053d0077dcd9fb4a6 --- .../gui/macosx/UI/VLCLibraryCollectionViewItem.xib | 10 ++++---- .../gui/macosx/extensions/NSFont+VLCAdditions.h | 6 +++-- .../gui/macosx/extensions/NSFont+VLCAdditions.m | 14 +++++++++-- .../macosx/library/VLCLibraryAlbumTableCellView.m | 6 ++--- .../macosx/library/VLCLibraryCollectionViewItem.m | 28 ++++++++++++++++++---- .../gui/macosx/library/VLCLibraryTableCellView.m | 6 ++--- 6 files changed, 50 insertions(+), 20 deletions(-) diff --git a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib index 42d21fd6fa..d919779119 100644 --- a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib +++ b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib @@ -25,7 +25,7 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <subviews> <customView translatesAutoresizingMaskIntoConstraints="NO" id="2aB-sB-hfY" customClass="VLCImageView"> - <rect key="frame" x="0.0" y="46" width="256" height="168"/> + <rect key="frame" x="0.0" y="49" width="256" height="165"/> <subviews> <customView translatesAutoresizingMaskIntoConstraints="NO" id="dFt-oZ-h9P" customClass="VLCLinearProgressIndicator"> <rect key="frame" x="0.0" y="0.0" width="256" height="4"/> @@ -34,7 +34,7 @@ </constraints> </customView> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="S3I-5Z-qgS"> - <rect key="frame" x="96" y="52" width="64" height="64"/> + <rect key="frame" x="96" y="51" width="64" height="64"/> <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="libraryPlay" imagePosition="only" alignment="center" inset="2" id="IHP-p1-d0R"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <font key="font" metaFont="system"/> @@ -44,7 +44,7 @@ </connections> </button> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tm2-NW-WsZ" customClass="VLCRoundedCornerTextField"> - <rect key="frame" x="8" y="144" width="37" height="17"/> + <rect key="frame" x="8" y="141" width="37" height="17"/> <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="tyb-Ur-7J9"> <font key="font" metaFont="system"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> @@ -61,7 +61,7 @@ </constraints> </customView> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OBS-Eh-1mT"> - <rect key="frame" x="-2" y="18" width="52" height="24"/> + <rect key="frame" x="-2" y="21" width="52" height="24"/> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" title="Label" usesSingleLineMode="YES" id="7Hy-o3-LvX"> <font key="font" size="20" name=".AppleSystemUIFont"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> @@ -103,7 +103,7 @@ <constraint firstItem="2aB-sB-hfY" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="3Ah-0T-rA9"/> <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="OBS-Eh-1mT" secondAttribute="trailing" id="457-oy-EbD"/> <constraint firstItem="Ubz-8I-W2F" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="7" id="8Qf-Un-Gdl"/> - <constraint firstItem="VAn-gF-QiZ" firstAttribute="top" secondItem="OBS-Eh-1mT" secondAttribute="bottom" constant="-1" id="ALi-0z-Mza"/> + <constraint firstItem="VAn-gF-QiZ" firstAttribute="top" secondItem="OBS-Eh-1mT" secondAttribute="bottom" constant="2" id="ALi-0z-Mza"/> <constraint firstAttribute="trailing" secondItem="u2r-zy-XEW" secondAttribute="trailing" id="Dd7-va-0UJ"/> <constraint firstItem="u2r-zy-XEW" firstAttribute="centerY" secondItem="VAn-gF-QiZ" secondAttribute="centerY" id="H5N-j9-THf"/> <constraint firstAttribute="bottom" secondItem="VAn-gF-QiZ" secondAttribute="bottom" id="Kp0-Hx-3Ek"/> diff --git a/modules/gui/macosx/extensions/NSFont+VLCAdditions.h b/modules/gui/macosx/extensions/NSFont+VLCAdditions.h index b2957c53ed..bb23598fb0 100644 --- a/modules/gui/macosx/extensions/NSFont+VLCAdditions.h +++ b/modules/gui/macosx/extensions/NSFont+VLCAdditions.h @@ -32,8 +32,10 @@ extern NSString *VLCMacOSXInterfaceLargeTextSettingChanged; + (instancetype)VLClibraryHighlightCellTitleFont; + (instancetype)VLClibraryHighlightCellSubtitleFont; + (instancetype)VLClibraryHighlightCellHighlightLabelFont; -+ (instancetype)VLClibraryCellTitleFont; -+ (instancetype)VLClibraryCellSubtitleFont; ++ (instancetype)VLClibraryLargeCellTitleFont; ++ (instancetype)VLClibraryLargeCellSubtitleFont; ++ (instancetype)VLClibrarySmallCellTitleFont; ++ (instancetype)VLClibrarySmallCellSubtitleFont; + (instancetype)VLClibraryCellAnnotationFont; + (instancetype)VLClibraryButtonFont; + (instancetype)VLCplaylistLabelFont; diff --git a/modules/gui/macosx/extensions/NSFont+VLCAdditions.m b/modules/gui/macosx/extensions/NSFont+VLCAdditions.m index fddd4dede2..98692a08a5 100644 --- a/modules/gui/macosx/extensions/NSFont+VLCAdditions.m +++ b/modules/gui/macosx/extensions/NSFont+VLCAdditions.m @@ -46,16 +46,26 @@ NSString *VLCMacOSXInterfaceLargeTextSettingChanged = @"VLCMacOSXInterfaceLargeT return [NSFont systemFontOfSize:11. weight:NSFontWeightBold]; } -+ (instancetype)VLClibraryCellTitleFont ++ (instancetype)VLClibraryLargeCellTitleFont { return [NSFont systemFontOfSize:17. weight:NSFontWeightMedium]; } -+ (instancetype)VLClibraryCellSubtitleFont ++ (instancetype)VLClibraryLargeCellSubtitleFont { return [NSFont systemFontOfSize:13. weight:NSFontWeightSemibold]; } ++ (instancetype)VLClibrarySmallCellTitleFont +{ + return [NSFont systemFontOfSize:13. weight:NSFontWeightMedium]; +} + ++ (instancetype)VLClibrarySmallCellSubtitleFont +{ + return [NSFont systemFontOfSize:10. weight:NSFontWeightSemibold]; +} + + (instancetype)VLClibraryCellAnnotationFont { return [NSFont systemFontOfSize:15. weight:NSFontWeightBold]; diff --git a/modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m b/modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m index 7c475a5c83..ec216b9415 100644 --- a/modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m +++ b/modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m @@ -50,9 +50,9 @@ const CGFloat VLCLibraryTracksRowHeight = 50.; - (void)awakeFromNib { - self.albumNameTextField.font = [NSFont VLClibraryCellTitleFont]; - self.yearTextField.font = [NSFont VLClibraryCellTitleFont]; - self.summaryTextField.font = [NSFont VLClibraryCellSubtitleFont]; + self.albumNameTextField.font = [NSFont VLClibraryLargeCellTitleFont]; + self.yearTextField.font = [NSFont VLClibraryLargeCellTitleFont]; + self.summaryTextField.font = [NSFont VLClibraryLargeCellSubtitleFont]; self.trackingView.viewToHide = self.playInstantlyButton; [self prepareForReuse]; } diff --git a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m index 7c40d68e66..293ad84ff9 100644 --- a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m +++ b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m @@ -52,9 +52,15 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95; { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(mediaItemUpdated:) - name:VLCLibraryModelMediaItemUpdated object:nil]; + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + [notificationCenter addObserver:self + selector:@selector(mediaItemUpdated:) + name:VLCLibraryModelMediaItemUpdated + object:nil]; + [notificationCenter addObserver:self + selector:@selector(updateFontBasedOnSetting:) + name:VLCMacOSXInterfaceLargeTextSettingChanged + object:nil]; } return self; } @@ -70,8 +76,6 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95; - (void)awakeFromNib { [(VLCTrackingView *)self.view setViewToHide:self.playInstantlyButton]; - self.mediaTitleTextField.font = [NSFont VLClibraryCellTitleFont]; - self.durationTextField.font = [NSFont VLClibraryCellSubtitleFont]; self.durationTextField.textColor = [NSColor VLClibrarySubtitleColor]; self.annotationTextField.font = [NSFont VLClibraryCellAnnotationFont]; self.annotationTextField.textColor = [NSColor VLClibraryAnnotationColor]; @@ -88,9 +92,12 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95; } [self updateColoredAppearance]; + [self updateFontBasedOnSetting:nil]; [self prepareForReuse]; } +#pragma mark - dynamic appearance + - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change @@ -104,6 +111,17 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95; self.mediaTitleTextField.textColor = self.view.shouldShowDarkAppearance ? [NSColor VLClibraryDarkTitleColor] : [NSColor VLClibraryLightTitleColor]; } +- (void)updateFontBasedOnSetting:(NSNotification *)aNotification +{ + if (config_GetInt("macosx-large-text")) { + self.mediaTitleTextField.font = [NSFont VLClibraryLargeCellTitleFont]; + self.durationTextField.font = [NSFont VLClibraryLargeCellSubtitleFont]; + } else { + self.mediaTitleTextField.font = [NSFont VLClibrarySmallCellTitleFont]; + self.durationTextField.font = [NSFont VLClibrarySmallCellSubtitleFont]; + } +} + #pragma mark - view representation - (void)prepareForReuse diff --git a/modules/gui/macosx/library/VLCLibraryTableCellView.m b/modules/gui/macosx/library/VLCLibraryTableCellView.m index cccd6adee5..b12e78dcf8 100644 --- a/modules/gui/macosx/library/VLCLibraryTableCellView.m +++ b/modules/gui/macosx/library/VLCLibraryTableCellView.m @@ -38,9 +38,9 @@ - (void)awakeFromNib { - self.singlePrimaryTitleTextField.font = [NSFont VLClibraryCellTitleFont]; - self.primaryTitleTextField.font = [NSFont VLClibraryCellTitleFont]; - self.secondaryTitleTextField.font = [NSFont VLClibraryCellSubtitleFont]; + self.singlePrimaryTitleTextField.font = [NSFont VLClibraryLargeCellTitleFont]; + self.primaryTitleTextField.font = [NSFont VLClibraryLargeCellTitleFont]; + self.secondaryTitleTextField.font = [NSFont VLClibraryLargeCellSubtitleFont]; [self prepareForReuse]; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
