From d7267619c01124e880abfc79b5b40ab775bd6a09 Mon Sep 17 00:00:00 2001 From: Rafael Date: Mon, 28 Nov 2016 08:21:26 +0100 Subject: [PATCH] Using messageFont require now Windows Vista or newer --- main.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/main.cpp b/main.cpp index 0821841..f7cf41f 100755 --- a/main.cpp +++ b/main.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -53,21 +54,24 @@ int main(int argc, char *argv[]) a.setApplicationVersion(GTA5SYNC_APPVER); #ifdef GTA5SYNC_WIN -#if QT_VERSION >= 0x050000 - // Get Windows Font - NONCLIENTMETRICS ncm; - ncm.cbSize = sizeof(ncm); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); - LOGFONTW uiFont = ncm.lfMessageFont; - QString uiFontStr(QString::fromStdWString(std::wstring(uiFont.lfFaceName))); +#if QT_VERSION >= 0x050400 + if (QSysInfo::windowsVersion() >= 0x0080) + { + // Get Windows Font + NONCLIENTMETRICS ncm; + ncm.cbSize = sizeof(ncm); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); + LOGFONTW uiFont = ncm.lfMessageFont; + QString uiFontStr(QString::fromStdWString(std::wstring(uiFont.lfFaceName))); #ifdef GTA5SYNC_DEBUG - QMessageBox::information(a.desktop(), QApplication::tr("Font"), QApplication::tr("Selected Font: %1").arg(uiFontStr)); + QMessageBox::information(a.desktop(), QApplication::tr("Font"), QApplication::tr("Selected Font: %1").arg(uiFontStr)); #endif - // Set Application Font - QFont appFont(uiFontStr, 9); - a.setFont(appFont); + // Set Application Font + QFont appFont(uiFontStr, 9); + a.setFont(appFont); + } #endif #endif