-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
AutoDJ: Show total track time #4846
base: 2.4
Are you sure you want to change the base?
Changes from 1 commit
f0b4f6d
a29f375
7f94c69
f059b36
865a429
4a110a9
4555fe8
8850afb
7cc0230
1798e32
9fadb20
fe7b602
5f588b0
6861456
86c9577
ef6a67c
ea0e42d
18dd4cb
85aedee
310c57d
bae8706
767e6d6
9f901aa
4c0ccae
e6a954a
dea1a7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -54,6 +54,13 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent, | |||
this, | ||||
&DlgAutoDJ::updateSelectionInfo); | ||||
|
||||
connect(&pLibrary->trackCollectionManager() | ||||
->internalCollection() | ||||
->getPlaylistDAO(), | ||||
&PlaylistDAO::tracksChanged, | ||||
this, | ||||
&DlgAutoDJ::updateInfo); | ||||
|
||||
connect(pLibrary, | ||||
&Library::setTrackTableFont, | ||||
m_pTrackTableView, | ||||
|
@@ -212,6 +219,7 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent, | |||
autoDJStateChanged(m_pAutoDJProcessor->getState()); | ||||
|
||||
updateSelectionInfo(); | ||||
updateInfo(); | ||||
} | ||||
|
||||
DlgAutoDJ::~DlgAutoDJ() { | ||||
|
@@ -362,7 +370,7 @@ void DlgAutoDJ::updateSelectionInfo() { | |||
|
||||
if (!indices.isEmpty()) { | ||||
label.append(mixxx::DurationBase::formatTime(duration)); | ||||
label.append(QString(" (%1)").arg(indices.size())); | ||||
label.append(QString(" (%1) / ").arg(indices.size())); | ||||
ronso0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
labelSelectionInfo->setToolTip(tr("Displays the duration and number of selected tracks.")); | ||||
labelSelectionInfo->setText(label); | ||||
labelSelectionInfo->setEnabled(true); | ||||
|
@@ -372,6 +380,22 @@ void DlgAutoDJ::updateSelectionInfo() { | |||
} | ||||
} | ||||
|
||||
void DlgAutoDJ::updateInfo() { | ||||
ronso0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
double duration = 0.0; | ||||
|
||||
int rows = m_pAutoDJTableModel->rowCount(); | ||||
for (int row = 0; row < rows; ++row) { | ||||
TrackPointer pTrack = m_pAutoDJTableModel->getTrack(m_pAutoDJTableModel->index(row, 0)); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Loading and instantiating a heavy-weight track object just to obtain the duration is overkill and will certainly block the UI if many tracks are affected. It somehow works for a quick and dirty prototype hack. But you shouldn't do this in production code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a recommendation for a workaround? I think the track duration will be already in the library cache. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are multiple options depending on what information is available in this context (which I am not aware of). This is just the worst option. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the best way forward is to introduce the same label we use per playlist.
Since Auto DJ is in fact a "hidden" playlist, we can move this function into a common base class. I suggest to use a "<" prefix to tell the user that the displayed time is the maximum. In a next step we may calculate also the real runtime for a reasonable amount of tracks only. The main use case is to see I think not more than a time < 1 h ahead, for a timed show or a visit on the rest rooms or at the bar. What do you think? |
||||
duration += pTrack->getDuration(); | ||||
} | ||||
|
||||
QString label; | ||||
label.append(mixxx::DurationBase::formatTime(duration)); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to communicate that the shown time is an estimate. Users making plans based on this will be mislead if they think this is accurate! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe a prefix like "Sum:" clarifies the overlaps/transitions are not considered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I disagree that it should be hidden in the tooltip. Also "sum" is unclear. "Estimate" would convey that this is not reliable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ping. The UI still presents this estimate as if it reflects the actual play time. |
||||
label.append(QString(" (%1)").arg(rows)); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here we should reuse the
in fact the playlists share the same issue that it shows the max time only and not the resulting time when put to Auto-DJ. |
||||
|
||||
labelInfo->setText(label); | ||||
} | ||||
|
||||
bool DlgAutoDJ::hasFocus() const { | ||||
return m_pTrackTableView->hasFocus(); | ||||
} | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another place of a "->" row.