Add a debug menu item for checking updates
This commit is contained in:
parent
9cb847c8d0
commit
37884f0ccf
|
@ -46,6 +46,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)checkForUpdate;
|
- (void)checkForUpdate;
|
||||||
|
- (void)checkForUpdateForced:(BOOL)forced;
|
||||||
|
|
||||||
@property (assign, nonatomic) IBOutlet NSWindow *window;
|
@property (assign, nonatomic) IBOutlet NSWindow *window;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -70,6 +70,11 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)checkForUpdate
|
- (void)checkForUpdate
|
||||||
|
{
|
||||||
|
[self checkForUpdateForced:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)checkForUpdateForced:(BOOL)forced
|
||||||
{
|
{
|
||||||
if (_updateCheckConnection) {
|
if (_updateCheckConnection) {
|
||||||
// busy
|
// busy
|
||||||
|
@ -77,14 +82,16 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// time for update?
|
// time for update?
|
||||||
NSDate *now = [NSDate date];
|
if (!forced) {
|
||||||
NSDate *date = [[NSUserDefaults standardUserDefaults] objectForKey:kNextUpdateCheckDateKey];
|
NSDate *now = [NSDate date];
|
||||||
if (![date isKindOfClass:[NSDate class]]) {
|
NSDate *date = [[NSUserDefaults standardUserDefaults] objectForKey:kNextUpdateCheckDateKey];
|
||||||
date = now;
|
if (![date isKindOfClass:[NSDate class]]) {
|
||||||
}
|
date = now;
|
||||||
|
}
|
||||||
|
|
||||||
if ([now compare:date] == NSOrderedAscending) {
|
if ([now compare:date] == NSOrderedAscending) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSDate *nextUpdateDate = [NSDate dateWithTimeInterval:kNextCheckInterval sinceDate:[NSDate date]];
|
NSDate *nextUpdateDate = [NSDate dateWithTimeInterval:kNextCheckInterval sinceDate:[NSDate date]];
|
||||||
|
|
|
@ -234,6 +234,11 @@ public:
|
||||||
}
|
}
|
||||||
#endif //DEBUG
|
#endif //DEBUG
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
NSMenuItem *updateCheckItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Check for Updates…", @"") action:@selector(checkForUpdate:) keyEquivalent:@""] autorelease];
|
||||||
|
[menu addItem:updateCheckItem];
|
||||||
|
#endif
|
||||||
|
|
||||||
NSMenuItem *aboutMenuItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"About McBopomofo…", @"") action:@selector(showAbout:) keyEquivalent:@""] autorelease];
|
NSMenuItem *aboutMenuItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"About McBopomofo…", @"") action:@selector(showAbout:) keyEquivalent:@""] autorelease];
|
||||||
[menu addItem:aboutMenuItem];
|
[menu addItem:aboutMenuItem];
|
||||||
|
|
||||||
|
@ -1360,6 +1365,11 @@ public:
|
||||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)checkForUpdate:(id)sender
|
||||||
|
{
|
||||||
|
[(AppDelegate *)[[NSApplication sharedApplication] delegate] checkForUpdateForced:YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)showAbout:(id)sender
|
- (void)showAbout:(id)sender
|
||||||
{
|
{
|
||||||
[[NSApplication sharedApplication] orderFrontStandardAboutPanel:sender];
|
[[NSApplication sharedApplication] orderFrontStandardAboutPanel:sender];
|
||||||
|
|
|
@ -25,3 +25,5 @@
|
||||||
/* No comment provided by engineer. */
|
/* No comment provided by engineer. */
|
||||||
"You are running version %@ (%@), and the new version %@ (%@) is now available.\n\nVisit the website to download it?" = "You are running version %1$@ (%2$@), and the new version %3$@ (%4$@) is now available.\n\nVisit the website to download it?";
|
"You are running version %@ (%@), and the new version %@ (%@) is now available.\n\nVisit the website to download it?" = "You are running version %1$@ (%2$@), and the new version %3$@ (%4$@) is now available.\n\nVisit the website to download it?";
|
||||||
|
|
||||||
|
/* No comment provided by engineer. */
|
||||||
|
"Check for Updates…" = "Check for Updates…";
|
||||||
|
|
|
@ -24,3 +24,6 @@
|
||||||
|
|
||||||
/* No comment provided by engineer. */
|
/* No comment provided by engineer. */
|
||||||
"You are running version %@ (%@), and the new version %@ (%@) is now available.\n\nVisit the website to download it?" = "目前的輸入法版本是 %1$@ 版 (%2$@),目前最新版本已經到第 %3$@ 版 (%4$@)。\n\n是否要前往輸入法網站,下載最新版本?";
|
"You are running version %@ (%@), and the new version %@ (%@) is now available.\n\nVisit the website to download it?" = "目前的輸入法版本是 %1$@ 版 (%2$@),目前最新版本已經到第 %3$@ 版 (%4$@)。\n\n是否要前往輸入法網站,下載最新版本?";
|
||||||
|
|
||||||
|
/* No comment provided by engineer. */
|
||||||
|
"Check for Updates…" = "檢查是否有新版…";
|
||||||
|
|
Loading…
Reference in New Issue