r20160 by craig - Add icon set switching capability to use new icons. Set naming and translation to come

scribus-commit scribus-commit at lists.scribus.net
Tue Jun 9 21:28:45 UTC 2015


Author: craig
Date: Tue Jun  9 21:28:45 2015
New Revision: 20160

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20160
Log:
Add icon set switching capability to use new icons. Set naming and translation to come

Modified:
    trunk/Scribus/CMakeLists.txt
    trunk/Scribus/ChangeLog
    trunk/Scribus/scribus/commonstrings.h
    trunk/Scribus/scribus/plugins/tools/pathcut/pathcut.cpp
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/prefsstructs.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/pageselector.cpp
    trunk/Scribus/scribus/ui/prefs_userinterface.cpp
    trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui
    trunk/Scribus/scribus/util_icon.cpp
    trunk/Scribus/scribus/util_icon.h

Modified: trunk/Scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/CMakeLists.txt (original)
+++ trunk/Scribus/CMakeLists.txt Tue Jun  9 21:28:45 2015
@@ -926,7 +926,7 @@
 ADD_SUBDIRECTORY(doc)
 ADD_SUBDIRECTORY(resources/dicts)
 ADD_SUBDIRECTORY(resources/editorconfig)
-ADD_SUBDIRECTORY(resources/iconsets/1_5_0)
+ADD_SUBDIRECTORY(resources/iconsets)
 ADD_SUBDIRECTORY(resources/keysets)
 ADD_SUBDIRECTORY(resources/loremipsum)
 ADD_SUBDIRECTORY(resources/profiles)

Modified: trunk/Scribus/ChangeLog
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/ChangeLog
==============================================================================
--- trunk/Scribus/ChangeLog (original)
+++ trunk/Scribus/ChangeLog Tue Jun  9 21:28:45 2015
@@ -1,3 +1,8 @@
+Scribus - 1.5.1.svn (Released 2015-xx-xx)
+========================================
+
+
+
 Scribus - 1.5.0 (Released 2015-05-19)
 ========================================
 

Modified: trunk/Scribus/scribus/commonstrings.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/commonstrings.h
==============================================================================
--- trunk/Scribus/scribus/commonstrings.h (original)
+++ trunk/Scribus/scribus/commonstrings.h Tue Jun  9 21:28:45 2015
@@ -289,6 +289,7 @@
 	static QString altModifier;
 	static QString shiftModifier;
 	static QString metaModifier;
+
 };
 
 #endif

Modified: trunk/Scribus/scribus/plugins/tools/pathcut/pathcut.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/plugins/tools/pathcut/pathcut.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/pathcut/pathcut.cpp (original)
+++ trunk/Scribus/scribus/plugins/tools/pathcut/pathcut.cpp Tue Jun  9 21:28:45 2015
@@ -73,8 +73,8 @@
 	m_actionInfo.text = tr("Cut Polygon");
 	m_actionInfo.helpText = tr("Cuts a Polygon with a Path.");
 	// Menu
-	m_actionInfo.icon1 = loadIcon("transform-crop-and-resize.png");
-	m_actionInfo.icon2 = loadIcon("transform-crop-and-resize.png");
+	m_actionInfo.icon1 = loadIcon("22/transform-crop-and-resize.png");
+	m_actionInfo.icon2 = loadIcon("22/transform-crop-and-resize.png");
 	m_actionInfo.menu = "ItemPathOps";
 	m_actionInfo.parentMenu = "Item";
 	m_actionInfo.subMenuName = tr("Path Tools");

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Tue Jun  9 21:28:45 2015
@@ -176,6 +176,7 @@
 	appPrefs.uiPrefs.useTabs = false;
 	appPrefs.uiPrefs.stickyTools = false;
 	appPrefs.uiPrefs.grayscaleIcons = false;
+	appPrefs.uiPrefs.iconSet = "1_5_0";
 	appPrefs.guidesPrefs.marginsShown = true;
 	appPrefs.guidesPrefs.framesShown = true;
 	appPrefs.guidesPrefs.layerMarkersShown = false;
@@ -1308,6 +1309,7 @@
 	dcUI.setAttribute("PaletteFontSize", appPrefs.uiPrefs.paletteFontSize);
 	dcUI.setAttribute("RecentDocumentCount", appPrefs.uiPrefs.recentDocCount);
 	dcUI.setAttribute("UseGrayscaleIcons", appPrefs.uiPrefs.grayscaleIcons);
+	dcUI.setAttribute("IconSet", appPrefs.uiPrefs.iconSet);
 	elem.appendChild(dcUI);
 
 	QDomElement deDocumentSetup=docu.createElement("DocumentSetup");
