diff --git a/src/exam/tcanvas.cpp b/src/exam/tcanvas.cpp
index 7b704672b19e55ff554eff9ec8ec656ab7e9094b..1dd2b5d6a25f0a0f18cf70267eaaff47d848df63 100644
--- a/src/exam/tcanvas.cpp
+++ b/src/exam/tcanvas.cpp
@@ -172,6 +172,9 @@ void Tcanvas::startTip() {
void Tcanvas::certificateTip() {
+ if (m_certifyTip)
+ return;
+
delete m_questionTip;
clearResultTip();
clearWhatNextTip();
@@ -377,7 +380,7 @@ void Tcanvas::clearCanvas() {
}
delete m_startTip;
delete m_questionTip;
- delete m_certifyTip;
+ clearCertificate();
delete m_outTuneTip;
clearMelodyCorrectMessage();
}
@@ -532,7 +535,7 @@ bool Tcanvas::eventFilter(QObject* obj, QEvent* event) {
QMouseEvent *me = static_cast<QMouseEvent *>(event);
if (event->type() == QEvent::MouseButtonPress) {
if (me->button() == Qt::MiddleButton && me->modifiers() | Qt::ShiftModifier && me->modifiers() | Qt::AltModifier) {
- if (m_exam)
+ if (m_exam && !m_certifyTip)
emit certificateMagicKeys();
}
}
diff --git a/src/exam/tcanvas.h b/src/exam/tcanvas.h
index 14ec4cfe2614b463db7e3d58b805316c9542085a..07c827f18f090cbaa6a3e1efaf2fbcfa5315a1b3 100644
--- a/src/exam/tcanvas.h
+++ b/src/exam/tcanvas.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2012-2015 by Tomasz Bojczuk *
+ * Copyright (C) 2012-2016 by Tomasz Bojczuk *
* tomaszbojczuk@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -103,7 +103,9 @@ public:
void detectedNoteTip(const Tnote& note);
QString detectedText(const QString& txt); /** Returns bigger @p txt in question color. Used for 'detected' message. */
-
+
+ bool hasCertificate() { return m_certifyTip != 0; }
+
public slots:
void clearResultTip(); // clears tip with results
void clearTryAgainTip();
@@ -149,7 +151,7 @@ private:
QPointer<TgraphicsTextTip> m_resultTip, m_whatTip, m_startTip, m_tryAgainTip;
QPointer<TgraphicsTextTip> m_confirmTip, m_outTuneTip;
QPointer<TquestionTip> m_questionTip;
- QPointer<TnootkaCertificate> m_certifyTip;
+ TnootkaCertificate *m_certifyTip;
Texam *m_exam;
QPointer<TcombinedAnim> m_correctAnim;
QTimer *m_timerToConfirm;
diff --git a/src/exam/texamexecutor.cpp b/src/exam/texamexecutor.cpp
index b740c17e18272fee317b8c6eedfa8d79a80bdf91..81ee3843bf3b133413482d5f9887800488ba6425 100755
--- a/src/exam/texamexecutor.cpp
+++ b/src/exam/texamexecutor.cpp
@@ -242,6 +242,9 @@ void TexamExecutor::initializeExecuting() {
void TexamExecutor::askQuestion(bool isAttempt) {
m_askingTimer->stop();
+ if (m_canvas->hasCertificate()) // in auto mode new question can be asked "under" certificate
+ return;
+
m_lockRightButt = false; // release mouse button events
if (m_exercise && !gl->E->showCorrected) // hide correct action button
mW->bar->removeAction(mW->bar->correctAct);
@@ -677,6 +680,8 @@ void TexamExecutor::checkAnswer(bool showResults) {
markAnswer(curQ);
int waitTime = gl->E->questionDelay;
+ if (m_melody) // increase minimal delay before next question for melodies to 500ms
+ waitTime = qMax(waitTime, 500);
if (m_exercise) {
if ((gl->E->autoNextQuest && gl->E->afterMistake != TexamParams::e_continue) || !gl->E->autoNextQuest || gl->E->showCorrected)
waitTime = gl->E->correctPreview; // user has to have time to see his mistake and correct answer
@@ -701,7 +706,7 @@ void TexamExecutor::checkAnswer(bool showResults) {
stopExamSlot();
else {
if (curQ->isCorrect()) {
- m_askingTimer->start(gl->E->questionDelay);
+ m_askingTimer->start(m_melody ? qMax(gl->E->questionDelay, 500) : gl->E->questionDelay);
} else {
if (gl->E->repeatIncorrect && !m_incorrectRepeated) {
if (curQ->melody())
@@ -1418,6 +1423,9 @@ void TexamExecutor::noteOfMelodyStarted(const TnoteStruct& n) {
void TexamExecutor::noteOfMelodyFinished(const TnoteStruct& n) {
// Tnote nn = n.pitch;
// qDebug() << "[TexamExecutor] note finished" << nn.toText();
+ if (m_melody->currentIndex() < 0) // meanwhile new question melody was asked - some undesired note was finished
+ return;
+
m_melody->setNote(n);
if (m_melody->currentIndex() == m_exam->curQ()->melody()->length() - 1) {
if (gl->E->expertsAnswerEnable)