initial commit
@@ -0,0 +1,844 @@
|
||||
/*!
|
||||
\file cexif.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CEXIF_H
|
||||
#define CEXIF_H
|
||||
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QDateTime>
|
||||
#include <QImage>
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QList>
|
||||
|
||||
#include <QSqlDatabase>
|
||||
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIFCompression cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIFCompression
|
||||
{
|
||||
public:
|
||||
cEXIFCompression(const qint32& iID, const QString& szCompression);
|
||||
|
||||
qint32 m_iID; /*!< TODO: describe */
|
||||
QString m_szCompression; /*!< TODO: describe */
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cEXIFCompression*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIFCompressionList cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIFCompressionList : public QList<cEXIFCompression*>
|
||||
{
|
||||
public:
|
||||
cEXIFCompressionList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param iID
|
||||
\param szCompression
|
||||
\return cEXIFCompression
|
||||
*/
|
||||
cEXIFCompression* add(const qint32& iID, const QString& szCompression);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param iID
|
||||
\return cEXIFCompression
|
||||
*/
|
||||
cEXIFCompression* find(const qint32& iID);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn compression
|
||||
\param iID
|
||||
\return QString
|
||||
*/
|
||||
QString compression(const qint32& iID);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cEXIFCompressionList)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIFLightSource cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIFLightSource
|
||||
{
|
||||
public:
|
||||
cEXIFLightSource(const qint32& iID, const QString& szLightSource);
|
||||
|
||||
qint32 m_iID; /*!< TODO: describe */
|
||||
QString m_szLightSource; /*!< TODO: describe */
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cEXIFLightSource*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIFLightSourceList cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIFLightSourceList : public QList<cEXIFLightSource*>
|
||||
{
|
||||
public:
|
||||
cEXIFLightSourceList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param iID
|
||||
\param szLightSource
|
||||
\return cEXIFLightSource
|
||||
*/
|
||||
cEXIFLightSource* add(const qint32& iID, const QString& szLightSource);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param iID
|
||||
\return cEXIFLightSource
|
||||
*/
|
||||
cEXIFLightSource* find(const qint32& iID);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn lightSource
|
||||
\param iID
|
||||
\return QString
|
||||
*/
|
||||
QString lightSource(const qint32& iID);
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIFFlash cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIFFlash
|
||||
{
|
||||
public:
|
||||
cEXIFFlash(const qint32& iID, const QString& szFlash);
|
||||
|
||||
qint32 m_iID; /*!< TODO: describe */
|
||||
QString m_szFlash; /*!< TODO: describe */
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cEXIFFlash*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIFFlashList cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIFFlashList : public QList<cEXIFFlash*>
|
||||
{
|
||||
public:
|
||||
cEXIFFlashList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param iID
|
||||
\param szFlash
|
||||
\return cEXIFFlash
|
||||
*/
|
||||
cEXIFFlash* add(const qint32& iID, const QString& szFlash);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param iID
|
||||
\return cEXIFFlash
|
||||
*/
|
||||
cEXIFFlash* find(const qint32& iID);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn flash
|
||||
\param iID
|
||||
\return QString
|
||||
*/
|
||||
QString flash(const qint32& iID);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
class cEXIFTag
|
||||
{
|
||||
public:
|
||||
cEXIFTag(const qint32& iTAGID, const QString& szTAGName, const qint32& iIFDID, const qint32& iTypeID, const QString& szDescription);
|
||||
|
||||
qint32 m_iTAGID; /*!< TODO: describe */
|
||||
QString m_szTAGName; /*!< TODO: describe */
|
||||
qint32 m_iIFDID; /*!< TODO: describe */
|
||||
qint32 m_iTypeID; /*!< TODO: describe */
|
||||
QString m_szDescription; /*!< TODO: describe */
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cEXIFTag*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIFTagList cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIFTagList : public QList<cEXIFTag*>
|
||||
{
|
||||
public:
|
||||
cEXIFTagList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param iTAGID
|
||||
\param szTAGName
|
||||
\param iIFDID
|
||||
\param iTypeID
|
||||
\param szDescription
|
||||
\return cEXIFTag
|
||||
*/
|
||||
cEXIFTag* add(const qint32& iTAGID, const QString& szTAGName, const qint32& iIFDID, const qint32& iTypeID, const QString& szDescription);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param iTAGID
|
||||
\param iIFDID
|
||||
\return cEXIFTag
|
||||
*/
|
||||
cEXIFTag* find(const qint32& iTAGID, const qint32& iIFDID);
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
*/
|
||||
class cEXIFValue
|
||||
{
|
||||
public:
|
||||
cEXIFValue(cEXIFTag* lpEXIFTag);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn exifTag
|
||||
\return cEXIFTag
|
||||
*/
|
||||
cEXIFTag* exifTag();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setValue
|
||||
\param szValue
|
||||
\param iTypeId
|
||||
\param iCount
|
||||
*/
|
||||
void setValue(const QString& szValue, qint32 iTypeId, qint32 iCount = 1);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn value
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant value();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn valueList
|
||||
\return QList<QVariant>
|
||||
*/
|
||||
QList<QVariant> valueList();
|
||||
|
||||
private:
|
||||
cEXIFTag* m_lpEXIFTag; /*!< TODO: describe */
|
||||
QList<QVariant> m_valueList; /*!< TODO: describe */
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn convertValue
|
||||
\param szValue
|
||||
\param iTypeId
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant convertValue(const QString& szValue, qint32 iTypeId);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cEXIFValue*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIFValueList cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIFValueList : public QList<cEXIFValue*>
|
||||
{
|
||||
public:
|
||||
cEXIFValueList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param lpEXIFTag
|
||||
\return cEXIFValue
|
||||
*/
|
||||
cEXIFValue* add(cEXIFTag* lpEXIFTag);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param lpEXIFTag
|
||||
\return cEXIFValue
|
||||
*/
|
||||
cEXIFValue* find(cEXIFTag* lpEXIFTag);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
class cIPTCTag
|
||||
{
|
||||
public:
|
||||
cIPTCTag(const qint32& iTAGID, const QString& szTAGName, const qint32& iTypeID, const QString& szDescription);
|
||||
|
||||
qint32 m_iTAGID; /*!< TODO: describe */
|
||||
QString m_szTAGName; /*!< TODO: describe */
|
||||
qint32 m_iTypeID; /*!< TODO: describe */
|
||||
QString m_szDescription; /*!< TODO: describe */
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cIPTCTag*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cIPTCTagList cexif.h "cexif.h"
|
||||
*/
|
||||
class cIPTCTagList : public QList<cIPTCTag*>
|
||||
{
|
||||
public:
|
||||
cIPTCTagList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param iTAGID
|
||||
\param szTAGName
|
||||
\param iTypeID
|
||||
\param szDescription
|
||||
\return cIPTCTag
|
||||
*/
|
||||
cIPTCTag* add(const qint32& iTAGID, const QString& szTAGName, const qint32& iTypeID, const QString& szDescription);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param iTAGID
|
||||
\return cIPTCTag
|
||||
*/
|
||||
cIPTCTag* find(const qint32& iTAGID);
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
*/
|
||||
class cIPTCValue
|
||||
{
|
||||
public:
|
||||
cIPTCValue(cIPTCTag* lpIPTCTag);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn iptcTag
|
||||
\return cIPTCTag
|
||||
*/
|
||||
cIPTCTag* iptcTag();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setValue
|
||||
\param szValue
|
||||
\param iTypeId
|
||||
\param iCount
|
||||
*/
|
||||
void setValue(const QString& szValue, qint32 iTypeId, qint32 iCount = 1);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn value
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant value();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn valueList
|
||||
\return QList<QVariant>
|
||||
*/
|
||||
QList<QVariant> valueList();
|
||||
|
||||
private:
|
||||
cIPTCTag* m_lpIPTCTag; /*!< TODO: describe */
|
||||
QList<QVariant> m_valueList; /*!< TODO: describe */
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn convertValue
|
||||
\param szValue
|
||||
\param iTypeId
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant convertValue(const QString& szValue, qint32 iTypeId);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cIPTCValue*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cIPTCValueList cexif.h "cexif.h"
|
||||
*/
|
||||
class cIPTCValueList : public QList<cIPTCValue*>
|
||||
{
|
||||
public:
|
||||
cIPTCValueList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param lpIPTCTag
|
||||
\return cIPTCValue
|
||||
*/
|
||||
cIPTCValue* add(cIPTCTag* lpIPTCTag);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param lpIPTCTag
|
||||
\return cIPTCValue
|
||||
*/
|
||||
cIPTCValue* find(cIPTCTag* lpIPTCTag);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
class cXMPTag
|
||||
{
|
||||
public:
|
||||
cXMPTag(const QString& szTAGName, const qint32& iTypeID, const QString& szDescription);
|
||||
|
||||
QString m_szTAGName; /*!< TODO: describe */
|
||||
qint32 m_iTypeID; /*!< TODO: describe */
|
||||
QString m_szDescription; /*!< TODO: describe */
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cXMPTag*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cXMPTagList cexif.h "cexif.h"
|
||||
*/
|
||||
class cXMPTagList : public QList<cXMPTag*>
|
||||
{
|
||||
public:
|
||||
cXMPTagList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param szTAGName
|
||||
\param iTypeID
|
||||
\param szDescription
|
||||
\return cXMPTag
|
||||
*/
|
||||
cXMPTag* add(const QString& szTAGName, const qint32& iTypeID, const QString& szDescription);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param szTAGName
|
||||
\return cXMPTag
|
||||
*/
|
||||
cXMPTag* find(const QString& szTAGName);
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
*/
|
||||
class cXMPValue
|
||||
{
|
||||
public:
|
||||
cXMPValue(cXMPTag* lpXMPTag);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn exifTag
|
||||
\return cXMPTag
|
||||
*/
|
||||
cXMPTag* xmpTag();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setValue
|
||||
\param szValue
|
||||
\param iTypeId
|
||||
\param iCount
|
||||
*/
|
||||
void setValue(const QString& szValue, qint32 iTypeId, qint32 iCount = 1);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn value
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant value();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn valueList
|
||||
\return QList<QVariant>
|
||||
*/
|
||||
QList<QVariant> valueList();
|
||||
|
||||
private:
|
||||
cXMPTag* m_lpXMPTag; /*!< TODO: describe */
|
||||
QList<QVariant> m_valueList; /*!< TODO: describe */
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn convertValue
|
||||
\param szValue
|
||||
\param iTypeId
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant convertValue(const QString& szValue, qint32 iTypeId);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cXMPValue*)
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cXMPValueList cexif.h "cexif.h"
|
||||
*/
|
||||
class cXMPValueList : public QList<cXMPValue*>
|
||||
{
|
||||
public:
|
||||
cXMPValueList();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn add
|
||||
\param lpXMPTag
|
||||
\return cXMPValue
|
||||
*/
|
||||
cXMPValue* add(cXMPTag* lpXMPTag);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn find
|
||||
\param lpXMPTag
|
||||
\return cXMPValue
|
||||
*/
|
||||
cXMPValue* find(cXMPTag* lpXMPTag);
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cEXIF cexif.h "cexif.h"
|
||||
*/
|
||||
class cEXIF
|
||||
{
|
||||
public:
|
||||
cEXIF();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn fromFile
|
||||
\param szFileName
|
||||
\return bool
|
||||
*/
|
||||
bool fromFile(const QString& szFileName);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn mimeType
|
||||
\return QString
|
||||
*/
|
||||
QString mimeType();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn imageWidth
|
||||
\return qint32
|
||||
*/
|
||||
qint32 imageWidth();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn imageHeight
|
||||
\return qint32
|
||||
*/
|
||||
qint32 imageHeight();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn imageOrientation
|
||||
\return qint16
|
||||
*/
|
||||
qint16 imageOrientation();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cameraMake
|
||||
\return QString
|
||||
*/
|
||||
QString cameraMake();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cameraModel
|
||||
\return QString
|
||||
*/
|
||||
QString cameraModel();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn dateTime
|
||||
\return QDateTime
|
||||
*/
|
||||
QDateTime dateTime();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn fNumber
|
||||
\return QString
|
||||
*/
|
||||
QString fNumber();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn iso
|
||||
\return qint32
|
||||
*/
|
||||
qint32 iso();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn flash
|
||||
\return QString
|
||||
*/
|
||||
QString flash();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn flashID
|
||||
\return qint32
|
||||
*/
|
||||
qint32 flashID();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn focalLength
|
||||
\return qreal
|
||||
*/
|
||||
qreal focalLength();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn lensMake
|
||||
\return QString
|
||||
*/
|
||||
QString lensMake();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn lensModel
|
||||
\return QString
|
||||
*/
|
||||
QString lensModel();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn exposureTime
|
||||
\return QString
|
||||
*/
|
||||
QString exposureTime();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn exposureBias
|
||||
\return qint32
|
||||
*/
|
||||
qint32 exposureBias();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn exifVersion
|
||||
\return QString
|
||||
*/
|
||||
QString exifVersion();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn dateTimeOriginal
|
||||
\return QDateTime
|
||||
*/
|
||||
QDateTime dateTimeOriginal();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn dateTimeDigitized
|
||||
\return QDateTime
|
||||
*/
|
||||
QDateTime dateTimeDigitized();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn whiteBalance
|
||||
\return qint32
|
||||
*/
|
||||
qint32 whiteBalance();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn focalLength35
|
||||
\return qreal
|
||||
*/
|
||||
qreal focalLength35();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn gps
|
||||
\return QString
|
||||
*/
|
||||
QString gps();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn duration
|
||||
\return QString
|
||||
*/
|
||||
QString duration();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn fileName
|
||||
\return QString
|
||||
*/
|
||||
QString fileName();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn previewList
|
||||
\return QList<QImage>
|
||||
*/
|
||||
QList<QImage> previewList();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn thumbnail
|
||||
\return QImage
|
||||
*/
|
||||
QImage thumbnail();
|
||||
|
||||
private:
|
||||
cEXIFValueList m_exifValueList; /*!< TODO: describe */
|
||||
cIPTCValueList m_iptcValueList; /*!< TODO: describe */
|
||||
cXMPValueList m_xmpValueList; /*!< TODO: describe */
|
||||
QString m_szMimeType; /*!< TODO: describe */
|
||||
qint32 m_iWidth; /*!< TODO: describe */
|
||||
qint32 m_iHeight; /*!< TODO: describe */
|
||||
QString m_szFileName; /*!< TODO: describe */
|
||||
QList<QImage> m_previewList; /*!< TODO: describe */
|
||||
QImage m_thumbnail; /*!< TODO: describe */
|
||||
|
||||
cEXIFCompressionList m_exifCompressionList; /*!< TODO: describe */
|
||||
cEXIFLightSourceList m_exifLightSourceList; /*!< TODO: describe */
|
||||
cEXIFFlashList m_exifFlashList; /*!< TODO: describe */
|
||||
cEXIFTagList m_exifTagList; /*!< TODO: describe */
|
||||
|
||||
cIPTCTagList m_iptcTagList; /*!< TODO: describe */
|
||||
|
||||
cXMPTagList m_xmpTagList; /*!< TODO: describe */
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn getEXIFTag
|
||||
\param iTAGID
|
||||
\param iIFDID
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant getEXIFTag(qint32 iTAGID, qint32 iIFDID);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn getIPTCTag
|
||||
\param iTAGID
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant getIPTCTag(qint32 iTAGID);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn getXMPTag
|
||||
\param szTAGName
|
||||
\return QVariant
|
||||
*/
|
||||
QVariant getXMPTag(const QString& szTAGName);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn getTagList
|
||||
\param iTAGID
|
||||
\param iIFDID
|
||||
\return QList<QVariant>
|
||||
*/
|
||||
QList<QVariant> getTagList(qint32 iTAGID, qint32 iIFDID);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cEXIF*)
|
||||
|
||||
#endif // CEXIF_H
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "cexportdialog.h"
|
||||
#include "ui_cexportdialog.h"
|
||||
|
||||
|
||||
cExportDialog::cExportDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::cExportDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->m_lpQualityValue, &QSlider::valueChanged, this, &cExportDialog::onQualityChanged);
|
||||
}
|
||||
|
||||
cExportDialog::~cExportDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cExportDialog::onQualityChanged(int value)
|
||||
{
|
||||
ui->m_lpQualityValue->setNum(value);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef CEXPORTDIALOG_H
|
||||
#define CEXPORTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class cExportDialog;
|
||||
}
|
||||
|
||||
class cExportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit cExportDialog(QWidget *parent = nullptr);
|
||||
~cExportDialog();
|
||||
|
||||
private:
|
||||
Ui::cExportDialog *ui;
|
||||
|
||||
private slots:
|
||||
void onQualityChanged(int value);
|
||||
};
|
||||
|
||||
#endif // CEXPORTDIALOG_H
|
||||
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>cExportDialog</class>
|
||||
<widget class="QDialog" name="cExportDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>135</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>quality:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>file format:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_lpFileFormat</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_lpFileFormat"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>destination path:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_lpDestinationPath</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSlider" name="m_lpQuality">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpQualityValue">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_lpQuality</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_lpDestinationPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpDestinationPathBrowse">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>cExportDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>227</x>
|
||||
<y>117</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>134</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>cExportDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>295</x>
|
||||
<y>123</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>134</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -0,0 +1,147 @@
|
||||
/*!
|
||||
\file cimage.cpp
|
||||
|
||||
*/
|
||||
|
||||
#include "cimage.h"
|
||||
|
||||
#include "libraw/libraw.h"
|
||||
|
||||
#include <QTransform>
|
||||
#include <QFileInfo>
|
||||
|
||||
|
||||
cImage::cImage() :
|
||||
QImage()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
cImage::cImage(const QSize &size, QImage::Format format) :
|
||||
QImage(size, format)
|
||||
{
|
||||
}
|
||||
|
||||
cImage::cImage(int width, int height, QImage::Format format) :
|
||||
QImage(width, height, format)
|
||||
{
|
||||
}
|
||||
|
||||
cImage::cImage(uchar *data, int width, int height, QImage::Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo) :
|
||||
QImage(data, width, height, format, cleanupFunction, cleanupInfo)
|
||||
{
|
||||
}
|
||||
|
||||
cImage::cImage(const uchar *data, int width, int height, QImage::Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo) :
|
||||
QImage(data, width, height, format, cleanupFunction, cleanupInfo)
|
||||
{
|
||||
}
|
||||
|
||||
cImage::cImage(uchar *data, int width, int height, int bytesPerLine, QImage::Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo) :
|
||||
QImage(data, width, height, bytesPerLine, format, cleanupFunction, cleanupInfo)
|
||||
{
|
||||
}
|
||||
|
||||
cImage::cImage(const uchar *data, int width, int height, int bytesPerLine, QImage::Format format, QImageCleanupFunction cleanupFunction, void *cleanupInfo) :
|
||||
QImage(data, width, height, bytesPerLine, format, cleanupFunction, cleanupInfo)
|
||||
{
|
||||
}
|
||||
|
||||
cImage::cImage(const QString &fileName, const char *format) :
|
||||
QImage()
|
||||
{
|
||||
load(fileName, format);
|
||||
}
|
||||
|
||||
cImage::cImage(const QImage &image) :
|
||||
QImage(image)
|
||||
{
|
||||
}
|
||||
|
||||
cImage::cImage(QImage &&other) :
|
||||
QImage(other)
|
||||
{
|
||||
}
|
||||
|
||||
bool cImage::load(const QString &fileName, const char *format)
|
||||
{
|
||||
QFileInfo fileInfo(fileName);
|
||||
|
||||
if(!fileInfo.suffix().compare("NEF", Qt::CaseInsensitive))
|
||||
return(loadRAW(fileName));
|
||||
|
||||
if(QImage::load(fileName, format))
|
||||
return(true);
|
||||
|
||||
return(loadRAW(fileName));
|
||||
}
|
||||
|
||||
bool cImage::loadRAW(const QString &fileName)
|
||||
{
|
||||
LibRaw rawProcessor;
|
||||
libraw_processed_image_t* lpOutput;
|
||||
|
||||
if(rawProcessor.open_file(fileName.toUtf8()) != LIBRAW_SUCCESS)
|
||||
return(false);
|
||||
|
||||
if(rawProcessor.unpack() != LIBRAW_SUCCESS)
|
||||
return(false);
|
||||
|
||||
rawProcessor.dcraw_process();
|
||||
lpOutput = rawProcessor.dcraw_make_mem_image();
|
||||
|
||||
const libraw_data_t& imgdata = rawProcessor.imgdata;
|
||||
uchar* pixels = nullptr;
|
||||
|
||||
if(lpOutput->type == LIBRAW_IMAGE_JPEG)
|
||||
{
|
||||
loadFromData(lpOutput->data, static_cast<int>(lpOutput->data_size), "JPEG");
|
||||
|
||||
if(imgdata.sizes.flip != 0)
|
||||
{
|
||||
QTransform rotation;
|
||||
int angle = 0;
|
||||
|
||||
if(imgdata.sizes.flip == 3)
|
||||
angle = 180;
|
||||
else if(imgdata.sizes.flip == 5)
|
||||
angle = -90;
|
||||
else if(imgdata.sizes.flip == 6)
|
||||
angle = 90;
|
||||
if(angle != 0)
|
||||
{
|
||||
rotation.rotate(angle);
|
||||
*this = transformed(rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int numPixels = lpOutput->width * lpOutput->height;
|
||||
int colorSize = lpOutput->bits / 8;
|
||||
int pixelSize = lpOutput->colors * colorSize;
|
||||
pixels = new uchar[numPixels * 4];
|
||||
uchar* data = lpOutput->data;
|
||||
|
||||
for(int i = 0; i < numPixels; i++, data += pixelSize)
|
||||
{
|
||||
if(lpOutput->colors == 3)
|
||||
{
|
||||
pixels[i * 4] = data[2 * colorSize];
|
||||
pixels[i * 4 + 1] = data[1 * colorSize];
|
||||
pixels[i * 4 + 2] = data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
pixels[i * 4] = data[0];
|
||||
pixels[i * 4 + 1] = data[0];
|
||||
pixels[i * 4 + 2] = data[0];
|
||||
}
|
||||
}
|
||||
*this = QImage(pixels, lpOutput->width, lpOutput->height, QImage::Format_RGB32);
|
||||
}
|
||||
|
||||
rawProcessor.recycle();
|
||||
|
||||
return(true);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*!
|
||||
\file cimage.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CIMAGE_H
|
||||
#define CIMAGE_H
|
||||
|
||||
|
||||
#include <QImage>
|
||||
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cImage cimage.h "cimage.h"
|
||||
*/
|
||||
class cImage : public QImage
|
||||
{
|
||||
public:
|
||||
cImage();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param size
|
||||
\param format
|
||||
*/
|
||||
cImage(const QSize &size, QImage::Format format);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param width
|
||||
\param height
|
||||
\param format
|
||||
*/
|
||||
cImage(int width, int height, QImage::Format format);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param data
|
||||
\param width
|
||||
\param height
|
||||
\param format
|
||||
\param cleanupFunction
|
||||
\param cleanupInfo
|
||||
*/
|
||||
cImage(uchar *data, int width, int height, QImage::Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param data
|
||||
\param width
|
||||
\param height
|
||||
\param format
|
||||
\param cleanupFunction
|
||||
\param cleanupInfo
|
||||
*/
|
||||
cImage(const uchar *data, int width, int height, QImage::Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param data
|
||||
\param width
|
||||
\param height
|
||||
\param bytesPerLine
|
||||
\param format
|
||||
\param cleanupFunction
|
||||
\param cleanupInfo
|
||||
*/
|
||||
cImage(uchar *data, int width, int height, int bytesPerLine, QImage::Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param data
|
||||
\param width
|
||||
\param height
|
||||
\param bytesPerLine
|
||||
\param format
|
||||
\param cleanupFunction
|
||||
\param cleanupInfo
|
||||
*/
|
||||
cImage(const uchar *data, int width, int height, int bytesPerLine, QImage::Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param fileName
|
||||
\param format
|
||||
*/
|
||||
cImage(const QString &fileName, const char *format = nullptr);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param image
|
||||
*/
|
||||
cImage(const QImage &image);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn cImage
|
||||
\param other
|
||||
*/
|
||||
cImage(QImage &&other);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn load
|
||||
\param fileName
|
||||
\param format
|
||||
\return bool
|
||||
*/
|
||||
bool load(const QString &fileName, const char *format = nullptr);
|
||||
|
||||
private:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn loadRAW
|
||||
\param fileName
|
||||
\return bool
|
||||
*/
|
||||
bool loadRAW(const QString &fileName);
|
||||
};
|
||||
|
||||
#endif // CIMAGE_H
|
||||
@@ -1,11 +1,44 @@
|
||||
#include "cmainwindow.h"
|
||||
#include "ui_cmainwindow.h"
|
||||
|
||||
cMainWindow::cMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::cMainWindow)
|
||||
#include "cimage.h"
|
||||
|
||||
#include "cexif.h"
|
||||
|
||||
#include "cexportdialog.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QFileInfoList>
|
||||
#include <QDir>
|
||||
#include <QMimeType>
|
||||
#include <QList>
|
||||
#include <QStandardItem>
|
||||
|
||||
#include <QImageWriter>
|
||||
|
||||
|
||||
cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::cMainWindow),
|
||||
m_lpSplashScreen(lpSplashScreen)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// QImageWriter writer;
|
||||
// QList<QByteArray> list = writer.supportedImageFormats();
|
||||
|
||||
// writer.setFormat("jpg");
|
||||
// QList<QByteArray> list1 = writer.supportedSubTypes();
|
||||
|
||||
// bool b;
|
||||
|
||||
// b = writer.supportsOption(QImageIOHandler::CompressionRatio);
|
||||
// b = writer.supportsOption(QImageIOHandler::Quality);
|
||||
|
||||
initUI();
|
||||
createActions();
|
||||
|
||||
onClearList();
|
||||
}
|
||||
|
||||
cMainWindow::~cMainWindow()
|
||||
@@ -13,3 +46,187 @@ cMainWindow::~cMainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("main/width", QVariant::fromValue(size().width()));
|
||||
settings.setValue("main/height", QVariant::fromValue(size().height()));
|
||||
settings.setValue("main/x", QVariant::fromValue(x()));
|
||||
settings.setValue("main/y", QVariant::fromValue(y()));
|
||||
if(this->isMaximized())
|
||||
settings.setValue("main/maximized", QVariant::fromValue(true));
|
||||
else
|
||||
settings.setValue("main/maximized", QVariant::fromValue(false));
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void cMainWindow::initUI()
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QIcon::setThemeName("TangoMFK");
|
||||
|
||||
m_lpFileListModel = new QStandardItemModel;
|
||||
ui->m_lpFileList->setModel(m_lpFileListModel);
|
||||
|
||||
QSettings settings;
|
||||
|
||||
if(!settings.value("main/maximized").toBool())
|
||||
{
|
||||
qint32 iX = settings.value("main/x", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iY = settings.value("main/y", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iWidth = settings.value("main/width", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iHeight = settings.value("main/height", QVariant::fromValue(-1)).toInt();
|
||||
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
resize(iWidth, iHeight);
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
}
|
||||
}
|
||||
|
||||
void cMainWindow::createActions()
|
||||
{
|
||||
setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
|
||||
createFileActions();
|
||||
createContextActions();
|
||||
|
||||
connect(ui->m_lpAddFile, &QPushButton::clicked, this, &cMainWindow::onAddFile);
|
||||
connect(ui->m_lpAddFolder, &QPushButton::clicked, this, &cMainWindow::onAddFolder);
|
||||
connect(ui->m_lpRemoveSelected, &QPushButton::clicked, this, &cMainWindow::onRemoveSelected);
|
||||
connect(ui->m_lpClearList, &QPushButton::clicked, this, &cMainWindow::onClearList);
|
||||
|
||||
connect(ui->m_lpConvert, &QPushButton::clicked, this, &cMainWindow::onConvert);
|
||||
|
||||
connect(ui->m_lpFileList, &cTreeView::addEntry, this, &cMainWindow::onAddEntry);
|
||||
}
|
||||
|
||||
void cMainWindow::createContextActions()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::createFileActions()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onAddFile()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onAddFolder()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onRemoveSelected()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::onClearList()
|
||||
{
|
||||
m_lpFileListModel->clear();
|
||||
|
||||
QStringList headerLabels = QStringList() << tr("path") << tr("file") << tr("size") << tr("date") << tr("width") << tr("height") << ("");
|
||||
m_lpFileListModel->setHorizontalHeaderLabels(headerLabels);
|
||||
}
|
||||
|
||||
void cMainWindow::onAddEntry(const QString& file)
|
||||
{
|
||||
QFileInfo fileInfo(file);
|
||||
|
||||
if(fileInfo.isDir())
|
||||
addPath(file);
|
||||
else
|
||||
{
|
||||
QMimeType mimeType = m_mimeDB.mimeTypeForFile(file);
|
||||
|
||||
if(mimeType.name().startsWith("image"))
|
||||
addFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
void cMainWindow::addPath(const QString& path)
|
||||
{
|
||||
QDir dir(path);
|
||||
QStringList dirList = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
QStringList fileList = dir.entryList(QDir::Files);
|
||||
|
||||
for(int i = 0;i < dirList.count();i++)
|
||||
addPath(path + "/" + dirList[i]);
|
||||
|
||||
for(int i = 0;i < fileList.count();i++)
|
||||
addFile(path + "/" + fileList[i]);
|
||||
}
|
||||
|
||||
void cMainWindow::addFile(const QString& file)
|
||||
{
|
||||
if(isInList(file))
|
||||
return;
|
||||
|
||||
QFileInfo info(file);
|
||||
cEXIF* lpExif = new cEXIF;
|
||||
|
||||
if(!lpExif->fromFile(file))
|
||||
{
|
||||
delete lpExif;
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QStandardItem*> items;
|
||||
|
||||
items.append(new QStandardItem(info.path()));
|
||||
items.append(new QStandardItem(info.fileName()));
|
||||
items.append(new QStandardItem(QString::number(info.size())));
|
||||
items.append(new QStandardItem(info.birthTime().toString("dd.MM.yyyy hh:mm:ss")));
|
||||
items.append(new QStandardItem(QString::number(lpExif->imageWidth())));
|
||||
items.append(new QStandardItem(QString::number(lpExif->imageHeight())));
|
||||
|
||||
items[3]->setTextAlignment(Qt::AlignRight);
|
||||
items[4]->setTextAlignment(Qt::AlignRight);
|
||||
items[5]->setTextAlignment(Qt::AlignRight);
|
||||
|
||||
items[0]->setData(QVariant::fromValue(lpExif), Qt::UserRole+1);
|
||||
|
||||
m_lpFileListModel->appendRow(items);
|
||||
}
|
||||
|
||||
bool cMainWindow::isInList(const QString& file)
|
||||
{
|
||||
for(int i = 0;i < m_lpFileListModel->rowCount();i++)
|
||||
{
|
||||
QString file1 = m_lpFileListModel->item(i, 0)->text() + "/" + m_lpFileListModel->item(i, 1)->text();
|
||||
if(!file.compare(file1, Qt::CaseInsensitive))
|
||||
return(true);
|
||||
}
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
void cMainWindow::onConvert()
|
||||
{
|
||||
cExportDialog* lpExportDialog = new cExportDialog(this);
|
||||
lpExportDialog->exec();
|
||||
delete lpExportDialog;
|
||||
|
||||
for(int i = 0;i < m_lpFileListModel->rowCount();i++)
|
||||
{
|
||||
QStandardItem* lpItem = m_lpFileListModel->item(i, 0);
|
||||
if(!lpItem)
|
||||
continue;
|
||||
|
||||
cEXIF* lpExif = lpItem->data(Qt::UserRole+1).value<cEXIF*>();
|
||||
if(!lpExif)
|
||||
continue;
|
||||
|
||||
cImage image(lpExif->fileName());
|
||||
if(image.isNull())
|
||||
continue;
|
||||
|
||||
QString newFile = lpExif->fileName();
|
||||
newFile = newFile.left(newFile.lastIndexOf("."));
|
||||
newFile.append("_converted.jpg");
|
||||
|
||||
image.save(newFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
#ifndef CMAINWINDOW_H
|
||||
#define CMAINWINDOW_H
|
||||
|
||||
|
||||
#include "csplashscreen.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QMimeDatabase>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class cMainWindow; }
|
||||
@@ -12,10 +20,37 @@ class cMainWindow : public QMainWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cMainWindow(QWidget *parent = nullptr);
|
||||
cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent = nullptr);
|
||||
~cMainWindow();
|
||||
|
||||
private:
|
||||
Ui::cMainWindow *ui;
|
||||
Ui::cMainWindow* ui;
|
||||
cSplashScreen* m_lpSplashScreen; /*!< TODO: describe */
|
||||
QStandardItemModel* m_lpFileListModel;
|
||||
|
||||
QMimeDatabase m_mimeDB;
|
||||
|
||||
|
||||
void initUI();
|
||||
void createActions();
|
||||
void createFileActions();
|
||||
void createContextActions();
|
||||
|
||||
void addPath(const QString& path);
|
||||
void addFile(const QString& file);
|
||||
|
||||
bool isInList(const QString& file);
|
||||
|
||||
private slots:
|
||||
void onAddFile();
|
||||
void onAddFolder();
|
||||
void onRemoveSelected();
|
||||
void onClearList();
|
||||
void onConvert();
|
||||
|
||||
void onAddEntry(const QString& file);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
};
|
||||
#endif // CMAINWINDOW_H
|
||||
|
||||
@@ -13,10 +13,120 @@
|
||||
<property name="windowTitle">
|
||||
<string>cMainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar"/>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpAddFile">
|
||||
<property name="text">
|
||||
<string>add file...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpAddFolder">
|
||||
<property name="text">
|
||||
<string>add folder...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpRemoveSelected">
|
||||
<property name="text">
|
||||
<string>remove selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpClearList">
|
||||
<property name="text">
|
||||
<string>clear list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpConvert">
|
||||
<property name="text">
|
||||
<string>convert...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="cTreeView" name="m_lpFileList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpPicturePreview">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpPictureData">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>cTreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>ctreeview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
#define THUMBNAIL_WIDTH 160
|
||||
#define THUMBNAIL_HEIGHT 120
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __PRETTY_FUNCTION__ << ":"
|
||||
#elif __MINGW32__
|
||||
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __PRETTY_FUNCTION__ << ":"
|
||||
#else
|
||||
#define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __FUNCTION__ << ":"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // COMMON_H
|
||||
@@ -0,0 +1,68 @@
|
||||
/*!
|
||||
\file csplashscreen.cpp
|
||||
|
||||
*/
|
||||
|
||||
#include "csplashscreen.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <QStyleOptionProgressBar>
|
||||
|
||||
|
||||
cSplashScreen::cSplashScreen(const QPixmap& pixmap, QFont& font) :
|
||||
QSplashScreen(pixmap),
|
||||
m_iMax(100),
|
||||
m_iProgress(0)
|
||||
{
|
||||
setFont(font);
|
||||
m_textDocument.setDefaultFont(font);
|
||||
}
|
||||
|
||||
void cSplashScreen::setMax(qint32 max)
|
||||
{
|
||||
m_iMax = max;
|
||||
}
|
||||
|
||||
void cSplashScreen::drawContents(QPainter *painter)
|
||||
{
|
||||
painter->translate(m_rect.topLeft());
|
||||
m_textDocument.setHtml(m_szMessage);
|
||||
m_textDocument.drawContents(painter);
|
||||
|
||||
QStyleOptionProgressBar pbstyle;
|
||||
pbstyle.initFrom(this);
|
||||
pbstyle.state = QStyle::State_Enabled;
|
||||
pbstyle.textVisible = false;
|
||||
pbstyle.minimum = 0;
|
||||
pbstyle.maximum = m_iMax;
|
||||
pbstyle.progress = m_iProgress;
|
||||
pbstyle.invertedAppearance = false;
|
||||
pbstyle.rect = QRect(0, 330, 390, 10); // Where is it.
|
||||
|
||||
// Draw it...
|
||||
style()->drawControl(QStyle::CE_ProgressBar, &pbstyle, painter, this);
|
||||
}
|
||||
|
||||
void cSplashScreen::showStatusMessage(const QString& message)
|
||||
{
|
||||
m_szMessage = message;
|
||||
showMessage(m_szMessage);
|
||||
}
|
||||
|
||||
void cSplashScreen::addStatusMessage(const QString& message)
|
||||
{
|
||||
m_szMessage.append(message);
|
||||
showMessage(m_szMessage);
|
||||
}
|
||||
|
||||
void cSplashScreen::setMessageRect(QRect rect)
|
||||
{
|
||||
m_rect = rect;
|
||||
m_textDocument.setTextWidth(rect.width());
|
||||
}
|
||||
|
||||
void cSplashScreen::setProgress(int value)
|
||||
{
|
||||
m_iProgress = value;
|
||||
update();
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*!
|
||||
\file csplashscreen.h
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CSPLASHSCREEN_H
|
||||
#define CSPLASHSCREEN_H
|
||||
|
||||
|
||||
#include <QSplashScreen>
|
||||
#include <QPainter>
|
||||
#include <QTextDocument>
|
||||
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\class cSplashScreen csplashscreen.h "csplashscreen.h"
|
||||
*/
|
||||
class cSplashScreen : public QSplashScreen
|
||||
{
|
||||
public:
|
||||
cSplashScreen(const QPixmap& pixmap, QFont &font);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn drawContents
|
||||
\param painter
|
||||
*/
|
||||
virtual void drawContents(QPainter *painter);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn showStatusMessage
|
||||
\param message
|
||||
*/
|
||||
void showStatusMessage(const QString &message);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn addStatusMessage
|
||||
\param message
|
||||
*/
|
||||
void addStatusMessage(const QString &message);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setMessageRect
|
||||
\param rect
|
||||
*/
|
||||
void setMessageRect(QRect rect);
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setMax
|
||||
\param max
|
||||
*/
|
||||
void setMax(qint32 max);
|
||||
|
||||
private:
|
||||
QTextDocument m_textDocument; /*!< TODO: describe */
|
||||
QString m_szMessage; /*!< TODO: describe */
|
||||
QRect m_rect; /*!< TODO: describe */
|
||||
qint32 m_iMax; /*!< TODO: describe */
|
||||
qint32 m_iProgress; /*!< TODO: describe */
|
||||
public slots:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setProgress
|
||||
\param value
|
||||
*/
|
||||
void setProgress(int value);
|
||||
};
|
||||
|
||||
#endif // CSPLASHSCREEN_H
|
||||
@@ -0,0 +1,48 @@
|
||||
#include "ctreeview.h"
|
||||
|
||||
#include <QDropEvent>
|
||||
#include <QMimeData>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
cTreeView::cTreeView(QWidget* parent) :
|
||||
QTreeView(parent)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
|
||||
void cTreeView::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if(event->mimeData()->hasUrls())
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
|
||||
void cTreeView::dropEvent(QDropEvent* event)
|
||||
{
|
||||
const QMimeData* mimeData = event->mimeData();
|
||||
|
||||
if(mimeData->hasUrls())
|
||||
{
|
||||
QStringList pathList;
|
||||
QList<QUrl> urlList = mimeData->urls();
|
||||
|
||||
for(int i = 0; i < urlList.size(); i++)
|
||||
emit addEntry(urlList[i].toLocalFile());
|
||||
}
|
||||
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void cTreeView::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void cTreeView::dragLeaveEvent(QDragLeaveEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef CTREEVIEW_H
|
||||
#define CTREEVIEW_H
|
||||
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QMetaType>
|
||||
|
||||
#include <QMimeDatabase>
|
||||
|
||||
#include <QStandardItem>
|
||||
|
||||
|
||||
class cTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
cTreeView(QWidget* parent = Q_NULLPTR);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
|
||||
private:
|
||||
|
||||
signals:
|
||||
void addEntry(const QString& path);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cTreeView*)
|
||||
|
||||
|
||||
#endif // CTREEVIEW_H
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 796 B |
|
After Width: | Height: | Size: 897 B |
|
After Width: | Height: | Size: 686 B |
|
After Width: | Height: | Size: 628 B |
|
After Width: | Height: | Size: 477 B |
|
After Width: | Height: | Size: 672 B |
|
After Width: | Height: | Size: 684 B |
|
After Width: | Height: | Size: 779 B |
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 756 B |
|
After Width: | Height: | Size: 866 B |
|
After Width: | Height: | Size: 911 B |
|
After Width: | Height: | Size: 773 B |
|
After Width: | Height: | Size: 498 B |
|
After Width: | Height: | Size: 807 B |
|
After Width: | Height: | Size: 680 B |
|
After Width: | Height: | Size: 776 B |
|
After Width: | Height: | Size: 617 B |
|
After Width: | Height: | Size: 561 B |
|
After Width: | Height: | Size: 591 B |
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 650 B |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 436 B |
|
After Width: | Height: | Size: 435 B |
|
After Width: | Height: | Size: 330 B |
|
After Width: | Height: | Size: 317 B |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 342 B |
|
After Width: | Height: | Size: 705 B |
|
After Width: | Height: | Size: 619 B |
|
After Width: | Height: | Size: 611 B |
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 663 B |
|
After Width: | Height: | Size: 683 B |
|
After Width: | Height: | Size: 666 B |
|
After Width: | Height: | Size: 606 B |
|
After Width: | Height: | Size: 723 B |
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 676 B |
|
After Width: | Height: | Size: 655 B |
|
After Width: | Height: | Size: 636 B |
|
After Width: | Height: | Size: 652 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 681 B |
|
After Width: | Height: | Size: 882 B |
|
After Width: | Height: | Size: 756 B |
|
After Width: | Height: | Size: 619 B |
|
After Width: | Height: | Size: 868 B |
|
After Width: | Height: | Size: 693 B |
|
After Width: | Height: | Size: 540 B |
|
After Width: | Height: | Size: 628 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 429 B |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 782 B |
|
After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 799 B |
|
After Width: | Height: | Size: 935 B |
|
After Width: | Height: | Size: 534 B |
|
After Width: | Height: | Size: 514 B |
|
After Width: | Height: | Size: 650 B |
|
After Width: | Height: | Size: 912 B |
|
After Width: | Height: | Size: 583 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 686 B |
|
After Width: | Height: | Size: 558 B |
|
After Width: | Height: | Size: 574 B |
|
After Width: | Height: | Size: 932 B |
|
After Width: | Height: | Size: 422 B |
|
After Width: | Height: | Size: 550 B |
|
After Width: | Height: | Size: 474 B |
|
After Width: | Height: | Size: 928 B |
|
After Width: | Height: | Size: 603 B |
|
After Width: | Height: | Size: 652 B |
|
After Width: | Height: | Size: 720 B |
|
After Width: | Height: | Size: 553 B |