From kde-commits Thu Nov 24 14:20:10 2011 From: Khudyakov Alexey Date: Thu, 24 Nov 2011 14:20:10 +0000 To: kde-commits Subject: [kstars] kstars/widgets: Minor refactoring Message-Id: <20111124142010.87EDDA60BB () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=132214449216462 Git commit 6a6feb812a9c0e5cb57ec38d0bbc52ebb75f5956 by Khudyakov Alexey. Committed on 17/11/2011 at 18:53. Pushed by khudyakov into branch 'master'. Minor refactoring M +8 -13 kstars/widgets/moonphasecalendarwidget.cpp http://commits.kde.org/kstars/6a6feb812a9c0e5cb57ec38d0bbc52ebb75f5956 diff --git a/kstars/widgets/moonphasecalendarwidget.cpp b/kstars/widgets/mo= onphasecalendarwidget.cpp index 841c650..497c664 100644 --- a/kstars/widgets/moonphasecalendarwidget.cpp +++ b/kstars/widgets/moonphasecalendarwidget.cpp @@ -69,7 +69,7 @@ void MoonPhaseCalendar::loadImages() { } = void MoonPhaseCalendar::computeMoonImageSize() { - cellWidth =3D width() / ( double ) numDayColumns; + cellWidth =3D width() / ( double ) numDayColumns; cellHeight =3D height() / ( double ) numWeekRows; kDebug() << cellWidth << cellHeight; MoonImageSize =3D ( (cellWidth > cellHeight - 12) ? cellHeight - 12 : = cellWidth ) - 2; // FIXME: Using hard-coded fontsize @@ -129,23 +129,18 @@ void MoonPhaseCalendar::paintCell( QPainter *painter,= int row, int col, const KC pos =3D numDayColumns * ( row - 1 ) + col; = //Calculate what day of the week the cell is - if ( col + calendar()->weekStartDay() <=3D numDayColumns ) { - cellWeekDay =3D col + calendar()->weekStartDay(); - } else { - cellWeekDay =3D col + calendar()->weekStartDay() - numDayColumns; + cellWeekDay =3D col + calendar()->weekStartDay(); + if ( cellWeekDay <=3D numDayColumns ) { + cellWeekDay -=3D numDayColumns; } = //See if cell day is normally a working day if ( KGlobal::locale()->workingWeekStartDay() <=3D KGlobal::locale()->= workingWeekEndDay() ) { - if ( cellWeekDay >=3D KGlobal::locale()->workingWeekStartDay() && - cellWeekDay <=3D KGlobal::locale()->workingWeekEndDay() ) { - workingDay =3D true; - } + workingDay =3D cellWeekDay >=3D KGlobal::locale()->workingWeekStar= tDay() + && cellWeekDay <=3D KGlobal::locale()->workingWeekEndDay= (); } else { - if ( cellWeekDay >=3D KGlobal::locale()->workingWeekStartDay() || - cellWeekDay <=3D KGlobal::locale()->workingWeekEndDay() ) { - workingDay =3D true; - } + workingDay =3D cellWeekDay >=3D KGlobal::locale()->workingWeekStar= tDay() + || cellWeekDay <=3D KGlobal::locale()->workingWeekEndDay= (); } = if( row =3D=3D 0 ) {