Fix compilation on MinGW.
- Add missing constant. - Make FontKey a pair instead of a function-local type which cannot be used as template parameter for gcc. - Fix warnings about redefinition of NOMINMAX and enumeration. Change-Id: Ie3eb6e5b8dd9cd81210d6e10270ada0158aaf809 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>bb10
parent
5bab4744ba
commit
5117f55063
|
|
@ -60,7 +60,9 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define NOMINMAX
|
||||
#ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
# define SPI_GETFONTSMOOTHINGTYPE 0x200A
|
||||
# define FE_FONTSMOOTHINGCLEARTYPE 0x0002
|
||||
# define CLEARTYPE_QUALITY 5
|
||||
# define SPI_GETDROPSHADOW 0x1024
|
||||
|
||||
# define CF_DIBV5 17
|
||||
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
|
|||
const FONTSIGNATURE *signature,
|
||||
int type)
|
||||
{
|
||||
typedef QPair<QString, QStringList> FontKey;
|
||||
|
||||
// the "@family" fonts are just the same as "family". Ignore them.
|
||||
if (familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_")))
|
||||
return false;
|
||||
|
|
@ -172,29 +174,19 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
|
|||
const QSettings fontRegistry(QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"),
|
||||
QSettings::NativeFormat);
|
||||
|
||||
struct FontKey
|
||||
{
|
||||
FontKey() {}
|
||||
FontKey(const QString &k) : key(k) {}
|
||||
|
||||
QString key;
|
||||
QStringList fonts;
|
||||
};
|
||||
static QVector<FontKey> allFonts;
|
||||
if (allFonts.isEmpty()) {
|
||||
const QStringList allKeys = fontRegistry.allKeys();
|
||||
allFonts.reserve(allKeys.size());
|
||||
const QString trueType = QStringLiteral("(TrueType)");
|
||||
foreach (const QString &key, allKeys) {
|
||||
FontKey fontKey(key);
|
||||
|
||||
QString realKey = key;
|
||||
realKey.remove(trueType);
|
||||
const QStringList fonts = realKey.trimmed().split(QLatin1Char('&'));
|
||||
foreach (const QString &font, fonts)
|
||||
fontKey.fonts.push_back(font.trimmed());
|
||||
|
||||
allFonts.push_back(fontKey);
|
||||
QStringList fonts;
|
||||
const QStringList fontNames = realKey.trimmed().split(QLatin1Char('&'));
|
||||
foreach (const QString &fontName, fontNames)
|
||||
fonts.push_back(fontName.trimmed());
|
||||
allFonts.push_back(FontKey(key, fonts));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,10 +194,10 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
|
|||
int index = 0;
|
||||
for (int k = 0; k < allFonts.size(); ++k) {
|
||||
const FontKey &fontKey = allFonts.at(k);
|
||||
for (int i = 0; i < fontKey.fonts.length(); ++i) {
|
||||
const QString font = fontKey.fonts[i];
|
||||
for (int i = 0; i < fontKey.second.length(); ++i) {
|
||||
const QString &font = fontKey.second.at(i);
|
||||
if (font == faceName || (faceName != fullName && fullName == font)) {
|
||||
value = fontRegistry.value(fontKey.key).toString();
|
||||
value = fontRegistry.value(fontKey.first).toString();
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
|
|||
case QPlatformIntegration::StartDragDistance:
|
||||
case QPlatformIntegration::MouseDoubleClickInterval:
|
||||
case QPlatformIntegration::KeyboardInputInterval:
|
||||
case QPlatformIntegration::ShowIsFullScreen:
|
||||
break; // Not implemented
|
||||
}
|
||||
return QPlatformIntegration::styleHint(hint);
|
||||
|
|
|
|||
Loading…
Reference in New Issue