CollectForOutput Class Reference
Performs "Collect for Output" tasks. collect() method copies the document, fonts and images into user defined directory. QObject inheritance mainly due moc speedup and tr() methods. More...
#include <collect4output.h>

Public Member Functions | |
| CollectForOutput (ScribusDoc *doc, bool withFontsA=false, bool withProfilesA=false, bool compressDocA=false) | |
| Setup the attributes. | |
| ~CollectForOutput () | |
| QString | collect () |
| Main method doing everything. It calls all related methods. | |
Private Member Functions | |
| bool | newDirDialog () |
| bool | collectDocument () |
| bool | collectItems () |
| void | processItem (PageItem *ite) |
| bool | collectFonts () |
| bool | collectProfiles () |
| QString | collectFile (QString oldFile, QString newFile) |
| Copy used file into new location with magic checks. It looks into collectedFiles map. If there is newFile (key) already found - it will construct new filename to prevent overwriting. E.g. newFile.png can be newFile_0.png. It checks already collected files not to collect one item 2 times. | |
Private Attributes | |
| ScribusDoc * | m_Doc |
| bool | compressDoc |
| bool | withFonts |
| bool | withProfiles |
| QString | outputDirectory |
| QString | newName |
| QMap< QString, QString > | collectedFiles |
| Remember already collected files to collect the same files only once. It's QMap - newFile, oldFile. | |
| PrefsContext * | dirs |
Detailed Description
Performs "Collect for Output" tasks. collect() method copies the document, fonts and images into user defined directory. QObject inheritance mainly due moc speedup and tr() methods.
Definition at line 25 of file collect4output.h.
Constructor & Destructor Documentation
| CollectForOutput::CollectForOutput | ( | ScribusDoc * | doc, | |
| bool | withFontsA = false, |
|||
| bool | withProfilesA = false, |
|||
| bool | compressDocA = false | |||
| ) |
Setup the attributes.
- Parameters:
-
withFonts collect/move fonts into output directory too compressDoc use gzipped document
Definition at line 28 of file collect4output.cpp.
References collectedFiles, compressDoc, dirs, PrefsFile::getContext(), PrefsManager::instance(), m_Doc, outputDirectory, PrefsManager::prefsFile, withFonts, and withProfiles.
| CollectForOutput::~CollectForOutput | ( | ) | [inline] |
Definition at line 35 of file collect4output.h.
Member Function Documentation
| QString CollectForOutput::collect | ( | ) |
Main method doing everything. It calls all related methods.
Definition at line 61 of file collect4output.cpp.
References collectDocument(), collectedFiles, collectFonts(), collectItems(), collectProfiles(), dirs, ScribusCore::fileWatcher, FileWatcher::forceScan(), UndoManager::instance(), ScribusMainWindow::mainWindowProgressBar, newDirDialog(), newName, outputDirectory, ScribusCore::primaryMainWindow(), UndoManager::renameStack(), ScCore, ScribusMainWindow::scrActions, PrefsContext::set(), ScribusMainWindow::setStatusBarInfoText(), FileWatcher::start(), FileWatcher::stop(), tr(), CommonStrings::tr_OK, CommonStrings::trWarning, ScribusMainWindow::updateActiveWindowCaption(), ScribusMainWindow::updateRecent(), withFonts, and withProfiles.
| bool CollectForOutput::newDirDialog | ( | ) | [private] |
Ask user for output directory via GUI.
- Return values:
-
true on success
Definition at line 41 of file collect4output.cpp.
References ScribusMainWindow::CFileDialog(), compressDoc, dirs, PrefsManager::documentDir(), fdDirectoriesOnly, PrefsContext::get(), PrefsManager::instance(), outputDirectory, ScribusCore::primaryMainWindow(), ScCore, tr(), ScribusCore::usingGUI(), withFonts, and withProfiles.
Referenced by collect().
| bool CollectForOutput::collectDocument | ( | ) | [private] |
Check permissions and export document itself.
- Return values:
-
true on success
Definition at line 104 of file collect4output.cpp.
References compressDoc, ScribusDoc::DocName, ScribusMainWindow::DoFileSave(), ScribusDoc::hasName, m_Doc, newName, outputDirectory, overwrite(), ScribusCore::primaryMainWindow(), and ScCore.
Referenced by collect().
| bool CollectForOutput::collectItems | ( | ) | [private] |
Collect all related items, esp. images.
- Return values:
-
true on success
Definition at line 140 of file collect4output.cpp.
References ScribusDoc::DocItems, ScribusDoc::docPatterns, ScribusDoc::FrameItems, ScribusDoc::getUsedPatterns(), ScPattern::items, m_Doc, ScribusDoc::MasterItems, and processItem().
Referenced by collect().
| void CollectForOutput::processItem | ( | PageItem * | ite | ) | [private] |
Processes the item, helper function for collectItems()
Definition at line 187 of file collect4output.cpp.
References FileWatcher::addFile(), PageItem::asImageFrame(), PageItem::asTextFrame(), collectFile(), ScribusCore::fileWatcher, PrefsManager::instance(), PageItem::isAnnotation(), PageItem::Pfile, PageItem::Pfile2, PageItem::Pfile3, FileWatcher::removeFile(), and ScCore.
Referenced by collectItems().
| bool CollectForOutput::collectFonts | ( | ) | [private] |
Collect used fonts if requested.
- Return values:
-
true on success
Definition at line 240 of file collect4output.cpp.
References PrefsManager::appPrefs, ApplicationPrefs::AvailFonts, copyFile(), PrefsManager::instance(), m_Doc, outputDirectory, and ScribusDoc::UsedFonts.
Referenced by collect().
| bool CollectForOutput::collectProfiles | ( | ) | [private] |
Collect used profiles if requested.
- Return values:
-
true on success
Definition at line 253 of file collect4output.cpp.
References copyFile(), ScribusDoc::getUsedProfiles(), m_Doc, and outputDirectory.
Referenced by collect().
| QString CollectForOutput::collectFile | ( | QString | oldFile, | |
| QString | newFile | |||
| ) | [private] |
Copy used file into new location with magic checks. It looks into collectedFiles map. If there is newFile (key) already found - it will construct new filename to prevent overwriting. E.g. newFile.png can be newFile_0.png. It checks already collected files not to collect one item 2 times.
- Parameters:
-
oldFile full path of the original file newFile suggested fullpath of the collected file
- Return values:
-
QString really used fullpath of the new file
Definition at line 267 of file collect4output.cpp.
References collectedFiles, copy(), copyFile(), and outputDirectory.
Referenced by processItem().
Member Data Documentation
ScribusDoc* CollectForOutput::m_Doc [private] |
Doc to collect
Definition at line 44 of file collect4output.h.
Referenced by collectDocument(), collectFonts(), CollectForOutput(), collectItems(), and collectProfiles().
bool CollectForOutput::compressDoc [private] |
Use compressed document. See the constructor
Definition at line 46 of file collect4output.h.
Referenced by collectDocument(), CollectForOutput(), and newDirDialog().
bool CollectForOutput::withFonts [private] |
Collect fonts too. See the constructor
Definition at line 48 of file collect4output.h.
Referenced by collect(), CollectForOutput(), and newDirDialog().
bool CollectForOutput::withProfiles [private] |
Collect icc profiles too. See the constructor
Definition at line 50 of file collect4output.h.
Referenced by collect(), CollectForOutput(), and newDirDialog().
QString CollectForOutput::outputDirectory [private] |
User defined directory via GUI
Definition at line 52 of file collect4output.h.
Referenced by collect(), collectDocument(), collectFile(), collectFonts(), CollectForOutput(), collectProfiles(), and newDirDialog().
QString CollectForOutput::newName [private] |
Name of the moved file with the new directory path
Definition at line 54 of file collect4output.h.
Referenced by collect(), and collectDocument().
QMap<QString, QString> CollectForOutput::collectedFiles [private] |
Remember already collected files to collect the same files only once. It's QMap - newFile, oldFile.
Definition at line 57 of file collect4output.h.
Referenced by collect(), collectFile(), and CollectForOutput().
PrefsContext* CollectForOutput::dirs [private] |
Reference to the preferences
Definition at line 59 of file collect4output.h.
Referenced by collect(), CollectForOutput(), and newDirDialog().
The documentation for this class was generated from the following files:
