diff --git a/src/main/texamexecutor.cpp b/src/main/texamexecutor.cpp index 87bb41d344c46983a744929125f78288a3f303c6..5362a131b2fd9d9ef72dafab12a7b803089f7ab6 100755 --- a/src/main/texamexecutor.cpp +++ b/src/main/texamexecutor.cpp @@ -362,7 +362,7 @@ void TexamExecutor::askQuestion(bool isAttempt) { // << (int)curQ->qa.pos.str() << (int)curQ->qa.pos.fret(); } - // ASKING QUESTIONS +// ASKING QUESTIONS if (curQ->questionAsNote()) { if (curQ->melody()) { if (!isAttempt) { @@ -380,7 +380,7 @@ void TexamExecutor::askQuestion(bool isAttempt) { connect(SOUND, &Tsound::noteStartedEntire, this, &TexamExecutor::noteOfMelodyStarted); connect(SOUND, &Tsound::noteFinishedEntire, this, &TexamExecutor::noteOfMelodyFinished); // connect(SCORE, &TmainScore::lockedNoteClicked, this, &TexamExecutor::noteOfMelodySelected); - // SCORE->selectNote(0); // mark first note + MAIN_SCORE->setSelectedItem(0); // mark first note // SCORE->setReadOnlyReacting(true); // allow user to select beginning note to play } } else { @@ -1514,7 +1514,7 @@ void TexamExecutor::connectPlayingFinished() { if (m_soundTimer->isActive()) m_soundTimer->stop(); if (m_exam->curQ()->answerAsSound()) - connect(SOUND, SIGNAL(plaingFinished()), this, SLOT(sniffAfterPlaying())); + connect(SOUND, &Tsound::plaingFinished, this, &TexamExecutor::sniffAfterPlaying); } @@ -1524,8 +1524,8 @@ void TexamExecutor::noteOfMelodyStarted(const TnoteStruct& n) { m_melody->noteStarted(); if (m_melody->currentIndex() == 0) // first played note was detected m_exam->curQ()->lastAttempt()->setPrepareTime(m_penalty->elapsedTime() - quint32(n.duration)); -// if (m_melody->currentIndex() + 1 < m_exam->curQ()->melody()->length()) // highlight next note -// SCORE->selectNote(m_melody->currentIndex() + 1); + if (m_melody->currentIndex() + 1 < m_exam->curQ()->melody()->length()) // highlight next note + MAIN_SCORE->setSelectedItem(m_melody->currentIndex() + 1); } @@ -1548,7 +1548,7 @@ void TexamExecutor::noteOfMelodyFinished(const TnoteStruct& n) { void TexamExecutor::noteOfMelodySelected(int nr) { m_melody->setCurrentIndex(nr); -// SCORE->selectNote(nr); + MAIN_SCORE->setSelectedItem(nr); SOUND->startListen(); // m_tipHandler->clearConfirmTip(); // if (isExercise() && INSTRUMENT->isVisible() && m_exam->curQ()->melody()) // in exercises, display guitar position of clicked note for a hint diff --git a/src/main/tmainscoreobject.cpp b/src/main/tmainscoreobject.cpp index 1b2e2a77e6c2b5e5bde8b21838a6a73fb335b3de..1192425d6673e200dfea495e3ecbde6a2f67bf7d 100644 --- a/src/main/tmainscoreobject.cpp +++ b/src/main/tmainscoreobject.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2017 by Tomasz Bojczuk * + * Copyright (C) 2017-2018 by Tomasz Bojczuk * * seelook@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -143,6 +143,11 @@ Tnote TmainScoreObject::getNote(int id) { } +void TmainScoreObject::setSelectedItem(int id) { + m_scoreObj->setSelectedItem(m_scoreObj->note(id)); +} + + void TmainScoreObject::askQuestion(Tmelody* mel) { m_scoreObj->setBgColor(scoreBackgroundColor(GLOB->EquestionColor, 20)); m_scoreObj->setMelody(mel); diff --git a/src/main/tmainscoreobject.h b/src/main/tmainscoreobject.h index 0b0a4ab1ad25338202839a97913e138cf097f33d..b1b46a65060d8d315936ebbdf03ea688bf7b74a9 100644 --- a/src/main/tmainscoreobject.h +++ b/src/main/tmainscoreobject.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2017 by Tomasz Bojczuk * + * Copyright (C) 2017-2018 by Tomasz Bojczuk * * seelook@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -91,6 +91,7 @@ public: void setKeySignature(const TkeySignature& key); char keySignatureValue(); Tnote getNote(int id); + void setSelectedItem(int id); // exam/exercise related void askQuestion(const Tnote& note, char realStr = 0);