Skip to content

Commit

Permalink
Initial draft for iMedia2. This is very much in an experimental stage…
Browse files Browse the repository at this point in the history
… and work in progress.

• Shows the parsing and loading architecture
• Works lazily and supports incremental updating of library nodes tree

ATTENTION: Do not use the code base in the trunk for shipping apps. Use the 1.x code base in the branch instead.
  • Loading branch information
peterb180369 committed Jul 20, 2009
1 parent 8ec6ddf commit 614486a
Show file tree
Hide file tree
Showing 45 changed files with 8,463 additions and 0 deletions.
Binary file added English.lproj/InfoPlist.strings
Binary file not shown.
107 changes: 107 additions & 0 deletions IMBCommon.h
@@ -0,0 +1,107 @@
/*
iMedia Browser Framework <http://karelia.com/imedia/>
Copyright (c) 2005-2009 by Karelia Software et al.
iMedia Browser is based on code originally developed by Jason Terhorst,
further developed for Sandvox by Greg Hulands, Dan Wood, and Terrence Talbot.
Contributions have also been made by Matt Gough, Martin Wennerberg and others
as indicated in source files.
The iMedia Browser Framework is licensed under the following terms:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in all or substantial portions of the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following
conditions:
Redistributions of source code must retain the original terms stated here,
including this list of conditions, the disclaimer noted below, and the
following copyright notice: Copyright (c) 2005-2009 by Karelia Software et al.
Redistributions in binary form must include, in an end-user-visible manner,
e.g., About window, Acknowledgments window, or similar, either a) the original
terms stated here, including this list of conditions, the disclaimer noted
below, and the aforementioned copyright notice, or b) the aforementioned
copyright notice and a link to karelia.com/imedia.
Neither the name of Karelia Software, nor Sandvox, nor the names of
contributors to iMedia Browser may be used to endorse or promote products
derived from the Software without prior and express written permission from
Karelia Software or individual contributors, as appropriate.
Disclaimer: THE SOFTWARE IS PROVIDED BY THE COPYRIGHT OWNER AND CONTRIBUTORS
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH, THE
SOFTWARE OR THE USE OF, OR OTHER DEALINGS IN, THE SOFTWARE.
*/


//----------------------------------------------------------------------------------------------------------------------


#pragma mark CONSTANTS


// Options to control behavior of the framework...

enum
{
kIMBOptionNone = 0,
kIMBOptionForceRecursiveLoading = 1
};
typedef NSUInteger IMBOptions;


// File watcher type for an IMBNode...

enum
{
kIMBWatcherTypeNone,
kIMBWatcherTypeKQueue,
kIMBWatcherTypeFSEvent
};
typedef NSUInteger IMBWatcherType;


// Badge type for IMBNode. A corresponding icon will be displayed in the cell...

enum IMBBadgeType
{
kIMBBadgeTypeNone,
kIMBBadgeTypeLoading,
kIMBBadgeTypeStop,
kIMBBadgeTypeEject,
kIMBBadgeTypeOffline
};
typedef NSUInteger IMBBadgeType;


// Media types...

extern NSString* kIMBPhotosMediaType;
extern NSString* kIMBMusicMediaType;
extern NSString* kIMBMoviesMediaType;
extern NSString* kIMBLinksMediaType;
extern NSString* kIMBContactsMediaType;


//----------------------------------------------------------------------------------------------------------------------


#pragma mark MACROS

#ifndef IMBRelease
#define IMBRelease(object) if (object) {[object release]; object=nil;}
#endif


//----------------------------------------------------------------------------------------------------------------------


62 changes: 62 additions & 0 deletions IMBCommon.m
@@ -0,0 +1,62 @@
/*
iMedia Browser Framework <http://karelia.com/imedia/>
Copyright (c) 2005-2009 by Karelia Software et al.
iMedia Browser is based on code originally developed by Jason Terhorst,
further developed for Sandvox by Greg Hulands, Dan Wood, and Terrence Talbot.
Contributions have also been made by Matt Gough, Martin Wennerberg and others
as indicated in source files.
The iMedia Browser Framework is licensed under the following terms:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in all or substantial portions of the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following
conditions:
Redistributions of source code must retain the original terms stated here,
including this list of conditions, the disclaimer noted below, and the
following copyright notice: Copyright (c) 2005-2009 by Karelia Software et al.
Redistributions in binary form must include, in an end-user-visible manner,
e.g., About window, Acknowledgments window, or similar, either a) the original
terms stated here, including this list of conditions, the disclaimer noted
below, and the aforementioned copyright notice, or b) the aforementioned
copyright notice and a link to karelia.com/imedia.
Neither the name of Karelia Software, nor Sandvox, nor the names of
contributors to iMedia Browser may be used to endorse or promote products
derived from the Software without prior and express written permission from
Karelia Software or individual contributors, as appropriate.
Disclaimer: THE SOFTWARE IS PROVIDED BY THE COPYRIGHT OWNER AND CONTRIBUTORS
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH, THE
SOFTWARE OR THE USE OF, OR OTHER DEALINGS IN, THE SOFTWARE.
*/


//----------------------------------------------------------------------------------------------------------------------


#pragma mark CONSTANTS

// Media types...

NSString* kIMBPhotosMediaType = @"photos";
NSString* kIMBMusicMediaType = @"music";
NSString* kIMBMoviesMediaType = @"movies";
NSString* kIMBLinksMediaType = @"links";
NSString* kIMBContactsMediaType = @"contacts";


