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

various bug fixes & slideshow control pad

Change-Id: I4bda3506f3c37be12795c9ed5787df1e7ced9014
üst e2a31725
...@@ -175,7 +175,7 @@ int count = 0; ...@@ -175,7 +175,7 @@ int count = 0;
case NSStreamEventHasBytesAvailable: case NSStreamEventHasBytesAvailable:
{ {
NSMutableData* data; NSMutableData* data;
NSLog(@"NSStreamEventHasBytesAvailable"); // NSLog(@"NSStreamEventHasBytesAvailable");
if(!data) { if(!data) {
data = [[NSMutableData alloc] init]; data = [[NSMutableData alloc] init];
} }
......
...@@ -20,10 +20,11 @@ ...@@ -20,10 +20,11 @@
@synthesize slideShow = _slideShow; @synthesize slideShow = _slideShow;
- (SlideShow*) slideshow{ - (CommandInterpreter *) init
if (!self.slideShow) {
self.slideShow = [[SlideShow alloc] init]; self = [super init];
return self.slideShow; self.slideShow = [[SlideShow alloc] init];
return self;
} }
- (BOOL) isSlideRunning { - (BOOL) isSlideRunning {
...@@ -44,12 +45,12 @@ ...@@ -44,12 +45,12 @@
else if ([instruction isEqualToString:STATUS_PAIRING_PAIRED]){ else if ([instruction isEqualToString:STATUS_PAIRING_PAIRED]){
[[NSNotificationCenter defaultCenter] postNotificationName:STATUS_PAIRING_PAIRED [[NSNotificationCenter defaultCenter] postNotificationName:STATUS_PAIRING_PAIRED
object:nil]; object:nil];
// @TODO take care of the trailing slideshow_started&slideshow_finished
} }
else if([instruction isEqualToString:@"slideshow_started"]){ else if([instruction isEqualToString:@"slideshow_started"]){
NSLog(@"Interpreter: slideshow_started");
uint slideLength = [[command objectAtIndex:1] integerValue]; uint slideLength = [[command objectAtIndex:1] integerValue];
uint currentSlide = [[command objectAtIndex:2] integerValue]; uint currentSlide = [[command objectAtIndex:2] integerValue];
self.slideShow = [[SlideShow alloc] init]; NSLog(@"Interpreter: slideshow_started with currentSlide: %u slideLength: %u", currentSlide, slideLength);
[self.slideShow setSize:slideLength]; [self.slideShow setSize:slideLength];
[self.slideShow setCurrentSlide:currentSlide]; [self.slideShow setCurrentSlide:currentSlide];
...@@ -63,8 +64,6 @@ ...@@ -63,8 +64,6 @@
self.slideShow = [[SlideShow alloc] init]; self.slideShow = [[SlideShow alloc] init];
[[NSNotificationCenter defaultCenter] postNotificationName:STATUS_CONNECTED_NOSLIDESHOW object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:STATUS_CONNECTED_NOSLIDESHOW object:nil];
} else { } else {
if (self.slideShow == nil)
return;
if ([instruction isEqualToString:@"slide_updated"]) { if ([instruction isEqualToString:@"slide_updated"]) {
NSLog(@"Interpreter: slide_updated"); NSLog(@"Interpreter: slide_updated");
uint newSlideNumber = [[command objectAtIndex:1] integerValue]; uint newSlideNumber = [[command objectAtIndex:1] integerValue];
...@@ -76,11 +75,18 @@ ...@@ -76,11 +75,18 @@
NSLog(@"Interpreter: slide_preview"); NSLog(@"Interpreter: slide_preview");
uint slideNumber = [[command objectAtIndex:1] integerValue]; uint slideNumber = [[command objectAtIndex:1] integerValue];
NSString * imageData = [command objectAtIndex:2]; NSString * imageData = [command objectAtIndex:2];
[self.slideShow putImage:imageData [self.slideShow putImage:imageData
AtIndex:slideNumber]; AtIndex:slideNumber];
[[NSNotificationCenter defaultCenter] postNotificationName:MSG_SLIDE_PREVIEW object:[NSNumber numberWithUnsignedInt:slideNumber]]; [[NSNotificationCenter defaultCenter] postNotificationName:MSG_SLIDE_PREVIEW object:[NSNumber numberWithUnsignedInt:slideNumber]];
if ([[command objectAtIndex:4] isEqualToString:@"slide_notes"])
{
NSRange range;
range.location = 4;
range.length = [command count] - 4;
[self parse:[command subarrayWithRange:range]];
}
} else if ([instruction isEqualToString:@"slide_notes"]){ } else if ([instruction isEqualToString:@"slide_notes"]){
NSLog(@"Interpreter: slide_notes");
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) {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
@property uint size; @property uint size;
@property uint currentSlide; @property uint currentSlide;
@property (nonatomic, strong) slideShowPreview_vc* delegate; @property (nonatomic, strong) id delegate;
- (void) putImage: (NSString *)img AtIndex: (uint) index; - (void) putImage: (NSString *)img AtIndex: (uint) index;
- (void) putNotes: (NSString *)notes AtIndex: (uint) index; - (void) putNotes: (NSString *)notes AtIndex: (uint) index;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#import "SlideShow.h" #import "SlideShow.h"
#import "Base64.h" #import "Base64.h"
#import "slideShowPreview_vc.h" #import "slideShow_vc.h"
#import <dispatch/dispatch.h> #import <dispatch/dispatch.h>
@interface SlideShow() @interface SlideShow()
...@@ -39,28 +39,30 @@ dispatch_queue_t backgroundQueue; ...@@ -39,28 +39,30 @@ dispatch_queue_t backgroundQueue;
_currentSlide = 0; _currentSlide = 0;
backgroundQueue = dispatch_queue_create("org.libreoffice.iosremote.bgqueue", NULL); backgroundQueue = dispatch_queue_create("org.libreoffice.iosremote.bgqueue", NULL);
// NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
// self.slideShowImageReadyObserver =[[NSNotificationCenter defaultCenter] self.slideShowImageReadyObserver =[[NSNotificationCenter defaultCenter]
// addObserverForName:@"storage_update_image_ready" addObserverForName:@"storage_update_image_ready"
// object:nil object:nil
// queue:mainQueue queue:mainQueue
// usingBlock:^(NSNotification *note) { usingBlock:^(NSNotification *note) {
// if ([[[note userInfo] objectForKey:@"index"] intValue] == self.lastRequestedImage) { if ([[[note userInfo] objectForKey:@"index"] intValue] == self.lastRequestedImage) {
// [self.delegate.image setImage:[self getImageAtIndex:self.lastRequestedImage]]; // NSLog(@"Load last requsted image");
// self.lastRequestedImage = -1; [[self.delegate slideView] setImage:[self getImageAtIndex:self.lastRequestedImage]];
// } self.lastRequestedImage = -1;
// }]; }
}];
// self.slideShowNoteReadyObserver = [[NSNotificationCenter defaultCenter] addObserverForName:@"storage_update_note_ready" self.slideShowNoteReadyObserver = [[NSNotificationCenter defaultCenter] addObserverForName:@"storage_update_note_ready"
// object:nil object:nil
// queue:mainQueue queue:mainQueue
// usingBlock:^(NSNotification *note) { usingBlock:^(NSNotification *note) {
// if ([[[note userInfo] objectForKey:@"index"] intValue] == self.lastRequestedNote) { // NSLog(@"Load last requsted note");
// [self.delegate.lecturer_notes loadHTMLString:[self getNotesAtIndex:self.lastRequestedNote] baseURL:nil]; if ([[[note userInfo] objectForKey:@"index"] intValue] == self.lastRequestedNote) {
// self.lastRequestedNote = -1; [[self.delegate lecturer_notes] loadHTMLString:[self getNotesAtIndex:self.lastRequestedNote] baseURL:nil];
// } self.lastRequestedNote = -1;
// }]; }
}];
return self; return self;
} }
......
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
self.comManager = [CommunicationManager sharedComManager]; self.comManager = [CommunicationManager sharedComManager];
[self.pinLabel setText:[NSString stringWithFormat:@"%@", [self.comManager getPairingPin]]]; [self.pinLabel setText:[NSString stringWithFormat:@"%@", [self.comManager getPairingPin]]];
}
- (void) viewDidAppear:(BOOL)animated
{
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
self.slideShowPreviewStartObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_PAIRING_PAIRED self.slideShowPreviewStartObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_PAIRING_PAIRED
object:nil object:nil
...@@ -46,15 +50,15 @@ ...@@ -46,15 +50,15 @@
usingBlock:^(NSNotification *note) { usingBlock:^(NSNotification *note) {
[self performSegueWithIdentifier:@"pinValidated" sender:self ]; [self performSegueWithIdentifier:@"pinValidated" sender:self ];
}]; }];
[super viewDidAppear:animated];
} }
//
//- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ - (void) viewDidDisappear:(BOOL)animated
// if ([segue.identifier isEqualToString:@"pinValidated"]) { {
// slideShowPreview_vc *destViewController = segue.destinationViewController; [[NSNotificationCenter defaultCenter] removeObserver:self.slideShowPreviewStartObserver];
// destViewController.slideshow = [self.comManager.interpreter slideShow]; [super viewDidDisappear:animated];
// [destViewController.slideshow setDelegate:destViewController]; }
// }
//}
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
{ {
......
...@@ -194,21 +194,13 @@ ...@@ -194,21 +194,13 @@
<rect key="frame" x="0.0" y="64" width="320" height="504"/> <rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="bZq-z2-OKU"> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" id="bZq-z2-OKU">
<rect key="frame" x="0.0" y="20" width="320" height="177"/> <rect key="frame" x="0.0" y="20" width="320" height="177"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
</imageView> </imageView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="811-qk-UdS">
<rect key="frame" x="20" y="317" width="280" height="167"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="XDZ-bs-OUM"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="XDZ-bs-OUM">
<rect key="frame" x="227" y="221" width="61" height="61"/> <rect key="frame" x="227" y="221" width="61" height="61"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" backgroundImage="released_next_button.png"> <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="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
...@@ -236,17 +228,23 @@ ...@@ -236,17 +228,23 @@
<action selector="previousSlideAction:" destination="Ivv-3X-Nhr" eventType="touchUpInside" id="DAf-Qp-7KW"/> <action selector="previousSlideAction:" destination="Ivv-3X-Nhr" eventType="touchUpInside" id="DAf-Qp-7KW"/>
</connections> </connections>
</button> </button>
<webView contentMode="scaleToFill" id="xGi-A7-hat">
<rect key="frame" x="20" y="333" width="280" height="151"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</webView>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view> </view>
<navigationItem key="navigationItem" id="T79-lT-61m"/> <navigationItem key="navigationItem" id="T79-lT-61m"/>
<connections> <connections>
<outlet property="nextBtn" destination="XDZ-bs-OUM" id="tcL-xX-S8l"/> <outlet property="lecturer_notes" destination="xGi-A7-hat" id="Cng-HM-0wW"/>
<outlet property="slideView" destination="bZq-z2-OKU" id="yu0-P8-F3v"/>
</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="620" y="1208"/> <point key="canvasLocation" x="620" y="1109"/>
</scene> </scene>
<!--Slide Show Preview Table vc--> <!--Slide Show Preview Table vc-->
<scene sceneID="Tvi-bD-vMC"> <scene sceneID="Tvi-bD-vMC">
...@@ -300,7 +298,7 @@ ...@@ -300,7 +298,7 @@
</tableViewController> </tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="z5S-eI-1pb" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="z5S-eI-1pb" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="1133" y="590"/> <point key="canvasLocation" x="1133" y="648"/>
</scene> </scene>
<!--Navigation Controller--> <!--Navigation Controller-->
<scene sceneID="yRe-s4-oKK"> <scene sceneID="yRe-s4-oKK">
...@@ -323,7 +321,6 @@ ...@@ -323,7 +321,6 @@
<!--View Controller--> <!--View Controller-->
<scene sceneID="kRQ-fB-NKx"> <scene sceneID="kRQ-fB-NKx">
<objects> <objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="uCa-zh-PLh" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController id="HMh-Ba-7X9" sceneMemberID="viewController"> <viewController id="HMh-Ba-7X9" sceneMemberID="viewController">
<view key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="Swz-wK-30Z"> <view key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="Swz-wK-30Z">
<rect key="frame" x="0.0" y="0.0" width="320" height="197"/> <rect key="frame" x="0.0" y="0.0" width="320" height="197"/>
...@@ -369,6 +366,7 @@ ...@@ -369,6 +366,7 @@
</view> </view>
<toolbarItems/> <toolbarItems/>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="uCa-zh-PLh" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="1133" y="272"/> <point key="canvasLocation" x="1133" y="272"/>
</scene> </scene>
...@@ -414,6 +412,8 @@ ...@@ -414,6 +412,8 @@
<relationships> <relationships>
<relationship kind="action" name="nextSlideAction:"/> <relationship kind="action" name="nextSlideAction:"/>
<relationship kind="action" name="previousSlideAction:"/> <relationship kind="action" name="previousSlideAction:"/>
<relationship kind="outlet" name="lecturer_notes" candidateClass="UIWebView"/>
<relationship kind="outlet" name="slideView" candidateClass="UIImageView"/>
</relationships> </relationships>
</class> </class>
</classes> </classes>
...@@ -425,4 +425,4 @@ ...@@ -425,4 +425,4 @@
<inferredMetricsTieBreakers> <inferredMetricsTieBreakers>
<segue reference="geL-Q8-f61"/> <segue reference="geL-Q8-f61"/>
</inferredMetricsTieBreakers> </inferredMetricsTieBreakers>
</document> </document>
\ No newline at end of file
...@@ -52,22 +52,35 @@ ...@@ -52,22 +52,35 @@
self.comManager = [CommunicationManager sharedComManager]; self.comManager = [CommunicationManager sharedComManager];
self.serverTable.dataSource = self; self.serverTable.dataSource = self;
self.serverTable.delegate = self; self.serverTable.delegate = self;
}
- (void) viewDidAppear:(BOOL)animated
{
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
self.pinValidationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_PAIRING_PINVALIDATION self.pinValidationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_PAIRING_PINVALIDATION
object:nil object:nil
queue:mainQueue queue:mainQueue
usingBlock:^(NSNotification *note) { usingBlock:^(NSNotification *note) {
[self performSegueWithIdentifier:@"pinValidation" sender:self ]; [self performSegueWithIdentifier:@"pinValidation" sender:self ];
}]; }];
self.slideShowPreviewStartObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_PAIRING_PAIRED self.slideShowPreviewStartObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_PAIRING_PAIRED
object:nil object:nil
queue:mainQueue queue:mainQueue
usingBlock:^(NSNotification *note) { usingBlock:^(NSNotification *note) {
[self performSegueWithIdentifier:@"SlideShowPreview" sender:self ]; [self performSegueWithIdentifier:@"SlideShowPreview" sender:self ];
}]; }];
[super viewDidAppear:animated];
}
- (void) viewDidDisappear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] removeObserver:self.slideShowPreviewStartObserver];
[[NSNotificationCenter defaultCenter] removeObserver:self.pinValidationObserver];
[super viewDidDisappear:animated];
} }
-(void)viewWillAppear:(BOOL)animated -(void)viewWillAppear:(BOOL)animated
{ {
[self.serverTable reloadData]; [self.serverTable reloadData];
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
@property (nonatomic, weak) UIButton * startButton; @property (nonatomic, weak) UIButton * startButton;
@property (nonatomic, strong) NSArray * optionsArray; @property (nonatomic, strong) NSArray * optionsArray;
@property (nonatomic, strong) CommunicationManager * comManager; @property (nonatomic, strong) CommunicationManager * comManager;
@property (nonatomic, strong) id slideShowStartObserver;
@end @end
@implementation slideShowPreviewTable_vc @implementation slideShowPreviewTable_vc
...@@ -44,6 +46,24 @@ ...@@ -44,6 +46,24 @@
self.optionsArray = [NSArray arrayWithObjects:@"Lecturer's Notes", @"Timer", @"Pointer", nil]; self.optionsArray = [NSArray arrayWithObjects:@"Lecturer's Notes", @"Timer", @"Pointer", nil];
self.comManager = [CommunicationManager sharedComManager]; self.comManager = [CommunicationManager sharedComManager];
self.comManager.delegate = self; self.comManager.delegate = self;
}
- (void) viewDidAppear:(BOOL)animated
{
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
self.slideShowStartObserver = [[NSNotificationCenter defaultCenter] addObserverForName:STATUS_CONNECTED_SLIDESHOW_RUNNING
object:nil
queue:mainQueue
usingBlock:^(NSNotification *note) {
[self.parentViewController performSegueWithIdentifier:@"slideShowSegue" sender:self];
}];
[super viewDidAppear:animated];
}
- (void) viewDidDisappear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] removeObserver:self.slideShowStartObserver];
[super viewDidDisappear:animated];
} }
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
...@@ -118,7 +138,6 @@ ...@@ -118,7 +138,6 @@
-(IBAction)startPresentationAction:(id)sender { -(IBAction)startPresentationAction:(id)sender {
[[self.comManager transmitter] startPresentation]; [[self.comManager transmitter] startPresentation];
[self performSegueWithIdentifier:@"slideShowSegue" sender:self];
} }
- (UIButton *)startButton{ - (UIButton *)startButton{
......
...@@ -12,8 +12,4 @@ ...@@ -12,8 +12,4 @@
@interface slideShowPreview_vc : UITableViewController @interface slideShowPreview_vc : UITableViewController
@property (nonatomic, strong) SlideShow* slideshow;
@property (nonatomic, strong) id slideShowImageReadyObserver;
@property (nonatomic, strong) id slideShowNoteReadyObserver;
@end @end
...@@ -8,19 +8,19 @@ ...@@ -8,19 +8,19 @@
#import "slideShowPreview_vc.h" #import "slideShowPreview_vc.h"
#import "SlideShow.h" #import "SlideShow.h"
#import "CommandInterpreter.h"
#import "CommunicationManager.h" #import "CommunicationManager.h"
@interface slideShowPreview_vc () @interface slideShowPreview_vc ()
@property (nonatomic, strong) CommunicationManager* comManager; @property (nonatomic, strong) CommunicationManager* comManager;
@property (nonatomic, strong) SlideShow* slideshow;
@end @end
@implementation slideShowPreview_vc @implementation slideShowPreview_vc
@synthesize slideshow = _slideshow; @synthesize slideshow = _slideshow;
@synthesize slideShowImageReadyObserver = _slideShowImageReadyObserver;
@synthesize slideShowNoteReadyObserver = _slideShowNoteReadyObserver;
@synthesize comManager = _comManager; @synthesize comManager = _comManager;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
...@@ -36,28 +36,8 @@ ...@@ -36,28 +36,8 @@
{ {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
// NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
// NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
// self.slideShowImageReadyObserver =[center addObserverForName:MSG_SLIDE_CHANGED
// object:nil
// queue:mainQueue
// usingBlock:^(NSNotification *note) {
// NSLog(@"Getting slide: %u image to display: %@", self.slideshow.currentSlide, [self.slideshow getImageAtIndex:self.slideshow.currentSlide]);
//
// [self.image setImage:[self.slideshow getImageAtIndex:self.slideshow.currentSlide]];
// [self.lecturer_notes loadHTMLString: [self.slideshow getNotesAtIndex:self.slideshow.currentSlide]baseURL:nil];
// }];
//
// self.slideShowNoteReadyObserver = [center addObserverForName:STATUS_CONNECTED_NOSLIDESHOW
// object:nil
// queue:mainQueue
// usingBlock:^(NSNotification *note) {
// [self.navigationController popViewControllerAnimated:YES];
// }];
// [self.image setImage:[self.slideshow getImageAtIndex:0]];
self.comManager = [CommunicationManager sharedComManager]; self.comManager = [CommunicationManager sharedComManager];
self.slideshow = [[self.comManager interpreter] slideShow];
} }
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
......
...@@ -13,4 +13,7 @@ ...@@ -13,4 +13,7 @@
- (IBAction)nextSlideAction:(id)sender; - (IBAction)nextSlideAction:(id)sender;
- (IBAction)previousSlideAction:(id)sender; - (IBAction)previousSlideAction:(id)sender;
@property (weak, nonatomic) IBOutlet UIWebView *lecturer_notes;
@property (weak, nonatomic) IBOutlet UIImageView *slideView;
@end @end
...@@ -7,18 +7,26 @@ ...@@ -7,18 +7,26 @@
// //
#import "slideShow_vc.h" #import "slideShow_vc.h"
#import "SlideShow.h"
#import "CommunicationManager.h" #import "CommunicationManager.h"
#import "CommandInterpreter.h"
#import "CommandTransmitter.h" #import "CommandTransmitter.h"
@interface slideShow_vc () @interface slideShow_vc ()
@property (nonatomic, strong) CommunicationManager *comManager; @property (nonatomic, strong) CommunicationManager *comManager;
@property (nonatomic, strong) id slideShowImageNoteReadyObserver;
@property (nonatomic, strong) id slideShowFinishedObserver;
@property (nonatomic, strong) SlideShow* slideshow;
@end @end
@implementation slideShow_vc @implementation slideShow_vc
@synthesize comManager = _comManager; @synthesize comManager = _comManager;
@synthesize slideShowImageNoteReadyObserver = _slideShowImageNoteReadyObserver;
@synthesize slideShowFinishedObserver = _slideShowFinishedObserver;
@synthesize slideshow = _slideshow;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{ {
...@@ -33,8 +41,44 @@ ...@@ -33,8 +41,44 @@
{ {
[super viewDidLoad]; [super viewDidLoad];
self.comManager = [CommunicationManager sharedComManager]; self.comManager = [CommunicationManager sharedComManager];
self.slideshow = [self.comManager.interpreter slideShow];
self.slideshow.delegate = self;
} }
- (void) viewDidAppear:(BOOL)animated
{
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
self.slideShowImageNoteReadyObserver =[center addObserverForName:MSG_SLIDE_CHANGED
object:nil
queue:mainQueue
usingBlock:^(NSNotification *note) {
NSLog(@"Getting slide: %u image to display: %@", self.slideshow.currentSlide, [self.slideshow getImageAtIndex:self.slideshow.currentSlide]);
[self.slideView setImage:[self.slideshow getImageAtIndex:self.slideshow.currentSlide]];
[self.lecturer_notes loadHTMLString: [self.slideshow getNotesAtIndex:self.slideshow.currentSlide]baseURL:nil];
}];
self.slideShowFinishedObserver = [center addObserverForName:STATUS_CONNECTED_NOSLIDESHOW
object:nil
queue:mainQueue
usingBlock:^(NSNotification *note) {
[self.navigationController popViewControllerAnimated:YES];
}];
[super viewDidAppear:animated];
}
- (void) viewDidDisappear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] removeObserver:self.slideShowFinishedObserver];
[[NSNotificationCenter defaultCenter] removeObserver:self.slideShowImageNoteReadyObserver];
[super viewDidDisappear:animated];
}
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
{ {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
...@@ -42,6 +86,8 @@ ...@@ -42,6 +86,8 @@
} }
- (void)viewDidUnload { - (void)viewDidUnload {
[self setLecturer_notes:nil];
[self setSlideView:nil];
[super viewDidUnload]; [super viewDidUnload];
} }
......
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