1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#ifndef LATEXCOMPLETER_P_H
#define LATEXCOMPLETER_P_H
#include "mostQtHeaders.h"
#include "codesnippet.h"
#include "latexcompleter_config.h"
typedef CodeSnippet CompletionWord;
//class CompleterInputBinding;
class CompletionListModel : public QAbstractListModel {
Q_OBJECT
public:
CompletionListModel(QObject *parent = 0): QAbstractListModel(parent),mostUsedUpdated(false),mCanFetchMore(false),mLastMU(0), mWordCount(0) {}
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role)const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
const QList<CompletionWord> & getWords(){return words;}
const QSet<QChar>& getAcceptedChars(){return acceptedChars;}
bool isNextCharPossible(const QChar &c); //does this character lead to a new possible word
void filterList(const QString &word,int mostUsed=-1,bool fetchMore=false);
void setBaseWords(const QSet<QString> &newwords, bool normalTextList);
void setBaseWords(const QList<CompletionWord> &newwords, bool normalTextList);
void setAbbrevWords(const QList<CompletionWord> &newwords);
void incUsage(const QModelIndex &index);
void setConfig(LatexCompleterConfig* newConfig);
virtual bool canFetchMore(const QModelIndex &parent) const;
void fetchMore(const QModelIndex &parent);
CompletionWord getLastWord();
private:
friend class LatexCompleter; //TODO: make this unnecessary
QList<CompletionWord> words;
QString curWord;
QList<CompletionWord> baselist;
QList<CompletionWord> wordsText, wordsCommands,wordsAbbrev;
QSet<QChar> acceptedChars;
int mostUsedUpdated;
bool mCanFetchMore;
QString mLastWord;
int mLastMU;
CompletionWord mLastWordInList;
int mWordCount;
QList<CompletionWord>::const_iterator it;
static LatexCompleterConfig* config;
};
#endif // LATEXCOMPLETER_P_H
|