pineapple-pictures/metadata.h

67 lines
1.7 KiB
C
Raw Permalink Normal View History

2020-10-12 22:35:37 +08:00
#ifndef METADATA_H
#define METADATA_H
#include <QMap>
#include <QPair>
#include <QCoreApplication>
class Section
{
Q_DECLARE_TR_FUNCTIONS(Section)
public:
Section();
~Section();
Section & operator=(const Section& other);
// TODO: maybe use QString instead of a enum? different section won't share a same
// enum value in any way...
enum PropertyType : int {
NameProp,
FileSizeProp,
LastModifiedProp,
ImageSizeProp,
};
int count() const;
void setSectionName(const QString & displayName);
void setValue(PropertyType type, const QString & value);
QString value(PropertyType type) const;
QString valueAt(int index) const;
QString propertyName(PropertyType type) const;
private:
QString m_displayName;
QList<PropertyType> m_propertyIndexes;
QMap<PropertyType, QString> m_propertiesValueMap;
QMap<PropertyType, QString> m_propertiesOverrideDisplayNameMap;
const QMap<PropertyType, QString> m_builtinPropDisplayNameMap {
{NameProp, tr("Name")},
{FileSizeProp, tr("File Size")},
{LastModifiedProp, tr("Last Modified")},
{ImageSizeProp, tr("Image Size")},
};
};
class Metadata
{
public:
enum SectionType : int {
GeneralSection,
ExifSection,
};
Metadata();
~Metadata();
private:
QList<SectionType> m_sectionIndexes;
QMap<SectionType, Section> m_sections;
void setSectionName(SectionType type, const QString & displayName);
void setPropertyValue(SectionType type, Section::PropertyType propType, QString value);
};
#endif // METADATA_H