FreeRDP
Loading...
Searching...
No Matches
iOS/AppDelegate.m
1/*
2 App delegate
3
4 Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
5
6 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7 If a copy of the MPL was not distributed with this file, You can obtain one at
8 http://mozilla.org/MPL/2.0/.
9 */
10
11#import "AppDelegate.h"
12
13#import "AboutController.h"
14#import "HelpController.h"
15#import "BookmarkListController.h"
16#import "AppSettingsController.h"
17#import "MainTabBarController.h"
18#import "Utils.h"
19
20@implementation AppDelegate
21
22@synthesize window = _window, tabBarController = _tabBarController;
23
24- (BOOL)application:(UIApplication *)application
25 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
26{
27 // Set default values for most NSUserDefaults
28 [[NSUserDefaults standardUserDefaults]
29 registerDefaults:[NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle]
30 pathForResource:@"Defaults"
31 ofType:@"plist"]]];
32
33 // init global settings
34 SetSwapMouseButtonsFlag(
35 [[NSUserDefaults standardUserDefaults] boolForKey:@"ui.swap_mouse_buttons"]);
36 SetInvertScrollingFlag(
37 [[NSUserDefaults standardUserDefaults] boolForKey:@"ui.invert_scrolling"]);
38
39 // create bookmark view and navigation controller
40 BookmarkListController *bookmarkListController =
41 [[[BookmarkListController alloc] initWithNibName:@"BookmarkListView"
42 bundle:nil] autorelease];
43 UINavigationController *bookmarkNavigationController = [[[UINavigationController alloc]
44 initWithRootViewController:bookmarkListController] autorelease];
45
46 // create app settings view and navigation controller
47 AppSettingsController *appSettingsController =
48 [[[AppSettingsController alloc] initWithStyle:UITableViewStyleGrouped] autorelease];
49 UINavigationController *appSettingsNavigationController = [[[UINavigationController alloc]
50 initWithRootViewController:appSettingsController] autorelease];
51
52 // create help view controller
53 HelpController *helpViewController = [[[HelpController alloc] initWithNibName:nil
54 bundle:nil] autorelease];
55
56 // create about view controller
57 AboutController *aboutViewController =
58 [[[AboutController alloc] initWithNibName:nil bundle:nil] autorelease];
59
60 // add tab-bar controller to the main window and display everything
61 NSArray *tabItems =
62 [NSArray arrayWithObjects:bookmarkNavigationController, appSettingsNavigationController,
63 helpViewController, aboutViewController, nil];
64 [_tabBarController setViewControllers:tabItems];
65 if ([_window respondsToSelector:@selector(setRootViewController:)])
66 [_window setRootViewController:_tabBarController];
67 else
68 [_window addSubview:[_tabBarController view]];
69 [_window makeKeyAndVisible];
70
71 return YES;
72}
73
74- (void)applicationWillResignActive:(UIApplication *)application
75{
76 /*
77 Sent when the application is about to move from active to inactive state. This can occur for
78 certain types of temporary interruptions (such as an incoming phone call or SMS message) or
79 when the user quits the application and it begins the transition to the background state. Use
80 this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates.
81 Games should use this method to pause the game.
82 */
83}
84
85- (void)applicationDidEnterBackground:(UIApplication *)application
86{
87 /*
88 Use this method to release shared resources, save user data, invalidate timers, and store
89 enough application state information to restore your application to its current state in case
90 it is terminated later. If your application supports background execution, this method is
91 called instead of applicationWillTerminate: when the user quits.
92 */
93}
94
95- (void)applicationWillEnterForeground:(UIApplication *)application
96{
97 /*
98 Called as part of the transition from the background to the inactive state; here you can undo
99 many of the changes made on entering the background.
100 */
101 // cancel disconnect timer
102}
103
104- (void)applicationDidBecomeActive:(UIApplication *)application
105{
106 /*
107 Restart any tasks that were paused (or not yet started) while the application was inactive. If
108 the application was previously in the background, optionally refresh the user interface.
109 */
110}
111
112- (void)applicationWillTerminate:(UIApplication *)application
113{
114 /*
115 Called when the application is about to terminate.
116 Save data if appropriate.
117 See also applicationDidEnterBackground:.
118 */
119}
120
121- (void)dealloc
122{
123 [_window release];
124 [super dealloc];
125}
126
127@end