r21250 by craig -

scribus-commit scribus-commit at lists.scribus.net
Wed Apr 27 21:15:01 UTC 2016


Author: craig
Date: Wed Apr 27 21:15:01 2016
New Revision: 21250

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21250
Log:
#13846: Rotate link buttons if RTL is being used

Modified:
    trunk/Scribus/scribus/iconmanager.cpp
    trunk/Scribus/scribus/iconmanager.h
    trunk/Scribus/scribus/ui/linkbutton.cpp
    trunk/Scribus/scribus/ui/linkbutton.h

Modified: trunk/Scribus/scribus/iconmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21250&path=/trunk/Scribus/scribus/iconmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/iconmanager.cpp	(original)
+++ trunk/Scribus/scribus/iconmanager.cpp	Wed Apr 27 21:15:01 2016
@@ -199,7 +199,7 @@
 	return QIcon(loadPixmap(nam, forceUseColor));
 }
 
-QPixmap IconManager::loadPixmap(const QString nam, bool forceUseColor)
+QPixmap IconManager::loadPixmap(const QString nam, bool forceUseColor, bool rtlFlip)
 {
 	if (m_pxCache.contains(nam))
 		return *m_pxCache[nam];
@@ -213,6 +213,12 @@
 //		qDebug()<<"Successful icon load from"<<iconFilePath;
 	if (PrefsManager::instance()->appPrefs.uiPrefs.grayscaleIcons && !forceUseColor)
 		iconToGrayscale(pm);
+	if (rtlFlip)
+	{
+		QTransform t;
+		t.rotate(180);
+		*pm = pm->transformed(t);
+	}
 	m_pxCache.insert(nam, pm);
 	return *pm;
 }

Modified: trunk/Scribus/scribus/iconmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21250&path=/trunk/Scribus/scribus/iconmanager.h
==============================================================================
--- trunk/Scribus/scribus/iconmanager.h	(original)
+++ trunk/Scribus/scribus/iconmanager.h	Wed Apr 27 21:15:01 2016
@@ -53,7 +53,7 @@
 		bool setup();
 		QCursor loadCursor(const QString nam, int hotX = -1, int hotY = -1, bool forceUseColor=false);
 		QIcon loadIcon(const QString nam, bool forceUseColor=false);
-		QPixmap loadPixmap(const QString nam, bool forceUseColor=false);
+		QPixmap loadPixmap(const QString nam, bool forceUseColor=false, bool rtlFlip=false);
 		QString pathForIcon(const QString nam);
 		QStringList pathList();
 		QStringList nameList(QString language);

Modified: trunk/Scribus/scribus/ui/linkbutton.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21250&path=/trunk/Scribus/scribus/ui/linkbutton.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/linkbutton.cpp	(original)
+++ trunk/Scribus/scribus/ui/linkbutton.cpp	Wed Apr 27 21:15:01 2016
@@ -23,6 +23,7 @@
 
 #include "linkbutton.h"
 #include "iconmanager.h"
+#include "scribuscore.h"
 #include <QIcon>
 #include <QPixmap>
 
@@ -30,10 +31,16 @@
 LinkButton::LinkButton(QWidget *pa) : QToolButton(pa)
 {
 	setBackgroundRole(QPalette::Window);
+	setNewIcon();
+}
+
+void LinkButton::setNewIcon()
+{
 	QIcon a=QIcon();
-	QPixmap closedPixmap(IconManager::instance()->loadPixmap("chain-closed.png"));
+	bool rtlLoad = QLocale(ScCore->getGuiLanguage()).textDirection() == Qt::RightToLeft;
+	QPixmap closedPixmap(IconManager::instance()->loadPixmap("chain-closed.png", false, rtlLoad));
 	a.addPixmap(closedPixmap, QIcon::Normal, QIcon::On);
-	a.addPixmap(IconManager::instance()->loadPixmap("chain-open.png"), QIcon::Normal, QIcon::Off);
+	a.addPixmap(IconManager::instance()->loadPixmap("chain-open.png", false, rtlLoad), QIcon::Normal, QIcon::Off);
 	setIcon(a);
 	setIconSize(closedPixmap.size());
 }

Modified: trunk/Scribus/scribus/ui/linkbutton.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21250&path=/trunk/Scribus/scribus/ui/linkbutton.h
==============================================================================
--- trunk/Scribus/scribus/ui/linkbutton.h	(original)
+++ trunk/Scribus/scribus/ui/linkbutton.h	Wed Apr 27 21:15:01 2016
@@ -41,6 +41,7 @@
 	 */
 	LinkButton(QWidget *pa);
 	~LinkButton() {};
+	void setNewIcon();
 	/*!
 	\author Franz Schmid
 	\brief Returns size of QPixmap, see the Qt-Documentation for further explaining of that.




More information about the scribus-commit mailing list