Replaced various '#define' with actual strings - part 5

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/13/head
Michele Calgaro 6 months ago
parent 9503185fc6
commit d9f688ddbd
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -50,7 +50,7 @@ BarCodeDialog::BarCodeDialog( TQWidget* parent, const char* name )
Layout6 = new TQVBoxLayout( 0, 0, 6, "Layout2"); Layout6 = new TQVBoxLayout( 0, 0, 6, "Layout2");
widget = new BarcodeWidget( this, "widget" ); widget = new BarcodeWidget( this, "widget" );
m_token = new TokenProvider( TQT_TQPAINTDEVICE(TDEApplication::desktop()) ); m_token = new TokenProvider( TDEApplication::desktop() );
widget->setTokenProvider( m_token ); widget->setTokenProvider( m_token );
buttonGenerate = new KPushButton( this, "buttonGenerate" ); buttonGenerate = new KPushButton( this, "buttonGenerate" );
@ -120,7 +120,7 @@ void BarCodeDialog::generate()
Barkode d; Barkode d;
widget->getData( d ); widget->getData( d );
d.setTokenProvider( m_token ); d.setTokenProvider( m_token );
d.update( TQT_TQPAINTDEVICE(TDEApplication::desktop()) ); d.update( TDEApplication::desktop() );
barcode->setPixmap( d.pixmap() ); barcode->setPixmap( d.pixmap() );
@ -149,7 +149,7 @@ void BarCodeDialog::save()
bc.setTokenProvider( m_token ); bc.setTokenProvider( m_token );
bc.update( TQT_TQPAINTDEVICE(TDEApplication::desktop()) ); bc.update( TDEApplication::desktop() );
if(!bc.pixmap().save( path, extension.utf8(), 0 )) if(!bc.pixmap().save( path, extension.utf8(), 0 ))
KMessageBox::error( this, i18n("An error occurred during saving the image") ); KMessageBox::error( this, i18n("An error occurred during saving the image") );

