Browse Source

Mark for translation, remove legacy batch details window

Neal Wilson 9 years ago
parent
commit
2068a27c92
3 changed files with 21 additions and 201 deletions
  1. 0
    178
      config/Windows/batchdetails.xml
  2. 20
    22
      config/Windows/batchdetailsnew.xml
  3. 1
    1
      config/config.xml

+ 0
- 178
config/Windows/batchdetails.xml View File

1
-<window id="batchDetails">
2
-    <layout type="vertical">
3
-        <layout type="horizontal">
4
-            <label>Time:</label>
5
-            <line editable="false" id="time" />
6
-        </layout>
7
-        <layout type="horizontal">
8
-            <label>Name:</label>
9
-            <line editable="false" id="name" />
10
-        </layout>
11
-        <layout type="horizontal">
12
-            <label>Green:</label>
13
-            <line editable="false" id="green" />
14
-        </layout>
15
-        <layout type="horizontal">
16
-            <label>Roasted:</label>
17
-            <line editable="false" id="roasted" />
18
-        </layout>
19
-        <layout type="horizontal">
20
-            <label>Duration:</label>
21
-            <line editable="false" id="duration" />
22
-        </layout>
23
-        <layout type="horizontal">
24
-            <label>Approval:</label>
25
-            <line editable="false" id="approval" />
26
-        </layout>
27
-        <layout type="horizontal">
28
-            <label>Files:</label>
29
-			<line id="files" />
30
-		</layout>
31
-        <layout type="vertical">
32
-            <button type="push" id="target" name="Load profile as target" />
33
-            <button type="push" id="view" name="View profile" />
34
-            <button type="push" id="compare" name="Compare profile" />
35
-        </layout>
36
-    </layout>
37
-    <program>
38
-        <![CDATA[
39
-			var widget = this;
40
-			var target = findChildObject(this, 'target');
41
-			var batchTime = findChildObject(this, 'time');
42
-			var filesfield = findChildObject(this, 'files');
43
-            var compare = findChildObject(this, 'compare');
44
-			if(typeof(navigationwindow.loggingWindow) == "undefined")
45
-			{
46
-				compare.enabled = false;
47
-				target.enabled = false;
48
-			}
49
-            compare.clicked.connect(function() {
50
-                files = filesfield.text;
51
-                files = files.replace("{", "(");
52
-                files = files.replace("}", ")");
53
-                var q = "SELECT file, name FROM files WHERE id IN ";
54
-                q = q + files;
55
-                q = q + " AND type = 'profile'";
56
-                query = new QSqlQuery();
57
-                query.exec(q);
58
-                query.next();
59
-                var buffer = new QBuffer(query.value(0));
60
-                var pname = query.value(1);
61
-                query = query.invalidate();
62
-                var startSeries = Number(QSettings.value('cseries', 3));
63
-                var nextSeries = startSeries + 2;
64
-                QSettings.setValue('cseries', nextSeries);
65
-                var input = new XMLInput(buffer, startSeries);
66
-                var graph = findChildObject(navigationwindow.loggingWindow, 'graph');
67
-                input.measure.connect(graph.newMeasurement);
68
-                input.input();
69
-            });
70
-			target.clicked.connect(function() {
71
-				files = filesfield.text;
72
-				files = files.replace("{", "(");
73
-				files = files.replace("}", ")");
74
-				var q = "SELECT file, name FROM files WHERE id IN ";
75
-				q = q + files;
76
-				q = q + " AND type = 'profile'";
77
-				query = new QSqlQuery();
78
-				query.exec(q);
79
-				query.next();
80
-				var targetseries = -1;
81
-				var buffer = new QBuffer(query.value(0));
82
-				var pname = query.value(1);
83
-                query = query.invalidate();
84
-				var input = new XMLInput(buffer, 1);
85
-				var graph = findChildObject(navigationwindow.loggingWindow, 'graph');
86
-				var log = findChildObject(navigationwindow.loggingWindow, 'log');
87
-				log.clear();
88
-				graph.clear();
89
-				input.newTemperatureColumn.connect(log.setHeaderData);
90
-				input.newTemperatureColumn.connect(function(col, text) {
91
-					if(text == navigationwindow.loggingWindow.targetcolumnname)
92
-					{
93
-						targetseries = col;
94
-					}
95
-				});
96
-				input.newAnnotationColumn.connect(log.setHeaderData);
97
-				input.measure.connect(graph.newMeasurement);
98
-				input.measure.connect(log.newMeasurement);
99
-				input.measure.connect(function(data, series) {
100
-					if(series == targetseries)
101
-					{
102
-						targetDetector.newMeasurement(data);
103
-					}
104
-				});
105
-				var lc;
106
-				input.lastColumn.connect(function(c) {
107
-					lc = c;
108
-					QSettings.setValue("liveColumn", c + 1);
109
-					navigationwindow.loggingWindow.postLoadColumnSetup(c);
110
-				});
111
-				input.annotation.connect(log.newAnnotation);
112
-				input.annotation.connect(function(note, tcol, ncol) {
113
-					for(var i = tcol; i < ncol; i++) {
114
-						log.newAnnotation(note, i, ncol);
115
-					}
116
-				});
117
-				navigationwindow.loggingWindow.windowTitle = "Typica - " + pname;
118
-				navigationwindow.loggingWindow.raise();
119
-				navigationwindow.loggingWindow.activateWindow();
120
-				input.input();
121
-				log.newAnnotation("End", 1, lc);
122
-			});
123
-			var viewbutton = findChildObject(this, 'view');
124
-			viewbutton.clicked.connect(function() {
125
-				files = filesfield.text;
126
-				files = files.replace("{", "(");
127
-				files = files.replace("}", ")");
128
-				var q = "SELECT file, name FROM files WHERE id IN ";
129
-				q = q + files;
130
-				q = q + " AND type = 'profile'";
131
-				query = new QSqlQuery();
132
-				query.exec(q);
133
-				if(query.next()) {
134
-					var viewer = createWindow('offline');
135
-					var buffer = new QBuffer(query.value(0));
136
-					var pname = query.value(1);
137
-					query = query.invalidate();
138
-					var input = new XMLInput(buffer, 1);
139
-					var graph = findChildObject(viewer, 'graph');
140
-					var log = findChildObject(viewer, 'log');
141
-					input.newTemperatureColumn.connect(log.setHeaderData);
142
-					input.newTemperatureColumn.connect(function(column) {
143
-						viewer.saveTemperatureColumns.push(column);
144
-					});
145
-					input.newAnnotationColumn.connect(log.setHeaderData);
146
-					input.newAnnotationColumn.connect(function(column) {
147
-						viewer.saveAnnotationColumns.push(column);
148
-					});
149
-					input.measure.connect(graph.newMeasurement);
150
-					input.measure.connect(log.newMeasurement);
151
-					input.annotation.connect(log.newAnnotation);
152
-					var lc;
153
-					input.lastColumn.connect(function(c) {
154
-						lc = c;
155
-						if(c < 3)
156
-						{
157
-							log.setHeaderData(3, "");
158
-						}
159
-					});
160
-					input.annotation.connect(function(note, tcol, ncol) {
161
-						for(var i = tcol; i < ncol; i++) {
162
-							log.newAnnotation(note, i, ncol);
163
-						}
164
-					});
165
-					viewer.windowTitle = "Typica - " + pname;
166
-					viewer.raise();
167
-					viewer.activateWindow();
168
-					input.input();
169
-					log.newAnnotation("End", 1, lc);
170
-				}
171
-				else {
172
-					print("Query returned no results");
173
-				}
174
-				query = query.invalidate();
175
-            });
176
-        ]]>
177
-    </program>
178
-</window>

