Add option to continue sidebar previews when mouse released (#5787)

* Add option to continue sidebar previews when mouse released

* Cancel non-sample previews regardless of setting
This commit is contained in:
Spekular
2020-11-24 21:49:54 +01:00
committed by GitHub
parent 8d4bcd7105
commit ed9abe58c6
3 changed files with 23 additions and 3 deletions

View File

@@ -75,6 +75,7 @@ private slots:
void toggleCompactTrackButtons(bool enabled);
void toggleOneInstrumentTrackWindow(bool enabled);
void toggleSideBarOnRight(bool enabled);
void toggleLetPreviewsFinish(bool enabled);
void toggleSoloLegacyBehavior(bool enabled);
void toggleMMPZ(bool enabled);
void toggleDisableBackup(bool enabled);
@@ -133,6 +134,7 @@ private:
bool m_compactTrackButtons;
bool m_oneInstrumentTrackWindow;
bool m_sideBarOnRight;
bool m_letPreviewsFinish;
bool m_soloLegacyBehavior;
bool m_MMPZ;
bool m_disableBackup;

View File

@@ -687,10 +687,16 @@ void FileBrowserTreeWidget::mouseReleaseEvent(QMouseEvent * me )
{
m_mousePressed = false;
// If a preview is running, we may need to stop it. Otherwise, we're done
QMutexLocker previewLocker(&m_pphMutex);
if (m_previewPlayHandle == nullptr) { return; }
//TODO: User setting to allow samples to play until completion instead
if (m_previewPlayHandle != nullptr) { stopPreview(); }
// Only sample previews may continue after mouse up. Is this a sample preview?
bool isSample = m_previewPlayHandle->type() == PlayHandle::TypeSamplePlayHandle;
// Even sample previews should only continue if the user wants them to. Do they?
bool shouldContinue = ConfigManager::inst()->value("ui", "letpreviewsfinish").toInt();
// If both are true the preview may continue, otherwise we stop it
if (!(isSample && shouldContinue)) { stopPreview(); }
}

View File

@@ -104,6 +104,8 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
"ui", "oneinstrumenttrackwindow").toInt()),
m_sideBarOnRight(ConfigManager::inst()->value(
"ui", "sidebaronright").toInt()),
m_letPreviewsFinish(ConfigManager::inst()->value(
"ui", "letpreviewsfinish").toInt()),
m_soloLegacyBehavior(ConfigManager::inst()->value(
"app", "sololegacybehavior", "0").toInt()),
m_MMPZ(!ConfigManager::inst()->value(
@@ -237,6 +239,8 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
m_oneInstrumentTrackWindow, SLOT(toggleOneInstrumentTrackWindow(bool)), true);
addLedCheckBox(tr("Show sidebar on the right-hand side"), gui_tw, counter,
m_sideBarOnRight, SLOT(toggleSideBarOnRight(bool)), true);
addLedCheckBox(tr("Let sample previews continue when mouse is released"), gui_tw, counter,
m_letPreviewsFinish, SLOT(toggleLetPreviewsFinish(bool)), false);
addLedCheckBox(tr("Mute automation tracks during solo"), gui_tw, counter,
m_soloLegacyBehavior, SLOT(toggleSoloLegacyBehavior(bool)), false);
@@ -466,7 +470,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
as_w_layout->setMargin(0);
#ifdef LMMS_HAVE_JACK
m_audioIfaceSetupWidgets[AudioJack::name()] =
m_audioIfaceSetupWidgets[AudioJack::name()] =
new AudioJack::setupWidget(as_w);
#endif
@@ -911,6 +915,8 @@ void SetupDialog::accept()
QString::number(m_oneInstrumentTrackWindow));
ConfigManager::inst()->setValue("ui", "sidebaronright",
QString::number(m_sideBarOnRight));
ConfigManager::inst()->setValue("ui", "letpreviewsfinish",
QString::number(m_letPreviewsFinish));
ConfigManager::inst()->setValue("app", "sololegacybehavior",
QString::number(m_soloLegacyBehavior));
ConfigManager::inst()->setValue("app", "nommpz",
@@ -1025,6 +1031,12 @@ void SetupDialog::toggleSideBarOnRight(bool enabled)
}
void SetupDialog::toggleLetPreviewsFinish(bool enabled)
{
m_letPreviewsFinish = enabled;
}
void SetupDialog::toggleMMPZ(bool enabled)
{
m_MMPZ = enabled;