@ -70,7 +70,7 @@ BatchPrinter::BatchPrinter( const TQString & path, TQWidget* p )
m_cur_data_count = 0; m_cur_data_count = 0;
m_paintDevice = TQT_TQPAINTDEVICE(p); m_paintDevice = p;
} }
BatchPrinter::BatchPrinter( const TQString & path, int format, TQWidget* _parent ) BatchPrinter::BatchPrinter( const TQString & path, int format, TQWidget* _parent )
@ -84,7 +84,7 @@ BatchPrinter::BatchPrinter( const TQString & path, int format, TQWidget* _parent
m_cur_data_count = 0; m_cur_data_count = 0;
m_paintDevice = TQT_TQPAINTDEVICE(_parent); m_paintDevice = _parent;
} }
BatchPrinter::~BatchPrinter() BatchPrinter::~BatchPrinter()
@ -133,7 +133,7 @@ void BatchPrinter::startPrintData( TQProgressDialog* progress )
for( unsigned int i = 0; i < m_data->count(); i++ ) for( unsigned int i = 0; i < m_data->count(); i++ )
{ {
Label l( def, TQT_TQIODEVICE(buffer), m_name, printer, m_customer, Label l( def, buffer, m_name, printer, m_customer,
(*m_data)[i].article_no, (*m_data)[i].group ); (*m_data)[i].article_no, (*m_data)[i].group );
l.setSerial( m_serial, m_increment ); l.setSerial( m_serial, m_increment );
@ -245,19 +245,19 @@ Label* BatchPrinter::initLabel( int* number )
if( m_vardata ) if( m_vardata )
{ {
l = new Label( def, TQT_TQIODEVICE(buffer), m_name, m_paintDevice ); l = new Label( def, buffer, m_name, m_paintDevice );
l->setUserVars( (*m_vardata)[m_cur_data_count] ); l->setUserVars( (*m_vardata)[m_cur_data_count] );
} }
else if( m_data ) else if( m_data )
{ {
l = new Label( def, TQT_TQIODEVICE(buffer), m_name, m_paintDevice, m_customer, l = new Label( def, buffer, m_name, m_paintDevice, m_customer,
(*m_data)[m_cur_data_count].article_no, (*m_data)[m_cur_data_count].group ); (*m_data)[m_cur_data_count].article_no, (*m_data)[m_cur_data_count].group );
if( number ) if( number )
*number = (*m_data)[m_cur_data_count].number; *number = (*m_data)[m_cur_data_count].number;
} }
else if( m_addrdata ) else if( m_addrdata )
{ {
l = new Label( def, TQT_TQIODEVICE(buffer), m_name, m_paintDevice ); l = new Label( def, buffer, m_name, m_paintDevice );
l->setAddressee( &((*m_addrdata)[m_cur_data_count]) ); l->setAddressee( &((*m_addrdata)[m_cur_data_count]) );
} }
@ -278,7 +278,7 @@ void BatchPrinter::startImages()
Measurements measure = def->getMeasurements(); Measurements measure = def->getMeasurements();
Label* l = NULL; Label* l = NULL;
painter = new TQPainter(); painter = new TQPainter();
TQPixmap pixmap( (int)measure.width( TQT_TQPAINTDEVICE(parent) ), (int)measure.height( TQT_TQPAINTDEVICE(parent) ) ); TQPixmap pixmap( (int)measure.width( parent ), (int)measure.height( parent ) );
while( (l = initLabel( &number ) ) != NULL ) while( (l = initLabel( &number ) ) != NULL )
{ {
for( int i = 0; i < number; i++ ) for( int i = 0; i < number; i++ )
@ -424,8 +424,8 @@ void BatchPrinter::drawBorders()
if( PrinterSettings::getInstance()->getData()->border ) { if( PrinterSettings::getInstance()->getData()->border ) {
painter->setPen( TQPen( TQt::black, 1 ) ); painter->setPen( TQPen( TQt::black, 1 ) );
painter->drawRect( (int)curw, (int)curh, painter->drawRect( (int)curw, (int)curh,
(int)m_measure.width( TQT_TQPAINTDEVICE(painter->device()) ), (int)m_measure.width( painter->device() ),
(int)m_measure.height( TQT_TQPAINTDEVICE(painter->device()) ) ); (int)m_measure.height( painter->device() ) );
} }
} }

@ -199,7 +199,7 @@ void BatchWizard::setupPage4()
void BatchWizard::setupPage5() void BatchWizard::setupPage5()
{ {
TokenProvider serial( TQT_TQPAINTDEVICE(this) ); TokenProvider serial( this );
page5 = new TQVBox( this, "page5" ); page5 = new TQVBox( this, "page5" );
@ -1000,7 +1000,7 @@ void BatchWizard::fillVarList()
XMLUtils util; XMLUtils util;
DocumentItemList list; DocumentItemList list;
TokenProvider token( TQT_TQPAINTDEVICE(this) ); TokenProvider token( this );
Definition* def = NULL; Definition* def = NULL;
TQString description; TQString description;

@ -35,7 +35,7 @@ CSVFile::CSVFile( const TQString & filename )
m_file.open( IO_ReadOnly ); m_file.open( IO_ReadOnly );
if( m_file.isOpen() ) if( m_file.isOpen() )
m_stream.setDevice( TQT_TQIODEVICE(&m_file) ); m_stream.setDevice( &m_file );
} }
CSVFile::CSVFile( TQBuffer & buf ) CSVFile::CSVFile( TQBuffer & buf )
@ -50,7 +50,7 @@ CSVFile::CSVFile( TQBuffer & buf )
buf.open( IO_ReadOnly ); buf.open( IO_ReadOnly );
if( buf.isOpen() ) if( buf.isOpen() )
m_stream.setDevice( TQT_TQIODEVICE(&buf) ); m_stream.setDevice( &buf );
} }
CSVFile::~CSVFile() CSVFile::~CSVFile()

