Skip to content
Snippets Groups Projects
Commit 38598839 authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Make play and record actions checkable, Back from record mode before exam/exercise starts

parent 1b3da23a
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ TmelMan::TmelMan(TmainScore* score) :
m_menu = new Tmenu();
m_playMelAct = createAction(tr("Play"), SLOT(playMelodySlot()), QKeySequence(Qt::Key_Space),
QIcon(score->style()->standardIcon(QStyle::SP_MediaPlay)));
m_playMelAct->setCheckable(true);
#if defined (Q_OS_MAC) // Ctrl is CMD under Mac and CMD+space is system wide shortcut - use Ctrl (Meta there) instead
m_recMelAct = createAction(tr("Record"), SLOT(recordMelodySlot()), QKeySequence("Meta+Space"),
QIcon(Tpath::img("record")));
......@@ -40,6 +41,7 @@ TmelMan::TmelMan(TmainScore* score) :
m_recMelAct = createAction(tr("Record"), SLOT(recordMelodySlot()), QKeySequence("Ctrl+Space"),
QIcon(Tpath::img("record")));
#endif
m_recMelAct->setCheckable(true);
m_recMelAct->setStatusTip(tr("When record is set, not only played notes are written one by one but either selecting fret or note name adds new note automatically."));
QAction* genAct = createAction(tr("Generate"), SLOT(randomizeMelodySlot()), QKeySequence(), QIcon(Tpath::img("melody")));
genAct->setStatusTip(tr("Generate a melody with random notes."));
......@@ -87,6 +89,7 @@ void TmelMan::playMelodySlot() {
m_score->playScore(); // It will be stopped
m_recMelAct->setDisabled(false);
m_playMelAct->setIcon(QIcon(m_score->style()->standardIcon(QStyle::SP_MediaPlay)));
m_playMelAct->setChecked(false);
if (m_score->insertMode() == TmultiScore::e_record)
showAudioMark(e_recording);
else
......@@ -100,6 +103,7 @@ void TmelMan::playMelodySlot() {
}
m_recMelAct->setDisabled(true);
m_playMelAct->setIcon(QIcon(m_score->style()->standardIcon(QStyle::SP_MediaStop)));
m_playMelAct->setChecked(true);
m_score->playScore();
showAudioMark(e_playing);
}
......
/***************************************************************************
* Copyright (C) 2014-2015 by Tomasz Bojczuk *
* Copyright (C) 2014-2016 by Tomasz Bojczuk *
* tomaszbojczuk@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
......@@ -46,7 +46,8 @@ public:
QWidgetAction* melodyAction() { return m_melAct; }
QToolButton* button() { return m_button; }
QAction* recordAction() { return m_recMelAct; }
public slots:
void playMelodySlot();
void recordMelodySlot();
......
......@@ -542,6 +542,8 @@ void MainWindow::prepareToExam() {
if (score->insertMode() != TmultiScore::e_single) {
if (score->isScorePlayed())
m_melButt->playMelodySlot(); // stop playing when played
if (m_melButt->recordAction()->isChecked()) // exit record mode
m_melButt->recordAction()->trigger();
}
sound->stopPlaying();
examResults = new TexamView();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment