summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/packagemanagergui.cpp
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2020-03-16 10:21:26 +0200
committerKatja Marttila <katja.marttila@qt.io>2020-03-16 10:35:50 +0200
commitcf47ae2dcceeacb63d37dcffffa3ff37b1c50342 (patch)
treebe7382f930eff628261a70ee3774a5245ea5ea5b /src/libs/installer/packagemanagergui.cpp
parent02a7a7b8c4e4cc8d5cb2ec64074d32a7598c373a (diff)
parentc0732c406741bbd3d8d16f32f599e7ce83155c85 (diff)
Merge remote-tracking branch 'origin/3.2' to master
Diffstat (limited to 'src/libs/installer/packagemanagergui.cpp')
-rw-r--r--src/libs/installer/packagemanagergui.cpp95
1 files changed, 4 insertions, 91 deletions
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index 05f61ae18..793519416 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -2411,102 +2411,15 @@ void ReadyForInstallationPage::entering()
m_taskDetailsBrowser->setVisible(!componentsOk || isVerbose());
setComplete(componentsOk);
- const VolumeInfo tempVolume = VolumeInfo::fromPath(QDir::tempPath());
- const VolumeInfo targetVolume = VolumeInfo::fromPath(packageManagerCore()->value(scTargetDir));
-
- const quint64 tempVolumeAvailableSize = tempVolume.availableSize();
- const quint64 installVolumeAvailableSize = targetVolume.availableSize();
-
- // at the moment there is no better way to check this
- if (targetVolume.size() == 0 && installVolumeAvailableSize == 0) {
- qCWarning(QInstaller::lcInstallerInstallLog).nospace() << "Cannot determine available space on device. "
- "Volume descriptor: " << targetVolume.volumeDescriptor()
- << ", Mount path: " << targetVolume.mountPath() << ". Continue silently.";
- return; // TODO: Shouldn't this also disable the "Next" button?
- }
-
- const bool tempOnSameVolume = (targetVolume == tempVolume);
- if (tempOnSameVolume) {
- qCDebug(QInstaller::lcInstallerInstallLog) << "Tmp and install directories are on the same volume. "
- "Volume mount point:" << targetVolume.mountPath() << "Free space available:"
- << humanReadableSize(installVolumeAvailableSize);
- } else {
- qCDebug(QInstaller::lcInstallerInstallLog) << "Tmp is on a different volume than the installation "
- "directory. Tmp volume mount point:"
- << tempVolume.mountPath() << "Free space available:"
- << humanReadableSize(tempVolumeAvailableSize) << "Install volume mount point:"
- << targetVolume.mountPath() << "Free space available:"
- << humanReadableSize(installVolumeAvailableSize);
- }
-
- const quint64 extraSpace = 256 * 1024 * 1024LL;
- quint64 required(packageManagerCore()->requiredDiskSpace());
- quint64 tempRequired(packageManagerCore()->requiredTemporaryDiskSpace());
- if (required < extraSpace) {
- required += 0.1 * required;
- tempRequired += 0.1 * tempRequired;
+ QString spaceInfo;
+ if (packageManagerCore()->checkAvailableSpace(spaceInfo)) {
+ m_msgLabel->setText(QString::fromLatin1("%1 %2").arg(m_msgLabel->text(), spaceInfo));
} else {
- required += extraSpace;
- tempRequired += extraSpace;
- }
-
- quint64 repositorySize = 0;
- const bool createLocalRepository = packageManagerCore()->createLocalRepositoryFromBinary();
- if (createLocalRepository && packageManagerCore()->isInstaller()) {
- repositorySize = QFile(QCoreApplication::applicationFilePath()).size();
- // if we create a local repository, take that space into account as well
- required += repositorySize;
- }
-
- qCDebug(QInstaller::lcInstallerInstallLog) << "Installation space required:"
- << humanReadableSize(required) << "Temporary space "
- "required:" << humanReadableSize(tempRequired) << "Local repository size:"
- << humanReadableSize(repositorySize);
-
- if (tempOnSameVolume && (installVolumeAvailableSize <= (required + tempRequired))) {
- m_msgLabel->setText(tr("Not enough disk space to store temporary files and the "
- "installation. %1 are available, while %2 are at least required.")
- .arg(humanReadableSize(installVolumeAvailableSize),
- humanReadableSize(required + tempRequired)));
- setComplete(false);
- return;
- }
-
- if (installVolumeAvailableSize < required) {
- m_msgLabel->setText(tr("Not enough disk space to store all selected components! %1 are available "
- "while %2 are at least required.").arg(humanReadableSize(installVolumeAvailableSize),
- humanReadableSize(required)));
- setComplete(false);
- return;
- }
-
- if (tempVolumeAvailableSize < tempRequired) {
- m_msgLabel->setText(tr("Not enough disk space to store temporary files! %1 are available "
- "while %2 are at least required.").arg(humanReadableSize(tempVolumeAvailableSize),
- humanReadableSize(tempRequired)));
+ m_msgLabel->setText(spaceInfo);
setComplete(false);
- return;
- }
-
- if (installVolumeAvailableSize - required < 0.01 * targetVolume.size()) {
- // warn for less than 1% of the volume's space being free
- m_msgLabel->setText(tr("The volume you selected for installation seems to have sufficient "
- "space for installation, but there will be less than 1% of the volume's space "
- "available afterwards. %1").arg(m_msgLabel->text()));
- } else if (installVolumeAvailableSize - required < 100 * 1024 * 1024LL) {
- // warn for less than 100MB being free
- m_msgLabel->setText(tr("The volume you selected for installation seems to have sufficient "
- "space for installation, but there will be less than 100 MB available afterwards. %1")
- .arg(m_msgLabel->text()));
}
-
- m_msgLabel->setText(QString::fromLatin1("%1 %2").arg(m_msgLabel->text(),
- tr("Installation will use %1 of disk space.")
- .arg(humanReadableSize(packageManagerCore()->requiredDiskSpace()))));
}
-
-
/*!
Called when end users leave the page and the PackageManagerGui:currentPageChanged()
signal is triggered.