Commit 264754b3 authored by Vibhoothi's avatar Vibhoothi

libraryView: Remove multiple instance of dataModel

Earlier we had 3 diffrent dataModel for thumbinail,image and years,now we have only one
dataModel

To-Do
 - Currently values is added to array which is being replaced instead of adding which
dataModel to repeat valeus
 - Fix up passing the dataModel to collectionViewItem
parent 4531bbef
......@@ -7,7 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
11CC2FBD21106C080091B834 /* VLCMainWindowDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 11CC2FBC21106C080091B834 /* VLCMainWindowDataModel.m */; };
1106202421197CC6000039A8 /* VLCMainWindowDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1106202321197CC5000039A8 /* VLCMainWindowDataModel.m */; };
11CE023120DBFE42008B0A7F /* VLCMainWindowCollectionViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 11CE022F20DBFE41008B0A7F /* VLCMainWindowCollectionViewItem.m */; };
1C1C62011F8260A90052DD4F /* VLCWrappableTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C1C62001F8260A90052DD4F /* VLCWrappableTextField.m */; };
1C31138E1E508C6900D4DD76 /* VLCAboutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C67C8A71D58C0A40079E1C1 /* VLCAboutWindowController.m */; };
......@@ -139,8 +139,8 @@
089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
11CC2FBB21106C080091B834 /* VLCMainWindowDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMainWindowDataModel.h; sourceTree = "<group>"; };
11CC2FBC21106C080091B834 /* VLCMainWindowDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMainWindowDataModel.m; sourceTree = "<group>"; };
1106202221197CC5000039A8 /* VLCMainWindowDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCMainWindowDataModel.h; sourceTree = "<group>"; };
1106202321197CC5000039A8 /* VLCMainWindowDataModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCMainWindowDataModel.m; sourceTree = "<group>"; };
11CE022E20DBFE41008B0A7F /* VLCMainWindowCollectionViewItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMainWindowCollectionViewItem.h; sourceTree = "<group>"; };
11CE022F20DBFE41008B0A7F /* VLCMainWindowCollectionViewItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMainWindowCollectionViewItem.m; sourceTree = "<group>"; };
11CE023020DBFE42008B0A7F /* VLCMainWindowCollectionViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCMainWindowCollectionViewItem.xib; sourceTree = "<group>"; };
......@@ -638,10 +638,10 @@
11CC2FBA211068490091B834 /* LibraryView */ = {
isa = PBXGroup;
children = (
1106202221197CC5000039A8 /* VLCMainWindowDataModel.h */,
1106202321197CC5000039A8 /* VLCMainWindowDataModel.m */,
11CE022E20DBFE41008B0A7F /* VLCMainWindowCollectionViewItem.h */,
11CE022F20DBFE41008B0A7F /* VLCMainWindowCollectionViewItem.m */,
11CC2FBB21106C080091B834 /* VLCMainWindowDataModel.h */,
11CC2FBC21106C080091B834 /* VLCMainWindowDataModel.m */,
);
name = LibraryView;
sourceTree = "<group>";
......@@ -1601,9 +1601,9 @@
6BBB05DA1EEFEA29003A1019 /* VLCHUDOutlineView.m in Sources */,
1C3113CB1E508C6900D4DD76 /* VLCPLItem.m in Sources */,
1C3113CD1E508C6900D4DD76 /* VLCPLModel.m in Sources */,
11CC2FBD21106C080091B834 /* VLCMainWindowDataModel.m in Sources */,
1C3113CF1E508C6900D4DD76 /* prefs_widgets.m in Sources */,
1C3113D11E508C6900D4DD76 /* prefs.m in Sources */,
1106202421197CC6000039A8 /* VLCMainWindowDataModel.m in Sources */,
1C3113D31E508C6900D4DD76 /* VLCResumeDialogController.m in Sources */,
1C5716AC1F5B142200678627 /* coreaudio_common.c in Sources */,
1C3113D51E508C6900D4DD76 /* VLCTextfieldPanelController.m in Sources */,
......
......@@ -15,7 +15,7 @@
<outlet property="popOverImage" destination="0sa-wu-dPr" id="xYR-7X-Xbm"/>
<outlet property="popOverSize" destination="lSa-IC-VbL" id="8hD-9j-3Uz"/>
<outlet property="popOverTitle" destination="bNc-32-jG8" id="gR0-OK-6Oj"/>
<outlet property="popOveryear" destination="Ebf-j5-UtS" id="sJY-aq-A4G"/>
<outlet property="popOverYear" destination="Ebf-j5-UtS" id="rXH-bR-4Gn"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
......
......@@ -52,11 +52,11 @@ typedef enum {
@property (readonly) BOOL nativeFullscreenMode;
@property (readwrite) BOOL nonembedded;
@property (weak) IBOutlet NSCollectionView *collectionView;
@property (strong) VLCMainWindowCollectionViewItem *collectionViewItem;
@property (strong) VLCMainWindowDataModel *dataModel;
@property (strong) NSMutableArray *thumbinails;
@property (strong) NSMutableArray *labels;
@property (strong) NSMutableArray *years;
@property (strong) NSMutableArray *dummyData;
@property (readonly) VLCFSPanelController* fspanel;
@property (nonatomic, copy) NSDictionary *overrideClassNames;
......
......@@ -53,7 +53,6 @@
BOOL collectionViewRemoved;
NSSet<NSIndexPath *> * VLCLibraryViewItem;
CGFloat lastCollectionViewHeight;
// VLCMainWindowDataModel *dataModel;
NSRect frameBeforePlayback;
}
@end
......@@ -133,7 +132,7 @@ static const float f_min_window_height = 307.;
if (var_InheritBool(pl_Get(getIntf()), "fullscreen"))
[self.controlsBar setFullscreenState:YES];
/* Make collectionview visible when Player loads */
/* Initialise collectionview when Player loads */
[self makeCollectionViewVisible];
[self.collectionView reloadData];
......@@ -212,10 +211,10 @@ static const float f_min_window_height = 307.;
}
[self makeFirstResponder:_collectionView];
self.collectionViewItem = [VLCMainWindowCollectionViewItem new];
// dataModel = [VLCMainWindowDataModel new];
self.collectionView.wantsLayer = YES;
// self.dataModel = [[VLCMainWindowDataModel alloc] init ] ;
self.dummyData=[NSMutableArray arrayWithCapacity:0 ];
self.collectionView.wantsLayer = YES;
self.thumbinails = [NSMutableArray arrayWithCapacity:0];
self.labels = [NSMutableArray arrayWithCapacity:0];
self.years = [NSMutableArray arrayWithCapacity:0];
......@@ -250,15 +249,27 @@ static const float f_min_window_height = 307.;
time.value = 0;
float duration = CMTimeGetSeconds([asset duration]);
CGImageRef imgRef = [imageGenerator copyCGImageAtTime:CMTimeMake(10, duration) actualTime:NULL error:nil];
self.dataModel.thumbnail=[[NSImage alloc] initWithCGImage:imgRef size:NSSizeFromCGSize(CGSizeMake(100.0, 100.0))];
NSImage *thumbinail =[[NSImage alloc] initWithCGImage:imgRef size:NSSizeFromCGSize(CGSizeMake(100.0, 100.0))];
if(thumbinail){
[self.thumbinails addObject:thumbinail];
[self.labels addObject:path];
[self.years addObject:@"2012"];
self.dataModel = [[VLCMainWindowDataModel alloc] init ] ;
self.dataModel.thumbnail = thumbinail;
self.dataModel.videoTitle= path;
self.dataModel.year = @"2012";
self.dataModel.length = @"303";
[self.dummyData addObject:self.dataModel] ;
/*
[self.thumbinails addObject:thumbinail];
[self.labels addObject:path];
[self.years addObject:@"2012"];
NSLog(@"self thumbs %@",self.thumbinails);
*/
// NSLog(@"dummyData2:%@",dummyData2);
}
}
NSLog(@"DataModel dummy %@",self.dummyData);
}
#pragma mark - NSCollectionViewDelegate
......@@ -281,21 +292,38 @@ static const float f_min_window_height = 307.;
}
- (NSInteger)collectionView:(NSCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.thumbinails.count;
return self.dummyData.count;
}
- (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath {
VLCMainWindowCollectionViewItem *item = [collectionView makeItemWithIdentifier:@"dummyViews" forIndexPath:indexPath];
VLCMainWindowDataModel *model =[VLCMainWindowDataModel new];
/*
Pass the metadata to the DataModel for assinging values to the views
and return updated view
*/
model.thumbnail = [self.thumbinails objectAtIndex:indexPath.item];
VLCMainWindowCollectionViewItem *item = [collectionView makeItemWithIdentifier:@"dummyViews" forIndexPath:indexPath];
VLCMainWindowDataModel *model =[VLCMainWindowDataModel new];
for(VLCMainWindowDataModel *subModel in self.dummyData)
{
// self.dataModel = [[VLCMainWindowDataModel alloc] init ] ;
// VLCMainWindowDataModel *model=[[VLCMainWindowDataModel alloc] init];
model=subModel;
NSLog(@"ModelTitle %@",model.videoTitle);
NSLog(@"SubModelTitle %@",subModel.videoTitle);
[item assignValueForDataModel:model];
}
return item;
//NSLog(@"Model %@",model);
//NSLog(@"model Title:%@,modelThumb :%@",model.videoTitle,model.thumbnail);
//[item assignValueForDataModel:model];
/*
model.videoTitle = [self.labels objectAtIndex:indexPath.item];
model.year=[self.years objectAtIndex:indexPath.item];
model.thumbnail = [self.thumbinails objectAtIndex:indexPath.item];
model.year = [self.years objectAtIndex:indexPath.item];
[item assignValueForDataModel:model];
return item;
*/
}
- (NSInteger)numberOfSectionsInCollectionView:(NSCollectionView *)collectionView {
......
......@@ -41,7 +41,7 @@
-(void)assignValueForDataModel:(VLCMainWindowDataModel *) dataModel
{
NSLog(@"assigning values to views from dataModel");
NSLog(@"dataModel %@",dataModel);
self.VLCItemLabel.stringValue =dataModel.videoTitle;;
self.VLCItemImageView.image=dataModel.thumbnail;
self.popOverYear.stringValue = dataModel.year;
......
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