From 4135b1f588f74b761602a1f7e430c6970579edfb Mon Sep 17 00:00:00 2001 From: Syping Date: Sun, 24 Jun 2018 02:25:34 +0200 Subject: [PATCH] minor changes --- .ci/gta5view.nsi | 9 +++++++-- .gitlab-ci.yml | 35 +++++------------------------------ AppEnv.cpp | 33 ++++++++++++++++++++++++++++++++- TelemetryClass.cpp | 6 ++++++ 4 files changed, 50 insertions(+), 33 deletions(-) diff --git a/.ci/gta5view.nsi b/.ci/gta5view.nsi index 46000cc..0d94825 100644 --- a/.ci/gta5view.nsi +++ b/.ci/gta5view.nsi @@ -89,7 +89,7 @@ InstallDir "$PROGRAMFILES64\Syping\gta5view" Function .onInit !insertmacro MUI_LANGDLL_DISPLAY !ifdef WIN32 - MessageBox MB_OK|MB_ICONSTOP "Can't install the 64bit version on a 32bit system, please download the 32bit version!" + MessageBox MB_OK|MB_ICONSTOP "Windows 32-Bit is not supported anymore!" Quit !endif SetRegView 64 @@ -140,6 +140,9 @@ File "/opt/windev/qt64d-latest/plugins/imageformats/qwbmp.dll" File "/opt/windev/qt64d-latest/plugins/imageformats/qwebp.dll" SetOutPath "$INSTDIR\platforms" File "/opt/windev/qt64d-latest/plugins/platforms/qwindows.dll" +SetOutPath "$INSTDIR\styles" +File "/opt/windev/qt64d-latest/plugins/styles/qcleanlooksstyle.dll" +File "/opt/windev/qt64d-latest/plugins/styles/qplastiquestyle.dll" SectionEnd ###################################################################### @@ -223,11 +226,13 @@ Delete "$INSTDIR\imageformats\qtiff.dll" Delete "$INSTDIR\imageformats\qwbmp.dll" Delete "$INSTDIR\imageformats\qwebp.dll" Delete "$INSTDIR\platforms\qwindows.dll" - +Delete "$INSTDIR\styles\qcleanlooksstyle.dll" +Delete "$INSTDIR\styles\qplastiquestyle.dll" RmDir "$INSTDIR\lang" RmDir "$INSTDIR\audio" RmDir "$INSTDIR\imageformats" RmDir "$INSTDIR\platforms" +RmDir "$INSTDIR\styles" Delete "$INSTDIR\uninstall.exe" !ifdef WEB_SITE diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1b8f2e2..fa9a0b1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,48 +1,23 @@ -debian32: - image: i386/debian:stretch +debian: + image: debian:stretch variables: BUILD_SCRIPT: "debian_ci.sh" APT_INSTALL: "clang" script: - .gitlab/gitlab.sh artifacts: - name: "gta5view-$CI_COMMIT_REF_NAME-debian32" + name: "gta5view-$CI_COMMIT_REF_NAME-debian" paths: - assets/*.deb -debian64: - image: amd64/debian:stretch - variables: - BUILD_SCRIPT: "debian_ci.sh" - APT_INSTALL: "clang" - script: - - .gitlab/gitlab.sh - artifacts: - name: "gta5view-$CI_COMMIT_REF_NAME-debian64" - paths: - - assets/*.deb - -win32: - image: syping/qt5-static-mingw:5.9.6 - variables: - BUILD_SCRIPT: "windows_build.sh" - QT_SELECT: "qt5-i686-w64-mingw32" - script: - - .gitlab/gitlab.sh - artifacts: - name: "gta5view-$CI_COMMIT_REF_NAME-win32" - paths: - - assets/*.exe - -win64: +windows: image: syping/qt5-static-mingw:5.9.6 variables: BUILD_SCRIPT: "windows_build.sh" QT_SELECT: "qt5-x86_64-w64-mingw32" - EXECUTABLE_ARCH: "_x64" script: - .gitlab/gitlab.sh artifacts: - name: "gta5view-$CI_COMMIT_REF_NAME-win64" + name: "gta5view-$CI_COMMIT_REF_NAME-windows" paths: - assets/*.exe diff --git a/AppEnv.cpp b/AppEnv.cpp index 56e0b08..60f4eac 100644 --- a/AppEnv.cpp +++ b/AppEnv.cpp @@ -152,7 +152,38 @@ QString AppEnv::getPluginsFolder() QByteArray AppEnv::getUserAgent() { - return QString("Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 %1/%2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8(); +#if QT_VERSION >= 0x050400 +#ifdef GTA5SYNC_WIN + QString kernelVersion = QSysInfo::kernelVersion(); + const QStringList &kernelVersionList = kernelVersion.split("."); + if (kernelVersionList.length() > 2) + { + kernelVersion = kernelVersionList.at(0) % "." % kernelVersionList.at(1); + } + QString runArch = QSysInfo::buildCpuArchitecture(); + if (runArch == "x86_64") + { + runArch = "Win64; x64"; + } + else if (runArch == "i686") + { + const QString &curArch = QSysInfo::currentCpuArchitecture(); + if (curArch == "x86_64") + { + runArch = "WOW64"; + } + else if (curArch == "i686") + { + runArch = "Win32; x86"; + } + } + return QString("Mozilla/5.0 (Windows NT %1; %2) %3/%4").arg(kernelVersion, runArch, GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8(); +#else + return QString("Mozilla/5.0 (%1; %2) %3/%4").arg(QSysInfo::kernelType(), QSysInfo::kernelVersion(), GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8(); +#endif +#else + return QString("Mozilla/5.0 %1/%2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8(); +#endif } // QUrl AppEnv::getCrewFetchingUrl(QString crewID) diff --git a/TelemetryClass.cpp b/TelemetryClass.cpp index 66eac7f..70621b9 100644 --- a/TelemetryClass.cpp +++ b/TelemetryClass.cpp @@ -198,6 +198,7 @@ void TelemetryClass::push(TelemetryCategory category, QJsonDocument json) QNetworkAccessManager *netManager = new QNetworkAccessManager(); QNetworkRequest netRequest(TelemetryClassAuthenticator::getTrackingPushURL()); + netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent()); QNetworkReply *netReply = netManager->post(netRequest, httpMultiPart); httpMultiPart->setParent(netReply); @@ -209,6 +210,10 @@ QJsonDocument TelemetryClass::getOperatingSystem() QJsonDocument jsonDocument; QJsonObject jsonObject; #if QT_VERSION >= 0x050400 + jsonObject["KernelType"] = QSysInfo::kernelType(); + jsonObject["KernelVersion"] = QSysInfo::kernelVersion(); + jsonObject["ProductType"] = QSysInfo::productType(); + jsonObject["ProductVersion"] = QSysInfo::productVersion(); jsonObject["OSName"] = QSysInfo::prettyProductName(); jsonObject["OSArch"] = QSysInfo::currentCpuArchitecture(); #endif @@ -434,6 +439,7 @@ void TelemetryClass::registerClient() { QNetworkAccessManager *netManager = new QNetworkAccessManager(); QNetworkRequest netRequest(TelemetryClassAuthenticator::getTrackingRegURL()); + netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent()); netManager->get(netRequest); connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(registerFinished(QNetworkReply*)));