+ 20
- 22
config/Windows/batchdetailsnew.xml View File

9
         <webview id="view" />
9
         <webview id="view" />
10
     </layout>
10
     </layout>
11
 	<menu name="File">
11
 	<menu name="File">
12
-            <item id="save" shortcut="Ctrl+S">Save</item>
13
-            <item id="print" shortcut="Ctrl+P">Print</item>
12
+            <item id="save" shortcut="Ctrl+S">Save...</item>
13
+            <item id="print" shortcut="Ctrl+P">Print...</item>
14
 	</menu>
14
 	</menu>
15
     <program>
15
     <program>
16
         <![CDATA[
16
         <![CDATA[
21
             {
21
             {
22
                 conversion = 2.2;
22
                 conversion = 2.2;
23
             }
23
             }
24
-            var unitText = (unit == 0 ? "Kg" : "Lb");
24
+            var unitText = (unit == 0 ? TTR("batchDetails", "Kg") :
25
+                           TTR("batchDetails", "Lb"));
25
             dataView = findChildObject(this, 'view');
26
             dataView = findChildObject(this, 'view');
26
             var printMenu = findChildObject(this, 'print');
27
             var printMenu = findChildObject(this, 'print');
27
             printMenu.triggered.connect(function() {
28
             printMenu.triggered.connect(function() {
109
                 Windows.loggingWindow.raise();
110
                 Windows.loggingWindow.raise();
110
                 Windows.loggingWindow.activateWindow();
111
                 Windows.loggingWindow.activateWindow();
111
                 input.input();
112
                 input.input();
112
-                log.newAnnotation("End", 1, lc);
113
+                log.newAnnotation(TTR("batchDetails", "End"), 1, lc);
113
                 query = query.invalidate();
114
                 query = query.invalidate();
114
             });
115
             });
115
             var viewbutton = findChildObject(this, 'viewprofile');
116
             var viewbutton = findChildObject(this, 'viewprofile');
159
                     graph.updatesEnabled = true;
160
                     graph.updatesEnabled = true;
160
                     log.newAnnotation("End", 1, lc);
161
                     log.newAnnotation("End", 1, lc);
161
                 }
162
                 }
162
-                else {
163
-                    print("Query returned no results");
164
-                }
165
                 query = query.invalidate();
163
                 query = query.invalidate();
166
             });
