Fix functionality broken by commit fc06df3

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/8/head
Michele Calgaro 1 year ago
parent fc06df3386
commit 6ca861bdae
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -204,7 +204,7 @@ void BarCodeDialog::copy()
BarcodeItem* item = new BarcodeItem( bc );
DocumentItemList list;
list.append( item );
list.push_back( item );
DocumentItemDrag* drag = new DocumentItemDrag();
drag->setDocumentItem( &list );

@ -999,7 +999,6 @@ void BatchWizard::fillVarList()
XMLUtils util;
DocumentItemList list;
list.setAutoDelete( true );
TokenProvider token( TQT_TQPAINTDEVICE(this) );
Definition* def = NULL;
@ -1017,8 +1016,8 @@ void BatchWizard::fillVarList()
m_varTable->setNumCols( vars.count() );
for( unsigned int i = 0; i < vars.count(); i++ )
{
vars[i] = vars[i].right( vars[i].length() - 1 );
m_varTable->horizontalHeader()->setLabel( i, vars[i] );
vars[i] = vars[i].right( vars[i].length() - 1 );
m_varTable->horizontalHeader()->setLabel( i, vars[i] );
}
delete def;

@ -20,7 +20,6 @@
#include <xmlutils.h>
#include <tqobject.h>
#include <tqptrlist.h>
#include <tqstring.h>
#include <tqtextstream.h>
@ -224,7 +223,5 @@ const TQString DocumentItem::visibilityScript() const
return m_visibilityScript;
}
typedef TQPtrList<DocumentItem> DocumentItemList;
#endif //DOCUMENTITEM_H

