VLCLibraryView.m 3.27 KB
Newer Older
1
/*****************************************************************************
2
 * VLCLibraryView.m: MacOS X interface module
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *****************************************************************************
 * Copyright (C) 2002-2018 VLC authors and VideoLAN
 * $Id $
 *
 * Authors: Vibhoothi   <vibhoothiiaanand -at- googlemail dot com>
 *
 * 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.
 *****************************************************************************/

24
#import <Cocoa/Cocoa.h>
25 26
#import "VLCLibraryView.h"
#import "VLCLibraryItem.h"
27

28
@interface VLCLibraryView ()
29 30 31 32 33
{
    
}
@end

34
@implementation VLCLibraryView
35 36 37 38 39 40

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.collectionView setDelegate:self];
}

41 42 43 44 45 46 47 48 49 50 51 52 53
#pragma mark - dataModel and View handling

/*
 Assigning values from the dataModel to the view fields like
 - Thumbnail
 - Video Title
 - Fields in the popOver where diffrent metadatas are shown
 - Small thumbnail
 - Title of the video
 - Size of the video
 - Year of the video
 */

54
-(void)assignValueForDataModel:(VLCLibraryItem *) dataModel
55
{
56 57
    self.VLCItemLabel.stringValue = dataModel.videoTitle;;
    self.VLCItemImageView.image = dataModel.thumbnail;
58
    self.popOverYear.stringValue = dataModel.year;
59 60
    self.popOverImage.image = self.VLCItemImageView.image;
    self.popOverTitle.stringValue = self.VLCItemLabel.stringValue;
61
    self.popOverSize.stringValue= dataModel.length;
62 63
}

64 65
#pragma mark - Selection Highlighting in the libraryView

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
- (void)setSelected:(BOOL)flag
{
    [super setSelected:flag];
    [self updateBackgroundColorForSelectionState:flag];
}


- (void) viewDidAppear
{
    [self updateBackgroundColorForSelectionState:self.isSelected];
}
- (void)updateBackgroundColorForSelectionState:(BOOL)flag
{
    if (flag)
    {
        self.view.layer.backgroundColor = [[NSColor alternateSelectedControlColor] CGColor];
    }
    else
    {
        self.view.layer.backgroundColor = [[NSColor clearColor] CGColor];
    }
}

89

90 91
#pragma mark - popOver Initialisation of the indexed files

92 93 94
- (BOOL)buttonIsPressed
{
    return self.VLCPopOverTriggerButton.intValue == 1;
95 96
}

97 98 99 100 101 102 103 104 105
- (IBAction)popOver:(id)sender {
    NSLog(@"VLC: Popup tapped");
        if (self.buttonIsPressed)
        {
            [self.VLCPopOver showRelativeToRect:[self.VLCPopOverTriggerButton bounds] ofView:self.VLCPopOverTriggerButton preferredEdge:NSMaxYEdge];
        } else {
            [self.VLCPopOver close];
        }
}
106 107 108 109 110 111 112 113 114 115 116 117
//(VLCLibraryItem *) dataModel
- (void) addItemToPlayQueue:(NSSet<NSIndexPath *>  *) indexPath : (VLCLibraryItem *) dataModel
{
    //    NSInteger *test= indexPath.item;
    
}

- (IBAction) insertItemToPlayQueue:(id)sender {
    
   
}

118 119 120


@end
121