Skip to content

Commit 46e6dd6

Browse files
Matthew DaveyMatthew Davey
authored andcommitted
Add record label metadata support
1 parent 17be527 commit 46e6dd6

17 files changed

Lines changed: 136 additions & 24 deletions

res/schema.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,4 +593,12 @@ reapplying those migrations.
593593
ALTER TABLE library ADD COLUMN tuning_frequency_hz FLOAT DEFAULT 0.0;
594594
</sql>
595595
</revision>
596-
</schema>
596+
<revision version="41" min_compatible="3">
597+
<description>
598+
Add record_label column to library table.
599+
</description>
600+
<sql>
601+
ALTER TABLE library ADD COLUMN record_label TEXT DEFAULT '';
602+
</sql>
603+
</revision>
604+
</schema>

src/database/mixxxdb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
const QString MixxxDb::kDefaultSchemaFile(":/schema.xml");
1515

1616
//static
17-
const int MixxxDb::kRequiredSchemaVersion = 40;
17+
const int MixxxDb::kRequiredSchemaVersion = 41;
1818

1919
namespace {
2020

src/library/basetrackcache.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ QVariant BaseTrackCache::getTrackValueForColumn(TrackPointer pTrack,
315315
if (fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ALBUMARTIST) == column) {
316316
return QVariant{pTrack->getAlbumArtist()};
317317
}
318+
if (fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RECORDLABEL) == column) {
319+
return QVariant{pTrack->getRecordLabel()};
320+
}
318321
if (fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_YEAR) == column) {
319322
return QVariant{pTrack->getYear()};
320323
}

src/library/basetracktablemodel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ QList<int> BaseTrackTableModel::pasteTracks(const QModelIndex& insertionIndex) {
322322
bool BaseTrackTableModel::isColumnHiddenByDefault(
323323
int column) {
324324
return column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ALBUMARTIST) ||
325+
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RECORDLABEL) ||
325326
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BPM_LOCK) ||
326327
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BITRATE) ||
327328
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_CHANNELS) ||

src/library/columncache.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ constexpr ColumnProperties kColumnPropertiesByEnum[] = {
5252
DI(ColumnCache::COLUMN_LIBRARYTABLE_ALBUMARTIST){&LIBRARYTABLE_ALBUMARTIST,
5353
QT_TRANSLATE_NOOP("BaseTrackTableModel", "Album Artist"),
5454
kDefaultColumnWidth * 4},
55+
DI(ColumnCache::COLUMN_LIBRARYTABLE_RECORDLABEL){&LIBRARYTABLE_RECORDLABEL,
56+
QT_TRANSLATE_NOOP("BaseTrackTableModel", "Record Label"),
57+
kDefaultColumnWidth * 4},
5558
DI(ColumnCache::COLUMN_LIBRARYTABLE_YEAR){&LIBRARYTABLE_YEAR,
5659
QT_TRANSLATE_NOOP("BaseTrackTableModel", "Year"),
5760
kDefaultColumnWidth},
@@ -234,6 +237,7 @@ void ColumnCache::setColumns(QStringList columns) {
234237
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_TITLE, kSortNoCaseLex);
235238
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_ALBUM, kSortNoCaseLex);
236239
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_ALBUMARTIST, kSortNoCaseLex);
240+
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_RECORDLABEL, kSortNoCaseLex);
237241
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_YEAR, kSortNoCase);
238242
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_GENRE, kSortNoCaseLex);
239243
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_COMPOSER, kSortNoCaseLex);

