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
11class QStandardItemModel;
12class QStandardItem;
13class DisplayRecentView : public QListView
14{
15 Q_OBJECT
16 QStringList cache;
17 QFileIconProvider iconProvider;
18public:
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();
26protected:
27 virtual void saveToFile(const QStringList &cache);
28protected:
29 QStandardItemModel *model;
30 QJsonDocument readRecent();
31private:
32};
33
34#endif // DISPLAYRECENTVIEW_H
35