[prev in list] [next in list] [prev in thread] [next in thread]
List: rockbox-cvs
Subject: rbutil: Improve progress & responsiveness on (un)install.
From: rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () lists ! haxx ! se>
Date: 2022-04-14 21:14:19
Message-ID: 202204142114.23ELEJPr2591395 () archos ! rockbox ! org
[Download RAW message or body]
commit b9c3ab2e049124894716305c9aa8a1d7a610d134
Author: Dominik Riebeling <Dominik.Riebeling@gmail.com>
Date: Thu Apr 14 23:06:40 2022 +0200
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
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);
--
rockbox-cvs mailing list
rockbox-cvs@lists.haxx.se
https://lists.haxx.se/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic