From c4b9d77eaacf70e4d5d287641d74aef610a0cb72 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 25 Nov 2016 10:44:06 +0100 Subject: [PATCH] Changed: Added option ignore_free_disk_space_checks to ryzom_installer.ini --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 15 ++++++++++++++- .../tools/client/ryzom_installer/src/configfile.h | 4 ++++ .../client/ryzom_installer/src/downloader.cpp | 3 ++- .../client/ryzom_installer/src/installdialog.cpp | 2 +- .../client/ryzom_installer/src/migratedialog.cpp | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 7d14aa223..592b8e0a2 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -25,7 +25,8 @@ CConfigFile *CConfigFile::s_instance = NULL; CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_version(-1), - m_defaultServerIndex(0), m_defaultProfileIndex(0), m_installerCopied(false), m_use64BitsClient(false), m_shouldUninstallOldClient(true) + m_defaultServerIndex(0), m_defaultProfileIndex(0), m_installerCopied(false), m_use64BitsClient(false), + m_shouldUninstallOldClient(true), m_ignoreFreeDiskSpaceChecks(false) { s_instance = this; @@ -82,6 +83,7 @@ bool CConfigFile::load(const QString &filename) m_installationDirectory = settings.value("installation_directory").toString(); m_use64BitsClient = settings.value("use_64bits_client", true).toBool(); m_shouldUninstallOldClient = settings.value("should_uninstall_old_client", true).toBool(); + m_ignoreFreeDiskSpaceChecks = settings.value("ignore_free_disk_space_checks", false).toBool(); // fix problems when src directory doesn't exist anymore if (!m_srcDirectory.isEmpty() && QFile::exists(m_srcDirectory)) m_srcDirectory.clear(); @@ -175,6 +177,7 @@ bool CConfigFile::save() const settings.setValue("installation_directory", m_installationDirectory); settings.setValue("use_64bits_client", m_use64BitsClient); settings.setValue("should_uninstall_old_client", m_shouldUninstallOldClient); + settings.setValue("ignore_free_disk_space_checks", m_ignoreFreeDiskSpaceChecks); #if defined(Q_OS_WIN) settings.setValue("installer_filename_windows", m_installerFilename); @@ -441,6 +444,16 @@ void CConfigFile::setShouldUninstallOldClient(bool on) m_shouldUninstallOldClient = on; } +bool CConfigFile::ignoreFreeDiskSpaceChecks() const +{ + return m_ignoreFreeDiskSpaceChecks; +} + +void CConfigFile::setIgnoreFreeDiskSpaceChecks(bool on) +{ + m_ignoreFreeDiskSpaceChecks = on; +} + bool CConfigFile::uninstallingOldClient() const { return QFile::exists(getInstallationDirectory() + "/ryzom_installer_uninstalling_old_client"); diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index df13b7a51..baa815bd8 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -113,6 +113,9 @@ public: bool shouldUninstallOldClient() const; void setShouldUninstallOldClient(bool on); + bool ignoreFreeDiskSpaceChecks() const; + void setIgnoreFreeDiskSpaceChecks(bool on); + bool uninstallingOldClient() const; void setUninstallingOldClient(bool on) const; @@ -158,6 +161,7 @@ private: QString m_srcDirectory; bool m_use64BitsClient; bool m_shouldUninstallOldClient; + bool m_ignoreFreeDiskSpaceChecks; QString m_installerFilename; QString m_language; diff --git a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp index 2d497b31a..81fc7ecd3 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp @@ -18,6 +18,7 @@ #include "operation.h" #include "downloader.h" #include "utils.h" +#include "configfile.h" #include "nel/misc/system_info.h" #include "nel/misc/path.h" @@ -179,7 +180,7 @@ void CDownloader::getFileHead() void CDownloader::downloadFile() { - qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_fullPath.toUtf8().constData()); + qint64 freeSpace = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks() ? 0:NLMISC::CSystemInfo::availableHDSpace(m_fullPath.toUtf8().constData()); if (freeSpace == 0) { diff --git a/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp index a41ebffff..d7f12be55 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp @@ -130,7 +130,7 @@ void CInstallDialog::updateDestinationText() void CInstallDialog::accept() { // check free disk space - qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); + qint64 freeSpace = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks() ? 0:NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); // shouldn't happen if (freeSpace == 0) diff --git a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp index 1629ae670..d246701ea 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp @@ -123,7 +123,7 @@ void CMigrateDialog::updateDestinationText() void CMigrateDialog::accept() { // check free disk space - qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); + qint64 freeSpace = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks() ? 0:NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); // shouldn't happen if (freeSpace == 0)