diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/changes b/changes index aa246dffb170c8618e4c9c553670ba510e2f3aee..fdef2c5aec8023b1d5d9f5a65fa7317fbed1170f 100644 --- a/changes +++ b/changes @@ -1,3 +1,9 @@ +1.1.7 rc2 + BUGS FIXES + - changed all static font sizes to system related sizes + - proper clef rendering in question tips + - proper re-sampling when rate is bigger than 48000 + 1.1.6 rc1 - new, advanced settings for pitch detection - workarounds to avoid pitch-detection of the same note twice diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/src/exam/tcanvas.cpp b/src/exam/tcanvas.cpp index 0b8701c0f91b92df25454889b25b25095aed081e..fca9da74cc72cc4e28d604fbe64c16a68f230bb7 100644 --- a/src/exam/tcanvas.cpp +++ b/src/exam/tcanvas.cpp @@ -99,6 +99,16 @@ void Tcanvas::resultTip(TQAunit* answer, int time) { clearConfirmTip(); clearResultTip(); clearTryAgainTip(); + + bool autoNext = gl->E->autoNextQuest; + if (gl->E->afterMistake == TexamParams::e_stop && !answer->isCorrect()) + autoNext = false; // when mistake and e_stop - the same like autoNext = false; + if (autoNext) { // determine time of displaying + if (answer->isCorrect() || gl->E->afterMistake == TexamParams::e_continue) + time = 2500; // hard-coded + else + time = gl->E->mistakePreview; // user defined wait time + } m_resultTip = new TgraphicsTextTip(wasAnswerOKtext(answer, TexecutorSupply::answerColor(answer->mistake()), bigFont())); m_scene->addItem(m_resultTip); @@ -404,6 +414,7 @@ void Tcanvas::clearCorrection() { delete m_flyEllipse; m_flyEllipse = 0; } + emit correctingFinished(); } diff --git a/src/exam/tcanvas.h b/src/exam/tcanvas.h index b91499b8e5b5ad985ca9f79fe5c2a5b9677fded2..2db0862c5aa07451dc3de77ec41de6b5a0ffd645 100644 --- a/src/exam/tcanvas.h +++ b/src/exam/tcanvas.h @@ -125,6 +125,7 @@ public slots: signals: void buttonClicked(const QString&); /** This signal is emitted when user click image button (a link) on any tip.*/ void certificateMagicKeys(); /** When translator wants to see a certificate preview */ + void correctingFinished(); /** Emitted when correction animation finish */ protected: diff --git a/src/exam/texamexecutor.cpp b/src/exam/texamexecutor.cpp old mode 100755 new mode 100644 diff --git a/src/exam/tquestiontip.cpp b/src/exam/tquestiontip.cpp index 478f11057469d749b9df97b3308efe5a7e93cc99..c908fb7dbf62c0d60dfa8ca5d01448c8bed8855f 100644 --- a/src/exam/tquestiontip.cpp +++ b/src/exam/tquestiontip.cpp @@ -123,10 +123,10 @@ QString TquestionTip::getQuestion(TQAunit* question, int questNr, Tlevel* level, QString attemptText = ""; if (question->attemptsCount() > 1) attemptText = " <small><i>" + TexTrans::attemptTxt() + QString(" %1").arg(question->attemptsCount()) + "</i></small>"; - m_questText += QString("<b><u> %1. </u></b>").arg(questNr) + attemptText + "<br>"; - QString apendix = ""; - QString noteStr; - switch (question->questionAs) { + m_questText += QString("<b><u> %1. </u></b>").arg(questNr) + attemptText + "<br>"; + QString apendix = ""; + QString noteStr; + switch (question->questionAs) { case TQAtype::e_asNote: { m_scoreFree = false; if (question->answerAsNote()) { @@ -250,9 +250,9 @@ QString TquestionTip::getQuestion(TQAunit* question, int questNr, Tlevel* level, } break; } - if (scale) - m_questText += "</p>"; - return m_questText; + if (scale) + m_questText += "</p>"; + return m_questText; } diff --git a/src/gui/ttoolbar.cpp b/src/gui/ttoolbar.cpp index 87e10ff77909fb5ea9cac2a695045edb5a2006bf..b785dfda7a4a79aec04f5c50d1f17012a1e2337d 100644 --- a/src/gui/ttoolbar.cpp +++ b/src/gui/ttoolbar.cpp @@ -224,14 +224,12 @@ void TtoolBar::setForQuestion(bool repeatSound, bool tuneFork) { addAction(repeatSndAct); if (tuneFork && tuneForkAct) addAction(tuneForkAct); - checkAct->setDisabled(false); addAction(checkAct); } void TtoolBar::setAfterAnswer() { removeAction(checkAct); - checkAct->setDisabled(true); if (repeatSndAct) removeAction(repeatSndAct); if (tuneForkAct) diff --git a/src/guitar/tfingerboard.cpp b/src/guitar/tfingerboard.cpp index 0bb78911f7c4541b9d7ad48eb8781e5d5a8cc810..692c640d50350f2e6b0911dcc32a995e4ebc0e4d 100644 --- a/src/guitar/tfingerboard.cpp +++ b/src/guitar/tfingerboard.cpp @@ -1019,16 +1019,17 @@ void TfingerBoard::strikeBlinkingFinished() { void TfingerBoard::finishCorrection() { - m_animation->deleteLater(); - m_animation = 0; - if (m_movingItem) { - delete m_movingItem; - m_movingItem = 0; - } - setFinger(m_goodPos); - markAnswer(QColor(gl->EanswerColor.lighter().name())); - if (m_nameInCorrection) - showName(m_corrStyle, gl->EanswerColor); + m_animation->deleteLater(); + m_animation = 0; + if (m_movingItem) { + delete m_movingItem; + m_movingItem = 0; + } + setFinger(m_goodPos); + markAnswer(QColor(gl->EanswerColor.lighter().name())); + if (m_nameInCorrection) + showName(m_corrStyle, gl->EanswerColor); + emit correctingFinished(); } diff --git a/src/guitar/tfingerboard.h b/src/guitar/tfingerboard.h index ee087810693ad1788decabed371b5fb49041ffe1..f6c7dfd7fb65987c4ab042f539b120552740b4cd 100644 --- a/src/guitar/tfingerboard.h +++ b/src/guitar/tfingerboard.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2014 by Tomasz Bojczuk * + * Copyright (C) 2011-2015 by Tomasz Bojczuk * * tomaszbojczuk@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -32,134 +32,135 @@ class TgraphicsTextTip; class TfingerBoard : public QGraphicsView { - Q_OBJECT + Q_OBJECT public: - explicit TfingerBoard(QWidget *parent = 0); - virtual ~TfingerBoard(); - - void acceptSettings(); - - /** It paints fingerprint on the fretboard in place where note is. - * If globals GshowOtherPos is true all possibilities are shown. - * If @param realStr is set is shown only on pointed string (if any). - * It returns true if something is shown.*/ - void setFinger(const Tnote& note); - void setFinger(TfingerPos pos); - TfingerPos getfingerPos() { return m_fingerPos; } /** Returns selected finger position */ - - void askQuestion(TfingerPos pos); - void clearFingerBoard(); - - /** Creates rectangle (or two) indicates range of frets in exam.*/ - void createRangeBox(char loFret, char hiFret); - void prepareAnswer(); - void deleteRangeBox(); - void setGuitarDisabled(bool disabled); - - void setHighlitedString(char realStrNr); /** Highlights given string */ - void clearHighLight(); - - int posX12fret(); /** Returns x coordinate of 12th fret where guitar body starts. */ - - QRect fbRect() { return m_fbRect; } /** Guitar fingerboard rectangle */ - QRect* pickRect() { return m_pickRect; } /** Rectangle of guitar pickup or empty if none */ - - /** Sets Rectangle describing pickup image - * x() has to point its x coordinate in TfingerBoard measures. */ - void setPickUpRect(const QRect& rect) { - m_pickRect->setRect(rect.x(), rect.y(), rect.width(), rect.height()); } - - - /** Returns width of a string */ - qreal stringWidth(int realStr) { return m_strWidth[qBound(1, realStr, 6)]; } - - /** Returns QLineF represents given string [1 - 6] */ - QLineF stringLine(int realStr) { return m_strings[qBound(0, realStr - 1, 5)]->line(); } - - /** Returns @param true when cursor is over the widget. */ - bool isCursorOverGuitar() { return m_isCursorOverGuitar; } - - /** Marks selected string or fret. Marking is cleaned when clearFingerBoard() is invoked. */ - void markAnswer(QColor blurColor); - - /** Highlights m_questString or m_questFinger after answering. */ - void markQuestion(QColor blurColor); - void correctPosition(TfingerPos &pos, const QColor color); - - /** Displays name of note at current position - * When note is empty the method tries to grab note (position) from that what was selected. */ - void showName(Tnote::EnameStyle st, Tnote& note, const QColor& textColor); - void showName(Tnote::EnameStyle st, const QColor& textColor) { Tnote empty(0, 0, 0); showName(st, empty, textColor); } - void deleteNoteName(); - - /** Returns scene coordinates of given guitar position */ - QPointF fretToPos(TfingerPos &pos); - QRectF fingerRect() const; + explicit TfingerBoard(QWidget *parent = 0); + virtual ~TfingerBoard(); + + void acceptSettings(); + + /** It paints fingerprint on the fretboard in place where note is. + * If globals GshowOtherPos is true all possibilities are shown. + * If @param realStr is set is shown only on pointed string (if any). + * It returns true if something is shown.*/ + void setFinger(const Tnote& note); + void setFinger(TfingerPos pos); + TfingerPos getfingerPos() { return m_fingerPos; } /** Returns selected finger position */ + + void askQuestion(TfingerPos pos); + void clearFingerBoard(); + + /** Creates rectangle (or two) indicates range of frets in exam.*/ + void createRangeBox(char loFret, char hiFret); + void prepareAnswer(); + void deleteRangeBox(); + void setGuitarDisabled(bool disabled); + + void setHighlitedString(char realStrNr); /** Highlights given string */ + void clearHighLight(); + + int posX12fret(); /** Returns x coordinate of 12th fret where guitar body starts. */ + + QRect fbRect() { return m_fbRect; } /** Guitar fingerboard rectangle */ + QRect* pickRect() { return m_pickRect; } /** Rectangle of guitar pickup or empty if none */ + + /** Sets Rectangle describing pickup image + * x() has to point its x coordinate in TfingerBoard measures. */ + void setPickUpRect(const QRect& rect) { + m_pickRect->setRect(rect.x(), rect.y(), rect.width(), rect.height()); } + + + /** Returns width of a string */ + qreal stringWidth(int realStr) { return m_strWidth[qBound(1, realStr, 6)]; } + + /** Returns QLineF represents given string [1 - 6] */ + QLineF stringLine(int realStr) { return m_strings[qBound(0, realStr - 1, 5)]->line(); } + + /** Returns @param true when cursor is over the widget. */ + bool isCursorOverGuitar() { return m_isCursorOverGuitar; } + + /** Marks selected string or fret. Marking is cleaned when clearFingerBoard() is invoked. */ + void markAnswer(QColor blurColor); + + /** Highlights m_questString or m_questFinger after answering. */ + void markQuestion(QColor blurColor); + void correctPosition(TfingerPos &pos, const QColor color); + + /** Displays name of note at current position + * When note is empty the method tries to grab note (position) from that what was selected. */ + void showName(Tnote::EnameStyle st, Tnote& note, const QColor& textColor); + void showName(Tnote::EnameStyle st, const QColor& textColor) { Tnote empty(0, 0, 0); showName(st, empty, textColor); } + void deleteNoteName(); + + /** Returns scene coordinates of given guitar position */ + QPointF fretToPos(TfingerPos &pos); + QRectF fingerRect() const; signals: - void guitarClicked(const Tnote&); + void guitarClicked(const Tnote&); + void correctingFinished(); /** Emitted when correction animation finish */ protected: - void resizeEvent(QResizeEvent *); - void mouseMoveEvent(QMouseEvent *); - void mousePressEvent(QMouseEvent *event); - bool event(QEvent *event); - - void paint(); - Tnote posToNote(int str, int fret); - - /** Determines string width by its note pitch. Sets loNote & hiNote */ - void setTune(); + void resizeEvent(QResizeEvent *); + void mouseMoveEvent(QMouseEvent *); + void mousePressEvent(QMouseEvent *event); + bool event(QEvent *event); + + void paint(); + Tnote posToNote(int str, int fret); + + /** Determines string width by its note pitch. Sets loNote & hiNote */ + void setTune(); private: - QRect m_fbRect; /** Represents top left positions and size of a fingerboard */ - short m_strGap; /** Distance between strings */ - short m_fretWidth; /** Average width of fret */ - short lastFret; /** Position of the last fret (in whole widget coordinates) */ - short m_curStr, m_curFret; /** Actual position of cursor over the guitar in strings/frets coordinates */ - short m_loNote, m_hiNote; /** Chromatic numbers of lowest note in tune and highest. */ - TfingerPos m_fingerPos; /** It keeps position of selected fingerprint.*/ - short m_fretsPos[24]; /** @param fretsPos stores X positions of frets in global widget coordinates */ - qreal m_strWidth[6]; /** Array of width each string. Width depends on fretboard height. */ - qreal m_widthFromPitch[6]; /** Base values from which m_strWidth is calculated determined from tune. */ - QColor m_strColors[6]; - - QGraphicsScene *m_scene; - QGraphicsEllipseItem *m_workFinger, *m_fingers[6], *m_questFinger; - int m_strNr, m_fretNr; - QGraphicsLineItem *m_workStrings[6], *m_strings[6], *m_questString, *m_highString; - QGraphicsSimpleTextItem *m_questMark; - TgraphicsTextTip *m_beyondTip; /** Tip about a note is impossible to show with current tune. */ - TgraphicsTextTip *m_noteName; /** Note name text. */ - Tnote::EnameStyle m_corrStyle; /** Name style of corrected note */ - bool m_nameInCorrection; - Tnote m_selNote; /** Keeps selected note */ - - /** Position from a question - is needed to calculate size of questioned finger - * or string if naughty user changes window size. */ - TfingerPos m_questPos; - char m_loFret, m_hiFret; /** Frets range in an exam*/ - QGraphicsRectItem *m_rangeBox1, *m_rangeBox2; - bool m_isDisabled; - int m_hilightedStrNr; - bool m_isCursorOverGuitar; - TfingerPos m_goodPos; - TstrikedOutItem *m_strikeOut; - TcombinedAnim *m_animation; - QGraphicsItem *m_movingItem; /** string line during animation */ - QRect *m_pickRect; /** Rectangle of guitar pickup or empty if none */ + QRect m_fbRect; /** Represents top left positions and size of a fingerboard */ + short m_strGap; /** Distance between strings */ + short m_fretWidth; /** Average width of fret */ + short lastFret; /** Position of the last fret (in whole widget coordinates) */ + short m_curStr, m_curFret; /** Actual position of cursor over the guitar in strings/frets coordinates */ + short m_loNote, m_hiNote; /** Chromatic numbers of lowest note in tune and highest. */ + TfingerPos m_fingerPos; /** It keeps position of selected fingerprint.*/ + short m_fretsPos[24]; /** @param fretsPos stores X positions of frets in global widget coordinates */ + qreal m_strWidth[6]; /** Array of width each string. Width depends on fretboard height. */ + qreal m_widthFromPitch[6]; /** Base values from which m_strWidth is calculated determined from tune. */ + QColor m_strColors[6]; + + QGraphicsScene *m_scene; + QGraphicsEllipseItem *m_workFinger, *m_fingers[6], *m_questFinger; + int m_strNr, m_fretNr; + QGraphicsLineItem *m_workStrings[6], *m_strings[6], *m_questString, *m_highString; + QGraphicsSimpleTextItem *m_questMark; + TgraphicsTextTip *m_beyondTip; /** Tip about a note is impossible to show with current tune. */ + TgraphicsTextTip *m_noteName; /** Note name text. */ + Tnote::EnameStyle m_corrStyle; /** Name style of corrected note */ + bool m_nameInCorrection; + Tnote m_selNote; /** Keeps selected note */ + + /** Position from a question - is needed to calculate size of questioned finger + * or string if naughty user changes window size. */ + TfingerPos m_questPos; + char m_loFret, m_hiFret; /** Frets range in an exam*/ + QGraphicsRectItem *m_rangeBox1, *m_rangeBox2; + bool m_isDisabled; + int m_hilightedStrNr; + bool m_isCursorOverGuitar; + TfingerPos m_goodPos; + TstrikedOutItem *m_strikeOut; + TcombinedAnim *m_animation; + QGraphicsItem *m_movingItem; /** string line during animation */ + QRect *m_pickRect; /** Rectangle of guitar pickup or empty if none */ private: - void paintFinger(QGraphicsEllipseItem *f, char strNr, char fretNr); - void paintQuestMark(); - void resizeRangeBox(); - void paintFingerAtPoint(QPoint p); - void deleteBeyondTip(); - + void paintFinger(QGraphicsEllipseItem *f, char strNr, char fretNr); + void paintQuestMark(); + void resizeRangeBox(); + void paintFingerAtPoint(QPoint p); + void deleteBeyondTip(); + private slots: - void strikeBlinkingFinished(); - void finishCorrection(); + void strikeBlinkingFinished(); + void finishCorrection(); }; diff --git a/src/libs/sound/trtaudioout.cpp b/src/libs/sound/trtaudioout.cpp index 6c553d90357213cbf06c5119b42bc8407df68b19..dae5519d79f59d01f927766069c1bae175e315b5 100755 --- a/src/libs/sound/trtaudioout.cpp +++ b/src/libs/sound/trtaudioout.cpp @@ -133,7 +133,6 @@ TaudioOUT::TaudioOUT(TaudioParams *_params, QObject *parent) : TaudioOUT::~TaudioOUT() { -// abortStream(); closeStream(); deleteOutParams(); resetCallBack(); @@ -148,12 +147,12 @@ void TaudioOUT::setAudioOutParams() { // qDebug() << "setAudioOutParams"; playable = oggScale->loadAudioData(audioParams()->audioInstrNr); if (playable && streamParams()) { - ratioOfRate = sampleRate() / 44100; - quint32 oggSR = sampleRate(); + ratioOfRate = outRate() / 44100; + quint32 oggSR = outRate(); if (ratioOfRate > 1) { // - if (sampleRate() == 88200 || sampleRate() == 176400) + if (outRate() == 88200 || outRate() == 176400) oggSR = 44100; - else if (sampleRate() == 96000 || sampleRate() == 192000) + else if (outRate() == 96000 || outRate() == 192000) oggSR = 48000; } oggScale->setSampleRate(oggSR); diff --git a/src/libs/sound/widgets/tintonationview.cpp b/src/libs/sound/widgets/tintonationview.cpp index bbdae77dd5312678138a7a457ed73d2634658f44..6b8fe9952675d79bff5db98e34343203ff49a7da 100644 --- a/src/libs/sound/widgets/tintonationview.cpp +++ b/src/libs/sound/widgets/tintonationview.cpp @@ -100,6 +100,7 @@ void TintonationView::pitchSlot(float pitch) { void TintonationView::outOfTuneAnim(float outTune, int duration) { + Q_UNUSED(duration) if (!m_timer) { m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(animationSlot())); diff --git a/src/libs/sound/widgets/tpitchview.cpp b/src/libs/sound/widgets/tpitchview.cpp index 0bb5c5703b2f90cd2e0bc50f062f4462bbbe40c6..10a363ebeb0ac4ec5ed860bc254c9dc0d8ad1810 100644 --- a/src/libs/sound/widgets/tpitchview.cpp +++ b/src/libs/sound/widgets/tpitchview.cpp @@ -59,6 +59,7 @@ TpitchView::TpitchView(TaudioIN* audioIn, QWidget* parent, bool pauseActive) : connect(m_volumeView, SIGNAL(paused()), this, SLOT(pauseClicked())); connect(m_volumeView, SIGNAL(minimalVolume(float)), this, SLOT(minimalVolumeChanged(float))); connect(m_intoView, SIGNAL(accuracyChanged()), this, SLOT(accuracyChangedSlot())); + connect(m_intoView, &TintonationView::animationFinished, this, &TpitchView::intoAnimFinished); } //################################################################################################# @@ -249,6 +250,11 @@ void TpitchView::accuracyChangedSlot() { } +void TpitchView::intoAnimFinished() { + emit correctingFinished(); +} + + //################################################################################################# //################### EVENTS ############################################ //################################################################################################# diff --git a/src/libs/sound/widgets/tpitchview.h b/src/libs/sound/widgets/tpitchview.h index 15826d215850e2a9d7d81c607495a0ddcb77aa1e..fb632658104dd299d354e5e928ddf7064954b4e8 100644 --- a/src/libs/sound/widgets/tpitchview.h +++ b/src/libs/sound/widgets/tpitchview.h @@ -72,6 +72,9 @@ public: /** Starts animation displaying correction of unclear sound. */ void outOfTuneAnim(float outTune, int duration = 300); +signals: + void correctingFinished(); /** Emitted when correction animation finish */ + protected slots: void noteSlot(); @@ -81,6 +84,7 @@ protected slots: void inputStateChanged(int inSt); void inputDeviceDeleted(); void accuracyChangedSlot(); + void intoAnimFinished(); protected: virtual void paintEvent(QPaintEvent*); diff --git a/src/notename/tnotename.cpp b/src/notename/tnotename.cpp index 239d1fddddf6dff4cb0a13087c07ec91284c7960..c6c89f756d5cb1a9eb7217b810e4245caf94da43 100755 --- a/src/notename/tnotename.cpp +++ b/src/notename/tnotename.cpp @@ -655,7 +655,7 @@ void TnoteName::octaveWasChanged(int octNr) { // octNr is button nr in the group void TnoteName::correctAnimationFinished() { // This slot is invoked by m_nameLabel child object which is deleted. - // It cases crashes. It is safer to call it with delay and outside + // It causes crashes. It is safer to call it with delay and outside QTimer::singleShot(1, this, SLOT(invokeBlinkingAgain())); } @@ -666,6 +666,7 @@ void TnoteName::invokeBlinkingAgain() { markNameLabel(QColor(gl->EanswerColor.name())); m_nameLabel->thrownText(m_goodNote.toRichText(), 150, 150); } + emit correctingFinished(); } diff --git a/src/notename/tnotename.h b/src/notename/tnotename.h index d661675b9d1fd22cf8177c9ae45893174af26130..b1c5f1fbc592bbb682a369fe0c7c562392127aa6 100755 --- a/src/notename/tnotename.h +++ b/src/notename/tnotename.h @@ -100,6 +100,7 @@ signals: void statusTipRequired(QString status); void nextNote(); void prevNote(); + void correctingFinished(); /** Emitted when correction animation finish */ protected: diff --git a/src/score/tmainscore.cpp b/src/score/tmainscore.cpp index 2af60bc19657f2c426971b1e8c33cfa933e39231..6a9bf52cc44960b24fdf434cf4c06cccf14f30b4 100644 --- a/src/score/tmainscore.cpp +++ b/src/score/tmainscore.cpp @@ -822,9 +822,8 @@ void TmainScore::keyBlinkingFinished() { void TmainScore::finishCorrection() { noteFromId(m_correctNoteNr)->enableNoteAnim(false); noteFromId(m_correctNoteNr)->markNote(QColor(Tcore::gl()->EanswerColor.lighter().name())); - if (Tcore::gl()->E->showNameOfAnswered) // show name only when it is enabled - noteFromId(m_correctNoteNr)->showNoteName(QColor(Tcore::gl()->EanswerColor.lighter().name())); m_correctNoteNr = -1; + emit correctingFinished(); } diff --git a/src/score/tmainscore.h b/src/score/tmainscore.h index 0c1676f139ae92f63a084f9057fbd171f0efb2ba..13a5c133bb3538f795e769cbb5ebbe2e51a76729 100644 --- a/src/score/tmainscore.h +++ b/src/score/tmainscore.h @@ -46,153 +46,154 @@ class QGraphicsSimpleTextItem; */ class TmainScore : public TmultiScore { - Q_OBJECT + Q_OBJECT public: - TmainScore(QMainWindow* mw, QWidget* parent = 0); - ~TmainScore(); - - - void setEnableEnharmNotes(bool isEnabled); - void acceptSettings(); - - int widthToHeight(int hi); /** Returns width of score when its height is @p hi. */ - - virtual void setNote(const Tnote& note); - virtual void setNote(int index, const Tnote& note) { TmultiScore::setNote(index, note); } - void setMelody(Tmelody* mel); - void getMelody(Tmelody* mel, const QString& title = ""); /** Grabs all notes, key and time in a score to given @p mel */ - - void setInsertMode(EinMode mode); - - TscoreActions* scoreActions() { return m_acts; } - - /** Describes moving of selected note */ - enum EmoveNote { - e_nextNote, e_prevNote, e_nextStaff, e_prevStaff, e_last, e_first, e_doNotMove - }; - - void askQuestion(Tnote note, char realStr = 0); - void askQuestion(Tnote note, TkeySignature key, char realStr = 0); - void askQuestion(Tmelody* mel); - void clearScore(); - - /** It sets TkeySignatureView background to question color, sets fake key signature - * and invokes askQuestion in TkeySignatureView */ - void prepareKeyToAnswer(TkeySignature fakeKey, QString expectKeyName); - - /** Connects or disconnects reactions for clicking a note - * and showing enharmonic notes depends on is exam executing (disconnect) - * or not (connect).*/ - void isExamExecuting(bool isIt); - bool isExam() { return (bool)m_questMark; } /** @p True during exam/exercises */ - /** Internally it calls setScoreDisabled(false) to unlock and locks unused noteViews (1 & 2) again. */ - void unLockScore(); - virtual void setScoreDisabled(bool disabled); - void lockKeySignature(bool lock); /** Locks/unlocks key signature segment (if exists). */ - void setKeyViewBg(QColor C); - void setNoteViewBg(int id, QColor C); - void forceAccidental(Tnote::Ealter accid); /** Sets given accidental */ - - /** Marks note with border and blur. It is used to show was answer correct or not. Default note number for single mode. */ - void markAnswered(QColor blurColor, int noteNr = 0); - void markQuestion(QColor blurColor, int noteNr = 1); - - void enableAccidToKeyAnim(bool enable); - bool isAccidToKeyAnimEnabled(); - - /** Performs animation that transforming current selected note to given @p goodNote */ - void correctNote(Tnote& goodNote, const QColor& color, int noteNr = 0); - - /** Performs rewinding of current key to @p newKey */ - void correctKeySignature(TkeySignature newKey); - void correctAccidental(Tnote& goodNote); - - /** Displays note name of first note or the second if given next to its note-head in a score. */ - void showNames(Tnote::EnameStyle st); - void deleteNoteName(int id); /** Deletes given instance of note name if it exist */ - - /** Returns note head rectangle if visible or empty QRectF. */ - QRectF noteRect(int noteNr); - - /** Position of a note in graphics view coordinates. */ - QPoint notePos(int noteNr); - - bool isScorePlayed() { return m_scoreIsPlayed; } - TnoteName* noteName() { return m_nameMenu; } - - bool isCorrectAnimPending() { return m_correctNoteNr > -1; } /** @p TRUE when animation is in progress. */ - + TmainScore(QMainWindow* mw, QWidget* parent = 0); + ~TmainScore(); + + + void setEnableEnharmNotes(bool isEnabled); + void acceptSettings(); + + int widthToHeight(int hi); /** Returns width of score when its height is @p hi. */ + + virtual void setNote(const Tnote& note); + virtual void setNote(int index, const Tnote& note) { TmultiScore::setNote(index, note); } + void setMelody(Tmelody* mel); + void getMelody(Tmelody* mel, const QString& title = ""); /** Grabs all notes, key and time in a score to given @p mel */ + + void setInsertMode(EinMode mode); + + TscoreActions* scoreActions() { return m_acts; } + + /** Describes moving of selected note */ + enum EmoveNote { + e_nextNote, e_prevNote, e_nextStaff, e_prevStaff, e_last, e_first, e_doNotMove + }; + + void askQuestion(Tnote note, char realStr = 0); + void askQuestion(Tnote note, TkeySignature key, char realStr = 0); + void askQuestion(Tmelody* mel); + void clearScore(); + + /** It sets TkeySignatureView background to question color, sets fake key signature + * and invokes askQuestion in TkeySignatureView */ + void prepareKeyToAnswer(TkeySignature fakeKey, QString expectKeyName); + + /** Connects or disconnects reactions for clicking a note + * and showing enharmonic notes depends on is exam executing (disconnect) + * or not (connect).*/ + void isExamExecuting(bool isIt); + bool isExam() { return (bool)m_questMark; } /** @p True during exam/exercises */ + /** Internally it calls setScoreDisabled(false) to unlock and locks unused noteViews (1 & 2) again. */ + void unLockScore(); + virtual void setScoreDisabled(bool disabled); + void lockKeySignature(bool lock); /** Locks/unlocks key signature segment (if exists). */ + void setKeyViewBg(QColor C); + void setNoteViewBg(int id, QColor C); + void forceAccidental(Tnote::Ealter accid); /** Sets given accidental */ + + /** Marks note with border and blur. It is used to show was answer correct or not. Default note number for single mode. */ + void markAnswered(QColor blurColor, int noteNr = 0); + void markQuestion(QColor blurColor, int noteNr = 1); + + void enableAccidToKeyAnim(bool enable); + bool isAccidToKeyAnimEnabled(); + + /** Performs animation that transforming current selected note to given @p goodNote */ + void correctNote(Tnote& goodNote, const QColor& color, int noteNr = 0); + + /** Performs rewinding of current key to @p newKey */ + void correctKeySignature(TkeySignature newKey); + void correctAccidental(Tnote& goodNote); + + /** Displays note name of first note or the second if given next to its note-head in a score. */ + void showNames(Tnote::EnameStyle st); + void deleteNoteName(int id); /** Deletes given instance of note name if it exist */ + + /** Returns note head rectangle if visible or empty QRectF. */ + QRectF noteRect(int noteNr); + + /** Position of a note in graphics view coordinates. */ + QPoint notePos(int noteNr); + + bool isScorePlayed() { return m_scoreIsPlayed; } + TnoteName* noteName() { return m_nameMenu; } + + bool isCorrectAnimPending() { return m_correctNoteNr > -1; } /** @p TRUE when animation is in progress. */ + signals: - void noteChanged(int index, Tnote note); - - void noteClicked(); /** This signal is emitted during an exam when expert answers are used. */ - void playbackFinished(); - + void noteChanged(int index, Tnote note); + + void noteClicked(); /** This signal is emitted during an exam when expert answers are used. */ + void playbackFinished(); + void correctingFinished(); /** Emitted when correction animation finish*/ + public slots: - void whenNoteWasChanged(int index, Tnote note); - void noteWasClickedMain(int index); - void setScordature(); /** Sets scordature to value kept in Tglobal. */ - void expertNoteChanged(); - void onClefChanged(Tclef cl); - void playScore(); /** Plays (actually emits noteChanged()) all notes starting from the selected one. */ + void whenNoteWasChanged(int index, Tnote note); + void noteWasClickedMain(int index); + void setScordature(); /** Sets scordature to value kept in Tglobal. */ + void expertNoteChanged(); + void onClefChanged(Tclef cl); + void playScore(); /** Plays (actually emits noteChanged()) all notes starting from the selected one. */ protected: - virtual void resizeEvent(QResizeEvent* event); - +virtual void resizeEvent(QResizeEvent* event); + protected slots: - void strikeBlinkingFinished(); - void keyBlinkingFinished(); - void finishCorrection(); - void zoomScoreSlot(); - - void showNameMenu(TscoreNote* sn); - void menuChangedNote(Tnote n); - void extraAccidsSlot(); - void showNamesSlot(); - void moveSelectedNote(EmoveNote nDir = e_doNotMove); - void moveNameForward() { moveName(e_nextNote); } - void moveNameBack() { moveName(e_prevNote); } - - void playSlot(); - + void strikeBlinkingFinished(); + void keyBlinkingFinished(); + void finishCorrection(); + void zoomScoreSlot(); + + void showNameMenu(TscoreNote* sn); + void menuChangedNote(Tnote n); + void extraAccidsSlot(); + void showNamesSlot(); + void moveSelectedNote(EmoveNote nDir = e_doNotMove); + void moveNameForward() { moveName(e_nextNote); } + void moveNameBack() { moveName(e_prevNote); } + + void playSlot(); + private: - void restoreNotesSettings(); /** Sets notes colors according to globals. */ - void performScordatureSet(); /** Common method to set scordature */ - void setQuestionMarkPos(); /** updates position of question mark in the middle of score view */ - - virtual void addStaff(TscoreStaff* st = 0); - - /** Creates QGraphicsRectItem with answer color, places it under the staff and adds to m_bgRects list. - * clearScore() removes it. */ - void createBgRect(QColor c, qreal width, QPointF pos); - - void setBarsIconSize(); - void createActions(); - void moveName(EmoveNote moveDir); - void createNoteName(); - void enableCorners(bool enable); /** Activates/deactivates corner menus. */ + void restoreNotesSettings(); /** Sets notes colors according to globals. */ + void performScordatureSet(); /** Common method to set scordature */ + void setQuestionMarkPos(); /** updates position of question mark in the middle of score view */ + + virtual void addStaff(TscoreStaff* st = 0); + + /** Creates QGraphicsRectItem with answer color, places it under the staff and adds to m_bgRects list. + * clearScore() removes it. */ + void createBgRect(QColor c, qreal width, QPointF pos); + + void setBarsIconSize(); + void createActions(); + void moveName(EmoveNote moveDir); + void createNoteName(); + void enableCorners(bool enable); /** Activates/deactivates corner menus. */ private: - QGraphicsSimpleTextItem *m_questMark; - QGraphicsTextItem *m_questKey; - QList<QGraphicsRectItem*> m_bgRects; // list of rectangles with highlights - TstrikedOutItem *m_strikeOut; - QPointer<TblinkingItem> m_bliking, m_keyBlinking; - int m_correctNoteNr; - Tnote m_goodNote; - TkeySignature m_goodKey; - Tnote::EnameStyle m_corrStyle; - QToolBar *m_settBar, *m_clearBar, *m_rhythmBar; - - TcornerProxy *m_delCorner; - TnoteName *m_nameMenu; - QPointer<TscoreNote> m_currentNameSegment; /** Currently edited TscoreNote by menu. */ - bool m_scoreIsPlayed; - QPointer<QTimer> m_playTimer; - TscoreActions *m_acts; /** Score actions (tool bars icons/buttons) */ - int m_playedIndex; - bool m_emitExpertNoteClicked; + QGraphicsSimpleTextItem *m_questMark; + QGraphicsTextItem *m_questKey; + QList<QGraphicsRectItem*> m_bgRects; // list of rectangles with highlights + TstrikedOutItem *m_strikeOut; + QPointer<TblinkingItem> m_bliking, m_keyBlinking; + int m_correctNoteNr; + Tnote m_goodNote; + TkeySignature m_goodKey; + Tnote::EnameStyle m_corrStyle; + QToolBar *m_settBar, *m_clearBar, *m_rhythmBar; + + TcornerProxy *m_delCorner; + TnoteName *m_nameMenu; + QPointer<TscoreNote> m_currentNameSegment; /** Currently edited TscoreNote by menu. */ + bool m_scoreIsPlayed; + QPointer<QTimer> m_playTimer; + TscoreActions *m_acts; /** Score actions (tool bars icons/buttons) */ + int m_playedIndex; + bool m_emitExpertNoteClicked; }; #endif // TMAINSCORE_H