Skip to content

Commit

Permalink
Merge pull request #2715 from xerus2000/refactor-basetrackset
Browse files Browse the repository at this point in the history
Move trackset-features into library subfolder
  • Loading branch information
Holzhaus authored Jun 11, 2020
2 parents 0912536 + 8757571 commit 2ea349e
Show file tree
Hide file tree
Showing 56 changed files with 1,367 additions and 1,358 deletions.
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,8 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/library/baseexternallibraryfeature.cpp
src/library/baseexternalplaylistmodel.cpp
src/library/baseexternaltrackmodel.cpp
src/library/baseplaylistfeature.cpp
src/library/basesqltablemodel.cpp
src/library/basetrackcache.cpp
src/library/basetracksetfeature.cpp
src/library/basetracktablemodel.cpp
src/library/bpmdelegate.cpp
src/library/browse/browsefeature.cpp
Expand All @@ -524,10 +522,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/library/coverartcache.cpp
src/library/coverartdelegate.cpp
src/library/coverartutils.cpp
src/library/crate/cratefeature.cpp
src/library/crate/cratefeaturehelper.cpp
src/library/crate/cratestorage.cpp
src/library/crate/cratetablemodel.cpp
src/library/dao/analysisdao.cpp
src/library/dao/autodjcratesdao.cpp
src/library/dao/cuedao.cpp
Expand Down Expand Up @@ -567,7 +561,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/library/parsercsv.cpp
src/library/parserm3u.cpp
src/library/parserpls.cpp
src/library/playlistfeature.cpp
src/library/playlisttablemodel.cpp
src/library/previewbuttondelegate.cpp
src/library/proxytrackmodel.cpp
Expand All @@ -587,7 +580,16 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/library/searchqueryparser.cpp
src/library/serato/seratofeature.cpp
src/library/serato/seratoplaylistmodel.cpp
src/library/setlogfeature.cpp
src/library/trackset/baseplaylistfeature.cpp
src/library/trackset/basetracksetfeature.cpp
src/library/trackset/crate/cratefeature.cpp
src/library/trackset/crate/cratefeaturehelper.cpp
src/library/trackset/crate/cratestorage.cpp
src/library/trackset/crate/cratetablemodel.cpp
src/library/trackset/playlistfeature.cpp
src/library/trackset/setlogfeature.cpp
src/library/trackset/tracksettablemodel.cpp
src/library/traktor/traktorfeature.cpp
src/library/sidebarmodel.cpp
src/library/songdownloader.cpp
src/library/stardelegate.cpp
Expand All @@ -597,8 +599,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/library/trackcollection.cpp
src/library/trackcollectionmanager.cpp
src/library/trackloader.cpp
src/library/tracksettablemodel.cpp
src/library/traktor/traktorfeature.cpp
src/library/treeitem.cpp
src/library/treeitemmodel.cpp
src/mixer/auxiliary.cpp
Expand Down
18 changes: 9 additions & 9 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,23 +1047,23 @@ def sources(self, build):
"src/library/coverartcache.cpp",
"src/library/coverartutils.cpp",

"src/library/crate/cratestorage.cpp",
"src/library/crate/cratefeature.cpp",
"src/library/crate/cratefeaturehelper.cpp",
"src/library/crate/cratetablemodel.cpp",
"src/library/trackset/basetracksetfeature.cpp",
"src/library/trackset/baseplaylistfeature.cpp",
"src/library/trackset/playlistfeature.cpp",
"src/library/trackset/setlogfeature.cpp",
"src/library/trackset/tracksettablemodel.cpp",
"src/library/trackset/crate/cratestorage.cpp",
"src/library/trackset/crate/cratefeature.cpp",
"src/library/trackset/crate/cratefeaturehelper.cpp",
"src/library/trackset/crate/cratetablemodel.cpp",

