From 31519dd17f627fcbf29caebb927997d1da3de90e Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Fri, 4 Jun 2021 16:59:28 -0400 Subject: [PATCH 1/4] Only show the date in Date Added / Last Played columns --- src/library/basetracktablemodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/library/basetracktablemodel.cpp b/src/library/basetracktablemodel.cpp index e714980a3dd..eaa78b64297 100644 --- a/src/library/basetracktablemodel.cpp +++ b/src/library/basetracktablemodel.cpp @@ -625,7 +625,7 @@ QVariant BaseTrackTableModel::roleValue( VERIFY_OR_DEBUG_ASSERT(rawValue.canConvert()) { return QVariant(); } - return mixxx::localDateTimeFromUtc(rawValue.toDateTime()); + return mixxx::localDateTimeFromUtc(rawValue.toDateTime()).date(); case ColumnCache::COLUMN_LIBRARYTABLE_LAST_PLAYED_AT: { QDateTime lastPlayedAt; if (rawValue.type() == QVariant::String) { @@ -639,7 +639,7 @@ QVariant BaseTrackTableModel::roleValue( return QVariant(); } DEBUG_ASSERT(lastPlayedAt.timeSpec() == Qt::UTC); - return mixxx::localDateTimeFromUtc(lastPlayedAt); + return mixxx::localDateTimeFromUtc(lastPlayedAt).date(); } case ColumnCache::COLUMN_LIBRARYTABLE_BPM: { mixxx::Bpm bpm; From 996a1494bda8875e7a74ee7f40b9e4f8fb64eed2 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Fri, 4 Jun 2021 17:26:50 -0400 Subject: [PATCH 2/4] Show the full datetime in the library tooltip --- src/library/basetracktablemodel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/library/basetracktablemodel.cpp b/src/library/basetracktablemodel.cpp index eaa78b64297..4854b811509 100644 --- a/src/library/basetracktablemodel.cpp +++ b/src/library/basetracktablemodel.cpp @@ -625,6 +625,9 @@ QVariant BaseTrackTableModel::roleValue( VERIFY_OR_DEBUG_ASSERT(rawValue.canConvert()) { return QVariant(); } + if (role == Qt::ToolTipRole || role == kDataExportRole) { + return mixxx::localDateTimeFromUtc(rawValue.toDateTime()); + } return mixxx::localDateTimeFromUtc(rawValue.toDateTime()).date(); case ColumnCache::COLUMN_LIBRARYTABLE_LAST_PLAYED_AT: { QDateTime lastPlayedAt; @@ -639,6 +642,9 @@ QVariant BaseTrackTableModel::roleValue( return QVariant(); } DEBUG_ASSERT(lastPlayedAt.timeSpec() == Qt::UTC); + if (role == Qt::ToolTipRole || role == kDataExportRole) { + return mixxx::localDateTimeFromUtc(lastPlayedAt); + } return mixxx::localDateTimeFromUtc(lastPlayedAt).date(); } case ColumnCache::COLUMN_LIBRARYTABLE_BPM: { From 18a9c526acf1ea8e9930c4e468544a376ef29428 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Fri, 4 Jun 2021 21:37:31 -0400 Subject: [PATCH 3/4] Simplify with temporary --- src/library/basetracktablemodel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/library/basetracktablemodel.cpp b/src/library/basetracktablemodel.cpp index 4854b811509..9bcf614cc86 100644 --- a/src/library/basetracktablemodel.cpp +++ b/src/library/basetracktablemodel.cpp @@ -625,10 +625,11 @@ QVariant BaseTrackTableModel::roleValue( VERIFY_OR_DEBUG_ASSERT(rawValue.canConvert()) { return QVariant(); } + QDateTime dt = mixxx::localDateTimeFromUtc(rawValue.toDateTime()); if (role == Qt::ToolTipRole || role == kDataExportRole) { - return mixxx::localDateTimeFromUtc(rawValue.toDateTime()); + return dt; } - return mixxx::localDateTimeFromUtc(rawValue.toDateTime()).date(); + return dt.date(); case ColumnCache::COLUMN_LIBRARYTABLE_LAST_PLAYED_AT: { QDateTime lastPlayedAt; if (rawValue.type() == QVariant::String) { @@ -642,10 +643,11 @@ QVariant BaseTrackTableModel::roleValue( return QVariant(); } DEBUG_ASSERT(lastPlayedAt.timeSpec() == Qt::UTC); + QDateTime dt = mixxx::localDateTimeFromUtc(lastPlayedAt); if (role == Qt::ToolTipRole || role == kDataExportRole) { - return mixxx::localDateTimeFromUtc(lastPlayedAt); + return dt; } - return mixxx::localDateTimeFromUtc(lastPlayedAt).date(); + return dt.date(); } case ColumnCache::COLUMN_LIBRARYTABLE_BPM: { mixxx::Bpm bpm; From 8bf5f0aed757b18c54b540957ec2c6ddebcf5d12 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Sat, 5 Jun 2021 09:23:43 -0400 Subject: [PATCH 4/4] Add scoping --- src/library/basetracktablemodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/library/basetracktablemodel.cpp b/src/library/basetracktablemodel.cpp index 9bcf614cc86..f1ea61b199a 100644 --- a/src/library/basetracktablemodel.cpp +++ b/src/library/basetracktablemodel.cpp @@ -621,7 +621,7 @@ 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()) { return QVariant(); } @@ -630,6 +630,7 @@ QVariant BaseTrackTableModel::roleValue( return dt; } return dt.date(); + } case ColumnCache::COLUMN_LIBRARYTABLE_LAST_PLAYED_AT: { QDateTime lastPlayedAt; if (rawValue.type() == QVariant::String) {