Add adjustable seek times

Make seek times adjustable. Expose seek time under Playback Settings.
Set min time allowed in seconds to 1 and max time in seconds to 300.

FEATURE: 468686
This commit is contained in:
Harry Kaimenas 2023-05-11 07:26:31 +00:00 committed by Bart De Vries
parent 38b67dbc4b
commit 39f215c897
4 changed files with 48 additions and 3 deletions

View File

@ -474,13 +474,13 @@ void AudioManager::seek(qint64 position)
void AudioManager::skipForward()
{
qCDebug(kastsAudio) << "AudioManager::skipForward";
seek(std::min((position() + SKIP_STEP), duration()));
seek(std::min((position() + (1000 * SettingsManager::skipForward())), duration()));
}
void AudioManager::skipBackward()
{
qCDebug(kastsAudio) << "AudioManager::skipBackward";
seek(std::max((qint64)0, (position() - SKIP_STEP)));
seek(std::max((qint64)0, (position() - (1000 * SettingsManager::skipBackward()))));
}
bool AudioManager::canGoNext() const

View File

@ -53,7 +53,6 @@ class AudioManager : public QObject
public:
const double MAX_RATE = 1.0;
const double MIN_RATE = 2.5;
const qint64 SKIP_STEP = 10000;
const qint64 SKIP_TRACK_END = 15000;
static AudioManager &instance()

View File

@ -166,6 +166,40 @@ Kirigami.ScrollablePage {
SettingsManager.save();
}
}
MobileForm.FormDelegateSeparator {
below: prioritizeStreaming
above: skipForwardStep
}
MobileForm.FormTextDelegate {
id: skipForwardStep
text: i18nc("@label:spinbox", "Skip forward interval (in seconds)")
trailing :
Controls.SpinBox {
Layout.rightMargin: Kirigami.Units.gridUnit
value: SettingsManager.skipForward
from: 1
to: 300
onValueModified: {
SettingsManager.skipForward = value;
SettingsManager.save();
}
}
}
MobileForm.FormTextDelegate {
id: skipBackwardInterval
text: i18nc("@label:spinbox", "Skip backward interval (in seconds)")
trailing :
Controls.SpinBox {
Layout.rightMargin: Kirigami.Units.gridUnit
value: SettingsManager.skipBackward
from: 1
to: 300
onValueModified: {
SettingsManager.skipBackward = value;
SettingsManager.save();
}
}
}
}
}

View File

@ -123,6 +123,18 @@
<label>List of user-defined playback rates</label>
<default>50,75,100,125,150,175,200,225,250</default>
</entry>
<entry name="skipForward" type="UInt">
<label>Skip forward in seconds</label>
<min>1</min>
<max>300</max>
<default>10</default>
</entry>
<entry name="skipBackward" type="UInt">
<label>Skip backward in seconds</label>
<min>1</min>
<max>300</max>
<default>10</default>
</entry>
</group>
<group name="Network">
<entry name="allowMeteredFeedUpdates" type="Bool">