Commit 29278198 authored by Vibhoothi's avatar Vibhoothi

libraryView:Use only single instance of dataModel

Make and use only one instance of dataModel for showing items inside libraryView
Following changes were introduced with this
 - This fixes the regression of 264754b3
 - Also now the performance of loading is increased a bit
 - Did a minor cleanup of VLCMainWindow
 - Also fixes the issue of not laoding thumbnail and videoTitle inside popOver
parent 6224bf17
......@@ -41,12 +41,11 @@
-(void)assignValueForDataModel:(VLCLibraryItem *) dataModel
{
NSLog(@"dataModel %@",dataModel);
self.VLCItemLabel.stringValue =dataModel.videoTitle;;
self.VLCItemImageView.image=dataModel.thumbnail;
self.VLCItemLabel.stringValue = dataModel.videoTitle;;
self.VLCItemImageView.image = dataModel.thumbnail;
self.popOverYear.stringValue = dataModel.year;
self.popOverImage=self.VLCItemImageView;
self.popOverTitle=self.VLCItemLabel;
self.popOverImage.image = self.VLCItemImageView.image;
self.popOverTitle.stringValue = self.VLCItemLabel.stringValue;
}
- (void)setSelected:(BOOL)flag
......
......@@ -53,10 +53,7 @@ typedef enum {
@property (readwrite) BOOL nonembedded;
@property (weak) IBOutlet NSCollectionView *collectionView;
@property (strong) VLCLibraryItem *dataModel;
@property (strong) NSMutableArray *thumbinails;
@property (strong) NSMutableArray *labels;
@property (strong) NSMutableArray *years;
@property (strong) NSMutableArray *dummyData;
@property (strong) NSMutableArray *dummyData;
@property (readonly) VLCFSPanelController* fspanel;
@property (nonatomic, copy) NSDictionary *overrideClassNames;
......
......@@ -215,9 +215,6 @@ static const float f_min_window_height = 307.;
// 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];
[self prepareData];
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
......@@ -257,15 +254,6 @@ static const float f_min_window_height = 307.;
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);
}
}
......@@ -295,36 +283,16 @@ static const float f_min_window_height = 307.;
return self.dummyData.count;
}
- (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath {
- (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath
{
/*
Pass the metadata to the DataModel for assinging values to the views
and return updated view
*/
VLCLibraryView *item = [collectionView makeItemWithIdentifier:@"dummyViews" forIndexPath:indexPath];
VLCLibraryItem *model =[VLCLibraryItem new];
for(VLCLibraryItem *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];
}
NSLog(@"Model Thumbinal outside %@",model.videoTitle);
VLCLibraryItem *libraryItem = [self.dummyData objectAtIndex:indexPath.item];
[item assignValueForDataModel:libraryItem];
return item;
//NSLog(@"model Title:%@,modelThumb :%@",model.videoTitle,model.thumbnail);
//[item assignValueForDataModel:model];
/*
model.videoTitle = [self.labels objectAtIndex:indexPath.item];
model.thumbnail = [self.thumbinails objectAtIndex:indexPath.item];
model.year = [self.years objectAtIndex:indexPath.item];
[item assignValueForDataModel:model];
*/
}
- (NSInteger)numberOfSectionsInCollectionView:(NSCollectionView *)collectionView {
......
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