Logo Search packages:      
Sourcecode: kbarcode version File versions  Download package

void LabelEditor::exportZPL (  )  [private, slot]

export to the Zebra Printing Language

Definition at line 855 of file labeleditor.cpp.

References DrawingRect::borderWidth(), ExportUtils::close(), BarCode::data(), DrawingRect::isCircle(), BarCode::pixmap(), ExportUtils::setBarcode(), ExportUtils::setImage(), ExportUtils::setRect(), ExportUtils::setTextField(), and CanvasText::text().

{
    KMessageBox::information( this, "The export code is still in development and its output might not be correct!" );

    KFileDialog fd( QString::null, "*.zpl|Zebra Printer Language (*.zpl)\n*.ipl|Intermec Printer Language (*.ipl)", this, "fd", true );
    if( fd.exec() != QDialog::Accepted )
        return;

    QFile file( fd.selectedFile() );
    if( !file.open( IO_WriteOnly ) )
        return;

    QTextStream t( &file );
    ExportUtils* z;
    if( fd.currentFilter() == "*.zpl" )
        z = new ZPLUtils( &t, cv );
    else if( fd.currentFilter() == "*.ipl" )
        z = new IPLUtils( &t, cv );
    else {
        qDebug("invalid filter");
        return;
    }
    
    QCanvasItemList list = c->allItems();
    for( unsigned int i = 0; i < list.count(); i++ )
        if( list[i]->rtti() == TEXT_RTTI ) {
            CanvasText* text = static_cast<CanvasText*>(list[i]);

            QString tt = text->text();
            z->setTextField( (int)text->x() - cv->getTranslation().x(), (int)text->y() - cv->getTranslation().y(), text->text() );
        } else if( list[i]->rtti() == BARCODE_RTTI ) {
            CanvasBarcode* barcode = static_cast<CanvasBarcode*>(list[i]);
            z->setBarcode( (int)barcode->x() - cv->getTranslation().x(), (int)barcode->y() - cv->getTranslation().y(),
                                      barcode->pixmap().height(),
                                      barcode->data().value, barcode->data().type );
            
        } else if( list[i]->rtti() == RECT_RTTI ) {
            DrawingRect* rect = static_cast<DrawingRect*>(list[i]);
            QSize size( rect->width(), rect->height() );
            z->setRect( (int)rect->x() - cv->getTranslation().x(), (int)rect->y() - cv->getTranslation().y(), size, rect->isCircle(), rect->borderWidth() );
        } else if( list[i]->rtti() == PIC_RTTI ) {
            PictureRectangle* rect = static_cast<PictureRectangle*>(list[i]);
            QImage img = rect->getTransformedPixmap().convertToImage();
            z->setImage( (int)rect->x() - cv->getTranslation().x(), (int)rect->y() - cv->getTranslation().y(), &img );
        }
        

    z->close();
    file.close();
}


Generated by  Doxygen 1.6.0   Back to index