File indexing completed on 2025-01-05 03:57:57
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2021-09-27 0007 * Description : Showfoto stack view favorites item 0008 * 0009 * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef SHOWFOTO_STACK_VIEW_FAVORITE_ITEM_H 0016 #define SHOWFOTO_STACK_VIEW_FAVORITE_ITEM_H 0017 0018 // Qt includes 0019 0020 #include <QString> 0021 #include <QStringList> 0022 #include <QUrl> 0023 #include <QDate> 0024 #include <QList> 0025 #include <QTreeWidget> 0026 #include <QTreeWidgetItem> 0027 0028 namespace ShowFoto 0029 { 0030 0031 class ShowfotoStackViewFavoriteItem : public QTreeWidgetItem 0032 { 0033 0034 public: 0035 0036 enum FavoriteType 0037 { 0038 FavoriteRoot = -1, ///< Favorite is root item from hierarchy. 0039 FavoriteFolder, ///< Favorite is a simple folder in hierarchy. 0040 FavoriteItem ///< Favorite is a hierarchy item including all properties. 0041 }; 0042 0043 public: 0044 0045 explicit ShowfotoStackViewFavoriteItem(QTreeWidget* const parent); 0046 ShowfotoStackViewFavoriteItem(QTreeWidgetItem* const parent, int favType); 0047 ~ShowfotoStackViewFavoriteItem() override; 0048 0049 void setName(const QString& name); 0050 QString name() const; 0051 0052 void setHierarchy(const QString& desc); 0053 QString hierarchy() const; 0054 0055 void setFavoriteType(int favoriteType); 0056 int favoriteType() const; 0057 0058 void setDescription(const QString& desc); 0059 QString description() const; 0060 0061 void setDate(const QDate& date); 0062 QDate date() const; 0063 0064 void setUrls(const QList<QUrl>&); 0065 QList<QUrl> urls() const; 0066 0067 void setCurrentUrl(const QUrl& url); 0068 QUrl currentUrl() const; 0069 0070 /** 0071 * Helper method to get a list local paths from image urls included in favorite item. 0072 */ 0073 QStringList urlsToPaths() const; 0074 0075 public: 0076 0077 /** 0078 * Helper static method to get hierarchy path from item. 'name' is the title and 'pitem" the parent instance. 0079 */ 0080 static QString hierarchyFromParent(const QString& name, ShowfotoStackViewFavoriteItem* const pitem); 0081 0082 private: 0083 0084 void updateToolTip(); 0085 Q_DISABLE_COPY(ShowfotoStackViewFavoriteItem) 0086 0087 private: 0088 0089 int m_favoriteType; 0090 QString m_hierarchy; 0091 QList<QUrl> m_urls; 0092 QString m_desc; 0093 QDate m_date; 0094 QUrl m_current; 0095 }; 0096 0097 } // namespace ShowFoto 0098 0099 #endif // SHOWFOTO_STACK_VIEW_FAVORITE_ITEM_H