refactor, init Service menu, clear screen function added to main menu
This commit is contained in:
parent
de303aab0d
commit
62438ae206
@ -17,6 +17,7 @@
|
||||
E22EE9EA1C9DB7B4001F5BC0 /* FMC_Planner_2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9E91C9DB7B4001F5BC0 /* FMC_Planner_2Tests.m */; };
|
||||
E22EE9F51C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */; };
|
||||
E2763C721CA6C8AE001E4EDA /* LSKs.plist in Resources */ = {isa = PBXBuildFile; fileRef = E2763C711CA6C8AE001E4EDA /* LSKs.plist */; };
|
||||
E2763C751CA6E777001E4EDA /* ViewControllerServiceMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = E2763C741CA6E777001E4EDA /* ViewControllerServiceMenu.m */; };
|
||||
E28E106D1C9FF93D006E2C6B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E28E106C1C9FF93D006E2C6B /* QuartzCore.framework */; };
|
||||
E28E10711CA01EC9006E2C6B /* MENU.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10701CA01EC9006E2C6B /* MENU.plist */; };
|
||||
E28E10731CA0375F006E2C6B /* ROUTE.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10721CA0375F006E2C6B /* ROUTE.plist */; };
|
||||
@ -63,6 +64,8 @@
|
||||
E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FMC_Planner_2UITests.m; sourceTree = "<group>"; };
|
||||
E22EE9F61C9DB7B4001F5BC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
E2763C711CA6C8AE001E4EDA /* LSKs.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = LSKs.plist; sourceTree = "<group>"; };
|
||||
E2763C731CA6E777001E4EDA /* ViewControllerServiceMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewControllerServiceMenu.h; sourceTree = "<group>"; };
|
||||
E2763C741CA6E777001E4EDA /* ViewControllerServiceMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewControllerServiceMenu.m; sourceTree = "<group>"; };
|
||||
E28E106C1C9FF93D006E2C6B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
E28E10701CA01EC9006E2C6B /* MENU.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = MENU.plist; sourceTree = "<group>"; };
|
||||
E28E10721CA0375F006E2C6B /* ROUTE.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ROUTE.plist; sourceTree = "<group>"; };
|
||||
@ -185,6 +188,7 @@
|
||||
E22EE9D51C9DB7B3001F5BC0 /* ViewController.h */,
|
||||
E227C7811C9F42AB00DE0CA4 /* ViewControllerKeyboard.h */,
|
||||
E227C7841C9F474100DE0CA4 /* ViewControllerScreen.h */,
|
||||
E2763C731CA6E777001E4EDA /* ViewControllerServiceMenu.h */,
|
||||
);
|
||||
name = Header;
|
||||
sourceTree = "<group>";
|
||||
@ -195,6 +199,7 @@
|
||||
E22EE9D61C9DB7B3001F5BC0 /* ViewController.m */,
|
||||
E227C7821C9F42AB00DE0CA4 /* ViewControllerKeyboard.m */,
|
||||
E227C7851C9F474100DE0CA4 /* ViewControllerScreen.m */,
|
||||
E2763C741CA6E777001E4EDA /* ViewControllerServiceMenu.m */,
|
||||
);
|
||||
name = Implementation;
|
||||
sourceTree = "<group>";
|
||||
@ -369,6 +374,7 @@
|
||||
E22EE9D11C9DB7B3001F5BC0 /* main.m in Sources */,
|
||||
E2A927161CA30CEE00606E07 /* SharedDeclerations.m in Sources */,
|
||||
E227C7831C9F42AB00DE0CA4 /* ViewControllerKeyboard.m in Sources */,
|
||||
E2763C751CA6E777001E4EDA /* ViewControllerServiceMenu.m in Sources */,
|
||||
E227C7861C9F474100DE0CA4 /* ViewControllerScreen.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
@ -2,4 +2,22 @@
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
<Breakpoints>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "FMC Planner 2/ViewControllerServiceMenu.m"
|
||||
timestampString = "480701863.847546"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "13"
|
||||
endingLineNumber = "13"
|
||||
landmarkName = "-viewDidLoad"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
@ -54,6 +54,41 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="132" y="344"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="f8n-Nj-rQS">
|
||||
<objects>
|
||||
<navigationController storyboardIdentifier="ServiceMenu" id="xrf-YY-4pi" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="N7x-bS-wc3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="NBp-hT-qnu" kind="relationship" relationship="rootViewController" id="Lj0-Sp-DNS"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="t3o-xk-B5M" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="477" y="344"/>
|
||||
</scene>
|
||||
<!--View Controller Service Menu-->
|
||||
<scene sceneID="7iP-Kr-lDf">
|
||||
<objects>
|
||||
<viewController id="NBp-hT-qnu" customClass="ViewControllerServiceMenu" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="ggM-lD-yT2"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="QF0-31-pd2"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Q1M-LV-Smi">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="74M-cv-MGw"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="PNG-bU-UDR" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="883" y="346"/>
|
||||
</scene>
|
||||
<!--View Controller Keyboard-->
|
||||
<scene sceneID="L6e-QQ-dPq">
|
||||
<objects>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<string></string>
|
||||
<string></string>
|
||||
<string></string>
|
||||
<string></string>
|
||||
<string>CLEAR ENTRY</string>
|
||||
<string>EXPORT</string>
|
||||
<string>SERVICE</string>
|
||||
</array>
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#import "SharedDeclerations.h"
|
||||
#import "ViewControllerKeyboard.h"
|
||||
#import "ViewControllerScreen.h"
|
||||
#import "ViewControllerServiceMenu.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ViewController : UIViewController <UIAlertViewDelegate>
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
// Setup save system
|
||||
_save = [[NSMutableDictionary alloc] init];
|
||||
_firstLoad = true;
|
||||
self.title = @"FMC";
|
||||
}
|
||||
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
@ -36,69 +37,19 @@
|
||||
}
|
||||
|
||||
- (void)saveToFile:(NSDictionary *)save {
|
||||
NSString *file =
|
||||
[SharedDeclerations savePathForFile:[_save valueForKey:@"MENU@LSKR1"]];
|
||||
if (_firstLoad) {
|
||||
if ([[NSFileManager defaultManager]
|
||||
fileExistsAtPath:
|
||||
[SharedDeclerations
|
||||
savePathForFile:[_save valueForKey:@"MENU@LSKR1"]]]) {
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController *alert = [UIAlertController
|
||||
alertControllerWithTitle:@"Load or replace?"
|
||||
message:
|
||||
@"The entered CO ROUTE alreay exists. "
|
||||
@"Do you want to load or replace it?"
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
UIAlertAction *defaultAction =
|
||||
[UIAlertAction actionWithTitle:@"Cancel"
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil];
|
||||
UIAlertAction *loadAction = [UIAlertAction
|
||||
actionWithTitle:@"Load"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[self
|
||||
loadSave:[_save valueForKey:@"MENU@LSKR1"]];
|
||||
}];
|
||||
UIAlertAction *replaceAction = [UIAlertAction
|
||||
actionWithTitle:@"Replace"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[_save
|
||||
writeToFile:
|
||||
[SharedDeclerations
|
||||
savePathForFile:
|
||||
[_save
|
||||
valueForKey:@"MENU@LSKR1"]]
|
||||
atomically:YES];
|
||||
}];
|
||||
[alert addAction:defaultAction];
|
||||
[alert addAction:loadAction];
|
||||
[alert addAction:replaceAction];
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
} else {
|
||||
UIAlertView *alert = [[UIAlertView alloc]
|
||||
initWithTitle:@"Load or replace?"
|
||||
message:@"The entered CO ROUTE alreay exists. Do "
|
||||
@"you want to load "
|
||||
@"or replace it?"
|
||||
delegate:self
|
||||
cancelButtonTitle:@"Cancel"
|
||||
otherButtonTitles:@"Load", @"Replace", nil];
|
||||
[alert show];
|
||||
}
|
||||
} else if (!([[_save valueForKey:@"MENU@LSKR1"] isEqualToString:@""])) {
|
||||
[_save
|
||||
writeToFile:[SharedDeclerations
|
||||
savePathForFile:[_save
|
||||
valueForKey:@"MENU@LSKR1"]]
|
||||
atomically:YES];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:file]) {
|
||||
[self alertViewiOS7:file];
|
||||
} else if (!([[_save valueForKey:@"MENU@LSKR1"]
|
||||
isEqualToString:@""]) &&
|
||||
[_save valueForKey:@"MENU@LSKR1"] != nil) {
|
||||
[_save writeToFile:file atomically:YES];
|
||||
}
|
||||
} else if (!([_save valueForKey:@"MENU@LSKR1"] == nil ||
|
||||
[[_save valueForKey:@"MENU@LSKR1"] isEqualToString:@""])) {
|
||||
[_save
|
||||
writeToFile:[SharedDeclerations
|
||||
savePathForFile:[_save valueForKey:@"MENU@LSKR1"]]
|
||||
atomically:YES];
|
||||
[_save writeToFile:file atomically:YES];
|
||||
}
|
||||
_firstLoad = false;
|
||||
}
|
||||
@ -113,7 +64,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Delegate vo UIAlertView
|
||||
#pragma mark - Delegate for UIAlertView and UIAlertController outsource
|
||||
|
||||
- (void)alertView:(UIAlertView *)alertView
|
||||
clickedButtonAtIndex:(NSInteger)buttonIndex {
|
||||
@ -129,4 +80,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)alertViewiOS7:(NSString *)file {
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController *alert = [UIAlertController
|
||||
alertControllerWithTitle:@"Load or replace?"
|
||||
message:@"The entered CO ROUTE alreay exists. "
|
||||
@"Do you want to load or replace it?"
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
UIAlertAction *defaultAction =
|
||||
[UIAlertAction actionWithTitle:@"Cancel"
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil];
|
||||
UIAlertAction *loadAction = [UIAlertAction
|
||||
actionWithTitle:@"Load"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[self loadSave:[_save valueForKey:@"MENU@LSKR1"]];
|
||||
}];
|
||||
UIAlertAction *replaceAction =
|
||||
[UIAlertAction actionWithTitle:@"Replace"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[_save writeToFile:file atomically:YES];
|
||||
}];
|
||||
[alert addAction:defaultAction];
|
||||
[alert addAction:loadAction];
|
||||
[alert addAction:replaceAction];
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
} else {
|
||||
UIAlertView *alert = [[UIAlertView alloc]
|
||||
initWithTitle:@"Load or replace?"
|
||||
message:@"The entered CO ROUTE alreay exists. Do "
|
||||
@"you want to load "
|
||||
@"or replace it?"
|
||||
delegate:self
|
||||
cancelButtonTitle:@"Cancel"
|
||||
otherButtonTitles:@"Load", @"Replace", nil];
|
||||
[alert show];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -82,12 +82,38 @@
|
||||
}
|
||||
_main.backupCoRte = ((UILabel *)tapReg.view).text;
|
||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||
} else if ([((UILabel *)tapReg.view)
|
||||
.restorationIdentifier isEqualToString:@"LSKR4"]) {
|
||||
[_main saveToFile:_main.save];
|
||||
_main.save = [[NSMutableDictionary alloc] init];
|
||||
[self clearScreen];
|
||||
NSArray *optional = [[[NSDictionary alloc]
|
||||
initWithContentsOfFile:[[NSBundle mainBundle]
|
||||
pathForResource:@"LSKs"
|
||||
ofType:@"plist"]]
|
||||
valueForKey:_Header.text];
|
||||
for (UILabel *label in _LSK) {
|
||||
for (int i = 0; i < optional.count; i++) {
|
||||
if (label.tag == i && [label.text isEqualToString:@""]) {
|
||||
label.text = optional[i];
|
||||
if (!([optional[i] isEqualToString:@""])) {
|
||||
label.userInteractionEnabled = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ([((UILabel *)tapReg.view)
|
||||
.restorationIdentifier isEqualToString:@"LSKR5"]) {
|
||||
#warning EXPORT TO PMDG GOES HERE
|
||||
} else if ([((UILabel *)tapReg.view)
|
||||
.restorationIdentifier isEqualToString:@"LSKR6"]) {
|
||||
#warning SERVICE MENU GOES HERE
|
||||
[self
|
||||
presentViewController:
|
||||
[self.storyboard
|
||||
instantiateViewControllerWithIdentifier:@"ServiceMenu"]
|
||||
animated:YES
|
||||
completion:nil];
|
||||
} else {
|
||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||
}
|
||||
|
||||
17
FMC Planner 2/ViewControllerServiceMenu.h
Normal file
17
FMC Planner 2/ViewControllerServiceMenu.h
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// ViewControllerServiceMenu.h
|
||||
// FMC Planner 2
|
||||
//
|
||||
// Created by Kilian Hofmann on 26.03.16.
|
||||
// Copyright © 2016 Kilian Hofmann. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SharedDeclerations.h"
|
||||
#import "ViewController.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ViewControllerServiceMenu : UIViewController
|
||||
|
||||
@property(strong, nonatomic) ViewController *main;
|
||||
|
||||
@end
|
||||
27
FMC Planner 2/ViewControllerServiceMenu.m
Normal file
27
FMC Planner 2/ViewControllerServiceMenu.m
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// ViewControllerServiceMenu.m
|
||||
// FMC Planner 2
|
||||
//
|
||||
// Created by Kilian Hofmann on 26.03.16.
|
||||
// Copyright © 2016 Kilian Hofmann. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ViewControllerServiceMenu.h"
|
||||
|
||||
@implementation ViewControllerServiceMenu
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"Service Menu";
|
||||
self.navigationItem.leftBarButtonItem =
|
||||
[[UIBarButtonItem alloc] initWithTitle:@"FMC"
|
||||
style:UIBarButtonItemStyleDone
|
||||
target:self
|
||||
action:@selector(back)];
|
||||
}
|
||||
|
||||
- (void)back {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
x
Reference in New Issue
Block a user