Fixing statistics
[impuzzle] / src / imageimporter.cpp
index ab341e9..bb6d000 100644 (file)
@@ -46,28 +46,29 @@ QList<PuzzleItem *> ImageImporter::newPieces(const QPixmap &pixmap, const int co
     QPixmap tmp;
 
     if(pixmap.isNull()) {
-        qDebug() << "Got NULL image - using default.jpg";
+        qDebug() << "Got NULL image - using default image";
         tmp = QPixmap(":/images/default.jpg");
     }
     else {
         tmp = pixmap;
-    }
 
-    if(tmp.size().height() != IMAGE_HEIGHT || tmp.size().width() != IMAGE_WIDTH) {
-        tmp = pixmap.scaled(QSize(IMAGE_WIDTH, IMAGE_HEIGHT), Qt::KeepAspectRatioByExpanding);
+        if(tmp.size().height() != IMAGE_HEIGHT || tmp.size().width() != IMAGE_WIDTH) {
+            tmp = pixmap.scaled(QSize(IMAGE_WIDTH, IMAGE_HEIGHT), Qt::KeepAspectRatioByExpanding);
+        }
     }
 
     QList<PuzzleItem *> list;
 
     int horizontalCount = 0;
 
-    if(count == 12) {
-        horizontalCount = 4;
+    if(count == EASY_PIECE_COUNT) {
+        horizontalCount = EASY_HORIZONTAL_COUNT;
     }
-    else if(count == 20) {
-        horizontalCount = 5;
+    else if(count == HARD_PIECE_COUNT) {
+        horizontalCount = HARD_HORIZONTAL_COUNT;
     }
     else {
+        qDebug() << QString("Bad piece count ( %1 ) @ ImageImporter::newPieces").arg(count);
         return list;
     }