164
             });
167
             window.loadData = function(table, row) {
165
             window.loadData = function(table, row) {
175
                 output.writeStartElement("html");
173
                 output.writeStartElement("html");
176
                 output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
174
                 output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
177
                 output.writeStartElement("head");
175
                 output.writeStartElement("head");
178
-                output.writeTextElement("title", "Batch Details");
176
+                output.writeTextElement("title", TTR("batchDetails", "Batch Details"));
179
                 output.writeEndElement();
177
                 output.writeEndElement();
180
                 output.writeStartElement("body");
178
                 output.writeStartElement("body");
181
                 output.writeStartElement("div");
179
                 output.writeStartElement("div");
182
                 output.writeAttribute("style", "float: left; padding-right: 10px");
180
                 output.writeAttribute("style", "float: left; padding-right: 10px");
183
                 output.writeStartElement("p");
181
                 output.writeStartElement("p");
184
-                output.writeTextElement("strong", "Roasted Coffee: ");
182
+                output.writeTextElement("strong", TTR("batchDetails", "Roasted Coffee: "));
185
                 output.writeTextElement("span", table.data(row, 2));
183
                 output.writeTextElement("span", table.data(row, 2));
186
                 output.writeEndElement();
184
                 output.writeEndElement();
187
                 output.writeEndElement();
185
                 output.writeEndElement();
188
                 output.writeStartElement("div");
186
                 output.writeStartElement("div");
189
                 output.writeAttribute("style", "float: left");
187
                 output.writeAttribute("style", "float: left");
190
                 output.writeStartElement("p");
188
                 output.writeStartElement("p");
191
-                output.writeTextElement("strong", "Roasted On: ");
189
+                output.writeTextElement("strong", TTR("batchDetails", "Roasted On: "));
192
                 batchTime = table.data(row, 0);
190
                 batchTime = table.data(row, 0);
193
                 output.writeTextElement("span", batchTime);
191
                 output.writeTextElement("span", batchTime);
194
                 output.writeEndElement();
192
                 output.writeEndElement();
195
                 output.writeStartElement("p");
193
                 output.writeStartElement("p");
196
-                output.writeTextElement("strong", "Batch Duration: ");
194
+                output.writeTextElement("strong", TTR("batchDetails", "Batch Duration: "));
197
                 output.writeTextElement("span", table.data(row, 6));
195
                 output.writeTextElement("span", table.data(row, 6));
198
                 output.writeEndElement();
196
                 output.writeEndElement();
199
                 output.writeEndElement();
197
                 output.writeEndElement();
203
                 output.writeStartElement("table");
201
                 output.writeStartElement("table");
204
                 output.writeStartElement("thead");
202
                 output.writeStartElement("thead");
205
                 output.writeStartElement("tr");
203
                 output.writeStartElement("tr");
206
-                output.writeTextElement("th", "Green Coffee");
207
-                output.writeTextElement("th", "Weight (" + unitText + ")");
204
+                output.writeTextElement("th", TTR("batchDetails", "Green Coffee"));
205
+                output.writeTextElement("th", TTR("batchDetails", "Weight (") + unitText + ")");
208
                 output.writeEndElement();
206
                 output.writeEndElement();
209
                 output.writeEndElement();
207
                 output.writeEndElement();
210
                 output.writeStartElement("tbody");
208
                 output.writeStartElement("tbody");
241
                 output.writeStartElement("tr");
239
                 output.writeStartElement("tr");
242
                 output.writeStartElement("td");
240
                 output.writeStartElement("td");
243
                 output.writeAttribute("align", "right");
241
                 output.writeAttribute("align", "right");
244
-                output.writeTextElement("strong", "Green Total:");
242
+                output.writeTextElement("strong", TTR("batchDetails", "Green Total:"));
245
                 output.writeEndElement();
243
                 output.writeEndElement();
246
                 output.writeStartElement("td");
244
                 output.writeStartElement("td");
247
                 output.writeAttribute("align", "center");
245
                 output.writeAttribute("align", "center");
251
                 output.writeStartElement("tr");
249
                 output.writeStartElement("tr");
252
                 output.writeStartElement("td");
250
                 output.writeStartElement("td");
253
                 output.writeAttribute("align", "right");
251
                 output.writeAttribute("align", "right");
254
-                output.writeTextElement("strong", "Roasted Weight:");
252
+                output.writeTextElement("strong", TTR("batchDetails", "Roasted Weight:"));
255
                 output.writeEndElement();
253
                 output.writeEndElement();
256
                 output.writeStartElement("td");
254
                 output.writeStartElement("td");
257
                 output.writeAttribute("align", "center");
255
                 output.writeAttribute("align", "center");
262
                 output.writeStartElement("tr");
260
                 output.writeStartElement("tr");
263
                 output.writeStartElement("td");
261
                 output.writeStartElement("td");
264
                 output.writeAttribute("align", "right");
262
                 output.writeAttribute("align", "right");
265
-                output.writeTextElement("strong", "Weight Loss:");
263
+                output.writeTextElement("strong", TTR("batchDetails", "Weight Loss:"));
266
                 output.writeEndElement();
264
                 output.writeEndElement();
267
                 output.writeStartElement("td");
265
                 output.writeStartElement("td");
268
                 output.writeAttribute("align", "center");
266
                 output.writeAttribute("align", "center");
273
                 output.writeEndElement();
271
                 output.writeEndElement();
274
                 output.writeEndElement();
272
                 output.writeEndElement();
275
                 output.writeStartElement("p");
273
                 output.writeStartElement("p");
276
-                output.writeTextElement("strong", "Approved: ");
274
+                output.writeTextElement("strong", TTR("batchDetails", "Approved: "));
277
                 output.writeCharacters(approval);
275
                 output.writeCharacters(approval);
278
                 output.writeEndElement();
276
                 output.writeEndElement();
279
                 output.writeStartElement("p");
277
                 output.writeStartElement("p");
280
-                output.writeTextElement("strong", "Files: ");
278
+                output.writeTextElement("strong", TTR("batchDetails", "Files: "));
281
                 output.writeCharacters(query.value(3));
279
                 output.writeCharacters(query.value(3));
282
                 output.writeEndElement();
280
                 output.writeEndElement();
283
                 output.writeStartElement("p");
281
                 output.writeStartElement("p");
284
-                output.writeTextElement("strong", "Annotations:");
282
+                output.writeTextElement("strong", TTR("batchDetails", "Annotations:"));
285
                 var files = sqlToArray(query.value(3));
283
                 var files = sqlToArray(query.value(3));
286
                 var annotations = annotationFromRecord(files[0]);
284
                 var annotations = annotationFromRecord(files[0]);
287
                 fileID = files[0];
285
                 fileID = files[0];
293
                 var result = colQuery.exec();
291
                 var result = colQuery.exec();
294
                 buffer2.close();
292
                 buffer2.close();
295
                 var seriesHeaders = new Array();
293
                 var seriesHeaders = new Array();
296
-                seriesHeaders.push("Time");
294
+                seriesHeaders.push(TTR("batchDetails", "Time"));
297
                 var records = result.split(";");
295
                 var records = result.split(";");
298
                 for(var i = 0; i < records.length - 1; i++) {
296
                 for(var i = 0; i < records.length - 1; i++) {
299
                     seriesHeaders.push(records[i].replace(/^\s+|\s+$/g,""));
297
                     seriesHeaders.push(records[i].replace(/^\s+|\s+$/g,""));
300
                 }
298
                 }
301
-                seriesHeaders.push("Note");
299
+                seriesHeaders.push(TTR("batchDetails", "Note"));
302
                 output.writeStartElement("table");
300
                 output.writeStartElement("table");
303
                 output.writeStartElement("thead");
301
                 output.writeStartElement("thead");
304
                 output.writeStartElement("tr");
302
                 output.writeStartElement("tr");
352
             };
350
             };
353
             var saveMenu = findChildObject(this, 'save');
351
             var saveMenu = findChildObject(this, 'save');
354
             saveMenu.triggered.connect(function() {
352
             saveMenu.triggered.connect(function() {
355
-                var filename = QFileDialog.getSaveFileName(window, "Save Log As…", QSettings.value("script/lastDir", "") + "/");
353
+                var filename = QFileDialog.getSaveFileName(window, TTR("batchDetails", "Save Log As..."), QSettings.value("script/lastDir", "") + "/");
356
                 if(filename != "") {
354
                 if(filename != "") {
357
                     saveFileFromDatabase(fileID, filename);
355
                     saveFileFromDatabase(fileID, filename);
358
                 }
356
                 }

+ 1
- 1
config/config.xml View File

45
             var badapt;
45
             var badapt;
46
             var azero;
46
             var azero;
47
             var bzero;
47
             var bzero;
48
-            navwindow.windowTitle = "Typica - Choose Your Path";
48
+            navwindow.windowTitle = TTR("config", "Typica - Choose Your Path");
49
         ]]>
49
         ]]>
50
     </program>
50
     </program>
51
 </application>
51
 </application>

Loading…
Cancel
Save