Skip to content

Commit

Permalink
Cleaning up after @okdana :P
Browse files Browse the repository at this point in the history
  • Loading branch information
cyco committed Jan 2, 2014
1 parent 4a357b8 commit 639203a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 42 deletions.
5 changes: 5 additions & 0 deletions OpenEmu/OEApplicationDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
@property(readonly) NSString *appVersion;
@property(readonly) NSString *buildVersion;
@property(readonly) NSAttributedString *projectURL;
#pragma mark - Help Menu
- (IBAction)showOEHelp:(id)sender;
- (IBAction)showOEReleaseNotes:(id)sender;
- (IBAction)showOEWebSite:(id)sender;
- (IBAction)showOEIssues:(id)sender;

#pragma mark - Debug
- (IBAction)OEDebug_logResponderChain:(id)sender;
Expand Down
26 changes: 26 additions & 0 deletions OpenEmu/OEApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@

#import "OEDBSaveState.h"

NSString *const OEWebSiteURL = @"http://openemu.org/";
NSString *const OEUserGuideURL = @"https://github.com/OpenEmu/OpenEmu/wiki/User-guide";
NSString *const OEReleaseNotesURL = @"https://github.com/OpenEmu/OpenEmu/wiki/Release-notes";
NSString *const OEFeedbackURL = @"https://github.com/OpenEmu/OpenEmu/issues";

static void *const _OEApplicationDelegateAllPluginsContext = (void *)&_OEApplicationDelegateAllPluginsContext;

@interface OEApplicationDelegate ()
Expand Down Expand Up @@ -613,6 +618,27 @@ - (IBAction)showPreferencesWindow:(id)sender
{
}

#pragma mark - Help Menu
- (IBAction)showOEHelp:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:OEUserGuideURL]];
}

- (IBAction)showOEReleaseNotes:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:OEReleaseNotesURL]];
}

- (IBAction)showOEWebSite:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:OEWebSiteURL]];
}

- (IBAction)showOEIssues:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:OEFeedbackURL]];
}

#pragma mark - About Window

- (void)showAboutWindow:(id)sender
Expand Down
59 changes: 17 additions & 42 deletions OpenEmu/OEMainWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@

NSString *const OEDefaultWindowTitle = @"OpenEmu";

NSString *const OEWebSiteURL = @"http://openemu.org/";
NSString *const OEUserGuideURL = @"https://github.com/OpenEmu/OpenEmu/wiki/User-guide";
NSString *const OEReleaseNotesURL = @"https://github.com/OpenEmu/OpenEmu/wiki/Release-notes";
NSString *const OEFeedbackURL = @"https://github.com/OpenEmu/OpenEmu/issues";

#define MainMenu_Window_OpenEmuTag 501

@interface OEMainWindowController () <OELibraryControllerDelegate>
Expand All @@ -83,30 +78,30 @@ - (id)initWithWindow:(NSWindow *)window
{
if((self = [super initWithWindow:window]) == nil)
return nil;

// Since restoration from autosave happens before NSWindowController
// receives -windowDidLoad and we are autosaving the window size, we
// need to set allowWindowResizing to YES before -windowDidLoad
_allowWindowResizing = YES;

return self;
}

- (void)windowDidLoad
{
NSWindow *window = [self window];

[super windowDidLoad];

[[self libraryController] setDelegate:self];

[window setWindowController:self];
[window setDelegate:self];

// Setup Window behavior
[window setRestorable:NO];
[window setExcludedFromWindowsMenu:YES];

if(![[NSUserDefaults standardUserDefaults] boolForKey:OESetupAssistantHasFinishedKey])
{
OESetupAssistant *setupAssistant = [[OESetupAssistant alloc] init];
Expand All @@ -117,9 +112,9 @@ - (void)windowDidLoad
[[[OELibraryDatabase defaultDatabase] importer] discoverRoms:volumes];
[self setCurrentContentController:[self libraryController] animate:NO];
}];

[window center];

[self setCurrentContentController:setupAssistant];
}
else
Expand Down Expand Up @@ -159,7 +154,7 @@ - (void)setCurrentContentController:(NSViewController *)controller animate:(BOOL
[placeHolderView replaceSubview:viewToReplace with:[controller view]];
else
[placeHolderView addSubview:[controller view]];

[[self window] makeFirstResponder:[controller view]];

[_currentContentController viewDidDisappear];
Expand All @@ -176,7 +171,7 @@ - (void)setCurrentContentController:(NSViewController *)controller animate:(BOOL
else
{
NSWindow *window = [self window];

[window setTitle:OEDefaultWindowTitle];
#if DEBUG_PRINT
[window setTitle:[[window title] stringByAppendingString:@" (DEBUG BUILD)"]];
Expand Down Expand Up @@ -367,7 +362,7 @@ - (void)windowWillClose:(NSNotification *)notification
[[self libraryController] viewWillAppear];
[[self libraryController] viewDidAppear];
}

[self setCurrentContentController:nil];
}

Expand All @@ -380,7 +375,7 @@ - (void)windowDidBecomeKey:(NSNotification *)notification
- (void)windowDidBecomeMain:(NSNotification *)notification
{
NSMenu *mainMenu = [NSApp mainMenu];

NSMenu *windowMenu = [[mainMenu itemAtIndex:5] submenu];
NSMenuItem *item = [windowMenu itemWithTag:MainMenu_Window_OpenEmuTag];
[item setState:NSOnState];
Expand All @@ -389,7 +384,7 @@ - (void)windowDidBecomeMain:(NSNotification *)notification
- (void)windowDidResignMain:(NSNotification *)notification
{
NSMenu *mainMenu = [NSApp mainMenu];

NSMenu *windowMenu = [[mainMenu itemAtIndex:5] submenu];
NSMenuItem *item = [windowMenu itemWithTag:MainMenu_Window_OpenEmuTag];
[item setState:NSOffState];
Expand All @@ -414,7 +409,7 @@ - (void)windowDidEnterFullScreen:(NSNotification *)notification
[_gameDocument setGameWindowController:self];
[self setCurrentContentController:[_gameDocument gameViewController]];
}

if(_resumePlayingAfterFullScreenTransition)
[_gameDocument setEmulationPaused:NO];
}
Expand All @@ -435,7 +430,7 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification
if(_shouldUndockGameWindowOnFullScreenExit)
{
_shouldUndockGameWindowOnFullScreenExit = NO;

[self setCurrentContentController:nil];

[_gameDocument showInSeparateWindowInFullScreen:NO];
Expand All @@ -455,28 +450,8 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification
- (IBAction)launchLastPlayedROM:(id)sender
{
OEDBGame *game = [[sender representedObject] game];

[self libraryController:nil didSelectGame:game];
}

- (IBAction)showOEHelp:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:OEUserGuideURL]];
}

- (IBAction)showOEReleaseNotes:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:OEReleaseNotesURL]];
}

- (IBAction)showOEWebSite:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:OEWebSiteURL]];
}

- (IBAction)showOEIssues:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:OEFeedbackURL]];
}

@end

0 comments on commit 639203a

Please sign in to comment.