@ -29,7 +29,6 @@ DocumentItemDlg::DocumentItemDlg( TokenProvider* token, DocumentItem* item, KCom
{
m_item = item;
m_history = history;
//m_list.setAutoDelete( false );
TQVBox* boxBorder = addVBoxPage(i18n("&Position && Size"), TQString(), TQPixmap() );
addPage( new PropertySize( boxBorder ) );

@ -15,6 +15,8 @@
* *
***************************************************************************/
#include <algorithm>
#include "label.h"
#include "measurements.h"
#include "kbarcode.h"
@ -72,6 +74,13 @@ Label::Label( Definition* _def, TQIODevice* device, TQString labelname, TQPaintD
Label::~Label()
{
for (DocumentItem *item : m_list)
{
if (item)
{
delete item;
}
}
}
void Label::epcl( TQTextStream* stream )
@ -79,7 +88,7 @@ void Label::epcl( TQTextStream* stream )
*stream << EPCLUtils::header();
DocumentItem* item;
for( item = m_list.first();item;item=m_list.next())
for (DocumentItem *item : m_list)
if( drawThisItem( item ) )
item->drawEPcl( stream );
@ -92,7 +101,7 @@ void Label::ipl( TQTextStream* stream )
*stream << utils.header();
DocumentItem* item;
for( item = m_list.first();item;item=m_list.next())
for (DocumentItem *item : m_list)
if( drawThisItem( item ) )
item->drawIpl( stream, &utils );
@ -105,7 +114,7 @@ void Label::zpl( TQTextStream* stream )
*stream << ZPLUtils::header();
DocumentItem* item;
for( item = m_list.first();item;item=m_list.next())
for (DocumentItem *item : m_list)
if( drawThisItem( item ) )
item->drawZpl( stream );
@ -117,7 +126,7 @@ void Label::InitBarcodes()
bool firstbarcode = true;
DocumentItem* item;
for( item = m_list.first();item;item=m_list.next())
for (DocumentItem *item : m_list)
{
if( item->rtti() == eRtti_Barcode )
{
@ -155,7 +164,7 @@ void Label::draw( TQPainter* painter, int x, int y )
InitBarcodes();
DocumentItem* item;
for( item = m_list.first();item;item=m_list.next())
for (DocumentItem *item : m_list)
if( drawThisItem( item ) )
{
// add x and y to clip coordinates
@ -231,13 +240,12 @@ void Label::load( TQIODevice* device )
delete definition;
readDocumentItems( &m_list, &doc, NULL, kbarcode18 );
m_list.setAutoDelete( true );
// sort the list by z index
m_list.sort();
std::sort(m_list.begin(), m_list.end(), [](DocumentItem *a, DocumentItem *b) { return *a < *b; });
DocumentItem* item;
for( item = m_list.first();item;item=m_list.next())
for (DocumentItem *item : m_list)
{
// set the paint device for all items
item->setPaintDevice( m_printer );
@ -295,7 +303,7 @@ bool Label::drawThisItem( const DocumentItem* item )
bool Label::update()
{
DocumentItem* item;
for( item = m_list.first();item;item=m_list.next())
for (DocumentItem *item : m_list)
if( !item->visibilityScript().isEmpty() && item->visibilityScript() != "true" )
return true;

@ -390,11 +390,11 @@ bool LabelEditor::openUrl( const TQString & url )
DocumentItemList list;
readDocumentItems( &list, &doc, m_token, kbarcode18 );
for( unsigned int i=0;i<list.count();i++ )
for( unsigned int i=0;i<list.size();i++ )
{
TCanvasItem* citem = new TCanvasItem( cv );
citem->setItem( list.at( i ) );
citem->addRef();
citem->addRef();
}
list.clear();
@ -625,9 +625,6 @@ void LabelEditor::insertText()
void LabelEditor::insertDataText()
{
// DocumentItemList list = cv->getAllItems();
// TQStringList vars = m_token->listUserVars( &list );
TokenDialog dlg( m_token, this, "dlg" );
if( dlg.exec() == TQDialog::Accepted )
insertText( dlg.token() );
@ -974,7 +971,7 @@ void LabelEditor::copy()
DocumentItemList items;
for( unsigned int i=0;i<list.count();i++)
items.append( (list[i])->item() );
items.push_back( (list[i])->item() );
DocumentItemDrag* drag = new DocumentItemDrag();
drag->setDocumentItem( &items );

@ -67,7 +67,7 @@ void DocumentItemDrag::setDocumentItem( DocumentItemList* list )
doc.appendChild( root );
XMLUtils xml;
for( unsigned int i=0;i<list->count();i++)
for( unsigned int i=0;i<list->size();i++)
{
DocumentItem* item = list->at( i );
xml.writeXMLDocumentItem( &root, &item );

@ -529,7 +529,7 @@ DocumentItemList MyCanvasView::getAllItems()
TQCanvasItemList list = canvas()->allItems();
for( unsigned int i = 0; i < list.count(); i++ )
l.append( ((TCanvasItem*)list[i])->item() );
l.push_back( ((TCanvasItem*)list[i])->item() );
return l;
}

@ -90,9 +90,9 @@ class MyCanvasView : public TQCanvasView
MyCanvasView( Definition* d, MyCanvas *c, TQWidget* parent=0, const char* name=0, WFlags f=0);
~MyCanvasView();
/** return a list of all DocumentItems on the canvas
*/
DocumentItemList getAllItems();
/** return a list of all DocumentItems on the canvas
*/
DocumentItemList getAllItems();
TCanvasItemList getSelected();

@ -401,7 +401,7 @@ TQStringList TokenProvider::listUserVars()
m_findUserVarsList = &lst;
for( i=0;i<m_document_items.count();i++ )
for( i=0;i<m_document_items.size();i++ )
{
item = m_document_items.at(i);
t = TQString();

@ -121,7 +121,6 @@ void XMLUtils::writeXMLHeader( TQDomNode* root, const TQString & description, De
void XMLUtils::readDocumentItems( DocumentItemList* list, TQDomDocument* doc, TokenProvider* token, bool kbarcode18 )
{
TQDomNode n = doc->documentElement().firstChild();
list->setAutoDelete( false );
if( kbarcode18 )
{
@ -136,7 +135,7 @@ void XMLUtils::readDocumentItems( DocumentItemList* list, TQDomDocument* doc, To
bcode->updateBarcode();
bcode->setZ( e.attribute( "z", "0" ).toInt() );
list->append( bcode );
list->push_back( bcode );
} else if( e.tagName() == "textfield" ) {
TextItem* t = new TextItem();
t->setTokenProvider( token );
@ -157,7 +156,7 @@ void XMLUtils::readDocumentItems( DocumentItemList* list, TQDomDocument* doc, To
n = n.nextSibling();
}
list->append( t );
list->push_back( t );
} else if( e.tagName() == "picture" ) {
ImageItem* r = new ImageItem();
@ -169,7 +168,7 @@ void XMLUtils::readDocumentItems( DocumentItemList* list, TQDomDocument* doc, To
r->setPixmap( pix );
r->setRotation( e.attribute("rotation", "0.0" ).toDouble() );
r->setZ( e.attribute( "z", "0" ).toInt() );
list->append( r );
list->push_back( r );
} else if( e.tagName() == "rect" ) {
RectItem* r = new RectItem();
@ -181,7 +180,7 @@ void XMLUtils::readDocumentItems( DocumentItemList* list, TQDomDocument* doc, To
r->setPen( TQPen(readXMLColor( &e, "bordercolor", TQt::black ),e.attribute( "borderwidth", "1" ).toInt(),(TQt::PenStyle)e.attribute( "borderstyle", "1" ).toInt() ));
r->setColor( readXMLColor( &e, "color", TQt::black ) );
list->append( r );
list->push_back( r );
} else if( e.tagName() == "line" ) {
#warning "TODO: test legacy loading of lines"
LineItem* cl = new LineItem();
@ -192,7 +191,7 @@ void XMLUtils::readDocumentItems( DocumentItemList* list, TQDomDocument* doc, To
cl->setZ( e.attribute( "z", "0" ).toInt() );
cl->setPen( TQPen( readXMLColor( &e, "color", TQt::black ),
e.attribute( "width", "0" ).toInt(), (TQPen::PenStyle)e.attribute( "style", "0" ).toInt() ) );
list->append( cl );
list->push_back( cl );
}
n = n.nextSibling();
}
@ -205,7 +204,7 @@ void XMLUtils::readDocumentItems( DocumentItemList* list, TQDomDocument* doc, To
{
DocumentItem* item = NULL;
if( readXMLDocumentItem( &e, &item, token ) )
list->append( item );
list->push_back( item );
}
n = n.nextSibling();
}

@ -19,7 +19,7 @@
#define XMLUTILS_H
#include <tqmap.h>
#include <tqptrlist.h>
#include <vector>
class DocumentItem;
class BarcodeItem;
@ -34,7 +34,7 @@ class TQDomNode;
class TQRect;
class TQString;
class TQWidget;
typedef TQPtrList<DocumentItem> DocumentItemList;
typedef std::vector<DocumentItem*> DocumentItemList;
/** This class provides helper function for saving and reading to XML files.
*

Loading…
Cancel
Save