Fix FTBFS due to redefine the 'round' symbol in korganizer.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 1762272863)
r14.0.x
Slávek Banko 4 years ago
parent 0dbb6b932f
commit 30cd1d6b25
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -38,7 +38,7 @@
#ifndef KORG_NOPRINTER #ifndef KORG_NOPRINTER
inline int round(const double x) inline int roundToInt(const double x)
{ {
return int(x > 0.0 ? x + 0.5 : x - 0.5); return int(x > 0.0 ? x + 0.5 : x - 0.5);
} }
@ -1178,7 +1178,7 @@ void CalPrintPluginBase::drawMonth( TQPainter &p, const TQDate &dt, const TQRect
// Fill the remaining space (if a month has less days than others) with a crossed-out pattern // Fill the remaining space (if a month has less days than others) with a crossed-out pattern
if ( daysinmonth<maxdays ) { if ( daysinmonth<maxdays ) {
TQRect dayBox( box.left(), daysBox.top() + round(dayheight*daysinmonth), box.width(), 0 ); TQRect dayBox( box.left(), daysBox.top() + roundToInt(dayheight*daysinmonth), box.width(), 0 );
dayBox.setBottom( daysBox.bottom() ); dayBox.setBottom( daysBox.bottom() );
p.fillRect( dayBox, TQt::DiagCrossPattern ); p.fillRect( dayBox, TQt::DiagCrossPattern );
} }
@ -1187,9 +1187,9 @@ void CalPrintPluginBase::drawMonth( TQPainter &p, const TQDate &dt, const TQRect
for ( d = 0; d < daysinmonth; ++d ) { for ( d = 0; d < daysinmonth; ++d ) {
TQDate day; TQDate day;
calsys->setYMD( day, dt.year(), dt.month(), d+1 ); calsys->setYMD( day, dt.year(), dt.month(), d+1 );
TQRect dayBox( daysBox.left()/*+rand()%50*/, daysBox.top() + round(dayheight*d), daysBox.width()/*-rand()%50*/, 0 ); TQRect dayBox( daysBox.left()/*+rand()%50*/, daysBox.top() + roundToInt(dayheight*d), daysBox.width()/*-rand()%50*/, 0 );
// FIXME: When using a border width of 0 for event boxes, don't let the rectangles overlap, i.e. subtract 1 from the top or bottom! // FIXME: When using a border width of 0 for event boxes, don't let the rectangles overlap, i.e. subtract 1 from the top or bottom!
dayBox.setBottom( daysBox.top()+round(dayheight*(d+1)) - 1 ); dayBox.setBottom( daysBox.top()+roundToInt(dayheight*(d+1)) - 1 );
p.setBrush( isWorkingDay( day )?workdayColor:holidayColor ); p.setBrush( isWorkingDay( day )?workdayColor:holidayColor );
p.drawRect( dayBox ); p.drawRect( dayBox );
@ -1314,9 +1314,9 @@ void CalPrintPluginBase::drawMonth( TQPainter &p, const TQDate &dt, const TQRect
int minsToEnd = starttime.secsTo( placeItem->end() )/60; int minsToEnd = starttime.secsTo( placeItem->end() )/60;
TQRect eventBox( xstartcont + placeItem->subCell()*17, TQRect eventBox( xstartcont + placeItem->subCell()*17,
daysBox.top() + round( double( minsToStart*daysBox.height()) / double(maxdays*24*60) ), daysBox.top() + roundToInt( double( minsToStart*daysBox.height()) / double(maxdays*24*60) ),
14, 0 ); 14, 0 );
eventBox.setBottom( daysBox.top() + round( double( minsToEnd*daysBox.height()) / double(maxdays*24*60) ) ); eventBox.setBottom( daysBox.top() + roundToInt( double( minsToEnd*daysBox.height()) / double(maxdays*24*60) ) );
drawVerticalBox( p, 0, eventBox, placeItem->event()->summary() ); drawVerticalBox( p, 0, eventBox, placeItem->event()->summary() );
newxstartcont = TQMAX( newxstartcont, eventBox.right() ); newxstartcont = TQMAX( newxstartcont, eventBox.right() );
} }
@ -1327,9 +1327,9 @@ void CalPrintPluginBase::drawMonth( TQPainter &p, const TQDate &dt, const TQRect
for ( int d=0; d<daysinmonth; ++d ) { for ( int d=0; d<daysinmonth; ++d ) {
TQStringList dayEvents( textEvents[d+1] ); TQStringList dayEvents( textEvents[d+1] );
TQString txt = dayEvents.join(", "); TQString txt = dayEvents.join(", ");
TQRect dayBox( xstartcont, daysBox.top()+round(dayheight*d), 0, 0 ); TQRect dayBox( xstartcont, daysBox.top()+roundToInt(dayheight*d), 0, 0 );
dayBox.setRight( box.right() ); dayBox.setRight( box.right() );
dayBox.setBottom( daysBox.top()+round(dayheight*(d+1)) ); dayBox.setBottom( daysBox.top()+roundToInt(dayheight*(d+1)) );
printEventString(p, dayBox, txt, TQt::AlignTop | TQt::AlignLeft | TQt::BreakAnywhere ); printEventString(p, dayBox, txt, TQt::AlignTop | TQt::AlignLeft | TQt::BreakAnywhere );
} }
p.setFont( oldfont ); p.setFont( oldfont );

Loading…
Cancel
Save