diff --git a/App/BitBar.xcodeproj/project.pbxproj b/App/BitBar.xcodeproj/project.pbxproj index 70fd3cba3..e8a0fbf21 100644 --- a/App/BitBar.xcodeproj/project.pbxproj +++ b/App/BitBar.xcodeproj/project.pbxproj @@ -16,21 +16,13 @@ 055EB111183472D300FF83A6 /* NSDateTimeAgo.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 055EB10F183472D300FF83A6 /* NSDateTimeAgo.bundle */; }; 059971961833394500EA6D8D /* Plugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 059971951833394500EA6D8D /* Plugin.m */; }; 0599719818333DB300EA6D8D /* PluginTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0599719718333DB300EA6D8D /* PluginTest.m */; }; - 05DADFF4183323DD00409786 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05DADFF3183323DD00409786 /* Cocoa.framework */; }; - 05DADFFE183323DD00409786 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 05DADFFC183323DD00409786 /* InfoPlist.strings */; }; - 05DAE000183323DD00409786 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 05DADFFF183323DD00409786 /* main.m */; }; - 05DAE004183323DD00409786 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 05DAE002183323DD00409786 /* Credits.rtf */; }; 05DAE007183323DD00409786 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 05DAE006183323DD00409786 /* AppDelegate.m */; }; - 05DAE013183323DD00409786 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05DAE012183323DD00409786 /* XCTest.framework */; }; - 05DAE014183323DD00409786 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05DADFF3183323DD00409786 /* Cocoa.framework */; }; - 05DAE01C183323DD00409786 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 05DAE01A183323DD00409786 /* InfoPlist.strings */; }; 05DAE02D1833274100409786 /* PluginManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 05DAE02C1833274100409786 /* PluginManager.m */; }; 05DAE02F1833276C00409786 /* PluginManagerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 05DAE02E1833276C00409786 /* PluginManagerTest.m */; }; A22AF329189F823E0011DFCD /* NSColor+Hex.m in Sources */ = {isa = PBXBuildFile; fileRef = A22AF328189F823E0011DFCD /* NSColor+Hex.m */; }; A22AF32A189F823E0011DFCD /* NSColor+Hex.m in Sources */ = {isa = PBXBuildFile; fileRef = A22AF328189F823E0011DFCD /* NSColor+Hex.m */; }; A281BDB5189066DE00C380A4 /* ExecutablePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = A281BDB4189066DE00C380A4 /* ExecutablePlugin.m */; }; A281BDB81890670800C380A4 /* HTMLPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = A281BDB71890670800C380A4 /* HTMLPlugin.m */; }; - A281BDBA1890721900C380A4 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A281BDB91890721900C380A4 /* WebKit.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -47,7 +39,7 @@ 0531DCD81844070A007F0A96 /* App.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = App.xib; sourceTree = ""; }; 0531DCE018440F93007F0A96 /* bitbar-icons.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = "bitbar-icons.icns"; path = "../bitbar-icons.icns"; sourceTree = ""; }; 05322A421833F7F2004D9AFE /* BitBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitBarController.h; sourceTree = ""; }; - 05322A431833F7F2004D9AFE /* BitBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BitBarController.m; sourceTree = ""; }; + 05322A431833F7F2004D9AFE /* BitBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = BitBarController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 05322A47183406E2004D9AFE /* Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Settings.h; sourceTree = ""; }; 05322A48183406E2004D9AFE /* Settings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Settings.m; sourceTree = ""; }; 055819761834172E00B44B00 /* LaunchAtLoginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchAtLoginController.h; sourceTree = ""; }; @@ -58,35 +50,24 @@ 05997192183335BF00EA6D8D /* two.5m.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = two.5m.sh; sourceTree = ""; }; 05997193183335C700EA6D8D /* three.7d.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = three.7d.sh; sourceTree = ""; }; 059971941833394500EA6D8D /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = ""; }; - 059971951833394500EA6D8D /* Plugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Plugin.m; sourceTree = ""; }; - 0599719718333DB300EA6D8D /* PluginTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginTest.m; sourceTree = ""; }; + 059971951833394500EA6D8D /* Plugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = Plugin.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + 0599719718333DB300EA6D8D /* PluginTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PluginTest.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 05DADFF0183323DD00409786 /* BitBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BitBar.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 05DADFF3183323DD00409786 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; - 05DADFF6183323DD00409786 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; - 05DADFF7183323DD00409786 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; - 05DADFF8183323DD00409786 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 05DADFFB183323DD00409786 /* BitBar-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BitBar-Info.plist"; sourceTree = ""; }; - 05DADFFD183323DD00409786 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 05DADFFF183323DD00409786 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 05DAE001183323DD00409786 /* BitBar-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BitBar-Prefix.pch"; sourceTree = ""; }; - 05DAE003183323DD00409786 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; - 05DAE005183323DD00409786 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 05DAE006183323DD00409786 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 05DAE006183323DD00409786 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = BitBar/AppDelegate.m; sourceTree = ""; }; 05DAE011183323DD00409786 /* BitBarTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BitBarTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 05DAE012183323DD00409786 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 05DAE019183323DD00409786 /* BitBarTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BitBarTests-Info.plist"; sourceTree = ""; }; - 05DAE01B183323DD00409786 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 05DAE02B1833274100409786 /* PluginManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginManager.h; sourceTree = ""; }; - 05DAE02C1833274100409786 /* PluginManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginManager.m; sourceTree = ""; }; - 05DAE02E1833276C00409786 /* PluginManagerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginManagerTest.m; sourceTree = ""; }; + 05DAE02C1833274100409786 /* PluginManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PluginManager.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + 05DAE02E1833276C00409786 /* PluginManagerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PluginManagerTest.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 05DAE031183329C500409786 /* one.10s.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = one.10s.sh; sourceTree = ""; }; A22AF327189F823E0011DFCD /* NSColor+Hex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSColor+Hex.h"; sourceTree = ""; }; A22AF328189F823E0011DFCD /* NSColor+Hex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSColor+Hex.m"; sourceTree = ""; }; A281BDB3189066DE00C380A4 /* ExecutablePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutablePlugin.h; sourceTree = ""; }; - A281BDB4189066DE00C380A4 /* ExecutablePlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExecutablePlugin.m; sourceTree = ""; }; + A281BDB4189066DE00C380A4 /* ExecutablePlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ExecutablePlugin.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; A281BDB61890670800C380A4 /* HTMLPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLPlugin.h; sourceTree = ""; }; - A281BDB71890670800C380A4 /* HTMLPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HTMLPlugin.m; sourceTree = ""; }; - A281BDB91890721900C380A4 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + A281BDB71890670800C380A4 /* HTMLPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = HTMLPlugin.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -94,8 +75,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A281BDBA1890721900C380A4 /* WebKit.framework in Frameworks */, - 05DADFF4183323DD00409786 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -103,8 +82,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 05DAE014183323DD00409786 /* Cocoa.framework in Frameworks */, - 05DAE013183323DD00409786 /* XCTest.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -118,6 +95,7 @@ 05322A431833F7F2004D9AFE /* BitBarController.m */, ); name = Controller; + path = BitBar; sourceTree = ""; }; 05322A46183406D7004D9AFE /* Settings */ = { @@ -127,6 +105,7 @@ 05322A48183406E2004D9AFE /* Settings.m */, ); name = Settings; + path = BitBar; sourceTree = ""; }; 055819751834171900B44B00 /* LaunchAtLoginController */ = { @@ -141,6 +120,7 @@ 055EB10C183472C400FF83A6 /* Lib */ = { isa = PBXGroup; children = ( + 055819751834171900B44B00 /* LaunchAtLoginController */, 055EB10D183472D300FF83A6 /* NSDate+TimeAgo.h */, 055EB10E183472D300FF83A6 /* NSDate+TimeAgo.m */, 055EB10F183472D300FF83A6 /* NSDateTimeAgo.bundle */, @@ -148,21 +128,19 @@ A22AF328189F823E0011DFCD /* NSColor+Hex.m */, ); name = Lib; - sourceTree = ""; - }; - 059971991833E3F300EA6D8D /* Commands */ = { - isa = PBXGroup; - children = ( - ); - name = Commands; + path = BitBar; sourceTree = ""; }; 05DADFE7183323DD00409786 = { isa = PBXGroup; children = ( - 05DADFF9183323DD00409786 /* BitBar */, + 055EB10C183472C400FF83A6 /* Lib */, + 05322A46183406D7004D9AFE /* Settings */, + 05322A411833F7E4004D9AFE /* Controller */, + 05DAE0271833241D00409786 /* Plugins */, + 05DAE006183323DD00409786 /* AppDelegate.m */, + 05DADFFA183323DD00409786 /* Supporting Files */, 05DAE017183323DD00409786 /* BitBarTests */, - 05DADFF2183323DD00409786 /* Frameworks */, 05DADFF1183323DD00409786 /* Products */, ); sourceTree = ""; @@ -176,55 +154,16 @@ name = Products; sourceTree = ""; }; - 05DADFF2183323DD00409786 /* Frameworks */ = { - isa = PBXGroup; - children = ( - A281BDB91890721900C380A4 /* WebKit.framework */, - 05DADFF3183323DD00409786 /* Cocoa.framework */, - 05DAE012183323DD00409786 /* XCTest.framework */, - 05DADFF5183323DD00409786 /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; - 05DADFF5183323DD00409786 /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 05DADFF6183323DD00409786 /* AppKit.framework */, - 05DADFF7183323DD00409786 /* CoreData.framework */, - 05DADFF8183323DD00409786 /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 05DADFF9183323DD00409786 /* BitBar */ = { - isa = PBXGroup; - children = ( - 055EB10C183472C400FF83A6 /* Lib */, - 055819751834171900B44B00 /* LaunchAtLoginController */, - 05322A46183406D7004D9AFE /* Settings */, - 05322A411833F7E4004D9AFE /* Controller */, - 059971991833E3F300EA6D8D /* Commands */, - 05DAE0271833241D00409786 /* Plugins */, - 05DAE005183323DD00409786 /* AppDelegate.h */, - 05DAE006183323DD00409786 /* AppDelegate.m */, - 05DADFFA183323DD00409786 /* Supporting Files */, - ); - path = BitBar; - sourceTree = ""; - }; 05DADFFA183323DD00409786 /* Supporting Files */ = { isa = PBXGroup; children = ( 0531DCE018440F93007F0A96 /* bitbar-icons.icns */, 05DADFFB183323DD00409786 /* BitBar-Info.plist */, - 05DADFFC183323DD00409786 /* InfoPlist.strings */, - 05DADFFF183323DD00409786 /* main.m */, 05DAE001183323DD00409786 /* BitBar-Prefix.pch */, - 05DAE002183323DD00409786 /* Credits.rtf */, 0531DCD81844070A007F0A96 /* App.xib */, ); name = "Supporting Files"; + path = BitBar; sourceTree = ""; }; 05DAE017183323DD00409786 /* BitBarTests */ = { @@ -242,7 +181,6 @@ isa = PBXGroup; children = ( 05DAE019183323DD00409786 /* BitBarTests-Info.plist */, - 05DAE01A183323DD00409786 /* InfoPlist.strings */, ); name = "Supporting Files"; sourceTree = ""; @@ -260,6 +198,7 @@ A281BDB71890670800C380A4 /* HTMLPlugin.m */, ); name = Plugins; + path = BitBar; sourceTree = ""; }; 05DAE030183329B300409786 /* TestPlugins */ = { @@ -355,11 +294,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 05DADFFE183323DD00409786 /* InfoPlist.strings in Resources */, 0531DCD91844070A007F0A96 /* App.xib in Resources */, 0531DCE118440F93007F0A96 /* bitbar-icons.icns in Resources */, 055EB111183472D300FF83A6 /* NSDateTimeAgo.bundle in Resources */, - 05DAE004183323DD00409786 /* Credits.rtf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -367,7 +304,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 05DAE01C183323DD00409786 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -388,7 +324,6 @@ 05322A441833F7F2004D9AFE /* BitBarController.m in Sources */, 059971961833394500EA6D8D /* Plugin.m in Sources */, 055819781834172E00B44B00 /* LaunchAtLoginController.m in Sources */, - 05DAE000183323DD00409786 /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -412,33 +347,6 @@ }; /* End PBXTargetDependency section */ -/* Begin PBXVariantGroup section */ - 05DADFFC183323DD00409786 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 05DADFFD183323DD00409786 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - 05DAE002183323DD00409786 /* Credits.rtf */ = { - isa = PBXVariantGroup; - children = ( - 05DAE003183323DD00409786 /* en */, - ); - name = Credits.rtf; - sourceTree = ""; - }; - 05DAE01A183323DD00409786 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 05DAE01B183323DD00409786 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - /* Begin XCBuildConfiguration section */ 05DAE01F183323DD00409786 /* Debug */ = { isa = XCBuildConfiguration; @@ -446,6 +354,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; @@ -456,7 +365,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = c11; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -483,6 +392,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; @@ -495,7 +405,7 @@ COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = c11; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; diff --git a/App/BitBar/AppDelegate.h b/App/BitBar/AppDelegate.h deleted file mode 100644 index e2d1ab4b0..000000000 --- a/App/BitBar/AppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AppDelegate.h -// BitBar -// -// Created by Mat Ryer on 11/12/13. -// Copyright (c) 2013 Bit Bar. All rights reserved. -// - -#import -@class BitBarController; - -@interface AppDelegate : NSObject - -@property (assign) IBOutlet NSWindow *window; - -@property (nonatomic, strong) BitBarController* controller; - -@end diff --git a/App/BitBar/AppDelegate.m b/App/BitBar/AppDelegate.m index d49d5cc44..ba3806434 100644 --- a/App/BitBar/AppDelegate.m +++ b/App/BitBar/AppDelegate.m @@ -6,9 +6,16 @@ // Copyright (c) 2013 Bit Bar. All rights reserved. // -#import "AppDelegate.h" #import "BitBarController.h" +@interface AppDelegate : NSObject + +@property (assign) IBOutlet NSWindow *window; + +@property (nonatomic) BitBarController* controller; + +@end + @implementation AppDelegate - (void)applicationDidFinishLaunching:(NSNotification *)aNotification @@ -16,9 +23,14 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification // enable usage of Safari's WebInspector to debug HTML Plugins [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitDeveloperExtras"]; - self.controller = [[BitBarController alloc] init]; + self.controller = BitBarController.new; [self.controller startApp]; } @end + +int main(int argc, const char * argv[]) +{ + return NSApplicationMain(argc, argv); +} diff --git a/App/BitBar/BitBarController.h b/App/BitBar/BitBarController.h index ece6c9a2b..bb9fdcf27 100644 --- a/App/BitBar/BitBarController.h +++ b/App/BitBar/BitBarController.h @@ -6,12 +6,11 @@ // Copyright (c) 2013 Bit Bar. All rights reserved. // -#import @class PluginManager; @interface BitBarController : NSObject -@property (nonatomic, strong) PluginManager *pluginManager; +@property (nonatomic) PluginManager *pluginManager; - (void) startApp; diff --git a/App/BitBar/BitBarController.m b/App/BitBar/BitBarController.m index 7461d9921..e9fd84cb2 100644 --- a/App/BitBar/BitBarController.m +++ b/App/BitBar/BitBarController.m @@ -16,14 +16,14 @@ @implementation BitBarController - (void) startApp { if ([Settings isFirstTimeAppRun]) { - LaunchAtLoginController *launcher = [[LaunchAtLoginController alloc] init]; + LaunchAtLoginController *launcher = LaunchAtLoginController.new; if (!launcher.launchAtLogin) { [launcher setLaunchAtLogin:YES]; } } // make a plugin manager - self.pluginManager = [[PluginManager alloc] initWithPluginPath:[Settings pluginsDirectory]]; + self.pluginManager = [PluginManager.alloc initWithPluginPath:[Settings pluginsDirectory]]; [self.pluginManager setupAllPlugins]; diff --git a/App/BitBar/ExecutablePlugin.m b/App/BitBar/ExecutablePlugin.m index 43924a64c..6e9932933 100644 --- a/App/BitBar/ExecutablePlugin.m +++ b/App/BitBar/ExecutablePlugin.m @@ -17,7 +17,7 @@ - (BOOL) refreshContentByExecutingCommand { return NO; } - NSTask *task = [[NSTask alloc] init]; + NSTask *task = NSTask.new; [task setEnvironment:self.manager.environment]; [task setLaunchPath:self.path]; @@ -39,8 +39,8 @@ - (BOOL) refreshContentByExecutingCommand { [task waitUntilExit]; - self.content = [[NSString alloc] initWithData:stdoutData encoding:NSUTF8StringEncoding]; - self.errorContent = [[NSString alloc] initWithData:stderrData encoding:NSUTF8StringEncoding]; + self.content = [NSString.alloc initWithData:stdoutData encoding:NSUTF8StringEncoding]; + self.errorContent = [NSString.alloc initWithData:stderrData encoding:NSUTF8StringEncoding]; // failure if ([task terminationStatus] != 0) { @@ -65,7 +65,7 @@ -(BOOL)refresh { [self refreshContentByExecutingCommand]; dispatch_sync(dispatch_get_main_queue(), ^{ - self.lastUpdated = [[NSDate alloc] init]; + self.lastUpdated = NSDate.new; [self rebuildMenuForStatusItem:self.statusItem]; @@ -122,14 +122,14 @@ - (void) runPluginExternally { NSString *s = [NSString stringWithFormat: script, self.path]; - NSAppleScript *as = [[NSAppleScript alloc] initWithSource:s]; + NSAppleScript *as = [NSAppleScript.alloc initWithSource:s]; [as executeAndReturnError:nil]; } - (void) addAdditionalMenuItems:(NSMenu *)menu { - NSMenuItem *runItem = [[NSMenuItem alloc] initWithTitle:@"Run in Terminal…" action:@selector(runPluginExternally) keyEquivalent:@"o"]; + NSMenuItem *runItem = [NSMenuItem.alloc initWithTitle:@"Run in Terminal…" action:@selector(runPluginExternally) keyEquivalent:@"o"]; [runItem setTarget:self]; [menu addItem:runItem]; diff --git a/App/BitBar/HTMLPlugin.m b/App/BitBar/HTMLPlugin.m index 0ea5619fd..7fe8f1234 100644 --- a/App/BitBar/HTMLPlugin.m +++ b/App/BitBar/HTMLPlugin.m @@ -51,7 +51,7 @@ -(void)reloadWebView { } -(void)rebuildMenuForStatusItem:(NSStatusItem *)statusItem { - WebView * webview = [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 15, 15)]; + WebView * webview = [WebView.alloc initWithFrame:NSMakeRect(0, 0, 15, 15)]; self.webView = webview; @@ -64,7 +64,7 @@ -(void)rebuildMenuForStatusItem:(NSStatusItem *)statusItem { webview.autoresizingMask = NSViewWidthSizable; NSURL * url = [NSURL fileURLWithPath:self.path]; - NSURLRequest * req = [[NSURLRequest alloc] initWithURL:url]; + NSURLRequest * req = [NSURLRequest.alloc initWithURL:url]; [webview.mainFrame loadRequest:req]; statusItem.view = webview; @@ -172,7 +172,7 @@ - (NSArray *) arrayOfKeysFromWebScriptObject:(WebScriptObject *)obj { - (NSDictionary *) dictionaryFromWebScriptObject:(WebScriptObject *)obj { NSArray * keys = [self arrayOfKeysFromWebScriptObject:obj]; - NSMutableDictionary * dict = [[NSMutableDictionary alloc] initWithCapacity:keys.count]; + NSMutableDictionary * dict = [NSMutableDictionary.alloc initWithCapacity:keys.count]; for (NSString * key in keys) { NSObject * value = [obj valueForKey:key]; if ([[value class] isSubclassOfClass:[NSString class]] || [[value class] isSubclassOfClass:[NSNumber class]]) { @@ -189,7 +189,7 @@ - (BOOL) isWebScriptObjectInstanceOfArray:(WebScriptObject *)obj { } - (NSArray *) arrayFromWebScriptObject:(WebScriptObject *)obj { - NSMutableArray * values = [[NSMutableArray alloc] init]; + NSMutableArray * values = NSMutableArray.new; id elem = nil; int i = 0; WebUndefined *undefined = [WebUndefined undefined]; @@ -226,7 +226,7 @@ - (void) resizeToFit { - (void) resetMenu { NSLog(@"resetMenu"); - _menu = [[NSMenu alloc] init]; + _menu = NSMenu.new; } - (void) addMenuItem:(NSObject*)titleOrParamsDict { diff --git a/App/BitBar/Plugin.h b/App/BitBar/Plugin.h index 251cd16a8..d0b7dc62f 100644 --- a/App/BitBar/Plugin.h +++ b/App/BitBar/Plugin.h @@ -6,34 +6,26 @@ // Copyright (c) 2013 Bit Bar. All rights reserved. // -#import @class PluginManager; @interface Plugin : NSObject -@property (nonatomic, copy) NSString *path; -@property (nonatomic, copy) NSString *name; -@property (nonatomic, copy) NSString *content; -@property (nonatomic, copy) NSString *allContent; -@property (nonatomic, assign) NSInteger currentLine; -@property (nonatomic, strong) NSArray *allContentLines; -@property (nonatomic, strong) NSArray *allContentLinesAfterBreak; -@property (nonatomic, copy) NSString *errorContent; -@property (nonatomic, assign) BOOL lastCommandWasError; -@property (nonatomic, strong) NSNumber *refreshIntervalSeconds; -@property (readonly, nonatomic, strong) PluginManager* manager; -@property (nonatomic, assign) NSInteger cycleLinesIntervalSeconds; -@property (nonatomic, assign) BOOL pluginIsVisible; -@property (nonatomic, strong) NSMenuItem *lastUpdatedMenuItem; -@property (nonatomic, strong) NSDate *lastUpdated; - -@property (nonatomic, assign) BOOL menuIsOpen; +@property (nonatomic) NSInteger currentLine, cycleLinesIntervalSeconds; +@property (nonatomic) BOOL lastCommandWasError, pluginIsVisible, menuIsOpen; +@property (readonly) BOOL isMultiline; +@property (readonly) NSString *lastUpdatedString; +@property (nonatomic, copy) NSString *path, *name, *content, *allContent, *errorContent; +@property (nonatomic) NSArray *allContentLines, *allContentLinesAfterBreak; +@property (nonatomic) NSNumber *refreshIntervalSeconds; +@property (nonatomic) NSMenuItem *lastUpdatedMenuItem; +@property (nonatomic) NSDate *lastUpdated; +@property (readonly) PluginManager *manager; // UI -@property (nonatomic, strong) NSStatusItem *statusItem; +@property (nonatomic) NSStatusItem *statusItem; + +- initWithManager:(PluginManager*)manager; -- (id) initWithManager:(PluginManager*)manager; -- (BOOL) isMultiline; - (NSMenuItem *) buildMenuItemWithParams:(NSDictionary *)params; - (void) rebuildMenuForStatusItem:(NSStatusItem*)statusItem; @@ -44,8 +36,6 @@ - (void) cycleLines; - (void) contentHasChanged; -- (NSString *)lastUpdatedString; - // actions - (void)changePluginsDirectorySelected:(id)sender; diff --git a/App/BitBar/Plugin.m b/App/BitBar/Plugin.m index a59ec6451..e61198f6e 100644 --- a/App/BitBar/Plugin.m +++ b/App/BitBar/Plugin.m @@ -57,7 +57,7 @@ - (NSMenuItem *) buildMenuItemWithParams:(NSDictionary *)params { if ([params objectForKey:@"bash"] != nil) { sel = @selector(performMenuItemOpenTerminalAction:); } - NSMenuItem * item = [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]; + NSMenuItem * item = [NSMenuItem.alloc initWithTitle:title action:sel keyEquivalent:@""]; if (sel != nil) { item.representedObject = params; [item setTarget:self]; @@ -71,7 +71,7 @@ - (NSMenuItem *) buildMenuItemWithParams:(NSDictionary *)params { - (NSAttributedString *) attributedTitleWithParams:(NSDictionary *)params { NSString * title = [params objectForKey:@"title"]; NSFont * font = [NSFont menuFontOfSize:14.0]; - NSMutableAttributedString * attributedTitle = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName: font}]; + NSMutableAttributedString * attributedTitle = [NSMutableAttributedString.alloc initWithString:title attributes:@{NSFontAttributeName: font}]; if ([params objectForKey:@"color"] != nil) { NSColor * fgColor = [NSColor colorWithWebColorString:[params objectForKey:@"color"]]; if (fgColor != nil) { @@ -93,7 +93,7 @@ - (NSDictionary *) dictionaryForLine:(NSString *)line { } NSString * title = [[line substringToIndex:found.location] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - NSMutableDictionary * params = [[NSMutableDictionary alloc] init]; + NSMutableDictionary * params = NSMutableDictionary.new; [params setObject:title forKey:@"title"]; NSString * paramsStr = [line substringFromIndex:found.location + found.length]; NSArray * paramsArr = [[paramsStr @@ -134,7 +134,7 @@ - (void) performMenuItemOpenTerminalAction:(NSMenuItem *)menuItem { //NSLog(@"%@", terminal); if([terminal isEqual: @"false"]){ - NSTask *task = [[NSTask alloc] init]; + NSTask *task = NSTask.new; [task setLaunchPath:bash]; [task setArguments:@[ param1, param2, param3 ]]; [task launch]; @@ -147,7 +147,7 @@ - (void) performMenuItemOpenTerminalAction:(NSMenuItem *)menuItem { end if \n\ do script \"%@\" in front window activate \n\ end tell", full_link]; - NSAppleScript *as = [[NSAppleScript alloc] initWithSource: s]; + NSAppleScript *as = [NSAppleScript.alloc initWithSource: s]; [as executeAndReturnError:nil]; } } @@ -155,7 +155,7 @@ - (void) performMenuItemOpenTerminalAction:(NSMenuItem *)menuItem { - (void) rebuildMenuForStatusItem:(NSStatusItem*)statusItem { // build the menu - NSMenu *menu = [[NSMenu alloc] init]; + NSMenu *menu = NSMenu.new; [menu setDelegate:self]; if (self.isMultiline) { @@ -195,7 +195,7 @@ - (void) rebuildMenuForStatusItem:(NSStatusItem*)statusItem { if (self.lastUpdated != nil) { - self.lastUpdatedMenuItem = [[NSMenuItem alloc] initWithTitle:@"Updated just now" action:nil keyEquivalent:@""]; + self.lastUpdatedMenuItem = [NSMenuItem.alloc initWithTitle:@"Updated just now" action:nil keyEquivalent:@""]; [menu addItem:self.lastUpdatedMenuItem]; [menu addItem:[NSMenuItem separatorItem]]; @@ -340,7 +340,7 @@ - (NSArray *)allContentLines { NSArray *lines = [self.allContent componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - NSMutableArray *cleanLines = [[NSMutableArray alloc] initWithCapacity:lines.count]; + NSMutableArray *cleanLines = [NSMutableArray.alloc initWithCapacity:lines.count]; NSString *line; for (line in lines) { @@ -382,7 +382,7 @@ - (NSArray *)allContentLinesAfterBreak { if (_allContentLinesAfterBreak == nil) { NSArray *lines = [self.allContent componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - NSMutableArray *cleanLines = [[NSMutableArray alloc] initWithCapacity:lines.count]; + NSMutableArray *cleanLines = [NSMutableArray.alloc initWithCapacity:lines.count]; NSString *line; BOOL storing = NO; diff --git a/App/BitBar/PluginManager.h b/App/BitBar/PluginManager.h index c8ac59154..0cbd91287 100644 --- a/App/BitBar/PluginManager.h +++ b/App/BitBar/PluginManager.h @@ -6,24 +6,21 @@ // Copyright (c) 2013 Bit Bar. All rights reserved. // -#import @class Plugin; @interface PluginManager : NSObject @property (nonatomic, copy) NSString *path; -@property (nonatomic, strong) NSArray *plugins; -@property (nonatomic, strong) NSStatusBar *statusBar; -@property (nonatomic, strong) NSStatusItem *defaultStatusItem; -@property (nonatomic, strong) NSTimer *timerForLastUpdated; -@property (nonatomic, strong) NSDictionary *environment; +@property (nonatomic) NSArray *plugins; +@property (nonatomic) NSStatusBar *statusBar; +@property (nonatomic) NSStatusItem *defaultStatusItem; +@property (nonatomic) NSTimer *timerForLastUpdated; +@property (nonatomic) NSDictionary *environment; -- (id) initWithPluginPath:(NSString *)path; +- initWithPluginPath:(NSString *)path; - (NSArray *) pluginFilesWithAsking:(BOOL)shouldAsk; -- (NSArray *)plugins; - - (void) setupAllPlugins; - (void) reset; - (void) clearPathAndReset; diff --git a/App/BitBar/PluginManager.m b/App/BitBar/PluginManager.m index bf49e8f50..ca3f12419 100644 --- a/App/BitBar/PluginManager.m +++ b/App/BitBar/PluginManager.m @@ -16,11 +16,11 @@ @implementation PluginManager - (id) initWithPluginPath:(NSString *)path { - if (self = [super init]) { + + if (!(self = super.init)) return nil; - self.path = [path stringByStandardizingPath]; - - } + _path = [path stringByStandardizingPath]; + return self; } @@ -30,130 +30,111 @@ - (void) showSystemStatusItemWithMessage:(NSString*)message { // make default menu item self.defaultStatusItem = [self.statusBar statusItemWithLength:NSVariableStatusItemLength]; - [self.defaultStatusItem setTitle:[[NSProcessInfo processInfo] processName]]; - self.defaultStatusItem.menu = [[NSMenu alloc] init]; - [self.defaultStatusItem.menu setDelegate:self]; + [self.defaultStatusItem setTitle:NSProcessInfo.processInfo.processName]; + [(self.defaultStatusItem.menu = NSMenu.new) setDelegate:self]; - if (message.length > 0) { - NSMenuItem *messageMenuItem = [[NSMenuItem alloc] initWithTitle:message action:nil keyEquivalent:@""]; + if (message.length) { + NSMenuItem *messageMenuItem = [NSMenuItem.alloc initWithTitle:message action:nil keyEquivalent:@""]; [self.defaultStatusItem.menu addItem:messageMenuItem]; - [self.defaultStatusItem.menu addItem:[NSMenuItem separatorItem]]; + [self.defaultStatusItem.menu addItem:NSMenuItem.separatorItem]; } [self addHelperItemsToMenu:self.defaultStatusItem.menu asSubMenu:NO]; } +#define ADD_MENU(TITLE,SELECTOR,SHORTCUT,TARGET) ({ \ + NSMenuItem *item = [NSMenuItem.alloc initWithTitle:TITLE action:NSStringFromSelector(@selector(SELECTOR)) ? @selector(SELECTOR) : NULL keyEquivalent:SHORTCUT?:@""];\ + if (TARGET) [item setTarget:TARGET]; \ + [targetMenu addItem:item]; item; }) + + - (void) addHelperItemsToMenu:(NSMenu*)menu asSubMenu:(BOOL)submenu { NSMenu *targetMenu; if (submenu) { - NSMenu *moreMenu = [[NSMenu alloc] initWithTitle:@"Preferences"]; - NSMenuItem *moreItem = [[NSMenuItem alloc] initWithTitle:@"Preferences" action:nil keyEquivalent:@""]; + NSMenu *moreMenu = [NSMenu.alloc initWithTitle:@"Preferences"]; + + NSMenuItem *moreItem = [NSMenuItem.alloc initWithTitle:@"Preferences" action:nil keyEquivalent:@""]; moreItem.submenu = moreMenu; [menu addItem:moreItem]; targetMenu = moreMenu; - } else { - - targetMenu = menu; - - } + } else targetMenu = menu; - // add reset - NSMenuItem *refreshMenuItem = [[NSMenuItem alloc] initWithTitle:@"Reset " action:@selector(reset) keyEquivalent:@"r"]; - [refreshMenuItem setTarget:self]; - [targetMenu addItem:refreshMenuItem]; - - [targetMenu addItem:[NSMenuItem separatorItem]]; + // add reset, aka refreshMenuItem + ADD_MENU(@"Reset ", reset, @"r", self); + + [targetMenu addItem:NSMenuItem.separatorItem]; - // add edit action - NSMenuItem *prefsMenuItem = [[NSMenuItem alloc] initWithTitle:@"Change Plugin Folder…" action:@selector(changePluginDirectory) keyEquivalent:@""]; - [prefsMenuItem setTarget:self]; - [targetMenu addItem:prefsMenuItem]; + // add edit action, aka prefsMenuItem + ADD_MENU(@"Change Plugin Folder…", changePluginDirectory,@"",self); - // add edit action - NSMenuItem *openPluginFolderMenuItem = [[NSMenuItem alloc] initWithTitle:@"Open Plugin Folder…" action:@selector(openPluginFolder) keyEquivalent:@""]; - [openPluginFolderMenuItem setTarget:self]; - [targetMenu addItem:openPluginFolderMenuItem]; + // add edit action, aka openPluginFolderMenuItem + ADD_MENU(@"Open Plugin Folder…",openPluginFolder, nil, self); - // add browser item - NSMenuItem *openPluginBrowserMenuItem = [[NSMenuItem alloc] initWithTitle:@"Find More Plugins…" action:@selector(openPluginsBrowser) keyEquivalent:@""]; - [openPluginBrowserMenuItem setTarget:self]; - [targetMenu addItem:openPluginBrowserMenuItem]; + // add browser item, aka openPluginBrowserMenuItem + ADD_MENU(@"Find More Plugins…", openPluginsBrowser, nil, self); - [targetMenu addItem:[NSMenuItem separatorItem]]; + [targetMenu addItem:NSMenuItem.separatorItem]; - // open at login - LaunchAtLoginController *lc = [[LaunchAtLoginController alloc] init]; - NSMenuItem *openAtLoginMenuItem = [[NSMenuItem alloc] initWithTitle:@"Open at Login" action:@selector(toggleOpenAtLogin:) keyEquivalent:@""]; - [openAtLoginMenuItem setTarget:self]; - [openAtLoginMenuItem setState:lc.launchAtLogin]; - [targetMenu addItem:openAtLoginMenuItem]; + // open at login, aka openAtLoginMenuItem + LaunchAtLoginController *lc = LaunchAtLoginController.new; + + [ADD_MENU(@"Open at Login", toggleOpenAtLogin:, nil, self) setState:lc.launchAtLogin]; - [targetMenu addItem:[NSMenuItem separatorItem]]; + [targetMenu addItem:NSMenuItem.separatorItem]; - NSString *versionString = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; + NSString *versionString = [NSBundle.mainBundle.infoDictionary objectForKey:@"CFBundleVersion"]; NSMenuItem *versionMenuitem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"v%@", versionString] action:nil keyEquivalent:@""]; [targetMenu addItem:versionMenuitem]; - + // add troubleshooting item - NSMenuItem *openHelpMenuItem = [[NSMenuItem alloc] initWithTitle:@"User Guide…" action:@selector(openTroubleshootingPage) keyEquivalent:@"g"]; - [openHelpMenuItem setTarget:self]; - [targetMenu addItem:openHelpMenuItem]; + ADD_MENU(@"User Guide…", openTroubleshootingPage,@"g",self); // add troubleshooting item - NSMenuItem *reportIssueMenuItem = [[NSMenuItem alloc] initWithTitle:@"Report an Issue…" action:@selector(openReportIssuesPage) keyEquivalent:@"i"]; - [reportIssueMenuItem setTarget:self]; - [targetMenu addItem:reportIssueMenuItem]; + ADD_MENU(@"Report an Issue…",openReportIssuesPage,@"i",self); // quit menu - NSMenuItem *quitMenuItem = [[NSMenuItem alloc] initWithTitle:@"Quit" action:@selector(quit) keyEquivalent:@"q"]; - [quitMenuItem setTarget:self]; - [targetMenu addItem:quitMenuItem]; - + ADD_MENU(@"Quit",quit, @"q",self); } - (void) quit { [NSApp terminate:[NSApplication sharedApplication]]; } +#define WSPACE NSWorkspace.sharedWorkspace - (void) openReportIssuesPage { - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/stretchr/bitbar/issues"]]; + [WSPACE openURL:[NSURL URLWithString:@"https://github.com/stretchr/bitbar/issues"]]; } - (void) openPluginsBrowser { - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/stretchr/bitbar/tree/master/Plugins"]]; + [WSPACE openURL:[NSURL URLWithString:@"https://github.com/stretchr/bitbar/tree/master/Plugins"]]; } - (void) openTroubleshootingPage { - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/stretchr/bitbar/wiki/User-Guide"]]; + [WSPACE openURL:[NSURL URLWithString:@"https://github.com/stretchr/bitbar/wiki/User-Guide"]]; } - (void) openPluginFolder { - [[NSWorkspace sharedWorkspace] openURL:[NSURL fileURLWithPath:self.path]]; + [WSPACE openURL:[NSURL fileURLWithPath:self.path]]; } - (void) toggleOpenAtLogin:(id)sender { - LaunchAtLoginController *lc = [[LaunchAtLoginController alloc] init]; + LaunchAtLoginController *lc = LaunchAtLoginController.new; [lc setLaunchAtLogin:!lc.launchAtLogin]; - - NSMenuItem *menuItem = (NSMenuItem*)sender; - [menuItem setState:lc.launchAtLogin]; + + [(NSMenuItem*)sender setState:lc.launchAtLogin]; } - (NSArray *) pluginFilesWithAsking:(BOOL)shouldAsk { - BOOL dirIsOK = YES; - - if (self.path == nil) { - dirIsOK = NO; - } + BOOL dirIsOK = !!self.path; if (dirIsOK) { @@ -190,16 +171,7 @@ - (NSArray *) pluginFilesWithAsking:(BOOL)shouldAsk { } } - if (!dirIsOK && shouldAsk) { - - if ([self beginSelectingPluginsDir] == YES) { - return [self pluginFilesWithAsking:NO];; - } - - } - - return nil; - + return (!dirIsOK && shouldAsk) && self.beginSelectingPluginsDir ? [self pluginFilesWithAsking:NO] : nil; } - (BOOL) beginSelectingPluginsDir { @@ -257,16 +229,16 @@ - (NSArray *)plugins { if (_plugins == nil) { NSArray *pluginFiles = [self pluginFilesWithAsking:YES]; - NSMutableArray *plugins = [[NSMutableArray alloc] initWithCapacity:[pluginFiles count]]; + NSMutableArray *plugins = [NSMutableArray.alloc initWithCapacity:[pluginFiles count]]; NSString *file; for (file in pluginFiles) { // setup this plugin Plugin *plugin; if ([@[@"html",@"htm"] containsObject:[[file pathExtension] lowercaseString]]) { - plugin = [[HTMLPlugin alloc] initWithManager:self]; + plugin = [HTMLPlugin.alloc initWithManager:self]; } else { - plugin = [[ExecutablePlugin alloc] initWithManager:self]; + plugin = [ExecutablePlugin.alloc initWithManager:self]; } [plugin setPath:[self.path stringByAppendingPathComponent:file]]; @@ -290,7 +262,7 @@ - (NSDictionary *)environment { if (_environment == nil) { NSDictionary *currentEnv = [[NSProcessInfo processInfo] environment]; - NSMutableDictionary *env = [[NSMutableDictionary alloc] initWithCapacity:[currentEnv count]+1]; + NSMutableDictionary *env = [NSMutableDictionary.alloc initWithCapacity:[currentEnv count]+1]; for (NSString *key in currentEnv.allKeys) { [env setObject:[currentEnv objectForKey:key] forKey:key]; } diff --git a/App/BitBar/Settings.m b/App/BitBar/Settings.m index 219f9b54f..7e3cfa4ac 100644 --- a/App/BitBar/Settings.m +++ b/App/BitBar/Settings.m @@ -8,21 +8,23 @@ #import "Settings.h" +#define DEFS NSUserDefaults.standardUserDefaults + @implementation Settings + (NSString *)pluginsDirectory { - return [[NSUserDefaults standardUserDefaults] stringForKey:@"pluginsDirectory"]; + return [DEFS stringForKey:@"pluginsDirectory"]; } + (void)setPluginsDirectory:(NSString*)value { - [[NSUserDefaults standardUserDefaults] setObject:value forKey:@"pluginsDirectory"]; + [DEFS setObject:value forKey:@"pluginsDirectory"]; } + (BOOL)isFirstTimeAppRun { - return ![[NSUserDefaults standardUserDefaults] boolForKey:@"appHasRun"]; + return ![DEFS boolForKey:@"appHasRun"]; } + (void)setNotFirstTimeAppRun { - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"appHasRun"]; + [DEFS setBool:YES forKey:@"appHasRun"]; } @end diff --git a/App/BitBar/en.lproj/Credits.rtf b/App/BitBar/en.lproj/Credits.rtf deleted file mode 100644 index 46576ef21..000000000 --- a/App/BitBar/en.lproj/Credits.rtf +++ /dev/null @@ -1,29 +0,0 @@ -{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} -{\colortbl;\red255\green255\blue255;} -\paperw9840\paperh8400 -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural - -\f0\b\fs24 \cf0 Engineering: -\b0 \ - Some people\ -\ - -\b Human Interface Design: -\b0 \ - Some other people\ -\ - -\b Testing: -\b0 \ - Hopefully not nobody\ -\ - -\b Documentation: -\b0 \ - Whoever\ -\ - -\b With special thanks to: -\b0 \ - Mom\ -} diff --git a/App/BitBar/en.lproj/InfoPlist.strings b/App/BitBar/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8..000000000 --- a/App/BitBar/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/App/BitBar/main.m b/App/BitBar/main.m deleted file mode 100644 index f703fc952..000000000 --- a/App/BitBar/main.m +++ /dev/null @@ -1,14 +0,0 @@ -// -// main.m -// BitBar -// -// Created by Mat Ryer on 11/12/13. -// Copyright (c) 2013 Bit Bar. All rights reserved. -// - -#import - -int main(int argc, const char * argv[]) -{ - return NSApplicationMain(argc, argv); -} diff --git a/App/BitBarTests/PluginManagerTest.m b/App/BitBarTests/PluginManagerTest.m index eadd3b022..988a81d48 100644 --- a/App/BitBarTests/PluginManagerTest.m +++ b/App/BitBarTests/PluginManagerTest.m @@ -31,14 +31,14 @@ - (void)tearDown - (void)testInit { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; XCTAssert([manager.path isEqualToString:[@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins" stringByStandardizingPath]]); } - (void)testPluginFiles { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; NSArray *pluginFiles = [manager pluginFiles]; XCTAssertEqual((NSUInteger)3, [pluginFiles count], @"pluginFiles count"); @@ -47,7 +47,7 @@ - (void)testPluginFiles { - (void)testPlugins { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; NSArray *plugins = [manager plugins]; @@ -63,14 +63,14 @@ - (void)testPlugins { - (void)testStatusBar { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; NSStatusBar *statusBar = manager.statusBar; XCTAssertNotNil(statusBar, @"statusBar"); XCTAssertEqual([NSStatusBar systemStatusBar], statusBar, @"statusBar should default to system one"); // set on explicitly - NSStatusBar *newBar = [[NSStatusBar alloc] init]; + NSStatusBar *newBar = NSStatusBar.new; manager.statusBar = newBar; XCTAssertEqual(newBar, manager.statusBar); diff --git a/App/BitBarTests/PluginTest.m b/App/BitBarTests/PluginTest.m index bcd5dbeab..87cf8edb7 100644 --- a/App/BitBarTests/PluginTest.m +++ b/App/BitBarTests/PluginTest.m @@ -30,8 +30,8 @@ - (void)tearDown - (void)testInitWithManager { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; XCTAssertEqual(p.manager, manager); XCTAssertEqual((NSInteger)-1, p.currentLine); @@ -41,8 +41,8 @@ - (void)testInitWithManager { - (void)testStatusItem { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; NSStatusItem *item = p.statusItem; XCTAssertNotNil(item, @"item nil?"); XCTAssertEqual((CGFloat)NSVariableStatusItemLength, item.length, @"length == NSVariableStatusItemLength"); @@ -55,8 +55,8 @@ - (void)testStatusItem { - (void)testExample { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; p.name = @"name.10s.sh"; p.refreshIntervalSeconds = nil; @@ -108,8 +108,8 @@ - (void)testExample - (void)testRefreshContentByExecutingCommandSuccess { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; p.name = @"one.10s.sh"; p.path = [[@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins" stringByStandardizingPath] stringByAppendingPathComponent:p.name]; @@ -134,8 +134,8 @@ - (void)testRefreshContentByExecutingCommandSuccess { - (void)testRefreshContentByExecutingCommandError { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; p.name = @"two.5m.sh"; p.path = [[@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins" stringByStandardizingPath] stringByAppendingPathComponent:p.name]; @@ -159,8 +159,8 @@ - (void)testRefreshContentByExecutingCommandError { - (void)testContentLines { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; p.content = @"Hello\nWorld\nOf\nBitBar"; @@ -214,8 +214,8 @@ - (void)testContentLines { - (void)testIsMultiline { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; p.content = @"Hello\nWorld\nOf\nBitBar"; XCTAssertEqual(YES, p.isMultiline); @@ -228,8 +228,8 @@ - (void)testIsMultiline { - (void)testRefresh { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; p.name = @"three.7d.sh"; p.path = [[@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins" stringByStandardizingPath] stringByAppendingPathComponent:p.name]; @@ -243,8 +243,8 @@ - (void)testRefresh { - (void)testCycleLinesAndCurrentLine { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; p.name = @"three.7d.sh"; p.path = [[@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins" stringByStandardizingPath] stringByAppendingPathComponent:p.name]; @@ -279,8 +279,8 @@ - (void)testCycleLinesAndCurrentLine { - (void)testRebuildMenuForStatusItem { - PluginManager *manager = [[PluginManager alloc] initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; - Plugin *p = [[Plugin alloc] initWithManager:manager]; + PluginManager *manager = [PluginManager.alloc initWithPluginPath:@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins"]; + Plugin *p = [Plugin.alloc initWithManager:manager]; p.name = @"three.7d.sh"; p.path = [[@"~/Work/bitbar/BitBar/BitBarTests/TestPlugins" stringByStandardizingPath] stringByAppendingPathComponent:p.name]; diff --git a/App/BitBarTests/en.lproj/InfoPlist.strings b/App/BitBarTests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8..000000000 --- a/App/BitBarTests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..2df7530e3 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ + +PROJECT_NAME ?= BitBar +PROJECT = $(shell find . -name '*.xcodeproj') + +all: build + +clean: + rm -r ./**/build + +build: + xcodebuild -project $(PROJECT) + ps aux | grep $(PROJECT_NAME) | grep -v grep >/dev/null 2>&1 && killall $(PROJECT_NAME) + open $(PROJECT)/../build/Release/$(PROJECT_NAME).app +