|
@@ -1,7 +1,7 @@
|
1
|
1
|
<window id="batchWindow">
|
2
|
|
- <menu name="File">
|
3
|
|
- <item id="print" shortcut="Ctrl+P">Print...</item>
|
4
|
|
- </menu>
|
|
2
|
+ <menu name="File">
|
|
3
|
+ <item id="print" shortcut="Ctrl+P">Print...</item>
|
|
4
|
+ </menu>
|
5
|
5
|
<menu name="Batch">
|
6
|
6
|
<item id="new" shortcut="Ctrl+N">New Batch...</item>
|
7
|
7
|
</menu>
|
|
@@ -144,7 +144,7 @@
|
144
|
144
|
roastwt.maximumWidth = 80;
|
145
|
145
|
var scalesLayout = findChildObject(this, 'scales');
|
146
|
146
|
scalesLayout.spacing = 10;
|
147
|
|
- var batchTag = findChildObject(this, 'batchTag');
|
|
147
|
+ var batchTag = findChildObject(this, 'batchTag');
|
148
|
148
|
if(navigationwindow.loggingWindow.scales.length > 0) {
|
149
|
149
|
for(var i = 0; i < navigationwindow.loggingWindow.scales.length; i++) {
|
150
|
150
|
var scale = navigationwindow.loggingWindow.scales[i];
|
|
@@ -623,7 +623,7 @@
|
623
|
623
|
filenofield.text = query.value(0);
|
624
|
624
|
var file = new QFile(batch.tempData);
|
625
|
625
|
file.remove();
|
626
|
|
- drawTag();
|
|
626
|
+ drawTag();
|
627
|
627
|
}
|
628
|
628
|
var wholecolor = findChildObject(this, 'wholecolor');
|
629
|
629
|
var groundcolor = findChildObject(this, 'groundcolor');
|
|
@@ -699,72 +699,72 @@
|
699
|
699
|
batch.windowModified = false;
|
700
|
700
|
batch.close();
|
701
|
701
|
}
|
702
|
|
- function drawTag() {
|
703
|
|
- var buffer = new QBuffer;
|
|
702
|
+ function drawTag() {
|
|
703
|
+ var buffer = new QBuffer;
|
704
|
704
|
buffer.open(3);
|
705
|
705
|
var output = new XmlWriter(buffer);
|
706
|
706
|
output.writeStartDocument("1.0");
|
707
|
707
|
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">');
|
708
|
708
|
output.writeStartElement("html");
|
709
|
709
|
output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
|
710
|
|
- output.writeStartElement("head");
|
711
|
|
- var styleFile = new QFile(QSettings.value("config") + "/Scripts/batchtag.css");
|
712
|
|
- styleFile.open(1);
|
713
|
|
- output.writeTextElement("style", styleFile.readToString());
|
714
|
|
- styleFile.close();
|
715
|
|
- output.writeStartElement("script");
|
716
|
|
- scriptFile = new QFile(QSettings.value("config") + "/Scripts/qrcode.js");
|
717
|
|
- scriptFile.open(1);
|
718
|
|
- output.writeCDATA(scriptFile.readToString());
|
719
|
|
- scriptFile.close();
|
720
|
|
- output.writeEndElement();
|
721
|
|
- output.writeEndElement();
|
|
710
|
+ output.writeStartElement("head");
|
|
711
|
+ var styleFile = new QFile(QSettings.value("config") + "/Scripts/batchtag.css");
|
|
712
|
+ styleFile.open(1);
|
|
713
|
+ output.writeTextElement("style", styleFile.readToString());
|
|
714
|
+ styleFile.close();
|
|
715
|
+ output.writeStartElement("script");
|
|
716
|
+ scriptFile = new QFile(QSettings.value("config") + "/Scripts/qrcode.js");
|
|
717
|
+ scriptFile.open(1);
|
|
718
|
+ output.writeCDATA(scriptFile.readToString());
|
|
719
|
+ scriptFile.close();
|
|
720
|
+ output.writeEndElement();
|
|
721
|
+ output.writeEndElement();
|
722
|
722
|
output.writeStartElement("body");
|
723
|
|
- output.writeStartElement("h1");
|
724
|
|
- output.writeCharacters(roasted.currentText);
|
725
|
|
- output.writeEndElement();
|
726
|
|
- output.writeTextElement("span", "Roasted at: " + timefield.text);
|
727
|
|
- output.writeTextElement("span", "On machine: " + machine.text);
|
728
|
|
- output.writeTextElement("span", "Batch file: " + filenofield.text);
|
729
|
|
- output.writeStartElement("div");
|
730
|
|
- output.writeAttribute("id", "container");
|
731
|
|
- output.writeEndElement();
|
732
|
|
- output.writeStartElement("script");
|
733
|
|
- var tag = {g: "Typica", m: Number(selectedRoasterID), v: 1};
|
734
|
|
- if(timefield.text.length > 0) {
|
735
|
|
- tag.t = timefield.text;
|
736
|
|
- }
|
737
|
|
- if(filenofield.text.length > 0) {
|
738
|
|
- tag.f = Number(filenofield.text);
|
739
|
|
- }
|
740
|
|
- var scriptData = 'var width = document.getElementById("container").offsetWidth;';
|
741
|
|
- scriptData += 'var qrcode = new QRCode({content: \'';
|
742
|
|
- scriptData += JSON.stringify(tag);
|
743
|
|
- scriptData += '\', width: width, height: width});';
|
744
|
|
- scriptData += 'var svg = qrcode.svg();';
|
745
|
|
- scriptData += 'document.getElementById("container").innerHTML = svg;';
|
746
|
|
- output.writeCDATA(scriptData);
|
747
|
|
- output.writeEndElement();
|
748
|
|
- output.writeEndElement();
|
749
|
|
- output.writeEndElement();
|
750
|
|
- output.writeEndDocument();
|
|
723
|
+ output.writeStartElement("h1");
|
|
724
|
+ output.writeCharacters(roasted.currentText);
|
|
725
|
+ output.writeEndElement();
|
|
726
|
+ output.writeTextElement("span", "Roasted at: " + timefield.text);
|
|
727
|
+ output.writeTextElement("span", "On machine: " + machine.text);
|
|
728
|
+ output.writeTextElement("span", "Batch file: " + filenofield.text);
|
|
729
|
+ output.writeStartElement("div");
|
|
730
|
+ output.writeAttribute("id", "container");
|
|
731
|
+ output.writeEndElement();
|
|
732
|
+ output.writeStartElement("script");
|
|
733
|
+ var tag = {g: "Typica", m: Number(selectedRoasterID), v: 1};
|
|
734
|
+ if(timefield.text.length > 0) {
|
|
735
|
+ tag.t = timefield.text;
|
|
736
|
+ }
|
|
737
|
+ if(filenofield.text.length > 0) {
|
|
738
|
+ tag.f = Number(filenofield.text);
|
|
739
|
+ }
|
|
740
|
+ var scriptData = 'var width = document.getElementById("container").offsetWidth;';
|
|
741
|
+ scriptData += 'var qrcode = new QRCode({content: \'';
|
|
742
|
+ scriptData += JSON.stringify(tag);
|
|
743
|
+ scriptData += '\', width: width, height: width});';
|
|
744
|
+ scriptData += 'var svg = qrcode.svg();';
|
|
745
|
+ scriptData += 'document.getElementById("container").innerHTML = svg;';
|
|
746
|
+ output.writeCDATA(scriptData);
|
|
747
|
+ output.writeEndElement();
|
|
748
|
+ output.writeEndElement();
|
|
749
|
+ output.writeEndElement();
|
|
750
|
+ output.writeEndDocument();
|
751
|
751
|
batchTag.setContent(buffer);
|
752
|
752
|
buffer.close();
|
753
|
|
- };
|
754
|
|
- drawTag();
|
755
|
|
- var printMenu = findChildObject(this, 'print');
|
|
753
|
+ };
|
|
754
|
+ drawTag();
|
|
755
|
+ var printMenu = findChildObject(this, 'print');
|
756
|
756
|
printMenu.triggered.connect(function() {
|
757
|
757
|
batchTag.print();
|
758
|
758
|
});
|
759
|
|
- var printers = findChildObject(this, 'printerlist');
|
760
|
|
- printers.currentIndex = printers.findText(QSettings.value("script/batchtagprinter"));
|
761
|
|
- printers['currentIndexChanged(int)'].connect(function() {
|
|
759
|
+ var printers = findChildObject(this, 'printerlist');
|
|
760
|
+ printers.currentIndex = printers.findText(QSettings.value("script/batchtagprinter"));
|
|
761
|
+ printers['currentIndexChanged(int)'].connect(function() {
|
762
|
762
|
QSettings.setValue("script/batchtagprinter", printers.currentText);
|
763
|
763
|
});
|
764
|
|
- var printbutton = findChildObject(this, 'printbutton');
|
765
|
|
- printbutton.clicked.connect(function() {
|
766
|
|
- batchTag.print(printers.currentText);
|
767
|
|
- });
|
|
764
|
+ var printbutton = findChildObject(this, 'printbutton');
|
|
765
|
+ printbutton.clicked.connect(function() {
|
|
766
|
+ batchTag.print(printers.currentText);
|
|
767
|
+ });
|
768
|
768
|
]]>
|
769
|
769
|
</program>
|
770
|
770
|
</window>
|