From b11d4d19e53bddb1a3873d99fafec8646f897abc Mon Sep 17 00:00:00 2001 From: birkeh Date: Mon, 1 Apr 2019 21:43:52 +0200 Subject: [PATCH] title filter --- cmainwindow.cpp | 11 ++++++++++- cthumbnailsortfilterproxymodel.cpp | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cmainwindow.cpp b/cmainwindow.cpp index e8d2b0c..ad0344d 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -55,7 +55,7 @@ cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) : QSettings settings; m_szOldPath = settings.value("file/lastPath", QDir::homePath()).toString(); m_pictureLibrary.openDatabase(m_szOldPath); - loadData(true); + loadData(false); updateRecentFileActions(); showCount(); @@ -709,6 +709,7 @@ void cMainWindow::onChangeTitle() } m_lpFolderSortFilterProxyModel->sort(0); m_lpThumbnailSortFilterProxyModel->invalidate(); + showCount(); } void cMainWindow::onChangeDate() @@ -766,6 +767,7 @@ void cMainWindow::onChangeDate() } m_lpFolderSortFilterProxyModel->sort(0); m_lpThumbnailSortFilterProxyModel->invalidate(); + showCount(); } void cMainWindow::onChangeDateTime() @@ -806,6 +808,7 @@ void cMainWindow::onChangeDateTime() m_lpThumbnailSortFilterProxyModel->invalidate(); } + showCount(); } } @@ -898,6 +901,7 @@ void cMainWindow::onTagEdited(cTag* /*lpTag*/) void cMainWindow::onTagListChanged() { m_lpFilterPanel->updateTagList(); + showCount(); } void cMainWindow::onPersonAdded(cPerson* /*lpPerson*/) @@ -915,6 +919,7 @@ void cMainWindow::onPersonEdited(cPerson* /*lpPerson*/) void cMainWindow::onPersonListChanged() { m_lpFilterPanel->updatePersonList(); + showCount(); } void cMainWindow::onLocationAdded(cLocation* /*lpLocation*/) @@ -940,6 +945,7 @@ void cMainWindow::onFilterTitleChanged(QStringList titleList) return; m_lpThumbnailSortFilterProxyModel->setTitleList(titleList); + showCount(); } void cMainWindow::onFilterPersonChanged(QList idList, bool bAnd) @@ -948,6 +954,7 @@ void cMainWindow::onFilterPersonChanged(QList idList, bool bAnd) return; m_lpThumbnailSortFilterProxyModel->setPersonList(idList, bAnd); + showCount(); } void cMainWindow::onFilterLocationChanged(QList idList, bool bAnd) @@ -956,6 +963,7 @@ void cMainWindow::onFilterLocationChanged(QList idList, bool bAnd) return; m_lpThumbnailSortFilterProxyModel->setLocationList(idList, bAnd); + showCount(); } void cMainWindow::onFilterTagChanged(QList idList, bool bAnd) @@ -964,4 +972,5 @@ void cMainWindow::onFilterTagChanged(QList idList, bool bAnd) return; m_lpThumbnailSortFilterProxyModel->setTagList(idList, bAnd); + showCount(); } diff --git a/cthumbnailsortfilterproxymodel.cpp b/cthumbnailsortfilterproxymodel.cpp index c7921b9..e557560 100644 --- a/cthumbnailsortfilterproxymodel.cpp +++ b/cthumbnailsortfilterproxymodel.cpp @@ -33,6 +33,8 @@ QStringList cThumbnailSortFilterProxyModel::titleList() void cThumbnailSortFilterProxyModel::setTitleList(const QStringList& titleList) { m_titleList = titleList; + + invalidateFilter(); } QList cThumbnailSortFilterProxyModel::personList() @@ -103,7 +105,7 @@ bool cThumbnailSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QMode if(!bValid) return(false); - if(!m_titleList.contains(lpPicture->title())) + if(!m_titleList.contains(lpPicture->title()) && !m_titleList.isEmpty()) return(false); if(!m_personList.isEmpty())