Commit e49882a7 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/library window: implement library view and fill with sample data

parent b6fbbfce
...@@ -119,6 +119,7 @@ ...@@ -119,6 +119,7 @@
6BF093F91EE0182B0049D8B0 /* VLCTimeField.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF093F81EE0182B0049D8B0 /* VLCTimeField.m */; }; 6BF093F91EE0182B0049D8B0 /* VLCTimeField.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF093F81EE0182B0049D8B0 /* VLCTimeField.m */; };
6BF5C5041EFE66EF008A9C12 /* VLCHUDTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF5C5031EFE66EF008A9C12 /* VLCHUDTableView.m */; }; 6BF5C5041EFE66EF008A9C12 /* VLCHUDTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF5C5031EFE66EF008A9C12 /* VLCHUDTableView.m */; };
7D0F63FF2201F63400FDB91F /* VLCPlaylistTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */; }; 7D0F63FF2201F63400FDB91F /* VLCPlaylistTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */; };
7D0F64062202047900FDB91F /* VLCLibraryCollectionViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D0F64042202047900FDB91F /* VLCLibraryCollectionViewItem.m */; };
7D2E0EDB20CD204D0033A221 /* VLCWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0ED920CD204D0033A221 /* VLCWindow.m */; }; 7D2E0EDB20CD204D0033A221 /* VLCWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0ED920CD204D0033A221 /* VLCWindow.m */; };
7D2E0EDE20CD206F0033A221 /* VLCVideoWindowCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0EDD20CD206F0033A221 /* VLCVideoWindowCommon.m */; }; 7D2E0EDE20CD206F0033A221 /* VLCVideoWindowCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0EDD20CD206F0033A221 /* VLCVideoWindowCommon.m */; };
7D66D4362200BC340040D04A /* VLCClickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66D4352200BC340040D04A /* VLCClickerManager.m */; }; 7D66D4362200BC340040D04A /* VLCClickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66D4352200BC340040D04A /* VLCClickerManager.m */; };
...@@ -436,6 +437,11 @@ ...@@ -436,6 +437,11 @@
7D0F63FD2201F63400FDB91F /* VLCPlaylistTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistTableCellView.h; sourceTree = "<group>"; }; 7D0F63FD2201F63400FDB91F /* VLCPlaylistTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistTableCellView.h; sourceTree = "<group>"; };
7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistTableCellView.m; sourceTree = "<group>"; }; 7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistTableCellView.m; sourceTree = "<group>"; };
7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCPlaylistTableCellView.xib; sourceTree = "<group>"; }; 7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCPlaylistTableCellView.xib; sourceTree = "<group>"; };
7D0F64032202047900FDB91F /* VLCLibraryCollectionViewItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryCollectionViewItem.h; sourceTree = "<group>"; };
7D0F64042202047900FDB91F /* VLCLibraryCollectionViewItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryCollectionViewItem.m; sourceTree = "<group>"; };
7D0F64052202047900FDB91F /* VLCLibraryCollectionViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCLibraryCollectionViewItem.xib; sourceTree = "<group>"; };
7D0F64082202058700FDB91F /* libraryCellGradient@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "libraryCellGradient@1x.png"; path = "../librarywindow/libraryCellGradient@1x.png"; sourceTree = "<group>"; };
7D0F64092202058700FDB91F /* libraryCellGradient@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "libraryCellGradient@2x.png"; path = "../librarywindow/libraryCellGradient@2x.png"; sourceTree = "<group>"; };
7D2E0ED920CD204D0033A221 /* VLCWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCWindow.m; sourceTree = "<group>"; }; 7D2E0ED920CD204D0033A221 /* VLCWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCWindow.m; sourceTree = "<group>"; };
7D2E0EDA20CD204D0033A221 /* VLCWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCWindow.h; sourceTree = "<group>"; }; 7D2E0EDA20CD204D0033A221 /* VLCWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCWindow.h; sourceTree = "<group>"; };
7D2E0EDC20CD206F0033A221 /* VLCVideoWindowCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCVideoWindowCommon.h; sourceTree = "<group>"; }; 7D2E0EDC20CD206F0033A221 /* VLCVideoWindowCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCVideoWindowCommon.h; sourceTree = "<group>"; };
...@@ -975,6 +981,15 @@ ...@@ -975,6 +981,15 @@
name = "Streaming and Remote Playback"; name = "Streaming and Remote Playback";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
7D0F64072202057C00FDB91F /* Library Window */ = {
isa = PBXGroup;
children = (
7D0F64082202058700FDB91F /* libraryCellGradient@1x.png */,
7D0F64092202058700FDB91F /* libraryCellGradient@2x.png */,
);
path = "Library Window";
sourceTree = "<group>";
};
7D2E0ED820CD201F0033A221 /* Windows */ = { 7D2E0ED820CD201F0033A221 /* Windows */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -1295,6 +1310,8 @@ ...@@ -1295,6 +1310,8 @@
7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */, 7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */,
7D0F63FD2201F63400FDB91F /* VLCPlaylistTableCellView.h */, 7D0F63FD2201F63400FDB91F /* VLCPlaylistTableCellView.h */,
7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */, 7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */,
7D0F64032202047900FDB91F /* VLCLibraryCollectionViewItem.h */,
7D0F64042202047900FDB91F /* VLCLibraryCollectionViewItem.m */,
); );
name = "Library Window"; name = "Library Window";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1408,6 +1425,7 @@ ...@@ -1408,6 +1425,7 @@
CC0430EE13B2461A00D7D52E /* UI Graphics */ = { CC0430EE13B2461A00D7D52E /* UI Graphics */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
7D0F64072202057C00FDB91F /* Library Window */,
6B82255A1E4D2BE400833BE1 /* Main Window */, 6B82255A1E4D2BE400833BE1 /* Main Window */,
6B8229CB1E4D2D2C00833BE1 /* Sidebar Icons */, 6B8229CB1E4D2D2C00833BE1 /* Sidebar Icons */,
6B8229FD1E4D2DB400833BE1 /* noart.png */, 6B8229FD1E4D2DB400833BE1 /* noart.png */,
...@@ -1516,6 +1534,7 @@ ...@@ -1516,6 +1534,7 @@
6B82240A1E4D2A9000833BE1 /* MainWindow.xib */, 6B82240A1E4D2A9000833BE1 /* MainWindow.xib */,
7D713D332201BB130042BEB7 /* VLCLibraryWindow.xib */, 7D713D332201BB130042BEB7 /* VLCLibraryWindow.xib */,
7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */, 7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */,
7D0F64052202047900FDB91F /* VLCLibraryCollectionViewItem.xib */,
6B82241A1E4D2A9000833BE1 /* VLCStatusBarIconMainMenu.xib */, 6B82241A1E4D2A9000833BE1 /* VLCStatusBarIconMainMenu.xib */,
6B8224181E4D2A9000833BE1 /* VLCFullScreenPanel.xib */, 6B8224181E4D2A9000833BE1 /* VLCFullScreenPanel.xib */,
6B8223FE1E4D2A8F00833BE1 /* About.xib */, 6B8223FE1E4D2A8F00833BE1 /* About.xib */,
...@@ -1695,6 +1714,7 @@ ...@@ -1695,6 +1714,7 @@
6B0292E61F43256300A50082 /* VLCBottomBarView.m in Sources */, 6B0292E61F43256300A50082 /* VLCBottomBarView.m in Sources */,
1C3113C51E508C6900D4DD76 /* misc.m in Sources */, 1C3113C51E508C6900D4DD76 /* misc.m in Sources */,
1C3113C71E508C6900D4DD76 /* VLCOpenWindowController.m in Sources */, 1C3113C71E508C6900D4DD76 /* VLCOpenWindowController.m in Sources */,
7D0F64062202047900FDB91F /* VLCLibraryCollectionViewItem.m in Sources */,
7D713D322201AE350042BEB7 /* VLCLibraryWindow.m in Sources */, 7D713D322201AE350042BEB7 /* VLCLibraryWindow.m in Sources */,
1C3113C91E508C6900D4DD76 /* VLCOutput.m in Sources */, 1C3113C91E508C6900D4DD76 /* VLCOutput.m in Sources */,
1C1C62011F8260A90052DD4F /* VLCWrappableTextField.m in Sources */, 1C1C62011F8260A90052DD4F /* VLCWrappableTextField.m in Sources */,
......
...@@ -92,6 +92,7 @@ libmacosx_plugin_la_SOURCES = \ ...@@ -92,6 +92,7 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/VLCMainWindow.h gui/macosx/VLCMainWindow.m \ gui/macosx/VLCMainWindow.h gui/macosx/VLCMainWindow.m \
gui/macosx/VLCLibraryWindow.h gui/macosx/VLCLibraryWindow.m \ gui/macosx/VLCLibraryWindow.h gui/macosx/VLCLibraryWindow.m \
gui/macosx/VLCPlaylistTableCellView.h gui/macosx/VLCPlaylistTableCellView.m \ gui/macosx/VLCPlaylistTableCellView.h gui/macosx/VLCPlaylistTableCellView.m \
gui/macosx/VLCLibraryCollectionViewItem.h gui/macosx/VLCLibraryCollectionViewItem.m \
gui/macosx/VLCDetachedVideoWindow.h gui/macosx/VLCDetachedVideoWindow.m \ gui/macosx/VLCDetachedVideoWindow.h gui/macosx/VLCDetachedVideoWindow.m \
gui/macosx/VLCRendererDiscovery.h gui/macosx/VLCRendererDiscovery.m \ gui/macosx/VLCRendererDiscovery.h gui/macosx/VLCRendererDiscovery.m \
gui/macosx/VLCRendererItem.h gui/macosx/VLCRendererItem.m \ gui/macosx/VLCRendererItem.h gui/macosx/VLCRendererItem.m \
...@@ -152,6 +153,7 @@ libmacosx_plugin_la_XIB_SOURCES = \ ...@@ -152,6 +153,7 @@ libmacosx_plugin_la_XIB_SOURCES = \
gui/macosx/UI/MainWindow.xib \ gui/macosx/UI/MainWindow.xib \
gui/macosx/UI/VLCLibraryWindow.xib \ gui/macosx/UI/VLCLibraryWindow.xib \
gui/macosx/UI/VLCPlaylistTableCellView.xib \ gui/macosx/UI/VLCPlaylistTableCellView.xib \
gui/macosx/UI/VLCLibraryCollectionViewItem.xib \
gui/macosx/UI/MediaInfo.xib \ gui/macosx/UI/MediaInfo.xib \
gui/macosx/UI/Open.xib \ gui/macosx/UI/Open.xib \
gui/macosx/UI/PlaylistAccessoryView.xib \ gui/macosx/UI/PlaylistAccessoryView.xib \
...@@ -199,6 +201,8 @@ libmacosx_plugin_la_RES = \ ...@@ -199,6 +201,8 @@ libmacosx_plugin_la_RES = \
gui/macosx/Resources/File-Icons/wav.icns \ gui/macosx/Resources/File-Icons/wav.icns \
gui/macosx/Resources/File-Icons/wma.icns \ gui/macosx/Resources/File-Icons/wma.icns \
gui/macosx/Resources/File-Icons/wmv.icns \ gui/macosx/Resources/File-Icons/wmv.icns \
gui/macosx/Resources/librarywindow/libraryCellGradient@1x.png \
gui/macosx/Resources/librarywindow/libraryCellGradient@2x.png \
gui/macosx/Resources/mainwindow/backward-3btns-pressed.png \ gui/macosx/Resources/mainwindow/backward-3btns-pressed.png \
gui/macosx/Resources/mainwindow/backward-3btns-pressed@2x.png \ gui/macosx/Resources/mainwindow/backward-3btns-pressed@2x.png \
gui/macosx/Resources/mainwindow/backward-3btns.png \ gui/macosx/Resources/mainwindow/backward-3btns.png \
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCLibraryCollectionViewItem">
<connections>
<outlet property="mediaImageView" destination="vP5-5j-rVa" id="YJb-5w-9sW"/>
<outlet property="mediaTitleTextField" destination="OBS-Eh-1mT" id="h1n-PU-IAx"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vP5-5j-rVa">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" id="hY9-UD-hSk"/>
</imageView>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="A5y-ue-y7t">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="libraryCellGradient" id="kbU-NG-wPM"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OBS-Eh-1mT">
<rect key="frame" x="18" y="20" width="52" height="24"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="7Hy-o3-LvX">
<font key="font" size="20" name=".AppleSystemUIFont"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="A5y-ue-y7t" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="NpD-8l-D5s"/>
<constraint firstAttribute="bottom" secondItem="A5y-ue-y7t" secondAttribute="bottom" id="cnQ-bx-Fmn"/>
<constraint firstAttribute="bottom" secondItem="OBS-Eh-1mT" secondAttribute="bottom" constant="20" id="dy4-gP-Sdi"/>
<constraint firstAttribute="trailing" secondItem="A5y-ue-y7t" secondAttribute="trailing" id="rKQ-WW-oC6"/>
<constraint firstItem="A5y-ue-y7t" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="x7v-58-kKz"/>
<constraint firstItem="OBS-Eh-1mT" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="yvp-xr-geN"/>
</constraints>
</customView>
</objects>
<resources>
<image name="libraryCellGradient" width="2" height="190"/>
</resources>
</document>
...@@ -53,13 +53,14 @@ ...@@ -53,13 +53,14 @@
<rect key="frame" x="0.0" y="0.0" width="242" height="235"/> <rect key="frame" x="0.0" y="0.0" width="242" height="235"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<collectionView id="B8x-e8-7zp"> <collectionView selectable="YES" id="B8x-e8-7zp">
<rect key="frame" x="0.0" y="0.0" width="242" height="235"/> <rect key="frame" x="0.0" y="0.0" width="242" height="235"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="Rag-cM-k1g"> <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="Rag-cM-k1g">
<size key="itemSize" width="50" height="50"/> <size key="itemSize" width="240" height="120"/>
</collectionViewFlowLayout> </collectionViewFlowLayout>
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="secondaryBackgroundColor" name="controlAlternatingRowColor" catalog="System" colorSpace="catalog"/>
</collectionView> </collectionView>
</subviews> </subviews>
</clipView> </clipView>
......
/*****************************************************************************
* VLCLibraryCollectionViewItem.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2019 VLC authors and VideoLAN
*
* Authors: Felix Paul Kühne <fkuehne # videolan -dot- org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface VLCLibraryCollectionViewItem : NSCollectionViewItem
@property (readwrite, assign) IBOutlet NSTextField *mediaTitleTextField;
@property (readwrite, assign) IBOutlet NSImageView *mediaImageView;
@end
NS_ASSUME_NONNULL_END
/*****************************************************************************
* VLCLibraryCollectionViewItem.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2019 VLC authors and VideoLAN
*
* Authors: Felix Paul Kühne <fkuehne # videolan -dot- org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCLibraryCollectionViewItem.h"
@implementation VLCLibraryCollectionViewItem
@end
...@@ -42,4 +42,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -42,4 +42,8 @@ NS_ASSUME_NONNULL_BEGIN
@end @end
@interface VLCLibraryDataSource : NSObject <NSCollectionViewDataSource, NSCollectionViewDelegate>
@end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -23,16 +23,19 @@ ...@@ -23,16 +23,19 @@
#import "VLCLibraryWindow.h" #import "VLCLibraryWindow.h"
#import "NSString+Helpers.h" #import "NSString+Helpers.h"
#import "VLCPlaylistTableCellView.h" #import "VLCPlaylistTableCellView.h"
#import "VLCLibraryCollectionViewItem.h"
static const float f_min_window_width = 604.; static const float f_min_window_width = 604.;
static const float f_min_window_height = 307.; static const float f_min_window_height = 307.;
static const float f_playlist_row_height = 40.; static const float f_playlist_row_height = 40.;
static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier"; static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier";
static NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier";
@interface VLCLibraryWindow () @interface VLCLibraryWindow ()
{ {
VLCPlaylistDataSource *_playlistDataSource; VLCPlaylistDataSource *_playlistDataSource;
VLCLibraryDataSource *_libraryDataSource;
} }
@end @end
...@@ -54,6 +57,12 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier"; ...@@ -54,6 +57,12 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier";
_playlistTableView.delegate = _playlistDataSource; _playlistTableView.delegate = _playlistDataSource;
_playlistTableView.rowHeight = f_playlist_row_height; _playlistTableView.rowHeight = f_playlist_row_height;
[_playlistTableView reloadData]; [_playlistTableView reloadData];
_libraryDataSource = [[VLCLibraryDataSource alloc] init];
_libraryCollectionView.dataSource = _libraryDataSource;
_libraryCollectionView.delegate = _libraryDataSource;
[_libraryCollectionView registerClass:[VLCLibraryCollectionViewItem class] forItemWithIdentifier:VLCLibraryCellIdentifier];
[_libraryCollectionView reloadData];
} }
- (void)segmentedControlAction - (void)segmentedControlAction
...@@ -104,6 +113,30 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier"; ...@@ -104,6 +113,30 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier";
@end @end
@implementation VLCLibraryDataSource
- (NSInteger)collectionView:(NSCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 2;
}
- (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath
{
VLCLibraryCollectionViewItem *viewItem = [collectionView makeItemWithIdentifier:VLCLibraryCellIdentifier forIndexPath:indexPath];
viewItem.mediaTitleTextField.stringValue = @"Custom Cell Label Text";
viewItem.mediaImageView.image = [NSImage imageNamed: @"noart.png"];
return viewItem;
}
- (void)collectionView:(NSCollectionView *)collectionView didSelectItemsAtIndexPaths:(NSSet<NSIndexPath *> *)indexPaths
{
NSLog(@"library selection changed: %@", indexPaths);
}
@end
@implementation VLCLibraryWindowController @implementation VLCLibraryWindowController
- (instancetype)initWithLibraryWindow - (instancetype)initWithLibraryWindow
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment