diff options
author | Uwe Klotz <uwe_klotz@web.de> | 2016-11-20 14:56:02 +0100 |
---|---|---|
committer | Uwe Klotz <uwe_klotz@web.de> | 2017-01-29 21:16:04 +0100 |
commit | b833ee91b94e1420b01d993daf58d7ac7a77f349 (patch) | |
tree | 4f11f1f6cf40ce5b5756fe3d97b4f13e850d6e84 /src/library | |
parent | b4eb0f20e8058e85d62b4938233861ca27e3b713 (diff) |
Split DAO class and DB schema constants
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/autodj/autodjfeature.cpp | 1 | ||||
-rw-r--r-- | src/library/baseexternalplaylistmodel.cpp | 1 | ||||
-rw-r--r-- | src/library/baseexternaltrackmodel.cpp | 1 | ||||
-rw-r--r-- | src/library/columncache.cpp | 4 | ||||
-rw-r--r-- | src/library/coverartdelegate.cpp | 2 | ||||
-rw-r--r-- | src/library/cratetablemodel.cpp | 2 | ||||
-rw-r--r-- | src/library/dao/autodjcratesdao.cpp | 3 | ||||
-rw-r--r-- | src/library/dao/cratedao.cpp | 2 | ||||
-rw-r--r-- | src/library/dao/cratedao.h | 13 | ||||
-rw-r--r-- | src/library/dao/crateschema.h | 22 | ||||
-rw-r--r-- | src/library/dao/trackdao.cpp | 5 | ||||
-rw-r--r-- | src/library/dao/trackdao.h | 48 | ||||
-rw-r--r-- | src/library/dao/trackschema.h | 54 | ||||
-rw-r--r-- | src/library/dlganalysis.cpp | 1 | ||||
-rw-r--r-- | src/library/hiddentablemodel.cpp | 3 | ||||
-rw-r--r-- | src/library/librarytablemodel.cpp | 1 | ||||
-rw-r--r-- | src/library/missingtablemodel.cpp | 1 | ||||
-rw-r--r-- | src/library/mixxxlibraryfeature.cpp | 1 | ||||
-rw-r--r-- | src/library/playlisttablemodel.cpp | 1 | ||||
-rw-r--r-- | src/library/searchquery.cpp | 2 |
20 files changed, 100 insertions, 68 deletions
diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index 184f37d84d..bad5a75617 100644 --- a/src/library/autodj/autodjfeature.cpp +++ b/src/library/autodj/autodjfeature.cpp @@ -10,6 +10,7 @@ #include "library/library.h" #include "library/parser.h" +#include "library/dao/crateschema.h" #include "mixer/playermanager.h" #include "library/autodj/autodjprocessor.h" #include "library/trackcollection.h" diff --git a/src/library/baseexternalplaylistmodel.cpp b/src/library/baseexternalplaylistmodel.cpp index c1ae125348..731c742368 100644 --- a/src/library/baseexternalplaylistmodel.cpp +++ b/src/library/baseexternalplaylistmodel.cpp @@ -1,6 +1,7 @@ #include "library/baseexternalplaylistmodel.h" #include "library/queryutil.h" +#include "library/dao/trackschema.h" #include "mixer/playermanager.h" BaseExternalPlaylistModel::BaseExternalPlaylistModel(QObject* parent, diff --git a/src/library/baseexternaltrackmodel.cpp b/src/library/baseexternaltrackmodel.cpp index 22aa56528c..0713790eff 100644 --- a/src/library/baseexternaltrackmodel.cpp +++ b/src/library/baseexternaltrackmodel.cpp @@ -1,4 +1,5 @@ #include "library/baseexternaltrackmodel.h" +#include "library/dao/trackschema.h" #include "library/trackcollection.h" #include "library/queryutil.h" #include "mixer/playermanager.h" diff --git a/src/library/columncache.cpp b/src/library/columncache.cpp index 1d8e405dde..8619b67509 100644 --- a/src/library/columncache.cpp +++ b/src/library/columncache.cpp @@ -1,8 +1,8 @@ #include "library/columncache.h" -#include "library/dao/trackdao.h" +#include "library/dao/trackschema.h" #include "library/dao/playlistdao.h" -#include "library/dao/cratedao.h" +#include "library/dao/crateschema.h" #include "track/keyutils.h" #include "track/key_preferences.h" #include "control/controlproxy.h" diff --git a/src/library/coverartdelegate.cpp b/src/library/coverartdelegate.cpp index d93639d62d..827145b400 100644 --- a/src/library/coverartdelegate.cpp +++ b/src/library/coverartdelegate.cpp @@ -2,7 +2,7 @@ #include "library/coverartdelegate.h" #include "library/coverartcache.h" -#include "library/dao/trackdao.h" +#include "library/dao/trackschema.h" #include "util/math.h" CoverArtDelegate::CoverArtDelegate(QObject *parent) diff --git a/src/library/cratetablemodel.cpp b/src/library/cratetablemodel.cpp index 7c2988a262..ee857ebb69 100644 --- a/src/library/cratetablemodel.cpp +++ b/src/library/cratetablemodel.cpp @@ -6,6 +6,8 @@ #include "library/cratetablemodel.h" #include "library/queryutil.h" +#include "library/dao/crateschema.h" +#include "library/dao/trackschema.h" #include "library/trackcollection.h" #include "mixer/playermanager.h" diff --git a/src/library/dao/autodjcratesdao.cpp b/src/library/dao/autodjcratesdao.cpp index 62d12a30e3..26c4ddd9f3 100644 --- a/src/library/dao/autodjcratesdao.cpp +++ b/src/library/dao/autodjcratesdao.cpp @@ -3,10 +3,11 @@ #include "mixer/playerinfo.h" #include "mixer/playermanager.h" -#include "library/dao/cratedao.h" +#include "library/dao/crateschema.h" #include "library/dao/settingsdao.h" #include "library/dao/trackdao.h" #include "library/queryutil.h" +#include "library/dao/trackschema.h" #include "library/trackcollection.h" #include "library/dao/autodjcratesdao.h" diff --git a/src/library/dao/cratedao.cpp b/src/library/dao/cratedao.cpp index 108e7b1f59..d0fed47f15 100644 --- a/src/library/dao/cratedao.cpp +++ b/src/library/dao/cratedao.cpp @@ -9,6 +9,8 @@ #include "library/dao/cratedao.h" #include "library/queryutil.h" +#include "library/dao/crateschema.h" +#include "library/dao/trackschema.h" CrateDAO::CrateDAO(QSqlDatabase& database) : m_database(database) { } diff --git a/src/library/dao/cratedao.h b/src/library/dao/cratedao.h index 6dae0e5cba..8238f230b3 100644 --- a/src/library/dao/cratedao.h +++ b/src/library/dao/cratedao.h @@ -14,19 +14,6 @@ #include "track/trackid.h" #include "util/class.h" -#define CRATE_TABLE "crates" -#define CRATE_TRACKS_TABLE "crate_tracks" - -const QString CRATETABLE_ID = "id"; -const QString CRATETABLE_NAME = "name"; -const QString CRATETABLE_COUNT = "count"; -const QString CRATETABLE_SHOW = "show"; -const QString CRATETABLE_LOCKED = "locked"; -const QString CRATETABLE_AUTODJ_SOURCE = "autodj_source"; - -const QString CRATETRACKSTABLE_TRACKID = "track_id"; -const QString CRATETRACKSTABLE_CRATEID = "crate_id"; - class CrateDAO : public QObject, public virtual DAO { Q_OBJECT public: diff --git a/src/library/dao/crateschema.h b/src/library/dao/crateschema.h new file mode 100644 index 0000000000..90b7c886d6 --- /dev/null +++ b/src/library/dao/crateschema.h @@ -0,0 +1,22 @@ +#ifndef MIXXX_CRATESCHEMA_H +#define MIXXX_CRATESCHEMA_H + + +#include <QString> + + +#define CRATE_TABLE "crates" +#define CRATE_TRACKS_TABLE "crate_tracks" + +const QString CRATETABLE_ID = "id"; +const QString CRATETABLE_AUTODJ_SOURCE = "autodj_source"; +const QString CRATETABLE_NAME = "name"; +const QString CRATETABLE_COUNT = "count"; +const QString CRATETABLE_SHOW = "show"; +const QString CRATETABLE_LOCKED = "locked"; + +const QString CRATETRACKSTABLE_CRATEID = "crate_id"; +const QString CRATETRACKSTABLE_TRACKID = "track_id"; + + +#endif // MIXXX_CRATESCHEMA_H diff --git a/src/library/dao/trackdao.cpp b/src/library/dao/trackdao.cpp index 101934e1b0..f32f224182 100644 --- a/src/library/dao/trackdao.cpp +++ b/src/library/dao/trackdao.cpp @@ -1,3 +1,5 @@ +#include "library/dao/trackdao.h" + #include <QtDebug> #include <QDir> #include <QDirIterator> @@ -8,13 +10,12 @@ #include <QCoreApplication> #include <QChar> -#include "library/dao/trackdao.h" - #include "sources/soundsourceproxy.h" #include "track/track.h" #include "library/queryutil.h" #include "library/coverart.h" #include "library/coverartutils.h" +#include "library/dao/trackschema.h" #include "library/dao/cratedao.h" #include "library/dao/cuedao.h" #include "library/dao/playlistdao.h" diff --git a/src/library/dao/trackdao.h b/src/library/dao/trackdao.h index 858b05999d..0abc6c95c8 100644 --- a/src/library/dao/trackdao.h +++ b/src/library/dao/trackdao.h @@ -18,54 +18,6 @@ #include "util/class.h" #include "util/memory.h" -#define LIBRARY_TABLE "library" - -const QString LIBRARYTABLE_ID = "id"; -const QString LIBRARYTABLE_ARTIST = "artist"; -const QString LIBRARYTABLE_TITLE = "title"; -const QString LIBRARYTABLE_ALBUM = "album"; -const QString LIBRARYTABLE_ALBUMARTIST = "album_artist"; -const QString LIBRARYTABLE_YEAR = "year"; -const QString LIBRARYTABLE_GENRE = "genre"; -const QString LIBRARYTABLE_COMPOSER = "composer"; -const QString LIBRARYTABLE_GROUPING = "grouping"; -const QString LIBRARYTABLE_TRACKNUMBER = "tracknumber"; -const QString LIBRARYTABLE_FILETYPE = "filetype"; -const QString LIBRARYTABLE_LOCATION = "location"; -const QString LIBRARYTABLE_COMMENT = "comment"; -const QString LIBRARYTABLE_DURATION = "duration"; -const QString LIBRARYTABLE_BITRATE = "bitrate"; -const QString LIBRARYTABLE_BPM = "bpm"; -const QString LIBRARYTABLE_REPLAYGAIN = "replaygain"; -const QString LIBRARYTABLE_CUEPOINT = "cuepoint"; -const QString LIBRARYTABLE_URL = "url"; -const QString LIBRARYTABLE_SAMPLERATE = "samplerate"; -const QString LIBRARYTABLE_WAVESUMMARYHEX = "wavesummaryhex"; -const QString LIBRARYTABLE_CHANNELS = "channels"; -const QString LIBRARYTABLE_MIXXXDELETED = "mixxx_deleted"; -const QString LIBRARYTABLE_DATETIMEADDED = "datetime_added"; -const QString LIBRARYTABLE_HEADERPARSED = "header_parsed"; -const QString LIBRARYTABLE_TIMESPLAYED = "timesplayed"; -const QString LIBRARYTABLE_PLAYED = "played"; -const QString LIBRARYTABLE_RATING = "rating"; -const QString LIBRARYTABLE_KEY = "key"; -const QString LIBRARYTABLE_KEY_ID = "key_id"; -const QString LIBRARYTABLE_BPM_LOCK = "bpm_lock"; -const QString LIBRARYTABLE_PREVIEW = "preview"; -const QString LIBRARYTABLE_COVERART = "coverart"; -const QString LIBRARYTABLE_COVERART_SOURCE = "coverart_source"; -const QString LIBRARYTABLE_COVERART_TYPE = "coverart_type"; -const QString LIBRARYTABLE_COVERART_LOCATION = "coverart_location"; -const QString LIBRARYTABLE_COVERART_HASH = "coverart_hash"; - -const QString TRACKLOCATIONSTABLE_ID = "id"; -const QString TRACKLOCATIONSTABLE_LOCATION = "location"; -const QString TRACKLOCATIONSTABLE_FILENAME = "filename"; -const QString TRACKLOCATIONSTABLE_DIRECTORY = "directory"; -const QString TRACKLOCATIONSTABLE_FILESIZE = "filesize"; -const QString TRACKLOCATIONSTABLE_FSDELETED = "fs_deleted"; -const QString TRACKLOCATIONSTABLE_NEEDSVERIFICATION = "needs_verification"; - class ScopedTransaction; class PlaylistDAO; class AnalysisDao; diff --git a/src/library/dao/trackschema.h b/src/library/dao/trackschema.h new file mode 100644 index 0000000000..1fda04f8d5 --- /dev/null +++ b/src/library/dao/trackschema.h @@ -0,0 +1,54 @@ +#ifndef MIXXX_TRACKSCHEMA_H +#define MIXXX_TRACKSCHEMA_H + +#include <QString> + +#define LIBRARY_TABLE "library" + +const QString LIBRARYTABLE_ID = "id"; +const QString LIBRARYTABLE_ARTIST = "artist"; +const QString LIBRARYTABLE_TITLE = "title"; +const QString LIBRARYTABLE_ALBUM = "album"; +const QString LIBRARYTABLE_ALBUMARTIST = "album_artist"; +const QString LIBRARYTABLE_YEAR = "year"; +const QString LIBRARYTABLE_GENRE = "genre"; +const QString LIBRARYTABLE_COMPOSER = "composer"; +const QString LIBRARYTABLE_GROUPING = "grouping"; +const QString LIBRARYTABLE_TRACKNUMBER = "tracknumber"; +const QString LIBRARYTABLE_FILETYPE = "filetype"; +const QString LIBRARYTABLE_LOCATION = "location"; +const QString LIBRARYTABLE_COMMENT = "comment"; +const QString LIBRARYTABLE_DURATION = "duration"; +const QString LIBRARYTABLE_BITRATE = "bitrate"; +const QString LIBRARYTABLE_BPM = "bpm"; +const QString LIBRARYTABLE_REPLAYGAIN = "replaygain"; +const QString LIBRARYTABLE_CUEPOINT = "cuepoint"; +const QString LIBRARYTABLE_URL = "url"; +const QString LIBRARYTABLE_SAMPLERATE = "samplerate"; +const QString LIBRARYTABLE_WAVESUMMARYHEX = "wavesummaryhex"; +const QString LIBRARYTABLE_CHANNELS = "channels"; +const QString LIBRARYTABLE_MIXXXDELETED = "mixxx_deleted"; +const QString LIBRARYTABLE_DATETIMEADDED = "datetime_added"; +const QString LIBRARYTABLE_HEADERPARSED = "header_parsed"; +const QString LIBRARYTABLE_TIMESPLAYED = "timesplayed"; +const QString LIBRARYTABLE_PLAYED = "played"; +const QString LIBRARYTABLE_RATING = "rating"; +const QString LIBRARYTABLE_KEY = "key"; +const QString LIBRARYTABLE_KEY_ID = "key_id"; +const QString LIBRARYTABLE_BPM_LOCK = "bpm_lock"; +const QString LIBRARYTABLE_PREVIEW = "preview"; +const QString LIBRARYTABLE_COVERART = "coverart"; +const QString LIBRARYTABLE_COVERART_SOURCE = "coverart_source"; +const QString LIBRARYTABLE_COVERART_TYPE = "coverart_type"; +const QString LIBRARYTABLE_COVERART_LOCATION = "coverart_location"; +const QString LIBRARYTABLE_COVERART_HASH = "coverart_hash"; + +const QString TRACKLOCATIONSTABLE_ID = "id"; +const QString TRACKLOCATIONSTABLE_LOCATION = "location"; +const QString TRACKLOCATIONSTABLE_FILENAME = "filename"; +const QString TRACKLOCATIONSTABLE_DIRECTORY = "directory"; +const QString TRACKLOCATIONSTABLE_FILESIZE = "filesize"; +const QString TRACKLOCATIONSTABLE_FSDELETED = "fs_deleted"; +const QString TRACKLOCATIONSTABLE_NEEDSVERIFICATION = "needs_verification"; + +#endif //MIXXX_TRACKSCHEMA_H diff --git a/src/library/dlganalysis.cpp b/src/library/dlganalysis.cpp index 4c07e30a42..6ce0526b4f 100644 --- a/src/library/dlganalysis.cpp +++ b/src/library/dlganalysis.cpp @@ -3,6 +3,7 @@ #include "widget/wwidget.h" #include "widget/wskincolor.h" #include "widget/wanalysislibrarytableview.h" +#include "library/dao/trackschema.h" #include "library/trackcollection.h" #include "library/dlganalysis.h" #include "util/assert.h" diff --git a/src/library/hiddentablemodel.cpp b/src/library/hiddentablemodel.cpp index c103ed88f2..a58edd1ef4 100644 --- a/src/library/hiddentablemodel.cpp +++ b/src/library/hiddentablemodel.cpp @@ -1,5 +1,8 @@ #include "library/hiddentablemodel.h" +#include "library/dao/trackschema.h" + + HiddenTableModel::HiddenTableModel(QObject* parent, TrackCollection* pTrackCollection) : BaseSqlTableModel(parent, pTrackCollection, "mixxx.db.model.missing") { diff --git a/src/library/librarytablemodel.cpp b/src/library/librarytablemodel.cpp index 71616d510c..d16b7dab5a 100644 --- a/src/library/librarytablemodel.cpp +++ b/src/library/librarytablemodel.cpp @@ -1,6 +1,7 @@ #include "library/librarytablemodel.h" #include "library/queryutil.h" +#include "library/dao/trackschema.h" #include "mixer/playermanager.h" namespace { diff --git a/src/library/missingtablemodel.cpp b/src/library/missingtablemodel.cpp index ee2cefb17b..4aa5d2f2d1 100644 --- a/src/library/missingtablemodel.cpp +++ b/src/library/missingtablemodel.cpp @@ -3,6 +3,7 @@ #include "library/trackcollection.h" #include "library/missingtablemodel.h" #include "library/librarytablemodel.h" +#include "library/dao/trackschema.h" namespace { diff --git a/src/library/mixxxlibraryfeature.cpp b/src/library/mixxxlibraryfeature.cpp index ef7daabcf7..43393d1d9b 100644 --- a/src/library/mixxxlibraryfeature.cpp +++ b/src/library/mixxxlibraryfeature.cpp @@ -12,6 +12,7 @@ #include "library/missingtablemodel.h" #include "library/hiddentablemodel.h" #include "library/queryutil.h" +#include "library/dao/trackschema.h" #include "library/trackcollection.h" #include "treeitem.h" #include "sources/soundsourceproxy.h" diff --git a/src/library/playlisttablemodel.cpp b/src/library/playlisttablemodel.cpp index e34ab73f78..35d5de6581 100644 --- a/src/library/playlisttablemodel.cpp +++ b/src/library/playlisttablemodel.cpp @@ -1,5 +1,6 @@ #include "library/playlisttablemodel.h" #include "library/queryutil.h" +#include "library/dao/trackschema.h" #include "mixer/playermanager.h" PlaylistTableModel::PlaylistTableModel(QObject* parent, diff --git a/src/library/searchquery.cpp b/src/library/searchquery.cpp index cd2364be5c..fc0937b976 100644 --- a/src/library/searchquery.cpp +++ b/src/library/searchquery.cpp @@ -4,7 +4,7 @@ #include "library/queryutil.h" #include "track/keyutils.h" -#include "library/dao/trackdao.h" +#include "library/dao/trackschema.h" QVariant getTrackValueForColumn(const TrackPointer& pTrack, const QString& column) { if (column == LIBRARYTABLE_ARTIST) { |