summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorsiqi <me@siqi.fr>2013-06-11 17:41:43 +0200
committersiqi <me@siqi.fr>2013-06-12 09:01:32 +0200
commit5705833197bceff4fc1be5bd179d8eff3225b386 (patch)
tree5fca92c86decb88389429783532fb81d6ac91cd7 /ios
parent16c554e70fe3b91eb33170676d5c972fb93546b9 (diff)
slides preview works
Diffstat (limited to 'ios')
-rw-r--r--ios/iosremote/iosremote/Base64.h33
-rw-r--r--ios/iosremote/iosremote/Base64.m100
-rw-r--r--ios/iosremote/iosremote/Communication/CommandInterpreter.m6
-rw-r--r--ios/iosremote/iosremote/Communication/CommandTransmitter.m6
-rw-r--r--ios/iosremote/iosremote/Communication/CommunicationManager.h11
-rw-r--r--ios/iosremote/iosremote/Communication/CommunicationManager.m38
-rw-r--r--ios/iosremote/iosremote/Communication/SlideShow.h3
-rw-r--r--ios/iosremote/iosremote/Communication/SlideShow.m19
-rw-r--r--ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard86
-rw-r--r--ios/iosremote/iosremote/libreoffice_sdremoteViewController.m10
-rw-r--r--ios/iosremote/iosremote/slideShowViewController.h6
-rw-r--r--ios/iosremote/iosremote/slideShowViewController.m22
12 files changed, 209 insertions, 131 deletions
diff --git a/ios/iosremote/iosremote/Base64.h b/ios/iosremote/iosremote/Base64.h
index f61160d34bbc..71c40707ab1e 100644
--- a/ios/iosremote/iosremote/Base64.h
+++ b/ios/iosremote/iosremote/Base64.h
@@ -1,29 +1,16 @@
-//
-// Base64.h
-// CryptTest
-//
-// Created by Kiichi Takeuchi on 4/20/10.
-// Copyright 2010 ObjectGraph LLC. All rights reserved.
-//
-// Original Source Code is donated by Cyrus
-// Public Domain License
-// http://www.cocoadev.com/index.pl?BaseSixtyFour
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
#import <Foundation/Foundation.h>
-@interface Base64 : NSObject {
+@interface NSData (Base64)
-}
++(id)dataWithBase64String:(NSString *)base64String;
-+ (void) initialize;
-
-+ (NSString*) encode:(const uint8_t*) input length:(NSInteger) length;
-
-+ (NSString*) encode:(NSData*) rawBytes;
-
-+ (NSData*) decode:(const char*) string length:(NSInteger) inputLength;
-
-+ (NSData*) decode:(NSString*) string;
-
-@end
+@end \ No newline at end of file
diff --git a/ios/iosremote/iosremote/Base64.m b/ios/iosremote/iosremote/Base64.m
index fc2a36949153..9b380eb876cd 100644
--- a/ios/iosremote/iosremote/Base64.m
+++ b/ios/iosremote/iosremote/Base64.m
@@ -1,97 +1,23 @@
-//
-// Base64.m
-// CryptTest
-//
-// Created by Kiichi Takeuchi on 4/20/10.
-// Copyright 2010 ObjectGraph LLC. All rights reserved.
-//
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
#import "Base64.h"
+@implementation NSData(Base64)
-@implementation Base64
-#define ArrayLength(x) (sizeof(x)/sizeof(*(x)))
-
-static char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-static char decodingTable[128];
-
-+ (void) initialize {
- if (self == [Base64 class]) {
- memset(decodingTable, 0, ArrayLength(decodingTable));
- for (NSInteger i = 0; i < ArrayLength(encodingTable); i++) {
- decodingTable[encodingTable[i]] = i;
- }
- }
-}
-
-
-+ (NSString*) encode:(const uint8_t*) input length:(NSInteger) length {
- NSMutableData* data = [NSMutableData dataWithLength:((length + 2) / 3) * 4];
- uint8_t* output = (uint8_t*)data.mutableBytes;
-
- for (NSInteger i = 0; i < length; i += 3) {
- NSInteger value = 0;
- for (NSInteger j = i; j < (i + 3); j++) {
- value <<= 8;
-
- if (j < length) {
- value |= (0xFF & input[j]);
- }
- }
-
- NSInteger index = (i / 3) * 4;
- output[index + 0] = encodingTable[(value >> 18) & 0x3F];
- output[index + 1] = encodingTable[(value >> 12) & 0x3F];
- output[index + 2] = (i + 1) < length ? encodingTable[(value >> 6) & 0x3F] : '=';
- output[index + 3] = (i + 2) < length ? encodingTable[(value >> 0) & 0x3F] : '=';
- }
-
- return [[NSString alloc] initWithData:data
- encoding:NSASCIIStringEncoding];
-}
-
-
-+ (NSString*) encode:(NSData*) rawBytes {
- return [self encode:(const uint8_t*) rawBytes.bytes length:rawBytes.length];
-}
-
-
-+ (NSData*) decode:(const char*) string length:(NSInteger) inputLength {
- if ((string == NULL) || (inputLength % 4 != 0)) {
++ (id) dataWithBase64String:(NSString *)base64Encoding
+{
+ if ([base64Encoding length] % 4 != 0)
return nil;
- }
-
- while (inputLength > 0 && string[inputLength - 1] == '=') {
- inputLength--;
- }
- NSInteger outputLength = inputLength * 3 / 4;
- NSMutableData* data = [NSMutableData dataWithLength:outputLength];
- uint8_t* output = data.mutableBytes;
-
- NSInteger inputPoint = 0;
- NSInteger outputPoint = 0;
- while (inputPoint < inputLength) {
- char i0 = string[inputPoint++];
- char i1 = string[inputPoint++];
- char i2 = inputPoint < inputLength ? string[inputPoint++] : 'A'; /* 'A' will decode to \0 */
- char i3 = inputPoint < inputLength ? string[inputPoint++] : 'A';
-
- output[outputPoint++] = (decodingTable[i0] << 2) | (decodingTable[i1] >> 4);
- if (outputPoint < outputLength) {
- output[outputPoint++] = ((decodingTable[i1] & 0xf) << 4) | (decodingTable[i2] >> 2);
- }
- if (outputPoint < outputLength) {
- output[outputPoint++] = ((decodingTable[i2] & 0x3) << 6) | decodingTable[i3];
- }
- }
-
- return data;
+ NSString *plist = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><plist version=\"1.0\"><data>%@</data></plist>", base64Encoding];
+ return [NSPropertyListSerialization propertyListWithData:[plist dataUsingEncoding:NSASCIIStringEncoding] options:0 format:NULL error:NULL];
}
-+ (NSData*) decode:(NSString*) string {
- return [self decode:[string cStringUsingEncoding:NSASCIIStringEncoding] length:string.length];
-}
-
@end
diff --git a/ios/iosremote/iosremote/Communication/CommandInterpreter.m b/ios/iosremote/iosremote/Communication/CommandInterpreter.m
index 05708e1553c9..184633fca300 100644
--- a/ios/iosremote/iosremote/Communication/CommandInterpreter.m
+++ b/ios/iosremote/iosremote/Communication/CommandInterpreter.m
@@ -73,13 +73,11 @@
AtIndex:slideNumber];
[[NSNotificationCenter defaultCenter] postNotificationName:MSG_SLIDE_PREVIEW object:[NSNumber numberWithUnsignedInt:slideNumber]];
} else if ([instruction isEqualToString:@"slide_notes"]){
- NSLog(@"Interpreter: slide_notes");
uint slideNumber = [[command objectAtIndex:1] integerValue];
- NSString *notes;
+ NSMutableString *notes = [[NSMutableString alloc] init];
for (int i = 2; i<command.count; ++i) {
- [notes stringByAppendingString:[command objectAtIndex:i]];
+ [notes appendString:[command objectAtIndex:i]];
}
-
[self.slideShow putNotes:notes
AtIndex:slideNumber];
[[NSNotificationCenter defaultCenter] postNotificationName:MSG_SLIDE_NOTES object: [NSNumber numberWithUnsignedInt:slideNumber]];
diff --git a/ios/iosremote/iosremote/Communication/CommandTransmitter.m b/ios/iosremote/iosremote/Communication/CommandTransmitter.m
index 43c1361b2bfa..ae7c12a90227 100644
--- a/ios/iosremote/iosremote/Communication/CommandTransmitter.m
+++ b/ios/iosremote/iosremote/Communication/CommandTransmitter.m
@@ -62,11 +62,11 @@
*/
- (void) blankScreenWithColor:(UIColor*)color
{
- CGColorRef colorRef = color.CGColor;
- NSString *colorString = [CIColor colorWithCGColor:colorRef].stringRepresentation;
+// CGColorRef colorRef = color.CGColor;
+// NSString *colorString = [CIColor colorWithCGColor:colorRef].stringRepresentation;
// Need new server-end interface, since this is a platform dependent representation
- [self.client sendCommand:[NSString stringWithFormat:@"presentation_blank_screen\n%@\n\n", colorString]];
+// [self.client sendCommand:[NSString stringWithFormat:@"presentation_blank_screen\n%@\n\n", colorString]];
}
- (void) resume
diff --git a/ios/iosremote/iosremote/Communication/CommunicationManager.h b/ios/iosremote/iosremote/Communication/CommunicationManager.h
index 5f6de0533ea8..3612a5039d49 100644
--- a/ios/iosremote/iosremote/Communication/CommunicationManager.h
+++ b/ios/iosremote/iosremote/Communication/CommunicationManager.h
@@ -36,7 +36,18 @@
#define STATUS_CONNECTION_FAILED @"STATUS_CONNECTION_FAILED"
+typedef enum ConnectionState : NSInteger ConnectionState;
+
+enum ConnectionState : NSInteger {
+ DISCONNECTED,
+ SEARCHING,
+ CONNECTING,
+ CONNECTED
+};
+
@interface CommunicationManager : NSObject
+@property ConnectionState state;
+
@end
diff --git a/ios/iosremote/iosremote/Communication/CommunicationManager.m b/ios/iosremote/iosremote/Communication/CommunicationManager.m
index d155a4605541..2be29fcfb4e5 100644
--- a/ios/iosremote/iosremote/Communication/CommunicationManager.m
+++ b/ios/iosremote/iosremote/Communication/CommunicationManager.m
@@ -8,12 +8,50 @@
#import "CommunicationManager.h"
+#import "Client.h"
+#import "Server.h"
+#import "CommandTransmitter.h"
+#import "CommandInterpreter.h"
@interface CommunicationManager()
+@property (nonatomic, strong) Client* client;
@end
+// Singlton Pattern
@implementation CommunicationManager
+@synthesize client = _client;
+@synthesize state = _state;
+
++ (CommunicationManager *)sharedComManager
+{
+ static CommunicationManager *sharedComManager = nil;
+
+ static dispatch_once_t _singletonPredicate;
+
+ dispatch_once(&_singletonPredicate, ^{
+ sharedComManager = [[super allocWithZone:nil] init];
+ });
+
+ return sharedComManager;
+}
+
+- (id) init
+{
+ self = [super init];
+ self.state = DISCONNECTED;
+ return self;
+}
+
++ (id)allocWithZone:(NSZone *)zone
+{
+ return [self sharedComManager];
+}
+
+
+
+
+
@end
diff --git a/ios/iosremote/iosremote/Communication/SlideShow.h b/ios/iosremote/iosremote/Communication/SlideShow.h
index c2e30ccfb4b0..b43c81001a11 100644
--- a/ios/iosremote/iosremote/Communication/SlideShow.h
+++ b/ios/iosremote/iosremote/Communication/SlideShow.h
@@ -17,4 +17,7 @@
- (void) putImage: (NSString *)img AtIndex: (uint) index;
- (void) putNotes: (NSString *)notes AtIndex: (uint) index;
+- (UIImage *) getImageAtIndex: (uint) index;
+- (NSString *) getNotesAtIndex: (uint) index;
+
@end
diff --git a/ios/iosremote/iosremote/Communication/SlideShow.m b/ios/iosremote/iosremote/Communication/SlideShow.m
index b2a4c084f908..7cecc7067b77 100644
--- a/ios/iosremote/iosremote/Communication/SlideShow.m
+++ b/ios/iosremote/iosremote/Communication/SlideShow.m
@@ -24,21 +24,36 @@
- (SlideShow *) init{
self = [super init];
+ self.imagesArray = [[NSMutableArray alloc] init];
+ self.notesArray = [[NSMutableArray alloc] init];
_size = 0;
_currentSlide = 0;
return self;
}
- (void) putImage: (NSString *)img AtIndex: (uint) index{
- [Base64 initialize];
- NSData* data = [Base64 decode:img];
+ NSData* data = [NSData dataWithBase64String:img];
UIImage* image = [UIImage imageWithData:data];
[self.imagesArray insertObject:image atIndex:index];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"IMAGE_READY" object:nil];
}
- (void) putNotes: (NSString *)notes AtIndex: (uint) index{
[self.notesArray insertObject:notes atIndex:index];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"NOTE_READY" object:nil];
}
+- (UIImage *) getImageAtIndex: (uint) index
+{
+ return [self.imagesArray objectAtIndex:index];
+}
+
+- (NSString *) getNotesAtIndex: (uint) index
+{
+ return [self.notesArray objectAtIndex:index];
+}
+
+
@end
diff --git a/ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard b/ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
index cb43691aeb3d..4dc5762cb2d0 100644
--- a/ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
+++ b/ios/iosremote/iosremote/en.lproj/MainStoryboard_iPad.storyboard
@@ -12,7 +12,7 @@
<rect key="frame" x="0.0" y="64" width="768" height="960"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="192.168.1.97" borderStyle="roundedRect" minimumFontSize="17" id="9w1-Ym-HcF">
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="172.25.19.11" borderStyle="roundedRect" minimumFontSize="17" id="9w1-Ym-HcF">
<rect key="frame" x="234" y="402" width="301" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
@@ -38,30 +38,88 @@
<connections>
<outlet property="ipAddressTextEdit" destination="9w1-Ym-HcF" id="hab-JH-3Lf"/>
<outlet property="pinLabel" destination="Cg3-f5-zuM" id="HaU-jr-8oJ"/>
- <segue destination="zdX-BL-bmY" kind="push" identifier="slidesPreview" id="9Yb-di-Q6v"/>
+ <segue destination="zdX-BL-bmY" kind="push" identifier="slidesPreviewSegue" id="9Yb-di-Q6v"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="1618" y="-293"/>
+ <point key="canvasLocation" x="2766" y="-569"/>
+ </scene>
+ <!--Table View Controller-->
+ <scene sceneID="Whz-cu-Rds">
+ <objects>
+ <tableViewController id="Q3M-g5-7cc" sceneMemberID="viewController">
+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="Wpt-pb-meU">
+ <rect key="frame" x="0.0" y="20" width="768" height="1004"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <prototypes>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="PmM-ch-mza" detailTextLabel="epJ-IU-4Ja" style="IBUITableViewCellStyleValue1" id="Jgt-j6-gHM">
+ <rect key="frame" x="0.0" y="22" width="768" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="0.0" y="0.0" width="748" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Servername" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PmM-ch-mza">
+ <rect key="frame" x="10" y="11" width="98" height="21"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </label>
+ <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="IP Address" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="epJ-IU-4Ja">
+ <rect key="frame" x="654" y="11" width="84" height="21"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" red="0.2196078431372549" green="0.32941176470588235" blue="0.52941176470588236" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </tableViewCell>
+ </prototypes>
+ <connections>
+ <outlet property="dataSource" destination="Q3M-g5-7cc" id="Ram-95-c0p"/>
+ <outlet property="delegate" destination="Q3M-g5-7cc" id="B8s-db-s0A"/>
+ </connections>
+ </tableView>
+ <navigationItem key="navigationItem" id="Jgb-PO-hv6">
+ <barButtonItem key="rightBarButtonItem" title="Add new Server" id="OYa-b3-ARI"/>
+ </navigationItem>
+ <connections>
+ <segue destination="2" kind="push" id="e6A-u1-Kqr"/>
+ </connections>
+ </tableViewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="Nq5-gt-sEh" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="1640" y="-1071"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="00H-XM-3gJ">
<objects>
- <navigationController id="KFV-Ae-zm8" sceneMemberID="viewController">
- <toolbarItems/>
+ <navigationController toolbarHidden="NO" id="KFV-Ae-zm8" sceneMemberID="viewController">
+ <toolbarItems>
+ <barButtonItem title="Diconnect" id="U8F-bC-QHV"/>
+ </toolbarItems>
+ <simulatedToolbarMetrics key="simulatedBottomBarMetrics" barStyle="blackTranslucent"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="QnQ-yW-KgX">
<rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
+ <toolbar key="toolbar" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" barStyle="blackTranslucent" id="Eh6-CN-U8v">
+ <rect key="frame" x="0.0" y="980" width="768" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </toolbar>
<connections>
- <segue destination="2" kind="relationship" relationship="rootViewController" id="nce-OO-TOv"/>
+ <segue destination="2" kind="relationship" relationship="rootViewController" id="m46-Fm-sAa"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sOJ-6b-jVh" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="721" y="-301"/>
+ <point key="canvasLocation" x="1666" y="89"/>
</scene>
<!--Slide Show View Controller-->
<scene sceneID="wDH-NE-E5t">
@@ -72,21 +130,26 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="T6z-xu-j8h">
- <rect key="frame" x="0.0" y="0.0" width="768" height="960"/>
+ <rect key="frame" x="0.0" y="0.0" width="768" height="458"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
+ <webView contentMode="scaleToFill" id="y0E-Wp-yUc">
+ <rect key="frame" x="20" y="492" width="728" height="378"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </webView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="uc0-p3-wnG"/>
<connections>
<outlet property="image" destination="T6z-xu-j8h" id="o1L-LM-TbP"/>
- <outlet property="view" destination="T6z-xu-j8h" id="YKN-ib-gU3"/>
+ <outlet property="lecturer_notes" destination="y0E-Wp-yUc" id="qNC-Bc-jAZ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Dqn-Ae-ABD" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="2616" y="-293"/>
+ <point key="canvasLocation" x="3804" y="-569"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
@@ -94,4 +157,7 @@
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
+ <inferredMetricsTieBreakers>
+ <segue reference="m46-Fm-sAa"/>
+ </inferredMetricsTieBreakers>
</document> \ No newline at end of file
diff --git a/ios/iosremote/iosremote/libreoffice_sdremoteViewController.m b/ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
index 45e23ee76fd8..0f913db85268 100644
--- a/ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
+++ b/ios/iosremote/iosremote/libreoffice_sdremoteViewController.m
@@ -10,6 +10,7 @@
#import "libreoffice_sdremoteViewController.h"
#import "Server.h"
#import "Client.h"
+#import "slideShowViewController.h"
@interface libreoffice_sdremoteViewController ()
@@ -39,11 +40,18 @@
self.slideShowPreviewStartObserver = [self.center addObserverForName:STATUS_CONNECTED_SLIDESHOW_RUNNING object:nil
queue:mainQueue usingBlock:^(NSNotification *note) {
NSLog(@"Received performSegue!");
- [self performSegueWithIdentifier:@"slidesPreview" sender:self];
+ [self performSegueWithIdentifier:@"slidesPreviewSegue" sender:self];
}];
}
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+ if ([segue.identifier isEqualToString:@"slidesPreviewSegue"]) {
+ slideShowViewController *destViewController = segue.destinationViewController;
+ destViewController.slideshow = [self.interpreter slideShow];
+ }
+}
+
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
diff --git a/ios/iosremote/iosremote/slideShowViewController.h b/ios/iosremote/iosremote/slideShowViewController.h
index f44b849d334c..314bd12ead12 100644
--- a/ios/iosremote/iosremote/slideShowViewController.h
+++ b/ios/iosremote/iosremote/slideShowViewController.h
@@ -7,9 +7,15 @@
//
#import <UIKit/UIKit.h>
+#import "SlideShow.h"
@interface slideShowViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *image;
+@property (weak, nonatomic) IBOutlet UIWebView *lecturer_notes;
+
+@property (nonatomic, strong) SlideShow *slideshow;
+@property (nonatomic, strong) id slideShowImageReadyObserver;
+@property (nonatomic, strong) id slideShowNoteReadyObserver;
@end
diff --git a/ios/iosremote/iosremote/slideShowViewController.m b/ios/iosremote/iosremote/slideShowViewController.m
index cd04f3987aa5..f39bead78137 100644
--- a/ios/iosremote/iosremote/slideShowViewController.m
+++ b/ios/iosremote/iosremote/slideShowViewController.m
@@ -7,6 +7,7 @@
//
#import "slideShowViewController.h"
+#import "SlideShow.h"
@interface slideShowViewController ()
@@ -14,6 +15,10 @@
@implementation slideShowViewController
+@synthesize slideshow = _slideshow;
+@synthesize slideShowImageReadyObserver = _slideShowImageReadyObserver;
+@synthesize slideShowNoteReadyObserver = _slideShowNoteReadyObserver;
+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
@@ -26,9 +31,23 @@
- (void)viewDidLoad
{
[super viewDidLoad];
- // Do any additional setup after loading the view.
+
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
+ self.slideShowImageReadyObserver = [center addObserverForName:@"IMAGE_READY" object:nil
+ queue:mainQueue usingBlock:^(NSNotification *note) {
+ NSLog(@"Getting image to display: %@", [self.slideshow getImageAtIndex:0]);
+ [self.image setImage:[self.slideshow getImageAtIndex:0]];
+ }];
+ self.slideShowNoteReadyObserver = [center addObserverForName:@"NOTE_READY" object:nil
+ queue:mainQueue usingBlock:^(NSNotification *note) {
+ NSLog(@"Getting note to display: %@", [self.slideshow getNotesAtIndex:0]);
+ [self.lecturer_notes loadHTMLString: [self.slideshow getNotesAtIndex:0]baseURL:nil];
+ }];
}
+
+
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
@@ -37,6 +56,7 @@
- (void)viewDidUnload {
[self setImage:nil];
+ [self setLecturer_notes:nil];
[super viewDidUnload];
}
@end