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

Only show the date in Date Added / Last Played columns #3945

Merged
merged 4 commits into from
Jun 5, 2021
Merged
Changes from all commits
Commits
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
15 changes: 12 additions & 3 deletions src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,11 +621,16 @@ QVariant BaseTrackTableModel::roleValue(
return QString("(%1)").arg(timesPlayed);
}
case ColumnCache::COLUMN_LIBRARYTABLE_DATETIMEADDED:
case ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_DATETIMEADDED:
case ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_DATETIMEADDED: {
VERIFY_OR_DEBUG_ASSERT(rawValue.canConvert<QDateTime>()) {
return QVariant();
}
return mixxx::localDateTimeFromUtc(rawValue.toDateTime());
QDateTime dt = mixxx::localDateTimeFromUtc(rawValue.toDateTime());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to enclose the case block in a scope now, like the next one. C++ weirdness.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes of course

if (role == Qt::ToolTipRole || role == kDataExportRole) {
return dt;
}
return dt.date();
}
case ColumnCache::COLUMN_LIBRARYTABLE_LAST_PLAYED_AT: {
QDateTime lastPlayedAt;
if (rawValue.type() == QVariant::String) {
Expand All @@ -639,7 +644,11 @@ QVariant BaseTrackTableModel::roleValue(
return QVariant();
}
DEBUG_ASSERT(lastPlayedAt.timeSpec() == Qt::UTC);
return mixxx::localDateTimeFromUtc(lastPlayedAt);
QDateTime dt = mixxx::localDateTimeFromUtc(lastPlayedAt);
if (role == Qt::ToolTipRole || role == kDataExportRole) {
return dt;
}
return dt.date();
}
case ColumnCache::COLUMN_LIBRARYTABLE_BPM: {
mixxx::Bpm bpm;
Expand Down