Using messageFont require now Windows Vista or newer

This commit is contained in:
Rafael 2016-11-28 08:21:26 +01:00
parent 6e55152b26
commit d7267619c0

View file

@ -33,6 +33,7 @@
#include <QTranslator> #include <QTranslator>
#include <QMessageBox> #include <QMessageBox>
#include <QFileInfo> #include <QFileInfo>
#include <QSysInfo>
#include <QRawFont> #include <QRawFont>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
@ -53,21 +54,24 @@ int main(int argc, char *argv[])
a.setApplicationVersion(GTA5SYNC_APPVER); a.setApplicationVersion(GTA5SYNC_APPVER);
#ifdef GTA5SYNC_WIN #ifdef GTA5SYNC_WIN
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050400
// Get Windows Font if (QSysInfo::windowsVersion() >= 0x0080)
NONCLIENTMETRICS ncm; {
ncm.cbSize = sizeof(ncm); // Get Windows Font
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); NONCLIENTMETRICS ncm;
LOGFONTW uiFont = ncm.lfMessageFont; ncm.cbSize = sizeof(ncm);
QString uiFontStr(QString::fromStdWString(std::wstring(uiFont.lfFaceName))); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
LOGFONTW uiFont = ncm.lfMessageFont;
QString uiFontStr(QString::fromStdWString(std::wstring(uiFont.lfFaceName)));
#ifdef GTA5SYNC_DEBUG #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 #endif
// Set Application Font // Set Application Font
QFont appFont(uiFontStr, 9); QFont appFont(uiFontStr, 9);
a.setFont(appFont); a.setFont(appFont);
}
#endif #endif
#endif #endif