Added macro definition and compile-time condition to support Qt < 5.9

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
This commit is contained in:
Dominique Fuchs 2019-09-08 17:33:34 +02:00
parent be7a524557
commit dca83aad45
4 changed files with 21 additions and 7 deletions

View file

@ -57,9 +57,10 @@ namespace Utility {
OCSYNC_EXPORT void setLaunchOnStartup(const QString &appName, const QString &guiName, bool launch);
OCSYNC_EXPORT uint convertSizeToUint(size_t &convertVar);
OCSYNC_EXPORT uint convertSizeToInt(size_t &convertVar);
#ifdef Q_OS_WIN
OCSYNC_EXPORT DWORD convertSizeToDWORD(size_t &convertVar);
#define QTLEGACY (QT_VERSION_MAJOR > 5 || (QT_VERSION_MAJOR == 5 && QT_VERSION_MINOR >= 9 ))
#endif
/**

View file

@ -26,6 +26,7 @@
#include "updater/updater.h"
#include "updater/ocupdater.h"
#include "ignorelisteditor.h"
#include "common/utility.h"
#include "config.h"
@ -80,9 +81,13 @@ GeneralSettings::GeneralSettings(QWidget *parent)
// Hide on non-Windows, or WindowsVersion < 10.
// The condition should match the default value of ConfigFile::showInExplorerNavigationPane.
#ifdef Q_OS_WIN
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows10)
#if QTLEGACY
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows10)
#else
if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS10)
#endif
_ui->showInExplorerNavigationPaneCheckBox->setVisible(false);
#endif
_ui->showInExplorerNavigationPaneCheckBox->setVisible(false);
/* Set the left contents margin of the layout to zero to make the checkboxes
* align properly vertically , fixes bug #3758

View file

@ -90,10 +90,14 @@ void showInFileManager(const QString &localPath)
{
if (Utility::isWindows()) {
#ifdef Q_OS_WIN
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows7) {
return;
}
#if QTLEGACY
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows7)
#else
if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS10)
#endif
return;
#endif
QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH
QFileInfo fi(localPath);

View file

@ -175,7 +175,11 @@ bool ConfigFile::showInExplorerNavigationPane() const
{
const bool defaultValue =
#ifdef Q_OS_WIN
QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::Windows10)
#if QTLEGACY
QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10;
#else
(QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS10);
#endif
#else
false
#endif