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

apply changes from git-clang-format #2

Merged
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/library/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "library/trackcollectionmanager.h"
#include "library/trackmodel.h"

#include "library/analysisfeature.h"
#include "library/autodj/autodjfeature.h"
#include "library/banshee/bansheefeature.h"
#include "library/browse/browsefeature.h"
Expand All @@ -28,12 +29,11 @@
#include "library/mixxxlibraryfeature.h"
#include "library/playlistfeature.h"
#include "library/recording/recordingfeature.h"
#include "library/rekordbox/rekordboxfeature.h"
#include "library/rhythmbox/rhythmboxfeature.h"
#include "library/serato/seratofeature.h"
#include "library/setlogfeature.h"
#include "library/traktor/traktorfeature.h"
#include "library/rekordbox/rekordboxfeature.h"
#include "library/serato/seratofeature.h"
#include "library/analysisfeature.h"

#include "mixer/playermanager.h"

Expand Down
161 changes: 87 additions & 74 deletions src/library/serato/seratofeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#include <QtDebug>

#include "engine/engine.h"
#include "library/dao/trackschema.h"
#include "library/library.h"
#include "library/librarytablemodel.h"
#include "library/missingtablemodel.h"
#include "library/queryutil.h"
#include "library/trackcollection.h"
#include "library/trackcollectionmanager.h"
#include "library/treeitem.h"
#include "library/dao/trackschema.h"
#include "track/beatfactory.h"
#include "track/cue.h"
#include "track/keyfactory.h"
Expand Down Expand Up @@ -101,7 +101,7 @@ const QString kSeratoLibraryTable = QStringLiteral("serato_library");
const QString kSeratoPlaylistsTable = QStringLiteral("serato_library");
const QString kSeratoPlaylistTracksTable = QStringLiteral("serato_library");

constexpr int kHeaderSize = 2*sizeof(quint32);
constexpr int kHeaderSize = 2 * sizeof(quint32);

int createPlaylist(const QSqlDatabase& database, const QString& name, const QString& databasePath) {
QSqlQuery query(database);
Expand Down Expand Up @@ -343,12 +343,15 @@ inline QString parseCrateTrackPath(QIODevice* buffer) {
return location;
}

QString parseCrate(const QSqlDatabase& database, const QString& databasePath,
const QString& crateFilePath, const QMap<QString, int>& trackIdMap) {
QString parseCrate(
const QSqlDatabase& database,
const QString& databasePath,
const QString& crateFilePath,
const QMap<QString, int>& trackIdMap) {
QString crateName = QFileInfo(crateFilePath).baseName();
qDebug() << "Parsing crate"
<< crateName
<< "at" << crateFilePath;
<< crateName
<< "at" << crateFilePath;

//Open the database connection in this thread.
VERIFY_OR_DEBUG_ASSERT(database.isOpen()) {
Expand Down Expand Up @@ -483,22 +486,24 @@ QString parseDatabase(mixxx::DbConnectionPoolPtr dbConnectionPool, TreeItem* dat

QSqlQuery query(database);
query.prepare(
"INSERT INTO " + kSeratoLibraryTable + " ("
+ LIBRARYTABLE_TITLE + ", "
+ LIBRARYTABLE_ARTIST + ", "
+ LIBRARYTABLE_ALBUM + ", "
+ LIBRARYTABLE_GENRE + ", "
+ LIBRARYTABLE_COMMENT + ", "
+ LIBRARYTABLE_GROUPING + ", "
+ LIBRARYTABLE_YEAR + ", "
+ LIBRARYTABLE_DURATION + ", "
+ LIBRARYTABLE_BITRATE + ", "
+ LIBRARYTABLE_SAMPLERATE + ", "
+ LIBRARYTABLE_BPM + ", "
+ LIBRARYTABLE_KEY + ", "
+ LIBRARYTABLE_LOCATION + ", "
+ LIBRARYTABLE_BPM_LOCK + ", "
+ LIBRARYTABLE_DATETIMEADDED + ", "
"INSERT INTO " +
kSeratoLibraryTable + " (" +
LIBRARYTABLE_TITLE + ", " +
LIBRARYTABLE_ARTIST + ", " +
LIBRARYTABLE_ALBUM + ", " +
LIBRARYTABLE_GENRE + ", " +
LIBRARYTABLE_COMMENT + ", " +
LIBRARYTABLE_GROUPING + ", " +
LIBRARYTABLE_YEAR + ", " +
LIBRARYTABLE_DURATION + ", " +
LIBRARYTABLE_BITRATE + ", " +
LIBRARYTABLE_SAMPLERATE + ", " +
LIBRARYTABLE_BPM + ", " +
LIBRARYTABLE_KEY + ", " +
LIBRARYTABLE_LOCATION + ", " +
LIBRARYTABLE_BPM_LOCK + ", " +
LIBRARYTABLE_DATETIMEADDED +
", "
"label, "
"serato_db"
") VALUES ("
Expand Down Expand Up @@ -629,9 +634,13 @@ QString parseDatabase(mixxx::DbConnectionPoolPtr dbConnectionPool, TreeItem* dat
if (crateDir.cd(kCrateDirectory)) {
QStringList filters;
filters << kCrateFilter;
foreach(const QString& entry, crateDir.entryList(filters)) {
foreach (const QString& entry, crateDir.entryList(filters)) {
QString crateFilePath = crateDir.filePath(entry);
QString crateName = parseCrate(database, databaseDir.path(), crateFilePath, trackIdMap);
QString crateName = parseCrate(
database,
databaseDir.path(),
crateFilePath,
trackIdMap);
if (!crateName.isEmpty()) {
QList<QVariant> data;
data << QVariant(crateFilePath)
Expand Down Expand Up @@ -765,52 +774,52 @@ void SeratoPlaylistModel::initSortColumnMapping() {
m_columnIndexBySortColumnId[i] = -1;
}

m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_ARTIST]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ARTIST);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_TITLE]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_TITLE);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_ALBUM]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ALBUM);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_ALBUMARTIST]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ALBUMARTIST);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_YEAR]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_YEAR);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_GENRE]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_GENRE);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_COMPOSER]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COMPOSER);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_GROUPING]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_GROUPING);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_TRACKNUMBER]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_TRACKNUMBER);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_FILETYPE]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_FILETYPE);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_NATIVELOCATION]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_NATIVELOCATION);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_COMMENT]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COMMENT);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_DURATION]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_DURATION);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_BITRATE]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BITRATE);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_BPM]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BPM);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_REPLAYGAIN]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_REPLAYGAIN);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_DATETIMEADDED]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_DATETIMEADDED);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_TIMESPLAYED]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_TIMESPLAYED);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_RATING]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RATING);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_KEY]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_KEY);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_PREVIEW]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_PREVIEW);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_COVERART]
= fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COVERART);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_POSITION]
= fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_POSITION);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_ARTIST] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ARTIST);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_TITLE] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_TITLE);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_ALBUM] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ALBUM);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_ALBUMARTIST] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ALBUMARTIST);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_YEAR] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_YEAR);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_GENRE] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_GENRE);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_COMPOSER] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COMPOSER);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_GROUPING] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_GROUPING);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_TRACKNUMBER] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_TRACKNUMBER);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_FILETYPE] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_FILETYPE);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_NATIVELOCATION] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_NATIVELOCATION);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_COMMENT] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COMMENT);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_DURATION] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_DURATION);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_BITRATE] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BITRATE);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_BPM] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BPM);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_REPLAYGAIN] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_REPLAYGAIN);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_DATETIMEADDED] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_DATETIMEADDED);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_TIMESPLAYED] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_TIMESPLAYED);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_RATING] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RATING);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_KEY] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_KEY);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_PREVIEW] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_PREVIEW);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_COVERART] =
fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COVERART);
m_columnIndexBySortColumnId[TrackModel::SortColumnId::SORTCOLUMN_POSITION] =
fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_POSITION);

