From 2c6b3b89da2a728ba6683d9f4455139372beb21b Mon Sep 17 00:00:00 2001 From: John Fultz Date: Mon, 14 Jan 2019 02:46:35 -0600 Subject: Fix #21, committing a phoney cannot be canceled. When going back to edit history, typing a phoney correctly brought up a dialog, but indicating you wanted to cancel the phoney play didn't stop the play from going down, or a subsequent computer player from making its play. --- quacker/graphicalboard.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'quacker/graphicalboard.cpp') diff --git a/quacker/graphicalboard.cpp b/quacker/graphicalboard.cpp index 7bc3fa8..35864bf 100644 --- a/quacker/graphicalboard.cpp +++ b/quacker/graphicalboard.cpp @@ -745,7 +745,7 @@ void GraphicalBoardFrame::deleteHandler() void GraphicalBoardFrame::submitHandler() { - QTimer::singleShot(0, this, SLOT(setGlobalCandidate())); + QTimer::singleShot(0, this, SLOT(setGlobalCandidate(nullptr))); } void GraphicalBoardFrame::commitHandler() @@ -753,7 +753,7 @@ void GraphicalBoardFrame::commitHandler() QTimer::singleShot(0, this, SLOT(setAndCommitGlobalCandidate())); } -void GraphicalBoardFrame::setGlobalCandidate() +void GraphicalBoardFrame::setGlobalCandidate(bool *carryOn) { if (m_candidate.action == Quackle::Move::Place && m_candidate.wordTilesWithNoPlayThru().empty()) { @@ -763,18 +763,20 @@ void GraphicalBoardFrame::setGlobalCandidate() if (m_candidate.wordTilesWithNoPlayThru().length() == 1) { - emit setCandidateMove(flip(m_candidate)); + emit setCandidateMove(flip(m_candidate), carryOn); } else { - emit setCandidateMove(m_candidate); + emit setCandidateMove(m_candidate, carryOn); } } void GraphicalBoardFrame::setAndCommitGlobalCandidate() { - setGlobalCandidate(); - emit commit(); + bool carryOn = false; + setGlobalCandidate(&carryOn); + if (carryOn) + emit commit(); } void GraphicalBoardFrame::appendHandler(const QString &text, bool shiftPressed) -- cgit v1.2.3