source: branches/CoreData/SapphireFrappliance/Browser/SapphireMarkMenu.m @ 757

Revision 757, 20.2 KB checked in by gbooker, 6 years ago (diff)

Added the feature to rename a file

Line 
1/*
2 * SapphireMarkMenu.m
3 * Sapphire
4 *
5 * Created by Graham Booker on Jun. 25, 2007.
6 * Copyright 2007 Sapphire Development Team and/or www.nanopi.net
7 * All rights reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License as published by the Free Software Foundation; either version 3 of the License,
11 * or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
15 * Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with this program; if not,
18 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 */
20
21#import "SapphireMarkMenu.h"
22#import "SapphireDirectoryMetaData.h"
23#import "SapphireCollectionDirectory.h"
24#import "SapphireFileMetaData.h"
25#import "SapphireJoinedFile.h"
26#import "SapphireMetaDataSupport.h"
27#import "SapphireMediaPreview.h"
28#import <SapphireCompatClasses/SapphireFrontRowCompat.h>
29#import <QTKit/QTKit.h>
30#import "SapphireTextEntryController.h"
31
32@implementation SapphireMarkMenu
33
34typedef enum {
35        COMMAND_TOGGLE_WATCHED,
36        COMMAND_TOGGLE_FAVORITE,
37        COMMAND_MARK_TO_REFETCH_TV,
38        COMMAND_MARK_TO_REFETCH_MOVIE,
39        COMMAND_MARK_TO_DELETE_METADATA,
40        COMMAND_MARK_TO_RESET_IMPORT,
41        //File Only Commands
42        COMMAND_RENAME_FILE,
43        COMMAND_MARK_TO_JOIN,
44        COMMAND_MARK_AND_JOIN,
45        COMMAND_CLEAR_JOIN_MARK,
46        COMMAND_JOIN,
47        //Directory Only Commands
48        COMMAND_MARK_WATCHED,
49        COMMAND_MARK_UNWATCHED,
50        COMMAND_MARK_FAVORITE,
51        COMMAND_MARK_NOT_FAVORITE,
52        COMMAND_TOGGLE_SKIP,
53        COMMAND_TOGGLE_COLLECTION,
54        //Collection Only Commands
55        COMMAND_RENAME_COLLECTION,
56} MarkCommand;
57
58static NSMutableArray *joinList;
59
60+ (void)initialize
61{
62        joinList = [[NSMutableArray alloc] init];
63}
64
65- (id) initWithScene: (BRRenderScene *) scene metaData: (SapphireMetaData *)meta
66{
67        self = [super initWithScene:scene];
68        if(!self)
69                return nil;
70       
71        /*Check to see if it is directory or file*/
72        isDir = [meta conformsToProtocol:@protocol(SapphireDirectory)];
73        metaData = [meta retain];
74        commands = nil;
75        /*Create the menu*/
76        if(isDir)
77        {
78                names = [[NSMutableArray alloc] initWithObjects:
79                        BRLocalizedString(@"Mark All as Watched", @"Mark whole directory as watched"),
80                        BRLocalizedString(@"Mark All as Unwatched", @"Mark whole directory as unwatched"),
81                        BRLocalizedString(@"Mark All as Favorite", @"Mark whole directory as favorite"),
82                        BRLocalizedString(@"Mark All as Not Favorite", @"Mark whole directory as not favorite"),
83                        BRLocalizedString(@"Mark All to Refetch TV Data", @"Mark whole directory to re-fetch its tv data"),
84                        BRLocalizedString(@"Mark All to Refetch Movie Data", @"Mark whole directory to re-fetch its movie data"),
85                        BRLocalizedString(@"Mark All to Clear Metadata", @"Mark whole directory to delete the metadata"),
86                        BRLocalizedString(@"Mark All to Reset Import Decisions", @"Mark whole directory to reset import decisions"),
87                        nil];
88                markDescriptions = [[NSMutableArray alloc] initWithObjects:
89                        BRLocalizedString(@"Sapphire will save this directory as watched.", @"Mark directory watched description"),
90                        BRLocalizedString(@"Sapphire will save this directory as unwatched.", @"Mark directory as unwatched description"),
91                        BRLocalizedString(@"Sapphire will add this directory as favorite.", @"Mark directory as favorite description"),
92                        BRLocalizedString(@"Sapphire will remove this directory from favorites.", @"Mark directory as not favorite"),
93                        BRLocalizedString(@"Tells Sapphire to refetch TV Show metadata for this directory the next time an import is run.", @"Mark directory to refetch tv data description"),
94                        BRLocalizedString(@"Tells Sapphire to refetch Movie metadata for this directory the next time an import is run.", @"Mark whole directory to re-fetch its movie data"),
95                        BRLocalizedString(@"Tells Sapphire to remove all metadata for this directory.", @"Mark directory to delete metadata description"),
96                        BRLocalizedString(@"Tells Sapphire to forget import decisions made on files in this directory.", @"Mark directory to reset import decisions description"),
97                        nil];
98                commands = [[NSMutableArray alloc] initWithObjects:
99                                        [NSNumber numberWithInt:COMMAND_MARK_WATCHED],
100                                        [NSNumber numberWithInt:COMMAND_MARK_UNWATCHED],
101                                        [NSNumber numberWithInt:COMMAND_MARK_FAVORITE],
102                                        [NSNumber numberWithInt:COMMAND_MARK_NOT_FAVORITE],
103                                        [NSNumber numberWithInt:COMMAND_MARK_TO_REFETCH_TV],
104                                        [NSNumber numberWithInt:COMMAND_MARK_TO_REFETCH_MOVIE],
105                                        [NSNumber numberWithInt:COMMAND_MARK_TO_DELETE_METADATA],
106                                        [NSNumber numberWithInt:COMMAND_MARK_TO_RESET_IMPORT],
107                                        nil];
108                id <SapphireDirectory> dirMeta = (id <SapphireDirectory>)meta;
109                if([dirMeta isKindOfClass:[SapphireDirectoryMetaData class]])
110                {
111                        SapphireCollectionDirectory *collection = [(SapphireDirectoryMetaData *)dirMeta collectionDirectory];
112                        if([collection isMountValue])
113                        {
114                                [names insertObject:BRLocalizedString(@"Rename this Collection", @"Rename a collection") atIndex:0];
115                                [markDescriptions insertObject:BRLocalizedString(@"Edit the display name for this collection", @"") atIndex:0];
116                                [commands insertObject:[NSNumber numberWithInt:COMMAND_RENAME_COLLECTION] atIndex:0];
117                        }
118                        if([collection skipValue])
119                        {
120                                [names addObject:BRLocalizedString(@"Mark Directory For Importing", @"Marks this directory to be no longer be skipped during import")];
121                                [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire it's okay to import from this directory.", @"Mark Directory For Importing description")];
122                        }
123                        else
124                        {
125                                [names addObject:BRLocalizedString(@"Mark this Directory to Skip Import", @"Marks this directory to be skipped during import")];
126                                [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to skip this directory when importing.", @"Mark this Directory to Skip Import description")];
127                        }
128                        [commands addObject:[NSNumber numberWithInt:COMMAND_TOGGLE_SKIP]];
129                        if(![collection isMountValue])
130                        {
131                                if(collection != nil)
132                                {
133                                        [names addObject:BRLocalizedString(@"Mark this Directory to Not be a Collection", @"Marks the directory to no longer be a collection")];
134                                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to remove this directory from the Collections list.", @"Marks the directory to no longer be a collection description")];
135                                }
136                                else
137                                {
138                                        [names addObject:BRLocalizedString(@"Mark this Directory as a Collection", @"Marks the directory to be a collection")];
139                                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to add this directory to the Collections list.", @"Marks the directory to be a collection description")];
140                                }
141                                [commands addObject:[NSNumber numberWithInt:COMMAND_TOGGLE_COLLECTION]];
142                        }
143                }
144        }
145        else if([meta isKindOfClass:[SapphireFileMetaData class]])
146        {
147                SapphireFileMetaData *fileMeta = (SapphireFileMetaData *)metaData;
148                NSString *watched = nil;
149                NSString *watchedDesc = nil;
150                NSString *favorite = nil;
151                NSString *favoriteDesc = nil;
152               
153                if([fileMeta watchedValue])
154                {
155                        watched         = BRLocalizedString(@"Mark as Unwatched", @"Mark file as unwatched");
156                        watchedDesc = BRLocalizedString(@"Sapphire will save this file as unwatched.", @"Mark directory watched description");
157                }
158                else
159                {
160                        watched         = BRLocalizedString(@"Mark as Watched", @"Mark file as watched");
161                        watchedDesc = BRLocalizedString(@"Sapphire will save this file as watched.", @"Mark directory watched description");
162                }
163
164                if([fileMeta favoriteValue])
165                {
166                        favorite         = BRLocalizedString(@"Mark as Not Favorite", @"Mark file as a favorite");
167                        favoriteDesc = BRLocalizedString(@"Sapphire will remove this file from favorites.", @"Mark directory as not favorite");
168                }
169                else
170                {
171                        favorite         = BRLocalizedString(@"Mark as Favorite", @"Mark file as not a favorite");
172                        favoriteDesc = BRLocalizedString(@"Sapphire will add this file as a favorite.", @"Mark directory as favorite description");
173
174                }
175                names                    = [[NSMutableArray alloc] initWithObjects:watched, favorite, nil];
176                markDescriptions = [[NSMutableArray alloc] initWithObjects:watchedDesc, favoriteDesc, nil];
177                commands = [[NSMutableArray alloc] initWithObjects: [NSNumber numberWithInt:COMMAND_TOGGLE_WATCHED], [NSNumber numberWithInt:COMMAND_TOGGLE_FAVORITE], nil];
178                if([fileMeta joinedToFile] == nil)
179                {
180                        [names insertObject:BRLocalizedString(@"Rename this file", @"Rename a file") atIndex:0];
181                        [markDescriptions insertObject:BRLocalizedString(@"Move a file to another name", @"Rename file description") atIndex:0];
182                        [commands insertObject:[NSNumber numberWithInt:COMMAND_RENAME_FILE] atIndex:0];
183                }
184                int importType = [fileMeta importTypeValue];
185                if(importType | IMPORT_TYPE_TVSHOW_MASK)
186                {
187                        [names addObject:BRLocalizedString(@"Mark to Refetch TV Data", @"Mark file to re-fetch its tv data")];
188                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to refetch TV Show metadata for this file the next time an import is run.", @"Mark file to refetch tv data description")];
189
190                        [commands addObject:[NSNumber numberWithInt:COMMAND_MARK_TO_REFETCH_TV]];
191                }
192                if(importType | IMPORT_TYPE_MOVIE_MASK)
193                {
194                        [names addObject:BRLocalizedString(@"Mark to Refetch Movie Data", @"Mark file to re-fetch its movie data")];
195                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to refetch Movie metadata for this file the next time an import is run.", @"Mark file to refetch movie description")];
196
197                        [commands addObject:[NSNumber numberWithInt:COMMAND_MARK_TO_REFETCH_MOVIE]];
198                }
199                if([fileMeta fileClass] != FILE_CLASS_UNKNOWN)
200                {
201                        [names addObject:BRLocalizedString(@"Mark to Clear Metadata", @"Mark a file to delete the metadata")];
202                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to remove all metadata for this file.", @"Mark file to delete metadata description")];
203
204                        [commands addObject:[NSNumber numberWithInt:COMMAND_MARK_TO_DELETE_METADATA]];
205                       
206                        [names addObject:BRLocalizedString(@"Mark to Reset Import Decisions", @"Mark a file to reset import decisions")];
207                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to forget import decisions made on this file.", @"Mark a file to reset import decisions description")];
208                       
209                        [commands addObject:[NSNumber numberWithInt:COMMAND_MARK_TO_RESET_IMPORT]];
210                }
211                if(![joinList containsObject:fileMeta])
212                {
213                        [names addObject:BRLocalizedString(@"Mark This File to Be Joined", @"Mark This File to Be Joined")];
214                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire you wish to add this file to a list of files to be joined. The files will be joined in the order they were added to the list.", @"Mark file to be joined description")];
215                        [commands addObject:[NSNumber numberWithInt:COMMAND_MARK_TO_JOIN]];
216                        [names addObject:BRLocalizedString(@"Mark This File and Join Group", @"Mark This File and Join Group")];
217                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to use this file to complete the joined list.", @"Mark file and join description")];
218                        [commands addObject:[NSNumber numberWithInt:COMMAND_MARK_AND_JOIN]];
219                }
220                if([joinList count])
221                {
222                        [names addObject:BRLocalizedString(@"Join Marked Files", @"Join Marked Files")];
223                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to complete the file join.", @"Join Marked Files description")];
224
225                        [commands addObject:[NSNumber numberWithInt:COMMAND_JOIN]];
226                        [names addObject:BRLocalizedString(@"Clear the Join List", @"Clear the Join List")];
227                        [markDescriptions addObject:BRLocalizedString(@"Tells Sapphire to clear the file join list.", @"clear file join list description")];
228
229                        [commands addObject:[NSNumber numberWithInt:COMMAND_CLEAR_JOIN_MARK]];
230                }
231        }
232        else
233        {
234                /*Neither, so just return nil*/
235                [self autorelease];
236                return nil;
237        }
238        [[self list] setDatasource:self];
239       
240        return self;
241}
242
243- (void) dealloc
244{
245        [commands release];
246        [names release];
247        [markDescriptions release];
248        [metaData release];
249        [names release];
250        [super dealloc];
251}
252
253- (void)doJoin
254{
255        if(![joinList count])
256                return;
257       
258        QTMovie *resultingMovie = [[QTMovie alloc] init];
259        [resultingMovie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute];
260       
261        NSString *savePath = [[joinList objectAtIndex:0] path];
262        BOOL hasmovExt = [[savePath pathExtension] isEqualToString:@"mov"];
263        NSString *base = [savePath stringByDeletingPathExtension];
264        if([[base lowercaseString] hasSuffix:@" part 1"])
265                base = [base substringToIndex:[base length] - 7];
266        if(hasmovExt)
267                savePath = [[base stringByAppendingString:@" Joined"] stringByAppendingPathExtension:@"mov"];
268        else
269                savePath = [base stringByAppendingPathExtension:@"mov"];
270
271        NSManagedObjectContext *moc = [[joinList objectAtIndex:0] managedObjectContext];
272        [SapphireFileMetaData createFileWithPath:savePath inContext:moc];
273        SapphireJoinedFile *joined = [SapphireJoinedFile joinedFileForPath:savePath inContext:moc];
274        int i, count=[joinList count];
275        for(i=0;i<count;i++)
276        {
277                SapphireFileMetaData *meta = [joinList objectAtIndex:i];
278                NSError *error = nil;
279                NSDictionary *openAttr = [NSDictionary dictionaryWithObjectsAndKeys:
280                                                                  [meta path], QTMovieFileNameAttribute,
281                                                                  [NSNumber numberWithBool:NO], QTMovieOpenAsyncOKAttribute,
282                                                                  nil];
283                QTMovie *current = [[QTMovie alloc] initWithAttributes:openAttr error:&error];
284                if(error == nil)
285                {
286                        QTTimeRange range;
287                        range.time = [current selectionStart];
288                        range.duration = [current duration];
289                        [current setSelection:range];
290                        [resultingMovie appendSelectionFromMovie:current];
291                        [meta setJoinedToFile:joined];
292                }
293                [current release];
294        }
295
296        [resultingMovie writeToFile:savePath withAttributes:[NSDictionary dictionary]];
297        [resultingMovie release];
298        [joinList removeAllObjects];
299        [SapphireMetaDataSupport save:moc];
300}
301
302- (long) itemCount
303{
304    // return the number of items in your menu list here
305        return ( [ names count]);
306}
307
308- (id<BRMenuItemLayer>) itemForRow: (long) row
309{
310        /*
311         // build a BRTextMenuItemLayer or a BRAdornedMenuItemLayer, etc. here
312         // return that object, it will be used to display the list item.
313         return ( nil );
314         */
315        if( row >= [names count] ) return ( nil ) ;
316       
317        BRAdornedMenuItemLayer * result = nil ;
318        NSString *name = [names objectAtIndex:row];
319        result = [SapphireFrontRowCompat textMenuItemForScene:[self scene] folder:NO];
320       
321        // add text
322        [SapphireFrontRowCompat setTitle:name forMenu:result];
323                               
324        return ( result ) ;
325}
326
327- (NSString *) titleForRow: (long) row
328{
329       
330        if ( row >= [ names count] ) return ( nil );
331       
332        NSString *result = [ names objectAtIndex: row] ;
333        return ( result ) ;
334}
335
336- (long) rowForTitle: (NSString *) title
337{
338    long result = -1;
339    long i, count = [self itemCount];
340    for ( i = 0; i < count; i++ )
341    {
342        if ( [title isEqualToString: [self titleForRow: i]] )
343        {
344            result = i;
345            break;
346        }
347    }
348   
349    return ( result );
350}
351
352- (void) itemSelected: (long) row
353{
354    // This is called when the user presses play/pause on a list item
355        if(row >= [names count])
356                return;
357       
358        NSManagedObjectContext *moc = [metaData managedObjectContext];
359        BRLayerController *replaceController = nil;
360        /*Do action on dir or file*/
361        if(isDir)
362        {
363                id <SapphireDirectory> dirMeta = (id <SapphireDirectory>)metaData;
364                SapphireCollectionDirectory *collection = nil;
365                if([dirMeta isKindOfClass:[SapphireDirectoryMetaData class]])
366                        collection = [(SapphireDirectoryMetaData *)dirMeta collectionDirectory];
367                NSString *path = [dirMeta path];
368                switch([[commands objectAtIndex:row] intValue])
369                {
370                        case COMMAND_MARK_WATCHED:
371                                setSubtreeToWatched(dirMeta, YES);
372                                break;
373                        case COMMAND_MARK_UNWATCHED:
374                                setSubtreeToWatched(dirMeta, NO);
375                                break;
376                        case COMMAND_MARK_FAVORITE:
377                                setSubtreeToFavorite(dirMeta, YES);
378                                break;
379                        case COMMAND_MARK_NOT_FAVORITE:
380                                setSubtreeToFavorite(dirMeta, NO);
381                                break;
382                        case COMMAND_MARK_TO_REFETCH_TV:
383                                setSubtreeToReimportFromMask(dirMeta, IMPORT_TYPE_TVSHOW_MASK);
384                                break;
385                        case COMMAND_MARK_TO_REFETCH_MOVIE:
386                                setSubtreeToReimportFromMask(dirMeta, IMPORT_TYPE_MOVIE_MASK);
387                                break;
388                        case COMMAND_MARK_TO_DELETE_METADATA:
389                                setSubtreeToClearMetaData(dirMeta);
390                                break;
391                        case COMMAND_MARK_TO_RESET_IMPORT:
392                                setSubtreeToResetImportDecisions(dirMeta);
393                                break;
394                        case COMMAND_TOGGLE_SKIP:
395                                if(collection == nil)
396                                        collection = [SapphireCollectionDirectory collectionAtPath:path inContext:moc];
397                                [collection setSkipValue:![collection skipValue]];
398                                break;
399                        case COMMAND_TOGGLE_COLLECTION:
400                                if(collection == nil)
401                                        [SapphireCollectionDirectory collectionAtPath:path inContext:moc];
402                                else
403                                        [moc deleteObject:collection];
404                                break;
405                        case COMMAND_RENAME_COLLECTION:
406                                if(collection == nil)
407                                        break;
408                                else
409                                {
410                                        NSString *title = [NSString stringWithFormat:BRLocalizedString(@"Rename %@", @"Rename a collection, argument is path"), [dirMeta path]];
411                                        NSString *oldName = [collection name];
412                                        if([oldName length] == 0)
413                                                oldName = title;
414                                       
415                                        NSInvocation *invoke = [NSInvocation invocationWithMethodSignature:[collection methodSignatureForSelector:@selector(setNameAndSave:)]];
416                                        [invoke setSelector:@selector(setNameAndSave:)];
417                                        [invoke setTarget:collection];
418                                        SapphireTextEntryController *rename = [[SapphireTextEntryController alloc] initWithScene:[self scene] title:title defaultText:oldName completionInvocation:invoke];
419                                        replaceController = [rename autorelease];
420                                }
421                }
422        }
423        else
424        {
425                SapphireFileMetaData *fileMeta = (SapphireFileMetaData *)metaData;
426                switch([[commands objectAtIndex:row] intValue])
427                {
428                        case COMMAND_TOGGLE_WATCHED:
429                                [fileMeta setWatchedValue:![fileMeta watchedValue]];
430                                [fileMeta setResumeTime:0];
431                                break;
432                        case COMMAND_TOGGLE_FAVORITE:
433                                [fileMeta setFavoriteValue:![fileMeta favoriteValue]];
434                                break;
435                        case COMMAND_MARK_TO_REFETCH_TV:
436                                [fileMeta setToReimportFromMask:IMPORT_TYPE_TVSHOW_MASK];
437                                break;
438                        case COMMAND_MARK_TO_REFETCH_MOVIE:
439                                [fileMeta setToReimportFromMask:IMPORT_TYPE_MOVIE_MASK];
440                                break;
441                        case COMMAND_MARK_TO_DELETE_METADATA:
442                                [fileMeta clearMetaData];
443                                break;
444                        case COMMAND_MARK_TO_RESET_IMPORT:
445                                [fileMeta setToResetImportDecisions];
446                                break;
447                        case COMMAND_MARK_TO_JOIN:
448                                [joinList addObject:fileMeta];
449                                break;
450                        case COMMAND_CLEAR_JOIN_MARK:
451                                [joinList removeAllObjects];
452                                break;
453                        case COMMAND_MARK_AND_JOIN:
454                                [joinList addObject:fileMeta];
455                        case COMMAND_JOIN:
456                                [self doJoin];
457                                break;
458                        case COMMAND_RENAME_FILE:
459                        {
460                                NSString *title = [NSString stringWithFormat:BRLocalizedString(@"Rename %@", @"Rename a file, argument is path"), [fileMeta path]];
461                                NSString *oldName = [[fileMeta path] lastPathComponent];
462                               
463                                NSInvocation *invoke = [NSInvocation invocationWithMethodSignature:[fileMeta methodSignatureForSelector:@selector(renameFile:)]];
464                                [invoke setSelector:@selector(renameFile:)];
465                                [invoke setTarget:fileMeta];
466                                SapphireTextEntryController *rename = [[SapphireTextEntryController alloc] initWithScene:[self scene] title:title defaultText:oldName completionInvocation:invoke];
467                                replaceController = [rename autorelease];                               
468                        }
469                }
470        }
471        /*Save and exit*/
472        [SapphireMetaDataSupport save:moc];
473        if(replaceController != nil)
474                [[self stack] swapController:replaceController];
475        else
476                [[self stack] popController];
477}
478
479- (id<BRMediaPreviewController>) previewControlForItem:(long)item
480{
481        return [self previewControllerForItem:item];
482}
483
484- (id<BRMediaPreviewController>) previewControllerForItem: (long) item
485{
486    // If subclassing BRMediaMenuController, this function is called when the selection cursor
487    // passes over an item.
488                if(item >= [names count])
489                return nil;
490        else
491        {
492                /* Get setting name & kill cushion  */
493                NSString *markName =[NSString stringWithFormat:@"%@ for \"%@\"",[names objectAtIndex:item],(NSString *)[self listTitle]];
494                NSString *markDescription=[markDescriptions objectAtIndex:item];
495                /* Construct a gerneric metadata asset for display */
496                NSMutableDictionary *markMeta=[[NSMutableDictionary alloc] init];
497                [markMeta setObject:markName forKey:META_TITLE_KEY];
498                [markMeta setObject:[NSNumber numberWithInt:FILE_CLASS_UTILITY] forKey:FILE_CLASS_KEY];
499                [markMeta setObject:markDescription forKey:META_DESCRIPTION_KEY];
500                SapphireMediaPreview *preview = [[SapphireMediaPreview alloc] initWithScene:[self scene]];
501                [preview setUtilityData:markMeta];
502                [markMeta release];
503                [preview setShowsMetadataImmediately:YES];
504                /*And go*/
505                return [preview autorelease];
506        }
507    return ( nil );
508}
509
510@end
Note: See TracBrowser for help on using the repository browser.