initial commit
@@ -1,6 +1,8 @@
|
|||||||
#include "cexif.h"
|
#include "cexif.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QImage>
|
||||||
|
#include <QPicture>
|
||||||
|
|
||||||
#include <exiv2/exiv2.hpp>
|
#include <exiv2/exiv2.hpp>
|
||||||
|
|
||||||
@@ -15,7 +17,12 @@ cEXIF::cEXIF(cEXIFTagList* lpEXIFTagList) :
|
|||||||
|
|
||||||
bool cEXIF::fromFile(const QString& szFileName)
|
bool cEXIF::fromFile(const QString& szFileName)
|
||||||
{
|
{
|
||||||
|
if(!QFile::exists(szFileName))
|
||||||
|
return(false);
|
||||||
|
|
||||||
m_exifValueList.clear();
|
m_exifValueList.clear();
|
||||||
|
m_previewList.clear();
|
||||||
|
|
||||||
m_szFileName = "";
|
m_szFileName = "";
|
||||||
|
|
||||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(szFileName.toStdString());
|
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(szFileName.toStdString());
|
||||||
@@ -45,6 +52,24 @@ bool cEXIF::fromFile(const QString& szFileName)
|
|||||||
m_iHeight = image->pixelHeight();
|
m_iHeight = image->pixelHeight();
|
||||||
m_szFileName = szFileName;
|
m_szFileName = szFileName;
|
||||||
|
|
||||||
|
Exiv2::PreviewManager previewManager(*image);
|
||||||
|
Exiv2::PreviewPropertiesList previewPropertiesList = previewManager.getPreviewProperties();
|
||||||
|
|
||||||
|
for(Exiv2::PreviewPropertiesList::const_iterator i = previewPropertiesList.begin();i != previewPropertiesList.end();i++)
|
||||||
|
{
|
||||||
|
Exiv2::PreviewImage previewImage = previewManager.getPreviewImage(*i);
|
||||||
|
|
||||||
|
QImage image;
|
||||||
|
image.loadFromData(static_cast<const uchar*>(previewImage.pData()), static_cast<qint32>(previewImage.size()));
|
||||||
|
m_previewList.append(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!m_previewList.count())
|
||||||
|
{
|
||||||
|
QImage image;
|
||||||
|
if(image.load(szFileName))
|
||||||
|
m_previewList.append(image.scaled(160, 120, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
|
||||||
|
}
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +140,7 @@ QString cEXIF::exposureTime()
|
|||||||
{
|
{
|
||||||
qreal value = getTag(0x829a, 5).value<qreal>();
|
qreal value = getTag(0x829a, 5).value<qreal>();
|
||||||
|
|
||||||
if(value == 0)
|
if(value == 0.0)
|
||||||
return("error");
|
return("error");
|
||||||
|
|
||||||
if(value >= 1.0)
|
if(value >= 1.0)
|
||||||
@@ -173,6 +198,11 @@ QString cEXIF::fileName()
|
|||||||
return(m_szFileName);
|
return(m_szFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QImage> cEXIF::previewList()
|
||||||
|
{
|
||||||
|
return(m_previewList);
|
||||||
|
}
|
||||||
|
|
||||||
QVariant cEXIF::getTag(qint32 iTAGID, qint32 iIFDID)
|
QVariant cEXIF::getTag(qint32 iTAGID, qint32 iIFDID)
|
||||||
{
|
{
|
||||||
cEXIFTag* lpTag = m_lpEXIFTagList->find(iTAGID, iIFDID);
|
cEXIFTag* lpTag = m_lpEXIFTagList->find(iTAGID, iIFDID);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QImage>
|
||||||
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -420,13 +421,20 @@ public:
|
|||||||
* @return QString
|
* @return QString
|
||||||
*/
|
*/
|
||||||
QString fileName();
|
QString fileName();
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return QList<QImage>
|
||||||
|
*/
|
||||||
|
QList<QImage> previewList();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cEXIFTagList* m_lpEXIFTagList; /**< TODO: describe */
|
cEXIFTagList* m_lpEXIFTagList; /**< TODO: describe */
|
||||||
cEXIFValueList m_exifValueList; /**< TODO: describe */
|
cEXIFValueList m_exifValueList; /**< TODO: describe */
|
||||||
qint32 m_iWidth; /**< TODO: describe */
|
qint32 m_iWidth; /**< TODO: describe */
|
||||||
qint32 m_iHeight; /**< TODO: describe */
|
qint32 m_iHeight; /**< TODO: describe */
|
||||||
QString m_szFileName; /**< TODO: describe */
|
QString m_szFileName; /**< TODO: describe */
|
||||||
|
QList<QImage> m_previewList; /**< TODO: describe */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
|
|||||||
@@ -6,164 +6,90 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
|
||||||
cMainWindow::cMainWindow(QWidget *parent) :
|
cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::cMainWindow)
|
ui(new Ui::cMainWindow),
|
||||||
|
m_lpSplashScreen(lpSplashScreen)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
initUI();
|
||||||
|
createActions();
|
||||||
|
|
||||||
cEXIF exif(&m_exifTagList);
|
cEXIF exif(&m_exifTagList);
|
||||||
|
// exif.fromFile(QDir::homePath() + "\\OneDrive - WINDESIGN\\exif-samples-master\\20181123_125857.jpg");
|
||||||
|
// exif.fromFile(QDir::homePath() + "\\OneDrive - WINDESIGN\\exif-samples-master\\IMG_1371.CR2");
|
||||||
|
// exif.fromFile(QDir::homePath() + "\\OneDrive - WINDESIGN\\exif-samples-master\\tiff\\BSG1.tiff");
|
||||||
|
// exif.fromFile(QDir::homePath() + "\\OneDrive - WINDESIGN\\exif-samples-master\\IMG_3444.CR2");
|
||||||
|
// exif.fromFile(QDir::homePath() + "\\OneDrive - WINDESIGN\\exif-samples-master\\IMG_0248_49_50_easyHDR-dramatic-strong.jpg");
|
||||||
|
// exif.fromFile(QDir::homePath() + "\\OneDrive - WINDESIGN\\exif-samples-master\\IMG_3466_7_8_easyHDR-dramatic-dark.tif");
|
||||||
|
exif.fromFile(QDir::homePath() + "\\OneDrive - WINDESIGN\\exif-samples-master\\IMG_0248_49_50_easyHDR-dramatic-strong.jpg");
|
||||||
|
|
||||||
exif.fromFile("C:\\Users\\VET0572\\Pictures\\IMG_1371.CR2");
|
QList<QImage> previewList = exif.previewList();
|
||||||
qDebug() << "===========================================================================";
|
for(int i = 0;i < previewList.count();i++)
|
||||||
qDebug() << exif.fileName();
|
{
|
||||||
qDebug() << "---------------------------------------------------------------------------";
|
QLabel* lpLabel = new QLabel;
|
||||||
qDebug() << "ImageWidth: " << exif.imageWidth();
|
lpLabel->setPixmap(QPixmap::fromImage(previewList[i]));
|
||||||
qDebug() << "ImageHeight: " << exif.imageHeight();
|
ui->m_lpMainLayout->addWidget(lpLabel);
|
||||||
qDebug() << "Make: " << exif.cameraMake();
|
}
|
||||||
qDebug() << "Model: " << exif.cameraModel();
|
|
||||||
qDebug() << "DateTime: " << exif.dateTime();
|
|
||||||
qDebug() << "FNumber: " << exif.fNumber();
|
|
||||||
qDebug() << "ISOSpeedRatings: " << exif.iso();
|
|
||||||
qDebug() << "Flash: " << exif.flash();
|
|
||||||
qDebug() << "FocalLength: " << exif.focalLength();
|
|
||||||
qDebug() << "LensMake: " << exif.lensMake();
|
|
||||||
qDebug() << "LensModel: " << exif.lensModel();
|
|
||||||
qDebug() << "ExposureTime: " << exif.exposureTime();
|
|
||||||
qDebug() << "ExposureBias: " << exif.exposureBias();
|
|
||||||
qDebug() << "ExifVersion: " << exif.exifVersion();
|
|
||||||
qDebug() << "DateTimeOriginal: " << exif.dateTimeOriginal();
|
|
||||||
qDebug() << "DateTimeDigitized: " << exif.dateTimeDigitized();
|
|
||||||
qDebug() << "WhiteBalance: " << exif.whiteBalance();
|
|
||||||
qDebug() << "FocalLengthIn35mmFilm: " << exif.focalLength35();
|
|
||||||
qDebug() << "GPS: " << exif.gps();
|
|
||||||
|
|
||||||
exif.fromFile("C:\\Users\\VET0572\\Pictures\\IMG_1372.CR2");
|
|
||||||
qDebug() << "===========================================================================";
|
|
||||||
qDebug() << exif.fileName();
|
|
||||||
qDebug() << "---------------------------------------------------------------------------";
|
|
||||||
qDebug() << "ImageWidth: " << exif.imageWidth();
|
|
||||||
qDebug() << "ImageHeight: " << exif.imageHeight();
|
|
||||||
qDebug() << "Make: " << exif.cameraMake();
|
|
||||||
qDebug() << "Model: " << exif.cameraModel();
|
|
||||||
qDebug() << "DateTime: " << exif.dateTime();
|
|
||||||
qDebug() << "FNumber: " << exif.fNumber();
|
|
||||||
qDebug() << "ISOSpeedRatings: " << exif.iso();
|
|
||||||
qDebug() << "Flash: " << exif.flash();
|
|
||||||
qDebug() << "FocalLength: " << exif.focalLength();
|
|
||||||
qDebug() << "LensMake: " << exif.lensMake();
|
|
||||||
qDebug() << "LensModel: " << exif.lensModel();
|
|
||||||
qDebug() << "ExposureTime: " << exif.exposureTime();
|
|
||||||
qDebug() << "ExposureBias: " << exif.exposureBias();
|
|
||||||
qDebug() << "ExifVersion: " << exif.exifVersion();
|
|
||||||
qDebug() << "DateTimeOriginal: " << exif.dateTimeOriginal();
|
|
||||||
qDebug() << "DateTimeDigitized: " << exif.dateTimeDigitized();
|
|
||||||
qDebug() << "WhiteBalance: " << exif.whiteBalance();
|
|
||||||
qDebug() << "FocalLengthIn35mmFilm: " << exif.focalLength35();
|
|
||||||
qDebug() << "GPS: " << exif.gps();
|
|
||||||
|
|
||||||
exif.fromFile("C:\\Users\\VET0572\\Pictures\\IMG_1373.CR2");
|
|
||||||
qDebug() << "===========================================================================";
|
|
||||||
qDebug() << exif.fileName();
|
|
||||||
qDebug() << "---------------------------------------------------------------------------";
|
|
||||||
qDebug() << "ImageWidth: " << exif.imageWidth();
|
|
||||||
qDebug() << "ImageHeight: " << exif.imageHeight();
|
|
||||||
qDebug() << "Make: " << exif.cameraMake();
|
|
||||||
qDebug() << "Model: " << exif.cameraModel();
|
|
||||||
qDebug() << "DateTime: " << exif.dateTime();
|
|
||||||
qDebug() << "FNumber: " << exif.fNumber();
|
|
||||||
qDebug() << "ISOSpeedRatings: " << exif.iso();
|
|
||||||
qDebug() << "Flash: " << exif.flash();
|
|
||||||
qDebug() << "FocalLength: " << exif.focalLength();
|
|
||||||
qDebug() << "LensMake: " << exif.lensMake();
|
|
||||||
qDebug() << "LensModel: " << exif.lensModel();
|
|
||||||
qDebug() << "ExposureTime: " << exif.exposureTime();
|
|
||||||
qDebug() << "ExposureBias: " << exif.exposureBias();
|
|
||||||
qDebug() << "ExifVersion: " << exif.exifVersion();
|
|
||||||
qDebug() << "DateTimeOriginal: " << exif.dateTimeOriginal();
|
|
||||||
qDebug() << "DateTimeDigitized: " << exif.dateTimeDigitized();
|
|
||||||
qDebug() << "WhiteBalance: " << exif.whiteBalance();
|
|
||||||
qDebug() << "FocalLengthIn35mmFilm: " << exif.focalLength35();
|
|
||||||
qDebug() << "GPS: " << exif.gps();
|
|
||||||
|
|
||||||
exif.fromFile("C:\\Users\\VET0572\\Pictures\\IMG_3444.CR2");
|
|
||||||
qDebug() << "===========================================================================";
|
|
||||||
qDebug() << exif.fileName();
|
|
||||||
qDebug() << "---------------------------------------------------------------------------";
|
|
||||||
qDebug() << "ImageWidth: " << exif.imageWidth();
|
|
||||||
qDebug() << "ImageHeight: " << exif.imageHeight();
|
|
||||||
qDebug() << "Make: " << exif.cameraMake();
|
|
||||||
qDebug() << "Model: " << exif.cameraModel();
|
|
||||||
qDebug() << "DateTime: " << exif.dateTime();
|
|
||||||
qDebug() << "FNumber: " << exif.fNumber();
|
|
||||||
qDebug() << "ISOSpeedRatings: " << exif.iso();
|
|
||||||
qDebug() << "Flash: " << exif.flash();
|
|
||||||
qDebug() << "FocalLength: " << exif.focalLength();
|
|
||||||
qDebug() << "LensMake: " << exif.lensMake();
|
|
||||||
qDebug() << "LensModel: " << exif.lensModel();
|
|
||||||
qDebug() << "ExposureTime: " << exif.exposureTime();
|
|
||||||
qDebug() << "ExposureBias: " << exif.exposureBias();
|
|
||||||
qDebug() << "ExifVersion: " << exif.exifVersion();
|
|
||||||
qDebug() << "DateTimeOriginal: " << exif.dateTimeOriginal();
|
|
||||||
qDebug() << "DateTimeDigitized: " << exif.dateTimeDigitized();
|
|
||||||
qDebug() << "WhiteBalance: " << exif.whiteBalance();
|
|
||||||
qDebug() << "FocalLengthIn35mmFilm: " << exif.focalLength35();
|
|
||||||
qDebug() << "GPS: " << exif.gps();
|
|
||||||
|
|
||||||
exif.fromFile("C:\\Users\\VET0572\\OneDrive - WINDESIGN\\exif-samples-master\\jpg\\Fujifilm_FinePix6900ZOOM.jpg");
|
|
||||||
qDebug() << "===========================================================================";
|
|
||||||
qDebug() << exif.fileName();
|
|
||||||
qDebug() << "---------------------------------------------------------------------------";
|
|
||||||
qDebug() << "ImageWidth: " << exif.imageWidth();
|
|
||||||
qDebug() << "ImageHeight: " << exif.imageHeight();
|
|
||||||
qDebug() << "Make: " << exif.cameraMake();
|
|
||||||
qDebug() << "Model: " << exif.cameraModel();
|
|
||||||
qDebug() << "DateTime: " << exif.dateTime();
|
|
||||||
qDebug() << "FNumber: " << exif.fNumber();
|
|
||||||
qDebug() << "ISOSpeedRatings: " << exif.iso();
|
|
||||||
qDebug() << "Flash: " << exif.flash();
|
|
||||||
qDebug() << "FocalLength: " << exif.focalLength();
|
|
||||||
qDebug() << "LensMake: " << exif.lensMake();
|
|
||||||
qDebug() << "LensModel: " << exif.lensModel();
|
|
||||||
qDebug() << "ExposureTime: " << exif.exposureTime();
|
|
||||||
qDebug() << "ExposureBias: " << exif.exposureBias();
|
|
||||||
qDebug() << "ExifVersion: " << exif.exifVersion();
|
|
||||||
qDebug() << "DateTimeOriginal: " << exif.dateTimeOriginal();
|
|
||||||
qDebug() << "DateTimeDigitized: " << exif.dateTimeDigitized();
|
|
||||||
qDebug() << "WhiteBalance: " << exif.whiteBalance();
|
|
||||||
qDebug() << "FocalLengthIn35mmFilm: " << exif.focalLength35();
|
|
||||||
qDebug() << "GPS: " << exif.gps();
|
|
||||||
|
|
||||||
exif.fromFile("C:\\Users\\VET0572\\OneDrive - WINDESIGN\\20181123_125857.jpg");
|
|
||||||
qDebug() << "===========================================================================";
|
|
||||||
qDebug() << exif.fileName();
|
|
||||||
qDebug() << "---------------------------------------------------------------------------";
|
|
||||||
qDebug() << "ImageWidth: " << exif.imageWidth();
|
|
||||||
qDebug() << "ImageHeight: " << exif.imageHeight();
|
|
||||||
qDebug() << "Make: " << exif.cameraMake();
|
|
||||||
qDebug() << "Model: " << exif.cameraModel();
|
|
||||||
qDebug() << "DateTime: " << exif.dateTime();
|
|
||||||
qDebug() << "FNumber: " << exif.fNumber();
|
|
||||||
qDebug() << "ISOSpeedRatings: " << exif.iso();
|
|
||||||
qDebug() << "Flash: " << exif.flash();
|
|
||||||
qDebug() << "FocalLength: " << exif.focalLength();
|
|
||||||
qDebug() << "LensMake: " << exif.lensMake();
|
|
||||||
qDebug() << "LensModel: " << exif.lensModel();
|
|
||||||
qDebug() << "ExposureTime: " << exif.exposureTime();
|
|
||||||
qDebug() << "ExposureBias: " << exif.exposureBias();
|
|
||||||
qDebug() << "ExifVersion: " << exif.exifVersion();
|
|
||||||
qDebug() << "DateTimeOriginal: " << exif.dateTimeOriginal();
|
|
||||||
qDebug() << "DateTimeDigitized: " << exif.dateTimeDigitized();
|
|
||||||
qDebug() << "WhiteBalance: " << exif.whiteBalance();
|
|
||||||
qDebug() << "FocalLengthIn35mmFilm: " << exif.focalLength35();
|
|
||||||
qDebug() << "GPS: " << exif.gps();
|
|
||||||
|
|
||||||
qDebug() << "done";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cMainWindow::~cMainWindow()
|
cMainWindow::~cMainWindow()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cMainWindow::initUI()
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
QIcon::setThemeName("TangoMFK");
|
||||||
|
}
|
||||||
|
|
||||||
|
void cMainWindow::createActions()
|
||||||
|
{
|
||||||
|
// setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||||
|
// createFileActions();
|
||||||
|
// createEditActions();
|
||||||
|
// createTextActions();
|
||||||
|
// createToolsActions();
|
||||||
|
// createWindowActions();
|
||||||
|
// createHelpActions();
|
||||||
|
|
||||||
|
// createContextActions();
|
||||||
|
|
||||||
|
// connect(ui->m_lpMainTab, &QTabWidget::currentChanged, this, &cMainWindow::onMainTabCurrentChanged);
|
||||||
|
// connect(ui->m_lpMainTab, &QTabWidget::tabCloseRequested, this, &cMainWindow::onMainTabTabCloseRequested);
|
||||||
|
// connect(ui->m_lpMdiArea, &QMdiArea::subWindowActivated, this, &cMainWindow::onMdiAreaSubWindowActivated);
|
||||||
|
|
||||||
|
// connect(ui->m_lpOutlineList, &QTreeView::doubleClicked, this, &cMainWindow::onOutlineDoubleClicked);
|
||||||
|
// connect(ui->m_lpCharacterList, &QTreeView::doubleClicked, this, &cMainWindow::onCharacterDoubleClicked);
|
||||||
|
// connect(ui->m_lpPlaceList, &QTreeView::doubleClicked, this, &cMainWindow::onPlaceDoubleClicked);
|
||||||
|
// connect(ui->m_lpObjectList, &QTreeView::doubleClicked, this, &cMainWindow::onObjectDoubleClicked);
|
||||||
|
// connect(ui->m_lpRechercheList, &QTreeView::doubleClicked, this, &cMainWindow::onRechercheDoubleClicked);
|
||||||
|
|
||||||
|
// connect(ui->m_lpOutlineList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onOutlineContextMenu);
|
||||||
|
// connect(ui->m_lpCharacterList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onCharacterContextMenu);
|
||||||
|
// connect(ui->m_lpPlaceList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onPlaceContextMenu);
|
||||||
|
// connect(ui->m_lpObjectList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onObjectContextMenu);
|
||||||
|
// connect(ui->m_lpRechercheList, &QTreeView::customContextMenuRequested, this, &cMainWindow::onRechercheContextMenu);
|
||||||
|
|
||||||
|
// connect(ui->m_lpOutlineList, &cTreeView::dropped, this, &cMainWindow::onOutlineDropped);
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,9 +2,13 @@
|
|||||||
#define CMAINWINDOW_H
|
#define CMAINWINDOW_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "cpicturelibrary.h"
|
||||||
|
|
||||||
#include "cexif.h"
|
#include "cexif.h"
|
||||||
|
#include "csplashscreen.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@@ -23,9 +27,10 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
|
* @param lpSplashScreen
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
explicit cMainWindow(QWidget *parent = nullptr);
|
explicit cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent = nullptr);
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
@@ -33,8 +38,32 @@ public:
|
|||||||
~cMainWindow();
|
~cMainWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::cMainWindow* ui; /**< TODO: describe */
|
Ui::cMainWindow* ui; /**< TODO: describe */
|
||||||
cEXIFTagList m_exifTagList; /**< TODO: describe */
|
cSplashScreen* m_lpSplashScreen; /*!< Splash Screen */
|
||||||
|
cEXIFTagList m_exifTagList; /**< TODO: describe */
|
||||||
|
cPictureLibrary m_pictureLibrary; /**< TODO: describe */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief
|
||||||
|
|
||||||
|
\fn initUI
|
||||||
|
*/
|
||||||
|
void initUI();
|
||||||
|
/*!
|
||||||
|
\brief
|
||||||
|
|
||||||
|
\fn createActions
|
||||||
|
*/
|
||||||
|
void createActions();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/*!
|
||||||
|
\brief
|
||||||
|
|
||||||
|
\fn closeEvent
|
||||||
|
\param event
|
||||||
|
*/
|
||||||
|
void closeEvent(QCloseEvent* event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CMAINWINDOW_H
|
#endif // CMAINWINDOW_H
|
||||||
|
|||||||
@@ -11,10 +11,35 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>cMainWindow</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget"/>
|
<widget class="QWidget" name="centralWidget">
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QScrollArea" name="m_lpMainScrollArea">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>380</width>
|
||||||
|
<height>227</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="m_lpMainLayout"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="m_lpMenuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@@ -23,15 +48,8 @@
|
|||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu_File">
|
|
||||||
<property name="title">
|
|
||||||
<string>&File</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionE_xit"/>
|
|
||||||
</widget>
|
|
||||||
<addaction name="menu_File"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="mainToolBar">
|
<widget class="QToolBar" name="m_lpMainToolBar">
|
||||||
<attribute name="toolBarArea">
|
<attribute name="toolBarArea">
|
||||||
<enum>TopToolBarArea</enum>
|
<enum>TopToolBarArea</enum>
|
||||||
</attribute>
|
</attribute>
|
||||||
@@ -39,7 +57,7 @@
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="m_lpStatusBar"/>
|
||||||
<action name="actionE_xit">
|
<action name="actionE_xit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>E&xit</string>
|
<string>E&xit</string>
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/*!
|
||||||
|
\file common.cpp
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*!
|
||||||
|
\file common.h
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COMMON_H
|
||||||
|
#define COMMON_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
|
#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,114 @@
|
|||||||
|
#include "cpicturelibrary.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <QSqlQuery>
|
||||||
|
#include <QSqlError>
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
|
||||||
|
cPictureLibrary::cPictureLibrary(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
if(!openDatabase())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cPictureLibrary::openDatabase()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
QString szDB = settings.value("database/path").toString();
|
||||||
|
|
||||||
|
m_db = QSqlDatabase::addDatabase("QSQLITE");
|
||||||
|
m_db.setHostName("localhost");
|
||||||
|
m_db.setDatabaseName(szDB);
|
||||||
|
|
||||||
|
if(!m_db.open())
|
||||||
|
{
|
||||||
|
myDebug << m_db.lastError().text();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!m_db.tables().contains("config"))
|
||||||
|
createDatabase();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QSqlQuery query;
|
||||||
|
|
||||||
|
query.prepare("SELECT version FROM config;");
|
||||||
|
if(!query.exec())
|
||||||
|
{
|
||||||
|
myDebug << query.lastError().text();
|
||||||
|
m_db.close();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
query.next();
|
||||||
|
if(query.value("version").toInt() < 2)
|
||||||
|
updateDatabase(query.value("version").toInt());
|
||||||
|
query.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cPictureLibrary::createTable(const QString& szSQL)
|
||||||
|
{
|
||||||
|
QSqlQuery query;
|
||||||
|
|
||||||
|
query.prepare(szSQL);
|
||||||
|
|
||||||
|
if(!query.exec())
|
||||||
|
{
|
||||||
|
myDebug << szSQL << "\n" << query.lastError().text();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cPictureLibrary::createDatabase()
|
||||||
|
{
|
||||||
|
QSqlQuery query;
|
||||||
|
|
||||||
|
if(!createTable("CREATE TABLE config ( "
|
||||||
|
" version INTEGER"
|
||||||
|
"); "))
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
query.prepare("INSERT INTO config (version) VALUES (:version);");
|
||||||
|
query.bindValue(":version", 1);
|
||||||
|
if(!query.exec())
|
||||||
|
{
|
||||||
|
myDebug << query.lastError().text();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cPictureLibrary::updateDatabase(qint32 version)
|
||||||
|
{
|
||||||
|
if(version < 2)
|
||||||
|
updateDatabase2(version);
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cPictureLibrary::updateDatabase2(qint32 /*version*/)
|
||||||
|
{
|
||||||
|
QSqlQuery query;
|
||||||
|
|
||||||
|
if(!query.exec("ALTER TABLE config ADD rootPath TEXT;"))
|
||||||
|
{
|
||||||
|
myDebug << query.lastError().text();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!query.exec("UPDATE config SET version=2;"))
|
||||||
|
{
|
||||||
|
myDebug << query.lastError().text();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
#ifndef CPICTURELIBRARY_H
|
||||||
|
#define CPICTURELIBRARY_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#include <QSqlDatabase>
|
||||||
|
|
||||||
|
|
||||||
|
class cPictureLibrary : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit cPictureLibrary(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief
|
||||||
|
|
||||||
|
\fn openDatabase
|
||||||
|
\return bool
|
||||||
|
*/
|
||||||
|
bool openDatabase();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSqlDatabase m_db; /*!< TODO: describe */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief
|
||||||
|
|
||||||
|
\fn createDatabase
|
||||||
|
\return bool
|
||||||
|
*/
|
||||||
|
bool createDatabase();
|
||||||
|
/*!
|
||||||
|
\brief
|
||||||
|
|
||||||
|
\fn updateDatabase
|
||||||
|
\param version
|
||||||
|
\return bool
|
||||||
|
*/
|
||||||
|
bool updateDatabase(qint32 version);
|
||||||
|
/*!
|
||||||
|
\brief
|
||||||
|
|
||||||
|
\fn updateDatabase1
|
||||||
|
\return bool
|
||||||
|
*/
|
||||||
|
bool updateDatabase2(qint32 version);
|
||||||
|
/*!
|
||||||
|
\brief
|
||||||
|
|
||||||
|
\fn createTable
|
||||||
|
\param szSQL
|
||||||
|
\return bool
|
||||||
|
*/
|
||||||
|
bool createTable(const QString& szSQL);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CPICTURELIBRARY_H
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#include "csplashscreen.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
|
||||||
|
cSplashScreen::cSplashScreen(const QPixmap& pixmap, QFont& font) :
|
||||||
|
QSplashScreen(pixmap)
|
||||||
|
{
|
||||||
|
setFont(font);
|
||||||
|
m_textDocument.setDefaultFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cSplashScreen::drawContents(QPainter *painter)
|
||||||
|
{
|
||||||
|
painter->translate(m_rect.topLeft());
|
||||||
|
m_textDocument.setHtml(m_szMessage);
|
||||||
|
m_textDocument.drawContents(painter);
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef CSPLASHSCREEN_H
|
||||||
|
#define CSPLASHSCREEN_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <QSplashScreen>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QTextDocument>
|
||||||
|
|
||||||
|
|
||||||
|
class cSplashScreen : public QSplashScreen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cSplashScreen(const QPixmap& pixmap, QFont &font);
|
||||||
|
|
||||||
|
virtual void drawContents(QPainter *painter);
|
||||||
|
void showStatusMessage(const QString &message);
|
||||||
|
void addStatusMessage(const QString &message);
|
||||||
|
void setMessageRect(QRect rect);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTextDocument m_textDocument;
|
||||||
|
QString m_szMessage;
|
||||||
|
QRect m_rect;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CSPLASHSCREEN_H
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
|
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 |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 452 B |
|
After Width: | Height: | Size: 650 B |