Debian Codegraph @

gui/pinyindictmanager/filelistmodel.h

raw
1 /*
2 * SPDX-FileCopyrightText: 2013-2018 CSSlayer <[email protected]>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 */
7 #ifndef _PINYINDICTMANAGER_FILELISTMODEL_H_
8 #define _PINYINDICTMANAGER_FILELISTMODEL_H_
9
10 #include <QAbstractListModel>
11 #include <QStringList>
12
13 namespace fcitx {
14
15 class FileListModel : public QAbstractListModel {
16 Q_OBJECT
17 public:
18 explicit FileListModel(QObject *parent = nullptr);
19 ~FileListModel() override;
20
21 QVariant data(const QModelIndex &index,
22 int role = Qt::DisplayRole) const override;
23 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
24 bool setData(const QModelIndex &index, const QVariant &value,
25 int role) override;
26 Qt::ItemFlags flags(const QModelIndex &index) const override;
27
28 void loadFileList();
29 void save();
30 int findFile(const QString &lastFileName);
31
32 Q_SIGNALS:
33 void changed();
34
35 private:
36 QList<QPair<QString, bool>> fileList_;
37 };
38
39 } // namespace fcitx
40
41 #endif // _PINYINDICTMANAGER_FILELISTMODEL_H_