Skip to content
Open
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
10 changes: 9 additions & 1 deletion res/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -593,4 +593,12 @@ reapplying those migrations.
ALTER TABLE library ADD COLUMN tuning_frequency_hz FLOAT DEFAULT 0.0;
</sql>
</revision>
</schema>
<revision version="41" min_compatible="3">
<description>
Add record_label column to library table.
</description>
<sql>
ALTER TABLE library ADD COLUMN record_label TEXT DEFAULT '';
</sql>
</revision>
</schema>
2 changes: 1 addition & 1 deletion src/database/mixxxdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
const QString MixxxDb::kDefaultSchemaFile(":/schema.xml");

//static
const int MixxxDb::kRequiredSchemaVersion = 40;
const int MixxxDb::kRequiredSchemaVersion = 41;

namespace {

Expand Down
3 changes: 3 additions & 0 deletions src/library/basetrackcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ QVariant BaseTrackCache::getTrackValueForColumn(TrackPointer pTrack,
if (fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ALBUMARTIST) == column) {
return QVariant{pTrack->getAlbumArtist()};
}
if (fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RECORDLABEL) == column) {
return QVariant{pTrack->getRecordLabel()};
}
if (fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_YEAR) == column) {
return QVariant{pTrack->getYear()};
}
Expand Down
1 change: 1 addition & 0 deletions src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ QList<int> BaseTrackTableModel::pasteTracks(const QModelIndex& insertionIndex) {
bool BaseTrackTableModel::isColumnHiddenByDefault(
int column) {
return column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_ALBUMARTIST) ||
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RECORDLABEL) ||
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BPM_LOCK) ||
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_BITRATE) ||
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_CHANNELS) ||
Expand Down
4 changes: 4 additions & 0 deletions src/library/columncache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ constexpr ColumnProperties kColumnPropertiesByEnum[] = {
DI(ColumnCache::COLUMN_LIBRARYTABLE_ALBUMARTIST){&LIBRARYTABLE_ALBUMARTIST,
QT_TRANSLATE_NOOP("BaseTrackTableModel", "Album Artist"),
kDefaultColumnWidth * 4},
DI(ColumnCache::COLUMN_LIBRARYTABLE_RECORDLABEL){&LIBRARYTABLE_RECORDLABEL,
QT_TRANSLATE_NOOP("BaseTrackTableModel", "Record Label"),
kDefaultColumnWidth * 4},
DI(ColumnCache::COLUMN_LIBRARYTABLE_YEAR){&LIBRARYTABLE_YEAR,
QT_TRANSLATE_NOOP("BaseTrackTableModel", "Year"),
kDefaultColumnWidth},
Expand Down Expand Up @@ -234,6 +237,7 @@ void ColumnCache::setColumns(QStringList columns) {
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_TITLE, kSortNoCaseLex);
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_ALBUM, kSortNoCaseLex);
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_ALBUMARTIST, kSortNoCaseLex);
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_RECORDLABEL, kSortNoCaseLex);
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_YEAR, kSortNoCase);
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_GENRE, kSortNoCaseLex);
insertColumnSortByEnum(COLUMN_LIBRARYTABLE_COMPOSER, kSortNoCaseLex);
Expand Down
1 change: 1 addition & 0 deletions src/library/columncache.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ColumnCache : public QObject {
COLUMN_LIBRARYTABLE_TITLE,
COLUMN_LIBRARYTABLE_ALBUM,
COLUMN_LIBRARYTABLE_ALBUMARTIST,
COLUMN_LIBRARYTABLE_RECORDLABEL,
COLUMN_LIBRARYTABLE_YEAR,
COLUMN_LIBRARYTABLE_GENRE,
COLUMN_LIBRARYTABLE_COMPOSER,
Expand Down
10 changes: 10 additions & 0 deletions src/library/dao/trackdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ void TrackDAO::addTracksPrepare() {
"title,"
"album,"
"album_artist,"
"record_label,"
"year,"
"genre,"
"tracknumber,"
Expand Down Expand Up @@ -491,6 +492,7 @@ void TrackDAO::addTracksPrepare() {
":title,"
":album,"
":album_artist,"
":record_label,"
":year,"
":genre,"
":tracknumber,"
Expand Down Expand Up @@ -597,6 +599,7 @@ void bindTrackLibraryValues(
pTrackLibraryQuery->bindValue(":title", trackInfo.getTitle());
pTrackLibraryQuery->bindValue(":album", albumInfo.getTitle());
pTrackLibraryQuery->bindValue(":album_artist", albumInfo.getArtist());
pTrackLibraryQuery->bindValue(":record_label",albumInfo.getRecordLabel());
pTrackLibraryQuery->bindValue(":year", trackInfo.getYear());
pTrackLibraryQuery->bindValue(":genre", trackInfo.getGenre());
pTrackLibraryQuery->bindValue(":composer", trackInfo.getComposer());
Expand Down Expand Up @@ -1174,6 +1177,10 @@ void setTrackAlbumArtist(const QSqlRecord& record, const int column, Track* pTra
pTrack->setAlbumArtist(record.value(column).toString());
}

void setTrackRecordLabel(const QSqlRecord& record, const int column, Track* pTrack) {
pTrack->setRecordLabel(record.value(column).toString());
}

void setTrackYear(const QSqlRecord& record, const int column, Track* pTrack) {
pTrack->setYear(record.value(column).toString());
}
Expand Down Expand Up @@ -1391,6 +1398,7 @@ TrackPointer TrackDAO::getTrackById(TrackId trackId) const {
{"title", setTrackTitle},
{"album", setTrackAlbum},
{"album_artist", setTrackAlbumArtist},
{"record_label", setTrackRecordLabel},
{"year", setTrackYear},
{"genre", setTrackGenre},
{"composer", setTrackComposer},
Expand Down Expand Up @@ -1686,6 +1694,7 @@ bool TrackDAO::updateTrack(const Track& track) const {
<< trackId
<< track.getLocation();


SqlTransaction transaction(m_database);
// PerformanceTimer time;
// time.start();
Expand All @@ -1699,6 +1708,7 @@ bool TrackDAO::updateTrack(const Track& track) const {
"title=:title,"
"album=:album,"
"album_artist=:album_artist,"
"record_label=:record_label,"
"year=:year,"
"genre=:genre,"
"composer=:composer,"
Expand Down
1 change: 1 addition & 0 deletions src/library/dao/trackschema.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const QString LIBRARYTABLE_ARTIST = QStringLiteral("artist");
const QString LIBRARYTABLE_TITLE = QStringLiteral("title");
const QString LIBRARYTABLE_ALBUM = QStringLiteral("album");
const QString LIBRARYTABLE_ALBUMARTIST = QStringLiteral("album_artist");
const QString LIBRARYTABLE_RECORDLABEL = QStringLiteral("record_label");
const QString LIBRARYTABLE_YEAR = QStringLiteral("year");
const QString LIBRARYTABLE_GENRE = QStringLiteral("genre");
const QString LIBRARYTABLE_COMPOSER = QStringLiteral("composer");
Expand Down
21 changes: 21 additions & 0 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void DlgTrackInfo::init() {
m_propertyWidgets.insert("titleInfo", txtTitle);
m_propertyWidgets.insert("album", txtAlbum);
m_propertyWidgets.insert("album_artist", txtAlbumArtist);
m_propertyWidgets.insert("record_label", txtRecordLabel);
m_propertyWidgets.insert("composer", txtComposer);
m_propertyWidgets.insert("genre", txtGenre);
m_propertyWidgets.insert("year", txtYear);
Expand Down Expand Up @@ -224,6 +225,19 @@ void DlgTrackInfo::init() {
m_trackRecord.refMetadata().refAlbumInfo().setArtist(
txtAlbumArtist->text());
});
connect(txtRecordLabel,
&QLineEdit::editingFinished,
this,
[this]() {
txtRecordLabel->setText(
txtRecordLabel->text().trimmed());

m_trackRecord
.refMetadata()
.refAlbumInfo()
.setRecordLabel(
txtRecordLabel->text());
});
connect(txtGenre,
&QLineEdit::editingFinished,
this,
Expand Down Expand Up @@ -636,6 +650,7 @@ void DlgTrackInfo::trackColorDialogSetColor(const mixxx::RgbColor::optional_t& n
}

void DlgTrackInfo::saveTrack() {
qDebug() << "DlgTrackInfo::saveTrack() called";
if (!m_pLoadedTrack) {
return;
}
Expand All @@ -657,6 +672,12 @@ void DlgTrackInfo::saveTrack() {
// updated by the editingFinished signal.
m_trackRecord.refMetadata().refTrackInfo().setComment(txtComment->toPlainText());

m_trackRecord
.refMetadata()
.refAlbumInfo()
.setRecordLabel(
txtRecordLabel->text().trimmed());

// First, disconnect the track changed signal. Otherwise we signal ourselves
// and repopulate all these fields.
const QSignalBlocker signalBlocker(this);
Expand Down
Loading