r17764 by jghali - #11040: Collect files in sub-directories
scribus-commit
scribus-commit at lists.scribus.net
Sun Aug 26 21:53:26 UTC 2012
Author: jghali
Date: Sun Aug 26 21:53:26 2012
New Revision: 17764
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17764
Log:
#11040: Collect files in sub-directories
Modified:
trunk/Scribus/scribus/collect4output.cpp
trunk/Scribus/scribus/scribus.cpp
Modified: trunk/Scribus/scribus/collect4output.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17764&path=/trunk/Scribus/scribus/collect4output.cpp
==============================================================================
--- trunk/Scribus/scribus/collect4output.cpp (original)
+++ trunk/Scribus/scribus/collect4output.cpp Sun Aug 26 21:53:26 2012
@@ -23,11 +23,11 @@
#include "scpattern.h"
#include "util_file.h"
+#include <QDir>
+#include <QMap>
#include <QMessageBox>
#include <QProgressBar>
#include <QString>
-#include <QMap>
-#include <QDir>
CollectForOutput::CollectForOutput(ScribusDoc* doc, QString outputDirectory, bool withFonts, bool withProfiles, bool compressDoc)
: QObject(ScCore),
@@ -74,15 +74,26 @@
return false;
if (!m_outputDirectory.endsWith("/"))
m_outputDirectory += "/";
- QDir dir(m_outputDirectory);
- if (!dir.exists())
- {
- bool created = dir.mkpath(m_outputDirectory);
+
+ QStringList directories;
+ directories.append(m_outputDirectory);
+ directories.append(m_outputDirectory + "images/");
+ if (m_withFonts)
+ directories.append(m_outputDirectory + "fonts/");
+ if (m_withProfiles)
+ directories.append(m_outputDirectory + "profiles/");
+
+ for (int i = 0; i < directories.count(); ++i)
+ {
+ QDir dir(directories[i]);
+ if (dir.exists()) continue;
+
+ bool created = dir.mkpath(directories[i]);
if (!created)
{
QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning,
- "<qt>" + tr("Cannot create directory:\n%1").arg(m_outputDirectory) + "</qt>",
- CommonStrings::tr_OK);
+ "<qt>" + tr("Cannot create directory:\n%1").arg(directories[i]) + "</qt>",
+ CommonStrings::tr_OK);
return false;
}
}
@@ -130,7 +141,8 @@
ScCore->primaryMainWindow()->mainWindowProgressBar->reset();
ScCore->fileWatcher->start();
collectedFiles.clear();
- newFileName=newName;
+ newFileName = newName;
+
return QString::null;
}
@@ -337,7 +349,7 @@
for (it3 = m_Doc->UsedFonts.begin(); it3 != it3end; ++it3)
{
QFileInfo itf(prefsManager->appPrefs.fontPrefs.AvailFonts[it3.key()].fontFilePath());
- copyFileAtomic(prefsManager->appPrefs.fontPrefs.AvailFonts[it3.key()].fontFilePath(), m_outputDirectory + itf.fileName());
+ copyFileAtomic(prefsManager->appPrefs.fontPrefs.AvailFonts[it3.key()].fontFilePath(), m_outputDirectory + "fonts/" + itf.fileName());
if (prefsManager->appPrefs.fontPrefs.AvailFonts[it3.key()].type() == ScFace::TYPE1)
{
QStringList metrics;
@@ -360,7 +372,7 @@
{
QString origAFM = metrics[a];
QFileInfo fi(origAFM);
- copyFileAtomic(origAFM, m_outputDirectory + fi.fileName());
+ copyFileAtomic(origAFM, m_outputDirectory + "fonts/" + fi.fileName());
}
}
if (uiCollect)
@@ -419,7 +431,7 @@
{
QString profileName(it.key());
QString profilePath(it.value());
- copyFileAtomic(profilePath, m_outputDirectory + QFileInfo(profilePath).fileName());
+ copyFileAtomic(profilePath, m_outputDirectory + "profiles/" + QFileInfo(profilePath).fileName());
if (uiCollect)
emit profilesCollected(c++);
}
@@ -445,7 +457,9 @@
++cnt;
}
if (copy)
- copyFileAtomic(oldFile, m_outputDirectory + newFile);
+ {
+ copyFileAtomic(oldFile, m_outputDirectory + "images/" + newFile);
+ }
collectedFiles[newFile] = oldFile;
- return m_outputDirectory + newFile;
-}
+ return m_outputDirectory + "images/" + newFile;
+}
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17764&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Aug 26 21:53:26 2012
@@ -3883,9 +3883,17 @@
is12doc=true;
}
+ QDir docProfileDir(fi.absolutePath() + "/profiles");
ScCore->getCMSProfilesDir(fi.absolutePath()+"/", false, false);
+ if (docProfileDir.exists())
+ ScCore->getCMSProfilesDir(fi.absolutePath()+"/profiles", false, false);
+
+ QDir docFontDir(fi.absolutePath() + "/fonts");
prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/", FName);
+ if (docFontDir.exists())
+ prefsManager->appPrefs.fontPrefs.AvailFonts.AddScalableFonts(fi.absolutePath()+"/fonts", FName);
prefsManager->appPrefs.fontPrefs.AvailFonts.updateFontMap();
+
doc=new ScribusDoc();
doc->is12doc=is12doc;
doc->appMode = modeNormal;
More information about the scribus-commit
mailing list