- Rewrote LauncherPreferences -> PLPreferences + Now the file layout is the same as UI layout + (get/set)Preference are replaced with corresponding get/set types + Getting/setting is now done through keyPath instead of manually iterating over subdictionaries. + Implemented an isolation layer, allowing an instance to have its own settings. This is off by default - Implemented launcher_profiles + Added Profile manager that can be accessed from the sidebar + Moved "Game directory (instances)" to this screen + Replaced version selector with profile selector. Version selector is moved into profile editor. - Other changes + Cleanup code by using NSPredicate instead of huge for loops + Titles in settings are made multilined + Controller config: replaced bar button items with localized ones Due to how large the changes are, this is committed directly to the mainline branch. Bugs are expected to be found (although I did enough tests for this locally)
71 lines
2.7 KiB
Objective-C
71 lines
2.7 KiB
Objective-C
#import "LauncherSplitViewController.h"
|
|
#import "LauncherMenuViewController.h"
|
|
#import "LauncherNewsViewController.h"
|
|
#import "LauncherNavigationController.h"
|
|
#import "LauncherPreferences.h"
|
|
#import "utils.h"
|
|
|
|
extern NSMutableDictionary *prefDict;
|
|
|
|
@interface LauncherSplitViewController ()<UISplitViewControllerDelegate>{
|
|
}
|
|
@end
|
|
|
|
@implementation LauncherSplitViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
UIApplication.sharedApplication.idleTimerDisabled = YES;
|
|
setViewBackgroundColor(self.view);
|
|
if ([getPrefObject(@"control.control_safe_area") length] == 0) {
|
|
setPrefObject(@"control.control_safe_area", NSStringFromUIEdgeInsets(getDefaultSafeArea()));
|
|
}
|
|
|
|
self.delegate = self;
|
|
|
|
UINavigationController *masterVc = [[UINavigationController alloc] initWithRootViewController:[[LauncherMenuViewController alloc] init]];
|
|
LauncherNavigationController *detailVc = [[LauncherNavigationController alloc] initWithRootViewController:[[LauncherNewsViewController alloc] init]];
|
|
detailVc.toolbarHidden = NO;
|
|
|
|
self.viewControllers = @[masterVc, detailVc];
|
|
[self changeDisplayModeForSize:self.view.frame.size];
|
|
|
|
self.maximumPrimaryColumnWidth = self.view.bounds.size.width * 0.95;
|
|
}
|
|
|
|
- (void)splitViewController:(UISplitViewController *)svc willChangeToDisplayMode:(UISplitViewControllerDisplayMode)displayMode {
|
|
if (self.preferredDisplayMode != displayMode && self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
self.preferredDisplayMode = UISplitViewControllerDisplayModeSecondaryOnly;
|
|
});
|
|
}
|
|
}
|
|
|
|
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
|
{
|
|
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
|
[self changeDisplayModeForSize:size];
|
|
}
|
|
|
|
- (void)changeDisplayModeForSize:(CGSize)size {
|
|
BOOL isPortrait = size.height > size.width;
|
|
if (self.preferredDisplayMode == 0 || self.displayMode != UISplitViewControllerDisplayModeSecondaryOnly) {
|
|
if(!getPrefBool(@"general.hidden_sidebar")) {
|
|
self.preferredDisplayMode = isPortrait ?
|
|
UISplitViewControllerDisplayModeOneOverSecondary :
|
|
UISplitViewControllerDisplayModeOneBesideSecondary;
|
|
} else {
|
|
self.preferredDisplayMode = UISplitViewControllerDisplayModeSecondaryOnly;
|
|
}
|
|
}
|
|
self.preferredSplitBehavior = isPortrait ?
|
|
UISplitViewControllerSplitBehaviorOverlay :
|
|
UISplitViewControllerSplitBehaviorTile;
|
|
}
|
|
|
|
- (void)dismissViewController {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
@end
|