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.

profilehistory.xml 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <window id="profilehistory">
  2. <layout type="vertical">
  3. <layout type="horizontal">
  4. <label>Coffee:</label>
  5. <sqldrop data="0" display="1" showdata="false" editable="false" id="coffees">
  6. <query>SELECT id, name FROM items WHERE category = 'Coffee: Roasted' AND id IN (SELECT item FROM current_items) ORDER BY name</query>
  7. </sqldrop>
  8. <stretch />
  9. </layout>
  10. <splitter type="horizontal" id="outersplitter">
  11. <widget>
  12. <layout type="vertical">
  13. <sqlview id="profilelist" />
  14. </layout>
  15. </widget>
  16. <widget>
  17. <layout type="vertical">
  18. <layout type="horizontal">
  19. <button name="Set as Current Target Roast Profile"
  20. id="setcurrent" type="push" />
  21. <stretch />
  22. </layout>
  23. <splitter type="horizontal">
  24. <measurementtable id="log" />
  25. <graph id = "graph" />
  26. </splitter>
  27. </layout>
  28. </widget>
  29. </splitter>
  30. </layout>
  31. <menu name="Log">
  32. <item id="showC">Display Celsius</item>
  33. <item id="showF">Display Fahrenheit</item>
  34. <separator />
  35. <item id="ms">Millisecond view</item>
  36. <item id="1s">1 Second View</item>
  37. <item id="5s">5 Second View</item>
  38. <item id="10s">10 Second View</item>
  39. <item id="15s">15 Second View</item>
  40. <item id="30s">30 Second View</item>
  41. <item id="1m">1 Minute View</item>
  42. </menu>
  43. <program>
  44. <![CDATA[
  45. var profileList = findChildObject(this, 'profilelist');
  46. var coffeelist = findChildObject(this, 'coffees');
  47. var graph = findChildObject(this, 'graph');
  48. var log = findChildObject(this, 'log');
  49. var setCurrent = findChildObject(this, 'setcurrent');
  50. setCurrent.enabled = false;
  51. var currentProfileID;
  52. setCurrent.clicked.connect(function() {
  53. var query = new QSqlQuery();
  54. query.prepare("INSERT INTO item_files VALUES('now', :coffee, :profile)");
  55. query.bind(":coffee", coffeelist.currentData());
  56. query.bind(":profile", "{" + currentProfileID + "}");
  57. query.exec();
  58. query = query.invalidate();
  59. listProfiles(coffeelist.currentData());
  60. });
  61. var listProfiles = function(roastedID) {
  62. q = "SELECT time, files[1] AS profile FROM item_files WHERE item =";
  63. q += roastedID;
  64. q += " ORDER BY time DESC";
  65. profileList.setQuery(q);
  66. };
  67. var displayProfile = function(profileID) {
  68. currentProfileID = profileID;
  69. setCurrent.enabled = true;
  70. var query = new QSqlQuery();
  71. query.prepare("SELECT file FROM files WHERE id = :id");
  72. query.bind(":id", profileID);
  73. query.exec();
  74. if(query.next())
  75. {
  76. var buffer = new QBuffer(query.value(0));
  77. var input = new XMLInput(buffer, 1);
  78. input.newTemperatureColumn.connect(log.setHeaderData);
  79. input.newAnnotationColumn.connect(log.setHeaderData);
  80. input.measure.connect(graph.newMeasurement);
  81. input.measure.connect(log.newMeasurement);
  82. var lc;
  83. input.lastColumn.connect(function(c) {
  84. lc = c;
  85. });
  86. input.annotation.connect(function(annotation, mc, nc) {
  87. for(var i = mc; i < lc; i++) {
  88. log.newAnnotation(annotation, i, nc);
  89. }
  90. });
  91. input.input();
  92. }
  93. query = query.invalidate();
  94. };
  95. coffeelist['currentIndexChanged(int)'].connect(function() {
  96. listProfiles(coffeelist.currentData());
  97. setCurrent.enabled = false;
  98. log.clear();
  99. graph.clear();
  100. });
  101. listProfiles(coffeelist.currentData());
  102. profileList.openEntryRow.connect(function(row) {
  103. log.clear();
  104. graph.clear();
  105. displayProfile(profileList.data(row, 1));
  106. });
  107. var v1 = findChildObject(this, 'ms');
  108. v1.triggered.connect(log.LOD_ms);
  109. var v2 = findChildObject(this, '1s');
  110. v2.triggered.connect(log.LOD_1s);
  111. var v3 = findChildObject(this, '5s');
  112. v3.triggered.connect(log.LOD_5s);
  113. var v4 = findChildObject(this, '10s');
  114. v4.triggered.connect(log.LOD_10s);
  115. var v5 = findChildObject(this, '15s');
  116. v5.triggered.connect(log.LOD_15s);
  117. var v6 = findChildObject(this, '30s');
  118. v6.triggered.connect(log.LOD_30s);
  119. var v7 = findChildObject(this, '1m');
  120. v7.triggered.connect(log.LOD_1m);
  121. var showC = findChildObject(this, 'showC');
  122. showC.triggered.connect(function() {
  123. log.setDisplayUnits(TemperatureDisplay.Celsius);
  124. graph.showC();
  125. });
  126. var showF = findChildObject(this, 'showF');
  127. showF.triggered.connect(function() {
  128. log.setDisplayUnits(TemperatureDisplay.Fahrenheit);
  129. graph.showF();
  130. });
  131. ]]>
  132. </program>
  133. </window>