src/library/columncache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class ColumnCache : public QObject {
2121
COLUMN_LIBRARYTABLE_TITLE,
2222
COLUMN_LIBRARYTABLE_ALBUM,
2323
COLUMN_LIBRARYTABLE_ALBUMARTIST,
24+
COLUMN_LIBRARYTABLE_RECORDLABEL,
2425
COLUMN_LIBRARYTABLE_YEAR,
2526
COLUMN_LIBRARYTABLE_GENRE,
2627
COLUMN_LIBRARYTABLE_COMPOSER,

src/library/dao/trackdao.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ void TrackDAO::addTracksPrepare() {
442442
"title,"
443443
"album,"
444444
"album_artist,"
445+
"record_label,"
445446
"year,"
446447
"genre,"
447448
"tracknumber,"
@@ -491,6 +492,7 @@ void TrackDAO::addTracksPrepare() {
491492
":title,"
492493
":album,"
493494
":album_artist,"
495+
":record_label,"
494496
":year,"
495497
":genre,"
496498
":tracknumber,"
@@ -597,6 +599,9 @@ void bindTrackLibraryValues(
597599
pTrackLibraryQuery->bindValue(":title", trackInfo.getTitle());
598600
pTrackLibraryQuery->bindValue(":album", albumInfo.getTitle());
599601
pTrackLibraryQuery->bindValue(":album_artist", albumInfo.getArtist());
602+
pTrackLibraryQuery->bindValue(
603+
":record_label",
604+
albumInfo.getRecordLabel());
600605
pTrackLibraryQuery->bindValue(":year", trackInfo.getYear());
601606
pTrackLibraryQuery->bindValue(":genre", trackInfo.getGenre());
602607
pTrackLibraryQuery->bindValue(":composer", trackInfo.getComposer());
@@ -1174,6 +1179,10 @@ void setTrackAlbumArtist(const QSqlRecord& record, const int column, Track* pTra
11741179
pTrack->setAlbumArtist(record.value(column).toString());
11751180
}
11761181

1182+
void setTrackRecordLabel(const QSqlRecord& record, const int column, Track* pTrack) {
1183+
pTrack->setRecordLabel(record.value(column).toString());
1184+
}
1185+
11771186
void setTrackYear(const QSqlRecord& record, const int column, Track* pTrack) {
11781187
pTrack->setYear(record.value(column).toString());
11791188
}
@@ -1391,6 +1400,7 @@ TrackPointer TrackDAO::getTrackById(TrackId trackId) const {
13911400
{"title", setTrackTitle},
13921401
{"album", setTrackAlbum},
13931402
{"album_artist", setTrackAlbumArtist},
1403+
{"record_label", setTrackRecordLabel},
13941404
{"year", setTrackYear},
13951405
{"genre", setTrackGenre},
13961406
{"composer", setTrackComposer},
@@ -1686,6 +1696,7 @@ bool TrackDAO::updateTrack(const Track& track) const {
16861696
<< trackId
16871697
<< track.getLocation();
16881698

1699+
16891700
SqlTransaction transaction(m_database);
16901701
// PerformanceTimer time;
16911702
// time.start();
@@ -1699,6 +1710,7 @@ bool TrackDAO::updateTrack(const Track& track) const {
16991710
"title=:title,"
17001711
"album=:album,"
17011712
"album_artist=:album_artist,"
1713+
"record_label=:record_label,"
17021714
"year=:year,"
17031715
"genre=:genre,"
17041716
"composer=:composer,"

src/library/dao/trackschema.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const QString LIBRARYTABLE_ARTIST = QStringLiteral("artist");
1515
const QString LIBRARYTABLE_TITLE = QStringLiteral("title");
1616
const QString LIBRARYTABLE_ALBUM = QStringLiteral("album");
1717
const QString LIBRARYTABLE_ALBUMARTIST = QStringLiteral("album_artist");
18+
const QString LIBRARYTABLE_RECORDLABEL = QStringLiteral("record_label");
1819
const QString LIBRARYTABLE_YEAR = QStringLiteral("year");
1920
const QString LIBRARYTABLE_GENRE = QStringLiteral("genre");
2021
const QString LIBRARYTABLE_COMPOSER = QStringLiteral("composer");

src/library/dlgtrackinfo.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ void DlgTrackInfo::init() {
7474
m_propertyWidgets.insert("titleInfo", txtTitle);
7575
m_propertyWidgets.insert("album", txtAlbum);
7676
m_propertyWidgets.insert("album_artist", txtAlbumArtist);
77+
m_propertyWidgets.insert("record_label", txtRecordLabel);
7778
m_propertyWidgets.insert("composer", txtComposer);
7879
m_propertyWidgets.insert("genre", txtGenre);
7980
m_propertyWidgets.insert("year", txtYear);
@@ -224,6 +225,19 @@ void DlgTrackInfo::init() {
224225
m_trackRecord.refMetadata().refAlbumInfo().setArtist(
225226
txtAlbumArtist->text());
226227
});
228+
connect(txtRecordLabel,
229+
&QLineEdit::editingFinished,
230+
this,
231+
[this]() {
232+
txtRecordLabel->setText(
233+
txtRecordLabel->text().trimmed());
234+
235+
m_trackRecord
236+
.refMetadata()
237+
.refAlbumInfo()
238+
.setRecordLabel(
239+
txtRecordLabel->text());
240+
});
227241
connect(txtGenre,
228242
&QLineEdit::editingFinished,
229243
this,
@@ -636,6 +650,7 @@ void DlgTrackInfo::trackColorDialogSetColor(const mixxx::RgbColor::optional_t& n
636650
}
637651

638652
void DlgTrackInfo::saveTrack() {
653+
qDebug() << "DlgTrackInfo::saveTrack() called";
639654
if (!m_pLoadedTrack) {
640655
return;
641656
}
@@ -657,6 +672,12 @@ void DlgTrackInfo::saveTrack() {
657672
// updated by the editingFinished signal.
658673
m_trackRecord.refMetadata().refTrackInfo().setComment(txtComment->toPlainText());
659674

675+
m_trackRecord
676+
.refMetadata()
677+
.refAlbumInfo()
678+
.setRecordLabel(
679+
txtRecordLabel->text().trimmed());
680+
660681
// First, disconnect the track changed signal. Otherwise we signal ourselves
661682
// and repopulate all these fields.
662683
const QSignalBlocker signalBlocker(this);

0 commit comments

Comments
 (0)