ソースを参照

Refactor profile loading

Neal Wilson 6年前
コミット
ee6f53bee8
署名者: neal <neal@typica.us> GPGキーID: D6F25C90DD5819DF
3個のファイルの変更46行の追加123行の削除
  1. 1
    42
      config/Windows/batchdetailsnew.xml
  2. 2
    44
      config/Windows/newbatch.xml
  3. 43
    37
      config/Windows/productionroaster.xml

+ 1
- 42
config/Windows/batchdetailsnew.xml ファイルの表示

@@ -163,48 +163,7 @@
163 163
                 var buffer = new QBuffer(query.value(0));
164 164
                 var pname = query.value(1);
165 165
                 query = query.invalidate();
166
-                var input = new XMLInput(buffer, 1);
167
-                var graph = findChildObject(Windows.loggingWindow, 'graph');
168
-                var log = findChildObject(Windows.loggingWindow, 'log');
169
-                log.clear();
170
-                graph.clear();
171
-                input.newTemperatureColumn.connect(log.setHeaderData);
172
-                input.newTemperatureColumn.connect(function(col, text) {
173
-                    if(text == Windows.loggingWindow.targetcolumnname) {
174
-                        targetseries = col;
175
-                    }
176
-                });
177
-                input.newAnnotationColumn.connect(log.setHeaderData);
178
-                input.measure.connect(graph.newMeasurement);
179
-                input.measure.connect(log.newMeasurement);
180
-				var targetDetector = Windows.loggingWindow.targetDetector;
181
-                input.measure.connect(function(data, series) {
182
-                    if(series == targetseries) {
183
-                        targetDetector.newMeasurement(data);
184
-                    }
185
-                });
186
-                var lc;
187
-                input.lastColumn.connect(function(c) {
188
-                    lc = c;
189
-                    QSettings.setValue("liveColumn", c + 1);
190
-                    Windows.loggingWindow.postLoadColumnSetup(c);
191
-                });
192
-                input.annotation.connect(log.newAnnotation);
193
-                input.annotation.connect(function(note, tcol, ncol) {
194
-                    for(var i = tcol; i < ncol; i++) {
195
-                        log.newAnnotation(note, i, ncol);
196
-                    }
197
-                });
198
-                Windows.loggingWindow.windowTitle = "Typica - " + pname;
199
-                Windows.loggingWindow.raise();
200
-                Windows.loggingWindow.activateWindow();
201
-                graph.updatesEnabled = false;
202
-                log.updatesEnabled = false;
203
-                input.input();
204
-                log.updatesEnabled = true;
205
-                graph.updatesEnabled = true;
206
-                log.newAnnotation(TTR("batchDetails", "End"), 1, lc);
207
-                query = query.invalidate();
166
+				Windows.loggingWindow.loadPlan(buffer, pname);
208 167
             });
209 168
             var approvalButton = findChildObject(this, 'approval');
210 169
             var annotationField = findChildObject(this, 'annotation');

+ 2
- 44
config/Windows/newbatch.xml ファイルの表示

@@ -578,8 +578,6 @@
578 578
                 query.bind(":item", Number(roasted.currentData()));
579 579
                 query.bind(":again", Number(roasted.currentData()));
580 580
                 query.exec();
581
-                var graph;
582
-                var log;
583 581
                 if(query.next())
584 582
                 {
585 583
                     var files = query.value(0);
@@ -591,53 +589,12 @@
591 589
                     query.exec(q);
592 590
                     if(query.next())
593 591
                     {
594
-                        var targetseries = -1;
595 592
                         var buffer = new QBuffer(query.value(0));
596 593
                         var pname = query.value(1);
597
-                        var input = new XMLInput(buffer, 1);
598
-                        graph = findChildObject(navigationwindow.loggingWindow, 'graph');
599
-                        log = findChildObject(navigationwindow.loggingWindow, 'log');
600
-                        log.clear();
601
-                        graph.clear();
602
-                        input.newTemperatureColumn.connect(log.setHeaderData);
603
-                        input.newTemperatureColumn.connect(function(col, text) {
604
-                            if(text == navigationwindow.loggingWindow.targetcolumnname)
605
-                            {
606
-                                targetseries = col;
607
-                            }
608
-                        });
609
-                        input.newAnnotationColumn.connect(log.setHeaderData);
610
-                        input.measure.connect(graph.newMeasurement);
611
-                        input.measure.connect(log.newMeasurement);
612
-                        input.measure.connect(function(data, series) {
613
-                            if(series == targetseries)
614
-                            {
615
-                                targetDetector.newMeasurement(data);
616
-                            }
617
-                        });
618
-                        var lc;
619
-                        input.lastColumn.connect(function(c) {
620
-                            lc = c;
621
-                            QSettings.setValue("liveColumn", c + 1);
622
-                            navigationwindow.loggingWindow.postLoadColumnSetup(c)
623
-                        });
624
-                        input.annotation.connect(function(note, tcol, ncol) {
625
-                            for(var i = tcol; i < ncol; i++) {
626
-                                log.newAnnotation(note, i, ncol);
627
-                            }
628
-                        });
594
+						Windows.loggingWindow.loadPlan(buffer, pname);
629 595
                     }
630 596
                 }
631 597
                 query = query.invalidate();
