Ai
1 Star 1 Fork 1

HuanZeng/texstudio

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
textanalysis.h 2.04 KB
一键复制 编辑 原始数据 按行查看 历史
sunderme@gmx.de 提交于 2017-12-01 05:48 +08:00 . move more source files
#ifndef TEXTANALYSIS_H
#define TEXTANALYSIS_H
#include "mostQtHeaders.h"
#include "ui_textanalysis.h"
#include "qdocumentcursor.h"
class QEditor;
class QDocument;
struct StructureEntry;
class ClsWord
{
public:
QString word;
int count;
ClsWord(): count(0) {}
ClsWord(QString nw, int nc);
bool operator<(const ClsWord &cmpTo) const;
};
class TextAnalysisModel : public QAbstractTableModel
{
Q_OBJECT
public:
QVector<ClsWord> words;
int wordCount, characterInWords;
float relativeProzentMultipler;
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;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
void updateAll();
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
};
class TextAnalysisDialog : public QDialog
{
Q_OBJECT
QVector<QPair<QString, int> > chapters;
QVector<QMap<QString, int> > maps[3]; //texts, commands, comments
QVector<int> lineCount[3]; //total line count, text lines, comment lines
TextAnalysisModel displayed;
const QDocument *document;
QEditor *editor;
QDocumentCursor cursor;
bool alreadyCount;
int lastSentenceLength, lastMinSentenceLength, lastParsedMinWordLength;
QString lastEndCharacters;
void needCount();
void insertDisplayData(const QMap<QString, int> &map);
public:
TextAnalysisDialog(QWidget *parent = 0, QString name = "");
~TextAnalysisDialog();
Ui::TextAnalysisDialog ui;
//void setData(const QDocument* doc, const QDocumentCursor &cur);
void setEditor(QEditor *aeditor);
void interpretStructureTree(StructureEntry *item);
private:
void interpretStructureTreeRec(StructureEntry *item, int targetLevel);
private slots:
void slotCount();
void slotClose();
void slotSelectionButton();
void slotExportButton();
void editorDestroyed();
public slots:
void init();
};
#endif // USERMENUDIALOG_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xmrzh/texstudio.git
git@gitee.com:xmrzh/texstudio.git
xmrzh
texstudio
texstudio
master

搜索帮助