initial commit
This commit is contained in:
@@ -186,6 +186,10 @@ Q_DECLARE_METATYPE(cEXIFTag*)
|
||||
class cEXIFTagList : public QList<cEXIFTag*>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
cEXIFTagList();
|
||||
|
||||
/**
|
||||
@@ -216,6 +220,11 @@ public:
|
||||
class cEXIFValue
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param lpEXIFTag
|
||||
*/
|
||||
cEXIFValue(cEXIFTag* lpEXIFTag);
|
||||
|
||||
/**
|
||||
|
||||
+71
-22
@@ -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<int>() << iWidth1 << iWidth2 << iWidth3);
|
||||
|
||||
ui->m_lpSplitter->setSizes(QList<int>() << 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<cPicture*>();
|
||||
QModelIndex index = ui->m_lpThumbnailView->selectionModel()->selectedIndexes()[0];
|
||||
if(!index.isValid())
|
||||
return;
|
||||
|
||||
cPicture* lpPicture = m_lpThumbnailFilterProxyModel->data(index, Qt::UserRole+1).value<cPicture*>();
|
||||
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<qint32> 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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+37
-14
@@ -7,6 +7,8 @@
|
||||
#include <QCloseEvent>
|
||||
#include <QItemSelection>
|
||||
|
||||
#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
|
||||
|
||||
+10
-5
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>449</width>
|
||||
<height>328</height>
|
||||
<width>697</width>
|
||||
<height>510</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -147,7 +147,12 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QListView" name="m_lpImportList">
|
||||
<widget class="QTreeView" name="m_lpFolderView">
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QListView" name="m_lpThumbnailView">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
@@ -183,7 +188,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>69</width>
|
||||
<height>134</height>
|
||||
<height>316</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@@ -200,7 +205,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpCount">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
+13
-50
@@ -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<cPicture*>();
|
||||
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<cPicture*>();
|
||||
lpToolBoxInfo->setPicture(lpPicture);
|
||||
}
|
||||
}
|
||||
|
||||
void cMainWindow::onFolderSelected(const QItemSelection& /*selection*/, const QItemSelection& /*previous*/)
|
||||
|
||||
+32
-41
@@ -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
|
||||
|
||||
+46
@@ -6,6 +6,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QDir>
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <QImage>
|
||||
#include <QByteArray>
|
||||
#include <QStandardItem>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+12
-2
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,11 @@ public:
|
||||
*/
|
||||
void setMessageRect(QRect rect);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param max
|
||||
*/
|
||||
void setMax(qint32 max);
|
||||
|
||||
private:
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
+179
-26
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>261</width>
|
||||
<height>163</height>
|
||||
<height>322</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -16,40 +16,68 @@
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="m_lpPath">
|
||||
<property name="text">
|
||||
<string>size:</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="m_lpLensModel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="m_lpCamera">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="m_lpFocalLength">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="m_lpFNumber">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>focal length:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>filename:</string>
|
||||
<string>flash:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>date:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>camera:</string>
|
||||
<string>ISO:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -66,7 +94,101 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="m_lpExposureTime">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>filename:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>F-number:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>camera:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>size:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>date:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>exposure time:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>exposure bias:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>lens model:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="m_lpFlash">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="m_lpSize">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@@ -76,20 +198,51 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="m_lpDate">
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="m_lpExposureBias">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>path:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="m_lpISO">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="m_lpCamera">
|
||||
<widget class="QLabel" name="m_lpDate">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>GPS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QLabel" name="m_lpGPS">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user