mirror of
https://github.com/cxasm/notepad--.git
synced 2026-10-28 20:56:38 +08:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e35bb2a3d5 | ||
|
|
bce032f974 | ||
|
|
11cf3364da | ||
|
|
db02b3e9e3 | ||
|
|
42cd3ce665 | ||
|
|
616c617363 | ||
|
|
06fd8e057a | ||
|
|
54ed6d2f02 | ||
|
|
98fa26d7a8 |
@@ -18,17 +18,17 @@
|
||||
|
||||
您可以在这个项目提交bug或反馈问题。
|
||||
|
||||
最新版本下载地址:https://gitee.com/cxasm/notepad--/releases/tag/v2.1
|
||||
最新版本下载地址:https://gitee.com/cxasm/notepad--/releases/tag/v2.4
|
||||
|
||||
由于github访问经常断网,几乎没法提交代码。国内用户请访问 https://gitee.com/cxasm/notepad--
|
||||
NDD已初步推出插件编写功能,希望广大的CPP/QT开发者加入我们,插件功能均可以留上您的大名和捐赠渠道,希望
|
||||
开发者参与插件功能开发。
|
||||
|
||||
**鉴于Notepad--遭到npp势力的匿名发帖诋毁,ndd项目申明:**
|
||||
**鉴于Notepad--遭到反动竞品同类软件的匿名发帖诋毁,ndd项目申明:**
|
||||
|
||||
**Notepad--不涉及任何政治,更不会随意发布政治言论。**
|
||||
|
||||
**澄清:何为npp的走狗?即公然承认npp的观点,并且为之站台宣传,则是npp走狗。"至于npp走狗,说全部npp用户都是走狗",绝不是ndd作者观点,是npp走狗恶意歪曲的观点,ndd表示严重反对。"至于npp走狗,说全部npp用户都是走狗",如此观点,可见npp走狗之用心险恶!在严重诋毁ndd的同时,更不惜拉上所有npp用户去垫背!为何要做Npp的走狗,做个正常的中国人不好吗?**
|
||||
**最后强烈建议全体海内外同胞,务必禁用发表错误言论的敌对软件,您可以选择用其它同类软件进行替代,比如vscode,notepad3,sublime都行。大家用实际行动杜绝敌对反动软件, 不去评论它,不去关注它,不给它带来任何流量,那么挑梁小丑终归要熄火。**
|
||||
|
||||
**做中国人自己的免费编辑器,离不开您的支持,请通过微信捐赠我们。**
|
||||
|
||||
@@ -65,7 +65,7 @@ NDD已初步推出插件编写功能,希望广大的CPP/QT开发者加入我
|
||||
1. 打包使用 OBS (Open Build Service)
|
||||
|
||||
|
||||
最新版本下载地址:https://gitee.com/cxasm/notepad--/releases/tag/v2.1
|
||||
最新版本下载地址:https://gitee.com/cxasm/notepad--/releases/tag/v2.3
|
||||
|
||||
|
||||
**Qt工程编译说明:**
|
||||
@@ -89,11 +89,22 @@ QQ群:372613546 959439826(已满) 用户群,做NDD的问题反馈、功能
|
||||
|
||||
QQ群 616606091 开发群,建议懂CPP/QT、愿意参与NDD项目代码贡献的开发人士加入。
|
||||
|
||||
ndd在深度国产uos运行效果:
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||
ndd在windows运行效果:
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
ndd 在macOs运行效果:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
subtwo在redhat运行效果:
|
||||
|
||||

