mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 21:04:09 +00:00
4c8ec4e3f2
especially when the dictionary has a very large collecton of headword. include export function
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#ifndef HEADWORDSLISTMODEL_H
|
|
#define HEADWORDSLISTMODEL_H
|
|
|
|
#include "dictionary.hh"
|
|
|
|
#include <QAbstractListModel>
|
|
#include <QStringList>
|
|
|
|
class HeadwordListModel : public QAbstractListModel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
HeadwordListModel(QObject *parent = nullptr);
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
int totalCount() const;
|
|
int wordCount() const;
|
|
bool isFinish() const;
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
QString getRow(int row);
|
|
void setFilter(QRegularExpression);
|
|
int getCurrentIndex();
|
|
QSet<QString> getRemainRows(int & nodeIndex);
|
|
signals:
|
|
void numberPopulated(int number);
|
|
void finished(int number);
|
|
|
|
public slots:
|
|
void setDict(Dictionary::Class * dict);
|
|
void requestFinished();
|
|
|
|
protected:
|
|
bool canFetchMore(const QModelIndex &parent) const override;
|
|
void fetchMore(const QModelIndex &parent) override;
|
|
private:
|
|
QStringList words;
|
|
QStringList filterWords;
|
|
QStringList fileSortedList;
|
|
long totalSize;
|
|
Dictionary::Class * _dict;
|
|
int index;
|
|
char* ptr;
|
|
Mutex lock;
|
|
std::list< sptr< Dictionary::WordSearchRequest > > queuedRequests;
|
|
};
|
|
|
|
#endif // HEADWORDSLISTMODEL_H
|