diff --git a/include/PianoRoll.h b/include/PianoRoll.h index bed5a08e3..470b87f1f 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -384,6 +384,7 @@ private: signals: void positionChanged( const MidiTime & ); + void noValidPattern(); } ; @@ -427,6 +428,10 @@ public: signals: void currentPatternChanged(); + +public slots: + void patternRenamed(); + private: void focusInEvent(QFocusEvent * event); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 497a6d6b2..7895d22e8 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3057,6 +3057,8 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) p.drawText( WHITE_KEY_WIDTH + 20, PR_TOP_MARGIN + 40, tr( "Please open a pattern by double-clicking " "on it!" ) ); + emit noValidPattern(); + } p.setClipRect( WHITE_KEY_WIDTH, PR_TOP_MARGIN, width() - @@ -4283,6 +4285,7 @@ PianoRollWindow::PianoRollWindow() : // Connections connect(m_editor, SIGNAL(currentPatternChanged()), this, SIGNAL(currentPatternChanged())); + connect( m_editor, SIGNAL(noValidPattern()), this, SLOT( patternRenamed() ) ); } const Pattern* PianoRollWindow::currentPattern() const @@ -4297,6 +4300,7 @@ void PianoRollWindow::setCurrentPattern(Pattern* pattern) if ( pattern ) { setWindowTitle( tr( "Piano-Roll - %1" ).arg( pattern->name() ) ); + connect( pattern->instrumentTrack(), SIGNAL(nameChanged()), this, SLOT( patternRenamed()) ); } else { @@ -4360,6 +4364,18 @@ QSize PianoRollWindow::sizeHint() const return {m_toolBar->sizeHint().width() + 10, INITIAL_PIANOROLL_HEIGHT}; } +void PianoRollWindow::patternRenamed() +{ + if ( currentPattern() ) + { + setWindowTitle( tr( "Piano-Roll - %1" ).arg( currentPattern()->name() ) ); + } + else + { + setWindowTitle( tr( "Piano-Roll - no pattern" ) ); + } +} + void PianoRollWindow::focusInEvent(QFocusEvent * event) { // when the window is given focus, also give focus to the actual piano roll