Rev 10272 | Rev 10303 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
10124 | 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 | */ |
||
7 | |||
8 | //Added by Craig Bradney in July 2007 |
||
9 | //To be used for basic format detection and checking |
||
10 | //One central place for storing all our extensions we support, etc |
||
11 | |||
10212 | cbradney | 12 | #ifndef _UTIL_FORMATs_H |
13 | #define _UTIL_FORMATs_H |
||
10124 | cbradney | 14 | |
10181 | cbradney | 15 | #include <QByteArray> |
16 | #include <QList> |
||
17 | #include <QMap> |
||
10124 | cbradney | 18 | #include <QString> |
10181 | cbradney | 19 | #include <QStringList> |
10137 | jghali | 20 | #include "scribusapi.h" |
10124 | cbradney | 21 | |
10137 | jghali | 22 | bool SCRIBUS_API extensionIndicatesEPS(const QString &ext); |
23 | bool SCRIBUS_API extensionIndicatesEPSorPS(const QString &ext); |
||
10181 | cbradney | 24 | bool SCRIBUS_API extensionIndicatesJPEG(const QString &ext); |
25 | bool SCRIBUS_API extensionIndicatesPDF(const QString &ext); |
||
26 | bool SCRIBUS_API extensionIndicatesPSD(const QString &ext); |
||
27 | bool SCRIBUS_API extensionIndicatesPattern(const QString &ext); |
||
10137 | jghali | 28 | bool SCRIBUS_API extensionIndicatesTIFF(const QString &ext); |
10124 | cbradney | 29 | |
10181 | cbradney | 30 | |
31 | class SCRIBUS_API FormatsManager |
||
32 | { |
||
33 | public: |
||
34 | |||
10271 | cbradney | 35 | enum ScImageFormatType |
10181 | cbradney | 36 | { |
10292 | cbradney | 37 | ALLIMAGES = 1|2|4|8|16|32|64|128|256|512|1024|2048|4096, |
38 | EPS = 1, // Encapsulated PostScript |
||
39 | GIF = 2, // GIF files |
||
40 | JPEG = 4, // JPEG |
||
41 | PAT = 8, // Pattern files |
||
42 | PDF = 16, // PDF Format |
||
43 | PNG = 32, // PNG files |
||
44 | PS = 64, // PostScript |
||
45 | PSD = 128, // Photoshop Format |
||
46 | TIFF = 256, // TIFF |
||
47 | XPM = 512, // XPM files |
||
48 | WMF = 1024, // WMF files |
||
49 | SVG = 2048, // WMF files |
||
50 | AI = 4096, // Adobe Illustrator files |
||
10181 | cbradney | 51 | }; |
52 | |||
53 | FormatsManager(); |
||
54 | ~FormatsManager(); |
||
55 | |||
56 | /** |
||
57 | * @brief Returns a pointer to the FormatsManager instance |
||
58 | * @return A pointer to the FormatsManager instance |
||
59 | */ |
||
60 | static FormatsManager* instance(); |
||
61 | /** |
||
62 | * @brief Deletes the FormatsManager Instance |
||
63 | * Must be called when FormatsManager is no longer needed. |
||
64 | */ |
||
65 | static void deleteInstance(); |
||
66 | void imageFormatSupported(const QString&); |
||
10292 | cbradney | 67 | //! Returns the name of a format, eg "Encapsulated PostScript" |
68 | QString nameOfFormat(int type); |
||
10181 | cbradney | 69 | |
10292 | cbradney | 70 | //! Returns the mimetypes of a format, eg "application/postscript" |
71 | QStringList mimetypeOfFormat(int type); |
||
10181 | cbradney | 72 | |
10292 | cbradney | 73 | //! Returns in the form of "EPS (*.eps *.EPS *.epsf *.EPSF *.epsi *.EPSI)" |
74 | QString extensionsForFormat(int type); |
||
75 | |||
76 | //! Returns in the form of "*.eps *.epsf *.epsi" or "eps|epsf|epsi" |
||
77 | QString extensionListForFormat(int type, int listType); |
||
78 | |||
79 | //! Returns in the form of "All Supported Formats (*.eps *.EPS *.epsf *.EPSF *.epsi *.EPSI);;EPS (*.eps *.EPS);;EPSI (*.epsf *.EPSF);;EPSI (*.epsi *.EPSI);;All Files (*)" |
||
80 | QString fileDialogFormatList(int type); |
||
81 | |||
10181 | cbradney | 82 | protected: |
10292 | cbradney | 83 | QMap<int, QString> m_fmtNames; |
84 | QMap<int, QStringList> m_fmtMimeTypes; |
||
10181 | cbradney | 85 | QMap<int, QStringList> m_fmts; |
86 | QStringList m_fmtList; |
||
10292 | cbradney | 87 | |
10272 | cbradney | 88 | QList<QByteArray> m_qtSupportedImageFormats; |
10181 | cbradney | 89 | QList<QByteArray> m_supportedImageFormats; |
90 | void updateSupportedImageFormats(QList<QByteArray>& supportedImageFormats); |
||
10292 | cbradney | 91 | void fileTypeStrings(int type, QString& formatList, QString& formatText, QString& formatAll, bool lowerCaseOnly=false); |
10181 | cbradney | 92 | |
93 | private: |
||
94 | /** |
||
95 | * @brief The only instance of FormatsManager available. |
||
96 | * |
||
97 | * FormatsManager is singleton and the instance can be queried with the method |
||
98 | * instance(). |
||
99 | */ |
||
100 | static FormatsManager* _instance; |
||
101 | }; |
||
102 | |||
10124 | cbradney | 103 | #endif |