@@ -1915,6 +1917,7 @@
 			appPrefs.uiPrefs.useTabs = static_cast<bool>(dc.attribute("UseDocumentTabs", "0").toInt());
 			appPrefs.uiPrefs.stickyTools = static_cast<bool>(dc.attribute("StickyTools", "0").toInt());
 			appPrefs.uiPrefs.grayscaleIcons = static_cast<bool>(dc.attribute("UseGrayscaleIcons",0).toInt());
+			appPrefs.uiPrefs.iconSet = dc.attribute("IconSet", "1_5_0");
 		}
 
 		if (dc.tagName()=="DocumentSetup")

Modified: trunk/Scribus/scribus/prefsstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/prefsstructs.h
==============================================================================
--- trunk/Scribus/scribus/prefsstructs.h (original)
+++ trunk/Scribus/scribus/prefsstructs.h Tue Jun  9 21:28:45 2015
@@ -142,6 +142,7 @@
 	bool showSplashOnStartup; //! Whether to show the splashscreen or not
 	bool stickyTools; //! Whether a user's tool section remains after use or the normal tool is reselected
 	bool grayscaleIcons; //! Show icons in toolbars as grayscale
+	QString iconSet; //! Icon set name
 	WindowPrefs mainWinSettings;
 	QByteArray mainWinState;
 };

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Jun  9 21:28:45 2015
@@ -1279,7 +1279,7 @@
 	QByteArray stylesheet;
 	if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet))
 	{
-		QString downArrow(ScPaths::instance().iconDir()+"16/go-down.png");
+		QString downArrow(pathForIcon("16/go-down.png"));
 		QByteArray da;
 		da.append(downArrow);
 		stylesheet.replace("___downArrow___", da);

Modified: trunk/Scribus/scribus/ui/pageselector.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/ui/pageselector.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pageselector.cpp (original)
+++ trunk/Scribus/scribus/ui/pageselector.cpp Tue Jun  9 21:28:45 2015
@@ -88,7 +88,7 @@
 	QByteArray stylesheet;
 	if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet))
 	{
-		QString downArrow(ScPaths::instance().iconDir()+"16/go-down.png");
+		QString downArrow(pathForIcon("16/go-down.png"));
 		QByteArray da;
 		da.append(downArrow);
 		stylesheet.replace("___downArrow___", da);

Modified: trunk/Scribus/scribus/ui/prefs_userinterface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/ui/prefs_userinterface.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_userinterface.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_userinterface.cpp Tue Jun  9 21:28:45 2015
@@ -30,8 +30,10 @@
 	// qt styles
 	QStringList styleList = QStyleFactory::keys();
 	themeComboBox->addItem("");
-	for (int i = 0; i < styleList.count(); ++i)
-		themeComboBox->addItem(styleList[i]);
+	themeComboBox->addItems(styleList);
+	QStringList iconSetList;
+	iconSetList<<"1_5_0"<<"1_5_1";
+	iconSetComboBox->addItems(iconSetList);
 
 	connect(languageComboBox, SIGNAL(activated(const QString &)), this, SLOT(setSelectedGUILang(const QString &)));
 	connect(storyEditorFontPushButton, SIGNAL(clicked()), this, SLOT(changeStoryEditorFont()));
@@ -46,6 +48,7 @@
 {
 	languageComboBox->setToolTip( "<qt>" + tr( "Select your default language for Scribus to run with. Leave this blank to choose based on environment variables. You can still override this by passing a command line option when starting Scribus" )+"</qt>");
 	themeComboBox->setToolTip( "<qt>" + tr( "Choose the default window decoration and looks. Scribus inherits any available KDE or Qt themes, if Qt is configured to search KDE plugins." ) + "</qt>");
+	iconSetComboBox->setToolTip( "<qt>" + tr( "Choose the default icon set" ) + "</qt>");
 	useSmallWidgetsCheckBox->setToolTip( "<qt>" + tr( "Palette windows will use smaller (space savy) widgets. Requires application restart" ) + "</qt>");
 	recentDocumentsSpinBox->setToolTip( "<qt>" + tr( "Number of recently edited documents to show in the File menu" ) + "</qt>");
 	fontSizeMenuSpinBox->setToolTip( "<qt>" + tr( "Default font size for the menus and windows" ) + "</qt>");
@@ -61,6 +64,7 @@
 	selectedGUILang = prefsData->uiPrefs.language;
 	setCurrentComboItem(languageComboBox, LanguageManager::instance()->getLangFromAbbrev(selectedGUILang));
 	setCurrentComboItem(themeComboBox, prefsData->uiPrefs.style);
+	setCurrentComboItem(iconSetComboBox, prefsData->uiPrefs.iconSet);
 	fontSizeMenuSpinBox->setValue( prefsData->uiPrefs.applicationFontSize );
 	fontSizePaletteSpinBox->setValue( prefsData->uiPrefs.paletteFontSize);
 	wheelJumpSpinBox->setValue( prefsData->uiPrefs.wheelJump );
@@ -84,6 +88,7 @@
 {
 	prefsData->uiPrefs.language=selectedGUILang;
 	prefsData->uiPrefs.style=themeComboBox->currentText();
+	prefsData->uiPrefs.iconSet=iconSetComboBox->currentText();
 	prefsData->uiPrefs.applicationFontSize=fontSizeMenuSpinBox->value();
 	prefsData->uiPrefs.paletteFontSize=fontSizePaletteSpinBox->value();
 	prefsData->uiPrefs.wheelJump=wheelJumpSpinBox->value();
@@ -109,22 +114,22 @@
 void Prefs_UserInterface::changeStoryEditorFontColor()
 {
 	QColor newColor(QColorDialog::getColor(seFontColor, this));
-	if (newColor.isValid())
-	{
-		QPixmap pm(100, 30);
-		pm.fill(newColor);
-		seFontColor = newColor;
-		storyEditorFontColorPushButton->setIcon(pm);
-	}
+	if (!newColor.isValid())
+		return;
+	QPixmap pm(100, 30);
+	pm.fill(newColor);
+	seFontColor = newColor;
+	storyEditorFontColorPushButton->setIcon(pm);
 }
+
 
 void Prefs_UserInterface::changeStoryEditorFont()
 {
 	bool ok;
 	QFont newFont(QFontDialog::getFont( &ok, seFont, this ));
-	if (ok)
-	{
-		seFont = newFont;
-		storyEditorFontPushButton->setText(seFont.family());
-	}
+	if (!ok)
+		return;
+	seFont = newFont;
+	storyEditorFontPushButton->setText(seFont.family());
 }
+

Modified: trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui (original)
+++ trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui Tue Jun  9 21:28:45 2015
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>803</width>
-    <height>431</height>
+    <height>434</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -90,50 +90,44 @@
          <item row="1" column="1">
           <widget class="QComboBox" name="themeComboBox"/>
          </item>
+         <item row="3" column="1">
+          <widget class="QCheckBox" name="useSmallWidgetsCheckBox">
+           <property name="text">
+            <string>Use Small Widgets on Palettes</string>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="1">
+          <widget class="QCheckBox" name="useTabsForDocumentsCheckBox">
+           <property name="text">
+            <string>Use Tabs for Documents</string>
+           </property>
+          </widget>
+         </item>
+         <item row="5" column="0">
+          <widget class="QLabel" name="recentDocumentsLabel">
+           <property name="text">
+            <string>&Recent Documents:</string>
+           </property>
+           <property name="buddy">
+            <cstring>recentDocumentsSpinBox</cstring>
+           </property>
+          </widget>
+         </item>
+         <item row="5" column="1">
+          <widget class="QSpinBox" name="recentDocumentsSpinBox"/>
+         </item>
          <item row="2" column="1">
-          <widget class="QCheckBox" name="useSmallWidgetsCheckBox">
-           <property name="text">
-            <string>Use Small Widgets on Palettes</string>
-           </property>
-          </widget>
-         </item>
-         <item row="3" column="1">
-          <widget class="QCheckBox" name="useTabsForDocumentsCheckBox">
-           <property name="text">
-            <string>Use Tabs for Documents</string>
-           </property>
-          </widget>
-         </item>
-         <item row="4" column="0">
-          <widget class="QLabel" name="recentDocumentsLabel">
-           <property name="text">
-            <string>&Recent Documents:</string>
-           </property>
-           <property name="buddy">
-            <cstring>recentDocumentsSpinBox</cstring>
-           </property>
-          </widget>
-         </item>
-         <item row="4" column="1">
-          <widget class="QSpinBox" name="recentDocumentsSpinBox"/>
-         </item>
-        </layout>
-       </item>
-       <item>
-        <spacer name="verticalSpacer_4">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
+          <widget class="QComboBox" name="iconSetComboBox"/>
+         </item>
+         <item row="2" column="0">
+          <widget class="QLabel" name="label_3">
+           <property name="text">
+            <string>Icon Set:</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
        <item>
         <widget class="QLabel" name="label_2">

Modified: trunk/Scribus/scribus/util_icon.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/util_icon.cpp
==============================================================================
--- trunk/Scribus/scribus/util_icon.cpp (original)
+++ trunk/Scribus/scribus/util_icon.cpp Tue Jun  9 21:28:45 2015
@@ -38,24 +38,42 @@
 	if (pxCache.contains(nam))
 		return *pxCache[nam];
 
-	QString iconFilePath(QString("%1%2").arg(ScPaths::instance().iconDir()).arg(nam));
-	QPixmap *pm = new QPixmap();
-	
+	QString iconFilePath(pathForIcon(nam));
+/*	QString iconset(PrefsManager::instance()->appPrefs.uiPrefs.iconSet);
+	QString iconSubdir("1_5_0/");
+	QString primaryIconSubdir("1_5_0/");
+	//temporary until second icon dir is there
+	if (iconset=="Dezso")
+		iconSubdir="1_5_1/";
+
+
+	QString iconFilePath(QString("%1%2%3").arg(ScPaths::instance().iconDir()).arg(iconSubdir).arg(nam));
+
+
+	if (!QFile::exists(iconFilePath))
+	{
+		qWarning("Unable to load icon %s: File not found", iconFilePath.toLatin1().constData());
+		iconFilePath=QString("%1%2%3").arg(ScPaths::instance().iconDir()).arg(primaryIconSubdir).arg(nam);
+	}
+
 	if (!QFile::exists(iconFilePath))
 		qWarning("Unable to load icon %s: File not found", iconFilePath.toLatin1().constData());
 	else
 	{
-		pm->load(iconFilePath);
-		if (pm->isNull())
-			qWarning("Unable to load icon %s: Got null pixmap", iconFilePath.toLatin1().constData());
-		if (PrefsManager::instance()->appPrefs.uiPrefs.grayscaleIcons && !forceUseColor)
-			iconToGrayscale(pm);
-	}
+*/
+	QPixmap *pm = new QPixmap();
+	pm->load(iconFilePath);
+	if (pm->isNull())
+		qWarning("Unable to load icon %s: Got null pixmap", iconFilePath.toLatin1().constData());
+//	else
+//		qDebug()<<"Successful icon load from"<<iconFilePath;
+	if (PrefsManager::instance()->appPrefs.uiPrefs.grayscaleIcons && !forceUseColor)
+		iconToGrayscale(pm);
 	pxCache.insert(nam, pm);
 	return *pm;
 }
 
-void SCRIBUS_API iconToGrayscale(QPixmap* pm)
+void iconToGrayscale(QPixmap* pm)
 {
 	QImage qi(pm->toImage());
 	int h=qi.height();
@@ -74,3 +92,28 @@
 }
 
 
+
+
+QString pathForIcon(const QString nam)
+{
+	QString iconset(PrefsManager::instance()->appPrefs.uiPrefs.iconSet);
+	QString iconSubdir("1_5_0/");
+	QString primaryIconSubdir("1_5_0/");
+	//temporary until second icon dir is there
+	if (iconset=="Dezso" || iconset=="1_5_1")
+		iconSubdir="1_5_1/";
+
+
+	QString iconFilePath(QString("%1%2%3").arg(ScPaths::instance().iconDir()).arg(iconSubdir).arg(nam));
+	if (QFile::exists(iconFilePath))
+		return iconFilePath;
+
+	qWarning("pathForIcon: Unable to load icon %s: File not found", iconFilePath.toLatin1().constData());
+	iconFilePath=QString("%1%2%3").arg(ScPaths::instance().iconDir()).arg(primaryIconSubdir).arg(nam);
+
+	if (QFile::exists(iconFilePath))
+		return iconFilePath;
+
+	qWarning("pathForIcon: Unable to load icon %s: File not found", iconFilePath.toLatin1().constData());
+	return "";
+}

Modified: trunk/Scribus/scribus/util_icon.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20160&path=/trunk/Scribus/scribus/util_icon.h
==============================================================================
--- trunk/Scribus/scribus/util_icon.h (original)
+++ trunk/Scribus/scribus/util_icon.h Tue Jun  9 21:28:45 2015
@@ -13,6 +13,7 @@
 #include "scribusapi.h"
 
 QPixmap SCRIBUS_API loadIcon(const QString nam, bool forceUseColor=false);
+QString SCRIBUS_API pathForIcon(const QString nam);
 void SCRIBUS_API iconToGrayscale(QPixmap *pm);
 
 #endif




More information about the scribus-commit mailing list