File indexing completed on 2024-05-19 08:11:53
0001 /* SPDX-FileCopyrightText: 2003-2019 The KPhotoAlbum Development Team 0002 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef OVERVIEWPAGE_H 0007 #define OVERVIEWPAGE_H 0008 #include "Breadcrumb.h" 0009 #include "BrowserPage.h" 0010 0011 #include <DB/CategoryPtr.h> 0012 0013 #include <QAbstractListModel> 0014 0015 namespace AnnotationDialog 0016 { 0017 class Dialog; 0018 } 0019 namespace DB 0020 { 0021 class ImageSearchInfo; 0022 class MediaCount; 0023 } 0024 namespace Browser 0025 { 0026 0027 class BrowserWidget; 0028 0029 /** 0030 * \brief The overview page in the browser (the one containing People, Places, Show Images etc) 0031 * 0032 * See \ref Browser for a detailed description of how this fits in with the rest of the classes in this module 0033 * 0034 * The OverviewPage implements two interfaces \ref BrowserPage (with 0035 * information about the page itself) and QAbstractListModel (the model 0036 * set on the view in the Browser). 0037 * 0038 * Combining both in the same class was done mostly for convenience, the 0039 * two interfaces was to a large extend referring to the same data. 0040 */ 0041 class OverviewPage : public QAbstractListModel, public BrowserPage 0042 { 0043 public: 0044 OverviewPage(const Breadcrumb &breadcrumb, const DB::ImageSearchInfo &info, Browser::BrowserWidget *); 0045 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0046 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0047 void activate() override; 0048 BrowserPage *activateChild(const QModelIndex &) override; 0049 Qt::ItemFlags flags(const QModelIndex &index) const override; 0050 bool isSearchable() const override; 0051 Breadcrumb breadcrumb() const override; 0052 bool showDuringMovement() const override; 0053 0054 private: 0055 /** 0056 * @brief Count images/videos in each category. 0057 */ 0058 void updateImageCount(); 0059 QList<DB::CategoryPtr> categories() const; 0060 0061 bool isCategoryIndex(int row) const; 0062 bool isGeoPositionIndex(int row) const; 0063 bool isExivIndex(int row) const; 0064 bool isSearchIndex(int row) const; 0065 bool isUntaggedImagesIndex(int row) const; 0066 bool isImageIndex(int row) const; 0067 0068 QVariant categoryInfo(int row, int role) const; 0069 QVariant geoPositionInfo(int role) const; 0070 QVariant exivInfo(int role) const; 0071 QVariant searchInfo(int role) const; 0072 QVariant untaggedImagesInfo(int rolw) const; 0073 QVariant imageInfo(int role) const; 0074 0075 BrowserPage *activateExivAction(); 0076 BrowserPage *activateSearchAction(); 0077 BrowserPage *activateUntaggedImagesAction(); 0078 0079 private: 0080 QMap<int, bool> m_rowHasSubcategories; 0081 static AnnotationDialog::Dialog *s_config; 0082 Breadcrumb m_breadcrumb; 0083 }; 0084 0085 } 0086 0087 #endif /* OVERVIEWPAGE_H */ 0088 0089 // vi:expandtab:tabstop=4 shiftwidth=4: