| 
     
      
      
      From: <vz...@us...> - 2008-02-28 00:10:03
       
   | 
Revision: 26
          http://kbarcode.svn.sourceforge.net/kbarcode/?rev=26&view=rev
Author:   vzsolt
Date:     2008-02-27 16:10:08 -0800 (Wed, 27 Feb 2008)
Log Message:
-----------
I've yet to find what's really new in the QTextStream class. It's supposed to be buffered now both when reading and writing, so I've added flush() everywhere when the stream is not on the stack.
(The buffers get flushed while the object is being destroyed.)
Modified Paths:
--------------
    trunk/src/barcodeitem.cpp
    trunk/src/barcodeitem.h
    trunk/src/batchprinter.cpp
    trunk/src/csvfile.h
    trunk/src/csvimportdlg.cpp
    trunk/src/definition.cpp
    trunk/src/documentitem.h
    trunk/src/imageitem.cpp
    trunk/src/imageitem.h
    trunk/src/label.cpp
    trunk/src/label.h
    trunk/src/purepostscript.cpp
    trunk/src/rectitem.cpp
    trunk/src/rectitem.h
    trunk/src/textitem.cpp
    trunk/src/textitem.h
    trunk/src/textlineitem.cpp
    trunk/src/textlineitem.h
    trunk/src/zplutils.cpp
    trunk/src/zplutils.h
Modified: trunk/src/barcodeitem.cpp
===================================================================
--- trunk/src/barcodeitem.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/barcodeitem.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -21,6 +21,7 @@
 #include <qdom.h>
 #include <qpainter.h>
 #include <QPaintDevice>
+#include <QTextStream>
 
 BarcodeItem::BarcodeItem()
     : Barkode(), DocumentItem()
@@ -201,6 +202,7 @@
     *stream << ZPLUtils::fieldOrigin( rect().x(), rect().y() );
     *stream << "^B" << encoding;
     *stream << ZPLUtils::fieldData( value() );
+    stream -> flush();
 }
 
 void BarcodeItem::drawIpl(  QTextStream* stream, IPLUtils* utils )
@@ -224,6 +226,7 @@
     
     *stream << utils->field( s );
     utils->addValue( value() );
+    stream -> flush();
 }
 
 void BarcodeItem::drawEPcl( QTextStream* stream )
@@ -243,6 +246,7 @@
     s += QString(" %1").arg( value() );
 
     *stream << EPCLUtils::field( s );
+    stream -> flush();
 }
 
 void BarcodeItem::updateBarcode()
Modified: trunk/src/barcodeitem.h
===================================================================
--- trunk/src/barcodeitem.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/barcodeitem.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -20,6 +20,7 @@
 
 #include <qmap.h>
 #include <qpixmap.h>
+#include <QTextStream>
 
 #include "barkode.h"
 #include "gnubarcode.h"
Modified: trunk/src/batchprinter.cpp
===================================================================
--- trunk/src/batchprinter.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/batchprinter.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -27,8 +27,8 @@
 #include <qfile.h>
 #include <qpainter.h>
 #include <QPaintDevice>
+#include <QTextStream>
 #include <q3progressdialog.h>
-//Added by qt3to4:
 #include <QList>
 #include <QPixmap>
 
Modified: trunk/src/csvfile.h
===================================================================
--- trunk/src/csvfile.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/csvfile.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -20,8 +20,7 @@
 
 #include <qfile.h>
 #include <qstringlist.h>
-#include <q3textstream.h>
-//Added by qt3to4:
+#include <QTextStream>
 #include <QList>
 
 class QBuffer;
Modified: trunk/src/csvimportdlg.cpp
===================================================================
--- trunk/src/csvimportdlg.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/csvimportdlg.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -35,7 +35,7 @@
 #include <qsqlquery.h>
 #include <q3table.h>
 #include <qradiobutton.h>
-#include <q3textstream.h>
+#include <QTextStream>
 #include <q3vbox.h>
 //Added by qt3to4:
 #include <QHBoxLayout>
Modified: trunk/src/definition.cpp
===================================================================
--- trunk/src/definition.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/definition.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -19,7 +19,7 @@
 #include "sqltables.h"
 
 // Qt includes
