Kaydet (Commit) a5f6c185 authored tarafından siqi's avatar siqi

accelormeter implemented but doesn't work well...

Change-Id: Ia5f2c1e706b21914ff483378e1bf8ffbdeb5eed6
üst 77826a48
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
57C6E3F7175E06E800E8BC5F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57C6E3F6175E06E800E8BC5F /* CoreGraphics.framework */; }; 57C6E3F7175E06E800E8BC5F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57C6E3F6175E06E800E8BC5F /* CoreGraphics.framework */; };
57C6E3FD175E06E800E8BC5F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E3FB175E06E800E8BC5F /* InfoPlist.strings */; }; 57C6E3FD175E06E800E8BC5F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E3FB175E06E800E8BC5F /* InfoPlist.strings */; };
57C6E3FF175E06E800E8BC5F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 57C6E3FE175E06E800E8BC5F /* main.m */; }; 57C6E3FF175E06E800E8BC5F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 57C6E3FE175E06E800E8BC5F /* main.m */; };
57C6E403175E06E800E8BC5F /* libreoffice_sdremoteAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 57C6E402175E06E800E8BC5F /* libreoffice_sdremoteAppDelegate.m */; }; 57C6E403175E06E800E8BC5F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 57C6E402175E06E800E8BC5F /* AppDelegate.m */; };
57C6E405175E06E800E8BC5F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E404175E06E800E8BC5F /* Default.png */; }; 57C6E405175E06E800E8BC5F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E404175E06E800E8BC5F /* Default.png */; };
57C6E407175E06E800E8BC5F /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E406175E06E800E8BC5F /* Default@2x.png */; }; 57C6E407175E06E800E8BC5F /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E406175E06E800E8BC5F /* Default@2x.png */; };
57C6E409175E06E800E8BC5F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E408175E06E800E8BC5F /* Default-568h@2x.png */; }; 57C6E409175E06E800E8BC5F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 57C6E408175E06E800E8BC5F /* Default-568h@2x.png */; };
...@@ -44,6 +44,11 @@ ...@@ -44,6 +44,11 @@
57CC48C6178B42A400075DE4 /* timer_pause_btn.png in Resources */ = {isa = PBXBuildFile; fileRef = 57CC48C4178B42A400075DE4 /* timer_pause_btn.png */; }; 57CC48C6178B42A400075DE4 /* timer_pause_btn.png in Resources */ = {isa = PBXBuildFile; fileRef = 57CC48C4178B42A400075DE4 /* timer_pause_btn.png */; };
57CC48C7178B42A400075DE4 /* timer_resume_btn.png in Resources */ = {isa = PBXBuildFile; fileRef = 57CC48C5178B42A400075DE4 /* timer_resume_btn.png */; }; 57CC48C7178B42A400075DE4 /* timer_resume_btn.png in Resources */ = {isa = PBXBuildFile; fileRef = 57CC48C5178B42A400075DE4 /* timer_resume_btn.png */; };
57CFED9917838FDC00E82E05 /* EditableTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 57CFED9817838FDC00E82E05 /* EditableTableViewCell.m */; }; 57CFED9917838FDC00E82E05 /* EditableTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 57CFED9817838FDC00E82E05 /* EditableTableViewCell.m */; };
57DC7003178D82610050FC58 /* ic_launcher.png in Resources */ = {isa = PBXBuildFile; fileRef = 57DC7002178D82610050FC58 /* ic_launcher.png */; };
57DC7005178D82940050FC58 /* ic_launcher@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 57DC7004178D82940050FC58 /* ic_launcher@2x.png */; };
57DC7007178D84490050FC58 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57DC7006178D84490050FC58 /* CoreMotion.framework */; };
57DC700F178E03330050FC58 /* touchPointer_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57DC700E178E03330050FC58 /* touchPointer_vc.m */; };
57DC7012178E16A40050FC58 /* setRecursiveUserInteraction.m in Sources */ = {isa = PBXBuildFile; fileRef = 57DC7011178E16A40050FC58 /* setRecursiveUserInteraction.m */; };
57FE71E31785C61400B50125 /* pinValidation_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E21785C61400B50125 /* pinValidation_vc.m */; }; 57FE71E31785C61400B50125 /* pinValidation_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E21785C61400B50125 /* pinValidation_vc.m */; };
57FE71E61785D7FE00B50125 /* slideShowPreview_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E51785D7FE00B50125 /* slideShowPreview_vc.m */; }; 57FE71E61785D7FE00B50125 /* slideShowPreview_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E51785D7FE00B50125 /* slideShowPreview_vc.m */; };
57FE71E917861A9000B50125 /* slideShowPreviewTable_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E817861A9000B50125 /* slideShowPreviewTable_vc.m */; }; 57FE71E917861A9000B50125 /* slideShowPreviewTable_vc.m in Sources */ = {isa = PBXBuildFile; fileRef = 57FE71E817861A9000B50125 /* slideShowPreviewTable_vc.m */; };
...@@ -88,8 +93,8 @@ ...@@ -88,8 +93,8 @@
57C6E3FC175E06E800E8BC5F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 57C6E3FC175E06E800E8BC5F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
57C6E3FE175E06E800E8BC5F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 57C6E3FE175E06E800E8BC5F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
57C6E400175E06E800E8BC5F /* iosremote-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iosremote-Prefix.pch"; sourceTree = "<group>"; }; 57C6E400175E06E800E8BC5F /* iosremote-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iosremote-Prefix.pch"; sourceTree = "<group>"; };
57C6E401175E06E800E8BC5F /* libreoffice_sdremoteAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libreoffice_sdremoteAppDelegate.h; sourceTree = "<group>"; }; 57C6E401175E06E800E8BC5F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
57C6E402175E06E800E8BC5F /* libreoffice_sdremoteAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = libreoffice_sdremoteAppDelegate.m; sourceTree = "<group>"; }; 57C6E402175E06E800E8BC5F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
57C6E404175E06E800E8BC5F /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; }; 57C6E404175E06E800E8BC5F /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
57C6E406175E06E800E8BC5F /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; }; 57C6E406175E06E800E8BC5F /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
57C6E408175E06E800E8BC5F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; }; 57C6E408175E06E800E8BC5F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
...@@ -106,6 +111,13 @@ ...@@ -106,6 +111,13 @@
57CC48C5178B42A400075DE4 /* timer_resume_btn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = timer_resume_btn.png; path = iosremote/timer_resume_btn.png; sourceTree = "<group>"; }; 57CC48C5178B42A400075DE4 /* timer_resume_btn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = timer_resume_btn.png; path = iosremote/timer_resume_btn.png; sourceTree = "<group>"; };
57CFED9717838FDC00E82E05 /* EditableTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditableTableViewCell.h; sourceTree = "<group>"; }; 57CFED9717838FDC00E82E05 /* EditableTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditableTableViewCell.h; sourceTree = "<group>"; };
57CFED9817838FDC00E82E05 /* EditableTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditableTableViewCell.m; sourceTree = "<group>"; }; 57CFED9817838FDC00E82E05 /* EditableTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditableTableViewCell.m; sourceTree = "<group>"; };
57DC7002178D82610050FC58 /* ic_launcher.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_launcher.png; sourceTree = "<group>"; };
57DC7004178D82940050FC58 /* ic_launcher@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ic_launcher@2x.png"; sourceTree = "<group>"; };
57DC7006178D84490050FC58 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
57DC700D178E03330050FC58 /* touchPointer_vc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = touchPointer_vc.h; sourceTree = "<group>"; };
57DC700E178E03330050FC58 /* touchPointer_vc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = touchPointer_vc.m; sourceTree = "<group>"; };
57DC7010178E16A40050FC58 /* setRecursiveUserInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setRecursiveUserInteraction.h; sourceTree = "<group>"; };
57DC7011178E16A40050FC58 /* setRecursiveUserInteraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = setRecursiveUserInteraction.m; sourceTree = "<group>"; };
57FE71E11785C61300B50125 /* pinValidation_vc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pinValidation_vc.h; path = Communication/pinValidation_vc.h; sourceTree = "<group>"; }; 57FE71E11785C61300B50125 /* pinValidation_vc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pinValidation_vc.h; path = Communication/pinValidation_vc.h; sourceTree = "<group>"; };
57FE71E21785C61400B50125 /* pinValidation_vc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = pinValidation_vc.m; path = Communication/pinValidation_vc.m; sourceTree = "<group>"; }; 57FE71E21785C61400B50125 /* pinValidation_vc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = pinValidation_vc.m; path = Communication/pinValidation_vc.m; sourceTree = "<group>"; };
57FE71E41785D7FE00B50125 /* slideShowPreview_vc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slideShowPreview_vc.h; sourceTree = "<group>"; }; 57FE71E41785D7FE00B50125 /* slideShowPreview_vc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slideShowPreview_vc.h; sourceTree = "<group>"; };
...@@ -120,6 +132,7 @@ ...@@ -120,6 +132,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
57DC7007178D84490050FC58 /* CoreMotion.framework in Frameworks */,
BE9EBD071765BF0800283FD2 /* CoreImage.framework in Frameworks */, BE9EBD071765BF0800283FD2 /* CoreImage.framework in Frameworks */,
57C6E3F3175E06E800E8BC5F /* UIKit.framework in Frameworks */, 57C6E3F3175E06E800E8BC5F /* UIKit.framework in Frameworks */,
57C6E3F5175E06E800E8BC5F /* Foundation.framework in Frameworks */, 57C6E3F5175E06E800E8BC5F /* Foundation.framework in Frameworks */,
...@@ -139,6 +152,10 @@ ...@@ -139,6 +152,10 @@
5770173E178B08A800B99793 /* SWReavealMainController.m */, 5770173E178B08A800B99793 /* SWReavealMainController.m */,
57701740178B0A6800B99793 /* slideShowSwipeInList.h */, 57701740178B0A6800B99793 /* slideShowSwipeInList.h */,
57701741178B0A6900B99793 /* slideShowSwipeInList.m */, 57701741178B0A6900B99793 /* slideShowSwipeInList.m */,
57DC700D178E03330050FC58 /* touchPointer_vc.h */,
57DC700E178E03330050FC58 /* touchPointer_vc.m */,
57DC7010178E16A40050FC58 /* setRecursiveUserInteraction.h */,
57DC7011178E16A40050FC58 /* setRecursiveUserInteraction.m */,
); );
name = slideShow; name = slideShow;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -186,6 +203,9 @@ ...@@ -186,6 +203,9 @@
57C6E3E6175E06E800E8BC5F = { 57C6E3E6175E06E800E8BC5F = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
57DC7006178D84490050FC58 /* CoreMotion.framework */,
57DC7004178D82940050FC58 /* ic_launcher@2x.png */,
57DC7002178D82610050FC58 /* ic_launcher.png */,
57AEEDAA1788D7B2007F4F97 /* Assets */, 57AEEDAA1788D7B2007F4F97 /* Assets */,
BE9EBD061765BF0800283FD2 /* CoreImage.framework */, BE9EBD061765BF0800283FD2 /* CoreImage.framework */,
57C6E425175E076900E8BC5F /* Communication */, 57C6E425175E076900E8BC5F /* Communication */,
...@@ -221,8 +241,8 @@ ...@@ -221,8 +241,8 @@
57FE71E11785C61300B50125 /* pinValidation_vc.h */, 57FE71E11785C61300B50125 /* pinValidation_vc.h */,
57FE71E21785C61400B50125 /* pinValidation_vc.m */, 57FE71E21785C61400B50125 /* pinValidation_vc.m */,
57AEEDAB1789443D007F4F97 /* slideShowPreview */, 57AEEDAB1789443D007F4F97 /* slideShowPreview */,
57C6E401175E06E800E8BC5F /* libreoffice_sdremoteAppDelegate.h */, 57C6E401175E06E800E8BC5F /* AppDelegate.h */,
57C6E402175E06E800E8BC5F /* libreoffice_sdremoteAppDelegate.m */, 57C6E402175E06E800E8BC5F /* AppDelegate.m */,
571BFAD2178AB7BA00EF1BDB /* slideShow */, 571BFAD2178AB7BA00EF1BDB /* slideShow */,
5753DD9717834D7100DB71BB /* newServer_vc.h */, 5753DD9717834D7100DB71BB /* newServer_vc.h */,
5753DD9817834D7100DB71BB /* newServer_vc.m */, 5753DD9817834D7100DB71BB /* newServer_vc.m */,
...@@ -341,6 +361,8 @@ ...@@ -341,6 +361,8 @@
571D4808178B2F080063D93B /* timer_start_btn.png in Resources */, 571D4808178B2F080063D93B /* timer_start_btn.png in Resources */,
57CC48C6178B42A400075DE4 /* timer_pause_btn.png in Resources */, 57CC48C6178B42A400075DE4 /* timer_pause_btn.png in Resources */,
57CC48C7178B42A400075DE4 /* timer_resume_btn.png in Resources */, 57CC48C7178B42A400075DE4 /* timer_resume_btn.png in Resources */,
57DC7003178D82610050FC58 /* ic_launcher.png in Resources */,
57DC7005178D82940050FC58 /* ic_launcher@2x.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -352,7 +374,7 @@ ...@@ -352,7 +374,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
57C6E3FF175E06E800E8BC5F /* main.m in Sources */, 57C6E3FF175E06E800E8BC5F /* main.m in Sources */,
57C6E403175E06E800E8BC5F /* libreoffice_sdremoteAppDelegate.m in Sources */, 57C6E403175E06E800E8BC5F /* AppDelegate.m in Sources */,
57C6E42E175E076900E8BC5F /* Client.m in Sources */, 57C6E42E175E076900E8BC5F /* Client.m in Sources */,
57C6E42F175E076900E8BC5F /* CommunicationManager.m in Sources */, 57C6E42F175E076900E8BC5F /* CommunicationManager.m in Sources */,
57C6E430175E076900E8BC5F /* CommandInterpreter.m in Sources */, 57C6E430175E076900E8BC5F /* CommandInterpreter.m in Sources */,
...@@ -370,6 +392,8 @@ ...@@ -370,6 +392,8 @@
57701739178AC83E00B99793 /* SWRevealViewController.m in Sources */, 57701739178AC83E00B99793 /* SWRevealViewController.m in Sources */,
5770173F178B08A800B99793 /* SWReavealMainController.m in Sources */, 5770173F178B08A800B99793 /* SWReavealMainController.m in Sources */,
57701742178B0A6900B99793 /* slideShowSwipeInList.m in Sources */, 57701742178B0A6900B99793 /* slideShowSwipeInList.m in Sources */,
57DC700F178E03330050FC58 /* touchPointer_vc.m in Sources */,
57DC7012178E16A40050FC58 /* setRecursiveUserInteraction.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
...@@ -7,9 +7,16 @@ ...@@ -7,9 +7,16 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <CoreMotion/CoreMotion.h>
@interface libreoffice_sdremoteAppDelegate : UIResponder <UIApplicationDelegate> @class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate> {
CMMotionManager *motionManager;
}
@property (readonly) CMMotionManager *motionManager;
@property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@end @end
...@@ -6,16 +6,22 @@ ...@@ -6,16 +6,22 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#import "libreoffice_sdremoteAppDelegate.h" #import "AppDelegate.h"
@implementation libreoffice_sdremoteAppDelegate @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ {
// Override point for customization after application launch. // Override point for customization after application launch.
return YES; return YES;
} }
- (CMMotionManager *)motionManager
{
if (!motionManager) motionManager = [[CMMotionManager alloc] init];
return motionManager;
}
- (void)applicationWillResignActive:(UIApplication *)application - (void)applicationWillResignActive:(UIApplication *)application
{ {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
......
...@@ -195,7 +195,7 @@ int count = 0; ...@@ -195,7 +195,7 @@ int count = 0;
} }
} }
} }
NSLog(@"Command:%@", str); // NSLog(@"Command:%@", str);
NSArray *commands = [str componentsSeparatedByString:@"\n"]; NSArray *commands = [str componentsSeparatedByString:@"\n"];
[self.receiver parse:commands]; [self.receiver parse:commands];
data = nil; data = nil;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
@interface CommandInterpreter : NSObject @interface CommandInterpreter : NSObject
@property (nonatomic, strong) SlideShow* slideShow; @property (atomic, strong) SlideShow* slideShow;
- (void) parse:(NSArray *)cmd; - (void) parse:(NSArray *)cmd;
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
@synthesize slideShow = _slideShow; @synthesize slideShow = _slideShow;
dispatch_queue_t backgroundQueue;
- (CommandInterpreter *) init - (CommandInterpreter *) init
{ {
self = [super init]; self = [super init];
...@@ -45,7 +47,7 @@ ...@@ -45,7 +47,7 @@
marker = 2; marker = 2;
} }
else if ([instruction isEqualToString:STATUS_PAIRING_PAIRED]){ else if ([instruction isEqualToString:STATUS_PAIRING_PAIRED]){
NSLog(@"Paired command: %@", command); // NSLog(@"Paired command: %@", command);
[[NSNotificationCenter defaultCenter] postNotificationName:STATUS_PAIRING_PAIRED [[NSNotificationCenter defaultCenter] postNotificationName:STATUS_PAIRING_PAIRED
object:nil]; object:nil];
marker = 2; marker = 2;
...@@ -77,14 +79,17 @@ ...@@ -77,14 +79,17 @@
marker = 3; marker = 3;
} else if ([instruction isEqualToString:@"slide_preview"]){ } else if ([instruction isEqualToString:@"slide_preview"]){
NSLog(@"Interpreter: slide_preview"); NSLog(@"Interpreter: slide_preview");
uint slideNumber = [[command objectAtIndex:1] integerValue]; backgroundQueue = dispatch_queue_create("com.libreoffice.iosremote", NULL);
NSString * imageData = [command objectAtIndex:2]; dispatch_async(backgroundQueue, ^(void) {
[self.slideShow putImage:imageData uint slideNumber = [[command objectAtIndex:1] integerValue];
AtIndex:slideNumber]; NSString * imageData = [command objectAtIndex:2];
[[NSNotificationCenter defaultCenter] postNotificationName:MSG_SLIDE_PREVIEW object:[NSNumber numberWithUnsignedInt:slideNumber]]; [self.slideShow putImage:imageData
AtIndex:slideNumber];
});
marker = 4; marker = 4;
} else if ([instruction isEqualToString:@"slide_notes"]){ } else if ([instruction isEqualToString:@"slide_notes"]){
NSLog(@"Interpreter: slide_notes"); NSLog(@"Interpreter: slide_notes");
backgroundQueue = dispatch_queue_create("com.libreoffice.iosremote", NULL);
uint slideNumber = [[command objectAtIndex:1] integerValue]; uint slideNumber = [[command objectAtIndex:1] integerValue];
NSMutableString *notes = [[NSMutableString alloc] init]; NSMutableString *notes = [[NSMutableString alloc] init];
for (int i = 2; i<command.count; ++i) { for (int i = 2; i<command.count; ++i) {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
@synthesize secondaryDelegate = _secondaryDelegate; @synthesize secondaryDelegate = _secondaryDelegate;
dispatch_queue_t backgroundQueue; dispatch_queue_t backgroundQueue;
NSLock *dictLock;
- (SlideShow *) init{ - (SlideShow *) init{
self = [super init]; self = [super init];
...@@ -56,6 +57,7 @@ dispatch_queue_t backgroundQueue; ...@@ -56,6 +57,7 @@ dispatch_queue_t backgroundQueue;
object:nil object:nil
queue:mainQueue queue:mainQueue
usingBlock:^(NSNotification *note) { usingBlock:^(NSNotification *note) {
dispatch_async(backgroundQueue, ^(void) {
if ([[self.loadBuffer allKeysForObject:[NSNumber numberWithInt:[[[note userInfo] objectForKey:@"index"] intValue]]] count]) { if ([[self.loadBuffer allKeysForObject:[NSNumber numberWithInt:[[[note userInfo] objectForKey:@"index"] intValue]]] count]) {
NSArray * tagArray = [self.loadBuffer allKeysForObject:[NSNumber numberWithInt:[[[note userInfo] objectForKey:@"index"] intValue]]]; NSArray * tagArray = [self.loadBuffer allKeysForObject:[NSNumber numberWithInt:[[[note userInfo] objectForKey:@"index"] intValue]]];
for (NSNumber *tag in tagArray) { for (NSNumber *tag in tagArray) {
...@@ -67,7 +69,9 @@ dispatch_queue_t backgroundQueue; ...@@ -67,7 +69,9 @@ dispatch_queue_t backgroundQueue;
if ([view isKindOfClass:[UIImageView class]]){ if ([view isKindOfClass:[UIImageView class]]){
UIImage *image = [self.imagesDictionary objectForKey:[self.loadBuffer objectForKey:tag]]; UIImage *image = [self.imagesDictionary objectForKey:[self.loadBuffer objectForKey:tag]];
if (image) { if (image) {
[(UIImageView *)view setImage:image]; dispatch_async(dispatch_get_main_queue(), ^{
[(UIImageView *)view setImage:image];
});
[self.loadBuffer removeObjectForKey:tag]; [self.loadBuffer removeObjectForKey:tag];
} }
} }
...@@ -75,27 +79,35 @@ dispatch_queue_t backgroundQueue; ...@@ -75,27 +79,35 @@ dispatch_queue_t backgroundQueue;
// NSLog(@"Async notes"); // NSLog(@"Async notes");
NSString *note = [self.notesDictionary objectForKey:[self.loadBuffer objectForKey:tag]]; NSString *note = [self.notesDictionary objectForKey:[self.loadBuffer objectForKey:tag]];
if (note) { if (note) {
[(UIWebView *)view loadHTMLString:note baseURL:nil]; dispatch_async(dispatch_get_main_queue(), ^{
[(UIWebView *)view loadHTMLString:note baseURL:nil];
});
[self.loadBuffer removeObjectForKey:tag]; [self.loadBuffer removeObjectForKey:tag];
} }
} else if ([view isKindOfClass:[UITableViewCell class]]){ } else if ([view isKindOfClass:[UITableViewCell class]]){
UIImage *image = [self.imagesDictionary objectForKey:[self.loadBuffer objectForKey:tag]]; UIImage *image = [self.imagesDictionary objectForKey:[self.loadBuffer objectForKey:tag]];
if (image){ if (image){
UIImageView *imageView = (UIImageView *)[view viewWithTag:1]; UIImageView *imageView = (UIImageView *)[view viewWithTag:1];
[imageView setImage:image]; dispatch_async(dispatch_get_main_queue(), ^{
[imageView setImage:image];
});
[self.loadBuffer removeObjectForKey:tag]; [self.loadBuffer removeObjectForKey:tag];
} }
} }
} }
} }
});
}]; }];
dictLock = [[NSLock alloc] init];
return self; return self;
} }
- (void) putImage: (NSString *)img AtIndex: (uint) index{ - (void) putImage: (NSString *)img AtIndex: (uint) index{
NSData* data = [NSData dataWithBase64String:img]; NSData* data = [NSData dataWithBase64String:img];
UIImage* image = [UIImage imageWithData:data]; UIImage* image = [UIImage imageWithData:data];
[dictLock lock];
[self.imagesDictionary setObject:image forKey:[NSNumber numberWithUnsignedInt:index]]; [self.imagesDictionary setObject:image forKey:[NSNumber numberWithUnsignedInt:index]];
[dictLock unlock];
[[NSNotificationCenter defaultCenter] postNotificationName:@"storage_update_ready" [[NSNotificationCenter defaultCenter] postNotificationName:@"storage_update_ready"
object:nil object:nil
userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:index] forKey:@"index"]]; userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:index] forKey:@"index"]];
......
...@@ -374,70 +374,6 @@ ...@@ -374,70 +374,6 @@
<rect key="frame" x="0.0" y="20" width="320" height="548"/> <rect key="frame" x="0.0" y="20" width="320" height="548"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" restorationIdentifier="" translatesAutoresizingMaskIntoConstraints="NO" id="3od-5c-yzI" userLabel="Bottom">
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vh9-Zy-DPu">
<constraints>
<constraint firstAttribute="width" constant="93" id="tXD-cs-5jt"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" backgroundImage="released_previous_button.png">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" backgroundImage="pushed_previous_button.png">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="previousSlideAction:" destination="Ivv-3X-Nhr" eventType="touchUpInside" id="DAf-Qp-7KW"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XDZ-bs-OUM">
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" backgroundImage="released_next_button.png">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" backgroundImage="pushed_next_button.png">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="nextSlideAction:" destination="Ivv-3X-Nhr" eventType="touchUpInside" id="qTl-Ib-3Z8"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kMb-xm-ope">
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="59" id="Kjm-ct-oJ3"/>
<constraint firstAttribute="height" constant="60" id="xrc-bW-vTq"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Button" image="pointer.png">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="pointer_pushed.png">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="pointerAction:" destination="Ivv-3X-Nhr" eventType="touchUpInside" id="KYl-be-1wN"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.93333333333333335" green="0.93333333333333335" blue="0.93333333333333335" alpha="1" colorSpace="deviceRGB"/>
<constraints>
<constraint firstItem="XDZ-bs-OUM" firstAttribute="centerY" secondItem="3od-5c-yzI" secondAttribute="centerY" type="default" id="992-ZE-DXX"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="centerY" secondItem="vh9-Zy-DPu" secondAttribute="centerY" type="default" id="DAr-Sf-YhO"/>
<constraint firstAttribute="trailing" secondItem="XDZ-bs-OUM" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="Eqp-Q3-L92"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="top" secondItem="XDZ-bs-OUM" secondAttribute="top" type="default" id="H9E-FR-J2C"/>
<constraint firstItem="vh9-Zy-DPu" firstAttribute="leading" secondItem="3od-5c-yzI" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="SQd-eE-VN0"/>
<constraint firstAttribute="height" constant="88" type="user" id="dBc-X5-XIU"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="top" secondItem="vh9-Zy-DPu" secondAttribute="top" type="default" id="r6I-Jb-2lm"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="leading" secondItem="3od-5c-yzI" secondAttribute="leading" constant="132" id="tY1-mj-gK5"/>
<constraint firstItem="vh9-Zy-DPu" firstAttribute="width" secondItem="XDZ-bs-OUM" secondAttribute="width" type="user" id="x0P-o6-T4k"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="height" secondItem="XDZ-bs-OUM" secondAttribute="height" type="user" id="zeV-2j-i1K"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YvB-Gp-Fvr" userLabel="Preview"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YvB-Gp-Fvr" userLabel="Preview">
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="bZq-z2-OKU"> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="bZq-z2-OKU">
...@@ -518,33 +454,204 @@ ...@@ -518,33 +454,204 @@
<constraint firstItem="Y23-iV-GJx" firstAttribute="width" secondItem="xGi-A7-hat" secondAttribute="width" type="user" id="uLC-ir-IGd"/> <constraint firstItem="Y23-iV-GJx" firstAttribute="width" secondItem="xGi-A7-hat" secondAttribute="width" type="user" id="uLC-ir-IGd"/>
</constraints> </constraints>
</view> </view>
<view hidden="YES" opaque="NO" userInteractionEnabled="NO" alpha="0.60000000000000009" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uSh-Ne-BdH" userLabel="blockview">
<color key="backgroundColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" none="YES" notEnabled="YES"/>
</accessibility>
</view>
<scrollView hidden="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1000" scrollEnabled="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sco-8x-zSx">
<subviews>
<imageView hidden="YES" userInteractionEnabled="NO" alpha="0.0" contentMode="scaleAspectFit" image="ic_launcher@2x.png" translatesAutoresizingMaskIntoConstraints="NO" id="ExH-sw-Z1i">
<constraints>
<constraint firstAttribute="height" constant="251" type="user" id="fag-vU-Fek"/>
</constraints>
</imageView>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iCc-m2-vR5" userLabel="pointer">
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="5" id="Pvc-0L-c6j"/>
<constraint firstAttribute="height" constant="5" id="pYn-Z0-Lv4"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="iCc-m2-vR5" firstAttribute="centerY" secondItem="ExH-sw-Z1i" secondAttribute="centerY" type="user" id="1ij-Ea-epv"/>
<constraint firstItem="ExH-sw-Z1i" firstAttribute="centerX" secondItem="sco-8x-zSx" secondAttribute="centerX" type="default" id="HzU-KT-Di4"/>
<constraint firstItem="ExH-sw-Z1i" firstAttribute="centerY" secondItem="sco-8x-zSx" secondAttribute="centerY" type="default" id="Jp6-hL-zFM"/>
<constraint firstItem="ExH-sw-Z1i" firstAttribute="leading" secondItem="sco-8x-zSx" secondAttribute="leading" type="default" id="Mlu-wO-svM"/>
<constraint firstItem="iCc-m2-vR5" firstAttribute="centerX" secondItem="ExH-sw-Z1i" secondAttribute="centerX" type="user" id="W0H-CC-5rY"/>
<constraint firstItem="ExH-sw-Z1i" firstAttribute="trailing" secondItem="sco-8x-zSx" secondAttribute="trailing" type="default" id="cE4-Q3-f4A"/>
<constraint firstAttribute="bottom" secondItem="ExH-sw-Z1i" secondAttribute="bottom" constant="149" id="vm4-SB-sLt"/>
</constraints>
</scrollView>
<view contentMode="scaleToFill" restorationIdentifier="" translatesAutoresizingMaskIntoConstraints="NO" id="3od-5c-yzI" userLabel="Bottom">
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vh9-Zy-DPu">
<constraints>
<constraint firstAttribute="width" constant="93" id="tXD-cs-5jt"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" backgroundImage="released_previous_button.png">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" backgroundImage="pushed_previous_button.png">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="previousSlideAction:" destination="Ivv-3X-Nhr" eventType="touchUpInside" id="DAf-Qp-7KW"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XDZ-bs-OUM">
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" backgroundImage="released_next_button.png">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" backgroundImage="pushed_next_button.png">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="nextSlideAction:" destination="Ivv-3X-Nhr" eventType="touchUpInside" id="qTl-Ib-3Z8"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kMb-xm-ope">
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="59" id="Kjm-ct-oJ3"/>
<constraint firstAttribute="height" constant="60" id="xrc-bW-vTq"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Button" image="pointer.png">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted" image="pointer_pushed.png">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="accPointerAction:" destination="Ivv-3X-Nhr" eventType="touchDown" id="35J-B2-GIE"/>
<action selector="accPointerAction:" destination="Ivv-3X-Nhr" eventType="touchUpOutside" id="F8W-M1-8Lb"/>
<action selector="accPointerAction:" destination="Ivv-3X-Nhr" eventType="touchUpInside" id="Lb1-HF-wdh"/>
<action selector="pointerAction:" destination="Ivv-3X-Nhr" eventType="touchDown" id="gK9-ff-k1g"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.93333333333333335" green="0.93333333333333335" blue="0.93333333333333335" alpha="1" colorSpace="deviceRGB"/>
<constraints>
<constraint firstItem="XDZ-bs-OUM" firstAttribute="centerY" secondItem="3od-5c-yzI" secondAttribute="centerY" type="default" id="992-ZE-DXX"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="centerY" secondItem="vh9-Zy-DPu" secondAttribute="centerY" type="default" id="DAr-Sf-YhO"/>
<constraint firstAttribute="trailing" secondItem="XDZ-bs-OUM" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="Eqp-Q3-L92"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="top" secondItem="XDZ-bs-OUM" secondAttribute="top" type="default" id="H9E-FR-J2C"/>
<constraint firstItem="vh9-Zy-DPu" firstAttribute="leading" secondItem="3od-5c-yzI" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="SQd-eE-VN0"/>
<constraint firstAttribute="height" constant="88" type="user" id="dBc-X5-XIU"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="top" secondItem="vh9-Zy-DPu" secondAttribute="top" type="default" id="r6I-Jb-2lm"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="leading" secondItem="3od-5c-yzI" secondAttribute="leading" constant="132" id="tY1-mj-gK5"/>
<constraint firstItem="vh9-Zy-DPu" firstAttribute="width" secondItem="XDZ-bs-OUM" secondAttribute="width" type="user" id="x0P-o6-T4k"/>
<constraint firstItem="kMb-xm-ope" firstAttribute="height" secondItem="XDZ-bs-OUM" secondAttribute="height" type="user" id="zeV-2j-i1K"/>
</constraints>
</view>
</subviews> </subviews>
<color key="backgroundColor" red="0.90196079015731812" green="0.90196079015731812" blue="0.90196079015731812" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.90196079015731812" green="0.90196079015731812" blue="0.90196079015731812" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstItem="evg-Ah-Kcw" firstAttribute="leading" secondItem="Xty-aF-WDv" secondAttribute="leading" constant="-13" id="5Ku-go-4Y7"/> <constraint firstItem="evg-Ah-Kcw" firstAttribute="leading" secondItem="Xty-aF-WDv" secondAttribute="leading" constant="-13" id="5Ku-go-4Y7"/>
<constraint firstItem="3od-5c-yzI" firstAttribute="leading" secondItem="Xty-aF-WDv" secondAttribute="leading" type="default" id="5et-XH-ZVD"/> <constraint firstItem="3od-5c-yzI" firstAttribute="leading" secondItem="Xty-aF-WDv" secondAttribute="leading" type="default" id="5et-XH-ZVD"/>
<constraint firstItem="3od-5c-yzI" firstAttribute="top" secondItem="evg-Ah-Kcw" secondAttribute="bottom" type="user" id="7vy-A8-l8f"/> <constraint firstItem="sco-8x-zSx" firstAttribute="centerY" secondItem="Xty-aF-WDv" secondAttribute="centerY" type="default" id="5g1-xQ-Rjo"/>
<constraint firstItem="uSh-Ne-BdH" firstAttribute="top" secondItem="Xty-aF-WDv" secondAttribute="top" type="default" id="5oi-ag-u6c"/>
<constraint firstAttribute="bottom" secondItem="uSh-Ne-BdH" secondAttribute="bottom" constant="-92" id="7f7-gO-D5h"/>
<constraint firstItem="3od-5c-yzI" firstAttribute="bottom" secondItem="Xty-aF-WDv" secondAttribute="bottom" type="default" id="9qT-8J-cJX"/>
<constraint firstItem="sco-8x-zSx" firstAttribute="top" secondItem="Xty-aF-WDv" secondAttribute="top" constant="-1" id="ABt-Qu-Csc"/>
<constraint firstItem="YvB-Gp-Fvr" firstAttribute="top" secondItem="Xty-aF-WDv" secondAttribute="top" constant="5" type="user" id="DoA-5l-NFS"/> <constraint firstItem="YvB-Gp-Fvr" firstAttribute="top" secondItem="Xty-aF-WDv" secondAttribute="top" constant="5" type="user" id="DoA-5l-NFS"/>
<constraint firstItem="evg-Ah-Kcw" firstAttribute="top" secondItem="YvB-Gp-Fvr" secondAttribute="bottom" constant="8" symbolic="YES" type="default" id="FDk-Bs-3cI"/> <constraint firstItem="evg-Ah-Kcw" firstAttribute="top" secondItem="YvB-Gp-Fvr" secondAttribute="bottom" constant="8" symbolic="YES" type="default" id="FDk-Bs-3cI"/>
<constraint firstItem="YvB-Gp-Fvr" firstAttribute="trailing" secondItem="Xty-aF-WDv" secondAttribute="trailing" type="default" id="FXg-Ij-nfl"/> <constraint firstItem="YvB-Gp-Fvr" firstAttribute="trailing" secondItem="Xty-aF-WDv" secondAttribute="trailing" type="default" id="FXg-Ij-nfl"/>
<constraint firstItem="evg-Ah-Kcw" firstAttribute="centerX" secondItem="3od-5c-yzI" secondAttribute="centerX" type="default" id="HOg-6M-zJ9"/> <constraint firstItem="uSh-Ne-BdH" firstAttribute="trailing" secondItem="Xty-aF-WDv" secondAttribute="trailing" type="default" id="HAC-vD-Hqj"/>
<constraint firstItem="uSh-Ne-BdH" firstAttribute="leading" secondItem="Xty-aF-WDv" secondAttribute="leading" type="default" id="HeG-j9-sqU"/>
<constraint firstItem="YvB-Gp-Fvr" firstAttribute="leading" secondItem="Xty-aF-WDv" secondAttribute="leading" type="default" id="I4g-8o-Kbt"/> <constraint firstItem="YvB-Gp-Fvr" firstAttribute="leading" secondItem="Xty-aF-WDv" secondAttribute="leading" type="default" id="I4g-8o-Kbt"/>
<constraint firstItem="3od-5c-yzI" firstAttribute="centerX" secondItem="evg-Ah-Kcw" secondAttribute="centerX" type="default" id="OBV-yE-3pQ"/>
<constraint firstItem="sco-8x-zSx" firstAttribute="trailing" secondItem="Xty-aF-WDv" secondAttribute="trailing" type="default" id="TvG-hv-kxd"/>
<constraint firstItem="3od-5c-yzI" firstAttribute="trailing" secondItem="Xty-aF-WDv" secondAttribute="trailing" type="default" id="eJ5-5R-zZM"/> <constraint firstItem="3od-5c-yzI" firstAttribute="trailing" secondItem="Xty-aF-WDv" secondAttribute="trailing" type="default" id="eJ5-5R-zZM"/>
<constraint firstAttribute="bottom" secondItem="3od-5c-yzI" secondAttribute="bottom" type="user" id="sob-HW-K69"/> <constraint firstItem="sco-8x-zSx" firstAttribute="leading" secondItem="Xty-aF-WDv" secondAttribute="leading" type="default" id="tDh-lz-AgT"/>
<constraint firstAttribute="bottom" secondItem="evg-Ah-Kcw" secondAttribute="bottom" constant="88" id="uDo-cI-z18"/>
</constraints> </constraints>
</view> </view>
<connections> <connections>
<outlet property="blockingView" destination="uSh-Ne-BdH" id="g9R-1S-DJA"/>
<outlet property="bottomView" destination="3od-5c-yzI" id="bAX-eX-GfA"/>
<outlet property="lecturer_notes" destination="xGi-A7-hat" id="Cng-HM-0wW"/> <outlet property="lecturer_notes" destination="xGi-A7-hat" id="Cng-HM-0wW"/>
<outlet property="movingPointer" destination="iCc-m2-vR5" id="Y9t-hw-qhs"/>
<outlet property="notesView" destination="evg-Ah-Kcw" id="mlQ-Ez-ekQ"/> <outlet property="notesView" destination="evg-Ah-Kcw" id="mlQ-Ez-ekQ"/>
<outlet property="pointerBtn" destination="kMb-xm-ope" id="0Ig-tz-vu5"/>
<outlet property="secondarySlideView" destination="B2g-rO-b9G" id="98R-qU-Psa"/> <outlet property="secondarySlideView" destination="B2g-rO-b9G" id="98R-qU-Psa"/>
<outlet property="slideNumber" destination="3BV-KX-Qla" id="681-YP-k0T"/> <outlet property="slideNumber" destination="3BV-KX-Qla" id="681-YP-k0T"/>
<outlet property="slideView" destination="bZq-z2-OKU" id="yu0-P8-F3v"/> <outlet property="slideView" destination="bZq-z2-OKU" id="yu0-P8-F3v"/>
<outlet property="touchPointerImage" destination="ExH-sw-Z1i" id="I0L-0P-zSk"/>
<outlet property="touchPointerScrollView" destination="sco-8x-zSx" id="7B3-1T-ZI8"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Uei-nM-J1S" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="Uei-nM-J1S" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="2290" y="1807"/> <point key="canvasLocation" x="2290" y="1807"/>
</scene> </scene>
<!--Touch Pointer vc-->
<scene sceneID="lb3-jJ-4Di">
<objects>
<viewController id="hES-Cx-oSf" customClass="touchPointer_vc" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5Hd-U9-nNh">
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mRz-Gd-KLu">
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wNe-aT-xcf">
<constraints>
<constraint firstAttribute="width" constant="214" id="HOe-Si-LIu"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Back">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="dismissModal:" destination="hES-Cx-oSf" eventType="touchUpInside" id="tXy-a7-aOT"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="yBi-pu-DQa">
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="242" id="i2l-Xn-OBb"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="yBi-pu-DQa" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="OMK-2m-vmJ"/>
<constraint firstAttribute="bottom" secondItem="wNe-aT-xcf" secondAttribute="bottom" constant="52" id="fBY-Iv-Mm5"/>
<constraint firstItem="yBi-pu-DQa" firstAttribute="leading" secondItem="mRz-Gd-KLu" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="la5-51-57u"/>
<constraint firstItem="wNe-aT-xcf" firstAttribute="centerX" secondItem="yBi-pu-DQa" secondAttribute="centerX" type="default" id="qSd-nY-2JL"/>
<constraint firstItem="yBi-pu-DQa" firstAttribute="top" secondItem="mRz-Gd-KLu" secondAttribute="top" constant="129" id="seB-Oa-d9u"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="mRz-Gd-KLu" firstAttribute="leading" secondItem="5Hd-U9-nNh" secondAttribute="leading" constant="-20" id="JBk-oD-bnz"/>
<constraint firstItem="mRz-Gd-KLu" firstAttribute="centerY" secondItem="5Hd-U9-nNh" secondAttribute="centerY" type="default" id="Tvh-8g-313"/>
<constraint firstItem="mRz-Gd-KLu" firstAttribute="top" secondItem="5Hd-U9-nNh" secondAttribute="top" constant="-20" id="XTc-4e-YRi"/>
<constraint firstItem="mRz-Gd-KLu" firstAttribute="centerX" secondItem="5Hd-U9-nNh" secondAttribute="centerX" type="default" id="tNV-xj-5gl"/>
</constraints>
</view>
<connections>
<outlet property="imageView" destination="yBi-pu-DQa" id="XE8-h0-pu0"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="gog-t4-scM" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2807" y="1752"/>
</scene>
<!--Slide Show Preview Table vc--> <!--Slide Show Preview Table vc-->
<scene sceneID="Tvi-bD-vMC"> <scene sceneID="Tvi-bD-vMC">
<objects> <objects>
...@@ -703,6 +810,7 @@ ...@@ -703,6 +810,7 @@
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="ic_launcher@2x.png" width="114" height="114"/>
<image name="impress.jpeg" width="204" height="204"/> <image name="impress.jpeg" width="204" height="204"/>
<image name="pointer.png" width="143" height="147"/> <image name="pointer.png" width="143" height="147"/>
<image name="pointer_pushed.png" width="143" height="147"/> <image name="pointer_pushed.png" width="143" height="147"/>
...@@ -713,64 +821,6 @@ ...@@ -713,64 +821,6 @@
<image name="timer_clear_btn.png" width="74" height="74"/> <image name="timer_clear_btn.png" width="74" height="74"/>
<image name="timer_start_btn.png" width="74" height="74"/> <image name="timer_start_btn.png" width="74" height="74"/>
</resources> </resources>
<classes>
<class className="EditableTableViewCell" superclassName="UITableViewCell">
<source key="sourceIdentifier" type="project" relativePath="./Classes/EditableTableViewCell.h"/>
</class>
<class className="NSLayoutConstraint" superclassName="NSObject">
<source key="sourceIdentifier" type="project" relativePath="./Classes/NSLayoutConstraint.h"/>
</class>
<class className="SWRevealViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/SWRevealViewController.h"/>
</class>
<class className="newServerViewController" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/newServerViewController.h"/>
<relationships>
<relationship kind="action" name="save:"/>
</relationships>
</class>
<class className="pinValidation_vc" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/pinValidation_vc.h"/>
<relationships>
<relationship kind="outlet" name="pinLabel" candidateClass="UILabel"/>
<relationship kind="outlet" name="statusLabel" candidateClass="UILabel"/>
</relationships>
</class>
<class className="server_list_vc" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/server_list_vc.h"/>
<relationships>
<relationship kind="outlet" name="serverTable" candidateClass="UITableView"/>
</relationships>
</class>
<class className="slideShowPreviewTable_vc" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/slideShowPreviewTable_vc.h"/>
<relationships>
<relationship kind="outlet" name="optionsTable" candidateClass="UITableView"/>
</relationships>
</class>
<class className="slideShowSwipeInList" superclassName="UITableViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/slideShowSwipeInList.h"/>
<relationships>
<relationship kind="action" name="stopWatchClear:"/>
<relationship kind="action" name="stopWatchStart:"/>
<relationship kind="outlet" name="slidesTable" candidateClass="UITableView"/>
</relationships>
</class>
<class className="slideShow_vc" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/slideShow_vc.h"/>
<relationships>
<relationship kind="action" name="nextSlideAction:"/>
<relationship kind="action" name="pointerAction:"/>
<relationship kind="action" name="previousSlideAction:"/>
<relationship kind="outlet" name="lecturer_notes" candidateClass="UIWebView"/>
<relationship kind="outlet" name="notesView" candidateClass="UIView"/>
<relationship kind="outlet" name="revealButtonItem" candidateClass="UIBarButtonItem"/>
<relationship kind="outlet" name="secondarySlideView" candidateClass="UIImageView"/>
<relationship kind="outlet" name="slideNumber" candidateClass="UILabel"/>
<relationship kind="outlet" name="slideView" candidateClass="UIImageView"/>
</relationships>
</class>
</classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics"> <simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/> <simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/> <simulatedOrientationMetrics key="orientation"/>
......
...@@ -8,6 +8,19 @@ ...@@ -8,6 +8,19 @@
<string>${PRODUCT_NAME}</string> <string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string> <string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>ic_launcher.png</string>
<string>ic_launcher@2x.png</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>org.libreoffice.${PRODUCT_NAME:rfc1034identifier}</string> <string>org.libreoffice.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
...@@ -26,6 +39,8 @@ ...@@ -26,6 +39,8 @@
<true/> <true/>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>iPhone_autolayout</string> <string>iPhone_autolayout</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>
<array> <array>
<string>armv7</string> <string>armv7</string>
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "libreoffice_sdremoteAppDelegate.h" #import "AppDelegate.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@autoreleasepool { @autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([libreoffice_sdremoteAppDelegate class])); return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
} }
} }
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#define OPTION_TIMER @"Timer auto-start"
#define OPTION_POINTER @"Touch pointer"
#define KEY_TIMER @"TIMER_AUTOSTART_ENABLED"
#define KEY_POINTER @"TOUCH_POINTER_ENABLED"
@interface slideShowPreviewTable_vc : UITableViewController <UITableViewDataSource, UITableViewDelegate> @interface slideShowPreviewTable_vc : UITableViewController <UITableViewDataSource, UITableViewDelegate>
@property (strong, nonatomic) IBOutlet UITableView *optionsTable; @property (strong, nonatomic) IBOutlet UITableView *optionsTable;
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
// Uncomment the following line to display an Edit button in the navigation bar for this view controller. // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem; // self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.optionsArray = [NSArray arrayWithObjects:@"Timer auto-start", nil]; self.optionsArray = [NSArray arrayWithObjects:OPTION_TIMER, OPTION_POINTER, nil];
self.comManager = [CommunicationManager sharedComManager]; self.comManager = [CommunicationManager sharedComManager];
self.comManager.delegate = self; self.comManager.delegate = self;
self.slidesRunning = NO; self.slidesRunning = NO;
...@@ -106,7 +106,11 @@ ...@@ -106,7 +106,11 @@
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
UISwitch *toggleSwitch = [[UISwitch alloc] init]; UISwitch *toggleSwitch = [[UISwitch alloc] init];
cell.accessoryView = [[UIView alloc] initWithFrame:toggleSwitch.frame]; cell.accessoryView = [[UIView alloc] initWithFrame:toggleSwitch.frame];
[toggleSwitch setOn:YES]; if (indexPath.row == 0) {
[toggleSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:KEY_TIMER]];
} else {
[toggleSwitch setOn:[[NSUserDefaults standardUserDefaults] boolForKey:KEY_POINTER]];
}
[cell.accessoryView addSubview:toggleSwitch]; [cell.accessoryView addSubview:toggleSwitch];
} }
cell.textLabel.text = [self.optionsArray objectAtIndex:indexPath.row]; cell.textLabel.text = [self.optionsArray objectAtIndex:indexPath.row];
...@@ -154,6 +158,14 @@ ...@@ -154,6 +158,14 @@
*/ */
-(IBAction)startPresentationAction:(id)sender { -(IBAction)startPresentationAction:(id)sender {
for (UITableViewCell *cell in self.tableView.visibleCells) {
UISwitch * toggle = [[[cell accessoryView] subviews] objectAtIndex:0];
if ([cell.textLabel.text isEqualToString:OPTION_TIMER])
[[NSUserDefaults standardUserDefaults] setBool:[toggle isOn] forKey:KEY_TIMER];
else if ([cell.textLabel.text isEqualToString:OPTION_POINTER])
[[NSUserDefaults standardUserDefaults] setBool:[toggle isOn] forKey:KEY_POINTER];
}
[[self.comManager transmitter] startPresentation]; [[self.comManager transmitter] startPresentation];
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#import "SlideShow.h" #import "SlideShow.h"
#import "CommandTransmitter.h" #import "CommandTransmitter.h"
#import "SWRevealViewController.h" #import "SWRevealViewController.h"
#import "slideShowPreviewTable_vc.h"
#import <QuartzCore/CALayer.h> #import <QuartzCore/CALayer.h>
#define TIMER_STATE_RUNNING 0 #define TIMER_STATE_RUNNING 0
...@@ -42,6 +43,11 @@ dispatch_queue_t backgroundQueue; ...@@ -42,6 +43,11 @@ dispatch_queue_t backgroundQueue;
self.slideshow = self.comManager.interpreter.slideShow; self.slideshow = self.comManager.interpreter.slideShow;
self.slideshow.secondaryDelegate = self; self.slideshow.secondaryDelegate = self;
self.state = TIMER_STATE_CLEARED; self.state = TIMER_STATE_CLEARED;
if ([[NSUserDefaults standardUserDefaults] boolForKey:KEY_TIMER]) {
UIButton *l = (UIButton *)[[self.slidesTable cellForRowAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]] viewWithTag:2];
[self stopWatchStart:l];
}
} }
- (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender - (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
- (IBAction)nextSlideAction:(id)sender; - (IBAction)nextSlideAction:(id)sender;
- (IBAction)previousSlideAction:(id)sender; - (IBAction)previousSlideAction:(id)sender;
- (IBAction)pointerAction:(id)sender; - (IBAction)pointerAction:(id)sender;
- (IBAction)accPointerAction:(id)sender;
@property (weak, nonatomic) IBOutlet UIView *notesView; @property (weak, nonatomic) IBOutlet UIView *notesView;
@property (weak, nonatomic) IBOutlet UIWebView *lecturer_notes; @property (weak, nonatomic) IBOutlet UIWebView *lecturer_notes;
...@@ -20,4 +21,11 @@ ...@@ -20,4 +21,11 @@
@property (weak, nonatomic) IBOutlet UIImageView *secondarySlideView; @property (weak, nonatomic) IBOutlet UIImageView *secondarySlideView;
@property (weak, nonatomic) IBOutlet UILabel *slideNumber; @property (weak, nonatomic) IBOutlet UILabel *slideNumber;
@property (weak, nonatomic) IBOutlet UIView *movingPointer;
@property (weak, nonatomic) IBOutlet UIImageView *touchPointerImage;
@property (weak, nonatomic) IBOutlet UIView *blockingView;
@property (weak, nonatomic) IBOutlet UIView *bottomView;
@property (weak, nonatomic) IBOutlet UIScrollView *touchPointerScrollView;
@property (weak, nonatomic) IBOutlet UIButton *pointerBtn;
@end @end
...@@ -7,16 +7,20 @@ ...@@ -7,16 +7,20 @@
*/ */
#import "slideShow_vc.h" #import "slideShow_vc.h"
#import "SlideShow.h" #import "SlideShow.h"
#import "setRecursiveUserInteraction.h"
#import "CommunicationManager.h" #import "CommunicationManager.h"
#import "SWRevealViewController.h" #import "SWRevealViewController.h"
#import "CommandInterpreter.h" #import "CommandInterpreter.h"
#import "CommandTransmitter.h" #import "CommandTransmitter.h"
#import "slideShowPreviewTable_vc.h"
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <CoreMotion/CoreMotion.h>
#define CURRENT_SLIDE_IMAGEVIEW 1 #define CURRENT_SLIDE_IMAGEVIEW 1
#define NEXT_SLIDE_IMAGEVIEW 2 #define NEXT_SLIDE_IMAGEVIEW 2
#define CURRENT_SLIDE_NOTES 3 #define TOUCH_POINTER_VIEW 3
#define CURRENT_SLIDE_NOTES 4
@interface slideShow_vc () @interface slideShow_vc ()
...@@ -25,9 +29,16 @@ ...@@ -25,9 +29,16 @@
@property (nonatomic, strong) id slideShowFinishedObserver; @property (nonatomic, strong) id slideShowFinishedObserver;
@property (nonatomic, strong) SlideShow* slideshow; @property (nonatomic, strong) SlideShow* slideshow;
@property BOOL pointerCalibrationOn;
@property CGPoint refLeftUpperGravity;
@property CGPoint refRightUpperGravity;
@property CGPoint refRightLowerGravity;
// SWReveal Controller // SWReveal Controller
@property (readwrite) IBOutlet UIBarButtonItem* revealButtonItem; @property (readwrite) IBOutlet UIBarButtonItem* revealButtonItem;
@property int count;
@end @end
@implementation slideShow_vc @implementation slideShow_vc
...@@ -37,6 +48,162 @@ ...@@ -37,6 +48,162 @@
@synthesize slideShowFinishedObserver = _slideShowFinishedObserver; @synthesize slideShowFinishedObserver = _slideShowFinishedObserver;
@synthesize slideshow = _slideshow; @synthesize slideshow = _slideshow;
#pragma mark - Pointer
- (CMMotionManager *)motionManager
{
CMMotionManager *motionManager = nil;
id appDelegate = [UIApplication sharedApplication].delegate;
if ([appDelegate respondsToSelector:@selector(motionManager)]) {
motionManager = [appDelegate motionManager];
}
return motionManager;
}
- (void)startMotionDetect
{
// __block float stepMoveFactorX = 5;
// __block float stepMoveFactorY = 5;
// __block double refX, refY;
[self.motionManager
startAccelerometerUpdatesToQueue:[[NSOperationQueue alloc] init]
withHandler:^(CMAccelerometerData *data, NSError *error)
{
dispatch_async(dispatch_get_main_queue(),
^{
CGRect rect = self.movingPointer.frame;
NSLog(@"x:%f y:%f z:%f", data.acceleration.x, data.acceleration.y, data.acceleration.z);
// Used to calibrate pointer based on initial position
// if (self.pointerCalibrationOn){
// refX = data.acceleration.x;
// refY = data.acceleration.y;
// self.pointerCalibrationOn = NO;
// }
// float movetoX = rect.origin.x + ((data.acceleration.x - refX) * stepMoveFactorX);
float movetoX = self.touchPointerImage.frame.origin.x + self.touchPointerImage.frame.size.width * ABS(data.acceleration.x - self.refLeftUpperGravity.x) / ABS(self.refRightUpperGravity.x - self.refLeftUpperGravity.x);
float maxX = self.touchPointerImage.frame.origin.x + self.touchPointerImage.frame.size.width - rect.size.width;
// float movetoY = (rect.origin.y) + ((data.acceleration.y - refY) * stepMoveFactorY);
float movetoY = self.touchPointerImage.frame.origin.y + self.touchPointerImage.frame.size.height * ABS(data.acceleration.y - self.refRightUpperGravity.y) / ABS(self.refRightLowerGravity.y - self.refRightUpperGravity.y);
float maxY = self.touchPointerImage.frame.origin.y + self.touchPointerImage.frame.size.height;
if ( movetoX > self.touchPointerImage.frame.origin.x && movetoX < maxX ) {
rect.origin.x = movetoX;
};
if ( movetoY > self.touchPointerImage.frame.origin.y && movetoY < maxY ) {
rect.origin.y = movetoY;
};
[UIView animateWithDuration:0 delay:0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
self.movingPointer.frame = rect;
}
completion:nil
];
});
}];
}
- (IBAction)accPointerAction:(id)sender{
BOOL acc = [[NSUserDefaults standardUserDefaults] boolForKey:KEY_POINTER];
if (!acc) {
static BOOL pointer = NO;
if (!pointer){
[self startMotionDetect];
[self.movingPointer setHidden:NO];
}
else {
[self.motionManager stopAccelerometerUpdates];
self.pointerCalibrationOn = NO;
[self.movingPointer setHidden:YES];
}
pointer = !pointer;
}
}
- (IBAction)pointerAction:(id)sender {
if (self.count == 0 || self.count == 1){
CGPoint p;
p.x = [self.motionManager accelerometerData].acceleration.x;
p.y = [self.motionManager accelerometerData].acceleration.y;
self.refLeftUpperGravity = p;
if (self.count == 1) {
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Calibration"
message:@"Upper left corner calibrated, now point your device to the upper right corner of the screen and click Pointer button again"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:@"Help", nil];
[message show];
}
++self.count;
} else if (self.count == 2 || self.count == 3) {
CGPoint p;
p.x = [self.motionManager accelerometerData].acceleration.x;
p.y = [self.motionManager accelerometerData].acceleration.y;
self.refRightUpperGravity = p;
if (self.count == 3) {
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Calibration"
message:@"Upper right corner calibrated, now point your device to the lower right corner of the screen and click Pointer button again!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:@"Help", nil];
[message show];
}
++self.count;
} else if (self.count == 4 || self.count == 5) {
CGPoint p;
p.x = [self.motionManager accelerometerData].acceleration.x;
p.y = [self.motionManager accelerometerData].acceleration.y;
self.refRightLowerGravity = p;
if (self.count == 5) {
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Calibration"
message:@"Lower right corner calibrated, enjoy your pointer!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:@"Help", nil];
[message show];
}
++self.count;
} else {
if ([self.touchPointerImage isHidden]){
[self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.touchPointerImage];
CGPoint p = self.view.center;
p.y -= 50;
self.touchPointerImage.center = p;
}
[self.touchPointerImage fadeInfadeOutwithDuration:0.0 maxAlpha:1.0];
[self.blockingView fadeInfadeOutwithDuration:0.0 maxAlpha:0.7];
[self.touchPointerScrollView setHidden:![self.touchPointerScrollView isHidden]];
}
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint loc = [touch locationInView:self.slideView];
if (loc.x >= 0 && loc.x <= self.slideView.frame.origin.x+self.slideView.frame.size.width
&& loc.y >= 0 && loc.y <= self.slideView.frame.origin.y + self.slideView.frame.size.height)
NSLog(@"Touch begins at: %f, %f", loc.x, loc.y);
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint loc = [touch locationInView:self.slideView];
if (loc.x >= 0 && loc.x <= self.slideView.frame.origin.x+self.slideView.frame.size.width
&& loc.y >= 0 && loc.y <= self.slideView.frame.origin.y + self.slideView.frame.size.height)
NSLog(@"Touch at: %f, %f", loc.x, loc.y);
}
#pragma mark - System defaults
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{ {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
...@@ -49,40 +216,51 @@ ...@@ -49,40 +216,51 @@
- (void)viewDidLoad - (void)viewDidLoad
{ {
[super viewDidLoad]; [super viewDidLoad];
// Unique tag assignment. Don't use 0 as it's default. 0-10 for central VC // Unique tag assignment. Don't use 0 as it's default. 0-10 for central VC
[self.slideView setTag:CURRENT_SLIDE_IMAGEVIEW]; [self.slideView setTag:CURRENT_SLIDE_IMAGEVIEW];
[self.secondarySlideView setTag:NEXT_SLIDE_IMAGEVIEW]; [self.secondarySlideView setTag:NEXT_SLIDE_IMAGEVIEW];
[self.lecturer_notes setTag:CURRENT_SLIDE_NOTES]; [self.lecturer_notes setTag:CURRENT_SLIDE_NOTES];
[self.touchPointerImage setTag:TOUCH_POINTER_VIEW];
self.comManager = [CommunicationManager sharedComManager]; self.comManager = [CommunicationManager sharedComManager];
self.slideshow = [self.comManager.interpreter slideShow]; self.slideshow = [self.comManager.interpreter slideShow];
self.slideshow.delegate = self; self.slideshow.delegate = self;
[self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.slideView]; [self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.slideView];
[self.slideshow getContentAtIndex:self.slideshow.currentSlide+1 forView:self.secondarySlideView]; [self.slideshow getContentAtIndex:self.slideshow.currentSlide+1 forView:self.secondarySlideView];
[self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.lecturer_notes]; [self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.lecturer_notes];
[self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.touchPointerImage];
[self.slideNumber setText:[NSString stringWithFormat:@"%u/%u", [self.slideshow currentSlide]+1, [self.slideshow size]]]; [self.slideNumber setText:[NSString stringWithFormat:@"%u/%u", [self.slideshow currentSlide]+1, [self.slideshow size]]];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Stop Presentation" UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Stop Presentation"
style:UIBarButtonItemStyleBordered style:UIBarButtonItemStyleBordered
target:self target:self
action:@selector(handleBack:)]; action:@selector(handleBack:)];
[backButton setTintColor:[UIColor redColor]]; [backButton setTintColor:[UIColor redColor]];
self.revealViewController.navigationItem.leftBarButtonItem = backButton; self.revealViewController.navigationItem.leftBarButtonItem = backButton;
self.revealButtonItem = [[UIBarButtonItem alloc] initWithImage: [UIImage imageNamed:@"more_icon.png"] self.revealButtonItem = [[UIBarButtonItem alloc] initWithImage: [UIImage imageNamed:@"more_icon.png"]
style:UIBarButtonItemStyleBordered style:UIBarButtonItemStyleBordered
target:self.revealViewController target:self.revealViewController
action:@selector( revealToggle: )]; action:@selector( revealToggle: )];
self.revealViewController.navigationItem.rightBarButtonItem = self.revealButtonItem; self.revealViewController.navigationItem.rightBarButtonItem = self.revealButtonItem;
[self.navigationController.navigationBar addGestureRecognizer: self.revealViewController.panGestureRecognizer]; [self.navigationController.navigationBar addGestureRecognizer: self.revealViewController.panGestureRecognizer];
self.pointerCalibrationOn = NO;
self.movingPointer.layer.cornerRadius = 3;
BOOL acc = [[NSUserDefaults standardUserDefaults] boolForKey:KEY_POINTER];
if (!acc) {
[self.pointerBtn addTarget:self action:@selector(pointerAction:) forControlEvents:UIControlEventTouchUpOutside];
[self.pointerBtn addTarget:self action:@selector(pointerAction:) forControlEvents:UIControlEventTouchUpInside];
}
} }
- (void) handleBack:(id)sender - (void) handleBack:(id)sender
{ {
[self.comManager.transmitter stopPresentation]; [self.comManager.transmitter stopPresentation];
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];
} }
...@@ -91,18 +269,19 @@ ...@@ -91,18 +269,19 @@
{ {
NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
self.slideShowImageNoteReadyObserver =[center addObserverForName:MSG_SLIDE_CHANGED self.slideShowImageNoteReadyObserver =[center addObserverForName:MSG_SLIDE_CHANGED
object:nil object:nil
queue:mainQueue queue:mainQueue
usingBlock:^(NSNotification *note) { usingBlock:^(NSNotification *note) {
[self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.slideView]; [self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.slideView];
[self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.touchPointerImage];
[self.slideshow getContentAtIndex:self.slideshow.currentSlide+1 forView:self.secondarySlideView]; [self.slideshow getContentAtIndex:self.slideshow.currentSlide+1 forView:self.secondarySlideView];
[self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.lecturer_notes]; [self.slideshow getContentAtIndex:self.slideshow.currentSlide forView:self.lecturer_notes];
[self.slideNumber setText:[NSString stringWithFormat:@"%u/%u", [self.slideshow currentSlide]+1, [self.slideshow size]]]; [self.slideNumber setText:[NSString stringWithFormat:@"%u/%u", [self.slideshow currentSlide]+1, [self.slideshow size]]];
}]; }];
self.slideShowFinishedObserver = [center addObserverForName:STATUS_CONNECTED_NOSLIDESHOW self.slideShowFinishedObserver = [center addObserverForName:STATUS_CONNECTED_NOSLIDESHOW
object:nil object:nil
queue:mainQueue queue:mainQueue
...@@ -115,19 +294,23 @@ ...@@ -115,19 +294,23 @@
self.slideView.layer.shadowOffset = CGSizeMake(3.0f, 3.0f); self.slideView.layer.shadowOffset = CGSizeMake(3.0f, 3.0f);
self.slideView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.slideView.bounds].CGPath; self.slideView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.slideView.bounds].CGPath;
self.slideView.clipsToBounds = NO; self.slideView.clipsToBounds = NO;
self.secondarySlideView.layer.shadowColor = [[UIColor blackColor] CGColor]; self.secondarySlideView.layer.shadowColor = [[UIColor blackColor] CGColor];
self.secondarySlideView.layer.shadowOpacity = 0.5; self.secondarySlideView.layer.shadowOpacity = 0.5;
self.secondarySlideView.layer.shadowRadius = 4.0; self.secondarySlideView.layer.shadowRadius = 4.0;
self.secondarySlideView.layer.shadowOffset = CGSizeMake(3.0f, 3.0f); self.secondarySlideView.layer.shadowOffset = CGSizeMake(3.0f, 3.0f);
self.secondarySlideView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.secondarySlideView.bounds].CGPath; self.secondarySlideView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.secondarySlideView.bounds].CGPath;
self.secondarySlideView.clipsToBounds = NO; self.secondarySlideView.clipsToBounds = NO;
// We calibrate once when presentation starts. needs a users alert to inform users to point at the center of the screen at the beginning
self.pointerCalibrationOn = YES;
[super viewDidAppear:animated]; [super viewDidAppear:animated];
} }
- (void) viewDidDisappear:(BOOL)animated - (void) viewDidDisappear:(BOOL)animated
{ {
self.count = 0;
[[NSNotificationCenter defaultCenter] removeObserver:self.slideShowFinishedObserver]; [[NSNotificationCenter defaultCenter] removeObserver:self.slideShowFinishedObserver];
[[NSNotificationCenter defaultCenter] removeObserver:self.slideShowImageNoteReadyObserver]; [[NSNotificationCenter defaultCenter] removeObserver:self.slideShowImageNoteReadyObserver];
[super viewDidDisappear:animated]; [super viewDidDisappear:animated];
...@@ -147,6 +330,11 @@ ...@@ -147,6 +330,11 @@
[self setSlideNumber:nil]; [self setSlideNumber:nil];
[self setSecondarySlideView:nil]; [self setSecondarySlideView:nil];
[self setNotesView:nil]; [self setNotesView:nil];
[self setMovingPointer:nil];
[self setBlockingView:nil];
[self setBottomView:nil];
[self setTouchPointerScrollView:nil];
[self setPointerBtn:nil];
[super viewDidUnload]; [super viewDidUnload];
} }
...@@ -158,10 +346,4 @@ ...@@ -158,10 +346,4 @@
[[self.comManager transmitter] previousTransition]; [[self.comManager transmitter] previousTransition];
} }
- (IBAction)pointerAction:(id)sender {
static int i = 0;
NSLog(@"i = %u", i);
[self.slideshow getContentAtIndex:i forView:self.slideView];
i++;
}
@end @end
//
// touchPointer_vc.h
// iosremote
//
// Created by Liu Siqi on 7/10/13.
// Copyright (c) 2013 libreoffice. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface touchPointer_vc : UIViewController
- (IBAction)dismissModal:(id)sender;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end
//
// touchPointer_vc.m
// iosremote
//
// Created by Liu Siqi on 7/10/13.
// Copyright (c) 2013 libreoffice. All rights reserved.
//
#import "touchPointer_vc.h"
#import "CommunicationManager.h"
#import "CommandTransmitter.h"
#import "CommandInterpreter.h"
#import "SlideShow.h"
#import <QuartzCore/QuartzCore.h>
@interface touchPointer_vc ()
@property (nonatomic, strong) CommunicationManager *comManager;
@end
@implementation touchPointer_vc
@synthesize comManager = _comManager;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.comManager = [CommunicationManager sharedComManager];
[self.comManager.interpreter.slideShow getContentAtIndex:self.comManager.interpreter.slideShow.currentSlide forView:self.imageView];
self.imageView.layer.shadowColor = [[UIColor blackColor] CGColor];
self.imageView.layer.shadowOpacity = 0.5;
self.imageView.layer.shadowRadius = 4.0;
self.imageView.layer.shadowOffset = CGSizeMake(3.0f, 3.0f);
self.imageView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.imageView.bounds].CGPath;
self.imageView.clipsToBounds = NO;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)dismissModal:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)viewDidUnload {
[self setImageView:nil];
[super viewDidUnload];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment