diff --git a/src/engine/gameplay.cpp b/src/engine/gameplay.cpp --- a/src/engine/gameplay.cpp +++ b/src/engine/gameplay.cpp @@ -167,6 +167,10 @@ void Palapeli::GamePlay::playPuzzle(Palapeli::Puzzle* puzzle) { t.start(); // IDW test. START the clock. + // we need to load the preview every time, although when the puzzle + // is already loaded because the preview is destroyed in actionGoCollection() + QTimer::singleShot(0, this, SLOT(loadPreview())); + qDebug() << "START playPuzzle(): elapsed 0"; // Get some current action states from the collection. m_canDeletePuzzle = m_mainWindow->actionCollection()-> @@ -206,8 +210,6 @@ // IDW TODO - There is no way to stop loading a puzzle and start loading // another. The only option is to Quit or abort Palapeli. - - QTimer::singleShot(0, this, SLOT(loadPreview())); } void Palapeli::GamePlay::loadPreview() @@ -229,11 +231,15 @@ metadata; m_puzzlePreview->loadImageFrom(md); m_mainWindow->setCaption(md.name); // Set main title. + delete cmd; } m_puzzlePreview->setVisible(Settings::puzzlePreviewVisible()); connect (m_puzzlePreview, SIGNAL(closing()), SLOT(actionTogglePreview())); // Hide preview: do not delete. + // sync with mainWindow + m_mainWindow->actionCollection()->action("view_preview")-> + setChecked(Settings::puzzlePreviewVisible()); } void Palapeli::GamePlay::playPuzzleFile(const QString& path) @@ -266,6 +272,8 @@ m_puzzlePreview->toggleVisible(); m_mainWindow->actionCollection()->action("view_preview")-> setChecked(Settings::puzzlePreviewVisible()); + // remember state + updateSavedGame(); } } diff --git a/src/window/mainwindow.cpp b/src/window/mainwindow.cpp --- a/src/window/mainwindow.cpp +++ b/src/window/mainwindow.cpp @@ -146,7 +146,7 @@ togglePreviewAct->setToolTip(i18n("Show or hide the image of the completed puzzle")); actionCollection()->addAction("view_preview", togglePreviewAct); togglePreviewAct->setEnabled(false); - togglePreviewAct->setChecked(false); + togglePreviewAct->setChecked(isVisible); connect(togglePreviewAct, SIGNAL(triggered()), m_game, SLOT(actionTogglePreview())); // View zoom in.