r15665 by fschmid - Do not store the colors & gradients in the prefs file anymore, load the selected default palette from the palette file instead.
scribus-commit
scribus-commit at lists.scribus.net
Wed Oct 27 23:43:36 CEST 2010
Author: fschmid
Date: Wed Oct 27 21:43:36 2010
New Revision: 15665
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15665
Log:
Do not store the colors & gradients in the prefs file anymore, load the selected default palette from the palette file instead.
Modified:
trunk/Scribus/scribus/colorsetmanager.cpp
trunk/Scribus/scribus/prefsmanager.cpp
Modified: trunk/Scribus/scribus/colorsetmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15665&path=/trunk/Scribus/scribus/colorsetmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/colorsetmanager.cpp (original)
+++ trunk/Scribus/scribus/colorsetmanager.cpp Wed Oct 27 21:43:36 2010
@@ -149,10 +149,15 @@
{
QString setName = fi.baseName();
setName.replace("_", " ");
- QTreeWidgetItem* item = new QTreeWidgetItem(parent);
- item->setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- item->setText(0, setName);
- searchDir(path + dirs[dc] + "/", item);
+ if (parent != NULL)
+ {
+ QTreeWidgetItem* item = new QTreeWidgetItem(parent);
+ item->setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ item->setText(0, setName);
+ searchDir(path + dirs[dc] + "/", item);
+ }
+ else
+ searchDir(path + dirs[dc] + "/", parent);
}
else
{
@@ -161,9 +166,12 @@
QString setName = fi.baseName();
setName.replace("_", " ");
palettes.insert(setName, fi.absoluteFilePath());
- QTreeWidgetItem* item = new QTreeWidgetItem(parent);
- item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- item->setText(0, setName);
+ if (parent != 0)
+ {
+ QTreeWidgetItem* item = new QTreeWidgetItem(parent);
+ item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ item->setText(0, setName);
+ }
}
}
}
@@ -177,22 +185,7 @@
for ( QStringList::Iterator it = paletteLocations.begin(); it != paletteLocations.end(); ++it )
{
path = (*it);
- if (parent != NULL)
- searchDir(path, parent);
- else
- {
- QDir dir(path , "*.xml *.gpl *.eps *.ai *.sla *.soc", QDir::Name, QDir::Files | QDir::NoSymLinks);
- if (dir.exists() && (dir.count() != 0))
- {
- for (uint i = 0; i < dir.count(); ++i)
- {
- QFileInfo file(path + dir[i]);
- QString setName=file.baseName();
- setName.replace("_", " ");
- palettes.insert(setName, file.absoluteFilePath());
- }
- }
- }
+ searchDir(path, parent);
}
}
Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15665&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Wed Oct 27 21:43:36 2010
@@ -52,6 +52,7 @@
#include "scribusstructs.h"
#include "scribuscore.h"
#include "ui/modetoolbar.h"
+#include "util_color.h"
#include "util_file.h"
#include "util_ghostscript.h"
@@ -1605,6 +1606,7 @@
rde.appendChild(hyelm2);
}
elem.appendChild(rde);
+/*
ColorList::Iterator itc;
for (itc = appPrefs.colorPrefs.DColors.begin(); itc != appPrefs.colorPrefs.DColors.end(); ++itc)
{
@@ -1636,6 +1638,7 @@
}
elem.appendChild(grad);
}
+*/
for (int rd=0; rd<appPrefs.uiPrefs.RecentDocs.count(); ++rd)
{
QDomElement rde=docu.createElement("Recent");
@@ -1828,6 +1831,10 @@
return false;
appPrefs.colorPrefs.DColors.clear();
appPrefs.extToolPrefs.latexCommands.clear();
+ ColorSetManager csm;
+ csm.initialiseDefaultPrefs(appPrefs);
+ csm.findPaletteLocations();
+ csm.findPalettes();
ScColor lf = ScColor();
QDomNode DOC=elem.firstChild();
if (!DOC.namedItem("CheckProfile").isNull())
@@ -2328,6 +2335,7 @@
face.subset(static_cast<bool>(dc.attribute("Subset", "0").toInt()));
}
}
+/*
if (dc.tagName()=="Color")
{
if (dc.hasAttribute("CMYK"))
@@ -2369,12 +2377,41 @@
}
appPrefs.defaultGradients.insert(dc.attribute("Name"), gra);
}
+*/
if (dc.tagName()=="Substitute")
appPrefs.fontPrefs.GFontSub[dc.attribute("Name")] = dc.attribute("Replace");
if (dc.tagName()=="ColorSet")
appPrefs.colorPrefs.CustomColorSets.append(dc.attribute("Name"));
if (dc.tagName()=="DefaultColorSet")
+ {
+ QString pfadC = "";
appPrefs.colorPrefs.DColorSet = dc.attribute("Name");
+ if (appPrefs.colorPrefs.CustomColorSets.contains(appPrefs.colorPrefs.DColorSet))
+ {
+ QString Fname = appPrefs.colorPrefs.DColorSet;
+ Fname.replace(" ", "_");
+ Fname += ".xml";
+ pfadC = QDir::convertSeparators(ScPaths::getApplicationDataDir()+Fname);
+ }
+ else
+ pfadC = csm.paletteFileFromName(appPrefs.colorPrefs.DColorSet);
+ if (appPrefs.colorPrefs.DColorSet != "Scribus Small")
+ importColorsFromFile(pfadC, appPrefs.colorPrefs.DColors, &appPrefs.defaultGradients, false);
+ else
+ {
+ appPrefs.colorPrefs.DColors.insert("White", ScColor(0, 0, 0, 0));
+ appPrefs.colorPrefs.DColors.insert("Black", ScColor(0, 0, 0, 255));
+ ScColor cc = ScColor(255, 255, 255, 255);
+ cc.setRegistrationColor(true);
+ appPrefs.colorPrefs.DColors.insert("Registration", cc);
+ appPrefs.colorPrefs.DColors.insert("Blue", ScColor(255, 255, 0, 0));
+ appPrefs.colorPrefs.DColors.insert("Cyan", ScColor(255, 0, 0, 0));
+ appPrefs.colorPrefs.DColors.insert("Green", ScColor(255, 0, 255, 0));
+ appPrefs.colorPrefs.DColors.insert("Red", ScColor(0, 255, 255, 0));
+ appPrefs.colorPrefs.DColors.insert("Yellow", ScColor(0, 0, 255, 0));
+ appPrefs.colorPrefs.DColors.insert("Magenta", ScColor(0, 255, 0, 0));
+ }
+ }
if(dc.tagName()=="PDF")
{
appPrefs.pdfPrefs.Articles = static_cast<bool>(dc.attribute("Articles").toInt());
More information about the scribus-commit
mailing list