From 50109a86ca87c32f5c4c4cd928d36b5120d675c9 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Sat, 24 May 2014 00:33:40 +0000 Subject: [PATCH] --- DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj | 6 ++++++ DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcshareddata/DUREX Vendor Control.xccheckout | 46 ++++++++++++++++++++++++++++++++++++++++++++++ DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate | Bin 73680 -> 0 bytes DUREX Vendor Control/MenuTableViewController.h | 10 +++++----- DUREX Vendor Control/MenuTableViewController.m | 19 ++++--------------- DUREX Vendor Control/Stack.h | 19 +++++++++++++++++++ DUREX Vendor Control/Stack.m | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ DUREX tests/DUREX test.xcodeproj/project.pbxproj | 10 ++++++++++ DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcshareddata/DUREX test.xccheckout | 46 ++++++++++++++++++++++++++++++++++++++++++++++ DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate | Bin 69478 -> 0 bytes DUREX tests/FirstAppExample/EMDevicePickerViewController.m | 2 +- DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/120 - App Icon@2x.png | Bin 5625 -> 0 bytes DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/40 - App Icon@2x.png | Bin 4053 -> 0 bytes DUREX tests/FirstAppExample/MainStoryboard.storyboard | 34 +++++++++------------------------- DUREX tests/MenuTableViewController.h | 15 +++++++-------- DUREX tests/MenuTableViewController.m | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------ DUREX tests/Stack.h | 1 + DUREX tests/Stack.m | 15 +++++++++++++-- DUREX tests/icon_checkmark.png | Bin 0 -> 2991 bytes DUREX tests/icon_delete.png | Bin 0 -> 3002 bytes 20 files changed, 279 insertions(+), 74 deletions(-) create mode 100644 DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcshareddata/DUREX Vendor Control.xccheckout create mode 100644 DUREX Vendor Control/Stack.h create mode 100644 DUREX Vendor Control/Stack.m create mode 100644 DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcshareddata/DUREX test.xccheckout create mode 100755 DUREX tests/icon_checkmark.png create mode 100755 DUREX tests/icon_delete.png diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj index 2415738..836819b 100644 --- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj +++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj @@ -25,6 +25,7 @@ F98356D8192E906600EA6821 /* bluetooth.png in Resources */ = {isa = PBXBuildFile; fileRef = F98356D7192E906600EA6821 /* bluetooth.png */; }; F98356DB192EAFD400EA6821 /* CommunicationProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = F98356DA192EAFD400EA6821 /* CommunicationProtocol.m */; }; F98356E1192EC84700EA6821 /* MenuTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F98356E0192EC84700EA6821 /* MenuTableViewController.m */; }; + F9A8EF7C192FE201009E7532 /* Stack.m in Sources */ = {isa = PBXBuildFile; fileRef = F9A8EF7B192FE201009E7532 /* Stack.m */; }; F9C77F4E192CDE18002DBE8A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F9C77F4C192CDE18002DBE8A /* InfoPlist.strings */; }; F9C77F50192CDE30002DBE8A /* durex.json in Resources */ = {isa = PBXBuildFile; fileRef = F9C77F4F192CDE30002DBE8A /* durex.json */; }; /* End PBXBuildFile section */ @@ -79,6 +80,8 @@ F98356DA192EAFD400EA6821 /* CommunicationProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommunicationProtocol.m; sourceTree = SOURCE_ROOT; }; F98356DF192EC84700EA6821 /* MenuTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuTableViewController.h; sourceTree = SOURCE_ROOT; }; F98356E0192EC84700EA6821 /* MenuTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuTableViewController.m; sourceTree = SOURCE_ROOT; }; + F9A8EF7A192FE201009E7532 /* Stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stack.h; sourceTree = SOURCE_ROOT; }; + F9A8EF7B192FE201009E7532 /* Stack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Stack.m; sourceTree = SOURCE_ROOT; }; F9C77F4D192CDE18002DBE8A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = FirstAppExample/en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; F9C77F4F192CDE30002DBE8A /* durex.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = durex.json; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -151,6 +154,8 @@ F98356E0192EC84700EA6821 /* MenuTableViewController.m */, F98356D9192EAFD400EA6821 /* CommunicationProtocol.h */, F98356DA192EAFD400EA6821 /* CommunicationProtocol.m */, + F9A8EF7A192FE201009E7532 /* Stack.h */, + F9A8EF7B192FE201009E7532 /* Stack.m */, 34AAB88C189805300019860D /* Images.xcassets */, 347186B91807290E00FA0FB2 /* Schemas */, 347186A718070F7F00FA0FB2 /* Device Picker */, @@ -322,6 +327,7 @@ buildActionMask = 2147483647; files = ( F98356D6192E835F00EA6821 /* InitialViewController.m in Sources */, + F9A8EF7C192FE201009E7532 /* Stack.m in Sources */, 34AAB885189804FF0019860D /* EMDevicePickerViewController.m in Sources */, 34AAB883189804FF0019860D /* DUREXAppDelegate.m in Sources */, F98356DB192EAFD400EA6821 /* CommunicationProtocol.m in Sources */, diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcshareddata/DUREX Vendor Control.xccheckout b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcshareddata/DUREX Vendor Control.xccheckout new file mode 100644 index 0000000..cde8688 --- /dev/null +++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcshareddata/DUREX Vendor Control.xccheckout @@ -0,0 +1,46 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 5E047851-FD9C-4741-AB1E-249FB7E14E28 + IDESourceControlProjectName + DUREX Vendor Control + IDESourceControlProjectOriginsDictionary + + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + svn://server/durex + + IDESourceControlProjectPath + DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + ../../.. + + IDESourceControlProjectRepositoryRootDictionary + + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + svn://server/durex + + IDESourceControlProjectURL + svn://server/durex/DUREX%20Vendor%20Control/DUREX%20Vendor%20Control.xcodeproj + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.subversion + IDESourceControlWCCIdentifierKey + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + IDESourceControlWCCName + durex + + + + diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate index f76115a..fabdbd0 100644 Binary files a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate and b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/DUREX Vendor Control/MenuTableViewController.h b/DUREX Vendor Control/MenuTableViewController.h index c2f969c..8f516e6 100644 --- a/DUREX Vendor Control/MenuTableViewController.h +++ b/DUREX Vendor Control/MenuTableViewController.h @@ -9,17 +9,15 @@ #import #import "EMFramework.h" #import "CommunicationProtocol.h" +#import "Stack.h" #define num(x) [NSNumber numberWithUnsignedInt:x] #define MENU_ELEMENTS @"Maintenance",@"Basic Configuration",@"Sending a Report" #define MENU_CELLS_PER_SECTION num(3) -#define MAINTENANCE_ELEMENTS @"General Status",@"Sensor Report" -#define MAINTENANCE_CELLS_PER_SECTION num(2) - -#define STATUS_ELEMENTS @"Time",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"CPP_TABLE",@"1€ Change",@"50c Change" -#define STATUS_CELLS_PER_SECTION num(10) +#define MAINTENANCE_ELEMENTS @"Time",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"CPP_TABLE",@"1€ Change",@"50c Change" +#define MAINTENANCE_CELLS_PER_SECTION num(10) #define CELL_IDENTIFIERS @"MenuCell",@"MaintenanceCell",@"ConfigCell",@"ReportCell" @@ -35,4 +33,6 @@ enum { @interface MenuTableViewController : UITableViewController +@property (strong,nonatomic) Stack *parentLayout; + @end diff --git a/DUREX Vendor Control/MenuTableViewController.m b/DUREX Vendor Control/MenuTableViewController.m index 1a08d23..32d90a6 100644 --- a/DUREX Vendor Control/MenuTableViewController.m +++ b/DUREX Vendor Control/MenuTableViewController.m @@ -19,9 +19,6 @@ @property (nonatomic,strong) const NSArray *maintenanceElements; @property (nonatomic,strong) const NSArray *maintenanceStructure; -@property (nonatomic,strong) const NSArray *statusElements; -@property (nonatomic,strong) const NSArray *statusStructure; - @property (nonatomic,strong) const NSArray *cellIdentifiers; @property (nonatomic,strong) CommunicationProtocol* protocol; @@ -52,14 +49,12 @@ [self setMaintenanceElements:[[NSArray alloc] initWithObjects:MAINTENANCE_ELEMENTS, nil]]; [self setMaintenanceStructure:[[NSArray alloc] initWithObjects:MAINTENANCE_CELLS_PER_SECTION, nil]]; - [self setStatusElements:[[NSArray alloc] initWithObjects:STATUS_ELEMENTS, nil]]; - [self setStatusStructure:[[NSArray alloc] initWithObjects:STATUS_CELLS_PER_SECTION, nil]]; - [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]]; } - (void) changeNavLevel: (uint8_t) level { + [[self parentLayout] push: [NSNumber numberWithUnsignedChar:level]]; [self setCurrentNavLevel:level]; [self setCurrentCellIdentifier:[[self cellIdentifiers] objectAtIndex:[self currentNavLevel]]]; if([self currentNavLevel] == MAINTENANCE) @@ -67,11 +62,6 @@ [self setCurrentElements:[self maintenanceElements]]; [self setCurrentStructure:[self maintenanceStructure]]; } - else if([self currentNavLevel] == STATUS) - { - [self setCurrentElements:[self statusElements]]; - [self setCurrentStructure:[self statusStructure]]; - } //AND SO ON... else { @@ -111,6 +101,9 @@ [[self navigationController] popToViewController:previous animated:YES]; } + //Initialize parentLayout stack + [self setParentLayout:[[Stack alloc]init]]; + //Set navigation level [self initializeMenuEntries]; [self changeNavLevel:MENU]; @@ -176,10 +169,6 @@ { [self changeNavLevel:MAINTENANCE]; } - else if([cellName isEqualToString:@"General Status"]) - { - [self changeNavLevel:STATUS]; - } } #pragma mark - Table view data source diff --git a/DUREX Vendor Control/Stack.h b/DUREX Vendor Control/Stack.h new file mode 100644 index 0000000..c0cbe1a --- /dev/null +++ b/DUREX Vendor Control/Stack.h @@ -0,0 +1,19 @@ +// +// Stack.h +// DUREX test +// +// Created by Imanol Barba on 5/23/14. +// Copyright (c) 2014 Emmoco. All rights reserved. +// + +#import + +@interface Stack : NSObject + +- (id) init; +- (void) push: (id) element; +- (id) pop; +- (NSInteger) count; +- (void) clear; + +@end diff --git a/DUREX Vendor Control/Stack.m b/DUREX Vendor Control/Stack.m new file mode 100644 index 0000000..1a635be --- /dev/null +++ b/DUREX Vendor Control/Stack.m @@ -0,0 +1,48 @@ +// +// Stack.m +// DUREX test +// +// Created by Imanol Barba on 5/23/14. +// Copyright (c) 2014 Emmoco. All rights reserved.retur +// + +#import "Stack.h" + +@interface Stack () + +@property (strong,nonatomic) NSMutableArray *dataArray; +@property (nonatomic) NSUInteger lastPosition; +@end + +@implementation Stack + +- (id) init +{ + self = [super init]; + [self setLastPosition: 0]; + [self setDataArray:[[NSMutableArray alloc] init]]; + return self; +} + +- (void) push: (id) element +{ + [[self dataArray] addObject:element]; + printf("%d elements in array\n",[self count]); +} +- (id) pop +{ + id element; + element = [[self dataArray] objectAtIndex:[self lastPosition]]; + [[self dataArray] removeLastObject]; + return element; +} +- (NSInteger) count +{ + return [[self dataArray] count]; +} +- (void) clear +{ + +} + +@end diff --git a/DUREX tests/DUREX test.xcodeproj/project.pbxproj b/DUREX tests/DUREX test.xcodeproj/project.pbxproj index 7a2f091..b605964 100644 --- a/DUREX tests/DUREX test.xcodeproj/project.pbxproj +++ b/DUREX tests/DUREX test.xcodeproj/project.pbxproj @@ -19,6 +19,8 @@ 34AAB889189804FF0019860D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 34AAB880189804FF0019860D /* main.m */; }; 34AAB88A189804FF0019860D /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 34AAB881189804FF0019860D /* MainStoryboard.storyboard */; }; 34AAB88D189805300019860D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 34AAB88C189805300019860D /* Images.xcassets */; }; + F9469169193015EE006DACD3 /* icon_checkmark.png in Resources */ = {isa = PBXBuildFile; fileRef = F9469167193015EE006DACD3 /* icon_checkmark.png */; }; + F946916A193015EE006DACD3 /* icon_delete.png in Resources */ = {isa = PBXBuildFile; fileRef = F9469168193015EE006DACD3 /* icon_delete.png */; }; F962A233192FCA8A00E4324A /* Stack.m in Sources */ = {isa = PBXBuildFile; fileRef = F962A232192FCA8A00E4324A /* Stack.m */; }; F98356D6192E835F00EA6821 /* InitialViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F98356D5192E835F00EA6821 /* InitialViewController.m */; }; F98356D8192E906600EA6821 /* bluetooth.png in Resources */ = {isa = PBXBuildFile; fileRef = F98356D7192E906600EA6821 /* bluetooth.png */; }; @@ -55,6 +57,8 @@ 34AAB880189804FF0019860D /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = FirstAppExample/main.m; sourceTree = SOURCE_ROOT; }; 34AAB881189804FF0019860D /* MainStoryboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = MainStoryboard.storyboard; path = FirstAppExample/MainStoryboard.storyboard; sourceTree = SOURCE_ROOT; }; 34AAB88C189805300019860D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = FirstAppExample/Images.xcassets; sourceTree = SOURCE_ROOT; }; + F9469167193015EE006DACD3 /* icon_checkmark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_checkmark.png; sourceTree = SOURCE_ROOT; }; + F9469168193015EE006DACD3 /* icon_delete.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_delete.png; sourceTree = SOURCE_ROOT; }; F962A231192FCA8A00E4324A /* Stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stack.h; sourceTree = SOURCE_ROOT; }; F962A232192FCA8A00E4324A /* Stack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Stack.m; sourceTree = SOURCE_ROOT; }; F98356D4192E835F00EA6821 /* InitialViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitialViewController.h; sourceTree = SOURCE_ROOT; }; @@ -150,6 +154,8 @@ 3471866718070D9300FA0FB2 /* Supporting Files */ = { isa = PBXGroup; children = ( + F9469167193015EE006DACD3 /* icon_checkmark.png */, + F9469168193015EE006DACD3 /* icon_delete.png */, F98356D7192E906600EA6821 /* bluetooth.png */, 34AAB87E189804FF0019860D /* DUREX test-Info.plist */, 34AAB87F189804FF0019860D /* DUREX test-Prefix.pch */, @@ -263,6 +269,8 @@ F9C77F50192CDE30002DBE8A /* durex.json in Resources */, F9C77F4E192CDE18002DBE8A /* InfoPlist.strings in Resources */, 34AAB88D189805300019860D /* Images.xcassets in Resources */, + F9469169193015EE006DACD3 /* icon_checkmark.png in Resources */, + F946916A193015EE006DACD3 /* icon_delete.png in Resources */, 34AAB88A189804FF0019860D /* MainStoryboard.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -401,6 +409,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "FirstAppExample/DUREX test-Prefix.pch"; INFOPLIST_FILE = "FirstAppExample/DUREX test-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", EmmocoMobileFramework/Framework, @@ -420,6 +429,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "FirstAppExample/DUREX test-Prefix.pch"; INFOPLIST_FILE = "FirstAppExample/DUREX test-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", EmmocoMobileFramework/Framework, diff --git a/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcshareddata/DUREX test.xccheckout b/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcshareddata/DUREX test.xccheckout new file mode 100644 index 0000000..d87e6fe --- /dev/null +++ b/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcshareddata/DUREX test.xccheckout @@ -0,0 +1,46 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 3DEF8FD7-874A-4291-AEBE-9A5EDB5EDFFF + IDESourceControlProjectName + DUREX test + IDESourceControlProjectOriginsDictionary + + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + svn://server/durex + + IDESourceControlProjectPath + DUREX tests/DUREX test.xcodeproj/project.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + ../../.. + + IDESourceControlProjectRepositoryRootDictionary + + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + svn://server/durex + + IDESourceControlProjectURL + svn://server/durex/DUREX%20tests/DUREX%20test.xcodeproj + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.subversion + IDESourceControlWCCIdentifierKey + 910DC6DA-E12E-46D3-A774-09A58FE8ED66 + IDESourceControlWCCName + durex + + + + diff --git a/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate b/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate index a28132b..5c1d6a5 100644 Binary files a/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate and b/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/DUREX tests/FirstAppExample/EMDevicePickerViewController.m b/DUREX tests/FirstAppExample/EMDevicePickerViewController.m index 8cdb75d..280892f 100644 --- a/DUREX tests/FirstAppExample/EMDevicePickerViewController.m +++ b/DUREX tests/FirstAppExample/EMDevicePickerViewController.m @@ -78,7 +78,7 @@ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DeviceCell"]; } - [[cell textLabel] setText:@"FUCKING PIECE OF CRAP 2000 PRO ULTRA"]; + [[cell textLabel] setText:@"PIECE OF CRAP 2000 PRO ULTRA"]; [[cell detailTextLabel] setText:@"FUCKING ONLINE"]; return cell; } diff --git a/DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/120 - App Icon@2x.png b/DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/120 - App Icon@2x.png index db853cc..b5432fd 100644 Binary files a/DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/120 - App Icon@2x.png and b/DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/120 - App Icon@2x.png differ diff --git a/DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/40 - App Icon@2x.png b/DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/40 - App Icon@2x.png index 6444f2f..bfa02d9 100644 Binary files a/DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/40 - App Icon@2x.png and b/DUREX tests/FirstAppExample/Images.xcassets/AppIcon.appiconset/40 - App Icon@2x.png differ diff --git a/DUREX tests/FirstAppExample/MainStoryboard.storyboard b/DUREX tests/FirstAppExample/MainStoryboard.storyboard index b241ecc..2fa13e4 100644 --- a/DUREX tests/FirstAppExample/MainStoryboard.storyboard +++ b/DUREX tests/FirstAppExample/MainStoryboard.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -78,32 +79,15 @@ - + - + - - - - - - - - - - - + \ No newline at end of file diff --git a/DUREX tests/MenuTableViewController.h b/DUREX tests/MenuTableViewController.h index aaa44ba..8608f28 100644 --- a/DUREX tests/MenuTableViewController.h +++ b/DUREX tests/MenuTableViewController.h @@ -8,32 +8,31 @@ #import #import "CommunicationProtocol.h" +#import "Stack.h" #define num(x) [NSNumber numberWithUnsignedInt:x] #define MENU_ELEMENTS @"Maintenance",@"Basic Configuration",@"Sending a Report" #define MENU_CELLS_PER_SECTION num(3) +#define MENU_HEADERS nil -#define MAINTENANCE_ELEMENTS @"General Status",@"Sensor Report" -#define MAINTENANCE_CELLS_PER_SECTION num(2) +#define MAINTENANCE_ELEMENTS @"Time",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"CPP_TABLE",@"1€ Change",@"50c Change" +#define MAINTENANCE_CELLS_PER_SECTION num(10),num(0) +#define MAINTENANCE_HEADERS @"Status",@"Sensors" -#define STATUS_ELEMENTS @"Time",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"CPP_TABLE",@"1€ Change",@"50c Change" -#define STATUS_CELLS_PER_SECTION num(10) - -#define CELL_IDENTIFIERS @"MenuCell",@"MaintenanceCell",@"StatusCell",@"ConfigCell",@"ReportCell" +#define CELL_IDENTIFIERS @"MenuCell",@"MaintenanceCell",@"ConfigCell",@"ReportCell" #define NUM_CHANNELS 8 enum { MENU = 0, MAINTENANCE, - STATUS, BASIC_CONFIGURATION, REPORT, } navigationLevel; @interface MenuTableViewController : UITableViewController -@property (strong,nonatomic) Stack parentLayout; +@property (strong,nonatomic) Stack *parentLayout; @end diff --git a/DUREX tests/MenuTableViewController.m b/DUREX tests/MenuTableViewController.m index b64baf3..d4b84de 100644 --- a/DUREX tests/MenuTableViewController.m +++ b/DUREX tests/MenuTableViewController.m @@ -15,12 +15,11 @@ } @property (nonatomic,strong) const NSArray *menuElements; @property (nonatomic,strong) const NSArray *menuStructure; +@property (nonatomic,strong) const NSArray *menuHeaders; @property (nonatomic,strong) const NSArray *maintenanceElements; @property (nonatomic,strong) const NSArray *maintenanceStructure; - -@property (nonatomic,strong) const NSArray *statusElements; -@property (nonatomic,strong) const NSArray *statusStructure; +@property (nonatomic,strong) const NSArray *maintenanceHeaders; @property (nonatomic,strong) const NSArray *cellIdentifiers; @@ -28,7 +27,8 @@ @property uint8_t currentNavLevel; @property NSString *currentCellIdentifier; @property const NSArray *currentElements; -@property const NSArray *currentStructure; +@property const NSArray *currentStructure; +@property const NSArray *currentHeaders; @end @@ -48,40 +48,62 @@ { [self setMenuElements:[[NSArray alloc] initWithObjects:MENU_ELEMENTS, nil]]; [self setMenuStructure:[[NSArray alloc] initWithObjects:MENU_CELLS_PER_SECTION, nil]]; + if([[self menuStructure] count] > 1) + { + [self setMenuHeaders:[[NSArray alloc] initWithObjects:MENU_HEADERS, nil]]; + } + else + { + [self setMenuHeaders:nil]; + } [self setMaintenanceElements:[[NSArray alloc] initWithObjects:MAINTENANCE_ELEMENTS, nil]]; [self setMaintenanceStructure:[[NSArray alloc] initWithObjects:MAINTENANCE_CELLS_PER_SECTION, nil]]; - - [self setStatusElements:[[NSArray alloc] initWithObjects:STATUS_ELEMENTS, nil]]; - [self setStatusStructure:[[NSArray alloc] initWithObjects:STATUS_CELLS_PER_SECTION, nil]]; + if([[self maintenanceStructure] count] > 1) + { + [self setMaintenanceHeaders:[[NSArray alloc] initWithObjects:MAINTENANCE_HEADERS, nil]]; + } + else + { + [self setMaintenanceHeaders:nil]; + } [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]]; } - (void) changeNavLevel: (uint8_t) level { + [[self parentLayout] push: [NSNumber numberWithUnsignedChar:level]]; [self setCurrentNavLevel:level]; [self setCurrentCellIdentifier:[[self cellIdentifiers] objectAtIndex:[self currentNavLevel]]]; if([self currentNavLevel] == MAINTENANCE) { [self setCurrentElements:[self maintenanceElements]]; [self setCurrentStructure:[self maintenanceStructure]]; - } - else if([self currentNavLevel] == STATUS) - { - [self setCurrentElements:[self statusElements]]; - [self setCurrentStructure:[self statusStructure]]; + [self setCurrentHeaders:[self maintenanceHeaders]]; } //AND SO ON... else { [self setCurrentElements:[self menuElements]]; [self setCurrentStructure:[self menuStructure]]; + [self setCurrentHeaders:[self menuHeaders]]; } + [[self tableView] reloadData]; NSRange range = NSMakeRange(0, [self numberOfSectionsInTableView:[self tableView]]); NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; [[self tableView] reloadSections:sections withRowAnimation:UITableViewRowAnimationAutomatic]; } + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + NSString *title = @""; + if([self currentHeaders] != nil) + { + title = [[self currentHeaders] objectAtIndex:section]; + } + return title; +} - (void)viewDidLoad { @@ -101,6 +123,9 @@ [[self navigationController] popToViewController:previous animated:YES]; } + //Initialize parentLayout stack + [self setParentLayout:[[Stack alloc]init]]; + //Set navigation level [self initializeMenuEntries]; [self changeNavLevel:MENU]; @@ -137,16 +162,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSLog(@"Section: %d Row: %d",[indexPath section],[indexPath row]); [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSString *cellName = [[[[self tableView] cellForRowAtIndexPath:indexPath]textLabel]text]; if([cellName isEqualToString:@"Maintenance"]) { [self changeNavLevel:MAINTENANCE]; } - else if([cellName isEqualToString:@"General Status"]) - { - [self changeNavLevel:STATUS]; - } } @@ -169,10 +191,34 @@ if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[self currentCellIdentifier]]; + if([self currentNavLevel] == MAINTENANCE) + { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:[self currentCellIdentifier]]; + } + else + { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[self currentCellIdentifier]]; + } + } + uint8_t offset = 0; + if([indexPath section] ) + { + for (int i = 0; i < [indexPath section]; i++) + { + offset += [[[self currentStructure] objectAtIndex:i] unsignedCharValue]; + } + } + [[cell textLabel] setText:[[self currentElements] objectAtIndex:[indexPath row]+offset]]; + if([self currentNavLevel] == MAINTENANCE) + { + [[cell detailTextLabel] setText:@"VALUE"]; + [cell setAccessoryView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_checkmark"]]]; + if( [[[cell textLabel] text] isEqualToString:@"5€ Notes"]) + { + [cell setAccessoryView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_delete"]]]; + } } - [[cell textLabel] setText:[[self currentElements] objectAtIndex:indexPath.row]]; return cell; } diff --git a/DUREX tests/Stack.h b/DUREX tests/Stack.h index 79f038c..c0cbe1a 100644 --- a/DUREX tests/Stack.h +++ b/DUREX tests/Stack.h @@ -10,6 +10,7 @@ @interface Stack : NSObject +- (id) init; - (void) push: (id) element; - (id) pop; - (NSInteger) count; diff --git a/DUREX tests/Stack.m b/DUREX tests/Stack.m index c4e3bd3..1a635be 100644 --- a/DUREX tests/Stack.m +++ b/DUREX tests/Stack.m @@ -11,19 +11,30 @@ @interface Stack () @property (strong,nonatomic) NSMutableArray *dataArray; -@property (strong,nonatomic) NSIndex *lastPosition; +@property (nonatomic) NSUInteger lastPosition; @end @implementation Stack +- (id) init +{ + self = [super init]; + [self setLastPosition: 0]; + [self setDataArray:[[NSMutableArray alloc] init]]; + return self; +} + - (void) push: (id) element { [[self dataArray] addObject:element]; + printf("%d elements in array\n",[self count]); } - (id) pop { - [[self dataArray] obj] + id element; + element = [[self dataArray] objectAtIndex:[self lastPosition]]; [[self dataArray] removeLastObject]; + return element; } - (NSInteger) count { diff --git a/DUREX tests/icon_checkmark.png b/DUREX tests/icon_checkmark.png new file mode 100755 index 0000000..05f9c40 Binary files /dev/null and b/DUREX tests/icon_checkmark.png differ diff --git a/DUREX tests/icon_delete.png b/DUREX tests/icon_delete.png new file mode 100755 index 0000000..3ea51f4 Binary files /dev/null and b/DUREX tests/icon_delete.png differ -- libgit2 0.22.2