diff --git a/mixxx/res/schema.xml b/mixxx/res/schema.xml
index 9dd9fdc617b..16f3965eff9 100644
--- a/mixxx/res/schema.xml
+++ b/mixxx/res/schema.xml
@@ -338,4 +338,13 @@ METADATA
ALTER TABLE Library ADD COLUMN keys_sub_version TEXT;
+
+
+ Add name_displayed column to playlists table.
+
+
+ ALTER TABLE Playlists ADD COLUMN name_displayed varchar(48);
+ ALTER TABLE Crates ADD COLUMN name_displayed varchar(48);
+
+
diff --git a/mixxx/src/library/autodjfeature.cpp b/mixxx/src/library/autodjfeature.cpp
index 59c6324e875..70ee08f5d0d 100644
--- a/mixxx/src/library/autodjfeature.cpp
+++ b/mixxx/src/library/autodjfeature.cpp
@@ -32,9 +32,8 @@ AutoDJFeature::~AutoDJFeature() {
QVariant AutoDJFeature::title() {
int autoDJId = m_playlistDao.getPlaylistIdFromName(AUTODJ_TABLE);
- QString title = m_playlistDao.getPlaylistName(autoDJId);
+ QString title = m_playlistDao.getPlaylistNameDisplayed(autoDJId);
return title;
- //return tr("Auto DJ");
}
QIcon AutoDJFeature::getIcon() {
diff --git a/mixxx/src/library/baseexternallibraryfeature.cpp b/mixxx/src/library/baseexternallibraryfeature.cpp
index ceb8aeccf85..9068594d728 100644
--- a/mixxx/src/library/baseexternallibraryfeature.cpp
+++ b/mixxx/src/library/baseexternallibraryfeature.cpp
@@ -121,7 +121,8 @@ void BaseExternalLibraryFeature::slotImportAsMixxxPlaylist() {
pPlaylistModelToAdd->select();
PlaylistDAO& playlistDao = m_pTrackCollection->getPlaylistDAO();
- int playlistId = playlistDao.getPlaylistIdFromName(playlist);
+ //int playlistId = playlistDao.getPlaylistIdFromName(playlist);
+ int playlistId = playlistDao.getPlaylistIdFromNameDisplayed(playlist);
int i = 1;
if (playlistId != -1) {
@@ -129,7 +130,8 @@ void BaseExternalLibraryFeature::slotImportAsMixxxPlaylist() {
playlist += "(%1)";
while (playlistId != -1) {
i++;
- playlistId = playlistDao.getPlaylistIdFromName(playlist.arg(i));
+ //playlistId = playlistDao.getPlaylistIdFromName(playlist.arg(i));
+ playlistId = playlistDao.getPlaylistIdFromNameDisplayed(playlist.arg(i));
}
playlist = playlist.arg(i);
}
diff --git a/mixxx/src/library/baseplaylistfeature.cpp b/mixxx/src/library/baseplaylistfeature.cpp
index 9436369b034..65f5b8d1aa0 100644
--- a/mixxx/src/library/baseplaylistfeature.cpp
+++ b/mixxx/src/library/baseplaylistfeature.cpp
@@ -96,7 +96,9 @@ void BasePlaylistFeature::activateChild(const QModelIndex& index) {
// Switch the playlist table model's playlist.
QString playlistName = index.data().toString();
- int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+
+ //int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ int playlistId = m_playlistDao.getPlaylistIdFromNameDisplayed(playlistName);
if (m_pPlaylistTableModel) {
m_pPlaylistTableModel->setTableModel(playlistId);
emit(showTrackModel(m_pPlaylistTableModel));
@@ -105,7 +107,10 @@ void BasePlaylistFeature::activateChild(const QModelIndex& index) {
void BasePlaylistFeature::slotRenamePlaylist() {
QString oldName = m_lastRightClickedIndex.data().toString();
- int playlistId = m_playlistDao.getPlaylistIdFromName(oldName);
+
+ //int playlistId = m_playlistDao.getPlaylistIdFromName(oldName);
+ int playlistId = m_playlistDao.getPlaylistIdFromNameDisplayed(oldName);
+
bool locked = m_playlistDao.isPlaylistLocked(playlistId);
if (locked) {
@@ -152,8 +157,8 @@ void BasePlaylistFeature::slotRenamePlaylist() {
void BasePlaylistFeature::slotDuplicatePlaylist() {
QString oldName = m_lastRightClickedIndex.data().toString();
- int oldPlaylistId = m_playlistDao.getPlaylistIdFromName(oldName);
-
+ //int oldPlaylistId = m_playlistDao.getPlaylistIdFromName(oldName);
+ int oldPlaylistId = m_playlistDao.getPlaylistIdFromNameDisplayed(oldName);
QString name;
bool validNameGiven = false;
@@ -199,7 +204,9 @@ void BasePlaylistFeature::slotDuplicatePlaylist() {
void BasePlaylistFeature::slotTogglePlaylistLock() {
QString playlistName = m_lastRightClickedIndex.data().toString();
- int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ //int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ int playlistId = m_playlistDao.getPlaylistIdFromNameDisplayed(playlistName);
+
bool locked = !m_playlistDao.isPlaylistLocked(playlistId);
if (!m_playlistDao.setPlaylistLocked(playlistId, locked)) {
@@ -259,7 +266,9 @@ void BasePlaylistFeature::slotCreatePlaylist() {
void BasePlaylistFeature::slotDeletePlaylist() {
//qDebug() << "slotDeletePlaylist() row:" << m_lastRightClickedIndex.data();
- int playlistId = m_playlistDao.getPlaylistIdFromName(m_lastRightClickedIndex.data().toString());
+
+ //int playlistId = m_playlistDao.getPlaylistIdFromName(m_lastRightClickedIndex.data().toString());
+ int playlistId = m_playlistDao.getPlaylistIdFromNameDisplayed(m_lastRightClickedIndex.data().toString());
bool locked = m_playlistDao.isPlaylistLocked(playlistId);
if (locked) {
@@ -400,7 +409,8 @@ void BasePlaylistFeature::addToAutoDJ(bool bTop) {
//qDebug() << "slotAddToAutoDJ() row:" << m_lastRightClickedIndex.data();
if (m_lastRightClickedIndex.isValid()) {
- int playlistId = m_playlistDao.getPlaylistIdFromName(
+ //int playlistId = m_playlistDao.getPlaylistIdFromName(
+ int playlistId = m_playlistDao.getPlaylistIdFromNameDisplayed(
m_lastRightClickedIndex.data().toString());
if (playlistId >= 0) {
// Insert this playlist
diff --git a/mixxx/src/library/cratefeature.cpp b/mixxx/src/library/cratefeature.cpp
index efcb80d6c5f..1e79d771989 100644
--- a/mixxx/src/library/cratefeature.cpp
+++ b/mixxx/src/library/cratefeature.cpp
@@ -96,7 +96,8 @@ QIcon CrateFeature::getIcon() {
bool CrateFeature::dropAcceptChild(const QModelIndex& index, QList urls,
QWidget *pSource) {
QString crateName = index.data().toString();
- int crateId = m_crateDao.getCrateIdByName(crateName);
+ //int crateId = m_crateDao.getCrateIdByName(crateName);
+ int crateId = m_crateDao.getCrateIdByNameDisplayed(crateName);
QList files;
foreach (QUrl url, urls) {
//XXX: See the comment in PlaylistFeature::dropAcceptChild() about
@@ -126,7 +127,8 @@ bool CrateFeature::dropAcceptChild(const QModelIndex& index, QList urls,
bool CrateFeature::dragMoveAcceptChild(const QModelIndex& index, QUrl url) {
//TODO: Filter by supported formats regex and reject anything that doesn't match.
QString crateName = index.data().toString();
- int crateId = m_crateDao.getCrateIdByName(crateName);
+ //int crateId = m_crateDao.getCrateIdByName(crateName);
+ int crateId = m_crateDao.getCrateIdByNameDisplayed(crateName);
bool locked = m_crateDao.isCrateLocked(crateId);
QFileInfo file(url.toLocalFile());
@@ -159,7 +161,8 @@ void CrateFeature::activateChild(const QModelIndex& index) {
if (!index.isValid())
return;
QString crateName = index.data().toString();
- int crateId = m_crateDao.getCrateIdByName(crateName);
+ //int crateId = m_crateDao.getCrateIdByName(crateName);
+ int crateId = m_crateDao.getCrateIdByNameDisplayed(crateName);
m_crateTableModel.setTableModel(crateId);
emit(showTrackModel(&m_crateTableModel));
}
@@ -176,7 +179,8 @@ void CrateFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index)
m_lastRightClickedIndex = index;
QString crateName = index.data().toString();
- int crateId = m_crateDao.getCrateIdByName(crateName);
+ //int crateId = m_crateDao.getCrateIdByName(crateName);
+ int crateId = m_crateDao.getCrateIdByNameDisplayed(crateName);
bool locked = m_crateDao.isCrateLocked(crateId);
@@ -248,7 +252,8 @@ void CrateFeature::slotCreateCrate() {
void CrateFeature::slotDeleteCrate() {
QString crateName = m_lastRightClickedIndex.data().toString();
- int crateId = m_crateDao.getCrateIdByName(crateName);
+ //int crateId = m_crateDao.getCrateIdByName(crateName);
+ int crateId = m_crateDao.getCrateIdByNameDisplayed(crateName);
bool locked = m_crateDao.isCrateLocked(crateId);
if (locked) {
@@ -267,7 +272,8 @@ void CrateFeature::slotDeleteCrate() {
void CrateFeature::slotRenameCrate() {
QString oldName = m_lastRightClickedIndex.data().toString();
- int crateId = m_crateDao.getCrateIdByName(oldName);
+ //int crateId = m_crateDao.getCrateIdByName(oldName);
+ int crateId = m_crateDao.getCrateIdByNameDisplayed(oldName);
bool locked = m_crateDao.isCrateLocked(crateId);
if (locked) {
@@ -316,7 +322,8 @@ void CrateFeature::slotRenameCrate() {
void CrateFeature::slotDuplicateCrate() {
QString oldName = m_lastRightClickedIndex.data().toString();
- int oldCrateId = m_crateDao.getCrateIdByName(oldName);
+ //int oldCrateId = m_crateDao.getCrateIdByName(oldName);
+ int oldCrateId = m_crateDao.getCrateIdByNameDisplayed(oldName);
QString name;
bool validNameGiven = false;
@@ -370,7 +377,8 @@ void CrateFeature::slotDuplicateCrate() {
void CrateFeature::slotToggleCrateLock()
{
QString crateName = m_lastRightClickedIndex.data().toString();
- int crateId = m_crateDao.getCrateIdByName(crateName);
+ //int crateId = m_crateDao.getCrateIdByName(crateName);
+ int crateId = m_crateDao.getCrateIdByNameDisplayed(crateName);
bool locked = !m_crateDao.isCrateLocked(crateId);
if (!m_crateDao.setCrateLocked(crateId, locked)) {
@@ -389,7 +397,7 @@ void CrateFeature::buildCrateList() {
while (crateListTableModel.canFetchMore()) {
crateListTableModel.fetchMore();
}
- int nameColumn = crateListTableModel.record().indexOf("name");
+ int nameColumn = crateListTableModel.record().indexOf("name_displayed");
int idColumn = crateListTableModel.record().indexOf("id");
for (int row = 0; row < crateListTableModel.rowCount(); ++row) {
diff --git a/mixxx/src/library/dao/cratedao.cpp b/mixxx/src/library/dao/cratedao.cpp
index 990462e6285..9e2099424fd 100644
--- a/mixxx/src/library/dao/cratedao.cpp
+++ b/mixxx/src/library/dao/cratedao.cpp
@@ -34,8 +34,9 @@ unsigned int CrateDAO::crateCount() {
int CrateDAO::createCrate(const QString& name) {
QSqlQuery query(m_database);
- query.prepare("INSERT INTO " CRATE_TABLE " (name) VALUES (:name)");
+ query.prepare("INSERT INTO " CRATE_TABLE " (name, name_displayed) VALUES (:name, :name_displayed)");
query.bindValue(":name", name);
+ query.bindValue(":name_displayed", name);
if (!query.exec()) {
LOG_FAILED_QUERY(query);
@@ -120,48 +121,36 @@ bool CrateDAO::deleteCrate(int crateId) {
return true;
}
-//int CrateDAO::getCrateIdByName(const QString& name) {
-// QSqlQuery query(m_database);
-// query.prepare("SELECT id FROM " CRATE_TABLE " WHERE name = (:name)");
-// query.bindValue(":name", name);
-// if (query.exec()) {
-// if (query.next()) {
-// int id = query.value(0).toInt();
-// return id;
-// }
-// } else {
-// LOG_FAILED_QUERY(query);
-// }
-// return -1;
-//}
-
int CrateDAO::getCrateIdByName(const QString& name) {
- QString pattern("(.*)\x20(\\(([1-9]\\d*|0)\\))");
- QRegExp rxnum(pattern);
-
QSqlQuery query(m_database);
- query.prepare("SELECT id,name FROM " CRATE_TABLE);
+ query.prepare("SELECT id FROM " CRATE_TABLE " WHERE name = (:name)");
+ query.bindValue(":name", name);
+ if (query.exec()) {
+ if (query.next()) {
+ int id = query.value(0).toInt();
+ return id;
+ }
+ } else {
+ LOG_FAILED_QUERY(query);
+ }
+ return -1;
+}
+int CrateDAO::getCrateIdByNameDisplayed(const QString& name) {
+ QSqlQuery query(m_database);
+ query.prepare("SELECT id FROM " CRATE_TABLE " WHERE name_displayed = (:name)");
+ query.bindValue(":name", name);
if (query.exec()) {
- while (query.next()) {
- int queryID = query.value(0).toInt();
- QString queryName = query.value(1).toString();
-
- if (queryName == name) {
- return queryID;
- } else if (rxnum.exactMatch(queryName)) {
- QString originalName = rxnum.cap(1);
- if (originalName == name) {
- return queryID;
- }
- }
+ if (query.next()) {
+ int id = query.value(0).toInt();
+ return id;
}
- return -1;
} else {
LOG_FAILED_QUERY(query);
}
return -1;
}
+
int CrateDAO::getCrateId(int position) {
QSqlQuery query(m_database);
query.prepare("SELECT id FROM " CRATE_TABLE);
@@ -193,6 +182,19 @@ QString CrateDAO::crateName(int crateId) {
return QString();
}
+QString CrateDAO::crateNameDisplayed(int crateId) {
+ QSqlQuery query(m_database);
+ query.prepare("SELECT name_displayed FROM " CRATE_TABLE " WHERE id = (:id)");
+ query.bindValue(":id", crateId);
+ if (query.exec()) {
+ if (query.next()) {
+ return query.value(0).toString();
+ }
+ } else {
+ LOG_FAILED_QUERY(query);
+ }
+ return QString();
+}
unsigned int CrateDAO::crateSize(int crateId) {
QSqlQuery query(m_database);
query.prepare("SELECT COUNT(*) FROM " CRATE_TRACKS_TABLE " WHERE crate_id = (:id)");
@@ -333,13 +335,10 @@ void CrateDAO::removeTracksFromCrates(QList ids) {
// emit(changed(crateId));
}
void CrateDAO::updateCratesTitleNum() {
- QString pattern("(.*)\x20(\\(([1-9]\\d*|0)\\))");
- QRegExp rxnum(pattern);
m_database.transaction();
QSqlQuery selectQuery(m_database);
- //select crates.name, crates.id,count(*) from crates, crate_tracks
- //where crates.id = crate_tracks.crate_id group by crates.id
+
selectQuery.prepare(" SELECT Crates.name,count(*),Crates.id FROM Crates, Crate_tracks "
" WHERE Crates.id = Crate_tracks.crate_id "
" GROUP BY Crates.id ");
@@ -348,25 +347,15 @@ void CrateDAO::updateCratesTitleNum() {
LOG_FAILED_QUERY(selectQuery);
} else {
while (selectQuery.next()) {
- QString newNameWithNum;
- QString oldName = selectQuery.value(0).toString();
+
+ QString Name = selectQuery.value(0).toString();
QString tracksNum = selectQuery.value(1).toString();
int cratesID = selectQuery.value(2).toInt();
- if (!rxnum.exactMatch(oldName)) {
- //qDebug() << "no:"<(hidden));
+ query.bindValue(":name_displayed", name);// same with name column in default.
if (!query.exec()) {
LOG_FAILED_QUERY(query);
@@ -87,56 +88,58 @@ QString PlaylistDAO::getPlaylistName(int playlistId)
}
return name;
}
+QString PlaylistDAO::getPlaylistNameDisplayed(int playlistId)
+{
+ // qDebug() << "PlaylistDAO::getPlaylistName" << QThread::currentThread() << m_database.connectionName();
+
+ QSqlQuery query(m_database);
+ query.prepare("SELECT name_displayed FROM Playlists "
+ "WHERE id= :id");
+ query.bindValue(":id", playlistId);
-//int PlaylistDAO::getPlaylistIdFromName(QString name) {
-// // qDebug() << "PlaylistDAO::getPlaylistIdFromName" << QThread::currentThread() << m_database.connectionName();
-//
-// QSqlQuery query(m_database);
-// query.prepare("SELECT id FROM Playlists WHERE name = :name");
-// query.bindValue(":name", name);
-// if (query.exec()) {
-// if (query.next()) {
-// return query.value(query.record().indexOf("id")).toInt();
-// }
-// } else {
-// LOG_FAILED_QUERY(query);
-// }
-// return -1;
-//}
+ if (!query.exec()) {
+ LOG_FAILED_QUERY(query);
+ return "";
+ }
+ // Get the name_displayed field
+ QString name = "";
+ while (query.next()) {
+ name = query.value(query.record().indexOf("name_displayed")).toString();
+ }
+ return name;
+}
int PlaylistDAO::getPlaylistIdFromName(QString name) {
- //qDebug() << "PlaylistDAO::getPlaylistIdFromName" << QThread::currentThread() << m_database.connectionName();
- // since now showing the number of the tracks in every playlist is through change the "name" column
- // in "playlists" table, so here we need a regular expression to match.
- QString pattern("(.*)\x20(\\(([1-9]\\d*|0)\\))");
- QRegExp rxnum(pattern);
+ // qDebug() << "PlaylistDAO::getPlaylistIdFromName" << QThread::currentThread() << m_database.connectionName();
QSqlQuery query(m_database);
- query.prepare("SELECT id,name FROM Playlists");
+ query.prepare("SELECT id FROM Playlists WHERE name = :name");
+ query.bindValue(":name", name);
+ if (query.exec()) {
+ if (query.next()) {
+ return query.value(query.record().indexOf("id")).toInt();
+ }
+ } else {
+ LOG_FAILED_QUERY(query);
+ }
+ return -1;
+}
+int PlaylistDAO::getPlaylistIdFromNameDisplayed(QString name) {
+ // qDebug() << "PlaylistDAO::getPlaylistIdFromName" << QThread::currentThread() << m_database.connectionName();
+ QSqlQuery query(m_database);
+ query.prepare("SELECT id FROM Playlists WHERE name_displayed = :name");
+ query.bindValue(":name", name);
if (query.exec()) {
- while (query.next()) {
- int queryID = query.value(0).toInt();
- QString queryName = query.value(1).toString();
-
- //qDebug() << "queryID:" << queryID
- // << "queryName:" << queryName;
-
- if (queryName == name) {
- return queryID;
- } else if (rxnum.exactMatch(queryName)) {
- QString originalName = rxnum.cap(1);
- if (originalName == name) {
- return queryID;
- }
- }
+ if (query.next()) {
+ return query.value(query.record().indexOf("id")).toInt();
}
- return -1;
} else {
LOG_FAILED_QUERY(query);
}
return -1;
}
+
void PlaylistDAO::deletePlaylist(int playlistId)
{
// qDebug() << "PlaylistDAO::deletePlaylist" << QThread::currentThread() << m_database.connectionName();
@@ -714,8 +717,6 @@ int PlaylistDAO::tracksInPlaylist(int playlistId) {
}
void PlaylistDAO::updatePlaylistsTitleNum() {
- QString pattern("(.*)\x20(\\(([1-9]\\d*|0)\\))");
- QRegExp rxnum(pattern);
m_database.transaction();
QSqlQuery selectQuery(m_database);
@@ -728,25 +729,14 @@ void PlaylistDAO::updatePlaylistsTitleNum() {
LOG_FAILED_QUERY(selectQuery);
} else {
while (selectQuery.next()) {
- QString newNameWithNum;
- QString oldName = selectQuery.value(0).toString();
+
+ QString Name = selectQuery.value(0).toString();
QString tracksNum = selectQuery.value(1).toString();
int playlistsID = selectQuery.value(2).toInt();
-
- if (!rxnum.exactMatch(oldName)) {
- //qDebug() << "no:"< urls
QWidget *pSource){
//TODO: Filter by supported formats regex and reject anything that doesn't match.
QString playlistName = index.data().toString();
- int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ //int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ int playlistId = m_playlistDao.getPlaylistIdFromNameDisplayed(playlistName);
//m_playlistDao.appendTrackToPlaylist(url.toLocalFile(), playlistId);
QList files;
foreach (QUrl url, urls) {
@@ -126,7 +128,8 @@ bool PlaylistFeature::dragMoveAcceptChild(const QModelIndex& index, QUrl url) {
//TODO: Filter by supported formats regex and reject anything that doesn't match.
QString playlistName = index.data().toString();
- int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ //int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ int playlistId = m_playlistDao.getPlaylistIdFromNameDisplayed(playlistName);
bool locked = m_playlistDao.isPlaylistLocked(playlistId);
QFileInfo file(url.toLocalFile());
@@ -146,7 +149,7 @@ void PlaylistFeature::buildPlaylistList() {
while (playlistTableModel.canFetchMore()) {
playlistTableModel.fetchMore();
}
- int nameColumn = playlistTableModel.record().indexOf("name");
+ int nameColumn = playlistTableModel.record().indexOf("name_displayed");
int idColumn = playlistTableModel.record().indexOf("id");
for (int row = 0; row < playlistTableModel.rowCount(); ++row) {
diff --git a/mixxx/src/library/setlogfeature.cpp b/mixxx/src/library/setlogfeature.cpp
index 69a78ce2e8e..43626d569f9 100644
--- a/mixxx/src/library/setlogfeature.cpp
+++ b/mixxx/src/library/setlogfeature.cpp
@@ -94,7 +94,8 @@ void SetlogFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index
//Save the model index so we can get it in the action slots...
m_lastRightClickedIndex = index;
QString playlistName = index.data().toString();
- int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ //int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
+ int playlistId = m_playlistDao.getPlaylistIdFromNameDisplayed(playlistName);
bool locked = m_playlistDao.isPlaylistLocked(playlistId);
@@ -164,7 +165,8 @@ void SetlogFeature::slotJoinWithPrevious() {
//qDebug() << "slotJoinWithPrevious() row:" << m_lastRightClickedIndex.data();
if (m_lastRightClickedIndex.isValid()) {
- int currentPlaylistId = m_playlistDao.getPlaylistIdFromName(
+ //int currentPlaylistId = m_playlistDao.getPlaylistIdFromName(
+ int currentPlaylistId = m_playlistDao.getPlaylistIdFromNameDisplayed(
m_lastRightClickedIndex.data().toString());
if (currentPlaylistId >= 0) {
diff --git a/mixxx/src/library/trackcollection.cpp b/mixxx/src/library/trackcollection.cpp
index 25c8cd95677..18bf68e7eb9 100644
--- a/mixxx/src/library/trackcollection.cpp
+++ b/mixxx/src/library/trackcollection.cpp
@@ -72,7 +72,7 @@ bool TrackCollection::checkForTables() {
return false;
}
- int requiredSchemaVersion = 18;
+ int requiredSchemaVersion = 19;
QString schemaFilename = m_pConfig->getResourcePath();
schemaFilename.append("schema.xml");
QString okToExit = tr("Click OK to exit.");
diff --git a/mixxx/src/widget/wpreparecratestableview.cpp b/mixxx/src/widget/wpreparecratestableview.cpp
index 02f9b8760c9..6e36b754ac3 100644
--- a/mixxx/src/widget/wpreparecratestableview.cpp
+++ b/mixxx/src/widget/wpreparecratestableview.cpp
@@ -87,7 +87,8 @@ void WPrepareCratesTableView::dropEvent(QDropEvent * event)
{
QModelIndex destIndex = this->indexAt(event->pos());
QString crateName = destIndex.data().toString();
- int crateId = m_pTrackCollection->getCrateDAO().getCrateIdByName(crateName);
+ //int crateId = m_pTrackCollection->getCrateDAO().getCrateIdByName(crateName);
+ int crateId = m_pTrackCollection->getCrateDAO().getCrateIdByNameDisplayed(crateName);
int trackId = m_pTrackCollection->getTrackDAO().getTrackId(url.toLocalFile());
if (trackId >= 0)
m_pTrackCollection->getCrateDAO().addTrackToCrate(trackId, crateId);