2021-05-31 14:07:27 +02:00
|
|
|
//
|
|
|
|
// TDNPreferencesWindowController.m
|
|
|
|
// QuietUnrar
|
|
|
|
//
|
|
|
|
// Created by Robert McGovern on 2021/05/30.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "TDNPreferencesWindowController.h"
|
2021-05-31 21:42:30 +02:00
|
|
|
#import "TDNUserDefaults.h"
|
|
|
|
//#import "QuietUnrarAppDelegate.h"
|
2021-05-31 14:07:27 +02:00
|
|
|
|
|
|
|
@interface TDNPreferencesWindowController ()
|
|
|
|
|
2021-05-31 21:42:30 +02:00
|
|
|
@property (weak) IBOutlet NSSwitch *showNotificationsSwitch;
|
|
|
|
@property (weak) IBOutlet NSSwitch *playSoundSwitch;
|
|
|
|
@property (weak) IBOutlet NSSwitch *hideDockIconSwitch;
|
|
|
|
|
|
|
|
@property TDNUserDefaults * userDefaults;
|
|
|
|
|
2021-05-31 14:07:27 +02:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation TDNPreferencesWindowController
|
|
|
|
|
2021-05-31 21:42:30 +02:00
|
|
|
@synthesize userDefaults, showNotificationsSwitch, playSoundSwitch, hideDockIconSwitch;
|
|
|
|
@synthesize quietUnrar;
|
|
|
|
|
2021-05-31 14:07:27 +02:00
|
|
|
- (id) init {
|
|
|
|
return [super initWithWindowNibName:@"PreferencesWindow"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)windowDidLoad {
|
|
|
|
[super windowDidLoad];
|
2021-05-31 21:42:30 +02:00
|
|
|
|
|
|
|
userDefaults = [TDNUserDefaults sharedInstance];
|
|
|
|
|
2021-05-31 14:07:27 +02:00
|
|
|
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
|
2021-05-31 23:22:04 +02:00
|
|
|
[self.window setTitle:@"QuietUnarchiver Preferences"];
|
|
|
|
|
2021-05-31 21:42:30 +02:00
|
|
|
if (userDefaults.hideDock) {
|
|
|
|
[hideDockIconSwitch setState:NSControlStateValueOn];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDefaults.showNotification) {
|
|
|
|
[showNotificationsSwitch setState:NSControlStateValueOn];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (userDefaults.playSounds) {
|
|
|
|
[playSoundSwitch setState:NSControlStateValueOn];
|
|
|
|
}
|
2021-05-31 14:07:27 +02:00
|
|
|
}
|
|
|
|
|
2021-05-31 21:42:30 +02:00
|
|
|
- (IBAction)showNotificationsSwitchToggled:(id)sender {
|
|
|
|
userDefaults.showNotification = [showNotificationsSwitch state];
|
|
|
|
}
|
2021-05-31 14:07:27 +02:00
|
|
|
|
2021-05-31 21:42:30 +02:00
|
|
|
- (IBAction)playSoundSwitchToggled:(id)sender {
|
|
|
|
userDefaults.playSounds = [playSoundSwitch state];
|
|
|
|
}
|
2021-05-31 14:07:27 +02:00
|
|
|
|
2021-05-31 21:42:30 +02:00
|
|
|
- (IBAction)hideDockIconSwitchToggled:(id)sender {
|
|
|
|
userDefaults.hideDock = [hideDockIconSwitch state];
|
|
|
|
[quietUnrar hideDockIcon: userDefaults.hideDock];
|
2021-05-31 14:07:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|