diff -Nru palapeli-4.12.97/debian/changelog palapeli-4.13.0/debian/changelog --- palapeli-4.12.97/debian/changelog 2014-04-02 09:57:11.000000000 +0000 +++ palapeli-4.13.0/debian/changelog 2014-04-10 21:30:49.000000000 +0000 @@ -1,3 +1,9 @@ +palapeli (4:4.13.0-0ubuntu1) trusty; urgency=medium + + * New upstream KDE Software Compilation release + + -- Jonathan Riddell Thu, 10 Apr 2014 22:30:48 +0100 + palapeli (4:4.12.97-0ubuntu1) trusty; urgency=medium * New upstream release candidate diff -Nru palapeli-4.12.97/debian/control palapeli-4.13.0/debian/control --- palapeli-4.12.97/debian/control 2014-04-02 09:57:11.000000000 +0000 +++ palapeli-4.13.0/debian/control 2014-04-10 21:30:49.000000000 +0000 @@ -13,8 +13,8 @@ Maximiliano Curia Build-Depends: kde-sc-dev-latest (>= 4:4.10.2), cmake, debhelper (>= 9), pkg-kde-tools (>= 0.14), - kdelibs5-dev (>= 4:4.12.97), - libkdegames-dev (>= 4:4.12.97), + kdelibs5-dev (>= 4:4.13.0), + libkdegames-dev (>= 4:4.13.0), shared-mime-info Standards-Version: 3.9.4 Homepage: http://games.kde.org/ diff -Nru palapeli-4.12.97/src/engine/constraintinteractor.cpp palapeli-4.13.0/src/engine/constraintinteractor.cpp --- palapeli-4.12.97/src/engine/constraintinteractor.cpp 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/constraintinteractor.cpp 2014-04-06 07:15:53.000000000 +0000 @@ -72,7 +72,7 @@ void Palapeli::ConstraintInteractor::continueInteraction(const Palapeli::MouseEvent& event) { - //in this method, we need the scene() as Palapeli::Scene for the piecesBoundingRect + // In this method, we need the scene() to be Palapeli::Scene type. Palapeli::Scene* scene = qobject_cast(this->scene()); if (!scene) return; @@ -87,7 +87,7 @@ sceneRect.setTop(newBounds.y()); else if (m_draggingSides.contains(BottomSide)) sceneRect.setBottom(newBounds.y()); - scene->setSceneRect(sceneRect | scene->piecesBoundingRect()); + scene->setSceneRect(sceneRect | scene->extPiecesBoundingRect()); } void Palapeli::ConstraintInteractor::stopInteraction(const Palapeli::MouseEvent& event) diff -Nru palapeli-4.12.97/src/engine/constraintvisualizer.cpp palapeli-4.13.0/src/engine/constraintvisualizer.cpp --- palapeli-4.12.97/src/engine/constraintvisualizer.cpp 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/constraintvisualizer.cpp 2014-04-06 07:15:53.000000000 +0000 @@ -117,9 +117,7 @@ if (m_sceneRect == sceneRect) return; // Make sure the ConstraintVisualizer stays outside the pieces' area. - QRectF minimumRect = m_scene->piecesBoundingRect(); - qreal m = m_scene->margin(); - minimumRect.adjust(-m, -m, m, m); + QRectF minimumRect = m_scene->extPiecesBoundingRect(); m_sceneRect = sceneRect; if(!sceneRect.contains(minimumRect)) { // IDW TODO - Works and seems safe, diff -Nru palapeli-4.12.97/src/engine/gameplay.cpp palapeli-4.13.0/src/engine/gameplay.cpp --- palapeli-4.12.97/src/engine/gameplay.cpp 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/gameplay.cpp 2014-04-06 07:15:53.000000000 +0000 @@ -351,8 +351,7 @@ createHolder(name); // Merges/moves in new holders add to the progress bar and are saved. Palapeli::View* view = m_viewList.last(); - Palapeli::PieceHolder* h = qobject_cast(view); - h->initializeZooming(); + view->setCloseUp(true); // New holders start in close-up scale. connect(view->scene(), SIGNAL(saveMove(int)), this, SLOT(positionChanged(int))); connect(view, @@ -368,6 +367,7 @@ Palapeli::PieceHolder* h = new Palapeli::PieceHolder(m_mainWindow, m_pieceAreaSize, name); m_viewList << h; + h->initializeZooming(); // Min. view 2x2 to 6x6 pieces. connect(h, SIGNAL(selected(PieceHolder*)), this, SLOT(changeSelectedHolder(PieceHolder*))); connect (h, SIGNAL(closing(PieceHolder*)), @@ -466,10 +466,17 @@ bRect |= piece->sceneBareBoundingRect(); } Palapeli::Scene* scene = view->scene(); - scene->initializeGrid(bRect.topLeft()); + // If in a piece-holder and ALL pieces are selected, start at (0, 0). + scene->initializeGrid(((view == m_currentHolder) && + (selectedPieces.count() == scene->pieces().count())) ? + QPointF(0.0, 0.0) : bRect.topLeft()); foreach (Palapeli::Piece* piece, selectedPieces) { scene->addToGrid(piece); } + if (view == m_currentHolder) { + // Adjust the piece-holder's scene to frame the pieces. + scene->setSceneRect(scene->extPiecesBoundingRect()); + } positionChanged(0); // There is no attempt to merge pieces here. } @@ -629,7 +636,7 @@ connect(piece, SIGNAL(moved(bool)), scene, SLOT(pieceMoved(bool))); } - scene->setSceneRect(scene->piecesBoundingRect()); + scene->setSceneRect(scene->extPiecesBoundingRect()); if (! destIsPuzzleTable) { dest->centerOn(pieces.last()->sceneBareBoundingRect().center()); } @@ -994,13 +1001,18 @@ // solved puzzle. updateSavedGame(); } + // Add constraint_handles+spacer to puzzle table and setSceneRect(). + QRectF s = m_puzzleTableScene->piecesBoundingRect(); + qreal handleWidth = qMin(s.width(), s.height())/100.0; + m_puzzleTableScene->addMargin(handleWidth, 0.5*handleWidth); + // Add all the pieces to the puzzle table and piece-holder scenes. foreach (Palapeli::View* view, m_viewList) { Palapeli::Scene* scene = view->scene(); - QRectF s = scene->piecesBoundingRect(); - qreal handleWidth = qMin(s.width(), s.height())/100.0; - // Add margin for constraint_handles+spacer and setSceneRect(). - scene->addMargin(handleWidth, 0.5*handleWidth); scene->addPieceItemsToScene(); + if (scene != m_puzzleTableScene) { + // Expand the piece-holder sceneRects. + scene->setSceneRect(scene->extPiecesBoundingRect()); + } } qDebug() << "Finish loadPiecePositions(): time" << t.restart(); finishLoading(); @@ -1018,21 +1030,18 @@ m_currentPieceCount = m_currentPieceCount + scene->pieces().size(); qDebug() << "Counted" << scene->pieces().size(); - // IDW TODO - Do this better. It's the VIEWS that need to know. - // IDW TODO - DELETE scene->startPuzzle(); if (view != m_puzzleTable->view()) { - Palapeli::PieceHolder* holder = - qobject_cast(view); - qDebug() << "Holder" << holder->name() << scene->pieces().size(); - holder->initializeZooming(); + // Saved-and-restored holders start in close-up scale. + view->setCloseUp(true); } else { qDebug() << "Puzzle table" << scene->pieces().size(); } } - m_puzzleTable->view()->puzzleStarted(); - // Initialize external progress display. + // Initialize external progress display, hide loading widget, show view. emit reportProgress(m_originalPieceCount, m_currentPieceCount); + // Adjust zoom-levels, center the view, show autosave message if needed. + m_puzzleTable->view()->puzzleStarted(); if (!m_restoredGame && (m_originalPieceCount >= LargePuzzle)) { // New puzzle and a large one: create a default PieceHolder. createHolder(i18nc("For holding pieces", "Hand")); @@ -1135,7 +1144,7 @@ QPropertyAnimation* animation = new QPropertyAnimation (m_puzzleTableScene, "sceneRect", this); animation->setStartValue(m_puzzleTableScene->sceneRect()); - animation->setEndValue(m_puzzleTableScene->piecesBoundingRect()); + animation->setEndValue(m_puzzleTableScene->extPiecesBoundingRect()); animation->setDuration(1000); connect(animation, SIGNAL(finished()), this, SLOT(playVictoryAnimation2())); @@ -1144,7 +1153,7 @@ void Palapeli::GamePlay::playVictoryAnimation2() { - m_puzzleTableScene->setSceneRect(m_puzzleTableScene->piecesBoundingRect()); + m_puzzleTableScene->setSceneRect(m_puzzleTableScene->extPiecesBoundingRect()); QTimer::singleShot(100, this, SIGNAL(victoryAnimationFinished())); // Give the View some time to play its part of the victory animation. QTimer::singleShot(1500, this, SLOT(playVictoryAnimation3())); diff -Nru palapeli-4.12.97/src/engine/piece.h palapeli-4.13.0/src/engine/piece.h --- palapeli-4.12.97/src/engine/piece.h 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/piece.h 2014-04-06 07:15:53.000000000 +0000 @@ -28,7 +28,7 @@ namespace Palapeli { class MovePieceInteractor; - struct PieceVisuals; + class PieceVisuals; class Piece : public Palapeli::GraphicsObject { diff -Nru palapeli-4.12.97/src/engine/puzzlepreview.h palapeli-4.13.0/src/engine/puzzlepreview.h --- palapeli-4.12.97/src/engine/puzzlepreview.h 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/puzzlepreview.h 2014-04-06 07:15:53.000000000 +0000 @@ -24,7 +24,7 @@ namespace Palapeli { - class PuzzleMetadata; + struct PuzzleMetadata; class PuzzlePreview : public QGraphicsView { diff -Nru palapeli-4.12.97/src/engine/scene.cpp palapeli-4.13.0/src/engine/scene.cpp --- palapeli-4.12.97/src/engine/scene.cpp 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/scene.cpp 2014-04-06 07:15:53.000000000 +0000 @@ -33,6 +33,7 @@ , m_pieceAreaSize(QSizeF(32.0, 32.0)) // Allow 1024 pixels initially. , m_margin(10.0) , m_handleWidth(7.0) + , m_minGrid(1) // Min. space for puzzle table. { initializeGrid(QPointF(0.0, 0.0)); } @@ -76,19 +77,39 @@ QRectF r = piecesBoundingRect(); r.adjust(-m_margin, -m_margin, m_margin, m_margin); setSceneRect(r); + m_constraintVisualizer->stop(); m_constraintVisualizer->start(r, handleWidth); views()[0]->fitInView(r, Qt::KeepAspectRatio); qDebug() << "SCENE RECT" << r << "VIEW SIZE" << views()[0]->size(); } -QRectF Palapeli::Scene::piecesBoundingRect(const int minGrid) const +QRectF Palapeli::Scene::extPiecesBoundingRect() const +{ + // Bounding rectangle of pieces plus constraint visualizer (margin). + QRectF result = piecesBoundingRect(); + result.adjust(-m_margin, -m_margin, m_margin, m_margin); + return result; +} + +void Palapeli::Scene::setMinGrid(const int minGrid) { - // Space is >= minGrid*minGrid pieces (e.g. for a new PieceHolder). - QSizeF minSize = minGrid * m_gridSpacing; - QRectF result (QPointF(0.0, 0.0), minSize); + m_minGrid = minGrid; +} + +QRectF Palapeli::Scene::piecesBoundingRect() const +{ + // If no pieces, space is >= m_minGrid*m_minGrid pieces (e.g. for a new + // PieceHolder). Default is >= 1 piece for the puzzle table. + QRectF result; foreach (Palapeli::Piece* piece, m_pieces) result |= piece->sceneBareBoundingRect(); - return result; + QSizeF minSize = m_minGrid * m_gridSpacing; + QRectF minRect(QPointF(0.0, 0.0), minSize); + if (m_pieces.count() > 0) { + // Center the minRect over the piece(s). + minRect.moveTopLeft(result.center() - minRect.center()); + } + return (result | minRect); } bool Palapeli::Scene::isConstrained() const diff -Nru palapeli-4.12.97/src/engine/scene.h palapeli-4.13.0/src/engine/scene.h --- palapeli-4.12.97/src/engine/scene.h 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/scene.h 2014-04-06 07:15:53.000000000 +0000 @@ -45,7 +45,9 @@ void addPieceToList(Palapeli::Piece* piece); void addPieceItemsToScene(); bool isConstrained() const; - QRectF piecesBoundingRect(const int minGrid = 2) const; + QRectF extPiecesBoundingRect() const; + void setMinGrid(const int minGrid); + QRectF piecesBoundingRect() const; qreal margin() { return m_margin; } qreal handleWidth() { return m_handleWidth; } void addMargin(const qreal handleWidth, @@ -96,6 +98,8 @@ int m_gridRank; int m_gridX; int m_gridY; + // Scene has at least m_minGrid*m_minGrid piece-spaces. + int m_minGrid; }; } diff -Nru palapeli-4.12.97/src/engine/view.cpp palapeli-4.13.0/src/engine/view.cpp --- palapeli-4.12.97/src/engine/view.cpp 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/view.cpp 2014-04-06 07:15:53.000000000 +0000 @@ -62,7 +62,7 @@ // IDW test. void Palapeli::View::logSceneChange(QRectF r) { - qDebug() << "View::logSceneChange" << r << "View size" << this->size(); + // qDebug() << "View::logSceneChange" << r << "View size" << this->size(); } Palapeli::InteractorManager* Palapeli::View::interactorManager() const @@ -268,6 +268,19 @@ } } +void Palapeli::View::setCloseUp(bool onOff) +{ + m_isCloseUp = onOff; + // Force zoomTo() to recalculate, even if m_zoomLevel == required value. + m_zoomLevel = m_isCloseUp ? m_closeUpLevel - 1 : m_distantLevel + 1; + if (m_isCloseUp) { + zoomTo(m_closeUpLevel); + } + else { + zoomTo(m_distantLevel); + } +} + void Palapeli::View::handleNewPieceSelection() { emit newPieceSelectionSeen(this); @@ -341,7 +354,7 @@ { //move viewport to show the complete puzzle QPropertyAnimation* animation = new QPropertyAnimation(this, "viewportRect", this); - animation->setEndValue(m_scene->piecesBoundingRect()); + animation->setEndValue(m_scene->extPiecesBoundingRect()); animation->setDuration(1000); animation->start(QAbstractAnimation::DeleteWhenStopped); emit zoomAdjustable(false); diff -Nru palapeli-4.12.97/src/engine/view.h palapeli-4.13.0/src/engine/view.h --- palapeli-4.12.97/src/engine/view.h 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/engine/view.h 2014-04-06 07:15:53.000000000 +0000 @@ -43,6 +43,7 @@ void setViewportRect(const QRectF& viewportRect); void teleportPieces(Piece* piece, const QPointF& scPos); void toggleCloseUp(); + void setCloseUp(bool onOff); void handleNewPieceSelection(); static const int MinimumZoomLevel; diff -Nru palapeli-4.12.97/src/file-io/puzzle.h palapeli-4.13.0/src/file-io/puzzle.h --- palapeli-4.12.97/src/file-io/puzzle.h 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/file-io/puzzle.h 2014-04-06 07:15:53.000000000 +0000 @@ -114,7 +114,7 @@ ///in memory. void dropComponent(Palapeli::PuzzleComponent::Type type); private: - class Private; + struct Private; Private* const d; }; } diff -Nru palapeli-4.12.97/src/palapeliui.rc palapeli-4.13.0/src/palapeliui.rc --- palapeli-4.12.97/src/palapeliui.rc 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/palapeliui.rc 2014-04-06 07:15:53.000000000 +0000 @@ -1,5 +1,5 @@ - @@ -27,6 +27,9 @@ + + + Main toolbar diff -Nru palapeli-4.12.97/src/window/mainwindow.cpp palapeli-4.13.0/src/window/mainwindow.cpp --- palapeli-4.12.97/src/window/mainwindow.cpp 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/window/mainwindow.cpp 2014-04-06 07:15:53.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include Palapeli::MainWindow::MainWindow(KCmdLineArgs* args) : m_game(new Palapeli::GamePlay(this)) @@ -155,6 +156,22 @@ // View zoom out. KStandardAction::zoomOut(m_game, SLOT(actionZoomOut()), actionCollection()); + // Settings: enable messages that the user marked "Do not show again". + KAction* enableMessagesAct = new KAction(i18n("Enable all messages"),0); + actionCollection()->addAction("enable_messages", enableMessagesAct); + connect(enableMessagesAct, SIGNAL(triggered()), SLOT(enableMessages())); +} + +void Palapeli::MainWindow::enableMessages() +{ + // Enable all messages that the user has marked "Do not show again". + int result = KMessageBox::questionYesNo(this, + i18n("Enable all messages")); + if (result == KMessageBox::Yes) { + qDebug() << "ENABLE ALL MESSAGES"; + KMessageBox::enableAllMessages(); + KGlobal::config()->sync(); // Save the changes to disk. + } } #include "mainwindow.moc" diff -Nru palapeli-4.12.97/src/window/mainwindow.h palapeli-4.13.0/src/window/mainwindow.h --- palapeli-4.12.97/src/window/mainwindow.h 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/window/mainwindow.h 2014-04-06 07:15:53.000000000 +0000 @@ -38,6 +38,8 @@ MainWindow(KCmdLineArgs* args); protected: virtual bool queryClose(); + private Q_SLOTS: + void enableMessages(); private: void setupActions(); diff -Nru palapeli-4.12.97/src/window/pieceholder.cpp palapeli-4.13.0/src/window/pieceholder.cpp --- palapeli-4.12.97/src/window/pieceholder.cpp 2014-03-25 18:50:02.000000000 +0000 +++ palapeli-4.13.0/src/window/pieceholder.cpp 2014-04-06 07:15:53.000000000 +0000 @@ -37,7 +37,11 @@ // Allow space for (2 * 2) pieces in minimum view initially. m_scene->setPieceAreaSize(pieceArea); m_scene->initializeGrid(QPointF(0.0, 0.0)); - m_scene->setSceneRect(m_scene->piecesBoundingRect(minGrid)); + m_scene->setMinGrid(minGrid); + // Add margin for constraint_handles+spacer and setSceneRect(). + QRectF rect = m_scene->piecesBoundingRect(); + qreal handleWidth = qMin(rect.width(), rect.height())/25.0; + m_scene->addMargin(handleWidth, 0.5*handleWidth); setWindowTitle(title); qreal s = calculateCloseUpScale(); QRectF r = m_scene->sceneRect();