r18483 by fschmid - Follow-Up to Bug #11659: Implement proper working for OSG-Frames.
scribus-commit
scribus-commit at lists.scribus.net
Sat Sep 21 16:04:49 UTC 2013
Author: fschmid
Date: Sat Sep 21 16:04:48 2013
New Revision: 18483
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18483
Log:
Follow-Up to Bug #11659: Implement proper working for OSG-Frames.
Modified:
trunk/Scribus/scribus/ui/scrapbookpalette.cpp
trunk/Scribus/scribus/ui/scrapbookpalette.h
Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18483&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Sat Sep 21 16:04:48 2013
@@ -200,8 +200,16 @@
if (!Pfile3.isEmpty())
hasImage = true;
}
+ else if (PType == PageItem::OSGFrame)
+ {
+ QString Pfile = pg.attribute("modelFile");
+ if (!Pfile.isEmpty())
+ hasImage = true;
+ }
else if (PType == PageItem::Group)
checkForImg(pg, hasImage);
+ if (hasImage)
+ break;
}
DOC = DOC.nextSibling();
}
@@ -232,8 +240,16 @@
if (!Pfile3.isEmpty())
hasImage = true;
}
+ else if (PType == PageItem::OSGFrame)
+ {
+ QString Pfile = pg.attribute("modelFile");
+ if (!Pfile.isEmpty())
+ hasImage = true;
+ }
else if (PType == PageItem::Group)
checkForImg(pg, hasImage);
+ if (hasImage)
+ break;
}
DOC = DOC.nextSibling();
}
@@ -305,6 +321,24 @@
}
pg.setAttribute("relativePaths", 1);
}
+ else if (PType == PageItem::OSGFrame)
+ {
+ QString Pfile = pg.attribute("modelFile");
+ if (!Pfile.isEmpty())
+ {
+ QFileInfo fi(Pfile);
+ if (fi.isAbsolute())
+ source = QDir::cleanPath(QDir::toNativeSeparators(Pfile));
+ else
+ {
+ QFileInfo pfi2(QDir::cleanPath(QDir::toNativeSeparators(fileDir+"/"+Pfile)));
+ source = pfi2.absoluteFilePath();
+ }
+ QString target = QDir::cleanPath(QDir::toNativeSeparators(dir + "/" + fid.baseName() + "/" + fi.fileName()));
+ copyFile(source, target);
+ pg.setAttribute("modelFile", fid.baseName() + "/" + fi.fileName());
+ }
+ }
else if (PType == PageItem::Group)
{
checkAndChangeGroups(pg, dir, fid);
@@ -381,6 +415,24 @@
pg.setAttribute("PFILE3", fid.baseName() + "/" + fi.fileName());
}
pg.setAttribute("relativePaths", 1);
+ }
+ else if (PType == PageItem::OSGFrame)
+ {
+ QString Pfile = pg.attribute("modelFile");
+ if (!Pfile.isEmpty())
+ {
+ QFileInfo fi(Pfile);
+ if (fi.isAbsolute())
+ source = QDir::cleanPath(QDir::toNativeSeparators(Pfile));
+ else
+ {
+ QFileInfo pfi2(QDir::cleanPath(QDir::toNativeSeparators(fileDir+"/"+Pfile)));
+ source = pfi2.absoluteFilePath();
+ }
+ QString target = QDir::cleanPath(QDir::toNativeSeparators(dir + "/" + fid.baseName() + "/" + fi.fileName()));
+ copyFile(source, target);
+ pg.setAttribute("modelFile", fid.baseName() + "/" + fi.fileName());
+ }
}
else if (PType == PageItem::Group)
{
@@ -1426,6 +1478,19 @@
}
pg.setAttribute("relativePaths", 1);
}
+ else if (PType == PageItem::OSGFrame)
+ {
+ QString Pfile = pg.attribute("modelFile");
+ if (!Pfile.isEmpty())
+ {
+ QFileInfo fi(Pfile);
+ pg.setAttribute("modelFile", fid.baseName() + "/" + fi.fileName());
+ }
+ }
+ else if (PType == PageItem::Group)
+ {
+ adjustReferencesGroups(pg, fid);
+ }
}
DOC = DOC.nextSibling();
}
@@ -1437,6 +1502,55 @@
s.setDevice(&fl);
s.writeRawData(cs.data(), cs.length());
fl.close();
+ }
+}
+
+void Biblio::adjustReferencesGroups(QDomElement elem, QFileInfo fid)
+{
+ QDomNode DOC = elem.firstChild();
+ while(!DOC.isNull())
+ {
+ QDomElement pg = DOC.toElement();
+ if(pg.tagName() == "PAGEOBJECT")
+ {
+ PageItem::ItemType PType = static_cast<PageItem::ItemType>(pg.attribute("PTYPE").toInt());
+ if ((PType == PageItem::ImageFrame) || (PType == PageItem::TextFrame))
+ {
+ QString Pfile = pg.attribute("PFILE");
+ if (!Pfile.isEmpty())
+ {
+ QFileInfo fi(Pfile);
+ pg.setAttribute("PFILE", fid.baseName() + "/" + fi.fileName());
+ }
+ QString Pfile2 = pg.attribute("PFILE2","");
+ if (!Pfile2.isEmpty())
+ {
+ QFileInfo fi(Pfile2);
+ pg.setAttribute("PFILE2", fid.baseName() + "/" + fi.fileName());
+ }
+ QString Pfile3 = pg.attribute("PFILE3","");
+ if (!Pfile3.isEmpty())
+ {
+ QFileInfo fi(Pfile3);
+ pg.setAttribute("PFILE3", fid.baseName() + "/" + fi.fileName());
+ }
+ pg.setAttribute("relativePaths", 1);
+ }
+ else if (PType == PageItem::OSGFrame)
+ {
+ QString Pfile = pg.attribute("modelFile");
+ if (!Pfile.isEmpty())
+ {
+ QFileInfo fi(Pfile);
+ pg.setAttribute("modelFile", fid.baseName() + "/" + fi.fileName());
+ }
+ }
+ else if (PType == PageItem::Group)
+ {
+ adjustReferencesGroups(pg, fid);
+ }
+ }
+ DOC = DOC.nextSibling();
}
}
Modified: trunk/Scribus/scribus/ui/scrapbookpalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18483&path=/trunk/Scribus/scribus/ui/scrapbookpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.h (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.h Sat Sep 21 16:04:48 2013
@@ -78,6 +78,7 @@
void ObjFromCopyAction(QString text, QString name);
void adjustReferences(QString nam);
+ void adjustReferencesGroups(QDomElement elem, QFileInfo fid);
void CleanUpTemp();
void setScrapbookFileName(QString);
const QString getScrapbookFileName();
More information about the scribus-commit
mailing list