2009-02-22 19:56:28 +00:00
|
|
|
//
|
|
|
|
// MainWindow.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 2/22/09.
|
|
|
|
// Copyright 2009 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "MainWindow.h"
|
|
|
|
|
2022-06-29 05:58:13 +00:00
|
|
|
#import "AppController.h"
|
|
|
|
|
2022-06-22 02:01:06 +00:00
|
|
|
void showCrashlyticsConsent(NSWindow *window) {
|
|
|
|
BOOL askedConsent = [[NSUserDefaults standardUserDefaults] boolForKey:@"crashlyticsAskedConsent"];
|
|
|
|
if(!askedConsent) {
|
|
|
|
[window orderFront:window];
|
|
|
|
|
|
|
|
NSAlert *alert = [[NSAlert alloc] init];
|
|
|
|
[alert setMessageText:NSLocalizedString(@"CrashlyticsConsentTitle", @"")];
|
|
|
|
[alert setInformativeText:NSLocalizedString(@"CrashlyticsConsentText", @"")];
|
|
|
|
[alert addButtonWithTitle:NSLocalizedString(@"ConsentYes",@"")];
|
|
|
|
[alert addButtonWithTitle:NSLocalizedString(@"ConsentNo", @"")];
|
|
|
|
|
|
|
|
[alert beginSheetModalForWindow:window completionHandler:^(NSModalResponse returnCode) {
|
|
|
|
if(returnCode == NSAlertFirstButtonReturn) {
|
|
|
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"crashlyticsConsented"];
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
|
|
|
|
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"crashlyticsAskedConsent"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-22 19:56:28 +00:00
|
|
|
@implementation MainWindow
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
|
|
|
|
self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
|
|
|
|
if(self) {
|
|
|
|
[self setExcludedFromWindowsMenu:YES];
|
|
|
|
[self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
|
|
|
}
|
|
|
|
return self;
|
2009-02-22 19:56:28 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)awakeFromNib {
|
|
|
|
[super awakeFromNib];
|
|
|
|
|
|
|
|
[playlistView setNextResponder:self];
|
|
|
|
|
|
|
|
hdcdLogo = [NSImage imageNamed:@"hdcdLogoTemplate"];
|
2021-01-09 09:44:32 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
[self showHDCDLogo:NO];
|
2022-06-22 02:01:06 +00:00
|
|
|
|
|
|
|
if(![[NSUserDefaults standardUserDefaults] boolForKey:@"miniMode"]) {
|
|
|
|
showCrashlyticsConsent(self);
|
|
|
|
}
|
2022-01-21 07:53:45 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)showHDCDLogo:(BOOL)show {
|
|
|
|
for(NSToolbarItem* toolbarItem in [mainToolbar items]) {
|
2022-06-11 20:37:51 +00:00
|
|
|
if([[toolbarItem itemIdentifier] isEqualToString:@"hdcdMain"]) {
|
2022-02-07 05:49:27 +00:00
|
|
|
if(show)
|
|
|
|
[toolbarItem setImage:hdcdLogo];
|
|
|
|
else
|
|
|
|
[toolbarItem setImage:nil];
|
|
|
|
}
|
|
|
|
}
|
2009-02-22 19:56:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|