Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes the behavior of "solo" so it doesn't mute Automation Tracks #5547

Merged
merged 12 commits into from
Aug 1, 2020
1 change: 1 addition & 0 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ class LMMS_EXPORT ConfigManager : public QObject

void upgrade_1_1_90();
void upgrade_1_1_91();
void upgrade_1_3_0();
void upgrade();

QString m_workingDir;
Expand Down
2 changes: 2 additions & 0 deletions include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ private slots:
void toggleCompactTrackButtons(bool enabled);
void toggleOneInstrumentTrackWindow(bool enabled);
void toggleSideBarOnRight(bool enabled);
void toggleSoloLegacyBehavior(bool enabled);
void toggleMMPZ(bool enabled);
void toggleDisableBackup(bool enabled);
void toggleOpenLastProject(bool enabled);
Expand Down Expand Up @@ -132,6 +133,7 @@ private slots:
bool m_compactTrackButtons;
bool m_oneInstrumentTrackWindow;
bool m_sideBarOnRight;
bool m_soloLegacyBehavior;
bool m_MMPZ;
bool m_disableBackup;
bool m_openLastProject;
Expand Down
15 changes: 15 additions & 0 deletions src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ void ConfigManager::upgrade_1_1_91()
}


void ConfigManager::upgrade_1_3_0()
{
// Adds the option of using the solo legacy behavior (muting Automation Tracks as well) if
// it isn't on the configuration file (safety check + upgrade)
if(value("app", "sololegacybehavior").isNull()) {
setValue("app", "sololegacybehavior", "0");
}
}
IanCaio marked this conversation as resolved.
Show resolved Hide resolved


IanCaio marked this conversation as resolved.
Show resolved Hide resolved
void ConfigManager::upgrade()
{
// Skip the upgrade if versions match
Expand All @@ -177,6 +187,11 @@ void ConfigManager::upgrade()
{
upgrade_1_1_91();
}

if (createdWith.setCompareType(ProjectVersion::Build) < "1.3.0")
{
upgrade_1_3_0();
}

// Don't use old themes as they break the UI (i.e. 0.4 != 1.0, etc)
if (createdWith.setCompareType(ProjectVersion::Minor) != LMMS_VERSION)
Expand Down
18 changes: 16 additions & 2 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2653,15 +2653,29 @@ void Track::toggleSolo()
{
( *it )->m_mutedBeforeSolo = ( *it )->isMuted();
}
( *it )->setMuted( *it == this ? false : true );
// Don't mute AutomationTracks (keep their original state) unless we are on the sololegacybehavior mode
if( *it == this ){
( *it )->setMuted( false );
} else {
if( ConfigManager::inst()->value("app","sololegacybehavior").toInt() || ( *it )->type() != AutomationTrack ){
( *it )->setMuted( true );
}
}
IanCaio marked this conversation as resolved.
Show resolved Hide resolved
if( *it != this )
{
( *it )->m_soloModel.setValue( false );
}
}
else if( !soloBefore )
{
( *it )->setMuted( ( *it )->m_mutedBeforeSolo );
// Unless we are on the sololegacybehavior mode, only restores the
// mute state if the track isn't an Automation Track
if( ConfigManager::inst()->value("app","sololegacybehavior").toInt() )
{
( *it )->setMuted( ( *it )->m_mutedBeforeSolo );
} else if( ( *it )->type() != AutomationTrack ) {
( *it )->setMuted( ( *it )->m_mutedBeforeSolo );
}
IanCaio marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/gui/SetupDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
"ui", "oneinstrumenttrackwindow").toInt()),
m_sideBarOnRight(ConfigManager::inst()->value(
"ui", "sidebaronright").toInt()),
m_soloLegacyBehavior(ConfigManager::inst()->value(
"app", "sololegacybehavior").toInt()),
m_MMPZ(!ConfigManager::inst()->value(
"app", "nommpz").toInt()),
m_disableBackup(!ConfigManager::inst()->value(
Expand Down Expand Up @@ -233,6 +235,8 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
m_oneInstrumentTrackWindow, SLOT(toggleOneInstrumentTrackWindow(bool)), true);
addLedCheckBox("Show sidebar on the right-hand side", gui_tw, counter,
m_sideBarOnRight, SLOT(toggleSideBarOnRight(bool)), true);
addLedCheckBox("Use solo legacy behavior", gui_tw, counter,
IanCaio marked this conversation as resolved.
Show resolved Hide resolved
m_soloLegacyBehavior, SLOT(toggleSoloLegacyBehavior(bool)), false);

gui_tw->setFixedHeight(YDelta + YDelta * counter);

Expand Down Expand Up @@ -905,6 +909,8 @@ void SetupDialog::accept()
QString::number(m_oneInstrumentTrackWindow));
ConfigManager::inst()->setValue("ui", "sidebaronright",
QString::number(m_sideBarOnRight));
ConfigManager::inst()->setValue("app", "sololegacybehavior",
QString::number(m_soloLegacyBehavior));
ConfigManager::inst()->setValue("app", "nommpz",
QString::number(!m_MMPZ));
ConfigManager::inst()->setValue("app", "disablebackup",
Expand Down Expand Up @@ -1041,6 +1047,10 @@ void SetupDialog::setLanguage(int lang)
}


void SetupDialog::toggleSoloLegacyBehavior(bool enabled)
{
m_soloLegacyBehavior = enabled;
}


// Performance settings slots.
Expand Down