Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Tuned dynamic fill of the icon #2

Merged
merged 2 commits into from almost 2 years ago

2 participants

Mathijs Kadijk Han Lin Yap
Mathijs Kadijk

Made the fill rect somewhat smaller, so it looks somewhat more like the Apple battery and doesn't feel to large anymore.

mac-cain13 added some commits
Mathijs Kadijk mac-cain13 Tuned dynamic fill of the icon
Made the fill rect somewhat smaller, so it looks somewhat more like the Apple battery and doesn't feel to large anymore.
112dec2
Mathijs Kadijk mac-cain13 Added an icon dae315e
Mathijs Kadijk

Also added an App icon in the second commit.

Han Lin Yap codler merged commit 9b9a139 into from
Han Lin Yap codler closed this
Han Lin Yap
Owner

Great! Thanks! It looks much better now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Aug 05, 2012
Mathijs Kadijk mac-cain13 Tuned dynamic fill of the icon
Made the fill rect somewhat smaller, so it looks somewhat more like the Apple battery and doesn't feel to large anymore.
112dec2
Mathijs Kadijk mac-cain13 Added an icon dae315e
This page is out of date. Refresh to see the latest.
4 Battery Time Remaining.xcodeproj/project.pbxproj
@@ -14,6 +14,7 @@
14 14 2841C7F415C91CC100F4F15F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2841C7F315C91CC100F4F15F /* AppDelegate.m */; };
15 15 2841C7F715C91CC200F4F15F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2841C7F515C91CC200F4F15F /* MainMenu.xib */; };
16 16 2841C7FE15C91CEF00F4F15F /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2841C7FD15C91CEF00F4F15F /* IOKit.framework */; };
  17 + D570489C15CF1B9200E488C4 /* battery.icns in Resources */ = {isa = PBXBuildFile; fileRef = D570489B15CF1B9200E488C4 /* battery.icns */; };
17 18 D58C7EF815CD7C6100C07E0C /* StartAtLoginHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = D58C7EF715CD7C6100C07E0C /* StartAtLoginHelper.m */; };
18 19 /* End PBXBuildFile section */
19 20
@@ -32,6 +33,7 @@
32 33 2841C7F315C91CC100F4F15F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
33 34 2841C7F615C91CC200F4F15F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
34 35 2841C7FD15C91CEF00F4F15F /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
  36 + D570489B15CF1B9200E488C4 /* battery.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = battery.icns; sourceTree = "<group>"; };
35 37 D58C7EF615CD7C6100C07E0C /* StartAtLoginHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StartAtLoginHelper.h; sourceTree = "<group>"; };
36 38 D58C7EF715CD7C6100C07E0C /* StartAtLoginHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StartAtLoginHelper.m; sourceTree = "<group>"; };
37 39 /* End PBXFileReference section */
@@ -52,6 +54,7 @@
52 54 2841C7D115C91CC100F4F15F = {
53 55 isa = PBXGroup;
54 56 children = (
  57 + D570489B15CF1B9200E488C4 /* battery.icns */,
55 58 2841C7E615C91CC100F4F15F /* Battery Time Remaining */,
56 59 2841C7DF15C91CC100F4F15F /* Frameworks */,
57 60 2841C7DD15C91CC100F4F15F /* Products */,
@@ -165,6 +168,7 @@
165 168 2841C7EB15C91CC100F4F15F /* InfoPlist.strings in Resources */,
166 169 2841C7F115C91CC100F4F15F /* Credits.rtf in Resources */,
167 170 2841C7F715C91CC200F4F15F /* MainMenu.xib in Resources */,
  171 + D570489C15CF1B9200E488C4 /* battery.icns in Resources */,
168 172 );
169 173 runOnlyForDeploymentPostprocessing = 0;
170 174 };
14 Battery Time Remaining/AppDelegate.m
@@ -132,20 +132,20 @@ - (void)updateStatusItem
132 132 NSInteger hour = (int)timeRemaining / 3600;
133 133 NSInteger minute = (int)timeRemaining % 3600 / 60;
134 134
135   - // Make dynamic Battery icon
  135 + // Make dynamic battery icon
136 136 NSImage *batteryDynamic = [self getBatteryIconNamed:@"BatteryEmpty"];
137 137
138 138 [batteryDynamic lockFocus];
139   -
  139 +
140 140 NSRect sourceRect;
141 141 sourceRect.origin = NSZeroPoint;
142 142 sourceRect.origin.x += [batteryDynamic size].width / 100 * 15;
143   - sourceRect.origin.y += [batteryDynamic size].height / 50 * 10;
  143 + sourceRect.origin.y += [batteryDynamic size].height / 50 * 15;
144 144 sourceRect.size = [batteryDynamic size];
145   - sourceRect.size.width -= [batteryDynamic size].width / 100 * 40;
146   - sourceRect.size.height -= [batteryDynamic size].height / 50 * 20;
  145 + sourceRect.size.width -= [batteryDynamic size].width / 100 * 43;
  146 + sourceRect.size.height -= [batteryDynamic size].height / 50 * 30;
147 147
148   - sourceRect.size.width -= [batteryDynamic size].width / 100 * (60.0f - (60.0f / 100.0f * percent));
  148 + sourceRect.size.width -= [batteryDynamic size].width / 100 * (60.f - (60.f / 100.f * percent));
149 149
150 150 if (percent > 15)
151 151 {
@@ -156,7 +156,7 @@ - (void)updateStatusItem
156 156 [[NSColor redColor] set];
157 157 }
158 158
159   - NSRectFill (sourceRect);
  159 + NSRectFill(sourceRect);
160 160
161 161 [batteryDynamic unlockFocus];
162 162
2  Battery Time Remaining/Battery Time Remaining-Info.plist
@@ -7,7 +7,7 @@
7 7 <key>CFBundleExecutable</key>
8 8 <string>${EXECUTABLE_NAME}</string>
9 9 <key>CFBundleIconFile</key>
10   - <string></string>
  10 + <string>battery</string>
11 11 <key>CFBundleIdentifier</key>
12 12 <string>com.codler.${PRODUCT_NAME:rfc1034identifier}</string>
13 13 <key>CFBundleInfoDictionaryVersion</key>
BIN  battery.icns
Binary file not shown

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.