00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** Contact: Alexander Bokovoy <alexander.bokovoy@nokia.com> 00005 ** 00006 ** This file is part of the Quill Metadata package. 00007 ** 00008 ** Commercial Usage 00009 ** Licensees holding valid Qt Commercial licenses may use this file in 00010 ** accordance with the Qt Commercial License Agreement provided with the 00011 ** Software or, alternatively, in accordance with the terms contained in 00012 ** a written agreement between you and Nokia. 00013 ** 00014 ** GNU Lesser General Public License Usage 00015 ** Alternatively, this file may be used under the terms of the GNU Lesser 00016 ** General Public License version 2.1 as published by the Free Software 00017 ** Foundation and appearing in the file LICENSE.LGPL included in the 00018 ** packaging of this file. Please review the following information to 00019 ** ensure the GNU Lesser General Public License version 2.1 requirements 00020 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00021 ** 00022 ** In addition, as a special exception, Nokia gives you certain 00023 ** additional rights. These rights are described in the Nokia Qt LGPL 00024 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 00025 ** package. 00026 ** 00027 ** GNU General Public License Usage 00028 ** Alternatively, this file may be used under the terms of the GNU 00029 ** General Public License version 3.0 as published by the Free Software 00030 ** Foundation and appearing in the file LICENSE.GPL included in the 00031 ** packaging of this file. Please review the following information to 00032 ** ensure the GNU General Public License version 3.0 requirements will be 00033 ** met: http://www.gnu.org/copyleft/gpl.html. 00034 ** 00035 ** If you are unsure which license is appropriate for your use, please 00036 ** contact the sales department at qt-sales@nokia.com. 00037 ** 00038 ****************************************************************************/ 00039 00040 #ifndef XMP_H 00041 #define XMP_H 00042 00043 #include <exempi-2.0/exempi/xmp.h> 00044 #include <QHash> 00045 00046 #include "metadatarepresentation.h" 00047 00048 00049 class XmpTag { 00050 public: 00051 enum TagType { 00052 TagTypeString, 00053 TagTypeStringList, 00054 TagTypeAltLang 00055 }; 00056 00057 XmpTag(const QString &schema, const QString &tag, TagType tagType); 00058 00059 QString schema; 00060 QString tag; 00061 TagType tagType; 00062 }; 00063 00064 class Xmp : public MetadataRepresentation 00065 { 00066 public: 00067 00068 Xmp(); 00069 Xmp(const QString &fileName); 00070 ~Xmp(); 00071 00072 bool isValid() const; 00073 00074 bool supportsEntry(QuillMetadata::Tag tag) const; 00075 bool hasEntry(QuillMetadata::Tag tag) const; 00076 QVariant entry(QuillMetadata::Tag tag) const; 00077 void setEntry(QuillMetadata::Tag tag, const QVariant &entry); 00078 void removeEntry(QuillMetadata::Tag tag); 00079 00080 bool write(const QString &fileName) const; 00081 00082 private: 00083 void initTags(); 00084 00085 static QString processXmpString(XmpStringPtr xmpString); 00086 00087 void setXmpEntry(QuillMetadata::Tag tag, const QVariant &entry); 00088 00089 private: 00090 static QHash<QuillMetadata::Tag,XmpTag> m_xmpTags; 00091 00092 XmpPtr m_xmpPtr; 00093 00094 static bool m_initialized; 00095 }; 00096 00097 #endif