r15461 by craig - Remove unneeded function declaration

scribus-commit scribus-commit at lists.scribus.net
Tue Aug 31 22:15:48 CEST 2010


Author: craig
Date: Tue Aug 31 20:15:48 2010
New Revision: 15461

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15461
Log:
Remove unneeded function declaration

Modified:
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/scraction.cpp
    trunk/Scribus/scribus/scraction.h
    trunk/Scribus/scribus/ui/storyeditor.h
    trunk/Scribus/scribus/util_icon.cpp
    trunk/Scribus/scribus/util_icon.h

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15461&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Tue Aug 31 20:15:48 2010
@@ -1244,6 +1244,7 @@
 	dcUI.setAttribute("ApplicationFontSize", appPrefs.uiPrefs.applicationFontSize);
 	dcUI.setAttribute("PaletteFontSize", appPrefs.uiPrefs.paletteFontSize);
 	dcUI.setAttribute("RecentDocumentCount", appPrefs.uiPrefs.recentDocCount);
+	dcUI.setAttribute("UseGrayscaleIcons", appPrefs.uiPrefs.grayscaleIcons);
 	elem.appendChild(dcUI);
 
 	QDomElement deDocumentSetup=docu.createElement("DocumentSetup");
@@ -1852,6 +1853,7 @@
 			appPrefs.uiPrefs.stickyTools = static_cast<bool>(dc.attribute("StickyTools", "0").toInt());
 			appPrefs.uiPrefs.SepalT = static_cast<bool>(dc.attribute("PagePaletteShowThumbs").toInt());
 			appPrefs.uiPrefs.SepalN = static_cast<bool>(dc.attribute("PagePaletteShowNames").toInt());
+			appPrefs.uiPrefs.grayscaleIcons = static_cast<bool>(dc.attribute("UseGrayscaleIcons",0).toInt());
 		}
 
 		if (dc.tagName()=="DocumentSetup")

Modified: trunk/Scribus/scribus/scraction.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15461&path=/trunk/Scribus/scribus/scraction.cpp
==============================================================================
--- trunk/Scribus/scribus/scraction.cpp (original)
+++ trunk/Scribus/scribus/scraction.cpp Tue Aug 31 20:15:48 2010
@@ -20,9 +20,11 @@
  ***************************************************************************/
 #include <QMenu>
 #include <QIcon>
+#include <QVector>
 #include "scraction.h"
 #include "scribus.h"
 #include "scribusdoc.h"
+#include "util_icon.h"
 
 ScrAction::ScrAction( QObject * parent ) : QAction( parent )
 {
@@ -35,13 +37,21 @@
 	initScrAction();
 }
 
-ScrAction::ScrAction( ActionType aType, const QPixmap & icon16, const QPixmap & icon22, const QString & menuText, QKeySequence accel, QObject * parent, int extraInt, double extraDouble, QString extraQString ) : QAction( QIcon(icon16), menuText, parent )
-{
-	setShortcut(accel);
-	initScrAction();
-	icon().addPixmap(icon22, QIcon::Normal, QIcon::On);
+ScrAction::ScrAction( ActionType aType, const QPixmap & icon16, const QPixmap & icon22, const QString & menuText, QKeySequence accel, QObject * parent, int extraInt, double extraDouble, QString extraQString ) : QAction( QIcon(), menuText, parent )
+{
+	setShortcut(accel);
+	initScrAction();
+	//icon().addPixmap(icon22, QIcon::Normal, QIcon::On);
+
+	QPixmap gray_icon16(icon16);
+	iconToGrayscale(&gray_icon16);
+	m_icon.addPixmap(icon16, QIcon::Active, QIcon::On);
+	m_icon.addPixmap(icon16, QIcon::Active, QIcon::Off);
+	m_icon.addPixmap(gray_icon16, QIcon::Normal, QIcon::On);
+	m_icon.addPixmap(gray_icon16, QIcon::Normal, QIcon::Off);
+	setIcon(m_icon.pixmap(QSize(16,16), QIcon::Normal, QIcon::Off));
+	//connect (this, SIGNAL(hovered()), this, SLOT(hoverIcon()));
 	_actionType=aType;
-
 	if (_actionType!=Normal)
 		connect (this, SIGNAL(triggered()), this, SLOT(triggeredToTriggeredData()));
 	switch (_actionType)
@@ -100,6 +110,7 @@
 	_actionType=UnicodeChar;
 
 	connect (this, SIGNAL(triggered()), this, SLOT(triggeredToTriggeredData()));
+	//connect (this, SIGNAL(hovered()), this, SLOT(hoverIcon()));
 	_dataInt=extraInt;
 	_dataQString=extraQString;
 }
@@ -115,6 +126,12 @@
 
 ScrAction::~ScrAction()
 {
+}
+
+void ScrAction::hoverIcon()
+{
+	qDebug("boo");
+	//setIcon(m_icon.pixmap(QSize(16,16), QIcon::Active, QIcon::Off));
 }
 
 void ScrAction::triggeredToTriggeredData()

Modified: trunk/Scribus/scribus/scraction.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15461&path=/trunk/Scribus/scribus/scraction.h
==============================================================================
--- trunk/Scribus/scribus/scraction.h (original)
+++ trunk/Scribus/scribus/scraction.h Tue Aug 31 20:15:48 2010
@@ -193,6 +193,7 @@
 	QKeySequence savedKeySequence;
 	bool shortcutSaved;
 	bool fakeToggle;
+	QIcon m_icon;
 	
 	/*!
 		\author Craig Bradney
@@ -217,6 +218,8 @@
 		\param ison true if toggled = on
 	 */
 	void toggledToToggledData(bool ison);
+
+	void hoverIcon();
 };
 
 #endif

