Add setting to continue playback after end of current track

This commit is contained in:
Bart De Vries 2021-05-23 21:09:02 +02:00
parent 086e0ef664
commit 99c1424327
3 changed files with 26 additions and 5 deletions

View File

@ -181,6 +181,7 @@ QMediaPlayer::MediaStatus AudioManager::status() const
void AudioManager::setEntry(Entry *entry)
{
d->m_lockPositionSaving = true;
bool continuePlayback = false;
// First check if the previous track needs to be marked as read
// TODO: make grace time a setting in SettingsManager
@ -193,6 +194,7 @@ void AudioManager::setEntry(Entry *entry)
d->m_entry->setRead(true);
d->m_entry->enclosure()->setPlayPosition(0);
d->m_entry->setQueueStatus(false); // i.e. remove from queue TODO: make this a choice in settings
continuePlayback = SettingsManager::self()->continuePlayingNextEntry();
}
}
@ -233,6 +235,7 @@ void AudioManager::setEntry(Entry *entry)
d->m_entry->enclosure()->setDuration(d->m_player.duration() / 1000);
// qDebug() << "Correcting duration of" << d->m_entry->id() << "to" << d->m_player.duration()/1000;
}
if (continuePlayback) play();
} else {
DataManager::instance().setLastPlayingEntry(QStringLiteral("none"));
d->m_entry = nullptr;

View File

@ -19,6 +19,19 @@ Kirigami.ScrollablePage {
Kirigami.FormLayout {
Kirigami.Heading {
Kirigami.FormData.isSection: true
text: i18n("Play Settings")
}
Controls.CheckBox {
id: continuePlayingNextEntry
checked: SettingsManager.continuePlayingNextEntry
text: i18n("Continue playing next episode after current one finishes")
onToggled: SettingsManager.continuePlayingNextEntry = checked
}
Kirigami.Heading {
Kirigami.FormData.isSection: true
text: i18n("Queue Settings")
@ -59,6 +72,7 @@ Kirigami.ScrollablePage {
text: i18n("Appearance")
}
Controls.CheckBox {
id: alwaysShowFeedTitles
checked: SettingsManager.alwaysShowFeedTitles
@ -91,4 +105,4 @@ Kirigami.ScrollablePage {
onToggled: SettingsManager.articleFontUseSystem = checked
}
}
}
}

View File

@ -5,6 +5,14 @@
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kastsrc" />
<group name="General">
<entry name="alwaysShowFeedTitles" type="Bool">
<label>Always show the title of podcast feeds in subscription view</label>
<default>false</default>
</entry>
<entry name="continuePlayingNextEntry" type="Bool">
<label>Continue playing next episode after current one finishes</label>
<default>true</default>
</entry>
<entry name="refreshOnStartup" type="Bool">
<label>Automatically fetch feed updates on startup</label>
<default>false</default>
@ -17,10 +25,6 @@
<label>Automatically download new episodes</label>
<default>false</default>
</entry>
<entry name="alwaysShowFeedTitles" type="Bool">
<label>Always show the title of podcast feeds in subscription view</label>
<default>false</default>
</entry>
<entry name="toggleRemainingTime" type="Bool">
<label>Whether the player shows remaining track time instead of total track time</label>
<default>false</default>