Commit cf12bc3a authored by Alexander Stippich's avatar Alexander Stippich
Browse files

remove the musicaudiotrack from databaseinterface

parent 80c7f148
......@@ -22,6 +22,7 @@ target_include_directories(viewManagerTest PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(databaseInterfaceTest_SOURCES
databaseinterfacetest.cpp
databasetestdata.h
../src/musicaudiotrack.cpp
)
ecm_add_test(${databaseInterfaceTest_SOURCES}
......@@ -33,6 +34,7 @@ target_include_directories(databaseInterfaceTest PRIVATE ${CMAKE_SOURCE_DIR}/src
set(managemediaplayercontrolTest_SOURCES
managemediaplayercontroltest.cpp
../src/musicaudiotrack.cpp
../src/elisautils.cpp
)
......@@ -44,6 +46,7 @@ ecm_add_test(${managemediaplayercontrolTest_SOURCES}
set(manageheaderbarTest_SOURCES
manageheaderbartest.cpp
../src/musicaudiotrack.cpp
../src/elisautils.cpp
)
......@@ -69,6 +72,7 @@ target_include_directories(manageaudioplayerTest PRIVATE ${CMAKE_SOURCE_DIR}/src
set(mediaplaylistTest_SOURCES
mediaplaylisttest.cpp
../src/elisautils.cpp
../src/musicaudiotrack.cpp
)
ecm_qt_declare_logging_category(mediaplaylistTest_SOURCES HEADER elisa_debug.h IDENTIFIER lcModelTest CATEGORY_NAME qt.modeltest)
......@@ -84,6 +88,7 @@ target_include_directories(mediaplaylistTest PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(trackslistenertest_SOURCES
trackslistenertest.cpp
../src/elisautils.cpp
../src/musicaudiotrack.cpp
)
ecm_add_test(${trackslistenertest_SOURCES}
......@@ -96,6 +101,7 @@ target_include_directories(trackslistenertest PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(datamodeltest_SOURCES
datamodeltest.cpp
../src/musicaudiotrack.cpp
)
ecm_qt_declare_logging_category(datamodeltest_SOURCES HEADER elisa_debug.h IDENTIFIER lcModelTest CATEGORY_NAME qt.modeltest)
......@@ -110,6 +116,7 @@ target_include_directories(datamodeltest PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(trackmetadatamodeltest_SOURCES
trackmetadatamodeltest.cpp
../src/musicaudiotrack.cpp
)
ecm_qt_declare_logging_category(trackmetadatamodeltest_SOURCES HEADER elisa_debug.h IDENTIFIER lcModelTest CATEGORY_NAME qt.modeltest)
......@@ -124,6 +131,7 @@ target_include_directories(trackmetadatamodeltest PRIVATE ${CMAKE_SOURCE_DIR}/sr
set(alltracksproxymodeltest_SOURCES
alltracksproxymodeltest.cpp
../src/musicaudiotrack.cpp
)
ecm_qt_declare_logging_category(alltracksproxymodeltest_SOURCES HEADER elisa_debug.h IDENTIFIER lcModelTest CATEGORY_NAME qt.modeltest)
......@@ -139,6 +147,7 @@ target_include_directories(alltracksproxymodeltest PRIVATE ${CMAKE_SOURCE_DIR}/s
if (KF5FileMetaData_FOUND)
set(localfilelistingtest_SOURCES
localfilelistingtest.cpp
../src/musicaudiotrack.cpp
)
ecm_add_test(${localfilelistingtest_SOURCES}
......
......@@ -91,7 +91,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -155,7 +155,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -227,7 +227,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -246,7 +246,7 @@ private Q_SLOTS:
auto newTracks = QList<MusicAudioTrack>();
newTracks.push_back(newTrack);
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......@@ -301,7 +301,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -329,7 +329,7 @@ private Q_SLOTS:
newFiles2.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(newTracks, newCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), newCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......@@ -378,7 +378,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -396,7 +396,7 @@ private Q_SLOTS:
auto newTracks = QList<MusicAudioTrack>();
newTracks.push_back(newTrack);
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -487,7 +487,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -506,7 +506,7 @@ private Q_SLOTS:
auto newTracks = QList<MusicAudioTrack>();
newTracks.push_back(newTrack);
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......
This diff is collapsed.
......@@ -80,7 +80,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 0);
QCOMPARE(endInsertRowsSpy.count(), 0);
......@@ -147,7 +147,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 0);
QCOMPARE(endInsertRowsSpy.count(), 0);
......@@ -228,7 +228,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 0);
QCOMPARE(endInsertRowsSpy.count(), 0);
......@@ -268,7 +268,7 @@ private Q_SLOTS:
newFiles2.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(albumsModel.rowCount(), 5);
QCOMPARE(beginInsertRowsSpy.count(), 2);
......@@ -296,7 +296,7 @@ private Q_SLOTS:
newFiles3.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(secondNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(secondNewTracks), mNewCovers);
QCOMPARE(albumsModel.rowCount(), 6);
QCOMPARE(beginInsertRowsSpy.count(), 3);
......@@ -344,7 +344,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 0);
QCOMPARE(endInsertRowsSpy.count(), 0);
......@@ -378,7 +378,7 @@ private Q_SLOTS:
QUrl::fromLocalFile(QStringLiteral("album1")), 5, true,
{}, QStringLiteral("composer1"), QStringLiteral("lyricist1"), false};
musicDb.insertTracksList({modifiedTrack}, mNewCovers);
musicDb.insertTracksList({modifiedTrack.toTrackData()}, mNewCovers);
QCOMPARE(albumsModel.rowCount(), 4);
QCOMPARE(beginInsertRowsSpy.count(), 1);
......@@ -429,7 +429,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -490,7 +490,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -558,7 +558,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -577,7 +577,7 @@ private Q_SLOTS:
auto newTracks = QList<MusicAudioTrack>();
newTracks.push_back(newTrack);
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......@@ -629,7 +629,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -657,7 +657,7 @@ private Q_SLOTS:
newFiles2.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(newTracks, newCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), newCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......@@ -703,7 +703,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -722,7 +722,7 @@ private Q_SLOTS:
auto newTracks = QList<MusicAudioTrack>();
newTracks.push_back(newTrack);
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -807,7 +807,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -827,7 +827,7 @@ private Q_SLOTS:
auto newTracks = QList<MusicAudioTrack>();
newTracks.push_back(newTrack);
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......@@ -873,7 +873,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(albumsModel.rowCount(), 5);
QCOMPARE(beginInsertRowsSpy.count(), 1);
......@@ -934,7 +934,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(albumsModel.rowCount(), 5);
QCOMPARE(beginInsertRowsSpy.count(), 1);
......@@ -1000,7 +1000,7 @@ private Q_SLOTS:
QCOMPARE(endRemoveRowsSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -1017,7 +1017,7 @@ private Q_SLOTS:
auto newTracks = QList<MusicAudioTrack>();
newTracks.push_back(newTrack);
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -1067,7 +1067,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 1);
QCOMPARE(endInsertRowsSpy.count(), 1);
......@@ -1088,7 +1088,7 @@ private Q_SLOTS:
auto newCovers = QHash<QString, QUrl>();
newCovers[QStringLiteral("album5")] = newCover;
musicDb.insertTracksList(newTracks, newCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), newCovers);
QCOMPARE(beginInsertRowsSpy.count(), 2);
QCOMPARE(endInsertRowsSpy.count(), 2);
......@@ -1133,7 +1133,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(artistsModel.rowCount(), 7);
QCOMPARE(beginInsertRowsSpy.count(), 1);
......@@ -1192,7 +1192,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(artistsModel.rowCount(), 7);
QCOMPARE(beginInsertRowsSpy.count(), 1);
......@@ -1215,7 +1215,7 @@ private Q_SLOTS:
newFiles2.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(artistsModel.rowCount(), 8);
QCOMPARE(beginInsertRowsSpy.count(), 2);
......@@ -1272,7 +1272,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(artistsModel.rowCount(), 1);
QCOMPARE(beginInsertRowsSpy.count(), 1);
......@@ -1331,7 +1331,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(artistsModel.rowCount(), 4);
QCOMPARE(beginInsertRowsSpy.count(), 1);
......@@ -1391,7 +1391,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(artistsModel.rowCount(), 2);
QCOMPARE(beginInsertRowsSpy.count(), 1);
......@@ -1433,7 +1433,7 @@ private Q_SLOTS:
QCOMPARE(modelResetSpy.count(), 0);
QCOMPARE(dataChangedSpy.count(), 0);
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(artistsModel.rowCount(), 0);
QCOMPARE(beginInsertRowsSpy.count(), 0);
......@@ -1482,7 +1482,7 @@ private Q_SLOTS:
newCovers[QStringLiteral("file:///$31")] = QUrl::fromLocalFile(QStringLiteral("album1"));
newCovers[QStringLiteral("file:///$32")] = QUrl::fromLocalFile(QStringLiteral("album3"));
musicDb.insertTracksList(newTracks, newCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), newCovers);
QCOMPARE(artistsModel.rowCount(), 5);
QCOMPARE(beginInsertRowsSpy.count(), 2);
......@@ -1527,7 +1527,7 @@ private Q_SLOTS:
newFiles.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(beginInsertRowsSpy.count(), 0);
QCOMPARE(endInsertRowsSpy.count(), 0);
......@@ -1567,7 +1567,7 @@ private Q_SLOTS:
newFiles2.push_back(oneTrack.resourceURI());
}
musicDb.insertTracksList(newTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(newTracks), mNewCovers);
QCOMPARE(albumsModel.rowCount(), 5);
QCOMPARE(beginInsertRowsSpy.count(), 2);
......
......@@ -121,9 +121,9 @@ private Q_SLOTS:
QCOMPARE(removedTracksListSpy.count(), 0);
const auto &firstNewTracksSignal = tracksListSpy.at(0);
auto firstNewTracks = firstNewTracksSignal.at(0).value<QList<MusicAudioTrack>>();
auto firstNewTracks = firstNewTracksSignal.at(0).value<DataTypes::ListTrackDataType>();
const auto &secondNewTracksSignal = tracksListSpy.at(1);
auto secondNewTracks = secondNewTracksSignal.at(0).value<QList<MusicAudioTrack>>();
auto secondNewTracks = secondNewTracksSignal.at(0).value<DataTypes::ListTrackDataType>();
auto newCovers = secondNewTracksSignal.at(1).value<QHash<QString, QUrl>>();
QCOMPARE(firstNewTracks.count() + secondNewTracks.count(), 5);
......@@ -180,7 +180,7 @@ private Q_SLOTS:
QCOMPARE(removedTracksListSpy.count(), 0);
auto newTracksSignal = tracksListSpy.at(0);
auto newTracks = newTracksSignal.at(0).value<QList<MusicAudioTrack>>();
auto newTracks = newTracksSignal.at(0).value<DataTypes::ListTrackDataType>();
auto newCovers = newTracksSignal.at(1).value<QHash<QString, QUrl>>();
QCOMPARE(newTracks.count(), 1);
......@@ -215,7 +215,7 @@ private Q_SLOTS:
QCOMPARE(removedTracksListSpy.count(), 1);
auto newTracksSignalLast = tracksListSpy.at(1);
auto newTracksLast = newTracksSignalLast.at(0).value<QList<MusicAudioTrack>>();
auto newTracksLast = newTracksSignalLast.at(0).value<DataTypes::ListTrackDataType>();
auto newCoversLast = newTracksSignalLast.at(1).value<QHash<QString, QUrl>>();
QCOMPARE(newTracksLast.count(), 1);
......@@ -274,7 +274,7 @@ private Q_SLOTS:
QCOMPARE(removedTracksListSpy.count(), 0);
auto newTracksSignal = tracksListSpy.at(0);
auto newTracks = newTracksSignal.at(0).value<QList<MusicAudioTrack>>();
auto newTracks = newTracksSignal.at(0).value<DataTypes::ListTrackDataType>();
auto newCovers = newTracksSignal.at(1).value<QHash<QString, QUrl>>();
QCOMPARE(newTracks.count(), 1);
......@@ -309,7 +309,7 @@ private Q_SLOTS:
QCOMPARE(removedTracksListSpy.count(), 1);
auto newTracksSignalLast = tracksListSpy.at(1);
auto newTracksLast = newTracksSignalLast.at(0).value<QList<MusicAudioTrack>>();
auto newTracksLast = newTracksSignalLast.at(0).value<DataTypes::ListTrackDataType>();
auto newCoversLast = newTracksSignalLast.at(1).value<QHash<QString, QUrl>>();
QCOMPARE(newTracksLast.count(), 1);
......@@ -378,7 +378,7 @@ private Q_SLOTS:
QCOMPARE(modifiedTracksListSpy.count(), 0);
auto newTracksSignal = tracksListSpy.at(0);
auto newTracks = newTracksSignal.at(0).value<QList<MusicAudioTrack>>();
auto newTracks = newTracksSignal.at(0).value<DataTypes::ListTrackDataType>();
auto newCovers = newTracksSignal.at(1).value<QHash<QString, QUrl>>();
QCOMPARE(newTracks.count(), 1);
......
This diff is collapsed.
......@@ -82,7 +82,7 @@ private Q_SLOTS:
musicDb.init(QStringLiteral("testDb"), databaseFile.fileName());
musicDb.insertTracksList(mNewTracks, mNewCovers);
musicDb.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
TrackMetadataModel myModel;
QAbstractItemModelTester testModel(&myModel);
......
......@@ -95,7 +95,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -217,7 +217,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -284,7 +284,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -363,7 +363,7 @@ private Q_SLOTS:
QCOMPARE(myPlayList.data(myPlayList.index(0, 0), MediaPlayList::ColumnsRoles::TrackNumberRole).toInt(), -1);
QCOMPARE(myPlayList.data(myPlayList.index(0, 0), MediaPlayList::ColumnsRoles::DiscNumberRole).toInt(), 0);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -417,7 +417,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData(mNewTracks), mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -440,14 +440,14 @@ private Q_SLOTS:
QCOMPARE(myPlayList.data(myPlayList.index(0, 0), MediaPlayList::ColumnsRoles::TrackNumberRole).toInt(), 1);
QCOMPARE(myPlayList.data(myPlayList.index(0, 0), MediaPlayList::ColumnsRoles::DiscNumberRole).toInt(), 1);
myDatabaseContent.insertTracksList({
myDatabaseContent.insertTracksList(MusicAudioTrack::tracksToListData({
{true, QStringLiteral("$1"), QStringLiteral("0"), QStringLiteral("track1"),
QStringLiteral("artist1"), QStringLiteral("album1"), QStringLiteral("Various Artists"),
2, 3, QTime::fromMSecsSinceStartOfDay(1000), {QUrl::fromLocalFile(QStringLiteral("/$1"))},
QDateTime::fromMSecsSinceEpoch(1),
{QUrl::fromLocalFile(QStringLiteral("file://image$1"))}, 1, false,
{}, {}, QStringLiteral("lyricist1"), false}
}, mNewCovers);
}), mNewCovers);
QCOMPARE(trackHasChangedSpy.count(), 2);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......
......@@ -2,7 +2,6 @@ include_directories(${elisa_BINARY_DIR})
set(elisaLib_SOURCES
mediaplaylist.cpp
musicaudiotrack.cpp
progressindicator.cpp
databaseinterface.cpp
datatypes.cpp
......
......@@ -21,7 +21,6 @@
#include "abstractfile/indexercommon.h"
#include "musicaudiotrack.h"
#include "filescanner.h"
#include <QThread>
......@@ -94,7 +93,7 @@ void AbstractFileListing::newTrackFile(const DataTypes::TrackDataType &partialTr
const auto &newTrack = scanOneFile(partialTrack.resourceURI(), scanFileInfo);
if (newTrack.isValid() && newTrack != partialTrack) {
Q_EMIT modifyTracksList({MusicAudioTrack::trackFromData(newTrack)}, d->mAllAlbumCover);
Q_EMIT modifyTracksList({newTrack}, d->mAllAlbumCover);
}
}
......@@ -237,7 +236,7 @@ void AbstractFileListing::scanDirectory(DataTypes::ListTrackDataType &newFiles,
if (newFiles.size() > d->mNewFilesEmitInterval && d->mStopRequest == 0) {
d->mNewFilesEmitInterval = std::min(50, 1 + d->mNewFilesEmitInterval * d->mNewFilesEmitInterval);
emitNewFiles(MusicAudioTrack::trackFromListData(newFiles));
emitNewFiles(newFiles);
newFiles.clear();
}
} else {
......@@ -272,7 +271,7 @@ void AbstractFileListing::fileChanged(const QString &modifiedFileName)
auto modifiedTrack = scanOneFile(modifiedFile, modifiedFileInfo);
if (modifiedTrack.isValid()) {
Q_EMIT modifyTracksList({MusicAudioTrack::trackFromData(modifiedTrack)}, d->mAllAlbumCover);
Q_EMIT modifyTracksList({modifiedTrack}, d->mAllAlbumCover);
}
}
......@@ -375,7 +374,7 @@ void AbstractFileListing::scanDirectoryTree(const QString &path)