Browse Source

Mark for translation, remove legacy batch details window

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

+ 1
- 1
config/config.xml View File

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

Loading…
Cancel
Save