From fa05750b5f47695cfe619ed126964210ae4d1e9c Mon Sep 17 00:00:00 2001 From: Herwig Birke Date: Mon, 18 Feb 2019 17:39:50 +0100 Subject: [PATCH] initial commit --- cexif.h | 9 ++ cimportdialog.cpp | 93 +++++++++++---- cimportdialog.h | 51 +++++--- cimportdialog.ui | 15 ++- cmainwindow.cpp | 63 +++------- cmainwindow.h | 73 +++++------- common.cpp | 46 ++++++++ common.h | 29 ++--- cpicture.cpp | 4 +- cpicture.h | 14 ++- csplashscreen.h | 5 + cthumbnailfilterproxymodel.cpp | 3 + ctoolboxinfo.cpp | 18 +++ ctoolboxinfo.ui | 205 ++++++++++++++++++++++++++++----- 14 files changed, 452 insertions(+), 176 deletions(-) diff --git a/cexif.h b/cexif.h index 5d14f7c..0b725b5 100644 --- a/cexif.h +++ b/cexif.h @@ -186,6 +186,10 @@ Q_DECLARE_METATYPE(cEXIFTag*) class cEXIFTagList : public QList { public: + /** + * @brief + * + */ cEXIFTagList(); /** @@ -216,6 +220,11 @@ public: class cEXIFValue { public: + /** + * @brief + * + * @param lpEXIFTag + */ cEXIFValue(cEXIFTag* lpEXIFTag); /** diff --git a/cimportdialog.cpp b/cimportdialog.cpp index eecd638..6243430 100644 --- a/cimportdialog.cpp +++ b/cimportdialog.cpp @@ -27,7 +27,12 @@ cImportDialog::cImportDialog(const QString& szRootPath, QWidget *parent) : QDialog(parent), ui(new Ui::cImportDialog), m_szRootPath(szRootPath), - m_bHasImported(false) + m_lpFolderViewModel(nullptr), + m_lpThumbnailViewModel(nullptr), + m_lpThumbnailFilterProxyModel(nullptr), + m_bLoading(false), + m_bHasImported(false), + m_lpRootItem(nullptr) { initUI(); createActions(); @@ -35,6 +40,10 @@ cImportDialog::cImportDialog(const QString& szRootPath, QWidget *parent) : cImportDialog::~cImportDialog() { + delete m_lpThumbnailViewModel; + delete m_lpFolderViewModel; + delete m_lpThumbnailFilterProxyModel; + delete ui; } @@ -44,8 +53,13 @@ void cImportDialog::initUI() ui->m_lpProgress->setVisible(false); ui->m_lpImport->setEnabled(false); - m_lpImportListModel = new QStandardItemModel; - ui->m_lpImportList->setModel(m_lpImportListModel); + m_lpFolderViewModel = new QStandardItemModel; + ui->m_lpFolderView->setModel(m_lpFolderViewModel); + + m_lpThumbnailViewModel = new QStandardItemModel; + m_lpThumbnailFilterProxyModel = new cThumbnailFilterProxyModel(this); + ui->m_lpThumbnailView->setModel(m_lpThumbnailFilterProxyModel); + m_lpThumbnailFilterProxyModel->setSourceModel(m_lpThumbnailViewModel); QSettings settings; @@ -59,10 +73,12 @@ void cImportDialog::initUI() if(iX != -1 && iY != -1) move(iX, iY); - qint32 iWidth1 = settings.value("import/splitter1", QVariant::fromValue(-1)).toInt(); - qint32 iWidth2 = settings.value("import/splitter2", QVariant::fromValue(-1)).toInt(); + qint32 iWidth1 = settings.value("main/splitter1", QVariant::fromValue(-1)).toInt(); + qint32 iWidth2 = settings.value("main/splitter2", QVariant::fromValue(-1)).toInt(); + qint32 iWidth3 = settings.value("main/splitter3", QVariant::fromValue(-1)).toInt(); + + ui->m_lpSplitter->setSizes(QList() << iWidth1 << iWidth2 << iWidth3); - ui->m_lpSplitter->setSizes(QList() << iWidth1 << iWidth2); ui->m_lpPath->setText(settings.value("import/path", QDir::homePath()).toString()); ui->m_lpRecursive->setChecked(settings.value("import/recursive", QVariant::fromValue(true)).toBool()); @@ -81,10 +97,11 @@ bool cImportDialog::hasImported() void cImportDialog::createActions() { - connect(ui->m_lpPathSelect, &QPushButton::clicked, this, &cImportDialog::onPathSelect); - connect(ui->m_lpRead, &QPushButton::clicked, this, &cImportDialog::onRead); - connect(ui->m_lpImport, &QPushButton::clicked, this, &cImportDialog::onImport); - connect(ui->m_lpImportList->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cImportDialog::onThumbnailSelected); + connect(ui->m_lpPathSelect, &QPushButton::clicked, this, &cImportDialog::onPathSelect); + connect(ui->m_lpRead, &QPushButton::clicked, this, &cImportDialog::onRead); + connect(ui->m_lpImport, &QPushButton::clicked, this, &cImportDialog::onImport); + connect(ui->m_lpThumbnailView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cImportDialog::onThumbnailSelected); + connect(ui->m_lpFolderView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cImportDialog::onFolderSelected); } void cImportDialog::onPathSelect() @@ -103,25 +120,40 @@ void cImportDialog::onPathSelect() void cImportDialog::onThumbnailSelected(const QItemSelection& /*selection*/, const QItemSelection& /*previous*/) { cToolBoxInfo* lpToolBoxInfo = ui->m_lpInfo; - qint32 iCount = ui->m_lpImportList->selectionModel()->selectedRows().count(); - ui->m_lpCount->setText(QString("count: %1, selected: %2").arg(m_lpImportListModel->rowCount()).arg(iCount)); + qint32 iCount = ui->m_lpThumbnailView->selectionModel()->selectedRows().count(); + ui->m_lpCount->setText(QString("count: %1, selected: %2").arg(m_lpThumbnailViewModel->rowCount()).arg(iCount)); if(iCount) ui->m_lpImport->setEnabled(true); else ui->m_lpImport->setEnabled(false); - if(ui->m_lpImportList->selectionModel()->selectedIndexes().count() != 1) + if(ui->m_lpThumbnailView->selectionModel()->selectedIndexes().count() != 1) { lpToolBoxInfo->setPicture(nullptr); return; } - QStandardItem* lpItem = m_lpImportListModel->itemFromIndex(ui->m_lpImportList->currentIndex()); - cPicture* lpPicture = lpItem->data().value(); + QModelIndex index = ui->m_lpThumbnailView->selectionModel()->selectedIndexes()[0]; + if(!index.isValid()) + return; + + cPicture* lpPicture = m_lpThumbnailFilterProxyModel->data(index, Qt::UserRole+1).value(); lpToolBoxInfo->setPicture(lpPicture); } +void cImportDialog::onFolderSelected(const QItemSelection& /*selection*/, const QItemSelection& /*previous*/) +{ + if(m_bLoading) + return; + + QStandardItem* lpItem = m_lpFolderViewModel->itemFromIndex(ui->m_lpFolderView->currentIndex()); + if(!lpItem) + return; + + m_lpThumbnailFilterProxyModel->setFilterPath(lpItem->data(Qt::UserRole+2).toString()); +} + void cImportDialog::accept() { savePosition(); @@ -146,7 +178,7 @@ void cImportDialog::savePosition() QList sizes = ui->m_lpSplitter->sizes(); for(int x = 0;x < sizes.count();x++) - settings.setValue(QString("import/splitter%1").arg(x+1), QVariant::fromValue(sizes[x])); + settings.setValue(QString("main/splitter%1").arg(x+1), QVariant::fromValue(sizes[x])); settings.setValue("import/recursive", QVariant::fromValue(ui->m_lpRecursive->isChecked())); settings.setValue("import/copy", QVariant::fromValue(ui->m_lpCopy->isChecked())); @@ -156,21 +188,34 @@ void cImportDialog::savePosition() void cImportDialog::onRead() { + if(m_bLoading) + return; + if(ui->m_lpPath->text().isEmpty()) { QMessageBox::critical(this, tr("Error"), tr("no path given!")); return; } - m_lpImportListModel->clear(); + m_bLoading = true; + + m_lpFolderViewModel->clear(); + m_lpThumbnailViewModel->clear(); ui->m_lpImport->setEnabled(false); + m_lpRootItem = new QStandardItem("library"); + m_lpFolderViewModel->appendRow(m_lpRootItem); + readDirectory(ui->m_lpPath->text(), ui->m_lpRecursive->isChecked()); + + ui->m_lpFolderView->expandAll(); + + m_bLoading = false; } void cImportDialog::onImport() { - QModelIndexList selected = ui->m_lpImportList->selectionModel()->selectedRows(); + QModelIndexList selected = ui->m_lpThumbnailView->selectionModel()->selectedRows(); QDir dir; QFile file; @@ -179,7 +224,7 @@ void cImportDialog::onImport() for(int x = 0;x < selected.count();x++) { - QStandardItem* lpItem = m_lpImportListModel->itemFromIndex(selected[x]); + QStandardItem* lpItem = m_lpThumbnailViewModel->itemFromIndex(selected[x]); if(lpItem) { @@ -214,7 +259,7 @@ void cImportDialog::onImport() ui->m_lpProgress->setValue(x); qApp->processEvents(); - lpPicture->setFilePath(szDestPath.left(szDestPath.length()-1)); + lpPicture->setFilePath(szDestPath.left(szDestPath.length()-1).replace("\\", "/")); lpPicture->toDB(); if(ui->m_lpMove->isChecked()) @@ -297,10 +342,14 @@ void cImportDialog::readDirectory(const QString& szPath, bool bRecursive) QStandardItem* lpItem = new QStandardItem(icon, lpPicture->fileName()); lpItem->setTextAlignment(Qt::AlignCenter); lpItem->setData(QVariant::fromValue(lpPicture)); - m_lpImportListModel->appendRow(lpItem); + lpItem->setData(QVariant::fromValue(lpPicture->filePath()), Qt::UserRole+2); + m_lpThumbnailViewModel->appendRow(lpItem); + + insertPath(lpPicture->filePath(), m_lpRootItem); + qApp->processEvents(); - ui->m_lpCount->setText(QString("count: %1, selected: %2").arg(m_lpImportListModel->rowCount()).arg(ui->m_lpImportList->selectionModel()->selectedRows().count())); + ui->m_lpCount->setText(QString("count: %1, selected: %2").arg(m_lpThumbnailViewModel->rowCount()).arg(ui->m_lpThumbnailView->selectionModel()->selectedRows().count())); } } } diff --git a/cimportdialog.h b/cimportdialog.h index 96d41d1..f0ccdf2 100644 --- a/cimportdialog.h +++ b/cimportdialog.h @@ -7,6 +7,8 @@ #include #include +#include "cthumbnailfilterproxymodel.h" + namespace Ui { class cImportDialog; @@ -38,7 +40,7 @@ public: * * @return bool */ - bool hasImported(); + bool hasImported(); private slots: /*! @@ -46,35 +48,56 @@ private slots: \fn onPathSelect */ - void onPathSelect(); + void onPathSelect(); /*! \brief \fn onRead */ - void onRead(); + void onRead(); /*! \brief \fn onImport */ - void onImport(); + void onImport(); /*! \brief \param selection \param previous \fn onThumbnailSelected */ - void onThumbnailSelected(const QItemSelection& selection, const QItemSelection& previous); + void onThumbnailSelected(const QItemSelection& selection, const QItemSelection& previous); + /*! + \brief + \param selection + \param previous + \fn onThumbnailSelected + */ + void onFolderSelected(const QItemSelection& selection, const QItemSelection& previous); private: - Ui::cImportDialog* ui; /**< TODO: describe */ - QString m_szRootPath; /**< TODO: describe */ - QStandardItemModel* m_lpImportListModel; /**< TODO: describe */ - bool m_bHasImported; /**< TODO: describe */ + Ui::cImportDialog* ui; /**< TODO: describe */ + QString m_szRootPath; /**< TODO: describe */ + QStandardItemModel* m_lpFolderViewModel; /**< TODO: describe */ + QStandardItemModel* m_lpThumbnailViewModel; /**< TODO: describe */ + cThumbnailFilterProxyModel* m_lpThumbnailFilterProxyModel; /**< TODO: describe */ + bool m_bLoading; /**< TODO: describe */ + bool m_bHasImported; /**< TODO: describe */ + QStandardItem* m_lpRootItem; /**< TODO: describe */ - void initUI(); - void createActions(); + /*! + \brief + + \fn initUI + */ + void initUI(); + /*! + \brief + + \fn createActions + */ + void createActions(); /** * @brief @@ -82,18 +105,18 @@ private: * @param szPath * @param bRecursive */ - void readDirectory(const QString& szPath, bool bRecursive); + void readDirectory(const QString& szPath, bool bRecursive); /** * @brief * */ - void accept(); + void accept(); /** * @brief * */ - void reject(); + void reject(); /** * @brief diff --git a/cimportdialog.ui b/cimportdialog.ui index 7eee2f3..6dd6bd5 100644 --- a/cimportdialog.ui +++ b/cimportdialog.ui @@ -6,8 +6,8 @@ 0 0 - 449 - 328 + 697 + 510 @@ -147,7 +147,12 @@ Qt::Horizontal - + + + false + + + QAbstractItemView::ExtendedSelection @@ -183,7 +188,7 @@ 0 0 69 - 134 + 316 @@ -200,7 +205,7 @@ - TextLabel + diff --git a/cmainwindow.cpp b/cmainwindow.cpp index 0ab0736..ed5fdb6 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -42,6 +42,9 @@ cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) : cMainWindow::~cMainWindow() { delete m_lpThumbnailViewModel; + delete m_lpFolderViewModel; + delete m_lpThumbnailFilterProxyModel; + delete ui; } @@ -53,7 +56,6 @@ void cMainWindow::initUI() ui->m_lpFolderView->setModel(m_lpFolderViewModel); m_lpThumbnailViewModel = new QStandardItemModel; -// ui->m_lpThumbnailView->setModel(m_lpThumbnailViewModel); m_lpThumbnailFilterProxyModel = new cThumbnailFilterProxyModel(this); ui->m_lpThumbnailView->setModel(m_lpThumbnailFilterProxyModel); m_lpThumbnailFilterProxyModel->setSourceModel(m_lpThumbnailViewModel); @@ -132,7 +134,7 @@ void cMainWindow::loadData(bool bProgressBar) lpItem->setData(QVariant::fromValue(m_pictureList[x]->filePath()), Qt::UserRole+2); m_lpThumbnailViewModel->appendRow(lpItem); - insertPath(m_pictureList[x]->filePath()); + insertPath(m_pictureList[x]->filePath(), m_lpRootItem); } ui->m_lpFolderView->expandAll(); @@ -140,51 +142,6 @@ void cMainWindow::loadData(bool bProgressBar) m_bLoading = false; } -void cMainWindow::insertPath(QString szPath) -{ - if(!m_lpRootItem) - return; - - QString szPath1 = szPath.replace("\\", "/"); - QStringList szPathList = szPath1.split("/"); - QStandardItem* lpCurRoot = m_lpRootItem; - int path; - bool bFound; - - szPath1 = ""; - - for(path = 0;path < szPathList.count();path++) - { - bFound = false; - for(int x = 0;x < lpCurRoot->rowCount();x++) - { - QStandardItem* lpCurItem = lpCurRoot->child(x, 0); - - if(!lpCurItem->text().compare(szPathList[path], Qt::CaseInsensitive)) - { - lpCurRoot = lpCurItem; - bFound = true; - break; - } - } - - if(!bFound) - break; - - szPath1.append(szPathList[path]+QDir::separator()); - } - - for(;path < szPathList.count();path++) - { - szPath1.append(szPathList[path]); - QStandardItem* lpNewItem = new QStandardItem(szPathList[path]); - lpCurRoot->appendRow(lpNewItem); - lpNewItem->setData(QVariant::fromValue(szPath1), Qt::UserRole+2); - szPath1.append(QDir::separator()); - lpCurRoot = lpNewItem; - } -} - void cMainWindow::closeEvent(QCloseEvent *event) { QSettings settings; @@ -252,9 +209,15 @@ void cMainWindow::onThumbnailSelected(const QItemSelection& /*selection*/, const return; } - QStandardItem* lpItem = m_lpThumbnailViewModel->itemFromIndex(ui->m_lpThumbnailView->currentIndex()); - cPicture* lpPicture = lpItem->data().value(); - lpToolBoxInfo->setPicture(lpPicture); + for(int x = 0;x < ui->m_lpThumbnailView->selectionModel()->selectedIndexes().count();x++) + { + QModelIndex index = ui->m_lpThumbnailView->selectionModel()->selectedIndexes()[x]; + if(!index.isValid()) + return; + + cPicture* lpPicture = m_lpThumbnailFilterProxyModel->data(index, Qt::UserRole+1).value(); + lpToolBoxInfo->setPicture(lpPicture); + } } void cMainWindow::onFolderSelected(const QItemSelection& /*selection*/, const QItemSelection& /*previous*/) diff --git a/cmainwindow.h b/cmainwindow.h index d7aeca0..18276fb 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -51,50 +51,50 @@ public: ~cMainWindow(); private: - Ui::cMainWindow* ui; /**< TODO: describe */ - QProgressBar* m_lpProgressBar; /**< TODO: describe */ - QStandardItemModel* m_lpFolderViewModel; /**< TODO: describe */ - QStandardItemModel* m_lpThumbnailViewModel; /**< TODO: describe */ - cThumbnailFilterProxyModel* m_lpThumbnailFilterProxyModel; /**< TODO: describe */ - QStandardItem* m_lpRootItem; /**< TODO: describe */ + Ui::cMainWindow* ui; /**< TODO: describe */ + QProgressBar* m_lpProgressBar; /**< TODO: describe */ + QStandardItemModel* m_lpFolderViewModel; /**< TODO: describe */ + QStandardItemModel* m_lpThumbnailViewModel; /**< TODO: describe */ + cThumbnailFilterProxyModel* m_lpThumbnailFilterProxyModel; /**< TODO: describe */ + QStandardItem* m_lpRootItem; /**< TODO: describe */ - bool m_bLoading; /**< TODO: describe */ + bool m_bLoading; /**< TODO: describe */ - cSplashScreen* m_lpSplashScreen; /*!< Splash Screen */ - cPictureLibrary m_pictureLibrary; /**< TODO: describe */ - cPictureList m_pictureList; /**< TODO: describe */ + cSplashScreen* m_lpSplashScreen; /*!< Splash Screen */ + cPictureLibrary m_pictureLibrary; /**< TODO: describe */ + cPictureList m_pictureList; /**< TODO: describe */ - QMenu* m_lpFileMenu; /*!< Pointer to the file menu */ + QMenu* m_lpFileMenu; /*!< Pointer to the file menu */ - QToolBar* m_lpFileToolBar; /*!< Pointer to the file toolbar */ + QToolBar* m_lpFileToolBar; /*!< Pointer to the file toolbar */ - QAction* m_lpFileNewAction; /*!< TODO: describe */ - QAction* m_lpFileOpenAction; /*!< TODO: describe */ - QAction* m_lpFileImportAction; /*!< TODO: describe */ - QAction* m_lpFileQuitAction; /*!< TODO: describe */ + QAction* m_lpFileNewAction; /*!< TODO: describe */ + QAction* m_lpFileOpenAction; /*!< TODO: describe */ + QAction* m_lpFileImportAction; /*!< TODO: describe */ + QAction* m_lpFileQuitAction; /*!< TODO: describe */ - QAction* m_lpSeparatorRecent; /*!< TODO: describe */ - enum { MaxRecentFiles = 5 }; /*!< TODO: describe */ - QAction* m_lpRecentFileAction[MaxRecentFiles]; /*!< TODO: describe */ + QAction* m_lpSeparatorRecent; /*!< TODO: describe */ + enum { MaxRecentFiles = 5 }; /*!< TODO: describe */ + QAction* m_lpRecentFileAction[MaxRecentFiles]; /*!< TODO: describe */ /*! \brief \fn initUI */ - void initUI(); + void initUI(); /*! \brief \fn createActions */ - void createActions(); + void createActions(); /*! \brief \fn createFileActions */ - void createFileActions(); + void createFileActions(); /*! \brief @@ -102,35 +102,26 @@ private: \fn setCurrentFile \param szFileName */ - void setCurrentFile(const QString& szFileName); + void setCurrentFile(const QString& szFileName); /*! \brief \fn updateRecentFileActions */ - void updateRecentFileActions(); + void updateRecentFileActions(); /*! \brief \fn openRecentFile */ - void openRecentFile(); + void openRecentFile(); /*! \brief \fn loadData */ - void loadData(bool bProgressBar = false); - - /*! - \brief - - \param szPath - \param lpItem - \fn insertPath - */ - void insertPath(QString szPath); + void loadData(bool bProgressBar = false); protected: /*! @@ -139,7 +130,7 @@ protected: \fn closeEvent \param event */ - void closeEvent(QCloseEvent* event); + void closeEvent(QCloseEvent* event); private slots: /*! @@ -148,32 +139,32 @@ private slots: \param previous \fn onThumbnailSelected */ - void onThumbnailSelected(const QItemSelection& selection, const QItemSelection& previous); + void onThumbnailSelected(const QItemSelection& selection, const QItemSelection& previous); /*! \brief \param selection \param previous \fn onThumbnailSelected */ - void onFolderSelected(const QItemSelection& selection, const QItemSelection& previous); + void onFolderSelected(const QItemSelection& selection, const QItemSelection& previous); /*! \brief \fn onFileNew */ - void onFileNew(); + void onFileNew(); /*! \brief \fn onFileOpen */ - void onFileOpen(); + void onFileOpen(); /*! \brief \fn onFileImport */ - void onFileImport(); + void onFileImport(); }; #endif // CMAINWINDOW_H diff --git a/common.cpp b/common.cpp index dc07271..2df8eca 100644 --- a/common.cpp +++ b/common.cpp @@ -6,6 +6,7 @@ #include "common.h" #include +#include QImage blob2Image(const QByteArray& ba) @@ -31,3 +32,48 @@ QByteArray image2Blob(const QImage &image) return(ba); } + +void insertPath(QString szPath, QStandardItem* lpRootItem) +{ + if(!lpRootItem) + return; + + QString szPath1 = szPath.replace("\\", "/"); + QStringList szPathList = szPath1.split("/"); + QStandardItem* lpCurRoot = lpRootItem; + int path; + bool bFound; + + szPath1 = ""; + + for(path = 0;path < szPathList.count();path++) + { + bFound = false; + for(int x = 0;x < lpCurRoot->rowCount();x++) + { + QStandardItem* lpCurItem = lpCurRoot->child(x, 0); + + if(!lpCurItem->text().compare(szPathList[path], Qt::CaseInsensitive)) + { + lpCurRoot = lpCurItem; + bFound = true; + break; + } + } + + if(!bFound) + break; + + szPath1.append(szPathList[path]+QDir::separator()); + } + + for(;path < szPathList.count();path++) + { + szPath1.append(szPathList[path]); + QStandardItem* lpNewItem = new QStandardItem(szPathList[path]); + lpCurRoot->appendRow(lpNewItem); + lpNewItem->setData(QVariant::fromValue(szPath1), Qt::UserRole+2); + szPath1.append(QDir::separator()); + lpCurRoot = lpNewItem; + } +} diff --git a/common.h b/common.h index 6a942a3..e9d8e23 100644 --- a/common.h +++ b/common.h @@ -9,6 +9,7 @@ #include #include +#include #include @@ -25,22 +26,22 @@ #define myDebug qDebug() << __FILE__ << "(" << __LINE__ << ") - " << __FUNCTION__ << ":" #endif -/*! - \brief - - \fn blob2Image - \param ba - \return QPixmap -*/ +/** + * @brief + * + * @param ba + * @return QImage + */ QImage blob2Image(const QByteArray& ba); -/*! - \brief - - \fn image2Blob - \param image - \return QByteArray -*/ +/** + * @brief + * + * @param image + * @return QByteArray + */ QByteArray image2Blob(const QImage& image); +void insertPath(QString szPath, QStandardItem* lpRootItem); + #endif // COMMON_H diff --git a/cpicture.cpp b/cpicture.cpp index 74b2e20..b8d3ff0 100644 --- a/cpicture.cpp +++ b/cpicture.cpp @@ -471,7 +471,7 @@ bool cPictureList::load(cSplashScreen *lpSplashScreen, QProgressBar *lpProgressB } qint32 count = 0; - qint32 step = max/50; + qint32 step = max/200; while(query.next()) { @@ -503,7 +503,7 @@ bool cPictureList::load(cSplashScreen *lpSplashScreen, QProgressBar *lpProgressB lpPicture->setThumbnail(blob2Image(query.value("thumbnail").toByteArray())); count++; - if(count % step) + if(!(count % step)) { if(lpProgressBar) lpProgressBar->setValue(count); diff --git a/cpicture.h b/cpicture.h index 3904f87..750c7c4 100644 --- a/cpicture.h +++ b/cpicture.h @@ -39,12 +39,15 @@ public: /** * @brief * - * @param db - * @param iID * @return bool */ bool toDB(); + /** + * @brief + * + * @param id + */ void setID(const qint32& id); /** * @brief @@ -428,6 +431,13 @@ public: */ explicit cPictureList(QObject *parent = nullptr); + /** + * @brief + * + * @param lpSplashScreen + * @param lpProgressBar + * @return bool + */ bool load(cSplashScreen* lpSplashScreen, QProgressBar* lpProgressBar = 0); /** diff --git a/csplashscreen.h b/csplashscreen.h index 6d9d325..72c09b9 100644 --- a/csplashscreen.h +++ b/csplashscreen.h @@ -41,6 +41,11 @@ public: */ void setMessageRect(QRect rect); + /** + * @brief + * + * @param max + */ void setMax(qint32 max); private: diff --git a/cthumbnailfilterproxymodel.cpp b/cthumbnailfilterproxymodel.cpp index 27a0431..a969b29 100644 --- a/cthumbnailfilterproxymodel.cpp +++ b/cthumbnailfilterproxymodel.cpp @@ -9,6 +9,8 @@ cThumbnailFilterProxyModel::cThumbnailFilterProxyModel(QObject* parent) : void cThumbnailFilterProxyModel::setFilterPath(const QString &szPath) { m_szPath = szPath; + m_szPath.replace("\\", "/"); + invalidateFilter(); } @@ -20,5 +22,6 @@ QString cThumbnailFilterProxyModel::filterPath() bool cThumbnailFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent); + QString tmp = sourceModel()->data(index0, Qt::UserRole+2).toString(); return(sourceModel()->data(index0, Qt::UserRole+2).toString().contains(m_szPath)); } diff --git a/ctoolboxinfo.cpp b/ctoolboxinfo.cpp index c9e42fc..c54351c 100644 --- a/ctoolboxinfo.cpp +++ b/ctoolboxinfo.cpp @@ -19,14 +19,32 @@ void cToolBoxInfo::setPicture(cPicture* lpPicture) if(!lpPicture) { ui->m_lpFileName->setText("---"); + ui->m_lpPath->setText("---"); ui->m_lpDate->setText("---"); ui->m_lpSize->setText("---"); ui->m_lpCamera->setText("---"); + ui->m_lpLensModel->setText("---"); + ui->m_lpFNumber->setText("---"); + ui->m_lpExposureTime->setText("---"); + ui->m_lpExposureBias->setText("---"); + ui->m_lpISO->setText("---"); + ui->m_lpFocalLength->setText("---"); + ui->m_lpFlash->setText("---"); + ui->m_lpGPS->setText("---"); return; } ui->m_lpFileName->setText(lpPicture->fileName()); + ui->m_lpPath->setText(lpPicture->filePath()); 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_lpLensModel->setText(lpPicture->lensModel()); + ui->m_lpFNumber->setText("f 1:" + lpPicture->fNumber()); + ui->m_lpExposureTime->setText(lpPicture->exposureTime()); + ui->m_lpExposureBias->setText(QString::number(lpPicture->exposureBias())); + ui->m_lpISO->setText(QString::number(lpPicture->iso())); + ui->m_lpFocalLength->setText(QString("%1 mm").arg(lpPicture->focalLength())); + ui->m_lpFlash->setText(lpPicture->flash()); + ui->m_lpGPS->setText(lpPicture->gps()); } diff --git a/ctoolboxinfo.ui b/ctoolboxinfo.ui index 2f8adad..c1e266c 100644 --- a/ctoolboxinfo.ui +++ b/ctoolboxinfo.ui @@ -7,7 +7,7 @@ 0 0 261 - 163 + 322 @@ -16,40 +16,68 @@ - - + + - size: + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + focal length: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - filename: + flash: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - date: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - camera: + ISO: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -66,7 +94,101 @@ - + + + + + + + + + + + filename: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + F-number: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + camera: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + date: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + exposure time: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + exposure bias: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + lens model: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + @@ -76,20 +198,51 @@ - - + + + + + + + + + + + path: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + - + - - true + + + + + + GPS: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + +