Browse Source

qt: update local cache "a priori" on user interaction in playlist model

pull/134/head
Pierre Lamot 4 years ago
committed by Jean-Baptiste Kempf
parent
commit
35de0a01f5
  1. 9
      modules/gui/qt/medialibrary/mlplaylistmodel.cpp

9
modules/gui/qt/medialibrary/mlplaylistmodel.cpp

@ -137,10 +137,9 @@ void MLPlaylistModel::moveImpl(int64_t playlistId, HighLowRanges&& ranges)
},
//UI thread
[this, playlistId, high, low, r = std::move(ranges)](quint64, Ctx& ctx) mutable {
beginMoveRows(QModelIndex(), low, high, QModelIndex(), r.lowTo);
moveRangeInCache(low, high, r.lowTo);
r.lowTo = ctx.newTo;
--r.lowRangeIt;
endMoveRows();
moveImpl(playlistId, std::move(r));
});
}
@ -162,10 +161,9 @@ void MLPlaylistModel::moveImpl(int64_t playlistId, HighLowRanges&& ranges)
},
//UI thread
[this, playlistId, low, high, r = std::move(ranges)](quint64, Ctx& ctx) mutable {
beginMoveRows(QModelIndex(), low, high, QModelIndex(), r.highTo);
moveRangeInCache(low, high, r.highTo);
r.highTo = ctx.newTo;
++r.highRangeIt;
endMoveRows();
moveImpl(playlistId, std::move(r));
});
}
@ -263,8 +261,7 @@ void MLPlaylistModel::removeImpl(int64_t playlistId, const std::vector<std::pair
},
//UI thread
[this, playlistId, range, rows = std::move(rangeList), index]() {
beginRemoveRows(QModelIndex(), range.first, range.second);
endRemoveRows();
deleteRangeInCache(range.first, range.second);
removeImpl(playlistId, std::move(rows), index+1);
});
}

Loading…
Cancel
Save