Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Tuned dynamic fill of the icon #2

Merged
merged 2 commits into from

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
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
Commits on Aug 5, 2012
  1. Mathijs Kadijk

    Tuned dynamic fill of the icon

    mac-cain13 authored
    Made the fill rect somewhat smaller, so it looks somewhat more like the Apple battery and doesn't feel to large anymore.
  2. Mathijs Kadijk

    Added an icon

    mac-cain13 authored
This page is out of date. Refresh to see the latest.
4 Battery Time Remaining.xcodeproj/project.pbxproj
View
@@ -14,6 +14,7 @@
2841C7F415C91CC100F4F15F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2841C7F315C91CC100F4F15F /* AppDelegate.m */; };
2841C7F715C91CC200F4F15F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2841C7F515C91CC200F4F15F /* MainMenu.xib */; };
2841C7FE15C91CEF00F4F15F /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2841C7FD15C91CEF00F4F15F /* IOKit.framework */; };
+ D570489C15CF1B9200E488C4 /* battery.icns in Resources */ = {isa = PBXBuildFile; fileRef = D570489B15CF1B9200E488C4 /* battery.icns */; };
D58C7EF815CD7C6100C07E0C /* StartAtLoginHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = D58C7EF715CD7C6100C07E0C /* StartAtLoginHelper.m */; };
/* End PBXBuildFile section */
@@ -32,6 +33,7 @@
2841C7F315C91CC100F4F15F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
2841C7F615C91CC200F4F15F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
2841C7FD15C91CEF00F4F15F /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
+ D570489B15CF1B9200E488C4 /* battery.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = battery.icns; sourceTree = "<group>"; };
D58C7EF615CD7C6100C07E0C /* StartAtLoginHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StartAtLoginHelper.h; sourceTree = "<group>"; };
D58C7EF715CD7C6100C07E0C /* StartAtLoginHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StartAtLoginHelper.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -52,6 +54,7 @@
2841C7D115C91CC100F4F15F = {
isa = PBXGroup;
children = (
+ D570489B15CF1B9200E488C4 /* battery.icns */,
2841C7E615C91CC100F4F15F /* Battery Time Remaining */,
2841C7DF15C91CC100F4F15F /* Frameworks */,
2841C7DD15C91CC100F4F15F /* Products */,
@@ -165,6 +168,7 @@
2841C7EB15C91CC100F4F15F /* InfoPlist.strings in Resources */,
2841C7F115C91CC100F4F15F /* Credits.rtf in Resources */,
2841C7F715C91CC200F4F15F /* MainMenu.xib in Resources */,
+ D570489C15CF1B9200E488C4 /* battery.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
14 Battery Time Remaining/AppDelegate.m
View
@@ -132,20 +132,20 @@ - (void)updateStatusItem
NSInteger hour = (int)timeRemaining / 3600;
NSInteger minute = (int)timeRemaining % 3600 / 60;
- // Make dynamic Battery icon
+ // Make dynamic battery icon
NSImage *batteryDynamic = [self getBatteryIconNamed:@"BatteryEmpty"];
[batteryDynamic lockFocus];
-
+
NSRect sourceRect;
sourceRect.origin = NSZeroPoint;
sourceRect.origin.x += [batteryDynamic size].width / 100 * 15;
- sourceRect.origin.y += [batteryDynamic size].height / 50 * 10;
+ sourceRect.origin.y += [batteryDynamic size].height / 50 * 15;
sourceRect.size = [batteryDynamic size];
- sourceRect.size.width -= [batteryDynamic size].width / 100 * 40;
- sourceRect.size.height -= [batteryDynamic size].height / 50 * 20;
+ sourceRect.size.width -= [batteryDynamic size].width / 100 * 43;
+ sourceRect.size.height -= [batteryDynamic size].height / 50 * 30;
- sourceRect.size.width -= [batteryDynamic size].width / 100 * (60.0f - (60.0f / 100.0f * percent));
+ sourceRect.size.width -= [batteryDynamic size].width / 100 * (60.f - (60.f / 100.f * percent));
if (percent > 15)
{
@@ -156,7 +156,7 @@ - (void)updateStatusItem
[[NSColor redColor] set];
}
- NSRectFill (sourceRect);
+ NSRectFill(sourceRect);
[batteryDynamic unlockFocus];
2  Battery Time Remaining/Battery Time Remaining-Info.plist
View
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
- <string></string>
+ <string>battery</string>
<key>CFBundleIdentifier</key>
<string>com.codler.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
BIN  battery.icns
View
Binary file not shown
Something went wrong with that request. Please try again.