From e4c21e8f389fe7a56814fee35c09214103f0a34b4e4d0b304123a7c56f5dd229 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Tue, 14 Oct 2014 11:24:52 +0000 Subject: [PATCH] Accepting request 255354 from KDE:Qt5 - Added 0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch, 0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch, 0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch and 0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch from upstream to improve QFileDialog behaviour with both local and remote URL's - Added 0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch: QTBUG-36184 - Added 0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch, 0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch, 0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch and 0004-GTK2-theme-should-use-GTK-configured-font-variant.patch QTBUG-40396, QTBUG-32254, QTBUG-39643 OBS-URL: https://build.opensuse.org/request/show/255354 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=30 --- ...egy-to-disable-subpixel-antialiasing.patch | 110 ++++++ ...t-urlsSelected-urlSelected-in-accept.patch | 107 ++++++ ...system-wide-kdeglobals-as-a-fallback.patch | 339 ++++++++++++++++++ ...ialiasingType-from-QFontEngineFT-to-.patch | 254 +++++++++++++ ...le-QString-should-lead-to-an-empty-U.patch | 100 ++++++ ...og-turn-workingDirectory-into-a-QUrl.patch | 315 ++++++++++++++++ ...-and-lcdfilter-fontconfig-configurat.patch | 93 +++++ ...ould-use-GTK-configured-font-variant.patch | 126 +++++++ ...ement-getOpenFileUrl-and-friends-for.patch | 284 +++++++++++++++ libqt5-qtbase.changes | 17 + libqt5-qtbase.spec | 27 ++ 11 files changed, 1772 insertions(+) create mode 100644 0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch create mode 100644 0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch create mode 100644 0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch create mode 100644 0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch create mode 100644 0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch create mode 100644 0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch create mode 100644 0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch create mode 100644 0004-GTK2-theme-should-use-GTK-configured-font-variant.patch create mode 100644 0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch diff --git a/0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch b/0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch new file mode 100644 index 0000000..50a0f68 --- /dev/null +++ b/0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch @@ -0,0 +1,110 @@ +From 820b20e593b7b0d92e6a78e7b23457f321aa0bc1 Mon Sep 17 00:00:00 2001 +From: Allan Sandfeld Jensen +Date: Thu, 24 Jul 2014 14:33:00 +0200 +Subject: [PATCH 1/4] Add QFont strategy to disable subpixel antialiasing + +This patch adds the option to disable subpixel antialiasing on QFont +basis. This can be useful when painting to offscreen surfaces. On OS X +this option disables the aggressive LCD font smoothing, which can be +necessary for certain fonts it may otherwise ruin. + +Task-number: QTBUG-40396 +Change-Id: I1664b636520ae63ee1503b5df7436748106b9f5c +Reviewed-by: Eskil Abrahamsen Blomfeldt +(cherry picked from commit 7ff4621100b3df7ba9b336ac60204da4b548e642) +--- + src/gui/text/qfont.cpp | 1 + + src/gui/text/qfont.h | 1 + + .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 4 +++- + src/plugins/platforms/cocoa/qpaintengine_mac.mm | 7 +++++++ + src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 4 +++- + 5 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp +index cf40dd0..82676d7 100644 +--- a/src/gui/text/qfont.cpp ++++ b/src/gui/text/qfont.cpp +@@ -1376,6 +1376,7 @@ QFont::StyleHint QFont::styleHint() const + \value PreferOutline prefers outline fonts (as opposed to bitmap fonts). + \value ForceOutline forces the use of outline fonts. + \value NoAntialias don't antialias the fonts. ++ \value NoSubpixelAntialias avoid subpixel antialiasing on the fonts if possible. + \value PreferAntialias antialias if possible. + \value OpenGLCompatible forces the use of OpenGL compatible + fonts. +diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h +index 7fbaf24..f48f4cf 100644 +--- a/src/gui/text/qfont.h ++++ b/src/gui/text/qfont.h +@@ -83,6 +83,7 @@ public: + NoAntialias = 0x0100, + OpenGLCompatible = 0x0200, + ForceIntegerMetrics = 0x0400, ++ NoSubpixelAntialias = 0x0800, + NoFontMerging = 0x8000 + }; + +diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +index b8da972..e10e10b 100644 +--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp ++++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +@@ -634,7 +634,9 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr) + } + + if (antialias) { +- QFontEngineFT::SubpixelAntialiasingType subpixelType = subpixelTypeFromMatch(match); ++ QFontEngineFT::SubpixelAntialiasingType subpixelType = QFontEngineFT::Subpixel_None; ++ if (!(f.styleStrategy & QFont::NoSubpixelAntialias)) ++ subpixelType = subpixelTypeFromMatch(match); + engine->subpixelType = subpixelType; + + format = (subpixelType == QFontEngineFT::Subpixel_None) +diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm +index f4cd071..d48cbdf 100644 +--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm ++++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm +@@ -1084,6 +1084,10 @@ void QCoreGraphicsPaintEngine::drawTextItem(const QPointF &pos, const QTextItem + if (textAA != lineAA) + CGContextSetShouldAntialias(d->hd, textAA); + ++ const bool smoothing = textAA && !(fe->fontDef.styleStrategy & QFont::NoSubpixelAntialias); ++ if (d->disabledSmoothFonts == smoothing) ++ CGContextSetShouldSmoothFonts(d->hd, smoothing); ++ + if (ti.glyphs.numGlyphs) { + switch (fe->type()) { + case QFontEngine::Mac: +@@ -1100,6 +1104,9 @@ void QCoreGraphicsPaintEngine::drawTextItem(const QPointF &pos, const QTextItem + if (textAA != lineAA) + CGContextSetShouldAntialias(d->hd, !textAA); + ++ if (smoothing == d->disabledSmoothFonts) ++ CGContextSetShouldSmoothFonts(d->hd, !d->disabledSmoothFonts); ++ + updatePen(oldPen); + updateBrush(oldBrush, oldBrushOrigin); + } +diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +index f30dcba..27262ec 100644 +--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp ++++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +@@ -1521,13 +1521,15 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) + #endif + + if (request.styleStrategy & QFont::PreferAntialias) { +- if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP) { ++ if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && !(request.styleStrategy & QFont::NoSubpixelAntialias)) { + qual = CLEARTYPE_QUALITY; + } else { + qual = ANTIALIASED_QUALITY; + } + } else if (request.styleStrategy & QFont::NoAntialias) { + qual = NONANTIALIASED_QUALITY; ++ } else if ((request.styleStrategy & QFont::NoSubpixelAntialias) && sharedFontData()->clearTypeEnabled) { ++ qual = ANTIALIASED_QUALITY; + } + + lf.lfQuality = qual; +-- +2.1.1 + diff --git a/0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch b/0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch new file mode 100644 index 0000000..c3c6aee --- /dev/null +++ b/0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch @@ -0,0 +1,107 @@ +From 9879e5b90b1babcf38236d2c46c187eacf613711 Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Wed, 9 Jul 2014 11:24:16 +0200 +Subject: [PATCH 1/4] QFileDialog: emit urlsSelected+urlSelected in accept(). + +Not just filesSelected+fileSelected (which only happens for local files). + +Change-Id: Ife592c3c921231356f96cbc2871b6d724a15d2c8 +Reviewed-by: Friedemann Kleint +(cherry picked from commit da088c5ace607904ec817033d2d48c689ff4816a) +--- + src/widgets/dialogs/qfiledialog.cpp | 21 +++++++++++++-------- + src/widgets/dialogs/qfiledialog.h | 4 ++-- + src/widgets/dialogs/qfiledialog_p.h | 4 ++-- + 3 files changed, 17 insertions(+), 12 deletions(-) + +diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp +index 9219757..037964b 100644 +--- a/src/widgets/dialogs/qfiledialog.cpp ++++ b/src/widgets/dialogs/qfiledialog.cpp +@@ -577,8 +577,8 @@ QFileDialogPrivate::~QFileDialogPrivate() + void QFileDialogPrivate::initHelper(QPlatformDialogHelper *h) + { + QFileDialog *d = q_func(); +- QObject::connect(h, SIGNAL(fileSelected(QUrl)), d, SLOT(_q_nativeFileSelected(QUrl))); +- QObject::connect(h, SIGNAL(filesSelected(QList)), d, SLOT(_q_nativeFilesSelected(QList))); ++ QObject::connect(h, SIGNAL(fileSelected(QUrl)), d, SLOT(_q_emitUrlSelected(QUrl))); ++ QObject::connect(h, SIGNAL(filesSelected(QList)), d, SLOT(_q_emitUrlsSelected(QList))); + QObject::connect(h, SIGNAL(currentChanged(QUrl)), d, SLOT(_q_nativeCurrentChanged(QUrl))); + QObject::connect(h, SIGNAL(directoryEntered(QUrl)), d, SLOT(_q_nativeEnterDirectory(QUrl))); + QObject::connect(h, SIGNAL(filterSelected(QString)), d, SIGNAL(filterSelected(QString))); +@@ -2607,15 +2607,20 @@ void QFileDialog::done(int result) + void QFileDialog::accept() + { + Q_D(QFileDialog); +- QStringList files = selectedFiles(); +- if (files.isEmpty()) +- return; + if (!d->usingWidgets()) { +- d->emitFilesSelected(files); ++ const QList urls = selectedUrls(); ++ if (urls.isEmpty()) ++ return; ++ d->_q_emitUrlsSelected(urls); ++ if (urls.count() == 1) ++ d->_q_emitUrlSelected(urls.first()); + QDialog::accept(); + return; + } + ++ QStringList files = selectedFiles(); ++ if (files.isEmpty()) ++ return; + QString lineEditText = d->lineEdit()->text(); + // "hidden feature" type .. and then enter, and it will move up a dir + // special case for ".." +@@ -3646,7 +3651,7 @@ void QFileDialogPrivate::_q_fileRenamed(const QString &path, const QString oldNa + } + } + +-void QFileDialogPrivate::_q_nativeFileSelected(const QUrl &file) ++void QFileDialogPrivate::_q_emitUrlSelected(const QUrl &file) + { + Q_Q(QFileDialog); + emit q->urlSelected(file); +@@ -3654,7 +3659,7 @@ void QFileDialogPrivate::_q_nativeFileSelected(const QUrl &file) + emit q->fileSelected(file.toLocalFile()); + } + +-void QFileDialogPrivate::_q_nativeFilesSelected(const QList &files) ++void QFileDialogPrivate::_q_emitUrlsSelected(const QList &files) + { + Q_Q(QFileDialog); + emit q->urlsSelected(files); +diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h +index 404e16c..184e072 100644 +--- a/src/widgets/dialogs/qfiledialog.h ++++ b/src/widgets/dialogs/qfiledialog.h +@@ -287,8 +287,8 @@ private: + Q_PRIVATE_SLOT(d_func(), void _q_updateOkButton()) + Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QModelIndex &index)) + Q_PRIVATE_SLOT(d_func(), void _q_enterDirectory(const QModelIndex &index)) +- Q_PRIVATE_SLOT(d_func(), void _q_nativeFileSelected(const QUrl &)) +- Q_PRIVATE_SLOT(d_func(), void _q_nativeFilesSelected(const QList &)) ++ Q_PRIVATE_SLOT(d_func(), void _q_emitUrlSelected(const QUrl &)) ++ Q_PRIVATE_SLOT(d_func(), void _q_emitUrlsSelected(const QList &)) + Q_PRIVATE_SLOT(d_func(), void _q_nativeCurrentChanged(const QUrl &)) + Q_PRIVATE_SLOT(d_func(), void _q_nativeEnterDirectory(const QUrl&)) + Q_PRIVATE_SLOT(d_func(), void _q_goToDirectory(const QString &path)) +diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h +index 632bbca..9e1c23b 100644 +--- a/src/widgets/dialogs/qfiledialog_p.h ++++ b/src/widgets/dialogs/qfiledialog_p.h +@@ -210,8 +210,8 @@ public: + void _q_updateOkButton(); + void _q_currentChanged(const QModelIndex &index); + void _q_enterDirectory(const QModelIndex &index); +- void _q_nativeFileSelected(const QUrl &file); +- void _q_nativeFilesSelected(const QList &files); ++ void _q_emitUrlSelected(const QUrl &file); ++ void _q_emitUrlsSelected(const QList &files); + void _q_nativeCurrentChanged(const QUrl &file); + void _q_nativeEnterDirectory(const QUrl &directory); + void _q_goToDirectory(const QString &); +-- +2.1.1 + diff --git a/0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch b/0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch new file mode 100644 index 0000000..962ebbc --- /dev/null +++ b/0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch @@ -0,0 +1,339 @@ +From 17bc5a22d5b3c289478f6fb91cd344708d957078 Mon Sep 17 00:00:00 2001 +From: J-P Nurmi +Date: Thu, 6 Feb 2014 17:14:25 +0100 +Subject: [PATCH 1/1] QKdeTheme: use system-wide kdeglobals as a fallback + +Determine KDE prefixes in the following priority order: +- KDEHOME and KDEDIRS environment variables +- ~/.kde() +- read prefixes from /etc/kderc +- fallback to /etc/kde + +Task-number: QTBUG-36184 +Change-Id: I9010ea485f1954b21bda73b02993dbddef67eb1d +Reviewed-by: Dominik Holland +Reviewed-by: David Faure +(cherry picked from commit eedd300b0ecf83a365f48c084e09f1446238e157) +--- + .../themes/genericunix/qgenericunixthemes.cpp | 167 +++++++++++++-------- + .../themes/genericunix/qgenericunixthemes_p.h | 2 +- + 2 files changed, 103 insertions(+), 66 deletions(-) + +diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +index b68aa85..dac417a 100644 +--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp ++++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +@@ -51,6 +51,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -171,26 +172,26 @@ QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const + class QKdeThemePrivate : public QPlatformThemePrivate + { + public: +- QKdeThemePrivate(const QString &kdeHome, int kdeVersion) +- : kdeHome(kdeHome) ++ QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion) ++ : kdeDirs(kdeDirs) + , kdeVersion(kdeVersion) + , toolButtonStyle(Qt::ToolButtonTextBesideIcon) + , toolBarIconSize(0) + , singleClick(true) + { } + +- QString globalSettingsFile() const ++ static QString kdeGlobals(const QString &kdeDir) + { +- return kdeHome + QStringLiteral("/share/config/kdeglobals"); ++ return kdeDir + QStringLiteral("/share/config/kdeglobals"); + } + + void refresh(); +- static void readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal); +- static QFont *readKdeFontSetting(const QSettings &settings, const QString &key); +- static QStringList kdeIconThemeSearchPaths(const QString &kdeHome); ++ static QVariant readKdeSetting(const QString &key, const QStringList &kdeDirs, QHash &kdeSettings); ++ static void readKdeSystemPalette(const QStringList &kdeDirs, QHash &kdeSettings, QPalette *pal); ++ static QFont *kdeFont(const QVariant &fontValue); ++ static QStringList kdeIconThemeSearchPaths(const QStringList &kdeDirs); + +- +- const QString kdeHome; ++ const QStringList kdeDirs; + const int kdeVersion; + + ResourceHelper resources; +@@ -212,36 +213,33 @@ void QKdeThemePrivate::refresh() + styleNames << QStringLiteral("Oxygen") << QStringLiteral("fusion") << QStringLiteral("windows"); + iconFallbackThemeName = iconThemeName = QStringLiteral("oxygen"); + +- // Read settings file. +- const QString settingsFile = globalSettingsFile(); +- if (!QFileInfo(settingsFile).isReadable()) +- return; +- +- const QSettings kdeSettings(settingsFile, QSettings::IniFormat); ++ QHash kdeSettings; + + QPalette systemPalette = QPalette(); +- readKdeSystemPalette(kdeSettings, &systemPalette); ++ readKdeSystemPalette(kdeDirs, kdeSettings, &systemPalette); + resources.palettes[QPlatformTheme::SystemPalette] = new QPalette(systemPalette); + //## TODO tooltip color + +- const QVariant styleValue = kdeSettings.value(QStringLiteral("widgetStyle")); ++ const QVariant styleValue = readKdeSetting(QStringLiteral("widgetStyle"), kdeDirs, kdeSettings); + if (styleValue.isValid()) { + const QString style = styleValue.toString(); + if (style != styleNames.front()) + styleNames.push_front(style); + } + +- singleClick = kdeSettings.value(QStringLiteral("KDE/SingleClick"), true).toBool(); ++ const QVariant singleClickValue = readKdeSetting(QStringLiteral("KDE/SingleClick"), kdeDirs, kdeSettings); ++ if (singleClickValue.isValid()) ++ singleClick = singleClickValue.toBool(); + +- const QVariant themeValue = kdeSettings.value(QStringLiteral("Icons/Theme")); ++ const QVariant themeValue = readKdeSetting(QStringLiteral("Icons/Theme"), kdeDirs, kdeSettings); + if (themeValue.isValid()) + iconThemeName = themeValue.toString(); + +- const QVariant toolBarIconSizeValue = kdeSettings.value(QStringLiteral("ToolbarIcons/Size")); ++ const QVariant toolBarIconSizeValue = readKdeSetting(QStringLiteral("ToolbarIcons/Size"), kdeDirs, kdeSettings); + if (toolBarIconSizeValue.isValid()) + toolBarIconSize = toolBarIconSizeValue.toInt(); + +- const QVariant toolbarStyleValue = kdeSettings.value(QStringLiteral("ToolButtonStyle")); ++ const QVariant toolbarStyleValue = readKdeSetting(QStringLiteral("Toolbar style/ToolButtonStyle"), kdeDirs, kdeSettings); + if (toolbarStyleValue.isValid()) { + const QString toolBarStyle = toolbarStyleValue.toString(); + if (toolBarStyle == QStringLiteral("TextBesideIcon")) +@@ -253,26 +251,46 @@ void QKdeThemePrivate::refresh() + } + + // Read system font, ignore 'smallestReadableFont' +- if (QFont *systemFont = readKdeFontSetting(kdeSettings, QStringLiteral("font"))) ++ if (QFont *systemFont = kdeFont(readKdeSetting(QStringLiteral("font"), kdeDirs, kdeSettings))) + resources.fonts[QPlatformTheme::SystemFont] = systemFont; + else + resources.fonts[QPlatformTheme::SystemFont] = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize); + +- if (QFont *fixedFont = readKdeFontSetting(kdeSettings, QStringLiteral("fixed"))) { ++ if (QFont *fixedFont = kdeFont(readKdeSetting(QStringLiteral("fixed"), kdeDirs, kdeSettings))) { + resources.fonts[QPlatformTheme::FixedFont] = fixedFont; + } else { + fixedFont = new QFont(QLatin1String(defaultSystemFontNameC), defaultSystemFontSize); + fixedFont->setStyleHint(QFont::TypeWriter); + resources.fonts[QPlatformTheme::FixedFont] = fixedFont; + } ++ ++ qDeleteAll(kdeSettings); ++} ++ ++QVariant QKdeThemePrivate::readKdeSetting(const QString &key, const QStringList &kdeDirs, QHash &kdeSettings) ++{ ++ foreach (const QString &kdeDir, kdeDirs) { ++ QSettings *settings = kdeSettings.value(kdeDir); ++ if (!settings) { ++ const QString kdeGlobalsPath = kdeGlobals(kdeDir); ++ if (QFileInfo(kdeGlobalsPath).isReadable()) { ++ settings = new QSettings(kdeGlobalsPath, QSettings::IniFormat); ++ kdeSettings.insert(kdeDir, settings); ++ } ++ } ++ if (settings) { ++ const QVariant value = settings->value(key); ++ if (value.isValid()) ++ return value; ++ } ++ } ++ return QVariant(); + } + + // Reads the color from the KDE configuration, and store it in the + // palette with the given color role if found. +-static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, +- const QSettings &kdeSettings, const QString &key) ++static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QVariant &value) + { +- const QVariant value = kdeSettings.value(key); + if (!value.isValid()) + return false; + const QStringList values = value.toStringList(); +@@ -282,9 +300,9 @@ static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, + return true; + } + +-void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal) ++void QKdeThemePrivate::readKdeSystemPalette(const QStringList &kdeDirs, QHash &kdeSettings, QPalette *pal) + { +- if (!kdeSettings.contains(QStringLiteral("Colors:Button/BackgroundNormal"))) { ++ if (!kdeColor(pal, QPalette::Button, readKdeSetting(QStringLiteral("Colors:Button/BackgroundNormal"), kdeDirs, kdeSettings))) { + // kcolorscheme.cpp: SetDefaultColors + const QColor defaultWindowBackground(214, 210, 208); + const QColor defaultButtonBackground(223, 220, 217); +@@ -292,19 +310,18 @@ void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalet + return; + } + +- kdeColor(pal, QPalette::Button, kdeSettings, QStringLiteral("Colors:Button/BackgroundNormal")); +- kdeColor(pal, QPalette::Window, kdeSettings, QStringLiteral("Colors:Window/BackgroundNormal")); +- kdeColor(pal, QPalette::Text, kdeSettings, QStringLiteral("Colors:View/ForegroundNormal")); +- kdeColor(pal, QPalette::WindowText, kdeSettings, QStringLiteral("Colors:Window/ForegroundNormal")); +- kdeColor(pal, QPalette::Base, kdeSettings, QStringLiteral("Colors:View/BackgroundNormal")); +- kdeColor(pal, QPalette::Highlight, kdeSettings, QStringLiteral("Colors:Selection/BackgroundNormal")); +- kdeColor(pal, QPalette::HighlightedText, kdeSettings, QStringLiteral("Colors:Selection/ForegroundNormal")); +- kdeColor(pal, QPalette::AlternateBase, kdeSettings, QStringLiteral("Colors:View/BackgroundAlternate")); +- kdeColor(pal, QPalette::ButtonText, kdeSettings, QStringLiteral("Colors:Button/ForegroundNormal")); +- kdeColor(pal, QPalette::Link, kdeSettings, QStringLiteral("Colors:View/ForegroundLink")); +- kdeColor(pal, QPalette::LinkVisited, kdeSettings, QStringLiteral("Colors:View/ForegroundVisited")); +- kdeColor(pal, QPalette::ToolTipBase, kdeSettings, QStringLiteral("Colors:Tooltip/BackgroundNormal")); +- kdeColor(pal, QPalette::ToolTipText, kdeSettings, QStringLiteral("Colors:Tooltip/ForegroundNormal")); ++ kdeColor(pal, QPalette::Window, readKdeSetting(QStringLiteral("Colors:Window/BackgroundNormal"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::Text, readKdeSetting(QStringLiteral("Colors:View/ForegroundNormal"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::WindowText, readKdeSetting(QStringLiteral("Colors:Window/ForegroundNormal"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::Base, readKdeSetting(QStringLiteral("Colors:View/BackgroundNormal"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::Highlight, readKdeSetting(QStringLiteral("Colors:Selection/BackgroundNormal"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::HighlightedText, readKdeSetting(QStringLiteral("Colors:Selection/ForegroundNormal"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::AlternateBase, readKdeSetting(QStringLiteral("Colors:View/BackgroundAlternate"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::ButtonText, readKdeSetting(QStringLiteral("Colors:Button/ForegroundNormal"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::Link, readKdeSetting(QStringLiteral("Colors:View/ForegroundLink"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::LinkVisited, readKdeSetting(QStringLiteral("Colors:View/ForegroundVisited"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::ToolTipBase, readKdeSetting(QStringLiteral("Colors:Tooltip/BackgroundNormal"), kdeDirs, kdeSettings)); ++ kdeColor(pal, QPalette::ToolTipText, readKdeSetting(QStringLiteral("Colors:Tooltip/ForegroundNormal"), kdeDirs, kdeSettings)); + + // The above code sets _all_ color roles to "normal" colors. In KDE, the disabled + // color roles are calculated by applying various effects described in kdeglobals. +@@ -347,15 +364,14 @@ void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalet + + const char *QKdeTheme::name = "kde"; + +-QKdeTheme::QKdeTheme(const QString &kdeHome, int kdeVersion) +- : QPlatformTheme(new QKdeThemePrivate(kdeHome,kdeVersion)) ++QKdeTheme::QKdeTheme(const QStringList& kdeDirs, int kdeVersion) ++ : QPlatformTheme(new QKdeThemePrivate(kdeDirs,kdeVersion)) + { + d_func()->refresh(); + } + +-QFont *QKdeThemePrivate::readKdeFontSetting(const QSettings &settings, const QString &key) ++QFont *QKdeThemePrivate::kdeFont(const QVariant &fontValue) + { +- const QVariant fontValue = settings.value(key); + if (fontValue.isValid()) { + // Read font value: Might be a QStringList as KDE stores fonts without quotes. + // Also retrieve the family for the constructor since we cannot use the +@@ -382,16 +398,11 @@ QFont *QKdeThemePrivate::readKdeFontSetting(const QSettings &settings, const QSt + } + + +-QStringList QKdeThemePrivate::kdeIconThemeSearchPaths(const QString &kdeHome) ++QStringList QKdeThemePrivate::kdeIconThemeSearchPaths(const QStringList &kdeDirs) + { +- QStringList candidates = QStringList(kdeHome); +- const QString kdeDirs = QFile::decodeName(qgetenv("KDEDIRS")); +- if (!kdeDirs.isEmpty()) +- candidates.append(kdeDirs.split(QLatin1Char(':'))); +- + QStringList paths = QGenericUnixTheme::xdgIconThemePaths(); + const QString iconPath = QStringLiteral("/share/icons"); +- foreach (const QString &candidate, candidates) { ++ foreach (const QString &candidate, kdeDirs) { + const QFileInfo fi(candidate + iconPath); + if (fi.isDir()) + paths.append(fi.absoluteFilePath()); +@@ -418,7 +429,7 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const + case QPlatformTheme::SystemIconFallbackThemeName: + return QVariant(d->iconFallbackThemeName); + case QPlatformTheme::IconThemeSearchPaths: +- return QVariant(d->kdeIconThemeSearchPaths(d->kdeHome)); ++ return QVariant(d->kdeIconThemeSearchPaths(d->kdeDirs)); + case QPlatformTheme::StyleNames: + return QVariant(d->styleNames); + case QPlatformTheme::KeyboardScheme: +@@ -445,26 +456,52 @@ const QFont *QKdeTheme::font(Font type) const + + QPlatformTheme *QKdeTheme::createKdeTheme() + { +- // Check for version >= 4 and determine home folder from environment, +- // defaulting to ~/.kde, ~/.kde + const QByteArray kdeVersionBA = qgetenv("KDE_SESSION_VERSION"); + const int kdeVersion = kdeVersionBA.toInt(); + if (kdeVersion < 4) + return 0; +- const QString kdeHomePathVar = QString::fromLocal8Bit(qgetenv("KDEHOME")); ++ ++ // Determine KDE prefixes in the following priority order: ++ // - KDEHOME and KDEDIRS environment variables ++ // - ~/.kde() ++ // - read prefixes from /etc/kderc ++ // - fallback to /etc/kde ++ ++ QStringList kdeDirs; ++ const QString kdeHomePathVar = QFile::decodeName(qgetenv("KDEHOME")); + if (!kdeHomePathVar.isEmpty()) +- return new QKdeTheme(kdeHomePathVar, kdeVersion); ++ kdeDirs += kdeHomePathVar; ++ ++ const QString kdeDirsVar = QFile::decodeName(qgetenv("KDEDIRS")); ++ if (!kdeDirsVar.isEmpty()) ++ kdeDirs += kdeDirsVar.split(QLatin1Char(':'), QString::SkipEmptyParts); ++ ++ const QString kdeVersionHomePath = QDir::homePath() + QStringLiteral("/.kde") + QLatin1String(kdeVersionBA); ++ if (QFileInfo(kdeVersionHomePath).isDir()) ++ kdeDirs += kdeVersionHomePath; + +- const QString kdeVersionHomePath = QDir::homePath() + QStringLiteral("/.kde") + QLatin1String(kdeVersionBA); +- if (QFileInfo(kdeVersionHomePath).isDir()) +- return new QKdeTheme(kdeVersionHomePath, kdeVersion); ++ const QString kdeHomePath = QDir::homePath() + QStringLiteral("/.kde"); ++ if (QFileInfo(kdeHomePath).isDir()) ++ kdeDirs += kdeHomePath; + +- const QString kdeHomePath = QDir::homePath() + QStringLiteral("/.kde"); +- if (QFileInfo(kdeHomePath).isDir()) +- return new QKdeTheme(kdeHomePath, kdeVersion); ++ const QString kdeRcPath = QStringLiteral("/etc/kde") + QLatin1String(kdeVersionBA) + QStringLiteral("rc"); ++ if (QFileInfo(kdeRcPath).isReadable()) { ++ QSettings kdeSettings(kdeRcPath, QSettings::IniFormat); ++ kdeSettings.beginGroup(QStringLiteral("Directories-default")); ++ kdeDirs += kdeSettings.value(QStringLiteral("prefixes")).toStringList(); ++ } ++ ++ const QString kdeVersionPrefix = QStringLiteral("/etc/kde") + QLatin1String(kdeVersionBA); ++ if (QFileInfo(kdeVersionPrefix).isDir()) ++ kdeDirs += kdeVersionPrefix; ++ ++ kdeDirs.removeDuplicates(); ++ if (kdeDirs.isEmpty()) { ++ qWarning("%s: Unable to determine KDE dirs", Q_FUNC_INFO); ++ return 0; ++ } + +- qWarning("%s: Unable to determine KDEHOME", Q_FUNC_INFO); +- return 0; ++ return new QKdeTheme(kdeDirs, kdeVersion); + } + + #endif // QT_NO_SETTINGS +diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +index fd65402..509a26d 100644 +--- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h ++++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +@@ -87,7 +87,7 @@ class QKdeTheme : public QPlatformTheme + { + Q_DECLARE_PRIVATE(QKdeTheme) + public: +- QKdeTheme(const QString &kdeHome, int kdeVersion); ++ QKdeTheme(const QStringList& kdeDirs, int kdeVersion); + + static QPlatformTheme *createKdeTheme(); + virtual QVariant themeHint(ThemeHint hint) const; +-- +2.1.1 + diff --git a/0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch b/0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch new file mode 100644 index 0000000..fdd5c83 --- /dev/null +++ b/0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch @@ -0,0 +1,254 @@ +From 6528af73e7e3fda1c3abdebac1d9dc13aba8af10 Mon Sep 17 00:00:00 2001 +From: Allan Sandfeld Jensen +Date: Wed, 13 Aug 2014 12:19:30 +0200 +Subject: [PATCH 2/4] Move SubpixelAntialiasingType from QFontEngineFT to + QFontEngine + +To be able to use the SubpixelAntialiasingType enum without depending +on QFontEngineFT we need to move it to QFontEngine. + +The patch also cleans up the left-overs of other enums moved the same +way. + +Change-Id: I025bc8a5b429d376cfab0a643121ed6f99204988 +Reviewed-by: Konstantin Ritt +(cherry picked from commit 9e1d6eec8eb7e393d1d0cc7efd24629e80b59289) +--- + src/gui/text/qfontengine_ft.cpp | 12 ++--- + src/gui/text/qfontengine_ft_p.h | 8 --- + src/gui/text/qfontengine_p.h | 8 +++ + .../fontconfig/qfontconfigdatabase.cpp | 60 +++++++++++----------- + 4 files changed, 44 insertions(+), 44 deletions(-) + +diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp +index f5ca559..ad4276b 100644 +--- a/src/gui/text/qfontengine_ft.cpp ++++ b/src/gui/text/qfontengine_ft.cpp +@@ -813,11 +813,11 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, + if (format == Format_Mono) { + load_target = FT_LOAD_TARGET_MONO; + } else if (format == Format_A32) { +- if (subpixelType == QFontEngineFT::Subpixel_RGB || subpixelType == QFontEngineFT::Subpixel_BGR) { ++ if (subpixelType == Subpixel_RGB || subpixelType == Subpixel_BGR) { + if (default_hint_style == HintFull) + load_target = FT_LOAD_TARGET_LCD; + hsubpixel = true; +- } else if (subpixelType == QFontEngineFT::Subpixel_VRGB || subpixelType == QFontEngineFT::Subpixel_VBGR) { ++ } else if (subpixelType == Subpixel_VRGB || subpixelType == Subpixel_VBGR) { + if (default_hint_style == HintFull) + load_target = FT_LOAD_TARGET_LCD_V; + vfactor = 3; +@@ -977,9 +977,9 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, + glyph_buffer = new uchar[glyph_buffer_size]; + + if (hsubpixel) +- convertRGBToARGB(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB, false); ++ convertRGBToARGB(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != Subpixel_RGB, false); + else if (vfactor != 1) +- convertRGBToARGB_V(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB, false); ++ convertRGBToARGB_V(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != Subpixel_VRGB, false); + } else + #endif + { +@@ -1091,10 +1091,10 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, + convoluteBitmap(bitmap.buffer, convoluted, bitmap.width, info.height, bitmap.pitch); + buffer = convoluted; + } +- convertRGBToARGB(buffer + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB, useLegacyLcdFilter); ++ convertRGBToARGB(buffer + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != Subpixel_RGB, useLegacyLcdFilter); + delete [] convoluted; + } else if (vfactor != 1) { +- convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB, true); ++ convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != Subpixel_VRGB, true); + } else if (format == Format_A32 && bitmap.pixel_mode == FT_PIXEL_MODE_GRAY) { + convertGRAYToARGB(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch); + } +diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h +index 8bdf991..ba603b9 100644 +--- a/src/gui/text/qfontengine_ft_p.h ++++ b/src/gui/text/qfontengine_ft_p.h +@@ -150,14 +150,6 @@ public: + uchar *data; + }; + +- enum SubpixelAntialiasingType { +- Subpixel_None, +- Subpixel_RGB, +- Subpixel_BGR, +- Subpixel_VRGB, +- Subpixel_VBGR +- }; +- + struct GlyphInfo { + unsigned short width; + unsigned short height; +diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h +index fc849d7..fdd4785 100644 +--- a/src/gui/text/qfontengine_p.h ++++ b/src/gui/text/qfontengine_p.h +@@ -261,6 +261,14 @@ public: + }; + virtual void setDefaultHintStyle(HintStyle) { } + ++ enum SubpixelAntialiasingType { ++ Subpixel_None, ++ Subpixel_RGB, ++ Subpixel_BGR, ++ Subpixel_VRGB, ++ Subpixel_VBGR ++ }; ++ + private: + const Type m_type; + +diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +index e10e10b..d95bcb9 100644 +--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp ++++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +@@ -517,15 +517,15 @@ QFontEngineMulti *QFontconfigDatabase::fontEngineMulti(QFontEngine *fontEngine, + } + + namespace { +-QFontEngineFT::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintingPreference, FcPattern *match) ++QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintingPreference, FcPattern *match) + { + switch (hintingPreference) { + case QFont::PreferNoHinting: +- return QFontEngineFT::HintNone; ++ return QFontEngine::HintNone; + case QFont::PreferVerticalHinting: +- return QFontEngineFT::HintLight; ++ return QFontEngine::HintLight; + case QFont::PreferFullHinting: +- return QFontEngineFT::HintFull; ++ return QFontEngine::HintFull; + case QFont::PreferDefaultHinting: + break; + } +@@ -545,21 +545,21 @@ QFontEngineFT::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hint + hint_style = FC_HINT_FULL; + switch (hint_style) { + case FC_HINT_NONE: +- return QFontEngineFT::HintNone; ++ return QFontEngine::HintNone; + case FC_HINT_SLIGHT: +- return QFontEngineFT::HintLight; ++ return QFontEngine::HintLight; + case FC_HINT_MEDIUM: +- return QFontEngineFT::HintMedium; ++ return QFontEngine::HintMedium; + case FC_HINT_FULL: +- return QFontEngineFT::HintFull; ++ return QFontEngine::HintFull; + default: + Q_UNREACHABLE(); + break; + } +- return QFontEngineFT::HintFull; ++ return QFontEngine::HintFull; + } + +-QFontEngineFT::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match) ++QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match) + { + int subpixel = FC_RGBA_UNKNOWN; + FcPatternGetInteger(match, FC_RGBA, 0, &subpixel); +@@ -567,20 +567,20 @@ QFontEngineFT::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match) + switch (subpixel) { + case FC_RGBA_UNKNOWN: + case FC_RGBA_NONE: +- return QFontEngineFT::Subpixel_None; ++ return QFontEngine::Subpixel_None; + case FC_RGBA_RGB: +- return QFontEngineFT::Subpixel_RGB; ++ return QFontEngine::Subpixel_RGB; + case FC_RGBA_BGR: +- return QFontEngineFT::Subpixel_BGR; ++ return QFontEngine::Subpixel_BGR; + case FC_RGBA_VRGB: +- return QFontEngineFT::Subpixel_VRGB; ++ return QFontEngine::Subpixel_VRGB; + case FC_RGBA_VBGR: +- return QFontEngineFT::Subpixel_VBGR; ++ return QFontEngine::Subpixel_VBGR; + default: + Q_UNREACHABLE(); + break; + } +- return QFontEngineFT::Subpixel_None; ++ return QFontEngine::Subpixel_None; + } + } // namespace + +@@ -599,7 +599,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr) + bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias); + engine = new QFontEngineFT(fontDef); + +- QFontEngineFT::GlyphFormat format; ++ QFontEngine::GlyphFormat format; + // try and get the pattern + FcPattern *pattern = FcPatternCreate(); + +@@ -634,20 +634,20 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr) + } + + if (antialias) { +- QFontEngineFT::SubpixelAntialiasingType subpixelType = QFontEngineFT::Subpixel_None; ++ QFontEngine::SubpixelAntialiasingType subpixelType = QFontEngine::Subpixel_None; + if (!(f.styleStrategy & QFont::NoSubpixelAntialias)) + subpixelType = subpixelTypeFromMatch(match); + engine->subpixelType = subpixelType; + +- format = (subpixelType == QFontEngineFT::Subpixel_None) +- ? QFontEngineFT::Format_A8 +- : QFontEngineFT::Format_A32; ++ format = (subpixelType == QFontEngine::Subpixel_None) ++ ? QFontEngine::Format_A8 ++ : QFontEngine::Format_A32; + } else +- format = QFontEngineFT::Format_Mono; ++ format = QFontEngine::Format_Mono; + + FcPatternDestroy(match); + } else +- format = antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono; ++ format = antialias ? QFontEngine::Format_A8 : QFontEngine::Format_Mono; + + FcPatternDestroy(pattern); + +@@ -667,7 +667,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal p + + QFontDef fontDef = engine->fontDef; + +- QFontEngineFT::GlyphFormat format; ++ QFontEngine::GlyphFormat format; + // try and get the pattern + FcPattern *pattern = FcPatternCreate(); + +@@ -692,17 +692,17 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal p + engine->antialias = fc_antialias; + + if (engine->antialias) { +- QFontEngineFT::SubpixelAntialiasingType subpixelType = subpixelTypeFromMatch(match); ++ QFontEngine::SubpixelAntialiasingType subpixelType = subpixelTypeFromMatch(match); + engine->subpixelType = subpixelType; + +- format = subpixelType == QFontEngineFT::Subpixel_None +- ? QFontEngineFT::Format_A8 +- : QFontEngineFT::Format_A32; ++ format = subpixelType == QFontEngine::Subpixel_None ++ ? QFontEngine::Format_A8 ++ : QFontEngine::Format_A32; + } else +- format = QFontEngineFT::Format_Mono; ++ format = QFontEngine::Format_Mono; + FcPatternDestroy(match); + } else +- format = QFontEngineFT::Format_A8; ++ format = QFontEngine::Format_A8; + + FcPatternDestroy(pattern); + +-- +2.1.1 + diff --git a/0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch b/0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch new file mode 100644 index 0000000..e0659a7 --- /dev/null +++ b/0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch @@ -0,0 +1,100 @@ +From 18bb76b3b27edf8d980e414bc2b91c44ad80aab2 Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Wed, 9 Jul 2014 15:03:35 +0200 +Subject: [PATCH 2/4] QUrl: fromLocalFile(QString()) should lead to an empty + URL. + +This is much more useful than the URL "file:", it allows to use +"empty path" and "empty URL" for the same meaning (e.g. not set). + +QFileDialog actually uses "file:" though, as the URL for the +"My Computer" item in the sidebar. This patch preserves that. + +[ChangeLog][QtCore][QUrl] QUrl::fromLocalFile now returns an empty URL +if the input string is empty. + +Change-Id: Ib5ce1a3cdf5f229368e5bcd83c62c1d1ac9f8a17 +Reviewed-by: Thiago Macieira +(cherry picked from commit fd331a5b3a122393cd697a8b856dd52cfd31d698) +--- + src/corelib/io/qurl.cpp | 4 ++++ + src/widgets/dialogs/qfiledialog.cpp | 4 ++-- + src/widgets/dialogs/qsidebar.cpp | 3 ++- + tests/auto/corelib/io/qurl/tst_qurl.cpp | 5 +++++ + 4 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp +index c109fc4..00ffc4f 100644 +--- a/src/corelib/io/qurl.cpp ++++ b/src/corelib/io/qurl.cpp +@@ -3714,11 +3714,15 @@ bool QUrl::isDetached() const + "//servername/path/to/file.txt". Note that only certain platforms can + actually open this file using QFile::open(). + ++ An empty \a localFile leads to an empty URL (since Qt 5.4). ++ + \sa toLocalFile(), isLocalFile(), QDir::toNativeSeparators() + */ + QUrl QUrl::fromLocalFile(const QString &localFile) + { + QUrl url; ++ if (localFile.isEmpty()) ++ return url; + url.setScheme(fileScheme()); + QString deslashified = QDir::fromNativeSeparators(localFile); + +diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp +index 037964b..82a4a4c 100644 +--- a/src/widgets/dialogs/qfiledialog.cpp ++++ b/src/widgets/dialogs/qfiledialog.cpp +@@ -2783,7 +2783,7 @@ void QFileDialogPrivate::createWidgets() + qFileDialogUi->setupUi(q); + + QList initialBookmarks; +- initialBookmarks << QUrl::fromLocalFile(QLatin1String("")) ++ initialBookmarks << QUrl(QLatin1String("file:")) + << QUrl::fromLocalFile(QDir::homePath()); + qFileDialogUi->sidebar->setModelAndUrls(model, initialBookmarks); + QFileDialog::connect(qFileDialogUi->sidebar, SIGNAL(goToUrl(QUrl)), +@@ -3760,7 +3760,7 @@ void QFileDialogComboBox::showPopup() + idx = idx.parent(); + } + // add "my computer" +- list.append(QUrl::fromLocalFile(QLatin1String(""))); ++ list.append(QUrl(QLatin1String("file:"))); + urlModel->addUrls(list, 0); + idx = model()->index(model()->rowCount() - 1, 0); + +diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp +index 3d22992..7b691dc 100644 +--- a/src/widgets/dialogs/qsidebar.cpp ++++ b/src/widgets/dialogs/qsidebar.cpp +@@ -249,7 +249,8 @@ void QUrlModel::addUrls(const QList &list, int row, bool move) + continue; + //this makes sure the url is clean + const QString cleanUrl = QDir::cleanPath(url.toLocalFile()); +- url = QUrl::fromLocalFile(cleanUrl); ++ if (!cleanUrl.isEmpty()) ++ url = QUrl::fromLocalFile(cleanUrl); + + for (int j = 0; move && j < rowCount(); ++j) { + QString local = index(j, 0).data(UrlRole).toUrl().toLocalFile(); +diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp +index d5eab54..b8bab87 100644 +--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp ++++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp +@@ -235,6 +235,11 @@ void tst_QUrl::constructing() + QVERIFY(url == url); + QVERIFY(!(url < url)); + ++ QUrl fromLocal = QUrl::fromLocalFile(QString()); ++ QVERIFY(!fromLocal.isValid()); ++ QVERIFY(fromLocal.isEmpty()); ++ QCOMPARE(fromLocal.toString(), QString()); ++ + QUrl justHost("qt-project.org"); + QVERIFY(!justHost.isEmpty()); + QVERIFY(justHost.host().isEmpty()); +-- +2.1.1 + diff --git a/0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch b/0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch new file mode 100644 index 0000000..85da1cf --- /dev/null +++ b/0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch @@ -0,0 +1,315 @@ +From c738b6f8a3d4b76fcd19be9d046e903eabc3301c Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Wed, 9 Jul 2014 11:54:36 +0200 +Subject: [PATCH 3/4] QFileDialog: turn workingDirectory into a QUrl + +In order to make this work better with remote URLs. + +Change-Id: Ic440735142441150838b05e88940adcc12a90d09 +Reviewed-by: Friedemann Kleint +(cherry picked from commit cd3331802516c012aed1be329e2e889478cbdd3e) +--- + src/widgets/dialogs/qfiledialog.cpp | 106 +++++++++++++++++++++--------------- + src/widgets/dialogs/qfiledialog_p.h | 10 ++-- + 2 files changed, 68 insertions(+), 48 deletions(-) + +diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp +index 82a4a4c..ab0361a 100644 +--- a/src/widgets/dialogs/qfiledialog.cpp ++++ b/src/widgets/dialogs/qfiledialog.cpp +@@ -78,7 +78,7 @@ extern bool qt_priv_ptr_valid; + + QT_BEGIN_NAMESPACE + +-Q_GLOBAL_STATIC(QString, lastVisitedDir) ++Q_GLOBAL_STATIC(QUrl, lastVisitedDir) + + /*! + \class QFileDialog +@@ -373,7 +373,7 @@ QFileDialog::QFileDialog(QWidget *parent, + : QDialog(*new QFileDialogPrivate, parent, 0) + { + Q_D(QFileDialog); +- d->init(directory, filter, caption); ++ d->init(QUrl::fromLocalFile(directory), filter, caption); + } + + /*! +@@ -444,7 +444,7 @@ static const qint32 QFileDialogMagic = 0xbe; + QByteArray QFileDialog::saveState() const + { + Q_D(const QFileDialog); +- int version = 3; ++ int version = 4; + QByteArray data; + QDataStream stream(&data, QIODevice::WriteOnly); + +@@ -479,7 +479,6 @@ QByteArray QFileDialog::saveState() const + bool QFileDialog::restoreState(const QByteArray &state) + { + Q_D(QFileDialog); +- int version = 3; + QByteArray sd = state; + QDataStream stream(&sd, QIODevice::ReadOnly); + if (stream.atEnd()) +@@ -488,23 +487,30 @@ bool QFileDialog::restoreState(const QByteArray &state) + QByteArray headerData; + QList bookmarks; + QStringList history; +- QString currentDirectory; ++ QUrl currentDirectory; + qint32 marker; + qint32 v; + qint32 viewMode; + stream >> marker; + stream >> v; +- if (marker != QFileDialogMagic || v != version) ++ // the code below only supports versions 3 and 4 ++ if (marker != QFileDialogMagic || (v != 3 && v != 4)) + return false; + + stream >> splitterState + >> bookmarks +- >> history +- >> currentDirectory +- >> headerData ++ >> history; ++ if (v == 3) { ++ QString currentDirectoryString; ++ stream >> currentDirectoryString; ++ currentDirectory = QUrl::fromLocalFile(currentDirectoryString); ++ } else { ++ stream >> currentDirectory; ++ } ++ stream >> headerData + >> viewMode; + +- setDirectory(lastVisitedDir()->isEmpty() ? currentDirectory : *lastVisitedDir()); ++ setDirectoryUrl(lastVisitedDir()->isEmpty() ? currentDirectory : *lastVisitedDir()); + setViewMode(static_cast(viewMode)); + + if (!d->usingWidgets()) +@@ -630,7 +636,7 @@ void QFileDialogPrivate::retranslateWindowTitle() + setWindowTitle = q->windowTitle(); + } + +-void QFileDialogPrivate::setLastVisitedDirectory(const QString &dir) ++void QFileDialogPrivate::setLastVisitedDirectory(const QUrl &dir) + { + *lastVisitedDir() = dir; + } +@@ -944,11 +950,12 @@ void QFileDialog::setDirectory(const QString &directory) + if (!directory.isEmpty() && newDirectory.isEmpty()) + return; + +- d->setLastVisitedDirectory(newDirectory); ++ QUrl newDirUrl = QUrl::fromLocalFile(newDirectory); ++ d->setLastVisitedDirectory(newDirUrl); + + d->options->setInitialDirectory(QUrl::fromLocalFile(directory)); + if (!d->usingWidgets()) { +- d->setDirectory_sys(QUrl::fromLocalFile(newDirectory)); ++ d->setDirectory_sys(newDirUrl); + return; + } + if (d->rootPath() == newDirectory) +@@ -995,6 +1002,9 @@ void QFileDialog::setDirectoryUrl(const QUrl &directory) + if (!directory.isValid()) + return; + ++ d->setLastVisitedDirectory(directory); ++ d->options->setInitialDirectory(directory); ++ + if (d->nativeDialogInUse) + d->setDirectory_sys(directory); + else if (directory.isLocalFile()) +@@ -2103,8 +2113,8 @@ QString QFileDialog::getOpenFileName(QWidget *parent, + QFileDialogArgs args; + args.parent = parent; + args.caption = caption; +- args.directory = QFileDialogPrivate::workingDirectory(dir); +- args.selection = QFileDialogPrivate::initialSelection(dir); ++ args.directory = QFileDialogPrivate::workingDirectory(QUrl::fromLocalFile(dir)); ++ args.selection = QFileDialogPrivate::initialSelection(QUrl::fromLocalFile(dir)); + args.filter = filter; + args.mode = ExistingFile; + args.options = options; +@@ -2231,8 +2241,8 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, + QFileDialogArgs args; + args.parent = parent; + args.caption = caption; +- args.directory = QFileDialogPrivate::workingDirectory(dir); +- args.selection = QFileDialogPrivate::initialSelection(dir); ++ args.directory = QFileDialogPrivate::workingDirectory(QUrl::fromLocalFile(dir)); ++ args.selection = QFileDialogPrivate::initialSelection(QUrl::fromLocalFile(dir)); + args.filter = filter; + args.mode = ExistingFiles; + args.options = options; +@@ -2363,8 +2373,8 @@ QString QFileDialog::getSaveFileName(QWidget *parent, + QFileDialogArgs args; + args.parent = parent; + args.caption = caption; +- args.directory = QFileDialogPrivate::workingDirectory(dir); +- args.selection = QFileDialogPrivate::initialSelection(dir); ++ args.directory = QFileDialogPrivate::workingDirectory(QUrl::fromLocalFile(dir)); ++ args.selection = QFileDialogPrivate::initialSelection(QUrl::fromLocalFile(dir)); + args.filter = filter; + args.mode = AnyFile; + args.options = options; +@@ -2477,7 +2487,7 @@ QString QFileDialog::getExistingDirectory(QWidget *parent, + QFileDialogArgs args; + args.parent = parent; + args.caption = caption; +- args.directory = QFileDialogPrivate::workingDirectory(dir); ++ args.directory = QFileDialogPrivate::workingDirectory(QUrl::fromLocalFile(dir)); + args.mode = (options & ShowDirsOnly ? DirectoryOnly : Directory); + args.options = options; + +@@ -2538,32 +2548,36 @@ QUrl QFileDialog::getExistingDirectoryUrl(QWidget *parent, + return dialogResultToUrl(getExistingDirectory(parent, caption, dir.toLocalFile(), options)); + } + +-inline static QString _qt_get_directory(const QString &path) ++inline static QUrl _qt_get_directory(const QUrl &url) + { +- QFileInfo info = QFileInfo(QDir::current(), path); +- if (info.exists() && info.isDir()) +- return QDir::cleanPath(info.absoluteFilePath()); +- info.setFile(info.absolutePath()); +- if (info.exists() && info.isDir()) +- return info.absoluteFilePath(); +- return QString(); ++ if (url.isLocalFile()) { ++ QFileInfo info = QFileInfo(QDir::current(), url.toLocalFile()); ++ if (info.exists() && info.isDir()) ++ return QUrl::fromLocalFile(QDir::cleanPath(info.absoluteFilePath())); ++ info.setFile(info.absolutePath()); ++ if (info.exists() && info.isDir()) ++ return QUrl::fromLocalFile(info.absoluteFilePath()); ++ return QUrl(); ++ } else { ++ return url; ++ } + } + /* +- Get the initial directory path ++ Get the initial directory URL + + \sa initialSelection() + */ +-QString QFileDialogPrivate::workingDirectory(const QString &path) ++QUrl QFileDialogPrivate::workingDirectory(const QUrl &url) + { +- if (!path.isEmpty()) { +- QString directory = _qt_get_directory(path); ++ if (!url.isEmpty()) { ++ QUrl directory = _qt_get_directory(url); + if (!directory.isEmpty()) + return directory; + } +- QString directory = _qt_get_directory(*lastVisitedDir()); ++ QUrl directory = _qt_get_directory(*lastVisitedDir()); + if (!directory.isEmpty()) + return directory; +- return QDir::currentPath(); ++ return QUrl::fromLocalFile(QDir::currentPath()); + } + + /* +@@ -2573,14 +2587,19 @@ QString QFileDialogPrivate::workingDirectory(const QString &path) + + \sa workingDirectory() + */ +-QString QFileDialogPrivate::initialSelection(const QString &path) ++QString QFileDialogPrivate::initialSelection(const QUrl &url) + { +- if (!path.isEmpty()) { +- QFileInfo info(path); ++ if (url.isEmpty()) ++ return QString(); ++ if (url.isLocalFile()) { ++ QFileInfo info(url.toLocalFile()); + if (!info.isDir()) + return info.fileName(); ++ else ++ return QString(); + } +- return QString(); ++ // With remote URLs we can only assume. ++ return url.fileName(); + } + + /*! +@@ -2717,7 +2736,7 @@ void QFileDialog::accept() + + Create widgets, layout and set default values + */ +-void QFileDialogPrivate::init(const QString &directory, const QString &nameFilter, ++void QFileDialogPrivate::init(const QUrl &directory, const QString &nameFilter, + const QString &caption) + { + Q_Q(QFileDialog); +@@ -2734,7 +2753,7 @@ void QFileDialogPrivate::init(const QString &directory, const QString &nameFilte + q->setFileMode(QFileDialog::AnyFile); + if (!nameFilter.isEmpty()) + q->setNameFilter(nameFilter); +- q->setDirectory(workingDirectory(directory)); ++ q->setDirectoryUrl(workingDirectory(directory)); + q->selectFile(initialSelection(directory)); + + #ifndef QT_NO_SETTINGS +@@ -3683,9 +3702,10 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory) + { + Q_Q(QFileDialog); + emit q->directoryUrlEntered(directory); +- if (!directory.isEmpty() && directory.isLocalFile()) { // Windows native dialogs occasionally emit signals with empty strings. +- *lastVisitedDir() = directory.toLocalFile(); +- emit q->directoryEntered(directory.toLocalFile()); ++ if (!directory.isEmpty()) { // Windows native dialogs occasionally emit signals with empty strings. ++ *lastVisitedDir() = directory; ++ if (directory.isLocalFile()) ++ emit q->directoryEntered(directory.toLocalFile()); + } + } + +diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h +index 9e1c23b..175760c 100644 +--- a/src/widgets/dialogs/qfiledialog_p.h ++++ b/src/widgets/dialogs/qfiledialog_p.h +@@ -100,7 +100,7 @@ struct QFileDialogArgs + + QWidget *parent; + QString caption; +- QString directory; ++ QUrl directory; + QString selection; + QString filter; + QFileDialog::FileMode mode; +@@ -123,12 +123,12 @@ public: + void createMenuActions(); + void createWidgets(); + +- void init(const QString &directory = QString(), const QString &nameFilter = QString(), ++ void init(const QUrl &directory = QUrl(), const QString &nameFilter = QString(), + const QString &caption = QString()); + bool itemViewKeyboardEvent(QKeyEvent *event); + QString getEnvironmentVariable(const QString &string); +- static QString workingDirectory(const QString &path); +- static QString initialSelection(const QString &path); ++ static QUrl workingDirectory(const QUrl &path); ++ static QString initialSelection(const QUrl &path); + QStringList typedFiles() const; + QList userSelectedFiles() const; + QStringList addDefaultSuffixToFiles(const QStringList filesToFix) const; +@@ -189,7 +189,7 @@ public: + #endif + } + +- void setLastVisitedDirectory(const QString &dir); ++ void setLastVisitedDirectory(const QUrl &dir); + void retranslateWindowTitle(); + void retranslateStrings(); + void emitFilesSelected(const QStringList &files); +-- +2.1.1 + diff --git a/0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch b/0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch new file mode 100644 index 0000000..4338093 --- /dev/null +++ b/0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch @@ -0,0 +1,93 @@ +From e5d61b2531ce2000e7e230d4cfdb793fa2b686e8 Mon Sep 17 00:00:00 2001 +From: Allan Sandfeld Jensen +Date: Mon, 11 Aug 2014 14:03:35 +0200 +Subject: [PATCH 3/4] Support autohint and lcdfilter fontconfig configuration + +This patch adds support for reading autohint and lcdfilter settings +from fontconfig and pass them on to freetype. + +Task-number: QTBUG-32254 +Change-Id: Iaa69b70f7005ee7f21126a8d984c07b3a46a3e7f +Reviewed-by: Eskil Abrahamsen Blomfeldt +(cherry picked from commit b35176f43a953d56380414f05834c7918762cb83) +--- + src/gui/text/qfontengine_ft.cpp | 4 ++++ + src/gui/text/qfontengine_ft_p.h | 1 + + .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 20 ++++++++++++++++++++ + 3 files changed, 25 insertions(+) + +diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp +index ad4276b..eef316b 100644 +--- a/src/gui/text/qfontengine_ft.cpp ++++ b/src/gui/text/qfontengine_ft.cpp +@@ -678,6 +678,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd) + const QByteArray env = qgetenv("QT_NO_FT_CACHE"); + cacheEnabled = env.isEmpty() || env.toInt() == 0; + m_subPixelPositionCount = 4; ++ forceAutoHint = false; + } + + QFontEngineFT::~QFontEngineFT() +@@ -832,6 +833,9 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, + else + load_flags |= load_target; + ++ if (forceAutoHint) ++ load_flags |= FT_LOAD_FORCE_AUTOHINT; ++ + return load_flags; + } + +diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h +index ba603b9..09c70c5 100644 +--- a/src/gui/text/qfontengine_ft_p.h ++++ b/src/gui/text/qfontengine_ft_p.h +@@ -307,6 +307,7 @@ protected: + int lcdFilterType; + bool embeddedbitmap; + bool cacheEnabled; ++ bool forceAutoHint; + + private: + friend class QFontEngineFTRawFont; +diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +index d95bcb9..0bf119c 100644 +--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp ++++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +@@ -625,6 +625,16 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr) + if (match) { + engine->setDefaultHintStyle(defaultHintStyleFromMatch((QFont::HintingPreference)f.hintingPreference, match)); + ++ FcBool fc_autohint; ++ if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch) ++ engine->forceAutoHint = fc_autohint; ++ ++#if defined(FT_LCD_FILTER_H) ++ int lcdFilter; ++ if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch) ++ engine->lcdFilterType = lcdFilter; ++#endif ++ + if (antialias) { + // If antialiasing is not fully disabled, fontconfig may still disable it on a font match basis. + FcBool fc_antialias; +@@ -686,6 +696,16 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal p + if (match) { + engine->setDefaultHintStyle(defaultHintStyleFromMatch(hintingPreference, match)); + ++ FcBool fc_autohint; ++ if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch) ++ engine->forceAutoHint = fc_autohint; ++ ++#if defined(FT_LCD_FILTER_H) ++ int lcdFilter; ++ if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch) ++ engine->lcdFilterType = lcdFilter; ++#endif ++ + FcBool fc_antialias; + if (FcPatternGetBool(match, FC_ANTIALIAS,0, &fc_antialias) != FcResultMatch) + fc_antialias = true; +-- +2.1.1 + diff --git a/0004-GTK2-theme-should-use-GTK-configured-font-variant.patch b/0004-GTK2-theme-should-use-GTK-configured-font-variant.patch new file mode 100644 index 0000000..7f49cca --- /dev/null +++ b/0004-GTK2-theme-should-use-GTK-configured-font-variant.patch @@ -0,0 +1,126 @@ +From d7afdc53b28d107bbf8cdfd52777cb7cb9f2c10d Mon Sep 17 00:00:00 2001 +From: Allan Sandfeld Jensen +Date: Tue, 12 Aug 2014 16:59:18 +0200 +Subject: [PATCH 4/4] GTK2 theme should use GTK configured font variant + +This patch makes the GTK2 theme read the font configuration and use +that as the default system font. + +Task-number: QTBUG-39643 +Change-Id: Ieacf8968e54f34c6d44669350d349c9a96ed6cc5 +Reviewed-by: Shawn Rutledge +(cherry picked from commit 2a33bfcfd174d503e2f98c66d8de0a68783015da) +--- + .../themes/genericunix/qgenericunixthemes.cpp | 27 +++++++++++++++++----- + .../themes/genericunix/qgenericunixthemes_p.h | 2 ++ + src/plugins/platformthemes/gtk2/qgtk2theme.cpp | 8 +++++++ + src/plugins/platformthemes/gtk2/qgtk2theme.h | 3 ++- + 4 files changed, 33 insertions(+), 7 deletions(-) + +diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +index 4a1d67f..b68aa85 100644 +--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp ++++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +@@ -482,15 +482,23 @@ const char *QGnomeTheme::name = "gnome"; + class QGnomeThemePrivate : public QPlatformThemePrivate + { + public: +- QGnomeThemePrivate() +- : systemFont(QLatin1Literal(defaultSystemFontNameC), defaultSystemFontSize) +- , fixedFont(QStringLiteral("monospace"), systemFont.pointSize()) ++ QGnomeThemePrivate() : fontsConfigured(false) { } ++ void configureFonts(QString gtkFontName) const + { ++ Q_ASSERT(!fontsConfigured); ++ const int split = gtkFontName.lastIndexOf(QChar::Space); ++ float size = gtkFontName.mid(split+1).toFloat(); ++ QString fontName = gtkFontName.left(split); ++ ++ systemFont = QFont(fontName, size); ++ fixedFont = QFont(QLatin1String("monospace"), systemFont.pointSize()); + fixedFont.setStyleHint(QFont::TypeWriter); ++ fontsConfigured = true; + } + +- const QFont systemFont; +- QFont fixedFont; ++ mutable QFont systemFont; ++ mutable QFont fixedFont; ++ mutable bool fontsConfigured; + }; + + QGnomeTheme::QGnomeTheme() +@@ -528,9 +536,11 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const + const QFont *QGnomeTheme::font(Font type) const + { + Q_D(const QGnomeTheme); ++ if (!d->fontsConfigured) ++ d->configureFonts(gtkFontName()); + switch (type) { + case QPlatformTheme::SystemFont: +- return &d->systemFont; ++ return &d->systemFont; + case QPlatformTheme::FixedFont: + return &d->fixedFont; + default: +@@ -538,6 +548,11 @@ const QFont *QGnomeTheme::font(Font type) const + } + } + ++QString QGnomeTheme::gtkFontName() const ++{ ++ return QStringLiteral("%1 %2").arg(QLatin1String(defaultSystemFontNameC)).arg(defaultSystemFontSize); ++} ++ + QString QGnomeTheme::standardButtonText(int button) const + { + switch (button) { +diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +index 36fcdd8..fd65402 100644 +--- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h ++++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +@@ -111,6 +111,8 @@ public: + virtual const QFont *font(Font type) const; + QString standardButtonText(int button) const Q_DECL_OVERRIDE; + ++ virtual QString gtkFontName() const; ++ + static const char *name; + }; + +diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp +index 812f4bc..4df3a30 100644 +--- a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp ++++ b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp +@@ -85,6 +85,14 @@ QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const + } + } + ++QString QGtk2Theme::gtkFontName() const ++{ ++ QString cfgFontName = gtkSetting("gtk-font-name"); ++ if (!cfgFontName.isEmpty()) ++ return cfgFontName; ++ return QGnomeTheme::gtkFontName(); ++} ++ + bool QGtk2Theme::usePlatformNativeDialog(DialogType type) const + { + switch (type) { +diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.h b/src/plugins/platformthemes/gtk2/qgtk2theme.h +index a0bd34e..c74e58e 100644 +--- a/src/plugins/platformthemes/gtk2/qgtk2theme.h ++++ b/src/plugins/platformthemes/gtk2/qgtk2theme.h +@@ -51,7 +51,8 @@ class QGtk2Theme : public QGnomeTheme + public: + QGtk2Theme(); + +- QVariant themeHint(ThemeHint hint) const; ++ virtual QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; ++ virtual QString gtkFontName() const Q_DECL_OVERRIDE; + + bool usePlatformNativeDialog(DialogType type) const; + QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; +-- +2.1.1 + diff --git a/0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch b/0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch new file mode 100644 index 0000000..18b6a7c --- /dev/null +++ b/0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch @@ -0,0 +1,284 @@ +From 2dcade09fca04dc45848a5a653b160e96aaab1e8 Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Wed, 9 Jul 2014 12:01:05 +0200 +Subject: [PATCH 4/4] QFileDialog: implement getOpenFileUrl and friends for + real + +i.e. make them support remote URLs. +To avoid code duplication, getOpenFileName/getSaveFileName/getExistingDirectory +are now implemented in terms of getOpenFileUrl/getSaveFileUrl/getExistingDirectoryUrl. + +Change-Id: If409ac9ab72c2a65f04e2ef1dc28e7d47bbcd73c +Reviewed-by: Friedemann Kleint +(cherry picked from commit 1a9701fe81c39450822c0d4b51c11444380a2fe4) + +Conflicts: + src/widgets/dialogs/qfiledialog.cpp +--- + src/widgets/dialogs/qfiledialog.cpp | 199 +++++++++++++++--------------------- + 1 file changed, 81 insertions(+), 118 deletions(-) + +diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp +index ab0361a..bc4a0a3 100644 +--- a/src/widgets/dialogs/qfiledialog.cpp ++++ b/src/widgets/dialogs/qfiledialog.cpp +@@ -2110,35 +2110,9 @@ QString QFileDialog::getOpenFileName(QWidget *parent, + QString *selectedFilter, + Options options) + { +- QFileDialogArgs args; +- args.parent = parent; +- args.caption = caption; +- args.directory = QFileDialogPrivate::workingDirectory(QUrl::fromLocalFile(dir)); +- args.selection = QFileDialogPrivate::initialSelection(QUrl::fromLocalFile(dir)); +- args.filter = filter; +- args.mode = ExistingFile; +- args.options = options; +-#if defined(Q_WS_WIN) +- if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) { +- return qt_win_get_open_file_name(args, &(args.directory), selectedFilter); +- } +-#endif +- +- // create a qt dialog +- QFileDialog dialog(args); +- if (selectedFilter && !selectedFilter->isEmpty()) +- dialog.selectNameFilter(*selectedFilter); +- if (dialog.exec() == QDialog::Accepted) { +- if (selectedFilter) +- *selectedFilter = dialog.selectedNameFilter(); +- return dialog.selectedFiles().value(0); +- } +- return QString(); +-} +- +-static inline QUrl dialogResultToUrl(const QString &file) +-{ +- return file.isEmpty() ? QUrl() : QUrl::fromLocalFile(file); ++ const QStringList schemes = QStringList(QStringLiteral("file")); ++ const QUrl selectedUrl = getOpenFileUrl(parent, caption, QUrl::fromLocalFile(dir), filter, selectedFilter, options, schemes); ++ return selectedUrl.toLocalFile(); + } + + /*! +@@ -2176,10 +2150,26 @@ QUrl QFileDialog::getOpenFileUrl(QWidget *parent, + Options options, + const QStringList &supportedSchemes) + { +- Q_UNUSED(supportedSchemes); ++ Q_UNUSED(supportedSchemes); // TODO ++ ++ QFileDialogArgs args; ++ args.parent = parent; ++ args.caption = caption; ++ args.directory = QFileDialogPrivate::workingDirectory(dir); ++ args.selection = QFileDialogPrivate::initialSelection(dir); ++ args.filter = filter; ++ args.mode = ExistingFile; ++ args.options = options; + +- // Falls back to local file +- return dialogResultToUrl(getOpenFileName(parent, caption, dir.toLocalFile(), filter, selectedFilter, options)); ++ QFileDialog dialog(args); ++ if (selectedFilter && !selectedFilter->isEmpty()) ++ dialog.selectNameFilter(*selectedFilter); ++ if (dialog.exec() == QDialog::Accepted) { ++ if (selectedFilter) ++ *selectedFilter = dialog.selectedNameFilter(); ++ return dialog.selectedUrls().value(0); ++ } ++ return QUrl(); + } + + /*! +@@ -2238,31 +2228,12 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent, + QString *selectedFilter, + Options options) + { +- QFileDialogArgs args; +- args.parent = parent; +- args.caption = caption; +- args.directory = QFileDialogPrivate::workingDirectory(QUrl::fromLocalFile(dir)); +- args.selection = QFileDialogPrivate::initialSelection(QUrl::fromLocalFile(dir)); +- args.filter = filter; +- args.mode = ExistingFiles; +- args.options = options; +- +-#if defined(Q_WS_WIN) +- if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) { +- return qt_win_get_open_file_names(args, &(args.directory), selectedFilter); +- } +-#endif +- +- // create a qt dialog +- QFileDialog dialog(args); +- if (selectedFilter && !selectedFilter->isEmpty()) +- dialog.selectNameFilter(*selectedFilter); +- if (dialog.exec() == QDialog::Accepted) { +- if (selectedFilter) +- *selectedFilter = dialog.selectedNameFilter(); +- return dialog.selectedFiles(); +- } +- return QStringList(); ++ const QStringList schemes = QStringList(QStringLiteral("file")); ++ const QList selectedUrls = getOpenFileUrls(parent, caption, QUrl::fromLocalFile(dir), filter, selectedFilter, options, schemes); ++ QStringList fileNames; ++ foreach (const QUrl &url, selectedUrls) ++ fileNames << url.toLocalFile(); ++ return fileNames; + } + + /*! +@@ -2303,14 +2274,24 @@ QList QFileDialog::getOpenFileUrls(QWidget *parent, + { + Q_UNUSED(supportedSchemes); + +- // Falls back to local files +- QList urls; +- +- const QStringList fileNames = getOpenFileNames(parent, caption, dir.toLocalFile(), filter, selectedFilter, options); +- foreach (const QString &fileName, fileNames) +- urls << QUrl::fromLocalFile(fileName); ++ QFileDialogArgs args; ++ args.parent = parent; ++ args.caption = caption; ++ args.directory = QFileDialogPrivate::workingDirectory(dir); ++ args.selection = QFileDialogPrivate::initialSelection(dir); ++ args.filter = filter; ++ args.mode = ExistingFiles; ++ args.options = options; + +- return urls; ++ QFileDialog dialog(args); ++ if (selectedFilter && !selectedFilter->isEmpty()) ++ dialog.selectNameFilter(*selectedFilter); ++ if (dialog.exec() == QDialog::Accepted) { ++ if (selectedFilter) ++ *selectedFilter = dialog.selectedNameFilter(); ++ return dialog.selectedUrls(); ++ } ++ return QList(); + } + + /*! +@@ -2370,33 +2351,9 @@ QString QFileDialog::getSaveFileName(QWidget *parent, + QString *selectedFilter, + Options options) + { +- QFileDialogArgs args; +- args.parent = parent; +- args.caption = caption; +- args.directory = QFileDialogPrivate::workingDirectory(QUrl::fromLocalFile(dir)); +- args.selection = QFileDialogPrivate::initialSelection(QUrl::fromLocalFile(dir)); +- args.filter = filter; +- args.mode = AnyFile; +- args.options = options; +- +-#if defined(Q_WS_WIN) +- if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog)) { +- return qt_win_get_save_file_name(args, &(args.directory), selectedFilter); +- } +-#endif +- +- // create a qt dialog +- QFileDialog dialog(args); +- dialog.setAcceptMode(AcceptSave); +- if (selectedFilter && !selectedFilter->isEmpty()) +- dialog.selectNameFilter(*selectedFilter); +- if (dialog.exec() == QDialog::Accepted) { +- if (selectedFilter) +- *selectedFilter = dialog.selectedNameFilter(); +- return dialog.selectedFiles().value(0); +- } +- +- return QString(); ++ const QStringList schemes = QStringList(QStringLiteral("file")); ++ const QUrl selectedUrl = getSaveFileUrl(parent, caption, QUrl::fromLocalFile(dir), filter, selectedFilter, options, schemes); ++ return selectedUrl.toLocalFile(); + } + + /*! +@@ -2436,8 +2393,25 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent, + { + Q_UNUSED(supportedSchemes); + +- // Falls back to local file +- return dialogResultToUrl(getSaveFileName(parent, caption, dir.toLocalFile(), filter, selectedFilter, options)); ++ QFileDialogArgs args; ++ args.parent = parent; ++ args.caption = caption; ++ args.directory = QFileDialogPrivate::workingDirectory(dir); ++ args.selection = QFileDialogPrivate::initialSelection(dir); ++ args.filter = filter; ++ args.mode = AnyFile; ++ args.options = options; ++ ++ QFileDialog dialog(args); ++ dialog.setAcceptMode(AcceptSave); ++ if (selectedFilter && !selectedFilter->isEmpty()) ++ dialog.selectNameFilter(*selectedFilter); ++ if (dialog.exec() == QDialog::Accepted) { ++ if (selectedFilter) ++ *selectedFilter = dialog.selectedNameFilter(); ++ return dialog.selectedUrls().value(0); ++ } ++ return QUrl(); + } + + /*! +@@ -2484,29 +2458,9 @@ QString QFileDialog::getExistingDirectory(QWidget *parent, + const QString &dir, + Options options) + { +- QFileDialogArgs args; +- args.parent = parent; +- args.caption = caption; +- args.directory = QFileDialogPrivate::workingDirectory(QUrl::fromLocalFile(dir)); +- args.mode = (options & ShowDirsOnly ? DirectoryOnly : Directory); +- args.options = options; +- +-#if defined(Q_WS_WIN) +- if (QGuiApplicationPrivate::platformIntegration()->usePlatformNativeDialog() && !(args.options & DontUseNativeDialog) && (options & ShowDirsOnly) +-#if defined(Q_OS_WINCE) +- && qt_priv_ptr_valid +-#endif +- ) { +- return qt_win_get_existing_directory(args); +- } +-#endif +- +- // create a qt dialog +- QFileDialog dialog(args); +- if (dialog.exec() == QDialog::Accepted) { +- return dialog.selectedFiles().value(0); +- } +- return QString(); ++ const QStringList schemes = QStringList(QStringLiteral("file")); ++ const QUrl selectedUrl = getExistingDirectoryUrl(parent, caption, QUrl::fromLocalFile(dir), options, schemes); ++ return selectedUrl.toLocalFile(); + } + + /*! +@@ -2544,8 +2498,17 @@ QUrl QFileDialog::getExistingDirectoryUrl(QWidget *parent, + { + Q_UNUSED(supportedSchemes); + +- // Falls back to local file +- return dialogResultToUrl(getExistingDirectory(parent, caption, dir.toLocalFile(), options)); ++ QFileDialogArgs args; ++ args.parent = parent; ++ args.caption = caption; ++ args.directory = QFileDialogPrivate::workingDirectory(dir); ++ args.mode = (options & ShowDirsOnly ? DirectoryOnly : Directory); ++ args.options = options; ++ ++ QFileDialog dialog(args); ++ if (dialog.exec() == QDialog::Accepted) ++ return dialog.selectedUrls().value(0); ++ return QUrl(); + } + + inline static QUrl _qt_get_directory(const QUrl &url) +-- +2.1.1 + diff --git a/libqt5-qtbase.changes b/libqt5-qtbase.changes index aed2e3d..f43a77d 100644 --- a/libqt5-qtbase.changes +++ b/libqt5-qtbase.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Sun Oct 12 15:21:11 UTC 2014 - hrvoje.senjan@gmail.com + +- Added 0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch, + 0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch, + 0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch and + 0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch + from upstream to improve QFileDialog behaviour with both local + and remote URL's +- Added 0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch: + QTBUG-36184 +- Added 0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch, + 0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch, + 0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch + and 0004-GTK2-theme-should-use-GTK-configured-font-variant.patch + QTBUG-40396, QTBUG-32254, QTBUG-39643 + ------------------------------------------------------------------- Wed Sep 24 16:23:20 UTC 2014 - mlin@suse.com diff --git a/libqt5-qtbase.spec b/libqt5-qtbase.spec index c0d2bc0..1a97ca5 100644 --- a/libqt5-qtbase.spec +++ b/libqt5-qtbase.spec @@ -60,6 +60,24 @@ Patch2002: libqt5-byte-order-byte-is-address0.patch Patch2003: 00010-Replace-the-const-QString-global-static-with-a-QStri.patch # PATCH-FIX-UPSTREAM 00011-Use-correct-signal-name-when-disconnecting.patch Patch2004: 00011-Use-correct-signal-name-when-disconnecting.patch +# PATCH-FIX-UPSTREAM 0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch +Patch2005: 0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch +# PATCH-FIX-UPSTREAM 0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch +Patch2006: 0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch +# PATCH-FIX-UPSTREAM 0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch +Patch2007: 0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch +# PATCH-FIX-UPSTREAM 0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch +Patch2008: 0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch +# PATCH-FIX-UPSTREAM 0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch +Patch2009: 0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch +# PATCH-FIX-UPSTREAM 0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch +Patch2010: 0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch +# PATCH-FIX-UPSTREAM 0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch +Patch2011: 0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch +# PATCH-FIX-UPSTREAM 0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch +Patch2012: 0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch +# PATCH-FIX-UPSTREAM 0004-GTK2-theme-should-use-GTK-configured-font-variant.patch +Patch2013: 0004-GTK2-theme-should-use-GTK-configured-font-variant.patch BuildRequires: alsa-devel BuildRequires: cups-devel BuildRequires: fdupes @@ -149,6 +167,15 @@ handling. %patch2002 -p1 %patch2003 -p1 %patch2004 -p1 +%patch2005 -p1 +%patch2006 -p1 +%patch2007 -p1 +%patch2008 -p1 +%patch2009 -p1 +%patch2010 -p1 +%patch2011 -p1 +%patch2012 -p1 +%patch2013 -p1 # be sure not to use them rm -r src/3rdparty/{libjpeg,freetype,libpng,zlib}