| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2017~2017 CSSlayer <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
* |
| 6 |
*/ |
| 7 |
#ifndef _QUICKPHRASE_EDITOR_FILELISTMODEL_H_ |
| 8 |
#define _QUICKPHRASE_EDITOR_FILELISTMODEL_H_ |
| 9 |
|
| 10 |
#include <QAbstractListModel> |
| 11 |
#include <QStringList> |
| 12 |
#include <filesystem> |
| 13 |
#include <vector> |
| 14 |
|
| 15 |
#define QUICK_PHRASE_CONFIG_DIR "data/quickphrase.d" |
| 16 |
#define QUICK_PHRASE_CONFIG_FILE "data/QuickPhrase.mb" |
| 17 |
|
| 18 |
namespace fcitx { |
| 19 |
|
| 20 |
class FileListModel : public QAbstractListModel { |
| 21 |
Q_OBJECT |
| 22 |
public: |
| 23 |
explicit FileListModel(QObject *parent = 0); |
| 24 |
virtual ~FileListModel(); |
| 25 |
|
| 26 |
QVariant data(const QModelIndex &index, |
| 27 |
int role = Qt::DisplayRole) const override; |
| 28 |
int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
| 29 |
|
| 30 |
void loadFileList(); |
| 31 |
int findFile(const QString &lastFileName); |
| 32 |
|
| 33 |
private: |
| 34 |
std::vector<std::filesystem::path> fileList_; |
| 35 |
}; |
| 36 |
} // namespace fcitx |
| 37 |
|
| 38 |
#endif // _QUICKPHRASE_EDITOR_FILELISTMODEL_H_ |