-#include <q3textstream.h>
+#include <QTextStream>
 #include <qsqlquery.h>
 #include <qregexp.h>
 
Modified: trunk/src/documentitem.h
===================================================================
--- trunk/src/documentitem.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/documentitem.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -22,7 +22,7 @@
 #include <qobject.h>
 #include <q3sortedlist.h> 
 #include <qstring.h>
-#include <q3textstream.h>
+#include <QTextStream>
 
 #include <qcolor.h>
 #include <qpen.h>
Modified: trunk/src/imageitem.cpp
===================================================================
--- trunk/src/imageitem.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/imageitem.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -23,6 +23,7 @@
 #include <qimage.h>
 #include <QPaintDevice>
 #include <QX11Info>
+#include <QTextStream>
 
 #include <qpainter.h>
 #include <QPixmap>
@@ -81,7 +82,8 @@
         *stream << "~DYD,p,P," << QString::number( data.size() ) + ",0,";
         for( unsigned int i=0;i<data.size();i++)
             *stream << data[i];
-    }        
+    }
+    stream -> flush();
 }
 
 void ImageItem::drawIpl( QTextStream*, IPLUtils* )
@@ -125,6 +127,8 @@
 
 		*stream << "\r\n";
 	}
+        
+        stream -> flush();
 }
 
 void ImageItem::loadXML(QDomElement* element)
Modified: trunk/src/imageitem.h
===================================================================
--- trunk/src/imageitem.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/imageitem.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -20,6 +20,7 @@
 #include "documentitem.h"
 
 #include <qpixmap.h>
+#include <QTextStream>
 
 enum EImageScaling { eImage_Original = 0, eImage_Scaled, eImage_Zoomed };
 
Modified: trunk/src/label.cpp
===================================================================
--- trunk/src/label.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/label.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -85,6 +85,8 @@
 	    item->drawEPcl( stream );
     
     *stream << EPCLUtils::footer();
+    
+    stream -> flush();
 }
 
 void Label::ipl( QTextStream* stream )
@@ -98,6 +100,8 @@
 	    item->drawIpl( stream, &utils );
     
     *stream << utils.footer();
+    
+    stream -> flush();
 }
 
 
@@ -111,6 +115,8 @@
 	    item->drawZpl( stream );
     
     *stream << ZPLUtils::footer();
+    
+    stream -> flush();
 }
 
 void Label::InitBarcodes()
Modified: trunk/src/label.h
===================================================================
--- trunk/src/label.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/label.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -20,6 +20,8 @@
 
 #include <qfont.h>
 #include <q3picture.h>
+#include <QTextStream>
+
 #include "labelutils.h"
 #include "xmlutils.h"
 #include "definition.h"
@@ -32,7 +34,6 @@
 class QString;
 class QPainter;
 class QPaintDevice;
