diff --git a/cexif.cpp b/cexif.cpp index 0ca62ce..7ad1c5d 100644 --- a/cexif.cpp +++ b/cexif.cpp @@ -16,6 +16,7 @@ cEXIF::cEXIF() : + m_szMimeType(""), m_iWidth(0), m_iHeight(0), m_szFileName("") @@ -44,6 +45,7 @@ bool cEXIF::fromFile(const QString& szFileName) Exiv2::IptcData& iptcData = image->iptcData(); Exiv2::XmpData& xmpData = image->xmpData(); + m_szMimeType = QString::fromStdString(image->mimeType()); m_iWidth = image->pixelWidth(); m_iHeight = image->pixelHeight(); @@ -282,6 +284,11 @@ bool cEXIF::fromFile(const QString& szFileName) return(true); } +QString cEXIF::mimeType() +{ + return(m_szMimeType); +} + qint32 cEXIF::imageWidth() { if(m_iWidth) diff --git a/cexif.h b/cexif.h index d6bd808..8af46d5 100644 --- a/cexif.h +++ b/cexif.h @@ -600,6 +600,13 @@ public: */ bool fromFile(const QString& szFileName); + /*! + \brief + + \fn mimeType + \return QString + */ + QString mimeType(); /*! \brief @@ -773,6 +780,7 @@ 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 */ diff --git a/cpicture.cpp b/cpicture.cpp index 56397aa..989fc05 100644 --- a/cpicture.cpp +++ b/cpicture.cpp @@ -21,6 +21,7 @@ cPicture::cPicture(qint32 iID, QObject *parent) : m_szFileName(""), m_szFilePath(""), m_iFileSize(0), + m_mimeType(""), m_imageWidth(0), m_imageHeight(0), m_cameraMake(""), @@ -55,6 +56,7 @@ bool cPicture::fromFile(const QString& szFileName) m_szFilePath = fileInfo.absolutePath(); m_iFileSize = fileInfo.size(); m_thumbnail = exif.thumbnail(); + m_mimeType = exif.mimeType(); m_imageWidth = exif.imageWidth(); m_imageHeight = exif.imageHeight(); m_imageOrientation = exif.imageOrientation(); @@ -95,18 +97,19 @@ bool cPicture::toDB() } if(!query.next()) - query.prepare("INSERT INTO picture (fileName, filePath, fileSize, imageWidth, imageHeight, imageOrientation, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, thumbnail) VALUES (:fileName, :filePath, :fileSize, :imageWidth, :imageHeight, :imageOrientation, :cameraMake, :cameraModel, :dateTime, :fNumber, :iso, :flashID, :focalLength, :lensMake, :lensModel, :exposureTime, :exposureBias, :exifVersion, :dateTimeOriginal, :dateTimeDigitized, :whiteBalance, :focalLength35, :gps, :thumbnail);"); + query.prepare("INSERT INTO picture (fileName, filePath, fileSize, mimeType, imageWidth, imageHeight, imageOrientation, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, thumbnail) VALUES (:fileName, :filePath, :fileSize, :mimeType, :imageWidth, :imageHeight, :imageOrientation, :cameraMake, :cameraModel, :dateTime, :fNumber, :iso, :flashID, :focalLength, :lensMake, :lensModel, :exposureTime, :exposureBias, :exifVersion, :dateTimeOriginal, :dateTimeDigitized, :whiteBalance, :focalLength35, :gps, :thumbnail);"); else - query.prepare("UPDATE picture SET fileName=:fileName, filePath=:filePath, fileSize=:fileSize, imageWidth=:imageWidth, imageHeight=:imageHeight, imageOrientation=:imageOrientation, cameraMake=:cameraMake, cameraModel=:cameraModel, dateTime=:dateTime, fNumber=:fNumber, iso=:iso, flashID=:flashID, focalLength=:focalLength, lensMake=:lensMake, lensModel=:lensModel, exposureTime=:exposureTime, exposureBias=:exposureBias, exifVersion=:exifVersion, dateTimeOriginal=:dateTimeOriginal, dateTimeDigitized=:dateTimeDigitized, whiteBalance=:whiteBalance, focalLength35=:focalLength35, gps=:gps, thumbnail=:thumbnail WHERE id=:id;"); + query.prepare("UPDATE picture SET fileName=:fileName, filePath=:filePath, fileSize=:fileSize, mimeType=:mimeType, imageWidth=:imageWidth, imageHeight=:imageHeight, imageOrientation=:imageOrientation, cameraMake=:cameraMake, cameraModel=:cameraModel, dateTime=:dateTime, fNumber=:fNumber, iso=:iso, flashID=:flashID, focalLength=:focalLength, lensMake=:lensMake, lensModel=:lensModel, exposureTime=:exposureTime, exposureBias=:exposureBias, exifVersion=:exifVersion, dateTimeOriginal=:dateTimeOriginal, dateTimeDigitized=:dateTimeDigitized, whiteBalance=:whiteBalance, focalLength35=:focalLength35, gps=:gps, thumbnail=:thumbnail WHERE id=:id;"); } else - query.prepare("INSERT INTO picture (fileName, filePath, fileSize, imageWidth, imageHeight, imageOrientation, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, thumbnail) VALUES (:fileName, :filePath, :fileSize, :imageWidth, :imageHeight, :imageOrientation, :cameraMake, :cameraModel, :dateTime, :fNumber, :iso, :flashID, :focalLength, :lensMake, :lensModel, :exposureTime, :exposureBias, :exifVersion, :dateTimeOriginal, :dateTimeDigitized, :whiteBalance, :focalLength35, :gps, :thumbnail);"); + query.prepare("INSERT INTO picture (fileName, filePath, fileSize, mimeType, imageWidth, imageHeight, imageOrientation, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, thumbnail) VALUES (:fileName, :filePath, :fileSize, :mimeType, :imageWidth, :imageHeight, :imageOrientation, :cameraMake, :cameraModel, :dateTime, :fNumber, :iso, :flashID, :focalLength, :lensMake, :lensModel, :exposureTime, :exposureBias, :exifVersion, :dateTimeOriginal, :dateTimeDigitized, :whiteBalance, :focalLength35, :gps, :thumbnail);"); query.bindValue(":id", m_iID); query.bindValue(":fileName", m_szFileName); query.bindValue(":filePath", m_szFilePath); query.bindValue(":fileSize", m_iFileSize); + query.bindValue(":mimeType", m_mimeType); query.bindValue(":imageWidth", m_imageWidth); query.bindValue(":imageHeight", m_imageHeight); query.bindValue(":imageOrientation", m_imageOrientation); @@ -164,6 +167,16 @@ qint32 cPicture::id() return(m_iID); } +void cPicture::setMimeType(const QString &mimeType) +{ + m_mimeType = mimeType; +} + +QString cPicture::mimeType() +{ + return(m_mimeType); +} + void cPicture::setImageWidth(const qint32& imageWidth) { m_imageWidth = imageWidth; @@ -420,6 +433,8 @@ bool cPicture::operator==(const cPicture& other) const return(false); if(this->m_iFileSize != other.m_iFileSize) return(false); + if(this->m_mimeType != other.m_mimeType) + return(false); if(this->m_imageWidth != other.m_imageWidth) return(false); if(this->m_imageHeight != other.m_imageHeight) @@ -470,6 +485,8 @@ bool cPicture::operator==(const cPicture*& other) const return(false); if(this->m_iFileSize != other->m_iFileSize) return(false); + if(this->m_mimeType != other->m_mimeType) + return(false); if(this->m_imageWidth != other->m_imageWidth) return(false); if(this->m_imageHeight != other->m_imageHeight) @@ -520,6 +537,8 @@ bool cPicture::operator==(const cPicture* other) const return(false); if(this->m_iFileSize != other->m_iFileSize) return(false); + if(this->m_mimeType != other->m_mimeType) + return(false); if(this->m_imageWidth != other->m_imageWidth) return(false); if(this->m_imageHeight != other->m_imageHeight) @@ -570,6 +589,8 @@ bool cPicture::operator==(cPicture* other) return(false); if(this->m_iFileSize != other->m_iFileSize) return(false); + if(this->m_mimeType != other->m_mimeType) + return(false); if(this->m_imageWidth != other->m_imageWidth) return(false); if(this->m_imageHeight != other->m_imageHeight) @@ -644,6 +665,7 @@ bool cPictureList::load(cSplashScreen *lpSplashScreen, QProgressBar *lpProgressB " fileName, " " filePath, " " fileSize, " + " mimeType, " " imageWidth, " " imageHeight, " " imageOrientation, " @@ -684,6 +706,7 @@ bool cPictureList::load(cSplashScreen *lpSplashScreen, QProgressBar *lpProgressB lpPicture->setFileName(query.value("fileName").toString()); lpPicture->setFilePath(query.value("filePath").toString()); lpPicture->setFileSize(query.value("fileSize").toLongLong()); + lpPicture->setMimeType(query.value("mimeType").toString()); lpPicture->setImageWidth(query.value("imageWidth").toInt()); lpPicture->setImageHeight(query.value("imageHeight").toInt()); lpPicture->setImageOrientation(static_cast(query.value("imageOrientation").toInt())); diff --git a/cpicture.h b/cpicture.h index d3ef5a6..6388ff7 100644 --- a/cpicture.h +++ b/cpicture.h @@ -68,6 +68,21 @@ public: */ qint32 id(); + /*! + \brief + + \fn setMimeType + \param mimeType + */ + void setMimeType(const QString& mimeType); + /*! + \brief + + \fn mimeType + \return QString + */ + QString mimeType(); + /*! \brief @@ -489,6 +504,7 @@ private: QString m_szFilePath; /*!< TODO: describe */ qint64 m_iFileSize; /*!< TODO: describe */ QImage m_thumbnail; /*!< TODO: describe */ + QString m_mimeType; /*!< TODO: describe */ qint32 m_imageWidth; /*!< TODO: describe */ qint32 m_imageHeight; /*!< TODO: describe */ qint16 m_imageOrientation; /*!< TODO: describe */ diff --git a/cpicturelibrary.cpp b/cpicturelibrary.cpp index 35f535e..a76c4a9 100644 --- a/cpicturelibrary.cpp +++ b/cpicturelibrary.cpp @@ -116,6 +116,7 @@ bool cPictureLibrary::createDatabase() " fileName TEXT, " " filePath TEXT, " " fileSize BIGINT, " + " mimeType TEXT, " " imageWidth INTEGER, " " imageHeight INTEGER, " " imageOrientation INTEGER, "