[vlc-commits] macosx/audio list: move from 3 columns to 2 columns for the list layout
Felix Paul Kühne
git at videolan.org
Tue Aug 13 11:48:29 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue Aug 13 11:10:15 2019 +0200| [8488a90530b83d450eed087685307c8a45808a5b] | committer: Felix Paul Kühne
macosx/audio list: move from 3 columns to 2 columns for the list layout
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8488a90530b83d450eed087685307c8a45808a5b
---
modules/gui/macosx/UI/VLCLibraryWindow.xib | 92 ++++------------------
.../VLCLibraryAlternativeAudioViewController.m | 8 +-
.../gui/macosx/library/VLCLibraryAudioDataSource.h | 5 +-
.../gui/macosx/library/VLCLibraryAudioDataSource.m | 58 +++++++-------
modules/gui/macosx/library/VLCLibraryWindow.h | 1 -
modules/gui/macosx/library/VLCLibraryWindow.m | 7 +-
6 files changed, 57 insertions(+), 114 deletions(-)
diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib b/modules/gui/macosx/UI/VLCLibraryWindow.xib
index a7be7373a2..4349aa21a1 100644
--- a/modules/gui/macosx/UI/VLCLibraryWindow.xib
+++ b/modules/gui/macosx/UI/VLCLibraryWindow.xib
@@ -513,7 +513,6 @@
<outlet property="alternativeAudioCollectionView" destination="QAt-jP-zE7" id="269-UN-dfM"/>
<outlet property="alternativeAudioSegmentedControl" destination="8iI-b7-Eag" id="ZYQ-79-H8k"/>
<outlet property="alternativeAudioView" destination="k7f-ic-LrF" id="8Cp-d2-3UJ"/>
- <outlet property="audioCategorySelectionTableView" destination="dNP-8u-8iI" id="KiD-PX-T2p"/>
<outlet property="audioCollectionSelectionTableView" destination="LNt-ot-2wU" id="eJS-WZ-Ri7"/>
<outlet property="audioGroupSelectionTableView" destination="4ll-T2-J16" id="bjS-a8-ePC"/>
<outlet property="audioLibrarySplitView" destination="llh-BF-BEJ" id="Uri-tX-OQS"/>
@@ -647,81 +646,21 @@
<rect key="frame" x="0.0" y="0.0" width="508" height="327"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
- <scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="38" horizontalPageScroll="10" verticalLineScroll="38" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="BbK-Tj-iCB">
- <rect key="frame" x="0.0" y="0.0" width="155" height="327"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
- <clipView key="contentView" id="dmB-cB-az6">
- <rect key="frame" x="0.0" y="0.0" width="155" height="327"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <subviews>
- <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" rowHeight="36" rowSizeStyle="large" viewBased="YES" id="dNP-8u-8iI">
- <rect key="frame" x="0.0" y="0.0" width="155" height="327"/>
- <autoresizingMask key="autoresizingMask"/>
- <size key="intercellSpacing" width="3" height="2"/>
- <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
- <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
- <tableColumns>
- <tableColumn width="152" minWidth="40" maxWidth="1000" id="ldG-xS-ywp">
- <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
- <font key="font" metaFont="smallSystem"/>
- <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
- <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
- </tableHeaderCell>
- <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="mIp-tF-277">
- <font key="font" metaFont="system"/>
- <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
- <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
- </textFieldCell>
- <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
- <prototypeCellViews>
- <tableCellView id="iS7-pe-SOa">
- <rect key="frame" x="1" y="1" width="152" height="17"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <subviews>
- <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jff-ZN-6z1">
- <rect key="frame" x="0.0" y="0.0" width="152" height="17"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
- <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="smc-Zb-hk9">
- <font key="font" metaFont="system"/>
- <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
- <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
- </textFieldCell>
- </textField>
- </subviews>
- <connections>
- <outlet property="textField" destination="jff-ZN-6z1" id="JTF-tq-wQB"/>
- </connections>
- </tableCellView>
- </prototypeCellViews>
- </tableColumn>
- </tableColumns>
- </tableView>
- </subviews>
- </clipView>
- <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="ddc-LV-cIL">
- <rect key="frame" x="0.0" y="311" width="155" height="16"/>
- <autoresizingMask key="autoresizingMask"/>
- </scroller>
- <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="VgV-Ti-WiA">
- <rect key="frame" x="224" y="17" width="15" height="102"/>
- <autoresizingMask key="autoresizingMask"/>
- </scroller>
- </scrollView>
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="HrP-Dz-Uh0">
- <rect key="frame" x="156" y="0.0" width="154" height="327"/>
+ <rect key="frame" x="0.0" y="0.0" width="222" height="327"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" id="qva-RZ-DvL">
- <rect key="frame" x="0.0" y="0.0" width="154" height="327"/>
+ <rect key="frame" x="0.0" y="0.0" width="222" height="327"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" viewBased="YES" id="LNt-ot-2wU">
- <rect key="frame" x="0.0" y="0.0" width="154" height="327"/>
+ <rect key="frame" x="0.0" y="0.0" width="222" height="327"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
- <tableColumn width="151" minWidth="40" maxWidth="1000" id="z5o-3O-6vc">
+ <tableColumn width="219" minWidth="40" maxWidth="1000" id="z5o-3O-6vc">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -735,11 +674,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="EIR-sY-f8g">
- <rect key="frame" x="1" y="1" width="151" height="17"/>
+ <rect key="frame" x="1" y="1" width="219" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xaz-WB-iQI">
- <rect key="frame" x="0.0" y="0.0" width="151" height="17"/>
+ <rect key="frame" x="0.0" y="0.0" width="219" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="zRF-hR-42C">
<font key="font" metaFont="system"/>
@@ -768,20 +707,20 @@
</scroller>
</scrollView>
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="Jmx-bp-HDp">
- <rect key="frame" x="311" y="0.0" width="197" height="327"/>
+ <rect key="frame" x="223" y="0.0" width="285" height="327"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" id="xCC-h9-931">
- <rect key="frame" x="0.0" y="0.0" width="197" height="327"/>
+ <rect key="frame" x="0.0" y="0.0" width="285" height="327"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="4ll-T2-J16">
- <rect key="frame" x="0.0" y="0.0" width="197" height="327"/>
+ <rect key="frame" x="0.0" y="0.0" width="285" height="327"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
- <tableColumn width="194" minWidth="40" maxWidth="1000" id="WLd-Pi-bR4">
+ <tableColumn width="282" minWidth="40" maxWidth="1000" id="WLd-Pi-bR4">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -795,11 +734,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="iSk-Qz-DTG">
- <rect key="frame" x="1" y="1" width="194" height="17"/>
+ <rect key="frame" x="1" y="1" width="282" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6ht-Tg-XJ9">
- <rect key="frame" x="0.0" y="0.0" width="194" height="17"/>
+ <rect key="frame" x="0.0" y="0.0" width="282" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="dbf-tg-Ss3">
<font key="font" metaFont="system"/>
@@ -831,7 +770,6 @@
<holdingPriorities>
<real value="250"/>
<real value="250"/>
- <real value="250"/>
</holdingPriorities>
<point key="canvasLocation" x="109" y="-224.5"/>
</splitView>
@@ -843,7 +781,7 @@
<rect key="frame" x="0.0" y="0.0" width="500" height="302"/>
<clipView key="contentView" id="2oa-WL-dxA">
<rect key="frame" x="0.0" y="0.0" width="500" height="302"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <autoresizingMask key="autoresizingMask"/>
<subviews>
<collectionView id="QAt-jP-zE7">
<rect key="frame" x="0.0" y="0.0" width="500" height="302"/>
@@ -881,7 +819,7 @@
<rect key="frame" x="0.0" y="0.0" width="528" height="267"/>
<clipView key="contentView" id="5co-vI-cEn">
<rect key="frame" x="0.0" y="0.0" width="528" height="267"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <autoresizingMask key="autoresizingMask"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" viewBased="YES" id="vpJ-Oz-Ebz">
<rect key="frame" x="0.0" y="0.0" width="528" height="267"/>
@@ -940,7 +878,7 @@
<rect key="frame" x="0.0" y="0.0" width="528" height="267"/>
<clipView key="contentView" id="tI4-x3-55j">
<rect key="frame" x="0.0" y="0.0" width="528" height="267"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <autoresizingMask key="autoresizingMask"/>
<subviews>
<collectionView selectable="YES" id="r7v-GI-W1U">
<rect key="frame" x="0.0" y="0.0" width="528" height="267"/>
diff --git a/modules/gui/macosx/library/VLCLibraryAlternativeAudioViewController.m b/modules/gui/macosx/library/VLCLibraryAlternativeAudioViewController.m
index d6ab05ffa4..b49e840db0 100644
--- a/modules/gui/macosx/library/VLCLibraryAlternativeAudioViewController.m
+++ b/modules/gui/macosx/library/VLCLibraryAlternativeAudioViewController.m
@@ -46,8 +46,6 @@
for (NSUInteger x = 0; x < availableCollectionsCount; x++) {
[self.segmentedControl setLabel:availableCollections[x] forSegment:x];
}
- [self.segmentedControl setTarget:self];
- [self.segmentedControl setAction:@selector(segmentedControlAction:)];
_collectionView.dataSource = self;
_collectionView.delegate = self;
@@ -58,11 +56,17 @@
flowLayout.minimumLineSpacing = 20.;
flowLayout.minimumInteritemSpacing = 20.;
+ [self.segmentedControl setTarget:self];
+ [self.segmentedControl setAction:@selector(segmentedControlAction:)];
[self segmentedControlAction:nil];
}
- (void)reloadAppearance
{
+ [self.segmentedControl setTarget:self];
+ [self.segmentedControl setAction:@selector(segmentedControlAction:)];
+ [self segmentedControlAction:nil];
+
[self.collectionView reloadData];
}
diff --git a/modules/gui/macosx/library/VLCLibraryAudioDataSource.h b/modules/gui/macosx/library/VLCLibraryAudioDataSource.h
index 016ddd8e4b..e90a0c8714 100644
--- a/modules/gui/macosx/library/VLCLibraryAudioDataSource.h
+++ b/modules/gui/macosx/library/VLCLibraryAudioDataSource.h
@@ -32,10 +32,13 @@ NS_ASSUME_NONNULL_BEGIN
@property (readwrite, assign) VLCLibraryModel *libraryModel;
@property (readwrite, assign) VLCLibraryGroupDataSource *groupDataSource;
- at property (readwrite, assign) NSTableView *categorySelectionTableView;
+ at property (readwrite, assign) NSSegmentedControl *segmentedControl;
@property (readwrite, assign) NSTableView *collectionSelectionTableView;
@property (readwrite, assign) NSTableView *groupSelectionTableView;
+- (void)setupAppearance;
+- (void)reloadAppearance;
+
@end
@interface VLCLibraryGroupDataSource : NSObject <NSTableViewDataSource, NSTableViewDelegate>
diff --git a/modules/gui/macosx/library/VLCLibraryAudioDataSource.m b/modules/gui/macosx/library/VLCLibraryAudioDataSource.m
index cb3adc788e..bb0701e11c 100644
--- a/modules/gui/macosx/library/VLCLibraryAudioDataSource.m
+++ b/modules/gui/macosx/library/VLCLibraryAudioDataSource.m
@@ -32,32 +32,47 @@
static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier";
- at interface VLCLibraryAudioDataSource()
-{
- NSArray *_availableCollectionsArray;
-}
- at end
-
@implementation VLCLibraryAudioDataSource
- (instancetype)init
{
self = [super init];
- if (self) {
- _availableCollectionsArray = [VLCLibraryModel availableAudioCollections];
- }
return self;
}
-- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
+- (void)setupAppearance
{
- if (tableView == self.categorySelectionTableView) {
- return _availableCollectionsArray.count;
+ NSArray *availableCollections = [VLCLibraryModel availableAudioCollections];
+ NSUInteger availableCollectionsCount = availableCollections.count;
+ self.segmentedControl.segmentCount = availableCollectionsCount;
+ for (NSUInteger x = 0; x < availableCollectionsCount; x++) {
+ [self.segmentedControl setLabel:availableCollections[x] forSegment:x];
}
+ [self reloadAppearance];
+}
+
+- (void)reloadAppearance
+{
+ [self.segmentedControl setTarget:self];
+ [self.segmentedControl setAction:@selector(segmentedControlAction:)];
+ [self segmentedControlAction:nil];
+
+ [self.collectionSelectionTableView reloadData];
+ [self.groupSelectionTableView reloadData];
+}
+
+- (IBAction)segmentedControlAction:(id)sender
+{
+ [self.collectionSelectionTableView reloadData];
+ [self.groupSelectionTableView reloadData];
+}
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
+{
NSInteger ret = 0;
- switch (self.categorySelectionTableView.selectedRow) {
+ switch (_segmentedControl.selectedSegment) {
case 0: // artists
ret = _libraryModel.numberOfArtists;
break;
@@ -103,15 +118,7 @@ static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier
cellView.identifier = VLCAudioLibraryCellIdentifier;
}
- if (tableView == self.categorySelectionTableView) {
- cellView.singlePrimaryTitleTextField.hidden = NO;
- cellView.singlePrimaryTitleTextField.stringValue = _availableCollectionsArray[row];
- NSImage *image = [NSImage imageNamed:NSImageNameApplicationIcon];
- cellView.representedImageView.image = image;
- return cellView;
- }
-
- switch (self.categorySelectionTableView.selectedRow) {
+ switch (self.segmentedControl.selectedSegment) {
case 0: // artists
{
NSArray *listOfArtists = [_libraryModel listOfArtists];
@@ -212,12 +219,7 @@ static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier
- (void)tableViewSelectionDidChange:(NSNotification *)notification
{
- if (notification.object == self.categorySelectionTableView) {
- [self.collectionSelectionTableView reloadData];
- return;
- }
-
- switch (self.categorySelectionTableView.selectedRow) {
+ switch (self.segmentedControl.selectedSegment) {
case 0: // artists
{
NSArray *listOfArtists = [_libraryModel listOfArtists];
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.h b/modules/gui/macosx/library/VLCLibraryWindow.h
index ce72c4ed64..0ec8521353 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.h
+++ b/modules/gui/macosx/library/VLCLibraryWindow.h
@@ -44,7 +44,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (readwrite, weak) IBOutlet NSCollectionView *recentVideoLibraryCollectionView;
@property (readwrite, weak) IBOutlet NSCollectionView *mediaSourceCollectionView;
@property (readwrite, weak) IBOutlet NSSplitView *audioLibrarySplitView;
- at property (readwrite, weak) IBOutlet NSTableView *audioCategorySelectionTableView;
@property (readwrite, weak) IBOutlet NSTableView *audioCollectionSelectionTableView;
@property (readwrite, weak) IBOutlet NSTableView *audioGroupSelectionTableView;
@property (readwrite, weak) IBOutlet NSView *mediaSourceView;
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m
index 97f091fb91..1f56bcebb1 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.m
+++ b/modules/gui/macosx/library/VLCLibraryWindow.m
@@ -222,12 +222,9 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
_libraryAudioDataSource = [[VLCLibraryAudioDataSource alloc] init];
_libraryAudioDataSource.libraryModel = mainInstance.libraryController.libraryModel;
- _libraryAudioDataSource.categorySelectionTableView = _audioCategorySelectionTableView;
_libraryAudioDataSource.collectionSelectionTableView = _audioCollectionSelectionTableView;
_libraryAudioDataSource.groupSelectionTableView = _audioGroupSelectionTableView;
- _audioCategorySelectionTableView.dataSource = _libraryAudioDataSource;
- _audioCategorySelectionTableView.delegate = _libraryAudioDataSource;
- _audioCategorySelectionTableView.rowHeight = VLCLibraryWindowSmallRowHeight;
+ _libraryAudioDataSource.segmentedControl = self.alternativeAudioSegmentedControl;
_audioCollectionSelectionTableView.dataSource = _libraryAudioDataSource;
_audioCollectionSelectionTableView.delegate = _libraryAudioDataSource;
_audioCollectionSelectionTableView.rowHeight = VLCLibraryWindowLargeRowHeight;
@@ -405,7 +402,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
[_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_audioLibrarySplitView(>=572.)]|" options:0 metrics:0 views:dict]];
[_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_audioLibrarySplitView(>=444.)]|" options:0 metrics:0 views:dict]];
}
- [_audioCategorySelectionTableView reloadData];
+ [_libraryAudioDataSource reloadAppearance];
[_audioCollectionSelectionTableView reloadData];
_librarySortButton.hidden = NO;
_alternativeAudioSegmentedControl.hidden = NO;
More information about the vlc-commits
mailing list