Changing default piece counts
[impuzzle] / src / imageimporter.cpp
index dab504b..e666335 100644 (file)
@@ -61,13 +61,14 @@ QList<PuzzleItem *> ImageImporter::newPieces(const QPixmap &pixmap, const int co
 
     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;
     }
 
@@ -75,11 +76,15 @@ QList<PuzzleItem *> ImageImporter::newPieces(const QPixmap &pixmap, const int co
     int verticalStep = IMAGE_HEIGHT / verticalCount;
     int horizontalStep = IMAGE_WIDTH / horizontalCount;
 
+    int pieceNo = 1;
+
     for(int i = 0; i < verticalCount; ++i) {
         for(int j = 0; j < horizontalCount; ++j) {
             PuzzleItem *item = new PuzzleItem;
             item->setPixmap(tmp.copy(QRect(QPoint(j * horizontalStep, i * verticalStep),
                                            QPoint(horizontalStep + j * horizontalStep, verticalStep + i * verticalStep))));
+            item->setPieceNumber(pieceNo);
+            pieceNo++;
             list.append(item);
         }
     }