Skip to content
/ mixxx Public
forked from mixxxdj/mixxx

Commit

Permalink
Sidebar: Cache AutoDJ feature title
Browse files Browse the repository at this point in the history
  • Loading branch information
ninomp committed Dec 21, 2022
1 parent 1798e32 commit 9fadb20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/library/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ AutoDJFeature::AutoDJFeature(Library* pLibrary,
&QAction::triggered,
this,
&AutoDJFeature::slotRemoveCrateFromAutoDj);

updateTitle();
}

AutoDJFeature::~AutoDJFeature() {
Expand All @@ -117,6 +119,10 @@ AutoDJFeature::~AutoDJFeature() {
}

QVariant AutoDJFeature::title() {
return m_title;
}

void AutoDJFeature::updateTitle() {
QString title = tr("Auto DJ");

PlaylistSummary summary;
Expand All @@ -127,7 +133,8 @@ QVariant AutoDJFeature::title() {
summary.getTrackDurationText()));
}

return title;
m_title = title;
emit featureIsLoading(this, false);
}

void AutoDJFeature::bindLibraryWidget(
Expand Down Expand Up @@ -343,6 +350,6 @@ void AutoDJFeature::slotPlaylistsChanged(const QSet<int>& playlistIds) {
if (playlistIds.contains(m_iAutoDJPlaylistId)) {
// If AutoDJ playlist was changed, notify that feature title has changed
// since it contains duration of the AutoDJ playlist.
emit featureIsLoading(this, false);
updateTitle();
}
}
4 changes: 4 additions & 0 deletions src/library/autodj/autodjfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ class AutoDJFeature : public LibraryFeature {

QPointer<WLibrarySidebar> m_pSidebarWidget;

QString m_title;

void updateTitle();

private slots:
// Add a crate to the auto-DJ queue.
void slotAddCrateToAutoDj(int iCrateId);
Expand Down

0 comments on commit 9fadb20

Please sign in to comment.