[vlc-commits] [Git][videolan/vlc][master] 6 commits: macosx: Disable autoresizingmask translation to constraints in convenience NSTextField label ctor
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Apr 25 05:08:27 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
0d99182d by Claudio Cambra at 2025-04-25T04:53:16+00:00
macosx: Disable autoresizingmask translation to constraints in convenience NSTextField label ctor
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1a6fc559 by Claudio Cambra at 2025-04-25T04:53:16+00:00
macosx: Use convenience defaultLabelWithString textfield in carousel container view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
132c8b94 by Claudio Cambra at 2025-04-25T04:53:16+00:00
macosx: Use convenience defaultLabelWithString textfield in media source view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1b1238cc by Claudio Cambra at 2025-04-25T04:53:16+00:00
macosx: Use convenience defaultLabelWithString textField in library window sidebar root view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1c093668 by Claudio Cambra at 2025-04-25T04:53:16+00:00
macosx: Use conveninece defaultLabelWithString textField in information window controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
823158d2 by Claudio Cambra at 2025-04-25T04:53:16+00:00
macosx: Use convenience defaultLabelWithString textField in prefs widgets
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
6 changed files:
- modules/gui/macosx/extensions/NSTextField+VLCAdditions.m
- modules/gui/macosx/library/VLCLibraryWindowSidebarRootViewController.m
- modules/gui/macosx/library/home-library/VLCLibraryHomeViewBaseCarouselContainerView.m
- modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.m
- modules/gui/macosx/panels/VLCInformationWindowController.m
- modules/gui/macosx/preferences/prefs_widgets.m
Changes:
=====================================
modules/gui/macosx/extensions/NSTextField+VLCAdditions.m
=====================================
@@ -26,9 +26,13 @@
+ (instancetype)defaultLabelWithString:(NSString *)stringValue
{
- if (@available(macOS 10.12, *))
- return [NSTextField wrappingLabelWithString:stringValue];
+ if (@available(macOS 10.12, *)) {
+ NSTextField * const textField = [NSTextField wrappingLabelWithString:stringValue];
+ textField.translatesAutoresizingMaskIntoConstraints = NO;
+ return textField;
+ }
NSTextField * const textField = [[NSTextField alloc] initWithFrame:NSZeroRect];
+ textField.translatesAutoresizingMaskIntoConstraints = NO;
textField.stringValue = stringValue;
textField.editable = NO;
textField.bordered = NO;
=====================================
modules/gui/macosx/library/VLCLibraryWindowSidebarRootViewController.m
=====================================
@@ -24,6 +24,7 @@
#import "extensions/NSFont+VLCAdditions.h"
#import "extensions/NSString+Helpers.h"
+#import "extensions/NSTextField+VLCAdditions.h"
#import "extensions/NSView+VLCAdditions.h"
#import "extensions/NSWindow+VLCAdditions.h"
@@ -92,12 +93,8 @@
- (void)setupPlayQueueTitle
{
- _playQueueHeaderLabel = [[NSTextField alloc] init];
- self.playQueueHeaderLabel.translatesAutoresizingMaskIntoConstraints = NO;
+ _playQueueHeaderLabel = [NSTextField defaultLabelWithString:@""];
self.playQueueHeaderLabel.font = NSFont.VLCLibrarySubsectionHeaderFont;
- self.playQueueHeaderLabel.editable = NO;
- self.playQueueHeaderLabel.bezeled = NO;
- self.playQueueHeaderLabel.drawsBackground = NO;
self.playQueueHeaderLabel.textColor = NSColor.headerTextColor;
[self.view addSubview:self.playQueueHeaderLabel];
=====================================
modules/gui/macosx/library/home-library/VLCLibraryHomeViewBaseCarouselContainerView.m
=====================================
@@ -24,6 +24,7 @@
#import "extensions/NSFont+VLCAdditions.h"
#import "extensions/NSString+Helpers.h"
+#import "extensions/NSTextField+VLCAdditions.h"
#import "library/VLCLibraryDataTypes.h"
#import "library/VLCLibraryCarouselViewItemView.h"
@@ -84,14 +85,10 @@
- (void)setupView
{
- _titleView = [[NSTextField alloc] init];
+ _titleView = [NSTextField defaultLabelWithString:@""];
self.titleView.font = NSFont.VLClibrarySectionHeaderFont;
self.titleView.textColor = NSColor.headerTextColor;
- self.titleView.selectable = NO;
- self.titleView.bordered = NO;
- self.titleView.drawsBackground = NO;
[self addSubview:self.titleView];
- self.titleView.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[
[self.leadingAnchor constraintEqualToAnchor:self.titleView.leadingAnchor],
[self.trailingAnchor constraintEqualToAnchor:self.titleView.trailingAnchor],
=====================================
modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.m
=====================================
@@ -28,6 +28,7 @@
#import "extensions/NSFont+VLCAdditions.h"
#import "extensions/NSString+Helpers.h"
+#import "extensions/NSTextField+VLCAdditions.h"
#import "extensions/NSWindow+VLCAdditions.h"
#import "library/VLCLibraryCollectionView.h"
@@ -123,19 +124,11 @@
- (void)setupPlaceholderLabel
{
- if (@available(macOS 10.12, *)) {
- _browsePlaceholderLabel = [NSTextField labelWithString:_NS("No files")];
- } else {
- _browsePlaceholderLabel = [[NSTextField alloc] init];
- self.browsePlaceholderLabel.stringValue = _NS("No files");
- self.browsePlaceholderLabel.editable = NO;
- }
+ _browsePlaceholderLabel = [NSTextField defaultLabelWithString:_NS("No files")];
self.browsePlaceholderLabel.font = NSFont.VLClibrarySectionHeaderFont;
self.browsePlaceholderLabel.textColor = NSColor.secondaryLabelColor;
self.browsePlaceholderLabel.alignment = NSTextAlignmentCenter;
self.browsePlaceholderLabel.backgroundColor = NSColor.clearColor;
- self.browsePlaceholderLabel.bezeled = NO;
- self.browsePlaceholderLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.mediaSourceView addSubview:self.browsePlaceholderLabel];
[self.mediaSourceView addConstraints:@[
[self.browsePlaceholderLabel.centerXAnchor constraintEqualToAnchor:self.mediaSourceView.centerXAnchor],
=====================================
modules/gui/macosx/panels/VLCInformationWindowController.m
=====================================
@@ -25,6 +25,7 @@
#import "extensions/NSImage+VLCAdditions.h"
#import "extensions/NSString+Helpers.h"
+#import "extensions/NSTextField+VLCAdditions.h"
#import "library/VLCInputItem.h"
#import "library/VLCLibraryController.h"
@@ -757,12 +758,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
viewForTableColumn:(nullable NSTableColumn *)tableColumn
item:(nonnull id)item
{
- NSTextField * const cellView = [[NSTextField alloc] initWithFrame:NSZeroRect];
+ NSTextField * const cellView = [NSTextField defaultLabelWithString:@""];
cellView.objectValue =
[self outlineView:self.outlineView objectValueForTableColumn:tableColumn byItem:item];
- cellView.editable = NO;
- cellView.bordered = NO;
- cellView.drawsBackground = NO;
return cellView;
}
=====================================
modules/gui/macosx/preferences/prefs_widgets.m
=====================================
@@ -37,10 +37,11 @@
#include <vlc_plugin.h>
#include <vlc_actions.h>
-#include "library/VLCLibraryUIUnits.h"
-#include "main/VLCMain.h"
-#include "extensions/NSString+Helpers.h"
-#include "preferences/prefs_widgets.h"
+#import "library/VLCLibraryUIUnits.h"
+#import "main/VLCMain.h"
+#import "extensions/NSString+Helpers.h"
+#import "extensions/NSTextField+VLCAdditions.h"
+#import "preferences/prefs_widgets.h"
NSString * const VLCPrefsWidgetModuleDragType = @"VLC media player module";
@@ -63,12 +64,9 @@ NSString * const VLCPrefsWidgetModuleDragType = @"VLC media player module";
s_rc.size.height = 17; \
s_rc.origin.x = x_offset - 3; \
s_rc.origin.y = superFrame.size.height - 17 + my_y_offset; \
- o_label = [[NSTextField alloc] initWithFrame: s_rc]; \
- [o_label setDrawsBackground: NO]; \
- [o_label setBordered: NO]; \
- [o_label setEditable: NO]; \
+ o_label = [NSTextField defaultLabelWithString:label]; \
+ o_label.frame = s_rc; \
[o_label setSelectable: NO]; \
- [o_label setStringValue: label]; \
[o_label setToolTip: tooltip]; \
[o_label setFont:[NSFont systemFontOfSize:0]]; \
[o_label sizeToFit]; \
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/213bdb0b752644f2f0b4f7ebdbc52ce9b2a0ad60...823158d246b3090d8b56aee483040b2239a69dce
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/213bdb0b752644f2f0b4f7ebdbc52ce9b2a0ad60...823158d246b3090d8b56aee483040b2239a69dce
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list