Rev 5093 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
3201 | subik | 7 | #ifndef COLLECT4OUTPUT_H |
8 | #define COLLECT4OUTPUT_H |
||
9 | |||
10 | #include <qobject.h> |
||
11 | #include <qmap.h> |
||
11827 | jghali | 12 | #include <qstringlist.h> |
3201 | subik | 13 | |
14 | class QString; |
||
4026 | craig | 15 | class ScribusMainWindow; |
3201 | subik | 16 | class PrefsContext; |
17 | |||
18 | |||
19 | /*! \brief Performs "Collect for Output" tasks. |
||
20 | collect() method copies the document, fonts and images |
||
21 | into user defined directory. QObject inheritance mainly due |
||
22 | moc speedup and tr() methods. |
||
23 | \author Petr Vanek, Franz Schmid |
||
24 | */ |
||
25 | class CollectForOutput : public QObject |
||
26 | { |
||
27 | Q_OBJECT |
||
28 | |||
29 | public: |
||
30 | /*! \brief Setup the attributes |
||
31 | \param withFonts collect/move fonts into output directory too |
||
32 | \param compressDoc use gzipped document |
||
33 | */ |
||
34 | CollectForOutput(bool withFonts=false, bool compressDoc=false); |
||
35 | ~CollectForOutput(){}; |
||
36 | |||
37 | /*! \brief Main method doing everything. |
||
38 | It calls all related methods |
||
39 | */ |
||
40 | QString collect(); |
||
41 | |||
42 | private: |
||
43 | /*! Use compressed document. See the constructor */ |
||
44 | bool compressDoc; |
||
45 | /*! Collect fonts too. See the constructor */ |
||
46 | bool withFonts; |
||
47 | /*! User defined directory via GUI */ |
||
48 | QString outputDirectory; |
||
49 | /*! Name of the moved file with the new directory path */ |
||
50 | QString newName; |
||
51 | /*! \brief Remember already collected files to collect the same files only once. |
||
52 | It's QMap - newFile, oldFile.*/ |
||
53 | QMap<QString, QString> collectedFiles; |
||
54 | /*! Reference to the preferences */ |
||
55 | PrefsContext* dirs; |
||
56 | |||
57 | /*! Ask user for output directory via GUI. |
||
58 | \retval true on success */ |
||
59 | bool newDirDialog(); |
||
60 | /*! Check permissions and export document itself. |
||
61 | \retval true on success */ |
||
62 | bool collectDocument(); |
||
63 | /*! Collect all related items, esp. images. |
||
64 | \retval true on success */ |
||
65 | bool collectItems(); |
||
66 | /*! Collect used fonts if requested. |
||
67 | \retval true on success */ |
||
68 | bool collectFonts(); |
||
11827 | jghali | 69 | /*! Helper function for collectFonts() */ |
70 | QStringList findFontMetrics(const QString& baseDir, const QString& baseName) const; |
||
3201 | subik | 71 | /*! \brief Copy used file into new location with magic checks. |
72 | It looks into collectedFiles map. If there is newFile (key) already |
||
73 | found - it will construct new filename to prevent overwritting. |
||
74 | E.g. newFile.png can be newFile_0.png. |
||
75 | It checks already collected files not to collect one item 2 times. |
||
76 | \param oldFile full path of the original file |
||
77 | \param newFile suggested fullpath of the collected file |
||
78 | \retval QString really used fullpath of the new file |
||
79 | */ |
||
80 | QString collectFile(QString oldFile, QString newFile); |
||
81 | |||
82 | }; |
||
83 | |||
84 | #endif |