Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve library sidebar UX (right-click and selection after add, rename, delete, duplicate etc.) #11208

Merged
merged 45 commits into from
May 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bd9656d
Library playlist features: use kInvalidPlaylistId instead of -1
ronso0 Jan 24, 2023
bbe8112
BasePlaylistFeature: move DAO connections to separate function
ronso0 Jan 24, 2023
9748e36
Library sidebar/features: some fixes, minor cleanup, improve comments
ronso0 Jan 24, 2023
74ec98f
WLibrarySidebar::keyPressEvent: ensure new selection is visible
ronso0 Jan 28, 2023
443b174
Playlists/Crates: use last right-clicked id for playlist file import
ronso0 Jan 28, 2023
b576824
Library sidebar: don't select on right-click, only set focus
ronso0 Jan 24, 2023
2f8681d
Library sidebar: don't select newly created or duplicated crate/playlist
ronso0 Jan 26, 2023
def2ddf
Library sidebar: don't rebuild tree model after item rename or lock c…
ronso0 Jan 27, 2023
aabd985
Library sidebar: track left & right clicks separately
ronso0 Jan 26, 2023
82da0eb
BasePlaylistFeature::activatePlaylist: remove redundant selectIndex()
ronso0 Jan 28, 2023
5a696b8
CrateFeature::activateCrate: remove redundant activateChild()
ronso0 Jan 28, 2023
fa9278b
History feature: fix decoration of current playlist after 'Finish cur…
ronso0 Jan 28, 2023
8f8bf48
Library sidebar: add item selection helpers for playlists & crates
ronso0 Jan 26, 2023
60198d5
History feature: clear view when clicking YEAR items
ronso0 Jan 26, 2023
117f61a
History feature: allow deleting all playlists in YEAR node
ronso0 Jan 26, 2023
42ce1d4
PlaylistDAO: add setPlaylistsLocked
ronso0 Feb 9, 2023
b046cae
History: allow un/locking all playlists in a YEAR folder
ronso0 Feb 9, 2023
302215e
PlaylistDAO: add getNextPlaylist(), to be used for History feature
ronso0 Jan 26, 2023
2aebd75
Library sidebar: handle item selection in DAO callback slots ...
ronso0 Jan 28, 2023
8740178
Library sidebar: add helper to get the (first) selected index
ronso0 Feb 6, 2023
bf28a07
Library sidebar: toggleItem() emits click(), not delayed pressed()
ronso0 Feb 6, 2023
693f8a4
BasePlaylistFeature::updateChildModel: use QSet to reduce tree iterat…
ronso0 Feb 9, 2023
013cbc3
skins: add focus indicator (right-click) to library sidebar items
ronso0 Feb 10, 2023
2918884
BasePlaylistFeature: improve playlist import comment
ronso0 Mar 22, 2023
35a0905
simplify WLibrarySidebar::selectedIndex return
ronso0 Mar 22, 2023
4fe9156
playlist features: remove obsolete qAsConst
ronso0 Mar 22, 2023
40dd91a
PlaylistDAO: use kInvalidPlaylistId
ronso0 Mar 22, 2023
5c2b1f1
PlaylistDAO: simplify string building for Sql query
ronso0 Mar 23, 2023
6c56d35
CrateFeature: use existing table model for importing when crate is se…
ronso0 Mar 23, 2023
2bc3884
PlaylistFeature: early return for inedaquate playlist type
ronso0 Mar 23, 2023
4a2be9b
playlist features: fix debug string
ronso0 Mar 23, 2023
150a116
PlaylistDAO: make delete functions return bool
ronso0 Mar 23, 2023
59be421
PlaylistDAO: remove type input from deletePlaylists()
ronso0 Mar 23, 2023
6e3cc8e
CrateFeature: explicit cast to int ('possible loss of data' warning)
ronso0 Mar 23, 2023
f89e170
SetlogFeature: add translator comments, re/move debug messages
ronso0 Mar 23, 2023
7b84778
History: bulk-delete only unlocked playlists
ronso0 Mar 23, 2023
85c9209
Merge remote-tracking branch 'mixxx/2.4' into lib-sidebar-right-click…
ronso0 Apr 23, 2023
be08c7d
PlaylistDAO: std::move QStringList to deleteUnlockedPlaylists()
ronso0 Apr 23, 2023
cdc0bf6
PlaylistDAO: correct return value of deleteAllUnlockedPlaylistsWithFe…
ronso0 Apr 23, 2023
223c610
History feature: improve 'Delete unlocked year playlists' dialogs
ronso0 Apr 23, 2023
850ecdd
PlaylistDAO: remove unnecessary/confusing comments
ronso0 Apr 24, 2023
f01647f
BasePlaylistFeature: don't wipe track count & duration when selecting
ronso0 May 20, 2023
89b3aff
Playlists: restore resorting sidebar items after playlist rename
ronso0 May 20, 2023
4cdc077
Crates: restore resorting sidebar items after playlist rename
ronso0 May 20, 2023
877f112
CrateFeature::activateCrate: just return false if crate doesn't exist
ronso0 May 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions res/skins/Deere/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ WLibrarySidebar::item:selected,
color: #D6D6D6;
background-color: #006596;
}
WLibrarySidebar::item:selected:focus {
outline: none;
border: 0px;
}
WLibrarySidebar::item:!selected:focus {
outline: none;
border: 1px solid white;
}
/* Use the native focus decoration */
/* This is for all cells including Played and Location */
WTrackTableView,
Expand Down Expand Up @@ -412,8 +420,7 @@ WSearchLineEdit {
qproperty-layoutSpacing: 0;
}

