Any access, read or write, via QSettings requires locking
`Clementine.conf`. On some devices, this can be slow. Moreover, it also
increases power use and wear on devices such as SSDs.
To improve the situation, defer QSettings updates until program close
for window resize, current playlist tab, and playlist geometry, i.e.
`PlaylistView::SaveGeometry`.
Also, limit `PlaylistView::LoadGeometry` to once per program run.
Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com>
There was an issue where the song items were only being shown
from a fresh start up but not when the playlist was created. This fixes
that issue and refactors the AddPlaylist code
This allows power users who keep 100s of playlists to easily
find a playlist either by directory name, playlist name or by
searching for a song artist/title a playlist might contain
* Continuation of "Seek instead of navigation with arrow keys" #5550, now allows up arrow key to not restart the song over when the library is in focus. Works as usuhal when playlist is in focus (song gets started over).
* Update playlistview.cpp
Added in the part that is responsible for seeking properly.
* Fix delete functionality. Skips to next song if deleted song is also currently playing.
* Added in a bool to determine if the song being deleted is meant to be deleted from the disk or just from the playlist. Took advantage of the unused variable located in removeRows to distinguish between the two options. No longer adds delete from disk to the undo stack, and deleting from the playlist goes to undo stack as it should.
* Added in a bool to determine if the song being deleted is meant to be deleted from the disk or just from the playlist. Took advantage of the unused variable located in removeRows to distinguish between the two options. No longer adds delete from disk to the undo stack, and deleting from the playlist goes to undo stack as it should.
* Update mainwindow.cpp
* Formatting Changes
* Update playlist.cpp
Simplified condition statement.
* Added in a missed boolean for RemoveSelected
* Update playlistview.cpp
* Do not restore playback state on application start if overwritten by command line options
This also fixes unwanted pausing if a new instance is started with commandline URL combined with playback restore.
Note that the actual buggy code (MainWindow::ResumePlayback()) is not fixed here.
* Fix for commandline URLs for new instances are always appended to playlist.
Calling InformOfCurrentSongChange before updating the virtual index results in
sending the CanGoNext and CanGoPrevious notifications with the wrong values.
Currently we just scroll to the last viewed index of the last playlist in the new one. This makes no sense and is frustrating when switching between long and short playlists.
This change scrolls to the last played track in each playlist on transition.
Fixes#4836
Last.fm defines a scrobble should be sent if:
-the track is longer than 30 seconds.
-the track has been played for at least half its duration, or for 4 minutes (whichever occurs earlier.)
Clementine has treated this as seconds from the start of the track, and if any seeking occurs, it nullifies the scrobble.
This IMO is incorrect. If I skip the first 10 seconds of a song, but listen to the rest (still meeting the time requirements),
I should still be able to scrobble the play. This change moves the scrobble point with every seek, requiring continuous playback
from any point that satisfies the time criteria.
Otherwise, it was never set to false at startup if no "current_playlist" was saved in the settings, then there was no new value saved for "current_playlist".
Fixes#4011.
When starting clementine, each playlist is loaded in turn.
When loading a playlist, the new tab order is committed to the db,
but we don't need to do that here because we know that once all the
playlists are loaded the tab order will be the same as it was initially.
This speeds startup substantially.
kstartperf:
Before: 3.5s
After: 1.5s
The playlist fetching uses QtConcurrent to make the playlist on a
different thread (possibly concurrently for each item).
However, profiling reveals that the slow operation is fetching
the rows from the SQLite database, making this redundant.
Instead move the whole playlist loading, including the database access,
into a single function, and call that function in a different thread via
QtConcurrent::run.
This has the side effect of moving all the concurrent stuff from
PlaylistBackend into the callers.
kstartperf measures:
Before: 7.5s cold
3.6 s warm
After: ~4.0 s cold
3.5 s warm
This is less confusing IMO. The dialog will shown up only if users decided to in the preferences, so that will not bother users who don't need this.
This reuses lot of things from Alan contribution from #4484