From 86306042f5bc757280798af36410656d8fc30f7a Mon Sep 17 00:00:00 2001 From: Kumar Date: Fri, 24 Jul 2020 12:33:25 +0530 Subject: [PATCH] Set default behaviour of playhead to << instead of |<< (#5591) * Set default behaviour, correct spelling * Set default behaviour, correct spelling * Store stop behaviour in project * Change how state is saved & loaded * Change to use enum --- include/TimeLineWidget.h | 1 + src/gui/TimeLineWidget.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/TimeLineWidget.h b/include/TimeLineWidget.h index bc0881f82..5b33bd989 100644 --- a/include/TimeLineWidget.h +++ b/include/TimeLineWidget.h @@ -243,6 +243,7 @@ signals: void positionChanged( const MidiTime & _t ); void loopPointStateLoaded( int _n ); void positionMarkerMoved(); + void loadBehaviourAtStop( int _n ); } ; diff --git a/src/gui/TimeLineWidget.cpp b/src/gui/TimeLineWidget.cpp index bd196de7f..8e79410b8 100644 --- a/src/gui/TimeLineWidget.cpp +++ b/src/gui/TimeLineWidget.cpp @@ -130,7 +130,7 @@ void TimeLineWidget::addToolButtons( QToolBar * _tool_bar ) NStateButton * behaviourAtStop = new NStateButton( _tool_bar ); behaviourAtStop->addState( embed::getIconPixmap( "back_to_zero" ), - tr( "After stopping go back to begin" ) + tr( "After stopping go back to beginning" ) ); behaviourAtStop->addState( embed::getIconPixmap( "back_to_start" ), tr( "After stopping go back to " @@ -140,6 +140,9 @@ void TimeLineWidget::addToolButtons( QToolBar * _tool_bar ) tr( "After stopping keep position" ) ); connect( behaviourAtStop, SIGNAL( changedState( int ) ), this, SLOT( toggleBehaviourAtStop( int ) ) ); + connect( this, SIGNAL( loadBehaviourAtStop( int ) ), behaviourAtStop, + SLOT( changeState( int ) ) ); + behaviourAtStop->changeState( BackToStart ); _tool_bar->addWidget( autoScroll ); _tool_bar->addWidget( loopPoints ); @@ -154,6 +157,7 @@ void TimeLineWidget::saveSettings( QDomDocument & _doc, QDomElement & _this ) _this.setAttribute( "lp0pos", (int) loopBegin() ); _this.setAttribute( "lp1pos", (int) loopEnd() ); _this.setAttribute( "lpstate", m_loopPoints ); + _this.setAttribute( "stopbehaviour", m_behaviourAtStop ); } @@ -167,6 +171,11 @@ void TimeLineWidget::loadSettings( const QDomElement & _this ) _this.attribute( "lpstate" ).toInt() ); update(); emit loopPointStateLoaded( m_loopPoints ); + + if( _this.hasAttribute( "stopbehaviour" ) ) + { + emit loadBehaviourAtStop( _this.attribute( "stopbehaviour" ).toInt() ); + } }