r21861 by jghali - write checked fonts file after adding font path to avoid potential slow startup at next launch

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 2 00:22:19 UTC 2017


Author: jghali
Date: Sun Apr  2 00:22:19 2017
New Revision: 21861

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21861
Log:
write checked fonts file after adding font path to avoid potential slow startup at next launch

Modified:
    trunk/Scribus/scribus/scfonts.cpp
    trunk/Scribus/scribus/scfonts.h
    trunk/Scribus/scribus/ui/prefs_fonts.cpp

Modified: trunk/Scribus/scribus/scfonts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21861&path=/trunk/Scribus/scribus/scfonts.cpp
==============================================================================
--- trunk/Scribus/scribus/scfonts.cpp	(original)
+++ trunk/Scribus/scribus/scfonts.cpp	Sun Apr  2 00:22:19 2017
@@ -1131,6 +1131,12 @@
 	}
 }
 
+void SCFonts::WriteCacheList()
+{
+	QString prefsLocation = PrefsManager::instance()->preferencesLocation();
+	WriteCacheList(prefsLocation);
+}
+
 void SCFonts::WriteCacheList(QString pf)
 {
 	QDomDocument docu("fontcacherc");
@@ -1143,22 +1149,21 @@
 		if (it.value().isChecked)
 		{
 			QDomElement fosu = docu.createElement("Font");
-			fosu.setAttribute("File",it.key());
-			fosu.setAttribute("Status",static_cast<int>(it.value().isOK));
-			fosu.setAttribute("Modified",it.value().lastMod.toString(Qt::ISODate));
+			fosu.setAttribute("File", it.key());
+			fosu.setAttribute("Status", static_cast<int>(it.value().isOK));
+			fosu.setAttribute("Modified", it.value().lastMod.toString(Qt::ISODate));
 			elem.appendChild(fosu);
 		}
 	}
 	ScCore->setSplashStatus( QObject::tr("Writing updated Font Cache") );
 	QFile f(pf + "/checkfonts150.xml");
-	if(f.open(QIODevice::WriteOnly))
+	if (f.open(QIODevice::WriteOnly))
 	{
 		QTextStream s(&f);
 		s.setCodec("UTF-8");
-		s<<docu.toString();
+		s << docu.toString();
 		f.close();
 	}
-	checkedFonts.clear();
 }
 
 void SCFonts::GetFonts(QString pf, bool showFontInfo)

Modified: trunk/Scribus/scribus/scfonts.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21861&path=/trunk/Scribus/scribus/scfonts.h
==============================================================================
--- trunk/Scribus/scribus/scfonts.h	(original)
+++ trunk/Scribus/scribus/scfonts.h	Sun Apr  2 00:22:19 2017
@@ -50,6 +50,8 @@
 		/// Changes replacement fonts to point to new real fonts. For all keys 'nam' in 'substitutes', findFont(name).isReplacement() must be true
 		void setSubstitutions(const QMap<QString,QString>& substitutes, ScribusDoc* doc = NULL);
 		void removeFont(QString name);
+		/// Write checked fonts file
+		void WriteCacheList();
 		/// maps family name to face variants
 		QMap<QString, QStringList> fontMap;
 	private:

Modified: trunk/Scribus/scribus/ui/prefs_fonts.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21861&path=/trunk/Scribus/scribus/ui/prefs_fonts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_fonts.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_fonts.cpp	Sun Apr  2 00:22:19 2017
@@ -332,6 +332,7 @@
 		QString dir(QDir::fromNativeSeparators(s2));
 		m_availFonts.AddScalableFonts(dir +"/");
 		m_availFonts.updateFontMap();
+		m_availFonts.WriteCacheList();
 		updateFontList();
 	}
 }




More information about the scribus-commit mailing list