diff options
Diffstat (limited to 'src/libs/installer/packagemanagergui.cpp')
-rw-r--r-- | src/libs/installer/packagemanagergui.cpp | 93 |
1 files changed, 4 insertions, 89 deletions
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 0ccd53da2..88e788b02 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -2538,100 +2538,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) { - qDebug().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) { - qDebug() << "Tmp and install directories are on the same volume. Volume mount point:" - << targetVolume.mountPath() << "Free space available:" - << humanReadableSize(installVolumeAvailableSize); - } else { - qDebug() << "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; - } - - qDebug() << "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. |