summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2022-04-14 23:06:40 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2022-04-14 23:06:40 +0200
commitb9c3ab2e049124894716305c9aa8a1d7a610d134 (patch)
treefc8ed899ebb17efbe40d36f75b384a7e34fcc3c0
parent97176d444eb377aa4efe83430d87eae0afb793d7 (diff)
downloadrockbox-b9c3ab2e04.tar.gz
rockbox-b9c3ab2e04.zip
rbutil: Improve progress & responsiveness on (un)install.
- When uninstalling update the log file only at the end of removing all files. This gives a major speed improveness since othewise the log file is written after each file. This slows down things notably, especially on slow disks. - Explicitly update the UI during install zip extraction. Avoids progress seemingly hanging due to the UI not getting updated often enough. Change-Id: Ib353a92e02a7038d6e55f5f88dcfb5085602c0f2
-rw-r--r--utils/rbutilqt/base/uninstall.cpp17
-rw-r--r--utils/rbutilqt/base/ziputil.cpp1
2 files changed, 13 insertions, 5 deletions
diff --git a/utils/rbutilqt/base/uninstall.cpp b/utils/rbutilqt/base/uninstall.cpp
index 6b4e08b55a..e6ced811d6 100644
--- a/utils/rbutilqt/base/uninstall.cpp
+++ b/utils/rbutilqt/base/uninstall.cpp
@@ -57,6 +57,7 @@ void Uninstaller::uninstall(void)
installlog.endGroup();
// iterate over all entries
+ QStringList deletedItems;
for(int j = 0; j < toDeleteList.size(); j++ )
{
emit logProgress(j, toDeleteList.size());
@@ -73,14 +74,13 @@ void Uninstaller::uninstall(void)
installlog.endGroup();
}
- installlog.beginGroup(uninstallSections.at(i));
QFileInfo toDelete(m_mountpoint + "/" + toDeleteList.at(j));
if(toDelete.isFile()) // if it is a file remove it
{
if(deleteFile && !QFile::remove(toDelete.filePath()))
emit logItem(tr("Could not delete %1")
.arg(toDelete.filePath()), LOGWARNING);
- installlog.remove(toDeleteList.at(j));
+ deletedItems.append(toDeleteList.at(j));
LOG_INFO() << "deleted:" << toDelete.filePath();
}
else // if it is a dir, remember it for later deletion
@@ -89,17 +89,24 @@ void Uninstaller::uninstall(void)
// folders will be rm'ed.
dirList << toDeleteList.at(j);
}
- installlog.endGroup();
QCoreApplication::processEvents();
}
// delete the dirs
installlog.beginGroup(uninstallSections.at(i));
- for(int j=0; j < dirList.size(); j++ )
+ for(int j = 0; j < dirList.size(); j++ )
{
- installlog.remove(dirList.at(j));
+ emit logProgress(j, dirList.size());
+ deletedItems.append(dirList.at(j));
QDir dir(m_mountpoint);
dir.rmdir(dirList.at(j)); // rm works only on empty folders
}
+ // for speed reasons update log file only at the end.
+ installlog.beginGroup(uninstallSections.at(i));
+ for (auto file : deletedItems)
+ {
+ installlog.remove(file);
+ }
+ installlog.endGroup();
installlog.endGroup();
//installlog.removeGroup(uninstallSections.at(i))
diff --git a/utils/rbutilqt/base/ziputil.cpp b/utils/rbutilqt/base/ziputil.cpp
index 3527e8e881..e285446711 100644
--- a/utils/rbutilqt/base/ziputil.cpp
+++ b/utils/rbutilqt/base/ziputil.cpp
@@ -147,6 +147,7 @@ bool ZipUtil::extractArchive(const QString& dest, QString file)
outputFile.close();
emit logProgress(current, entries);
+ QCoreApplication::processEvents();
}
delete currentFile;
emit logProgress(1, 1);