summaryrefslogtreecommitdiffstats
path: root/src/library/dao
diff options
context:
space:
mode:
authorOwen Williams <owilliams@mixxx.org>2020-11-17 22:49:05 -0500
committerOwen Williams <owilliams@mixxx.org>2020-11-17 22:49:05 -0500
commitb4d297a6fd7c4bd3f558132b553ff2cd33f60197 (patch)
tree9cc27f298800a9de65c8c686ca0b9051a6715837 /src/library/dao
parentb878d36feb2b8eded824bf6ff33d2b22afd210ab (diff)
Column Cache: address notes
Diffstat (limited to 'src/library/dao')
-rw-r--r--src/library/dao/trackschema.cpp56
-rw-r--r--src/library/dao/trackschema.h49
2 files changed, 49 insertions, 56 deletions
diff --git a/src/library/dao/trackschema.cpp b/src/library/dao/trackschema.cpp
index ef948c4bca..7f89e9a839 100644
--- a/src/library/dao/trackschema.cpp
+++ b/src/library/dao/trackschema.cpp
@@ -1,51 +1,13 @@
#include "library/dao/trackschema.h"
-//static
-QStringList TrackSchema::GetColumnNames() {
- QStringList columns;
-
- // This is the canonical ordering of columns. Changing this order can break things, so always
- // add new columns to the bottom of the list.
- columns << LIBRARYTABLE_ID
- << LIBRARYTABLE_PLAYED
- << LIBRARYTABLE_TIMESPLAYED
- //has to be up here otherwise Played and TimesPlayed are not shown
- << LIBRARYTABLE_ALBUMARTIST
- << LIBRARYTABLE_ALBUM
- << LIBRARYTABLE_ARTIST
- << LIBRARYTABLE_TITLE
- << LIBRARYTABLE_YEAR
- << LIBRARYTABLE_RATING
- << LIBRARYTABLE_GENRE
- << LIBRARYTABLE_COMPOSER
- << LIBRARYTABLE_GROUPING
- << LIBRARYTABLE_TRACKNUMBER
- << LIBRARYTABLE_KEY
- << LIBRARYTABLE_KEY_ID
- << LIBRARYTABLE_BPM
- << LIBRARYTABLE_BPM_LOCK
- << LIBRARYTABLE_DURATION
- << LIBRARYTABLE_BITRATE
- << LIBRARYTABLE_REPLAYGAIN
- << LIBRARYTABLE_FILETYPE
- << LIBRARYTABLE_DATETIMEADDED
- << TRACKLOCATIONSTABLE_LOCATION
- << TRACKLOCATIONSTABLE_FSDELETED
- << LIBRARYTABLE_COMMENT
- << LIBRARYTABLE_MIXXXDELETED
- << LIBRARYTABLE_COLOR
- << LIBRARYTABLE_COVERART_SOURCE
- << LIBRARYTABLE_COVERART_TYPE
- << LIBRARYTABLE_COVERART_LOCATION
- << LIBRARYTABLE_COVERART_HASH;
- return columns;
-}
-
-// static
-QString TrackSchema::TableForColumn(const QString& columnName){
- if (columnName == "location" || columnName == "fs_deleted") {
- return "track_locations";
+namespace mixxx {
+namespace TrackSchema {
+QString tableForColumn(const QString& columnName) {
+ if (columnName == TRACKLOCATIONSTABLE_FSDELETED || columnName == TRACKLOCATIONSTABLE_LOCATION) {
+ return QStringLiteral(TRACKLOCATIONS_TABLE);
}
// This doesn't detect unknown columns, but that's not really important here.
- return "library";
-} \ No newline at end of file
+ return QStringLiteral(LIBRARY_TABLE);
+}
+} // namespace TrackSchema
+} // namespace mixxx
diff --git a/src/library/dao/trackschema.h b/src/library/dao/trackschema.h
index f423f9a016..0284b4fc6a 100644
--- a/src/library/dao/trackschema.h
+++ b/src/library/dao/trackschema.h
@@ -5,6 +5,7 @@
#include <QStringList>
#define LIBRARY_TABLE "library"
+#define TRACKLOCATIONS_TABLE "track_locations"
const QString LIBRARYTABLE_ID = "id";
const QString LIBRARYTABLE_ARTIST = "artist";
@@ -55,15 +56,45 @@ const QString TRACKLOCATIONSTABLE_NEEDSVERIFICATION = "needs_verification";
const QString REKORDBOX_ANALYZE_PATH = "analyze_path";
-// Simple static-only class for getting the ordered subset of columns used in the track headers.
-class TrackSchema {
-public:
- // GetColumns returns a QStringList of all the relevant columns that can be displayed to the
- // user.
- static QStringList GetColumnNames();
+const QStringList DEFAULT_COLUMNS = {
+ LIBRARYTABLE_ID,
+ LIBRARYTABLE_PLAYED,
+ LIBRARYTABLE_TIMESPLAYED,
+ //has to be up here otherwise Played and TimesPlayed are not shown
+ LIBRARYTABLE_ALBUMARTIST,
+ LIBRARYTABLE_ALBUM,
+ LIBRARYTABLE_ARTIST,
+ LIBRARYTABLE_TITLE,
+ LIBRARYTABLE_YEAR,
+ LIBRARYTABLE_RATING,
+ LIBRARYTABLE_GENRE,
+ LIBRARYTABLE_COMPOSER,
+ LIBRARYTABLE_GROUPING,
+ LIBRARYTABLE_TRACKNUMBER,
+ LIBRARYTABLE_KEY,
+ LIBRARYTABLE_KEY_ID,
+ LIBRARYTABLE_BPM,
+ LIBRARYTABLE_BPM_LOCK,
+ LIBRARYTABLE_DURATION,
+ LIBRARYTABLE_BITRATE,
+ LIBRARYTABLE_REPLAYGAIN,
+ LIBRARYTABLE_FILETYPE,
+ LIBRARYTABLE_DATETIMEADDED,
+ TRACKLOCATIONSTABLE_LOCATION,
+ TRACKLOCATIONSTABLE_FSDELETED,
+ LIBRARYTABLE_COMMENT,
+ LIBRARYTABLE_MIXXXDELETED,
+ LIBRARYTABLE_COLOR,
+ LIBRARYTABLE_COVERART_SOURCE,
+ LIBRARYTABLE_COVERART_TYPE,
+ LIBRARYTABLE_COVERART_LOCATION,
+ LIBRARYTABLE_COVERART_HASH};
- // TableForColumn returns the name of the table that contains the named column.
- static QString TableForColumn(const QString& columnName);
-};
+namespace mixxx {
+namespace TrackSchema {
+// TableForColumn returns the name of the table that contains the named column.
+QString tableForColumn(const QString& columnName);
+} // namespace TrackSchema
+} // namespace mixxx
#endif //MIXXX_TRACKSCHEMA_H