util_formats.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef _UTIL_FORMATs_H
00013 #define _UTIL_FORMATs_H
00014
00015 #include <QByteArray>
00016 #include <QFile>
00017 #include <QFileInfo>
00018 #include <QList>
00019 #include <QMap>
00020 #include <QString>
00021 #include <QStringList>
00022 #include "scribusapi.h"
00023
00024 bool SCRIBUS_API extensionIndicatesEPS(const QString &ext);
00025 bool SCRIBUS_API extensionIndicatesEPSorPS(const QString &ext);
00026 bool SCRIBUS_API extensionIndicatesJPEG(const QString &ext);
00027 bool SCRIBUS_API extensionIndicatesPDF(const QString &ext);
00028 bool SCRIBUS_API extensionIndicatesPSD(const QString &ext);
00029 bool SCRIBUS_API extensionIndicatesPattern(const QString &ext);
00030 bool SCRIBUS_API extensionIndicatesTIFF(const QString &ext);
00031 QString SCRIBUS_API getImageType(QString filename);
00032
00033 class SCRIBUS_API FormatsManager
00034 {
00035 public:
00036
00037 enum ScImageFormatType
00038 {
00039 ALLIMAGES = 1|2|4|8|16|32|64|128|256|512|1024|2048|4096,
00040 IMAGESIMGFRAME = 1|2|4|16|32|64|128|256|512,
00041 VECTORIMAGES = 1|64|1024|2048,
00042 RASTORIMAGES = 2|4|8|32|512,
00043 EPS = 1,
00044 GIF = 2,
00045 JPEG = 4,
00046 PAT = 8,
00047 PDF = 16,
00048 PNG = 32,
00049 PS = 64,
00050 PSD = 128,
00051 TIFF = 256,
00052 XPM = 512,
00053 WMF = 1024,
00054 SVG = 2048,
00055 AI = 4096,
00056 };
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 FormatsManager();
00087 ~FormatsManager();
00088
00093 static FormatsManager* instance();
00098 static void deleteInstance();
00099 void imageFormatSupported(const QString&);
00101 QString nameOfFormat(int type);
00102
00104 QStringList mimetypeOfFormat(int type);
00105
00107 QString extensionsForFormat(int type);
00108
00110 QString extensionListForFormat(int type, int listType);
00111
00113 QString fileDialogFormatList(int type);
00114
00115 protected:
00116 QMap<int, QString> m_fmtNames;
00117 QMap<int, QStringList> m_fmtMimeTypes;
00118 QMap<int, QStringList> m_fmts;
00119 QStringList m_fmtList;
00120
00121 QList<QByteArray> m_qtSupportedImageFormats;
00122 QList<QByteArray> m_supportedImageFormats;
00123 void updateSupportedImageFormats(QList<QByteArray>& supportedImageFormats);
00124 void fileTypeStrings(int type, QString& formatList, QString& formatText, QString& formatAll, bool lowerCaseOnly=false);
00125
00126 private:
00133 static FormatsManager* _instance;
00134 };
00135
00136 #endif