[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kstars] kstars/widgets: Minor refactoring
From:       Khudyakov Alexey <alexey.skladnoy () gmail ! com>
Date:       2011-11-24 14:20:10
Message-ID: 20111124142010.87EDDA60BB () git ! kde ! org
[Download RAW message or body]

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/moonphasecalendarwidget.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 = width() / ( double ) numDayColumns;
+    cellWidth  = width() / ( double ) numDayColumns;
     cellHeight = height() / ( double ) numWeekRows;
     kDebug() << cellWidth << cellHeight;
     MoonImageSize = ( (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 = \
numDayColumns * ( row - 1 ) + col;  
     //Calculate what day of the week the cell is
-    if ( col + calendar()->weekStartDay() <= numDayColumns ) {
-        cellWeekDay = col + calendar()->weekStartDay();
-    } else {
-        cellWeekDay = col + calendar()->weekStartDay() - numDayColumns;
+    cellWeekDay = col + calendar()->weekStartDay();
+    if ( cellWeekDay <= numDayColumns ) {
+        cellWeekDay -= numDayColumns;
     }
 
     //See if cell day is normally a working day
     if ( KGlobal::locale()->workingWeekStartDay() <= \
                KGlobal::locale()->workingWeekEndDay() ) {
-        if ( cellWeekDay >= KGlobal::locale()->workingWeekStartDay() &&
-             cellWeekDay <= KGlobal::locale()->workingWeekEndDay() ) {
-                workingDay = true;
-        }
+        workingDay = cellWeekDay >= KGlobal::locale()->workingWeekStartDay()
+                  && cellWeekDay <= KGlobal::locale()->workingWeekEndDay();
     } else {
-        if ( cellWeekDay >= KGlobal::locale()->workingWeekStartDay() ||
-             cellWeekDay <= KGlobal::locale()->workingWeekEndDay() ) {
-                workingDay = true;
-        }
+        workingDay = cellWeekDay >= KGlobal::locale()->workingWeekStartDay()
+                  || cellWeekDay <= KGlobal::locale()->workingWeekEndDay();
     }
 
     if( row == 0 ) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic