summaryrefslogtreecommitdiff
path: root/quacker/graphicalboard.cpp
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2019-01-14 02:46:35 -0600
committerJohn Fultz <jfultz@wolfram.com>2019-01-14 02:47:01 -0600
commit2c6b3b89da2a728ba6683d9f4455139372beb21b (patch)
tree17e01fc5b5e736ec42b9b5e406371f03b1da216b /quacker/graphicalboard.cpp
parent3938bd82ac4ac35916c83b378776159952f744eb (diff)
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.
Diffstat (limited to 'quacker/graphicalboard.cpp')
-rw-r--r--quacker/graphicalboard.cpp14
1 files changed, 8 insertions, 6 deletions
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)