|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
Ndd V1.23 发布 20230226
|
||||
功能:
|
||||
1 希望可以支持xml按照层次折叠和展开操作
|
||||
2 能否增加自动刷新和滚动文本功能,以及手动重新打开文件。提供tailf方式。
|
||||
3 建议 查找与替换 添加ESC键响应,ESC键退出查找替换窗体
|
||||
4 查找替换没有默认选中
|
||||
5 新窗口打开的文件,不能再拖放回去
|
||||
6 无法计算选中内容的行数
|
||||
7 json 格式化,提供json格式化插件,命令行插件等
|
||||
8 高清屏幕适配一些列问题
|
||||
9 能否支持在软件内设置文件关联。安装包支持
|
||||
10 希望记录一下关闭软件时的标签页
|
||||
11 增加md5/sha计算
|
||||
|
||||
改进:
|
||||
1 新建文件缩进参考线会消失
|
||||
2 XML 文件 注释部分文字偏小看不清
|
||||
3 关闭编辑器之后,编辑器的设置窗口还在,如果多次就会有下图的样子
|
||||
4 Ctrl+F时,建议文本框内的内容默认选中
|
||||
5 建议程序打开时tab页为最后关闭时tab页
|
||||
6 选中多个文件右键打开时会启动多个窗口,而非多个标签,
|
||||
7 双击英文句点全部文本都会高亮
|
||||
8 command只能-缩小,+没用 不能放大
|
||||
9 CTRL+F搜索框丢失焦点后,再用快捷键CTRL+F不能自动聚焦
|
||||
10 已设置的快捷键可以取消
|
||||
11 希望显示总字数
|
||||
12 Ctrl+S时,并不能删除.swp临时文件,建议隐藏.swp文件
|
||||
13 建议 增加 打开当前文件目录下 命令提示符的功能
|
||||
14 显示空格的问题
|
||||
15 鼠标选择文本后高亮
|
||||
|
||||
Ndd V1.22 预发布 20230202
|
||||
1 提供大文本、超大文本打开两种方式;并尽量显示行号。
|
||||
2 增加ASM语言的语法高亮;增加shell语法高亮。
|
||||
|
||||
+61
-5
@@ -1,4 +1,4 @@
|
||||
#include "CmpareMode.h"
|
||||
#include "CmpareMode.h"
|
||||
#include "Encode.h"
|
||||
#include "rcglobal.h"
|
||||
|
||||
@@ -132,7 +132,6 @@ CODE_ID CmpareMode::getTextFileEncodeType(uchar* fileFpr, int fileLength, QStrin
|
||||
//是否跳过前面的LE头。默认不跳过。只有文件块开头第一块,才需要跳过。
|
||||
bool CmpareMode::tranUnicodeLeToUtf8Bytes(uchar* fileFpr, const int fileLength, QString &outUtf8Bytes, bool isSkipHead)
|
||||
{
|
||||
int lineNums = 0;
|
||||
CODE_ID code = CODE_ID::UNICODE_LE;
|
||||
|
||||
int lineStartPos = (isSkipHead ? 2:0); //uicode_le前面有2个特殊标识,故跳过2
|
||||
@@ -984,7 +983,9 @@ CODE_ID CmpareMode::readLineFromFile(uchar* m_fileFpr, const int fileLength, con
|
||||
|
||||
|
||||
//扫描文件的字符编码,不输出文件
|
||||
CODE_ID CmpareMode::scanFileRealCode(QString filePath)
|
||||
//扫描多少行scanLineNum 默认100
|
||||
//如果是-1 之前全部扫描
|
||||
CODE_ID CmpareMode::scanFileRealCode(QString filePath, int scanLineNum)
|
||||
{
|
||||
QFile file(filePath);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
@@ -1052,8 +1053,10 @@ CODE_ID CmpareMode::scanFileRealCode(QString filePath)
|
||||
|
||||
++lineNums;
|
||||
|
||||
//最多扫描200行,加块速度。速度与精确性的权衡
|
||||
if (lineNums >= 200)
|
||||
//默认最多扫描200行,加块速度。速度与精确性的权衡
|
||||
//对于打开文件,默认扫描前面的200行,加快速度。
|
||||
//对于编码转换,为了精确,默认全部都要处理
|
||||
if ((scanLineNum != -1) && (lineNums >= scanLineNum))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -1095,3 +1098,56 @@ CODE_ID CmpareMode::scanFileOutPut(CODE_ID code, QString filePath, QList<LineFil
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
//读取文件,并输出
|
||||
//bytes charsNums:文件字符个数,不是文件大小
|
||||
//20220908 自动判断是否是二进制文件。isHexFile 是输出
|
||||
//20230304 新增,一次性读取文件,不检测每行文本,加快速度。existGrbledCode 是否存在乱码
|
||||
CODE_ID CmpareMode::scanFileOutPut(QFile& pFile, CODE_ID code, QString filePath, QString& outText, bool & existGrbledCode)
|
||||
{
|
||||
QByteArray outTextBytes = pFile.readAll();
|
||||
|
||||
if (outTextBytes.size() == 0)
|
||||
{
|
||||
outText = "";
|
||||
existGrbledCode = false;
|
||||
return CODE_ID::UTF8_NOBOM;
|
||||
}
|
||||
|
||||
if (code == UNKOWN)
|
||||
{
|
||||
code = getTextFileEncodeType((uchar * )outTextBytes.data(), pFile.size(), filePath);
|
||||
|
||||
//编码还是检测失败,这里概率是比较小的。
|
||||
if (code == CODE_ID::UNKOWN)
|
||||
{
|
||||
//无条件按照ANSI/GBK编码打开
|
||||
code = CODE_ID::GBK;
|
||||
}
|
||||
}
|
||||
|
||||
int lineStartPos = 0; //uicode_le前面有2个特殊标识,故跳过2
|
||||
|
||||
if (code == CODE_ID::UNICODE_BE || code == CODE_ID::UNICODE_LE)
|
||||
{
|
||||
lineStartPos = 2;
|
||||
}
|
||||
else if (code == CODE_ID::UTF8_BOM)
|
||||
{
|
||||
lineStartPos = 3;
|
||||
}
|
||||
|
||||
bool codeSucess = Encode::tranStrToUNICODE(code, outTextBytes.data()+ lineStartPos, outTextBytes.size()- lineStartPos, outText);
|
||||
|
||||
//如果存在乱码,而且不是以gbk编码打开,再无条件尝试ASNI/GBK编码打开。如果是国际版,后续还得完善策略,得无条件以ASNI本地编码打开。
|
||||
if (!codeSucess && (code != CODE_ID::GBK))
|
||||
{
|
||||
code = CODE_ID::GBK;
|
||||
outText.clear();
|
||||
codeSucess = Encode::tranStrToUNICODE(code, outTextBytes.data() + lineStartPos, outTextBytes.size() - lineStartPos, outText);
|
||||
}
|
||||
existGrbledCode = !codeSucess;
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include <qobject.h>
|
||||
#include<QVector>
|
||||
#include<QMap>
|
||||
@@ -70,8 +70,9 @@ public:
|
||||
static CODE_ID judgeFinalTextCode(CODE_ID code, bool isExistUnKownCode, bool isExistGbk, bool isExistUtf8);
|
||||
static CODE_ID readLineFromFile(uchar * m_fileFpr, const int fileLength, const CODE_ID fileCode, QList<LineFileInfo>& lineInfoVec,int& maxLineSize, int& charsNums, bool &isMaybeHexFile);
|
||||
|
||||
static CODE_ID scanFileRealCode(QString filePath);
|
||||
static CODE_ID scanFileRealCode(QString filePath,int scanLineNum=200);
|
||||
static CODE_ID scanFileOutPut(CODE_ID code, QString filePath, QList<LineFileInfo>& outputLineInfoVec, int & maxLineSize, int & charsNums, bool &isHexFile);
|
||||
static CODE_ID scanFileOutPut(QFile& pFile, CODE_ID code, QString filePath, QString& outText, bool& existGrbledCode);
|
||||
|
||||
static CODE_ID getTextFileEncodeType(uchar* fileFpr, int fileLength, QString filePath="", bool isCheckHead = true);
|
||||
static bool tranUnicodeLeToUtf8Bytes(uchar* fileFpr, const int fileLength, QString& outUtf8Bytes, bool isSkipHead=false);
|
||||
|
||||
@@ -145,5 +145,7 @@
|
||||
<file>Resources/img/expand.png</file>
|
||||
<file>Resources/img/fold.png</file>
|
||||
<file>qss/common.qss</file>
|
||||
<file>notepad/tailf.png</file>
|
||||
<file>Resources/edit/styledeepblue/tailf.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Binary file not shown.
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#include <windows.h>
|
||||
|
||||
IDI_ICON1 ICON DISCARDABLE ".\\Resources\\edit\\global\\ndd.ico"
|
||||
|
||||
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,22,0,0
|
||||
PRODUCTVERSION 1,22,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "080404b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "notepad-- v1.22.0\0"
|
||||
VALUE "FileVersion", "1.22.0.0\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2020-2023\0"
|
||||
VALUE "OriginalFilename", "Notepad--.exe\0"
|
||||
VALUE "ProductName", "notepad-- \0"
|
||||
VALUE "ProductVersion", "1.22.0.0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0804, 1200
|
||||
END
|
||||
END
|
||||
/* End of Version info */
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 652 B After Width: | Height: | Size: 848 B |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
+19
-47
@@ -3,6 +3,7 @@
|
||||
#include "ccnotepad.h"
|
||||
#include "progresswin.h"
|
||||
#include "nddsetting.h"
|
||||
#include "ctipwin.h"
|
||||
|
||||
#include <QTableWidgetItem>
|
||||
#include <QFileDialog>
|
||||
@@ -172,42 +173,25 @@ void BatchFindReplace::on_findBtClick()
|
||||
if (m_mainNotepad != nullptr && m_mainNotepad)
|
||||
{
|
||||
int rowNums = ui.findReplaceTable->rowCount();
|
||||
|
||||
if (rowNums == 0)
|
||||
{
|
||||
CTipWin::showTips(this, tr("Please fresh first !"), 1200);
|
||||
return;
|
||||
}
|
||||
ProgressWin* loadFileProcessWin = new ProgressWin(this);
|
||||
|
||||
loadFileProcessWin->setWindowModality(Qt::WindowModal);
|
||||
|
||||
loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(rowNums));
|
||||
|
||||
loadFileProcessWin->setTotalSteps(rowNums);
|
||||
|
||||
loadFileProcessWin->show();
|
||||
|
||||
int foundTimes = 0;
|
||||
|
||||
QStringList findKeyList;
|
||||
|
||||
for (int i = 0; i < rowNums; ++i)
|
||||
{
|
||||
QTableWidgetItem* item = ui.findReplaceTable->item(i, 0);
|
||||
if (item != nullptr && !item->text().isEmpty())
|
||||
{
|
||||
if (loadFileProcessWin->isCancel())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
foundTimes += m_mainNotepad->findAtBack(item->text());
|
||||
|
||||
loadFileProcessWin->moveStep();
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
findKeyList.append(item->text());
|
||||
}
|
||||
}
|
||||
|
||||
delete loadFileProcessWin;
|
||||
foundTimes = m_mainNotepad->findAtBack(findKeyList);
|
||||
|
||||
ui.statusBar->showMessage(tr("Batch Find Finished! total %1 found.").arg(foundTimes),10000);
|
||||
}
|
||||
@@ -216,11 +200,15 @@ void BatchFindReplace::on_findBtClick()
|
||||
//进行批量替换工作
|
||||
void BatchFindReplace::on_replaceBtClick()
|
||||
{
|
||||
if (m_mainNotepad != nullptr && m_mainNotepad)
|
||||
if (m_mainNotepad != nullptr)
|
||||
{
|
||||
int rowNums = ui.findReplaceTable->rowCount();
|
||||
if (rowNums == 0)
|
||||
{
|
||||
CTipWin::showTips(this, tr("Please fresh first !"), 1200);
|
||||
return;
|
||||
}
|
||||
|
||||
int replaceTimes = 0;
|
||||
|
||||
QStringList findKeyList;
|
||||
QStringList replaceKeyList;
|
||||
@@ -241,9 +229,9 @@ void BatchFindReplace::on_replaceBtClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
replaceTimes = m_mainNotepad->replaceAtBack(findKeyList, replaceKeyList);
|
||||
m_mainNotepad->replaceAtBack(findKeyList, replaceKeyList);
|
||||
|
||||
ui.statusBar->showMessage(tr("Batch Replace Finished, total Replace %1 times !").arg(replaceTimes), 10000);
|
||||
ui.statusBar->showMessage(tr("Batch Replace Finished, total Replace %1 times !").arg(findKeyList.size()), 10000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,40 +320,24 @@ void BatchFindReplace::on_mark()
|
||||
int rowNums = ui.findReplaceTable->rowCount();
|
||||
if (rowNums == 0)
|
||||
{
|
||||
CTipWin::showTips(this, tr("Please fresh first !"), 1200);
|
||||
return;
|
||||
}
|
||||
|
||||
int markTimes = 0;
|
||||
|
||||
ProgressWin* loadFileProcessWin = new ProgressWin(this);
|
||||
|
||||
loadFileProcessWin->setWindowModality(Qt::WindowModal);
|
||||
|
||||
loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(rowNums));
|
||||
|
||||
loadFileProcessWin->setTotalSteps(rowNums);
|
||||
|
||||
loadFileProcessWin->show();
|
||||
QStringList findKeyList;
|
||||
|
||||
for (int i = 0; i < rowNums; ++i)
|
||||
{
|
||||
QTableWidgetItem* item = ui.findReplaceTable->item(i, 0);
|
||||
if (item != nullptr && !item->text().isEmpty())
|
||||
{
|
||||
if (loadFileProcessWin->isCancel())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
markTimes += m_mainNotepad->markAtBack(item->text());
|
||||
|
||||
loadFileProcessWin->moveStep();
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
findKeyList.append(item->text());
|
||||
}
|
||||
}
|
||||
|
||||
delete loadFileProcessWin;
|
||||
markTimes = m_mainNotepad->markAtBack(findKeyList);
|
||||
|
||||
ui.statusBar->showMessage(tr("Batch Mark Finished, total Mark %1 times !").arg(markTimes), 10000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "bigfilemessage.h"
|
||||
#include "nddsetting.h"
|
||||
|
||||
BigFileMessage::BigFileMessage(QWidget *parent)
|
||||
: QDialog(parent), m_result(-1)
|
||||
@@ -41,19 +42,19 @@ void BigFileMessage::slot_okBt()
|
||||
{
|
||||
if (ui.textMode->isChecked())
|
||||
{
|
||||
m_result = TXT_TYPE;//普通文本
|
||||
m_result = TXT_TYPE;//普通文本
|
||||
}
|
||||
else if(ui.bigTextMode->isChecked())
|
||||
{
|
||||
m_result = BIG_TEXT_RO_TYPE; //小于8G的大文本
|
||||
m_result = BIG_TEXT_RO_TYPE; //小于8G的大文本
|
||||
}
|
||||
else if (ui.superBigTextMode->isChecked())
|
||||
{
|
||||
m_result = SUPER_BIG_TEXT_RO_TYPE;//8G以上的大文本
|
||||
m_result = SUPER_BIG_TEXT_RO_TYPE;//8G以上的大文本
|
||||
}
|
||||
else if (ui.hexMode->isChecked())
|
||||
{
|
||||
m_result = HEX_TYPE;//二进制
|
||||
m_result = HEX_TYPE;//二进制
|
||||
}
|
||||
done(m_result);
|
||||
}
|
||||
@@ -62,4 +63,4 @@ void BigFileMessage::slot_cancelBt()
|
||||
{
|
||||
m_result = -1;
|
||||
done(m_result);
|
||||
}
|
||||
}
|
||||
+1057
-226
File diff suppressed because it is too large
Load Diff
+64
-21
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QLabel>
|
||||
@@ -35,6 +35,10 @@ struct HexFileMgr;
|
||||
struct TextFileMgr;
|
||||
struct BigTextEditFileMgr;
|
||||
|
||||
static const char* Tail_Thread = "tailthread";
|
||||
|
||||
//编码类型,int
|
||||
static const char* Edit_Text_Code = "code";
|
||||
|
||||
enum OpenAttr {
|
||||
Text = 1,
|
||||
@@ -83,6 +87,7 @@ enum NddDocType {
|
||||
//打开模式。1 文本 2 二进制 3 大文本只读 4 文本只读
|
||||
//const char* Open_Attr = "openid";
|
||||
class FileListView;
|
||||
class QtLangSet;
|
||||
|
||||
class CCNotePad : public QMainWindow
|
||||
{
|
||||
@@ -100,18 +105,7 @@ public:
|
||||
void initLexerNameToIndex();
|
||||
|
||||
static LexerInfo getLangLexerIdByFileExt(QString filePath);
|
||||
#if 0
|
||||
static QFont & getTxtFont()
|
||||
{
|
||||
return s_txtFont;
|
||||
}
|
||||
|
||||
static QFont & getProLangFont()
|
||||
{
|
||||
return s_proLangFont;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool openFile(QString filePath, int lineNum=-1);
|
||||
bool tryRestoreFile(QString filePath);
|
||||
|
||||
@@ -143,8 +137,8 @@ public:
|
||||
void clearHighlightWord(QString signWord, ScintillaEditView* pEdit = nullptr);
|
||||
bool closeFileByEditWidget(QWidget* pEdit);
|
||||
void showChangePageTips(QWidget* pEdit);
|
||||
int markAtBack(QString keyword);
|
||||
int findAtBack(QString keyword);
|
||||
int markAtBack(QStringList& keyword);
|
||||
int findAtBack(QStringList& keyword);
|
||||
int replaceAtBack(QStringList& keyword, QStringList& replace);
|
||||
void updateThemes();
|
||||
|
||||
@@ -154,10 +148,15 @@ public:
|
||||
|
||||
void changeMarkColor(int sytleId);
|
||||
void setUserDefShortcutKey(int shortcutId);
|
||||
|
||||
QtLangSet* getLangSet();
|
||||
signals:
|
||||
void signSendRegisterKey(QString key);
|
||||
void signRegisterReplay(int code);
|
||||
void signLinkNetServer();
|
||||
#ifdef Q_OS_WIN
|
||||
void tailFileChange(ScintillaEditView*,qint64 lastSize, qint64 curSize);
|
||||
#endif
|
||||
public slots:
|
||||
void slot_changeChinese();
|
||||
void slot_changeEnglish();
|
||||
@@ -171,8 +170,10 @@ public slots:
|
||||
void slot_actionCloseNonCurDoc();
|
||||
void slot_actionCloseLeftAll();
|
||||
void slot_actionCloseRightAll();
|
||||
|
||||
void slot_quit(bool);
|
||||
|
||||
|
||||
void slot_closeAllFile(bool);
|
||||
void slot_batch_convert();
|
||||
void slot_batch_rename();
|
||||
@@ -183,17 +184,21 @@ public slots:
|
||||
void slot_viewLexerChange(QString tag);
|
||||
void slot_findInDir();
|
||||
void slot_showFileInExplorer();
|
||||
#ifdef Q_OS_WIN
|
||||
void slot_showCmdInExplorer();
|
||||
#endif
|
||||
void slot_wordHighlight();
|
||||
|
||||
void slot_clearWordHighlight();
|
||||
void slot_clearMark();
|
||||
void slot_zoomValueChange();
|
||||
|
||||
void on_quitActiveWindow();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
void dropEvent(QDropEvent* e) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent* event);
|
||||
bool eventFilter(QObject *watched, QEvent *event)override;
|
||||
#ifdef Q_OS_WIN
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||
@@ -232,7 +237,9 @@ private slots:
|
||||
|
||||
void slot_findResultPosChangeed(Qt::DockWidgetArea area);
|
||||
void slot_findResultItemDoubleClick(const QModelIndex & index);
|
||||
#if 0
|
||||
void slot_showFindAllInCurDocResult(FindRecords * record);
|
||||
#endif
|
||||
void slot_showfindAllInOpenDocResult(QVector<FindRecords*>* record, int hits, QString whatFind);
|
||||
void slot_clearFindResult();
|
||||
void slot_convertWinLineEnd(bool);
|
||||
@@ -260,6 +267,7 @@ private slots:
|
||||
void slot_compareDir();
|
||||
void slot_binCompare();
|
||||
void slot_tabBarClicked(int index);
|
||||
void on_tabBarDoubleClicked(int index);
|
||||
void slot_reOpenTextMode();
|
||||
void slot_reOpenHexMode();
|
||||
void slot_selectLeftFile();
|
||||
@@ -338,15 +346,23 @@ private slots:
|
||||
void slot_showToolBar(bool);
|
||||
void slot_dynamicLoadToolMenu();
|
||||
void slot_batchFind();
|
||||
#ifdef NO_PLUGIN
|
||||
void on_loadReceneFile();
|
||||
void slot_pluginMgr();
|
||||
#ifdef NO_PLUGIN
|
||||
void onPlugWork(bool check);
|
||||
void sendParaToPlugin(NDD_PROC_DATA& procData);
|
||||
//cmdId 执行什么动作,一定固定后,主程序不能随便修改,否则会引发兼容性问题。
|
||||
bool pluginInvoke(int cmdId, void* data);
|
||||
#endif
|
||||
void slot_showWebAddr(bool check);
|
||||
void slot_langFileSuffix();
|
||||
void slot_shortcutManager();
|
||||
void on_lineEndChange(int index);
|
||||
void on_tailfile(bool isOn);
|
||||
#ifdef Q_OS_WIN
|
||||
void on_roladFile(ScintillaEditView* pEdit,quint64 lastSize, qint64 curSize);
|
||||
#endif
|
||||
void on_md5hash();
|
||||
|
||||
private:
|
||||
void initFindResultDockWin();
|
||||
@@ -376,6 +392,7 @@ private:
|
||||
void syncCurDocEncodeToMenu(QWidget * curEdit);
|
||||
void syncCurDocLineEndStatusToMenu(QWidget * curEdit);
|
||||
void syncCurDocLexerToMenu(QWidget* pEdit);
|
||||
void syncCurDocTailfToMenu(QWidget* curEdit);
|
||||
|
||||
void cmpSelectFile();
|
||||
|
||||
@@ -385,11 +402,15 @@ private:
|
||||
void addWatchFilePath(QString filePath);
|
||||
void removeWatchFilePath(QString filePath);
|
||||
|
||||
bool checkRoladFile(ScintillaEditView * pEdit);
|
||||
void reloadEditFile(ScintillaEditView * pEidt);
|
||||
void doReloadTxtFile(ScintillaEditView* pEdit, bool isOnTail, qint64 startReadSize);
|
||||
void firstTimeIntoTail(ScintillaEditView* pEdit, int remainLineNums=100);
|
||||
bool checkRoladFile(ScintillaEditView * pEdit, qint64 startReadSize=-1);
|
||||
void reloadEditFile(ScintillaEditView * pEidt, bool isTailfOn = false, qint64 startReadSize=-1);
|
||||
int initFindWindow(FindTabIndex type= FIND_TAB);
|
||||
|
||||
void setToFileRightMenu();
|
||||
void initReceneCmp();
|
||||
void saveReceneCmp();
|
||||
|
||||
QString getShortName(const QString& name);
|
||||
|
||||
@@ -445,6 +466,7 @@ private:
|
||||
void init_toolsMenu();
|
||||
void changeBlankShowStatus(int showBlank);
|
||||
void syncBlankShowStatus();
|
||||
void openFileInNewWin(int index);
|
||||
#ifdef NO_PLUGIN
|
||||
void loadPluginLib();
|
||||
void loadPluginProcs(QString strLibDir, QMenu* pMenu);
|
||||
@@ -453,7 +475,13 @@ private:
|
||||
|
||||
void setUserDefShortcutKey();
|
||||
void setNormalTextEditInitPro(ScintillaEditView* pEdit, QString filePath, CODE_ID code, RC_LINE_FORM lineEnd, bool isReadOnly, bool isModifyed);
|
||||
void registerCommentShortKey(int type, QKeySequence& keySeq);
|
||||
void dealRecentFileMenuWhenColseFile(QString closeFilePath);
|
||||
void registerFoldShortKey(int type, QKeySequence& keySeq, bool isFold);
|
||||
void doFold(int type, bool mode);
|
||||
void doComment(int type);
|
||||
void tailfile(bool isOn, ScintillaEditView* pEdit);
|
||||
void on_findResultlineDoubleClick(QString* pFilePath, int pos, int end);
|
||||
private:
|
||||
Ui::CCNotePad ui;
|
||||
|
||||
@@ -478,11 +506,15 @@ private:
|
||||
QActionGroup *m_pLexerActGroup;
|
||||
QActionGroup *m_pIconSize;
|
||||
|
||||
#if 0
|
||||
QAction* m_quitAction;
|
||||
#endif
|
||||
|
||||
//关闭时,询问保存文件,用户点击了取消,此时不能走关闭程序
|
||||
//设置一个标志记录该状态,确定最终是否要退出
|
||||
bool m_isQuitCancel;
|
||||
//是否主窗口。可以打开多个,但是只有第一个是主窗口
|
||||
bool m_isMainWindows;
|
||||
|
||||
QMap<QString, LexerNode> m_lexerNameToIndex;
|
||||
|
||||
@@ -493,12 +525,17 @@ private:
|
||||
QString m_cmpRightFilePath;
|
||||
|
||||
QPointer<QMainWindow> m_pFindWin;
|
||||
QPointer <QWidget> m_columnEditWin;
|
||||
QPointer<QWidget> m_columnEditWin;
|
||||
QPointer<QMainWindow> m_langSetWin;
|
||||
QPointer<QWidget> m_optionsView;
|
||||
|
||||
|
||||
QSharedMemory* m_shareMem;
|
||||
|
||||
//是否主窗口。可以打开多个,但是只有第一个是主窗口
|
||||
bool m_isMainWindows;
|
||||
|
||||
|
||||
QList<CompareDirs*> m_cmpDirMgr;
|
||||
QList<CompareWin*> m_cmpFileMgr;
|
||||
|
||||
//最近打开的对比文件和目录列表。做一个环形区
|
||||
//保存在数据库中
|
||||
@@ -511,6 +548,7 @@ private:
|
||||
|
||||
QAction* m_openInNewWinAct;
|
||||
QAction* m_showFileDirAct;
|
||||
QAction* m_showCmdAct;
|
||||
|
||||
QAction* m_openWithText;
|
||||
QAction* m_openWithHex;
|
||||
@@ -528,6 +566,7 @@ private:
|
||||
QPointer<QWidget> m_pHexGotoWin;
|
||||
|
||||
static QStringList s_findHistroy;
|
||||
static QStringList s_replaceHistroy;
|
||||
static int s_padTimes;
|
||||
|
||||
int m_curSoftLangs; //当前语言0:自动 1 中文 2 英语
|
||||
@@ -563,6 +602,7 @@ private:
|
||||
QToolButton* m_wordwrap;
|
||||
QToolButton* m_allWhite;
|
||||
QToolButton* m_indentGuide;
|
||||
QToolButton* m_tailf;
|
||||
QToolButton* m_preHexPage;
|
||||
QToolButton* m_nextHexPage;
|
||||
QToolButton* m_gotoHexPage;
|
||||
@@ -585,10 +625,13 @@ private:
|
||||
|
||||
bool m_isInitBookMarkAct;
|
||||
|
||||
bool m_isRecentFileLoaded;
|
||||
|
||||
QList<QAction*>m_styleMarkActList;
|
||||
QList<NDD_PROC_DATA> m_pluginList;
|
||||
|
||||
public:
|
||||
|
||||
static QString s_lastOpenDirPath;
|
||||
static int s_restoreLastFile; //自动恢复上次打开的文件
|
||||
static int s_curStyleId;
|
||||
|
||||
@@ -57,9 +57,6 @@
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideNone</enum>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -69,6 +66,9 @@
|
||||
<property name="movable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tabBarAutoHide">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -506,6 +506,7 @@
|
||||
<property name="title">
|
||||
<string>T&ools</string>
|
||||
</property>
|
||||
<addaction name="actionMd5_Sha"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuPlugin">
|
||||
<property name="title">
|
||||
@@ -1626,6 +1627,9 @@
|
||||
<property name="text">
|
||||
<string>Column Block Editing</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Alt+X</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWrap">
|
||||
<property name="checkable">
|
||||
@@ -2060,6 +2064,11 @@
|
||||
<string>Plugin Manager</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMd5_Sha">
|
||||
<property name="text">
|
||||
<string>Md5/Sha</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
@@ -3474,6 +3483,22 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>actionMd5_Sha</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>CCNotePad</receiver>
|
||||
<slot>on_md5hash()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>728</x>
|
||||
<y>394</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>slot_actionNewFile_toggle(bool)</slot>
|
||||
@@ -3577,5 +3602,6 @@
|
||||
<slot>slot_showWebAddr(bool)</slot>
|
||||
<slot>slot_langFileSuffix()</slot>
|
||||
<slot>slot_shortcutManager()</slot>
|
||||
<slot>on_md5hash()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
+269
-104
@@ -1,4 +1,4 @@
|
||||
#include "filemanager.h"
|
||||
#include "filemanager.h"
|
||||
#include "scintillaeditview.h"
|
||||
#include "scintillahexeditview.h"
|
||||
#include "CmpareMode.h"
|
||||
@@ -9,7 +9,9 @@
|
||||
#include <QFile>
|
||||
#include <QtGlobal>
|
||||
#include <qscilexer.h>
|
||||
#include <QFileInfo>
|
||||
|
||||
LangType detectLanguage(QString& headContent, QString& filepath);
|
||||
|
||||
FileManager::FileManager():m_lastErrorCode(NONE_ERROR)
|
||||
{
|
||||
@@ -218,6 +220,68 @@ void FileManager::delNewFileNode(int fileIndex)
|
||||
}
|
||||
}
|
||||
|
||||
//和loadFileDataInText类似,但是不是从头开始读取文件,而是从startReadSize开始
|
||||
//不检查编码,直接按照fileTextCode进行读取
|
||||
int FileManager::loadFileDataInTextFromOffset(ScintillaEditView* editView, QString filePath, CODE_ID fileTextCode, QWidget* msgBoxParent, quint64 startReadSize)
|
||||
{
|
||||
QFile file(filePath);
|
||||
|
||||
//如果文件不存在,直接返回
|
||||
if (!file.exists())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
QFlags<QFileDevice::Permission> power = QFile::permissions(filePath);
|
||||
|
||||
//直接以只读的方式打开,至于能不能保存,是保存时需要考虑的问题。
|
||||
//只需要在保存的时候获取admin权限即可
|
||||
QIODevice::OpenMode mode;
|
||||
|
||||
mode = QIODevice::ExistingOnly | QIODevice::ReadOnly;
|
||||
|
||||
if (!file.open(mode))
|
||||
{
|
||||
QMessageBox::warning(msgBoxParent, tr("Error"), tr("Open File %1 failed").arg(filePath));
|
||||
return 2;
|
||||
}
|
||||
|
||||
quint64 fileSize = file.size();
|
||||
|
||||
//如果文件是空的。检查一下,有可能在临时文件损坏情况下出现,外面需要使用
|
||||
if (fileSize == 0)
|
||||
{
|
||||
file.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//如果读取的内容,超过了当前文件大小,则直接返回。这里是返回0,视作成功,没有新内容要读
|
||||
if (startReadSize >= fileSize)
|
||||
{
|
||||
file.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
QByteArray bytes;
|
||||
|
||||
if (file.seek(startReadSize))
|
||||
{
|
||||
//读取后面所有的内容
|
||||
bytes = file.readAll();
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
QString text;
|
||||
|
||||
Encode::tranStrToUNICODE(fileTextCode, bytes.data(), bytes.count(), text);
|
||||
|
||||
editView->append(text);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
//这里是以文本方式加载文件。但是可能遇到的是二进制文件,里面会做判断
|
||||
//二进制时hexAsk是否询问,当用户指定打开格式时,不需要询问
|
||||
@@ -406,6 +470,172 @@ int FileManager::loadFileDataInText(ScintillaEditView* editView, QString filePat
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//20230304新增加:不再一行一行读取文件,而是一次性读取到内存,加快文本文件打开时的处理速度
|
||||
//这里是以文本方式加载文件。但是可能遇到的是二进制文件,里面会做判断
|
||||
//二进制时hexAsk是否询问,当用户指定打开格式时,不需要询问
|
||||
//MsgBoxParent::尽量把这个给一下,让MsgBox有图标,不那么难看。
|
||||
int FileManager::loadFileDataInText(ScintillaEditView* editView, QString filePath, CODE_ID& fileTextCode, RC_LINE_FORM& lineEnd, CCNotePad* callbackObj, bool hexAsk, QWidget* msgBoxParent)
|
||||
{
|
||||
QFile file(filePath);
|
||||
|
||||
//如果文件不存在,直接返回
|
||||
if (!file.exists())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
QFlags<QFileDevice::Permission> power = QFile::permissions(filePath);
|
||||
|
||||
//直接以只读的方式打开,至于能不能保存,是保存时需要考虑的问题。
|
||||
//只需要在保存的时候获取admin权限即可
|
||||
QIODevice::OpenMode mode;
|
||||
|
||||
mode = QIODevice::ExistingOnly | QIODevice::ReadOnly;
|
||||
|
||||
if (!file.open(mode))
|
||||
{
|
||||
qDebug() << file.error();
|
||||
#ifdef Q_OS_WIN
|
||||
//打开失败,这里一般是权限问题导致。如果是windows,在外面申请权限后继续处理
|
||||
if (QFileDevice::OpenError == file.error())
|
||||
{
|
||||
if (callbackObj != nullptr)
|
||||
{
|
||||
return callbackObj->runAsAdmin(filePath);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_UNIX
|
||||
QMessageBox::warning(msgBoxParent, tr("Error"), tr("Open File %1 failed").arg(filePath));
|
||||
#endif
|
||||
return 2;
|
||||
}
|
||||
|
||||
qint64 fileSize = file.size();
|
||||
|
||||
//如果文件是空的。检查一下,有可能在临时文件损坏情况下出现,外面需要使用
|
||||
if (fileSize == 0)
|
||||
{
|
||||
m_lastErrorCode = ERROR_TYPE::OPEN_EMPTY_FILE;
|
||||
file.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
qint64 bufferSizeRequested = fileSize + qMin((qint64)(1 << 20), (qint64)(fileSize / 6));
|
||||
|
||||
if (bufferSizeRequested > INT_MAX)
|
||||
{
|
||||
QMessageBox::warning(msgBoxParent, tr("Error"), tr("File is too big to be opened by Notepad--"));
|
||||
file.close();
|
||||
return 3;
|
||||
}
|
||||
|
||||
QString fileText;
|
||||
bool isErrorCode = false;
|
||||
|
||||
fileTextCode = CmpareMode::scanFileOutPut(file, fileTextCode, filePath, fileText, isErrorCode);
|
||||
|
||||
//如果文件是空的。检查一下,有可能在临时文件损坏情况下出现,外面需要使用
|
||||
if (fileText.size() == 0)
|
||||
{
|
||||
m_lastErrorCode = ERROR_TYPE::OPEN_EMPTY_FILE;
|
||||
file.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (isErrorCode && hexAsk)
|
||||
{
|
||||
//检测到文件很可能是二进制文件,询问用户,是否以二进制加载
|
||||
int ret = QMessageBox::question(msgBoxParent, tr("Open with Text or Hex? [Exist Garbled Code]"), tr("The file %1 is likely to be binary. Do you want to open it in binary?").arg(filePath), tr("Hex Open"), tr("Text Open"), tr("Cancel"));
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
//16进制打开
|
||||
file.close();
|
||||
return 4;
|
||||
}
|
||||
else if (ret == 1)
|
||||
{
|
||||
//继续以文本打开
|
||||
}
|
||||
else
|
||||
{
|
||||
//取消,不打开
|
||||
file.close();
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
//以第一行的换行为文本的换行符。暂时只考虑win unix 。mac \r 已经淘汰,暂时不管
|
||||
lineEnd = RC_LINE_FORM::UNKNOWN_LINE;
|
||||
|
||||
int pos = fileText.indexOf("\n");
|
||||
if (pos >=1)
|
||||
{
|
||||
if (fileText[pos - 1] == QChar('\r'))
|
||||
{
|
||||
lineEnd = RC_LINE_FORM::DOS_LINE;
|
||||
}
|
||||
else
|
||||
{
|
||||
lineEnd = RC_LINE_FORM::UNIX_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
if (lineEnd == UNKNOWN_LINE)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
lineEnd = DOS_LINE;
|
||||
#else
|
||||
lineEnd = UNIX_LINE;
|
||||
#endif
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
|
||||
//优先根据文件后缀来确定其语法风格
|
||||
LexerInfo lxdata = CCNotePad::getLangLexerIdByFileExt(filePath);
|
||||
|
||||
if (lxdata.lexerId != L_TXT)
|
||||
{
|
||||
QsciLexer* lexer = editView->createLexer(lxdata.lexerId, lxdata.tagName);
|
||||
editView->setLexer(lexer);
|
||||
}
|
||||
else
|
||||
{
|
||||
//利用前面100个字符,进行一个编程语言的判断
|
||||
QString headContens = fileText.mid(0, 100);
|
||||
|
||||
LangType _language = detectLanguage(headContens, filePath);
|
||||
|
||||
if (_language >= 0 && _language < L_EXTERNAL)
|
||||
{
|
||||
QsciLexer* lexer = editView->createLexer(_language);
|
||||
editView->setLexer(lexer);
|
||||
}
|
||||
}
|
||||
|
||||
//如果检测到时16进制文件,但是强行以二进制打开,则有限走setUtf8Text。
|
||||
if (!isErrorCode)
|
||||
{
|
||||
editView->setText(fileText);
|
||||
}
|
||||
else
|
||||
{
|
||||
//20230203有github用户反馈,说存在乱码的文件被截断,所以后续还是不走截断
|
||||
editView->setText(fileText);
|
||||
|
||||
return 6;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//加载文件,只为查找使用
|
||||
int FileManager::loadFileForSearch(ScintillaEditView* editView, QString filePath)
|
||||
{
|
||||
@@ -413,15 +643,9 @@ int FileManager::loadFileForSearch(ScintillaEditView* editView, QString filePath
|
||||
|
||||
QFlags<QFileDevice::Permission> power = QFile::permissions(filePath);
|
||||
|
||||
if (!power.testFlag(QFile::ReadOwner))
|
||||
{
|
||||
//文件不能读
|
||||
return 1;
|
||||
}
|
||||
|
||||
QIODevice::OpenMode mode;
|
||||
|
||||
if (!power.testFlag(QFile::WriteOwner))
|
||||
if (!power.testFlag(QFile::WriteUser))
|
||||
{
|
||||
//文件不能写
|
||||
mode = QIODevice::ExistingOnly | QIODevice::ReadOnly;
|
||||
@@ -433,7 +657,7 @@ int FileManager::loadFileForSearch(ScintillaEditView* editView, QString filePath
|
||||
|
||||
if (!file.open(mode))
|
||||
{
|
||||
qDebug() << file.error();
|
||||
//qDebug() << file.error();
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -441,46 +665,30 @@ int FileManager::loadFileForSearch(ScintillaEditView* editView, QString filePath
|
||||
|
||||
qint64 bufferSizeRequested = fileSize + qMin((qint64)(1 << 20), (qint64)(fileSize / 6));
|
||||
|
||||
// As a 32bit application, we cannot allocate 2 buffer of more than INT_MAX size (it takes the whole address space)
|
||||
if (bufferSizeRequested > INT_MAX)
|
||||
{
|
||||
file.close();
|
||||
return 3;
|
||||
}
|
||||
|
||||
QList<LineFileInfo> outputLineInfoVec;
|
||||
|
||||
int maxLineSize = 0;
|
||||
int charsNums = 0;
|
||||
bool isHexFile = false;
|
||||
|
||||
bool existGrbledCode = false;
|
||||
QString outText;
|
||||
CODE_ID fileTextCode = CODE_ID::UNKOWN;
|
||||
|
||||
CmpareMode::scanFileOutPut(fileTextCode, filePath, outputLineInfoVec, maxLineSize, charsNums, isHexFile);
|
||||
fileTextCode = CmpareMode::scanFileOutPut(file, fileTextCode, filePath, outText, existGrbledCode);
|
||||
|
||||
if (isHexFile)
|
||||
//20230218 这里必须指明一下编码,否则后续会导致编码被修改
|
||||
editView->setProperty(Edit_Text_Code, fileTextCode);
|
||||
|
||||
if (existGrbledCode)
|
||||
{
|
||||
qDebug() << filePath;
|
||||
//qDebug() << filePath;
|
||||
file.close();
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (maxLineSize > 0)
|
||||
{
|
||||
editView->execute(SCI_SETSCROLLWIDTH, maxLineSize * 10);
|
||||
}
|
||||
|
||||
QString text;
|
||||
text.reserve(charsNums + 1);
|
||||
|
||||
for (QList<LineFileInfo>::iterator it = outputLineInfoVec.begin(); it != outputLineInfoVec.end(); ++it)
|
||||
{
|
||||
text.append(it->unicodeStr);
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
editView->setText(text);
|
||||
editView->setText(outText);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1220,95 +1428,52 @@ void FileManager::closeBigTextRoFileHand(QString filepath)
|
||||
}
|
||||
}
|
||||
|
||||
//检查文件的编程语言
|
||||
LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data, size_t dataLen)
|
||||
//初步检查文件的编程语言。两个标准: 1 文件头部标签 2 文件特定名称
|
||||
LangType detectLanguage(QString& headContent, QString& filepath)
|
||||
{
|
||||
struct FirstLineLanguages
|
||||
{
|
||||
std::string pattern;
|
||||
QString pattern;
|
||||
LangType lang;
|
||||
};
|
||||
|
||||
// Is the buffer at least the size of a BOM?
|
||||
if (dataLen <= 3)
|
||||
return L_TXT;
|
||||
|
||||
// Eliminate BOM if present
|
||||
size_t i = 0;
|
||||
if ((data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF) || // UTF8 BOM
|
||||
(data[0] == 0xFE && data[1] == 0xFF && data[2] == 0x00) || // UTF16 BE BOM
|
||||
(data[0] == 0xFF && data[1] == 0xFE && data[2] == 0x00)) // UTF16 LE BOM
|
||||
i += 3;
|
||||
|
||||
// Skip any space-like char
|
||||
for (; i < dataLen; ++i)
|
||||
{
|
||||
if (data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r')
|
||||
break;
|
||||
}
|
||||
|
||||
// Create the buffer to need to test
|
||||
const size_t longestLength = 40; // shebangs can be large
|
||||
std::string buf2Test = std::string((const char *)data + i, longestLength);
|
||||
|
||||
// Is there a \r or \n in the buffer? If so, truncate it
|
||||
auto cr = buf2Test.find("\r");
|
||||
auto nl = buf2Test.find("\n");
|
||||
auto crnl = qMin(cr, nl);
|
||||
if (crnl != std::string::npos && crnl < longestLength)
|
||||
buf2Test = std::string((const char *)data + i, crnl);
|
||||
|
||||
// First test for a Unix-like Shebang
|
||||
// See https://en.wikipedia.org/wiki/Shebang_%28Unix%29 for more details about Shebang
|
||||
std::string shebang = "#!";
|
||||
|
||||
size_t foundPos = buf2Test.find(shebang);
|
||||
if (foundPos == 0)
|
||||
{
|
||||
// Make a list of the most commonly used languages
|
||||
const size_t NB_SHEBANG_LANGUAGES = 7;
|
||||
FirstLineLanguages ShebangLangs[NB_SHEBANG_LANGUAGES] = {
|
||||
{ "sh", L_BASH },
|
||||
{ "python", L_PYTHON },
|
||||
{ "perl", L_PERL },
|
||||
{ "php", L_PHP },
|
||||
{ "ruby", L_RUBY },
|
||||
{ "node", L_JAVASCRIPT },
|
||||
{ "Makefile", L_MAKEFILE}
|
||||
};
|
||||
|
||||
// Go through the list of languages
|
||||
for (i = 0; i < NB_SHEBANG_LANGUAGES; ++i)
|
||||
{
|
||||
if (buf2Test.find(ShebangLangs[i].pattern) != std::string::npos)
|
||||
{
|
||||
return ShebangLangs[i].lang;
|
||||
}
|
||||
}
|
||||
|
||||
// Unrecognized shebang (there is always room for improvement ;-)
|
||||
return L_TXT;
|
||||
}
|
||||
|
||||
// Are there any other patterns we know off?
|
||||
const size_t NB_FIRST_LINE_LANGUAGES = 5;
|
||||
FirstLineLanguages languages[NB_FIRST_LINE_LANGUAGES] = {
|
||||
const size_t FIRST_LINE_LANGUAGES = 5;
|
||||
FirstLineLanguages languages[FIRST_LINE_LANGUAGES] = {
|
||||
{ "<?xml", L_XML },
|
||||
{ "<?php", L_PHP },
|
||||
{ "<html", L_HTML },
|
||||
{ "<!DOCTYPE html", L_HTML },
|
||||
{ "<?", L_PHP } // MUST be after "<?php" and "<?xml" to get the result as accurate as possible
|
||||
{ "<?", L_PHP }
|
||||
};
|
||||
|
||||
for (i = 0; i < NB_FIRST_LINE_LANGUAGES; ++i)
|
||||
int foundPos = -1;
|
||||
for (int i = 0; i < FIRST_LINE_LANGUAGES; ++i)
|
||||
{
|
||||
foundPos = buf2Test.find(languages[i].pattern);
|
||||
foundPos = headContent.indexOf(languages[i].pattern);
|
||||
if (foundPos == 0)
|
||||
{
|
||||
return languages[i].lang;
|
||||
}
|
||||
}
|
||||
|
||||
const size_t NAME_CHECK_LANGUAGES = 3;
|
||||
FirstLineLanguages NAME_LEXER[NAME_CHECK_LANGUAGES] = {
|
||||
{ "make", L_MAKEFILE },
|
||||
{ "makefile", L_MAKEFILE },
|
||||
{ "CMakeLists", L_MAKEFILE },
|
||||
};
|
||||
|
||||
QFileInfo fi(filepath);
|
||||
QString baseName = fi.baseName();
|
||||
|
||||
for (int i = 0; i < NAME_CHECK_LANGUAGES; ++i)
|
||||
{
|
||||
if (0 == NAME_LEXER[i].pattern.compare(baseName, Qt::CaseInsensitive))
|
||||
{
|
||||
return NAME_LEXER[i].lang;
|
||||
}
|
||||
}
|
||||
|
||||
// Unrecognized first line, we assume it is a text file for now
|
||||
return L_UNKNOWN;
|
||||
}
|
||||
|
||||
+25
-22
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
#include "rcglobal.h"
|
||||
@@ -11,7 +11,7 @@
|
||||
class ScintillaEditView;
|
||||
class ScintillaHexEditView;
|
||||
|
||||
//小于100k的文件一次性全部读取完毕
|
||||
//小于100k的文件一次性全部读取完毕
|
||||
const int LITTLE_FILE_MAX = 1024000;
|
||||
|
||||
enum ERROR_TYPE {
|
||||
@@ -29,16 +29,16 @@ struct NewFileIdMgr {
|
||||
}
|
||||
};
|
||||
|
||||
//管理二进制文件的信息
|
||||
//管理二进制文件的信息
|
||||
struct HexFileMgr {
|
||||
QString filePath;
|
||||
QFile* file;
|
||||
qint64 fileOffset;
|
||||
qint64 fileSize;
|
||||
qint16 lineSize;//每次读取多少行,默认为64行,没行16个字符
|
||||
qint16 lineSize;//每次读取多少行,默认为64行,没行16个字符
|
||||
char* contentBuf;
|
||||
int contentRealSize;
|
||||
bool onetimeRead; //是否一次性全部读取到内存。小于等于LITTLE_FILE_MAX的才会全部读取
|
||||
bool onetimeRead; //是否一次性全部读取到内存。小于等于LITTLE_FILE_MAX的才会全部读取
|
||||
HexFileMgr() :file(nullptr), fileOffset(0), lineSize(64), fileSize(0), contentBuf(nullptr), contentRealSize(0),onetimeRead(false)
|
||||
{
|
||||
|
||||
@@ -62,17 +62,17 @@ private:
|
||||
HexFileMgr(const HexFileMgr&) = delete;
|
||||
};
|
||||
|
||||
//管理大文本文件的信息
|
||||
//管理大文本文件的信息
|
||||
struct TextFileMgr {
|
||||
QString filePath;
|
||||
QFile* file;
|
||||
qint64 fileOffset;
|
||||
qint64 fileSize;
|
||||
qint16 lineSize;//每次读取多少行,默认每次读取1024行。但是最大不超过1M的内容。
|
||||
qint16 lineSize;//每次读取多少行,默认每次读取1024行。但是最大不超过1M的内容。
|
||||
char* contentBuf;
|
||||
int contentRealSize;
|
||||
int loadWithCode;
|
||||
int lineEndType;//行尾类型,win linux mac
|
||||
int lineEndType;//行尾类型,win linux mac
|
||||
|
||||
TextFileMgr() :file(nullptr), fileOffset(0), lineSize(64), fileSize(0), contentBuf(nullptr), contentRealSize(0), loadWithCode(CODE_ID::UNKOWN),lineEndType(RC_LINE_FORM::UNKNOWN_LINE)
|
||||
{
|
||||
@@ -98,23 +98,23 @@ private:
|
||||
};
|
||||
|
||||
struct BlockIndex {
|
||||
qint64 fileOffset;//块的开始地址
|
||||
quint32 fileSize;//块的大小
|
||||
quint32 lineNumStart;//块中行号的开始值
|
||||
quint32 lineNum;//块中的行数量
|
||||
qint64 fileOffset;//块的开始地址
|
||||
quint32 fileSize;//块的大小
|
||||
quint32 lineNumStart;//块中行号的开始值
|
||||
quint32 lineNum;//块中的行数量
|
||||
};
|
||||
|
||||
//管理大文本文件,可以编辑的信息
|
||||
//管理大文本文件,可以编辑的信息
|
||||
struct BigTextEditFileMgr {
|
||||
QString filePath;
|
||||
QFile* file;
|
||||
uchar* filePtr;//使用的是文件映射的方式打开
|
||||
quint32 m_curBlockIndex; //当前展示中的块索引序号
|
||||
int loadWithCode; //以何种编码来加载解析文件。默认UTF8
|
||||
int lineEndType;//行尾类型,win linux mac
|
||||
static const qint16 BLOCK_SIZE = 1;//块大小,单位M。开始是4M,发现块越大,行越多,那么在一块中定位行的位置越慢
|
||||
uchar* filePtr;//使用的是文件映射的方式打开
|
||||
quint32 m_curBlockIndex; //当前展示中的块索引序号
|
||||
int loadWithCode; //以何种编码来加载解析文件。默认UTF8
|
||||
int lineEndType;//行尾类型,win linux mac
|
||||
static const qint16 BLOCK_SIZE = 1;//块大小,单位M。开始是4M,发现块越大,行越多,那么在一块中定位行的位置越慢
|
||||
|
||||
QVector<BlockIndex> blocks;//每一块的索引。打开文件的时候,需要建立该索引
|
||||
QVector<BlockIndex> blocks;//每一块的索引。打开文件的时候,需要建立该索引
|
||||
|
||||
BigTextEditFileMgr():filePtr(nullptr), file(nullptr), m_curBlockIndex(0), loadWithCode(CODE_ID::UNKOWN), lineEndType(RC_LINE_FORM::UNKNOWN_LINE)
|
||||
{
|
||||
@@ -154,8 +154,13 @@ public:
|
||||
|
||||
void delNewFileNode(int fileIndex);
|
||||
|
||||
int loadFileDataInText(ScintillaEditView * editView, QString filePath, CODE_ID & fileTextCode, RC_LINE_FORM &lineEnd, CCNotePad * callbackObj=nullptr, bool hexAsk = true, QWidget* MsgBoxParent=nullptr);
|
||||
int loadFileDataInTextFromOffset(ScintillaEditView* editView, QString filePath, CODE_ID fileTextCode, QWidget* msgBoxParent, quint64 startReadSize);
|
||||
|
||||
//下面这个是旧函数,之前对比时候用的。
|
||||
//int loadFileDataInText(ScintillaEditView * editView, QString filePath, CODE_ID & fileTextCode, RC_LINE_FORM &lineEnd, CCNotePad * callbackObj=nullptr, bool hexAsk = true, QWidget* MsgBoxParent=nullptr);
|
||||
|
||||
int loadFileDataInText(ScintillaEditView* editView, QString filePath, CODE_ID& fileTextCode, RC_LINE_FORM& lineEnd, CCNotePad* callbackObj = nullptr, bool hexAsk = true, QWidget* msgBoxParent = nullptr);
|
||||
|
||||
int loadFileForSearch(ScintillaEditView * editView, QString filePath);
|
||||
|
||||
//int loadFileData(ScintillaEditView * editView, QString filePath, CODE_ID & fileTextCode, RC_LINE_FORM & lineEnd);
|
||||
@@ -188,8 +193,6 @@ public:
|
||||
|
||||
void closeBigTextRoFileHand(QString filepath);
|
||||
|
||||
LangType detectLanguageFromTextBegining(const unsigned char * data, size_t dataLen);
|
||||
|
||||
static FileManager& getInstance() {
|
||||
static FileManager instance;
|
||||
return instance;
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<number>-100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -34,3 +34,29 @@ void CTipWin::slot_delayClose()
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
void CTipWin::showTips(QWidget* parent, QString text, int sec, bool isMousePos)
|
||||
{
|
||||
|
||||
if (parent != nullptr)
|
||||
{
|
||||
CTipWin* pWin = new CTipWin();
|
||||
pWin->setTipText(text);
|
||||
pWin->setAttribute(Qt::WA_DeleteOnClose);
|
||||
pWin->showMsg(sec);
|
||||
|
||||
if (!isMousePos)
|
||||
{
|
||||
QPoint pos = parent->pos();
|
||||
QSize size = parent->size();
|
||||
|
||||
QPoint newPos(pos.x() + 10, pos.y() + size.height() - 20);
|
||||
pWin->move(newPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
pWin->move(parent->cursor().pos());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
~CTipWin();
|
||||
void setTipText(QString text);
|
||||
void showMsg(int sec = 2000);
|
||||
static void showTips(QWidget* parent, QString text, int sec, bool isMousePos = false);
|
||||
|
||||
private slots:
|
||||
void slot_delayClose();
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>295</width>
|
||||
<height>69</height>
|
||||
<height>35</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
#include "dectfilechanges.h"
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
DectFileChanges::DectFileChanges():m_lastFileSize(0), m_curFileSize(0)
|
||||
{
|
||||
_szFile = NULL;
|
||||
_dwNotifyFilter = 0;
|
||||
}
|
||||
|
||||
|
||||
DectFileChanges::~DectFileChanges()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BOOL DectFileChanges::DetectChanges() {
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA fInfo;
|
||||
BOOL rValue = FALSE;
|
||||
::GetFileAttributesEx(_szFile, GetFileExInfoStandard, &fInfo);
|
||||
|
||||
if ((_dwNotifyFilter & FILE_NOTIFY_CHANGE_SIZE) && (fInfo.nFileSizeHigh != _lastFileInfo.nFileSizeHigh || fInfo.nFileSizeLow != _lastFileInfo.nFileSizeLow)) {
|
||||
rValue = TRUE;
|
||||
}
|
||||
|
||||
if ((_dwNotifyFilter & FILE_NOTIFY_CHANGE_LAST_WRITE) && (fInfo.ftLastWriteTime.dwHighDateTime != _lastFileInfo.ftLastWriteTime.dwHighDateTime || fInfo.ftLastWriteTime.dwLowDateTime != _lastFileInfo.ftLastWriteTime.dwLowDateTime)) {
|
||||
rValue = TRUE;
|
||||
}
|
||||
|
||||
if (rValue)
|
||||
{
|
||||
m_lastFileSize = getFileSize(_lastFileInfo);
|
||||
}
|
||||
_lastFileInfo = fInfo;
|
||||
|
||||
if (rValue)
|
||||
{
|
||||
m_curFileSize = getFileSize(_lastFileInfo);
|
||||
}
|
||||
return rValue;
|
||||
}
|
||||
|
||||
void DectFileChanges::AddFile(LPCTSTR szFile, DWORD dwNotifyFilter)
|
||||
{
|
||||
_szFile = szFile;
|
||||
_dwNotifyFilter = dwNotifyFilter;
|
||||
::GetFileAttributesEx(szFile, GetFileExInfoStandard, &_lastFileInfo);
|
||||
}
|
||||
|
||||
|
||||
void DectFileChanges::Terminate()
|
||||
{
|
||||
_szFile = NULL;
|
||||
_dwNotifyFilter = 0;
|
||||
}
|
||||
quint64 DectFileChanges::getFileSize(WIN32_FILE_ATTRIBUTE_DATA& data)
|
||||
{
|
||||
quint64 fileSize = data.nFileSizeHigh;
|
||||
fileSize = (fileSize << 32);
|
||||
fileSize += data.nFileSizeLow;
|
||||
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
void DectFileChanges::getDiffFileSize(quint64& lastSize, quint64& curSize)
|
||||
{
|
||||
lastSize = m_lastFileSize;
|
||||
curSize = m_curFileSize;
|
||||
}
|
||||
|
||||
#endif
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN
|
||||
#endif
|
||||
|
||||
//ÏÂÃæNOMINMAX±£Ö¤std::min²»Öظ´¶¨Òå
|
||||
#define NOMINMAX
|
||||
|
||||
#include <windows.h>
|
||||
#include <QtGlobal>
|
||||
|
||||
class DectFileChanges
|
||||
{
|
||||
public:
|
||||
DectFileChanges();
|
||||
~DectFileChanges();
|
||||
void AddFile(LPCTSTR szDirectory, DWORD dwNotifyFilter);
|
||||
BOOL DetectChanges();
|
||||
void Terminate();
|
||||
|
||||
void getDiffFileSize(quint64& lastSize, quint64& curSize);
|
||||
|
||||
private:
|
||||
quint64 getFileSize(WIN32_FILE_ATTRIBUTE_DATA& data);
|
||||
|
||||
private:
|
||||
LPCTSTR _szFile = nullptr;
|
||||
DWORD _dwNotifyFilter = 0;
|
||||
WIN32_FILE_ATTRIBUTE_DATA _lastFileInfo = {};
|
||||
|
||||
quint64 m_lastFileSize;
|
||||
quint64 m_curFileSize;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -289,7 +289,7 @@ QFuture<EncodeThreadParameter*> EncodeConvert::commitTask(std::function<EncodeTh
|
||||
}
|
||||
|
||||
|
||||
//对比左右文件的大小,sha1值来判断文件是否相等
|
||||
//识别文件编码
|
||||
QFuture<EncodeThreadParameter_*> EncodeConvert::checkFileCode(QString filePath, QTreeWidgetItem* item)
|
||||
{
|
||||
EncodeThreadParameter_* p = new EncodeThreadParameter_(filePath);
|
||||
@@ -298,7 +298,8 @@ QFuture<EncodeThreadParameter_*> EncodeConvert::checkFileCode(QString filePath,
|
||||
//int 0相等 1 不等
|
||||
return commitTask([](EncodeThreadParameter_* parameter)->EncodeThreadParameter_*
|
||||
{
|
||||
parameter->code = CmpareMode::scanFileRealCode(parameter->filepath);
|
||||
//整个文件都要扫描完毕。还是怕太慢,最多1000行吧
|
||||
parameter->code = CmpareMode::scanFileRealCode(parameter->filepath,1000);
|
||||
return parameter;
|
||||
}
|
||||
, p);
|
||||
@@ -473,6 +474,7 @@ void EncodeConvert::scanFileCode()
|
||||
{
|
||||
iter->selfItem->setText(2, QString("--"));
|
||||
}
|
||||
//20230304 编码转换这里,不能仅仅只识别已知后缀文件,要失败所有文件
|
||||
else if ((iter->type == RC_FILE) && DocTypeListView::isSupportExt(fileSuffix(iter->relativePath)))
|
||||
{
|
||||
QFutureWatcher<EncodeThreadParameter_*>* futureWatcher = new QFutureWatcher<EncodeThreadParameter_*>();
|
||||
|
||||
Executable
+288
@@ -0,0 +1,288 @@
|
||||
#include "findresultview.h"
|
||||
#include "styleset.h"
|
||||
#include "findresultwin.h"
|
||||
#include "ctipwin.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
#include <QClipboard>
|
||||
|
||||
|
||||
const int MARGE_FOLDER = 1;
|
||||
const int STYLE_COLOUR_TITLE = 1;
|
||||
const int STYLE_COLOUR_DEST_FILE = 2;
|
||||
const int STYLE_COLOUR_KEYWORD_HIGH = 3;
|
||||
const int STYLE_COLOUR_KEYWORD_BACK_HIGH = 4;
|
||||
const int STYLE_DEEP_COLOUR_KEYWORD_HIGH = 5; //深色模式下面的前景色
|
||||
const int STYLE_DEEP_COLOUR_DEST_FILE = 6;
|
||||
|
||||
static void getFoldColor(QColor& fgColor, QColor& bgColor, QColor& activeFgColor)
|
||||
{
|
||||
//这里看起来反了,但是实际代码就是如此
|
||||
fgColor = StyleSet::s_global_style->fold.bgColor;
|
||||
bgColor = StyleSet::s_global_style->fold.fgColor;
|
||||
|
||||
activeFgColor = StyleSet::s_global_style->fold_active.fgColor;
|
||||
|
||||
}
|
||||
|
||||
void FindResultView::setFoldColor(int margin, QColor fgClack, QColor bkColor, QColor foreActive)
|
||||
{
|
||||
SendScintilla(SCI_MARKERSETFORE, margin, fgClack);
|
||||
SendScintilla(SCI_MARKERSETBACK, margin, bkColor);
|
||||
SendScintilla(SCI_MARKERSETBACKSELECTED, margin, foreActive);
|
||||
}
|
||||
|
||||
FindResultView::FindResultView(QWidget *parent)
|
||||
: QsciScintilla(parent)
|
||||
{
|
||||
//通过fold发现,尽量使用qscint的功能,因为他做了大量封装和简化
|
||||
setFolding(BoxedTreeFoldStyle, MARGE_FOLDER);
|
||||
|
||||
SendScintilla(SCI_SETMARGINWIDTHN, MARGE_FOLDER, 14);
|
||||
|
||||
SendScintilla(SCI_MARKERSETFORE, SC_MARKNUM_FOLDERSUB, QColor(0xff,0,0));
|
||||
|
||||
setCaretLineVisible(true);
|
||||
SendScintilla(SCI_SETSCROLLWIDTHTRACKING, true);
|
||||
SendScintilla(SCI_SETCARETLINEBACK, StyleSet::s_global_style->current_line_background_color.bgColor);
|
||||
|
||||
QColor foldfgColor = Qt::white, foldbgColor = Qt::gray, activeFoldFgColor = Qt::red;
|
||||
getFoldColor(foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
setFoldMarginColors(StyleSet::s_global_style->fold_margin.fgColor, StyleSet::s_global_style->fold_margin.bgColor);
|
||||
setFoldColor(SC_MARKNUM_FOLDEROPEN, foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
setFoldColor(SC_MARKNUM_FOLDER, foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
setFoldColor(SC_MARKNUM_FOLDERSUB, foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
setFoldColor(SC_MARKNUM_FOLDERTAIL, foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
setFoldColor(SC_MARKNUM_FOLDEREND, foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
setFoldColor(SC_MARKNUM_FOLDEROPENMID, foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
setFoldColor(SC_MARKNUM_FOLDERMIDTAIL, foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
|
||||
SendScintilla(SCI_STYLESETSIZE, STYLE_DEFAULT, 12);
|
||||
|
||||
if (!StyleSet::isCurrentDeepStyle())
|
||||
{
|
||||
this->setPaper(StyleSet::s_global_style->default_style.bgColor);
|
||||
|
||||
SendScintilla(SCI_STYLESETBACK, STYLE_COLOUR_TITLE, 0xffbbbb);
|
||||
SendScintilla(SCI_STYLESETBACK, STYLE_COLOUR_DEST_FILE, 0xd5ffd5);
|
||||
SendScintilla(SCI_STYLESETEOLFILLED, STYLE_COLOUR_TITLE, true);
|
||||
SendScintilla(SCI_STYLESETEOLFILLED, STYLE_COLOUR_DEST_FILE, true);
|
||||
SendScintilla(SCI_STYLESETFORE, STYLE_COLOUR_KEYWORD_HIGH, 0x4080ff);
|
||||
SendScintilla(SCI_STYLESETBACK, STYLE_COLOUR_KEYWORD_BACK_HIGH, 0xbfffff);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setColor(StyleSet::s_global_style->default_style.fgColor);
|
||||
this->setPaper(StyleSet::s_global_style->default_style.bgColor);
|
||||
|
||||
//QColor& col = StyleSet::s_global_style->default_style.fgColor;
|
||||
//sptr_t fgLParam = (col.blue() << 16) | (col.green() << 8) | col.red();
|
||||
|
||||
QColor& col2 = StyleSet::s_global_style->default_style.bgColor;
|
||||
sptr_t bklParam = (col2.blue() << 16) | (col2.green() << 8) | col2.red();
|
||||
|
||||
SendScintilla(SCI_STYLESETBACK, STYLE_COLOUR_TITLE, 0xffbbbb);
|
||||
SendScintilla(SCI_STYLESETEOLFILLED, STYLE_COLOUR_TITLE, true);
|
||||
//SendScintilla(SCI_STYLESETFORE, STYLE_COLOUR_TITLE, fgLParam);
|
||||
|
||||
SendScintilla(SCI_STYLESETBACK, STYLE_DEEP_COLOUR_DEST_FILE, bklParam);
|
||||
SendScintilla(SCI_STYLESETFORE, STYLE_DEEP_COLOUR_DEST_FILE, 0x99cc99);
|
||||
//SendScintilla(SCI_STYLESETFORE, STYLE_DEEP_COLOUR_DEST_FILE, fgLParam);
|
||||
//SendScintilla(SCI_STYLESETBOLD, STYLE_DEEP_COLOUR_DEST_FILE, 1);//这个无法生效。可能是qscint bug
|
||||
|
||||
//文字要大一号,然后颜色是绿色
|
||||
SendScintilla(SCI_STYLESETSIZE, STYLE_DEEP_COLOUR_DEST_FILE, 14);
|
||||
|
||||
SendScintilla(SCI_STYLESETFORE, STYLE_DEEP_COLOUR_KEYWORD_HIGH, 0x00aaff);
|
||||
SendScintilla(SCI_STYLESETBACK, STYLE_DEEP_COLOUR_KEYWORD_HIGH, bklParam);
|
||||
|
||||
|
||||
//给行号使用
|
||||
SendScintilla(SCI_STYLESETFORE, STYLE_COLOUR_KEYWORD_HIGH, 0x4080ff);
|
||||
SendScintilla(SCI_STYLESETBACK, STYLE_COLOUR_KEYWORD_HIGH, bklParam);
|
||||
}
|
||||
|
||||
|
||||
this->setReadOnly(true);
|
||||
|
||||
m_resultWin = dynamic_cast<FindResultWin*>(parent);
|
||||
}
|
||||
|
||||
FindResultView::~FindResultView()
|
||||
{}
|
||||
|
||||
//设置行背景色
|
||||
void FindResultView::setLineBackColorStyle(int line, int style)
|
||||
{
|
||||
int startPos = SendScintilla(SCI_POSITIONFROMLINE, line);
|
||||
int len = SendScintilla(SCI_LINELENGTH, line);
|
||||
|
||||
SendScintilla(SCI_STARTSTYLING, startPos);
|
||||
SendScintilla(SCI_SETSTYLING, len, style);
|
||||
}
|
||||
|
||||
//设置行前景色。line 行号,从相对行pos的位置开始
|
||||
void FindResultView::setLineColorStyle(int line, int offsetPos, int length, int style)
|
||||
{
|
||||
int startPos = SendScintilla(SCI_POSITIONFROMLINE, line);
|
||||
SendScintilla(SCI_STARTSTYLING, startPos + offsetPos);
|
||||
SendScintilla(SCI_SETSTYLING, length, style);
|
||||
}
|
||||
|
||||
|
||||
void FindResultView::mouseDoubleClickEvent(QMouseEvent* /*e*/)
|
||||
{
|
||||
//QsciScintilla::mouseDoubleClickEvent(e);
|
||||
|
||||
int line = 0;
|
||||
int index = 0;
|
||||
|
||||
this->getCursorPosition(&line,&index);
|
||||
|
||||
emit lineDoubleClick(line);
|
||||
}
|
||||
|
||||
void FindResultView::contextUserDefineMenuEvent(QMenu* menu)
|
||||
{
|
||||
if (menu != nullptr)
|
||||
{
|
||||
//移动一下位置
|
||||
|
||||
QAction* pCopy = menu->findChild<QAction*>("copy");
|
||||
if (pCopy != nullptr)
|
||||
{
|
||||
menu->removeAction(pCopy);
|
||||
}
|
||||
|
||||
menu->addAction(tr("Fold All"), this, &FindResultView::on_foldAll);
|
||||
menu->addAction(tr("Expand All"), this, &FindResultView::on_expandAll);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
if (pCopy != nullptr)
|
||||
{
|
||||
menu->addAction(pCopy);
|
||||
}
|
||||
menu->addAction(tr("copy select line"), this, &FindResultView::on_copySelectLine);
|
||||
menu->addAction(tr("warp"), this, &FindResultView::on_warp);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
menu->addAction(tr("clear"), this, &FindResultView::on_clear);
|
||||
menu->addAction(tr("close"), this, &FindResultView::on_close);
|
||||
|
||||
|
||||
}
|
||||
menu->move(cursor().pos()); //让菜单显示的位置在鼠标的坐标上
|
||||
menu->show();
|
||||
}
|
||||
|
||||
void FindResultView::on_foldAll()
|
||||
{
|
||||
for (int i = 0; i < m_resultWin->m_resultLineInfo.size(); ++i)
|
||||
{
|
||||
const ResultLineInfo& lineInfo = m_resultWin->m_resultLineInfo.at(i);
|
||||
|
||||
//如果是1级别的行,则进行一个收起操作
|
||||
if ((lineInfo.level == 1) || (lineInfo.level == 0))
|
||||
{
|
||||
SendScintilla(SCI_FOLDLINE, i, (long)SC_FOLDACTION_CONTRACT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FindResultView::on_expandAll()
|
||||
{
|
||||
for (int i = 0; i < m_resultWin->m_resultLineInfo.size(); ++i)
|
||||
{
|
||||
const ResultLineInfo& lineInfo = m_resultWin->m_resultLineInfo.at(i);
|
||||
|
||||
//如果是1级别的行,则进行一个收起操作
|
||||
if ((lineInfo.level == 1) || (lineInfo.level == 0))
|
||||
{
|
||||
SendScintilla(SCI_FOLDLINE, i, SC_FOLDACTION_EXPAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//复制选中的内容
|
||||
//void FindResultView::on_copySelect()
|
||||
//{
|
||||
// QString word = selectedText();
|
||||
// if (!word.isEmpty())
|
||||
// {
|
||||
// QClipboard* clipboard = QApplication::clipboard();
|
||||
// clipboard->setText(word);
|
||||
//
|
||||
// CTipWin::showTips(this, tr("Copy to clipboard Finished!"), 1200,true);
|
||||
// }
|
||||
//}
|
||||
|
||||
//复制选中行
|
||||
void FindResultView::on_copySelectLine()
|
||||
{
|
||||
int startPos = SendScintilla(SCI_GETSELECTIONSTART);
|
||||
int endPos = SendScintilla(SCI_GETSELECTIONEND);
|
||||
|
||||
int startLine = SendScintilla(SCI_LINEFROMPOSITION, startPos);
|
||||
int endLine = SendScintilla(SCI_LINEFROMPOSITION, endPos);
|
||||
|
||||
int start = SendScintilla(SCI_POSITIONFROMLINE, startLine);
|
||||
int end = SendScintilla(SCI_POSITIONFROMLINE, endLine+1);
|
||||
|
||||
char *dest = new char[end - start + 1];
|
||||
dest[end - start] = '\0';
|
||||
|
||||
Sci_TextRange tr;
|
||||
tr.chrg.cpMin = static_cast<Sci_PositionCR>(start);
|
||||
tr.chrg.cpMax = static_cast<Sci_PositionCR>(end);
|
||||
tr.lpstrText = dest;
|
||||
|
||||
this->SendScintilla(SCI_GETTEXTRANGE, 0, &tr);
|
||||
|
||||
QString text(dest);
|
||||
|
||||
QStringList lineText = text.split("\n");
|
||||
QString selectConnect;
|
||||
|
||||
for (int i = 0; i < lineText.size(); ++i)
|
||||
{
|
||||
const QString& t = lineText.at(i);
|
||||
int pos = t.indexOf(": ");
|
||||
if (pos != -1)
|
||||
{
|
||||
QString v = t.mid(pos + 2);
|
||||
selectConnect.append(v);
|
||||
selectConnect.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(selectConnect);
|
||||
|
||||
//CTipWin::showTips(this, tr("Copy to clipboard Finished!"), 1200, true);
|
||||
}
|
||||
|
||||
void FindResultView::on_clear()
|
||||
{
|
||||
this->clear();
|
||||
m_resultWin->clear();
|
||||
}
|
||||
|
||||
void FindResultView::on_close()
|
||||
{
|
||||
m_resultWin->m_parent->close();
|
||||
}
|
||||
|
||||
void FindResultView::on_warp()
|
||||
{
|
||||
if (SC_WRAP_CHAR != wrapMode())
|
||||
{
|
||||
this->setWrapMode(QsciScintilla::WrapCharacter);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setWrapMode(QsciScintilla::WrapNone);
|
||||
}
|
||||
}
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
#include <QWidget>
|
||||
#include <qsciscintilla.h>
|
||||
#include <QMouseEvent>
|
||||
#include <QMenu>
|
||||
|
||||
extern const int MARGIN_VER_LINE;
|
||||
extern const int STYLE_COLOUR_TITLE;
|
||||
extern const int STYLE_COLOUR_DEST_FILE;
|
||||
extern const int STYLE_COLOUR_KEYWORD_HIGH;
|
||||
extern const int STYLE_COLOUR_KEYWORD_BACK_HIGH;
|
||||
extern const int STYLE_DEEP_COLOUR_KEYWORD_HIGH;
|
||||
extern const int STYLE_DEEP_COLOUR_DEST_FILE;
|
||||
|
||||
class FindResultWin;
|
||||
|
||||
class FindResultView : public QsciScintilla
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FindResultView(QWidget* parent);
|
||||
virtual ~FindResultView();
|
||||
|
||||
void setLineBackColorStyle(int line, int style);
|
||||
void setLineColorStyle(int line, int pos, int length, int style);
|
||||
|
||||
signals:
|
||||
void lineDoubleClick(int line);
|
||||
|
||||
public slots:
|
||||
void on_foldAll();
|
||||
private slots:
|
||||
|
||||
void on_expandAll();
|
||||
//void on_copySelect();
|
||||
void on_copySelectLine();
|
||||
void on_clear();
|
||||
void on_close();
|
||||
void on_warp();
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QMouseEvent* e) override;
|
||||
void contextUserDefineMenuEvent(QMenu* menu) override;
|
||||
void setFoldColor(int margin, QColor fgClack, QColor bkColor, QColor foreActive);
|
||||
|
||||
private:
|
||||
FindResultWin* m_resultWin;
|
||||
};
|
||||
+203
-465
@@ -3,19 +3,20 @@
|
||||
#include "common.h"
|
||||
#include "styleset.h"
|
||||
#include "nddsetting.h"
|
||||
#include "findresultview.h"
|
||||
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QStyleFactory>
|
||||
#include <QToolButton>
|
||||
#include <qtreeview.h>
|
||||
#include <QStandardItem>
|
||||
#include <QStandardItemModel>
|
||||
#include <qsciscintilla.h>
|
||||
#include <Scintilla.h>
|
||||
|
||||
//#include <QTreeWidgetItem>
|
||||
//#include <QStyleFactory>
|
||||
//#include <QToolButton>
|
||||
//#include <qtreeview.h>
|
||||
//#include <QStandardItem>
|
||||
//#include <QStandardItemModel>
|
||||
#include <QClipboard>
|
||||
#include <QTextEdit>
|
||||
#include <qscrollbar.h>
|
||||
|
||||
#include "ndstyleditemdelegate.h"
|
||||
|
||||
//目前可以高亮,使用富文本进行了高亮设置。但是有个问题:富文本与html有一些冲突,在<>存在时,可能导致乱。这是一个问题。20220609
|
||||
//使用Html的转义解决了该问题
|
||||
|
||||
@@ -23,51 +24,8 @@ FindResultWin::FindResultWin(QWidget *parent)
|
||||
: QWidget(parent), m_menu(nullptr), m_parent(parent),m_defaultFontSize(14), m_defFontSizeChange(false)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
//设置左边的缩起来按钮为加号,而不是箭头
|
||||
ui.resultTreeView->setStyle(QStyleFactory::create("windows"));
|
||||
ui.resultTreeView->header()->hide();
|
||||
connect(ui.displayView, &FindResultView::lineDoubleClick, this, &FindResultWin::on_lineDoubleClick);
|
||||
|
||||
m_model = new QStandardItemModel(ui.resultTreeView);
|
||||
m_delegate = new NdStyledItemDelegate(ui.resultTreeView);
|
||||
ui.resultTreeView->setModel(m_model);
|
||||
ui.resultTreeView->setItemDelegate(m_delegate);
|
||||
ui.resultTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
ui.resultTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
//#if defined (Q_OS_MAC)
|
||||
// QString qss = "QTreeView::item:selected{ \
|
||||
// background:#e8e8ff; \
|
||||
// } \
|
||||
// QTreeView::item{ \
|
||||
// height:18px; \
|
||||
// }";
|
||||
//#else
|
||||
// QString qss = "QTreeView::item:selected{ \
|
||||
// background:#e8e8ff; \
|
||||
// }";
|
||||
//#endif
|
||||
// ui.resultTreeView->setStyleSheet(qss);
|
||||
|
||||
connect(ui.resultTreeView, &QTreeView::doubleClicked, this, &FindResultWin::itemDoubleClicked);
|
||||
|
||||
connect(ui.resultTreeView, SIGNAL(pressed(QModelIndex)), this, SLOT(slot_treeView_pressed(QModelIndex)));
|
||||
connect(ui.resultTreeView, SIGNAL(expanded(QModelIndex)), this, SLOT(slot_treeView_pressed(QModelIndex)));
|
||||
|
||||
ui.resultTreeView->verticalScrollBar()->setStyle(QStyleFactory::create("vis"));
|
||||
ui.resultTreeView->horizontalScrollBar()->setStyle(QStyleFactory::create("vis"));
|
||||
|
||||
int defFontSize = NddSetting::getKeyValueFromNumSets(FIND_RESULT_FONT_SIZE);
|
||||
if (defFontSize >= 8)
|
||||
{
|
||||
m_defaultFontSize = defFontSize;
|
||||
|
||||
QFont curFt = ui.resultTreeView->font();
|
||||
curFt.setPointSize(m_defaultFontSize);
|
||||
ui.resultTreeView->setFont(curFt);
|
||||
|
||||
m_delegate->setFontSize(m_defaultFontSize);
|
||||
}
|
||||
}
|
||||
|
||||
FindResultWin::~FindResultWin()
|
||||
@@ -75,311 +33,32 @@ FindResultWin::~FindResultWin()
|
||||
if (m_defFontSizeChange)
|
||||
{
|
||||
NddSetting::updataKeyValueFromNumSets(FIND_RESULT_FONT_SIZE, m_defaultFontSize);
|
||||
}
|
||||
}
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
void FindResultWin::slot_treeView_pressed(QModelIndex modeIndex)
|
||||
void FindResultWin::clear()
|
||||
{
|
||||
ui.resultTreeView->resizeColumnToContents(modeIndex.column());
|
||||
}
|
||||
|
||||
void FindResultWin::contextMenuEvent(QContextMenuEvent *)
|
||||
{
|
||||
if (m_menu == nullptr)
|
||||
for (int i = 0; i < m_resultLineFilePath.size(); ++i)
|
||||
{
|
||||
m_menu = new QMenu(this);
|
||||
m_menu->addAction(tr("clear this find result"), this, &FindResultWin::slot_clearContents);
|
||||
m_menu->addAction(tr("clear all find result"), this, &FindResultWin::slot_clearAllContents);
|
||||
|
||||
m_menu->addSeparator();
|
||||
m_pSelectSectonAct = m_menu->addAction(tr("select section"), this, &FindResultWin::slot_selectSection);
|
||||
m_menu->addAction(tr("select all item"), this, &FindResultWin::slot_selectAll);
|
||||
|
||||
m_menu->addSeparator();
|
||||
|
||||
m_menu->addAction(tr("copy select item (Ctrl Muli)"), this, &FindResultWin::slot_copyItemContents);
|
||||
m_menu->addAction(tr("copy select Line (Ctrl Muli)"), this, &FindResultWin::slot_copyContents);
|
||||
|
||||
m_menu->addSeparator();
|
||||
m_menu->addAction(tr("Zoom In"), this, &FindResultWin::slot_fontZoomIn);
|
||||
m_menu->addAction(tr("Zoom Out"), this, &FindResultWin::slot_fontZoomOut);
|
||||
m_menu->addAction(tr("close"), m_parent, &QWidget::close);
|
||||
|
||||
delete m_resultLineFilePath.at(i);
|
||||
}
|
||||
m_menu->move(cursor().pos()); //让菜单显示的位置在鼠标的坐标上
|
||||
m_menu->show();
|
||||
|
||||
QModelIndex curSelItem = ui.resultTreeView->currentIndex();
|
||||
|
||||
if (!curSelItem.data(ResultItemRoot).isNull())
|
||||
{
|
||||
//是根不能选择section
|
||||
m_pSelectSectonAct->setEnabled(false);
|
||||
}
|
||||
else if (!curSelItem.data(ResultItemEditor).isNull())
|
||||
{
|
||||
m_pSelectSectonAct->setEnabled(true);
|
||||
}
|
||||
else if (!curSelItem.data(ResultItemPos).isNull())
|
||||
{
|
||||
m_pSelectSectonAct->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void FindResultWin::slot_clearContents()
|
||||
{
|
||||
QModelIndex curSelItem = ui.resultTreeView->currentIndex();
|
||||
|
||||
if (!curSelItem.data(ResultItemRoot).isNull())
|
||||
{
|
||||
//是根可以直接删除
|
||||
m_model->removeRow(curSelItem.row());
|
||||
}
|
||||
else if (!curSelItem.data(ResultItemEditor).isNull())
|
||||
{
|
||||
//需要找到上一个父节点,即根
|
||||
QModelIndex rootItem = curSelItem.parent();
|
||||
|
||||
if (rootItem.isValid())
|
||||
{
|
||||
m_model->removeRow(curSelItem.row(), rootItem);
|
||||
|
||||
if (0 == m_model->rowCount(rootItem))
|
||||
{
|
||||
m_model->removeRow(rootItem.row());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!curSelItem.data(ResultItemPos).isNull())
|
||||
{
|
||||
//需要找到上两个父节点,即根
|
||||
QModelIndex itemEditor = curSelItem.parent();
|
||||
if (itemEditor.isValid())
|
||||
{
|
||||
QModelIndex rootItem = itemEditor.parent();
|
||||
if (rootItem.isValid())
|
||||
{
|
||||
m_model->removeRow(itemEditor.row(), rootItem);
|
||||
if (0 == m_model->rowCount(rootItem))
|
||||
{
|
||||
m_model->removeRow(rootItem.row());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//全选
|
||||
void FindResultWin::slot_selectAll()
|
||||
{
|
||||
|
||||
QModelIndex root = ui.resultTreeView->rootIndex();
|
||||
|
||||
QModelIndex curSelItem = ui.resultTreeView->currentIndex();
|
||||
QModelIndex firstRootItem;
|
||||
//先找到根节点
|
||||
while (curSelItem.isValid())
|
||||
{
|
||||
QModelIndex pMi = curSelItem.parent();
|
||||
if (pMi.isValid())
|
||||
{
|
||||
curSelItem = pMi;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//找到第一个兄弟根节点
|
||||
if (curSelItem.row() != 0)
|
||||
{
|
||||
firstRootItem = curSelItem.siblingAtRow(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
firstRootItem = curSelItem;
|
||||
}
|
||||
|
||||
auto selectSection = [this](QModelIndex& sectionItem)->int{
|
||||
//遍历其下面的所有子节点
|
||||
ui.resultTreeView->selectionModel()->select(sectionItem, QItemSelectionModel::Select);
|
||||
|
||||
//遍历下面的子节点
|
||||
int i = 0;
|
||||
QModelIndex childMi;
|
||||
childMi = sectionItem.child(i, 0);
|
||||
while (childMi.isValid())
|
||||
{
|
||||
++i;
|
||||
ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select);
|
||||
childMi = sectionItem.child(i, 0);
|
||||
}
|
||||
return i+1;
|
||||
};
|
||||
|
||||
QModelIndex rootItem = firstRootItem;
|
||||
int j = 0;
|
||||
int selectCount = 0;
|
||||
while (rootItem.isValid())
|
||||
{
|
||||
//遍历根节点下面每一个section
|
||||
{
|
||||
int i = 0;
|
||||
QModelIndex section = rootItem.child(i, 0);
|
||||
while (section.isValid() && !section.data(ResultItemEditor).isNull())
|
||||
{
|
||||
++i;
|
||||
selectCount += selectSection(section);
|
||||
section = firstRootItem.child(i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//切换到下一个查找的根节点
|
||||
j++;
|
||||
rootItem = firstRootItem.siblingAtRow(j);
|
||||
}
|
||||
|
||||
QString msg = tr("%1 rows selected !").arg(selectCount);
|
||||
emit showMsg(msg);
|
||||
}
|
||||
|
||||
void FindResultWin::slot_selectSection()
|
||||
{
|
||||
QModelIndex curSelItem = ui.resultTreeView->currentIndex();
|
||||
|
||||
auto selectSection = [this](QModelIndex& sectionItem)->int {
|
||||
//遍历其下面的所有子节点
|
||||
ui.resultTreeView->selectionModel()->select(sectionItem, QItemSelectionModel::Select);
|
||||
|
||||
//遍历下面的子节点
|
||||
int i = 0;
|
||||
QModelIndex childMi;
|
||||
childMi = sectionItem.child(i, 0);
|
||||
while (childMi.isValid())
|
||||
{
|
||||
++i;
|
||||
ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select);
|
||||
childMi = sectionItem.child(i, 0);
|
||||
}
|
||||
return i+1;
|
||||
};
|
||||
|
||||
int selectCount = 0;
|
||||
|
||||
if (!curSelItem.data(ResultItemRoot).isNull())
|
||||
{
|
||||
//啥也不做。不能选择多个section
|
||||
}
|
||||
else if (!curSelItem.data(ResultItemEditor).isNull())
|
||||
{
|
||||
selectCount = selectSection(curSelItem);
|
||||
|
||||
}
|
||||
else if (!curSelItem.data(ResultItemPos).isNull())
|
||||
{
|
||||
//其父节点
|
||||
QModelIndex sectionItem = curSelItem.parent();
|
||||
if (!sectionItem.data(ResultItemEditor).isNull())
|
||||
{
|
||||
selectCount = selectSection(sectionItem);
|
||||
}
|
||||
}
|
||||
|
||||
QString msg = tr("%1 rows selected !").arg(selectCount);
|
||||
emit showMsg(msg);
|
||||
}
|
||||
|
||||
//拷贝item的行,不进行过滤,全部拷贝
|
||||
void FindResultWin::slot_copyItemContents()
|
||||
{
|
||||
QModelIndexList selectList;
|
||||
|
||||
ui.resultTreeView->getSelectedIndexes(selectList);
|
||||
|
||||
QString selectConnect;
|
||||
|
||||
for (int i = 0, s = selectList.size(); i < s; ++i)
|
||||
{
|
||||
|
||||
QModelIndex curSelItem = selectList.at(i);
|
||||
|
||||
QString text = m_model->itemData(curSelItem).values()[0].toString();
|
||||
|
||||
QTextEdit t(this);
|
||||
t.setAcceptRichText(true);
|
||||
t.setText(text);
|
||||
text = t.toPlainText();
|
||||
|
||||
selectConnect.append(text);
|
||||
selectConnect.append("\n");
|
||||
}
|
||||
|
||||
QClipboard *clip = QApplication::clipboard();
|
||||
clip->setText(selectConnect);
|
||||
|
||||
QString msg = tr("%1 items have been copied to the clipboard !").arg(selectList.size());
|
||||
emit showMsg(msg);
|
||||
}
|
||||
|
||||
void FindResultWin::slot_copyContents()
|
||||
{
|
||||
QModelIndexList selectList;
|
||||
|
||||
//std::sort(selectList.begin(), selectList.end(), [](QModelIndex& a, QModelIndex& b) {
|
||||
// return a.row() < b.row();
|
||||
//});
|
||||
|
||||
ui.resultTreeView->getSelectedIndexes(selectList);
|
||||
|
||||
QString selectConnect;
|
||||
|
||||
int copyTimes = 0;
|
||||
|
||||
for (int i = 0, s = selectList.size(); i < s; ++i)
|
||||
{
|
||||
QModelIndex curSelItem = selectList.at(i);
|
||||
|
||||
//只拷贝真正的行内容
|
||||
if (curSelItem.data(ResultItemPos).isNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
copyTimes++;
|
||||
|
||||
QString text = m_model->itemData(curSelItem).values()[0].toString();
|
||||
|
||||
QTextEdit t(this);
|
||||
t.setAcceptRichText(true);
|
||||
t.setText(text);
|
||||
text = t.toPlainText();
|
||||
|
||||
int pos = text.indexOf(": ");
|
||||
if (pos != -1)
|
||||
{
|
||||
text = text.mid(pos + 2);
|
||||
}
|
||||
|
||||
selectConnect.append(text);
|
||||
selectConnect.append("\n");
|
||||
}
|
||||
|
||||
QClipboard *clip = QApplication::clipboard();
|
||||
clip->setText(selectConnect);
|
||||
|
||||
QString msg = tr("%1 lines have been copied to the clipboard !").arg(copyTimes);
|
||||
emit showMsg(msg);
|
||||
m_resultLineFilePath.clear();
|
||||
m_resultLineInfo.clear();
|
||||
}
|
||||
|
||||
void FindResultWin::slot_clearAllContents()
|
||||
{
|
||||
m_model->clear();
|
||||
clear();
|
||||
ui.displayView->clear();
|
||||
}
|
||||
|
||||
#if 0 //老的机制,暂时屏蔽,后续可删除
|
||||
//高亮查找的关键字文本。Index表示是第几次出现,前面的要跳过
|
||||
void FindResultWin::highlightFindText(int index, QString &srcText, QString &findText, Qt::CaseSensitivity cs)
|
||||
{
|
||||
#if 0
|
||||
int pos = 0;
|
||||
int findPos = 0;
|
||||
|
||||
@@ -403,14 +82,18 @@ void FindResultWin::highlightFindText(int index, QString &srcText, QString &find
|
||||
index--;
|
||||
}
|
||||
srcText.replace(pos, lens, QString("<font style='font-size:14px;background-color:#ffffbf'>%1</font>").arg(srcText.mid(pos,lens)));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
const int MAX_HEAD_LENTGH = 20;
|
||||
const int MAX_TAIL_LENGTH = 80;
|
||||
|
||||
#if 0
|
||||
//更复杂的高亮:在全词语匹配,大小写敏感,甚至正则表达式情况下,上面的highlightFindText是不够的。需要精确定位
|
||||
QString FindResultWin::highlightFindText(FindRecord& record)
|
||||
{
|
||||
#if 0
|
||||
QByteArray utf8bytes = record.lineContents.toUtf8();
|
||||
|
||||
int lineLens = utf8bytes.length();
|
||||
@@ -438,9 +121,9 @@ QString FindResultWin::highlightFindText(FindRecord& record)
|
||||
head = QString("<font style='font-size:14px;'>%1</font>").arg(QString(utf8bytes.mid(0, targetStart)).toHtmlEscaped());
|
||||
src = QString("<font style='font-size:14px;background-color:#ffffbf'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
|
||||
tail = QString("<font style='font-size:14px;'>%1</font>").arg(QString(utf8bytes.mid(tailStart)).toHtmlEscaped());
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
head = QString(utf8bytes.mid(0, targetStart));
|
||||
if (head.size() > MAX_HEAD_LENTGH)
|
||||
{
|
||||
@@ -471,7 +154,7 @@ QString FindResultWin::highlightFindText(FindRecord& record)
|
||||
head = QString("<font style='font-size:14px;color:#dcdcdc'>%1</font>").arg(QString(utf8bytes.mid(0, targetStart)).toHtmlEscaped());
|
||||
src = QString("<font style='font-size:14px;font-weight:bold;color:#ffaa00'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
|
||||
tail = QString("<font style='font-size:14px;color:#dcdcdc'>%1</font>").arg(QString(utf8bytes.mid(tailStart)).toHtmlEscaped());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QString headContens = QString(utf8bytes.mid(0, targetStart));
|
||||
@@ -501,36 +184,68 @@ QString FindResultWin::highlightFindText(FindRecord& record)
|
||||
}
|
||||
|
||||
return QString("%1%2%3").arg(head).arg(src).arg(tail);
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
//在当前文件查找字段,结果是一个单一的FindRecords
|
||||
void FindResultWin::appendResultsToShow(FindRecords* record)
|
||||
{
|
||||
#if 0
|
||||
if (record == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FindResultView* pDisplay = ui.displayView;
|
||||
|
||||
QString findTitle = tr("Search \"%1\" (%2 hits)\n").arg(record->findText).arg(record->records.size());
|
||||
|
||||
//pDisplay->append(findTitle);
|
||||
|
||||
pDisplay->insertAt(findTitle,0,0);
|
||||
|
||||
pDisplay->SendScintilla(SCI_SETFOLDLEVEL, 0, (long)(0|SC_FOLDLEVELHEADERFLAG));
|
||||
|
||||
QStringList contents;
|
||||
|
||||
for (int i = 0; i < record->records.size(); ++i)
|
||||
{
|
||||
FindRecord v = record->records.at(i);
|
||||
|
||||
const QString & richText = v.lineContents;
|
||||
|
||||
QString text;
|
||||
if (!StyleSet::isCurrentDeepStyle())
|
||||
{
|
||||
text = tr("Line %1 : %2\n").arg(v.lineNum + 1).arg(richText);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = tr("Line %1 : %2\n").arg(v.lineNum + 1).arg(richText);
|
||||
}
|
||||
|
||||
contents.append(text);
|
||||
}
|
||||
|
||||
pDisplay->insertAt(contents.join(""), 1, 0);
|
||||
|
||||
for (int i = 0; i < record->records.size(); ++i)
|
||||
{
|
||||
pDisplay->SendScintilla(SCI_SETFOLDLEVEL, i+1, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
QString findTitle;
|
||||
//if (!StyleSet::isCurrentDeepStyle())
|
||||
//{
|
||||
findTitle = tr("<font style='font-size:14px;font-weight:bold;color:#343497'>Search \"%1\" (%2 hits)</font>").arg(record->findText.toHtmlEscaped()).arg(record->records.size());
|
||||
/*}
|
||||
else
|
||||
{
|
||||
findTitle = tr("<font style='font-size:14px;font-weight:bold;color:#ffffff'>Search \"%1\" (%2 hits)</font>").arg(record->findText.toHtmlEscaped()).arg(record->records.size());
|
||||
}*/
|
||||
|
||||
findTitle = tr("<font style='font-size:14px;font-weight:bold;color:#343497'>Search \"%1\" (%2 hits)</font>").arg(record->findText.toHtmlEscaped()).arg(record->records.size());
|
||||
|
||||
QStandardItem* titleItem = new QStandardItem(findTitle);
|
||||
|
||||
//if (!StyleSet::isCurrentDeepStyle())
|
||||
//{
|
||||
setItemBackground(titleItem, QColor(0xbbbbff));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// setItemBackground(titleItem, QColor(0x423328));//0xd5ffd5
|
||||
//}
|
||||
setItemBackground(titleItem, QColor(0xbbbbff));
|
||||
|
||||
|
||||
m_model->insertRow(0, titleItem);
|
||||
titleItem->setData(QVariant(true), ResultItemRoot);
|
||||
@@ -579,8 +294,6 @@ void FindResultWin::appendResultsToShow(FindRecords* record)
|
||||
//描述行双击不响应
|
||||
descItem->setData(QVariant(true), ResultItemDesc);
|
||||
|
||||
//int lastLineNum = -1;
|
||||
//int occurTimes = 0;
|
||||
|
||||
for (int i =0 ; i < record->records.size(); ++i)
|
||||
{
|
||||
@@ -600,14 +313,18 @@ void FindResultWin::appendResultsToShow(FindRecords* record)
|
||||
QStandardItem* childItem = new QStandardItem(text);
|
||||
childItem->setData(QVariant(v.pos), ResultItemPos);
|
||||
childItem->setData(QVariant(v.end - v.pos), ResultItemLen);
|
||||
#if defined(Q_OS_MAC)
|
||||
childItem->setTextAlignment(Qt::AlignVCenter);
|
||||
#endif
|
||||
descItem->appendRow(childItem);
|
||||
}
|
||||
if (!record->records.isEmpty())
|
||||
{
|
||||
ui.resultTreeView->expand(m_model->index(0, 0, m_model->index(0, 0)));
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void FindResultWin::appendResultsToShow(QVector<FindRecords*>* record, int hits, QString whatFind)
|
||||
{
|
||||
@@ -616,146 +333,149 @@ void FindResultWin::appendResultsToShow(QVector<FindRecords*>* record, int hits,
|
||||
return;
|
||||
}
|
||||
|
||||
QString findTitle = tr("<font style='font-size:14px;font-weight:bold;color:#343497'>Search \"%1\" (%2 hits in %3 files)</font>").arg(whatFind.toHtmlEscaped()).arg(hits).arg(record->size());
|
||||
QStandardItem* titleItem = new QStandardItem(findTitle);
|
||||
setItemBackground(titleItem, QColor(0xbbbbff));
|
||||
titleItem->setData(QVariant(true), ResultItemRoot);
|
||||
|
||||
//总是把结果插在最上面一行
|
||||
m_model->insertRow(0, titleItem);
|
||||
|
||||
int rowNum = m_model->rowCount();
|
||||
|
||||
//把其余的行收起来
|
||||
for (int i = 1; i < rowNum; ++i)
|
||||
if (this->isHidden())
|
||||
{
|
||||
ui.resultTreeView->collapse(m_model->index(i, 0));
|
||||
this->setVisible(true);
|
||||
}
|
||||
ui.resultTreeView->expand(m_model->index(0, 0));
|
||||
|
||||
ResultLineInfo lineInfo;
|
||||
|
||||
QString findTitle = tr("Search \"%1\" (%2 hits in %3 files)\n").arg(whatFind).arg(hits).arg(record->size());
|
||||
|
||||
FindResultView* pDisplay = ui.displayView;
|
||||
pDisplay->on_foldAll();
|
||||
|
||||
pDisplay->insertAt(findTitle, 0, 0);
|
||||
|
||||
lineInfo.level = 0;
|
||||
m_resultLineInfo.insert(0,lineInfo);
|
||||
|
||||
pDisplay->SendScintilla(SCI_SETFOLDLEVEL, 0, (long)(0 | SC_FOLDLEVELHEADERFLAG));
|
||||
|
||||
if (record->size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList contents;
|
||||
|
||||
QList<int> keyworkOffsetPos;
|
||||
QString text;
|
||||
QString linePrefix;
|
||||
|
||||
|
||||
for (int i = 0,count= record->size(); i < count; ++i)
|
||||
int insertIndex = 1;
|
||||
for (int i = 0, count = record->size(); i < count; ++i)
|
||||
{
|
||||
FindRecords* pr = record->at(i);
|
||||
|
||||
QString* pFilePath = new QString(pr->findFilePath);
|
||||
QString desc;
|
||||
if (!StyleSet::isCurrentDeepStyle())
|
||||
{
|
||||
desc = tr("<font style='font-size:14px;font-weight:bold;color:#309730'>%1 (%2 hits)</font>").arg(pr->findFilePath.toHtmlEscaped()).arg(pr->records.size());
|
||||
desc = tr(" %1 (%2 hits)\n").arg(pr->findFilePath).arg(pr->records.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
desc = tr("<font style='font-size:14px;color:#99cc99'>%1 (%2 hits)</font>").arg(pr->findFilePath.toHtmlEscaped()).arg(pr->records.size());
|
||||
desc = tr(" %1 (%2 hits)\n").arg(pr->findFilePath).arg(pr->records.size());
|
||||
}
|
||||
contents.append(desc);
|
||||
m_resultLineFilePath.append(pFilePath);
|
||||
|
||||
QStandardItem* descItem = new QStandardItem(desc);
|
||||
lineInfo.level = 1;
|
||||
m_resultLineInfo.insert(insertIndex, lineInfo);
|
||||
++insertIndex;
|
||||
|
||||
if (!StyleSet::isCurrentDeepStyle())
|
||||
for (int j = 0; j < pr->records.size(); ++j)
|
||||
{
|
||||
setItemBackground(descItem, QColor(0xd5ffd5));
|
||||
}
|
||||
else
|
||||
{
|
||||
setItemBackground(descItem, QColor(0x484848));
|
||||
}
|
||||
FindRecord v = pr->records.at(j);
|
||||
QString richText = v.lineContents;
|
||||
|
||||
titleItem->insertRow(0,descItem);
|
||||
linePrefix = tr(" Line %1: ").arg(v.lineNum + 1);
|
||||
|
||||
//默认全部收起来
|
||||
if (count > 10)
|
||||
{
|
||||
ui.resultTreeView->collapse(m_model->index(0, 0, m_model->index(0, 0)));
|
||||
}
|
||||
|
||||
descItem->setData(QVariant((qlonglong)pr->pEdit), ResultItemEditor);
|
||||
descItem->setData(QVariant(pr->findFilePath), ResultItemEditorFilePath);
|
||||
descItem->setData(QVariant(pr->findText), ResultWhatFind);
|
||||
|
||||
//描述行双击不响应
|
||||
descItem->setData(QVariant(true), ResultItemDesc);
|
||||
|
||||
for (int i = 0; i < pr->records.size(); ++i)
|
||||
{
|
||||
FindRecord v = pr->records.at(i);
|
||||
QString richText = highlightFindText(v);
|
||||
|
||||
QString text;
|
||||
if (!StyleSet::isCurrentDeepStyle())
|
||||
{
|
||||
text = tr("<font style='font-size:14px;'>Line </font><font style='font-size:14px;color:#ff8040'>%1</font> : %2").arg(v.lineNum + 1).arg(richText);
|
||||
text = tr("%1%2\n").arg(linePrefix).arg(richText);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = tr("<font style='font-size:14px;color:#ffffff'>Line </font><font style='font-size:14px;color:#ff8040'>%1</font> : %2").arg(v.lineNum + 1).arg(richText);
|
||||
text = tr("%1%2\n").arg(linePrefix).arg(richText);
|
||||
}
|
||||
QStandardItem* childItem = new QStandardItem(text);
|
||||
childItem->setData(QVariant(v.pos), ResultItemPos);
|
||||
childItem->setData(QVariant(v.end - v.pos), ResultItemLen);
|
||||
descItem->appendRow(childItem);
|
||||
contents.append(text);
|
||||
keyworkOffsetPos.append(linePrefix.toUtf8().size());
|
||||
lineInfo.level = 2;
|
||||
lineInfo.resultPos = v.pos;
|
||||
lineInfo.resultEnd = v.end;
|
||||
lineInfo.pFilePath = pFilePath;
|
||||
m_resultLineInfo.insert(insertIndex, lineInfo);
|
||||
++insertIndex;
|
||||
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
if (count <= 10 && !pr->records.isEmpty())
|
||||
}
|
||||
|
||||
pDisplay->insertAt(contents.join(""), 1, 0);
|
||||
|
||||
int lineNum = 1;
|
||||
|
||||
QList<int> destFileLineNum;
|
||||
|
||||
for (int i = 0, count = record->size(); i < count; ++i)
|
||||
{
|
||||
FindRecords* pr = record->at(i);
|
||||
|
||||
pDisplay->SendScintilla(SCI_SETFOLDLEVEL, lineNum, (long)(1 | SC_FOLDLEVELHEADERFLAG));
|
||||
destFileLineNum.append(lineNum);
|
||||
++lineNum;
|
||||
|
||||
for (int j = 0; j < pr->records.size(); ++j)
|
||||
{
|
||||
ui.resultTreeView->expand(m_model->index(0, 0, m_model->index(0, 0)));
|
||||
pDisplay->SendScintilla(SCI_SETFOLDLEVEL, lineNum, (long)2| SC_FOLDLEVELBASE);
|
||||
|
||||
++lineNum;
|
||||
}
|
||||
}
|
||||
ui.resultTreeView->expand(m_model->index(0, 0, m_model->index(0, 0)));
|
||||
}
|
||||
|
||||
void FindResultWin::setItemBackground(QStandardItem* item, const QColor& color)
|
||||
{
|
||||
QBrush b(color);
|
||||
item->setBackground(b);
|
||||
}
|
||||
//着色
|
||||
pDisplay->setLineBackColorStyle(0, STYLE_COLOUR_TITLE);
|
||||
|
||||
void FindResultWin::setItemForeground(QStandardItem* item, const QColor& color)
|
||||
{
|
||||
QBrush b(color);
|
||||
item->setForeground(b);
|
||||
}
|
||||
|
||||
//查找结果框的字体变大
|
||||
void FindResultWin::slot_fontZoomIn()
|
||||
{
|
||||
QFont curFt = ui.resultTreeView->font();
|
||||
|
||||
int s = curFt.pointSize();
|
||||
s += 2;
|
||||
curFt.setPointSize(s);
|
||||
|
||||
m_defaultFontSize += 2;
|
||||
|
||||
ui.resultTreeView->setFont(curFt);
|
||||
|
||||
m_delegate->setFontSize(m_defaultFontSize);
|
||||
|
||||
m_defFontSizeChange = true;
|
||||
}
|
||||
|
||||
void FindResultWin::slot_fontZoomOut()
|
||||
{
|
||||
QFont curFt = ui.resultTreeView->font();
|
||||
|
||||
int s = curFt.pointSize();
|
||||
s -= 2;
|
||||
|
||||
if (s >= 8)
|
||||
for (int i = 0, count = destFileLineNum.size(); i < count; ++i)
|
||||
{
|
||||
m_defFontSizeChange = true;
|
||||
m_defaultFontSize -= 2;
|
||||
curFt.setPointSize(s);
|
||||
ui.resultTreeView->setFont(curFt);
|
||||
m_delegate->setFontSize(m_defaultFontSize);
|
||||
pDisplay->setLineBackColorStyle(destFileLineNum.at(i), (StyleSet::isCurrentDeepStyle()? STYLE_DEEP_COLOUR_DEST_FILE:STYLE_COLOUR_DEST_FILE));
|
||||
}
|
||||
|
||||
//关键字高亮
|
||||
//高亮的开始、结束位置
|
||||
int targetStart = 0;
|
||||
int targetLens = 0;
|
||||
lineNum = 1;
|
||||
|
||||
int lineOffsetPosIndex = 0;
|
||||
int lineOffsetPos = 0;
|
||||
|
||||
QString lineNumStr = tr(" Line ");
|
||||
int skipLineNumOffset = lineNumStr.toUtf8().size();
|
||||
|
||||
for (int i = 0, count = record->size(); i < count; ++i)
|
||||
{
|
||||
FindRecords* pr = record->at(i);
|
||||
++lineNum;
|
||||
for (int j = 0; j < pr->records.size(); ++j)
|
||||
{
|
||||
lineOffsetPos = keyworkOffsetPos.at(lineOffsetPosIndex);
|
||||
const FindRecord &v = pr->records.at(j);
|
||||
targetStart = v.pos - v.lineStartPos + lineOffsetPos;
|
||||
targetLens = v.end - v.pos;
|
||||
pDisplay->setLineColorStyle(lineNum, skipLineNumOffset, lineOffsetPos-skipLineNumOffset-2, STYLE_COLOUR_KEYWORD_HIGH);
|
||||
pDisplay->setLineColorStyle(lineNum, targetStart, targetLens, (StyleSet::isCurrentDeepStyle()? STYLE_DEEP_COLOUR_KEYWORD_HIGH:STYLE_COLOUR_KEYWORD_BACK_HIGH));
|
||||
++lineNum;
|
||||
++lineOffsetPosIndex;
|
||||
}
|
||||
}
|
||||
pDisplay->SendScintilla(SCI_GOTOLINE, 0);
|
||||
}
|
||||
|
||||
|
||||
int FindResultWin::getDefaultFontSize()
|
||||
{
|
||||
return m_defaultFontSize;
|
||||
@@ -765,3 +485,21 @@ void FindResultWin::setDefaultFontSize(int defSize)
|
||||
{
|
||||
m_defaultFontSize = defSize;
|
||||
}
|
||||
|
||||
void FindResultWin::on_lineDoubleClick(int lineNum)
|
||||
{
|
||||
if (lineNum < m_resultLineInfo.size())
|
||||
{
|
||||
const ResultLineInfo& lineInfo = m_resultLineInfo.at(lineNum);
|
||||
|
||||
if (lineInfo.level == 2)
|
||||
{
|
||||
//文件定位到行
|
||||
emit lineDoubleClicked(lineInfo.pFilePath, lineInfo.resultPos, lineInfo.resultEnd);
|
||||
}
|
||||
else if ((lineInfo.level == 0) || (lineInfo.level == 1))
|
||||
{
|
||||
ui.displayView->SendScintilla(SCI_FOLDLINE, lineNum, SC_FOLDACTION_TOGGLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
-20
@@ -6,57 +6,54 @@
|
||||
#include "ui_findresultwin.h"
|
||||
|
||||
class FindRecords;
|
||||
class QStandardItem;
|
||||
class NdStyledItemDelegate;
|
||||
class QStandardItemModel;
|
||||
struct FindRecord;
|
||||
|
||||
struct ResultLineInfo {
|
||||
int level;//缩进类型。0 1 2。0:title 1 filepath desc 2 result。
|
||||
int resultPos;//结果字段的开始offset。0和1是没有这个字段的。
|
||||
int resultEnd;//长度
|
||||
QString* pFilePath;
|
||||
};
|
||||
|
||||
class FindResultWin : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
friend class FindResultView;
|
||||
FindResultWin(QWidget *parent = Q_NULLPTR);
|
||||
~FindResultWin();
|
||||
|
||||
void appendResultsToShow(FindRecords * record);
|
||||
void appendResultsToShow(QVector<FindRecords*>* record, int hits, QString whatFind);
|
||||
int getDefaultFontSize();
|
||||
void setDefaultFontSize(int defSize);
|
||||
void clear();
|
||||
signals:
|
||||
void itemDoubleClicked(const QModelIndex &index);
|
||||
void showMsg(QString &msg);
|
||||
void lineDoubleClicked(QString* pFilePath, int pos, int end);
|
||||
|
||||
private slots:
|
||||
void slot_clearContents();
|
||||
void slot_selectAll();
|
||||
void slot_copyContents();
|
||||
void slot_copyItemContents();
|
||||
void slot_selectSection();
|
||||
void slot_treeView_pressed(QModelIndex modeIndex);
|
||||
void slot_fontZoomIn();
|
||||
void slot_fontZoomOut();
|
||||
void on_lineDoubleClick(int line);
|
||||
public slots:
|
||||
void slot_clearAllContents();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent * event);
|
||||
|
||||
private:
|
||||
#if 0
|
||||
void setItemBackground(QStandardItem* item, const QColor& color);
|
||||
void setItemForeground(QStandardItem * item, const QColor & color);
|
||||
|
||||
void highlightFindText(int index, QString & srcText, QString & findText, Qt::CaseSensitivity cs);
|
||||
QString highlightFindText(FindRecord& record);
|
||||
#endif
|
||||
private:
|
||||
Ui::FindResultWin ui;
|
||||
QMenu *m_menu;
|
||||
QAction* m_pSelectSectonAct;
|
||||
|
||||
QStandardItemModel* m_model;
|
||||
NdStyledItemDelegate* m_delegate;
|
||||
|
||||
QWidget* m_parent;
|
||||
|
||||
QList<ResultLineInfo> m_resultLineInfo;
|
||||
QList<QString*> m_resultLineFilePath;
|
||||
|
||||
int m_defaultFontSize;
|
||||
bool m_defFontSizeChange;
|
||||
};
|
||||
|
||||
+8
-25
@@ -39,31 +39,13 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="MyTreeView" name="resultTreeView">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Microsoft YaHei</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<widget class="FindResultView" name="displayView">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked</set>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -71,9 +53,10 @@
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MyTreeView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>mytreeview.h</header>
|
||||
<class>FindResultView</class>
|
||||
<extends>QFrame</extends>
|
||||
<header location="global">findresultview.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
||||
+678
-127
File diff suppressed because it is too large
Load Diff
+19
-7
@@ -63,10 +63,13 @@ public:
|
||||
void setCurrentTab(FindTabIndex index);
|
||||
void setTabWidget(QTabWidget * editTabWidget);
|
||||
void setFindText(QString & text);
|
||||
void keywordWinGetFouse(FindTabIndex tabIndex);
|
||||
void setReplaceFindText(QString& text);
|
||||
void setDirFindText(QString& text);
|
||||
void setMarkFindText(QString& text);
|
||||
void disableReplace();
|
||||
void setFindHistory(QList<QString>* findHistory);
|
||||
void setReplaceHistory(QList<QString>* replaceHistory);
|
||||
int markAllWord(QString& word);
|
||||
void removeLineHeadEndBlank(int mode);
|
||||
static void showCallTip(QsciScintilla * pEdit, int pos);
|
||||
@@ -74,11 +77,10 @@ public:
|
||||
void findNext();
|
||||
void findPrev();
|
||||
void setFindBackward(bool isBackward);
|
||||
int findAtBack(QString keyword);
|
||||
|
||||
int findAtBack(QStringList& keyword);
|
||||
int markAtBack(QStringList& keyword);
|
||||
int replaceAtBack(QStringList& keyword, QStringList& replace);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual void focusInEvent(QFocusEvent *ev);
|
||||
@@ -96,8 +98,10 @@ signals:
|
||||
private:
|
||||
void updateParameterFromUI();
|
||||
void addFindHistory(QString & text);
|
||||
void addReplaceHistory(QString& text);
|
||||
bool isFirstFind();
|
||||
void addCurFindRecord(ScintillaEditView * pEdit, FindRecords & recordRet, bool isMark=false);
|
||||
|
||||
QString addCurFindRecord(ScintillaEditView * pEdit, FindRecords & recordRet, bool isMark=false, bool getResult=false);
|
||||
|
||||
bool findTextInFile(QString & filePath, int & findNums, QVector<FindRecords*>* allfileInDirRecord);
|
||||
|
||||
@@ -123,9 +127,11 @@ private:
|
||||
|
||||
int replaceAll();
|
||||
|
||||
int markAll();
|
||||
int markAll(QSet<int>* outLineNum=nullptr);
|
||||
|
||||
int findAllInCurDoc();
|
||||
int findAllInCurDoc(QStringList * reResult=nullptr);
|
||||
|
||||
void findAllInOpenDoc(int index = -1);
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -169,6 +175,10 @@ private slots:
|
||||
|
||||
void slot_tabIndexChange(int index);
|
||||
|
||||
void on_copyReFindResult();
|
||||
|
||||
void on_markAndBook();
|
||||
|
||||
private:
|
||||
Ui::FindWin ui;
|
||||
|
||||
@@ -212,6 +222,8 @@ private:
|
||||
|
||||
QList<QString>* m_findHistory;
|
||||
|
||||
QList<QString>* m_replaceHistory;
|
||||
|
||||
ScintillaEditView* pEditTemp;
|
||||
|
||||
QWidget* m_curEditWin;
|
||||
|
||||
+133
-84
@@ -286,6 +286,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyReResultBt">
|
||||
<property name="text">
|
||||
<string>Copy Regular Result</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="findClearBt">
|
||||
<property name="minimumSize">
|
||||
@@ -396,13 +403,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="replaceWithBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<widget class="QComboBox" name="replaceWithBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
@@ -415,6 +416,12 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maxCount">
|
||||
<number>512</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -752,48 +759,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="fileType">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>*.c:*.cpp:*.h</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="dealFileType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File Type :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
@@ -806,20 +772,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="skipDir">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Skip Dir Name :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="skipDirNames">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@@ -847,8 +800,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="dirReplaceWhat">
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="skipDir">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Skip Dir Name :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="fileType">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -867,6 +836,35 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>*.c:*.cpp:*.h</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="dealFileType">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File Type :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="dirReplaceWhat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -1305,6 +1303,25 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mark & Bookmark</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="markClearBox">
|
||||
<property name="sizePolicy">
|
||||
@@ -1403,7 +1420,6 @@
|
||||
<tabstop>findModeExtendBt</tabstop>
|
||||
<tabstop>findModeRegularBt</tabstop>
|
||||
<tabstop>replaceTextBox</tabstop>
|
||||
<tabstop>replaceWithBox</tabstop>
|
||||
<tabstop>replaceFindNextBox</tabstop>
|
||||
<tabstop>replaceBt</tabstop>
|
||||
<tabstop>replaceAllBt</tabstop>
|
||||
@@ -1418,7 +1434,6 @@
|
||||
<tabstop>replaceModeRegularBt</tabstop>
|
||||
<tabstop>destFindDir</tabstop>
|
||||
<tabstop>dirFindWhat</tabstop>
|
||||
<tabstop>dirReplaceWhat</tabstop>
|
||||
<tabstop>selectDir</tabstop>
|
||||
<tabstop>dirFindAll</tabstop>
|
||||
<tabstop>dirReplaceAll</tabstop>
|
||||
@@ -1476,8 +1491,8 @@
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>572</x>
|
||||
<y>251</y>
|
||||
<x>672</x>
|
||||
<y>291</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>169</x>
|
||||
@@ -1524,8 +1539,8 @@
|
||||
<slot>slot_replaceFindNext()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>94</x>
|
||||
<y>60</y>
|
||||
<x>458</x>
|
||||
<y>61</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>588</x>
|
||||
@@ -1540,8 +1555,8 @@
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>94</x>
|
||||
<y>45</y>
|
||||
<x>458</x>
|
||||
<y>198</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>588</x>
|
||||
@@ -1556,8 +1571,8 @@
|
||||
<slot>slot_replace()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>94</x>
|
||||
<y>64</y>
|
||||
<x>458</x>
|
||||
<y>95</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>588</x>
|
||||
@@ -1572,8 +1587,8 @@
|
||||
<slot>slot_replaceAll()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>94</x>
|
||||
<y>67</y>
|
||||
<x>458</x>
|
||||
<y>129</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>588</x>
|
||||
@@ -1588,8 +1603,8 @@
|
||||
<slot>slot_replaceAllInOpenDoc()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>94</x>
|
||||
<y>76</y>
|
||||
<x>458</x>
|
||||
<y>169</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>588</x>
|
||||
@@ -1620,8 +1635,8 @@
|
||||
<slot>slot_clearMark()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>489</x>
|
||||
<y>84</y>
|
||||
<x>672</x>
|
||||
<y>129</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>588</x>
|
||||
@@ -1636,8 +1651,8 @@
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>572</x>
|
||||
<y>162</y>
|
||||
<x>672</x>
|
||||
<y>197</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>404</x>
|
||||
@@ -1748,8 +1763,8 @@
|
||||
<slot>slot_clearAllMark()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>538</x>
|
||||
<y>112</y>
|
||||
<x>672</x>
|
||||
<y>163</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>574</x>
|
||||
@@ -1757,6 +1772,38 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>copyReResultBt</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>FindWin</receiver>
|
||||
<slot>on_copyReFindResult()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>534</x>
|
||||
<y>222</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>344</x>
|
||||
<y>191</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>FindWin</receiver>
|
||||
<slot>on_markAndBook()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>565</x>
|
||||
<y>77</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>434</x>
|
||||
<y>386</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>slot_findNext()</slot>
|
||||
@@ -1775,5 +1822,7 @@
|
||||
<slot>sign_clearResult()</slot>
|
||||
<slot>slot_findPrev()</slot>
|
||||
<slot>slot_clearAllMark()</slot>
|
||||
<slot>on_copyReFindResult()</slot>
|
||||
<slot>on_markAndBook()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
#define MyAppName "Notepad--"
|
||||
#define MyAppVersion "1.22.0"
|
||||
#define MyAppVersion "1.23.2"
|
||||
#define MyAppDesc MyAppName + MyAppVersion + "(Ndd主程序)"
|
||||
#define MyAppPublisher "ndd开源组织"
|
||||
#define MyAppURL "https://gitee.com/cxasm/notepad--"
|
||||
#define MyAppExeName "Notepad--.exe"
|
||||
@@ -10,6 +11,20 @@
|
||||
#define MyAppAssocExt ".txt"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
|
||||
#define MyAppAssocExt1 ".ini"
|
||||
#define MyAppAssocExt2 ".log"
|
||||
#define MyAppAssocExt3 ".sh"
|
||||
#define MyAppAssocExt4 ".h"
|
||||
#define MyAppAssocExt5 ".c"
|
||||
#define MyAppAssocExt6 ".cpp"
|
||||
#define MyAppAssocExt7 ".py"
|
||||
#define MyAppAssocExt8 ".xml"
|
||||
#define MyAppAssocExt9 ".def"
|
||||
#define MyAppAssocExt10 ".json"
|
||||
#define MyAppAssocExt11 ".pro"
|
||||
#define MyAppAssocExt12 ".csv"
|
||||
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
@@ -35,6 +50,7 @@ Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
|
||||
|
||||
[Languages]
|
||||
Name: "ChineseSimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
|
||||
|
||||
@@ -47,14 +63,35 @@ Source: "D:\CCNotePad\x64\Release\*"; DestDir: "{app}"; Flags: ignoreversion rec
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Registry]
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
|
||||
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""
|
||||
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--"; ValueType: string; ValueName: ""; ValueData: "Edit with Notepad--"; Flags: uninsdeletekey
|
||||
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\{#MyAppExeName}"""
|
||||
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" ;
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: main
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt1}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue ; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt2}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt3}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt4}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt5}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt6}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt7}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt8}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt9}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt10}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt11}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue; Components: ass
|
||||
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey; Components: main
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"; Components: main
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Components: main
|
||||
|
||||
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}"; ValueType: string; ValueName: ""; ValueData: ""; Flags: uninsdeletekey; Components: main
|
||||
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""; Flags: uninsdeletekey; Components: main
|
||||
;Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletekey; Components: main
|
||||
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--"; ValueType: string; ValueName: ""; ValueData: "Edit with Notepad--"; Flags: uninsdeletekey; Components: main
|
||||
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--"; ValueType: string; ValueName: "Icon"; ValueData: """{app}\{#MyAppExeName}""" ; Components: main
|
||||
Root: HKA; Subkey: "Software\Classes\*\shell\Notepad--\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" ; Components: main
|
||||
|
||||
|
||||
|
||||
[Components]
|
||||
Name: "main"; Description: "{#MyAppDesc}"; Types: full compact custom; Flags: fixed
|
||||
Name: "ass"; Description: "关联打开常见文本类型"; Types: full
|
||||
|
||||
|
||||
[Icons]
|
||||
|
||||
@@ -4,7 +4,7 @@ Name=Notepad--
|
||||
Name[zh_CN]=Notepad--
|
||||
Comment=Notepad-- 是一个国产跨平台、简单的文本编辑器。
|
||||
Type=Application
|
||||
Exec=NotePad-- %F
|
||||
Exec=notepad-- %F
|
||||
Icon=notepad--
|
||||
Categories=Development;Office;
|
||||
Terminal=false
|
||||
|
||||
+7
-3
@@ -40,7 +40,7 @@ const QString c_strTitle = "Ndd";
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#if defined(Q_OS_MAC)
|
||||
QSharedMemory shared("CCNotebook122");;//mac下面后面带一个版本号,避免新的打不开
|
||||
QSharedMemory shared("CCNotebook123");;//mac下面后面带一个版本号,避免新的打不开
|
||||
#else
|
||||
QSharedMemory shared("CCNotebook");
|
||||
#endif
|
||||
@@ -120,8 +120,12 @@ class MyApplication : public QApplication
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//可以防止某些屏幕下的字体拥挤重叠问题
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
//可以防止某些屏幕下的字体拥挤重叠问题。暂时屏蔽,不使用qt方法,使用windows自带方案
|
||||
// 发现windows自带方案模糊。//发现下面打开后,在win10上反而效果不好,界面会变得很大,默认还是不开启的好。
|
||||
//QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
//QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
//QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
MyApplication a(argc, argv);
|
||||
#else
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#include "markdownview.h"
|
||||
|
||||
MarkdownView::MarkdownView(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
}
|
||||
|
||||
MarkdownView::~MarkdownView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MarkdownView::viewMarkdown(QString& text)
|
||||
{
|
||||
ui.textEdit->setMarkdown(text);
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "ui_markdownview.h"
|
||||
|
||||
class MarkdownView : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MarkdownView(QWidget *parent = nullptr);
|
||||
~MarkdownView();
|
||||
void viewMarkdown(QString& text);
|
||||
|
||||
private:
|
||||
Ui::MarkdownViewClass ui;
|
||||
};
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MarkdownViewClass</class>
|
||||
<widget class="QMainWindow" name="MarkdownViewClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1134</width>
|
||||
<height>712</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MarkdownView</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1134</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Executable
+153
@@ -0,0 +1,153 @@
|
||||
#include "md5hash.h"
|
||||
#include "ccnotepad.h"
|
||||
#include "ctipwin.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QClipboard>
|
||||
|
||||
Md5hash::Md5hash(QWidget *parent)
|
||||
: QWidget(parent), m_isFile(false)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
|
||||
m_btGroup.addButton(ui.md4RadioBt, 0);
|
||||
m_btGroup.addButton(ui.md5RadioBt, 1);
|
||||
m_btGroup.addButton(ui.sha1RadioBt, 2);
|
||||
m_btGroup.addButton(ui.sha256RadioBt, 4);
|
||||
m_btGroup.addButton(ui.sha3RadioBt, 12);
|
||||
m_btGroup.addButton(ui.kec256RadioBt, 8);
|
||||
|
||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,15,0))
|
||||
connect(&m_btGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &Md5hash::on_methodIdChange);
|
||||
#else
|
||||
connect(&m_btGroup, &QButtonGroup::idClicked, this, &Md5hash::on_methodIdChange);
|
||||
#endif
|
||||
|
||||
connect(ui.srcTextEdit,&QPlainTextEdit::textChanged,this,&Md5hash::on_hash);
|
||||
}
|
||||
|
||||
Md5hash::~Md5hash()
|
||||
{}
|
||||
|
||||
void Md5hash::slot_select()
|
||||
{
|
||||
QFileDialog fd(this, QString(), CCNotePad::s_lastOpenDirPath);
|
||||
fd.setFileMode(QFileDialog::ExistingFile);
|
||||
m_fileList.clear();
|
||||
|
||||
if (fd.exec() == QDialog::Accepted) //如果成功的执行
|
||||
{
|
||||
m_fileList = fd.selectedFiles(); //返回文件列表的名称
|
||||
|
||||
if (!m_fileList.isEmpty())
|
||||
{
|
||||
m_isFile = true;
|
||||
ui.srcTextEdit->setPlainText(m_fileList.join("\n"));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fd.close();
|
||||
}
|
||||
}
|
||||
|
||||
void Md5hash::on_methodIdChange(int id)
|
||||
{
|
||||
on_hash();
|
||||
}
|
||||
|
||||
void Md5hash::on_hash()
|
||||
{
|
||||
QCryptographicHash::Algorithm method = QCryptographicHash::Md5;
|
||||
|
||||
if (ui.md5RadioBt->isChecked())
|
||||
{
|
||||
method = QCryptographicHash::Md5;
|
||||
}
|
||||
else if (ui.md4RadioBt->isChecked())
|
||||
{
|
||||
method = QCryptographicHash::Md4;
|
||||
}
|
||||
else if (ui.sha1RadioBt->isChecked())
|
||||
{
|
||||
method = QCryptographicHash::Sha1;
|
||||
}
|
||||
else if (ui.sha256RadioBt->isChecked())
|
||||
{
|
||||
method = QCryptographicHash::Sha256;
|
||||
}
|
||||
else if (ui.sha3RadioBt->isChecked())
|
||||
{
|
||||
method = QCryptographicHash::Sha3_256;
|
||||
}
|
||||
else if (ui.kec256RadioBt->isChecked())
|
||||
{
|
||||
method = QCryptographicHash::Keccak_256;
|
||||
}
|
||||
|
||||
//如果是文本
|
||||
if (!m_isFile)
|
||||
{
|
||||
QString text = ui.srcTextEdit->toPlainText();
|
||||
|
||||
QByteArray data = text.toUtf8();
|
||||
|
||||
if (!text.isEmpty())
|
||||
{
|
||||
QByteArray result = QCryptographicHash::hash(data, method);
|
||||
ui.hashTextEdit->setPlainText(result.toHex());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QCryptographicHash fileHash(method);
|
||||
QByteArray rs;
|
||||
|
||||
QList<QByteArray> result;
|
||||
|
||||
for (int i = 0; i < m_fileList.size(); ++i)
|
||||
{
|
||||
rs.clear();
|
||||
QFile file(m_fileList.at(i));
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
if (fileHash.addData(&file))
|
||||
{
|
||||
rs = fileHash.result();
|
||||
result.append(rs.toHex());
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append("Error Null");
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append("Error Null");
|
||||
}
|
||||
|
||||
}
|
||||
for (int i = 0; i < result.size(); ++i)
|
||||
{
|
||||
QString info = QString("File %1 cyp hash is \n%2").arg(m_fileList.at(i)).arg(QString(result.at(i)));
|
||||
ui.hashTextEdit->appendPlainText(info);
|
||||
}
|
||||
m_isFile = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Md5hash::on_copyClipboard()
|
||||
{
|
||||
if (!ui.hashTextEdit->toPlainText().isEmpty())
|
||||
{
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(ui.hashTextEdit->toPlainText());
|
||||
|
||||
CTipWin::showTips(this, tr("Copy to clipboard Finished!"), 1200);
|
||||
}
|
||||
}
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QButtonGroup>
|
||||
#include "ui_md5hash.h"
|
||||
|
||||
class Md5hash : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Md5hash(QWidget *parent = nullptr);
|
||||
~Md5hash();
|
||||
|
||||
private slots:
|
||||
void slot_select();
|
||||
void on_hash();
|
||||
void on_methodIdChange(int id);
|
||||
void on_copyClipboard();
|
||||
|
||||
private:
|
||||
Ui::Md5hashClass ui;
|
||||
QButtonGroup m_btGroup;
|
||||
QStringList m_fileList;
|
||||
bool m_isFile;
|
||||
};
|
||||
Executable
+203
@@ -0,0 +1,203 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Md5hashClass</class>
|
||||
<widget class="QWidget" name="Md5hashClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>560</width>
|
||||
<height>436</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Md5hash</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Copy Text Or Select File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>select</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="srcTextEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Algorithm</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="md4RadioBt">
|
||||
<property name="text">
|
||||
<string>Md4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="sha1RadioBt">
|
||||
<property name="text">
|
||||
<string>Sha1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="sha3RadioBt">
|
||||
<property name="text">
|
||||
<string>Sha3_256</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="md5RadioBt">
|
||||
<property name="text">
|
||||
<string>Md5</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="sha256RadioBt">
|
||||
<property name="text">
|
||||
<string>Sha256</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="kec256RadioBt">
|
||||
<property name="text">
|
||||
<string>Keccak_256</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="hashTextEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Copy to Clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelBt">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>toolButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Md5hashClass</receiver>
|
||||
<slot>slot_select()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>534</x>
|
||||
<y>19</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>552</x>
|
||||
<y>239</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cancelBt</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Md5hashClass</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>503</x>
|
||||
<y>412</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>338</x>
|
||||
<y>430</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>Md5hashClass</receiver>
|
||||
<slot>on_copyClipboard()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>393</x>
|
||||
<y>415</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>539</x>
|
||||
<y>430</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>slot_select()</slot>
|
||||
<slot>on_copyClipboard()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#include "nddpluginapi.h"
|
||||
#include "ccnotepad.h"
|
||||
|
||||
NddPluginApi::NddPluginApi(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
|
||||
NddPluginApi::~NddPluginApi()
|
||||
{}
|
||||
|
||||
void NddPluginApi::setMainNotePad(QWidget * pWidget)
|
||||
{
|
||||
m_mainNotePad = pWidget;
|
||||
}
|
||||
|
||||
//注意这里实际返回的是ScintillaEditView
|
||||
QsciScintilla* NddPluginApi::getCurrentEidtHandle()
|
||||
{
|
||||
CCNotePad* pNotepad = dynamic_cast<CCNotePad*>(m_mainNotePad);
|
||||
if (pNotepad != nullptr)
|
||||
{
|
||||
return pNotepad->getCurEditView();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
|
||||
//这个类供插件中调用,务必要保证该类的ABI兼容性。
|
||||
//这意味着,不能随意增加删除该类中的函数和成员变量;否则会导致插件无法兼容。
|
||||
//不使用除虚函数之外的任何虚函数
|
||||
//理论上最好一个插件,对应一个该对象。这样不会冲突。
|
||||
|
||||
class QsciScintilla;
|
||||
|
||||
class NddPluginApi : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NddPluginApi(QObject *parent);
|
||||
~NddPluginApi();
|
||||
|
||||
//获取当前编辑框的对象这个一定要每次动态获取。这里也有问题,一旦QsciScintilla修改,还是不能起到ABI兼容。
|
||||
//尽量依赖不需要改动的部分。
|
||||
|
||||
void setMainNotePad(QWidget* pWidget);
|
||||
|
||||
//有了这个当前编辑框后,就可以动态做许多事情了。但是前提是QsciScintilla基类不能随意修改。
|
||||
QsciScintilla* getCurrentEidtHandle();
|
||||
|
||||
|
||||
|
||||
//这个里面的成员函数要特别小心,一旦给定,则顺序和参数不能随意修改。只能依次往后增加、不能删除。
|
||||
public:
|
||||
//使用动态参数进行参数的传递。使用public传递成员参数
|
||||
QMap<QString, QVariant> m_parameter;
|
||||
QWidget* m_mainNotePad;
|
||||
};
|
||||
+83
-48
@@ -1,4 +1,4 @@
|
||||
#include "nddsetting.h"
|
||||
#include "nddsetting.h"
|
||||
#include <QObject>
|
||||
#include <QtDebug>
|
||||
#include <QCoreApplication>
|
||||
@@ -7,20 +7,20 @@
|
||||
#include <QStorageInfo>
|
||||
#include <QSettings>
|
||||
|
||||
static short version_num = 29; //1.22.0 是29
|
||||
//配置文件是否存在。如果初始化失败,则不存在
|
||||
static short version_num = 29; //1.22.0 是29
|
||||
//配置文件是否存在。如果初始化失败,则不存在
|
||||
bool NddSetting::s_isExistDb = false;
|
||||
int NddSetting::s_reference = 0;
|
||||
bool NddSetting::s_isContentChanged = false;
|
||||
|
||||
QSettings* NddSetting::s_nddSet = nullptr;
|
||||
|
||||
QSettings* NddSetting::s_winPosSet = nullptr;
|
||||
QSettings* NddSetting::s_nddDelaySet = nullptr;
|
||||
|
||||
//如果key不存在,则新增key-value。存在:返回true
|
||||
//如果key不存在,则新增key-value。存在:返回true
|
||||
bool NddSetting::checkNoExistAdd(QString key, QVariant& value)
|
||||
{
|
||||
//每次新加字段后,这里要检查一下,不存在则新增
|
||||
//每次新加字段后,这里要检查一下,不存在则新增
|
||||
if (!s_nddSet->contains(key))
|
||||
{
|
||||
s_nddSet->setValue(key, value);
|
||||
@@ -34,13 +34,13 @@ bool NddSetting::checkNoExistAdd(QString key, QVariant& value)
|
||||
return true;
|
||||
}
|
||||
|
||||
//20220402这里隐含了一个前置条件:数据库句柄是在主线程创建的,最好不要在子线程中调用。
|
||||
//避免因为跨线程访问和多线程冲突访问引发的闪退问题。所以最好配置文件的读写都在主线程中进行
|
||||
//20220402这里隐含了一个前置条件:数据库句柄是在主线程创建的,最好不要在子线程中调用。
|
||||
//避免因为跨线程访问和多线程冲突访问引发的闪退问题。所以最好配置文件的读写都在主线程中进行
|
||||
void NddSetting::init()
|
||||
{
|
||||
++s_reference;
|
||||
|
||||
//如果已经初始化过了,则直接返回
|
||||
//如果已经初始化过了,则直接返回
|
||||
if (s_isExistDb)
|
||||
{
|
||||
return;
|
||||
@@ -56,47 +56,47 @@ void NddSetting::init()
|
||||
auto initNddSet = []() {
|
||||
QString key = "signdate";
|
||||
//QString date = QDate::currentDate().toString(QString("yyyy/M/d"));
|
||||
//不写今天的时间,否则第一次运行,无条件不会发送心跳。
|
||||
//直接写一个过去的时间,让第一次运行,总是要签到
|
||||
//不写今天的时间,否则第一次运行,无条件不会发送心跳。
|
||||
//直接写一个过去的时间,让第一次运行,总是要签到
|
||||
addKeyValueToSets(key, "2022/2/20");
|
||||
|
||||
QString str;
|
||||
|
||||
//tab的长度,默认为4
|
||||
//tab的长度,默认为4
|
||||
addKeyValueToNumSets("tablens", 4);
|
||||
//space replace tab空格替换tab,默认0, 1为true,0为false
|
||||
//space replace tab空格替换tab,默认0, 1为true,0为false
|
||||
addKeyValueToNumSets("tabnouse", 0);
|
||||
|
||||
addKeyValueToSets("mac", "0");
|
||||
addKeyValueToNumSets("padtimes", 0);
|
||||
addKeyValueToNumSets("serverip", 0);
|
||||
|
||||
//是否高亮不同处背景
|
||||
//是否高亮不同处背景
|
||||
addKeyValueToNumSets("hexhigh", 1);
|
||||
|
||||
addKeyValueToNumSets(VERSION, version_num);
|
||||
|
||||
//皮肤id
|
||||
//皮肤id
|
||||
addKeyValueToNumSets(SKIN_KEY, 0);
|
||||
|
||||
//语言index 0:自动选择 1:中文 2 英文
|
||||
//语言index 0:自动选择 1:中文 2 英文
|
||||
addKeyValueToNumSets(LANGS_KEY, 0);
|
||||
|
||||
//开启自动换行
|
||||
//开启自动换行
|
||||
addKeyValueToNumSets(AUTOWARP_KEY, 0);
|
||||
|
||||
//开启自动缩进
|
||||
//开启自动缩进
|
||||
addKeyValueToNumSets(INDENT_KEY, 0);
|
||||
|
||||
//显示空白
|
||||
//显示空白。0都不显示 1 单显示空格 2 单显示行尾 3 都显示
|
||||
addKeyValueToNumSets(SHOWSPACE_KEY, 0);
|
||||
|
||||
//最大文本文件的门限。默认100M.(50-300)
|
||||
//最大文本文件的门限。默认100M.(50-600)
|
||||
addKeyValueToNumSets(MAX_BIG_TEXT, 100);
|
||||
|
||||
addKeyValueToSets(SOFT_KEY, "0");
|
||||
|
||||
addKeyValueToSets(RESTORE_CLOSE_FILE, "1");
|
||||
addKeyValueToNumSets(RESTORE_CLOSE_FILE, 1);
|
||||
|
||||
//0 24 1 36 2 48
|
||||
addKeyValueToNumSets(ICON_SIZE, 1);
|
||||
@@ -107,22 +107,22 @@ void NddSetting::init()
|
||||
|
||||
addKeyValueToNumSets(FILELISTPOS, Qt::LeftDockWidgetArea);
|
||||
|
||||
//默认0不显示
|
||||
//默认0不显示
|
||||
addKeyValueToNumSets(FILELISTSHOW, 0);
|
||||
|
||||
//默认显示工具栏
|
||||
//默认显示工具栏
|
||||
addKeyValueToNumSets(TOOLBARSHOW, 1);
|
||||
|
||||
//打开网页,默认不勾选,资源耗费多
|
||||
//打开网页,默认不勾选,资源耗费多
|
||||
addKeyValueToNumSets(SHOWWEBADDR, 0);
|
||||
|
||||
//查找结果框的默认字体大小
|
||||
//查找结果框的默认字体大小
|
||||
addKeyValueToNumSets(FIND_RESULT_FONT_SIZE, 14);
|
||||
};
|
||||
|
||||
if (!s_nddSet->contains(VERSION))
|
||||
{
|
||||
//不存在走初始化流程
|
||||
//不存在走初始化流程
|
||||
initNddSet();
|
||||
s_isContentChanged = true;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void NddSetting::init()
|
||||
QVariant v(VERSION);
|
||||
if (checkNoExistAdd(VERSION, v))
|
||||
{
|
||||
//如果存在,而且版本是最新,不需要走后面自动检查流程了
|
||||
//如果存在,而且版本是最新,不需要走后面自动检查流程了
|
||||
int curVersion = s_nddSet->value(VERSION).toInt();
|
||||
if (curVersion == version_num)
|
||||
{
|
||||
@@ -141,12 +141,12 @@ void NddSetting::init()
|
||||
}
|
||||
else if (curVersion < version_num)
|
||||
{
|
||||
//更新版本到最新
|
||||
//更新版本到最新
|
||||
updataKeyValueFromNumSets(VERSION, version_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
//每次新加字段后,这里要检查一下,不存在则新增
|
||||
//每次新加字段后,这里要检查一下,不存在则新增
|
||||
{
|
||||
QVariant v(1);
|
||||
checkNoExistAdd(SKIN_KEY, v);
|
||||
@@ -227,6 +227,10 @@ void NddSetting::init()
|
||||
QVariant v(14);
|
||||
checkNoExistAdd(FIND_RESULT_FONT_SIZE, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(LAST_ACTION_TAB_INDEX, v);
|
||||
}
|
||||
} while (false);
|
||||
|
||||
}
|
||||
@@ -237,7 +241,7 @@ void NddSetting::init()
|
||||
|
||||
|
||||
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
|
||||
QString NddSetting::getKeyValueFromSets(QString key)
|
||||
{
|
||||
return s_nddSet->value(key,"").toString();
|
||||
@@ -250,7 +254,7 @@ bool NddSetting::updataKeyValueFromSets(QString key, QString value)
|
||||
return true;
|
||||
}
|
||||
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
|
||||
QByteArray NddSetting::getKeyByteArrayValue(QString key)
|
||||
{
|
||||
return s_nddSet->value(key, "").toByteArray();
|
||||
@@ -262,14 +266,14 @@ void NddSetting::updataKeyByteArrayValue(QString key, QByteArray& value)
|
||||
s_isContentChanged = true;
|
||||
}
|
||||
|
||||
//第一次加一条记录,用于初始化
|
||||
//第一次加一条记录,用于初始化
|
||||
void NddSetting::addKeyValueToSets(QString key, QString value)
|
||||
{
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
}
|
||||
|
||||
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口.0做默认值,外部最好不用0做初始化值
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口.0做默认值,外部最好不用0做初始化值
|
||||
int NddSetting::getKeyValueFromNumSets(const QString key)
|
||||
{
|
||||
QVariant v = s_nddSet->value(key, QVariant(0));
|
||||
@@ -283,7 +287,7 @@ bool NddSetting::updataKeyValueFromNumSets(const QString key, int value)
|
||||
}
|
||||
|
||||
|
||||
//第一次加一条记录,用于初始化
|
||||
//第一次加一条记录,用于初始化
|
||||
void NddSetting::addKeyValueToNumSets(QString key, int value)
|
||||
{
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
@@ -300,7 +304,7 @@ void NddSetting::close()
|
||||
{
|
||||
s_isExistDb = false;
|
||||
|
||||
//做一次真正的保存
|
||||
//做一次真正的保存
|
||||
if (s_isContentChanged)
|
||||
{
|
||||
s_nddSet->sync();
|
||||
@@ -309,38 +313,69 @@ void NddSetting::close()
|
||||
s_isContentChanged = false;
|
||||
}
|
||||
|
||||
//在这里保存一下子窗口的位置。不排除有可能子窗口还在,主窗口已经退出的情况,不过问题不大。
|
||||
if (s_winPosSet != nullptr)
|
||||
//在这里保存一下子窗口的位置。不排除有可能子窗口还在,主窗口已经退出的情况,不过问题不大。
|
||||
if (s_nddDelaySet != nullptr)
|
||||
{
|
||||
s_winPosSet->sync();
|
||||
s_winPosSet = nullptr;
|
||||
s_nddDelaySet->sync();
|
||||
s_nddDelaySet = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//子窗口的位置,单独放在一个winpos.ini文件中,而且启动程序时,不需要读取,可避免启动时拖慢速度
|
||||
//子窗口的位置,单独放在一个winpos.ini文件中,而且启动程序时,不需要读取,可避免启动时拖慢速度
|
||||
QByteArray NddSetting::getWinPos(QString key)
|
||||
{
|
||||
winPosInit();
|
||||
return s_winPosSet->value(key, "").toByteArray();
|
||||
nddDelaySetInit();
|
||||
return s_nddDelaySet->value(key, "").toByteArray();
|
||||
}
|
||||
|
||||
void NddSetting::updataWinPos(QString key, QByteArray& value)
|
||||
{
|
||||
winPosInit();
|
||||
s_winPosSet->setValue(key, QVariant(value));
|
||||
nddDelaySetInit();
|
||||
s_nddDelaySet->setValue(key, QVariant(value));
|
||||
}
|
||||
|
||||
void NddSetting::winPosInit()
|
||||
void NddSetting::nddDelaySetInit()
|
||||
{
|
||||
if (s_winPosSet == nullptr)
|
||||
if (s_nddDelaySet == nullptr)
|
||||
{
|
||||
QString settingDir = QString("notepad/delayset");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
QString qsSetPath = qs.fileName();
|
||||
|
||||
s_winPosSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
s_winPosSet->setIniCodec("UTF-8");
|
||||
s_nddDelaySet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
s_nddDelaySet->setIniCodec("UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
|
||||
QString NddSetting::getKeyValueFromDelaySets(QString key)
|
||||
{
|
||||
nddDelaySetInit();
|
||||
return s_nddDelaySet->value(key, "").toString();
|
||||
}
|
||||
|
||||
bool NddSetting::updataKeyValueFromDelaySets(QString key, QString value)
|
||||
{
|
||||
nddDelaySetInit();
|
||||
s_nddDelaySet->setValue(key, value);
|
||||
s_isContentChanged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
|
||||
int NddSetting::getKeyValueFromDelayNumSets(QString key)
|
||||
{
|
||||
nddDelaySetInit();
|
||||
return s_nddDelaySet->value(key, "").toInt();
|
||||
}
|
||||
|
||||
bool NddSetting::updataKeyValueFromDelayNumSets(QString key, int value)
|
||||
{
|
||||
nddDelaySetInit();
|
||||
s_nddDelaySet->setValue(key, value);
|
||||
s_isContentChanged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
+33
-20
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include <QSettings>
|
||||
#include <QVariant>
|
||||
|
||||
@@ -10,24 +10,29 @@ static QString SHOWSPACE_KEY = "blank";
|
||||
static QString MAX_BIG_TEXT = "maxtsize";
|
||||
static QString SOFT_STATUS = "rstatus";
|
||||
static QString SOFT_KEY = "rkey";
|
||||
static QString RESTORE_CLOSE_FILE = "restore"; //恢复关闭时打开的文件
|
||||
static QString PRO_DIR = "prodir";//放置配置文件的路径
|
||||
//static QString RESTORE_SIZE = "rsize";//保存关闭时的大小
|
||||
static QString WIN_POS = "pos";//保存关闭是的大小
|
||||
static QString ICON_SIZE = "iconsize";//图标大小
|
||||
static QString ZOOMVALUE = "zoom"; //放大倍数
|
||||
static QString VERSION = "version";//当前版本
|
||||
static QString FINDRESULTPOS = "findpos";//查找窗口悬浮的位置
|
||||
static QString FILELISTPOS = "filepos";//文件列表悬浮框的位置
|
||||
static QString FILELISTSHOW = "showfilelist"; //文件列表框是否显示
|
||||
static QString TOOLBARSHOW = "showbar"; //是否显示工具栏
|
||||
static QString FINDWINSIZE = "findwinsize";//保存查找框的大小。150%放大时界面永久。保留避免每次手动调整
|
||||
static QString SHOWWEBADDR = "showweb";//高亮web地址,双击网页打开
|
||||
static QString FIND_RESULT_FONT_SIZE = "frfs";//查找结果的默认字体大小,默认为14
|
||||
static QString RESTORE_CLOSE_FILE = "restore"; //恢复关闭时打开的文件
|
||||
static QString PRO_DIR = "prodir";//放置配置文件的路径
|
||||
//static QString RESTORE_SIZE = "rsize";//保存关闭时的大小
|
||||
static QString WIN_POS = "pos";//保存关闭是的大小
|
||||
static QString ICON_SIZE = "iconsize";//图标大小
|
||||
static QString ZOOMVALUE = "zoom"; //放大倍数
|
||||
static QString VERSION = "version";//当前版本
|
||||
static QString FINDRESULTPOS = "findpos";//查找窗口悬浮的位置
|
||||
static QString FILELISTPOS = "filepos";//文件列表悬浮框的位置
|
||||
static QString FILELISTSHOW = "showfilelist"; //文件列表框是否显示
|
||||
static QString TOOLBARSHOW = "showbar"; //是否显示工具栏
|
||||
static QString FINDWINSIZE = "findwinsize";//保存查找框的大小。150%放大时界面永久。保留避免每次手动调整
|
||||
static QString SHOWWEBADDR = "showweb";//高亮web地址,双击网页打开
|
||||
static QString FIND_RESULT_FONT_SIZE = "frfs";//查找结果的默认字体大小,默认为14
|
||||
static QString LAST_ACTION_TAB_INDEX = "lati";//上次关闭时,当前激活的tab标签页序号
|
||||
|
||||
static QString RECENT_OPEN_FILE = "recentopenfile";
|
||||
static QString LAST_OPEN_DIR = "lastdir";
|
||||
static QString CLEAR_OPENFILE_ON_CLOSE = "clearopenfile"; //关闭时清空历史文件
|
||||
|
||||
|
||||
//下面这个是winpos.ini中的key,避免单个文件太大,拖慢启动速度
|
||||
static QString BATCH_FIND_REPLACE_POS = "bfpos";//批量查找替换窗口的大小
|
||||
//下面这个是winpos.ini中的key,避免单个文件太大,拖慢启动速度
|
||||
static QString BATCH_FIND_REPLACE_POS = "bfpos";//批量查找替换窗口的大小
|
||||
|
||||
class NddSetting
|
||||
{
|
||||
@@ -58,14 +63,20 @@ public:
|
||||
|
||||
static void updataWinPos(QString key, QByteArray& value);
|
||||
|
||||
|
||||
static QString getKeyValueFromDelaySets(QString key);
|
||||
|
||||
static bool updataKeyValueFromDelaySets(QString key, QString value);
|
||||
|
||||
static int getKeyValueFromDelayNumSets(QString key);
|
||||
|
||||
static bool updataKeyValueFromDelayNumSets(QString key, int value);
|
||||
|
||||
static bool isDbExist()
|
||||
{
|
||||
return s_isExistDb;
|
||||
}
|
||||
private:
|
||||
static void winPosInit();
|
||||
static void nddDelaySetInit();
|
||||
private:
|
||||
|
||||
static bool s_isExistDb;
|
||||
@@ -74,5 +85,7 @@ private:
|
||||
|
||||
static QSettings* s_nddSet;
|
||||
|
||||
static QSettings* s_winPosSet;
|
||||
//基本和s_nddSet一样,不过在启动的时候,不需要读取该文件。加快启动速度
|
||||
//启动完毕后,其他操作触发加载该文件
|
||||
static QSettings* s_nddDelaySet;
|
||||
};
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 697 B |
+2
-2
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include "pluginGl.h"
|
||||
#include <functional>
|
||||
class QMenu;
|
||||
class QsciScintilla;
|
||||
class QWidget;
|
||||
|
||||
typedef int (*NDD_PROC_MAIN_CALLBACK)(QWidget* parent, const QString& strFileName, std::function<QsciScintilla*()>getCurEdit, NDD_PROC_DATA* procData);
|
||||
typedef int (*NDD_PROC_MAIN_CALLBACK)(QWidget* parent, const QString& strFileName, std::function<QsciScintilla*()>getCurEdit, std::function<bool(int, void*)>, NDD_PROC_DATA* procData);
|
||||
|
||||
int loadProc(const QString& strDirOut, std::function<void(NDD_PROC_DATA&, QMenu*)> funcallback, QMenu* pUserData);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
TEMPLATE = lib
|
||||
LANGUAGE = C++
|
||||
|
||||
CONFIG += qt warn_on
|
||||
CONFIG += qt warn_on Release
|
||||
QT += core gui widgets
|
||||
|
||||
HEADERS += *.h
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include <qobject.h>
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
#include <pluginGl.h>
|
||||
#include <functional>
|
||||
#include <qsciscintilla.h>
|
||||
#include "qttestclass.h"
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#define NDD_EXPORTDLL
|
||||
|
||||
@@ -22,7 +25,7 @@
|
||||
#endif
|
||||
|
||||
NDD_EXPORT bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData);
|
||||
NDD_EXPORT int NDD_PROC_MAIN(QWidget* pNotepad, const QString& strFileName, std::function<QsciScintilla* ()>getCurEdit, NDD_PROC_DATA* procData);
|
||||
NDD_EXPORT int NDD_PROC_MAIN(QWidget* pNotepad, const QString& strFileName, std::function<QsciScintilla* ()>getCurEdit, std::function<bool(int, void*)> pluginCallBack, NDD_PROC_DATA* procData);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -32,6 +35,7 @@
|
||||
static NDD_PROC_DATA s_procData;
|
||||
static QWidget* s_pMainNotepad = nullptr;
|
||||
std::function<QsciScintilla* ()> s_getCurEdit;
|
||||
std::function<bool(int, void*)> s_invokeMainFun;
|
||||
|
||||
bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData)
|
||||
{
|
||||
@@ -40,7 +44,7 @@ bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData)
|
||||
return false;
|
||||
}
|
||||
pProcData->m_strPlugName = QObject::tr("Hello World Plug");
|
||||
pProcData->m_strComment = QObject::tr("char to Upper.");
|
||||
pProcData->m_strComment = QObject::tr(u8"不需要创建二级菜单的插件例子");
|
||||
|
||||
pProcData->m_version = QString("v1.0");
|
||||
pProcData->m_auther = QString("zuowei.yin");
|
||||
@@ -54,9 +58,10 @@ bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData)
|
||||
//pNotepad:就是CCNotepad的主界面指针
|
||||
//strFileName:当前插件DLL的全路径,如果不关心,则可以不使用
|
||||
//getCurEdit:从NDD主程序传递过来的仿函数,通过该函数获取当前编辑框操作对象QsciScintilla
|
||||
//s_invokeMainFun: 可以回调NDD主程序中的功能函数,比如创建新文件功能等,根据需要可实时扩展。
|
||||
//pProcData:如果pProcData->m_menuType = 0 ,则该指针为空;如果pProcData->m_menuType = 1,则该指针有值。目前需要关心s_procData.m_rootMenu
|
||||
//开发者可以在该菜单下面,自行创建二级菜单
|
||||
int NDD_PROC_MAIN(QWidget* pNotepad, const QString &strFileName, std::function<QsciScintilla*()>getCurEdit, NDD_PROC_DATA* pProcData)
|
||||
int NDD_PROC_MAIN(QWidget* pNotepad, const QString &strFileName, std::function<QsciScintilla*()>getCurEdit, std::function<bool(int, void*)> pluginCallBack, NDD_PROC_DATA* pProcData)
|
||||
{
|
||||
QsciScintilla* pEdit = getCurEdit();
|
||||
if (pEdit == nullptr)
|
||||
@@ -72,6 +77,7 @@ int NDD_PROC_MAIN(QWidget* pNotepad, const QString &strFileName, std::function<Q
|
||||
|
||||
s_pMainNotepad = pNotepad;
|
||||
s_getCurEdit = getCurEdit;
|
||||
s_invokeMainFun = pluginCallBack;
|
||||
|
||||
//如果pProcData->m_menuType = 1;是自己要创建二级菜单的场景。则通过s_procData.m_rootMenu 获取该插件的菜单根节点。
|
||||
//插件开发者自行在s_procData.m_rootMenu下添加新的二级菜单项目
|
||||
@@ -85,3 +91,26 @@ int NDD_PROC_MAIN(QWidget* pNotepad, const QString &strFileName, std::function<Q
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpvReserved) {
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
if (NULL == lpvReserved) {
|
||||
//做全局回收工作
|
||||
}
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
void onDllUnload(void)
|
||||
{
|
||||
//做全局回收工作
|
||||
}
|
||||
#endif
|
||||
@@ -1,9 +1,12 @@
|
||||
#include <qobject.h>
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
#include <pluginGl.h>
|
||||
#include <functional>
|
||||
#include <qsciscintilla.h>
|
||||
#include <QAction>
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#define NDD_EXPORTDLL
|
||||
|
||||
@@ -22,7 +25,7 @@
|
||||
#endif
|
||||
|
||||
NDD_EXPORT bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData);
|
||||
NDD_EXPORT int NDD_PROC_MAIN(QWidget* pNotepad, const QString& strFileName, std::function<QsciScintilla* ()>getCurEdit, NDD_PROC_DATA* procData);
|
||||
NDD_EXPORT int NDD_PROC_MAIN(QWidget* pNotepad, const QString& strFileName, std::function<QsciScintilla* ()>getCurEdit, std::function<bool(int, void*)> pluginCallBack, NDD_PROC_DATA* procData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -31,6 +34,7 @@
|
||||
static NDD_PROC_DATA s_procData;
|
||||
static QWidget* s_pMainNotepad = nullptr;
|
||||
std::function<QsciScintilla* ()> s_getCurEdit;
|
||||
std::function<bool(int, void*)> s_invokeMainFun;
|
||||
|
||||
bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData)
|
||||
{
|
||||
@@ -38,8 +42,8 @@ bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
pProcData->m_strPlugName = QObject::tr("Test Plug");
|
||||
pProcData->m_strComment = QObject::tr("char to lower.");
|
||||
pProcData->m_strPlugName = QObject::tr("Create Second Menu Plug");
|
||||
pProcData->m_strComment = QObject::tr(u8"创建二级菜单的插件例子");
|
||||
|
||||
pProcData->m_version = QString("v1.0");
|
||||
pProcData->m_auther = QString("zuowei.yin");
|
||||
@@ -53,8 +57,9 @@ bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData)
|
||||
//strFileName:当前插件DLL的全路径,如果不关心,则可以不使用
|
||||
//getCurEdit:从NDD主程序传递过来的仿函数,通过该函数获取当前编辑框操作对象QsciScintilla
|
||||
//pProcData:如果pProcData->m_menuType = 0 ,则该指针为空;如果pProcData->m_menuType = 1,则该指针有值。目前需要关心s_procData.m_rootMenu
|
||||
//开发者可以在该菜单下面,自行创建二级菜单
|
||||
int NDD_PROC_MAIN(QWidget* pNotepad, const QString& strFileName, std::function<QsciScintilla* ()>getCurEdit, NDD_PROC_DATA* pProcData)
|
||||
//s_invokeMainFun: 可以回调NDD主程序中的功能函数,比如创建新文件功能等,根据需要可实时扩展。
|
||||
//开发者可以在该菜单下面,自行创建二级菜单.更详细的例子,请见jstool min插件。
|
||||
int NDD_PROC_MAIN(QWidget* pNotepad, const QString& strFileName, std::function<QsciScintilla* ()>getCurEdit, std::function<bool(int, void*)> pluginCallBack, NDD_PROC_DATA* pProcData)
|
||||
{
|
||||
|
||||
//务必拷贝一份pProcData,在外面会释放。
|
||||
|
||||
+5
-1
@@ -1,4 +1,4 @@
|
||||
#include "pluginmgr.h"
|
||||
#include "pluginmgr.h"
|
||||
#include "rcglobal.h"
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@ PluginMgr::PluginMgr(QWidget *parent, QList<NDD_PROC_DATA>& pluginList)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
ui.pluginTable->horizontalHeader()->setStretchLastSection(true);
|
||||
ui.pluginTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui.pluginTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||
//ui.pluginTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
init(pluginList);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Scintilla source code edit control
|
||||
// Scintilla source code edit control
|
||||
/** @file EditView.cxx
|
||||
** Defines the appearance of the main text area of the editor window.
|
||||
**/
|
||||
@@ -833,7 +833,13 @@ static void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle r
|
||||
PRectangle rcChar = rcCChar;
|
||||
rcChar.left++;
|
||||
rcChar.right--;
|
||||
surface->DrawTextClipped(rcChar, ctrlCharsFont,
|
||||
// In the original Scintilla code this was a call to DrawTextClipped().
|
||||
// This caused the clipping to be incorrect (triggered when EOLs are
|
||||
// visible) causing text to overwrite the margins when scrolling. The
|
||||
// change is consistent with the alternative code paths to where
|
||||
// DrawTextBlob() is called bu tthe root cause maybe in PlatQt.cpp or in Qt
|
||||
// itself.
|
||||
surface->DrawTextNoClip(rcChar, ctrlCharsFont,
|
||||
rcSegment.top + vsDraw.maxAscent, s, static_cast<int>(s ? strlen(s) : 0),
|
||||
textBack, textFore);
|
||||
}
|
||||
|
||||
@@ -5622,7 +5622,7 @@ void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam
|
||||
vs.styles[wParam].back = ColourDesired(static_cast<int>(lParam));
|
||||
break;
|
||||
case SCI_STYLESETBOLD:
|
||||
vs.styles[wParam].weight = lParam != 0 ? SC_WEIGHT_BOLD : SC_WEIGHT_NORMAL;
|
||||
vs.styles[wParam].weight = ((lParam != 0) ? SC_WEIGHT_BOLD : SC_WEIGHT_NORMAL);
|
||||
break;
|
||||
case SCI_STYLESETWEIGHT:
|
||||
vs.styles[wParam].weight = static_cast<int>(lParam);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2021 Riverbank Computing Limited
|
||||
// Copyright (c) 2023 Riverbank Computing Limited
|
||||
// Copyright (c) 2011 Archaeopteryx Software, Inc.
|
||||
// Copyright (c) 1990-2011, Scientific Toolworks, Inc.
|
||||
//
|
||||
@@ -137,44 +137,45 @@ void QsciScintillaBase::inputMethodEvent(QInputMethodEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
bool initialCompose = false;
|
||||
if (sci->pdoc->TentativeActive()) {
|
||||
sci->pdoc->TentativeUndo();
|
||||
} else {
|
||||
// No tentative undo means start of this composition so
|
||||
// Fill in any virtual spaces.
|
||||
sci->ClearBeforeTentativeStart();
|
||||
initialCompose = true;
|
||||
}
|
||||
|
||||
sci->view.imeCaretBlockOverride = false;
|
||||
|
||||
if (!event->commitString().isEmpty()) {
|
||||
const QString commitStr = event->commitString();
|
||||
const unsigned int commitStrLen = commitStr.length();
|
||||
const int commitStrLen = commitStr.length();
|
||||
|
||||
for (unsigned int i = 0; i < commitStrLen;) {
|
||||
const unsigned int ucWidth = commitStr.at(i).isHighSurrogate() ? 2 : 1;
|
||||
for (int i = 0; i < commitStrLen;) {
|
||||
const int ucWidth = commitStr.at(i).isHighSurrogate() ? 2 : 1;
|
||||
const QString oneCharUTF16 = commitStr.mid(i, ucWidth);
|
||||
const QByteArray oneChar = textAsBytes(oneCharUTF16);
|
||||
const int oneCharLen = oneChar.length();
|
||||
|
||||
sci->AddCharUTF(oneChar.data(), oneCharLen);
|
||||
sci->AddCharUTF(oneChar.data(), oneChar.length());
|
||||
i += ucWidth;
|
||||
}
|
||||
|
||||
} else if (!event->preeditString().isEmpty()) {
|
||||
const QString preeditStr = event->preeditString();
|
||||
const unsigned int preeditStrLen = preeditStr.length();
|
||||
if ((preeditStrLen == 0) || (preeditStrLen > MAXLENINPUTIME)) {
|
||||
const int preeditStrLen = preeditStr.length();
|
||||
if (preeditStrLen == 0) {
|
||||
sci->ShowCaretAtCurrentPosition();
|
||||
return;
|
||||
}
|
||||
|
||||
if (initialCompose)
|
||||
sci->ClearBeforeTentativeStart();
|
||||
sci->pdoc->TentativeStart(); // TentativeActive() from now on.
|
||||
|
||||
std::vector<int> imeIndicator = MapImeIndicators(event);
|
||||
|
||||
const bool recording = sci->recordingMacro;
|
||||
sci->recordingMacro = false;
|
||||
for (unsigned int i = 0; i < preeditStrLen;) {
|
||||
const unsigned int ucWidth = preeditStr.at(i).isHighSurrogate() ? 2 : 1;
|
||||
const QString oneCharUTF16 = preeditStr.mid(i, ucWidth);
|
||||
@@ -186,7 +187,6 @@ void QsciScintillaBase::inputMethodEvent(QInputMethodEvent *event)
|
||||
DrawImeIndicator(sci, imeIndicator[i], oneCharLen);
|
||||
i += ucWidth;
|
||||
}
|
||||
sci->recordingMacro = recording;
|
||||
|
||||
// Move IME carets.
|
||||
int imeCaretPos = GetImeCaretPos(event);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// This module implements the specialisation of QListBox that handles the
|
||||
// Scintilla double-click callback.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// This defines the specialisation of QListBox that handles the Scintilla
|
||||
// double-click callback.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// macOS. It is a separate file to avoid clashes between macOS and Scintilla
|
||||
// data types.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This module implements the portability layer for the Qt port of Scintilla.
|
||||
// This module implements the portability layer for the Qt port of Scintilla.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This module defines interface to the QsciAbstractAPIs class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This module defines interface to the QsciAPIs class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciCommand class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciCommandSet class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciDocument class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This module defines various things common to all of the Scintilla Qt port.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
@@ -37,7 +37,11 @@
|
||||
// Define QSCINTILLA_MAKE_DLL to create a QScintilla shared library, or
|
||||
// define QSCINTILLA_DLL to link against a QScintilla shared library, or define
|
||||
// neither to either build or link against a static QScintilla library.
|
||||
#define QSCINTILLA_DLL
|
||||
#ifdef QSCINTILLA_DLL
|
||||
#undef QSCINTILLA_DLL
|
||||
#endif
|
||||
|
||||
//#define QSCINTILLA_DLL
|
||||
|
||||
#if defined(QSCINTILLA_DLL)
|
||||
#define QSCINTILLA_EXPORT Q_DECL_IMPORT
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexer class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
// This defines the interface to the QsciLexerAsm class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerAVS class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerBash class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerBatch class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerCMake class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerCoffeeScript class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerCPP class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerCSharp class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerCSS class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerCustom class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerD class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerDiff class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerEDIFACT class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerFortran class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerFortran77 class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerGO class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerHTML class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerIDL class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerJava class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerJavaScript class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerJSON class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerLua class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerMakefile class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerMarkdown class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerMatlab class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerOctave class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerPascal class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerPerl class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerPO class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerPostScript class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerPOV class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerProperties class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerPython class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#pragma once
|
||||
// This defines the interface to the QsciLexerR class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This defines the interface to the QsciLexerRuby class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user