Commit 2b2b06a6 authored by Andre Hartmann's avatar Andre Hartmann Committed by André Hartmann

SVN: Avoid uncessesary QString creations.

Commmits a5b7ba58
and a5720ca8
remove some QLatinString uses.

As the subversion status strings only contains
Latin1 characters, the comparisons can be speed
up by restricting to Latin1, instead using
fromUtf8() as would be done otherwise.

Change-Id: I734691bda6f5a1214ec6b15fe6d7ed4b028fbc1e
Reviewed-by: default avatarHugues Delorme <delorme.hugues@fougue.pro>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 44b0ca47
...@@ -145,11 +145,12 @@ StatusList parseStatusOutput(const QString &output) ...@@ -145,11 +145,12 @@ StatusList parseStatusOutput(const QString &output)
foreach (const QString &l, list) { foreach (const QString &l, list) {
const QString line =l.trimmed(); const QString line =l.trimmed();
if (line.size() > 8) { if (line.size() > 8) {
const QString state = line.left(1); const QByteArray state = line.left(1).toLatin1();
if (state == FileAddedC || state == FileConflictedC if (state == FileAddedC || state == FileConflictedC
|| state == FileDeletedC || state == FileModifiedC) { || state == FileDeletedC || state == FileModifiedC) {
const QString fileName = line.mid(7); // Column 8 starting from svn 1.6 const QString fileName = line.mid(7); // Column 8 starting from svn 1.6
changeSet.push_back(SubversionSubmitEditor::StatusFilePair(QString(state), fileName.trimmed())); changeSet.push_back(SubversionSubmitEditor::StatusFilePair(QLatin1String(state),
fileName.trimmed()));
} }
} }
......
...@@ -48,20 +48,23 @@ void SubversionSubmitEditor::setStatusList(const QList<StatusFilePair> &statusOu ...@@ -48,20 +48,23 @@ void SubversionSubmitEditor::setStatusList(const QList<StatusFilePair> &statusOu
model->setFileStatusQualifier([](const QString &status, const QVariant &) model->setFileStatusQualifier([](const QString &status, const QVariant &)
-> VcsBase::SubmitFileModel::FileStatusHint -> VcsBase::SubmitFileModel::FileStatusHint
{ {
if (status == FileConflictedC) const QByteArray statusC = status.toLatin1();
if (statusC == FileConflictedC)
return VcsBase::SubmitFileModel::FileUnmerged; return VcsBase::SubmitFileModel::FileUnmerged;
if (status == FileAddedC) if (statusC == FileAddedC)
return VcsBase::SubmitFileModel::FileAdded; return VcsBase::SubmitFileModel::FileAdded;
if (status == FileModifiedC) if (statusC == FileModifiedC)
return VcsBase::SubmitFileModel::FileModified; return VcsBase::SubmitFileModel::FileModified;
if (status == FileDeletedC) if (statusC == FileDeletedC)
return VcsBase::SubmitFileModel::FileDeleted; return VcsBase::SubmitFileModel::FileDeleted;
return VcsBase::SubmitFileModel::FileStatusUnknown; return VcsBase::SubmitFileModel::FileStatusUnknown;
} ); } );
for (const StatusFilePair &pair : statusOutput) { for (const StatusFilePair &pair : statusOutput) {
const VcsBase::CheckMode checkMode = const VcsBase::CheckMode checkMode =
(pair.first == FileConflictedC) ? VcsBase::Uncheckable : VcsBase::Unchecked; (pair.first == QLatin1String(FileConflictedC))
? VcsBase::Uncheckable
: VcsBase::Unchecked;
model->addFile(pair.second, pair.first, checkMode); model->addFile(pair.second, pair.first, checkMode);
} }
setFileModel(model); setFileModel(model);
......
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