initial commit
This commit is contained in:
+8
-2
@@ -122,14 +122,17 @@ cAlbums* cAlbums::parentAlbums()
|
||||
return(m_parentAlbums);
|
||||
}
|
||||
|
||||
bool cAlbums::loadImages()
|
||||
bool cAlbums::loadImages(bool loadThumbnails)
|
||||
{
|
||||
if(!m_imagesList)
|
||||
{
|
||||
m_imagesList = new cImagesList(m_dbDigikam, m_dbThumbnail, m_albumsList, this);
|
||||
m_imagesList->load(this);
|
||||
m_imagesList->load(loadThumbnails, this);
|
||||
return(true);
|
||||
}
|
||||
else
|
||||
m_imagesList->loadThumbnails();
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -190,6 +193,7 @@ cAlbums* cAlbumsList::add(const qint32& id, QObject* parent)
|
||||
return(lpNew);
|
||||
|
||||
lpNew = new cAlbums(id, this, m_dbDigikam, m_dbThumbnail, parent);
|
||||
lpNew->loadImages();
|
||||
|
||||
append(lpNew);
|
||||
return(lpNew);
|
||||
@@ -202,6 +206,7 @@ cAlbums* cAlbumsList::add(const qint32& id, cAlbumRoots* albumRoots, const QStri
|
||||
return(lpNew);
|
||||
|
||||
lpNew = new cAlbums(id, albumRoots, relativePath, date, caption, collection, modificationDate, this, m_dbDigikam, m_dbThumbnail, parent);
|
||||
lpNew->loadImages();
|
||||
|
||||
QString parentAlbum = relativePath.left(relativePath.lastIndexOf("/"));
|
||||
if(!parentAlbum.isEmpty())
|
||||
@@ -219,6 +224,7 @@ cAlbums* cAlbumsList::add(const qint32& id, const qint32& albumRootsID, const QS
|
||||
|
||||
cAlbumRoots* albumRoots = m_albumRootsList->find(albumRootsID);
|
||||
lpNew = new cAlbums(id, albumRoots, relativePath, date, caption, collection, modificationDate, this, m_dbDigikam, m_dbThumbnail, parent);
|
||||
lpNew->loadImages(false);
|
||||
|
||||
QString parentAlbum = relativePath.left(relativePath.lastIndexOf("/"));
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
void setParentAlbums(cAlbums* root);
|
||||
cAlbums* parentAlbums();
|
||||
|
||||
bool loadImages();
|
||||
bool loadImages(bool loadThumbnails = true);
|
||||
cImagesList* imagesList();
|
||||
|
||||
void setItem(QStandardItem* item);
|
||||
|
||||
+272
-19
@@ -230,6 +230,76 @@ QImage* cImages::thumbnail()
|
||||
return(m_thumbnail);
|
||||
}
|
||||
|
||||
void cImages::setImageComment(const IMAGECOMMENT& ImageComment)
|
||||
{
|
||||
m_ImageComment = ImageComment;
|
||||
}
|
||||
|
||||
IMAGECOMMENT cImages::imageComment()
|
||||
{
|
||||
return(m_ImageComment);
|
||||
}
|
||||
|
||||
void cImages::setImageCopyright(const IMAGECOPYRIGHT& ImageCopyright)
|
||||
{
|
||||
m_ImageCopyright = ImageCopyright;
|
||||
}
|
||||
|
||||
IMAGECOPYRIGHT cImages::imageCopyright()
|
||||
{
|
||||
return(m_ImageCopyright);
|
||||
}
|
||||
|
||||
void cImages::setImageInformation(const IMAGEINFORMATION& ImageInformation)
|
||||
{
|
||||
m_ImageInformation = ImageInformation;
|
||||
}
|
||||
|
||||
IMAGEINFORMATION cImages::imageInformation()
|
||||
{
|
||||
return(m_ImageInformation);
|
||||
}
|
||||
|
||||
void cImages::setImageMetadata(const IMAGEMETADATA& ImageMetadata)
|
||||
{
|
||||
m_ImageMetadata = ImageMetadata;
|
||||
}
|
||||
|
||||
IMAGEMETADATA cImages::imageMetadata()
|
||||
{
|
||||
return(m_ImageMetadata);
|
||||
}
|
||||
|
||||
void cImages::setImagePositions(const IMAGEPOSITIONS& ImagePositions)
|
||||
{
|
||||
m_ImagePositions = ImagePositions;
|
||||
}
|
||||
|
||||
IMAGEPOSITIONS cImages::imagePositions()
|
||||
{
|
||||
return(m_ImagePositions);
|
||||
}
|
||||
|
||||
void cImages::setImageProperties(const IMAGEPROPERTIES& ImageProperties)
|
||||
{
|
||||
m_ImageProperties = ImageProperties;
|
||||
}
|
||||
|
||||
IMAGEPROPERTIES cImages::imageProperties()
|
||||
{
|
||||
return(m_ImageProperties);
|
||||
}
|
||||
|
||||
void cImages::setVideoMetadata(const VIDEOMETADATA& VideoMetadata)
|
||||
{
|
||||
m_VideoMetadata = VideoMetadata;
|
||||
}
|
||||
|
||||
VIDEOMETADATA cImages::videoMetadata()
|
||||
{
|
||||
return(m_VideoMetadata);
|
||||
}
|
||||
|
||||
cImagesList::cImagesList(QSqlDatabase* dbDigikam, QSqlDatabase *dbThumbnail, cAlbumsList* albumsList, QObject* parent) :
|
||||
QObject(parent),
|
||||
m_dbDigikam(dbDigikam),
|
||||
@@ -238,23 +308,92 @@ cImagesList::cImagesList(QSqlDatabase* dbDigikam, QSqlDatabase *dbThumbnail, cAl
|
||||
{
|
||||
}
|
||||
|
||||
bool cImagesList::load(cAlbums* albums)
|
||||
bool cImagesList::load(bool loadThumbnails, cAlbums* albums)
|
||||
{
|
||||
if(!m_dbDigikam)
|
||||
return(false);
|
||||
|
||||
QSqlQuery query(*m_dbDigikam);
|
||||
QString sql = QString("SELECT id, "
|
||||
" album, "
|
||||
" name, "
|
||||
" status, "
|
||||
" category, "
|
||||
" modificationDate, "
|
||||
" fileSize, "
|
||||
" uniqueHash, "
|
||||
" manualOrder "
|
||||
"FROM Images "
|
||||
"WHERE album = %1 "
|
||||
QString sql = QString("SELECT i.id Image_id, "
|
||||
" i.album Image_album, "
|
||||
" i.name Image_name, "
|
||||
" i.status Image_status, "
|
||||
" i.category Image_category, "
|
||||
" i.modificationDate Image_modificationDate, "
|
||||
" i.fileSize Image_fileSize, "
|
||||
" i.uniqueHash Image_uniqueHash, "
|
||||
" i.manualOrder Image_manualOrder, "
|
||||
" icom.id ImageComment_id, "
|
||||
" icom.imageid ImageComment_imageid, "
|
||||
" icom.type ImageComment_type, "
|
||||
" icom.language ImageComment_language, "
|
||||
" icom.author ImageComment_author, "
|
||||
" icom.date ImageComment_date, "
|
||||
" icom.comment ImageComment_comment, "
|
||||
" icop.id ImageCopyright_id, "
|
||||
" icop.imageid ImageCopyright_imageid, "
|
||||
" icop.property ImageCopyright_property, "
|
||||
" icop.value ImageCopyright_value, "
|
||||
" icop.extraValue ImageCopyright_extraValue, "
|
||||
" iinfo.imageid ImageInformation_imageid, "
|
||||
" iinfo.rating ImageInformation_rating, "
|
||||
" iinfo.creationDate ImageInformation_creationDate, "
|
||||
" iinfo.digitizationDate ImageInformation_digitizationDate, "
|
||||
" iinfo.orientation ImageInformation_orientation, "
|
||||
" iinfo.width ImageInformation_width, "
|
||||
" iinfo.height ImageInformation_height, "
|
||||
" iinfo.format ImageInformation_format, "
|
||||
" iinfo.colorDepth ImageInformation_colorDepth, "
|
||||
" iinfo.colorModel ImageInformation_colorModel, "
|
||||
" imeta.imageid ImageMetadata_imageid, "
|
||||
" imeta.make ImageMetadata_make, "
|
||||
" imeta.model ImageMetadata_model, "
|
||||
" imeta.lens ImageMetadata_lens, "
|
||||
" imeta.aperture ImageMetadata_aparture, "
|
||||
" imeta.focalLength ImageMetadata_focalLength, "
|
||||
" imeta.focalLength35 ImageMetadata_focalLength35, "
|
||||
" imeta.exposureTime ImageMetadata_exposureTime, "
|
||||
" imeta.exposureProgram ImageMetadata_exposureProgram, "
|
||||
" imeta.exposureMode ImageMetadata_exposureMode, "
|
||||
" imeta.sensitivity ImageMetadata_sensitivity, "
|
||||
" imeta.flash ImageMetadata_flash, "
|
||||
" imeta.whiteBalance ImageMetadata_whiteBalance, "
|
||||
" imeta.whiteBalanceColorTemperature ImageMetadata_whiteBalanceColorTemperature, "
|
||||
" imeta.meteringMode ImageMetadata_meteringMode, "
|
||||
" imeta.subjectDistance ImageMetadata_subjectDistance, "
|
||||
" imeta.subjectDistanceCategory ImageMetadata_subjectDistanceCategory, "
|
||||
" ipos.imageid ImagePositions_imageid, "
|
||||
" ipos.latitude ImagePositions_latitude, "
|
||||
" ipos.latitudeNumber ImagePositions_latitideNumber, "
|
||||
" ipos.longitude ImagePositions_longitude, "
|
||||
" ipos.longitudeNumber ImagePositions_longitudeNumber, "
|
||||
" ipos.altitude ImagePositions_altitude, "
|
||||
" ipos.orientation ImagePositions_orientation, "
|
||||
" ipos.tilt ImagePositions_tilt, "
|
||||
" ipos.roll ImagePositions_roll, "
|
||||
" ipos.accuracy ImagePositions_accuracy, "
|
||||
" ipos.description ImagePositions_description, "
|
||||
" iprop.imageid ImageProperties_imageid, "
|
||||
" iprop.property ImageProperties_property, "
|
||||
" iprop.value ImageProperties_value, "
|
||||
" vmeta.imageid VideoMetadata_imageid, "
|
||||
" vmeta.aspectRatio VideoMetadata_aspectRation, "
|
||||
" vmeta.audioBitRate VideoMetadata_audioBitRate, "
|
||||
" vmeta.audioChannelType VideoMetadata_audioChannelType, "
|
||||
" vmeta.audioCompressor VideoMetadata_audioCompressor, "
|
||||
" vmeta.duration VideoMetadata_duration, "
|
||||
" vmeta.frameRate VideoMetadata_frameRate, "
|
||||
" vmeta.exposureProgram VideoMetadata_exposureProgram, "
|
||||
" vmeta.videoCodec VideoMetadata_videoCodec "
|
||||
"FROM Images i "
|
||||
"LEFT JOIN ImageComments icom ON (i.id = icom.imageid) "
|
||||
"LEFT JOIN ImageCopyright icop ON (i.id = icop.imageid) "
|
||||
"LEFT JOIN ImageInformation iinfo ON (i.id = iinfo.imageid) "
|
||||
"LEFT JOIN ImageMetadata imeta ON (i.id = imeta.imageid) "
|
||||
"LEFT JOIN ImagePositions ipos ON (i.id = ipos.imageid) "
|
||||
"LEFT JOIN ImageProperties iprop ON (i.id = iprop.imageid) "
|
||||
"LEFT JOIN VideoMetadata vmeta ON (i.id = vmeta.imageid) "
|
||||
"WHERE album = %1 "
|
||||
"ORDER BY name;").arg(albums->id());
|
||||
if(!query.exec(sql))
|
||||
{
|
||||
@@ -263,12 +402,92 @@ bool cImagesList::load(cAlbums* albums)
|
||||
}
|
||||
|
||||
while(query.next())
|
||||
add(query.value("id").toInt(), albums, query.value("name").toString(), query.value("status").toInt(), query.value("category").toInt(), query.value("modificationDate").toDateTime(), query.value("fileSize").toInt(), query.value("uniqueHash").toString(), query.value("manualOrder").toInt(), this);
|
||||
{
|
||||
cImages* newImages = add(query.value("Image_id").toInt(), albums, query.value("Image_name").toString(), query.value("Image_status").toInt(), query.value("Image_category").toInt(), query.value("Image_modificationDate").toDateTime(), query.value("Image_fileSize").toInt(), query.value("Image_uniqueHash").toString(), query.value("Image_manualOrder").toInt(), loadThumbnails, this);
|
||||
IMAGECOMMENT ImageComment;
|
||||
IMAGECOPYRIGHT ImageCopyright;
|
||||
IMAGEINFORMATION ImageInformation;
|
||||
IMAGEMETADATA ImageMetadata;
|
||||
IMAGEPOSITIONS ImagePositions;
|
||||
IMAGEPROPERTIES ImageProperties;
|
||||
VIDEOMETADATA VideoMetadata;
|
||||
|
||||
ImageComment.id = query.value("ImageComment_id").toInt();
|
||||
ImageComment.imageid = query.value("ImageComment_imageid").toInt();
|
||||
ImageComment.type = query.value("ImageComment_type").toInt();
|
||||
ImageComment.language = query.value("ImageComment_language").toString();
|
||||
ImageComment.author = query.value("ImageComment_author").toString();
|
||||
ImageComment.date = query.value("ImageComment_date").toDateTime();
|
||||
ImageComment.comment = query.value("ImageComment_comment").toString();
|
||||
ImageCopyright.id = query.value("ImageCopyright_id").toInt();
|
||||
ImageCopyright.imageid = query.value("ImageCopyright_imageid").toInt();
|
||||
ImageCopyright.property = query.value("ImageCopyright_property").toString();
|
||||
ImageCopyright.value = query.value("ImageCopyright_value").toString();
|
||||
ImageCopyright.extraValue = query.value("ImageCopyright_extraValue").toString();
|
||||
ImageInformation.imageid = query.value("ImageInformation_imageid").toInt();
|
||||
ImageInformation.rating = query.value("ImageInformation_rating").toInt();
|
||||
ImageInformation.creationDate = query.value("ImageInformation_creationDate").toDateTime();
|
||||
ImageInformation.digitizationDate = query.value("ImageInformation_digitizationDate").toDateTime();
|
||||
ImageInformation.orientation = query.value("ImageInformation_orientation").toInt();
|
||||
ImageInformation.width = query.value("ImageInformation_width").toInt();
|
||||
ImageInformation.height = query.value("ImageInformation_height").toInt();
|
||||
ImageInformation.format = query.value("ImageInformation_format").toString();
|
||||
ImageInformation.colorDepth = query.value("ImageInformation_colorDepth").toInt();
|
||||
ImageInformation.colorModel = query.value("ImageInformation_colorModel").toInt();
|
||||
ImageMetadata.imageid = query.value("ImageMetadata_imageid").toInt();
|
||||
ImageMetadata.make = query.value("ImageMetadata_make").toString();
|
||||
ImageMetadata.model = query.value("ImageMetadata_model").toString();
|
||||
ImageMetadata.lens = query.value("ImageMetadata_lens").toString();
|
||||
ImageMetadata.aparture = query.value("ImageMetadata_aparture").toReal();
|
||||
ImageMetadata.focalLength = query.value("ImageMetadata_focalLength").toReal();
|
||||
ImageMetadata.focalLength35 = query.value("ImageMetadata_focalLength35").toReal();
|
||||
ImageMetadata.exposureTime = query.value("ImageMetadata_exposureTime").toReal();
|
||||
ImageMetadata.exposureProgram = query.value("ImageMetadata_exposureProgram").toInt();
|
||||
ImageMetadata.exposureMode = query.value("ImageMetadata_exposureMode").toInt();
|
||||
ImageMetadata.sensitivity = query.value("ImageMetadata_sensitivity").toInt();
|
||||
ImageMetadata.flash = query.value("ImageMetadata_flash").toInt();
|
||||
ImageMetadata.whiteBalance = query.value("ImageMetadata_whiteBalance").toInt();
|
||||
ImageMetadata.whiteBalanceColorTemperature = query.value("ImageMetadata_whiteBalanceColorTemperature").toInt();
|
||||
ImageMetadata.meteringMode = query.value("ImageMetadata_meteringMode").toInt();
|
||||
ImageMetadata.subjectDistance = query.value("ImageMetadata_subjectDistance").toReal();
|
||||
ImageMetadata.subjectDistanceCategory = query.value("ImageMetadata_subjectDistanceCategory").toInt();
|
||||
ImagePositions.imageid = query.value("ImagePositions_imageid").toInt();
|
||||
ImagePositions.latitude = query.value("ImagePositions_latitude").toString();
|
||||
ImagePositions.latitideNumber = query.value("ImagePositions_latitideNumber").toReal();
|
||||
ImagePositions.longitude = query.value("ImagePositions_longitude").toString();
|
||||
ImagePositions.longitudeNumber = query.value("ImagePositions_longitudeNumber").toReal();
|
||||
ImagePositions.altitude = query.value("ImagePositions_altitude").toReal();
|
||||
ImagePositions.orientation = query.value("ImagePositions_orientation").toReal();
|
||||
ImagePositions.tilt = query.value("ImagePositions_tilt").toReal();
|
||||
ImagePositions.roll = query.value("ImagePositions_roll").toReal();
|
||||
ImagePositions.accuracy = query.value("ImagePositions_accuracy").toReal();
|
||||
ImagePositions.description = query.value("ImagePositions_description").toString();
|
||||
ImageProperties.imageid = query.value("ImageProperties_imageid").toInt();
|
||||
ImageProperties.property = query.value("ImageProperties_property").toString();
|
||||
ImageProperties.value = query.value("ImageProperties_value").toString();
|
||||
VideoMetadata.imageid = query.value("VideoMetadata_imageid").toInt();
|
||||
VideoMetadata.aspectRation = query.value("VideoMetadata_aspectRation").toString();
|
||||
VideoMetadata.audioBitRate = query.value("VideoMetadata_audioBitRate").toString();
|
||||
VideoMetadata.audioChannelType = query.value("VideoMetadata_audioChannelType").toString();
|
||||
VideoMetadata.audioCompressor = query.value("VideoMetadata_audioCompressor").toString();
|
||||
VideoMetadata.duration = query.value("VideoMetadata_duration").toString();
|
||||
VideoMetadata.frameRate = query.value("VideoMetadata_frameRate").toString();
|
||||
VideoMetadata.exposureProgram = query.value("VideoMetadata_exposureProgram").toInt();
|
||||
VideoMetadata.videoCodec = query.value("VideoMetadata_videoCodec").toString();
|
||||
|
||||
newImages->setImageComment(ImageComment);
|
||||
newImages->setImageCopyright(ImageCopyright);
|
||||
newImages->setImageInformation(ImageInformation);
|
||||
newImages->setImageMetadata(ImageMetadata);
|
||||
newImages->setImagePositions(ImagePositions);
|
||||
newImages->setImageProperties(ImageProperties);
|
||||
newImages->setVideoMetadata(VideoMetadata);
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool cImagesList::load(const qint32 &albumsID)
|
||||
bool cImagesList::load(bool loadThumbnails, const qint32 &albumsID)
|
||||
{
|
||||
if(!m_dbDigikam)
|
||||
return(false);
|
||||
@@ -293,11 +512,25 @@ bool cImagesList::load(const qint32 &albumsID)
|
||||
}
|
||||
|
||||
while(query.next())
|
||||
add(query.value("id").toInt(), query.value("album").toInt(), query.value("name").toString(), query.value("status").toInt(), query.value("category").toInt(), query.value("modificationDate").toDateTime(), query.value("fileSize").toInt(), query.value("uniqueHash").toString(), query.value("manualOrder").toInt(), this);
|
||||
add(query.value("id").toInt(), query.value("album").toInt(), query.value("name").toString(), query.value("status").toInt(), query.value("category").toInt(), query.value("modificationDate").toDateTime(), query.value("fileSize").toInt(), query.value("uniqueHash").toString(), query.value("manualOrder").toInt(), loadThumbnails, this);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool cImagesList::loadThumbnails()
|
||||
{
|
||||
for(int i = 0;i < count();i++)
|
||||
{
|
||||
cImages* images = at(i);
|
||||
if(!images->thumbnail())
|
||||
{
|
||||
images->loadThumbnail();
|
||||
images->item()->setIcon(QIcon(QPixmap::fromImage(*images->thumbnail())));
|
||||
}
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
cImages* cImagesList::add(const qint32& id, QObject* parent)
|
||||
{
|
||||
cImages* lpNew = find(id);
|
||||
@@ -310,20 +543,30 @@ cImages* cImagesList::add(const qint32& id, QObject* parent)
|
||||
return(lpNew);
|
||||
}
|
||||
|
||||
cImages* cImagesList::add(const qint32& id, cAlbums* albums, const QString& name, const qint8& status, const qint8& category, const QDateTime& modificationDate, const qint32& fileSize, const QString& uniqueHash, const qint32& manualOrder, QObject *parent)
|
||||
cImages* cImagesList::add(const qint32& id, cAlbums* albums, const QString& name, const qint8& status, const qint8& category, const QDateTime& modificationDate, const qint32& fileSize, const QString& uniqueHash, const qint32& manualOrder, bool loadThumbnails, QObject *parent)
|
||||
{
|
||||
cImages* lpNew = find(id);
|
||||
if(lpNew)
|
||||
return(lpNew);
|
||||
|
||||
lpNew = new cImages(id, albums, name, status, category, modificationDate, fileSize, uniqueHash, manualOrder, m_dbThumbnail, parent);
|
||||
lpNew->loadThumbnail();
|
||||
QStandardItem* item = new QStandardItem(name);
|
||||
item->setTextAlignment(Qt::AlignCenter);
|
||||
item->setData(QVariant::fromValue(lpNew));
|
||||
item->setCheckable(true);
|
||||
lpNew->setItem(item);
|
||||
|
||||
if(loadThumbnails)
|
||||
{
|
||||
lpNew->loadThumbnail();
|
||||
item->setIcon(QIcon(QPixmap::fromImage(*lpNew->thumbnail())));
|
||||
}
|
||||
|
||||
append(lpNew);
|
||||
return(lpNew);
|
||||
}
|
||||
|
||||
cImages* cImagesList::add(const qint32& id, const qint32& albumsID, const QString& name, const qint8& status, const qint8& category, const QDateTime& modificationDate, const qint32& fileSize, const QString& uniqueHash, const qint32& manualOrder, QObject *parent)
|
||||
cImages* cImagesList::add(const qint32& id, const qint32& albumsID, const QString& name, const qint8& status, const qint8& category, const QDateTime& modificationDate, const qint32& fileSize, const QString& uniqueHash, const qint32& manualOrder, bool loadThumbnails, QObject *parent)
|
||||
{
|
||||
cImages* lpNew = find(id);
|
||||
if(lpNew)
|
||||
@@ -331,7 +574,17 @@ cImages* cImagesList::add(const qint32& id, const qint32& albumsID, const QStrin
|
||||
|
||||
cAlbums* albums = m_albumsList->find(albumsID);
|
||||
lpNew = new cImages(id, albums, name, status, category, modificationDate, fileSize, uniqueHash, manualOrder, m_dbThumbnail, parent);
|
||||
lpNew->loadThumbnail();
|
||||
QStandardItem* item = new QStandardItem(name);
|
||||
item->setTextAlignment(Qt::AlignCenter);
|
||||
item->setData(QVariant::fromValue(lpNew));
|
||||
item->setCheckable(true);
|
||||
lpNew->setItem(item);
|
||||
|
||||
if(loadThumbnails)
|
||||
{
|
||||
lpNew->loadThumbnail();
|
||||
item->setIcon(QIcon(QPixmap::fromImage(*lpNew->thumbnail())));
|
||||
}
|
||||
|
||||
append(lpNew);
|
||||
return(lpNew);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CIMAGES_H
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "cimage.h"
|
||||
|
||||
#include <QString>
|
||||
@@ -26,51 +27,80 @@ public:
|
||||
cImages(const qint32& id, QObject *parent = nullptr);
|
||||
cImages(const qint32& id, cAlbums* albums, const QString& name, const qint8& status, const qint8& category, const QDateTime& modificationDate, const qint32& fileSize, const QString& uniqueHash, const qint32& manualOrder, QSqlDatabase* dbThumbnail, QObject *parent = nullptr);
|
||||
|
||||
qint32 id();
|
||||
qint32 id();
|
||||
|
||||
void setAlbums(cAlbums* albums);
|
||||
cAlbums* albums();
|
||||
void setAlbums(cAlbums* albums);
|
||||
cAlbums* albums();
|
||||
|
||||
void setName(const QString& name);
|
||||
QString name();
|
||||
void setName(const QString& name);
|
||||
QString name();
|
||||
|
||||
void setStatus(qint8& status);
|
||||
qint8 status();
|
||||
void setStatus(qint8& status);
|
||||
qint8 status();
|
||||
|
||||
void setCategory(qint8& category);
|
||||
qint8 category();
|
||||
void setCategory(qint8& category);
|
||||
qint8 category();
|
||||
|
||||
void setModificationDate(const QDateTime modificationDate);
|
||||
QDateTime modificationDate();
|
||||
void setModificationDate(const QDateTime modificationDate);
|
||||
QDateTime modificationDate();
|
||||
|
||||
void setFileSize(qint32& fileSize);
|
||||
qint32 fileSize();
|
||||
void setFileSize(qint32& fileSize);
|
||||
qint32 fileSize();
|
||||
|
||||
void setUniqueHash(const QString& uniqueHash);
|
||||
QString uniqueHash();
|
||||
void setUniqueHash(const QString& uniqueHash);
|
||||
QString uniqueHash();
|
||||
|
||||
void setManualOrder(qint32& manualOrder);
|
||||
qint32 manualOrder();
|
||||
void setManualOrder(qint32& manualOrder);
|
||||
qint32 manualOrder();
|
||||
|
||||
void setItem(QStandardItem* item);
|
||||
QStandardItem* item();
|
||||
void setItem(QStandardItem* item);
|
||||
QStandardItem* item();
|
||||
|
||||
void loadThumbnail();
|
||||
QImage* thumbnail();
|
||||
void loadThumbnail();
|
||||
QImage* thumbnail();
|
||||
|
||||
void setImageComment(const IMAGECOMMENT& ImageComment);
|
||||
IMAGECOMMENT imageComment();
|
||||
|
||||
void setImageCopyright(const IMAGECOPYRIGHT& ImageCopyright);
|
||||
IMAGECOPYRIGHT imageCopyright();
|
||||
|
||||
void setImageInformation(const IMAGEINFORMATION& ImageInformation);
|
||||
IMAGEINFORMATION imageInformation();
|
||||
|
||||
void setImageMetadata(const IMAGEMETADATA& ImageMetadata);
|
||||
IMAGEMETADATA imageMetadata();
|
||||
|
||||
void setImagePositions(const IMAGEPOSITIONS& ImagePositions);
|
||||
IMAGEPOSITIONS imagePositions();
|
||||
|
||||
void setImageProperties(const IMAGEPROPERTIES& ImageProperties);
|
||||
IMAGEPROPERTIES imageProperties();
|
||||
|
||||
void setVideoMetadata(const VIDEOMETADATA& VideoMetadata);
|
||||
VIDEOMETADATA videoMetadata();
|
||||
|
||||
private:
|
||||
qint32 m_id;
|
||||
cAlbums* m_albums;
|
||||
QString m_name;
|
||||
qint8 m_status;
|
||||
qint8 m_category;
|
||||
QDateTime m_modificationDate;
|
||||
qint32 m_fileSize;
|
||||
QString m_uniqueHash;
|
||||
qint32 m_manualOrder;
|
||||
QSqlDatabase* m_dbThumbnail;
|
||||
QStandardItem* m_item;
|
||||
cImage* m_thumbnail;
|
||||
qint32 m_id;
|
||||
cAlbums* m_albums;
|
||||
QString m_name;
|
||||
qint8 m_status;
|
||||
qint8 m_category;
|
||||
QDateTime m_modificationDate;
|
||||
qint32 m_fileSize;
|
||||
QString m_uniqueHash;
|
||||
qint32 m_manualOrder;
|
||||
QSqlDatabase* m_dbThumbnail;
|
||||
QStandardItem* m_item;
|
||||
cImage* m_thumbnail;
|
||||
|
||||
IMAGECOMMENT m_ImageComment;
|
||||
IMAGECOPYRIGHT m_ImageCopyright;
|
||||
IMAGEINFORMATION m_ImageInformation;
|
||||
IMAGEMETADATA m_ImageMetadata;
|
||||
IMAGEPOSITIONS m_ImagePositions;
|
||||
IMAGEPROPERTIES m_ImageProperties;
|
||||
VIDEOMETADATA m_VideoMetadata;
|
||||
|
||||
signals:
|
||||
|
||||
@@ -85,17 +115,18 @@ class cImagesList : public QObject, public QList<cImages*>
|
||||
public:
|
||||
cImagesList(QSqlDatabase* dbDigikam, QSqlDatabase* dbThumbnail, cAlbumsList* albumsList, QObject* parent = nullptr);
|
||||
|
||||
bool load(cAlbums* albums);
|
||||
bool load(const qint32& albumsID);
|
||||
cImages* add(const qint32& id, QObject* parent = nullptr);
|
||||
cImages* add(const qint32& id, cAlbums* albums, const QString& name, const qint8& status, const qint8& category, const QDateTime& modificationDate, const qint32& fileSize, const QString& uniqueHash, const qint32& manualOrder, QObject *parent = nullptr);
|
||||
cImages* add(const qint32& id, const qint32& albumsID, const QString& name, const qint8& status, const qint8& category, const QDateTime &modificationDate, const qint32 &fileSize, const QString& uniqueHash, const qint32 &manualOrder, QObject *parent = nullptr);
|
||||
cImages* find(const qint32& id);
|
||||
bool load(bool loadThumbnails, cAlbums* albums);
|
||||
bool load(bool loadThumbnails, const qint32& albumsID);
|
||||
bool loadThumbnails();
|
||||
cImages* add(const qint32& id, QObject* parent = nullptr);
|
||||
cImages* add(const qint32& id, cAlbums* albums, const QString& name, const qint8& status, const qint8& category, const QDateTime& modificationDate, const qint32& fileSize, const QString& uniqueHash, const qint32& manualOrder, bool loadThumbnails, QObject *parent = nullptr);
|
||||
cImages* add(const qint32& id, const qint32& albumsID, const QString& name, const qint8& status, const qint8& category, const QDateTime &modificationDate, const qint32 &fileSize, const QString& uniqueHash, const qint32 &manualOrder, bool loadThumbnails, QObject *parent = nullptr);
|
||||
cImages* find(const qint32& id);
|
||||
|
||||
private:
|
||||
QSqlDatabase* m_dbDigikam;
|
||||
QSqlDatabase* m_dbThumbnail;
|
||||
cAlbumsList* m_albumsList;
|
||||
QSqlDatabase* m_dbDigikam;
|
||||
QSqlDatabase* m_dbThumbnail;
|
||||
cAlbumsList* m_albumsList;
|
||||
};
|
||||
|
||||
#endif // CIMAGES_H
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "clogwindow.h"
|
||||
#include "ui_clogwindow.h"
|
||||
|
||||
|
||||
cLogWindow::cLogWindow(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::cLogWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
cLogWindow::~cLogWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cLogWindow::setText(const QString& text)
|
||||
{
|
||||
ui->m_lpLog->setHtml(text);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef CLOGWINDOW_H
|
||||
#define CLOGWINDOW_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class cLogWindow;
|
||||
}
|
||||
|
||||
class cLogWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit cLogWindow(QWidget *parent = nullptr);
|
||||
~cLogWindow();
|
||||
|
||||
void setText(const QString& text);
|
||||
|
||||
private:
|
||||
Ui::cLogWindow* ui;
|
||||
};
|
||||
|
||||
#endif // CLOGWINDOW_H
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>cLogWindow</class>
|
||||
<widget class="QDialog" name="cLogWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="m_lpLog"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>cLogWindow</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>cLogWindow</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
+405
-9
@@ -8,11 +8,22 @@
|
||||
|
||||
#include "cimage.h"
|
||||
#include "cexportdialog.h"
|
||||
#include "clogwindow.h"
|
||||
|
||||
#include <QImageReader>
|
||||
#include <QImageWriter>
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
|
||||
void addToExportLog(QString& exportLog, const QString& text)
|
||||
{
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
|
||||
exportLog.append(" <tr>\n <td class='time'>" + now.toString("yyyy-mm-dd hh:MM:ss") + "</td>\n <td>" + text + "</td>\n </tr>\n");
|
||||
}
|
||||
|
||||
cMainWindow::cMainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
@@ -30,7 +41,10 @@ cMainWindow::cMainWindow(QWidget *parent) :
|
||||
m_thumbnailViewModel(nullptr),
|
||||
m_thumbnailSortFilterProxyModel(nullptr),
|
||||
m_rootItem(nullptr),
|
||||
m_loading(false)
|
||||
m_loading(false),
|
||||
m_working(false),
|
||||
m_stopIt(false),
|
||||
m_exportLog("")
|
||||
{
|
||||
initUI();
|
||||
createActions();
|
||||
@@ -197,6 +211,10 @@ void cMainWindow::loadData()
|
||||
m_thumbnailViewModel->clear();
|
||||
m_folderViewModel->clear();
|
||||
|
||||
QElapsedTimer timer;
|
||||
|
||||
timer.start();
|
||||
|
||||
if(m_albumRootsList)
|
||||
delete m_albumRootsList;
|
||||
|
||||
@@ -251,6 +269,8 @@ void cMainWindow::loadData()
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Loading took " << timer.elapsed() << "ms";
|
||||
|
||||
displayData();
|
||||
ui->m_folderView->expandAll();
|
||||
}
|
||||
@@ -338,8 +358,9 @@ QStandardItem* cMainWindow::findParentItem(QStandardItemModel* model, QStandardI
|
||||
|
||||
void cMainWindow::initSignals()
|
||||
{
|
||||
connect(m_folderViewModel, &QStandardItemModel::itemChanged, this, &cMainWindow::onFolderViewItemChanged);
|
||||
connect(ui->m_folderView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cMainWindow::onFolderSelected);
|
||||
connect(m_folderViewModel, &QStandardItemModel::itemChanged, this, &cMainWindow::onFolderViewItemChanged);
|
||||
connect(ui->m_folderView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cMainWindow::onFolderSelected);
|
||||
connect(ui->m_thumbnailView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cMainWindow::onThumbnailSelected);
|
||||
}
|
||||
|
||||
void cMainWindow::onFolderViewItemChanged(QStandardItem* item)
|
||||
@@ -396,6 +417,7 @@ void cMainWindow::onFolderSelected(const QItemSelection& /*selection*/, const QI
|
||||
return;
|
||||
|
||||
m_thumbnailViewModel->clear();
|
||||
ui->m_information->clear();
|
||||
|
||||
if(!ui->m_folderView->selectionModel()->selectedIndexes().count())
|
||||
return;
|
||||
@@ -417,18 +439,71 @@ void cMainWindow::onFolderSelected(const QItemSelection& /*selection*/, const QI
|
||||
if(!images)
|
||||
continue;
|
||||
|
||||
QIcon icon = QIcon(QPixmap::fromImage(*images->thumbnail()));
|
||||
QStandardItem* item = new QStandardItem(icon, images->name());
|
||||
item->setTextAlignment(Qt::AlignCenter);
|
||||
item->setData(QVariant::fromValue(images));
|
||||
item->setCheckable(true);
|
||||
QStandardItem* item = images->item();
|
||||
if(loaded)
|
||||
item->setCheckState(state);
|
||||
images->setItem(item);
|
||||
|
||||
m_thumbnailViewModel->appendRow(item);
|
||||
}
|
||||
}
|
||||
|
||||
void cMainWindow::onThumbnailSelected(const QItemSelection& /*selection*/, const QItemSelection& /*previous*/)
|
||||
{
|
||||
QModelIndex index = ui->m_thumbnailView->selectionModel()->selectedIndexes()[0];
|
||||
if(!index.isValid())
|
||||
return;
|
||||
|
||||
cImages* images = m_thumbnailSortFilterProxyModel->data(index, Qt::UserRole+1).value<cImages*>();
|
||||
|
||||
if(images)
|
||||
{
|
||||
QString information;
|
||||
information = "<!DOCTYPE html>\n";
|
||||
information.append("<html>\n");
|
||||
information.append(" <head>\n");
|
||||
information.append(" <style>\n");
|
||||
information.append(" body { background-color: white; color: black; }\n");
|
||||
information.append(" h1 { color: black; }\n");
|
||||
information.append(" p { color: black; }\n");
|
||||
information.append(" .time { color: darkgrey; }\n");
|
||||
information.append(" .title { color: darkblue; font-weight: bold; }\n");
|
||||
information.append(" .option { color: darkmagenta; font-style: italic; }\n");
|
||||
information.append(" .optionok { color: green; font-style: italic; }\n");
|
||||
information.append(" .optionnok { color: red; font-style: italic; }\n");
|
||||
information.append(" td { color: black; }\n");
|
||||
information.append(" table { width: 100%; }\n");
|
||||
information.append(" </style>\n");
|
||||
information.append(" </head>\n");
|
||||
information.append(" <body>\n");
|
||||
information.append(" <table style='width:100%'>\n");
|
||||
information.append(" <tr><td span=2 class='title'>File properties</td></tr>");
|
||||
information.append(QString(" <tr><td><i>File:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->name()));
|
||||
information.append(QString(" <tr><td><i>Folder:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->albums()->path()));
|
||||
information.append(QString(" <tr><td><i>Date:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->modificationDate().toString()));
|
||||
information.append(QString(" <tr><td><i>Size:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->fileSize()));
|
||||
information.append(" <tr><td span=2 class='title'>Image properties</td></tr>\n");
|
||||
information.append(QString(" <tr><td><i>Type:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->imageInformation().format));
|
||||
information.append(QString(" <tr><td><i>Size:</i></td><td align=\"right\">%1x%2</td></tr>\n").arg(images->imageInformation().width).arg(images->imageInformation().height));
|
||||
information.append(QString(" <tr><td><i>Color depth:</i></td><td align=\"right\">%1 bpp</td></tr>\n").arg(images->imageInformation().colorDepth));
|
||||
information.append(" <tr><td span=2 class='title'>Shoot properties</td></tr>\n");
|
||||
information.append(QString(" <tr><td><i>Camera:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->imageMetadata().model));
|
||||
information.append(QString(" <tr><td><i>Taken:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->imageInformation().creationDate.toString()));
|
||||
information.append(QString(" <tr><td><i>Lens:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->imageMetadata().lens));
|
||||
information.append(QString(" <tr><td><i>Aparture:</i></td><td align=\"right\">F%1</td></tr>\n").arg(images->imageMetadata().aparture));
|
||||
information.append(QString(" <tr><td><i>Focal length:</i></td><td align=\"right\">%1</td></tr>\n").arg(images->imageMetadata().focalLength));
|
||||
information.append(QString(" <tr><td><i>Focal length (35mm):</i></td><td align=\"right\">%1</td></tr>\n").arg(images->imageMetadata().focalLength35));
|
||||
information.append(QString(" <tr><td><i>Exposure time:</i></td><td align=\"right\">1/%1</td></tr>\n").arg(1/images->imageMetadata().exposureTime));
|
||||
information.append(QString(" <tr><td><i>Sensitivity:</i></td><td align=\"right\">ISO %1</td></tr>\n").arg(images->imageMetadata().sensitivity));
|
||||
information.append(" </table>\n");
|
||||
information.append(" </body>\n");
|
||||
m_exportLog.append("</html>\n");
|
||||
|
||||
ui->m_information->setText(information);
|
||||
}
|
||||
else
|
||||
ui->m_information->clear();
|
||||
}
|
||||
|
||||
void cMainWindow::onRefreshList()
|
||||
{
|
||||
loadData();
|
||||
@@ -436,11 +511,332 @@ void cMainWindow::onRefreshList()
|
||||
|
||||
void cMainWindow::onExport()
|
||||
{
|
||||
bool hasExport = false;
|
||||
|
||||
for(int x = 0;x < m_albumsList->count();x++)
|
||||
{
|
||||
cAlbums* albums = m_albumsList->at(x);
|
||||
QStandardItem* item = albums->item();
|
||||
|
||||
if(item)
|
||||
{
|
||||
if(item->checkState() == Qt::Checked)
|
||||
{
|
||||
hasExport = true;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if(albums)
|
||||
{
|
||||
cImagesList* imagesList = albums->imagesList();
|
||||
|
||||
if(imagesList)
|
||||
{
|
||||
for(int y = 0;y < imagesList->count();y++)
|
||||
{
|
||||
cImages* images = albums->imagesList()->at(y);
|
||||
|
||||
if(images)
|
||||
{
|
||||
QStandardItem* item = images->item();
|
||||
if(item)
|
||||
{
|
||||
if(item->checkState() == Qt::Checked)
|
||||
{
|
||||
hasExport = true;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if(!hasExport)
|
||||
{
|
||||
QMessageBox::information(this, "Export", tr("No files selected for export."));
|
||||
return;
|
||||
}
|
||||
|
||||
cExportDialog exportDialog(m_imageFormats, this);
|
||||
if(exportDialog.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
m_working = true;
|
||||
m_stopIt = false;
|
||||
// setActionEnabled(false, false, false, false, false, true);
|
||||
doExport();
|
||||
// setActionEnabled(true, true, true, true, true, false);
|
||||
m_working = false;
|
||||
}
|
||||
|
||||
void cMainWindow::onStop()
|
||||
{
|
||||
}
|
||||
|
||||
void cMainWindow::doExport()
|
||||
{
|
||||
EXPORTSETTINGS exportSettings;
|
||||
OVERWRITE overwrite = OVERWRITE_ASK;
|
||||
|
||||
m_exportLog = "<!DOCTYPE html>\n";
|
||||
m_exportLog.append("<html>\n");
|
||||
m_exportLog.append("<head>\n");
|
||||
m_exportLog.append("<style>\n");
|
||||
m_exportLog.append("body { background-color: white; color: black; }\n");
|
||||
m_exportLog.append("h1 { color: black; }\n");
|
||||
m_exportLog.append("p { color: black; }\n");
|
||||
m_exportLog.append(".time { color: darkgrey; }");
|
||||
m_exportLog.append(".title { color: darkblue; font-weight: bold; }");
|
||||
m_exportLog.append(".option { color: darkmagenta; font-style: italic; }");
|
||||
m_exportLog.append(".optionok { color: green; font-style: italic; }");
|
||||
m_exportLog.append(".optionnok { color: red; font-style: italic; }");
|
||||
m_exportLog.append("td { color: black; }\n");
|
||||
m_exportLog.append("</style>\n");
|
||||
m_exportLog.append("</head>\n");
|
||||
m_exportLog.append("<body>\n");
|
||||
|
||||
addToExportLog(m_exportLog, "<span class='title'>Start Export</span>");
|
||||
|
||||
getExportSettings(exportSettings);
|
||||
|
||||
qint32 fileCount = 0;
|
||||
for(int x = 0;x < m_albumsList->count();x++)
|
||||
{
|
||||
cAlbums* albums = m_albumsList->at(x);
|
||||
|
||||
if(albums)
|
||||
{
|
||||
cImagesList* imagesList = albums->imagesList();
|
||||
|
||||
if(imagesList)
|
||||
{
|
||||
for(int y = 0;y < imagesList->count();y++)
|
||||
{
|
||||
cImages* images = albums->imagesList()->at(y);
|
||||
|
||||
if(images)
|
||||
{
|
||||
QStandardItem* item = images->item();
|
||||
if(item)
|
||||
{
|
||||
if(item->checkState() == Qt::Checked)
|
||||
fileCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addToExportLog(m_exportLog, QString("Files to export: <span class='option'>%1</span>").arg(fileCount));
|
||||
|
||||
m_progressBar->setRange(0, fileCount);
|
||||
m_progressBar->setValue(0);
|
||||
m_progressBar->setVisible(true);
|
||||
|
||||
qint32 curFile = 0;
|
||||
for(int x = 0;x < m_albumsList->count();x++)
|
||||
{
|
||||
cAlbums* albums = m_albumsList->at(x);
|
||||
|
||||
if(albums)
|
||||
{
|
||||
cImagesList* imagesList = albums->imagesList();
|
||||
|
||||
if(imagesList)
|
||||
{
|
||||
for(int y = 0;y < imagesList->count();y++)
|
||||
{
|
||||
cImages* images = albums->imagesList()->at(y);
|
||||
|
||||
if(images)
|
||||
{
|
||||
QStandardItem* item = images->item();
|
||||
if(item)
|
||||
{
|
||||
if(item->checkState() == Qt::Checked)
|
||||
{
|
||||
m_progressBar->setValue(curFile);
|
||||
ui->m_statusBar->showMessage(images->name());
|
||||
qApp->processEvents();
|
||||
// overwrite = exportFile(exportSettings, overwrite);
|
||||
|
||||
curFile++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
// overwrite = exportFile(exportSettings, lpExif, overwrite);
|
||||
|
||||
// m_lpProgressBar->setValue(i+1);
|
||||
|
||||
// qApp->processEvents();
|
||||
|
||||
// if(m_stopIt)
|
||||
// {
|
||||
// addToExportLog(m_exportLog, "<b>aborted.</b>");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
m_progressBar->setVisible(false);
|
||||
ui->m_statusBar->showMessage(tr("export done."), 3000);
|
||||
|
||||
addToExportLog(m_exportLog, "<b>done.</b>");
|
||||
m_exportLog.append("</body>\n");
|
||||
m_exportLog.append("</html>\n");
|
||||
|
||||
cLogWindow logWindow;
|
||||
|
||||
logWindow.setText(m_exportLog);
|
||||
logWindow.exec();
|
||||
}
|
||||
|
||||
/*
|
||||
DIRECTORY_METHOD directoryMethod;
|
||||
QString directory;
|
||||
bool keepStructure;
|
||||
QString directoryTag;
|
||||
STRIP_LAST_FOLDER_METHOD stripLastFolderMethod;
|
||||
QStringList stripLastFolderIfList;
|
||||
FILE_METHOD fileMethod;
|
||||
FILE_ADD fileAdd;
|
||||
QString fileTag;
|
||||
OVERWRITE_METHOD overwriteMethod;
|
||||
bool copyEXIF;
|
||||
QString fileFormat;
|
||||
int quality;
|
||||
*/
|
||||
void cMainWindow::getExportSettings(EXPORTSETTINGS& exportSettings)
|
||||
{
|
||||
QSettings settings;
|
||||
QString tmp;
|
||||
|
||||
tmp = settings.value("export/directoryMethod", QVariant::fromValue(QString("keepDirectory"))).toString();
|
||||
|
||||
addToExportLog(m_exportLog, "<b>Settings:</b>");
|
||||
|
||||
exportSettings.directory = settings.value("export/destinationPath", QVariant::fromValue(QString(""))).toString();
|
||||
exportSettings.keepStructure = settings.value("export/keepStructure", QVariant::fromValue(false)).toBool();
|
||||
exportSettings.directoryTag = settings.value("export/destinationPathTag", QVariant::fromValue(QString(""))).toString();
|
||||
|
||||
if(tmp == "newDirectoryTag")
|
||||
{
|
||||
exportSettings.directoryMethod = DIRECTORY_METHOD_TAG;
|
||||
addToExportLog(m_exportLog, "Directory Name Method: <span class='option'>rename Directory by TAG</span>");
|
||||
addToExportLog(m_exportLog, " - used TAG: <span class='option'>" + exportSettings.directoryTag + "</span>");
|
||||
}
|
||||
else if(tmp == "newDirectory")
|
||||
{
|
||||
exportSettings.directoryMethod = DIRECTORY_METHOD_NEW;
|
||||
addToExportLog(m_exportLog, "Directory Name Method: <span class='option'>create new directory</span>");
|
||||
addToExportLog(m_exportLog, " - used Directory: <span class='option'>" + exportSettings.directory + "</span>");
|
||||
}
|
||||
else
|
||||
{
|
||||
exportSettings.directoryMethod = DIRECTORY_METHOD_KEEP;
|
||||
addToExportLog(m_exportLog, "Directory Name Method: <span class='option'>keep directory</span>");
|
||||
}
|
||||
|
||||
addToExportLog(m_exportLog, QString("Keep old Structure: <span class='option'>%1</span>").arg(exportSettings.keepStructure ? "yes" : "no"));
|
||||
|
||||
bool stripLastFolder = settings.value("export/stripLastDirectory", QVariant::fromValue(false)).toBool();
|
||||
bool stripLastFolderIf = settings.value("export/stripLastDirectoryIf", QVariant::fromValue(false)).toBool();
|
||||
|
||||
if(stripLastFolder)
|
||||
{
|
||||
if(stripLastFolderIf)
|
||||
{
|
||||
exportSettings.stripLastFolderMethod = STRIP_LAST_FOLDER_METHOD::STRIP_LAST_FOLDER_IF;
|
||||
exportSettings.stripLastFolderIfList = settings.value("export/stripLastDirectoryIfList", QVariant::fromValue(QString(""))).toString().split("\n");
|
||||
addToExportLog(m_exportLog, "Strip last folder: <span class='option'>yes</span>");
|
||||
addToExportLog(m_exportLog, QString(" - folders to strip: <span class='option'>%1</span>").arg(exportSettings.stripLastFolderIfList.join(", ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
exportSettings.stripLastFolderMethod = STRIP_LAST_FOLDER_METHOD::STRIP_LAST_FOLDER;
|
||||
addToExportLog(m_exportLog, "Strip last folder: <span class='option'>yes</span>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
exportSettings.stripLastFolderMethod = STRIP_LAST_FOLDER_METHOD::STRIP_LAST_FOLDER_NO;
|
||||
addToExportLog(m_exportLog, "Strip last folder: <span class='option'>no</span>");
|
||||
}
|
||||
|
||||
tmp = settings.value("export/filenamePlus", QVariant::fromValue(QString("converted"))).toString();
|
||||
|
||||
if(tmp == "TAG")
|
||||
exportSettings.fileAdd = FILE_ADD_TAG;
|
||||
else
|
||||
exportSettings.fileAdd = FILE_ADD_CONVERTED;
|
||||
|
||||
exportSettings.fileTag = settings.value("export/fileTag", QVariant::fromValue(QString(""))).toString();
|
||||
|
||||
tmp = settings.value("export/fileMethod", QVariant::fromValue(QString("keepFilename"))).toString();
|
||||
|
||||
if(tmp == "newFilename")
|
||||
{
|
||||
exportSettings.fileMethod = FILE_METHOD_RENAME;
|
||||
addToExportLog(m_exportLog, "File Name Method: <span class='option'>FILE_METHOD_RENAME</span>");
|
||||
|
||||
if(exportSettings.fileAdd == FILE_ADD_TAG)
|
||||
addToExportLog(m_exportLog, " - used TAG: <span class='option'>" + exportSettings.fileTag + "</span>");
|
||||
else
|
||||
addToExportLog(m_exportLog, " - add <span class='option'>'_converted'</span>");
|
||||
}
|
||||
else
|
||||
{
|
||||
exportSettings.fileMethod = FILE_METHOD_KEEP;
|
||||
addToExportLog(m_exportLog, "File Name Method: <span class='option'>FILE_METHOD_KEEP</span>");
|
||||
}
|
||||
|
||||
|
||||
tmp = settings.value("export/overwrite", QVariant::fromValue(QString("ask"))).toString();
|
||||
|
||||
if(tmp == "no")
|
||||
{
|
||||
exportSettings.overwriteMethod = OVERWRITE_METHOD_NOEXPORT;
|
||||
addToExportLog(m_exportLog, "Existing File Overwrite Mode: <span class='option'>do not export existing file</span>");
|
||||
}
|
||||
else if(tmp == "overwrite")
|
||||
{
|
||||
exportSettings.overwriteMethod = OVERWRITE_METHOD_OVERWRITE;
|
||||
addToExportLog(m_exportLog, "Existing File Overwrite Mode: <span class='option'>overwrite existing file</span>");
|
||||
}
|
||||
else if(tmp == "rename")
|
||||
{
|
||||
exportSettings.overwriteMethod = OVERWRITE_METHOD_RENAME;
|
||||
addToExportLog(m_exportLog, "Existing File Overwrite Mode: <span class='option'>rename existing file</span>");
|
||||
}
|
||||
else
|
||||
{
|
||||
exportSettings.overwriteMethod = OVERWRITE_METHOD_ASK;
|
||||
addToExportLog(m_exportLog, "Existing File Overwrite Mode: <span class='option'>ask for overwrite</span>");
|
||||
}
|
||||
|
||||
exportSettings.copyEXIF = settings.value("export/copyEXIF", QVariant::fromValue(true)).toBool();
|
||||
exportSettings.fileFormat = settings.value("export/fileFormat").toString();
|
||||
exportSettings.quality = settings.value("export/quality", QVariant::fromValue(50)).toInt();
|
||||
|
||||
addToExportLog(m_exportLog, "File Format: <span class='option'>" + exportSettings.fileFormat + "</span>");
|
||||
addToExportLog(m_exportLog, "Default Output Quality: <span class='option'>" + QString::number(exportSettings.quality) + "</span>");
|
||||
}
|
||||
|
||||
@@ -23,6 +23,66 @@ QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class cMainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
enum DIRECTORY_METHOD
|
||||
{
|
||||
DIRECTORY_METHOD_KEEP = 1,
|
||||
DIRECTORY_METHOD_NEW = 2,
|
||||
DIRECTORY_METHOD_TAG = 3,
|
||||
};
|
||||
|
||||
enum FILE_METHOD
|
||||
{
|
||||
FILE_METHOD_KEEP = 1,
|
||||
FILE_METHOD_RENAME = 2,
|
||||
};
|
||||
|
||||
enum STRIP_LAST_FOLDER_METHOD
|
||||
{
|
||||
STRIP_LAST_FOLDER_NO = 1,
|
||||
STRIP_LAST_FOLDER = 2,
|
||||
STRIP_LAST_FOLDER_IF = 3,
|
||||
};
|
||||
|
||||
enum OVERWRITE_METHOD
|
||||
{
|
||||
OVERWRITE_METHOD_NOEXPORT = 1,
|
||||
OVERWRITE_METHOD_ASK = 2,
|
||||
OVERWRITE_METHOD_RENAME = 3,
|
||||
OVERWRITE_METHOD_OVERWRITE = 4,
|
||||
};
|
||||
|
||||
enum FILE_ADD
|
||||
{
|
||||
FILE_ADD_CONVERTED = 1,
|
||||
FILE_ADD_TAG = 2,
|
||||
};
|
||||
|
||||
typedef struct tagEXPORTSETTINGS
|
||||
{
|
||||
DIRECTORY_METHOD directoryMethod;
|
||||
QString directory;
|
||||
bool keepStructure;
|
||||
QString directoryTag;
|
||||
STRIP_LAST_FOLDER_METHOD stripLastFolderMethod;
|
||||
QStringList stripLastFolderIfList;
|
||||
FILE_METHOD fileMethod;
|
||||
FILE_ADD fileAdd;
|
||||
QString fileTag;
|
||||
OVERWRITE_METHOD overwriteMethod;
|
||||
bool copyEXIF;
|
||||
QString fileFormat;
|
||||
int quality;
|
||||
} EXPORTSETTINGS;
|
||||
|
||||
enum OVERWRITE
|
||||
{
|
||||
OVERWRITE_ASK = 0,
|
||||
OVERWRITE_NONE = 1,
|
||||
OVERWRITE_ALL = 2,
|
||||
};
|
||||
|
||||
|
||||
class cMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -61,6 +121,10 @@ private:
|
||||
QList<IMAGEFORMAT> m_imageFormats;
|
||||
|
||||
bool m_loading;
|
||||
bool m_working;
|
||||
bool m_stopIt;
|
||||
|
||||
QString m_exportLog;
|
||||
|
||||
void initUI();
|
||||
void createActions();
|
||||
@@ -74,6 +138,9 @@ private:
|
||||
|
||||
QStandardItem* findDBRootItem(QStandardItemModel* model, QStandardItem* rootItem, cAlbumRoots* albumRoots);
|
||||
QStandardItem* findParentItem(QStandardItemModel* model, QStandardItem* rootItem, cAlbums *albumRoots);
|
||||
|
||||
void doExport();
|
||||
void getExportSettings(EXPORTSETTINGS& exportSettings);
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
@@ -83,5 +150,6 @@ private slots:
|
||||
void onStop();
|
||||
void onFolderViewItemChanged(QStandardItem* item);
|
||||
void onFolderSelected(const QItemSelection& selection, const QItemSelection& previous);
|
||||
void onThumbnailSelected(const QItemSelection& selection, const QItemSelection& previous);
|
||||
};
|
||||
#endif // CMAINWINDOW_H
|
||||
|
||||
+50
-43
@@ -16,49 +16,56 @@
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QSplitter" name="m_splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTreeView" name="m_folderView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListView" name="m_thumbnailView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="gridSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>180</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QSplitter" name="m_splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTreeView" name="m_folderView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListView" name="m_thumbnailView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="gridSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>180</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="m_information">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define COMMON_H
|
||||
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
@@ -41,6 +42,96 @@ typedef struct tagIMAGEFORMAT
|
||||
\typedef IMAGEFORMAT*/
|
||||
} IMAGEFORMAT;
|
||||
|
||||
typedef struct tagIMAGECOMMENT
|
||||
{
|
||||
qint32 id;
|
||||
qint32 imageid;
|
||||
qint32 type;
|
||||
QString language;
|
||||
QString author;
|
||||
QDateTime date;
|
||||
QString comment;
|
||||
} IMAGECOMMENT;
|
||||
|
||||
typedef struct tagIMAGECOPYRIGHT
|
||||
{
|
||||
qint32 id;
|
||||
qint32 imageid;
|
||||
QString property;
|
||||
QString value;
|
||||
QString extraValue;
|
||||
|
||||
} IMAGECOPYRIGHT;
|
||||
|
||||
typedef struct tagIMAGEINFORMATION
|
||||
{
|
||||
qint32 imageid;
|
||||
qint32 rating;
|
||||
QDateTime creationDate;
|
||||
QDateTime digitizationDate;
|
||||
qint32 orientation;
|
||||
qint32 width;
|
||||
qint32 height;
|
||||
QString format;
|
||||
qint32 colorDepth;
|
||||
qint32 colorModel;
|
||||
} IMAGEINFORMATION;
|
||||
|
||||
typedef struct tagIMAGEMETADATA
|
||||
{
|
||||
qint32 imageid;
|
||||
QString make;
|
||||
QString model;
|
||||
QString lens;
|
||||
qreal aparture;
|
||||
qreal focalLength;
|
||||
qreal focalLength35;
|
||||
qreal exposureTime;
|
||||
qint32 exposureProgram;
|
||||
qint32 exposureMode;
|
||||
qint32 sensitivity;
|
||||
qint32 flash;
|
||||
qint32 whiteBalance;
|
||||
qint32 whiteBalanceColorTemperature;
|
||||
qint32 meteringMode;
|
||||
qreal subjectDistance;
|
||||
qint32 subjectDistanceCategory;
|
||||
} IMAGEMETADATA;
|
||||
|
||||
typedef struct tagIMAGEPOSITIONS
|
||||
{
|
||||
qint32 imageid;
|
||||
QString latitude;
|
||||
qreal latitideNumber;
|
||||
QString longitude;
|
||||
qreal longitudeNumber;
|
||||
qreal altitude;
|
||||
qreal orientation;
|
||||
qreal tilt;
|
||||
qreal roll;
|
||||
qreal accuracy;
|
||||
QString description;
|
||||
} IMAGEPOSITIONS;
|
||||
|
||||
typedef struct tagIMAGEPROPERTIES
|
||||
{
|
||||
qint32 imageid;
|
||||
QString property;
|
||||
QString value;
|
||||
} IMAGEPROPERTIES;
|
||||
|
||||
typedef struct tagVIDEOMETADATA
|
||||
{
|
||||
qint32 imageid;
|
||||
QString aspectRation;
|
||||
QString audioBitRate;
|
||||
QString audioChannelType;
|
||||
QString audioCompressor;
|
||||
QString duration;
|
||||
QString frameRate;
|
||||
qint32 exposureProgram;
|
||||
QString videoCodec;
|
||||
} VIDEOMETADATA;
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
@@ -45,6 +45,7 @@ SOURCES += \
|
||||
cfoldersortfilterproxymodel.cpp \
|
||||
cimage.cpp \
|
||||
cimages.cpp \
|
||||
clogwindow.cpp \
|
||||
common.cpp \
|
||||
cthumbnailsortfilterproxymodel.cpp \
|
||||
main.cpp \
|
||||
@@ -64,6 +65,7 @@ HEADERS += \
|
||||
cfoldersortfilterproxymodel.h \
|
||||
cimage.h \
|
||||
cimages.h \
|
||||
clogwindow.h \
|
||||
cmainwindow.h \
|
||||
common.h \
|
||||
cthumbnailsortfilterproxymodel.h \
|
||||
@@ -80,6 +82,7 @@ HEADERS += \
|
||||
|
||||
FORMS += \
|
||||
cexportdialog.ui \
|
||||
clogwindow.ui \
|
||||
cmainwindow.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
|
||||
Reference in New Issue
Block a user