1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef DISPLAYRECENTVIEW_H |
6 | #define DISPLAYRECENTVIEW_H |
7 | |
8 | #include <QListView> |
9 | #include <QFileIconProvider> |
10 | |
11 | class QStandardItemModel; |
12 | class QStandardItem; |
13 | class DisplayRecentView : public QListView |
14 | { |
15 | Q_OBJECT |
16 | QStringList cache; |
17 | QFileIconProvider iconProvider; |
18 | public: |
19 | explicit DisplayRecentView(QWidget *parent = nullptr); |
20 | virtual QString cachePath(); |
21 | virtual void add(const QString &data); |
22 | virtual QIcon icon(const QString &data); |
23 | virtual QString title() = 0; |
24 | virtual void load(); |
25 | virtual QList<QStandardItem*> itemsFromFile(); |
26 | protected: |
27 | virtual void saveToFile(const QStringList &cache); |
28 | protected: |
29 | QStandardItemModel *model; |
30 | QJsonDocument readRecent(); |
31 | private: |
32 | }; |
33 | |
34 | #endif // DISPLAYRECENTVIEW_H |
35 |