source: trunk/SapphireVirtualDirectory.m @ 299

Revision 299, 2.0 KB checked in by pmerrill, 7 years ago (diff)
  • Added a few more icons.
  • Updated current icon set to a standard resolution multiple for better icon placement.
  • Updated ListTitles? to accommodate the icon proportion changes.
  • Updated MenuItems? to accommodate the icon proportion changes.
  • Added some testing code to dump the virtual directories to a plist file.
Line 
1//
2//  SapphireVirtualDirectory.m
3//  Sapphire
4//
5//  Created by Graham Booker on 11/18/07.
6//  Copyright 2007 __MyCompanyName__. All rights reserved.
7//
8
9#import "SapphireVirtualDirectory.h"
10
11
12@interface SapphireDirectoryMetaData (privateFunctions)
13- (id)initWithDictionary:(NSDictionary *)dict parent:(SapphireMetaData *)myParent path:(NSString *)myPath;
14@end
15
16@implementation SapphireVirtualDirectory
17- (id)initWithParent:(SapphireVirtualDirectory *)myParent path:(NSString *)myPath
18{
19        self = [super initWithDictionary:nil parent:myParent path:myPath];
20        if(self == nil)
21                return nil;
22       
23        directory = [[NSMutableDictionary alloc] init];
24        reloadTimer = nil;
25        scannedDirectory = YES;
26       
27        return self;
28}
29
30- (void) dealloc
31{
32        [directory release];
33        [reloadTimer invalidate];
34        [super dealloc];
35}
36
37- (void)reloadDirectoryContents
38{
39        [files removeAllObjects];
40        [directories removeAllObjects];
41        [metaFiles removeAllObjects];
42        [metaDirs removeAllObjects];
43        [cachedMetaFiles removeAllObjects];
44        [cachedMetaDirs removeAllObjects];
45        [reloadTimer invalidate];
46        reloadTimer = nil;
47}
48
49- (void)setReloadTimer
50{
51        [reloadTimer invalidate];
52        reloadTimer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(reloadDirectoryContents) userInfo:nil repeats:NO];
53}
54
55- (void)processFile:(SapphireFileMetaData *)file
56{
57}
58
59- (void)removeFile:(SapphireFileMetaData *)file
60{
61}
62
63- (void)childDisplayChanged
64{
65        /*The way the timings work out, if the timer exists already, it is more efficient to leave it set rather than set a new one*/
66        if(reloadTimer == nil)
67                [self setReloadTimer];
68}
69
70- (void)writeToFile:(NSString *)filePath
71{
72        NSMutableDictionary *fileData = [NSMutableDictionary dictionaryWithDictionary:directory];
73/*
74        NSMutableDictionary *fileData = [NSMutableDictionary dictionaryWithObjectsAndKeys:
75                                                         directory, @"VirtualDirectory",
76                                                         nil];
77*/
78        if([fileData count])
79                [fileData writeToFile:filePath  atomically:YES];
80}
81
82- (BOOL)isDisplayEmpty
83{
84        return [files count] == 0 && [directories count] == 0;
85}
86
87- (BOOL)isEmpty
88{
89        return [directory count] == 0;
90}
91
92@end
Note: See TracBrowser for help on using the repository browser.