Skip to content
Browse files

badge text now includes an ellipsis if it's still checking for H.264 …

…variants; extra contextual items now appear if H.264 is confirmed but HD H.264 is still being checked
  • Loading branch information...
1 parent 57930e9 commit f1d8c95336945de0fd126cfce98708870ecfc357 Simone Manganelli committed
Showing with 24 additions and 11 deletions.
  1. +1 −0 Plugin/Plugin.h
  2. +23 −11 Plugin/Plugin.m
View
1 Plugin/Plugin.h
@@ -54,6 +54,7 @@ THE SOFTWARE.
NSString *_launchedAppBundleIdentifier;
BOOL _contextMenuIsVisible;
+ BOOL _receivedAllResponses;
NSURLConnection *connections[2];
unsigned expectedResponses;
NSTimer *_delayingTimer;
View
34 Plugin/Plugin.m
@@ -751,21 +751,30 @@ - (void) _loadInvisibleContentForWindow: (NSNotification*) notification
- (NSString*) badgeLabelText
{
- if( [ self _useHDH264Version ] && [self _hasHDH264Version])
+ if( [ self _useHDH264Version ] && [self _hasHDH264Version]) {
return NSLocalizedString( @"HD H.264", @"HD H.264 badge text" );
- if( [ self _useH264Version ] && [self _hasH264Version])
- return NSLocalizedString( @"H.264", @"H.264 badge text" );
- else if( _fromYouTube && _videoId)
+ } else if( [ self _useH264Version ] && [self _hasH264Version]) {
+ if (_receivedAllResponses) {
+ return NSLocalizedString( @"H.264", @"H.264 badge text" );
+ } else {
+ return NSLocalizedString( @"H.264…", @"H.264 badge waiting text" );
+ }
+ } else if( _fromYouTube && _videoId) {
// we check the video ID too because if it's a flash ad on YouTube.com,
// we don't want to identify it as an actual YouTube video -- but if
// the flash object actually has a video ID parameter, it means its
// a bona fide YouTube video
- return NSLocalizedString( @"YouTube", @"YouTube badge text" );
- else if( _badgeText )
+ if (_receivedAllResponses) {
+ return NSLocalizedString( @"YouTube", @"YouTube badge text" );
+ } else {
+ return NSLocalizedString( @"YouTube…", @"YouTube badge waiting text" );
+ }
+ } else if( _badgeText ) {
return _badgeText;
- else
+ } else {
return NSLocalizedString( @"Flash", @"Flash badge text" );
+ }
}
- (void) _drawBadgeWithPressed: (BOOL) pressed
@@ -1158,12 +1167,13 @@ - (void)_checkForH264VideoVariants
}
expectedResponses = 2;
+ _receivedAllResponses = NO;
}
}
- (void)finishedWithConnection:(NSURLConnection *)connection
{
- BOOL receivedAllResponses = YES;
+ BOOL didReceiveAllResponses = YES;
for (int i = 0; i < 2; ++i) {
if (connection == connections[i]) {
@@ -1171,11 +1181,13 @@ - (void)finishedWithConnection:(NSURLConnection *)connection
[connection release];
connections[i] = nil;
} else if (connections[i])
- receivedAllResponses = NO;
+ didReceiveAllResponses = NO;
}
- if (receivedAllResponses)
- [self setUpExtraMenuItems];
+ if (didReceiveAllResponses) _receivedAllResponses = YES;
+
+ [self setUpExtraMenuItems];
+ [self setNeedsDisplay:YES];
}
- (void)connection:(NSURLConnection *)connection

0 comments on commit f1d8c95

Please sign in to comment.
Something went wrong with that request. Please try again.