GUI: use .clear() for clearing lists

.empty() is just a compatibility function for stdlib and doesn't clear
the list. It's the equivalent of .isEmpty().

This fixes clearing the lists when loading/resetting configs.
This commit is contained in:
Moritz Bunkus 2014-09-14 12:04:16 +02:00
parent 16ffc67210
commit 79b7a3717c
3 changed files with 9 additions and 9 deletions

View File

@ -49,7 +49,7 @@ fixMappings(SourceFile *oldFile,
assert((!!newTrack->m_file == !!oldTrack->m_file) && (!!newTrack->m_appendedTo == !!newTrack->m_appendedTo)); assert((!!newTrack->m_file == !!oldTrack->m_file) && (!!newTrack->m_appendedTo == !!newTrack->m_appendedTo));
newTrack->m_appendedTracks.empty(); newTrack->m_appendedTracks.clear();
for (auto const &oldAppendedTrack : oldTrack->m_appendedTracks) { for (auto const &oldAppendedTrack : oldTrack->m_appendedTracks) {
auto newAppendedTrack = trackMap[oldAppendedTrack]; auto newAppendedTrack = trackMap[oldAppendedTrack];
assert(!!newAppendedTrack); assert(!!newAppendedTrack);
@ -103,9 +103,9 @@ MuxConfig::operator =(MuxConfig const &other) {
m_linkFiles = other.m_linkFiles; m_linkFiles = other.m_linkFiles;
m_webmMode = other.m_webmMode; m_webmMode = other.m_webmMode;
m_files.empty(); m_files.clear();
m_tracks.empty(); m_tracks.clear();
m_attachments.empty(); m_attachments.clear();
for (auto const &attachment : other.m_attachments) for (auto const &attachment : other.m_attachments)
m_attachments << std::make_shared<Attachment>(*attachment); m_attachments << std::make_shared<Attachment>(*attachment);

View File

@ -161,7 +161,7 @@ SelectPlaylistDialog::onScannedFileSelected(QTreeWidgetItem *current,
ui->tracks->insertTopLevelItems(0, newItems); ui->tracks->insertTopLevelItems(0, newItems);
newItems.empty(); newItems.clear();
for (auto const &playlistFile : file.m_playlistFiles) for (auto const &playlistFile : file.m_playlistFiles)
newItems << createPlaylistItemItem(playlistFile); newItems << createPlaylistItemItem(playlistFile);

View File

@ -72,10 +72,10 @@ SourceFile::operator =(SourceFile const &other) {
m_playlistFiles = other.m_playlistFiles; m_playlistFiles = other.m_playlistFiles;
m_appendedTo = nullptr; m_appendedTo = nullptr;
m_tracks.empty(); m_tracks.clear();
m_additionalParts.empty(); m_additionalParts.clear();
m_appendedFiles.empty(); m_appendedFiles.clear();
m_playlistFiles.empty(); m_playlistFiles.clear();
for (auto const &track : other.m_tracks) for (auto const &track : other.m_tracks)
m_tracks << std::make_shared<Track>(*track); m_tracks << std::make_shared<Track>(*track);