@ -37,7 +37,7 @@ void DocumentItem::init()
{ {
m_canvasitem = NULL; m_canvasitem = NULL;
m_token = NULL; m_token = NULL;
m_device = TQT_TQPAINTDEVICE(TDEApplication::desktop()); m_device = TDEApplication::desktop();
m_z = 0; m_z = 0;
m_border = true; m_border = true;

@ -158,8 +158,8 @@ void Label::InitBarcodes()
void Label::draw( TQPainter* painter, int x, int y ) void Label::draw( TQPainter* painter, int x, int y )
{ {
TQSize label( (int)d->getMeasurements().width( TQT_TQPAINTDEVICE(painter->device()) ), TQSize label( (int)d->getMeasurements().width( painter->device() ),
(int)d->getMeasurements().height( TQT_TQPAINTDEVICE(painter->device()) ) ); (int)d->getMeasurements().height( painter->device() ) );
InitBarcodes(); InitBarcodes();

@ -131,7 +131,7 @@ LabelEditor::LabelEditor( TQWidget *parent, TQString _filename, const char *name
description = TQString(); description = TQString();
d = new Definition(); d = new Definition();
m_token = new TokenProvider( TQT_TQPAINTDEVICE(TDEApplication::desktop()) ); m_token = new TokenProvider( TDEApplication::desktop() );
statusBar()->insertItem( "", STATUS_ID_TEMPLATE, 0, true ); statusBar()->insertItem( "", STATUS_ID_TEMPLATE, 0, true );
statusBar()->insertItem( "", STATUS_ID_SIZE, 0, true ); statusBar()->insertItem( "", STATUS_ID_SIZE, 0, true );
@ -303,7 +303,7 @@ bool LabelEditor::save( TQString name )
if ( !f.open( IO_WriteOnly ) ) if ( !f.open( IO_WriteOnly ) )
return false; return false;
save( TQT_TQIODEVICE(&f) ); save( &f );
m_token->setLabelName( filename.right( filename.length() - filename.findRev( "/" ) - 1 ) ); m_token->setLabelName( filename.right( filename.length() - filename.findRev( "/" ) - 1 ) );
// maybe we should redraw all items on the canvas now. // maybe we should redraw all items on the canvas now.
@ -798,7 +798,7 @@ void LabelEditor::batchPrint( BatchPrinter* batch, int copies, int mode )
if( !buffer.open( IO_WriteOnly ) ) if( !buffer.open( IO_WriteOnly ) )
return; return;
save( TQT_TQIODEVICE(&buffer) ); save( &buffer );
batch->setBuffer( &buffer ); batch->setBuffer( &buffer );
batch->setSerial( TQString(), 1 ); batch->setSerial( TQString(), 1 );
@ -944,10 +944,10 @@ void LabelEditor::preview()
if( !buffer.open( IO_WriteOnly ) ) if( !buffer.open( IO_WriteOnly ) )
return; return;
save( TQT_TQIODEVICE(&buffer) ); save( &buffer );
// No need to delete pd as it has WDestructiveClose set! // No need to delete pd as it has WDestructiveClose set!
PreviewDialog* pd = new PreviewDialog( TQT_TQIODEVICE(&buffer), d, fileName(), this ); PreviewDialog* pd = new PreviewDialog( &buffer, d, fileName(), this );
pd->exec(); pd->exec();
} }

@ -43,7 +43,7 @@ LabelUtils::~LabelUtils()
double LabelUtils::pixelToMm( double pixel, const TQPaintDevice* device, int mode ) double LabelUtils::pixelToMm( double pixel, const TQPaintDevice* device, int mode )
{ {
TQPaintDeviceMetrics pdm( device ? device : TQT_TQPAINTDEVICE(TDEApplication::desktop()) ); TQPaintDeviceMetrics pdm( device ? device : TDEApplication::desktop() );
if( mode == DpiX ) if( mode == DpiX )
return (pixel * CONVERSION_FACTOR) / (double)pdm.logicalDpiX(); return (pixel * CONVERSION_FACTOR) / (double)pdm.logicalDpiX();
else else
@ -58,7 +58,7 @@ double LabelUtils::mmToPixel( double mm, const TQPaintDevice* device, int mode )
// We don't get valid metrics from the printer - and we want a better resolution // We don't get valid metrics from the printer - and we want a better resolution
// anyway (it's the PS driver that takes care of the printer resolution). // anyway (it's the PS driver that takes care of the printer resolution).
TQPaintDeviceMetrics pdm( device ? device : TQT_TQPAINTDEVICE(TDEApplication::desktop()) ); TQPaintDeviceMetrics pdm( device ? device : TDEApplication::desktop() );
// tqDebug("DpiX=%i", pdm.logicalDpiX()); // tqDebug("DpiX=%i", pdm.logicalDpiX());
// tqDebug("DpiY=%i", pdm.logicalDpiY()); // tqDebug("DpiY=%i", pdm.logicalDpiY());

@ -147,8 +147,8 @@ void MyCanvasView::contentsMouseMoveEvent(TQMouseEvent* e)
if( statusbar ) { if( statusbar ) {
LabelUtils l; LabelUtils l;
int x = (int)l.pixelToMm( e->x(), TQT_TQPAINTDEVICE(this), LabelUtils::DpiX ); int x = (int)l.pixelToMm( e->x(), this, LabelUtils::DpiX );
int y = (int)l.pixelToMm( e->y(), TQT_TQPAINTDEVICE(this), LabelUtils::DpiY ); int y = (int)l.pixelToMm( e->y(), this, LabelUtils::DpiY );
statusbar->changeItem( i18n("Position: ") + statusbar->changeItem( i18n("Position: ") +
TQString( "%1%2 x %3%4" ).arg( x ) TQString( "%1%2 x %3%4" ).arg( x )
.arg( Measurements::system() ).arg( y ).arg( Measurements::system()), mouseid ); .arg( Measurements::system() ).arg( y ).arg( Measurements::system()), mouseid );
@ -179,8 +179,8 @@ void MyCanvasView::contentsMouseMoveEvent(TQMouseEvent* e)
LabelUtils l; LabelUtils l;
TQPoint pmm; TQPoint pmm;
pmm.setX( (int)l.pixelToMm( new_pt.x() - getTranslation().x(), TQT_TQPAINTDEVICE(this), LabelUtils::DpiX ) * 1000 ); pmm.setX( (int)l.pixelToMm( new_pt.x() - getTranslation().x(), this, LabelUtils::DpiX ) * 1000 );
pmm.setY( (int)l.pixelToMm( new_pt.y() - getTranslation().y(), TQT_TQPAINTDEVICE(this), LabelUtils::DpiY ) * 1000 ); pmm.setY( (int)l.pixelToMm( new_pt.y() - getTranslation().y(), this, LabelUtils::DpiY ) * 1000 );
// Move the item // Move the item
MoveCommand* mv = new MoveCommand( pmm.x() - moving->item()->rectMM().x(), MoveCommand* mv = new MoveCommand( pmm.x() - moving->item()->rectMM().x(),
@ -197,8 +197,8 @@ void MyCanvasView::contentsMouseMoveEvent(TQMouseEvent* e)
LabelUtils l; LabelUtils l;
TQPoint pmm; TQPoint pmm;
pmm.setX( (int)l.pixelToMm( p.x() - getTranslation().x(), TQT_TQPAINTDEVICE(this), LabelUtils::DpiX ) * 1000 ); pmm.setX( (int)l.pixelToMm( p.x() - getTranslation().x(), this, LabelUtils::DpiX ) * 1000 );
pmm.setY( (int)l.pixelToMm( p.y() - getTranslation().y(), TQT_TQPAINTDEVICE(this), LabelUtils::DpiY ) * 1000 ); pmm.setY( (int)l.pixelToMm( p.y() - getTranslation().y(), this, LabelUtils::DpiY ) * 1000 );
TQRect rmm = moving->item()->rectMM(); TQRect rmm = moving->item()->rectMM();
ResizeCommand* mv = new ResizeCommand( moving, shift_pressed ); ResizeCommand* mv = new ResizeCommand( moving, shift_pressed );
@ -399,7 +399,7 @@ void MyCanvasView::updateRuler()
rulerv->setGeometry( 0, 20, 20, height() - 20 ); rulerv->setGeometry( 0, 20, 20, height() - 20 );
if( def ) { if( def ) {
canv->setRect( TQRect( translation.x(), translation.y(), (int)def->getMeasurements().width( TQT_TQPAINTDEVICE(this) ), (int)def->getMeasurements().height( TQT_TQPAINTDEVICE(this) )) ); canv->setRect( TQRect( translation.x(), translation.y(), (int)def->getMeasurements().width( this ), (int)def->getMeasurements().height( this )) );
rulerv->setMaxValue( height() ); rulerv->setMaxValue( height() );
rulerh->setMaxValue( width() ); rulerh->setMaxValue( width() );
@ -443,16 +443,16 @@ void MyCanvasView::reposition()
* and multiply with the new one. * and multiply with the new one.
* As a result we have the correct width. * As a result we have the correct width.
*/ */
int x = int((width() - (def->getMeasurements().width( TQT_TQPAINTDEVICE(this) )) ) / 2); int x = int((width() - (def->getMeasurements().width( this )) ) / 2);
int y = int((height() - (def->getMeasurements().height( TQT_TQPAINTDEVICE(this) )) ) / 2); int y = int((height() - (def->getMeasurements().height( this )) ) / 2);
// move label 30 pixels away from top/left if necessary // move label 30 pixels away from top/left if necessary
x = x > 0 ? x : 30; x = x > 0 ? x : 30;
y = y > 0 ? y : 30; y = y > 0 ? y : 30;
// make sure that there is some space around the label, therefore at 60 pixel // make sure that there is some space around the label, therefore at 60 pixel
int w = ( this->width() - 2 > def->getMeasurements().width( TQT_TQPAINTDEVICE(this) ) ? this->width() - 2 : int(def->getMeasurements().width( TQT_TQPAINTDEVICE(this) ) + 60) ); int w = ( this->width() - 2 > def->getMeasurements().width( this ) ? this->width() - 2 : int(def->getMeasurements().width( this ) + 60) );
int h = ( this->height() - 2 > def->getMeasurements().height( TQT_TQPAINTDEVICE(this) ) ? this->height() - 2 : int(def->getMeasurements().height( TQT_TQPAINTDEVICE(this) ) + 60) ); int h = ( this->height() - 2 > def->getMeasurements().height( this ) ? this->height() - 2 : int(def->getMeasurements().height( this ) + 60) );
canvas()->resize( w, h ); canvas()->resize( w, h );

@ -114,7 +114,7 @@ void PixmapBarcode::update( const TQPaintDevice* device )
void PixmapBarcode::drawBarcode( TQPainter & painter, int x, int y ) void PixmapBarcode::drawBarcode( TQPainter & painter, int x, int y )
{ {
if( p.isNull() ) if( p.isNull() )
createBarcode( &p, TQT_TQPAINTDEVICE(painter.device()) ); createBarcode( &p, painter.device() );
if( p.isNull() ) // still no barcode.... if( p.isNull() ) // still no barcode....
{ {

@ -113,7 +113,7 @@ PreviewDialog::PreviewDialog( TQIODevice* device, Definition* d, TQString filena
preview = new TQLabel( sv->viewport() ); preview = new TQLabel( sv->viewport() );
sv->addChild( preview ); sv->addChild( preview );
TQPixmap pix( (int)d->getMeasurements().width( TQT_TQPAINTDEVICE(this) ), (int)d->getMeasurements().height( TQT_TQPAINTDEVICE(this) ) ); TQPixmap pix( (int)d->getMeasurements().width( this ), (int)d->getMeasurements().height( this ) );
pix.fill( TQt::white ); pix.fill( TQt::white );
preview->setPixmap( pix ); preview->setPixmap( pix );
@ -182,12 +182,12 @@ void PreviewDialog::selectAddress()
void PreviewDialog::updatechanges() void PreviewDialog::updatechanges()
{ {
TQPixmap pix( (int)def->getMeasurements().width( TQT_TQPAINTDEVICE(this) ), (int)def->getMeasurements().height( TQT_TQPAINTDEVICE(this) ) ); TQPixmap pix( (int)def->getMeasurements().width( this ), (int)def->getMeasurements().height( this ) );
pix.fill( TQt::white ); pix.fill( TQt::white );
TQPainter painter( &pix ); TQPainter painter( &pix );
Label* l = new Label( def, file, m_filename, TQT_TQPAINTDEVICE(TDEApplication::desktop()), Label* l = new Label( def, file, m_filename, TDEApplication::desktop(),
customerId->currentText(), articleId->text(), groupName->text() ); customerId->currentText(), articleId->text(), groupName->text() );
l->setIndex( spinIndex->value() - 1 ); l->setIndex( spinIndex->value() - 1 );
l->setSerial( serialStart->text(), serialInc->value() ); l->setSerial( serialStart->text(), serialInc->value() );

@ -96,8 +96,8 @@ void TCanvasItem::moveMM( int x, int y )
LabelUtils l; LabelUtils l;
// the TQCanvasRectangle::move is done before the real move // the TQCanvasRectangle::move is done before the real move
// as we get dancing TCanvasItems on the screen otherwise // as we get dancing TCanvasItems on the screen otherwise
TQCanvasRectangle::move( l.mmToPixel( x / 1000.0, TQT_TQPAINTDEVICE(m_view), LabelUtils::DpiX ) + m_view->getTranslation().x(), TQCanvasRectangle::move( l.mmToPixel( x / 1000.0, m_view, LabelUtils::DpiX ) + m_view->getTranslation().x(),
l.mmToPixel( y / 1000.0, TQT_TQPAINTDEVICE(m_view), LabelUtils::DpiY ) + m_view->getTranslation().y() ); l.mmToPixel( y / 1000.0, m_view, LabelUtils::DpiY ) + m_view->getTranslation().y() );
m_item->moveMM( x, y ); m_item->moveMM( x, y );
} }
} }

Loading…
Cancel
Save