digiKam
showfotostackviewfavoriteitem.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2021-09-27
7  * Description : Showfoto stack view favorites item
8  *
9  * Copyright (C) 2021-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef SHOWFOTO_STACK_VIEW_FAVORITE_ITEM_H
25 #define SHOWFOTO_STACK_VIEW_FAVORITE_ITEM_H
26 
27 // Qt includes
28 
29 #include <QString>
30 #include <QStringList>
31 #include <QUrl>
32 #include <QDate>
33 #include <QList>
34 #include <QTreeWidget>
35 #include <QTreeWidgetItem>
36 
37 namespace ShowFoto
38 {
39 
40 class ShowfotoStackViewFavoriteItem : public QTreeWidgetItem
41 {
42 
43 public:
44 
46  {
47  FavoriteRoot = -1,
50  };
51 
52 public:
53 
54  explicit ShowfotoStackViewFavoriteItem(QTreeWidget* const parent);
55  ShowfotoStackViewFavoriteItem(QTreeWidgetItem* const parent, int favType);
57 
58  void setName(const QString& name);
59  QString name() const;
60 
61  void setHierarchy(const QString& desc);
62  QString hierarchy() const;
63 
64  void setFavoriteType(int favoriteType);
65  int favoriteType() const;
66 
67  void setDescription(const QString& desc);
68  QString description() const;
69 
70  void setDate(const QDate& date);
71  QDate date() const;
72 
73  void setUrls(const QList<QUrl>&);
74  QList<QUrl> urls() const;
75 
76  void setCurrentUrl(const QUrl& url);
77  QUrl currentUrl() const;
78 
82  QStringList urlsToPaths() const;
83 
84 public:
85 
89  static QString hierarchyFromParent(const QString& name, ShowfotoStackViewFavoriteItem* const pitem);
90 
91 private:
92 
93  void updateToolTip();
94  Q_DISABLE_COPY(ShowfotoStackViewFavoriteItem)
95 
96 private:
97 
98  int m_favoriteType;
99  QString m_hierarchy;
100  QList<QUrl> m_urls;
101  QString m_desc;
102  QDate m_date;
103  QUrl m_current;
104 };
105 
106 } // namespace ShowFoto
107 
108 #endif // SHOWFOTO_STACK_VIEW_FAVORITE_ITEM_H
Definition: showfotostackviewfavoriteitem.h:41
QDate date() const
Definition: showfotostackviewfavoriteitem.cpp:156
QUrl currentUrl() const
Definition: showfotostackviewfavoriteitem.cpp:178
QString name() const
Definition: showfotostackviewfavoriteitem.cpp:84
int favoriteType() const
Definition: showfotostackviewfavoriteitem.cpp:132
void setUrls(const QList< QUrl > &)
Definition: showfotostackviewfavoriteitem.cpp:161
ShowfotoStackViewFavoriteItem(QTreeWidget *const parent)
Definition: showfotostackviewfavoriteitem.cpp:45
void setFavoriteType(int favoriteType)
Definition: showfotostackviewfavoriteitem.cpp:99
~ShowfotoStackViewFavoriteItem() override
Definition: showfotostackviewfavoriteitem.cpp:61
QStringList urlsToPaths() const
Definition: showfotostackviewfavoriteitem.cpp:188
QList< QUrl > urls() const
Definition: showfotostackviewfavoriteitem.cpp:168
void setDate(const QDate &date)
Definition: showfotostackviewfavoriteitem.cpp:149
void setHierarchy(const QString &desc)
Definition: showfotostackviewfavoriteitem.cpp:89
static QString hierarchyFromParent(const QString &name, ShowfotoStackViewFavoriteItem *const pitem)
Definition: showfotostackviewfavoriteitem.cpp:72
FavoriteType
Definition: showfotostackviewfavoriteitem.h:46
@ FavoriteRoot
Favorite is root item from hierarchy.
Definition: showfotostackviewfavoriteitem.h:47
@ FavoriteItem
Favorite is a hierarchy item including all properties.
Definition: showfotostackviewfavoriteitem.h:49
@ FavoriteFolder
Favorite is a simple folder in hierarchy.
Definition: showfotostackviewfavoriteitem.h:48
QString hierarchy() const
Definition: showfotostackviewfavoriteitem.cpp:94
void setName(const QString &name)
Definition: showfotostackviewfavoriteitem.cpp:65
void setDescription(const QString &desc)
Definition: showfotostackviewfavoriteitem.cpp:137
void setCurrentUrl(const QUrl &url)
Definition: showfotostackviewfavoriteitem.cpp:173
QString description() const
Definition: showfotostackviewfavoriteitem.cpp:144
Definition: showfotofolderviewbar.cpp:52