File indexing completed on 2024-04-28 04:38:49
0001 /* 0002 SPDX-FileCopyrightText: 2010 Aleix Pol Gonzalez <aleixpol@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #include "gitclonejob.h" 0008 0009 GitCloneJob::GitCloneJob(const QDir& d, KDevelop::IPlugin* parent, OutputJobVerbosity verbosity) 0010 : GitJob(d, parent, verbosity) 0011 , m_steps(0) 0012 { 0013 connect(this, &GitCloneJob::resultsReady, this, &GitCloneJob::processResult); 0014 } 0015 void GitCloneJob::processResult() 0016 { 0017 if (error()) { 0018 QByteArray out = errorOutput(); 0019 if (out.contains('\n')) { 0020 m_steps+=out.count('\n'); 0021 emitPercent(m_steps, 6); //I'm counting 6 lines so it's a way to provide some progress, probably not the best 0022 } 0023 0024 int end = qMax(out.lastIndexOf('\n'), out.lastIndexOf('\r')); 0025 int start = qMax(qMax(out.lastIndexOf('\n', end-1), out.lastIndexOf('\r', end-1)), 0); 0026 0027 const QString info = QString::fromUtf8(out.mid(start+1, end-start-1)); 0028 emit infoMessage(this, info); 0029 } 0030 } 0031 0032 #include "moc_gitclonejob.cpp"