m_sortColumnIdByColumnIndex.clear();
for (int i = 0; i < TrackModel::SortColumnId::NUM_SORTCOLUMNIDS; ++i) {
Expand Down Expand Up @@ -890,10 +899,14 @@ SeratoFeature::SeratoFeature(
clearTable(database, kSeratoLibraryTable);
transaction.commit();

connect(&m_databasesFutureWatcher, &QFutureWatcher<QList<TreeItem*>>::finished,
this, &SeratoFeature::onSeratoDatabasesFound);
connect(&m_tracksFutureWatcher, &QFutureWatcher<QString>::finished,
this, &SeratoFeature::onTracksFound);
connect(&m_databasesFutureWatcher,
&QFutureWatcher<QList<TreeItem*>>::finished,
this,
&SeratoFeature::onSeratoDatabasesFound);
connect(&m_tracksFutureWatcher,
&QFutureWatcher<QString>::finished,
this,
&SeratoFeature::onTracksFound);

// initialize the model
m_childModel.setRootItem(std::make_unique<TreeItem>(this));
Expand Down
6 changes: 3 additions & 3 deletions src/preferences/dialog/dlgpreflibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void DlgPrefLibrary::slotUpdate() {
checkBox_show_rekordbox->setChecked(m_pConfig->getValue(
ConfigKey("[Library]","ShowRekordboxLibrary"), true));
checkBox_show_serato->setChecked(m_pConfig->getValue(
ConfigKey("[Library]","ShowSeratoLibrary"), true));
ConfigKey("[Library]", "ShowSeratoLibrary"), true));

switch (m_pConfig->getValue<int>(
ConfigKey("[Library]","TrackLoadAction"), LOAD_TO_DECK)) {
Expand Down Expand Up @@ -313,8 +313,8 @@ void DlgPrefLibrary::slotApply() {
ConfigValue((int)checkBox_show_traktor->isChecked()));
m_pConfig->set(ConfigKey("[Library]","ShowRekordboxLibrary"),
ConfigValue((int)checkBox_show_rekordbox->isChecked()));
m_pConfig->set(ConfigKey("[Library]","ShowSeratoLibrary"),
ConfigValue((int)checkBox_show_serato->isChecked()));
m_pConfig->set(ConfigKey("[Library]", "ShowSeratoLibrary"),
ConfigValue((int)checkBox_show_serato->isChecked()));
int dbclick_status;
if (radioButton_dbclick_bottom->isChecked()) {
dbclick_status = ADD_TO_AUTODJ_BOTTOM;
Expand Down