For now this only works with NetworkManager. The related settings are
greyed out on systems not using NetworkManager.
Some details of the implementation:
- Implement settings in the settings menu to enable/disable feed
updates, episode downloads and/ or image downloads on metered
connections. If the option(s) is disabled, an overlay dialog is shown
with options to "not allow", "allow once", or "allow always".
- If the network is down, no attempt is made to download images and the
fallback image will be used until the network is up again.
This also solves an issue where the application hangs when the network
is down and feed images have not been cached yet.
- Next to this, part of the cachedImage implementation in Entry and Feed
has been refactored to re-use code as part of the image() method in
Fetcher.
- In case something unexpected happens, an error will be logged.
RENAME COLUMN was only introduced in sqlite 3.25. So it's probably
better to avoid it for the time being to increase compatibility with
older versions.
Still to be done:
- Update Download Page to show partial downloads.
- Connect signals to Download Page to update whenever an enclosure
changes status. This is broken by this commit because
downloadCountChanged has been removed.
Since we have a product on bugs.kde.org which already has several bugs
registered, we might as well use it as the main place for externally
reported bugs, and keep gitlab issues as internal tracker.
The main bits of this implementation are:
- Start a new track in paused state. We don't care about the actual
media state or player state that QMediaPlayer is reporting. We will
deal with that when the audio actually starts playing.
- If a player position needs to be restored, we set d->m_pendingSeek to
the position that needs to be seeked. We don't actually seek because
we have no idea what state the player is in yet.
- On the positionChanged signal of QMP, and if the media is buffered, we
check if there is pendingSeek value set which is set to a different
value than the current player position. If so, we call
d->m_player.setPosition(). If we have arrived at the correct
position, then we reset d->m_pendingSeek to -1.
- In the position(), duration() and seek() methods, we return sensible
values, even QMP is not. So, we report the duration from the
enclosure, the position from d->m_pendingSeek, and let seek() change
the value of d->m_PendingSeek (if it's not -1) to the new seek
position.
- When there's a pending seek, we set the notifyInterval to shorter
interval to reduce the startup audio glitch as much as possible. We
then reset it to the default of 1000 msec.
This was tested on linux and android.
- This refactoring also includes a cleanup of a lot of header includes to
avoid circular dependencies.
- The error message will now be shown below the info message.
- Add database migration (for Errors)
The inhibit dbus call to gnome sessionmanager expects flags as input.
Currently the flags are set to 4, which will "Inhibit the session being
marked as idle". This is insufficient to prevent the device from
suspending while playing.
We should also add 8 = "Inhibit suspending the session or computer".
Hence, the updated flags to 12.
This change was tested on phosh/phoc and it properly prevents the
system from suspending. The flags = 12 settings is also what gnome
music players like Lollypop are using (as checked through the gnome
sessionmanager dbus interface).
This enables the download method in Fetcher to resume in case a partial
download is already saved to disk.
For full implementation of download resumes, more changes are required,
because the current application will automatically clean up files that
don't match the expected size at startup.