"src/library/playlisttablemodel.cpp",
"src/library/tracksettablemodel.cpp",
"src/library/libraryfeature.cpp",
"src/library/analysisfeature.cpp",
"src/library/autodj/autodjfeature.cpp",
"src/library/autodj/autodjprocessor.cpp",
"src/library/dao/directorydao.cpp",
"src/library/mixxxlibraryfeature.cpp",
"src/library/basetracksetfeature.cpp",
"src/library/baseplaylistfeature.cpp",
"src/library/playlistfeature.cpp",
"src/library/setlogfeature.cpp",
"src/library/autodj/dlgautodj.cpp",
"src/library/dlganalysis.cpp",
"src/library/dlgcoverartfullsize.cpp",
Expand Down
10 changes: 5 additions & 5 deletions src/library/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
// FORK FORK FORK on 11/1/2009 by Albert Santoni (alberts@mixxx.org)
// Created 8/23/2009 by RJ Ryan (rryan@mit.edu)

#include <QtDebug>
#include <QMetaObject>
#include <QMenu>

#include "library/autodj/autodjfeature.h"

#include <QMenu>
#include <QMetaObject>
#include <QtDebug>

#include "controllers/keyboard/keyboardeventfilter.h"
#include "library/autodj/autodjprocessor.h"
#include "library/autodj/dlgautodj.h"
#include "library/crate/cratestorage.h"
#include "library/library.h"
#include "library/parser.h"
#include "library/trackcollection.h"
#include "library/trackcollectionmanager.h"
#include "library/trackset/crate/cratestorage.h"
#include "library/treeitem.h"
#include "mixer/playermanager.h"
#include "sources/soundsourceproxy.h"
Expand Down
16 changes: 8 additions & 8 deletions src/library/autodj/autodjfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
#ifndef AUTODJFEATURE_H
#define AUTODJFEATURE_H

#include <QObject>
#include <QStringListModel>
#include <QVariant>
#include <QAction>
#include <QIcon>
#include <QUrl>
#include <QList>
#include <QModelIndex>
#include <QObject>
#include <QPoint>
#include <QAction>
#include <QPointer>
#include <QStringListModel>
#include <QUrl>
#include <QVariant>

#include "library/dao/autodjcratesdao.h"
#include "library/libraryfeature.h"
#include "preferences/usersettings.h"
#include "library/trackset/crate/crate.h"
#include "library/treeitemmodel.h"
#include "library/crate/crate.h"
#include "library/dao/autodjcratesdao.h"
#include "preferences/usersettings.h"

class DlgAutoDJ;
class Library;
Expand Down
182 changes: 83 additions & 99 deletions src/library/banshee/bansheeplaylistmodel.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "library/banshee/bansheeplaylistmodel.h"

#include <QtDebug>

#include "library/banshee/bansheeplaylistmodel.h"
#include "library/banshee/bansheedbconnection.h"
#include "library/queryutil.h"
#include "library/starrating.h"
#include "library/previewbuttondelegate.h"
#include "library/trackcollectionmanager.h"
#include "mixer/playermanager.h"
#include "track/beatfactory.h"
#include "track/beats.h"
#include "mixer/playermanager.h"