632
-                navigationwindow.loggingWindow.windowTitle = "Typica - [*]" + pname;
633
-                navigationwindow.loggingWindow.raise();
634
-                navigationwindow.loggingWindow.activateWindow();
635
-                graph.updatesEnabled = false;
636
-                log.updatesEnabled = false;
637
-                input.input();
638
-                log.updatesEnabled = true;
639
-                graph.updatesEnabled = true;
640
-                log.newAnnotation(TTR("batchWindow", "End"), 1, lc);
641 598
             }
642 599
             var noprofilebutton = findChildObject(this, 'noprofile');
643 600
             noprofilebutton.clicked.connect(function() {
@@ -659,6 +616,7 @@
659 616
             var doNoProfile = function() {
660 617
                 batch.windowModified = true;
661 618
                 currentBatchInfo = batch;
619
+				navigationwindow.loggingWindow.clearLog();
662 620
                 navigationwindow.loggingWindow.raise();
663 621
                 navigationwindow.loggingWindow.activateWindow();
664 622
                 if(scheduledID > 0) {

+ 43
- 37
config/Windows/productionroaster.xml ファイルの表示

@@ -1222,48 +1222,54 @@
1222 1222
             exportWindow.windowTitle = TTR("basicWindow", "Typica - Export XHTML+SVG");
1223 1223
             exportWindow.log = log;
1224 1224
         });
1225
+		window.loadPlan = function(device, name) {
1226
+			window.clearLog();
1227
+			var input = new XMLInput(device, 1);
1228
+			targetseries = -1;
1229
+            input.newTemperatureColumn.connect(log.setHeaderData);
1230
+			input.newTemperatureColumn.connect(function(col, text) {
1231
+				if(text == window.targetcolumnname) {
1232
+					targetseries = col;
1233
+				}
1234
+			});
1235
+            input.newAnnotationColumn.connect(log.setHeaderData);
1236
+            input.measure.connect(graph.newMeasurement);
1237
+            input.measure.connect(log.newMeasurement);
1238
+			input.measure.connect(function(data, series) {
1239
+				if(series == targetseries) {
1240
+					targetDetector.newMeasurement(data);
1241
+				}
1242
+			});
1243
+			resetTranslation.enabled = false;
1244
+			setTranslation.enabled = false;
1245
+            input.annotation.connect(log.newAnnotation);
1246
+			input.annotation.connect(function(note, tcol, ncol) {
1247
+				for(var i = tcol; i < ncol; i++) {
1248
+					log.newAnnotation(note, i, ncol);
1249
+				}
1250
+			});
1251
+			var lc;
1252
+            input.lastColumn.connect(function(c) {
1253
+				lc = c;
1254
+                QSettings.setValue("liveColumn", c + 1);
1255
+				window.postLoadColumnSetup(c);
1256
+			});
1257
+			graph.updatesEnabled = false;
1258
+			log.updatesEnabled = false;
1259
+            input.input();
1260
+			log.updatesEnabled = true;
1261
+			graph.updatesEnabled = true;
1262
+			window.windowTitle = 'Typica - [*]' + name;
1263
+			log.newAnnotation(TTR("basicWindow", "End"), 1, lc);
1264
+			window.raise();
1265
+			window.activateWindow();
1266
+		}
1225 1267
         openMenu.triggered.connect(function() {
1226 1268
             var filename = QFileDialog.getOpenFileName(window, TTR("basicWindow", "Open Log..."), QSettings.value('script/lastDir', '') + '/');
1227 1269
             if(filename != '') {
1228 1270
                 var file = new QFile(filename);
1229
-                var input = new XMLInput(file, 1);
1230
-				targetseries = -1;
1231
-                input.newTemperatureColumn.connect(log.setHeaderData);
1232
-				input.newTemperatureColumn.connect(function(col, text) {
1233
-					if(text == window.targetcolumnname) {
1234
-						targetseries = col;
1235
-					}
1236
-				});
1237
-                input.newAnnotationColumn.connect(log.setHeaderData);
1238
-                input.measure.connect(graph.newMeasurement);
1239
-                input.measure.connect(log.newMeasurement);
1240
-				input.measure.connect(function(data, series) {
1241
-					if(series == targetseries) {
1242
-						targetDetector.newMeasurement(data);
1243
-					}
1244
-				});
1245
-				resetTranslation.enabled = false;
1246
-				setTranslation.enabled = false;
1247
-                input.annotation.connect(log.newAnnotation);
1248
-				input.annotation.connect(function(note, tcol, ncol) {
1249
-					for(var i = tcol; i < ncol; i++) {
1250
-						log.newAnnotation(note, i, ncol);
1251
-					}
1252
-				});
1253
-				var lc;
1254
-                input.lastColumn.connect(function(c) {
1255
-					lc = c;
1256
-                    QSettings.setValue("liveColumn", c + 1);
1257
-					window.postLoadColumnSetup(c);
1258
-				});
1259
-				graph.updatesEnabled = false;
1260
-				log.updatesEnabled = false;
1261
-                input.input();
1262
-				log.updatesEnabled = true;
1263
-				graph.updatesEnabled = true;
1264
-                window.windowTitle = 'Typica - [*]' + baseName(filename);
1271
+				window.loadPlan(file, baseName(filename));
1265 1272
                 QSettings.setValue("script/lastDir", dir(filename));
1266
-				log.newAnnotation(TTR("basicWindow", "End"), 1, lc);
1267 1273
             }
1268 1274
         });
1269 1275
 		var columnName = function(c) {

読み込み中…
キャンセル
保存