Hello community, here is the log from the commit of package QGnomePlatform for openSUSE:Factory checked in at 2020-06-02 09:32:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/QGnomePlatform (Old) and /work/SRC/openSUSE:Factory/.QGnomePlatform.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "QGnomePlatform" Tue Jun 2 09:32:58 2020 rev:5 rq:810721 version:0.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/QGnomePlatform/QGnomePlatform.changes 2020-01-21 21:04:10.792955641 +0100 +++ /work/SRC/openSUSE:Factory/.QGnomePlatform.new.3606/QGnomePlatform.changes 2020-06-02 09:32:59.915282806 +0200 @@ -1,0 +2,10 @@ +Tue Jun 2 07:12:49 UTC 2020 - Dominique Leuenberger <[email protected]> + +- Update to version 0.6.1: + + Preview support in file dialog. + + Prioritize Adwaita-dark theme for all themes ending with + "-dark" suffix. + + Use Qt's default palette. +- Add QGnomePlatform-qt-5.15.patch: Fix build with Qt 5.15. + +------------------------------------------------------------------- Old: ---- QGnomePlatform-0.6.0.tar.gz New: ---- QGnomePlatform-0.6.1.tar.gz QGnomePlatform-qt-5.15.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ QGnomePlatform.spec ++++++ --- /var/tmp/diff_new_pack.iy92pV/_old 2020-06-02 09:33:00.663285097 +0200 +++ /var/tmp/diff_new_pack.iy92pV/_new 2020-06-02 09:33:00.667285110 +0200 @@ -1,7 +1,7 @@ # # spec file for package QGnomePlatform # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # Copyright © 2016 Yuriy Gorodilin <[email protected]> # Copyright © 2018–2019 Markus S. <[email protected]> # @@ -19,7 +19,7 @@ Name: QGnomePlatform -Version: 0.6.0 +Version: 0.6.1 Release: 0 Summary: A better Qt application inclusion in GNOME # Most code is LGPL-2.1-or-later but qgtk3dialoghelpers files forked from @@ -28,8 +28,9 @@ Group: System/GUI/GNOME URL: https://github.com/FedoraQt/QGnomePlatform/ Source: %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz - Source1: baselibs.conf +# PATCH-FIX-UPSTREAM QGnomePlatform-qt-5.15.patch [email protected] -- Fix build with Qt 5.15 +Patch0: QGnomePlatform-qt-5.15.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: libQt5Core-private-headers-devel @@ -38,11 +39,11 @@ BuildRequires: libqt5-qtwayland-devel BuildRequires: libqt5-qtwayland-private-headers-devel BuildRequires: pkgconfig +BuildRequires: pkgconfig(Qt5Widgets) +BuildRequires: pkgconfig(Qt5X11Extras) BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(libinput) -BuildRequires: pkgconfig(Qt5Widgets) -BuildRequires: pkgconfig(Qt5X11Extras) BuildRequires: pkgconfig(udev) BuildRequires: pkgconfig(xkbcommon) BuildRequires: pkgconfig(xrandr) ++++++ QGnomePlatform-0.6.0.tar.gz -> QGnomePlatform-0.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.6.0/common/gnomehintssettings.cpp new/QGnomePlatform-0.6.1/common/gnomehintssettings.cpp --- old/QGnomePlatform-0.6.0/common/gnomehintssettings.cpp 2019-10-21 12:27:01.000000000 +0200 +++ new/QGnomePlatform-0.6.1/common/gnomehintssettings.cpp 2020-04-19 22:14:28.000000000 +0200 @@ -139,7 +139,6 @@ cursorSizeChanged(); loadFonts(); - loadPalette(); loadStaticHints(); loadTheme(); loadTitlebar(); @@ -148,7 +147,11 @@ GnomeHintsSettings::~GnomeHintsSettings() { qDeleteAll(m_fonts); - delete m_palette; + if (m_cinnamonSettings) { + g_object_unref(m_cinnamonSettings); + } + g_object_unref(m_gnomeDesktopSettings); + g_object_unref(m_settings); } void GnomeHintsSettings::gsettingPropertyChanged(GSettings *settings, gchar *key, GnomeHintsSettings *gnomeHintsSettings) @@ -258,18 +261,7 @@ void GnomeHintsSettings::themeChanged() { - loadPalette(); loadTheme(); - - // QApplication::setPalette and QGuiApplication::setPalette are different functions - // and non virtual. Call the correct one - if (qobject_cast<QApplication *>(QCoreApplication::instance())) { - QApplication::setPalette(*m_palette); - if (QStyleFactory::keys().contains(m_gtkTheme, Qt::CaseInsensitive)) - QApplication::setStyle(m_gtkTheme); - } else if (qobject_cast<QGuiApplication *>(QCoreApplication::instance())) { - QGuiApplication::setPalette(*m_palette); - } } void GnomeHintsSettings::loadTitlebar() @@ -316,7 +308,7 @@ } else { qCDebug(QGnomePlatform) << "Theme name: " << m_gtkTheme; - if (m_gtkTheme.toLower() == QStringLiteral("adwaita-dark")) { + if (m_gtkTheme.toLower().endsWith("-dark")) { m_gtkThemeDarkVariant = true; } @@ -404,16 +396,6 @@ } } -void GnomeHintsSettings::loadPalette() -{ - if (m_palette) { - delete m_palette; - m_palette = nullptr; - } - - m_palette = new QPalette(); -} - void GnomeHintsSettings::loadStaticHints() { int cursorBlinkTime = getSettingsProperty<int>(QStringLiteral("cursor-blink-time")); if (cursorBlinkTime >= 100) { @@ -455,7 +437,7 @@ } else { m_hints[QPlatformTheme::SystemIconThemeName] = "Adwaita"; } - m_hints[QPlatformTheme::SystemIconFallbackThemeName] = "breeze"; + m_hints[QPlatformTheme::SystemIconFallbackThemeName] = "hicolor"; m_hints[QPlatformTheme::IconThemeSearchPaths] = xdgIconThemePaths(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.6.0/common/gnomehintssettings.h new/QGnomePlatform-0.6.1/common/gnomehintssettings.h --- old/QGnomePlatform-0.6.0/common/gnomehintssettings.h 2019-10-21 12:27:01.000000000 +0200 +++ new/QGnomePlatform-0.6.1/common/gnomehintssettings.h 2020-04-19 22:14:28.000000000 +0200 @@ -36,7 +36,6 @@ #include <qpa/qplatformtheme.h> -class QPalette; class GnomeHintsSettings : public QObject { @@ -84,11 +83,6 @@ return m_hints[hint]; } - inline QPalette *palette() const - { - return m_palette; - } - inline TitlebarButtons titlebarButtons() const { return m_titlebarButtons; @@ -110,7 +104,6 @@ void loadFonts(); void loadTheme(); void loadTitlebar(); - void loadPalette(); void loadStaticHints(); void portalSettingChanged(const QString &group, const QString &key, const QDBusVariant &value); @@ -169,7 +162,6 @@ TitlebarButtons m_titlebarButtons = TitlebarButton::CloseButton; TitlebarButtonsPlacement m_titlebarButtonPlacement = TitlebarButtonsPlacement::RightPlacement; QString m_gtkTheme = nullptr; - QPalette *m_palette = nullptr; GSettings *m_cinnamonSettings = nullptr; GSettings *m_gnomeDesktopSettings = nullptr; GSettings *m_settings = nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.6.0/common/qgtk3dialoghelpers.cpp new/QGnomePlatform-0.6.1/common/qgtk3dialoghelpers.cpp --- old/QGnomePlatform-0.6.0/common/qgtk3dialoghelpers.cpp 2019-10-21 12:27:01.000000000 +0200 +++ new/QGnomePlatform-0.6.1/common/qgtk3dialoghelpers.cpp 2020-04-19 22:14:28.000000000 +0200 @@ -44,6 +44,7 @@ #include <qcolor.h> #include <qdebug.h> #include <qfont.h> +#include <qfileinfo.h> #include <private/qguiapplication_p.h> #include <qpa/qplatformfontdatabase.h> @@ -56,6 +57,16 @@ QT_BEGIN_NAMESPACE +// GTK file chooser image preview: thanks to Chromium + +// The size of the preview we display for selected image files. We set height +// larger than width because generally there is more free space vertically +// than horiztonally (setting the preview image will alway expand the width of +// the dialog, but usually not the height). The image's aspect ratio will always +// be preserved. +#define PREVIEW_WIDTH 256 +#define PREVIEW_HEIGHT 512 + class QGtk3Dialog : public QWindow { Q_OBJECT @@ -76,18 +87,24 @@ protected: static void onResponse(QGtk3Dialog *dialog, int response); + static void onUpdatePreview(QGtk3Dialog *dialog); private slots: void onParentWindowDestroyed(); private: GtkWidget *gtkWidget; + GtkWidget *previewWidget; }; QGtk3Dialog::QGtk3Dialog(GtkWidget *gtkWidget) : gtkWidget(gtkWidget) { g_signal_connect_swapped(G_OBJECT(gtkWidget), "response", G_CALLBACK(onResponse), this); g_signal_connect(G_OBJECT(gtkWidget), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); + + previewWidget = gtk_image_new(); + g_signal_connect_swapped(G_OBJECT(gtkWidget), "update-preview", G_CALLBACK(onUpdatePreview), this); + gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(gtkWidget), previewWidget); } QGtk3Dialog::~QGtk3Dialog() @@ -163,6 +180,32 @@ emit dialog->reject(); } +void QGtk3Dialog::onUpdatePreview(QGtk3Dialog *dialog) { + gchar *filename = gtk_file_chooser_get_preview_filename(GTK_FILE_CHOOSER(dialog->gtkWidget)); + if (!filename) { + gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(dialog->gtkWidget), false); + return; + } + + // Don't attempt to open anything which isn't a regular file. If a named pipe, + // this may hang. See https://crbug.com/534754. + QFileInfo fileinfo(filename); + if (!fileinfo.exists() || !fileinfo.isFile()) { + g_free(filename); + gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(dialog->gtkWidget), false); + return; + } + + // This will preserve the image's aspect ratio. + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(filename, PREVIEW_WIDTH, PREVIEW_HEIGHT, 0); + g_free(filename); + if (pixbuf) { + gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->previewWidget), pixbuf); + g_object_unref(pixbuf); + } + gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(dialog->gtkWidget), pixbuf ? true : false); +} + void QGtk3Dialog::onParentWindowDestroyed() { // The QGtk3*DialogHelper classes own this object. Make sure the parent doesn't delete it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/QGnomePlatform-0.6.0/theme/qgnomeplatformtheme.cpp new/QGnomePlatform-0.6.1/theme/qgnomeplatformtheme.cpp --- old/QGnomePlatform-0.6.0/theme/qgnomeplatformtheme.cpp 2019-10-21 12:27:01.000000000 +0200 +++ new/QGnomePlatform-0.6.1/theme/qgnomeplatformtheme.cpp 2020-04-19 22:14:28.000000000 +0200 @@ -68,12 +68,7 @@ const QPalette *QGnomePlatformTheme::palette(Palette type) const { - QPalette *palette = m_hints->palette(); - if (palette && type == QPlatformTheme::SystemPalette) { - return palette; - } else { - return QPlatformTheme::palette(type); - } + return QPlatformTheme::palette(type); } bool QGnomePlatformTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const ++++++ QGnomePlatform-qt-5.15.patch ++++++ >From c835c9e80cfadd62e01f16591721d2103d28a212 Mon Sep 17 00:00:00 2001 From: Jan Grulich <[email protected]> Date: Wed, 27 May 2020 13:38:49 +0200 Subject: [PATCH] Fix build with Qt 5.15 --- decoration/qgnomeplatformdecoration.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/decoration/qgnomeplatformdecoration.cpp b/decoration/qgnomeplatformdecoration.cpp index 61c2af9..c8b381c 100644 --- a/decoration/qgnomeplatformdecoration.cpp +++ b/decoration/qgnomeplatformdecoration.cpp @@ -46,6 +46,7 @@ #include <QtGui/QCursor> #include <QtGui/QLinearGradient> #include <QtGui/QPainter> +#include <QtGui/QPainterPath> #include <QtGui/QPalette> #include <QtGui/QPixmap>
