mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
Merge pull request #6336 from nextcloud/feature/improve-speed-of-discovery
Allow event processing between each XML parser run, to improve GUI performance.
This commit is contained in:
commit
89d2ec4f51
10 changed files with 24 additions and 15 deletions
|
@ -206,7 +206,7 @@ void EditLocallyJob::fetchRemoteFileParentInfo()
|
|||
return;
|
||||
}
|
||||
|
||||
const auto job = new LsColJob(_accountState->account(), QDir::cleanPath(_folderForFile->remotePathTrailingSlash() + _relPathParent), this);
|
||||
const auto job = new LsColJob(_accountState->account(), QDir::cleanPath(_folderForFile->remotePathTrailingSlash() + _relPathParent));
|
||||
const QList<QByteArray> props{QByteArrayLiteral("resourcetype"),
|
||||
QByteArrayLiteral("getlastmodified"),
|
||||
QByteArrayLiteral("getetag"),
|
||||
|
|
|
@ -614,7 +614,7 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent)
|
|||
path += infoPath;
|
||||
}
|
||||
|
||||
auto *job = new LsColJob(_accountState->account(), path, this);
|
||||
auto *job = new LsColJob(_accountState->account(), path);
|
||||
info->_fetchingJob = job;
|
||||
auto props = QList<QByteArray>() << "resourcetype"
|
||||
<< "http://owncloud.org/ns:size"
|
||||
|
|
|
@ -464,7 +464,7 @@ void FolderWizardRemotePath::slotTypedPathFound(const QStringList &subpaths)
|
|||
|
||||
LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path)
|
||||
{
|
||||
auto *job = new LsColJob(_account, path, this);
|
||||
auto *job = new LsColJob(_account, path);
|
||||
auto props = QList<QByteArray>() << "resourcetype";
|
||||
if (_account->capabilities().clientSideEncryptionAvailable()) {
|
||||
props << "http://nextcloud.org/ns:is-encrypted";
|
||||
|
|
|
@ -107,7 +107,7 @@ void SelectiveSyncWidget::refreshFolders()
|
|||
{
|
||||
_encryptedPaths.clear();
|
||||
|
||||
auto *job = new LsColJob(_account, _folderPath, this);
|
||||
auto *job = new LsColJob(_account, _folderPath);
|
||||
auto props = QList<QByteArray>() << "resourcetype"
|
||||
<< "http://owncloud.org/ns:size";
|
||||
if (_account->capabilities().clientSideEncryptionAvailable()) {
|
||||
|
@ -336,7 +336,7 @@ void SelectiveSyncWidget::slotItemExpanded(QTreeWidgetItem *item)
|
|||
if (!_folderPath.isEmpty()) {
|
||||
prefix = _folderPath + QLatin1Char('/');
|
||||
}
|
||||
auto *job = new LsColJob(_account, prefix + dir, this);
|
||||
auto *job = new LsColJob(_account, prefix + dir);
|
||||
job->setProperties(QList<QByteArray>() << "resourcetype"
|
||||
<< "http://owncloud.org/ns:size");
|
||||
connect(job, &LsColJob::directoryListingSubfolders,
|
||||
|
|
|
@ -168,7 +168,7 @@ void ShellExtensionsServer::processCustomStateRequest(QLocalSocket *socket, cons
|
|||
closeSession(socket);
|
||||
}));
|
||||
|
||||
auto *const lsColJob = new LsColJob(folder->accountState()->account(), QDir::cleanPath(folder->remotePath() + lsColJobPath), this);
|
||||
auto *const lsColJob = new LsColJob(folder->accountState()->account(), QDir::cleanPath(folder->remotePath() + lsColJobPath));
|
||||
lsColJob->setProperties({QByteArrayLiteral("http://owncloud.org/ns:share-types"), QByteArrayLiteral("http://owncloud.org/ns:permissions")});
|
||||
|
||||
const auto folderAlias = customStateRequestInfo.folderAlias;
|
||||
|
|
|
@ -378,7 +378,7 @@ DiscoverySingleDirectoryJob::DiscoverySingleDirectoryJob(const AccountPtr &accou
|
|||
void DiscoverySingleDirectoryJob::start()
|
||||
{
|
||||
// Start the actual HTTP job
|
||||
auto *lsColJob = new LsColJob(_account, _subPath, this);
|
||||
auto *lsColJob = new LsColJob(_account, _subPath);
|
||||
|
||||
QList<QByteArray> props;
|
||||
props << "resourcetype"
|
||||
|
|
|
@ -99,7 +99,7 @@ void EncryptedFolderMetadataHandler::startFetchMetadata()
|
|||
void EncryptedFolderMetadataHandler::fetchFolderEncryptedId()
|
||||
{
|
||||
qCDebug(lcFetchAndUploadE2eeFolderMetadataJob) << "Folder is encrypted, let's get the Id from it.";
|
||||
const auto job = new LsColJob(_account, _folderPath, this);
|
||||
const auto job = new LsColJob(_account, _folderPath);
|
||||
job->setProperties({"resourcetype", "http://owncloud.org/ns:fileid"});
|
||||
connect(job, &LsColJob::directoryListingSubfolders, this, &EncryptedFolderMetadataHandler::slotFolderEncryptedIdReceived);
|
||||
connect(job, &LsColJob::finishedWithError, this, &EncryptedFolderMetadataHandler::slotFolderEncryptedIdError);
|
||||
|
|
|
@ -317,13 +317,13 @@ bool LsColXMLParser::parse(const QByteArray &xml, QHash<QString, ExtraFolderInfo
|
|||
|
||||
/*********************************************************************************************/
|
||||
|
||||
LsColJob::LsColJob(AccountPtr account, const QString &path, QObject *parent)
|
||||
: AbstractNetworkJob(account, path, parent)
|
||||
LsColJob::LsColJob(AccountPtr account, const QString &path)
|
||||
: AbstractNetworkJob(account, path)
|
||||
{
|
||||
}
|
||||
|
||||
LsColJob::LsColJob(AccountPtr account, const QUrl &url, QObject *parent)
|
||||
: AbstractNetworkJob(account, QString(), parent)
|
||||
LsColJob::LsColJob(AccountPtr account, const QUrl &url)
|
||||
: AbstractNetworkJob(account, QString())
|
||||
, _url(url)
|
||||
{
|
||||
}
|
||||
|
@ -404,6 +404,13 @@ bool LsColJob::finished()
|
|||
connect(&parser, &LsColXMLParser::finishedWithoutError,
|
||||
this, &LsColJob::finishedWithoutError);
|
||||
|
||||
// bool LsColXMLParser::parse takes a while, let's process some events in attempt to make UI more responsive
|
||||
// from https://doc.qt.io/qt-5/qcoreapplication.html#processEvents-1
|
||||
// "You can call this function occasionally when your program is busy doing a long operation (e.g. copying a file)."
|
||||
// we should not abuse this function, as it affects QObject instances lifetime (when children are getting deleted or when deleteLater is called)
|
||||
// one reason I had to remove ability for LsColJob to have parent, which, otherwise, leads to a crash later
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
|
||||
QString expectedPath = reply()->request().url().path(); // something like "/owncloud/remote.php/dav/folder"
|
||||
if (!parser.parse(reply()->readAll(), &_folderInfos, expectedPath)) {
|
||||
// XML parse error
|
||||
|
@ -414,6 +421,8 @@ bool LsColJob::finished()
|
|||
emit finishedWithError(reply());
|
||||
}
|
||||
|
||||
this->deleteLater();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,8 +140,8 @@ class OWNCLOUDSYNC_EXPORT LsColJob : public AbstractNetworkJob
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LsColJob(AccountPtr account, const QString &path, QObject *parent = nullptr);
|
||||
explicit LsColJob(AccountPtr account, const QUrl &url, QObject *parent = nullptr);
|
||||
explicit LsColJob(AccountPtr account, const QString &path);
|
||||
explicit LsColJob(AccountPtr account, const QUrl &url);
|
||||
void start() override;
|
||||
QHash<QString, ExtraFolderInfo> _folderInfos;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ void PropagateUploadFileNG::doStartUpload()
|
|||
if (progressInfo._valid && progressInfo.isChunked() && progressInfo._modtime == _item->_modtime && progressInfo._size == _item->_size) {
|
||||
_transferId = progressInfo._transferid;
|
||||
|
||||
const auto job = new LsColJob(propagator()->account(), chunkUploadFolderUrl(), this);
|
||||
const auto job = new LsColJob(propagator()->account(), chunkUploadFolderUrl());
|
||||
_jobs.append(job);
|
||||
job->setProperties(QList<QByteArray>() << "resourcetype"
|
||||
<< "getcontentlength");
|
||||
|
|
Loading…
Reference in a new issue