Browse Source

Replace obsoleted QSysInfo functions

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
cdb0db02f9
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 12
      src/gui/mainwindow.cpp
  2. 12
      src/gui/programupdater.cpp

12
src/gui/mainwindow.cpp

@ -28,6 +28,11 @@
#include "mainwindow.h" #include "mainwindow.h"
#if defined(Q_OS_WIN)
#include <Windows.h>
#include <versionhelpers.h> // must follow after Windows.h
#endif
#include <QCloseEvent> #include <QCloseEvent>
#include <QDebug> #include <QDebug>
#include <QDesktopServices> #include <QDesktopServices>
@ -40,7 +45,6 @@
#include <QShortcut> #include <QShortcut>
#include <QSplitter> #include <QSplitter>
#include <QStatusBar> #include <QStatusBar>
#include <QSysInfo>
#include <QtGlobal> #include <QtGlobal>
#include <QTimer> #include <QTimer>
@ -2003,7 +2007,7 @@ void MainWindow::installPython()
{ {
setCursor(QCursor(Qt::WaitCursor)); setCursor(QCursor(Qt::WaitCursor));
// Download python // Download python
const QString installerURL = ((QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) const QString installerURL = (::IsWindowsVistaOrGreater()
? "https://www.python.org/ftp/python/3.6.6/python-3.6.6.exe" ? "https://www.python.org/ftp/python/3.6.6/python-3.6.6.exe"
: "https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi"); : "https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi");
Net::DownloadManager::instance()->download( Net::DownloadManager::instance()->download(
@ -2026,7 +2030,7 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
QProcess installer; QProcess installer;
qDebug("Launching Python installer in passive mode..."); qDebug("Launching Python installer in passive mode...");
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) { if (::IsWindowsVistaOrGreater()) {
QFile::rename(result.filePath, result.filePath + ".exe"); QFile::rename(result.filePath, result.filePath + ".exe");
installer.start('"' + Utils::Fs::toNativePath(result.filePath) + ".exe\" /passive"); installer.start('"' + Utils::Fs::toNativePath(result.filePath) + ".exe\" /passive");
} }
@ -2042,7 +2046,7 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
qDebug("Installer stderr: %s", installer.readAllStandardError().data()); qDebug("Installer stderr: %s", installer.readAllStandardError().data());
qDebug("Setup should be complete!"); qDebug("Setup should be complete!");
// Delete temp file // Delete temp file
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) if (::IsWindowsVistaOrGreater())
Utils::Fs::forceRemove(result.filePath + ".exe"); Utils::Fs::forceRemove(result.filePath + ".exe");
else else
Utils::Fs::forceRemove(result.filePath + ".msi"); Utils::Fs::forceRemove(result.filePath + ".msi");

12
src/gui/programupdater.cpp

@ -28,13 +28,21 @@
#include "programupdater.h" #include "programupdater.h"
#if defined(Q_OS_WIN)
#include <Windows.h>
#include <versionhelpers.h> // must follow after Windows.h
#endif
#include <QDebug> #include <QDebug>
#include <QDesktopServices> #include <QDesktopServices>
#include <QRegularExpression> #include <QRegularExpression>
#include <QStringList> #include <QStringList>
#include <QSysInfo>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#if defined(Q_OS_WIN)
#include <QSysInfo>
#endif
#include "base/net/downloadmanager.h" #include "base/net/downloadmanager.h"
namespace namespace
@ -73,7 +81,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
const QString OS_TYPE {"Mac OS X"}; const QString OS_TYPE {"Mac OS X"};
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
const QString OS_TYPE {((QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) const QString OS_TYPE {(::IsWindows7OrGreater()
&& QSysInfo::currentCpuArchitecture().endsWith("64")) && QSysInfo::currentCpuArchitecture().endsWith("64"))
? "Windows x64" : "Windows"}; ? "Windows x64" : "Windows"};
#endif #endif

Loading…
Cancel
Save