Modified: trunk/Scribus/scribus/ui/storyeditor.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15461&path=/trunk/Scribus/scribus/ui/storyeditor.h
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.h (original)
+++ trunk/Scribus/scribus/ui/storyeditor.h Tue Aug 31 20:15:48 2010
@@ -462,7 +462,7 @@
 	void PasteAvail();
 	void updateTextFrame();
 	void SearchText();
-	void slotEditStyles();
+	//void slotEditStyles();
 	void modifiedText();
 	void LoadTextFile();
 	void SaveTextFile();

Modified: trunk/Scribus/scribus/util_icon.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15461&path=/trunk/Scribus/scribus/util_icon.cpp
==============================================================================
--- trunk/Scribus/scribus/util_icon.cpp (original)
+++ trunk/Scribus/scribus/util_icon.cpp Tue Aug 31 20:15:48 2010
@@ -49,23 +49,28 @@
 		if (pm->isNull())
 			qWarning("Unable to load icon %s: Got null pixmap", iconFilePath.toAscii().constData());
 		if (PrefsManager::instance()->appPrefs.uiPrefs.grayscaleIcons && !forceUseColor)
-		{
-			QImage qi(pm->toImage());
-			int h=qi.height();
-			int w=qi.width();
-			QRgb c_rgb;
-			for (int i=0;i<w;++i)
-			{
-				for (int j=0;j<h;++j)
-				{
-					c_rgb=qi.pixel(i,j);
-					int k = qMin(qRound(0.3 * qRed(c_rgb) + 0.59 * qGreen(c_rgb) + 0.11 * qBlue(c_rgb)), 255);
-					qi.setPixel(i, j, qRgba(k, k, k, qAlpha(c_rgb)));
-				}
-			}
-			*pm=QPixmap::fromImage(qi);
-		}
+			iconToGrayscale(pm);
 	}
 	pxCache.insert(nam, pm);
 	return *pm;
 }
+
+void SCRIBUS_API iconToGrayscale(QPixmap* pm)
+{
+	QImage qi(pm->toImage());
+	int h=qi.height();
+	int w=qi.width();
+	QRgb c_rgb;
+	for (int i=0;i<w;++i)
+	{
+		for (int j=0;j<h;++j)
+		{
+			c_rgb=qi.pixel(i,j);
+			int k = qMin(qRound(0.3 * qRed(c_rgb) + 0.59 * qGreen(c_rgb) + 0.11 * qBlue(c_rgb)), 255);
+			qi.setPixel(i, j, qRgba(k, k, k, qAlpha(c_rgb)));
+		}
+	}
+	*pm=QPixmap::fromImage(qi);
+}
+
+

Modified: trunk/Scribus/scribus/util_icon.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15461&path=/trunk/Scribus/scribus/util_icon.h
==============================================================================
--- trunk/Scribus/scribus/util_icon.h (original)
+++ trunk/Scribus/scribus/util_icon.h Tue Aug 31 20:15:48 2010
@@ -13,6 +13,6 @@
 #include "scribusapi.h"
 
 QPixmap SCRIBUS_API loadIcon(const QString nam, bool forceUseColor=false);
-
+void SCRIBUS_API iconToGrayscale(QPixmap *pm);
 
 #endif




More information about the scribus-commit mailing list