#define BANSHEE_TABLE "banshee"
#define CLM_TRACK_ID "track_id"
Expand Down Expand Up @@ -75,73 +75,56 @@ void BansheePlaylistModel::setTableModel(int playlistId) {
m_playlistId = playlistId;

QSqlQuery query(m_database);
QString strQuery("CREATE TEMP TABLE IF NOT EXISTS %1"
" (" CLM_TRACK_ID " INTEGER, "
CLM_VIEW_ORDER " INTEGER, "
CLM_ARTIST " TEXT, "
CLM_TITLE " TEXT, "
CLM_DURATION " INTEGER, "
CLM_URI " TEXT, "
CLM_ALBUM " TEXT, "
CLM_ALBUM_ARTIST " TEXT, "
CLM_YEAR " INTEGER, "
CLM_RATING " INTEGER, "
CLM_GENRE " TEXT, "
CLM_GROUPING " TEXT, "
CLM_TRACKNUMBER " INTEGER, "
CLM_DATEADDED " INTEGER, "
CLM_BPM " INTEGER, "
CLM_BITRATE " INTEGER, "
CLM_COMMENT " TEXT, "
CLM_PLAYCOUNT" INTEGER, "
CLM_COMPOSER " TEXT, "
CLM_PREVIEW " TEXT)");
if (!query.exec(strQuery.arg(m_tempTableName))) {
if (!query.exec(QStringLiteral(
"CREATE TEMP TABLE IF NOT EXISTS %1 (" //
CLM_TRACK_ID " INTEGER, " //
CLM_VIEW_ORDER " INTEGER, " //
CLM_ARTIST " TEXT, " //
CLM_TITLE " TEXT, " //
CLM_DURATION " INTEGER, " //
CLM_URI " TEXT, " //
CLM_ALBUM " TEXT, " //
CLM_ALBUM_ARTIST " TEXT, " //
CLM_YEAR " INTEGER, " //
CLM_RATING " INTEGER, " //
CLM_GENRE " TEXT, " //
CLM_GROUPING " TEXT, " //
CLM_TRACKNUMBER " INTEGER, " //
CLM_DATEADDED " INTEGER, " //
CLM_BPM " INTEGER, " //
CLM_BITRATE " INTEGER, " //
CLM_COMMENT " TEXT, " //
CLM_PLAYCOUNT " INTEGER, " //
CLM_COMPOSER " TEXT, " //
CLM_PREVIEW " TEXT)")
.arg(m_tempTableName))) {
LOG_FAILED_QUERY(query);
}

QString strQuery2("INSERT INTO %1"
" (" CLM_TRACK_ID ", "
CLM_VIEW_ORDER ", "
CLM_ARTIST ", "
CLM_TITLE ", "
CLM_DURATION ", "
CLM_URI ", "
CLM_ALBUM ", "
CLM_ALBUM_ARTIST ", "
CLM_YEAR ", "
CLM_RATING ", "
CLM_GENRE ", "
CLM_GROUPING ", "
CLM_TRACKNUMBER ", "
CLM_DATEADDED ", "
CLM_BPM ", "
CLM_BITRATE ", "
CLM_COMMENT ", "
CLM_PLAYCOUNT ", "
CLM_COMPOSER ") "
"VALUES (:"
CLM_TRACK_ID ", :"
CLM_VIEW_ORDER ", :"
CLM_ARTIST ", :"
CLM_TITLE ", :"
CLM_DURATION ", :"
CLM_URI ", :"
CLM_ALBUM ", :"
CLM_ALBUM_ARTIST ", :"
CLM_YEAR ", :"
CLM_RATING ", :"
CLM_GENRE ", :"
CLM_GROUPING ", :"
CLM_TRACKNUMBER ", :"
CLM_DATEADDED ", :"
CLM_BPM ", :"
CLM_BITRATE ", :"
CLM_COMMENT ", :"
CLM_PLAYCOUNT ", :"
CLM_COMPOSER ") ");

query.prepare(strQuery2.arg(m_tempTableName));
QStringList insertColumns;
insertColumns
<< CLM_TRACK_ID
<< CLM_VIEW_ORDER
<< CLM_ARTIST
<< CLM_TITLE
<< CLM_DURATION
<< CLM_URI
<< CLM_ALBUM
<< CLM_ALBUM_ARTIST
<< CLM_YEAR
<< CLM_RATING
<< CLM_GENRE
<< CLM_GROUPING
<< CLM_TRACKNUMBER
<< CLM_DATEADDED
<< CLM_BPM
<< CLM_BITRATE
<< CLM_COMMENT
<< CLM_PLAYCOUNT
<< CLM_COMPOSER;
query.prepare(
QStringLiteral("INSERT INTO %1 (%2) VALUES (:%3)")
.arg(m_tempTableName, insertColumns.join(", "), insertColumns.join(", :")));

QList<struct BansheeDbConnection::PlaylistEntry> list =
m_pConnection->getPlaylistEntries(playlistId);
Expand Down Expand Up @@ -186,34 +169,37 @@ void BansheePlaylistModel::setTableModel(int playlistId) {

QStringList tableColumns;
tableColumns
<< CLM_TRACK_ID // 0
<< CLM_VIEW_ORDER
<< CLM_PREVIEW; // 3
<< CLM_TRACK_ID // 0
<< CLM_VIEW_ORDER
<< CLM_PREVIEW; // 3

QStringList trackSourceColumns;
trackSourceColumns
<< CLM_TRACK_ID // 0
<< CLM_ARTIST
<< CLM_TITLE
<< CLM_DURATION
<< CLM_URI
<< CLM_ALBUM
<< CLM_ALBUM_ARTIST
<< CLM_YEAR
<< CLM_RATING
<< CLM_GENRE
<< CLM_GROUPING
<< CLM_TRACKNUMBER
<< CLM_DATEADDED
<< CLM_BPM
<< CLM_BITRATE
<< CLM_COMMENT
<< CLM_PLAYCOUNT
<< CLM_COMPOSER;
<< CLM_TRACK_ID // 0
<< CLM_ARTIST
<< CLM_TITLE
<< CLM_DURATION
<< CLM_URI
<< CLM_ALBUM
<< CLM_ALBUM_ARTIST
<< CLM_YEAR
<< CLM_RATING
<< CLM_GENRE
<< CLM_GROUPING
<< CLM_TRACKNUMBER
<< CLM_DATEADDED
<< CLM_BPM
<< CLM_BITRATE
<< CLM_COMMENT
<< CLM_PLAYCOUNT
<< CLM_COMPOSER;

QSharedPointer<BaseTrackCache> trackSource(
new BaseTrackCache(m_pTrackCollectionManager->internalCollection(), m_tempTableName, CLM_TRACK_ID,
trackSourceColumns, false));
new BaseTrackCache(m_pTrackCollectionManager->internalCollection(),
m_tempTableName,
CLM_TRACK_ID,
trackSourceColumns,
false));

setTable(m_tempTableName, CLM_TRACK_ID, tableColumns, trackSource);
setSearch("");
Expand All @@ -222,15 +208,14 @@ void BansheePlaylistModel::setTableModel(int playlistId) {
}

TrackModel::CapabilitiesFlags BansheePlaylistModel::getCapabilities() const {
return TRACKMODELCAPS_NONE
| TRACKMODELCAPS_ADDTOPLAYLIST
| TRACKMODELCAPS_ADDTOCRATE
| TRACKMODELCAPS_ADDTOAUTODJ
| TRACKMODELCAPS_LOADTODECK
| TRACKMODELCAPS_LOADTOSAMPLER;
return TRACKMODELCAPS_ADDTOPLAYLIST |
TRACKMODELCAPS_ADDTOCRATE |
TRACKMODELCAPS_ADDTOAUTODJ |
TRACKMODELCAPS_LOADTODECK |
TRACKMODELCAPS_LOADTOSAMPLER;
}

Qt::ItemFlags BansheePlaylistModel::flags(const QModelIndex &index) const {
Qt::ItemFlags BansheePlaylistModel::flags(const QModelIndex& index) const {
return readOnlyFlags(index);
}

Expand Down Expand Up @@ -297,7 +282,6 @@ TrackPointer BansheePlaylistModel::getTrack(const QModelIndex& index) const {
mixxx::BeatsPointer pBeats = BeatFactory::makeBeatGrid(*pTrack, bpm, 0.0);
pTrack->setBeats(pBeats);
}

}
return pTrack;
}
Expand Down Expand Up @@ -348,5 +332,5 @@ QString BansheePlaylistModel::getTrackLocation(const QModelIndex& index) const {
bool BansheePlaylistModel::isColumnInternal(int column) {
return (column == fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_TRACKID) ||
(PlayerManager::numPreviewDecks() == 0 &&
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_PREVIEW)));
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_PREVIEW)));
}
2 changes: 1 addition & 1 deletion src/library/baseexternallibraryfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void BaseExternalLibraryFeature::slotImportAsMixxxPlaylist() {
playlistDao.appendTracksToPlaylist(trackIds, playlistId);
} else {
// Do not change strings here without also changing strings in
// src/library/baseplaylistfeature.cpp
// src/library/trackset/baseplaylistfeature.cpp
QMessageBox::warning(NULL,
tr("Playlist Creation Failed"),
tr("An unknown error occurred while creating playlist: ")
Expand Down
Loading

0 comments on commit 2ea349e

Please sign in to comment.