//----------------------------------------------------------------------------------------------------------------------


57 changes: 57 additions & 0 deletions IMBConfig.h
@@ -0,0 +1,57 @@
/*
iMedia Browser Framework <http://karelia.com/imedia/>
Copyright (c) 2005-2009 by Karelia Software et al.
iMedia Browser is based on code originally developed by Jason Terhorst,
further developed for Sandvox by Greg Hulands, Dan Wood, and Terrence Talbot.
Contributions have also been made by Matt Gough, Martin Wennerberg and others
as indicated in source files.
The iMedia Browser Framework is licensed under the following terms:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in all or substantial portions of the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following
conditions:
Redistributions of source code must retain the original terms stated here,
including this list of conditions, the disclaimer noted below, and the
following copyright notice: Copyright (c) 2005-2009 by Karelia Software et al.
Redistributions in binary form must include, in an end-user-visible manner,
e.g., About window, Acknowledgments window, or similar, either a) the original
terms stated here, including this list of conditions, the disclaimer noted
below, and the aforementioned copyright notice, or b) the aforementioned
copyright notice and a link to karelia.com/imedia.
Neither the name of Karelia Software, nor Sandvox, nor the names of
contributors to iMedia Browser may be used to endorse or promote products
derived from the Software without prior and express written permission from
Karelia Software or individual contributors, as appropriate.
Disclaimer: THE SOFTWARE IS PROVIDED BY THE COPYRIGHT OWNER AND CONTRIBUTORS
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH, THE
SOFTWARE OR THE USE OF, OR OTHER DEALINGS IN, THE SOFTWARE.
*/


//----------------------------------------------------------------------------------------------------------------------


@interface IMBConfig : NSObject

+ (void) setPrefs:(NSMutableDictionary*)inClassDict forClass:(Class)inClass;
+ (NSMutableDictionary*) prefsForClass:(Class)inClass;

@end


//----------------------------------------------------------------------------------------------------------------------
104 changes: 104 additions & 0 deletions IMBConfig.m
@@ -0,0 +1,104 @@
/*
iMedia Browser Framework <http://karelia.com/imedia/>
Copyright (c) 2005-2009 by Karelia Software et al.
iMedia Browser is based on code originally developed by Jason Terhorst,
further developed for Sandvox by Greg Hulands, Dan Wood, and Terrence Talbot.
Contributions have also been made by Matt Gough, Martin Wennerberg and others
as indicated in source files.
The iMedia Browser Framework is licensed under the following terms:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in all or substantial portions of the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following
conditions:
Redistributions of source code must retain the original terms stated here,
including this list of conditions, the disclaimer noted below, and the
following copyright notice: Copyright (c) 2005-2009 by Karelia Software et al.
Redistributions in binary form must include, in an end-user-visible manner,
e.g., About window, Acknowledgments window, or similar, either a) the original
terms stated here, including this list of conditions, the disclaimer noted
below, and the aforementioned copyright notice, or b) the aforementioned
copyright notice and a link to karelia.com/imedia.
Neither the name of Karelia Software, nor Sandvox, nor the names of
contributors to iMedia Browser may be used to endorse or promote products
derived from the Software without prior and express written permission from
Karelia Software or individual contributors, as appropriate.
Disclaimer: THE SOFTWARE IS PROVIDED BY THE COPYRIGHT OWNER AND CONTRIBUTORS
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH, THE
SOFTWARE OR THE USE OF, OR OTHER DEALINGS IN, THE SOFTWARE.
*/


//----------------------------------------------------------------------------------------------------------------------


#pragma mark HEADERS

#import "IMBConfig.h"


//----------------------------------------------------------------------------------------------------------------------


#pragma mark CONSTANTS

static NSString* sIMBPrefsKey = @"iMedia2";


//----------------------------------------------------------------------------------------------------------------------


#pragma mark

@implementation IMBConfig


//----------------------------------------------------------------------------------------------------------------------


// Store the specified dictionary in the iMedia section of the preferences under its class name...

+ (void) setPrefs:(NSMutableDictionary*)inClassDict forClass:(Class)inClass
{
NSUserDefaults* prefs = [NSUserDefaults standardUserDefaults];

NSMutableDictionary* iMediaDict = [[[prefs dictionaryForKey:sIMBPrefsKey] mutableCopy] autorelease];
if (iMediaDict == nil) iMediaDict = [NSMutableDictionary dictionary];

[iMediaDict setObject:inClassDict forKey:NSStringFromClass(inClass)];
[prefs setObject:iMediaDict forKey:sIMBPrefsKey];
}


// Return a mutable copy of the class specific preference dictionary. If it doesn't exist yet, then return an
// empty dictionary...

+ (NSMutableDictionary*) prefsForClass:(Class)inClass
{
NSUserDefaults* prefs = [NSUserDefaults standardUserDefaults];
NSDictionary* iMediaDict = [prefs dictionaryForKey:sIMBPrefsKey];
NSDictionary* classDict = [iMediaDict objectForKey:NSStringFromClass(inClass)];

return [NSMutableDictionary dictionaryWithDictionary:classDict];
}


//----------------------------------------------------------------------------------------------------------------------


@end

0 comments on commit 614486a

Please sign in to comment.