diff --git a/src/Tomighty.xcodeproj/project.pbxproj b/src/Tomighty.xcodeproj/project.pbxproj index 642aad2..a848044 100644 --- a/src/Tomighty.xcodeproj/project.pbxproj +++ b/src/Tomighty.xcodeproj/project.pbxproj @@ -21,7 +21,8 @@ 301ABD0C17A602E800F19F3C /* Sounds.m in Sources */ = {isa = PBXBuildFile; fileRef = 301ABD0B17A602E800F19F3C /* Sounds.m */; }; 3025F55717A7299000970DA9 /* Tomighty.m in Sources */ = {isa = PBXBuildFile; fileRef = 3025F55617A7299000970DA9 /* Tomighty.m */; }; 3025F55A17A74A6100970DA9 /* TimerContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 3025F55917A74A6100970DA9 /* TimerContext.m */; }; - 30429410179F2CD3008CB481 /* status-normal.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3042940E179F2CD3008CB481 /* status-normal.tiff */; }; + 3055C8C718297D540040918A /* status-normal.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3055C8C618297D540040918A /* status-normal.tiff */; }; + 3055C8CA1829A4F30040918A /* ImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 3055C8C91829A4F30040918A /* ImageLoader.m */; }; 30AA857217A154C400F4ADC6 /* tomighty.icns in Resources */ = {isa = PBXBuildFile; fileRef = 30AA857117A154C400F4ADC6 /* tomighty.icns */; }; 30B829CF17A0AC1500DFC201 /* Timer.m in Sources */ = {isa = PBXBuildFile; fileRef = 30B829CE17A0AC1500DFC201 /* Timer.m */; }; 30B829D417A0CCD000DFC201 /* status-white.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 30B829D317A0CCD000DFC201 /* status-white.tiff */; }; @@ -57,7 +58,9 @@ 3025F55617A7299000970DA9 /* Tomighty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tomighty.m; sourceTree = ""; }; 3025F55817A74A6100970DA9 /* TimerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimerContext.h; sourceTree = ""; }; 3025F55917A74A6100970DA9 /* TimerContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TimerContext.m; sourceTree = ""; }; - 3042940E179F2CD3008CB481 /* status-normal.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "status-normal.tiff"; sourceTree = ""; }; + 3055C8C618297D540040918A /* status-normal.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "status-normal.tiff"; sourceTree = ""; }; + 3055C8C81829A4F30040918A /* ImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageLoader.h; sourceTree = ""; }; + 3055C8C91829A4F30040918A /* ImageLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageLoader.m; sourceTree = ""; }; 30AA857117A154C400F4ADC6 /* tomighty.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = tomighty.icns; sourceTree = ""; }; 30B829CD17A0AC1500DFC201 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = ""; }; 30B829CE17A0AC1500DFC201 /* Timer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Timer.m; sourceTree = ""; }; @@ -98,6 +101,7 @@ 301ABCF317A5A53300F19F3C /* Icons */ = { isa = PBXGroup; children = ( + 3055C8C618297D540040918A /* status-normal.tiff */, 301ABCF117A5999400F19F3C /* clock.tiff */, 301ABCED17A593AA00F19F3C /* start-pomodoro.tiff */, 301ABCEE17A593AA00F19F3C /* status-pomodoro.tiff */, @@ -107,7 +111,6 @@ 30FA9D9B17A586A0005D0A80 /* start-long-break.tiff */, 30FA9D9D17A586A0005D0A80 /* start-short-break.tiff */, 30B829D317A0CCD000DFC201 /* status-white.tiff */, - 3042940E179F2CD3008CB481 /* status-normal.tiff */, ); name = Icons; sourceTree = ""; @@ -128,6 +131,8 @@ 3025F55617A7299000970DA9 /* Tomighty.m */, 3025F55817A74A6100970DA9 /* TimerContext.h */, 3025F55917A74A6100970DA9 /* TimerContext.m */, + 3055C8C81829A4F30040918A /* ImageLoader.h */, + 3055C8C91829A4F30040918A /* ImageLoader.m */, ); name = Core; sourceTree = ""; @@ -262,7 +267,6 @@ 30F01B06179EC3F00061D183 /* InfoPlist.strings in Resources */, 30F01B0C179EC3F00061D183 /* Credits.rtf in Resources */, 30F01B12179EC3F10061D183 /* MainMenu.xib in Resources */, - 30429410179F2CD3008CB481 /* status-normal.tiff in Resources */, 30B829D417A0CCD000DFC201 /* status-white.tiff in Resources */, 30AA857217A154C400F4ADC6 /* tomighty.icns in Resources */, 30FA9D9F17A586A0005D0A80 /* start-long-break.tiff in Resources */, @@ -271,6 +275,7 @@ 301ABCE617A5910C00F19F3C /* status-long-break.tiff in Resources */, 301ABCE817A5910C00F19F3C /* status-short-break.tiff in Resources */, 301ABCEF17A593AA00F19F3C /* start-pomodoro.tiff in Resources */, + 3055C8C718297D540040918A /* status-normal.tiff in Resources */, 301ABCF017A593AA00F19F3C /* status-pomodoro.tiff in Resources */, 301ABCF217A5999400F19F3C /* clock.tiff in Resources */, 301ABCFC17A5A8E100F19F3C /* PreferencesWindow.xib in Resources */, @@ -295,6 +300,7 @@ 301ABD0217A5C48500F19F3C /* Preferences.m in Sources */, 301ABD0C17A602E800F19F3C /* Sounds.m in Sources */, 3025F55717A7299000970DA9 /* Tomighty.m in Sources */, + 3055C8CA1829A4F30040918A /* ImageLoader.m in Sources */, 3025F55A17A74A6100970DA9 /* TimerContext.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/src/Tomighty/AppDelegate.m b/src/Tomighty/AppDelegate.m index fe5ac4c..5e2fa68 100644 --- a/src/Tomighty/AppDelegate.m +++ b/src/Tomighty/AppDelegate.m @@ -7,6 +7,7 @@ // #import "AppDelegate.h" +#import "ImageLoader.h" #import "Preferences.h" #import "PreferencesWindowController.h" #import "Sounds.h" @@ -35,8 +36,16 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { shortBreakContext = [[TimerContext alloc] initWithName:@"Short break"]; longBreakContext = [[TimerContext alloc] initWithName:@"Long break"]; + [self initMenuItemsIcons]; [self updateRemainingTime:0]; - +} + +- (void)initMenuItemsIcons { + [self.remainingTimeMenuItem setImage:[ImageLoader loadIcon:@"clock"]]; + [self.stopTimerMenuItem setImage:[ImageLoader loadIcon:@"stop"]]; + [self.startPomodoroMenuItem setImage:[ImageLoader loadIcon:@"start-pomodoro"]]; + [self.startShortBreakMenuItem setImage:[ImageLoader loadIcon:@"start-short-break"]]; + [self.startLongBreakMenuItem setImage:[ImageLoader loadIcon:@"start-long-break"]]; } - (IBAction)showPreferences:(id)sender { diff --git a/src/Tomighty/ImageLoader.h b/src/Tomighty/ImageLoader.h new file mode 100644 index 0000000..461ea1b --- /dev/null +++ b/src/Tomighty/ImageLoader.h @@ -0,0 +1,16 @@ +// +// ImageFactory.h +// Tomighty +// +// Created by Célio Cidral Jr on 05/11/13. +// Copyright (c) 2013 Célio Cidral Jr. All rights reserved. +// + +#import + +@interface ImageLoader : NSObject + ++ (NSImage*) loadIcon:(NSString*)name; ++ (NSImage*) loadTiffImage:(NSString*)name withSize:(int)size; + +@end diff --git a/src/Tomighty/ImageLoader.m b/src/Tomighty/ImageLoader.m new file mode 100644 index 0000000..5e7ac04 --- /dev/null +++ b/src/Tomighty/ImageLoader.m @@ -0,0 +1,32 @@ +// +// ImageFactory.m +// Tomighty +// +// Created by Célio Cidral Jr on 05/11/13. +// Copyright (c) 2013 Célio Cidral Jr. All rights reserved. +// + +#import "ImageLoader.h" + +@implementation ImageLoader + +int const ICON_SIZE = 16; + ++ (NSImage*) loadIcon:(NSString*)name { + return [self loadTiffImage:name withSize:ICON_SIZE]; +} + ++ (NSImage*) loadTiffImage:(NSString*)name withSize:(int)widthAndHeight { + NSString* fileName = [NSString stringWithFormat:@"%@.tiff", name]; + NSImage* image = [NSImage imageNamed:fileName]; + + NSSize size; + size.width = widthAndHeight; + size.height = widthAndHeight; + + [image setSize:size]; + + return image; +} + +@end diff --git a/src/Tomighty/PreferencesWindow.xib b/src/Tomighty/PreferencesWindow.xib index 5d79535..1743012 100644 --- a/src/Tomighty/PreferencesWindow.xib +++ b/src/Tomighty/PreferencesWindow.xib @@ -1,14 +1,14 @@ - 1080 - 12E55 - 3084 - 1187.39 - 626.00 + 1070 + 13A603 + 4514 + 1265 + 695.00 com.apple.InterfaceBuilder.CocoaPlugin - 3084 + 4514 IBNSLayoutConstraint @@ -51,30 +51,27 @@ - + 256 - 12 + 268 {{13, 10}, {296, 200}} - - _NS:9 1 - 256 + 274 268 - {{48, 132}, {73, 17}} + {{49, 132}, {73, 17}} - _NS:1535 YES @@ -83,7 +80,7 @@ 272630784 Pomodoro: - LucidaGrande + .LucidaGrandeUI 13 1044 @@ -109,14 +106,14 @@ NO + 1 268 - {{126, 129}, {50, 22}} + {{128, 129}, {50, 22}} - _NS:9 YES @@ -184,13 +181,13 @@ NO + 1 268 - {{40, 102}, {81, 17}} + {{41, 102}, {81, 17}} - _NS:1535 YES @@ -205,13 +202,13 @@ NO + 1 268 - {{42, 72}, {79, 17}} + {{43, 72}, {79, 17}} - _NS:1535 YES @@ -226,13 +223,13 @@ NO + 1 268 - {{126, 99}, {50, 22}} + {{128, 99}, {50, 22}} - _NS:9 YES @@ -285,13 +282,13 @@ NO + 1 268 - {{126, 69}, {50, 22}} + {{128, 69}, {50, 22}} - _NS:9 YES @@ -344,13 +341,13 @@ NO + 1 268 - {{181, 132}, {55, 17}} + {{184, 132}, {55, 17}} - _NS:1535 YES @@ -365,13 +362,13 @@ NO + 1 268 - {{181, 102}, {55, 17}} + {{184, 102}, {55, 17}} - _NS:1535 YES @@ -386,13 +383,13 @@ NO + 1 268 - {{181, 72}, {55, 17}} + {{184, 72}, {55, 17}} - _NS:1535 YES @@ -407,11 +404,11 @@ NO + 1 {{10, 33}, {276, 154}} - _NS:11 @@ -428,7 +425,7 @@ 268 - {{15, 135}, {229, 18}} + {{15, 135}, {227, 18}} _NS:9 @@ -459,7 +456,7 @@ 268 - {{15, 115}, {245, 18}} + {{15, 115}, {244, 18}} _NS:9 @@ -485,7 +482,7 @@ 268 - {{17, 82}, {168, 17}} + {{18, 82}, {167, 17}} _NS:1535 @@ -501,6 +498,7 @@ NO + 1 @@ -513,7 +511,7 @@ 268 - {{16, 32}, {94, 18}} + {{16, 32}, {93, 18}} _NS:9 @@ -539,7 +537,7 @@ 268 - {{16, 12}, {64, 18}} + {{16, 12}, {63, 18}} _NS:9 @@ -563,13 +561,13 @@ NO - {{1, 1}, {242, 58}} + {{1, 1}, {241, 58}} _NS:11 - {{17, 17}, {244, 74}} + {{17, 17}, {243, 74}} _NS:9 @@ -579,7 +577,7 @@ 0 - LucidaGrande + .LucidaGrandeUI 11 3100 @@ -616,8 +614,6 @@ {322, 216} - - _NS:20 @@ -808,9 +804,10 @@ 1000 - 8 + 0 29 3 + NO @@ -824,9 +821,10 @@ 1000 - 8 + 0 29 3 + NO @@ -840,9 +838,10 @@ 1000 - 8 + 0 29 3 + NO @@ -856,9 +855,10 @@ 1000 - 8 + 0 29 3 + NO @@ -908,6 +908,7 @@ 6 24 2 + NO @@ -924,6 +925,7 @@ 3 9 3 + NO @@ -940,6 +942,7 @@ 6 24 2 + NO @@ -956,6 +959,7 @@ 3 9 3 + NO @@ -972,6 +976,7 @@ 3 9 3 + NO @@ -988,6 +993,7 @@ 6 24 3 + NO @@ -1001,9 +1007,10 @@ 1000 - 8 + 0 29 3 + NO @@ -1017,9 +1024,10 @@ 1000 - 8 + 0 29 3 + NO @@ -1033,9 +1041,10 @@ 1000 - 8 + 0 29 3 + NO @@ -1063,6 +1072,7 @@ 6 24 3 + NO @@ -1079,6 +1089,7 @@ 6 24 2 + NO @@ -1095,6 +1106,7 @@ 6 24 2 + NO @@ -1111,6 +1123,7 @@ 6 24 3 + NO @@ -1127,6 +1140,7 @@ 6 24 2 + NO @@ -1143,6 +1157,7 @@ 6 24 3 + NO @@ -1159,6 +1174,7 @@ 6 24 2 + NO @@ -1175,6 +1191,7 @@ 6 24 2 + NO @@ -1191,6 +1208,7 @@ 3 9 3 + NO @@ -1207,6 +1225,7 @@ 6 24 2 + NO @@ -1223,6 +1242,7 @@ 6 24 2 + NO @@ -1239,6 +1259,7 @@ 6 24 3 + NO @@ -1255,6 +1276,7 @@ 3 9 3 + NO @@ -1271,6 +1293,7 @@ 6 24 2 + NO @@ -1287,6 +1310,7 @@ 6 24 3 + NO @@ -1303,6 +1327,7 @@ 6 24 2 + NO @@ -1316,9 +1341,10 @@ 1000 - 8 + 0 29 3 + NO @@ -1335,6 +1361,7 @@ 6 24 3 + NO @@ -1351,6 +1378,7 @@ 6 24 2 + NO @@ -1367,6 +1395,7 @@ 3 9 3 + NO @@ -1422,6 +1451,7 @@ 3 9 1 + NO @@ -1743,9 +1773,10 @@ 1000 - 8 + 0 29 3 + NO @@ -1759,9 +1790,10 @@ 1000 - 8 + 0 29 3 + NO @@ -1778,6 +1810,7 @@ 6 24 3 + NO @@ -1791,9 +1824,10 @@ 1000 - 8 + 0 29 3 + NO @@ -1807,9 +1841,10 @@ 1000 - 8 + 0 29 3 + NO @@ -2049,106 +2084,18 @@ 370 - - - - NSLayoutConstraint - NSObject - - IBProjectSource - ./Classes/NSLayoutConstraint.h - - - - PreferencesWindowController - NSWindowController - - id - id - id - id - id - id - id - - - - save_sound_play_on_timer_finish: - id - - - save_sound_play_on_timer_start: - id - - - save_sound_play_tictac_during_break: - id - - - save_sound_play_tictac_during_pomodoro: - id - - - save_time_longBreak: - id - - - save_time_pomodoro: - id - - - save_time_shortBreak: - id - - - - NSButton - NSButton - NSButton - NSButton - NSTextField - NSTextField - NSTextField - - - - sound_on_timer_finish - NSButton - - - sound_on_timer_start - NSButton - - - sound_tictac_during_break - NSButton - - - sound_tictac_during_pomodoro - NSButton - - - time_longBreak - NSTextField - - - time_pomodoro - NSTextField - - - time_shortBreak - NSTextField - - - - IBProjectSource - ./Classes/PreferencesWindowController.h - - - - + 0 IBCocoaFramework + YES + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + YES 3 diff --git a/src/Tomighty/StatusIcon.m b/src/Tomighty/StatusIcon.m index 518d0c2..d81c635 100644 --- a/src/Tomighty/StatusIcon.m +++ b/src/Tomighty/StatusIcon.m @@ -7,6 +7,7 @@ // #import "StatusIcon.h" +#import "ImageLoader.h" @implementation StatusIcon { @@ -22,17 +23,21 @@ - (id)initWithStatusMenu:(NSMenu *)statusMenu { self = [super init]; if(self) { - blackIcon = [NSImage imageNamed:@"status-normal.tiff"]; - whiteIcon = [NSImage imageNamed:@"status-white.tiff"]; - redIcon = [NSImage imageNamed:@"status-pomodoro.tiff"]; - greenIcon = [NSImage imageNamed:@"status-short-break.tiff"]; - blueIcon = [NSImage imageNamed:@"status-long-break.tiff"]; + [self createIcons]; [self createStatusItem:statusMenu]; } return self; } +- (void)createIcons { + blackIcon = [ImageLoader loadIcon:@"status-normal"]; + whiteIcon = [ImageLoader loadIcon:@"status-white"]; + redIcon = [ImageLoader loadIcon:@"status-pomodoro"]; + greenIcon = [ImageLoader loadIcon:@"status-short-break"]; + blueIcon = [ImageLoader loadIcon:@"status-long-break"]; +} + - (void)normal { [statusItem setImage:blackIcon]; } diff --git a/src/Tomighty/en.lproj/MainMenu.xib b/src/Tomighty/en.lproj/MainMenu.xib index 8253a60..8f23463 100644 --- a/src/Tomighty/en.lproj/MainMenu.xib +++ b/src/Tomighty/en.lproj/MainMenu.xib @@ -1,14 +1,14 @@ - 1080 - 12F45 - 4510 - 1187.40 - 626.00 + 1070 + 13A603 + 4514 + 1265 + 695.00 com.apple.InterfaceBuilder.CocoaPlugin - 4510 + 4514 NSCustomObject @@ -47,10 +47,6 @@ 00:00 2147483647 - - NSImage - clock - NSImage NSMenuCheckmark @@ -69,10 +65,6 @@ Stop 2147483647 - - NSImage - stop - @@ -119,10 +111,6 @@ Pomodoro 2147483647 - - NSImage - start-pomodoro - @@ -131,10 +119,6 @@ Short break 2147483647 - - NSImage - start-short-break - @@ -143,10 +127,6 @@ Long break 2147483647 - - NSImage - start-long-break - @@ -590,7 +570,7 @@ YES com.apple.InterfaceBuilder.CocoaPlugin.macosx - + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 @@ -601,11 +581,6 @@ {11, 11} {10, 3} - {16, 16} - {16, 16} - {16, 16} - {16, 16} - {16, 16} YES