-class QTextStream;
 class QPrinter;
 /** Creates a QPicture from the XML KBarcode file. If a SQL connections is available
   * the data from the SQL tables will be used, too.
Modified: trunk/src/purepostscript.cpp
===================================================================
--- trunk/src/purepostscript.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/purepostscript.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -22,7 +22,7 @@
 
 #include <qdom.h>
 #include <qfile.h>
-#include <q3textstream.h>
+#include <QTextStream>
 
 #include <kstandarddirs.h>
 #include <ktemporaryfile.h>
Modified: trunk/src/rectitem.cpp
===================================================================
--- trunk/src/rectitem.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/rectitem.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -84,6 +84,8 @@
         *stream << QString("~GE%1,%2,%3,B").arg( rect().width() ).arg( rect().height() ).arg( thick );
     else
         *stream << QString("~GB%1,%2,%3,B,0").arg( rect().width() ).arg( rect().height() ).arg( thick );
+
+    stream -> flush();
 }
 
 void RectItem::drawIpl( QTextStream* stream, IPLUtils* utils )
@@ -106,6 +108,8 @@
     
         *stream << utils->field( s );
     }
+    
+    stream -> flush();
 }
 
 void RectItem::drawEPcl( QTextStream* stream )
@@ -117,6 +121,8 @@
     s += QString(" %1 2").arg( pen().width() );
 
     *stream << EPCLUtils::field( s );
+    
+    stream -> flush();
 }
 
 void RectItem::init()
Modified: trunk/src/rectitem.h
===================================================================
--- trunk/src/rectitem.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/rectitem.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -18,6 +18,8 @@
 #ifndef RECTITEM_H
 #define RECTITEM_H
 #include <qstring.h>
+#include <QTextStream>
+
 #include "documentitem.h"
 #include "qcolor.h"
 
Modified: trunk/src/textitem.cpp
===================================================================
--- trunk/src/textitem.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/textitem.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -126,6 +126,8 @@
     QString data = m_text.replace( QRegExp("<[^>]*>"), "" );
     *stream << ZPLUtils::fieldOrigin( rect().x(), rect().y() );
     *stream << ZPLUtils::font( QFont() ); // todo: select a valid font
+    
+    stream -> flush();
 }
 
 void TextItem::drawIpl( QTextStream* stream, IPLUtils* utils )
@@ -146,6 +148,7 @@
      
     *stream << utils->field( s );
     utils->addValue( data );
+    stream -> flush();
 }
 
 void TextItem::drawEPcl( QTextStream* stream )
@@ -171,6 +174,7 @@
         s += QString(" %1").arg( *line );
         *stream << EPCLUtils::field( s );
     }
+    stream -> flush();
 }
 
 void TextItem::loadXML (QDomElement* element)
Modified: trunk/src/textitem.h
===================================================================
--- trunk/src/textitem.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/textitem.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -19,6 +19,7 @@
 #define TEXTITEM_H
 #include <qstring.h>
 #include "documentitem.h"
+#include <QTextStream>
 
 class LabelEditor;
 
Modified: trunk/src/textlineitem.cpp
===================================================================
--- trunk/src/textlineitem.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/textlineitem.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -91,6 +91,8 @@
     QString data = m_text.replace( QRegExp("<[^>]*>"), "" );
     *stream << ZPLUtils::fieldOrigin( rect().x(), rect().y() );
     *stream << ZPLUtils::font( QFont() ); // todo: select a valid font
+
+    stream -> flush();
 }
 
 void TextLineItem::drawIpl( QTextStream* stream, IPLUtils* utils )
@@ -111,6 +113,8 @@
 
     *stream << utils->field( s );
     utils->addValue( data );
+
+    stream -> flush();
 }
 
 void TextLineItem::drawEPcl( QTextStream* stream )
@@ -135,6 +139,8 @@
 		s += QString(" %1").arg( *line );
 		*stream << EPCLUtils::field( s );
 	}
+
+        stream -> flush();
 }
 
 void TextLineItem::loadXML (QDomElement* element)
Modified: trunk/src/textlineitem.h
===================================================================
--- trunk/src/textlineitem.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/textlineitem.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -18,6 +18,8 @@
 #ifndef TEXTLINEITEM_H
 #define TEXTLINEITEM_H
 #include <qstring.h>
+#include <QTextStream>
+
 #include "documentitem.h"
 
 /**
Modified: trunk/src/zplutils.cpp
===================================================================
--- trunk/src/zplutils.cpp	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/zplutils.cpp	2008-02-28 00:10:08 UTC (rev 26)
@@ -23,7 +23,6 @@
 #include <QPaintDevice>
 #include <qregexp.h>
 #include <qstring.h>
-#include <q3textstream.h>
 
 // font table for IPL, thanks to Erich Kitzmueller
 struct { int size; int c; int h; int w; } iplfonttable[] = {
Modified: trunk/src/zplutils.h
===================================================================
--- trunk/src/zplutils.h	2008-02-27 23:37:04 UTC (rev 25)
+++ trunk/src/zplutils.h	2008-02-28 00:10:08 UTC (rev 26)
@@ -22,12 +22,12 @@
 #include <qstring.h>
 #include <qstringlist.h>
 #include <qmap.h>
+#include <QTextStream>
 
 class QColor;
 class QFont;
 class QImage;
 class QSize;
-class QTextStream;
 
 class BarcodePrinterDevice : public QPaintDevice {
     public:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |