VCS: Generalize selections preserving on model refresh

Default implementation is between O(n) (for identical models) to
O(n*m) (for disjoint models). If sort order is known, this
can be reduced to O(n+m), like in Git implementation.

Change-Id: I44662a22961311cb882601d20efa9d445f74748b
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Orgad Shaneh
2013-01-02 23:21:30 +02:00
committed by hjk
parent 01084aaa38
commit 2396f34fda
4 changed files with 62 additions and 25 deletions

View File

@@ -479,6 +479,11 @@ QStringList VcsBaseSubmitEditor::checkedFiles() const
void VcsBaseSubmitEditor::setFileModel(SubmitFileModel *m, const QString &repositoryDirectory)
{
Q_ASSERT(m);
if (SubmitFileModel *oldModel = d->m_widget->fileModel()) {
m->updateSelections(oldModel);
delete oldModel;
}
d->m_widget->setFileModel(m);
QSet<QString> uniqueSymbols;