initial commit
This commit is contained in:
@@ -61,6 +61,29 @@ bool cEXIF::fromFile(const QString& szFileName)
|
||||
Exiv2::PreviewImage previewImage = previewManager.getPreviewImage(*i);
|
||||
QImage image;
|
||||
image.loadFromData(static_cast<const uchar*>(previewImage.pData()), static_cast<qint32>(previewImage.size()));
|
||||
|
||||
QTransform rotation;
|
||||
int angle = 0;
|
||||
|
||||
switch(imageOrientation())
|
||||
{
|
||||
case 8:
|
||||
angle = 270;
|
||||
break;
|
||||
case 3:
|
||||
angle = 180;
|
||||
break;
|
||||
case 6:
|
||||
angle = 90;
|
||||
break;
|
||||
}
|
||||
|
||||
if(angle != 0)
|
||||
{
|
||||
rotation.rotate(angle);
|
||||
image = image.transformed(rotation);
|
||||
}
|
||||
|
||||
m_previewList.append(image);
|
||||
}
|
||||
|
||||
@@ -68,7 +91,31 @@ bool cEXIF::fromFile(const QString& szFileName)
|
||||
{
|
||||
QImage image;
|
||||
if(image.load(szFileName))
|
||||
m_thumbnail = image.scaled(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||
{
|
||||
QTransform rotation;
|
||||
int angle = 0;
|
||||
|
||||
switch(imageOrientation())
|
||||
{
|
||||
case 8:
|
||||
angle = 270;
|
||||
break;
|
||||
case 3:
|
||||
angle = 180;
|
||||
break;
|
||||
case 6:
|
||||
angle = 90;
|
||||
break;
|
||||
}
|
||||
|
||||
if(angle != 0)
|
||||
{
|
||||
rotation.rotate(angle);
|
||||
image = image.transformed(rotation);
|
||||
}
|
||||
|
||||
m_thumbnail = image.scaled(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -109,7 +156,7 @@ bool cEXIF::fromFile(const QString& szFileName)
|
||||
}
|
||||
|
||||
if(index != -1)
|
||||
m_thumbnail = m_previewList[index].scaled(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||
m_thumbnail = m_previewList[index].scaled(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
return(true);
|
||||
@@ -130,10 +177,10 @@ qint32 cEXIF::imageHeight()
|
||||
|
||||
return(getTag(0x0101, 1).value<qint32>());
|
||||
}
|
||||
//0x0112
|
||||
|
||||
qint16 cEXIF::imageOrientation()
|
||||
{bla
|
||||
return(getTag(0x0112, 1).value<qint32>());
|
||||
{
|
||||
return(getTag(0x0112, 1).value<qint16>());
|
||||
}
|
||||
|
||||
QString cEXIF::cameraMake()
|
||||
|
||||
+17
-3
@@ -50,6 +50,7 @@ bool cPicture::fromFile(const QString& szFileName)
|
||||
m_thumbnail = exif.thumbnail();
|
||||
m_imageWidth = exif.imageWidth();
|
||||
m_imageHeight = exif.imageHeight();
|
||||
m_imageOrientation = exif.imageOrientation();
|
||||
m_cameraMake = exif.cameraMake();
|
||||
m_cameraModel = exif.cameraModel();
|
||||
m_dateTime = exif.dateTime();
|
||||
@@ -92,12 +93,12 @@ bool cPicture::toDB()
|
||||
}
|
||||
|
||||
if(!query.next())
|
||||
query.prepare("INSERT INTO picture (fileName, filePath, fileSize, imageWidth, imageHeight, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, thumbnail) VALUES (:fileName, :filePath, :fileSize, :imageWidth, :imageHeight, :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, 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);");
|
||||
else
|
||||
query.prepare("UPDATE picture SET fileName=:fileName, filePath=:filePath, fileSize=:fileSize, imageWidth=:imageWidth, imageHeight=:imageHeight, 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, 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, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, thumbnail) VALUES (:fileName, :filePath, :fileSize, :imageWidth, :imageHeight, :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, 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.bindValue(":id", m_iID);
|
||||
@@ -106,6 +107,7 @@ bool cPicture::toDB()
|
||||
query.bindValue(":fileSize", m_iFileSize);
|
||||
query.bindValue(":imageWidth", m_imageWidth);
|
||||
query.bindValue(":imageHeight", m_imageHeight);
|
||||
query.bindValue(":imageOrientation", m_imageOrientation);
|
||||
query.bindValue(":cameraMake", m_cameraMake);
|
||||
query.bindValue(":cameraModel", m_cameraModel);
|
||||
query.bindValue(":dateTime", m_dateTime);
|
||||
@@ -180,6 +182,16 @@ qint32 cPicture::imageHeight()
|
||||
return(m_imageHeight);
|
||||
}
|
||||
|
||||
void cPicture::setImageOrientation(const qint16& imageOrientation)
|
||||
{
|
||||
m_imageOrientation = imageOrientation;
|
||||
}
|
||||
|
||||
qint16 cPicture::imageOrientation()
|
||||
{
|
||||
return(m_imageOrientation);
|
||||
}
|
||||
|
||||
void cPicture::setCameraMake(const QString& cameraMake)
|
||||
{
|
||||
m_cameraMake = cameraMake;
|
||||
@@ -416,6 +428,7 @@ bool cPictureList::load()
|
||||
" fileSize, "
|
||||
" imageWidth, "
|
||||
" imageHeight, "
|
||||
" imageOrientation, "
|
||||
" cameraMake, "
|
||||
" cameraModel, "
|
||||
" dateTime, "
|
||||
@@ -451,6 +464,7 @@ bool cPictureList::load()
|
||||
lpPicture->setFileSize(query.value("fileSize").toLongLong());
|
||||
lpPicture->setImageWidth(query.value("imageWidth").toInt());
|
||||
lpPicture->setImageHeight(query.value("imageHeight").toInt());
|
||||
lpPicture->setImageOrientation(static_cast<qint16>(query.value("imageOrientation").toInt()));
|
||||
lpPicture->setCameraMake(query.value("cameraMake").toString());
|
||||
lpPicture->setCameraModel(query.value("cameraModel").toString());
|
||||
lpPicture->setDateTime(query.value("dateTime").toDateTime());
|
||||
|
||||
+14
@@ -75,6 +75,19 @@ public:
|
||||
*/
|
||||
qint32 imageHeight();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param imageOrientation
|
||||
*/
|
||||
void setImageOrientation(const qint16& imageOrientation);
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @return qint16
|
||||
*/
|
||||
qint16 imageOrientation();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
@@ -373,6 +386,7 @@ private:
|
||||
QImage m_thumbnail; /**< TODO: describe */
|
||||
qint32 m_imageWidth; /**< TODO: describe */
|
||||
qint32 m_imageHeight; /**< TODO: describe */
|
||||
qint16 m_imageOrientation; /**< TODO: describe */
|
||||
QString m_cameraMake; /**< TODO: describe */
|
||||
QString m_cameraModel; /**< TODO: describe */
|
||||
QDateTime m_dateTime; /**< TODO: describe */
|
||||
|
||||
@@ -113,6 +113,7 @@ bool cPictureLibrary::createDatabase()
|
||||
" fileSize BIGINT, "
|
||||
" imageWidth INTEGER, "
|
||||
" imageHeight INTEGER, "
|
||||
" imageOrientation INTEGER, "
|
||||
" cameraMake TEXT, "
|
||||
" cameraModel TEXT, "
|
||||
" dateTime DATETIME, "
|
||||
@@ -186,6 +187,7 @@ bool cPictureLibrary::updateDatabase3(qint32 version)
|
||||
" fileSize BIGINT, "
|
||||
" imageWidth INTEGER, "
|
||||
" imageHeight INTEGER, "
|
||||
" imageOrientation INTEGER, "
|
||||
" cameraMake TEXT, "
|
||||
" cameraModel TEXT, "
|
||||
" dateTime DATETIME, "
|
||||
|
||||
+2
-1
@@ -28,5 +28,6 @@ void cToolBoxInfo::setPicture(cPicture* lpPicture)
|
||||
ui->m_lpFileName->setText(lpPicture->fileName());
|
||||
ui->m_lpDate->setText(lpPicture->dateTime().toString());
|
||||
ui->m_lpSize->setText(QString("%1x%2").arg(lpPicture->imageWidth()).arg(lpPicture->imageHeight()));
|
||||
ui->m_lpCamera->setText(QString("%1 %2").arg(lpPicture->cameraMake()).arg(lpPicture->cameraModel()));
|
||||
// ui->m_lpCamera->setText(QString("%1 %2").arg(lpPicture->cameraMake()).arg(lpPicture->cameraModel()));
|
||||
ui->m_lpCamera->setText(QString("%1").arg(lpPicture->imageOrientation()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user