Commit Graph

606 Commits

Author SHA1 Message Date
Jim Broadus f4108b5a0c playlistparser: Display errors on failures.
Add an Error signal to PlayListParser and connect that to the
PlayListManager::Error signal. This is eventually connected to the
Application::AddError. Add error messages in some cases where
PlayListParser can fail silently.
2021-06-11 10:17:20 +01:00
Jim Broadus f04657e7e7 Replace qrand usage with QRandomGenerator
QRandomGenerator was introduced in 5.10 and qrand has since been
deprecated. QRandomGenerator::global() returns a global instance that
has been securely seeded. QRandomGenerator provides methods that
generate values within ranges, so taking a modulus of the result isn't
necessary.
2021-04-20 10:31:07 +01:00
Jim Broadus a86558f9a6 playlist: Fix queued item painting
QueuedItemDelegate::DrawBox leaves the painter in a state that can cause
artifacts. Specifically, there are cases where the item text is not
visible. To fix this, push the painter state before making changes and
pop it after drawing.
2021-04-10 14:58:36 +01:00
Jim Broadus db55c541b2 Revert "↑↓ for "Up" and "Down" (#5841)"
This reverts commit 566708b778.

Escape sequences are not legal key sequences.

Reference: https://doc.qt.io/qt-5/qkeysequence.html#details
2021-04-10 14:57:55 +01:00
Jim Broadus f779652aa2 Localize song count in playlist
Use %Lx to localize number formatting.

Reference: https://doc.qt.io/qt-5/qtquick-internationalization.html#5-use-lx-so-numbers-are-localized
2021-01-10 21:58:54 +00:00
Matthieu Bruel 9714b0632d All changes for ClemRemote v1.0 (in one go) 2020-12-17 12:23:30 +00:00
John Maguire 341dc7326f Reformat all C++ 2020-09-22 14:56:06 +01:00
Keshav Kini 68d375c43c Use effective album artist for Repeat Album logic
When there is album artist information available for a track, the user would
probably expect that "Repeat Album" should cycle through all songs with the same
album artist and album title, not only all songs with the same artist and album
title.
2020-07-20 10:45:49 +01:00
Jim Broadus 1f7607b1db Get backend from application in PlaylistContainer::SetApplication
The manager's library backend may not be set when this is called.
2020-07-12 09:44:47 +01:00
Jim Broadus c75fa0077e Fix playlist memory leak
When the current playlist is changed, PlaylistContainer::SetViewModel is called
to set the new list. This calls PlaylistView::SetItemDelegates, which allocates
several objects that are never freed. Instead, move the call to SetItemDelegates
to PlaylistContainer::SetApplication, which is only called once.
2020-07-10 10:28:19 +01:00
Jim Broadus ad882cc999 Add static IsTypeSupported methods to playlist item classes 2020-06-23 11:06:06 +01:00
Jim Broadus 9455a3ef79 Use IsLocalLibraryItem instead of comparing type string 2020-06-23 11:06:06 +01:00
Jim Broadus f563b7da40 Add DbPlaylistItem base class to LibraryPlaylistItem
This will be used to move items from non-library databases away from the
LibraryPlaylistItem class.
2020-06-19 11:18:32 +01:00
dmdmdm a63a37a7ab Changed to translator comment 2020-05-28 19:40:57 +01:00
dmdmdm 32cb04f26b Change text for Original Year 2020-05-28 19:40:57 +01:00
dmdmdm 0555cf5a35 Changed rgb() to rgba()
Avoids message:   
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 200, 200, 200, 75%'
2020-05-27 17:07:42 +01:00
Power Snail 4fe845c2c5 Use reference on a const loop var to avoid copy
Clang 10 warns that ``s`` might be copied. Use a reference to avoid copying
2020-03-07 02:39:13 +00:00
Jim Broadus 90cf4988ea Fix crash when searching playlist.
While iterating over expandList in refreshExpanded, calls to setExpanded cause
the list to be appended. Since QList uses an array implementation that must
reallocate when reserved space is exhausted, iterators are unsafe for this case.
Use indexes, which are O(1) in QLists, instead of iterators.
2020-02-24 13:45:42 +00:00
Jim Broadus 85651dd37f Fix assertion when deleting multiple queued items from playlist.
Removal of items from a playlist is done with a single transaction. When
Queue::SourceLayoutChanged is called after this, the items in the queue are
checked one at a time. When an item is removed, it triggers dataChanged signal
from the model, connected to the SourceDataChanged slot. There, ItemCountChanged
is emitted which calls UpdateTotalLength. This method will assert when it finds
an item that is in the queue, but not in the playlist.

To solve this, disconnect the ItemCountChanged signal at the beginning of
SourceLayoutChanged and re-enable it after cleaning the queue. The method emits
the signal before returning.
2020-02-21 10:09:12 +00:00
Jonas Kvinge 959a957a56 Replace QModelIndex::child() with QAbstractItemModel::index() 2020-01-05 18:37:27 +01:00
Jonas Kvinge 5eb32b33c1 Replace QSet::toList() with QSet::values() 2020-01-05 00:58:33 +01:00
Jim Broadus a164a5dffa Fix smart playlist crash.
When QProxyStyle is given a base style, it take ownership of that object.
PlaylistView creates a proxy style based on its own style, but that is a shared
resource. When the PlayListView is destroyed, this object is destroyed.

