Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add System entry to apps popup #59

Merged
merged 2 commits into from

2 participants

Uli Kusterer amyworrall
Uli Kusterer

Wanted this for ages, so thought I'd finally add it. Thanks for all the work you put into keeping this running in the face of Apple's constant changes :-)

uliwitness added some commits
Uli Kusterer uliwitness Fix two category names
Apple has renamed Mac OS X to OS X.
5df76d6
Uli Kusterer uliwitness Add a 'System' entry to the popup.
Makes it easier to find system version & build (when relevant) or file OS bugs.
05999ad
Uli Kusterer

In case it isn't clear: This adds a "System" entry to the running applications popup, so you can pick the system version & build number easily when filing OS bugs.

amyworrall amyworrall merged commit 19f6b82 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 21, 2014
  1. Uli Kusterer

    Fix two category names

    uliwitness authored
    Apple has renamed Mac OS X to OS X.
  2. Uli Kusterer

    Add a 'System' entry to the popup.

    uliwitness authored
    Makes it easier to find system version & build (when relevant) or file OS bugs.
This page is out of date. Refresh to see the latest.
4 QuickRadar/ProductCategories.plist
View
@@ -29,11 +29,11 @@
<string>com.apple.Java</string>
<string>com.apple.Jar</string>
</array>
- <key>Mac App Store</key>
+ <key>OS X App Store</key>
<array>
<string>com.apple.appstore</string>
</array>
- <key>Mac OS X</key>
+ <key>OS X</key>
<array>
<string>com.apple.finder</string>
<string>com.apple.dock</string>
2  QuickRadar/QRAppListManager.h
View
@@ -14,7 +14,7 @@
@interface QRAppListManager : NSObject
-@property (nonatomic, readonly) NSMutableArray *appList;
+@property (nonatomic, readonly) NSArray *appList;
@property (nonatomic, readonly) NSDictionary *categories;
+ (QRAppListManager *)sharedManager;
109 QuickRadar/QRAppListManager.m
View
@@ -13,8 +13,93 @@
#define kQRAppListApplePrefix @"com.apple"
+
+@interface QRSystemFakeApplication : NSObject
+
+-(id) initWithSysVersionDict: (NSDictionary*)inSysVersionDict;
+
+@property (nonatomic,readwrite) NSDictionary* sysVersionDict;
+@property (nonatomic, readonly) NSString *unlocalizedName;
+@property (nonatomic, readonly) NSString *version;
+@property (nonatomic, readonly) NSString *build;
+@property (nonatomic, readonly) NSString *versionAndBuild;
+@property (nonatomic, readonly) NSImage *icon;
+
+@end
+
+
+@implementation QRSystemFakeApplication
+
+-(id) initWithSysVersionDict: (NSDictionary*)inSysVersionDict
+{
+ self = [super init];
+ if( self )
+ self.sysVersionDict = inSysVersionDict;
+
+ return self;
+}
+
+
+-(NSString*) unlocalizedName
+{
+ return [self.sysVersionDict objectForKey: @"ProductName"];
+}
+
+-(NSString*) name
+{
+ return [self.sysVersionDict objectForKey: @"ProductName"];
+}
+
+-(NSString*) version
+{
+ return [self.sysVersionDict objectForKey: @"ProductVersion"];
+}
+
+-(NSString*) build
+{
+ return [self.sysVersionDict objectForKey: @"ProductBuildVersion"];
+}
+
+-(NSString*) versionAndBuild
+{
+ return [NSString stringWithFormat: @"%@ (%@)", self.version, self.build];
+}
+
+-(NSImage*) icon
+{
+ return [[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode( 'macs' )];
+}
+
+
+-(BOOL) didCrashRecently
+{
+ return NO;
+}
+
+
+- (NSString *)guessCategory
+{
+ NSString *identifier = @"com.apple.dock"; // Dock is a part of us, so good guess.
+ NSDictionary *categories = [[QRAppListManager sharedManager] categories];
+ NSEnumerator *enumerator = [categories keyEnumerator];
+ NSString *key;
+ while ((key = [enumerator nextObject])) {
+ NSArray *bundlePrefixes = categories[key];
+ for (NSString *prefix in bundlePrefixes) {
+ if ([identifier hasPrefix:prefix]) {
+ return key;
+ }
+ }
+ }
+ return nil;
+}
+
+@end
+
+
@interface QRAppListManager ()
-@property (nonatomic, readwrite) NSMutableArray *appList;
+@property (nonatomic, readwrite) NSMutableArray *internalAppList;
+@property (nonatomic, readwrite) QRSystemFakeApplication *systemFakeAppObject;
@end
@@ -46,11 +131,14 @@ - (id)init
name:NSWorkspaceDidActivateApplicationNotification object:nil];
// Try to load any cached list, otherwise start with empty list.
- self.appList = [NSMutableArray arrayWithCapacity:15];
+ self.internalAppList = [NSMutableArray arrayWithCapacity:15];
NSArray *loadedList = [self loadList];
if (loadedList) {
- [self.appList addObjectsFromArray:loadedList];
+ [self.internalAppList addObjectsFromArray:loadedList];
}
+
+ NSDictionary * sysVersionDict = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
+ self.systemFakeAppObject = [[QRSystemFakeApplication alloc] initWithSysVersionDict: sysVersionDict];
}
return self;
}
@@ -65,10 +153,10 @@ - (void)addApp:(QRCachedRunningApplication *)app {
NSInteger oldIndex = [self.appList indexOfObject:app];
userInfo[kQRAppListNotificationOldIndexKey] = @(oldIndex);
QRCachedRunningApplication *existingApp = self.appList[oldIndex];
- [self.appList removeObjectAtIndex:oldIndex];
- [self.appList insertObject:existingApp atIndex:0];
+ [self.internalAppList removeObjectAtIndex:oldIndex];
+ [self.internalAppList insertObject:existingApp atIndex:0];
} else {
- [self.appList insertObject:app atIndex:0];
+ [self.internalAppList insertObject:app atIndex:0];
}
[[NSNotificationCenter defaultCenter] postNotificationName:kQRAppListUpdatesNotification object:self userInfo:userInfo];
}
@@ -101,7 +189,7 @@ - (NSString *)cacheFolder {
- (void)saveList {
NSString *plistPath = [[self cacheFolder] stringByAppendingPathComponent:@"AppList.plist"];
- [NSKeyedArchiver archiveRootObject:self.appList toFile:plistPath];
+ [NSKeyedArchiver archiveRootObject:self.internalAppList toFile:plistPath];
}
- (NSArray *)loadList {
@@ -116,6 +204,13 @@ - (NSArray *)loadList {
return list;
}
+
+- (NSArray*)appList {
+ NSMutableArray * apps = [[NSMutableArray alloc] initWithObjects: self.systemFakeAppObject, nil];
+ [apps addObjectsFromArray: self.internalAppList];
+ return apps;
+}
+
#pragma mark -
#pragma mark Categories
2  QuickRadar/QRAppListViewController.m
View
@@ -90,7 +90,7 @@ - (void)reloadList {
}
- (id)listItemAtIndex:(NSInteger)index appsOnly:(BOOL)appsOnly {
- NSMutableArray *appList = [QRAppListManager sharedManager].appList;
+ NSArray *appList = [QRAppListManager sharedManager].appList;
NSInteger appListCount = appList.count;
if (index > 0 && index <= appListCount)
return [QRAppListManager sharedManager].appList[index - 1];
Something went wrong with that request. Please try again.