Skip to content
Snippets Groups Projects
Commit a831aa9f authored by Maxime Graulich's avatar Maxime Graulich
Browse files

iOS: show progress informations

parent 73aa5e91
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
@property (nonatomic, retain) EAGLView *glView; @property (nonatomic, retain) EAGLView *glView;
@property (strong, nonatomic) id detailItem; @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; @property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
......
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
-(void)viewDidAppear:(BOOL)animated -(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 ); _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){ if(self.initialModel != nil){
UIAlertView* progressAlert = [[UIAlertView alloc] initWithTitle:@"Please wait..." message: @"The model is loading" delegate: self cancelButtonTitle: nil otherButtonTitles: nil]; UIAlertView* progressAlert = [[UIAlertView alloc] initWithTitle:@"Please wait..." message: @"The model is loading" delegate: self cancelButtonTitle: nil otherButtonTitles: nil];
[progressAlert show]; [progressAlert show];
...@@ -79,12 +83,18 @@ ...@@ -79,12 +83,18 @@
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation - (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 ); _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 - (void)compute
{ {
[_runStopButton addTarget:self action:@selector(stop) forControlEvents:UIControlEventTouchDown]; [_runStopButton addTarget:self action:@selector(stop) forControlEvents:UIControlEventTouchDown];
[_runStopButton setTitle:@"Stop" forState:UIControlStateNormal]; [_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), ^{ dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
appDelegate->compute = YES; appDelegate->compute = YES;
...@@ -102,6 +112,9 @@ ...@@ -102,6 +112,9 @@
{ {
[_runStopButton addTarget:self action:@selector(compute) forControlEvents:UIControlEventTouchDown]; [_runStopButton addTarget:self action:@selector(compute) forControlEvents:UIControlEventTouchDown];
[_runStopButton setTitle:@"Run" forState:UIControlStateNormal]; [_runStopButton setTitle:@"Run" forState:UIControlStateNormal];
[_progressLabel setHidden:YES];
[_progressIndicator stopAnimating];
[_progressIndicator setHidden:YES];
} }
- (void)stop - (void)stop
{ {
...@@ -189,6 +202,8 @@ ...@@ -189,6 +202,8 @@
{ {
[self setGlView:nil]; [self setGlView:nil];
[self setRunStopButton:nil]; [self setRunStopButton:nil];
[self setProgressLabel:nil];
[self setProgressIndicator:nil];
[super viewDidUnload]; [super viewDidUnload];
// Release any retained subviews of the main view. // Release any retained subviews of the main view.
} }
...@@ -261,9 +276,16 @@ void messageFromCpp (void *self, std::string level, std::string msg) ...@@ -261,9 +276,16 @@ void messageFromCpp (void *self, std::string level, std::string msg)
[(__bridge id)self requestRender]; [(__bridge id)self requestRender];
[[NSNotificationCenter defaultCenter] postNotificationName:@"refreshParameters" object:nil]; [[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") else if(level == "Error")
[(__bridge id)self showAlert:msg title:level]; [(__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) 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]; [(__bridge id)self getBitmapFromStringObjC:text withTextSize:textsize inMap:map inHeight:height inWidth:width inRealWidth:realWidth];
......
...@@ -46,6 +46,17 @@ ...@@ -46,6 +46,17 @@
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
</button> </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> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/> <simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/>
...@@ -58,6 +69,8 @@ ...@@ -58,6 +69,8 @@
<navigationItem key="navigationItem" title="ONELAB" id="53"/> <navigationItem key="navigationItem" title="ONELAB" id="53"/>
<connections> <connections>
<outlet property="glView" destination="26" id="i7d-I7-Zhz"/> <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"/> <outlet property="runStopButton" destination="RAk-ub-gte" id="OAy-FP-40z"/>
</connections> </connections>
</viewController> </viewController>
...@@ -293,38 +306,6 @@ ...@@ -293,38 +306,6 @@
<point key="canvasLocation" x="336" y="340"/> <point key="canvasLocation" x="336" y="340"/>
</scene> </scene>
</scenes> </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"> <simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/> <simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/>
<simulatedOrientationMetrics key="orientation"/> <simulatedOrientationMetrics key="orientation"/>
......
...@@ -55,12 +55,28 @@ ...@@ -55,12 +55,28 @@
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state> </state>
</button> </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> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<gestureRecognizers/> <gestureRecognizers/>
<constraints> <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 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 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> </constraints>
<connections> <connections>
<outletCollection property="gestureRecognizers" destination="7R3-zZ-cpa" appends="YES" id="K8X-lL-YUb"/> <outletCollection property="gestureRecognizers" destination="7R3-zZ-cpa" appends="YES" id="K8X-lL-YUb"/>
...@@ -70,6 +86,8 @@ ...@@ -70,6 +86,8 @@
<navigationItem key="navigationItem" title="ONELAB" id="WX3-lU-bHf"/> <navigationItem key="navigationItem" title="ONELAB" id="WX3-lU-bHf"/>
<connections> <connections>
<outlet property="glView" destination="zrj-Dd-WPc" id="sIP-YC-fg2"/> <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"/> <outlet property="runStopButton" destination="ljM-5L-gYy" id="igr-iL-gpM"/>
<segue destination="0h7-h3-thM" kind="push" identifier="showSettingsSegue" id="cJz-7s-fgZ"/> <segue destination="0h7-h3-thM" kind="push" identifier="showSettingsSegue" id="cJz-7s-fgZ"/>
</connections> </connections>
...@@ -248,41 +266,6 @@ ...@@ -248,41 +266,6 @@
<point key="canvasLocation" x="1596" y="160"/> <point key="canvasLocation" x="1596" y="160"/>
</scene> </scene>
</scenes> </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"> <simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/> <simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/> <simulatedOrientationMetrics key="orientation"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment