diff --git a/contrib/mobile/iOS/Onelab/ModelViewController.h b/contrib/mobile/iOS/Onelab/ModelViewController.h index 3b9c7d28d0ef5a9f0e028b058ee3207f4ac018bb..af6332be948658e2fd2567c51f2d9ac07cbc0442 100644 --- a/contrib/mobile/iOS/Onelab/ModelViewController.h +++ b/contrib/mobile/iOS/Onelab/ModelViewController.h @@ -20,7 +20,9 @@ @property (nonatomic, retain) EAGLView *glView; @property (strong, nonatomic) id detailItem; -@property (weak, nonatomic) IBOutlet UIButton *runStopButton; +@property (strong, nonatomic) IBOutlet UIButton *runStopButton; +@property (weak, nonatomic) IBOutlet UILabel *progressLabel; +@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *progressIndicator; @property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel; diff --git a/contrib/mobile/iOS/Onelab/ModelViewController.mm b/contrib/mobile/iOS/Onelab/ModelViewController.mm index af065d8885bf6f54293205c4eb531ea1235086b0..77dc3c74ab2cfb3c00141d5f5e9d316f423f375f 100644 --- a/contrib/mobile/iOS/Onelab/ModelViewController.mm +++ b/contrib/mobile/iOS/Onelab/ModelViewController.mm @@ -46,6 +46,10 @@ -(void)viewDidAppear:(BOOL)animated { _runStopButton.frame = CGRectMake(self.view.frame.size.width - _runStopButton.frame.size.width - 7, 50, _runStopButton.frame.size.width, _runStopButton.frame.size.height ); + _progressLabel.frame = CGRectMake(50, self.view.frame.size.height - 25, _progressLabel.frame.size.width, _progressLabel.frame.size.height); + _progressIndicator.frame = CGRectMake(20, self.view.frame.size.height - 25, _progressIndicator.frame.size.width, _progressIndicator.frame.size.height); + [_progressLabel setHidden:YES]; + [_progressIndicator setHidden:YES]; if(self.initialModel != nil){ UIAlertView* progressAlert = [[UIAlertView alloc] initWithTitle:@"Please wait..." message: @"The model is loading" delegate: self cancelButtonTitle: nil otherButtonTitles: nil]; [progressAlert show]; @@ -79,12 +83,18 @@ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { _runStopButton.frame = CGRectMake(self.view.frame.size.width - _runStopButton.frame.size.width - 7, 50, _runStopButton.frame.size.width, _runStopButton.frame.size.height ); + _progressLabel.frame = CGRectMake(50, self.view.frame.size.height - 25, _progressLabel.frame.size.width, _progressLabel.frame.size.height); + _progressIndicator.frame = CGRectMake(20, self.view.frame.size.height - 25, _progressIndicator.frame.size.width, _progressIndicator.frame.size.height); } - (void)compute { [_runStopButton addTarget:self action:@selector(stop) forControlEvents:UIControlEventTouchDown]; [_runStopButton setTitle:@"Stop" forState:UIControlStateNormal]; + [_progressLabel setText:@""]; + [_progressLabel setHidden:NO]; + [_progressIndicator setHidden:NO]; + [_progressIndicator startAnimating]; dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; appDelegate->compute = YES; @@ -102,6 +112,9 @@ { [_runStopButton addTarget:self action:@selector(compute) forControlEvents:UIControlEventTouchDown]; [_runStopButton setTitle:@"Run" forState:UIControlStateNormal]; + [_progressLabel setHidden:YES]; + [_progressIndicator stopAnimating]; + [_progressIndicator setHidden:YES]; } - (void)stop { @@ -189,6 +202,8 @@ { [self setGlView:nil]; [self setRunStopButton:nil]; + [self setProgressLabel:nil]; + [self setProgressIndicator:nil]; [super viewDidUnload]; // Release any retained subviews of the main view. } @@ -261,9 +276,16 @@ void messageFromCpp (void *self, std::string level, std::string msg) [(__bridge id)self requestRender]; [[NSNotificationCenter defaultCenter] postNotificationName:@"refreshParameters" object:nil]; } + else if(level == "Progress"){ + [(__bridge id)self performSelectorOnMainThread:@selector(setProgress:) withObject:[NSString stringWithCString:msg.c_str() encoding:[NSString defaultCStringEncoding]] waitUntilDone:YES]; + } else if(level == "Error") [(__bridge id)self showAlert:msg title:level]; } +-(void)setProgress:(NSString *)progress +{ + [_progressLabel setText:progress]; +} void getBitmap(void *self, const char *text, int textsize, unsigned char **map, int *height, int *width, int *realWidth) { [(__bridge id)self getBitmapFromStringObjC:text withTextSize:textsize inMap:map inHeight:height inWidth:width inRealWidth:realWidth]; diff --git a/contrib/mobile/iOS/Onelab/en.lproj/iPadStoryboard.storyboard b/contrib/mobile/iOS/Onelab/en.lproj/iPadStoryboard.storyboard index 913933205f2a319c2bd646755e44eec6e9a1bb2f..6fe26e001493813a674143326ccfce674c711866 100644 --- a/contrib/mobile/iOS/Onelab/en.lproj/iPadStoryboard.storyboard +++ b/contrib/mobile/iOS/Onelab/en.lproj/iPadStoryboard.storyboard @@ -46,6 +46,17 @@ <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> </state> </button> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HN2-fw-mfe"> + <rect key="frame" x="47" y="707" width="636" height="21"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + <activityIndicatorView opaque="NO" contentMode="scaleToFill" style="gray" id="BfX-qT-0mL"> + <rect key="frame" x="20" y="708" width="20" height="20"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + </activityIndicatorView> </subviews> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/> @@ -58,6 +69,8 @@ <navigationItem key="navigationItem" title="ONELAB" id="53"/> <connections> <outlet property="glView" destination="26" id="i7d-I7-Zhz"/> + <outlet property="progressIndicator" destination="BfX-qT-0mL" id="O9E-Bm-5zQ"/> + <outlet property="progressLabel" destination="HN2-fw-mfe" id="s62-5y-B7S"/> <outlet property="runStopButton" destination="RAk-ub-gte" id="OAy-FP-40z"/> </connections> </viewController> @@ -293,38 +306,6 @@ <point key="canvasLocation" x="336" y="340"/> </scene> </scenes> - <classes> - <class className="EAGLView" superclassName="UIView"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/EAGLView.h"/> - </class> - <class className="ModelListController" superclassName="UITableViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/ModelListController.h"/> - </class> - <class className="ModelViewController" superclassName="UIViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/ModelViewController.h"/> - <relationships> - <relationship kind="action" name="pinch:" candidateClass="UIPinchGestureRecognizer"/> - <relationship kind="action" name="tap:" candidateClass="UITapGestureRecognizer"/> - <relationship kind="outlet" name="detailDescriptionLabel" candidateClass="UILabel"/> - <relationship kind="outlet" name="runStopButton" candidateClass="UIButton"/> - </relationships> - </class> - <class className="ParametersViewController" superclassName="UITableViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/ParametersViewController.h"/> - </class> - <class className="PostProcessingViewController" superclassName="UIViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/PostProcessingViewController.h"/> - <relationships> - <relationship kind="outlet" name="Intervals" candidateClass="UITextField"/> - <relationship kind="outlet" name="IntervalsType" candidateClass="UIPickerView"/> - <relationship kind="outlet" name="Name" candidateClass="UILabel"/> - <relationship kind="outlet" name="RaiseZ" candidateClass="UISlider"/> - </relationships> - </class> - <class className="SplitViewController" superclassName="UISplitViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/SplitViewController.h"/> - </class> - </classes> <simulatedMetricsContainer key="defaultSimulatedMetrics"> <simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/> <simulatedOrientationMetrics key="orientation"/> diff --git a/contrib/mobile/iOS/Onelab/en.lproj/iPhoneiPodStoryboard.storyboard b/contrib/mobile/iOS/Onelab/en.lproj/iPhoneiPodStoryboard.storyboard index 8a6f70b04f37a93984e598180684ee32e466e2c1..0199d697b3abe9fecd87cd07edfe9e7f7a94b78e 100644 --- a/contrib/mobile/iOS/Onelab/en.lproj/iPhoneiPodStoryboard.storyboard +++ b/contrib/mobile/iOS/Onelab/en.lproj/iPhoneiPodStoryboard.storyboard @@ -55,12 +55,28 @@ <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> </state> </button> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yT7-IR-qUJ"> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + <activityIndicatorView opaque="NO" contentMode="scaleToFill" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="Fuh-zG-zVR"> + <constraints> + <constraint firstAttribute="width" constant="20" id="f9c-ZY-6q4"/> + </constraints> + </activityIndicatorView> </subviews> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <gestureRecognizers/> <constraints> + <constraint firstAttribute="trailing" secondItem="yT7-IR-qUJ" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="02X-Hf-QoA"/> <constraint firstItem="ljM-5L-gYy" firstAttribute="top" secondItem="zrj-Dd-WPc" secondAttribute="top" constant="20" symbolic="YES" type="default" id="1wx-mM-ycN"/> + <constraint firstAttribute="bottom" secondItem="yT7-IR-qUJ" secondAttribute="bottom" constant="20" symbolic="YES" type="default" id="4by-pW-cH0"/> + <constraint firstItem="Fuh-zG-zVR" firstAttribute="centerY" secondItem="yT7-IR-qUJ" secondAttribute="centerY" type="default" id="BLC-3x-kRj"/> + <constraint firstItem="Fuh-zG-zVR" firstAttribute="top" secondItem="yT7-IR-qUJ" secondAttribute="top" type="default" id="REs-y3-luE"/> <constraint firstAttribute="trailing" secondItem="ljM-5L-gYy" secondAttribute="trailing" constant="20" symbolic="YES" type="default" id="Yxs-PL-axJ"/> + <constraint firstItem="yT7-IR-qUJ" firstAttribute="leading" secondItem="Fuh-zG-zVR" secondAttribute="trailing" constant="8" symbolic="YES" type="default" id="oc4-6x-CF7"/> + <constraint firstItem="Fuh-zG-zVR" firstAttribute="leading" secondItem="zrj-Dd-WPc" secondAttribute="leading" constant="20" symbolic="YES" type="default" id="qfh-y2-BuW"/> </constraints> <connections> <outletCollection property="gestureRecognizers" destination="7R3-zZ-cpa" appends="YES" id="K8X-lL-YUb"/> @@ -70,6 +86,8 @@ <navigationItem key="navigationItem" title="ONELAB" id="WX3-lU-bHf"/> <connections> <outlet property="glView" destination="zrj-Dd-WPc" id="sIP-YC-fg2"/> + <outlet property="progressIndicator" destination="Fuh-zG-zVR" id="ifr-7g-7Dv"/> + <outlet property="progressLabel" destination="yT7-IR-qUJ" id="onn-gw-Mnv"/> <outlet property="runStopButton" destination="ljM-5L-gYy" id="igr-iL-gpM"/> <segue destination="0h7-h3-thM" kind="push" identifier="showSettingsSegue" id="cJz-7s-fgZ"/> </connections> @@ -248,41 +266,6 @@ <point key="canvasLocation" x="1596" y="160"/> </scene> </scenes> - <classes> - <class className="EAGLView" superclassName="UIView"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/EAGLView.h"/> - </class> - <class className="ModelListController" superclassName="UITableViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/ModelListController.h"/> - </class> - <class className="ModelViewController" superclassName="UIViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/ModelViewController.h"/> - <relationships> - <relationship kind="action" name="pinch:" candidateClass="UIPinchGestureRecognizer"/> - <relationship kind="action" name="tap:" candidateClass="UITapGestureRecognizer"/> - <relationship kind="outlet" name="detailDescriptionLabel" candidateClass="UILabel"/> - <relationship kind="outlet" name="runStopButton" candidateClass="UIButton"/> - </relationships> - </class> - <class className="NSLayoutConstraint" superclassName="NSObject"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/NSLayoutConstraint.h"/> - </class> - <class className="OptionsViewController" superclassName="UITableViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/OptionsViewController.h"/> - </class> - <class className="ParametersViewController" superclassName="UITableViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/ParametersViewController.h"/> - </class> - <class className="PostProcessingViewController" superclassName="UIViewController"> - <source key="sourceIdentifier" type="project" relativePath="./Classes/PostProcessingViewController.h"/> - <relationships> - <relationship kind="outlet" name="Intervals" candidateClass="UITextField"/> - <relationship kind="outlet" name="IntervalsType" candidateClass="UIPickerView"/> - <relationship kind="outlet" name="Name" candidateClass="UILabel"/> - <relationship kind="outlet" name="RaiseZ" candidateClass="UISlider"/> - </relationships> - </class> - </classes> <simulatedMetricsContainer key="defaultSimulatedMetrics"> <simulatedStatusBarMetrics key="statusBar"/> <simulatedOrientationMetrics key="orientation"/>