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

void BatchPrinter::startImages (  ) 

start image generation

Definition at line 141 of file batchprinter.cpp.

References TokenProvider::barcodeNo(), createProgressDialog(), Definition::getMeasurements(), Measurements::height(), m_filename_article, m_format, m_path, parent, Label::picture(), TokenProvider::setSerial(), and Measurements::width().

{
    QProgressDialog* progress = createProgressDialog( i18n("Creating Images...") );

    // TODO: check if this still works
    Measurements* measure = def->getMeasurements();

    painter = new QPainter();
    QPixmap pixmap( (int)measure->width( parent ), (int)measure->height( parent ) );
    for( unsigned int z = 0; z < m_data->count(); z++ ) {
        Label l( def, buffer, m_name, parent, m_customer,
                 (*m_data)[z].article_no, (*m_data)[z].group );
        l.setSerial( m_serial, m_increment );

        QPicture* pic = l.picture();

        pixmap.fill( Qt::white );
        painter->begin( &pixmap );
        painter->drawPicture( 0, 0, *pic );
        painter->end();

        for( int i = 0; i < (*m_data)[z].number; i++ ) {
            QString filename = m_path + "/" +
                               ( m_filename_article ? (*m_data)[z].article_no : l.barcodeNo() )
                               + QString("_%1.").arg( i ) + KImageIO::suffix( m_format );

            unsigned int c = 0;
            while( QFile::exists( filename ) ) {
                filename += "." + QString::number( c );
                c++;
            }

            pixmap.save( filename, m_format );

            if( !checkProgressDialog( progress ) )
                return;
        }

    }
    delete progress;
}


Generated by  Doxygen 1.6.0   Back to index