Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:wolfi323:branches:KDE:Frameworks5
palapeli4
fix-preview.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-preview.patch of Package palapeli4
From ea163d0913f715b96e81ac300625e64e78713566 Mon Sep 17 00:00:00 2001 From: Wolfgang Bauer <wbauer@tmo.at> Date: Tue, 7 Nov 2017 07:49:54 +0100 Subject: [PATCH] Properly show/hide preview dialog The visiblity of the preview dialog was not synced with the preview action in the main window. Also the preview image was not created when then same puzzle was opened after going back to the overview. Don't leak PuzzleComponent in GamePlay::loadPreview() This is a backport of commit 851870fbfae1 to the kdelibs4 based 17.08 branch. --- src/engine/gameplay.cpp | 12 ++++++++++-- src/window/mainwindow.cpp | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/engine/gameplay.cpp b/src/engine/gameplay.cpp index 695f49b..8c55060 100644 --- a/src/engine/gameplay.cpp +++ b/src/engine/gameplay.cpp @@ -167,6 +167,10 @@ void Palapeli::GamePlay::shutdown() 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 @@ void Palapeli::GamePlay::playPuzzle(Palapeli::Puzzle* puzzle) // 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 @@ void Palapeli::GamePlay::loadPreview() 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 @@ void Palapeli::GamePlay::actionTogglePreview() 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 index 31c3689..7bdc6be 100644 --- a/src/window/mainwindow.cpp +++ b/src/window/mainwindow.cpp @@ -146,7 +146,7 @@ void Palapeli::MainWindow::setupActions() 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. -- 2.13.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor