Typica is a free program for professional coffee roasters. https://typica.us
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

export.xml 40KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. <window id="exportWindow">
  2. <layout type="vertical">
  3. <layout type="horizontal">
  4. <label>Title:</label>
  5. <line id="title" />
  6. </layout>
  7. <layout type="horizontal">
  8. <label>Subtitle:</label>
  9. <line id="subtitle" />
  10. </layout>
  11. <layout type="horizontal">
  12. <label>% weight loss:</label>
  13. <line id="loss" validator="numeric" />
  14. <label>Tolerance:</label>
  15. <line id="tolerance" validator="numeric" />
  16. </layout>
  17. <layout type="horizontal">
  18. <label>Additional notes:</label>
  19. <line id="notes" />
  20. </layout>
  21. <layout type="horizontal">
  22. <label>Measurement column:</label>
  23. <line id="addmeasurement" validator="integer" />
  24. <button name="Add column" type="push" id="ambutton" />
  25. <line id="mcols" writable="false" />
  26. </layout>
  27. <layout type="horizontal">
  28. <label>Annotation column:</label>
  29. <line id="addnote" validator="integer" />
  30. <button name="Add column" type="push" id="anbutton" />
  31. <line id="ncols" writable="false" />
  32. </layout>
  33. <button name="Export" type="push" id="export" />
  34. </layout>
  35. <program>
  36. <![CDATA[
  37. var window = this;
  38. var exportButton = findChildObject(this, 'export');
  39. exportButton.enable = false;
  40. var mcoldisp = findChildObject(this, 'mcols');
  41. mcoldisp.enable = false;
  42. var ncoldisp = findChildObject(this, 'ncols');
  43. ncoldisp.enable = false;
  44. var mbutton = findChildObject(this, 'ambutton');
  45. var msource = findChildObject(this, 'addmeasurement');
  46. var mdest = findChildObject(this, 'mcols');
  47. mbutton.clicked.connect(function() {
  48. if(window.marray === undefined)
  49. {
  50. window.marray = new Array();
  51. }
  52. window.marray.push(Number(msource.text));
  53. mdest.text = window.marray.toString();
  54. msource.text = '';
  55. if(window.narray === undefined)
  56. {} else { exportButton.enable = true;}
  57. });
  58. var abutton = findChildObject(window, 'anbutton');
  59. var asource = findChildObject(window, 'addnote');
  60. var adest = findChildObject(window, 'ncols');
  61. abutton.clicked.connect(function() {
  62. if(window.narray === undefined)
  63. {
  64. window.narray = new Array();
  65. }
  66. window.narray.push(Number(asource.text));
  67. adest.text = window.narray.toString();
  68. asource.text = '';
  69. if(window.marray === undefined)
  70. { } else { exportButton.enable = true;}
  71. });
  72. var titleField = findChildObject(window, 'title');
  73. var subTitleField = findChildObject(window, 'subtitle');
  74. exportButton.clicked.connect(function() {
  75. var filename = QFileDialog.getSaveFileName(window, TTR("exportWindow", "Export XHTML+SVG As..."), QSettings.value("script/lastDir", "") + "/");
  76. if(filename != "")
  77. {
  78. window.log.clearOutputColumns();
  79. for(var i = 0; i < window.marray.length; i++)
  80. {
  81. window.log.addOutputTemperatureColumn(window.marray[i]);
  82. }
  83. for(var i = 0; i < window.narray.length; i++)
  84. {
  85. window.log.addOutputAnnotationColumn(window.narray[i]);
  86. }
  87. var unitdesc = log.displayUnits();
  88. if(unitdesc != 10144)
  89. {
  90. log.setDisplayUnits(10144);
  91. }
  92. var tempFilename = log.saveTemporary();
  93. log.setDisplayUnits(unitdesc);
  94. var sourceFile = new QFile(tempFilename);
  95. sourceFile.open(3);
  96. var destFile = new QFile(filename);
  97. destFile.remove();
  98. destFile.open(3);
  99. var input = new XmlReader(sourceFile);
  100. var output = new XmlWriter(destFile);
  101. output.writeStartDocument("1.0");
  102. output.writeDTD('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg.dtd">');
  103. output.writeStartElement("html");
  104. output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
  105. output.writeStartElement("head");
  106. output.writeStartElement("title");
  107. output.writeCDATA(titleField.text);
  108. output.writeEndElement();
  109. output.writeEndElement();
  110. output.writeStartElement("body");
  111. output.writeStartElement("h1");
  112. output.writeAttribute("style", "font-size:100%;font-weight:bold");
  113. output.writeCDATA(titleField.text);
  114. output.writeEndElement();
  115. output.writeStartElement("h2");
  116. output.writeAttribute("style", "font-size:100%;font-weight:normal");
  117. output.writeCDATA(subTitleField.text);
  118. output.writeEndElement();
  119. output.writeStartElement("div");
  120. output.writeAttribute("style", "width:7.5in");
  121. output.writeStartElement("div");
  122. output.writeAttribute("style", "float:left;width:2.5in");
  123. output.writeStartElement("table");
  124. output.writeStartElement("tr");
  125. output.writeStartElement("th");
  126. output.writeCDATA("Time");
  127. output.writeEndElement();
  128. input.readNext();
  129. var colMap = new Array();
  130. var tempMap = new Array();
  131. while(input.name() != "roast")
  132. {
  133. if(input.isStartElement())
  134. {
  135. if(input.name() == "tempseries")
  136. {
  137. colMap.push(input.attribute("name"));
  138. tempMap.push(input.attribute("name"));
  139. }
  140. if(input.name() == "noteseries")
  141. {
  142. colMap.push(input.attribute("name"));
  143. }
  144. }
  145. input.readNext();
  146. }
  147. print("Column definitions read");
  148. for(var i = 0; i < colMap.length; i++)
  149. {
  150. output.writeStartElement("th");
  151. output.writeCDATA(colMap[i]);
  152. output.writeEndElement();
  153. }
  154. print("Column headers output");
  155. output.writeEndElement();
  156. var rowBuffer = new Array();
  157. var nextTime = 0;
  158. input.readNext();
  159. var inputReady = false;
  160. var annotationRead = false;
  161. var tm = 0;
  162. var ts = 0;
  163. while(!input.atEnd())
  164. {
  165. if(input.isStartElement())
  166. {
  167. if(input.name() == "time")
  168. {
  169. rowBuffer[0] = input.readElementText();
  170. inputReady = true;
  171. }
  172. if(input.name() == "temperature")
  173. {
  174. for (var i = 0; i < colMap.length; i++)
  175. {
  176. if(colMap[i] == input.attribute("series"))
  177. {
  178. if(log.displayUnits() == 10143)
  179. {
  180. rowBuffer[i + 1] = Math.floor((input.readElementText() - 32) * 5 / 9);
  181. }
  182. else
  183. {
  184. rowBuffer[i + 1] = Math.floor(input.readElementText());
  185. }
  186. break;
  187. }
  188. }
  189. }
  190. if(input.name() == "annotation")
  191. {
  192. for (var i = 0; i < colMap.length; i++)
  193. {
  194. if(colMap[i] == input.attribute("series"))
  195. {
  196. rowBuffer[i + 1] = input.readElementText();
  197. break;
  198. }
  199. }
  200. annotationRead = true;
  201. }
  202. if(input.name() == "tuple")
  203. {
  204. if(inputReady)
  205. {
  206. var ta1 = rowBuffer[0].split(":");
  207. var ta2 = ta1[1].split(".");
  208. if(Number(ta1[0]) == tm)
  209. {
  210. if(Number(ta2[0]) == ts)
  211. {
  212. annotationRead = false;
  213. output.writeStartElement("tr");
  214. for(var i = 0; i < rowBuffer.length; i++)
  215. {
  216. output.writeStartElement("td");
  217. output.writeAttribute("align", "center");
  218. output.writeAttribute("style", "font-size: 80%");
  219. if(i == 0)
  220. {
  221. output.writeCDATA(rowBuffer[i].split(".")[0]);
  222. }
  223. else
  224. {
  225. output.writeCDATA(rowBuffer[i]);
  226. }
  227. output.writeEndElement();
  228. }
  229. output.writeEndElement();
  230. nextTime += 30;
  231. tm = Math.floor(nextTime / 60);
  232. ts = nextTime % 60;
  233. }
  234. }
  235. if(annotationRead)
  236. {
  237. output.writeStartElement("tr");
  238. for(var i = 0; i < rowBuffer.length; i++)
  239. {
  240. output.writeStartElement("td");
  241. output.writeAttribute("align", "center");
  242. output.writeAttribute("style", "font-size: 80%");
  243. output.writeCDATA(rowBuffer[i]);
  244. output.writeEndElement();
  245. }
  246. output.writeEndElement();
  247. annotationRead = false;
  248. }
  249. }
  250. rowBuffer = new Array();
  251. }
  252. }
  253. input.readNext();
  254. }
  255. output.writeStartElement("tr");
  256. for(var i = 0; i < rowBuffer.length; i++)
  257. {
  258. output.writeStartElement("td");
  259. output.writeAttribute("align", "center");
  260. output.writeAttribute("style", "font-size: 80%");
  261. output.writeCDATA(rowBuffer[i]);
  262. output.writeEndElement();
  263. }
  264. output.writeEndElement();
  265. output.writeEndElement();
  266. output.writeEndElement();
  267. output.writeStartElement("div");
  268. output.writeAttribute("style", "width=4.5in;float=right");
  269. output.writeStartElement("svg");
  270. output.writeAttribute("xmlns", "http://www.w3.org/2000/svg");
  271. output.writeAttribute("version", "1.1");
  272. output.writeAttribute("width", "4.5in");
  273. output.writeAttribute("height", "3.4in");
  274. output.writeAttribute("viewbox", "0 0 400 400");
  275. output.writeStartElement("rect");
  276. output.writeAttribute("width", "4.5in");
  277. output.writeAttribute("height", "3.4in");
  278. output.writeAttribute("style", "fill:none;stroke-width:3;stroke:rgb(64,64,64)");
  279. output.writeEndElement();
  280. output.writeStartElement("text");
  281. output.writeAttribute("x", "0.1in");
  282. output.writeAttribute("y", "1.3in");
  283. output.writeAttribute("font-size", "12");
  284. output.writeAttribute("transform", "rotate(-90 40,150)");
  285. if(log.displayUnits() == 10143)
  286. {
  287. output.writeCDATA(TTR("exportWindow", "Temperature (°C)"));
  288. }
  289. else
  290. {
  291. output.writeCDATA(TTR("exportWindow", "Temperature (°F)"));
  292. }
  293. output.writeEndElement();
  294. output.writeStartElement("text");
  295. output.writeAttribute("x", "1.9in");
  296. output.writeAttribute("y", "3.3in");
  297. output.writeAttribute("font-size", "12");
  298. output.writeCDATA("Time (minutes)");
  299. output.writeEndElement();
  300. output.writeStartElement("line");
  301. output.writeAttribute("x1", "0.4in");
  302. output.writeAttribute("x2", "0.4in");
  303. output.writeAttribute("y1", "0.1in");
  304. output.writeAttribute("y2", "2.9in");
  305. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  306. output.writeEndElement();
  307. output.writeStartElement("line");
  308. output.writeAttribute("x1", "0.5in");
  309. output.writeAttribute("x2", "4.4in");
  310. output.writeAttribute("y1", "3in");
  311. output.writeAttribute("y2", "3in");
  312. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  313. output.writeEndElement();
  314. output.writeStartElement("line");
  315. output.writeAttribute("x1", "0.4in");
  316. output.writeAttribute("x2", "4.4in");
  317. output.writeAttribute("y1", "2.9in");
  318. output.writeAttribute("y2", "2.9in");
  319. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  320. output.writeEndElement();
  321. if(log.displayUnits() != 10143)
  322. {
  323. output.writeStartElement("text");
  324. output.writeAttribute("x", "0.3in");
  325. output.writeAttribute("y", "2.95in");
  326. output.writeAttribute("font-size", "12");
  327. output.writeCDATA("0");
  328. output.writeEndElement();
  329. }
  330. if(log.displayUnits() == 10143)
  331. {
  332. output.writeStartElement("line");
  333. output.writeAttribute("x1", "0.4in");
  334. output.writeAttribute("x2", "4.4in");
  335. output.writeAttribute("y1", "2.22in");
  336. output.writeAttribute("y2", "2.22in");
  337. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  338. output.writeEndElement();
  339. output.writeStartElement("text");
  340. output.writeAttribute("x", "0.18in");
  341. output.writeAttribute("y", "2.27in");
  342. output.writeAttribute("font-size", "12");
  343. output.writeCDATA("50");
  344. output.writeEndElement();
  345. output.writeStartElement("line");
  346. output.writeAttribute("x1", "0.4in");
  347. output.writeAttribute("x2", "4.4in");
  348. output.writeAttribute("y1", "1.71in");
  349. output.writeAttribute("y2", "1.71in");
  350. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  351. output.writeEndElement();
  352. output.writeStartElement("text");
  353. output.writeAttribute("x", "0.18in");
  354. output.writeAttribute("y", "1.76in");
  355. output.writeAttribute("font-size", "12");
  356. output.writeCDATA("100");
  357. output.writeEndElement();
  358. output.writeStartElement("line");
  359. output.writeAttribute("x1", "0.4in");
  360. output.writeAttribute("x2", "4.4in");
  361. output.writeAttribute("y1", "1.21in");
  362. output.writeAttribute("y2", "1.21in");
  363. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  364. output.writeEndElement();
  365. output.writeStartElement("text");
  366. output.writeAttribute("x", "0.18in");
  367. output.writeAttribute("y", "1.26in");
  368. output.writeAttribute("font-size", "12");
  369. output.writeCDATA("150");
  370. output.writeEndElement();
  371. output.writeStartElement("line");
  372. output.writeAttribute("x1", "0.4in");
  373. output.writeAttribute("x2", "4.4in");
  374. output.writeAttribute("y1", "0.7in");
  375. output.writeAttribute("y2", "0.7in");
  376. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  377. output.writeEndElement();
  378. output.writeStartElement("text");
  379. output.writeAttribute("x", "0.18in");
  380. output.writeAttribute("y", "0.75in");
  381. output.writeAttribute("font-size", "12");
  382. output.writeCDATA("200");
  383. output.writeEndElement();
  384. output.writeStartElement("line");
  385. output.writeAttribute("x1", "0.4in");
  386. output.writeAttribute("x2", "4.4in");
  387. output.writeAttribute("y1", "0.2in");
  388. output.writeAttribute("y2", "0.2in");
  389. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  390. output.writeEndElement();
  391. output.writeStartElement("text");
  392. output.writeAttribute("x", "0.18in");
  393. output.writeAttribute("y", "0.25in");
  394. output.writeAttribute("font-size", "12");
  395. output.writeCDATA("250");
  396. output.writeEndElement();
  397. }
  398. else
  399. {
  400. output.writeStartElement("line");
  401. output.writeAttribute("x1", "0.4in");
  402. output.writeAttribute("x2", "4.4in");
  403. output.writeAttribute("y1", "2.34in");
  404. output.writeAttribute("y2", "2.34in");
  405. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  406. output.writeEndElement();
  407. output.writeStartElement("text");
  408. output.writeAttribute("x", "0.18in");
  409. output.writeAttribute("y", "2.39in");
  410. output.writeAttribute("font-size", "12");
  411. output.writeCDATA("100");
  412. output.writeEndElement();
  413. output.writeStartElement("line");
  414. output.writeAttribute("x1", "0.4in");
  415. output.writeAttribute("x2", "4.4in");
  416. output.writeAttribute("y1", "1.78in");
  417. output.writeAttribute("y2", "1.78in");
  418. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  419. output.writeEndElement();
  420. output.writeStartElement("text");
  421. output.writeAttribute("x", "0.18in");
  422. output.writeAttribute("y", "1.83in");
  423. output.writeAttribute("font-size", "12");
  424. output.writeCDATA("200");
  425. output.writeEndElement();
  426. output.writeStartElement("line");
  427. output.writeAttribute("x1", "0.4in");
  428. output.writeAttribute("x2", "4.4in");
  429. output.writeAttribute("y1", "1.22in");
  430. output.writeAttribute("y2", "1.22in");
  431. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  432. output.writeEndElement();
  433. output.writeStartElement("text");
  434. output.writeAttribute("x", "0.18in");
  435. output.writeAttribute("y", "1.27in");
  436. output.writeAttribute("font-size", "12");
  437. output.writeCDATA("300");
  438. output.writeEndElement();
  439. output.writeStartElement("line");
  440. output.writeAttribute("x1", "0.4in");
  441. output.writeAttribute("x2", "4.4in");
  442. output.writeAttribute("y1", "0.66in");
  443. output.writeAttribute("y2", "0.66in");
  444. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  445. output.writeEndElement();
  446. output.writeStartElement("text");
  447. output.writeAttribute("x", "0.18in");
  448. output.writeAttribute("y", "0.71in");
  449. output.writeAttribute("font-size", "12");
  450. output.writeCDATA("400");
  451. output.writeEndElement();
  452. output.writeStartElement("line");
  453. output.writeAttribute("x1", "0.4in");
  454. output.writeAttribute("x2", "4.4in");
  455. output.writeAttribute("y1", "0.1in");
  456. output.writeAttribute("y2", "0.1in");
  457. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  458. output.writeEndElement();
  459. output.writeStartElement("text");
  460. output.writeAttribute("x", "0.18in");
  461. output.writeAttribute("y", "0.15in");
  462. output.writeAttribute("font-size", "12");
  463. output.writeCDATA("500");
  464. output.writeEndElement();
  465. }
  466. output.writeStartElement("line");
  467. output.writeAttribute("x1", "0.5in");
  468. output.writeAttribute("x2", "0.5in");
  469. output.writeAttribute("y1", "2.95in");
  470. output.writeAttribute("y2", "3.05in");
  471. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  472. output.writeEndElement();
  473. output.writeStartElement("text");
  474. output.writeAttribute("x", "0.47in");
  475. output.writeAttribute("y", "3.16in");
  476. output.writeAttribute("font-size", "12");
  477. output.writeCDATA("0");
  478. output.writeEndElement();
  479. output.writeStartElement("line");
  480. output.writeAttribute("x1", "0.89in");
  481. output.writeAttribute("x2", "0.89in");
  482. output.writeAttribute("y1", "2.95in");
  483. output.writeAttribute("y2", "3.05in");
  484. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  485. output.writeEndElement();
  486. output.writeStartElement("text");
  487. output.writeAttribute("x", "0.86in");
  488. output.writeAttribute("y", "3.16in");
  489. output.writeAttribute("font-size", "12");
  490. output.writeCDATA("2");
  491. output.writeEndElement();
  492. output.writeStartElement("line");
  493. output.writeAttribute("x1", "1.28in");
  494. output.writeAttribute("x2", "1.28in");
  495. output.writeAttribute("y1", "2.95in");
  496. output.writeAttribute("y2", "3.05in");
  497. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  498. output.writeEndElement();
  499. output.writeStartElement("text");
  500. output.writeAttribute("x", "1.25in");
  501. output.writeAttribute("y", "3.16in");
  502. output.writeAttribute("font-size", "12");
  503. output.writeCDATA("4");
  504. output.writeEndElement();
  505. output.writeStartElement("line");
  506. output.writeAttribute("x1", "1.67in");
  507. output.writeAttribute("x2", "1.67in");
  508. output.writeAttribute("y1", "2.95in");
  509. output.writeAttribute("y2", "3.05in");
  510. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  511. output.writeEndElement();
  512. output.writeStartElement("text");
  513. output.writeAttribute("x", "1.64in");
  514. output.writeAttribute("y", "3.16in");
  515. output.writeAttribute("font-size", "12");
  516. output.writeCDATA("6");
  517. output.writeEndElement();
  518. output.writeStartElement("line");
  519. output.writeAttribute("x1", "2.06in");
  520. output.writeAttribute("x2", "2.06in");
  521. output.writeAttribute("y1", "2.95in");
  522. output.writeAttribute("y2", "3.05in");
  523. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  524. output.writeEndElement();
  525. output.writeStartElement("text");
  526. output.writeAttribute("x", "2.03in");
  527. output.writeAttribute("y", "3.16in");
  528. output.writeAttribute("font-size", "12");
  529. output.writeCDATA("8");
  530. output.writeEndElement();
  531. output.writeStartElement("line");
  532. output.writeAttribute("x1", "2.45in");
  533. output.writeAttribute("x2", "2.45in");
  534. output.writeAttribute("y1", "2.95in");
  535. output.writeAttribute("y2", "3.05in");
  536. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  537. output.writeEndElement();
  538. output.writeStartElement("text");
  539. output.writeAttribute("x", "2.39in");
  540. output.writeAttribute("y", "3.16in");
  541. output.writeAttribute("font-size", "12");
  542. output.writeCDATA("10");
  543. output.writeEndElement();
  544. output.writeStartElement("line");
  545. output.writeAttribute("x1", "2.84in");
  546. output.writeAttribute("x2", "2.84in");
  547. output.writeAttribute("y1", "2.95in");
  548. output.writeAttribute("y2", "3.05in");
  549. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  550. output.writeEndElement();
  551. output.writeStartElement("text");
  552. output.writeAttribute("x", "2.78in");
  553. output.writeAttribute("y", "3.16in");
  554. output.writeAttribute("font-size", "12");
  555. output.writeCDATA("12");
  556. output.writeEndElement();
  557. output.writeStartElement("line");
  558. output.writeAttribute("x1", "3.23in");
  559. output.writeAttribute("x2", "3.23in");
  560. output.writeAttribute("y1", "2.95in");
  561. output.writeAttribute("y2", "3.05in");
  562. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  563. output.writeEndElement();
  564. output.writeStartElement("text");
  565. output.writeAttribute("x", "3.17in");
  566. output.writeAttribute("y", "3.16in");
  567. output.writeAttribute("font-size", "12");
  568. output.writeCDATA("14");
  569. output.writeEndElement();
  570. output.writeStartElement("line");
  571. output.writeAttribute("x1", "3.62in");
  572. output.writeAttribute("x2", "3.62in");
  573. output.writeAttribute("y1", "2.95in");
  574. output.writeAttribute("y2", "3.05in");
  575. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  576. output.writeEndElement();
  577. output.writeStartElement("text");
  578. output.writeAttribute("x", "3.56in");
  579. output.writeAttribute("y", "3.16in");
  580. output.writeAttribute("font-size", "12");
  581. output.writeCDATA("16");
  582. output.writeEndElement();
  583. output.writeStartElement("line");
  584. output.writeAttribute("x1", "4.01in");
  585. output.writeAttribute("x2", "4.01in");
  586. output.writeAttribute("y1", "2.95in");
  587. output.writeAttribute("y2", "3.05in");
  588. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  589. output.writeEndElement();
  590. output.writeStartElement("text");
  591. output.writeAttribute("x", "3.95in");
  592. output.writeAttribute("y", "3.16in");
  593. output.writeAttribute("font-size", "12");
  594. output.writeCDATA("18");
  595. output.writeEndElement();
  596. output.writeStartElement("line");
  597. output.writeAttribute("x1", "4.4in");
  598. output.writeAttribute("x2", "4.4in");
  599. output.writeAttribute("y1", "2.95in");
  600. output.writeAttribute("y2", "3.05in");
  601. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  602. output.writeEndElement();
  603. output.writeStartElement("text");
  604. output.writeAttribute("x", "4.34in");
  605. output.writeAttribute("y", "3.16in");
  606. output.writeAttribute("font-size", "12");
  607. output.writeCDATA("20");
  608. output.writeEndElement();
  609. sourceFile.close();
  610. sourceFile.open(3);
  611. input = new XmlReader(sourceFile);
  612. var lineStyles = new Array();
  613. lineStyles.push("stroke:rgb(255,0,0);stroke-width:1");
  614. lineStyles.push("stroke:rgb(0,255,0);stroke-width:1");
  615. lineStyles.push("stroke:rgb(0,0,255);stroke-width:1");
  616. lineStyles.push("stroke:rgb(255,255,0);stroke-width:1");
  617. lineStyles.push("stroke:rgb(255,0,255);stroke-width:1");
  618. lineStyles.push("stroke:rgb(0,255,255);stroke-width:1");
  619. var check1 = false;
  620. var drawable = false;
  621. var previousX;
  622. var currentX;
  623. var previousY = new Array();
  624. input.readNext();
  625. while(!input.atEnd())
  626. {
  627. if(input.isStartElement())
  628. {
  629. if(input.name() == "time")
  630. {
  631. if(check1)
  632. {
  633. previousX = currentX;
  634. }
  635. var tstring = input.readElementText();
  636. var tsplit1 = tstring.split(":");
  637. var tsplit2 = tsplit1[1].split(".");
  638. currentX = 0.5 + (Number(tsplit1[0])*0.195) + (Number(tsplit2[0])*0.00325);// + (Number(tsplit2[1]) * 0.00000325);
  639. if(check1)
  640. {
  641. drawable = true;
  642. }
  643. check1 = true;
  644. }
  645. if(input.name() == "temperature")
  646. {
  647. var series;
  648. for(var i = 0; i < tempMap.length; i++)
  649. {
  650. if(tempMap[i] == input.attribute("series"))
  651. {
  652. series = i;
  653. break;
  654. }
  655. }
  656. var currentY = 2.9 - Number(input.readElementText()) * 0.0056;
  657. if(drawable)
  658. {
  659. output.writeStartElement("line");
  660. output.writeAttribute("style", lineStyles[series % 6]);
  661. output.writeAttribute("x1", String(previousX)+"in");
  662. output.writeAttribute("x2", String(currentX)+"in");
  663. output.writeAttribute("y1", String(previousY[series])+"in");
  664. output.writeAttribute("y2", String(currentY)+"in");
  665. output.writeEndElement();
  666. }
  667. previousY[series] = currentY;
  668. }
  669. }
  670. input.readNext();
  671. }
  672. sourceFile.remove();
  673. sourceFile.close();
  674. output.writeEndElement();
  675. output.writeStartElement("div");
  676. output.writeAttribute("style", "margin-left:3in;margin-top:0.5in");
  677. var lossField = findChildObject(window, 'loss');
  678. var tolField = findChildObject(window, 'tolerance');
  679. if(lossField.text != "")
  680. {
  681. output.writeStartElement("p");
  682. output.writeCDATA(TTR("exportWindow", "Weight loss: "));
  683. output.writeCDATA(lossField.text);
  684. if(tolField.text != "")
  685. {
  686. output.writeCDATA("±");
  687. output.writeCDATA(tolField.text);
  688. }
  689. output.writeCDATA("%");
  690. output.writeEndElement();
  691. output.writeStartElement("table");
  692. output.writeStartElement("tr");
  693. output.writeStartElement("th");
  694. output.writeCDATA(TTR("exportWindow", "Roasted"));
  695. output.writeEndElement();
  696. output.writeStartElement("th");
  697. output.writeCDATA(TTR("exportWindow", "Green"));
  698. output.writeEndElement();
  699. output.writeEndElement();
  700. var green;
  701. var roasted;
  702. var loss = (Number(lossField.text) + Number(tolField.text)) / 100;
  703. for(roasted = 1; roasted < 30; roasted++)
  704. {
  705. green = (1/-(loss-1)) * roasted;
  706. if(green > 30)
  707. {
  708. break;
  709. }
  710. if(roasted % 5 == 0)
  711. {
  712. output.writeStartElement("tr");
  713. output.writeStartElement("td");
  714. output.writeAttribute("align", "center");
  715. output.writeCDATA(roasted);
  716. output.writeEndElement();
  717. output.writeStartElement("td");
  718. output.writeAttribute("align", "center");
  719. output.writeCDATA(green.toFixed(2));
  720. output.writeEndElement();
  721. output.writeEndElement();
  722. }
  723. }
  724. roasted--;
  725. if(roasted % 5 > 0)
  726. {
  727. green = (1/-(loss-1)) * roasted;
  728. output.writeStartElement("tr");
  729. output.writeStartElement("td");
  730. output.writeAttribute("align", "center");
  731. output.writeCDATA(roasted);
  732. output.writeEndElement();
  733. output.writeStartElement("td");
  734. output.writeAttribute("align", "center");
  735. output.writeCDATA(green.toFixed(2));
  736. output.writeEndElement();
  737. output.writeEndElement();
  738. }
  739. output.writeEndElement();
  740. }
  741. var noteField = findChildObject(window, 'notes');
  742. if(noteField.text != "")
  743. {
  744. output.writeStartElement("p");
  745. output.writeCDATA(noteField.text);
  746. output.writeEndElement();
  747. }
  748. output.writeEndElement();
  749. output.writeEndElement();
  750. output.writeEndElement();
  751. output.writeEndElement();
  752. output.writeEndDocument();
  753. destFile.close();
  754. QSettings.setValue("script/lastDir", dir(filename));
  755. window.close();
  756. }
  757. });
  758. ]]>
  759. </program>
  760. </window>