WLibrarySidebar,
WLibrarySidebar::item:focus {
WLibrarySidebar {
outline: none;
/* Spacing between treeview and preview deck/search bar */
margin: 0px;
Expand Down
11 changes: 8 additions & 3 deletions res/skins/LateNight/style_classic.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,14 @@ WTrackTableView::item:selected,
color: #fff;
background-color: #5e4507;
}
WLibrarySidebar::item:selected:focus {
outline: none;
border: 0px;
}
WLibrarySidebar::item:!selected:focus {
outline: none;
border: 1px solid white;
}

/* Use the native focus decoration */
/* This is for all cells including Played and Location */
Expand All @@ -2088,9 +2096,6 @@ WTrackTableView {

WLibrarySidebar {
show-decoration-selected: 0;
}
WLibrarySidebar,
WLibrarySidebar::item:focus {
outline: none;
}

Expand Down
11 changes: 9 additions & 2 deletions res/skins/LateNight/style_palemoon.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2544,16 +2544,23 @@ WLibrarySidebar {
/* background of Color delegate in selected row */
selection-background-color: #2c454f;
}
WLibrarySidebar {
outline: none;
}
/* Selected rows in Tree and Tracks table */
WLibrarySidebar::item:selected,
WTrackTableView::item:selected,
#LibraryBPMButton::item:selected {
color: #fff;
background-color: #2c454f;
}
WLibrarySidebar,
WLibrarySidebar::item:focus {
WLibrarySidebar::item:selected:focus {
outline: none;
border: 0px;
}
WLibrarySidebar::item:!selected:focus {
outline: none;
border: 1px solid white;
}

WTrackTableView:focus,
Expand Down
11 changes: 9 additions & 2 deletions res/skins/Shade/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,16 @@ WLibrarySidebar::branch:selected,
WSearchLineEdit::indicator {
width: 0;
}
WLibrarySidebar,
WLibrarySidebar::item:focus {
WLibrarySidebar {
outline: none;
}
WLibrarySidebar::item:selected:focus {
outline: none;
border: 0px;
}
WLibrarySidebar::item:!selected:focus {
outline: none;
border: 1px solid white;
}

/* Use the native focus decoration */
Expand Down
8 changes: 8 additions & 0 deletions res/skins/Tango/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -2650,6 +2650,14 @@ WLibrarySidebar::item:!selected {
background-color: #0f0f0f;
color: #999;
}
WLibrarySidebar::item:selected:focus {
outline: none;
border: 0px;
}
WLibrarySidebar::item:!selected:focus {
outline: none;
border: 1px solid white;
}

WTrackTableViewHeader {
/* Don't set a font size to pick up the system font size. */
Expand Down
4 changes: 2 additions & 2 deletions src/library/banshee/bansheeplaylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const QString kCrate = QStringLiteral(CLM_CRATE);
BansheePlaylistModel::BansheePlaylistModel(QObject* pParent, TrackCollectionManager* pTrackCollectionManager, BansheeDbConnection* pConnection)
: BaseSqlTableModel(pParent, pTrackCollectionManager, "mixxx.db.model.banshee_playlist"),
m_pConnection(pConnection),
m_playlistId(-1) {
m_playlistId(kInvalidPlaylistId) {
m_tempTableName = BANSHEE_TABLE + QString::number(sTableNumber.fetchAndAddAcquire(1));
}

Expand All @@ -77,7 +77,7 @@ BansheePlaylistModel::~BansheePlaylistModel() {
void BansheePlaylistModel::dropTempTable() {
if (m_playlistId >= 0) {
// Clear old playlist
m_playlistId = -1;
m_playlistId = kInvalidPlaylistId;
QSqlQuery query(m_database);
QString strQuery("DROP TABLE IF EXISTS %1");
if (!query.exec(strQuery.arg(m_tempTableName))) {
Expand Down
2 changes: 1 addition & 1 deletion src/library/baseexternallibraryfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void BaseExternalLibraryFeature::slotImportAsMixxxPlaylist() {

int playlistId = playlistDao.createUniquePlaylist(&playlist);

if (playlistId != -1) {
if (playlistId != kInvalidPlaylistId) {
playlistDao.appendTracksToPlaylist(trackIds, playlistId);
} else {
// Do not change strings here without also changing strings in
Expand Down
8 changes: 4 additions & 4 deletions src/library/baseexternalplaylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BaseExternalPlaylistModel::BaseExternalPlaylistModel(QObject* parent,
m_playlistsTable(playlistsTable),
m_playlistTracksTable(playlistTracksTable),
m_trackSource(trackSource),
m_currentPlaylistId(-1) {
m_currentPlaylistId(kInvalidPlaylistId) {
}

BaseExternalPlaylistModel::~BaseExternalPlaylistModel() {
Expand Down Expand Up @@ -100,20 +100,20 @@ void BaseExternalPlaylistModel::setPlaylist(const QString& playlist_path) {
}

// TODO(XXX): Why not last-insert id?
int playlistId = -1;
int playlistId = kInvalidPlaylistId;
QSqlRecord finder_query_record = finder_query.record();
while (finder_query.next()) {
playlistId = finder_query.value(finder_query_record.indexOf("id")).toInt();
}

if (playlistId == -1) {
if (playlistId == kInvalidPlaylistId) {
qWarning() << "ERROR: Could not get the playlist ID for playlist:" << playlist_path;
return;
}

// Store search text
QString currSearch = currentSearch();
if (m_currentPlaylistId != -1) {
if (m_currentPlaylistId != kInvalidPlaylistId) {
if (!currSearch.trimmed().isEmpty()) {
m_searchTexts.insert(m_currentPlaylistId, currSearch);
} else {
Expand Down
Loading