diff --git a/contrib/mobile/iOS/Onelab/AboutViewController.mm b/contrib/mobile/iOS/Onelab/AboutViewController.mm index 5091e2359a54f2aee1e2cdc9fe5a20cc6696c211..f68b1f6eadfd3e93e883d20fc064901ab2b2c8b4 100644 --- a/contrib/mobile/iOS/Onelab/AboutViewController.mm +++ b/contrib/mobile/iOS/Onelab/AboutViewController.mm @@ -36,7 +36,22 @@ self.aboutView.delegate = self; self.aboutView.dataDetectorTypes = UIDataDetectorTypeNone; - if(self.fileToEdit){ + if([self.fileToEdit isEqual:@"About"]){ + [self.aboutView loadHTMLString:[NSString stringWithFormat:@"<html><head><style type=\"text/css\">body { background-color: #FFFFFF; color: #252525; margin: 35px 10px 35px 10px; padding: 0; font-family: helvetica-neue,sans-serif; font-size: 1em; }</style></head><body><center><p><!-- img width=32 src=\"icon_onelab.png\"--></p><h3>Onelab/Mobile</h3>Version %@<p>Copyright (C) 2014-2016 Christophe Geuzaine and Maxime Graulich, University of Liège</p><p>Visit <a href=\"http://onelab.info/\">http://onelab.info/</a> for more information</p><p style=\"padding-top: 35px;\">This version of Onelab/Mobile contains:</p><h3>Gmsh</h3>Version %s (<i>Build date:</i> %s)<p>Copyright (C) 1997-2016 Christophe Geuzaine and Jean-François Remacle</p><p><a href=\"http://geuz.org/gmsh/doc/CREDITS.txt\">Credits</a> and <a href=\"http://geuz.org/gmsh/doc/LICENSE.txt\">licensing information</a></p><p><i>Build options:</i> %s</p><p>Visit <a href=\"http://gmsh.info/\">http://gmsh.info</a> for more information</p><h3>GetDP</h3>Version %s (<i>Build date:</i> %s)<p>Copyright (C) 1997-2016 Patrick Dular and Christophe Geuzaine, University of Liège</p><p><a href=\"http://geuz.org/getdp/doc/CREDITS.txt\">Credits</a> and <a href=\"http://geuz.org/getdp/doc/LICENSE.txt\">licensing information</a></p><p><i>Build options:</i> %s</p><p>Visit <a href=\"http://getdp.info\">http://getdp.info</a> for more information</p></center></body></html>", + [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], + GMSH_VERSION, + GMSH_DATE, + GMSH_CONFIG_OPTIONS, + GETDP_VERSION, + GETDP_DATE, + GETDP_CONFIG_OPTIONS] + baseURL:[[NSBundle mainBundle] bundleURL]]; + } + else if([self.fileToEdit isEqual:@"Help"]){ + [self.aboutView loadHTMLString:@"<html><head><style type=\"text/css\">body { background-color: #FFFFFF; color: #252525; margin: 35px 10px 35px 10px; padding: 0; font-family: helvetica-neue,sans-serif; font-size: 1em; } h3 { text-align: center; } b { font-weight: normal; color: rgb(0,122,255); }</style></head><!-- img width=32 src=\"icon_onelab.png\"--><h3>Onelab/Mobile</h3> <h4>Running an existing model</h4> <p> The list of available models appears when you launch the app. Selecting a model will load it. You can then press <b>Run</b> to launch a simulation with the default set of parameters. When available, additional information about a model can be obtained by long-pressing on the model descrition and selecting <b>Visit model website</b>.</p> <h4>Modifying a model</h4> <p>To run a model with different parameters, press <b>Parameters</b> and modify any of the presets. Then press <b>Run</b> again: all the simulation steps will be performed with the new parameter values. To restore the preset parameters values, press <b>Reset</b>. </p> <p> Advanced users can also directly edit the model input files: long-press on the model description and select <b>Edit model files</b>. </p> <p> To free up space, temporary model files (meshes, solution files) can be removed by long-pressing on the model description and selecting <b>Clear results</b>. </p> <p> To completey remove a model, long-press on the model description and select <b>Remove</b>. </p> <h4>Sharing a model</h4> <p> To share a model by email, long-press on the model description and select <b>Email model files</b>. </p> <h4>Installing a new model</h4> <p> To install a new model: <ol> <li>Put all the model files (.pro, .geo) in a directory, which should also contain a file named <code>infos.xml</code> with the model information: <pre>\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<models>\n <model>\n <title>Model title</title>\n <summary>Model summary</summary>\n <file type=\"pro\">main_pro_file.pro</file>\n <preview type=\"png\">128x128_pixel_screenshot.png</preview>\n <url>http://model_website.com</url>\n </model>\n</models>\n</pre><li>Zip the directory. <li>Open the .zip file on your device, e.g. through iCloud or by emailing it to yourself and opening the attachment; or by putting it on a web server and downloading the file on the device with Safari. <li>Refresh the list of models: the new model will be extracted alongside Onelab/Mobile\'s built-in models.</ol> <p style=\"padding-top: 2em;\">Visit <a href=\"http://onelab.info/\">http://onelab.info/</a> for more information.</p> </body></html>" + baseURL:[[NSBundle mainBundle] bundleURL]]; + } + else{ NSData *fileData = [NSData dataWithContentsOfFile:self.fileToEdit]; NSString* aStr = [[NSString alloc] initWithData:fileData encoding:NSUTF8StringEncoding]; if(!aStr) aStr = [[NSString alloc] initWithData:fileData encoding:NSASCIIStringEncoding]; @@ -46,25 +61,13 @@ aStr = [aStr stringByReplacingOccurrencesOfString:@">" withString:@">"]; } - // custom microlight.js for basic syntax highlighting const char *js = "!function(a,b){\"function\"==typeof define&&define.amd?define([\"exports\"],b):b(\"undefined\"!=typeof exports?exports:a.microlight={})}(this,function(a){var k,l,m,b=window,c=document,d=\"appendChild\",e=\"test\",g=\"opacity:.\",n=function(a){for(l=c.getElementsByClassName(a||\"microlight\"),k=0;m=l[k++];){var n,o,r,s,t,f=m.textContent,h=0,i=f[0],j=1,p=m.innerHTML=\"\",q=0,u=/(\\d*\\, \\d*\\, \\d*)(, ([.\\d]*))?/g.exec(b.getComputedStyle(m).color);for(\"px rgba(\"+u[1]+\",\",u[3]||1;o=n,n=q<7&&\"\\\\\"==n?1:j;){if(j=i,i=f[++h],s=p.length>1,!j||q>8&&\"\\n\"==j||[/\\S/[e](j),1,1,!/[$\\w]/[e](j),(\"/\"==n||\"\\n\"==n)&&s,\'\"\'==n&&s,\"\'\"==n&&s,f[h-4]+o+n==\"-->\",o+n==\"*/\"][q])for(p&&(m[d](t=c.createElement(\"span\")).setAttribute(\"style\",[\"\",\"font-weight:bold;color:#00c;\",g+6,\"color: #a08;\"+g+8,\"font-style:italic;color: #b00;\"+g+8][q?q<3?2:q>6?4:q>3?3:+/^(If|Else|ElseIf|EndIf|Include|For|EndFor|Include|Macro|Return)$/[e](p):0]),t[d](c.createTextNode(p))),r=q&&q<7?q:r,p=\"\",q=11;![1,/[\\/{}[(\\-+*=<>:;|\\\\.,?!&@~]/[e](j),/[\\])]/[e](j),/[$\\w]/[e](j),\"/\"==j&&r<2&&\"<\"!=n,\'\"\'==j,\"\'\"==j,j+i+f[h+1]+f[h+2]==\"<!--\",j+i==\"/*\",j+i==\"//\",j+i==\"//\"][--q];);p+=j}}};a.reset=n,\"complete\"==c.readyState?n():b.addEventListener(\"load\",function(){n()},0)});"; - [self.aboutView loadHTMLString:[NSString stringWithFormat:@"<html><head><script>%s</script></head><body><pre contenteditable=\"true\" class=microlight>%@</pre></body></html>", js, aStr] baseURL:[[NSBundle mainBundle] bundleURL]]; UIBarButtonItem *save = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(saveFile)]; [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects: save, nil]]; } - else{ - [self.aboutView loadHTMLString:[NSString stringWithFormat:@"<html><head><style type=\"text/css\"><!--body { background-color: #FFFFFF; color: #252525; margin: 35px 10px 35px 10px; padding: 0; font-family: helvetica-neue,sans-serif; font-size: 1em; }--></style></head><body><center><p><!--img width=32 src=\"icon_onelab.png\"--></p><h3>Onelab/Mobile</h3>Version %@<p>Copyright (C) 2014-2016 Christophe Geuzaine and Maxime Graulich, University of Liège</p><p>Visit <a href=\"http://onelab.info/\">http://onelab.info/</a> for more information</p><p style=\"padding-top: 35px;\">This version of Onelab/Mobile contains:</p><h3>Gmsh</h3>Version %s (<i>Build date:</i> %s)<p>Copyright (C) 1997-2016 Christophe Geuzaine and Jean-François Remacle</p><p><a href=\"http://geuz.org/gmsh/doc/CREDITS.txt\">Credits</a> and <a href=\"http://geuz.org/gmsh/doc/LICENSE.txt\">licensing information</a></p><p><i>Build options:</i> %s</p><p>Visit <a href=\"http://gmsh.info/\">http://gmsh.info</a> for more information</p><h3>GetDP</h3>Version %s (<i>Build date:</i> %s)<p>Copyright (C) 1997-2016 Patrick Dular and Christophe Geuzaine, University of Liège</p><p><a href=\"http://geuz.org/getdp/doc/CREDITS.txt\">Credits</a> and <a href=\"http://geuz.org/getdp/doc/LICENSE.txt\">licensing information</a></p><p><i>Build options:</i> %s</p><p>Visit <a href=\"http://getdp.info\">http://getdp.info</a> for more information</p></center></body>", - [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], - GMSH_VERSION, - GMSH_DATE, - GMSH_CONFIG_OPTIONS, - GETDP_VERSION, - GETDP_DATE, - GETDP_CONFIG_OPTIONS] - baseURL:[[NSBundle mainBundle] bundleURL]]; - } + } -(void)saveFile diff --git a/contrib/mobile/iOS/Onelab/ModelListController.mm b/contrib/mobile/iOS/Onelab/ModelListController.mm index a4f7695a6dba1b2825e6cd5ff1bf14c1755caa33..1a0881d960d7c24110f22c97652b19ee05b9acaa 100644 --- a/contrib/mobile/iOS/Onelab/ModelListController.mm +++ b/contrib/mobile/iOS/Onelab/ModelListController.mm @@ -41,11 +41,24 @@ target:self action:@selector(showAbout)]; [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects: about, nil]]; + + UIBarButtonItem *help = + [[UIBarButtonItem alloc] initWithTitle:@"Help" + style:UIBarButtonItemStylePlain + target:self + action:@selector(showHelp)]; + [self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects: help, nil]]; } -(void)showAbout { - currentFileToEdit = nil; + currentFileToEdit = @"About"; + [self performSegueWithIdentifier:@"showAboutSegue" sender:self]; +} + +-(void)showHelp +{ + currentFileToEdit = @"Help"; [self performSegueWithIdentifier:@"showAboutSegue" sender:self]; } diff --git a/contrib/mobile/iOS/Onelab/Onelab-Info.plist b/contrib/mobile/iOS/Onelab/Onelab-Info.plist index 92cf778a0d820d3482e69ab8d3fc9a273779c10b..427fcd566b56628b6abe5aac383e97cec704d3bc 100644 --- a/contrib/mobile/iOS/Onelab/Onelab-Info.plist +++ b/contrib/mobile/iOS/Onelab/Onelab-Info.plist @@ -39,7 +39,7 @@ <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>1.3.2.1</string> + <string>1.3.2.7</string> <key>LSRequiresIPhoneOS</key> <true/> <key>UIFileSharingEnabled</key>