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

Never emit dataChanged signal when inserting new entries

parent 6026c09e
......@@ -635,7 +635,7 @@ void MediaPlayListProxyModelTest::enqueueTrackByUrl()
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(persistentStateChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 1);
......@@ -649,7 +649,7 @@ void MediaPlayListProxyModelTest::enqueueTrackByUrl()
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(persistentStateChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 2);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 1);
......@@ -1482,7 +1482,7 @@ void MediaPlayListProxyModelTest::testSavePersistentState()
QCOMPARE(rowsMovedSpyRead.count(), 0);
QCOMPARE(rowsInsertedSpyRead.count(), 1);
QCOMPARE(persistentStateChangedSpyRead.count(), 2);
QCOMPARE(dataChangedSpyRead.count(), 6);
QCOMPARE(dataChangedSpyRead.count(), 3);
QCOMPARE(myPlayListReadProxyModel.tracksCount(), 3);
......@@ -2731,7 +2731,7 @@ void MediaPlayListProxyModelTest::undoClearPlayListCase()
QCOMPARE(rowsInsertedSpy.count(), 3);
QCOMPARE(tracksCountChangedSpy.count(), 5);
QCOMPARE(persistentStateChangedSpy.count(), 6);
QCOMPARE(dataChangedSpy.count(), 6);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 6);
QCOMPARE(newEntryInListSpy.count(), 1);
QCOMPARE(currentTrackChangedSpy.count(), 4);
......@@ -2969,7 +2969,7 @@ void MediaPlayListProxyModelTest::undoReplacePlayListCase()
QCOMPARE(rowsInsertedSpy.count(), 5);
QCOMPARE(tracksCountChangedSpy.count(), 9);
QCOMPARE(persistentStateChangedSpy.count(), 10);
QCOMPARE(dataChangedSpy.count(), 6);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 6);
QCOMPARE(newEntryInListSpy.count(), 2);
QCOMPARE(currentTrackChangedSpy.count(), 7);
......@@ -6645,7 +6645,7 @@ void MediaPlayListProxyModelTest::enqueueFiles()
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(persistentStateChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
......@@ -6661,7 +6661,7 @@ void MediaPlayListProxyModelTest::enqueueFiles()
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(persistentStateChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 3);
QCOMPARE(dataChangedSpy.count(), 2);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
......@@ -6759,14 +6759,14 @@ void MediaPlayListProxyModelTest::enqueueSampleFiles()
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(persistentStateChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
QCOMPARE(myPlayListProxyModel.rowCount(), 2);
while (dataChangedSpy.count() < 3) {
while (dataChangedSpy.count() < 2) {
QCOMPARE(dataChangedSpy.wait(), true);
}
......@@ -6777,7 +6777,7 @@ void MediaPlayListProxyModelTest::enqueueSampleFiles()
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(persistentStateChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 3);
QCOMPARE(dataChangedSpy.count(), 2);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
......
......@@ -455,7 +455,7 @@ void MediaPlayListTest::enqueueTrackByUrl()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 1);
......@@ -468,7 +468,7 @@ void MediaPlayListTest::enqueueTrackByUrl()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 2);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 1);
......@@ -548,7 +548,7 @@ void MediaPlayListTest::enqueueTracksByUrl()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
......@@ -561,7 +561,7 @@ void MediaPlayListTest::enqueueTracksByUrl()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 3);
QCOMPARE(dataChangedSpy.count(), 2);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
......@@ -637,7 +637,7 @@ void MediaPlayListTest::enqueueFiles()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
......@@ -652,7 +652,7 @@ void MediaPlayListTest::enqueueFiles()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 3);
QCOMPARE(dataChangedSpy.count(), 2);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
......@@ -743,14 +743,14 @@ void MediaPlayListTest::enqueueSampleFiles()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
QCOMPARE(myPlayList.rowCount(), 2);
while (dataChangedSpy.count() < 3) {
while (dataChangedSpy.count() < 2) {
QCOMPARE(dataChangedSpy.wait(), true);
}
......@@ -760,7 +760,7 @@ void MediaPlayListTest::enqueueSampleFiles()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 3);
QCOMPARE(dataChangedSpy.count(), 2);
QCOMPARE(newTrackByNameInListSpy.count(), 0);
QCOMPARE(newEntryInListSpy.count(), 0);
QCOMPARE(newUrlInListSpy.count(), 2);
......@@ -1821,13 +1821,13 @@ void MediaPlayListTest::testHasHeaderWithRestore()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 4);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 4);
QCOMPARE(newEntryInListSpy.count(), 0);
myDatabaseContent.insertTracksList(mNewTracks, mNewCovers);
while (dataChangedSpy.count() < 8) {
while (dataChangedSpy.count() < 4) {
QCOMPARE(dataChangedSpy.wait(), true);
}
......@@ -1837,7 +1837,7 @@ void MediaPlayListTest::testHasHeaderWithRestore()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 8);
QCOMPARE(dataChangedSpy.count(), 4);
QCOMPARE(newTrackByNameInListSpy.count(), 4);
QCOMPARE(newEntryInListSpy.count(), 0);
......@@ -2275,7 +2275,7 @@ void MediaPlayListTest::restoreMultipleIdenticalTracks()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 4);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 4);
QCOMPARE(newEntryInListSpy.count(), 0);
......@@ -2289,7 +2289,7 @@ void MediaPlayListTest::restoreMultipleIdenticalTracks()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 8);
QCOMPARE(dataChangedSpy.count(), 4);
QCOMPARE(newTrackByNameInListSpy.count(), 4);
QCOMPARE(newEntryInListSpy.count(), 0);
......@@ -2421,7 +2421,7 @@ void MediaPlayListTest::restoreTrackWithoutAlbum()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 0);
QCOMPARE(newTrackByNameInListSpy.count(), 1);
QCOMPARE(newEntryInListSpy.count(), 0);
......@@ -2433,7 +2433,7 @@ void MediaPlayListTest::restoreTrackWithoutAlbum()
QCOMPARE(rowsRemovedSpy.count(), 0);
QCOMPARE(rowsMovedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 1);
QCOMPARE(dataChangedSpy.count(), 2);
QCOMPARE(dataChangedSpy.count(), 1);
QCOMPARE(newTrackByNameInListSpy.count(), 1);
QCOMPARE(newEntryInListSpy.count(), 0);
......
......@@ -342,10 +342,6 @@ void MediaPlayList::enqueueRestoredEntries(const QVariantList &newEntries)
} else {
Q_EMIT newEntryInList(newEntry.mId, {}, ElisaUtils::Track);
}
if (!newEntry.mIsValid) {
Q_EMIT dataChanged(index(rowCount() - 1, 0), index(rowCount() - 1, 0), {MediaPlayList::IsPlayingRole});
}
}
endInsertRows();
}
......@@ -395,8 +391,6 @@ void MediaPlayList::enqueueFilesList(const ElisaUtils::EntryDataList &newEntries
}
}
endInsertRows();
Q_EMIT dataChanged(index(rowCount() - 1, 0), index(rowCount() - 1, 0), {MediaPlayList::IsPlayingRole});
}
void MediaPlayList::enqueueTracksListById(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType type)
......@@ -411,8 +405,6 @@ void MediaPlayList::enqueueTracksListById(const ElisaUtils::EntryDataList &newEn
Q_EMIT newEntryInList(newMediaPlayListEntry.mId, newMediaPlayListEntry.mTitle.toString(), newMediaPlayListEntry.mEntryType);
}
endInsertRows();
Q_EMIT dataChanged(index(rowCount() - 1, 0), index(rowCount() - 1, 0), {MediaPlayList::IsPlayingRole});
}
void MediaPlayList::enqueueOneEntry(const ElisaUtils::EntryData &entryData, ElisaUtils::PlayListEntryType type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment