From 1c75bcde4699feb9d7be9c5c8b8c3d61fdda1430 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 14 Aug 2016 12:50:11 +0200 Subject: [PATCH] Changed: Computes size of downloaded files, see #279 --- .../tools/client/ryzom_installer/src/uninstalldialog.cpp | 5 +++++ code/ryzom/tools/client/ryzom_installer/src/utils.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp index 94ea973e6..bfba57840 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/uninstalldialog.cpp @@ -264,6 +264,11 @@ void CUninstallDialog::updateSizes() ++it; } + // downloaded files + qint64 bytes = getDirectorySize(config->getInstallationDirectory(), false); + + emit updateSize(m_downloadedFilesIndex, qBytesToHumanReadable(bytes)); + emit updateLayout(); } diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index cdbadc246..28860ffab 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -34,7 +34,7 @@ QString qBytesToHumanReadable(qint64 bytes) return QString::fromUtf8(NLMISC::bytesToHumanReadable(bytes).c_str()); } -qint64 getDirectorySize(const QString &directory) +qint64 getDirectorySize(const QString &directory, bool recursize) { qint64 size = 0; @@ -52,7 +52,7 @@ qint64 getDirectorySize(const QString &directory) if (fileInfo.isDir()) { - size += getDirectorySize(fileInfo.absoluteFilePath()); + if (recursize) size += getDirectorySize(fileInfo.absoluteFilePath(), true); } else {