This commit is contained in:
2020-02-06 13:57:15 +01:00
parent 14125520ef
commit 3367a8f24c
4 changed files with 79 additions and 31 deletions
+53 -10
View File
@@ -123,7 +123,7 @@ void cFileBrowser::onDirectoryChanged(const QItemSelection& selected, const QIte
m_working = false;
}
void cFileBrowser::onCountChanged(const QString& fileName, QPixmap pixmap, int count)
void cFileBrowser::onCountChanged(cFileViewer* fileViewer)
{
cFileViewer* lpFileViewer;
@@ -132,10 +132,14 @@ void cFileBrowser::onCountChanged(const QString& fileName, QPixmap pixmap, int c
lpFileViewer = static_cast<cFileViewer*>(ui->m_lpSelectedList->indexWidget(m_lpSelectedListModel->index(x, 0)));
if(lpFileViewer)
{
if(lpFileViewer->fileName() == fileName)
if(lpFileViewer->fileName() == fileViewer->fileName())
{
if(count)
lpFileViewer->setCount(count);
if(fileViewer->count())
{
disconnect(lpFileViewer, &cFileViewer::countChanged, this, &cFileBrowser::onCountChangedSelected);
lpFileViewer->setCount(fileViewer->count());
connect(lpFileViewer, &cFileViewer::countChanged, this, &cFileBrowser::onCountChangedSelected);
}
else
m_lpSelectedListModel->removeRow(x);
return;
@@ -145,11 +149,34 @@ void cFileBrowser::onCountChanged(const QString& fileName, QPixmap pixmap, int c
QStandardItem* lpItem = new QStandardItem("");
cFileViewer* lpFileViewer1 = new cFileViewer;
lpFileViewer1->setImage(fileName, pixmap);
lpFileViewer1->setCount(count);
lpFileViewer1->setImage(fileViewer->fileName(), fileViewer->image());
lpFileViewer1->setCount(fileViewer->count());
m_lpSelectedListModel->appendRow(lpItem);
ui->m_lpSelectedList->setIndexWidget(m_lpSelectedListModel->index(m_lpSelectedListModel->rowCount()-1, 0), lpFileViewer1);
connect(lpFileViewer1, &cFileViewer::countChanged, this, &cFileBrowser::onCountChangedSelected);
}
void cFileBrowser::onCountChangedSelected(cFileViewer* fileViewer)
{
cFileViewer* lpFileViewer;
for(int x = 0;x < m_lpFileListModel->rowCount();x++)
{
lpFileViewer = static_cast<cFileViewer*>(ui->m_lpFileList->indexWidget(m_lpFileListModel->index(x, 0)));
if(lpFileViewer)
{
if(lpFileViewer->fileName() == fileViewer->fileName())
{
disconnect(lpFileViewer, &cFileViewer::countChanged, this, &cFileBrowser::onCountChangedSelected);
lpFileViewer->setCount(fileViewer->count());
connect(lpFileViewer, &cFileViewer::countChanged, this, &cFileBrowser::onCountChangedSelected);
return;
}
}
}
}
void cFileBrowser::addFile(const QFileInfo& fileInfo)
@@ -171,12 +198,28 @@ void cFileBrowser::addFile(const QFileInfo& fileInfo)
painter.drawImage((THUMBNAIL_WIDTH-thumbnail.width())/2, 0, thumbnail);
QStandardItem* lpItem = new QStandardItem("");
cFileViewer* lpFileViewer = new cFileViewer;
lpFileViewer->setImage(fileInfo.filePath(), QPixmap::fromImage(thumb));
cFileViewer* lpFileViewerNew = new cFileViewer;
lpFileViewerNew->setImage(fileInfo.filePath(), QPixmap::fromImage(thumb));
m_lpFileListModel->appendRow(lpItem);
ui->m_lpFileList->setIndexWidget(m_lpFileListModel->index(m_lpFileListModel->rowCount()-1, 0), lpFileViewer);
ui->m_lpFileList->setIndexWidget(m_lpFileListModel->index(m_lpFileListModel->rowCount()-1, 0), lpFileViewerNew);
cFileViewer* lpFileViewer;
for(int x = 0;x < m_lpSelectedListModel->rowCount();x++)
{
lpFileViewer = static_cast<cFileViewer*>(ui->m_lpSelectedList->indexWidget(m_lpSelectedListModel->index(x, 0)));
if(lpFileViewer)
{
if(lpFileViewer->fileName() == lpFileViewerNew->fileName())
{
lpFileViewerNew->setCount(lpFileViewer->count());
break;
}
}
}
connect(lpFileViewerNew, &cFileViewer::countChanged, this, &cFileBrowser::onCountChanged);
connect(lpFileViewer, &cFileViewer::countChanged, this, &cFileBrowser::onCountChanged);
delete lpExif;
}
+23 -18
View File
@@ -54,25 +54,25 @@ public:
~cFileBrowser();
private:
Ui::cFileBrowser* ui; /*!< TODO: describe */
QFileSystemModel m_directoryListModel; /*!< TODO: describe */
QStandardItemModel* m_lpFileListModel; /*!< TODO: describe */
QStandardItemModel* m_lpSelectedListModel; /*!< TODO: describe */
QProgressBar* m_lpProgressBar; /*!< TODO: describe */
QList<IMAGEFORMAT>* m_lpImageFormats; /*!< TODO: describe */
Ui::cFileBrowser* ui; /*!< TODO: describe */
QFileSystemModel m_directoryListModel; /*!< TODO: describe */
QStandardItemModel* m_lpFileListModel; /*!< TODO: describe */
QStandardItemModel* m_lpSelectedListModel; /*!< TODO: describe */
QProgressBar* m_lpProgressBar; /*!< TODO: describe */
QList<IMAGEFORMAT>* m_lpImageFormats; /*!< TODO: describe */
cEXIFTagList m_exifTAGList; /*!< TODO: describe */
cEXIFCompressionList m_exifCompressionList; /*!< TODO: describe */
cEXIFLightSourceList m_exifLightSourceList; /*!< TODO: describe */
cEXIFFlashList m_exifFlashList; /*!< TODO: describe */
cEXIFTagList m_exifTAGList; /*!< TODO: describe */
cEXIFCompressionList m_exifCompressionList; /*!< TODO: describe */
cEXIFLightSourceList m_exifLightSourceList; /*!< TODO: describe */
cEXIFFlashList m_exifFlashList; /*!< TODO: describe */
cIPTCTagList m_iptcTagList; /*!< TODO: describe */
cIPTCTagList m_iptcTagList; /*!< TODO: describe */
cXMPTagList m_xmpTagList; /*!< TODO: describe */
cXMPTagList m_xmpTagList; /*!< TODO: describe */
QSqlDatabase m_cacheDB; /*!< TODO: describe */
QSqlDatabase m_cacheDB; /*!< TODO: describe */
bool m_working; /*!< TODO: describe */
bool m_working; /*!< TODO: describe */
/*!
\brief
@@ -95,11 +95,16 @@ private slots:
\brief
\fn onCountChanged
\param fileName
\param pixmap
\param count
\param fileViewer
*/
void onCountChanged(const QString& fileName, QPixmap pixmap, int count);
void onCountChanged(cFileViewer* fileViewer);
/*!
\brief
\fn onCountChangedSelected
\param fileViewer
*/
void onCountChangedSelected(cFileViewer* fileViewer);
};
#endif // CFILEBROWSER_H
+2 -2
View File
@@ -62,9 +62,9 @@ qint32 cFileViewer::count()
return(ui->m_lpCount->value());
}
void cFileViewer::onCountChanged(int i)
void cFileViewer::onCountChanged(int /*i*/)
{
emit countChanged(m_fileName, image(), i);
emit countChanged(this);
}
cFileViewer* cFileViewerList::add(const QString& fileName, const QPixmap& image)
+1 -1
View File
@@ -101,7 +101,7 @@ signals:
\param pixmap
\param i
*/
void countChanged(const QString& fileName, QPixmap pixmap, int i);
void countChanged(cFileViewer* fileViewer);
};
Q_DECLARE_METATYPE(cFileViewer*)