summaryrefslogtreecommitdiffstats
path: root/kbarcode/tec.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-29 00:55:34 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-29 00:55:34 +0000
commitc4189d200e71c7ef82e9a6e34935ad225154d658 (patch)
treef7f29a1159e0402472ff2ab22617a8113f66263c /kbarcode/tec.cpp
parent2f888b1578e65ec1bc514996eb509fcaf34462d6 (diff)
downloadkbarcode-c4189d200e71c7ef82e9a6e34935ad225154d658.tar.gz
kbarcode-c4189d200e71c7ef82e9a6e34935ad225154d658.zip
TQt4 port kbarcode
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbarcode@1233956 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbarcode/tec.cpp')
-rw-r--r--kbarcode/tec.cpp580
1 files changed, 290 insertions, 290 deletions
diff --git a/kbarcode/tec.cpp b/kbarcode/tec.cpp
index 174806e..b4b53ff 100644
--- a/kbarcode/tec.cpp
+++ b/kbarcode/tec.cpp
@@ -22,16 +22,16 @@
#include <unistd.h>
// QT includes
-#include <qclipboard.h>
-#include <qcursor.h>
-#include <qgroupbox.h>
-#include <qhbox.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
-#include <qprogressdialog.h>
-#include <qsqlcursor.h>
-#include <qvalidator.h>
+#include <tqclipboard.h>
+#include <tqcursor.h>
+#include <tqgroupbox.h>
+#include <tqhbox.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
+#include <tqpaintdevicemetrics.h>
+#include <tqprogressdialog.h>
+#include <tqsqlcursor.h>
+#include <tqvalidator.h>
// KDE includes
#include <kapplication.h>
@@ -51,10 +51,10 @@
#define MAXDATASIZE 32550
-QString tec452(const QString &url, int count, const QString &art, const QString &group, const QString &id)
+TQString tec452(const TQString &url, int count, const TQString &art, const TQString &group, const TQString &id)
{
- QString filename;
- QString result;
+ TQString filename;
+ TQString result;
int countBar=0;
int countText=0;
@@ -65,42 +65,42 @@ QString tec452(const QString &url, int count, const QString &art, const QString
filename = url;
//setCaption( filename, false );
- QFile f( filename );
+ TQFile f( filename );
if ( !f.open( IO_ReadOnly ) )
return false;
//clearLabel();
- QDomDocument doc( "KBarcodeLabel" );
+ TQDomDocument doc( "KBarcodeLabel" );
if ( !doc.setContent( &f ) ) {
f.close();
return false;
}
f.close();
- QDomNode n = doc.documentElement().firstChild();
+ TQDomNode n = doc.documentElement().firstChild();
// this should not be neccessary,
// but <label><id> needs to be processed first
while( !n.isNull() ) {
- QDomElement e = n.toElement(); // try to convert the node to an element.
+ TQDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() )
// label has to be the first xml element!
if( e.tagName() == "label" ) {
- QDomNode n = e.firstChild();
+ TQDomNode n = e.firstChild();
while( !n.isNull() ) {
- QDomElement e = n.toElement(); // try to convert the node to an element.
+ TQDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() )
if( e.tagName() == "id" ) {
- result += QString("{D%1,").arg( convZeros((e.attribute( "height" ).toInt() + e.attribute( "gap_v" ).toInt())*10,4)); // Altura + Gap vertical
- result += QString("%1,").arg( convZeros(e.attribute( "width" ).toInt()*10,4) ); // Anchura
- result += QString("%1|}\n").arg( convZeros(e.attribute( "height" ).toInt()*10,4) ); // Altura
- result += QString("{C|}\n"); // Clear buffer
- result += QString("{U2;0130|}\n"); // BackFeed
- result += QString("{D%1,").arg( convZeros((e.attribute( "height" ).toInt() + e.attribute( "gap_v" ).toInt())*10,4)); // Altura + Gap vertical
- result += QString("%1,").arg( convZeros(e.attribute( "width" ).toInt()*10,4) ); // Anchura
- result += QString("%1|}\n").arg( convZeros(e.attribute( "height" ).toInt()*10,4) ); // Altura
- result += QString("{AX;+000,+000,+00|}\n"); // Position Fine adjust
- result += QString("{AY;+04,1|}\n"); // Print density fine adjust
+ result += TQString("{D%1,").tqarg( convZeros((e.attribute( "height" ).toInt() + e.attribute( "gap_v" ).toInt())*10,4)); // Altura + Gap vertical
+ result += TQString("%1,").tqarg( convZeros(e.attribute( "width" ).toInt()*10,4) ); // Anchura
+ result += TQString("%1|}\n").tqarg( convZeros(e.attribute( "height" ).toInt()*10,4) ); // Altura
+ result += TQString("{C|}\n"); // Clear buffer
+ result += TQString("{U2;0130|}\n"); // BackFeed
+ result += TQString("{D%1,").tqarg( convZeros((e.attribute( "height" ).toInt() + e.attribute( "gap_v" ).toInt())*10,4)); // Altura + Gap vertical
+ result += TQString("%1,").tqarg( convZeros(e.attribute( "width" ).toInt()*10,4) ); // Anchura
+ result += TQString("%1|}\n").tqarg( convZeros(e.attribute( "height" ).toInt()*10,4) ); // Altura
+ result += TQString("{AX;+000,+000,+00|}\n"); // Position Fine adjust
+ result += TQString("{AY;+04,1|}\n"); // Print density fine adjust
}
@@ -112,7 +112,7 @@ QString tec452(const QString &url, int count, const QString &art, const QString
n = doc.documentElement().firstChild();
while( !n.isNull() ) {
- QDomElement e = n.toElement(); // try to convert the node to an element.
+ TQDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() )
if( e.tagName() == "barcode" ) {
@@ -122,110 +122,110 @@ QString tec452(const QString &url, int count, const QString &art, const QString
if ( e.attribute( "type" ) == "b55" ) result += pdf417(e, countBar);
- QString data;
- QDomNode n = e.firstChild();
+ TQString data;
+ TQDomNode n = e.firstChild();
while( !n.isNull() ) {
- QDomElement e = n.toElement(); // try to convert the node to an element.
+ TQDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() )
if( e.tagName() == "value" ) data = e.text();
n = n.nextSibling();
}
- result += QString("{RB%1;").arg( convZeros(countBar, 2) ); // count de RB
- result += QString("%1|}\n").arg( data ); // Data + fin
+ result += TQString("{RB%1;").tqarg( convZeros(countBar, 2) ); // count de RB
+ result += TQString("%1|}\n").tqarg( data ); // Data + fin
countBar++;
} else if( e.tagName() == "textfield" ) {
- result += QString("{PC%1;").arg( convZeros(countText, 3) ); // count
- result += QString("%1,").arg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
- result += QString("%1,").arg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
- result += QString("%1,").arg( "10" );
- result += QString("%1,").arg( "15" );
- result += QString("%1,").arg( "J" );
- result += QString("%1,").arg( "00" );
- result += QString("%1|}\n").arg( "B" );
-
- QString etext;
- QDomNode n = e.firstChild();
+ result += TQString("{PC%1;").tqarg( convZeros(countText, 3) ); // count
+ result += TQString("%1,").tqarg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
+ result += TQString("%1,").tqarg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
+ result += TQString("%1,").tqarg( "10" );
+ result += TQString("%1,").tqarg( "15" );
+ result += TQString("%1,").tqarg( "J" );
+ result += TQString("%1,").tqarg( "00" );
+ result += TQString("%1|}\n").tqarg( "B" );
+
+ TQString etext;
+ TQDomNode n = e.firstChild();
while( !n.isNull() ) {
- QDomElement e = n.toElement(); // try to convert the node to an element.
+ TQDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() )
if( e.tagName() == "text" )
etext = e.text();
n = n.nextSibling();
}
- result += QString("{RC%1;").arg( convZeros(countText, 3) ); // count de RB
+ result += TQString("{RC%1;").tqarg( convZeros(countText, 3) ); // count de RB
etext=getData(etext, art, group, id );
- result += QString("%1|}\n").arg( etext ); // Data + fin
+ result += TQString("%1|}\n").tqarg( etext ); // Data + fin
countText++;
}
else if( e.tagName() == "rect" ) {
if (e.attribute("colorr")=="0" and e.attribute("colorg")=="0" and e.attribute("colorb")=="0") {
- result += QString("{XR;"); // XR
- result += QString("%1,").arg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
- result += QString("%1,").arg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
- result += QString("%1,").arg( convZeros(posConv(e.attribute( "x_mm"), 4 ).toInt()+posConv(e.attribute( "width_mm"),4 ).toInt(),4)); // X position
- result += QString("%1,").arg( convZeros(posConv(e.attribute( "y_mm"), 4 ).toInt()+posConv(e.attribute( "height_mm"),4 ).toInt(),4)); // Y position
- result += QString("A"); // Type of Clear
- result += QString("|}\n"); // FIN
- result += QString("{XR;"); // XR
- result += QString("%1,").arg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
- result += QString("%1,").arg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
- result += QString("%1,").arg( convZeros(posConv(e.attribute( "x_mm"), 4 ).toInt()+posConv(e.attribute( "width_mm"),4 ).toInt(),4)); // X position
- result += QString("%1,").arg( convZeros(posConv(e.attribute( "y_mm"), 4 ).toInt()+posConv(e.attribute( "height_mm"),4 ).toInt(),4)); // Y position
- result += QString("B"); // Type of Clear
- result += QString("|}\n"); // FIN
+ result += TQString("{XR;"); // XR
+ result += TQString("%1,").tqarg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
+ result += TQString("%1,").tqarg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
+ result += TQString("%1,").tqarg( convZeros(posConv(e.attribute( "x_mm"), 4 ).toInt()+posConv(e.attribute( "width_mm"),4 ).toInt(),4)); // X position
+ result += TQString("%1,").tqarg( convZeros(posConv(e.attribute( "y_mm"), 4 ).toInt()+posConv(e.attribute( "height_mm"),4 ).toInt(),4)); // Y position
+ result += TQString("A"); // Type of Clear
+ result += TQString("|}\n"); // FIN
+ result += TQString("{XR;"); // XR
+ result += TQString("%1,").tqarg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
+ result += TQString("%1,").tqarg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
+ result += TQString("%1,").tqarg( convZeros(posConv(e.attribute( "x_mm"), 4 ).toInt()+posConv(e.attribute( "width_mm"),4 ).toInt(),4)); // X position
+ result += TQString("%1,").tqarg( convZeros(posConv(e.attribute( "y_mm"), 4 ).toInt()+posConv(e.attribute( "height_mm"),4 ).toInt(),4)); // Y position
+ result += TQString("B"); // Type of Clear
+ result += TQString("|}\n"); // FIN
}
else {
- result += QString("{LC;"); // LC
- result += QString("%1,").arg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
- result += QString("%1,").arg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
- result += QString("%1,").arg( convZeros(posConv(e.attribute( "x_mm"), 4 ).toInt()+posConv(e.attribute( "width_mm"),4 ).toInt(),4)); // X position
- result += QString("%1,").arg( convZeros(posConv(e.attribute( "y_mm"), 4 ).toInt()+posConv(e.attribute( "height_mm"),4 ).toInt(),4)); // Y position
- result += QString("1,"); // Type of line 0=line 1=Rectangulo 2=Jagged line 3=Rectangle with jagged lines
- result += QString("%1").arg(lineWidth(e)); // No. of line width dots 1-9
- //result += QString("999"); // Radius of rounded corners of a rectangle
- result += QString("|}\n"); // FIN
+ result += TQString("{LC;"); // LC
+ result += TQString("%1,").tqarg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
+ result += TQString("%1,").tqarg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
+ result += TQString("%1,").tqarg( convZeros(posConv(e.attribute( "x_mm"), 4 ).toInt()+posConv(e.attribute( "width_mm"),4 ).toInt(),4)); // X position
+ result += TQString("%1,").tqarg( convZeros(posConv(e.attribute( "y_mm"), 4 ).toInt()+posConv(e.attribute( "height_mm"),4 ).toInt(),4)); // Y position
+ result += TQString("1,"); // Type of line 0=line 1=Rectangulo 2=Jagged line 3=Rectangle with jagged lines
+ result += TQString("%1").tqarg(lineWidth(e)); // No. of line width dots 1-9
+ //result += TQString("999"); // Radius of rounded corners of a rectangle
+ result += TQString("|}\n"); // FIN
}
}
else if( e.tagName() == "line" ) {
- result += QString("{LC;"); // LC
- result += QString("%1,").arg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
- result += QString("%1,").arg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
- result += QString("%1,").arg( convZeros(posConv(e.attribute( "x_mm"), 4 ).toInt()+posConv(e.attribute( "width_mm"),4 ).toInt(),4)); // X position
- result += QString("%1,").arg( convZeros(posConv(e.attribute( "y_mm"), 4 ).toInt()+posConv(e.attribute( "height_mm"),4 ).toInt(),4)); // Y position
- result += QString("0,"); // Type of line 0=line 1=Rectangulo 2=Jagged line 3=Rectangle with jagged lines
- result += QString("%1").arg(lineWidth(e)); // No. of line width dots 1-9
- //result += QString("999"); // Radius of rounded corners of a rectangle
- result += QString("|}\n"); // FIN
+ result += TQString("{LC;"); // LC
+ result += TQString("%1,").tqarg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
+ result += TQString("%1,").tqarg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
+ result += TQString("%1,").tqarg( convZeros(posConv(e.attribute( "x_mm"), 4 ).toInt()+posConv(e.attribute( "width_mm"),4 ).toInt(),4)); // X position
+ result += TQString("%1,").tqarg( convZeros(posConv(e.attribute( "y_mm"), 4 ).toInt()+posConv(e.attribute( "height_mm"),4 ).toInt(),4)); // Y position
+ result += TQString("0,"); // Type of line 0=line 1=Rectangulo 2=Jagged line 3=Rectangle with jagged lines
+ result += TQString("%1").tqarg(lineWidth(e)); // No. of line width dots 1-9
+ //result += TQString("999"); // Radius of rounded corners of a rectangle
+ result += TQString("|}\n"); // FIN
}
n = n.nextSibling();
}
- result += QString("{U1;0130|}\n"); // ForwardFeed
- result += QString("{XS;I,%1,0000C2000|}\n").arg(convZeros(count,4)); // Issue Command
+ result += TQString("{U1;0130|}\n"); // ForwardFeed
+ result += TQString("{XS;I,%1,0000C2000|}\n").tqarg(convZeros(count,4)); // Issue Command
return result;
}
-QString convZeros( int count, int zeros )
+TQString convZeros( int count, int zeros )
{
-QString str= QString("%1").arg(count);
+TQString str= TQString("%1").tqarg(count);
int l=strlen(str); //get the string length
-for(;l<zeros;l++) str = QString("0") + str;
+for(;l<zeros;l++) str = TQString("0") + str;
return str;
}
-QString posConv( QString str, int zeros )
+TQString posConv( TQString str, int zeros )
{
-int point=str.find(".",0);
-QString dec= QString("%1").arg(str.mid(point+1,1));
+int point=str.tqfind(".",0);
+TQString dec= TQString("%1").tqarg(str.mid(point+1,1));
str = str.mid(0,point);
-str = QString("%1%2").arg(str).arg(dec);
+str = TQString("%1%2").tqarg(str).tqarg(dec);
return convZeros (str.toInt(), zeros);
}
@@ -237,30 +237,30 @@ else return 0;
}
-QString code39 (const QDomElement &e, int countBar) {
-
-QString result;
- result += QString("{XB%1;").arg( convZeros(countBar, 2) ); // count
- result += QString("%1").arg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
- result += QString(",%1").arg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
- result += QString(",%1").arg( barcodeType( e.attribute( "type") ) ); // Type of bar code
- result += QString(",%1").arg( withChecksum(e) ); // Type of check digit
- result += QString(",%1").arg( "03" ); // Narrow bar width
- result += QString(",%1").arg( "03" ); // Narrow space width
- result += QString(",%1").arg( "06" ); // Wide bar width
- result += QString(",%1").arg( "06" ); // Wide space width
- result += QString(",%1").arg( "03" ); // Character to Character space width
- result += QString(",%1").arg( rotation(e.attribute( "rotation", "0" ).toInt())); // Rotation angel of barcode
- result += QString(",%1").arg( "0063" ); // height of barcode
- result += QString(",+%1").arg( sequence(e) ); // Increment / Decrement
- result += QString(",%1").arg( e.attribute( "text", "1" ).toInt() ); // Selection of print or non print of numerals under bars
- result += QString(",00"); //Number of Zeros to be suppressed
- result += QString("|}\n"); // FIN
+TQString code39 (const TQDomElement &e, int countBar) {
+
+TQString result;
+ result += TQString("{XB%1;").tqarg( convZeros(countBar, 2) ); // count
+ result += TQString("%1").tqarg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
+ result += TQString(",%1").tqarg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
+ result += TQString(",%1").tqarg( barcodeType( e.attribute( "type") ) ); // Type of bar code
+ result += TQString(",%1").tqarg( withChecksum(e) ); // Type of check digit
+ result += TQString(",%1").tqarg( "03" ); // Narrow bar width
+ result += TQString(",%1").tqarg( "03" ); // Narrow space width
+ result += TQString(",%1").tqarg( "06" ); // Wide bar width
+ result += TQString(",%1").tqarg( "06" ); // Wide space width
+ result += TQString(",%1").tqarg( "03" ); // Character to Character space width
+ result += TQString(",%1").tqarg( rotation(e.attribute( "rotation", "0" ).toInt())); // Rotation angel of barcode
+ result += TQString(",%1").tqarg( "0063" ); // height of barcode
+ result += TQString(",+%1").tqarg( sequence(e) ); // Increment / Decrement
+ result += TQString(",%1").tqarg( e.attribute( "text", "1" ).toInt() ); // Selection of print or non print of numerals under bars
+ result += TQString(",00"); //Number of Zeros to be suppressed
+ result += TQString("|}\n"); // FIN
return result;
}
-QString barcodeType(const QString &type){
+TQString barcodeType(const TQString &type){
if (type == "i25") return "2";
if (type == "i25 -c") return "2";
if (type == "msi") return "1";
@@ -294,7 +294,7 @@ return "0";
}
-QString withChecksum( const QDomElement &e) {
+TQString withChecksum( const TQDomElement &e) {
if (e.attribute("type")=="code39 -c") return "1";
if (e.attribute("type")=="code39") return "3";
if (e.attribute("type")=="ean") return "3";
@@ -364,37 +364,37 @@ return "0";
}
-QString sequence(const QDomElement &e){
+TQString sequence(const TQDomElement &e){
return convZeros(e.attribute("sequencestep" ,"0").toInt() ,10);
}
-QString code128 (const QDomElement &e, int countBar) {
-
-QString result;
- result += QString("{XB%1;").arg( convZeros(countBar, 2) ); // count
- result += QString("%1").arg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
- result += QString(",%1").arg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
- result += QString(",%1").arg( barcodeType( e.attribute( "type") ) ); // Type of bar code
- result += QString(",%1").arg( withChecksum(e) ); // Type of check digit
- result += QString(",%1").arg( "03" ); // 1 module width
- result += QString(",%1").arg( rotation(e.attribute( "rotation", "0" ).toInt())); // Rotation angel of barcode
- result += QString(",%1").arg( "0063" ); // height of barcode
- result += QString(",+%1").arg( sequence(e) ); // Increment / Decrement
- result += QString(",000"); // Length of th WPC guard bar
- result += QString(",%1").arg( e.attribute( "text", "1" ).toInt() ); // Selection of print or non print of numerals under bars
- result += QString(",00"); //Number of Zeros to be suppressed
- result += QString("|}\n"); // FIN
+TQString code128 (const TQDomElement &e, int countBar) {
+
+TQString result;
+ result += TQString("{XB%1;").tqarg( convZeros(countBar, 2) ); // count
+ result += TQString("%1").tqarg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
+ result += TQString(",%1").tqarg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
+ result += TQString(",%1").tqarg( barcodeType( e.attribute( "type") ) ); // Type of bar code
+ result += TQString(",%1").tqarg( withChecksum(e) ); // Type of check digit
+ result += TQString(",%1").tqarg( "03" ); // 1 module width
+ result += TQString(",%1").tqarg( rotation(e.attribute( "rotation", "0" ).toInt())); // Rotation angel of barcode
+ result += TQString(",%1").tqarg( "0063" ); // height of barcode
+ result += TQString(",+%1").tqarg( sequence(e) ); // Increment / Decrement
+ result += TQString(",000"); // Length of th WPC guard bar
+ result += TQString(",%1").tqarg( e.attribute( "text", "1" ).toInt() ); // Selection of print or non print of numerals under bars
+ result += TQString(",00"); //Number of Zeros to be suppressed
+ result += TQString("|}\n"); // FIN
return result;
}
#if 0
-QString serialWatch(){
+TQString serialWatch(){
int fd, res, exit=1;
struct termios oldtio,newtio;
char buf[MAXDATASIZE];
-QString result,temp;
+TQString result,temp;
//fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY );
@@ -407,7 +407,7 @@ newtio.c_iflag = IGNPAR; // | ICRNL;
newtio.c_oflag = 0;
newtio.c_lflag =0;// ICANON;
newtio.c_cc[VINTR] = 0; /* Ctrl-c */
-newtio.c_cc[VQUIT] = 0; /* Ctrl-\ */
+newtio.c_cc[VTQUIT] = 0; /* Ctrl-\ */
newtio.c_cc[VERASE] = 0; /* del */
newtio.c_cc[VKILL] = 0; /* @ */
newtio.c_cc[VEOF] = 4; /* Ctrl-d */
@@ -434,12 +434,12 @@ while (res ==-1 ){
//sleep(10);
res=read(fd,buf,MAXDATASIZE);
}
-temp = QString(buf);
+temp = TQString(buf);
//qDebug ("serial: "+temp+"\n");
// LF = = 10
// CR = \r = 13
-if (temp.find(QString("\r"),0,1)==-1) result+= temp;
+if (temp.tqfind(TQString("\r"),0,1)==-1) result+= temp;
else {
result+= temp;
exit=0;
@@ -454,24 +454,24 @@ return result;
-QString pdf417 (const QDomElement &e, int countBar) {
+TQString pdf417 (const TQDomElement &e, int countBar) {
-QString result;
- result += QString("{XB%1;").arg( convZeros(countBar, 2) ); // count
- result += QString("%1").arg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
- result += QString(",%1").arg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
- result += QString(",P"); // Type of bar code ALWAYS PDF417
- result += QString(",%1").arg( withChecksum(e) ); // Type of check digit
- result += QString(",%1").arg( "03" ); // Module Width
- result += QString(",%1").arg( convZeros(e.attribute("pdf417.col").toInt(),2 )); // Number of columns
- result += QString(",%1").arg( rotation(e.attribute( "rotation", "0" ).toInt())); // Rotation angel of barcode
- result += QString(",%1").arg( "0063" ); // height of barcode
- result += QString("|}\n"); // FIN
+TQString result;
+ result += TQString("{XB%1;").tqarg( convZeros(countBar, 2) ); // count
+ result += TQString("%1").tqarg( posConv(e.attribute( "x_mm"), 4 ) ); // X position
+ result += TQString(",%1").tqarg( posConv(e.attribute( "y_mm"), 4 ) ); // Y position
+ result += TQString(",P"); // Type of bar code ALWAYS PDF417
+ result += TQString(",%1").tqarg( withChecksum(e) ); // Type of check digit
+ result += TQString(",%1").tqarg( "03" ); // Module Width
+ result += TQString(",%1").tqarg( convZeros(e.attribute("pdf417.col").toInt(),2 )); // Number of columns
+ result += TQString(",%1").tqarg( rotation(e.attribute( "rotation", "0" ).toInt())); // Rotation angel of barcode
+ result += TQString(",%1").tqarg( "0063" ); // height of barcode
+ result += TQString("|}\n"); // FIN
return result;
}
-QString getData(const QString &etext, const QString &art, const QString &group, const QString &id){
+TQString getData(const TQString &etext, const TQString &art, const TQString &group, const TQString &id){
TokenProvider token( NULL );
token.setArticleNo( art );
token.setGroup( group );
@@ -486,141 +486,141 @@ QString getData(const QString &etext, const QString &art, const QString &group,
return token.parse( etext );
/*
-QString temp;
-
-
-if (etext.contains("[serial_watch]") ) etext.replace( "[serial_watch]" , serialWatch() );
-if (etext.contains("[customer_no]") ) etext.replace( "[customer_no]" , id );
-if (etext.contains("[customer_name]") ) etext.replace( "[customer_name]" , name );
-if (etext.contains("[group]") ) etext.replace( "[group]" , group );
-if (etext.contains("[article_no]") ) etext.replace( "[article_no]" , art );
-if (etext.contains("[line1]") ) {
- QSqlQuery query("SELECT line1 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line1]" , temp );
- }
-if (etext.contains("[line0]") ) {
- QSqlQuery query("SELECT line0 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line0]" , temp );
- }
-if (etext.contains("[line2]") ) {
- QSqlQuery query("SELECT line2 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line2]" , temp );
- }
-if (etext.contains("[line3]") ) {
- QSqlQuery query("SELECT line3 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line3]" , temp );
- }
-if (etext.contains("[line4]") ) {
- QSqlQuery query("SELECT line4 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line4]" , temp );
- }
-if (etext.contains("[line5]") ) {
- QSqlQuery query("SELECT line5 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line5]" , temp );
- }
-if (etext.contains("[line6]") ) {
- QSqlQuery query("SELECT line6 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line6]" , temp );
- }
-if (etext.contains("[line7]") ) {
- QSqlQuery query("SELECT line7 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line7]" , temp );
- }
-if (etext.contains("[line8]") ) {
- QSqlQuery query("SELECT line8 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line8]" , temp );
- }
-if (etext.contains("[line9]") ) {
- QSqlQuery query("SELECT line9 FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[line9]" , temp );
- }
-if (etext.contains("[field0]") ) {
- QSqlQuery query("SELECT field0 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field0]" , temp );
- }
-if (etext.contains("[field1]") ) {
- QSqlQuery query("SELECT field1 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field1]" , temp );
- }
-if (etext.contains("[field2]") ) {
- QSqlQuery query("SELECT field2 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field2]" , temp );
- }
-if (etext.contains("[field3]") ) {
- QSqlQuery query("SELECT field3 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field3]" , temp );
- }
-if (etext.contains("[field4]") ) {
- QSqlQuery query("SELECT field4 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field4]" , temp );
- }
-if (etext.contains("[field5]") ) {
- QSqlQuery query("SELECT field5 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field5]" , temp );
- }
-if (etext.contains("[field6]") ) {
- QSqlQuery query("SELECT field6 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field6]" , temp );
- }
-if (etext.contains("[field7]") ) {
- QSqlQuery query("SELECT field7 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field7]" , temp );
- }
-if (etext.contains("[field8]") ) {
- QSqlQuery query("SELECT field8 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field8]" , temp );
- }
-if (etext.contains("[field9]") ) {
- QSqlQuery query("SELECT field9 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field9]" , temp );
- }
-if (etext.contains("[article_desc]") ) {
- QSqlQuery query("SELECT article_desc FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[article_desc]" , temp );
- }
-if (etext.contains("[barcode_no]") ) {
- QSqlQuery query("SELECT barcode_no FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[barcode_no]" , temp );
- }
-if (etext.contains("[field9]") ) {
- QSqlQuery query("SELECT field9 FROM barcode_basic where article_no='" + art + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[field9]" , temp );
- }
-if (etext.contains("[article_no_customer]") ) {
- QSqlQuery query("SELECT article_no_customer FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace( "[article_no_customer]" , temp );
- }
-if (etext.contains("[barcode_no_customer]") ){
- QSqlQuery query("SELECT barcode_no FROM customer_text where customer_no='" + id + "'" );
- while( query.next() ) temp = QString (query.value( 0 ).toString());
- etext.replace("[barcode_no_customer]" , temp );
- }
-if (etext.contains("[date]") ) etext.replace( "[date]" ,QDateTime::currentDateTime().toString( KBarcodeSettings::getDateFormat() ));
-if (etext.contains("[time]") ) etext.replace( "[time]" ,QTime::currentTime().toString());
+TQString temp;
+
+
+if (etext.tqcontains("[serial_watch]") ) etext.tqreplace( "[serial_watch]" , serialWatch() );
+if (etext.tqcontains("[customer_no]") ) etext.tqreplace( "[customer_no]" , id );
+if (etext.tqcontains("[customer_name]") ) etext.tqreplace( "[customer_name]" , name );
+if (etext.tqcontains("[group]") ) etext.tqreplace( "[group]" , group );
+if (etext.tqcontains("[article_no]") ) etext.tqreplace( "[article_no]" , art );
+if (etext.tqcontains("[line1]") ) {
+ TQSqlQuery query("SELECT line1 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line1]" , temp );
+ }
+if (etext.tqcontains("[line0]") ) {
+ TQSqlQuery query("SELECT line0 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line0]" , temp );
+ }
+if (etext.tqcontains("[line2]") ) {
+ TQSqlQuery query("SELECT line2 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line2]" , temp );
+ }
+if (etext.tqcontains("[line3]") ) {
+ TQSqlQuery query("SELECT line3 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line3]" , temp );
+ }
+if (etext.tqcontains("[line4]") ) {
+ TQSqlQuery query("SELECT line4 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line4]" , temp );
+ }
+if (etext.tqcontains("[line5]") ) {
+ TQSqlQuery query("SELECT line5 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line5]" , temp );
+ }
+if (etext.tqcontains("[line6]") ) {
+ TQSqlQuery query("SELECT line6 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line6]" , temp );
+ }
+if (etext.tqcontains("[line7]") ) {
+ TQSqlQuery query("SELECT line7 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line7]" , temp );
+ }
+if (etext.tqcontains("[line8]") ) {
+ TQSqlQuery query("SELECT line8 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line8]" , temp );
+ }
+if (etext.tqcontains("[line9]") ) {
+ TQSqlQuery query("SELECT line9 FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[line9]" , temp );
+ }
+if (etext.tqcontains("[field0]") ) {
+ TQSqlQuery query("SELECT field0 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field0]" , temp );
+ }
+if (etext.tqcontains("[field1]") ) {
+ TQSqlQuery query("SELECT field1 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field1]" , temp );
+ }
+if (etext.tqcontains("[field2]") ) {
+ TQSqlQuery query("SELECT field2 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field2]" , temp );
+ }
+if (etext.tqcontains("[field3]") ) {
+ TQSqlQuery query("SELECT field3 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field3]" , temp );
+ }
+if (etext.tqcontains("[field4]") ) {
+ TQSqlQuery query("SELECT field4 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field4]" , temp );
+ }
+if (etext.tqcontains("[field5]") ) {
+ TQSqlQuery query("SELECT field5 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field5]" , temp );
+ }
+if (etext.tqcontains("[field6]") ) {
+ TQSqlQuery query("SELECT field6 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field6]" , temp );
+ }
+if (etext.tqcontains("[field7]") ) {
+ TQSqlQuery query("SELECT field7 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field7]" , temp );
+ }
+if (etext.tqcontains("[field8]") ) {
+ TQSqlQuery query("SELECT field8 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field8]" , temp );
+ }
+if (etext.tqcontains("[field9]") ) {
+ TQSqlQuery query("SELECT field9 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field9]" , temp );
+ }
+if (etext.tqcontains("[article_desc]") ) {
+ TQSqlQuery query("SELECT article_desc FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[article_desc]" , temp );
+ }
+if (etext.tqcontains("[barcode_no]") ) {
+ TQSqlQuery query("SELECT barcode_no FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[barcode_no]" , temp );
+ }
+if (etext.tqcontains("[field9]") ) {
+ TQSqlQuery query("SELECT field9 FROM barcode_basic where article_no='" + art + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[field9]" , temp );
+ }
+if (etext.tqcontains("[article_no_customer]") ) {
+ TQSqlQuery query("SELECT article_no_customer FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace( "[article_no_customer]" , temp );
+ }
+if (etext.tqcontains("[barcode_no_customer]") ){
+ TQSqlQuery query("SELECT barcode_no FROM customer_text where customer_no='" + id + "'" );
+ while( query.next() ) temp = TQString (query.value( 0 ).toString());
+ etext.tqreplace("[barcode_no_customer]" , temp );
+ }
+if (etext.tqcontains("[date]") ) etext.tqreplace( "[date]" ,TQDateTime::tqcurrentDateTime().toString( KBarcodeSettings::getDateFormat() ));
+if (etext.tqcontains("[time]") ) etext.tqreplace( "[time]" ,TQTime::currentTime().toString());
return etext;*/
}
@@ -628,31 +628,31 @@ return etext;*/
-QString lineWidth(const QDomElement &e){
-QString result;
+TQString lineWidth(const TQDomElement &e){
+TQString result;
int width = e.attribute("line-width").toInt();
if (width > 0 and width < 10) return result.setNum(width);
else return "9"; //Max width supported
}
-QString image (const QString &file){
+TQString image (const TQString &file){
int fd, res;
char buf[1];
-QString result;
+TQString result;
fd = open(file, O_RDONLY);
if (fd <0) return "Port Error.";
res=read(fd,buf,1);
while (res == 1){
-result += QString(buf);
+result += TQString(buf);
res=read(fd,buf,1);
}
return result;
}
-QString getImage( const QString &id){
-QString file;
-QSqlQuery query("SELECT line9 FROM customer_text where customer_no='" + id + "'" );
-while( query.next() ) file = QString (query.value( 0 ).toString());
+TQString getImage( const TQString &id){
+TQString file;
+TQSqlQuery query("SELECT line9 FROM customer_text where customer_no='" + id + "'" );
+while( query.next() ) file = TQString (query.value( 0 ).toString());
return image(file);
}