summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorChristoph VogtlÃĪnder <c.vogtlaender@sigma-surface-science.com>2015-01-21 14:29:15 +0100
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-02-03 12:22:33 +0000
commit380670252dfa56194038ea3af134df9998c52288 (patch)
treed5d656d5087ba51fff9b2678ffd863c87a72fb67 /src/libs
parenta40ed1fb156a89b7bad3b886dc66ffc7adf2219f (diff)
Show size in "Programs and Features"
Add size as quint32 to always create a REG_DWORD. Calculate size based on installed packages and meta data instead of using the installer binary file size. Change-Id: Id379aafe885d2785251eecf831cb7d07cc44f3d4 Task-number: QTIFW-616 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/packagemanagercore.cpp2
-rw-r--r--src/libs/installer/packagemanagercore.h2
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp18
3 files changed, 20 insertions, 2 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 1b59b1dcd..80d57ac4b 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -496,7 +496,7 @@ void PackageManagerCore::setMessageBoxAutomaticAnswer(const QString &identifier,
static_cast<QMessageBox::Button>(button));
}
-quint64 size(QInstaller::Component *component, const QString &value)
+quint64 PackageManagerCore::size(QInstaller::Component *component, const QString &value) const
{
if (component->installAction() == ComponentModelHelper::Install)
return component->value(value).toLongLong();
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h
index fb16cc29c..a3bfa3928 100644
--- a/src/libs/installer/packagemanagercore.h
+++ b/src/libs/installer/packagemanagercore.h
@@ -186,6 +186,8 @@ public:
Q_INVOKABLE void autoRejectMessageBoxes();
Q_INVOKABLE void setMessageBoxAutomaticAnswer(const QString &identifier, int button);
+ quint64 size(QInstaller::Component *component, const QString &value) const;
+
Q_INVOKABLE bool isFileExtensionRegistered(const QString &extension) const;
Q_INVOKABLE bool fileExists(const QString &filePath) const;
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index 4c35b5426..1e2f4923c 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -1986,7 +1986,23 @@ void PackageManagerCorePrivate::registerMaintenanceTool()
settings.setValue(QLatin1String("UninstallString"), maintenanceTool);
settings.setValue(QLatin1String("ModifyPath"), QString(maintenanceTool
+ QLatin1String(" --manage-packages")));
- settings.setValue(QLatin1String("EstimatedSize"), QFileInfo(installerBinaryPath()).size());
+ // required disk space of the installed components
+ quint64 estimatedSizeKB = m_core->requiredDiskSpace() / 1024;
+ // add required space for the maintenance tool
+ estimatedSizeKB += QFileInfo(maintenanceTool).size() / 1024;
+ if (m_core->createLocalRepositoryFromBinary()) {
+ // add required space for a local repository
+ quint64 result(0);
+ foreach (QInstaller::Component *component,
+ m_core->components(PackageManagerCore::ComponentType::All)) {
+ result += m_core->size(component, scCompressedSize);
+ }
+ estimatedSizeKB += result / 1024;
+ }
+ // Windows can only handle 32bit REG_DWORD (max. recordable installation size is 4TiB)
+ const quint64 limit = std::numeric_limits<quint32>::max(); // maximum 32 bit value
+ if (estimatedSizeKB <= limit)
+ settings.setValue(QLatin1String("EstimatedSize"), static_cast<quint32>(estimatedSizeKB));
settings.setValue(QLatin1String("NoModify"), 0);
settings.setValue(QLatin1String("NoRepair"), 1);
#endif