Instead of passing style() to QStyle, pass nullptr. This will use the native
style.
2020-01-01 22:30:59 -08:00
John Maguire b7c3173001
Merge pull request #6439 from jonaski/signalmapper
Replace all uses of QSignalMapper with C++11 lambda expressions
2019-11-10 19:13:31 +00:00
Jonas Kvinge 344023e6dd Fix formatting 2019-11-10 15:16:39 +01:00
Jonas Kvinge ba31c755ef Replace all uses of QSignalMapper with C++11 lambda expressions 2019-11-10 15:07:12 +01:00
John Maguire 21da802630
Merge pull request #6438 from jonaski/remove-extra-semicolon
Remove extra ';'
2019-11-10 00:53:37 +00:00
Jonas Kvinge d09c27f719 Remove extra ';' 2019-11-10 00:30:18 +01:00
Jonas Kvinge 0da490a5e1 Replace QString::null with QString() 2019-11-09 23:45:28 +01:00
John Maguire cb6cd7c485 Merge remote-tracking branch 'origin/master' into qt5 2019-10-04 16:51:43 +01:00
Antonio Russo ccaa59cc66 Periodically save current playlist tab
Building on the previous commit, we save the current playlist (tab)
periodically as well.

Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com>
2019-09-10 18:41:18 -06:00
Antonio Russo e66fdd86da Periodically save settings
Instead of immediately saving, which leads to poor performance,
and possible hardware damage (see #6057), limit saves to once
per second (similar to how KDE does it).  It also guarantees
that only one save is required per second, by sharing a QSettings
object, and establishes a signaling framework to put other
setting save events into (but only uses this for the two major
offenders: playlist tab switching and window resizing).

This is in contrast to 6a312e7, which simply deferred the save
until program exit, and caused problems for some people (see #6217
and #6209).

Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com>
2019-09-10 18:41:18 -06:00
luz.paz fb93ae4b02 Fix misc. source comment typos
Typos found via `codespell`
2019-08-21 23:43:16 -04:00
Jonas Kvinge 546078c317 Fix memory leaks (#6376) 2019-08-02 16:24:26 +01:00
Jonas Kvinge 1a2274bd2b Merge branch 'master' into qt5-update 2019-07-21 14:20:59 +02:00
Antonio Russo 40326bb94b setFirstSectionMovable() in playlistview.cpp
Qt 5.11 added a function allowing the first column in a list to be set
to be movable.  Contingent on its availability, make the first column
of the playlist viewer draggable.
2019-04-22 17:31:16 -04:00
Jim Broadus babff78025 Add error handling path for async song loading.
Async song loading can fail without user feedback. This change adds return codes
to these async load functions. It will now produce an error dialog in simple
scenarios (test case is user selecting a file that is not readable). Other cases,
such as directories and playlists, aren't yet covered.
2019-04-10 11:49:09 -07:00
Filip Gawin be827f4f7f Simplify some statements 2019-02-22 18:49:48 +01:00
Jonas Kvinge d260c8b6d8 Fix saving playlist columns (#6222) 2018-11-29 21:33:52 +00:00
Jonas Kvinge 8c198a99a5 Qt 5 fixes 2018-11-21 10:31:17 +00:00
Jonas Kvinge d4fab4a2ea Merge remote-tracking branch 'upstream/master' into qt5-update 2018-11-11 22:46:07 +01:00
Victor Parmar f4d84bc05a Split last.fm scrobbling and play count calculation, closes #5771 (#6179)
Also add a configurable option to increment the play count if song has played for a shorter duration.
2018-10-20 12:57:49 +01:00
Amish Naidu 107e945872 Convert uses of QtAlgorithms to std:: algorithms 2018-10-09 19:17:54 +01:00
Amish Naidu 34e007f2b8 Port 'Allow ignoring prefixes when sorting playlist' to master (#6166)
* Allow ignoring prefixes when sorting playlist

This introduces new configuration options which allow you to ignore
prefixes while sorting the playlist on album, artist and titles.
Prefixes are configurable, default are "a" and "the".

* Change QStringLiteral to QString for compatbility with Qt 4.8
2018-10-08 16:24:36 +01:00
Amish Naidu fb00835468 Allow ignoring prefixes when sorting playlist
This introduces new configuration options which allow you to ignore
prefixes while sorting the playlist on album, artist and titles.
Prefixes are configurable, default are "a" and "the".
2018-10-05 10:56:49 +01:00
Jonas Kvinge c29c2e95cc Fixed merge conflicts 2018-09-30 15:11:06 +02:00
Kerem Seyhan 4ac2dedefa Added mouse forward and back button actions. 2018-08-14 17:09:55 +01:00
David Guillen Fandos 4a1236f8da Reduce some CPU load by disabling/fixing some UI stuff
- Disabling playlist row glow by default
 - Track slider popup visible by default, add hide()
    to ensure not visible by default (no more repaints)
 - Set kTrackSliderUpdateTimeMs to 500. IMO 40 is too low

This should partially fix issue #1079
2018-08-08 22:39:54 +01:00
Jonas Kvinge a5e8eba91c Merge remote-tracking branch 'upstream/master' into qt5-update 2018-06-29 02:38:19 +02:00
vaterlangen fcf96cb6ff Queue size and duration is now displayed in queue manager && Album Cover Popup fixes (#6086) 2018-06-18 14:21:44 +01:00
Clang Formatter 083129f41c Automatically formatted 2018-06-13 20:37:13 +00:00