diff --git a/mySIMBL.xcodeproj/project.pbxproj b/mySIMBL.xcodeproj/project.pbxproj index 04c6437..7f32b91 100644 --- a/mySIMBL.xcodeproj/project.pbxproj +++ b/mySIMBL.xcodeproj/project.pbxproj @@ -23,6 +23,8 @@ FB0CF6AE1C61D314002CF3DE /* injectPROC.sh in Resources */ = {isa = PBXBuildFile; fileRef = FB0CF6AD1C61D314002CF3DE /* injectPROC.sh */; }; FB0CF6B01C61D617002CF3DE /* SIMBL.osax in Resources */ = {isa = PBXBuildFile; fileRef = FB0CF6951C61D13F002CF3DE /* SIMBL.osax */; }; FB0CF6B11C61D625002CF3DE /* SIMBL_Install.sh in Resources */ = {isa = PBXBuildFile; fileRef = FB0CF6931C61D133002CF3DE /* SIMBL_Install.sh */; }; + FB24B09E1C952FF700443CA0 /* pluginTable.m in Sources */ = {isa = PBXBuildFile; fileRef = FB24B09D1C952FF700443CA0 /* pluginTable.m */; }; + FB24B0A21C955D2C00443CA0 /* shareClass.m in Sources */ = {isa = PBXBuildFile; fileRef = FB24B0A11C955D2C00443CA0 /* shareClass.m */; }; FB3E55971C82EE4C006B4A54 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB5F44DE1C43A5AF00DE80B4 /* Sparkle.framework */; }; FB4F45701C8FD4C3004AAE68 /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = FB4F456F1C8FD4C3004AAE68 /* icon.icns */; }; FB57D2F31C4BAFB20077F91C /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FB5F44DE1C43A5AF00DE80B4 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -33,6 +35,10 @@ FB5F44C01C41EA4000DE80B4 /* Appliaction.xib in Resources */ = {isa = PBXBuildFile; fileRef = FB5F44BE1C41EA4000DE80B4 /* Appliaction.xib */; }; FB5F44E61C44BFF100DE80B4 /* SCEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = FB5F44E41C44BFF100DE80B4 /* SCEvent.m */; }; FB5F44E71C44BFF100DE80B4 /* SCEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = FB5F44E51C44BFF100DE80B4 /* SCEvents.m */; }; + FB790FE81CA447AD00BE3B59 /* repopluginTable.m in Sources */ = {isa = PBXBuildFile; fileRef = FB790FE71CA447AD00BE3B59 /* repopluginTable.m */; }; + FB790FED1CA4BC0900BE3B59 /* bundlePage.m in Sources */ = {isa = PBXBuildFile; fileRef = FB790FEC1CA4BC0900BE3B59 /* bundlePage.m */; }; + FB9BF36A1CA6801F00A63718 /* loading_mini.gif in Resources */ = {isa = PBXBuildFile; fileRef = FB9BF3691CA6801F00A63718 /* loading_mini.gif */; }; + FBA9EB341C965E9F00511BE3 /* sourcesTable.m in Sources */ = {isa = PBXBuildFile; fileRef = FBA9EB331C965E9F00511BE3 /* sourcesTable.m */; }; FBB7934F1C7AB6C3006BF301 /* injectPROC.sh in Resources */ = {isa = PBXBuildFile; fileRef = FBB7934D1C7AB6C3006BF301 /* injectPROC.sh */; }; FBB793501C7AB6C3006BF301 /* SIMBL_Install.sh in Resources */ = {isa = PBXBuildFile; fileRef = FBB7934E1C7AB6C3006BF301 /* SIMBL_Install.sh */; }; FBB793521C7AB7BC006BF301 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = FBB793511C7AB7BC006BF301 /* dsa_pub.pem */; }; @@ -80,6 +86,9 @@ FB0CF6A61C61D1E9002CF3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; FB0CF6A81C61D1E9002CF3DE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; FB0CF6AD1C61D314002CF3DE /* injectPROC.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = injectPROC.sh; sourceTree = ""; }; + FB24B09D1C952FF700443CA0 /* pluginTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = pluginTable.m; sourceTree = ""; }; + FB24B0A11C955D2C00443CA0 /* shareClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = shareClass.m; sourceTree = ""; }; + FB24B0A31C955EEC00443CA0 /* shareClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shareClass.h; sourceTree = ""; }; FB4F456F1C8FD4C3004AAE68 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = ""; }; FB5F44B31C41EA4000DE80B4 /* mySIMBL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = mySIMBL.app; sourceTree = BUILT_PRODUCTS_DIR; }; FB5F44B61C41EA4000DE80B4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -95,6 +104,10 @@ FB5F44E31C44BFF100DE80B4 /* SCEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCEvents.h; sourceTree = ""; }; FB5F44E41C44BFF100DE80B4 /* SCEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCEvent.m; sourceTree = ""; }; FB5F44E51C44BFF100DE80B4 /* SCEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCEvents.m; sourceTree = ""; }; + FB790FE71CA447AD00BE3B59 /* repopluginTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = repopluginTable.m; sourceTree = ""; }; + FB790FEC1CA4BC0900BE3B59 /* bundlePage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = bundlePage.m; sourceTree = ""; }; + FB9BF3691CA6801F00A63718 /* loading_mini.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = loading_mini.gif; sourceTree = ""; }; + FBA9EB331C965E9F00511BE3 /* sourcesTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = sourcesTable.m; sourceTree = ""; }; FBB7934D1C7AB6C3006BF301 /* injectPROC.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = injectPROC.sh; sourceTree = ""; }; FBB7934E1C7AB6C3006BF301 /* SIMBL_Install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = SIMBL_Install.sh; sourceTree = ""; }; FBB793511C7AB7BC006BF301 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = ""; }; @@ -194,6 +207,7 @@ FB57959C1C4DCFA2001A76AC /* Icons */ = { isa = PBXGroup; children = ( + FB9BF3691CA6801F00A63718 /* loading_mini.gif */, FB4F456F1C8FD4C3004AAE68 /* icon.icns */, FB09A4FA1C4B85250072C553 /* brick.png */, FB09A4F61C4B64F80072C553 /* webicon.png */, @@ -242,6 +256,9 @@ FB5F44BE1C41EA4000DE80B4 /* Appliaction.xib */, FB5F44B61C41EA4000DE80B4 /* AppDelegate.h */, FB5F44B71C41EA4000DE80B4 /* AppDelegate.m */, + FB790FEB1CA4AA8600BE3B59 /* Tables */, + FB24B0A31C955EEC00443CA0 /* shareClass.h */, + FB24B0A11C955D2C00443CA0 /* shareClass.m */, FB09A4F41C4B5FEF0072C553 /* Changelog.rtf */, FB5F44C11C41EA4000DE80B4 /* Info.plist */, ); @@ -273,6 +290,17 @@ name = SCEvent; sourceTree = ""; }; + FB790FEB1CA4AA8600BE3B59 /* Tables */ = { + isa = PBXGroup; + children = ( + FB24B09D1C952FF700443CA0 /* pluginTable.m */, + FBA9EB331C965E9F00511BE3 /* sourcesTable.m */, + FB790FE71CA447AD00BE3B59 /* repopluginTable.m */, + FB790FEC1CA4BC0900BE3B59 /* bundlePage.m */, + ); + name = Tables; + sourceTree = ""; + }; FBB7934C1C7A9748006BF301 /* Scripts */ = { isa = PBXGroup; children = ( @@ -404,6 +432,7 @@ FBB7934F1C7AB6C3006BF301 /* injectPROC.sh in Resources */, FBC54D6F1C4C33030021517C /* Credits.rtf in Resources */, FB4F45701C8FD4C3004AAE68 /* icon.icns in Resources */, + FB9BF36A1CA6801F00A63718 /* loading_mini.gif in Resources */, FB0CF6941C61D133002CF3DE /* SIMBL_Install.sh in Resources */, FB0CF6961C61D13F002CF3DE /* SIMBL.osax in Resources */, FB09A4F51C4B5FEF0072C553 /* Changelog.rtf in Resources */, @@ -448,11 +477,16 @@ buildActionMask = 2147483647; files = ( FB09A4C61C4B26AD0072C553 /* INWindowButton.m in Sources */, + FB24B09E1C952FF700443CA0 /* pluginTable.m in Sources */, FB09A4C51C4B26AD0072C553 /* INAppStoreWindow.m in Sources */, FBC54D8B1C4C454E0021517C /* PFMoveApplication.m in Sources */, FB5F44E71C44BFF100DE80B4 /* SCEvents.m in Sources */, + FBA9EB341C965E9F00511BE3 /* sourcesTable.m in Sources */, FB09A4C71C4B26AD0072C553 /* WAYAppStoreWindow.m in Sources */, + FB24B0A21C955D2C00443CA0 /* shareClass.m in Sources */, + FB790FE81CA447AD00BE3B59 /* repopluginTable.m in Sources */, FB5F44BB1C41EA4000DE80B4 /* main.m in Sources */, + FB790FED1CA4BC0900BE3B59 /* bundlePage.m in Sources */, FB5F44B81C41EA4000DE80B4 /* AppDelegate.m in Sources */, FB5F44E61C44BFF100DE80B4 /* SCEvent.m in Sources */, FB09A4C81C4B26AD0072C553 /* WAYWindow.m in Sources */, diff --git a/mySIMBL.xcodeproj/project.xcworkspace/xcuserdata/w0lf.xcuserdatad/UserInterfaceState.xcuserstate b/mySIMBL.xcodeproj/project.xcworkspace/xcuserdata/w0lf.xcuserdatad/UserInterfaceState.xcuserstate index 43acdd5..275e8e7 100644 Binary files a/mySIMBL.xcodeproj/project.xcworkspace/xcuserdata/w0lf.xcuserdatad/UserInterfaceState.xcuserstate and b/mySIMBL.xcodeproj/project.xcworkspace/xcuserdata/w0lf.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/mySIMBL.xcodeproj/xcuserdata/w0lf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/mySIMBL.xcodeproj/xcuserdata/w0lf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index e5126bb..8f94031 100644 --- a/mySIMBL.xcodeproj/xcuserdata/w0lf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/mySIMBL.xcodeproj/xcuserdata/w0lf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -4,131 +4,13 @@ version = "2.0"> + BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - + scope = "0" + stopOnStyle = "0"> diff --git a/mySIMBL/AppDelegate.h b/mySIMBL/AppDelegate.h index 72af8c9..3e20c21 100644 --- a/mySIMBL/AppDelegate.h +++ b/mySIMBL/AppDelegate.h @@ -14,14 +14,83 @@ #import "WAYAppStoreWindow.h" #import "SCEventListenerProtocol.h" #import "PFMoveApplication.h" +#import "shareClass.h" @interface AppDelegate : NSObject { SCEvents *_events; + shareClass *_sharedMethods; } +@property IBOutlet WAYAppStoreWindow *window; +@property IBOutlet NSWindow *srcWin; +@property IBOutlet SUUpdater *updater; +@property IBOutlet NSTabView *tabView; + +// Tab views +@property IBOutlet NSView *tabAbout; +@property IBOutlet NSView *tabPlugins; +@property IBOutlet NSView *tabSIMBL; +@property IBOutlet NSView *tabPreferences; +@property IBOutlet NSView *tabSIP; +@property IBOutlet NSView *tabSources; +@property IBOutlet NSView *tabDiscover; + +// Plugins view +@property IBOutlet NSTableView *tblView; +@property IBOutlet NSTableView *sourcesAllTable; +@property IBOutlet NSTableView *sourcesRepoTable; + +// Add source +@property IBOutlet NSButton *addsourcesAccept; +@property IBOutlet NSTextField *addsourcesTextFiled; + +// Sources view +@property IBOutlet NSView *sourcesRoot; +@property IBOutlet NSView *sourcesBundle; +@property IBOutlet NSScrollView *sourcesURLS; +@property IBOutlet NSScrollView *sourcesPlugins; +@property IBOutlet NSButton *sourcesPush; +@property IBOutlet NSButton *sourcesPop; +@property IBOutlet NSButton *sourcestoRoot; +@property IBOutlet NSButton *sourcesAdd; +@property IBOutlet NSButton *sourcesRefresh; + +// Tab bar items +@property IBOutlet NSButton *viewPlugins; +@property IBOutlet NSButton *viewPreferences; +@property IBOutlet NSButton *viewSources; +@property IBOutlet NSButton *viewDiscover; +@property IBOutlet NSButton *viewAbout; +@property IBOutlet NSButton *donateButton; + +// About view +@property IBOutlet NSTextField *appName; +@property IBOutlet NSTextField *appVersion; +@property IBOutlet NSTextField *appCopyright; +@property IBOutlet NSButton *gitButton; +@property IBOutlet NSButton *sourceButton; +@property IBOutlet NSButton *emailButton; +@property IBOutlet NSButton *webButton; +@property IBOutlet NSButton *showCredits; +@property IBOutlet NSButton *showChanges; +@property IBOutlet NSButton *showEULA; + +// Preferences view +@property IBOutlet NSButton *prefVibrant; +@property IBOutlet NSButton *prefTips; +@property IBOutlet NSButton *prefDonate; +@property IBOutlet NSButton *prefWindow; +@property IBOutlet NSPopUpButton *prefUpdateAuto; +@property IBOutlet NSPopUpButton *prefUpdateInterval; +@property IBOutlet NSPopUpButton *prefStartTab; +@property IBOutlet NSPopUpButton *SIMBLLogging; +@property IBOutlet NSTextView *changeLog; + - (void)setupEventListener; -- (void)installBundles:(NSArray*)pathArray; ++ (AppDelegate*) sharedInstance; +- (IBAction)pushView:(id)sender; +- (IBAction)popView:(id)sender; @end @@ -31,8 +100,4 @@ } + (id)sharedToolTipManager; - (void)setInitialToolTipDelay:(double)arg1; -@end - -@interface CustomTableCell : NSTableCellView - @end \ No newline at end of file diff --git a/mySIMBL/AppDelegate.m b/mySIMBL/AppDelegate.m index fa051d0..325c32f 100644 --- a/mySIMBL/AppDelegate.m +++ b/mySIMBL/AppDelegate.m @@ -8,68 +8,12 @@ #import "AppDelegate.h" +AppDelegate* myDelegate; NSMutableDictionary *myPreferences; -NSMutableArray *tableArray; +NSMutableArray *pluginsArray; NSMutableArray *confirmDelete; - -@interface AppDelegate () - -@property (nonatomic, strong) IBOutlet WAYAppStoreWindow *window; -@property (nonatomic, strong) IBOutlet NSTableView *tblView; -@property (nonatomic, strong) IBOutlet NSTabView *tabView; - -@property (nonatomic, strong) IBOutlet NSTextField *appName; -@property (nonatomic, strong) IBOutlet NSTextField *appVersion; -@property (nonatomic, strong) IBOutlet NSTextField *appCopyright; - -@property (nonatomic, strong) IBOutlet NSView *tabAbout; -@property (nonatomic, strong) IBOutlet NSView *tabPlugins; -@property (nonatomic, strong) IBOutlet NSView *tabSIMBL; -@property (nonatomic, strong) IBOutlet NSView *tabSIMBLInstalled; -@property (nonatomic, strong) IBOutlet NSView *tabPreferences; -@property (nonatomic, strong) IBOutlet NSView *tabSIP; -@property (nonatomic, strong) IBOutlet NSView *tabSources; -@property (nonatomic, strong) IBOutlet NSView *tabDiscover; - -@property (nonatomic, strong) IBOutlet NSButton *viewPlugins; -@property (nonatomic, strong) IBOutlet NSButton *viewPreferences; -@property (nonatomic, strong) IBOutlet NSButton *viewSources; -@property (nonatomic, strong) IBOutlet NSButton *viewDiscover; -@property (nonatomic, strong) IBOutlet NSButton *viewAbout; -@property (nonatomic, strong) IBOutlet NSButton *showCredits; -@property (nonatomic, strong) IBOutlet NSButton *showChanges; -@property (nonatomic, strong) IBOutlet NSButton *showEULA; -@property (nonatomic, strong) IBOutlet NSButton *donateButton; -@property (nonatomic, strong) IBOutlet NSButton *gitButton; -@property (nonatomic, strong) IBOutlet NSButton *emailButton; -@property (nonatomic, strong) IBOutlet NSButton *webButton; -@property (nonatomic, strong) IBOutlet NSButton *translateButton; - -@property (nonatomic, strong) IBOutlet NSPopUpButton *SIMBLLogging; - -// App preferences -@property (nonatomic, strong) IBOutlet NSButton *prefVibrant; -@property (nonatomic, strong) IBOutlet NSButton *prefTips; -@property (nonatomic, strong) IBOutlet NSButton *prefDonate; -@property (nonatomic, strong) IBOutlet NSButton *prefWindow; - -@property (nonatomic, strong) IBOutlet NSPopUpButton *prefUpdateAuto; -@property (nonatomic, strong) IBOutlet NSPopUpButton *prefUpdateInterval; - -@property IBOutlet NSTextView *changeLog; - -@end - -@interface CustomTableCell () - -@property (nonatomic, strong) IBOutlet NSButton* pluginDelete; -@property (nonatomic, strong) IBOutlet NSButton* pluginWeb; -@property (nonatomic, strong) IBOutlet NSButton* pluginStatus; -@property (nonatomic, strong) IBOutlet NSTextField* pluginName; -@property (nonatomic, strong) IBOutlet NSTextField* pluginDescription; -@property (nonatomic, strong) IBOutlet NSImageView* pluginImage; - -@end +NSArray *tabs; +NSArray *sourceItems; @implementation AppDelegate @@ -80,22 +24,29 @@ - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theAppl // Install bundle files - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { - [self installBundles:filenames]; + [_sharedMethods installBundles:filenames]; } // App opened - (void)applicationWillFinishLaunching:(NSNotification *)aNotification { + myDelegate = self; + + tabs = [NSArray arrayWithObjects:_viewPlugins, _viewDiscover, _viewSources, _viewPreferences, _viewAbout, nil]; + sourceItems = [NSArray arrayWithObjects:_sourcesURLS, _sourcesPlugins, _sourcesBundle, nil]; + [_sourcesPush setEnabled:true]; + [_sourcesPop setEnabled:false]; myPreferences = [self getmyPrefs]; + _sharedMethods = [shareClass alloc]; + + [_sourcesRoot setSubviews:[[NSArray alloc] initWithObjects:_sourcesURLS, nil]]; [self setupWindow]; [self setupPrefstab]; - [self readPlugins]; + [_sharedMethods readPlugins:_tblView]; [self addLoginItem]; [self launchHelper]; // Setup plugin table - [_tblView setHeaderView:nil]; -// [_tblView setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone]; [_tblView registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]]; [_donateButton setImage:[NSImage imageNamed:@"heart2.png"]]; @@ -103,6 +54,8 @@ - (void)applicationWillFinishLaunching:(NSNotification *)aNotification { PFMoveToApplicationsFolderIfNecessary(); [self setupEventListener]; + + [self.window makeKeyAndOrderFront:self]; } - (void)applicationWillTerminate:(NSNotification *)aNotification { @@ -210,32 +163,6 @@ - (NSMutableDictionary *)getmyPrefs { // return [NSMutableDictionary dictionaryWithContentsOfFile:plist_Dock]; } -- (IBAction)changeAutoUpdates:(id)sender { - int selected = (int)[(NSPopUpButton*)sender indexOfSelectedItem]; - if (selected == 0) - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:false] forKey:@"SUEnableAutomaticChecks"]; - if (selected == 1) - { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:true] forKey:@"SUEnableAutomaticChecks"]; - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:false] forKey:@"SUAutomaticallyUpdate"]; - } - if (selected == 2) - { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:true] forKey:@"SUEnableAutomaticChecks"]; - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:true] forKey:@"SUAutomaticallyUpdate"]; - } -} - -- (IBAction)changeUpdateFrequency:(id)sender { - int selected = (int)[(NSPopUpButton*)sender selectedTag]; - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:selected] forKey:@"SUScheduledCheckInterval"]; -} - -- (IBAction)changeSIMBLLogging:(id)sender { - NSString *logLevel = [NSString stringWithFormat:@"defaults write net.culater.SIMBL SIMBLLogLevel -int %ld", [_SIMBLLogging indexOfSelectedItem]]; - logLevel = [self runCommand:logLevel]; -} - - (void)setupWindow { if ([[NSProcessInfo processInfo] operatingSystemVersion].minorVersion < 10) { @@ -246,6 +173,14 @@ - (void)setupWindow { [_window setTitlebarAppearsTransparent:true]; } + if (![[myPreferences objectForKey:@"sources"] containsObject:@"https://w0lfschild.github.io/repo"]) + { + NSMutableArray *newArray = [NSMutableArray arrayWithArray:[myPreferences objectForKey:@"sources"]]; + [newArray addObject:@"https://w0lfschild.github.io/repo"]; + [[NSUserDefaults standardUserDefaults] setObject:newArray forKey:@"sources"]; + [myPreferences setObject:newArray forKey:@"sources"]; + } + if ([[myPreferences valueForKey:@"prefVibrant"] boolValue]) { Class vibrantClass=NSClassFromString(@"NSVisualEffectView"); @@ -262,15 +197,23 @@ - (void)setupWindow { [_window setMovableByWindowBackground:YES]; // Setup tab view - [self selectView:_viewPlugins]; + if ([[myPreferences valueForKey:@"prefStartTab"] integerValue] >= 0) + { + NSInteger tab = [[myPreferences valueForKey:@"prefStartTab"] integerValue]; + [self selectView:[tabs objectAtIndex:tab]]; + [_prefStartTab selectItemAtIndex:tab]; + } else { + [self selectView:_viewPlugins]; + [_prefStartTab selectItemAtIndex:0]; + } + [[_tabView tabViewItemAtIndex:0] setView:_tabPlugins]; [[_tabView tabViewItemAtIndex:1] setView:_tabDiscover]; [[_tabView tabViewItemAtIndex:2] setView:_tabSources]; [[_tabView tabViewItemAtIndex:3] setView:_tabPreferences]; [[_tabView tabViewItemAtIndex:4] setView:_tabAbout]; - NSTabViewItem* tabItem1 = [_tabView tabViewItemAtIndex:1]; - [tabItem1 setView:_tabSIMBLInstalled]; + NSTabViewItem* tabItem1 = [_tabView tabViewItemAtIndex:0]; if (![[NSFileManager defaultManager] fileExistsAtPath:@"/System/Library/ScriptingAdditions/SIMBL.osax"]) { if ([[NSProcessInfo processInfo] operatingSystemVersion].minorVersion >= 11) @@ -286,7 +229,7 @@ - (void)setupWindow { [task launch]; NSData *data = [file readDataToEndOfFile]; NSString *output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; -// NSLog(@"%@", output); + // NSLog(@"%@", output); if ([output containsString:@"Operation not permitted"]) [tabItem1 setView:_tabSIP]; else @@ -304,73 +247,6 @@ - (void)setupWindow { [[_changeLog textStorage] setAttributedString:[[NSAttributedString alloc] initWithPath:[[NSBundle mainBundle] pathForResource:@"Changelog" ofType:@"rtf"] documentAttributes:nil]]; } -- (IBAction)toggleVibrancy:(id)sender { - NSButton *btn = sender; - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefVibrant"]; - Class vibrantClass=NSClassFromString(@"NSVisualEffectView"); - if (vibrantClass) - { - if ([btn state]) - { - NSVisualEffectView *vibrant=[[vibrantClass alloc] initWithFrame:[[_window contentView] bounds]]; - [vibrant setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; - [vibrant setBlendingMode:NSVisualEffectBlendingModeBehindWindow]; - if (![[_window.contentView subviews] containsObject:vibrant]) - [[_window contentView] addSubview:vibrant positioned:NSWindowBelow relativeTo:nil]; - } else { - for (NSVisualEffectView *v in (NSMutableArray *)[_window.contentView subviews]) - if ([v class] == vibrantClass) { - [v removeFromSuperview]; - break; - } - } - } -} - -- (IBAction)toggleTips:(id)sender { - NSButton *btn = sender; -// [myPreferences setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefTips"]; - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefTips"]; - NSToolTipManager *test = [NSToolTipManager sharedToolTipManager]; - if ([btn state]) - [test setInitialToolTipDelay:0.1]; - else - [test setInitialToolTipDelay:2]; -} - -- (IBAction)toggleSaveWindow:(id)sender { - NSButton *btn = sender; -// [myPreferences setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefWindow"]; - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefWindow"]; - if ([btn state]) - { - [[_window windowController] setShouldCascadeWindows:NO]; // Tell the controller to not cascade its windows. - [_window setFrameAutosaveName:[_window representedFilename]]; - } else { - [_window setFrameAutosaveName:@""]; - } -} - -- (IBAction)toggleDonateButton:(id)sender { - NSButton *btn = sender; -// [myPreferences setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefDonate"]; - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefDonate"]; - if ([btn state]) - { - [NSAnimationContext beginGrouping]; - [[NSAnimationContext currentContext] setDuration:1.0]; - [[_donateButton animator] setAlphaValue:0]; - [[_donateButton animator] setHidden:true]; - [NSAnimationContext endGrouping]; - } else { - [NSAnimationContext beginGrouping]; - [[NSAnimationContext currentContext] setDuration:1.0]; - [[_donateButton animator] setAlphaValue:1]; - [[_donateButton animator] setHidden:false]; - [NSAnimationContext endGrouping]; - } -} - - (void)addLoginItem { dispatch_queue_t myQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(myQueue, ^{ @@ -417,10 +293,10 @@ - (void)setupPrefstab { if ([[NSUserDefaults standardUserDefaults] boolForKey:@"SUAutomaticallyUpdate"]) { [_prefUpdateAuto selectItemAtIndex:2]; - SUUpdater *myUpdater = [SUUpdater alloc]; - [myUpdater checkForUpdatesInBackground]; + [self.updater checkForUpdatesInBackground]; } else if ([[NSUserDefaults standardUserDefaults] boolForKey:@"SUEnableAutomaticChecks"]) { [_prefUpdateAuto selectItemAtIndex:1]; + [self.updater checkForUpdatesInBackground]; } else { [_prefUpdateAuto selectItemAtIndex:0]; } @@ -428,22 +304,16 @@ - (void)setupPrefstab { [_prefUpdateInterval selectItemWithTag:[[myPreferences objectForKey:@"SUScheduledCheckInterval"] integerValue]]; [[_gitButton cell] setImageScaling:NSImageScaleProportionallyUpOrDown]; -// [[_translateButton cell] setImageScaling:NSImageScaleProportionallyUpOrDown]; + [[_sourceButton cell] setImageScaling:NSImageScaleProportionallyUpOrDown]; [[_webButton cell] setImageScaling:NSImageScaleProportionallyUpOrDown]; [[_emailButton cell] setImageScaling:NSImageScaleProportionallyUpOrDown]; + [_sourceButton setAction:@selector(visitSource)]; [_gitButton setAction:@selector(visitGithub)]; -// [_translateButton setAction:@selector(translate)]; [_webButton setAction:@selector(visitWebsite)]; [_emailButton setAction:@selector(sendEmail)]; } -- (IBAction)inject:(id)sender { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - [self runScript:[[NSBundle mainBundle] pathForResource:@"injectPROC" ofType:@"sh"]]; - }); -} - - (void)donate { [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://goo.gl/DSyEFR"]]; } @@ -461,6 +331,10 @@ - (void)visitGithub { [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/w0lfschild"]]; } +- (void)visitSource { + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/w0lfschild/mySIMBL"]]; +} + - (void)visitWebsite { [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://w0lfschild.github.io/app_SIMBL.html"]]; } @@ -492,211 +366,133 @@ - (void)setupEventListener { - (void)pathWatcher:(SCEvents *)pathWatcher eventOccurred:(SCEvent *)event { // NSLog(@"%@", event); - [self readPlugins]; + [_sharedMethods readPlugins:_tblView]; } -- (void)readFolder:(NSString *)str :(NSMutableDictionary *)dict { - - NSArray *appFolderContents = [[NSArray alloc] init]; - appFolderContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:str error:nil]; - - for (NSString* fileName in appFolderContents) { - if ([fileName hasSuffix:@".bundle"]) { - NSString* path=[str stringByAppendingPathComponent:fileName]; - NSString* name=[fileName stringByDeletingPathExtension]; - //check Info.plist - NSBundle* bundle = [NSBundle bundleWithPath:path]; - NSDictionary* info=[bundle infoDictionary]; -// NSDictionary* info=nil; - NSString* bundleIdentifier=[bundle bundleIdentifier]; - if(![bundleIdentifier length])bundleIdentifier=@"(null)"; - - NSString* bundleVersion=[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; - if(![bundleVersion length])bundleVersion=[bundle objectForInfoDictionaryKey:@"CFBundleVersion"]; - - NSString* description=bundleIdentifier; - if([bundleVersion length]){ - description=[NSString stringWithFormat:@"%@ - %@", bundleVersion, description]; - } - - NSArray *components = [path pathComponents]; - NSString* location= [components objectAtIndex:1]; - NSString* endcomp= [components objectAtIndex:[components count] - 2]; - if([location length]){ - if ([endcomp containsString:@"Disabled"]) - { - description=[NSString stringWithFormat:@"%@ - %@ (Disabled)", description, location]; - } else { - description=[NSString stringWithFormat:@"%@ - %@", description, location]; - } - } - - NSMutableDictionary* itm=[NSMutableDictionary dictionaryWithObjectsAndKeys: - name, @"name", path, @"path", description, @"description", - bundleIdentifier, @"bundleId", bundleVersion, @"version", - info, @"bundleInfo", - [NSNumber numberWithBool:YES], @"enabled", - [NSNumber numberWithBool:NO], @"fileSystemConflict", - nil]; - - NSString* nameandPath = [NSString stringWithFormat:@"%@ - %@", name, path]; - - [dict setObject:itm forKey:nameandPath]; - } +- (IBAction)changeAutoUpdates:(id)sender { + int selected = (int)[(NSPopUpButton*)sender indexOfSelectedItem]; + if (selected == 0) + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:false] forKey:@"SUEnableAutomaticChecks"]; + if (selected == 1) + { + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:true] forKey:@"SUEnableAutomaticChecks"]; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:false] forKey:@"SUAutomaticallyUpdate"]; } -} - -- (void)readPlugins { - tableArray = [[NSMutableArray alloc] init]; - confirmDelete = [[NSMutableArray alloc] init]; - NSMutableDictionary *myDict = [[NSMutableDictionary alloc] init]; - - NSArray* libDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSLocalDomainMask]; - NSArray* usrDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; - - NSString* libSupport = [[libDomain objectAtIndex:0] path]; - NSString* usrSupport = [[usrDomain objectAtIndex:0] path]; - - NSString* libPathENB = [NSString stringWithFormat:@"%@/SIMBL/Plugins", libSupport]; - NSString* libPathDIS = [NSString stringWithFormat:@"%@/SIMBL/Plugins (Disabled)", libSupport]; - - NSString* usrPathENB = [NSString stringWithFormat:@"%@/SIMBL/Plugins", usrSupport]; - NSString* usrPathDIS = [NSString stringWithFormat:@"%@/SIMBL/Plugins (Disabled)", usrSupport]; - - NSString* OpeePath = [NSString stringWithFormat:@"/Library/Opee/Extensions"]; - - [self readFolder:libPathENB :myDict]; - [self readFolder:libPathDIS :myDict]; - - [self readFolder:usrPathENB :myDict]; - [self readFolder:usrPathDIS :myDict]; - - [self readFolder:OpeePath :myDict]; - - NSArray *keys = [myDict allKeys]; - NSArray *sortedKeys = [keys sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; -// sortedKeys = [[sortedKeys reverseObjectEnumerator] allObjects]; - - for (NSString *app in sortedKeys) + if (selected == 2) { - [tableArray addObject:[myDict valueForKey:app]]; - [confirmDelete addObject:[NSNumber numberWithBool:false]]; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:true] forKey:@"SUEnableAutomaticChecks"]; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:true] forKey:@"SUAutomaticallyUpdate"]; } +} - [[self tblView] reloadData]; +- (IBAction)changeUpdateFrequency:(id)sender { + int selected = (int)[(NSPopUpButton*)sender selectedTag]; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:selected] forKey:@"SUScheduledCheckInterval"]; } -- (void)installBundles:(NSArray*)pathArray { -// NSLog(@"%@", pathArray); - NSArray* libDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSLocalDomainMask]; - NSString* libSupport = [[libDomain objectAtIndex:0] path]; - for (NSString* path in pathArray) { - if ([[path pathExtension] isEqualToString:@"bundle"]) +- (IBAction)changeSIMBLLogging:(id)sender { + NSString *logLevel = [NSString stringWithFormat:@"defaults write net.culater.SIMBL SIMBLLogLevel -int %ld", [_SIMBLLogging indexOfSelectedItem]]; + logLevel = [self runCommand:logLevel]; +} + +- (IBAction)toggleVibrancy:(id)sender { + NSButton *btn = sender; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefVibrant"]; + Class vibrantClass=NSClassFromString(@"NSVisualEffectView"); + if (vibrantClass) + { + if ([btn state]) { - NSArray* pathComp=[path pathComponents]; - NSString* name=[pathComp objectAtIndex:[pathComp count] - 1]; - NSString* libPath = [NSString stringWithFormat:@"%@/SIMBL/Plugins/%@", libSupport, name]; - // NSLog(@"\n%@\n%@", libPath, path); - [self replaceFile:path :libPath]; + NSVisualEffectView *vibrant=[[vibrantClass alloc] initWithFrame:[[_window contentView] bounds]]; + [vibrant setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; + [vibrant setBlendingMode:NSVisualEffectBlendingModeBehindWindow]; + if (![[_window.contentView subviews] containsObject:vibrant]) + [[_window contentView] addSubview:vibrant positioned:NSWindowBelow relativeTo:nil]; + } else { + for (NSVisualEffectView *v in (NSMutableArray *)[_window.contentView subviews]) + if ([v class] == vibrantClass) { + [v removeFromSuperview]; + break; + } } } - [self readPlugins]; } -- (void)replaceFile:(NSString*)start :(NSString*)end { - NSError* error; - if ([[NSFileManager defaultManager] fileExistsAtPath:end]) { - // NSLog(@"File Exists"); - [[NSFileManager defaultManager] replaceItemAtURL:[NSURL fileURLWithPath:end] withItemAtURL:[NSURL fileURLWithPath:start] backupItemName:nil options:NSFileManagerItemReplacementUsingNewMetadataOnly resultingItemURL:nil error:&error]; +- (IBAction)toggleTips:(id)sender { + NSButton *btn = sender; + // [myPreferences setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefTips"]; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefTips"]; + NSToolTipManager *test = [NSToolTipManager sharedToolTipManager]; + if ([btn state]) + [test setInitialToolTipDelay:0.1]; + else + [test setInitialToolTipDelay:2]; +} + +- (IBAction)toggleSaveWindow:(id)sender { + NSButton *btn = sender; + // [myPreferences setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefWindow"]; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefWindow"]; + if ([btn state]) + { + [[_window windowController] setShouldCascadeWindows:NO]; // Tell the controller to not cascade its windows. + [_window setFrameAutosaveName:[_window representedFilename]]; + } else { + [_window setFrameAutosaveName:@""]; + } +} + +- (IBAction)toggleDonateButton:(id)sender { + NSButton *btn = sender; + // [myPreferences setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefDonate"]; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[btn state]] forKey:@"prefDonate"]; + if ([btn state]) + { + [NSAnimationContext beginGrouping]; + [[NSAnimationContext currentContext] setDuration:1.0]; + [[_donateButton animator] setAlphaValue:0]; + [[_donateButton animator] setHidden:true]; + [NSAnimationContext endGrouping]; } else { - // NSLog(@"File Doesn't Exist"); - [[NSFileManager defaultManager] moveItemAtURL:[NSURL fileURLWithPath:start] toURL:[NSURL fileURLWithPath:end] error:&error]; + [NSAnimationContext beginGrouping]; + [[NSAnimationContext currentContext] setDuration:1.0]; + [[_donateButton animator] setAlphaValue:1]; + [[_donateButton animator] setHidden:false]; + [NSAnimationContext endGrouping]; } - // NSLog(@"%@", error); +} + +- (IBAction)inject:(id)sender { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + [self runScript:[[NSBundle mainBundle] pathForResource:@"injectPROC" ofType:@"sh"]]; + [[NSSound soundNamed:@"Blow"] play]; + }); } - (IBAction)showAbout:(id)sender { - NSArray *tabs = [NSArray arrayWithObjects:_viewPlugins, _viewDiscover, _viewSources, _viewPreferences, _viewAbout, nil]; [_tabView selectTabViewItemAtIndex:4]; for (NSButton *g in tabs) { if (![g isEqualTo:_viewAbout]) - [g setState:NSOffState]; + g.layer.backgroundColor = [NSColor clearColor].CGColor; else - [g setState:NSOnState]; + g.layer.backgroundColor = [NSColor colorWithCalibratedRed:0.121f green:0.4375f blue:0.1992f alpha:0.2578f].CGColor; } } - (IBAction)showPrefs:(id)sender { - NSArray *tabs = [NSArray arrayWithObjects:_viewPlugins, _viewDiscover, _viewSources, _viewPreferences, _viewAbout, nil]; [_tabView selectTabViewItemAtIndex:3]; for (NSButton *g in tabs) { if (![g isEqualTo:_viewPreferences]) - [g setState:NSOffState]; + g.layer.backgroundColor = [NSColor clearColor].CGColor; else - [g setState:NSOnState]; + g.layer.backgroundColor = [NSColor colorWithCalibratedRed:0.121f green:0.4375f blue:0.1992f alpha:0.2578f].CGColor; } } -- (IBAction)pluginWebpage:(id)sender { - long selected = [_tblView rowForView:sender]; - NSDictionary* obj = [tableArray objectAtIndex:selected]; - NSDictionary* info = [obj objectForKey:@"bundleInfo"]; - NSString* webURL = [info objectForKey:@"DevURL"]; - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:webURL]]; -} - - (IBAction)donate:(id)sender { [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://goo.gl/DSyEFR"]]; } -- (IBAction)newView:(id)sender { - long selected = [_tblView rowForView:sender]; - NSDictionary* obj = [tableArray objectAtIndex:selected]; - NSLog(@"%@", [obj valueForKey:@"name"]); -} - -- (IBAction)deletePlugin:(id)sender { - long selected = [_tblView rowForView:sender]; - if ([[confirmDelete objectAtIndex:selected] boolValue]) - { - NSDictionary* obj = [tableArray objectAtIndex:selected]; - NSString* path = [obj objectForKey:@"path"]; - NSURL* url = [NSURL fileURLWithPath:path]; - NSURL* trash; - NSError* error; - [[NSFileManager defaultManager] trashItemAtURL:url resultingItemURL:&trash error:&error]; - } - [self readPlugins]; - [confirmDelete setObject:[NSNumber numberWithBool:true] atIndexedSubscript:selected]; -} - -- (IBAction)togglePlugin:(id)sender { - long selected = [_tblView rowForView:sender]; - NSDictionary* obj = [tableArray objectAtIndex:selected]; - NSString* name = [obj objectForKey:@"name"]; - NSString* path = [obj objectForKey:@"path"]; - - NSArray* libDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSLocalDomainMask]; - NSArray* usrDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; - - NSString* libSupport = [[libDomain objectAtIndex:0] path]; - NSString* usrSupport = [[usrDomain objectAtIndex:0] path]; - - NSString* disPath = [NSString stringWithFormat:@"%@/SIMBL/Plugins (Disabled)/%@.bundle", libSupport, name]; - NSString* libPath = [NSString stringWithFormat:@"%@/SIMBL/Plugins/%@.bundle", libSupport, name]; - NSString* usrPath = [NSString stringWithFormat:@"%@/SIMBL/Plugins/%@.bundle", usrSupport, name]; - - if ([[obj objectForKey:@"path"] isEqualToString:disPath]) { - [self replaceFile:path :usrPath]; - } else if ([[obj objectForKey:@"path"] isEqualToString:usrPath]) { - [self replaceFile:path :libPath]; - } else { - [self replaceFile:path :disPath]; - } - - [self readPlugins]; -} - - (IBAction)aboutInfo:(id)sender { if ([sender isEqualTo:_showChanges]) { @@ -736,124 +532,112 @@ - (IBAction)aboutInfo:(id)sender { } } -- (IBAction)selectView:(id)sender { - NSArray *tabs = [NSArray arrayWithObjects:_viewPlugins, _viewDiscover, _viewSources, _viewPreferences, _viewAbout, nil]; - if ([tabs containsObject:sender]) - [_tabView selectTabViewItemAtIndex:[tabs indexOfObject:sender]]; - for (NSButton *g in tabs) { - if (![g isEqualTo:sender]) - [g setState:NSOffState]; - else - [g setState:NSOnState]; - } +- (IBAction)toggleStartTab:(id)sender { + NSPopUpButton *btn = sender; + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:[btn indexOfSelectedItem]] forKey:@"prefStartTab"]; } -- (IBAction)showInFinder:(id)sender { - long selected = [_tblView rowForView:sender]; - NSDictionary* obj = [tableArray objectAtIndex:selected]; -// NSLog(@"%@", [obj valueForKey:@"path"]); - NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:[obj valueForKey:@"path"]]; -// NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; -// [pasteboard writeObjects:[NSArray arrayWithObject:fileURL]]; - [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:[NSArray arrayWithObject:fileURL]]; +- (IBAction)pushView:(id)sender { + long cur = [sourceItems indexOfObject:[_sourcesRoot.subviews objectAtIndex:0]]; + if ([_sourcesAllTable selectedRow] > -1) + { + [_sourcesPop setEnabled:true]; + if ((cur + 2) >= [sourceItems count]) + [_sourcesPush setEnabled:false]; + else + [_sourcesPush setEnabled:true]; + + if ((cur + 1) < [sourceItems count]) + { + [[_sourcesRoot animator] replaceSubview:[_sourcesRoot.subviews objectAtIndex:0] with:[sourceItems objectAtIndex:cur + 1]]; + [self.window makeFirstResponder: [sourceItems objectAtIndex:cur + 1]]; + } + } + // [_sourcesRoot setSubviews:[[NSArray alloc] initWithObjects:_sourcesPlugins, nil]]; } -- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { - return [tableArray count]; +- (IBAction)popView:(id)sender { + long cur = [sourceItems indexOfObject:[_sourcesRoot.subviews objectAtIndex:0]]; + + [_sourcesPush setEnabled:true]; + if ((cur - 1) <= 0) + [_sourcesPop setEnabled:false]; + else + [_sourcesPop setEnabled:true]; + + if ((cur - 1) >= 0) + { + [[_sourcesRoot animator] replaceSubview:[_sourcesRoot.subviews objectAtIndex:0] with:[sourceItems objectAtIndex:cur - 1]]; + [self.window makeFirstResponder: [sourceItems objectAtIndex:cur - 1]]; + } +// [[_sourcesRoot animator] replaceSubview:[_sourcesRoot.subviews objectAtIndex:0] with:_sourcesURLS]; +// [_sourcesRoot setSubviews:[[NSArray alloc] initWithObjects:_sourcesPlugins, nil]]; } -//- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard -//{ -// return YES; -//} - -- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id )info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op { - return NSDragOperationCopy; +- (IBAction)rootView:(id)sender { + [_sourcesPush setEnabled:true]; + [_sourcesPop setEnabled:false]; + [[_sourcesRoot animator] replaceSubview:[_sourcesRoot.subviews objectAtIndex:0] with:_sourcesURLS]; + // [_sourcesRoot setSubviews:[[NSArray alloc] initWithObjects:_sourcesPlugins, nil]]; } -- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id )info row:(int)row dropOperation:(NSTableViewDropOperation)operation { - NSPasteboard *pboard = [info draggingPasteboard]; - if ([[pboard types] containsObject:NSURLPboardType]) { - NSArray* urls = [pboard readObjectsForClasses:@[[NSURL class]] options:nil]; - NSMutableArray* sorted = [[NSMutableArray alloc] init]; - for (NSURL* url in urls) - { - if ([[url.path pathExtension] isEqualToString:@"bundle"]) - { - [sorted addObject:url.path]; -// NSLog(@"%@", url.path); - } - } - if ([sorted count]) - { -// NSLog(@"%@", sorted); - NSArray* installArray = [NSArray arrayWithArray:sorted]; - [self installBundles:installArray]; - } +- (IBAction)selectView:(id)sender { + if ([tabs containsObject:sender]) + [_tabView selectTabViewItemAtIndex:[tabs indexOfObject:sender]]; + for (NSButton *g in tabs) { + if (![g isEqualTo:sender]) + g.layer.backgroundColor = [NSColor clearColor].CGColor; + else + g.layer.backgroundColor = [NSColor colorWithCalibratedRed:0.121f green:0.4375f blue:0.1992f alpha:0.2578f].CGColor; } - return YES; } -- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { - CustomTableCell *result = (CustomTableCell*)[tableView makeViewWithIdentifier:@"MyView" owner:self]; - NSDictionary* item = [tableArray objectAtIndex:row]; - NSDictionary* info = [item objectForKey:@"bundleInfo"]; - NSString* iconPath = [NSString stringWithFormat:@"%@/Contents/icon.icns", [item objectForKey:@"path"]]; - NSImage* icon = [[NSImage alloc] initWithContentsOfFile:iconPath]; +- (IBAction)sourceAddorRemove:(id)sender { + NSMutableArray *newArray = [NSMutableArray arrayWithArray:[myPreferences objectForKey:@"sources"]]; + NSString *input = _addsourcesTextFiled.stringValue; + NSArray *arr = [input componentsSeparatedByString:@"\n"]; - result.pluginName.stringValue = [item objectForKey:@"name"]; - if([[item objectForKey:@"path"] length]){ - NSString *path = [item objectForKey:@"path"]; - NSArray *components = [path pathComponents]; - - if ([[components objectAtIndex:1] isEqualToString:@"Library"]) +// NSLog(@"%@", arr); +// NSLog(@"%@", newArray); + + for (NSString* item in arr) + { + if ([item length]) { - [result.pluginStatus setImage:[NSImage imageNamed:@"NSStatusAvailable"]]; - } else { - [result.pluginStatus setImage:[NSImage imageNamed:@"NSStatusPartiallyAvailable"]]; + if ([newArray containsObject:item]) + { + [newArray removeObject:item]; + } else { + NSString* content = [item stringByAppendingString:@"/resource.plist"]; + NSURL *theURL = [NSURL fileURLWithPath:content + isDirectory:NO]; + + NSLog(@"%@", theURL); + NSError *err; + if ([theURL checkResourceIsReachableAndReturnError:&err] == NO) + [[NSAlert alertWithError:err] runModal]; + else + [newArray addObject:item]; + } } - - if ([path containsString:@"Disabled"]) - [result.pluginStatus setImage:[NSImage imageNamed:@"NSStatusUnavailable"]]; } - result.pluginDescription.stringValue = [item objectForKey:@"description"]; - - if ([[confirmDelete objectAtIndex:row] boolValue]) - [result.pluginDelete setImage:[NSImage imageNamed:@"NSTrashFull"]]; - else - [result.pluginDelete setImage:[NSImage imageNamed:@"NSTrashEmpty"]]; - -// [result.pluginBlackList setEnabled:true]; -// NSNumber* n = [info objectForKey:@"SupportsBlackList"]; -// BOOL value = [n boolValue]; -// if (!value) -// [result.pluginBlackList setEnabled:false]; + [[NSUserDefaults standardUserDefaults] setObject:newArray forKey:@"sources"]; + [myPreferences setObject:newArray forKey:@"sources"]; + [_srcWin close]; + [_sourcesAllTable reloadData]; +} - if (icon) { - result.pluginImage.image = icon; - } else { -// result.pluginImage.image = [NSImage imageNamed:@"brick.png"]; - result.pluginImage.image = [[NSImage alloc] initWithContentsOfFile:@"/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns"]; - } - - [result.pluginWeb setImage:[NSImage imageNamed:@"webicon.png"]]; - [[result.pluginWeb cell] setImageScaling:NSImageScaleProportionallyUpOrDown]; - - [result.pluginWeb setEnabled:true]; - [result.pluginWeb setHidden:false]; - NSString* webURL = [info objectForKey:@"DevURL"]; - if (![webURL length]) { - [result.pluginWeb setEnabled:false]; - [result.pluginWeb setHidden:true]; - } - - - // Return the result - return result; +- (IBAction)sourceAddNew:(id)sender { + NSRect newFrame = _window.frame; + newFrame.origin.x += (_window.frame.size.width / 2) - (_srcWin.frame.size.width / 2); + newFrame.origin.y += (_window.frame.size.height / 2) - (_srcWin.frame.size.height / 2); + newFrame.size.width = _srcWin.frame.size.width; + newFrame.size.height = _srcWin.frame.size.height; + [_srcWin setFrame:newFrame display:true]; + NSWindowController *vc = [[NSWindowController alloc] initWithWindow:_srcWin]; + [vc showWindow:nil]; } -@end -@implementation CustomTableCell @end \ No newline at end of file diff --git a/mySIMBL/Base.lproj/Appliaction.xib b/mySIMBL/Base.lproj/Appliaction.xib index 005a95d..651486a 100644 --- a/mySIMBL/Base.lproj/Appliaction.xib +++ b/mySIMBL/Base.lproj/Appliaction.xib @@ -1,8 +1,9 @@ - + + @@ -12,214 +13,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + @@ -227,8 +57,8 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + + @@ -476,14 +540,8 @@ - - - - - - - + @@ -509,7 +567,7 @@ - + @@ -549,44 +607,32 @@ - + - - + + - - - - - - - - - - - + + @@ -612,7 +658,7 @@ - + @@ -669,26 +715,26 @@ - - + + - - - - - + + + + + - + - + @@ -706,7 +752,7 @@ - + @@ -714,7 +760,7 @@ - + @@ -722,7 +768,7 @@ - + @@ -730,7 +776,7 @@ - + @@ -746,18 +792,8 @@ - - + @@ -765,7 +801,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + - + + - + diff --git a/mySIMBL/Changelog.rtf b/mySIMBL/Changelog.rtf index 8630953..6699df2 100755 --- a/mySIMBL/Changelog.rtf +++ b/mySIMBL/Changelog.rtf @@ -1,31 +1,72 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf450 -{\fonttbl\f0\fswiss\fcharset0 Helvetica-Light;\f1\fswiss\fcharset0 Helvetica;\f2\fnil\fcharset204 LucidaGrande; -} -{\colortbl;\red255\green255\blue255;} -{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1} +{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf460 +{\fonttbl\f0\fswiss\fcharset0 Helvetica-Light;\f1\fnil\fcharset204 LucidaGrande;\f2\fnil\fcharset0 Menlo-Regular; +\f3\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;\red196\green26\blue22;} +{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid2\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid3\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li2160\lin2160 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid4\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li2880\lin2880 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid5\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li3600\lin3600 }{\listname ;}\listid1} {\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid2} {\list\listtemplateid3\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid201\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid3} {\list\listtemplateid4\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid301\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid4} {\list\listtemplateid5\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid401\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid5} {\list\listtemplateid6\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid501\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid6} {\list\listtemplateid7\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid601\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid602\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid7} -{\list\listtemplateid8\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid701\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid702\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid8} -{\list\listtemplateid9\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{square\}}{\leveltext\leveltemplateid801\'01\uc0\u9642 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid802\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid9} +{\list\listtemplateid8\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{square\}}{\leveltext\leveltemplateid701\'01\uc0\u9642 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid702\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid8} +{\list\listtemplateid9\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid801\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid802\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid9} {\list\listtemplateid10\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid901\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid902\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid10}} {\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}{\listoverride\listid3\listoverridecount0\ls3}{\listoverride\listid4\listoverridecount0\ls4}{\listoverride\listid5\listoverridecount0\ls5}{\listoverride\listid6\listoverridecount0\ls6}{\listoverride\listid7\listoverridecount0\ls7}{\listoverride\listid8\listoverridecount0\ls8}{\listoverride\listid9\listoverridecount0\ls9}{\listoverride\listid10\listoverridecount0\ls10}} \margl1440\margr1440\vieww15040\viewh13640\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\f0\fs22 \cf0 0.1.6\ +\f0\fs22 \cf0 0.2.0\ \ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls1\ilvl0\cf0 {\listtext \'95 }UI adjustments\ +\ls1\ilvl0\cf0 {\listtext \'95 }Sources view implemented \ +\pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural\partightenfactor0 +\ls1\ilvl1\cf0 {\listtext +\f1 \uc0\u8259 +\f0 }One repo included\ +{\listtext +\f1 \uc0\u8259 +\f0 }Basic repo implementation\ +{\listtext +\f1 \uc0\u8259 +\f0 }Structure\ +\pard\tx1660\tx2160\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li2160\fi-2160\pardirnatural\partightenfactor0 +\ls1\ilvl2\cf0 {\listtext +\f1 \uc0\u8259 +\f0 }Source View (Root)\ +\pard\tx2380\tx2880\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li2880\fi-2880\pardirnatural\partightenfactor0 +\ls1\ilvl3\cf0 {\listtext +\f1 \uc0\u8259 +\f0 }Source Bundles\ +\pard\tx3100\tx3600\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li3600\fi-3600\pardirnatural\partightenfactor0 +\ls1\ilvl4\cf0 {\listtext +\f1 \uc0\u8259 +\f0 }Bundle Page\ +\pard\tx560\tx1120\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 +\cf0 \ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 +\ls2\ilvl0\cf0 {\listtext \'95 }UI adjustments\ +{\listtext \'95 }Code refactoring\ +{\listtext \'95 }Startup tab preference\ +{\listtext \'95 }Bundles use icon of first application in SIMBLTargetApplications +\f2 \cf2 \CocoaLigature0 +\f0 \cf0 if no icon provided +\f2 \cf2 \ +\ls2\ilvl0 +\f0 \cf0 \CocoaLigature1 {\listtext \'95 }View source button in about page\ +{\listtext \'95 }Cells selectable in tables\ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 +\cf0 \ +0.1.6\ +\ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 +\ls3\ilvl0\cf0 {\listtext \'95 }UI adjustments\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 \cf0 \ 0.1.5\ \ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls2\ilvl0\cf0 {\listtext \'95 }UI adjustments\ +\ls4\ilvl0\cf0 {\listtext \'95 }UI adjustments\ {\listtext \'95 }Changed fonts\ {\listtext \'95 }Almost all preferences working\ {\listtext \'95 }Updated about page\ @@ -34,7 +75,7 @@ 0.1.4\ \ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls3\ilvl0\cf0 {\listtext \'95 }UI adjustments\ +\ls5\ilvl0\cf0 {\listtext \'95 }UI adjustments\ {\listtext \'95 }Inject into apps button\ {\listtext \'95 }Preferences mostly complete\ {\listtext \'95 }Delete bundle requires two clicks\ @@ -51,53 +92,56 @@ \cf0 0.1.2\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 \cf0 \ + \'95 Helper agent\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls4\ilvl0\cf0 {\listtext \'95 }System Integrity Protection warning\ -{\listtext \'95 }Helper agent\ +\ls6\ilvl0\cf0 {\listtext \'95 }System Integrity Protection warning\ {\listtext \'95 }Inject into specified system apps\ {\listtext \'95 }Offers to move self to /Applications\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls5\ilvl0\cf0 {\listtext \'95 }Drag and drop install bundles in /Library/Application Support/SIMBL/Plugins\ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls6\ilvl0\cf0 {\listtext \'95 }Open bundles with app to install in /Library/Application Support/SIMBL/Plugins\ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 \cf0 \'95 Show bundle in Finder (Magnifying Glass)\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls7\ilvl0\cf0 {\listtext \'95 }Toggle bundles between (Colored Circle Icon)\ +\ls7\ilvl0\cf0 {\listtext \'95 }Bundles will display custom icon if located in /Contents/icon.icns\ +{\listtext \'95 }Easy bundle installation\ \pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural\partightenfactor0 \ls7\ilvl1\cf0 {\listtext \f1 \uc0\u8259 -\f0 }/Library/Application Support/SIMBL/Plugins\ +\f0 }Drag and drop install bundles in /Library/Application Support/SIMBL/Plugins\ {\listtext \f1 \uc0\u8259 -\f0 }/Library/Application Support/SIMBL/Plugins (Disabled)\ -{\listtext -\f1 \uc0\u8259 -\f0 }~/Library/Application Support/SIMBL/Plugins\ +\f0 }Open bundles with app to install in /Library/Application Support/SIMBL/Plugins\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls8\ilvl0\cf0 {\listtext \'95 }Bundles will display custom icon if located in /Contents/icon.icns\ +\ls8\ilvl0\cf0 {\listtext +\f1 \uc0\u9642 +\f0 }Show bundle developer page (Globe Icon)\ \pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural\partightenfactor0 \ls8\ilvl1\cf0 {\listtext -\f1 \uc0\u8259 -\f0 }Otherwise bundles display default bundle icon\ +\f3 \uc0\u8259 +\f0 }plist value is string 'DevURL'\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 -\ls9\ilvl0\cf0 {\listtext -\f2 \uc0\u9642 -\f0 }Show bundle developer page (Globe Icon)\ +\ls9\ilvl0\cf0 {\listtext \'95 }Toggle bundles between (Colored Circle Icon)\ \pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural\partightenfactor0 \ls9\ilvl1\cf0 {\listtext -\f1 \uc0\u8259 -\f0 }Must have url included in /Contents/Info.plist\ +\f3 \uc0\u8259 +\f0 }/Library/Application Support/SIMBL/Plugins\ {\listtext -\f1 \uc0\u8259 -\f0 }plist value is string 'DevURL'\ +\f3 \uc0\u8259 +\f0 }/Library/Application Support/SIMBL/Plugins (Disabled)\ +{\listtext +\f3 \uc0\u8259 +\f0 }~/Library/Application Support/SIMBL/Plugins (User only)\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural\partightenfactor0 \ls10\ilvl0\cf0 {\listtext \'95 }Watch for changes to\ \pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural\partightenfactor0 \ls10\ilvl1\cf0 {\listtext \f1 \uc0\u8259 \f0 }/Library/Application Support/SIMBL/Plugins\ +\pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\pardirnatural\partightenfactor0 +\ls10\ilvl1 +\f3 \cf0 {\listtext \uc0\u8259 +\f0 } +\f3 /Library/Application Support/SIMBL/Plugins (Disabled)\ {\listtext \f1 \uc0\u8259 -\f0 }~/Library/Application Support/SIMBL/Plugins\ +\f0 } +\f3 ~/Library/Application Support/SIMBL/Plugins\ } \ No newline at end of file diff --git a/mySIMBL/Credits.rtf b/mySIMBL/Credits.rtf index 1caf786..8d0c06d 100755 --- a/mySIMBL/Credits.rtf +++ b/mySIMBL/Credits.rtf @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf450 +{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf460 {\fonttbl\f0\froman\fcharset0 TimesNewRomanPSMT;} {\colortbl;\red255\green255\blue255;\red0\green0\blue255;} \margl1440\margr1440\vieww9000\viewh8400\viewkind0 @@ -7,7 +7,10 @@ {\field{\*\fldinst{HYPERLINK "http://www.iconarchive.com/"}}{\fldrslt \f0\fs24 \cf2 \ul \ulc2 iconarchive.com/}} \f0\fs24 \cf2 \ul \ulc2 \ -{\field{\*\fldinst{HYPERLINK "http://www.culater.net/software/SIMBL/SIMBL.php"}}{\fldrslt culater.net/software/SIMBL/SIMBL.php}}\ +\pard\pardeftab720\partightenfactor0 +{\field{\*\fldinst{HYPERLINK "http://www.culater.net/software/SIMBL/SIMBL.php"}}{\fldrslt \cf2 culater.net/software/SIMBL/SIMBL.php}}\ +\pard\pardeftab720\partightenfactor0 +{\field{\*\fldinst{HYPERLINK "https://github.com/bfolder/BFNavigationController"}}{\fldrslt \cf2 github.com/bfolder/BFNavigationController}}\ \pard\pardeftab720\partightenfactor0 {\field{\*\fldinst{HYPERLINK "https://github.com/mz2/SCEvents"}}{\fldrslt \cf2 github.com/mz2/SCEvents}}\ \pard\pardeftab720\partightenfactor0 diff --git a/mySIMBL/Info.plist b/mySIMBL/Info.plist index dbe54e0..4505aac 100644 --- a/mySIMBL/Info.plist +++ b/mySIMBL/Info.plist @@ -2,6 +2,11 @@ + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + SUFeedURL https://github.com/w0lfschild/app_updates/raw/master/mySIMBL/appcast.xml CFBundleDevelopmentRegion @@ -36,11 +41,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.1.6 + 0.2.0 CFBundleSignature ???? CFBundleVersion - 6 + 11 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright diff --git a/mySIMBL/bundlePage.m b/mySIMBL/bundlePage.m new file mode 100644 index 0000000..959741b --- /dev/null +++ b/mySIMBL/bundlePage.m @@ -0,0 +1,260 @@ +// +// bundlePage.m +// mySIMBL +// +// Created by Wolfgang Baird on 3/24/16. +// Copyright © 2016 Wolfgang Baird. All rights reserved. +// + +@import AppKit; +@import WebKit; +#import "shareClass.h" +#import "AppDelegate.h" + +@interface bundlePage : NSView + +@property IBOutlet NSTextField* bundleName; +@property IBOutlet NSTextField* bundleVersion; +@property IBOutlet NSTextField* bundleSize; +@property IBOutlet NSTextField* bundleID; +@property IBOutlet NSTextField* bundleDev; +@property IBOutlet NSTextField* bundleTarget; +@property IBOutlet NSTextField* bundleDescription; +@property IBOutlet NSImageView* bundleImage; +@property IBOutlet NSButton* bundleInstall; +@property IBOutlet NSButton* bundleDelete; +@property IBOutlet NSButton* bundleContact; +@property IBOutlet NSButton* bundleDonate; +@property IBOutlet WebView* bundleWebView; + +@end + +extern AppDelegate* myDelegate; +extern NSString *repoPackages; +extern NSMutableArray *pluginsArray; +extern long selectedRow; + +@implementation bundlePage +{ + bool doOnce; + NSMutableDictionary* installedPlugins; + NSDictionary* item; +} + +-(void)viewWillDraw +{ + [self setWantsLayer:YES]; + self.layer.masksToBounds = YES; + self.layer.borderWidth = 1.0f; + [self.layer setBorderColor:[NSColor grayColor].CGColor]; + + NSURL *dicURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/packages.plist", repoPackages]]; + NSArray *allPlugins = [[NSArray alloc] initWithContentsOfURL:dicURL]; + item = [[NSMutableDictionary alloc] initWithDictionary:[allPlugins objectAtIndex:selectedRow]]; + + NSString* newString; + + newString = [NSString stringWithFormat:@"%@", [item objectForKey:@"name"]]; + self.bundleName.stringValue = newString; + + newString = [NSString stringWithFormat:@"Version : %@", [item objectForKey:@"version"]]; + self.bundleVersion.stringValue = newString; + + newString = [NSString stringWithFormat:@"Size : %@", [item objectForKey:@"size"]]; + self.bundleSize.stringValue = newString; + + newString = [NSString stringWithFormat:@"Description : %@", [item objectForKey:@"description"]]; + self.bundleDescription.stringValue = newString; + self.bundleDescription.toolTip = newString; + + newString = [NSString stringWithFormat:@"Bundle ID : %@", [item objectForKey:@"package"]]; + self.bundleID.stringValue = newString; + + newString = [NSString stringWithFormat:@"Target : %@", [item objectForKey:@"apps"]]; + self.bundleTarget.stringValue = newString; + + newString = [NSString stringWithFormat:@"Author : %@", [item objectForKey:@"author"]]; + self.bundleDev.stringValue = newString; + + if ([[item objectForKey:@"webpage"] length]) + { + // NSURL*url=[NSURL URLWithString:@"http://w0lfschild.github.io/app_cDock"]; + NSURL*url=[NSURL URLWithString:[item objectForKey:@"webpage"]]; + NSURLRequest*request=[NSURLRequest requestWithURL:url]; + [[self.bundleWebView mainFrame] loadRequest:request]; + if (!doOnce) + { + doOnce = true; + // [[[[[self.bundleWebView mainFrame] frameView] documentView] superview] scaleUnitSquareToSize:NSMakeSize(.5, .5)]; + } + } else { + [[self.bundleWebView mainFrame] loadHTMLString:nil baseURL:nil]; + } + + + installedPlugins = [[NSMutableDictionary alloc] init]; + for (NSDictionary* dict in pluginsArray) + { + NSString* str = [dict objectForKey:@"bundleId"]; + [installedPlugins setObject:dict forKey:str]; + } + + [self.bundleContact setTarget:self]; + [self.bundleDonate setTarget:self]; + + [self.bundleContact setAction:@selector(contactDev)]; + [self.bundleDonate setAction:@selector(donateDev)]; + + [self.bundleInstall setTarget:self]; + [self.bundleDelete setTarget:self]; + [self.bundleDelete setAction:@selector(pluginDelete)]; + if ([installedPlugins objectForKey:[item objectForKey:@"package"]]) + { + // Pack needs update + if (![[[[installedPlugins objectForKey:[item objectForKey:@"package"]] objectForKey:@"bundleInfo"] objectForKey:@"CFBundleShortVersionString"] isEqualToString:[item objectForKey:@"version"]]) + { + [self.bundleInstall setEnabled:true]; + self.bundleInstall.title = @"Update"; + [self.bundleInstall setAction:@selector(pluginUpdate)]; + } else { + [self.bundleInstall setEnabled:false]; + self.bundleInstall.title = @"Up to date"; + } + } else { + // Package not installed + [self.bundleInstall setEnabled:true]; + self.bundleInstall.title = @"Install"; + [self.bundleInstall setAction:@selector(pluginInstall)]; + } + + self.bundleImage.image = [self getbundleIcon:item]; + [self.bundleImage.cell setImageScaling:NSImageScaleProportionallyUpOrDown]; +} + +- (void)keyDown:(NSEvent *)theEvent +{ + NSString* const character = [theEvent charactersIgnoringModifiers]; + unichar const code = [character characterAtIndex:0]; + bool specKey = false; + switch (code) + { + case NSLeftArrowFunctionKey: + { + [myDelegate popView:nil]; + specKey = true; + break; + } + case NSRightArrowFunctionKey: + { + [myDelegate pushView:nil]; + specKey = true; + break; + } + case NSCarriageReturnCharacter: + { + [self.bundleInstall performClick:nil]; +// [myDelegate pushView:nil]; + specKey = true; + break; + } + } + + if (!specKey) + [super keyDown:theEvent]; +} + +- (void)contactDev +{ + NSURL *mailtoURL = [NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@", [item objectForKey:@"contact"]]]; + [[NSWorkspace sharedWorkspace] openURL:mailtoURL]; +} + +- (void)donateDev +{ + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[item objectForKey:@"donate"]]]; +} + +- (void)pluginInstall +{ + NSURL *installURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", repoPackages, [item objectForKey:@"filename"]]]; + NSData *myData = [NSData dataWithContentsOfURL:installURL]; + NSString *temp = [NSString stringWithFormat:@"/tmp/%@_%@", [item objectForKey:@"package"], [item objectForKey:@"version"]]; + [myData writeToFile:temp atomically:YES]; + NSArray* libDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSLocalDomainMask]; + NSString* libSupport = [[libDomain objectAtIndex:0] path]; + NSString* libPathENB = [NSString stringWithFormat:@"%@/SIMBL/Plugins", libSupport]; + NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/unzip" arguments:@[@"-o", temp, @"-d", libPathENB]]; + [task waitUntilExit]; + [self.bundleInstall setEnabled:false]; + self.bundleInstall.title = @"Up to date"; + shareClass* t = [[shareClass alloc] init]; + [t readPlugins:nil]; +} + +- (void)pluginUpdate +{ + NSURL *installURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", repoPackages, [item objectForKey:@"filename"]]]; + NSData *myData = [NSData dataWithContentsOfURL:installURL]; + NSString *temp = [NSString stringWithFormat:@"/tmp/%@_%@", [item objectForKey:@"package"], [item objectForKey:@"version"]]; + [myData writeToFile:temp atomically:YES]; + NSArray* libDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSLocalDomainMask]; + NSString* libSupport = [[libDomain objectAtIndex:0] path]; + NSString* libPathENB = [NSString stringWithFormat:@"%@/SIMBL/Plugins", libSupport]; + NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/unzip" arguments:@[@"-o", temp, @"-d", libPathENB]]; + [task waitUntilExit]; + [self.bundleInstall setEnabled:false]; + self.bundleInstall.title = @"Up to date"; + shareClass* t = [[shareClass alloc] init]; + [t readPlugins:nil]; +} + +- (void)pluginDelete +{ + int pos = 0; + bool found = false; + for (NSDictionary* dict in pluginsArray) + { + if ([[dict objectForKey:@"bundleId"] isEqualToString:[item objectForKey:@"package"]]) + { + found = true; + break; + } + pos += 1; + } + + if (found) + { + NSDictionary* obj = [pluginsArray objectAtIndex:pos]; + NSString* path = [obj objectForKey:@"path"]; + NSURL* url = [NSURL fileURLWithPath:path]; + NSURL* trash; + NSError* error; + [[NSFileManager defaultManager] trashItemAtURL:url resultingItemURL:&trash error:&error]; + } + + [self.bundleInstall setEnabled:true]; + self.bundleInstall.title = @"Install"; + [self.bundleInstall setAction:@selector(pluginInstall)]; +} + +- (NSImage*)getbundleIcon:(NSDictionary*)plist +{ + NSImage* result = nil; + NSArray* targets = [plist objectForKey:@"targets"]; + NSString* iconPath = @""; + for (NSDictionary* targetApp in targets) + { + iconPath = [targetApp objectForKey:@"BundleIdentifier"]; + iconPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:iconPath]; + if ([iconPath length]) + { + result = [[NSWorkspace sharedWorkspace] iconForFile:iconPath]; + if (result) return result; + } + } + + result = [[NSImage alloc] initWithContentsOfFile:@"/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns"]; + return result; +} + +@end \ No newline at end of file diff --git a/mySIMBL/loading_mini.gif b/mySIMBL/loading_mini.gif new file mode 100644 index 0000000..74bc2ea Binary files /dev/null and b/mySIMBL/loading_mini.gif differ diff --git a/mySIMBL/pluginTable.m b/mySIMBL/pluginTable.m new file mode 100644 index 0000000..59a0bf9 --- /dev/null +++ b/mySIMBL/pluginTable.m @@ -0,0 +1,255 @@ +// +// pluginTable.m +// TableTest +// +// Created by Wolfgang Baird on 3/12/16. +// Copyright © 2016 Wolfgang Baird. All rights reserved. +// + +@import AppKit; +#import "shareClass.h" + +extern NSMutableArray *confirmDelete; +extern NSMutableArray *pluginsArray; +NSInteger previusRow = -1; + +@interface pluginTable : NSObject +{ + shareClass *_sharedMethods; +} +@property (weak) IBOutlet NSTableView* tblView; +@end + +@interface CustomTableCell : NSTableCellView +@property (weak) IBOutlet NSButton* pluginDelete; +@property (weak) IBOutlet NSButton* pluginWeb; +@property (weak) IBOutlet NSButton* pluginStatus; +@property (weak) IBOutlet NSTextField* pluginName; +@property (weak) IBOutlet NSTextField* pluginDescription; +@property (weak) IBOutlet NSImageView* pluginImage; +@end + +@implementation pluginTable + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { + if (_sharedMethods == nil) + _sharedMethods = [shareClass alloc]; + return [pluginsArray count]; +} + +- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id )info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op { + return NSDragOperationCopy; +} + +- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id )info row:(int)row dropOperation:(NSTableViewDropOperation)operation { + NSPasteboard *pboard = [info draggingPasteboard]; + if ([[pboard types] containsObject:NSURLPboardType]) { + NSArray* urls = [pboard readObjectsForClasses:@[[NSURL class]] options:nil]; + NSMutableArray* sorted = [[NSMutableArray alloc] init]; + for (NSURL* url in urls) + { + if ([[url.path pathExtension] isEqualToString:@"bundle"]) + { + [sorted addObject:url.path]; + } + } + if ([sorted count]) + { + NSArray* installArray = [NSArray arrayWithArray:sorted]; + [_sharedMethods installBundles:installArray]; + } + } + return YES; +} + +-(NSColor*)inverseColor:(NSColor*)color +{ + CGFloat r,g,b,a; + [color getRed:&r green:&g blue:&b alpha:&a]; + return [NSColor colorWithRed:1.-r green:1.-g blue:1.-b alpha:a]; +} + +-(void)tableChange:(NSNotification *)aNotification +{ + id sender = [aNotification object]; + NSInteger selectedRow = [sender selectedRow]; + if (selectedRow != -1) { + if (selectedRow != previusRow) + { + NSColor *aColor = [[NSColor selectedControlColor] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + if (aColor) { + CustomTableCell *ctc = [sender viewAtColumn:0 row:selectedRow makeIfNecessary:YES]; + aColor = [self inverseColor:aColor]; + // [ctc.pluginName setFont:[NSFont boldSystemFontOfSize:13]]; + [ctc.pluginName setTextColor:aColor]; + [ctc.pluginDescription setTextColor:aColor]; + if (previusRow != -1) + { + CustomTableCell *ctc = [sender viewAtColumn:0 row:previusRow makeIfNecessary:YES]; + // [ctc.pluginName setFont:[NSFont systemFontOfSize:13]]; + [ctc.pluginName setTextColor:[NSColor blackColor]]; + [ctc.pluginDescription setTextColor:[NSColor grayColor]]; + } + previusRow = selectedRow; + } + + } + } + else { + // No row was selected + } +} + +- (void)tableViewSelectionDidChange:(NSNotification *)aNotification +{ + [self tableChange:aNotification]; +} + +- (void)tableViewSelectionIsChanging:(NSNotification *)aNotification +{ + [self tableChange:aNotification]; +} + +- (NSImage*)getbundleIcon:(NSDictionary*)plist +{ + NSImage* result = nil; + NSDictionary* info = [plist objectForKey:@"bundleInfo"]; + + NSString* iconPath = [NSString stringWithFormat:@"%@/Contents/icon.icns", [plist objectForKey:@"path"]]; + if ([iconPath length]) + { + result = [[NSImage alloc] initWithContentsOfFile:iconPath]; + if (result) return result; + } + + NSArray* SIMBLTargets = [info objectForKey:@"SIMBLTargetApplications"]; + for (NSDictionary* targetApp in SIMBLTargets) + { + iconPath = [targetApp objectForKey:@"BundleIdentifier"]; + iconPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:iconPath]; + if ([iconPath length]) + { + result = [[NSWorkspace sharedWorkspace] iconForFile:iconPath]; + if (result) return result; + } + } + + result = [[NSImage alloc] initWithContentsOfFile:@"/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns"]; + return result; +} + +- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + + CustomTableCell *result = (CustomTableCell*)[tableView makeViewWithIdentifier:@"MyView" owner:self]; + + NSDictionary* item = [pluginsArray objectAtIndex:row]; + NSDictionary* info = [item objectForKey:@"bundleInfo"]; + + result.pluginName.stringValue = [item objectForKey:@"name"]; + if([[item objectForKey:@"path"] length]){ + NSString *path = [item objectForKey:@"path"]; + NSArray *components = [path pathComponents]; + + if ([[components objectAtIndex:1] isEqualToString:@"Library"]) + { + [result.pluginStatus setImage:[NSImage imageNamed:@"NSStatusAvailable"]]; + } else { + [result.pluginStatus setImage:[NSImage imageNamed:@"NSStatusPartiallyAvailable"]]; + } + + if ([path containsString:@"Disabled"]) + [result.pluginStatus setImage:[NSImage imageNamed:@"NSStatusUnavailable"]]; + } + + result.pluginDescription.stringValue = [item objectForKey:@"description"]; + result.pluginImage.image = [self getbundleIcon:item]; + + if ([[confirmDelete objectAtIndex:row] boolValue]) + [result.pluginDelete setImage:[NSImage imageNamed:@"NSTrashFull"]]; + else + [result.pluginDelete setImage:[NSImage imageNamed:@"NSTrashEmpty"]]; + + // [result.pluginBlackList setEnabled:true]; + // NSNumber* n = [info objectForKey:@"SupportsBlackList"]; + // BOOL value = [n boolValue]; + // if (!value) + // [result.pluginBlackList setEnabled:false]; + + [result.pluginWeb setImage:[NSImage imageNamed:@"webicon.png"]]; + [[result.pluginWeb cell] setImageScaling:NSImageScaleProportionallyUpOrDown]; + + [result.pluginWeb setEnabled:true]; + [result.pluginWeb setHidden:false]; + NSString* webURL = [info objectForKey:@"DevURL"]; + if (![webURL length]) { + [result.pluginWeb setEnabled:false]; + [result.pluginWeb setHidden:true]; + } + + // Return the result + return result; +} + +- (IBAction)pluginWebpage:(id)sender { + NSTableView *t = (NSTableView*)[[[sender superview] superview] superview]; + NSDictionary* obj = [pluginsArray objectAtIndex:[t rowForView:sender]]; + NSString* webURL = [[obj objectForKey:@"bundleInfo"] objectForKey:@"DevURL"]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:webURL]]; +} + +- (IBAction)pluginFinder:(id)sender { + NSTableView *t = (NSTableView*)[[[sender superview] superview] superview]; + NSDictionary* obj = [pluginsArray objectAtIndex:[t rowForView:sender]]; + NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:[obj valueForKey:@"path"]]; + [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:[NSArray arrayWithObject:fileURL]]; +} + +- (IBAction)pluginToggle:(id)sender { + NSTableView *t = (NSTableView*)[[[sender superview] superview] superview]; + long selected = [t rowForView:sender]; + NSDictionary* obj = [pluginsArray objectAtIndex:selected]; + NSString* name = [obj objectForKey:@"name"]; + NSString* path = [obj objectForKey:@"path"]; + + NSArray* libDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSLocalDomainMask]; + NSArray* usrDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; + + NSString* libSupport = [[libDomain objectAtIndex:0] path]; + NSString* usrSupport = [[usrDomain objectAtIndex:0] path]; + + NSString* disPath = [NSString stringWithFormat:@"%@/SIMBL/Plugins (Disabled)/%@.bundle", libSupport, name]; + NSString* libPath = [NSString stringWithFormat:@"%@/SIMBL/Plugins/%@.bundle", libSupport, name]; + NSString* usrPath = [NSString stringWithFormat:@"%@/SIMBL/Plugins/%@.bundle", usrSupport, name]; + + if ([[obj objectForKey:@"path"] isEqualToString:disPath]) { + [_sharedMethods replaceFile:path :usrPath]; + } else if ([[obj objectForKey:@"path"] isEqualToString:usrPath]) { + [_sharedMethods replaceFile:path :libPath]; + } else { + [_sharedMethods replaceFile:path :disPath]; + } + + [_sharedMethods readPlugins:_tblView]; +} + +- (IBAction)pluginDelete:(id)sender { + NSTableView *t = (NSTableView*)[[[sender superview] superview] superview]; + long selected = [t rowForView:sender]; + if ([[confirmDelete objectAtIndex:selected] boolValue]) + { + NSDictionary* obj = [pluginsArray objectAtIndex:selected]; + NSString* path = [obj objectForKey:@"path"]; + NSURL* url = [NSURL fileURLWithPath:path]; + NSURL* trash; + NSError* error; + [[NSFileManager defaultManager] trashItemAtURL:url resultingItemURL:&trash error:&error]; + } + [_sharedMethods readPlugins:_tblView]; + [confirmDelete setObject:[NSNumber numberWithBool:true] atIndexedSubscript:selected]; +} + +@end + +@implementation CustomTableCell +@end + diff --git a/mySIMBL/repopluginTable.m b/mySIMBL/repopluginTable.m new file mode 100644 index 0000000..0f1d690 --- /dev/null +++ b/mySIMBL/repopluginTable.m @@ -0,0 +1,152 @@ +// +// repopluginTable.m +// mySIMBL +// +// Created by Wolfgang Baird on 3/24/16. +// Copyright © 2016 Wolfgang Baird. All rights reserved. +// + +@import AppKit; +#import "shareClass.h" +#import "AppDelegate.h" + +extern AppDelegate* myDelegate; +extern NSString *repoPackages; +long selectedRow; + +@interface repopluginTable : NSTableView +{ + shareClass *_sharedMethods; +} +@end + +@interface repopluginTableCell : NSTableCellView +@property (weak) IBOutlet NSTextField* bundleName; +@property (weak) IBOutlet NSTextField* bundleDescription; +@property (weak) IBOutlet NSTextField* bundleInfo; +@property (weak) IBOutlet NSTextField* bundleRepo; +@property (weak) IBOutlet NSImageView* bundleImage; +@property (weak) IBOutlet NSImageView* bundleIndicator; +@end + +@implementation repopluginTable +{ + NSArray *allPlugins; +} + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { + if (_sharedMethods == nil) + _sharedMethods = [shareClass alloc]; + + NSURL *dicURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/packages.plist", repoPackages]]; + allPlugins = [[NSArray alloc] initWithContentsOfURL:dicURL]; + + return [allPlugins count]; +} + +- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + repopluginTableCell *result = (repopluginTableCell*)[tableView makeViewWithIdentifier:@"psView" owner:self]; + NSDictionary* item = [[NSMutableDictionary alloc] initWithDictionary:[allPlugins objectAtIndex:row]]; + result.bundleName.stringValue = [item objectForKey:@"name"]; + result.bundleDescription.stringValue = [item objectForKey:@"description"]; + NSString *bInfo = [NSString stringWithFormat:@"%@ - %@ - %@", [item objectForKey:@"version"], [item objectForKey:@"package"], [item objectForKey:@"homepage"]]; + result.bundleInfo.stringValue = bInfo; + result.bundleDescription.toolTip = [item objectForKey:@"description"]; + result.bundleImage.image = [self getbundleIcon:item]; + [result.bundleImage.cell setImageScaling:NSImageScaleProportionallyUpOrDown]; + return result; +} + +- (void)keyDown:(NSEvent *)theEvent +{ + NSString* const character = [theEvent charactersIgnoringModifiers]; + unichar const code = [character characterAtIndex:0]; + bool specKey = false; + switch (code) + { + case NSLeftArrowFunctionKey: + { + [myDelegate popView:nil]; + specKey = true; + break; + } + case NSRightArrowFunctionKey: + { + [myDelegate pushView:nil]; + specKey = true; + break; + } + case NSCarriageReturnCharacter: + { + [myDelegate pushView:nil]; + specKey = true; + break; + } + } + + if (!specKey) + [super keyDown:theEvent]; +} + +-(void)tableChange:(NSNotification *)aNotification +{ + id sender = [aNotification object]; + selectedRow = [sender selectedRow]; +// if (selectedRow != -1) { +// sourceTableCell *ctc = [sender viewAtColumn:0 row:selectedRow makeIfNecessary:YES]; +// repoPackages = [sourceURLS objectAtIndex:selectedRow]; +// if (selectedRow != previusRow) +// { +// NSColor *aColor = [[NSColor selectedControlColor] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; +// if (aColor) { +// aColor = [self inverseColor:aColor]; +// [ctc.sourceName setTextColor:aColor]; +// [ctc.sourceDescription setTextColor:aColor]; +// if (previusRow != -1) +// { +// [ctc.sourceName setTextColor:[NSColor blackColor]]; +// [ctc.sourceDescription setTextColor:[NSColor grayColor]]; +// } +// previusRow = selectedRow; +// } +// } +// } +// else { +// // No row was selected +// } +} + +- (void)tableViewSelectionDidChange:(NSNotification *)aNotification +{ + [self tableChange:aNotification]; +} + +- (void)tableViewSelectionIsChanging:(NSNotification *)aNotification +{ + [self tableChange:aNotification]; +} + +- (NSImage*)getbundleIcon:(NSDictionary*)plist +{ + NSImage* result = nil; + NSArray* targets = [plist objectForKey:@"targets"]; + NSString* iconPath = @""; + for (NSDictionary* targetApp in targets) + { + iconPath = [targetApp objectForKey:@"BundleIdentifier"]; + iconPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:iconPath]; + if ([iconPath length]) + { + result = [[NSWorkspace sharedWorkspace] iconForFile:iconPath]; + if (result) return result; + } + } + + result = [[NSImage alloc] initWithContentsOfFile:@"/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns"]; + return result; +} + +@end + +@implementation repopluginTableCell +@end \ No newline at end of file diff --git a/mySIMBL/shareClass.h b/mySIMBL/shareClass.h new file mode 100644 index 0000000..601eccb --- /dev/null +++ b/mySIMBL/shareClass.h @@ -0,0 +1,15 @@ +// +// shareClass.h +// mySIMBL +// +// Created by Wolfgang Baird on 3/13/16. +// Copyright © 2016 Wolfgang Baird. All rights reserved. +// + +@interface shareClass : NSObject + +- (void)readPlugins:(NSTableView *)pluginTable; +- (void)replaceFile:(NSString*)start :(NSString*)end; +- (void)installBundles:(NSArray*)pathArray; + +@end diff --git a/mySIMBL/shareClass.m b/mySIMBL/shareClass.m new file mode 100644 index 0000000..15cd443 --- /dev/null +++ b/mySIMBL/shareClass.m @@ -0,0 +1,136 @@ +// +// shareClass.m +// mySIMBL +// +// Created by Wolfgang Baird on 3/13/16. +// Copyright © 2016 Wolfgang Baird. All rights reserved. +// + +@import AppKit; +#import "shareClass.h" + +extern NSMutableArray *pluginsArray; +extern NSMutableArray *confirmDelete; + +@implementation shareClass + +- (void)installBundles:(NSArray*)pathArray { + // NSLog(@"%@", pathArray); + NSArray* libDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSLocalDomainMask]; + NSString* libSupport = [[libDomain objectAtIndex:0] path]; + for (NSString* path in pathArray) { + if ([[path pathExtension] isEqualToString:@"bundle"]) + { + NSArray* pathComp=[path pathComponents]; + NSString* name=[pathComp objectAtIndex:[pathComp count] - 1]; + NSString* libPath = [NSString stringWithFormat:@"%@/SIMBL/Plugins/%@", libSupport, name]; + // NSLog(@"\n%@\n%@", libPath, path); + [self replaceFile:path :libPath]; + } + } +} + +- (void)replaceFile:(NSString*)start :(NSString*)end { + NSError* error; + if ([[NSFileManager defaultManager] fileExistsAtPath:end]) { + // NSLog(@"File Exists"); + [[NSFileManager defaultManager] replaceItemAtURL:[NSURL fileURLWithPath:end] withItemAtURL:[NSURL fileURLWithPath:start] backupItemName:nil options:NSFileManagerItemReplacementUsingNewMetadataOnly resultingItemURL:nil error:&error]; + } else { + // NSLog(@"File Doesn't Exist"); + [[NSFileManager defaultManager] moveItemAtURL:[NSURL fileURLWithPath:start] toURL:[NSURL fileURLWithPath:end] error:&error]; + } + // NSLog(@"%@", error); +} + +- (void)readFolder:(NSString *)str :(NSMutableDictionary *)dict { + + NSArray *appFolderContents = [[NSArray alloc] init]; + appFolderContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:str error:nil]; + + for (NSString* fileName in appFolderContents) { + if ([fileName hasSuffix:@".bundle"]) { + NSString* path=[str stringByAppendingPathComponent:fileName]; + NSString* name=[fileName stringByDeletingPathExtension]; + //check Info.plist + NSBundle* bundle = [NSBundle bundleWithPath:path]; + NSDictionary* info=[bundle infoDictionary]; + // NSDictionary* info=nil; + NSString* bundleIdentifier=[bundle bundleIdentifier]; + if(![bundleIdentifier length])bundleIdentifier=@"(null)"; + + NSString* bundleVersion=[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; + if(![bundleVersion length])bundleVersion=[bundle objectForInfoDictionaryKey:@"CFBundleVersion"]; + + NSString* description=bundleIdentifier; + if([bundleVersion length]){ + description=[NSString stringWithFormat:@"%@ - %@", bundleVersion, description]; + } + + NSArray *components = [path pathComponents]; + NSString* location= [components objectAtIndex:1]; + NSString* endcomp= [components objectAtIndex:[components count] - 2]; + if([location length]){ + if ([endcomp containsString:@"Disabled"]) + { + description=[NSString stringWithFormat:@"%@ - %@ (Disabled)", description, location]; + } else { + description=[NSString stringWithFormat:@"%@ - %@", description, location]; + } + } + + NSMutableDictionary* itm=[NSMutableDictionary dictionaryWithObjectsAndKeys: + name, @"name", path, @"path", description, @"description", + bundleIdentifier, @"bundleId", bundleVersion, @"version", + info, @"bundleInfo", + [NSNumber numberWithBool:YES], @"enabled", + [NSNumber numberWithBool:NO], @"fileSystemConflict", + nil]; + + NSString* nameandPath = [NSString stringWithFormat:@"%@ - %@", name, path]; + + [dict setObject:itm forKey:nameandPath]; + } + } +} + +- (void)readPlugins:(NSTableView *)pluginTable { + pluginsArray = [[NSMutableArray alloc] init]; + confirmDelete = [[NSMutableArray alloc] init]; + NSMutableDictionary *myDict = [[NSMutableDictionary alloc] init]; + + NSArray* libDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSLocalDomainMask]; + NSArray* usrDomain = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask]; + + NSString* libSupport = [[libDomain objectAtIndex:0] path]; + NSString* usrSupport = [[usrDomain objectAtIndex:0] path]; + + NSString* libPathENB = [NSString stringWithFormat:@"%@/SIMBL/Plugins", libSupport]; + NSString* libPathDIS = [NSString stringWithFormat:@"%@/SIMBL/Plugins (Disabled)", libSupport]; + + NSString* usrPathENB = [NSString stringWithFormat:@"%@/SIMBL/Plugins", usrSupport]; + NSString* usrPathDIS = [NSString stringWithFormat:@"%@/SIMBL/Plugins (Disabled)", usrSupport]; + + NSString* OpeePath = [NSString stringWithFormat:@"/Library/Opee/Extensions"]; + + [self readFolder:libPathENB :myDict]; + [self readFolder:libPathDIS :myDict]; + + [self readFolder:usrPathENB :myDict]; + [self readFolder:usrPathDIS :myDict]; + + [self readFolder:OpeePath :myDict]; + + NSArray *keys = [myDict allKeys]; + NSArray *sortedKeys = [keys sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; + // sortedKeys = [[sortedKeys reverseObjectEnumerator] allObjects]; + + for (NSString *app in sortedKeys) + { + [pluginsArray addObject:[myDict valueForKey:app]]; + [confirmDelete addObject:[NSNumber numberWithBool:false]]; + } + + [pluginTable reloadData]; +} + +@end \ No newline at end of file diff --git a/mySIMBL/sourcesTable.m b/mySIMBL/sourcesTable.m new file mode 100644 index 0000000..cdbb952 --- /dev/null +++ b/mySIMBL/sourcesTable.m @@ -0,0 +1,161 @@ +// +// sourcesTable.m +// mySIMBL +// +// Created by Wolfgang Baird on 3/13/16. +// Copyright © 2016 Wolfgang Baird. All rights reserved. +// + +@import AppKit; +#import "shareClass.h" +#import "AppDelegate.h" + +extern AppDelegate* myDelegate; +NSString *repoPackages = @""; +NSArray *sourceURLS; + +@interface sourcesTable : NSTableView +{ + shareClass *_sharedMethods; +} +@end + +@interface sourceTableCell : NSTableCellView +@property (weak) IBOutlet NSTextField* sourceName; +@property (weak) IBOutlet NSTextField* sourceDescription; +@property (weak) IBOutlet NSImageView* sourceImage; +@property (weak) IBOutlet NSImageView* sourceIndicator; +@end + +@implementation sourcesTable +{ + NSInteger previusRow; + NSDictionary* item; +} + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { + if (_sharedMethods == nil) + _sharedMethods = [shareClass alloc]; + +// [self setTarget:self]; +// [self setDoubleAction:@selector(doubleClickInTable:)]; + + item = [[NSMutableDictionary alloc] initWithDictionary:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]; + sourceURLS = [item objectForKey:@"sources"]; + + return [sourceURLS count]; +} + +- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + sourceTableCell *result = (sourceTableCell*)[tableView makeViewWithIdentifier:@"sView" owner:self]; + + result.sourceIndicator.animates = YES; + result.sourceIndicator.image = [NSImage imageNamed:@"loading_mini.gif"]; + result.sourceIndicator.canDrawSubviewsIntoLayer = YES; + [result.superview setWantsLayer:YES]; + + dispatch_queue_t backgroundQueue = dispatch_queue_create("com.w0lf.mySIMBL", 0); + dispatch_async(backgroundQueue, ^{ + NSArray* sourceURLS = [item objectForKey:@"sources"]; + NSString* source = [sourceURLS objectAtIndex:row]; + NSURL* data = [NSURL URLWithString:[NSString stringWithFormat:@"%@/resource.plist", source]]; + NSMutableDictionary* dic = [[NSMutableDictionary alloc] initWithContentsOfURL:data]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [result.sourceIndicator setImage:[NSImage imageNamed:NSImageNameRightFacingTriangleTemplate]]; + + if ([source length]) + result.sourceDescription.stringValue = source; + + if (dic) + { + if ([dic objectForKey:@"name"]) + result.sourceName.stringValue = [dic objectForKey:@"name"]; + result.sourceImage.image = [[NSImage alloc] initByReferencingURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/icon.png", source]]]; + } + }); + }); + + return result; +} + +-(NSColor*)inverseColor:(NSColor*)color +{ + CGFloat r,g,b,a; + [color getRed:&r green:&g blue:&b alpha:&a]; + return [NSColor colorWithRed:1.-r green:1.-g blue:1.-b alpha:a]; +} + +- (void)keyDown:(NSEvent *)theEvent +{ + NSString* const character = [theEvent charactersIgnoringModifiers]; + unichar const code = [character characterAtIndex:0]; + bool specKey = false; + switch (code) + { + case NSLeftArrowFunctionKey: + { + [myDelegate popView:nil]; + specKey = true; + break; + } + case NSRightArrowFunctionKey: + { + [myDelegate pushView:nil]; + specKey = true; + break; + } + case NSCarriageReturnCharacter: + { + [myDelegate pushView:nil]; + specKey = true; + break; + } + } + + if (!specKey) + [super keyDown:theEvent]; +} + +-(void)tableChange:(NSNotification *)aNotification +{ + id sender = [aNotification object]; + NSInteger selectedRow = [sender selectedRow]; + if (selectedRow != -1) { + sourceTableCell *ctc = [sender viewAtColumn:0 row:selectedRow makeIfNecessary:YES]; + repoPackages = [sourceURLS objectAtIndex:selectedRow]; + if (selectedRow != previusRow) + { + NSColor *aColor = [[NSColor selectedControlColor] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + if (aColor) { + aColor = [self inverseColor:aColor]; + [ctc.sourceName setTextColor:aColor]; + [ctc.sourceDescription setTextColor:aColor]; + if (previusRow != -1) + { + [ctc.sourceName setTextColor:[NSColor blackColor]]; + [ctc.sourceDescription setTextColor:[NSColor grayColor]]; + } + previusRow = selectedRow; + } + } + } + else { + // No row was selected + } +} + +- (void)tableViewSelectionDidChange:(NSNotification *)aNotification +{ + [self tableChange:aNotification]; +} + +- (void)tableViewSelectionIsChanging:(NSNotification *)aNotification +{ + [self tableChange:aNotification]; +} + +@end + +@implementation sourceTableCell +@end \ No newline at end of file