Hello community,
here is the log from the commit of package libyui-qt for openSUSE:Factory checked in at 2016-10-13 11:25:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libyui-qt (Old)
and /work/SRC/openSUSE:Factory/.libyui-qt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyui-qt"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libyui-qt/libyui-qt.changes 2016-10-01 23:50:14.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libyui-qt.new/libyui-qt.changes 2016-10-13 11:25:23.000000000 +0200
@@ -1,0 +2,6 @@
+Mon Oct 10 16:56:41 UTC 2016 - igonzalezsosa@suse.com
+
+- Fix high-contrast support (bsc#76811 and related to bsc#780621)
+- 2.46.27
+
+-------------------------------------------------------------------
Old:
----
libyui-qt-2.46.26.tar.bz2
New:
----
libyui-qt-2.46.27.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libyui-qt-doc.spec ++++++
--- /var/tmp/diff_new_pack.KMjNCL/_old 2016-10-13 11:25:24.000000000 +0200
+++ /var/tmp/diff_new_pack.KMjNCL/_new 2016-10-13 11:25:24.000000000 +0200
@@ -20,7 +20,7 @@
%define so_version 7
Name: %{parent}-doc
-Version: 2.46.26
+Version: 2.46.27
Release: 0
Source: %{parent}-%{version}.tar.bz2
++++++ libyui-qt.spec ++++++
--- /var/tmp/diff_new_pack.KMjNCL/_old 2016-10-13 11:25:24.000000000 +0200
+++ /var/tmp/diff_new_pack.KMjNCL/_new 2016-10-13 11:25:24.000000000 +0200
@@ -17,7 +17,7 @@
Name: libyui-qt
-Version: 2.46.26
+Version: 2.46.27
Release: 0
Source: %{name}-%{version}.tar.bz2
++++++ libyui-qt-2.46.26.tar.bz2 -> libyui-qt-2.46.27.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/VERSION.cmake new/libyui-qt-2.46.27/VERSION.cmake
--- old/libyui-qt-2.46.26/VERSION.cmake 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/VERSION.cmake 2016-10-11 12:04:11.000000000 +0200
@@ -1,6 +1,6 @@
SET(VERSION_MAJOR "2")
SET(VERSION_MINOR "46")
-SET(VERSION_PATCH "26")
+SET(VERSION_PATCH "27")
SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${GIT_SHA1_VERSION}" )
##### This is need for the libyui core, ONLY.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/package/libyui-qt-doc.spec new/libyui-qt-2.46.27/package/libyui-qt-doc.spec
--- old/libyui-qt-2.46.26/package/libyui-qt-doc.spec 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/package/libyui-qt-doc.spec 2016-10-11 12:04:11.000000000 +0200
@@ -20,7 +20,7 @@
%define so_version 7
Name: %{parent}-doc
-Version: 2.46.26
+Version: 2.46.27
Release: 0
Source: %{parent}-%{version}.tar.bz2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/package/libyui-qt.changes new/libyui-qt-2.46.27/package/libyui-qt.changes
--- old/libyui-qt-2.46.26/package/libyui-qt.changes 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/package/libyui-qt.changes 2016-10-11 12:04:11.000000000 +0200
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Oct 10 16:56:41 UTC 2016 - igonzalezsosa@suse.com
+
+- Fix high-contrast support (bsc#76811 and related to bsc#780621)
+- 2.46.27
+
+-------------------------------------------------------------------
Sun Sep 25 18:49:32 CEST 2016 - hrvoje.senjan@gmail.com
- Fix compilation with Qt 5.7 by using non-deprecated classes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/package/libyui-qt.spec new/libyui-qt-2.46.27/package/libyui-qt.spec
--- old/libyui-qt-2.46.26/package/libyui-qt.spec 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/package/libyui-qt.spec 2016-10-11 12:04:11.000000000 +0200
@@ -17,7 +17,7 @@
Name: libyui-qt
-Version: 2.46.26
+Version: 2.46.27
Release: 0
Source: %{name}-%{version}.tar.bz2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/src/QY2Styler.cc new/libyui-qt-2.46.27/src/QY2Styler.cc
--- old/libyui-qt-2.46.26/src/QY2Styler.cc 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/src/QY2Styler.cc 2016-10-11 12:04:11.000000000 +0200
@@ -40,6 +40,7 @@
#include <QSvgRenderer>
#include <iostream>
#include <QPixmapCache>
+#include <QFileInfo>
#define LOGGING_CAUSES_QT4_THREADING_PROBLEMS 1
@@ -50,11 +51,16 @@
using namespace std;
-QY2Styler::QY2Styler( QObject * parent )
+QY2Styler::QY2Styler( QObject * parent,
+ const QString & defaultStyleSheet,
+ const QString & highContrastStyleSheet)
: QObject( parent )
{
QPixmapCache::setCacheLimit( 5 * 1024 );
yuiDebug() << "Styler created" << std::endl;
+ setDefaultStyleSheet(defaultStyleSheet);
+ setHighContrastStyleSheet(highContrastStyleSheet);
+ _currentStyleSheet = QString( "" );
}
@@ -64,39 +70,75 @@
static QY2Styler * styler = 0;
if ( ! styler )
- {
- yuiDebug() << "Creating QY2Styler singleton" << std::endl;
+ {
+ yuiDebug() << "Creating QY2Styler singleton" << std::endl;
- styler = new QY2Styler( qApp );
- YUI_CHECK_NEW( styler );
+ QString y2style = getenv("Y2STYLE");
+ QString y2highcontrast = getenv("Y2HIGHCONTRAST");
+ styler = new QY2Styler( qApp, y2style, y2highcontrast );
+
+ YUI_CHECK_NEW( styler );
+ if (y2highcontrast.isEmpty())
+ styler->loadDefaultStyleSheet();
+ else
+ styler->loadHighContrastStyleSheet();
+ }
+ return styler;
+}
- QString style = getenv("Y2STYLE");
+void QY2Styler::setDefaultStyleSheet(const QString & styleSheet)
+{
+ QFileInfo fileInfo(themeDir() + styleSheet);
- if ( ! style.isEmpty() )
- styler->loadStyleSheet( style );
- else
- styler->loadStyleSheet( "style.qss" );
+ if (fileInfo.isFile())
+ {
+ _defaultStyleSheet = styleSheet;
+ yuiDebug() << "Setting high-contrast style sheet to "
+ << _defaultStyleSheet << std::endl;
}
+}
- return styler;
+void QY2Styler::setHighContrastStyleSheet(const QString & styleSheet)
+{
+ QFileInfo fileInfo(themeDir() + styleSheet);
+
+ if (fileInfo.isFile())
+ {
+ _highContrastStyleSheet = styleSheet;
+ yuiDebug() << "Setting default style sheet to "
+ << _highContrastStyleSheet << std::endl;
+ }
}
+void QY2Styler::loadDefaultStyleSheet()
+{
+ if (loadStyleSheet(_defaultStyleSheet))
+ _usingHighContrastStyleSheet = false;
+}
+
+void QY2Styler::loadHighContrastStyleSheet()
+{
+ if (loadStyleSheet(_highContrastStyleSheet))
+ _usingHighContrastStyleSheet = true;
+}
-void QY2Styler::loadStyleSheet( const QString & filename )
+bool QY2Styler::loadStyleSheet( const QString & filename )
{
QFile file( themeDir() + filename );
if ( file.open( QIODevice::ReadOnly ) )
{
- yuiMilestone() << "Using style sheet \"" << file.fileName() << "\"" << std::endl;
- QString text = file.readAll();
- setStyleSheet( text );
+ yuiMilestone() << "Using style sheet \"" << file.fileName() << "\"" << std::endl;
+ QString text = file.readAll();
+ _currentStyleSheet = QString(filename);
+ setStyleSheet( text );
+ return true;
}
else
{
yuiMilestone() << "Couldn't open style sheet \"" << file.fileName() << "\"" << std::endl;
+ return false;
}
-
}
void QY2Styler::setStyleSheet( const QString & text )
@@ -115,6 +157,13 @@
registered_widget->setStyleSheet( _style );
}
+void QY2Styler::toggleHighContrastStyleSheet()
+{
+ if (usingHighContrastStyleSheet())
+ loadDefaultStyleSheet();
+ else
+ loadHighContrastStyleSheet();
+}
void QY2Styler::processUrls( QString & text )
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/src/QY2Styler.h new/libyui-qt-2.46.27/src/QY2Styler.h
--- old/libyui-qt-2.46.26/src/QY2Styler.h 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/src/QY2Styler.h 2016-10-11 12:04:11.000000000 +0200
@@ -32,6 +32,8 @@
#include <QImage>
#include <QMap>
+#define HIGH_CONTRAST_STYLE_SHEET "highcontrast.qss"
+#define DEFAULT_STYLE_SHEET "style.qss"
class QY2Styler : public QObject
{
@@ -43,20 +45,100 @@
* Constructor. Use the static styler() function instead to return the
* singleton for this class.
**/
- QY2Styler( QObject * parent );
+ QY2Styler( QObject * parent,
+ const QString & defaultStyleSheet = "",
+ const QString & highContrastStyleSheet = "" );
public:
static QY2Styler * styler();
- void loadStyleSheet( const QString &file ); // reads style sheet form a file
+ /**
+ * Loads and apply a style sheet from a file.
+ *
+ * \param file Filename. It should live in the themeDir() directory.
+ * \return true if the file was found (and applied); false otherwise.
+ */
+ bool loadStyleSheet( const QString &file );
+
+ /**
+ * Applies a style sheet from a string.
+ *
+ * \param text Style sheet content.
+ */
void setStyleSheet( const QString & text );
+
+ /**
+ * Loads the default stylesheet.
+ *
+ * The default stylesheet is determined by the environment variable Y2STYLE.
+ * If this variable is not set, the DEFAULT_STYLE_SHEET style sheet will be used.
+ */
+ void loadDefaultStyleSheet();
+
+ /**
+ * Loads the high-contrast stylesheet.
+ */
+ void loadHighContrastStyleSheet();
+
+ /**
+ * Returns the path to the style sheets directory.
+ */
QString themeDir() const;
+
+ /**
+ * Registers a widget and applies the style sheet
+ *
+ * \param widget Widget to register.
+ */
void registerWidget( QWidget *widget );
+
+ /**
+ * Unregisters a widget.
+ *
+ * \param widget Widget to unregister.
+ */
void unregisterWidget( QWidget *widget );
+
+
+ /**
+ * Registers a child widget.
+ *
+ * \param parent Parent widget.
+ * \param widget Widget to register.
+ */
void registerChildWidget( QWidget *parent, QWidget *widget );
+
QString textStyle() const { return _textStyle; }
+ /**
+ * Set style sheet for the default theme
+ *
+ * If the style sheet does not exists, it won't be changed.
+ *
+ * \param styleSheet Style sheet file name
+ */
+ void setDefaultStyleSheet(const QString & styleSheet);
+
+ /**
+ * Set style sheet for the high contrast theme
+ *
+ * If the style sheet does not exists, it won't be changed.
+ *
+ * \param styleSheet Style sheet file name
+ */
+ void setHighContrastStyleSheet(const QString & styleSheet);
+
+ /**
+ * Toggle between default/high-contrast style sheets.
+ */
+ void toggleHighContrastStyleSheet();
+
+ /**
+ * Determines if the high-contrast style is being used.
+ */
+ bool usingHighContrastStyleSheet() { return _usingHighContrastStyleSheet; }
+
bool updateRendering( QWidget *wid );
protected:
@@ -75,6 +157,10 @@
**/
bool eventFilter( QObject * obj, QEvent * ev );
+ QString _currentStyleSheet;
+ QString _defaultStyleSheet = DEFAULT_STYLE_SHEET;
+ QString _highContrastStyleSheet = HIGH_CONTRAST_STYLE_SHEET;
+ bool _usingHighContrastStyleSheet = false;
private:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/src/YQDialog.cc new/libyui-qt-2.46.27/src/YQDialog.cc
--- old/libyui-qt-2.46.26/src/YQDialog.cc 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/src/YQDialog.cc 2016-10-11 12:04:11.000000000 +0200
@@ -615,9 +615,9 @@
else if ( event->key() == Qt::Key_F4 && // Shift-F4: toggle colors for vision impaired users
event->modifiers() == Qt::ShiftModifier )
{
- YQUI::ui()->toggleVisionImpairedPalette();
+ QY2Styler::styler()->toggleHighContrastStyleSheet();
- if ( YQUI::ui()->usingVisionImpairedPalette() )
+ if ( QY2Styler::styler()->usingHighContrastStyleSheet() )
{
QWidget* parent = 0;
YDialog * currentDialog = YDialog::currentDialog( false );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/src/YQUI.cc new/libyui-qt-2.46.27/src/YQUI.cc
--- old/libyui-qt-2.46.26/src/YQUI.cc 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/src/YQUI.cc 2016-10-11 12:04:11.000000000 +0200
@@ -103,7 +103,6 @@
_uiInitialized = false;
_fatalError = false;
_fullscreen = false;
- _usingVisionImpairedPalette = false;
_noborder = false;
screenShotNameTemplate = "";
_blockedLevel = 0;
@@ -158,7 +157,6 @@
_busyCursorTimer = new QTimer( _signalReceiver );
_busyCursorTimer->setSingleShot( true );
- _normalPalette = qApp->palette();
(void) QY2Styler::styler(); // Make sure QY2Styler singleton is created
setButtonOrderFromEnvironment();
@@ -628,60 +626,6 @@
_eventHandler.deletePendingEventsFor( widget );
}
-
-void YQUI::toggleVisionImpairedPalette()
-{
- if ( _usingVisionImpairedPalette )
- {
- qApp->setPalette( normalPalette()); // informWidgets
-
- _usingVisionImpairedPalette = false;
- }
- else
- {
- qApp->setPalette( visionImpairedPalette() ); // informWidgets
-
- _usingVisionImpairedPalette = true;
- }
-}
-
-
-QPalette
-YQUI::visionImpairedPalette()
-{
- const QColor dark ( 0x20, 0x20, 0x20 );
- QPalette pal;
-
- // for the active window (the one with the keyboard focus)
- pal.setColor( QPalette::Active, QPalette::Background, Qt::black );
- pal.setColor( QPalette::Active, QPalette::Foreground, Qt::cyan );
- pal.setColor( QPalette::Active, QPalette::Text, Qt::cyan );
- pal.setColor( QPalette::Active, QPalette::Base, dark );
- pal.setColor( QPalette::Active, QPalette::Button, dark );
- pal.setColor( QPalette::Active, QPalette::ButtonText, Qt::green );
- pal.setColor( QPalette::Active, QPalette::Highlight, Qt::yellow );
- pal.setColor( QPalette::Active, QPalette::HighlightedText, Qt::black );
-
- // for other windows (those that don't have the keyboard focus)
- pal.setColor( QPalette::Inactive, QPalette::Background, Qt::black );
- pal.setColor( QPalette::Inactive, QPalette::Foreground, Qt::cyan );
- pal.setColor( QPalette::Inactive, QPalette::Text, Qt::cyan );
- pal.setColor( QPalette::Inactive, QPalette::Base, dark );
- pal.setColor( QPalette::Inactive, QPalette::Button, dark );
- pal.setColor( QPalette::Inactive, QPalette::ButtonText, Qt::green );
-
- // for disabled widgets
- pal.setColor( QPalette::Disabled, QPalette::Background, Qt::black );
- pal.setColor( QPalette::Disabled, QPalette::Foreground, Qt::gray );
- pal.setColor( QPalette::Disabled, QPalette::Text, Qt::gray );
- pal.setColor( QPalette::Disabled, QPalette::Base, dark );
- pal.setColor( QPalette::Disabled, QPalette::Button, dark );
- pal.setColor( QPalette::Disabled, QPalette::ButtonText, Qt::gray );
-
- return pal;
-}
-
-
// FIXME: Does this still do anything now that YQUI is no longer a QObject?
bool YQUI::close()
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-qt-2.46.26/src/YQUI.h new/libyui-qt-2.46.27/src/YQUI.h
--- old/libyui-qt-2.46.26/src/YQUI.h 2016-09-26 13:49:10.000000000 +0200
+++ new/libyui-qt-2.46.27/src/YQUI.h 2016-10-11 12:04:11.000000000 +0200
@@ -28,7 +28,6 @@
#include