代码拉取完成,页面将自动刷新
同步操作将从 KongJun/noter 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#ifndef __EDITOR_H__
#define __EDITOR_H__
#include "Highlighter.h"
#include "NoterConfig.h"
#include <QColor>
#include <QDebug>
#include <QFile>
#include <QKeyEvent>
#include <QList>
#include <QMenu>
#include <QMessageBox>
#include <QPlainTextEdit>
#include <QPoint>
#include <QRegularExpression>
#include <QSize>
#include <QTextBlock>
#include <QTextCursor>
#include <QTextDocument>
#include <QTextLayout>
#include <QTextStream>
#include <algorithm>
#include <unordered_map>
class Editor : public QPlainTextEdit
{
Q_OBJECT
public:
Editor(const std::unordered_map<QString, QVariant> &editorConfig,
QWidget* parent = nullptr);
~Editor();
void keyPressEvent(QKeyEvent* e) override;
void keyReleaseEvent(QKeyEvent* e) override;
void setSearchPosition(int pos) { m_searchPosition = pos; }
void setNotebook(const QString& notebook);
bool centerOnScrollOption() const;
bool isAutoSave() const;
bool isModified() const;
void setCenterOnScrollOption(bool option);
QString notebook() const;
qint64 lineNumber() const;
qint64 lineNumber(const QTextCursor &cursor) const;
qint64 columnNumber(const QTextCursor &cursor) const;
qint64 columnNumber() const;
qint64 lineWidth(const QTextCursor &cursor) const;
private:
QString m_path; //< File path of current buffer
QString m_notebook; //< Name of notebook
QTextEdit::ExtraSelection
m_extraSelection; //< block hightlighted by searchRegex()
QMenu* m_editorMenu;
Highlighter* m_highlighter;
int m_searchPosition; //< searchRegex() from this
QTextCursor m_previousCursor;
bool m_isFakeVim = true;
bool m_isNormalMode = false;
bool m_isShiftPressed = false;
bool m_isControlPressed = false;
bool m_centerOnScrollOption =
false; //< Confugration option: wether center on scroll
bool m_isAutoSave = false; //< Confugration option: wether autosave buffer
void initMenu();
void highlightSelections(
QList<QTextEdit::ExtraSelection>& extraSelectionList,
QColor color = QColor(Qt::yellow).lighter());
void highlightSelection(QTextEdit::ExtraSelection& extraSelection,
QColor color = QColor(Qt::yellow).lighter());
void parseConfig(const std::unordered_map<QString, QVariant>& editorConfig);
public slots:
void highlightCurrentLine();
void openNote(const QString& notebook, const QString& path);
void customContextMenuRequestedSlot(QPoint pos);
void deleteActionSlot();
void saveNote();
public slots:
void searchRegex(const QRegularExpression& regex,
QTextDocument::FindFlags findFlags);
signals:
void showMessageSignal(const QString& message, int timeout = 8000);
void searchRegexIsNotFound();
void searchRegexIsFound();
void enterNormalMode();
void enterInsertMode();
void openSearchPanelSignal();
void toggleNotebookTreeSignal();
};
#endif /* end of include guard: __EDITOR_H__ */
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。