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 57 58 59 60 61 62 63 64 65 66 67
|
#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), mLastType(CodeSnippet::none), mEnvMode(false), mWordCount(0), mCitCount(-1) {}
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; }
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, CodeSnippet::Type type = CodeSnippet::none);
void setEnvironMode(bool mode);
void setBaseWords(const QSet<QString> &newwords, CompletionType completionType);
void setBaseWords(const QList<CompletionWord> &newwords, CompletionType completionType);
void setBaseWords(const CodeSnippetList &baseCommands, const CodeSnippetList &newwords, CompletionType completionType);
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();
void setContextWords(const QSet<QString> &newwords, const QString &context);
void setKeyValWords(const QString &name, const QSet<QString> &newwords);
private:
friend class LatexCompleter; //TODO: make this unnecessary
QList<CompletionWord> words;
QString curWord;
QList<CompletionWord> baselist;
QList<CompletionWord> wordsText, wordsCommands, wordsAbbrev, wordsLabels, wordsCitations, wordsCitationCommands;
int mostUsedUpdated;
QMap<QString, QList<CompletionWord> > keyValLists;
QMap<QString, QList<CompletionWord> > contextLists;
bool mCanFetchMore;
QString mLastWord;
int mLastMU;
CodeSnippet::Type mLastType;
CompletionWord mLastWordInList;
bool mEnvMode;
int mWordCount, mCitCount;
QList<CompletionWord>::iterator it;
static LatexCompleterConfig *config;
};
#endif // LATEXCOMPLETER_P_H
|