From ec8b92502882e45b688847075eedbe6fafec176f Mon Sep 17 00:00:00 2001 From: emsquared Date: Tue, 26 Jun 2012 17:42:25 -0400 Subject: [PATCH] Configurable system profiler extension. --- Resources/Info.plist | 4 +- .../English.lproj/BasicLanguage.strings | 2 + .../English.lproj/TDCPreferences.xib | 47 +- .../English.lproj/TPISystemProfiler.xib | 773 ++++++++++++++++++ .../project.pbxproj | 36 +- .../System Profiler/TPISystemProfiler.h | 8 + .../System Profiler/TPISystemProfiler.m | 47 +- .../Plugins/System Profiler/TPI_SP_SysInfo.m | 131 +-- 8 files changed, 977 insertions(+), 71 deletions(-) create mode 100644 Resources/Plugins/System Profiler/English.lproj/TPISystemProfiler.xib diff --git a/Resources/Info.plist b/Resources/Info.plist index c68dba1549..63b2b3ee93 100755 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -45,8 +45,8 @@ NSPrincipalClass NSApplication TXBundleBuildNumber - 11485 + 11492 TXBundleBuildReference - 2.1.1-190-gddd8bfd-appstore,llvm4.0 + 2.1.1-191-g47af099-appstore,llvm4.0 diff --git a/Resources/Localization/English.lproj/BasicLanguage.strings b/Resources/Localization/English.lproj/BasicLanguage.strings index ee89c41ae2..e3c34177ee 100644 --- a/Resources/Localization/English.lproj/BasicLanguage.strings +++ b/Resources/Localization/English.lproj/BasicLanguage.strings @@ -283,6 +283,8 @@ /* System Profiler Extension. */ +"SystemInformationPreferencePaneMenuItemTitle" = "System Information"; + "SystemInformationCompiledOutputPrefix" = "System Information:"; "SystemInformationCompiledOutputModel" = " \002Model:\002 %@ \002•\002"; "SystemInformationCompiledOutputCPUSingleCore" = " \002CPU:\002 %1$@ (%2$@ Core) @ %3$@ \002•\002"; diff --git a/Resources/Localization/English.lproj/TDCPreferences.xib b/Resources/Localization/English.lproj/TDCPreferences.xib index 814aba2673..7c12aa52f2 100755 --- a/Resources/Localization/English.lproj/TDCPreferences.xib +++ b/Resources/Localization/English.lproj/TDCPreferences.xib @@ -178,8 +178,6 @@ 268 {{3, 14}, {43, 32}} - - 13 YES @@ -193,7 +191,6 @@ -2044182528 2 - 400 @@ -365,8 +362,6 @@ 268 {{8, 14}, {43, 32}} - - 11 YES @@ -605,7 +600,6 @@ {{0, 6}, {534, 270}} - NSView @@ -619,7 +613,7 @@ YES - + 268 @@ -627,6 +621,7 @@ 268 {{29, 225}, {452, 32}} + YES @@ -660,6 +655,7 @@ 268 {{88, 153}, {190, 16}} + YES @@ -694,6 +690,7 @@ 268 {{270, 262}, {138, 16}} + YES @@ -712,6 +709,7 @@ 268 {{47, 97}, {56, 16}} + YES @@ -734,6 +732,7 @@ 268 {{47, 125}, {37, 16}} + YES @@ -752,6 +751,7 @@ 268 {{47, 153}, {43, 16}} + YES @@ -770,6 +770,7 @@ 268 {{114, 181}, {37, 16}} + YES @@ -788,6 +789,7 @@ 268 {{47, 181}, {45, 16}} + YES @@ -806,6 +808,7 @@ 268 {{234, 262}, {36, 16}} + YES @@ -824,6 +827,7 @@ 12 {{33, 75}, {471, 5}} + {0, 0} @@ -855,6 +859,7 @@ 268 {{30, 44}, {185, 16}} + YES @@ -873,6 +878,7 @@ 268 {{220, 22}, {137, 38}} + YES NO 2 @@ -1066,6 +1072,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 95}, {329, 18}} + YES @@ -1090,6 +1097,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 253}, {452, 32}} + YES @@ -1114,6 +1122,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 288}, {452, 18}} + YES @@ -1138,6 +1147,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 316}, {452, 18}} + YES @@ -1162,6 +1172,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 123}, {265, 18}} + YES @@ -1186,6 +1197,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 151}, {270, 18}} + YES @@ -1210,6 +1222,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 179}, {338, 18}} + YES @@ -1234,6 +1247,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 12 {{32, 212}, {470, 5}} + {0, 0} @@ -1257,6 +1271,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 344}, {302, 18}} + YES @@ -1281,6 +1296,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 372}, {332, 18}} + YES @@ -1305,6 +1321,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 256 {{30, 428}, {312, 18}} + YES @@ -1329,6 +1346,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA 268 {{30, 400}, {375, 18}} + YES @@ -1350,6 +1368,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA {534, 464} + + NSView @@ -3589,7 +3609,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA NSView - + 268 @@ -3597,7 +3617,6 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA 256 {{252, 21}, {230, 22}} - YES -2076180416 @@ -3713,7 +3732,6 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA {534, 61} - NSView @@ -4897,7 +4915,6 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA 12 {{10, 10}, {515, 418}} - 1 @@ -5006,7 +5023,6 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA 268 {{10, 229}, {357, 18}} - _NS:239 YES @@ -10838,7 +10854,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - + 32 @@ -10854,6 +10870,11 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA 22 1 + + + 432 + 1 + com.apple.InterfaceBuilder.CocoaPlugin diff --git a/Resources/Plugins/System Profiler/English.lproj/TPISystemProfiler.xib b/Resources/Plugins/System Profiler/English.lproj/TPISystemProfiler.xib new file mode 100644 index 0000000000..833f77c296 --- /dev/null +++ b/Resources/Plugins/System Profiler/English.lproj/TPISystemProfiler.xib @@ -0,0 +1,773 @@ + + + + 1060 + 12A248 + 2541 + 1183 + 622.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 2541 + + + NSButton + NSButtonCell + NSCustomObject + NSCustomView + NSTextField + NSTextFieldCell + NSUserDefaultsController + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + TPISystemProfiler + + + FirstResponder + + + NSApplication + + + + 268 + + + + 268 + {{273, 257}, {140, 17}} + + + + _NS:1549 + YES + + 68157504 + 272630784 + command: + + LucidaGrande + 12 + 16 + + _NS:1549 + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + NO + + + + 268 + {{218, 257}, {63, 17}} + + + + _NS:1549 + YES + + 68157504 + 272630784 + /sysinfo + + LucidaGrande-Bold + 12 + 16 + + _NS:1549 + + + + + NO + + + + 268 + {{24, 257}, {200, 17}} + + + + _NS:1549 + YES + + 68157504 + 272630784 + Information shown as part of the + + _NS:1549 + + + + + NO + + + + 268 + {{43, 26}, {264, 18}} + + + + _NS:9 + YES + + -2080374784 + 268435456 + Operating System Version Information + + _NS:9 + + 1211912448 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + NO + + + + 268 + {{44, 54}, {156, 18}} + + + + _NS:9 + YES + + -2080374784 + 268435456 + System Load Average + + _NS:9 + + 1211912448 + 2 + + + + + 200 + 25 + + NO + + + + 268 + {{44, 82}, {227, 18}} + + + + _NS:9 + YES + + -2080374784 + 268435456 + Active Display Screen Resolution + + _NS:9 + + 1211912448 + 2 + + + + + 200 + 25 + + NO + + + + 268 + {{45, 110}, {194, 18}} + + + + _NS:9 + YES + + -2080374784 + 268435456 + Graphics Card Model Name + + _NS:9 + + 1211912448 + 2 + + + + + 200 + 25 + + NO + + + + 268 + {{45, 138}, {212, 18}} + + + + _NS:9 + YES + + -2080374784 + 268435456 + Boot Volume Disk Information + + _NS:9 + + 1211912448 + 2 + + + + + 200 + 25 + + NO + + + + 268 + {{45, 166}, {183, 18}} + + + + _NS:9 + YES + + -2080374784 + 268435456 + Operating System Uptime + + _NS:9 + + 1211912448 + 2 + + + + + 200 + 25 + + NO + + + + 268 + {{45, 194}, {225, 18}} + + + + _NS:9 + YES + + -2080374784 + 268435456 + System Memory Total Allocation + + _NS:9 + + 1211912448 + 2 + + + + + 200 + 25 + + NO + + + + 268 + {{46, 222}, {253, 18}} + + + + _NS:9 + YES + + -2080374784 + 268435456 + CPU Model & Associated Information + + _NS:9 + + 1211912448 + 2 + + + + + 200 + 25 + + NO + + + {540, 292} + + + + NSView + + + YES + + + + + + + preferencePaneView + + + + 2 + + + + value: values.System Profiler Extension -> Feature Enabled -> CPU Model + + + + + + value: values.System Profiler Extension -> Feature Enabled -> CPU Model + value + values.System Profiler Extension -> Feature Enabled -> CPU Model + 2 + + + 35 + + + + value: values.System Profiler Extension -> Feature Enabled -> Memory Information + + + + + + value: values.System Profiler Extension -> Feature Enabled -> Memory Information + value + values.System Profiler Extension -> Feature Enabled -> Memory Information + 2 + + + 36 + + + + value: values.System Profiler Extension -> Feature Enabled -> System Uptime + + + + + + value: values.System Profiler Extension -> Feature Enabled -> System Uptime + value + values.System Profiler Extension -> Feature Enabled -> System Uptime + 2 + + + 43 + + + + value: values.System Profiler Extension -> Feature Enabled -> Disk Information + + + + + + value: values.System Profiler Extension -> Feature Enabled -> Disk Information + value + values.System Profiler Extension -> Feature Enabled -> Disk Information + 2 + + + 38 + + + + value: values.System Profiler Extension -> Feature Enabled -> GPU Model + + + + + + value: values.System Profiler Extension -> Feature Enabled -> GPU Model + value + values.System Profiler Extension -> Feature Enabled -> GPU Model + 2 + + + 39 + + + + value: values.System Profiler Extension -> Feature Enabled -> Screen Resolution + + + + + + value: values.System Profiler Extension -> Feature Enabled -> Screen Resolution + value + values.System Profiler Extension -> Feature Enabled -> Screen Resolution + 2 + + + 40 + + + + value: values.System Profiler Extension -> Feature Enabled -> Load Average + + + + + + value: values.System Profiler Extension -> Feature Enabled -> Load Average + value + values.System Profiler Extension -> Feature Enabled -> Load Average + 2 + + + 41 + + + + value: values.System Profiler Extension -> Feature Enabled -> OS Version + + + + + + value: values.System Profiler Extension -> Feature Enabled -> OS Version + value + values.System Profiler Extension -> Feature Enabled -> OS Version + 2 + + + 42 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + + + + + + + + + + + + + + + + 3 + + + + + + + + 4 + + + + + 5 + + + + + + + + 6 + + + + + 12 + + + + + + + + 13 + + + + + 14 + + + + + + + + 15 + + + + + 16 + + + + + + + + 17 + + + + + 18 + + + + + + + + 19 + + + + + 20 + + + + + + + + 21 + + + + + 22 + + + + + + + + 23 + + + + + 28 + + + + + + + + 29 + + + + + 30 + + + + + + + + 31 + + + + + 32 + + + + + + + + 33 + + + + + 34 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + 432 + 1 + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 43 + + + + + TPISystemProfiler + NSObject + + preferencePaneView + NSView + + + preferencePaneView + + preferencePaneView + NSView + + + + IBProjectSource + ./Classes/TPISystemProfiler.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + YES + 3 + + NSSwitch + {15, 15} + + + diff --git a/Resources/Plugins/System Profiler/System Profiler Extension.xcodeproj/project.pbxproj b/Resources/Plugins/System Profiler/System Profiler Extension.xcodeproj/project.pbxproj index 35ae7fc96b..0729fa6de9 100755 --- a/Resources/Plugins/System Profiler/System Profiler Extension.xcodeproj/project.pbxproj +++ b/Resources/Plugins/System Profiler/System Profiler Extension.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 4C1BE0FA159A5FCF00DB3341 /* TPISystemProfiler.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C1BE0F8159A5FCF00DB3341 /* TPISystemProfiler.xib */; }; 4C57A681131D378900252759 /* TPI_SP_SysInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C57A67E131D378900252759 /* TPI_SP_SysInfo.m */; }; 4C57A682131D378900252759 /* TPISystemProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C57A680131D378900252759 /* TPISystemProfiler.m */; }; 4C57A695131D37F000252759 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C57A694131D37F000252759 /* OpenGL.framework */; }; @@ -17,6 +18,7 @@ /* Begin PBXFileReference section */ 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; + 4C1BE0F9159A5FCF00DB3341 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/TPISystemProfiler.xib; sourceTree = ""; }; 4C57A67C131D378900252759 /* SystemProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemProfiler.h; sourceTree = ""; }; 4C57A67D131D378900252759 /* TPI_SP_SysInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPI_SP_SysInfo.h; sourceTree = ""; }; 4C57A67E131D378900252759 /* TPI_SP_SysInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TPI_SP_SysInfo.m; sourceTree = ""; }; @@ -67,8 +69,8 @@ 089C167CFE841241C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( - 8D576317048677EA00EA77CD /* Info.plist */, - 4CD69D81131E2BD200F4618E /* MacintoshModels.plist */, + 4C1BE079159A57BD00DB3341 /* Property Lists */, + 4C1BE07B159A57C300DB3341 /* User Interface */, ); name = Resources; sourceTree = ""; @@ -94,6 +96,23 @@ name = Products; sourceTree = ""; }; + 4C1BE079159A57BD00DB3341 /* Property Lists */ = { + isa = PBXGroup; + children = ( + 8D576317048677EA00EA77CD /* Info.plist */, + 4CD69D81131E2BD200F4618E /* MacintoshModels.plist */, + ); + name = "Property Lists"; + sourceTree = ""; + }; + 4C1BE07B159A57C300DB3341 /* User Interface */ = { + isa = PBXGroup; + children = ( + 4C1BE0F8159A5FCF00DB3341 /* TPISystemProfiler.xib */, + ); + name = "User Interface"; + sourceTree = ""; + }; 4C8884A9158EB9CE00747ABB /* ARC Weak Refrences */ = { isa = PBXGroup; children = ( @@ -141,6 +160,7 @@ Japanese, French, German, + en, ); mainGroup = 089C166AFE841209C02AAC07 /* BlowfishCommandLine */; projectDirPath = ""; @@ -157,6 +177,7 @@ buildActionMask = 2147483647; files = ( 4CD69D82131E2BD200F4618E /* MacintoshModels.plist in Resources */, + 4C1BE0FA159A5FCF00DB3341 /* TPISystemProfiler.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -175,6 +196,17 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + 4C1BE0F8159A5FCF00DB3341 /* TPISystemProfiler.xib */ = { + isa = PBXVariantGroup; + children = ( + 4C1BE0F9159A5FCF00DB3341 /* English */, + ); + name = TPISystemProfiler.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 1DEB911B08733D790010E9CD /* Debug */ = { isa = XCBuildConfiguration; diff --git a/Resources/Plugins/System Profiler/TPISystemProfiler.h b/Resources/Plugins/System Profiler/TPISystemProfiler.h index ecc33f8cbb..2031569906 100755 --- a/Resources/Plugins/System Profiler/TPISystemProfiler.h +++ b/Resources/Plugins/System Profiler/TPISystemProfiler.h @@ -4,9 +4,17 @@ #include "SystemProfiler.h" @interface TPISystemProfiler : NSObject +/* User Input */ - (void)messageSentByUser:(IRCClient *)client message:(NSString *)messageString command:(NSString *)commandString; - (NSArray *)pluginSupportsUserInputCommands; + +/* Allocation & Deallocation */ +- (void)pluginLoadedIntoMemory:(IRCWorld *)world; + +/* Preference Pane */ +- (NSView *)preferencesView; +- (NSString *)preferencesMenuItemName; @end \ No newline at end of file diff --git a/Resources/Plugins/System Profiler/TPISystemProfiler.m b/Resources/Plugins/System Profiler/TPISystemProfiler.m index 150404a866..2a8599566f 100755 --- a/Resources/Plugins/System Profiler/TPISystemProfiler.m +++ b/Resources/Plugins/System Profiler/TPISystemProfiler.m @@ -4,13 +4,56 @@ #import "TPISystemProfiler.h" #import "TPI_SP_SysInfo.h" +@interface TPISystemProfiler () +@property (nonatomic, strong) IBOutlet NSView *preferencePaneView; +@end + @implementation TPISystemProfiler +#pragma mark - +#pragma mark Memory Allocation & Deallocation + +/* Allocation & Deallocation */ +- (void)pluginLoadedIntoMemory:(IRCWorld *)world +{ + [NSBundle loadNibNamed:@"TPISystemProfiler" owner:self]; + + NSDictionary *settingDefaults = @{ + @"System Profiler Extension -> Feature Enabled -> CPU Model" : @YES, + @"System Profiler Extension -> Feature Enabled -> Memory Information" : @YES, + @"System Profiler Extension -> Feature Enabled -> System Uptime" : @YES, + @"System Profiler Extension -> Feature Enabled -> Disk Information" : @YES, + @"System Profiler Extension -> Feature Enabled -> GPU Model" : @YES, + @"System Profiler Extension -> Feature Enabled -> Screen Resolution" : @YES, + @"System Profiler Extension -> Feature Enabled -> Load Average" : @YES, + @"System Profiler Extension -> Feature Enabled -> OS Version" : @YES + }; + + [_NSUserDefaults() registerDefaults:settingDefaults]; +} + +#pragma mark - +#pragma mark Preference Pane + +/* Preference Pane */ +- (NSView *)preferencesView +{ + return self.preferencePaneView; +} + +- (NSString *)preferencesMenuItemName +{ + return TXTLS(@"SystemInformationPreferencePaneMenuItemTitle"); +} + +#pragma mark - +#pragma mark User Input + - (NSArray *)pluginSupportsUserInputCommands { return @[@"sysinfo", @"memory", @"uptime", @"netstats", - @"msgcount", @"diskspace", @"theme", @"screens", @"runcount", @"loadavg", - @"sysmem"]; + @"msgcount", @"diskspace", @"theme", @"screens", + @"runcount", @"loadavg", @"sysmem"]; } - (void)messageSentByUser:(IRCClient *)client diff --git a/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m b/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m index aa273333f2..3709c30736 100755 --- a/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m +++ b/Resources/Plugins/System Profiler/TPI_SP_SysInfo.m @@ -36,6 +36,15 @@ + (NSString *)compiledOutput _cpu_model = [_cpu_model trim]; + BOOL _show_cpu_model = [_NSUserDefaults() boolForKey:@"System Profiler Extension -> Feature Enabled -> CPU Model"]; + BOOL _show_gpu_model = [_NSUserDefaults() boolForKey:@"System Profiler Extension -> Feature Enabled -> GPU Model"]; + BOOL _show_diskinfo = [_NSUserDefaults() boolForKey:@"System Profiler Extension -> Feature Enabled -> Disk Information"]; + BOOL _show_sys_uptime = [_NSUserDefaults() boolForKey:@"System Profiler Extension -> Feature Enabled -> System Uptime"]; + BOOL _show_sys_memory = [_NSUserDefaults() boolForKey:@"System Profiler Extension -> Feature Enabled -> Memory Information"]; + BOOL _show_screen_res = [_NSUserDefaults() boolForKey:@"System Profiler Extension -> Feature Enabled -> Screen Resolution"]; + BOOL _show_load_avg = [_NSUserDefaults() boolForKey:@"System Profiler Extension -> Feature Enabled -> Load Average"]; + BOOL _show_os_version = [_NSUserDefaults() boolForKey:@"System Profiler Extension -> Feature Enabled -> OS Version"]; + /* Mac Model. */ if (NSObjectIsNotEmpty(_model)) { NSDictionary *_all_models = [NSDictionary dictionaryWithContentsOfFile:[_bundle pathForResource:@"MacintoshModels" ofType:@"plist"]]; @@ -51,81 +60,99 @@ + (NSString *)compiledOutput sysinfo = [sysinfo stringByAppendingString:_new]; } - /* CPU Information. */ - if (_cpu_count_int >= 1 && NSObjectIsNotEmpty(_cpu_speed)) { - if (_cpu_count_int == 1) { - _new = TXTFLS(@"SystemInformationCompiledOutputCPUSingleCore", _cpu_model, _cpu_count, _cpu_speed); - } else { - _new = TXTFLS(@"SystemInformationCompiledOutputCPUMultiCore", _cpu_model, _cpu_count, _cpu_speed); + if (_show_cpu_model) { + /* CPU Information. */ + if (_cpu_count_int >= 1 && NSObjectIsNotEmpty(_cpu_speed)) { + if (_cpu_count_int == 1) { + _new = TXTFLS(@"SystemInformationCompiledOutputCPUSingleCore", _cpu_model, _cpu_count, _cpu_speed); + } else { + _new = TXTFLS(@"SystemInformationCompiledOutputCPUMultiCore", _cpu_model, _cpu_count, _cpu_speed); + } + + sysinfo = [sysinfo stringByAppendingString:_new]; } - sysinfo = [sysinfo stringByAppendingString:_new]; + /* L2 & L3 Cache. */ + if (_cpu_l2) { + _new = TXTFLS(@"SystemInformationCompiledOutputL2,3Cache", 2, _cpu_l2); + + sysinfo = [sysinfo stringByAppendingString:_new]; + } + + if (_cpu_l3) { + _new = TXTFLS(@"SystemInformationCompiledOutputL2,3Cache", 3, _cpu_l3); + + sysinfo = [sysinfo stringByAppendingString:_new]; + } } - /* L2 & L3 Cache. */ - if (_cpu_l2) { - _new = TXTFLS(@"SystemInformationCompiledOutputL2,3Cache", 2, _cpu_l2); + if (_show_sys_memory && _memory) { + _new = TXTFLS(@"SystemInformationCompiledOutputMemory", _memory); sysinfo = [sysinfo stringByAppendingString:_new]; } - if (_cpu_l3) { - _new = TXTFLS(@"SystemInformationCompiledOutputL2,3Cache", 3, _cpu_l3); + if (_show_sys_uptime) { + /* System Uptime. */ + _new = TXTFLS(@"SystemInformationCompiledOutputUptime", [self systemUptimeUsingShortValue:YES]); sysinfo = [sysinfo stringByAppendingString:_new]; } - if (_memory) { - _new = TXTFLS(@"SystemInformationCompiledOutputMemory", _memory); + if (_show_diskinfo) { + /* Disk Space Information. */ + _new = TXTFLS(@"SystemInformationCompiledOutputDiskspace", [self diskInfo]); sysinfo = [sysinfo stringByAppendingString:_new]; } - /* System Uptime. */ - _new = TXTFLS(@"SystemInformationCompiledOutputUptime", [self systemUptimeUsingShortValue:YES]); - - sysinfo = [sysinfo stringByAppendingString:_new]; - - /* Disk Space Information. */ - _new = TXTFLS(@"SystemInformationCompiledOutputDiskspace", [self diskInfo]); - - sysinfo = [sysinfo stringByAppendingString:_new]; + if (_show_gpu_model) { + /* GPU Information. */ + if (NSObjectIsNotEmpty(_gpu_model)) { + _new = TXTFLS(@"SystemInformationCompiledOutputGraphics", _gpu_model); + + sysinfo = [sysinfo stringByAppendingString:_new]; + } + } - /* GPU Information. */ - if (NSObjectIsNotEmpty(_gpu_model)) { - _new = TXTFLS(@"SystemInformationCompiledOutputGraphics", _gpu_model); + if (_show_screen_res) { + /* Screen Resolution. */ + NSArray *allScreens = [NSScreen screens]; - sysinfo = [sysinfo stringByAppendingString:_new]; + if (NSObjectIsNotEmpty(allScreens)) { + NSScreen *maiScreen = allScreens[0]; + + _new = TXTFLS(@"SystemInformationCompiledOutputScreenResolution", maiScreen.frame.size.width, maiScreen.frame.size.height); + + sysinfo = [sysinfo stringByAppendingString:_new]; + } } - /* Screen Resolution. */ - NSArray *allScreens = [NSScreen screens]; + if (_show_load_avg) { + /* Load Average. */ + if (NSObjectIsNotEmpty(_loadavg)) { + _new = TXTFLS(@"SystemInformationCompiledOutputLoad", _loadavg); + + sysinfo = [sysinfo stringByAppendingString:_new]; + } + } - if (NSObjectIsNotEmpty(allScreens)) { - NSScreen *maiScreen = allScreens[0]; + if (_show_os_version) { + /* Operating System. */ + NSString *osname = [self operatingSystemName]; - _new = TXTFLS(@"SystemInformationCompiledOutputScreenResolution", maiScreen.frame.size.width, maiScreen.frame.size.height); + _new = TXTFLS(@"SystemInformationCompiledOutputOSVersion", + [TPCPreferences systemInfoPlist][@"ProductName"], + [TPCPreferences systemInfoPlist][@"ProductVersion"], osname, + [TPCPreferences systemInfoPlist][@"ProductBuildVersion"]); sysinfo = [sysinfo stringByAppendingString:_new]; } - - /* Load Average. */ - if (NSObjectIsNotEmpty(_loadavg)) { - _new = TXTFLS(@"SystemInformationCompiledOutputLoad", _loadavg); - - sysinfo = [sysinfo stringByAppendingString:_new]; + + if ([sysinfo hasSuffix:@" \002•\002"]) { + sysinfo = [sysinfo safeSubstringToIndex:(sysinfo.length - 3)]; } - /* Operating System. */ - NSString *osname = [self operatingSystemName]; - - _new = TXTFLS(@"SystemInformationCompiledOutputOSVersion", - [TPCPreferences systemInfoPlist][@"ProductName"], - [TPCPreferences systemInfoPlist][@"ProductVersion"], osname, - [TPCPreferences systemInfoPlist][@"ProductBuildVersion"]); - - sysinfo = [sysinfo stringByAppendingString:_new]; - /* Compiled Output. */ return sysinfo; } @@ -136,7 +163,7 @@ + (NSString *)activeScreenResolutions if ([screens count] == 1) { NSScreen *maiScreen = screens[0]; - + return TXTFLS(@"SystemInformationScreensCommandResultSingle", maiScreen.frame.size.width, maiScreen.frame.size.height); } else { NSMutableString *result = [NSMutableString string]; @@ -162,7 +189,7 @@ + (NSString *)applicationAndSystemUptime NSString *textualUptime = TXSpecialReadableTime([NSDate secondsSinceUnixTimestamp:[TPCPreferences startTime]], NO, @[@"day", @"hour", @"minute", @"second"]); - + return TXTFLS(@"SystemInformationUptimeCommandResult", systemUptime, textualUptime); } @@ -284,7 +311,7 @@ + (NSString *)systemMemoryUsage } [result appendFormat:@"%c", 0x03]; - + return TXTFLS(@"SystemInformationSysmemCommandResult", [self formattedDiskSize:freeMemory], [self formattedDiskSize:usedMemory], @@ -439,7 +466,7 @@ + (NSString *)diskInfo if (diskInfo) { TXFSLongInt totalSpace = [diskInfo longLongForKey:NSFileSystemSize]; TXFSLongInt freeSpace = [diskInfo longLongForKey:NSFileSystemFreeSize]; - + return TXTFLS(@"SystemInformationCompiledOutputDiskspaceExtended", [self formattedDiskSize:totalSpace], [self formattedDiskSize:freeSpace]);