From 129e446322cddde9adb7eca2d29704de8d40afe6 Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Thu, 1 Sep 2016 10:24:25 +0200 Subject: [PATCH 1/7] Window title will be changed on rename track, now --- include/SubWindow.h | 2 ++ src/gui/SubWindow.cpp | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/include/SubWindow.h b/include/SubWindow.h index 3a00ecf16..1169517ac 100644 --- a/include/SubWindow.h +++ b/include/SubWindow.h @@ -64,6 +64,7 @@ protected: virtual void moveEvent( QMoveEvent * event ); virtual void resizeEvent( QResizeEvent * event ); virtual void paintEvent( QPaintEvent * pe ); + virtual void changeEvent( QEvent * event ); private: const QSize m_buttonSize; @@ -82,6 +83,7 @@ private: static void elideText( QLabel *label, QString text ); bool isMaximized(); + void adjustTitleBar(); }; #endif diff --git a/src/gui/SubWindow.cpp b/src/gui/SubWindow.cpp index 88eb1489f..ec4217579 100644 --- a/src/gui/SubWindow.cpp +++ b/src/gui/SubWindow.cpp @@ -121,6 +121,20 @@ void SubWindow::paintEvent( QPaintEvent * ) +void SubWindow::changeEvent( QEvent *event ) +{ + QMdiSubWindow::changeEvent( event ); + + if( event->type() == QEvent::WindowTitleChange ) + { + adjustTitleBar(); + } + +} + + + + void SubWindow::elideText( QLabel *label, QString text ) { QFontMetrics metrix( label->font() ); @@ -219,7 +233,7 @@ void SubWindow::moveEvent( QMoveEvent * event ) -void SubWindow::resizeEvent( QResizeEvent * event ) +void SubWindow::adjustTitleBar() { // button adjustments m_minimizeBtn->hide(); @@ -280,12 +294,19 @@ void SubWindow::resizeEvent( QResizeEvent * event ) elideText( m_windowTitle, widget()->windowTitle() ); m_windowTitle->setTextInteractionFlags( Qt::NoTextInteraction ); m_windowTitle->adjustSize(); +} + + + +void SubWindow::resizeEvent( QResizeEvent * event ) +{ + adjustTitleBar(); QMdiSubWindow::resizeEvent( event ); // if the window was resized and ISN'T minimized/maximized/fullscreen, // then save the current size - if( !isMax && !isMin && !isFullScreen() ) + if( !isMaximized() && !isMinimized() && !isFullScreen() ) { m_trackedNormalGeom.setSize( event->size() ); } From 0af64f5836bd2e0991491088a5f34254fb15f59b Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Thu, 1 Sep 2016 11:29:11 +0200 Subject: [PATCH 2/7] adjust window title on rename lfo controller --- src/gui/widgets/ControllerView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/widgets/ControllerView.cpp b/src/gui/widgets/ControllerView.cpp index 0b1d912c4..d6a020bce 100644 --- a/src/gui/widgets/ControllerView.cpp +++ b/src/gui/widgets/ControllerView.cpp @@ -154,6 +154,10 @@ void ControllerView::renameController() if( ok && !new_name.isEmpty() ) { c->setName( new_name ); + if( getController()->type() == getController()->LfoController ) + { + m_controllerDlg->setWindowTitle( "LFO (" + new_name + ")" ); + } m_nameLabel->setText( new_name ); } } From 2310c653486ae23c0bd48cbb8b5a9c8e06477229 Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Thu, 15 Sep 2016 15:20:33 +0200 Subject: [PATCH 3/7] rename Piano Roll window title on Instrument Track rename/remove --- include/PianoRoll.h | 5 +++++ src/gui/editors/PianoRoll.cpp | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) 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 From 52102dd8b31939624e13d7ae229cf6364d399a61 Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Thu, 15 Sep 2016 15:42:40 +0200 Subject: [PATCH 4/7] no reason for patternRenamed() is public --- include/PianoRoll.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 470b87f1f..92778a481 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -429,7 +429,7 @@ signals: void currentPatternChanged(); -public slots: +private slots: void patternRenamed(); private: From aaed243abb263a8ef18720423ca1e2219a4d3643 Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Sat, 17 Sep 2016 12:57:00 +0200 Subject: [PATCH 5/7] minor changes/code conventions --- include/PianoRoll.h | 2 - src/gui/SubWindow.cpp | 2 +- src/gui/editors/PianoRoll.cpp | 166 ++++++++++++++++++----------- src/gui/widgets/ControllerView.cpp | 4 +- 4 files changed, 105 insertions(+), 69 deletions(-) diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 92778a481..42b812f76 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -384,8 +384,6 @@ private: signals: void positionChanged( const MidiTime & ); - void noValidPattern(); - } ; diff --git a/src/gui/SubWindow.cpp b/src/gui/SubWindow.cpp index ec4217579..1f773f4aa 100644 --- a/src/gui/SubWindow.cpp +++ b/src/gui/SubWindow.cpp @@ -125,7 +125,7 @@ void SubWindow::changeEvent( QEvent *event ) { QMdiSubWindow::changeEvent( event ); - if( event->type() == QEvent::WindowTitleChange ) + if( event->type() == QEvent::WindowTitleChange ) { adjustTitleBar(); } diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 7895d22e8..dd5503aac 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3057,8 +3057,6 @@ 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() - @@ -4019,12 +4017,12 @@ PianoRollWindow::PianoRollWindow() : Editor(true), m_editor(new PianoRoll()) { - setCentralWidget(m_editor); + setCentralWidget( m_editor ); - m_playAction->setToolTip(tr("Play/pause current pattern (Space)")); - m_recordAction->setToolTip(tr("Record notes from MIDI-device/channel-piano")); - m_recordAccompanyAction->setToolTip(tr("Record notes from MIDI-device/channel-piano while playing song or BB track")); - m_stopAction->setToolTip(tr("Stop playing of current pattern (Space)")); + m_playAction->setToolTip(tr( "Play/pause current pattern (Space)" ) ); + m_recordAction->setToolTip(tr( "Record notes from MIDI-device/channel-piano" ) ); + m_recordAccompanyAction->setToolTip( tr( "Record notes from MIDI-device/channel-piano while playing song or BB track" ) ); + m_stopAction->setToolTip( tr( "Stop playing of current pattern (Space)" ) ); m_playAction->setWhatsThis( tr( "Click here to play the current pattern. " @@ -4045,21 +4043,21 @@ PianoRollWindow::PianoRollWindow() : m_stopAction->setWhatsThis( tr( "Click here to stop playback of current pattern." ) ); - DropToolBar *notesActionsToolBar = addDropToolBarToTop(tr("Edit actions")); + DropToolBar *notesActionsToolBar = addDropToolBarToTop( tr( "Edit actions" ) ); // init edit-buttons at the top - ActionGroup* editModeGroup = new ActionGroup(this); - QAction* drawAction = editModeGroup->addAction(embed::getIconPixmap("edit_draw"), tr("Draw mode (Shift+D)")); - QAction* eraseAction = editModeGroup->addAction(embed::getIconPixmap("edit_erase"), tr("Erase mode (Shift+E)")); - QAction* selectAction = editModeGroup->addAction(embed::getIconPixmap("edit_select"), tr("Select mode (Shift+S)")); - QAction* detuneAction = editModeGroup->addAction(embed::getIconPixmap("automation"), tr("Detune mode (Shift+T)")); + ActionGroup* editModeGroup = new ActionGroup( this ); + QAction* drawAction = editModeGroup->addAction( embed::getIconPixmap( "edit_draw" ), tr( "Draw mode (Shift+D)" ) ); + QAction* eraseAction = editModeGroup->addAction( embed::getIconPixmap( "edit_erase" ), tr("Erase mode (Shift+E)" ) ); + QAction* selectAction = editModeGroup->addAction( embed::getIconPixmap( "edit_select" ), tr( "Select mode (Shift+S)" ) ); + QAction* detuneAction = editModeGroup->addAction( embed::getIconPixmap( "automation" ), tr("Detune mode (Shift+T)" ) ); drawAction->setChecked( true ); - drawAction->setShortcut(Qt::SHIFT | Qt::Key_D); - eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E); - selectAction->setShortcut(Qt::SHIFT | Qt::Key_S); - detuneAction->setShortcut(Qt::SHIFT | Qt::Key_T); + drawAction->setShortcut( Qt::SHIFT | Qt::Key_D ); + eraseAction->setShortcut( Qt::SHIFT | Qt::Key_E ); + selectAction->setShortcut( Qt::SHIFT | Qt::Key_S ); + detuneAction->setShortcut( Qt::SHIFT | Qt::Key_T ); drawAction->setWhatsThis( tr( "Click here and draw mode will be activated. In this " @@ -4069,9 +4067,9 @@ PianoRollWindow::PianoRollWindow() : "activate this mode. In this mode, hold %1 to " "temporarily go into select mode." ).arg( #ifdef LMMS_BUILD_APPLE - "⌘") ); + "⌘" ) ); #else - "Ctrl") ); + "Ctrl" ) ); #endif eraseAction->setWhatsThis( tr( "Click here and erase mode will be activated. In this " @@ -4083,9 +4081,9 @@ PianoRollWindow::PianoRollWindow() : "you can hold %1 in draw mode to temporarily use " "select mode." ).arg( #ifdef LMMS_BUILD_APPLE - "⌘") ); + "⌘" ) ); #else - "Ctrl") ); + "Ctrl" ) ); #endif detuneAction->setWhatsThis( tr( "Click here and detune mode will be activated. " @@ -4094,10 +4092,10 @@ PianoRollWindow::PianoRollWindow() : "notes from one to another. You can also press " "'Shift+T' on your keyboard to activate this mode." ) ); - connect(editModeGroup, SIGNAL(triggered(int)), m_editor, SLOT(setEditMode(int))); + connect( editModeGroup, SIGNAL( triggered( int ) ), m_editor, SLOT( setEditMode( int ) ) ); - QAction* quantizeAction = new QAction(embed::getIconPixmap("quantize"), tr("Quantize"), this); - connect(quantizeAction, SIGNAL(triggered()), m_editor, SLOT(quantizeNotes())); + QAction* quantizeAction = new QAction(embed::getIconPixmap( "quantize" ), tr( "Quantize" ), this ); + connect( quantizeAction, SIGNAL( triggered() ), m_editor, SLOT( quantizeNotes() ) ); notesActionsToolBar->addAction( drawAction ); notesActionsToolBar->addAction( eraseAction ); @@ -4107,30 +4105,30 @@ PianoRollWindow::PianoRollWindow() : notesActionsToolBar->addAction( quantizeAction ); // Copy + paste actions - DropToolBar *copyPasteActionsToolBar = addDropToolBarToTop(tr("Copy paste controls")); + DropToolBar *copyPasteActionsToolBar = addDropToolBarToTop( tr( "Copy paste controls" ) ); - QAction* cutAction = new QAction(embed::getIconPixmap("edit_cut"), - tr("Cut selected notes (%1+X)").arg( + QAction* cutAction = new QAction(embed::getIconPixmap( "edit_cut" ), + tr( "Cut selected notes (%1+X)" ).arg( #ifdef LMMS_BUILD_APPLE - "⌘"), this); + "⌘" ), this ); #else - "Ctrl"), this); + "Ctrl" ), this ); #endif - QAction* copyAction = new QAction(embed::getIconPixmap("edit_copy"), - tr("Copy selected notes (%1+C)").arg( + QAction* copyAction = new QAction(embed::getIconPixmap( "edit_copy" ), + tr( "Copy selected notes (%1+C)" ).arg( #ifdef LMMS_BUILD_APPLE "⌘"), this); #else - "Ctrl"), this); + "Ctrl" ), this ); #endif - QAction* pasteAction = new QAction(embed::getIconPixmap("edit_paste"), - tr("Paste notes from clipboard (%1+V)").arg( + QAction* pasteAction = new QAction(embed::getIconPixmap( "edit_paste" ), + tr( "Paste notes from clipboard (%1+V)" ).arg( #ifdef LMMS_BUILD_APPLE - "⌘"), this); + "⌘" ), this ); #else - "Ctrl"), this); + "Ctrl" ), this ); #endif cutAction->setWhatsThis( @@ -4145,27 +4143,27 @@ PianoRollWindow::PianoRollWindow() : tr( "Click here and the notes from the clipboard will be " "pasted at the first visible measure." ) ); - cutAction->setShortcut(Qt::CTRL | Qt::Key_X); - copyAction->setShortcut(Qt::CTRL | Qt::Key_C); - pasteAction->setShortcut(Qt::CTRL | Qt::Key_V); + cutAction->setShortcut( Qt::CTRL | Qt::Key_X ); + copyAction->setShortcut( Qt::CTRL | Qt::Key_C ); + pasteAction->setShortcut( Qt::CTRL | Qt::Key_V ); - connect(cutAction, SIGNAL(triggered()), m_editor, SLOT(cutSelectedNotes())); - connect(copyAction, SIGNAL(triggered()), m_editor, SLOT(copySelectedNotes())); - connect(pasteAction, SIGNAL(triggered()), m_editor, SLOT(pasteNotes())); + connect( cutAction, SIGNAL( triggered() ), m_editor, SLOT( cutSelectedNotes() ) ); + connect( copyAction, SIGNAL( triggered() ), m_editor, SLOT( copySelectedNotes() ) ); + connect( pasteAction, SIGNAL( triggered() ), m_editor, SLOT( pasteNotes() ) ); - copyPasteActionsToolBar->addAction(cutAction); - copyPasteActionsToolBar->addAction(copyAction); - copyPasteActionsToolBar->addAction(pasteAction); + copyPasteActionsToolBar->addAction( cutAction ); + copyPasteActionsToolBar->addAction( copyAction ); + copyPasteActionsToolBar->addAction( pasteAction ); - DropToolBar *timeLineToolBar = addDropToolBarToTop(tr("Timeline controls")); - m_editor->m_timeLine->addToolButtons(timeLineToolBar); + DropToolBar *timeLineToolBar = addDropToolBarToTop( tr( "Timeline controls" ) ); + m_editor->m_timeLine->addToolButtons( timeLineToolBar ); addToolBarBreak(); - DropToolBar *zoomAndNotesToolBar = addDropToolBarToTop(tr("Zoom and note controls")); + DropToolBar *zoomAndNotesToolBar = addDropToolBarToTop( tr( "Zoom and note controls" ) ); QLabel * zoom_lbl = new QLabel( m_toolBar ); zoom_lbl->setPixmap( embed::getIconPixmap( "zoom" ) ); @@ -4182,12 +4180,10 @@ PianoRollWindow::PianoRollWindow() : m_quantizeComboBox->setModel( &m_editor->m_quantizeModel ); m_quantizeComboBox->setFixedSize( 64, 22 ); - // setup note-len-stuff QLabel * note_len_lbl = new QLabel( m_toolBar ); note_len_lbl->setPixmap( embed::getIconPixmap( "note" ) ); - m_noteLenComboBox = new ComboBox( m_toolBar ); m_noteLenComboBox->setModel( &m_editor->m_noteLenModel ); m_noteLenComboBox->setFixedSize( 105, 22 ); @@ -4265,7 +4261,6 @@ PianoRollWindow::PianoRollWindow() : "and in the key you have selected!" ) ); - m_chordComboBox->setWhatsThis( tr( "Let you select a chord which LMMS then can draw or highlight." @@ -4276,7 +4271,6 @@ PianoRollWindow::PianoRollWindow() : "in this drop-down menu." ) ); - // setup our actual window setFocusPolicy( Qt::StrongFocus ); setFocus(); @@ -4284,23 +4278,29 @@ PianoRollWindow::PianoRollWindow() : setCurrentPattern( NULL ); // Connections - connect(m_editor, SIGNAL(currentPatternChanged()), this, SIGNAL(currentPatternChanged())); - connect( m_editor, SIGNAL(noValidPattern()), this, SLOT( patternRenamed() ) ); + connect( m_editor, SIGNAL( currentPatternChanged() ), this, SIGNAL( currentPatternChanged() ) ); + connect( m_editor, SIGNAL( currentPatternChanged() ), this, SLOT( patternRenamed() ) ); } + + + const Pattern* PianoRollWindow::currentPattern() const { return m_editor->currentPattern(); } -void PianoRollWindow::setCurrentPattern(Pattern* pattern) + + + +void PianoRollWindow::setCurrentPattern( Pattern* pattern ) { - m_editor->setCurrentPattern(pattern); + m_editor->setCurrentPattern( pattern ); if ( pattern ) { setWindowTitle( tr( "Piano-Roll - %1" ).arg( pattern->name() ) ); - connect( pattern->instrumentTrack(), SIGNAL(nameChanged()), this, SLOT( patternRenamed()) ); + connect( pattern->instrumentTrack(), SIGNAL( nameChanged() ), this, SLOT( patternRenamed()) ); } else { @@ -4308,62 +4308,97 @@ void PianoRollWindow::setCurrentPattern(Pattern* pattern) } } + + + bool PianoRollWindow::isRecording() const { return m_editor->isRecording(); } + + + int PianoRollWindow::quantization() const { return m_editor->quantization(); } + + + void PianoRollWindow::play() { m_editor->play(); } + + + void PianoRollWindow::stop() { m_editor->stop(); } + + + void PianoRollWindow::record() { m_editor->record(); } + + + void PianoRollWindow::recordAccompany() { m_editor->recordAccompany(); } + + + void PianoRollWindow::stopRecording() { m_editor->stopRecording(); } + + + void PianoRollWindow::reset() { m_editor->reset(); } -void PianoRollWindow::saveSettings(QDomDocument & doc, QDomElement & de) + + +void PianoRollWindow::saveSettings( QDomDocument & doc, QDomElement & de ) { - MainWindow::saveWidgetState(this, de, QSize( 640, 480 ) ); + MainWindow::saveWidgetState( this, de, QSize( 640, 480 ) ); } -void PianoRollWindow::loadSettings(const QDomElement & de) + + + +void PianoRollWindow::loadSettings( const QDomElement & de ) { - MainWindow::restoreWidgetState(this, de); + MainWindow::restoreWidgetState( this, de ); } + + + QSize PianoRollWindow::sizeHint() const { - return {m_toolBar->sizeHint().width() + 10, INITIAL_PIANOROLL_HEIGHT}; + return { m_toolBar->sizeHint().width() + 10, INITIAL_PIANOROLL_HEIGHT }; } + + + void PianoRollWindow::patternRenamed() { if ( currentPattern() ) @@ -4376,8 +4411,11 @@ void PianoRollWindow::patternRenamed() } } -void PianoRollWindow::focusInEvent(QFocusEvent * event) + + + +void PianoRollWindow::focusInEvent( QFocusEvent * event ) { // when the window is given focus, also give focus to the actual piano roll - m_editor->setFocus(event->reason()); + m_editor->setFocus( event->reason() ); } diff --git a/src/gui/widgets/ControllerView.cpp b/src/gui/widgets/ControllerView.cpp index d6a020bce..afe934abd 100644 --- a/src/gui/widgets/ControllerView.cpp +++ b/src/gui/widgets/ControllerView.cpp @@ -154,9 +154,9 @@ void ControllerView::renameController() if( ok && !new_name.isEmpty() ) { c->setName( new_name ); - if( getController()->type() == getController()->LfoController ) + if( getController()->type() == Controller::LfoController ) { - m_controllerDlg->setWindowTitle( "LFO (" + new_name + ")" ); + m_controllerDlg->setWindowTitle( tr( "LFO" ) + " (" + new_name + ")" ); } m_nameLabel->setText( new_name ); } From 354cb78412f07ba86357707bf0775db47cef4ff6 Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Sun, 18 Sep 2016 13:18:35 +0200 Subject: [PATCH 6/7] piano roll title changed on pattern renaming --- src/gui/editors/PianoRoll.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index dd5503aac..5adb01c01 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4301,6 +4301,7 @@ void PianoRollWindow::setCurrentPattern( Pattern* pattern ) { setWindowTitle( tr( "Piano-Roll - %1" ).arg( pattern->name() ) ); connect( pattern->instrumentTrack(), SIGNAL( nameChanged() ), this, SLOT( patternRenamed()) ); + connect( pattern, SIGNAL( dataChanged() ), this, SLOT( patternRenamed() ) ); } else { From d600d56ad369dcb0715208067c1e17c03e2f7d7a Mon Sep 17 00:00:00 2001 From: Steffen Baranowsky Date: Sun, 18 Sep 2016 13:56:36 +0200 Subject: [PATCH 7/7] change automation editor window title on rename automation pattern --- include/AutomationEditor.h | 3 +++ src/gui/editors/AutomationEditor.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index c85ca55be..3e0faaced 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -288,6 +288,9 @@ protected slots: void play(); void stop(); +private slots: + void updateWindowTitle(); + private: QAction* m_discreteAction; QAction* m_linearAction; diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index c532d1414..7ff86dbb2 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -2318,6 +2318,7 @@ void AutomationEditorWindow::setCurrentPattern(AutomationPattern* pattern) if (pattern) { connect(pattern, SIGNAL(dataChanged()), this, SLOT(update())); + connect( pattern, SIGNAL( dataChanged() ), this, SLOT( updateWindowTitle() ) ); connect(pattern, SIGNAL(destroyed()), this, SLOT(clearCurrentPattern())); connect(m_flipXAction, SIGNAL(triggered()), pattern, SLOT(flipX())); @@ -2394,3 +2395,14 @@ void AutomationEditorWindow::stop() { m_editor->stop(); } + +void AutomationEditorWindow::updateWindowTitle() +{ + if ( m_editor->m_pattern == nullptr) + { + setWindowTitle( tr( "Automation Editor - no pattern" ) ); + return; + } + + setWindowTitle( tr( "Automation Editor - %1" ).arg( m_editor->m_pattern->name() ) ); +}