Adds the new solo behavior as a new LED button

To allow the user choosing between the old solo behavior and the new one, a new LED button was added which will be used to enable the solo keeping the automation tracks states, while the red LED will enable the solo with the current behavior.

Changes to the code:
	- Added a purple LED image that will be used on the new button.
	- Increased the default width of the widget that holds the mute and solo buttons so the third one fits.
	- Changed the positioning of the LEDs on both the standard and compact track modes to accomodate them.
	- Added a new model called m_soloAutomationsModel, which is connected to the new LED button (m_soloAutomationsBtn). This will dictate the behavior of the toggleSolo method.
	- The red LED calls the toggleSolo method as before. The purple LED will change the m_soloAutomationsModel value and toggle the red LED, which will then call toggleSolo. But since the value of m_soloAutomationsModel will be different, the new behavior will be used on the method.
This commit is contained in:
IanCaio
2020-06-30 16:02:02 -03:00
parent 149ef0bd50
commit fdbc8b2712
4 changed files with 43 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

View File

@@ -57,7 +57,7 @@ class TrackView;
const int DEFAULT_SETTINGS_WIDGET_WIDTH = 224;
const int TRACK_OP_WIDTH = 78;
const int TRACK_OP_WIDTH = 94;
// This shaves 150-ish pixels off track buttons,
// ruled from config: ui.compacttrackbuttons
const int DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT = 96;
@@ -466,6 +466,7 @@ private:
QPushButton * m_trackOps;
PixmapButton * m_muteBtn;
PixmapButton * m_soloBtn;
PixmapButton * m_soloAutomationsBtn; // Purple LED that enables solo with automations
friend class TrackView;
@@ -629,6 +630,8 @@ private:
BoolModel m_soloModel;
bool m_mutedBeforeSolo;
BoolModel m_soloAutomationsModel; // That option prevents solo from muting automation tracks
bool m_simpleSerializingMode;
tcoVector m_trackContentObjects;

View File

@@ -1871,16 +1871,23 @@ TrackOperationsWidget::TrackOperationsWidget( TrackView * parent ) :
m_soloBtn->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );
m_soloBtn->setCheckable( true );
m_soloAutomationsBtn = new PixmapButton( this, tr( "Solo with Automations" ) );
m_soloAutomationsBtn->setActiveGraphic( embed::getIconPixmap( "led_purple" ) );
m_soloAutomationsBtn->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );
m_soloAutomationsBtn->setCheckable( true );
if( ConfigManager::inst()->value( "ui",
"compacttrackbuttons" ).toInt() )
{
m_muteBtn->move( 46, 0 );
m_soloBtn->move( 46, 16 );
m_soloBtn->move( 46, 9 );
m_soloAutomationsBtn->move( 46, 18 );
}
else
{
m_muteBtn->move( 46, 8 );
m_soloBtn->move( 62, 8 );
m_soloAutomationsBtn->move( 78, 8 );
}
m_muteBtn->show();
@@ -1889,6 +1896,14 @@ TrackOperationsWidget::TrackOperationsWidget( TrackView * parent ) :
m_soloBtn->show();
ToolTip::add( m_soloBtn, tr( "Solo" ) );
m_soloAutomationsBtn->show();
ToolTip::add( m_soloAutomationsBtn, tr( "Solo with Automations" ) );
// The purple LED will simply enable the regular solo (red LED). But since it will also
// change m_soloAutomationsModel to true, the behavior of the solo will be different
// keeping the automation tracks on their current state (either muted or unmuted).
connect( m_soloAutomationsBtn, SIGNAL( clicked() ),
m_soloBtn, SLOT( toggle() ) );
connect( this, SIGNAL( trackRemovalScheduled( TrackView * ) ),
m_trackView->trackContainerView(),
SLOT( deleteTrackView( TrackView * ) ),
@@ -2643,6 +2658,13 @@ void Track::toggleSolo()
}
const bool solo = m_soloModel.value();
// Turn off the soloAutomationsBtn LED if we are disabling the solo
if( !solo )
{
m_soloAutomationsModel.setValue( false );
}
for( TrackContainer::TrackList::const_iterator it = tl.begin();
it != tl.end(); ++it )
{
@@ -2653,20 +2675,29 @@ void Track::toggleSolo()
{
( *it )->m_mutedBeforeSolo = ( *it )->isMuted();
}
// Don't mute AutomationTracks (keep their original state)
if( *it == this ){
( *it )->setMuted( false );
} else if( ( *it )->type() != AutomationTrack ){
( *it )->setMuted( true );
} else {
// Only mutes the automation tracks if the soloAutomationsBtn LED is not
// toggled
if( ( *it )->type() == AutomationTrack ){
if( !m_soloAutomationsModel.value() )
{
( *it )->setMuted( true );
}
} else {
( *it )->setMuted( true );
}
}
if( *it != this )
{
( *it )->m_soloModel.setValue( false );
// If the soloAutomationsBtn LED is activated on another track we disable it as well
( *it )->m_soloAutomationsModel.setValue( false );
}
}
else if( !soloBefore && (* it )->type() != AutomationTrack )
else if( !soloBefore )
{
// Only restores the mute state if the track isn't an Automation Track
( *it )->setMuted( ( *it )->m_mutedBeforeSolo );
}
}
@@ -2675,6 +2706,7 @@ void Track::toggleSolo()
BoolModel *Track::getMutedModel()
{
return &m_mutedModel;
@@ -2841,6 +2873,7 @@ void TrackView::modelChanged()
connect( m_track, SIGNAL( destroyedTrack() ), this, SLOT( close() ) );
m_trackOperationsWidget.m_muteBtn->setModel( &m_track->m_mutedModel );
m_trackOperationsWidget.m_soloBtn->setModel( &m_track->m_soloModel );
m_trackOperationsWidget.m_soloAutomationsBtn->setModel( &m_track->m_soloAutomationsModel );
ModelView::modelChanged();
setFixedHeight( m_track->getHeight() );
}