From a1c0d30f4fb2da5cc21161628d356206ce606e39 Mon Sep 17 00:00:00 2001
From: wingsummer <1326224942@qq.com>
Date: Sat, 14 Jun 2025 22:16:36 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E9=87=8D=E8=BD=BD=E9=97=AE=E9=A2=98=EF=BC=9B=E6=9B=B4=E6=96=B0?=
=?UTF-8?q?=E4=B8=8A=E6=B8=B8=E7=BB=84=E4=BB=B6=EF=BC=9B=E9=87=8D=E6=9E=84?=
=?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=B3=BB=E7=BB=9F=E7=9A=84=20SDK=20=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E5=86=85=E5=AE=B9=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
3rdparty/QHexView/document/qhexdocument.cpp | 3 +
3rdparty/Qt-Advanced-Docking-System | 2 +-
3rdparty/cpptrace | 2 +-
3rdparty/qwindowkit | 2 +-
CMakeLists.txt | 5 +-
README.md | 6 +-
README_en.md | 6 +-
TestPlugin/lang/TestPlugin_zh_CN.ts | 14 +-
TestPlugin/testplugin.cpp | 28 +-
WingPlugin | 2 +-
lang/zh_CN/winghex_zh_CN.ts | 199 ++++----
lang/zh_TW/winghex_zh_TW.ts | 199 ++++----
src/class/pluginsystem.cpp | 509 +++++++++++---------
src/class/pluginsystem.h | 499 ++++++++++---------
src/class/wingangelapi.cpp | 9 +-
src/components.md | 3 +-
src/control/editorview.cpp | 42 +-
src/control/editorview.h | 405 ++++++++--------
src/dialog/mainwindow.cpp | 23 +-
src/dialog/scriptingdialog.cpp | 31 +-
src/dialog/scriptingdialog.h | 2 +
src/grammar/NumCal/NumCal.g4 | 4 +-
src/grammar/NumCal/NumCalParser.cpp | 134 +++---
src/grammar/NumCal/NumCalParser.h | 4 +-
24 files changed, 1052 insertions(+), 1081 deletions(-)
diff --git a/3rdparty/QHexView/document/qhexdocument.cpp b/3rdparty/QHexView/document/qhexdocument.cpp
index 9c99172..60aa451 100644
--- a/3rdparty/QHexView/document/qhexdocument.cpp
+++ b/3rdparty/QHexView/document/qhexdocument.cpp
@@ -226,7 +226,10 @@ bool QHexDocument::isUndoByteModified() { return m_bytesModFlag > 0; }
void QHexDocument::setDocSaved(bool b) {
if (b) {
m_undostack->setClean();
+ } else {
+ m_undostack->resetClean();
}
+
Q_EMIT documentSaved(b);
}
diff --git a/3rdparty/Qt-Advanced-Docking-System b/3rdparty/Qt-Advanced-Docking-System
index 7cdf84f..8875029 160000
--- a/3rdparty/Qt-Advanced-Docking-System
+++ b/3rdparty/Qt-Advanced-Docking-System
@@ -1 +1 @@
-Subproject commit 7cdf84f7c23256032f9bbae44e6a47b439ed66c8
+Subproject commit 8875029eb943e6fd36e6b8f07dcf063bc081b0d3
diff --git a/3rdparty/cpptrace b/3rdparty/cpptrace
index ce639eb..74051bb 160000
--- a/3rdparty/cpptrace
+++ b/3rdparty/cpptrace
@@ -1 +1 @@
-Subproject commit ce639ebfcec47a7c74233b4bab50017cb34e615b
+Subproject commit 74051bb8376a8f546fefd5ad25f77daa80da9799
diff --git a/3rdparty/qwindowkit b/3rdparty/qwindowkit
index a1c500e..a4d0b98 160000
--- a/3rdparty/qwindowkit
+++ b/3rdparty/qwindowkit
@@ -1 +1 @@
-Subproject commit a1c500e1dd254445e7bc153f4e0f049cabab35a0
+Subproject commit a4d0b98d40d0f740742e393db774ee53302ec64c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53476eb..2301f9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,9 +10,8 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PROJECT_VERSION "2.2.3")
-find_package(
- QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network Concurrent
- PrintSupport Xml LinguistTools)
+find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Network Concurrent
+ PrintSupport Xml LinguistTools)
find_package(
Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network Concurrent
PrintSupport Xml LinguistTools)
diff --git a/README.md b/README.md
index 6766de5..172416e 100644
--- a/README.md
+++ b/README.md
@@ -92,11 +92,7 @@
## 软件编译运行情况
-> 对于 Qt 5 版本,建议 5.15.2 或更高版本,Qt 6 的话 6.6.2 或更高的版本,其他低版本由于关键库的 API 缺失和自身的一些 Bug,所以请不要使用。
-
-另外:
-
-> QT5 版本主动编译支持已停止,我不会再支持和修复相关问题,但接受 PR 。如果因特殊需要 QT5 版本,请咨询我商业合作和付费技术支持。
+> Qt 6 请使用 6.6.2 或更高的版本,其他低版本由于关键库的 API 缺失和自身的一些 Bug,所以请不要使用。QT5 已停止支持,我不会再修复相关问题,但接受 PR 。如果因特殊需要 QT5 版本,请咨询我商业合作和付费技术支持。
该仓库代码使用 Qt 6.6.2 在最新版 Windows 和 Ubuntu 编译情况: 
diff --git a/README_en.md b/README_en.md
index aadfa19..3249989 100644
--- a/README_en.md
+++ b/README_en.md
@@ -92,11 +92,7 @@ Make sure that you follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) while contrib
## Status
-> For Qt 5, only version 5.15.2 or higher is suggested, and for Qt 6, only version 6.6.2 or higher is recommended. Other lower versions are wired due to missing APIs of key libraries and some bugs of their own.
-
-And also:
-
-> Support for QT5 had been stopped, and I will no longer fix related issues, but PR will be welcomed. If you need QT5 version for special purposes, please consult me for commercial cooperation and paid technical support.
+> For Qt 6, only version 6.6.2 or higher is recommended. Other lower versions are wired due to missing APIs of key libraries and some bugs of their own. Support for QT5 had been stopped, and I will no longer fix related issues, but PR will be welcomed. If you need QT5 version for special purposes, please consult me for commercial cooperation and paid technical support.
The repository code compiles with Qt 5.15.2 and 6.6.2 on the latest versions of Windows and Ubuntu: 
diff --git a/TestPlugin/lang/TestPlugin_zh_CN.ts b/TestPlugin/lang/TestPlugin_zh_CN.ts
index d536183..6c36a69 100644
--- a/TestPlugin/lang/TestPlugin_zh_CN.ts
+++ b/TestPlugin/lang/TestPlugin_zh_CN.ts
@@ -306,12 +306,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
InvalidParamsCount
无效参数个数
@@ -322,7 +322,7 @@
非法参数
-
+
AllocArrayFailed
分配数组失败
diff --git a/TestPlugin/testplugin.cpp b/TestPlugin/testplugin.cpp
index ed18942..e18a83c 100644
--- a/TestPlugin/testplugin.cpp
+++ b/TestPlugin/testplugin.cpp
@@ -444,16 +444,17 @@ TestPlugin::colorTable(const QList ¶ms) {
colors.append(new QColor(c));
}
- auto invoked =
- invokeService(QStringLiteral("WingAngelAPI"), "vector2AsArray",
- WINGAPI_RETURN_ARG(array), WINGAPI_ARG(MetaType::Color),
- WINGAPI_ARG(colors));
- if (invoked) {
- if (array) {
- qDeleteAll(colors);
- return array;
- }
- }
+ // TODO
+ // auto invoked =
+ // invokeService(QStringLiteral("WingAngelAPI"), "vector2AsArray",
+ // WINGAPI_RETURN_ARG(array),
+ // WINGAPI_ARG(MetaType::Color), WINGAPI_ARG(colors));
+ // if (invoked) {
+ // if (array) {
+ // qDeleteAll(colors);
+ // return array;
+ // }
+ // }
qDeleteAll(colors);
return generateScriptCallError(-2, tr("AllocArrayFailed"));
@@ -642,8 +643,7 @@ WingHex::IWingPlugin::RegisteredEvents TestPlugin::registeredEvents() const {
void TestPlugin::eventReady() {
bool ret;
- invokeService(
- QStringLiteral("WingAngelAPI"), "execCode", Qt::AutoConnection,
- WINGAPI_RETURN_ARG(ret),
- WINGAPI_ARG(QString(R"(print("Hello, this is TestPlugin!");)")));
+ invokeService(QStringLiteral("WingAngelAPI"), "execCode",
+ Qt::AutoConnection, qReturnArg(ret),
+ QStringLiteral(R"(print("Hello, this is TestPlugin!");)"));
}
diff --git a/WingPlugin b/WingPlugin
index 1f53c30..07d1b5a 160000
--- a/WingPlugin
+++ b/WingPlugin
@@ -1 +1 @@
-Subproject commit 1f53c308498e529e5cfbed16c9f7f68c77a3e8e5
+Subproject commit 07d1b5a19e7b3fca2444c02edbe1d28e13d34316
diff --git a/lang/zh_CN/winghex_zh_CN.ts b/lang/zh_CN/winghex_zh_CN.ts
index 442dfbd..5bed38b 100644
--- a/lang/zh_CN/winghex_zh_CN.ts
+++ b/lang/zh_CN/winghex_zh_CN.ts
@@ -470,12 +470,12 @@
书签
-
+
Untitled
未命名
-
+
Not allowed operation in non-UI thread
该操作在非 UI 线程非法
@@ -1022,8 +1022,8 @@
-
-
+
+
Reload
重新加载
@@ -1285,7 +1285,7 @@
导出结果
-
+
NothingToSave
没有保存的数据
@@ -1607,10 +1607,10 @@
-
-
-
-
+
+
+
+
Error
错误
@@ -1624,8 +1624,8 @@
-
-
+
+
FilePermission
因文件权限无法继续!
@@ -1648,7 +1648,7 @@
-
+
ChooseSaveFile
请选择保存文件路径:
@@ -1688,55 +1688,55 @@
该编辑页已被克隆编辑,如果关闭,相关联的页也会被关闭,你确认继续吗?
-
+
FileCloseBigFile
大文件读取模式下目标文件被关闭,该标签将会被关闭。
-
-
+
+
ReloadNeededYesOrNo
目标文件被修改,是否重新加载?
-
+
SaveWorkSpace
保存工作区
-
+
WingHexWorkSpace (*.wingpro)
羽云十六进制工作区 (*.wingpro)
-
+
ConfirmSave
正在关闭未保存的文件或工作区,你确定保存吗?
-
+
[Info]
【信息】
-
+
[Warn]
【警告】
-
+
[Error]
【错误】
-
+
ConfirmAPPSave
你尝试关闭程序,但仍存在未保存的文件或工作区,你确定保存这些更改吗?
-
+
SaveSuccessfully
保存成功!
@@ -2049,12 +2049,12 @@
工作区文件无法保存,你确认要退出吗?
-
+
CopyLimit
拷贝字节超出限制
-
+
ErrOpenFileBelow
打开文件出现错误(由于权限不足),如下为打开错误的文件:
@@ -2285,200 +2285,195 @@
PluginSystem
-
+
LoadingPlugin
加载插件中:
-
+
InvalidPluginBrokenInfo
加载插件失败:损坏的插件数据
-
+
AppClosingCanceled:
程序关闭被取消:
-
+
- PluginID:
- 插件 ID:
-
+
FoundDrvPluginCount
总计发现设备拓展插件数目:
-
+
RegisterScriptFnUnSupportedTypes:
因脚本函数含有未支持的类型而注册失败:
-
-
+
+
RegisterScriptFnInvalidSig:
因脚本函数签名非法而注册失败:
-
-
+
+
RegisterScriptFnConflitSig:
因脚本函数签名冲突而注册失败:
-
+
InvalidEnumName:
非法枚举名:
-
+
InvalidEnumValue:
非法枚举值:
-
+
InvalidMarcosRegister:
非法宏注册:
-
+
ErrLoadPluginSDKVersion
插件加载失败:非法插件 SDK 版本!
-
+
ErrLoadPluginNoName
插件加载失败:非法插件名称!
-
+
ErrLoadInitPlugin
插件加载失败:初始化插件失败!
-
+
PluginName :
插件名:
-
+
PluginAuthor :
插件作者:
-
+
PluginWidgetRegister
注册插件对象中……
-
+
ErrLoadExtPluginSDKVersion
设备拓展插件加载失败:非法插件 SDK 版本!
-
+
ExtPluginAuthor :
设备拓展插件作者:
-
+
ExtPluginWidgetRegister
设备拓展注册插件对象中……
-
+
ErrLoadInitExtPlugin
设备拓展插件加载失败:初始化插件失败!
-
+
ChooseFile
选择文件
-
-
+
+
Error
错误
-
+
FileNotExist
文件不存在!
-
+
FilePermission
因文件权限无法继续!
-
+
EmptyNameDockWidget:
空的贴边组件名:
-
+
InvalidNameDockWidget:
无效贴边组件名:
-
+
InvalidNullDockWidget:
无效空贴边组件:
-
+
Not allowed operation in non-UI thread
该操作在非 UI 线程非法
-
+
UnsafePluginDir
不安全的插件目录,请将插件目录设置为仅管理员账户可写
-
- [EvilCall]
- 【非法调用】
-
-
-
+
InvalidPluginID
加载插件失败:非法插件标识符
-
+
InvalidDupPlugin
加载插件失败:重复的插件标识符
-
+
FoundPluginCount
总计发现插件数目:
-
+
PluginLoadingFailedSummary
有依赖插件加载失败总结
-
+
- Dependencies:
- 依赖:
-
+
PUID:
插件唯一标志符:
-
+
Version:
版本:
-
+
PluginLoadingFinished
加载插件完毕!
@@ -4658,8 +4653,7 @@
-
-
+
Reload
重新加载
@@ -4832,11 +4826,11 @@
-
-
-
-
-
+
+
+
+
+
Error
错误
@@ -4856,84 +4850,83 @@
脚本保存失败,你仍确认关闭吗?
-
-
+
ReloadNeededYesOrNo
目标文件被修改,是否重新加载?
-
+
Debuging...
调试中...
-
+
Running...
运行中...
-
+
Line %1, Col %2
行 %1, 列 %2
-
+
(Selected: %1)
(选中: %1)
-
-
+
+
ChooseFile
选择文件
-
-
-
+
+
+
FilePermission
因文件权限无法继续!
-
+
ReloadSuccessfully
文件重新加载成功!
-
+
ReloadUnSuccessfully
文件重新加载失败!
-
+
ChooseSaveFile
请选择保存文件路径:
-
-
+
+
SaveSuccessfully
保存成功!
-
+
SaveUnSuccessfully
保存失败!
-
+
FormatCodeFailed
代码格式化失败
-
-
+
+
CannotSave2RunScript
无法保存,故无法继续运行脚本。
-
+
ScriptStillRunning
脚本仍在运行,你确定要退出吗?
@@ -5254,18 +5247,18 @@
为 AngelScript 脚本提供调用主机 API 能力的内部插件。
-
+
NotSupportedQMetaType:
不支持的 QT 数据元类型:
-
-
+
+
Get Exception While ScriptCall: (%1) %2
脚本调用发生异常:(%1)%2
-
+
InvalidRetType: need
无效返回值:需要
diff --git a/lang/zh_TW/winghex_zh_TW.ts b/lang/zh_TW/winghex_zh_TW.ts
index c4f7d3d..2706988 100644
--- a/lang/zh_TW/winghex_zh_TW.ts
+++ b/lang/zh_TW/winghex_zh_TW.ts
@@ -470,12 +470,12 @@
書簽
-
+
Untitled
未命名
-
+
Not allowed operation in non-UI thread
該操作在非 UI 線程非法
@@ -1022,8 +1022,8 @@
-
-
+
+
Reload
重新加載
@@ -1285,7 +1285,7 @@
導出結果
-
+
NothingToSave
沒有保存的數據
@@ -1607,10 +1607,10 @@
-
-
-
-
+
+
+
+
Error
錯誤
@@ -1624,8 +1624,8 @@
-
-
+
+
FilePermission
因檔許可權無法繼續!
@@ -1648,7 +1648,7 @@
-
+
ChooseSaveFile
請選擇保存檔路徑:
@@ -1688,55 +1688,55 @@
該編輯頁已被克隆編輯,如果關閉,相關聯的頁也會被關閉,你確認繼續嗎?
-
+
FileCloseBigFile
大檔讀取模式下目的檔案被關閉,該標籤將會被關閉。
-
-
+
+
ReloadNeededYesOrNo
目的檔案被修改,是否重新載入?
-
+
SaveWorkSpace
保存工作區
-
+
WingHexWorkSpace (*.wingpro)
羽雲十六進制工作區 (*.wingpro)
-
+
ConfirmSave
正在關閉未保存的檔或工作區,你確定保存嗎?
-
+
[Info]
【資訊】
-
+
[Warn]
【警告】
-
+
[Error]
【錯誤】
-
+
ConfirmAPPSave
你嘗試關閉程式,但仍存在未保存的檔或工作區,你確定保存這些更改嗎?
-
+
SaveSuccessfully
保存成功!
@@ -2049,12 +2049,12 @@
工作區檔無法保存,你確認要退出嗎?
-
+
CopyLimit
拷貝位元組超出限制
-
+
ErrOpenFileBelow
打開檔出現錯誤(由於許可權不足),如下為打開錯誤的檔:
@@ -2285,200 +2285,195 @@
PluginSystem
-
+
LoadingPlugin
加載插件中:
-
+
InvalidPluginBrokenInfo
加載插件失敗:損壞的插件數據
-
+
AppClosingCanceled:
程式關閉被取消:
-
+
- PluginID:
- 插件 ID:
-
+
FoundDrvPluginCount
總計發現設備拓展插件數目:
-
+
RegisterScriptFnUnSupportedTypes:
因腳本函數含有未支持的類型而註冊失敗:
-
-
+
+
RegisterScriptFnInvalidSig:
因腳本函數簽名非法而註冊失敗:
-
-
+
+
RegisterScriptFnConflitSig:
因腳本函數簽名衝突而註冊失敗:
-
+
InvalidEnumName:
非法枚舉名:
-
+
InvalidEnumValue:
非法枚舉值:
-
+
InvalidMarcosRegister:
非法宏註冊:
-
+
ErrLoadPluginSDKVersion
插件加載失敗:非法插件 SDK 版本!
-
+
ErrLoadPluginNoName
插件加載失敗:非法插件名稱!
-
+
ErrLoadInitPlugin
插件加載失敗:初始化插件失敗!
-
+
PluginName :
插件名:
-
+
PluginAuthor :
插件作者:
-
+
PluginWidgetRegister
註冊插件對象中……
-
+
ErrLoadExtPluginSDKVersion
設備拓展插件加載失敗:非法插件 SDK 版本!
-
+
ExtPluginAuthor :
設備拓展插件作者:
-
+
ExtPluginWidgetRegister
設備拓展註冊插件對象中……
-
+
ErrLoadInitExtPlugin
設備拓展插件加載失敗:初始化插件失敗!
-
+
ChooseFile
選擇檔
-
-
+
+
Error
錯誤
-
+
FileNotExist
檔不存在!
-
+
FilePermission
因檔許可權無法繼續!
-
+
EmptyNameDockWidget:
空的貼邊組件名:
-
+
InvalidNameDockWidget:
無效貼邊組件名:
-
+
InvalidNullDockWidget:
無效空貼邊組件:
-
+
Not allowed operation in non-UI thread
該操作在非 UI 線程非法
-
+
UnsafePluginDir
不安全的插件目錄,請將插件目錄設置為僅管理員帳戶可寫
-
- [EvilCall]
- 【非法調用】
-
-
-
+
InvalidPluginID
加載插件失敗:非法插件識別字
-
+
InvalidDupPlugin
加載插件失敗:重複的插件識別字
-
+
FoundPluginCount
總計發現插件數目:
-
+
PluginLoadingFailedSummary
有依賴插件加載失敗總結
-
+
- Dependencies:
- 依賴:
-
+
PUID:
插件唯一標誌符:
-
+
Version:
版本:
-
+
PluginLoadingFinished
加載插件完畢!
@@ -4658,8 +4653,7 @@
-
-
+
Reload
重新加載
@@ -4832,11 +4826,11 @@
-
-
-
-
-
+
+
+
+
+
Error
錯誤
@@ -4856,84 +4850,83 @@
腳本保存失敗,你仍確認關閉嗎?
-
-
+
ReloadNeededYesOrNo
目的檔案被修改,是否重新載入?
-
+
Debuging...
調試中...
-
+
Running...
運行中...
-
+
Line %1, Col %2
行 %1, 列 %2
-
+
(Selected: %1)
(選中: %1)
-
-
+
+
ChooseFile
選擇檔
-
-
-
+
+
+
FilePermission
因檔許可權無法繼續!
-
+
ReloadSuccessfully
檔重新加載成功!
-
+
ReloadUnSuccessfully
檔重新加載失敗!
-
+
ChooseSaveFile
請選擇保存檔路徑:
-
-
+
+
SaveSuccessfully
保存成功!
-
+
SaveUnSuccessfully
保存失敗!
-
+
FormatCodeFailed
代碼格式化失敗
-
-
+
+
CannotSave2RunScript
無法保存,故無法繼續運行腳本。
-
+
ScriptStillRunning
腳本仍在運行,你確定要退出嗎?
@@ -5254,18 +5247,18 @@
為 AngelScript 腳本提供調用主機 API 能力的內部插件。
-
+
NotSupportedQMetaType:
不支持的 QT 數據元類型:
-
-
+
+
Get Exception While ScriptCall: (%1) %2
腳本調用發生異常:(%1)%2
-
+
InvalidRetType: need
無效返回值:需要
diff --git a/src/class/pluginsystem.cpp b/src/class/pluginsystem.cpp
index f454d32..eb78444 100644
--- a/src/class/pluginsystem.cpp
+++ b/src/class/pluginsystem.cpp
@@ -42,24 +42,33 @@
#include
#include
+#include
+
PluginSystem::PluginSystem(QObject *parent) : QObject(parent) {
+ qRegisterMetaType("MetaCallInfo");
+
auto mobj = PluginSystem::metaObject();
auto total = mobj->methodCount();
for (int i = 0; i < total; ++i) {
auto m = mobj->method(i);
- if (m.methodType() == QMetaMethod::Method) {
- QByteArray msig = m.name();
- msig.append('(');
-
- QByteArrayList params;
- auto total = m.parameterCount();
- for (int i = 1; i < total; ++i) {
- auto mt = QMetaType(m.parameterType(i));
- params.append(mt.name());
+ // all public slots
+ if (m.methodType() == QMetaMethod::Slot &&
+ m.access() == QMetaMethod::Public) {
+ if (qstrcmp(m.tag(), "WING_API")) {
+ continue;
+ }
+
+ WingHex::FunctionSig msig;
+ msig.fnName = m.name();
+
+ auto total = m.parameterCount();
+ msig.types.reserve(total);
+
+ for (int i = 1; i < total; ++i) {
+ auto mt = m.parameterType(i);
+ msig.types.append(mt);
}
- msig.append(params.join(','));
- msig.append(')');
_plgFns.insert(msig, m);
}
}
@@ -80,7 +89,7 @@ void PluginSystem::finalizeCheckingEngine() { _engine->ShutDownAndRelease(); }
// =========================================================================
-void PluginSystem::toast(QObject *sender, const QPixmap &icon,
+void PluginSystem::toast(const QObject *sender, const QPixmap &icon,
const QString &message) {
Q_UNUSED(sender);
if (!checkThreadAff()) {
@@ -93,24 +102,24 @@ void PluginSystem::toast(QObject *sender, const QPixmap &icon,
Toast::toast(_win, icon, message);
}
-void PluginSystem::logTrace(QObject *sender, const QString &message) {
+void PluginSystem::logTrace(const QObject *sender, const QString &message) {
Logger::trace(packLogMessage(sender->metaObject()->className(), message));
}
-void PluginSystem::logDebug(QObject *sender, const QString &message) {
+void PluginSystem::logDebug(const QObject *sender, const QString &message) {
Logger::debug(packLogMessage(sender->metaObject()->className(), message));
}
-void PluginSystem::logInfo(QObject *sender, const QString &message) {
+void PluginSystem::logInfo(const QObject *sender, const QString &message) {
Logger::info(packLogMessage(sender->metaObject()->className(), message));
}
-void PluginSystem::logError(QObject *sender, const QString &message) {
+void PluginSystem::logError(const QObject *sender, const QString &message) {
Logger::critical(
packLogMessage(sender->metaObject()->className(), message));
}
-bool PluginSystem::raiseDockWidget(QObject *sender, QWidget *w) {
+bool PluginSystem::raiseDockWidget(const QObject *sender, QWidget *w) {
Q_UNUSED(sender);
if (!checkThreadAff()) {
return false;
@@ -122,7 +131,7 @@ bool PluginSystem::raiseDockWidget(QObject *sender, QWidget *w) {
return false;
}
-QDialog *PluginSystem::createDialog(QObject *sender, QWidget *content) {
+QDialog *PluginSystem::createDialog(const QObject *sender, QWidget *content) {
Q_UNUSED(sender);
if (!checkThreadAff()) {
return nullptr;
@@ -138,7 +147,7 @@ QDialog *PluginSystem::createDialog(QObject *sender, QWidget *content) {
}
}
-void PluginSystem::msgAboutQt(QObject *sender, QWidget *parent,
+void PluginSystem::msgAboutQt(const QObject *sender, QWidget *parent,
const QString &title) {
Q_UNUSED(sender);
if (checkThreadAff()) {
@@ -147,7 +156,7 @@ void PluginSystem::msgAboutQt(QObject *sender, QWidget *parent,
}
QMessageBox::StandardButton
-PluginSystem::msgInformation(QObject *sender, QWidget *parent,
+PluginSystem::msgInformation(const QObject *sender, QWidget *parent,
const QString &title, const QString &text,
QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton) {
@@ -160,7 +169,7 @@ PluginSystem::msgInformation(QObject *sender, QWidget *parent,
}
QMessageBox::StandardButton
-PluginSystem::msgQuestion(QObject *sender, QWidget *parent,
+PluginSystem::msgQuestion(const QObject *sender, QWidget *parent,
const QString &title, const QString &text,
QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton) {
@@ -173,8 +182,8 @@ PluginSystem::msgQuestion(QObject *sender, QWidget *parent,
}
QMessageBox::StandardButton
-PluginSystem::msgWarning(QObject *sender, QWidget *parent, const QString &title,
- const QString &text,
+PluginSystem::msgWarning(const QObject *sender, QWidget *parent,
+ const QString &title, const QString &text,
QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton) {
Q_UNUSED(sender);
@@ -186,7 +195,7 @@ PluginSystem::msgWarning(QObject *sender, QWidget *parent, const QString &title,
}
QMessageBox::StandardButton
-PluginSystem::msgCritical(QObject *sender, QWidget *parent,
+PluginSystem::msgCritical(const QObject *sender, QWidget *parent,
const QString &title, const QString &text,
QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton) {
@@ -198,7 +207,7 @@ PluginSystem::msgCritical(QObject *sender, QWidget *parent,
return QMessageBox::StandardButton::NoButton;
}
-void PluginSystem::msgAbout(QObject *sender, QWidget *parent,
+void PluginSystem::msgAbout(const QObject *sender, QWidget *parent,
const QString &title, const QString &text) {
Q_UNUSED(sender);
if (checkThreadAff()) {
@@ -207,9 +216,9 @@ void PluginSystem::msgAbout(QObject *sender, QWidget *parent,
}
QMessageBox::StandardButton
-PluginSystem::msgbox(QObject *sender, QWidget *parent, QMessageBox::Icon icon,
- const QString &title, const QString &text,
- QMessageBox::StandardButtons buttons,
+PluginSystem::msgbox(const QObject *sender, QWidget *parent,
+ QMessageBox::Icon icon, const QString &title,
+ const QString &text, QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton) {
Q_UNUSED(sender);
if (checkThreadAff()) {
@@ -219,7 +228,7 @@ PluginSystem::msgbox(QObject *sender, QWidget *parent, QMessageBox::Icon icon,
return QMessageBox::StandardButton::NoButton;
}
-QString PluginSystem::dlgGetText(QObject *sender, QWidget *parent,
+QString PluginSystem::dlgGetText(const QObject *sender, QWidget *parent,
const QString &title, const QString &label,
QLineEdit::EchoMode echo, const QString &text,
bool *ok,
@@ -233,7 +242,7 @@ QString PluginSystem::dlgGetText(QObject *sender, QWidget *parent,
}
QString
-PluginSystem::dlgGetMultiLineText(QObject *sender, QWidget *parent,
+PluginSystem::dlgGetMultiLineText(const QObject *sender, QWidget *parent,
const QString &title, const QString &label,
const QString &text, bool *ok,
Qt::InputMethodHints inputMethodHints) {
@@ -245,7 +254,7 @@ PluginSystem::dlgGetMultiLineText(QObject *sender, QWidget *parent,
return {};
}
-QString PluginSystem::dlgGetItem(QObject *sender, QWidget *parent,
+QString PluginSystem::dlgGetItem(const QObject *sender, QWidget *parent,
const QString &title, const QString &label,
const QStringList &items, int current,
bool editable, bool *ok,
@@ -258,7 +267,7 @@ QString PluginSystem::dlgGetItem(QObject *sender, QWidget *parent,
return {};
}
-int PluginSystem::dlgGetInt(QObject *sender, QWidget *parent,
+int PluginSystem::dlgGetInt(const QObject *sender, QWidget *parent,
const QString &title, const QString &label,
int value, int minValue, int maxValue, int step,
bool *ok) {
@@ -270,7 +279,7 @@ int PluginSystem::dlgGetInt(QObject *sender, QWidget *parent,
return 0;
}
-double PluginSystem::dlgGetDouble(QObject *sender, QWidget *parent,
+double PluginSystem::dlgGetDouble(const QObject *sender, QWidget *parent,
const QString &title, const QString &label,
double value, double minValue,
double maxValue, int decimals, bool *ok,
@@ -283,7 +292,8 @@ double PluginSystem::dlgGetDouble(QObject *sender, QWidget *parent,
return qQNaN();
}
-QString PluginSystem::dlgGetExistingDirectory(QObject *sender, QWidget *parent,
+QString PluginSystem::dlgGetExistingDirectory(const QObject *sender,
+ QWidget *parent,
const QString &caption,
const QString &dir,
QFileDialog::Options options) {
@@ -295,7 +305,7 @@ QString PluginSystem::dlgGetExistingDirectory(QObject *sender, QWidget *parent,
return {};
}
-QString PluginSystem::dlgGetOpenFileName(QObject *sender, QWidget *parent,
+QString PluginSystem::dlgGetOpenFileName(const QObject *sender, QWidget *parent,
const QString &caption,
const QString &dir,
const QString &filter,
@@ -311,12 +321,10 @@ QString PluginSystem::dlgGetOpenFileName(QObject *sender, QWidget *parent,
return {};
}
-QStringList PluginSystem::dlgGetOpenFileNames(QObject *sender, QWidget *parent,
- const QString &caption,
- const QString &dir,
- const QString &filter,
- QString *selectedFilter,
- QFileDialog::Options options) {
+QStringList PluginSystem::dlgGetOpenFileNames(
+ const QObject *sender, QWidget *parent, const QString &caption,
+ const QString &dir, const QString &filter, QString *selectedFilter,
+ QFileDialog::Options options) {
Q_UNUSED(sender);
if (checkThreadAff()) {
return WingFileDialog::getOpenFileNames(parent, caption, dir, filter,
@@ -325,7 +333,7 @@ QStringList PluginSystem::dlgGetOpenFileNames(QObject *sender, QWidget *parent,
return {};
}
-QString PluginSystem::dlgGetSaveFileName(QObject *sender, QWidget *parent,
+QString PluginSystem::dlgGetSaveFileName(const QObject *sender, QWidget *parent,
const QString &caption,
const QString &dir,
const QString &filter,
@@ -341,7 +349,7 @@ QString PluginSystem::dlgGetSaveFileName(QObject *sender, QWidget *parent,
return {};
}
-QColor PluginSystem::dlgGetColor(QObject *sender, const QString &caption,
+QColor PluginSystem::dlgGetColor(const QObject *sender, const QString &caption,
QWidget *parent) {
Q_UNUSED(sender);
if (checkThreadAff()) {
@@ -354,7 +362,8 @@ QColor PluginSystem::dlgGetColor(QObject *sender, const QString &caption,
return {};
}
-bool PluginSystem::existsServiceHost(QObject *sender, const QString &puid) {
+bool PluginSystem::existsServiceHost(const QObject *sender,
+ const QString &puid) {
Q_UNUSED(sender);
return std::find_if(_loadedplgs.begin(), _loadedplgs.end(),
[puid, this](IWingPlugin *plg) {
@@ -362,24 +371,13 @@ bool PluginSystem::existsServiceHost(QObject *sender, const QString &puid) {
}) != _loadedplgs.end();
}
-bool PluginSystem::invokeService(QObject *sender, const QString &puid,
- const char *method, Qt::ConnectionType type,
- QGenericReturnArgument ret,
- QGenericArgument val0, QGenericArgument val1,
- QGenericArgument val2, QGenericArgument val3,
- QGenericArgument val4) {
+bool PluginSystem::invokeServiceImpl(const QObject *sender, const QString &puid,
+ const MetaCallInfo &infos) {
auto p = checkPluginAndReport(sender, __func__);
- return invokeService(sender, getPUID(p), puid, method, type, ret, val0,
- val1, val2, val3, val4);
-}
+ if (p == nullptr) {
+ return false;
+ }
-bool PluginSystem::invokeService(QObject *sender, const QString &selfpuid,
- const QString &puid, const char *method,
- Qt::ConnectionType type,
- QGenericReturnArgument ret,
- QGenericArgument val0, QGenericArgument val1,
- QGenericArgument val2, QGenericArgument val3,
- QGenericArgument val4) {
auto r =
std::find_if(_loadedplgs.begin(), _loadedplgs.end(),
[=](IWingPlugin *plg) { return getPUID(plg) == puid; });
@@ -390,58 +388,45 @@ bool PluginSystem::invokeService(QObject *sender, const QString &selfpuid,
auto obj = *r;
auto meta = obj->metaObject();
- // filter the evil call and report to log
- QVarLengthArray sig;
- int len = qstrlen(method);
- if (len <= 0)
- return false;
- sig.append(method, len);
- sig.append('(');
+ Qt::ConnectionType c;
+ qsizetype paramCount;
+ const char *method;
+ const void *const *parameters;
+ const char *const *typeNames;
+ const QtPrivate::QMetaTypeInterface *const *metaTypes;
+ std::tie(method, c, paramCount, parameters, typeNames, metaTypes) = infos;
- auto sname = QMetaType::fromType().name();
+ QMetaMethod m;
+ // retrive method
+ auto len = meta->methodCount();
+ for (int i = 0; i < len; ++i) {
+ auto met = meta->method(i);
+ if (met.parameterCount() != paramCount) {
+ continue;
+ }
- const char *typeNames[] = {ret.name(), sname, val0.name(),
- val1.name(), val2.name(), val3.name(),
- val4.name()};
- size_t paramCount;
- constexpr auto maxParamCount = sizeof(typeNames) / sizeof(const char *);
- for (paramCount = 1; paramCount < maxParamCount; ++paramCount) {
- len = qstrlen(typeNames[paramCount]);
- if (len <= 0)
- break;
- sig.append(typeNames[paramCount], len);
- sig.append(',');
- }
- if (paramCount == 1)
- sig.append(')'); // no parameters
- else
- sig[sig.size() - 1] = ')';
- sig.append('\0');
-
- // checking
- auto midx = meta->indexOfMethod(sig.constData());
- if (midx < 0) {
- auto norm = QMetaObject::normalizedSignature(sig.constData());
- midx = meta->indexOfMethod(norm.constData());
- if (midx < 0) {
- return false;
+ if (met.name() == method) {
+ bool err = false;
+ for (int i = 1; i < paramCount; ++i) {
+ if (met.parameterType(i) != metaTypes[i]->typeId) {
+ err = true;
+ break;
+ }
+ }
+ if (err) {
+ continue;
+ }
+ m = met;
}
}
- auto m = meta->method(midx);
- auto mt = m.methodType();
- if (mt == QMetaMethod::Signal || mt == QMetaMethod::Constructor) {
- // report
- Logger::warning(packLogMessage(
- sender->metaObject()->className(),
- tr("[EvilCall]") + QString::fromLatin1(sig.data(), sig.length())));
+ if (!m.isValid()) {
return false;
}
- meta = sender->metaObject();
SenderInfo info;
info.plgcls = meta->className();
- info.puid = selfpuid;
+ info.puid = getPUID(p);
auto meta_name = "WING_META";
// property first
@@ -455,11 +440,42 @@ bool PluginSystem::invokeService(QObject *sender, const QString &selfpuid,
}
}
- return m.invoke(obj, type, ret, WINGAPI_ARG(info), val0, val1, val2, val3,
- val4);
+ // prepend the 'SenderInfo' parameter
+ // note: index 0 is return value, index 1 is the real first param
+ auto data = QtPrivate::Invoke::dataHelper(info);
+ auto tn = QtPrivate::Invoke::typenameHelper(info);
+ auto inf = QtPrivate::Invoke::metaTypeHelper(info);
+
+ auto nparamCount = paramCount + 1;
+ QVarLengthArray nparameters;
+ QVarLengthArray ntypeNames;
+ QVarLengthArray nmetaTypes;
+ nparameters.reserve(nparamCount);
+ ntypeNames.reserve(nparamCount);
+ nmetaTypes.reserve(nparamCount);
+
+ nparameters.append(parameters, 1);
+ nparameters.append(data);
+ nparameters.append(parameters + 1, paramCount);
+
+ ntypeNames.append(typeNames, 1);
+ ntypeNames.append(tn);
+ ntypeNames.append(typeNames + 1, paramCount);
+
+ nmetaTypes.append(metaTypes, 1);
+ nmetaTypes.append(inf);
+ nmetaTypes.append(metaTypes + 1, paramCount);
+
+ auto ret = QMetaMethodInvoker::invokeImpl(
+ m, obj, c, nparamCount, nparameters.data(), ntypeNames.data(),
+ nmetaTypes.data());
+
+ // errror report
+
+ return ret == QMetaMethodInvoker::InvokeFailReason::None;
}
-bool PluginSystem::isCurrentDocEditing(QObject *sender) {
+bool PluginSystem::isCurrentDocEditing(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -467,7 +483,7 @@ bool PluginSystem::isCurrentDocEditing(QObject *sender) {
return pluginCurrentEditor(plg);
}
-QString PluginSystem::currentDocFilename(QObject *sender) {
+QString PluginSystem::currentDocFilename(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return {};
@@ -479,7 +495,7 @@ QString PluginSystem::currentDocFilename(QObject *sender) {
return {};
}
-bool PluginSystem::isReadOnly(QObject *sender) {
+bool PluginSystem::isReadOnly(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -492,7 +508,7 @@ bool PluginSystem::isReadOnly(QObject *sender) {
return false;
}
-bool PluginSystem::isInsertionMode(QObject *sender) {
+bool PluginSystem::isInsertionMode(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -504,7 +520,7 @@ bool PluginSystem::isInsertionMode(QObject *sender) {
return true;
}
-bool PluginSystem::isKeepSize(QObject *sender) {
+bool PluginSystem::isKeepSize(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -516,7 +532,7 @@ bool PluginSystem::isKeepSize(QObject *sender) {
return false;
}
-bool PluginSystem::isLocked(QObject *sender) {
+bool PluginSystem::isLocked(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -528,7 +544,7 @@ bool PluginSystem::isLocked(QObject *sender) {
return false;
}
-qsizetype PluginSystem::documentLines(QObject *sender) {
+qsizetype PluginSystem::documentLines(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -540,7 +556,7 @@ qsizetype PluginSystem::documentLines(QObject *sender) {
return 0;
}
-qsizetype PluginSystem::documentBytes(QObject *sender) {
+qsizetype PluginSystem::documentBytes(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -552,7 +568,7 @@ qsizetype PluginSystem::documentBytes(QObject *sender) {
return 0;
}
-qsizetype PluginSystem::currentRow(QObject *sender) {
+qsizetype PluginSystem::currentRow(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -564,7 +580,7 @@ qsizetype PluginSystem::currentRow(QObject *sender) {
return 0;
}
-qsizetype PluginSystem::currentColumn(QObject *sender) {
+qsizetype PluginSystem::currentColumn(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -576,7 +592,7 @@ qsizetype PluginSystem::currentColumn(QObject *sender) {
return 0;
}
-qsizetype PluginSystem::currentOffset(QObject *sender) {
+qsizetype PluginSystem::currentOffset(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -588,7 +604,7 @@ qsizetype PluginSystem::currentOffset(QObject *sender) {
return 0;
}
-qsizetype PluginSystem::selectedLength(QObject *sender) {
+qsizetype PluginSystem::selectedLength(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -600,7 +616,7 @@ qsizetype PluginSystem::selectedLength(QObject *sender) {
return 0;
}
-QByteArray PluginSystem::selectedBytes(QObject *sender, qsizetype index) {
+QByteArray PluginSystem::selectedBytes(const QObject *sender, qsizetype index) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return {};
@@ -612,7 +628,7 @@ QByteArray PluginSystem::selectedBytes(QObject *sender, qsizetype index) {
return {};
}
-QByteArrayList PluginSystem::selectionBytes(QObject *sender) {
+QByteArrayList PluginSystem::selectionBytes(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return {};
@@ -624,8 +640,9 @@ QByteArrayList PluginSystem::selectionBytes(QObject *sender) {
return {};
}
-qsizetype PluginSystem::selectionLength(QObject *sender, qsizetype index) {
- auto plg = qobject_cast(sender);
+qsizetype PluginSystem::selectionLength(const QObject *sender,
+ qsizetype index) {
+ auto plg = qobject_cast(const_cast(sender));
auto e = pluginCurrentEditor(plg);
if (e) {
auto cursor = e->hexEditor()->cursor();
@@ -636,7 +653,7 @@ qsizetype PluginSystem::selectionLength(QObject *sender, qsizetype index) {
return 0;
}
-qsizetype PluginSystem::selectionCount(QObject *sender) {
+qsizetype PluginSystem::selectionCount(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -649,7 +666,7 @@ qsizetype PluginSystem::selectionCount(QObject *sender) {
return 0;
}
-bool PluginSystem::stringVisible(QObject *sender) {
+bool PluginSystem::stringVisible(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -661,7 +678,7 @@ bool PluginSystem::stringVisible(QObject *sender) {
return false;
}
-bool PluginSystem::addressVisible(QObject *sender) {
+bool PluginSystem::addressVisible(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -673,7 +690,7 @@ bool PluginSystem::addressVisible(QObject *sender) {
return false;
}
-bool PluginSystem::headerVisible(QObject *sender) {
+bool PluginSystem::headerVisible(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -685,7 +702,7 @@ bool PluginSystem::headerVisible(QObject *sender) {
return false;
}
-quintptr PluginSystem::addressBase(QObject *sender) {
+quintptr PluginSystem::addressBase(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -697,8 +714,8 @@ quintptr PluginSystem::addressBase(QObject *sender) {
return 0;
}
-bool PluginSystem::isModified(QObject *sender) {
- auto plg = qobject_cast(sender);
+bool PluginSystem::isModified(const QObject *sender) {
+ auto plg = qobject_cast(const_cast(sender));
auto e = pluginCurrentEditor(plg);
if (e) {
return !e->hexEditor()->isSaved();
@@ -706,7 +723,7 @@ bool PluginSystem::isModified(QObject *sender) {
return 0;
}
-qint8 PluginSystem::readInt8(QObject *sender, qsizetype offset) {
+qint8 PluginSystem::readInt8(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -714,7 +731,7 @@ qint8 PluginSystem::readInt8(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-qint16 PluginSystem::readInt16(QObject *sender, qsizetype offset) {
+qint16 PluginSystem::readInt16(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -722,7 +739,7 @@ qint16 PluginSystem::readInt16(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-qint32 PluginSystem::readInt32(QObject *sender, qsizetype offset) {
+qint32 PluginSystem::readInt32(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -730,7 +747,7 @@ qint32 PluginSystem::readInt32(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-qint64 PluginSystem::readInt64(QObject *sender, qsizetype offset) {
+qint64 PluginSystem::readInt64(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -738,7 +755,7 @@ qint64 PluginSystem::readInt64(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-quint8 PluginSystem::readUInt8(QObject *sender, qsizetype offset) {
+quint8 PluginSystem::readUInt8(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -746,7 +763,7 @@ quint8 PluginSystem::readUInt8(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-quint16 PluginSystem::readUInt16(QObject *sender, qsizetype offset) {
+quint16 PluginSystem::readUInt16(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -754,7 +771,7 @@ quint16 PluginSystem::readUInt16(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-quint32 PluginSystem::readUInt32(QObject *sender, qsizetype offset) {
+quint32 PluginSystem::readUInt32(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -762,7 +779,7 @@ quint32 PluginSystem::readUInt32(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-quint64 PluginSystem::readUInt64(QObject *sender, qsizetype offset) {
+quint64 PluginSystem::readUInt64(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return 0;
@@ -770,7 +787,7 @@ quint64 PluginSystem::readUInt64(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-float PluginSystem::readFloat(QObject *sender, qsizetype offset) {
+float PluginSystem::readFloat(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return qQNaN();
@@ -778,7 +795,7 @@ float PluginSystem::readFloat(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-double PluginSystem::readDouble(QObject *sender, qsizetype offset) {
+double PluginSystem::readDouble(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return qQNaN();
@@ -786,7 +803,7 @@ double PluginSystem::readDouble(QObject *sender, qsizetype offset) {
return readBasicTypeContent(plg, offset);
}
-QString PluginSystem::readString(QObject *sender, qsizetype offset,
+QString PluginSystem::readString(const QObject *sender, qsizetype offset,
const QString &encoding) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -811,7 +828,7 @@ QString PluginSystem::readString(QObject *sender, qsizetype offset,
return QString();
}
-QByteArray PluginSystem::readBytes(QObject *sender, qsizetype offset,
+QByteArray PluginSystem::readBytes(const QObject *sender, qsizetype offset,
qsizetype count) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -827,9 +844,9 @@ QByteArray PluginSystem::readBytes(QObject *sender, qsizetype offset,
return {};
}
-qsizetype PluginSystem::findNext(QObject *sender, qsizetype begin,
+qsizetype PluginSystem::findNext(const QObject *sender, qsizetype begin,
const QByteArray &ba) {
- auto plg = qobject_cast(sender);
+ auto plg = qobject_cast(const_cast(sender));
auto e = pluginCurrentEditor(plg);
if (e) {
return e->hexEditor()->document()->findNext(begin, ba);
@@ -837,7 +854,7 @@ qsizetype PluginSystem::findNext(QObject *sender, qsizetype begin,
return qsizetype(-1);
}
-qsizetype PluginSystem::findPrevious(QObject *sender, qsizetype begin,
+qsizetype PluginSystem::findPrevious(const QObject *sender, qsizetype begin,
const QByteArray &ba) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -850,7 +867,7 @@ qsizetype PluginSystem::findPrevious(QObject *sender, qsizetype begin,
return qsizetype(-1);
}
-QString PluginSystem::bookMarkComment(QObject *sender, qsizetype pos) {
+QString PluginSystem::bookMarkComment(const QObject *sender, qsizetype pos) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return {};
@@ -862,7 +879,7 @@ QString PluginSystem::bookMarkComment(QObject *sender, qsizetype pos) {
return {};
}
-bool PluginSystem::existBookMark(QObject *sender, qsizetype pos) {
+bool PluginSystem::existBookMark(const QObject *sender, qsizetype pos) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -874,7 +891,7 @@ bool PluginSystem::existBookMark(QObject *sender, qsizetype pos) {
return false;
}
-bool PluginSystem::switchDocument(QObject *sender, int handle) {
+bool PluginSystem::switchDocument(const QObject *sender, int handle) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -893,7 +910,7 @@ bool PluginSystem::switchDocument(QObject *sender, int handle) {
return true;
}
-bool PluginSystem::raiseDocument(QObject *sender, int handle) {
+bool PluginSystem::raiseDocument(const QObject *sender, int handle) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -918,7 +935,7 @@ bool PluginSystem::raiseDocument(QObject *sender, int handle) {
return false;
}
-bool PluginSystem::setLockedFile(QObject *sender, bool b) {
+bool PluginSystem::setLockedFile(const QObject *sender, bool b) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -933,7 +950,7 @@ bool PluginSystem::setLockedFile(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::setKeepSize(QObject *sender, bool b) {
+bool PluginSystem::setKeepSize(const QObject *sender, bool b) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -948,7 +965,7 @@ bool PluginSystem::setKeepSize(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::setStringVisible(QObject *sender, bool b) {
+bool PluginSystem::setStringVisible(const QObject *sender, bool b) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -964,7 +981,7 @@ bool PluginSystem::setStringVisible(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::setAddressVisible(QObject *sender, bool b) {
+bool PluginSystem::setAddressVisible(const QObject *sender, bool b) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -980,7 +997,7 @@ bool PluginSystem::setAddressVisible(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::setHeaderVisible(QObject *sender, bool b) {
+bool PluginSystem::setHeaderVisible(const QObject *sender, bool b) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -996,7 +1013,7 @@ bool PluginSystem::setHeaderVisible(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::setAddressBase(QObject *sender, quintptr base) {
+bool PluginSystem::setAddressBase(const QObject *sender, quintptr base) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1012,7 +1029,7 @@ bool PluginSystem::setAddressBase(QObject *sender, quintptr base) {
return false;
}
-bool PluginSystem::beginMarco(QObject *sender, const QString &txt) {
+bool PluginSystem::beginMarco(const QObject *sender, const QString &txt) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1029,7 +1046,7 @@ bool PluginSystem::beginMarco(QObject *sender, const QString &txt) {
return true;
}
-bool PluginSystem::endMarco(QObject *sender) {
+bool PluginSystem::endMarco(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1054,7 +1071,8 @@ bool PluginSystem::endMarco(QObject *sender) {
return false;
}
-bool PluginSystem::writeInt8(QObject *sender, qsizetype offset, qint8 value) {
+bool PluginSystem::writeInt8(const QObject *sender, qsizetype offset,
+ qint8 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1062,7 +1080,8 @@ bool PluginSystem::writeInt8(QObject *sender, qsizetype offset, qint8 value) {
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeInt16(QObject *sender, qsizetype offset, qint16 value) {
+bool PluginSystem::writeInt16(const QObject *sender, qsizetype offset,
+ qint16 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1070,7 +1089,8 @@ bool PluginSystem::writeInt16(QObject *sender, qsizetype offset, qint16 value) {
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeInt32(QObject *sender, qsizetype offset, qint32 value) {
+bool PluginSystem::writeInt32(const QObject *sender, qsizetype offset,
+ qint32 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1078,7 +1098,8 @@ bool PluginSystem::writeInt32(QObject *sender, qsizetype offset, qint32 value) {
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeInt64(QObject *sender, qsizetype offset, qint64 value) {
+bool PluginSystem::writeInt64(const QObject *sender, qsizetype offset,
+ qint64 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1086,7 +1107,8 @@ bool PluginSystem::writeInt64(QObject *sender, qsizetype offset, qint64 value) {
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeUInt8(QObject *sender, qsizetype offset, quint8 value) {
+bool PluginSystem::writeUInt8(const QObject *sender, qsizetype offset,
+ quint8 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1094,7 +1116,7 @@ bool PluginSystem::writeUInt8(QObject *sender, qsizetype offset, quint8 value) {
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeUInt16(QObject *sender, qsizetype offset,
+bool PluginSystem::writeUInt16(const QObject *sender, qsizetype offset,
quint16 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1103,7 +1125,7 @@ bool PluginSystem::writeUInt16(QObject *sender, qsizetype offset,
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeUInt32(QObject *sender, qsizetype offset,
+bool PluginSystem::writeUInt32(const QObject *sender, qsizetype offset,
quint32 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1112,7 +1134,7 @@ bool PluginSystem::writeUInt32(QObject *sender, qsizetype offset,
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeUInt64(QObject *sender, qsizetype offset,
+bool PluginSystem::writeUInt64(const QObject *sender, qsizetype offset,
quint64 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1121,7 +1143,8 @@ bool PluginSystem::writeUInt64(QObject *sender, qsizetype offset,
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeFloat(QObject *sender, qsizetype offset, float value) {
+bool PluginSystem::writeFloat(const QObject *sender, qsizetype offset,
+ float value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1129,7 +1152,7 @@ bool PluginSystem::writeFloat(QObject *sender, qsizetype offset, float value) {
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeDouble(QObject *sender, qsizetype offset,
+bool PluginSystem::writeDouble(const QObject *sender, qsizetype offset,
double value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1138,7 +1161,7 @@ bool PluginSystem::writeDouble(QObject *sender, qsizetype offset,
return writeBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::writeString(QObject *sender, qsizetype offset,
+bool PluginSystem::writeString(const QObject *sender, qsizetype offset,
const QString &value, const QString &encoding) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1162,7 +1185,7 @@ bool PluginSystem::writeString(QObject *sender, qsizetype offset,
return false;
}
-bool PluginSystem::writeBytes(QObject *sender, qsizetype offset,
+bool PluginSystem::writeBytes(const QObject *sender, qsizetype offset,
const QByteArray &data) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1184,7 +1207,8 @@ bool PluginSystem::writeBytes(QObject *sender, qsizetype offset,
return false;
}
-bool PluginSystem::insertInt8(QObject *sender, qsizetype offset, qint8 value) {
+bool PluginSystem::insertInt8(const QObject *sender, qsizetype offset,
+ qint8 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1192,7 +1216,7 @@ bool PluginSystem::insertInt8(QObject *sender, qsizetype offset, qint8 value) {
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertInt16(QObject *sender, qsizetype offset,
+bool PluginSystem::insertInt16(const QObject *sender, qsizetype offset,
qint16 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1201,7 +1225,7 @@ bool PluginSystem::insertInt16(QObject *sender, qsizetype offset,
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertInt32(QObject *sender, qsizetype offset,
+bool PluginSystem::insertInt32(const QObject *sender, qsizetype offset,
qint32 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1210,7 +1234,7 @@ bool PluginSystem::insertInt32(QObject *sender, qsizetype offset,
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertInt64(QObject *sender, qsizetype offset,
+bool PluginSystem::insertInt64(const QObject *sender, qsizetype offset,
qint64 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1219,7 +1243,7 @@ bool PluginSystem::insertInt64(QObject *sender, qsizetype offset,
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertUInt8(QObject *sender, qsizetype offset,
+bool PluginSystem::insertUInt8(const QObject *sender, qsizetype offset,
quint8 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1228,7 +1252,7 @@ bool PluginSystem::insertUInt8(QObject *sender, qsizetype offset,
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertUInt16(QObject *sender, qsizetype offset,
+bool PluginSystem::insertUInt16(const QObject *sender, qsizetype offset,
quint16 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1237,7 +1261,7 @@ bool PluginSystem::insertUInt16(QObject *sender, qsizetype offset,
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertUInt32(QObject *sender, qsizetype offset,
+bool PluginSystem::insertUInt32(const QObject *sender, qsizetype offset,
quint32 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1246,7 +1270,7 @@ bool PluginSystem::insertUInt32(QObject *sender, qsizetype offset,
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertUInt64(QObject *sender, qsizetype offset,
+bool PluginSystem::insertUInt64(const QObject *sender, qsizetype offset,
quint64 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1255,7 +1279,8 @@ bool PluginSystem::insertUInt64(QObject *sender, qsizetype offset,
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertFloat(QObject *sender, qsizetype offset, float value) {
+bool PluginSystem::insertFloat(const QObject *sender, qsizetype offset,
+ float value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1263,7 +1288,7 @@ bool PluginSystem::insertFloat(QObject *sender, qsizetype offset, float value) {
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertDouble(QObject *sender, qsizetype offset,
+bool PluginSystem::insertDouble(const QObject *sender, qsizetype offset,
double value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1272,7 +1297,7 @@ bool PluginSystem::insertDouble(QObject *sender, qsizetype offset,
return insertBasicTypeContent(plg, offset, value);
}
-bool PluginSystem::insertString(QObject *sender, qsizetype offset,
+bool PluginSystem::insertString(const QObject *sender, qsizetype offset,
const QString &value, const QString &encoding) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1296,7 +1321,7 @@ bool PluginSystem::insertString(QObject *sender, qsizetype offset,
return false;
}
-bool PluginSystem::insertBytes(QObject *sender, qsizetype offset,
+bool PluginSystem::insertBytes(const QObject *sender, qsizetype offset,
const QByteArray &data) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1318,7 +1343,7 @@ bool PluginSystem::insertBytes(QObject *sender, qsizetype offset,
return false;
}
-bool PluginSystem::appendInt8(QObject *sender, qint8 value) {
+bool PluginSystem::appendInt8(const QObject *sender, qint8 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1326,7 +1351,7 @@ bool PluginSystem::appendInt8(QObject *sender, qint8 value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendInt16(QObject *sender, qint16 value) {
+bool PluginSystem::appendInt16(const QObject *sender, qint16 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1334,7 +1359,7 @@ bool PluginSystem::appendInt16(QObject *sender, qint16 value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendInt32(QObject *sender, qint32 value) {
+bool PluginSystem::appendInt32(const QObject *sender, qint32 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1342,7 +1367,7 @@ bool PluginSystem::appendInt32(QObject *sender, qint32 value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendInt64(QObject *sender, qint64 value) {
+bool PluginSystem::appendInt64(const QObject *sender, qint64 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1350,7 +1375,7 @@ bool PluginSystem::appendInt64(QObject *sender, qint64 value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendUInt8(QObject *sender, quint8 value) {
+bool PluginSystem::appendUInt8(const QObject *sender, quint8 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1358,7 +1383,7 @@ bool PluginSystem::appendUInt8(QObject *sender, quint8 value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendUInt16(QObject *sender, quint16 value) {
+bool PluginSystem::appendUInt16(const QObject *sender, quint16 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1366,7 +1391,7 @@ bool PluginSystem::appendUInt16(QObject *sender, quint16 value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendUInt32(QObject *sender, quint32 value) {
+bool PluginSystem::appendUInt32(const QObject *sender, quint32 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1374,7 +1399,7 @@ bool PluginSystem::appendUInt32(QObject *sender, quint32 value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendUInt64(QObject *sender, quint64 value) {
+bool PluginSystem::appendUInt64(const QObject *sender, quint64 value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1382,7 +1407,7 @@ bool PluginSystem::appendUInt64(QObject *sender, quint64 value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendFloat(QObject *sender, float value) {
+bool PluginSystem::appendFloat(const QObject *sender, float value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1390,7 +1415,7 @@ bool PluginSystem::appendFloat(QObject *sender, float value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendDouble(QObject *sender, double value) {
+bool PluginSystem::appendDouble(const QObject *sender, double value) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1398,7 +1423,7 @@ bool PluginSystem::appendDouble(QObject *sender, double value) {
return appendBasicTypeContent(plg, value);
}
-bool PluginSystem::appendString(QObject *sender, const QString &value,
+bool PluginSystem::appendString(const QObject *sender, const QString &value,
const QString &encoding) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1423,7 +1448,7 @@ bool PluginSystem::appendString(QObject *sender, const QString &value,
return false;
}
-bool PluginSystem::appendBytes(QObject *sender, const QByteArray &data) {
+bool PluginSystem::appendBytes(const QObject *sender, const QByteArray &data) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1444,7 +1469,7 @@ bool PluginSystem::appendBytes(QObject *sender, const QByteArray &data) {
return false;
}
-bool PluginSystem::removeBytes(QObject *sender, qsizetype offset,
+bool PluginSystem::removeBytes(const QObject *sender, qsizetype offset,
qsizetype len) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1467,8 +1492,9 @@ bool PluginSystem::removeBytes(QObject *sender, qsizetype offset,
return false;
}
-bool PluginSystem::moveTo(QObject *sender, qsizetype line, qsizetype column,
- int nibbleindex, bool clearSelection) {
+bool PluginSystem::moveTo(const QObject *sender, qsizetype line,
+ qsizetype column, int nibbleindex,
+ bool clearSelection) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1485,7 +1511,7 @@ bool PluginSystem::moveTo(QObject *sender, qsizetype line, qsizetype column,
return false;
}
-bool PluginSystem::moveTo(QObject *sender, qsizetype offset,
+bool PluginSystem::moveTo(const QObject *sender, qsizetype offset,
bool clearSelection) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1502,8 +1528,8 @@ bool PluginSystem::moveTo(QObject *sender, qsizetype offset,
return false;
}
-bool PluginSystem::select(QObject *sender, qsizetype offset, qsizetype length,
- SelectionMode mode) {
+bool PluginSystem::select(const QObject *sender, qsizetype offset,
+ qsizetype length, SelectionMode mode) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1533,7 +1559,7 @@ bool PluginSystem::select(QObject *sender, qsizetype offset, qsizetype length,
return false;
}
-bool PluginSystem::setInsertionMode(QObject *sender, bool isinsert) {
+bool PluginSystem::setInsertionMode(const QObject *sender, bool isinsert) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1550,9 +1576,9 @@ bool PluginSystem::setInsertionMode(QObject *sender, bool isinsert) {
return false;
}
-bool PluginSystem::metadata(QObject *sender, qsizetype begin, qsizetype length,
- const QColor &fgcolor, const QColor &bgcolor,
- const QString &comment) {
+bool PluginSystem::metadata(const QObject *sender, qsizetype begin,
+ qsizetype length, const QColor &fgcolor,
+ const QColor &bgcolor, const QString &comment) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1575,7 +1601,7 @@ bool PluginSystem::metadata(QObject *sender, qsizetype begin, qsizetype length,
return false;
}
-bool PluginSystem::removeMetadata(QObject *sender, qsizetype offset) {
+bool PluginSystem::removeMetadata(const QObject *sender, qsizetype offset) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1596,7 +1622,7 @@ bool PluginSystem::removeMetadata(QObject *sender, qsizetype offset) {
return false;
}
-bool PluginSystem::clearMetadata(QObject *sender) {
+bool PluginSystem::clearMetadata(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1617,7 +1643,7 @@ bool PluginSystem::clearMetadata(QObject *sender) {
return false;
}
-bool PluginSystem::setMetaVisible(QObject *sender, bool b) {
+bool PluginSystem::setMetaVisible(const QObject *sender, bool b) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1636,7 +1662,7 @@ bool PluginSystem::setMetaVisible(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::setMetafgVisible(QObject *sender, bool b) {
+bool PluginSystem::setMetafgVisible(const QObject *sender, bool b) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1653,7 +1679,7 @@ bool PluginSystem::setMetafgVisible(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::setMetabgVisible(QObject *sender, bool b) {
+bool PluginSystem::setMetabgVisible(const QObject *sender, bool b) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1670,8 +1696,8 @@ bool PluginSystem::setMetabgVisible(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::setMetaCommentVisible(QObject *sender, bool b) {
- auto plg = qobject_cast(sender);
+bool PluginSystem::setMetaCommentVisible(const QObject *sender, bool b) {
+ auto plg = qobject_cast(const_cast(sender));
if (!checkThreadAff()) {
return false;
}
@@ -1684,7 +1710,7 @@ bool PluginSystem::setMetaCommentVisible(QObject *sender, bool b) {
return false;
}
-bool PluginSystem::addBookMark(QObject *sender, qsizetype pos,
+bool PluginSystem::addBookMark(const QObject *sender, qsizetype pos,
const QString &comment) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1706,7 +1732,7 @@ bool PluginSystem::addBookMark(QObject *sender, qsizetype pos,
return false;
}
-bool PluginSystem::modBookMark(QObject *sender, qsizetype pos,
+bool PluginSystem::modBookMark(const QObject *sender, qsizetype pos,
const QString &comment) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1728,7 +1754,7 @@ bool PluginSystem::modBookMark(QObject *sender, qsizetype pos,
return false;
}
-bool PluginSystem::removeBookMark(QObject *sender, qsizetype pos) {
+bool PluginSystem::removeBookMark(const QObject *sender, qsizetype pos) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1749,7 +1775,7 @@ bool PluginSystem::removeBookMark(QObject *sender, qsizetype pos) {
return false;
}
-bool PluginSystem::clearBookMark(QObject *sender) {
+bool PluginSystem::clearBookMark(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1770,7 +1796,7 @@ bool PluginSystem::clearBookMark(QObject *sender) {
return false;
}
-bool PluginSystem::closeAllFiles(QObject *sender) {
+bool PluginSystem::closeAllFiles(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return false;
@@ -1787,11 +1813,12 @@ bool PluginSystem::closeAllFiles(QObject *sender) {
return true;
}
-bool PluginSystem::checkErrAllAllowAndReport(QObject *sender,
+bool PluginSystem::checkErrAllAllowAndReport(const QObject *sender,
const char *func) {
- auto p = qobject_cast(sender);
+ QObject *s = const_cast(sender);
+ auto p = qobject_cast(s);
if (p == nullptr) {
- auto p = qobject_cast(sender);
+ auto p = qobject_cast(s);
if (p == nullptr) {
qCritical("[EvilCall] Invalid sender called '%s'", func);
return true;
@@ -1800,10 +1827,11 @@ bool PluginSystem::checkErrAllAllowAndReport(QObject *sender,
return false;
}
-IWingPlugin *PluginSystem::checkPluginAndReport(QObject *sender,
+IWingPlugin *PluginSystem::checkPluginAndReport(const QObject *sender,
const char *func) {
Q_ASSERT(func);
- auto p = qobject_cast(sender);
+ auto p =
+ qobject_cast(const_cast(sender));
if (p == nullptr) {
qCritical("[EvilCall] Invalid sender called '%s'", func);
return nullptr;
@@ -1811,7 +1839,8 @@ IWingPlugin *PluginSystem::checkPluginAndReport(QObject *sender,
return p;
}
-ErrFile PluginSystem::saveAsCurrent(QObject *sender, const QString &savename) {
+ErrFile PluginSystem::saveAsCurrent(const QObject *sender,
+ const QString &savename) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -1831,7 +1860,8 @@ ErrFile PluginSystem::saveAsCurrent(QObject *sender, const QString &savename) {
return ErrFile::Error;
}
-ErrFile PluginSystem::exportCurrent(QObject *sender, const QString &savename) {
+ErrFile PluginSystem::exportCurrent(const QObject *sender,
+ const QString &savename) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -1852,7 +1882,7 @@ ErrFile PluginSystem::exportCurrent(QObject *sender, const QString &savename) {
return ErrFile::Error;
}
-ErrFile PluginSystem::saveCurrent(QObject *sender) {
+ErrFile PluginSystem::saveCurrent(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -1873,7 +1903,7 @@ ErrFile PluginSystem::saveCurrent(QObject *sender) {
return ErrFile::Error;
}
-ErrFile PluginSystem::closeCurrent(QObject *sender, bool force) {
+ErrFile PluginSystem::closeCurrent(const QObject *sender, bool force) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -1897,7 +1927,7 @@ ErrFile PluginSystem::closeCurrent(QObject *sender, bool force) {
return _win->closeEditor(view, force);
}
-ErrFile PluginSystem::openCurrent(QObject *sender) {
+ErrFile PluginSystem::openCurrent(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -1926,7 +1956,7 @@ ErrFile PluginSystem::openCurrent(QObject *sender) {
return ErrFile::Error;
}
-ErrFile PluginSystem::saveAsFile(QObject *sender, int handle,
+ErrFile PluginSystem::saveAsFile(const QObject *sender, int handle,
const QString &savename) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1947,7 +1977,7 @@ ErrFile PluginSystem::saveAsFile(QObject *sender, int handle,
return ErrFile::NotExist;
}
-ErrFile PluginSystem::exportFile(QObject *sender, int handle,
+ErrFile PluginSystem::exportFile(const QObject *sender, int handle,
const QString &savename) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -1969,7 +1999,8 @@ ErrFile PluginSystem::exportFile(QObject *sender, int handle,
return ErrFile::NotExist;
}
-ErrFile PluginSystem::openWorkSpace(QObject *sender, const QString &filename) {
+ErrFile PluginSystem::openWorkSpace(const QObject *sender,
+ const QString &filename) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -2002,7 +2033,7 @@ ErrFile PluginSystem::openWorkSpace(QObject *sender, const QString &filename) {
}
}
-ErrFile PluginSystem::saveFile(QObject *sender, int handle) {
+ErrFile PluginSystem::saveFile(const QObject *sender, int handle) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -2022,7 +2053,7 @@ ErrFile PluginSystem::saveFile(QObject *sender, int handle) {
return ErrFile::NotExist;
}
-ErrFile PluginSystem::closeFile(QObject *sender, int handle, bool force) {
+ErrFile PluginSystem::closeFile(const QObject *sender, int handle, bool force) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -2036,7 +2067,7 @@ ErrFile PluginSystem::closeFile(QObject *sender, int handle, bool force) {
return ErrFile::NotExist;
}
-ErrFile PluginSystem::closeHandle(QObject *sender, int handle) {
+ErrFile PluginSystem::closeHandle(const QObject *sender, int handle) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -2047,7 +2078,7 @@ ErrFile PluginSystem::closeHandle(QObject *sender, int handle) {
return WingHex::ErrFile::NotExist;
}
-ErrFile PluginSystem::openExtFile(QObject *sender, const QString &ext,
+ErrFile PluginSystem::openExtFile(const QObject *sender, const QString &ext,
const QString &file) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
@@ -2081,7 +2112,7 @@ ErrFile PluginSystem::openExtFile(QObject *sender, const QString &ext,
}
}
-ErrFile PluginSystem::openFile(QObject *sender, const QString &filename) {
+ErrFile PluginSystem::openFile(const QObject *sender, const QString &filename) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -2113,7 +2144,7 @@ ErrFile PluginSystem::openFile(QObject *sender, const QString &filename) {
}
}
-ErrFile PluginSystem::newFile(QObject *sender) {
+ErrFile PluginSystem::newFile(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return ErrFile::Error;
@@ -2143,7 +2174,7 @@ ErrFile PluginSystem::newFile(QObject *sender) {
}
}
-HexPosition PluginSystem::selectionEnd(QObject *sender, qsizetype index) {
+HexPosition PluginSystem::selectionEnd(const QObject *sender, qsizetype index) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return {};
@@ -2164,7 +2195,8 @@ HexPosition PluginSystem::selectionEnd(QObject *sender, qsizetype index) {
return pos;
}
-HexPosition PluginSystem::selectionStart(QObject *sender, qsizetype index) {
+HexPosition PluginSystem::selectionStart(const QObject *sender,
+ qsizetype index) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return {};
@@ -2185,7 +2217,7 @@ HexPosition PluginSystem::selectionStart(QObject *sender, qsizetype index) {
return pos;
}
-HexPosition PluginSystem::currentPos(QObject *sender) {
+HexPosition PluginSystem::currentPos(const QObject *sender) {
auto plg = checkPluginAndReport(sender, __func__);
if (plg == nullptr) {
return {};
@@ -2203,7 +2235,7 @@ HexPosition PluginSystem::currentPos(QObject *sender) {
return pos;
}
-AppTheme PluginSystem::currentAppTheme(QObject *sender) {
+AppTheme PluginSystem::currentAppTheme(const QObject *sender) {
Q_UNUSED(sender);
auto theme = SkinManager::instance().currentTheme();
switch (theme) {
@@ -2215,7 +2247,7 @@ AppTheme PluginSystem::currentAppTheme(QObject *sender) {
return WingHex::AppTheme::Dark; // fallback to default theme
}
-void PluginSystem::logWarn(QObject *sender, const QString &message) {
+void PluginSystem::logWarn(const QObject *sender, const QString &message) {
Logger::warning(packLogMessage(sender->metaObject()->className(), message));
}
@@ -3787,11 +3819,12 @@ QUndoCommand *PluginSystem::pluginCurrentUndoCmd(IWingPlugin *plg) const {
return nullptr;
}
-IWingDevice *PluginSystem::checkBaseAndReport(QObject *sender,
+IWingDevice *PluginSystem::checkBaseAndReport(const QObject *sender,
const char *func) {
Q_ASSERT(func);
// I don't trust it, try to convert again
- auto p = qobject_cast(sender);
+ auto p =
+ qobject_cast(const_cast(sender));
if (p) {
qCritical("[EvilCall] Invalid sender called '%s'", func);
return nullptr;
diff --git a/src/class/pluginsystem.h b/src/class/pluginsystem.h
index 8fd85be..c4395c5 100644
--- a/src/class/pluginsystem.h
+++ b/src/class/pluginsystem.h
@@ -324,411 +324,402 @@ private:
void finalizeCheckingEngine();
// IWingPluginBase API
-public:
- WING_SERVICE void toast(QObject *sender, const QPixmap &icon,
- const QString &message);
+public slots:
+ WING_API void toast(const QObject *sender, const QPixmap &icon,
+ const QString &message);
// logging
- WING_SERVICE void logTrace(QObject *sender, const QString &message);
- WING_SERVICE void logDebug(QObject *sender, const QString &message);
- WING_SERVICE void logInfo(QObject *sender, const QString &message);
- WING_SERVICE void logWarn(QObject *sender, const QString &message);
- WING_SERVICE void logError(QObject *sender, const QString &message);
- WING_SERVICE bool raiseDockWidget(QObject *sender, QWidget *w);
+ WING_API void logTrace(const QObject *sender, const QString &message);
+ WING_API void logDebug(const QObject *sender, const QString &message);
+ WING_API void logInfo(const QObject *sender, const QString &message);
+ WING_API void logWarn(const QObject *sender, const QString &message);
+ WING_API void logError(const QObject *sender, const QString &message);
+ WING_API bool raiseDockWidget(const QObject *sender, QWidget *w);
- WING_SERVICE WingHex::AppTheme currentAppTheme(QObject *sender);
- WING_SERVICE QDialog *createDialog(QObject *sender, QWidget *content);
+ WING_API WingHex::AppTheme currentAppTheme(const QObject *sender);
+ WING_API QDialog *createDialog(const QObject *sender, QWidget *content);
-public:
- WING_SERVICE void msgAboutQt(QObject *sender, QWidget *parent,
- const QString &title);
- WING_SERVICE QMessageBox::StandardButton
- msgInformation(QObject *sender, QWidget *parent, const QString &title,
+public slots:
+ WING_API void msgAboutQt(const QObject *sender, QWidget *parent,
+ const QString &title);
+ WING_API QMessageBox::StandardButton
+ msgInformation(const QObject *sender, QWidget *parent, const QString &title,
const QString &text, QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton);
- WING_SERVICE QMessageBox::StandardButton
- msgQuestion(QObject *sender, QWidget *parent, const QString &title,
+ WING_API QMessageBox::StandardButton
+ msgQuestion(const QObject *sender, QWidget *parent, const QString &title,
const QString &text, QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton);
- WING_SERVICE QMessageBox::StandardButton
- msgWarning(QObject *sender, QWidget *parent, const QString &title,
+ WING_API QMessageBox::StandardButton
+ msgWarning(const QObject *sender, QWidget *parent, const QString &title,
const QString &text, QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton);
- WING_SERVICE QMessageBox::StandardButton
- msgCritical(QObject *sender, QWidget *parent, const QString &title,
+ WING_API QMessageBox::StandardButton
+ msgCritical(const QObject *sender, QWidget *parent, const QString &title,
const QString &text, QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton);
- WING_SERVICE void msgAbout(QObject *sender, QWidget *parent,
- const QString &title, const QString &text);
- WING_SERVICE QMessageBox::StandardButton
- msgbox(QObject *sender, QWidget *parent, QMessageBox::Icon icon,
+ WING_API void msgAbout(const QObject *sender, QWidget *parent,
+ const QString &title, const QString &text);
+ WING_API QMessageBox::StandardButton
+ msgbox(const QObject *sender, QWidget *parent, QMessageBox::Icon icon,
const QString &title, const QString &text,
QMessageBox::StandardButtons buttons,
QMessageBox::StandardButton defaultButton);
-public:
- WING_SERVICE QString dlgGetText(QObject *sender, QWidget *parent,
- const QString &title, const QString &label,
- QLineEdit::EchoMode echo,
- const QString &text, bool *ok,
- Qt::InputMethodHints inputMethodHints);
- WING_SERVICE QString
- dlgGetMultiLineText(QObject *sender, QWidget *parent, const QString &title,
- const QString &label, const QString &text, bool *ok,
- Qt::InputMethodHints inputMethodHints);
- WING_SERVICE QString dlgGetItem(QObject *sender, QWidget *parent,
- const QString &title, const QString &label,
- const QStringList &items, int current,
- bool editable, bool *ok,
- Qt::InputMethodHints inputMethodHints);
- WING_SERVICE int dlgGetInt(QObject *sender, QWidget *parent,
- const QString &title, const QString &label,
- int value, int minValue, int maxValue, int step,
- bool *ok);
- WING_SERVICE double dlgGetDouble(QObject *sender, QWidget *parent,
- const QString &title, const QString &label,
- double value, double minValue,
- double maxValue, int decimals, bool *ok,
- double step);
+public slots:
+ WING_API QString dlgGetText(const QObject *sender, QWidget *parent,
+ const QString &title, const QString &label,
+ QLineEdit::EchoMode echo, const QString &text,
+ bool *ok,
+ Qt::InputMethodHints inputMethodHints);
+ WING_API QString dlgGetMultiLineText(const QObject *sender, QWidget *parent,
+ const QString &title,
+ const QString &label,
+ const QString &text, bool *ok,
+ Qt::InputMethodHints inputMethodHints);
+ WING_API QString dlgGetItem(const QObject *sender, QWidget *parent,
+ const QString &title, const QString &label,
+ const QStringList &items, int current,
+ bool editable, bool *ok,
+ Qt::InputMethodHints inputMethodHints);
+ WING_API int dlgGetInt(const QObject *sender, QWidget *parent,
+ const QString &title, const QString &label,
+ int value, int minValue, int maxValue, int step,
+ bool *ok);
+ WING_API double dlgGetDouble(const QObject *sender, QWidget *parent,
+ const QString &title, const QString &label,
+ double value, double minValue, double maxValue,
+ int decimals, bool *ok, double step);
-public:
- WING_SERVICE QString dlgGetExistingDirectory(QObject *sender,
- QWidget *parent,
- const QString &caption,
- const QString &dir,
- QFileDialog::Options options);
- WING_SERVICE QString dlgGetOpenFileName(QObject *sender, QWidget *parent,
- const QString &caption,
- const QString &dir,
- const QString &filter,
- QString *selectedFilter,
- QFileDialog::Options options);
- WING_SERVICE QStringList dlgGetOpenFileNames(
- QObject *sender, QWidget *parent, const QString &caption,
+public slots:
+ WING_API QString dlgGetExistingDirectory(const QObject *sender,
+ QWidget *parent,
+ const QString &caption,
+ const QString &dir,
+ QFileDialog::Options options);
+ WING_API QString dlgGetOpenFileName(const QObject *sender, QWidget *parent,
+ const QString &caption,
+ const QString &dir,
+ const QString &filter,
+ QString *selectedFilter,
+ QFileDialog::Options options);
+ WING_API QStringList dlgGetOpenFileNames(
+ const QObject *sender, QWidget *parent, const QString &caption,
const QString &dir, const QString &filter, QString *selectedFilter,
QFileDialog::Options options);
- WING_SERVICE QString dlgGetSaveFileName(QObject *sender, QWidget *parent,
- const QString &caption,
- const QString &dir,
- const QString &filter,
- QString *selectedFilter,
- QFileDialog::Options options);
+ WING_API QString dlgGetSaveFileName(const QObject *sender, QWidget *parent,
+ const QString &caption,
+ const QString &dir,
+ const QString &filter,
+ QString *selectedFilter,
+ QFileDialog::Options options);
- WING_SERVICE QColor dlgGetColor(QObject *sender, const QString &caption,
- QWidget *parent);
+ WING_API QColor dlgGetColor(const QObject *sender, const QString &caption,
+ QWidget *parent);
// IWingPlugin API
-public:
- WING_SERVICE bool existsServiceHost(QObject *sender, const QString &puid);
+public slots:
+ WING_API bool existsServiceHost(const QObject *sender, const QString &puid);
- WING_SERVICE bool
- invokeService(QObject *sender, const QString &puid, const char *method,
- Qt::ConnectionType type, QGenericReturnArgument ret,
- QGenericArgument val0, QGenericArgument val1,
- QGenericArgument val2, QGenericArgument val3,
- QGenericArgument val4);
- bool invokeService(QObject *sender, const QString &selfpuid,
- const QString &puid, const char *method,
- Qt::ConnectionType type, QGenericReturnArgument ret,
- QGenericArgument val0, QGenericArgument val1,
- QGenericArgument val2, QGenericArgument val3,
- QGenericArgument val4);
+ WING_API bool invokeServiceImpl(const QObject *sender, const QString &puid,
+ const MetaCallInfo &infos);
- WING_SERVICE bool isCurrentDocEditing(QObject *sender);
+ WING_API bool isCurrentDocEditing(const QObject *sender);
- WING_SERVICE QString currentDocFilename(QObject *sender);
+ WING_API QString currentDocFilename(const QObject *sender);
// document
- WING_SERVICE bool isReadOnly(QObject *sender);
+ WING_API bool isReadOnly(const QObject *sender);
- WING_SERVICE bool isInsertionMode(QObject *sender);
+ WING_API bool isInsertionMode(const QObject *sender);
- WING_SERVICE bool isKeepSize(QObject *sender);
+ WING_API bool isKeepSize(const QObject *sender);
- WING_SERVICE bool isLocked(QObject *sender);
+ WING_API bool isLocked(const QObject *sender);
- WING_SERVICE qsizetype documentLines(QObject *sender);
+ WING_API qsizetype documentLines(const QObject *sender);
- WING_SERVICE qsizetype documentBytes(QObject *sender);
+ WING_API qsizetype documentBytes(const QObject *sender);
- WING_SERVICE WingHex::HexPosition currentPos(QObject *sender);
+ WING_API WingHex::HexPosition currentPos(const QObject *sender);
- WING_SERVICE qsizetype currentRow(QObject *sender);
+ WING_API qsizetype currentRow(const QObject *sender);
- WING_SERVICE qsizetype currentColumn(QObject *sender);
+ WING_API qsizetype currentColumn(const QObject *sender);
- WING_SERVICE qsizetype currentOffset(QObject *sender);
+ WING_API qsizetype currentOffset(const QObject *sender);
- WING_SERVICE qsizetype selectedLength(QObject *sender);
+ WING_API qsizetype selectedLength(const QObject *sender);
- WING_SERVICE QByteArray selectedBytes(QObject *sender, qsizetype index);
+ WING_API QByteArray selectedBytes(const QObject *sender, qsizetype index);
- WING_SERVICE QByteArrayList selectionBytes(QObject *sender);
+ WING_API QByteArrayList selectionBytes(const QObject *sender);
- WING_SERVICE WingHex::HexPosition selectionStart(QObject *sender,
- qsizetype index);
+ WING_API WingHex::HexPosition selectionStart(const QObject *sender,
+ qsizetype index);
- WING_SERVICE WingHex::HexPosition selectionEnd(QObject *sender,
- qsizetype index);
+ WING_API WingHex::HexPosition selectionEnd(const QObject *sender,
+ qsizetype index);
- WING_SERVICE qsizetype selectionLength(QObject *sender, qsizetype index);
+ WING_API qsizetype selectionLength(const QObject *sender, qsizetype index);
- WING_SERVICE qsizetype selectionCount(QObject *sender);
+ WING_API qsizetype selectionCount(const QObject *sender);
- WING_SERVICE bool stringVisible(QObject *sender);
+ WING_API bool stringVisible(const QObject *sender);
- WING_SERVICE bool addressVisible(QObject *sender);
+ WING_API bool addressVisible(const QObject *sender);
- WING_SERVICE bool headerVisible(QObject *sender);
+ WING_API bool headerVisible(const QObject *sender);
- WING_SERVICE quintptr addressBase(QObject *sender);
+ WING_API quintptr addressBase(const QObject *sender);
- WING_SERVICE bool isModified(QObject *sender);
+ WING_API bool isModified(const QObject *sender);
- WING_SERVICE qint8 readInt8(QObject *sender, qsizetype offset);
+ WING_API qint8 readInt8(const QObject *sender, qsizetype offset);
- WING_SERVICE qint16 readInt16(QObject *sender, qsizetype offset);
+ WING_API qint16 readInt16(const QObject *sender, qsizetype offset);
- WING_SERVICE qint32 readInt32(QObject *sender, qsizetype offset);
+ WING_API qint32 readInt32(const QObject *sender, qsizetype offset);
- WING_SERVICE qint64 readInt64(QObject *sender, qsizetype offset);
+ WING_API qint64 readInt64(const QObject *sender, qsizetype offset);
- WING_SERVICE quint8 readUInt8(QObject *sender, qsizetype offset);
+ WING_API quint8 readUInt8(const QObject *sender, qsizetype offset);
- WING_SERVICE quint16 readUInt16(QObject *sender, qsizetype offset);
+ WING_API quint16 readUInt16(const QObject *sender, qsizetype offset);
- WING_SERVICE quint32 readUInt32(QObject *sender, qsizetype offset);
+ WING_API quint32 readUInt32(const QObject *sender, qsizetype offset);
- WING_SERVICE quint64 readUInt64(QObject *sender, qsizetype offset);
+ WING_API quint64 readUInt64(const QObject *sender, qsizetype offset);
- WING_SERVICE float readFloat(QObject *sender, qsizetype offset);
+ WING_API float readFloat(const QObject *sender, qsizetype offset);
- WING_SERVICE double readDouble(QObject *sender, qsizetype offset);
+ WING_API double readDouble(const QObject *sender, qsizetype offset);
- WING_SERVICE QString readString(QObject *sender, qsizetype offset,
- const QString &encoding);
+ WING_API QString readString(const QObject *sender, qsizetype offset,
+ const QString &encoding);
- WING_SERVICE QByteArray readBytes(QObject *sender, qsizetype offset,
- qsizetype count);
+ WING_API QByteArray readBytes(const QObject *sender, qsizetype offset,
+ qsizetype count);
- WING_SERVICE qsizetype findNext(QObject *sender, qsizetype begin,
+ WING_API qsizetype findNext(const QObject *sender, qsizetype begin,
+ const QByteArray &ba);
+
+ WING_API qsizetype findPrevious(const QObject *sender, qsizetype begin,
const QByteArray &ba);
- WING_SERVICE qsizetype findPrevious(QObject *sender, qsizetype begin,
- const QByteArray &ba);
+ WING_API QString bookMarkComment(const QObject *sender, qsizetype pos);
- WING_SERVICE QString bookMarkComment(QObject *sender, qsizetype pos);
-
- WING_SERVICE bool existBookMark(QObject *sender, qsizetype pos);
+ WING_API bool existBookMark(const QObject *sender, qsizetype pos);
// document
- WING_SERVICE bool switchDocument(QObject *sender, int handle);
+ WING_API bool switchDocument(const QObject *sender, int handle);
- WING_SERVICE bool raiseDocument(QObject *sender, int handle);
+ WING_API bool raiseDocument(const QObject *sender, int handle);
- WING_SERVICE bool setLockedFile(QObject *sender, bool b);
+ WING_API bool setLockedFile(const QObject *sender, bool b);
- WING_SERVICE bool setKeepSize(QObject *sender, bool b);
+ WING_API bool setKeepSize(const QObject *sender, bool b);
- WING_SERVICE bool setStringVisible(QObject *sender, bool b);
+ WING_API bool setStringVisible(const QObject *sender, bool b);
- WING_SERVICE bool setAddressVisible(QObject *sender, bool b);
+ WING_API bool setAddressVisible(const QObject *sender, bool b);
- WING_SERVICE bool setHeaderVisible(QObject *sender, bool b);
+ WING_API bool setHeaderVisible(const QObject *sender, bool b);
- WING_SERVICE bool setAddressBase(QObject *sender, quintptr base);
+ WING_API bool setAddressBase(const QObject *sender, quintptr base);
- WING_SERVICE bool beginMarco(QObject *sender, const QString &txt);
+ WING_API bool beginMarco(const QObject *sender, const QString &txt);
- WING_SERVICE bool endMarco(QObject *sender);
+ WING_API bool endMarco(const QObject *sender);
- WING_SERVICE bool writeInt8(QObject *sender, qsizetype offset, qint8 value);
+ WING_API bool writeInt8(const QObject *sender, qsizetype offset,
+ qint8 value);
- WING_SERVICE bool writeInt16(QObject *sender, qsizetype offset,
- qint16 value);
+ WING_API bool writeInt16(const QObject *sender, qsizetype offset,
+ qint16 value);
- WING_SERVICE bool writeInt32(QObject *sender, qsizetype offset,
- qint32 value);
+ WING_API bool writeInt32(const QObject *sender, qsizetype offset,
+ qint32 value);
- WING_SERVICE bool writeInt64(QObject *sender, qsizetype offset,
- qint64 value);
+ WING_API bool writeInt64(const QObject *sender, qsizetype offset,
+ qint64 value);
- WING_SERVICE bool writeUInt8(QObject *sender, qsizetype offset,
- quint8 value);
+ WING_API bool writeUInt8(const QObject *sender, qsizetype offset,
+ quint8 value);
- WING_SERVICE bool writeUInt16(QObject *sender, qsizetype offset,
- quint16 value);
+ WING_API bool writeUInt16(const QObject *sender, qsizetype offset,
+ quint16 value);
- WING_SERVICE bool writeUInt32(QObject *sender, qsizetype offset,
- quint32 value);
+ WING_API bool writeUInt32(const QObject *sender, qsizetype offset,
+ quint32 value);
- WING_SERVICE bool writeUInt64(QObject *sender, qsizetype offset,
- quint64 value);
+ WING_API bool writeUInt64(const QObject *sender, qsizetype offset,
+ quint64 value);
- WING_SERVICE bool writeFloat(QObject *sender, qsizetype offset,
- float value);
+ WING_API bool writeFloat(const QObject *sender, qsizetype offset,
+ float value);
- WING_SERVICE bool writeDouble(QObject *sender, qsizetype offset,
- double value);
+ WING_API bool writeDouble(const QObject *sender, qsizetype offset,
+ double value);
- WING_SERVICE bool writeString(QObject *sender, qsizetype offset,
- const QString &value,
- const QString &encoding);
+ WING_API bool writeString(const QObject *sender, qsizetype offset,
+ const QString &value, const QString &encoding);
- WING_SERVICE bool writeBytes(QObject *sender, qsizetype offset,
- const QByteArray &data);
+ WING_API bool writeBytes(const QObject *sender, qsizetype offset,
+ const QByteArray &data);
- WING_SERVICE bool insertInt8(QObject *sender, qsizetype offset,
- qint8 value);
+ WING_API bool insertInt8(const QObject *sender, qsizetype offset,
+ qint8 value);
- WING_SERVICE bool insertInt16(QObject *sender, qsizetype offset,
- qint16 value);
+ WING_API bool insertInt16(const QObject *sender, qsizetype offset,
+ qint16 value);
- WING_SERVICE bool insertInt32(QObject *sender, qsizetype offset,
- qint32 value);
+ WING_API bool insertInt32(const QObject *sender, qsizetype offset,
+ qint32 value);
- WING_SERVICE bool insertInt64(QObject *sender, qsizetype offset,
- qint64 value);
+ WING_API bool insertInt64(const QObject *sender, qsizetype offset,
+ qint64 value);
- WING_SERVICE bool insertUInt8(QObject *sender, qsizetype offset,
- quint8 value);
+ WING_API bool insertUInt8(const QObject *sender, qsizetype offset,
+ quint8 value);
- WING_SERVICE bool insertUInt16(QObject *sender, qsizetype offset,
- quint16 value);
+ WING_API bool insertUInt16(const QObject *sender, qsizetype offset,
+ quint16 value);
- WING_SERVICE bool insertUInt32(QObject *sender, qsizetype offset,
- quint32 value);
+ WING_API bool insertUInt32(const QObject *sender, qsizetype offset,
+ quint32 value);
- WING_SERVICE bool insertUInt64(QObject *sender, qsizetype offset,
- quint64 value);
+ WING_API bool insertUInt64(const QObject *sender, qsizetype offset,
+ quint64 value);
- WING_SERVICE bool insertFloat(QObject *sender, qsizetype offset,
- float value);
+ WING_API bool insertFloat(const QObject *sender, qsizetype offset,
+ float value);
- WING_SERVICE bool insertDouble(QObject *sender, qsizetype offset,
- double value);
+ WING_API bool insertDouble(const QObject *sender, qsizetype offset,
+ double value);
- WING_SERVICE bool insertString(QObject *sender, qsizetype offset,
- const QString &value,
- const QString &encoding);
+ WING_API bool insertString(const QObject *sender, qsizetype offset,
+ const QString &value, const QString &encoding);
- WING_SERVICE bool insertBytes(QObject *sender, qsizetype offset,
- const QByteArray &data);
+ WING_API bool insertBytes(const QObject *sender, qsizetype offset,
+ const QByteArray &data);
- WING_SERVICE bool appendInt8(QObject *sender, qint8 value);
+ WING_API bool appendInt8(const QObject *sender, qint8 value);
- WING_SERVICE bool appendInt16(QObject *sender, qint16 value);
+ WING_API bool appendInt16(const QObject *sender, qint16 value);
- WING_SERVICE bool appendInt32(QObject *sender, qint32 value);
+ WING_API bool appendInt32(const QObject *sender, qint32 value);
- WING_SERVICE bool appendInt64(QObject *sender, qint64 value);
+ WING_API bool appendInt64(const QObject *sender, qint64 value);
- WING_SERVICE bool appendUInt8(QObject *sender, quint8 value);
+ WING_API bool appendUInt8(const QObject *sender, quint8 value);
- WING_SERVICE bool appendUInt16(QObject *sender, quint16 value);
+ WING_API bool appendUInt16(const QObject *sender, quint16 value);
- WING_SERVICE bool appendUInt32(QObject *sender, quint32 value);
+ WING_API bool appendUInt32(const QObject *sender, quint32 value);
- WING_SERVICE bool appendUInt64(QObject *sender, quint64 value);
+ WING_API bool appendUInt64(const QObject *sender, quint64 value);
- WING_SERVICE bool appendFloat(QObject *sender, float value);
+ WING_API bool appendFloat(const QObject *sender, float value);
- WING_SERVICE bool appendDouble(QObject *sender, double value);
+ WING_API bool appendDouble(const QObject *sender, double value);
- WING_SERVICE bool appendString(QObject *sender, const QString &value,
- const QString &encoding);
+ WING_API bool appendString(const QObject *sender, const QString &value,
+ const QString &encoding);
- WING_SERVICE bool appendBytes(QObject *sender, const QByteArray &data);
+ WING_API bool appendBytes(const QObject *sender, const QByteArray &data);
- WING_SERVICE bool removeBytes(QObject *sender, qsizetype offset,
- qsizetype len);
+ WING_API bool removeBytes(const QObject *sender, qsizetype offset,
+ qsizetype len);
// cursor
- WING_SERVICE bool moveTo(QObject *sender, qsizetype line, qsizetype column,
- int nibbleindex, bool clearSelection);
+ WING_API bool moveTo(const QObject *sender, qsizetype line,
+ qsizetype column, int nibbleindex,
+ bool clearSelection);
- WING_SERVICE bool moveTo(QObject *sender, qsizetype offset,
- bool clearSelection);
+ WING_API bool moveTo(const QObject *sender, qsizetype offset,
+ bool clearSelection);
- WING_SERVICE bool select(QObject *sender, qsizetype offset,
- qsizetype length, SelectionMode mode);
+ WING_API bool select(const QObject *sender, qsizetype offset,
+ qsizetype length, SelectionMode mode);
- WING_SERVICE bool setInsertionMode(QObject *sender, bool isinsert);
+ WING_API bool setInsertionMode(const QObject *sender, bool isinsert);
- WING_SERVICE bool metadata(QObject *sender, qsizetype begin,
- qsizetype length, const QColor &fgcolor,
- const QColor &bgcolor, const QString &comment);
+ WING_API bool metadata(const QObject *sender, qsizetype begin,
+ qsizetype length, const QColor &fgcolor,
+ const QColor &bgcolor, const QString &comment);
- WING_SERVICE bool removeMetadata(QObject *sender, qsizetype offset);
+ WING_API bool removeMetadata(const QObject *sender, qsizetype offset);
- WING_SERVICE bool clearMetadata(QObject *sender);
+ WING_API bool clearMetadata(const QObject *sender);
- WING_SERVICE bool setMetaVisible(QObject *sender, bool b);
+ WING_API bool setMetaVisible(const QObject *sender, bool b);
- WING_SERVICE bool setMetafgVisible(QObject *sender, bool b);
+ WING_API bool setMetafgVisible(const QObject *sender, bool b);
- WING_SERVICE bool setMetabgVisible(QObject *sender, bool b);
+ WING_API bool setMetabgVisible(const QObject *sender, bool b);
- WING_SERVICE bool setMetaCommentVisible(QObject *sender, bool b);
+ WING_API bool setMetaCommentVisible(const QObject *sender, bool b);
// mainwindow
- WING_SERVICE WingHex::ErrFile newFile(QObject *sender);
+ WING_API WingHex::ErrFile newFile(const QObject *sender);
- WING_SERVICE WingHex::ErrFile openFile(QObject *sender,
- const QString &filename);
+ WING_API WingHex::ErrFile openFile(const QObject *sender,
+ const QString &filename);
- WING_SERVICE WingHex::ErrFile
- openExtFile(QObject *sender, const QString &ext, const QString &file);
+ WING_API WingHex::ErrFile
+ openExtFile(const QObject *sender, const QString &ext, const QString &file);
- WING_SERVICE WingHex::ErrFile openWorkSpace(QObject *sender,
- const QString &filename);
+ WING_API WingHex::ErrFile openWorkSpace(const QObject *sender,
+ const QString &filename);
- WING_SERVICE WingHex::ErrFile closeHandle(QObject *sender, int handle);
+ WING_API WingHex::ErrFile closeHandle(const QObject *sender, int handle);
- WING_SERVICE WingHex::ErrFile closeFile(QObject *sender, int handle,
- bool force);
+ WING_API WingHex::ErrFile closeFile(const QObject *sender, int handle,
+ bool force);
- WING_SERVICE WingHex::ErrFile saveFile(QObject *sender, int handle);
+ WING_API WingHex::ErrFile saveFile(const QObject *sender, int handle);
- WING_SERVICE WingHex::ErrFile exportFile(QObject *sender, int handle,
- const QString &savename);
+ WING_API WingHex::ErrFile exportFile(const QObject *sender, int handle,
+ const QString &savename);
- WING_SERVICE WingHex::ErrFile saveAsFile(QObject *sender, int handle,
- const QString &savename);
+ WING_API WingHex::ErrFile saveAsFile(const QObject *sender, int handle,
+ const QString &savename);
- WING_SERVICE WingHex::ErrFile openCurrent(QObject *sender);
+ WING_API WingHex::ErrFile openCurrent(const QObject *sender);
- WING_SERVICE WingHex::ErrFile closeCurrent(QObject *sender, bool force);
+ WING_API WingHex::ErrFile closeCurrent(const QObject *sender, bool force);
- WING_SERVICE WingHex::ErrFile saveCurrent(QObject *sender);
+ WING_API WingHex::ErrFile saveCurrent(const QObject *sender);
- WING_SERVICE WingHex::ErrFile exportCurrent(QObject *sender,
- const QString &savename);
+ WING_API WingHex::ErrFile exportCurrent(const QObject *sender,
+ const QString &savename);
- WING_SERVICE WingHex::ErrFile saveAsCurrent(QObject *sender,
- const QString &savename);
+ WING_API WingHex::ErrFile saveAsCurrent(const QObject *sender,
+ const QString &savename);
// bookmark
- WING_SERVICE bool addBookMark(QObject *sender, qsizetype pos,
- const QString &comment);
+ WING_API bool addBookMark(const QObject *sender, qsizetype pos,
+ const QString &comment);
- WING_SERVICE bool modBookMark(QObject *sender, qsizetype pos,
- const QString &comment);
+ WING_API bool modBookMark(const QObject *sender, qsizetype pos,
+ const QString &comment);
- WING_SERVICE bool removeBookMark(QObject *sender, qsizetype pos);
+ WING_API bool removeBookMark(const QObject *sender, qsizetype pos);
- WING_SERVICE bool clearBookMark(QObject *sender);
+ WING_API bool clearBookMark(const QObject *sender);
// extension
- WING_SERVICE bool closeAllFiles(QObject *sender);
+ WING_API bool closeAllFiles(const QObject *sender);
private:
- WingHex::IWingPlugin *checkPluginAndReport(QObject *sender,
+ WingHex::IWingPlugin *checkPluginAndReport(const QObject *sender,
const char *func);
- WingHex::IWingDevice *checkBaseAndReport(QObject *sender, const char *func);
+ WingHex::IWingDevice *checkBaseAndReport(const QObject *sender,
+ const char *func);
- bool checkErrAllAllowAndReport(QObject *sender, const char *func);
+ bool checkErrAllAllowAndReport(const QObject *sender, const char *func);
private:
CallTable _plgFns;
diff --git a/src/class/wingangelapi.cpp b/src/class/wingangelapi.cpp
index 6df3823..d912e25 100644
--- a/src/class/wingangelapi.cpp
+++ b/src/class/wingangelapi.cpp
@@ -1060,7 +1060,8 @@ void WingAngelAPI::installHexControllerAPI(asIScriptEngine *engine) {
(const QString &), WingHex::ErrFile),
"ErrFile openWorkSpace(string &in filename)");
- registerAPI(engine, asMETHOD(WingHex::IWingPlugin, closeAllFiles),
+ registerAPI(engine,
+ asMETHODPR(WingHex::IWingPlugin, closeAllFiles, (), bool),
"bool closeAll()");
engine->SetDefaultNamespace("");
@@ -2098,9 +2099,9 @@ CScriptArray *WingAngelAPI::_HexReader_selectionBytes() {
auto array = CScriptArray::Create(arrt, ret.size());
for (qsizetype i = 0; i < ret.size(); ++i) {
auto buffer = ret.at(i);
- auto conarr = CScriptArray::Create(t, ret.size());
- for (qsizetype i = 0; i < ret.size(); ++i) {
- auto v = ret.at(buffer.at(i));
+ auto conarr = CScriptArray::Create(t, buffer.size());
+ for (qsizetype i = 0; i < buffer.size(); ++i) {
+ auto v = buffer.at(i);
conarr->SetValue(i, &v);
}
array->SetValue(i, conarr);
diff --git a/src/components.md b/src/components.md
index b955e62..2da61a4 100644
--- a/src/components.md
+++ b/src/components.md
@@ -1,6 +1,6 @@
以下组件为该软件所使用的所有第三方组件,标注 **FORK** 表示已经被该软件作者大量魔改,若后续标注箭头和开源协议表示所有修改的文件遵守箭头所指向的开源协议,若不标注则遵守原有的协议。没特殊说明,**APGL-3.0** 只应用到该官方源码仓库的非子模块(git-submodule)部分。
-The following components are all third-party components used by the software. The **FORK** mark indicates that they have been heavily modified by the software author. If there is an arrow and open source license, all modified files comply with the open source agreement pointed by the arrow. If there is no mark, the original agreement is followed. Unless otherwise specified, **APGL-3.0** is only applied to the non-submodule (git-submodule) part of the official source repository.
+The following components are all third-party components used by the software. The **FORK** mark indicates that they have been deeply modified by the software author. If there is an arrow and open source license, all modified files comply with the open source license pointed by the arrow. If there is no mark, the original agreement is followed. Unless otherwise specified, **APGL-3.0** is only applied to the non-submodule (git-submodule) part of the official source repository.
* [QHexView](https://github.com/Dax89/QHexView/tree/master) (MIT, **FORK** -> AGPL-3.0)
* [QHexEdit2](https://github.com/Simsys/qhexedit2) (GPL, **FORK**)
@@ -9,6 +9,7 @@ The following components are all third-party components used by the software. Th
* [QWingRibbon](https://github.com/martijnkoopman/Qt-Ribbon-Widget) (LGPL, **FORK**)
* [QtSingleApplication](https://github.com/qtproject/qt-solutions/tree/master/qtsingleapplication) (BSD-3-Clause)
* [QWindowKit](https://github.com/stdware/qwindowkit) (Apache v2.0)
+* [antlr4](https://github.com/antlr/antlr4) (BSD-3-Clause)
* [AngelScript](https://github.com/codecat/angelscript-mirror) (zlib license)
* [cpptrace](https://github.com/jeremy-rifkin/cpptrace) (MIT)
* [QConsoleWidget](https://github.com/gapost/qconsolewidget) (MIT, **FORK** -> AGPL-3.0)
diff --git a/src/control/editorview.cpp b/src/control/editorview.cpp
index ff72f3d..683f063 100644
--- a/src/control/editorview.cpp
+++ b/src/control/editorview.cpp
@@ -132,19 +132,24 @@ EditorView::EditorView(QWidget *parent)
auto total = mobj->methodCount();
for (int i = 0; i < total; ++i) {
auto m = mobj->method(i);
- if (m.methodType() == QMetaMethod::Method) {
- QByteArray msig = m.name();
- msig.append('(');
-
- QByteArrayList params;
- auto total = m.parameterCount();
- for (int i = 1; i < total; ++i) {
- auto mt = QMetaType(m.parameterType(i));
- params.append(mt.name());
+ // all private slots
+ if (m.methodType() == QMetaMethod::Slot &&
+ m.access() == QMetaMethod::Private) {
+ if (qstrcmp(m.tag(), "WING_API")) {
+ continue;
+ }
+
+ WingHex::FunctionSig msig;
+ msig.fnName = m.name();
+
+ auto total = m.parameterCount();
+ msig.types.reserve(total);
+
+ for (int i = 1; i < total; ++i) {
+ auto mt = m.parameterType(i);
+ msig.types.append(mt);
}
- msig.append(params.join(','));
- msig.append(')');
_viewFns.insert(msig, m);
}
}
@@ -864,7 +869,7 @@ void EditorView::applyFunctionTables(WingEditorViewWidget *view,
view->setProperty("__CALL_POINTER__", quintptr(this));
}
-bool EditorView::checkErrAndReport(QObject *sender, const char *func) {
+bool EditorView::checkErrAndReport(const QObject *sender, const char *func) {
for (auto p = m_others.constBegin(); p != m_others.constEnd(); ++p) {
if (*p == sender) {
return true;
@@ -886,18 +891,13 @@ bool EditorView::existsServiceHost(QObject *caller, const QString &puid) {
return PluginSystem::instance().existsServiceHost(caller, puid);
}
-bool EditorView::invokeService(QObject *caller, const QString &puid,
- const char *method, Qt::ConnectionType type,
- QGenericReturnArgument ret,
- QGenericArgument val0, QGenericArgument val1,
- QGenericArgument val2, QGenericArgument val3,
- QGenericArgument val4) {
- if (checkErrAndReport(caller, __func__)) {
+bool EditorView::invokeServiceImpl(const QObject *sender, const QString &puid,
+ const MetaCallInfo &infos) {
+ if (checkErrAndReport(sender, __func__)) {
return false;
}
- return PluginSystem::instance().invokeService(
- this, {}, puid, method, type, ret, val0, val1, val2, val3, val4);
+ return PluginSystem::instance().invokeServiceImpl(this, puid, infos);
}
QString EditorView::currentDocFilename(QObject *caller) {
diff --git a/src/control/editorview.h b/src/control/editorview.h
index c4c0240..023d513 100644
--- a/src/control/editorview.h
+++ b/src/control/editorview.h
@@ -231,294 +231,273 @@ private:
const CallTable &fns);
private:
- bool checkErrAndReport(QObject *sender, const char *func);
+ bool checkErrAndReport(const QObject *sender, const char *func);
bool checkThreadAff();
-private:
- WING_SERVICE bool existsServiceHost(QObject *caller, const QString &puid);
+private slots:
+ WING_API bool existsServiceHost(QObject *caller, const QString &puid);
- WING_SERVICE bool
- invokeService(QObject *caller, const QString &puid, const char *method,
- Qt::ConnectionType type, QGenericReturnArgument ret,
- QGenericArgument val0, QGenericArgument val1,
- QGenericArgument val2, QGenericArgument val3,
- QGenericArgument val4);
+ WING_API bool invokeServiceImpl(const QObject *sender, const QString &puid,
+ const MetaCallInfo &infos);
-private:
- WING_SERVICE QString currentDocFilename(QObject *caller);
+private slots:
+ WING_API QString currentDocFilename(QObject *caller);
// document
- WING_SERVICE bool isReadOnly(QObject *caller);
- WING_SERVICE bool isInsertionMode(QObject *caller);
- WING_SERVICE bool isKeepSize(QObject *caller);
- WING_SERVICE bool isLocked(QObject *caller);
- WING_SERVICE qsizetype documentLines(QObject *caller);
- WING_SERVICE qsizetype documentBytes(QObject *caller);
- WING_SERVICE WingHex::HexPosition currentPos(QObject *caller);
- WING_SERVICE qsizetype currentRow(QObject *caller);
- WING_SERVICE qsizetype currentColumn(QObject *caller);
- WING_SERVICE qsizetype currentOffset(QObject *caller);
- WING_SERVICE qsizetype selectedLength(QObject *caller);
+ WING_API bool isReadOnly(QObject *caller);
+ WING_API bool isInsertionMode(QObject *caller);
+ WING_API bool isKeepSize(QObject *caller);
+ WING_API bool isLocked(QObject *caller);
+ WING_API qsizetype documentLines(QObject *caller);
+ WING_API qsizetype documentBytes(QObject *caller);
+ WING_API WingHex::HexPosition currentPos(QObject *caller);
+ WING_API qsizetype currentRow(QObject *caller);
+ WING_API qsizetype currentColumn(QObject *caller);
+ WING_API qsizetype currentOffset(QObject *caller);
+ WING_API qsizetype selectedLength(QObject *caller);
- WING_SERVICE QByteArray selectedBytes(QObject *caller, qsizetype index);
- WING_SERVICE QByteArrayList selectionBytes(QObject *caller);
+ WING_API QByteArray selectedBytes(QObject *caller, qsizetype index);
+ WING_API QByteArrayList selectionBytes(QObject *caller);
- WING_SERVICE WingHex::HexPosition selectionStart(QObject *caller,
- qsizetype index);
- WING_SERVICE WingHex::HexPosition selectionEnd(QObject *caller,
- qsizetype index);
- WING_SERVICE qsizetype selectionLength(QObject *caller, qsizetype index);
- WING_SERVICE qsizetype selectionCount(QObject *caller);
+ WING_API WingHex::HexPosition selectionStart(QObject *caller,
+ qsizetype index);
+ WING_API WingHex::HexPosition selectionEnd(QObject *caller,
+ qsizetype index);
+ WING_API qsizetype selectionLength(QObject *caller, qsizetype index);
+ WING_API qsizetype selectionCount(QObject *caller);
- WING_SERVICE bool stringVisible(QObject *caller);
- WING_SERVICE bool addressVisible(QObject *caller);
- WING_SERVICE bool headerVisible(QObject *caller);
- WING_SERVICE quintptr addressBase(QObject *caller);
- WING_SERVICE bool isModified(QObject *caller);
+ WING_API bool stringVisible(QObject *caller);
+ WING_API bool addressVisible(QObject *caller);
+ WING_API bool headerVisible(QObject *caller);
+ WING_API quintptr addressBase(QObject *caller);
+ WING_API bool isModified(QObject *caller);
- WING_SERVICE qint8 readInt8(QObject *caller, qsizetype offset);
- WING_SERVICE qint16 readInt16(QObject *caller, qsizetype offset);
- WING_SERVICE qint32 readInt32(QObject *caller, qsizetype offset);
- WING_SERVICE qint64 readInt64(QObject *caller, qsizetype offset);
- WING_SERVICE quint8 readUInt8(QObject *caller, qsizetype offset);
- WING_SERVICE quint16 readUInt16(QObject *caller, qsizetype offset);
- WING_SERVICE quint32 readUInt32(QObject *caller, qsizetype offset);
- WING_SERVICE quint64 readUInt64(QObject *caller, qsizetype offset);
- WING_SERVICE float readFloat(QObject *caller, qsizetype offset);
- WING_SERVICE double readDouble(QObject *caller, qsizetype offset);
- WING_SERVICE QString readString(QObject *caller, qsizetype offset,
- const QString &encoding);
- WING_SERVICE QByteArray readBytes(QObject *caller, qsizetype offset,
- qsizetype count);
+ WING_API qint8 readInt8(QObject *caller, qsizetype offset);
+ WING_API qint16 readInt16(QObject *caller, qsizetype offset);
+ WING_API qint32 readInt32(QObject *caller, qsizetype offset);
+ WING_API qint64 readInt64(QObject *caller, qsizetype offset);
+ WING_API quint8 readUInt8(QObject *caller, qsizetype offset);
+ WING_API quint16 readUInt16(QObject *caller, qsizetype offset);
+ WING_API quint32 readUInt32(QObject *caller, qsizetype offset);
+ WING_API quint64 readUInt64(QObject *caller, qsizetype offset);
+ WING_API float readFloat(QObject *caller, qsizetype offset);
+ WING_API double readDouble(QObject *caller, qsizetype offset);
+ WING_API QString readString(QObject *caller, qsizetype offset,
+ const QString &encoding);
+ WING_API QByteArray readBytes(QObject *caller, qsizetype offset,
+ qsizetype count);
- WING_SERVICE qsizetype findNext(QObject *caller, qsizetype begin,
+ WING_API qsizetype findNext(QObject *caller, qsizetype begin,
+ const QByteArray &ba);
+ WING_API qsizetype findPrevious(QObject *caller, qsizetype begin,
const QByteArray &ba);
- WING_SERVICE qsizetype findPrevious(QObject *caller, qsizetype begin,
- const QByteArray &ba);
- WING_SERVICE QString bookMarkComment(QObject *caller, qsizetype pos);
- WING_SERVICE bool existBookMark(QObject *caller, qsizetype pos);
+ WING_API QString bookMarkComment(QObject *caller, qsizetype pos);
+ WING_API bool existBookMark(QObject *caller, qsizetype pos);
- WING_SERVICE bool setLockedFile(QObject *caller, bool b);
- WING_SERVICE bool setKeepSize(QObject *caller, bool b);
- WING_SERVICE bool setStringVisible(QObject *caller, bool b);
- WING_SERVICE bool setAddressVisible(QObject *caller, bool b);
- WING_SERVICE bool setHeaderVisible(QObject *caller, bool b);
- WING_SERVICE bool setAddressBase(QObject *caller, quintptr base);
+ WING_API bool setLockedFile(QObject *caller, bool b);
+ WING_API bool setKeepSize(QObject *caller, bool b);
+ WING_API bool setStringVisible(QObject *caller, bool b);
+ WING_API bool setAddressVisible(QObject *caller, bool b);
+ WING_API bool setHeaderVisible(QObject *caller, bool b);
+ WING_API bool setAddressBase(QObject *caller, quintptr base);
- WING_SERVICE bool beginMarco(QObject *caller, const QString &txt);
+ WING_API bool beginMarco(QObject *caller, const QString &txt);
bool endMarco(QObject *caller);
- WING_SERVICE bool writeInt8(QObject *caller, qsizetype offset, qint8 value);
- WING_SERVICE bool writeInt16(QObject *caller, qsizetype offset,
- qint16 value);
- WING_SERVICE bool writeInt32(QObject *caller, qsizetype offset,
- qint32 value);
- WING_SERVICE bool writeInt64(QObject *caller, qsizetype offset,
- qint64 value);
- WING_SERVICE bool writeUInt8(QObject *caller, qsizetype offset,
- quint8 value);
- WING_SERVICE bool writeUInt16(QObject *caller, qsizetype offset,
- quint16 value);
- WING_SERVICE bool writeUInt32(QObject *caller, qsizetype offset,
- quint32 value);
- WING_SERVICE bool writeUInt64(QObject *caller, qsizetype offset,
- quint64 value);
- WING_SERVICE bool writeFloat(QObject *caller, qsizetype offset,
- float value);
- WING_SERVICE bool writeDouble(QObject *caller, qsizetype offset,
- double value);
- WING_SERVICE
+ WING_API bool writeInt8(QObject *caller, qsizetype offset, qint8 value);
+ WING_API bool writeInt16(QObject *caller, qsizetype offset, qint16 value);
+ WING_API bool writeInt32(QObject *caller, qsizetype offset, qint32 value);
+ WING_API bool writeInt64(QObject *caller, qsizetype offset, qint64 value);
+ WING_API bool writeUInt8(QObject *caller, qsizetype offset, quint8 value);
+ WING_API bool writeUInt16(QObject *caller, qsizetype offset, quint16 value);
+ WING_API bool writeUInt32(QObject *caller, qsizetype offset, quint32 value);
+ WING_API bool writeUInt64(QObject *caller, qsizetype offset, quint64 value);
+ WING_API bool writeFloat(QObject *caller, qsizetype offset, float value);
+ WING_API bool writeDouble(QObject *caller, qsizetype offset, double value);
+ WING_API
bool writeString(QObject *caller, qsizetype offset, const QString &value,
const QString &encoding);
- WING_SERVICE bool writeBytes(QObject *caller, qsizetype offset,
- const QByteArray &data);
+ WING_API bool writeBytes(QObject *caller, qsizetype offset,
+ const QByteArray &data);
- WING_SERVICE bool insertInt8(QObject *caller, qsizetype offset,
- qint8 value);
- WING_SERVICE bool insertInt16(QObject *caller, qsizetype offset,
- qint16 value);
- WING_SERVICE bool insertInt32(QObject *caller, qsizetype offset,
- qint32 value);
- WING_SERVICE bool insertInt64(QObject *caller, qsizetype offset,
- qint64 value);
- WING_SERVICE bool insertUInt8(QObject *caller, qsizetype offset,
- quint8 value);
- WING_SERVICE
+ WING_API bool insertInt8(QObject *caller, qsizetype offset, qint8 value);
+ WING_API bool insertInt16(QObject *caller, qsizetype offset, qint16 value);
+ WING_API bool insertInt32(QObject *caller, qsizetype offset, qint32 value);
+ WING_API bool insertInt64(QObject *caller, qsizetype offset, qint64 value);
+ WING_API bool insertUInt8(QObject *caller, qsizetype offset, quint8 value);
+ WING_API
bool insertUInt16(QObject *caller, qsizetype offset, quint16 value);
- WING_SERVICE
+ WING_API
bool insertUInt32(QObject *caller, qsizetype offset, quint32 value);
- WING_SERVICE bool insertUInt64(QObject *caller, qsizetype offset,
- quint64 value);
- WING_SERVICE bool insertFloat(QObject *caller, qsizetype offset,
- float value);
- WING_SERVICE bool insertDouble(QObject *caller, qsizetype offset,
- double value);
- WING_SERVICE bool insertString(QObject *caller, qsizetype offset,
- const QString &value,
- const QString &encoding);
- WING_SERVICE bool insertBytes(QObject *caller, qsizetype offset,
- const QByteArray &data);
+ WING_API bool insertUInt64(QObject *caller, qsizetype offset,
+ quint64 value);
+ WING_API bool insertFloat(QObject *caller, qsizetype offset, float value);
+ WING_API bool insertDouble(QObject *caller, qsizetype offset, double value);
+ WING_API bool insertString(QObject *caller, qsizetype offset,
+ const QString &value, const QString &encoding);
+ WING_API bool insertBytes(QObject *caller, qsizetype offset,
+ const QByteArray &data);
- WING_SERVICE bool appendInt8(QObject *caller, qint8 value);
- WING_SERVICE bool appendInt16(QObject *caller, qint16 value);
- WING_SERVICE bool appendInt32(QObject *caller, qint32 value);
- WING_SERVICE bool appendInt64(QObject *caller, qint64 value);
- WING_SERVICE bool appendUInt8(QObject *caller, quint8 value);
- WING_SERVICE bool appendUInt16(QObject *caller, quint16 value);
- WING_SERVICE bool appendUInt32(QObject *caller, quint32 value);
- WING_SERVICE bool appendUInt64(QObject *caller, quint64 value);
- WING_SERVICE bool appendFloat(QObject *caller, float value);
- WING_SERVICE bool appendDouble(QObject *caller, double value);
- WING_SERVICE bool appendString(QObject *caller, const QString &value,
- const QString &encoding);
- WING_SERVICE bool appendBytes(QObject *caller, const QByteArray &data);
+ WING_API bool appendInt8(QObject *caller, qint8 value);
+ WING_API bool appendInt16(QObject *caller, qint16 value);
+ WING_API bool appendInt32(QObject *caller, qint32 value);
+ WING_API bool appendInt64(QObject *caller, qint64 value);
+ WING_API bool appendUInt8(QObject *caller, quint8 value);
+ WING_API bool appendUInt16(QObject *caller, quint16 value);
+ WING_API bool appendUInt32(QObject *caller, quint32 value);
+ WING_API bool appendUInt64(QObject *caller, quint64 value);
+ WING_API bool appendFloat(QObject *caller, float value);
+ WING_API bool appendDouble(QObject *caller, double value);
+ WING_API bool appendString(QObject *caller, const QString &value,
+ const QString &encoding);
+ WING_API bool appendBytes(QObject *caller, const QByteArray &data);
- WING_SERVICE bool removeBytes(QObject *caller, qsizetype offset,
- qsizetype len);
+ WING_API bool removeBytes(QObject *caller, qsizetype offset, qsizetype len);
// cursor
- WING_SERVICE bool moveTo(QObject *caller, qsizetype line, qsizetype column,
- int nibbleindex, bool clearSelection);
- WING_SERVICE bool moveTo(QObject *caller, qsizetype offset,
- bool clearSelection);
- WING_SERVICE bool select(QObject *caller, qsizetype offset,
- qsizetype length, SelectionMode mode);
- WING_SERVICE bool setInsertionMode(QObject *caller, bool isinsert);
+ WING_API bool moveTo(QObject *caller, qsizetype line, qsizetype column,
+ int nibbleindex, bool clearSelection);
+ WING_API bool moveTo(QObject *caller, qsizetype offset,
+ bool clearSelection);
+ WING_API bool select(QObject *caller, qsizetype offset, qsizetype length,
+ SelectionMode mode);
+ WING_API bool setInsertionMode(QObject *caller, bool isinsert);
// metadata
- WING_SERVICE bool metadata(QObject *caller, qsizetype begin,
- qsizetype length, const QColor &fgcolor,
- const QColor &bgcolor, const QString &comment);
+ WING_API bool metadata(QObject *caller, qsizetype begin, qsizetype length,
+ const QColor &fgcolor, const QColor &bgcolor,
+ const QString &comment);
- WING_SERVICE bool removeMetadata(QObject *caller, qsizetype offset);
- WING_SERVICE bool clearMetadata(QObject *caller);
- WING_SERVICE bool setMetaVisible(QObject *caller, bool b);
- WING_SERVICE bool setMetafgVisible(QObject *caller, bool b);
- WING_SERVICE bool setMetabgVisible(QObject *caller, bool b);
- WING_SERVICE bool setMetaCommentVisible(QObject *caller, bool b);
+ WING_API bool removeMetadata(QObject *caller, qsizetype offset);
+ WING_API bool clearMetadata(QObject *caller);
+ WING_API bool setMetaVisible(QObject *caller, bool b);
+ WING_API bool setMetafgVisible(QObject *caller, bool b);
+ WING_API bool setMetabgVisible(QObject *caller, bool b);
+ WING_API bool setMetaCommentVisible(QObject *caller, bool b);
// bookmark
- WING_SERVICE bool addBookMark(QObject *caller, qsizetype pos,
- const QString &comment);
- WING_SERVICE bool modBookMark(QObject *caller, qsizetype pos,
- const QString &comment);
- WING_SERVICE bool removeBookMark(QObject *caller, qsizetype pos);
- WING_SERVICE bool clearBookMark(QObject *caller);
+ WING_API bool addBookMark(QObject *caller, qsizetype pos,
+ const QString &comment);
+ WING_API bool modBookMark(QObject *caller, qsizetype pos,
+ const QString &comment);
+ WING_API bool removeBookMark(QObject *caller, qsizetype pos);
+ WING_API bool clearBookMark(QObject *caller);
-private:
- WING_SERVICE void toast(QObject *caller, const QPixmap &icon,
- const QString &message);
- WING_SERVICE void logTrace(QObject *caller, const QString &message);
- WING_SERVICE void logDebug(QObject *caller, const QString &message);
- WING_SERVICE void logWarn(QObject *caller, const QString &message);
- WING_SERVICE void logError(QObject *caller, const QString &message);
- WING_SERVICE void logInfo(QObject *caller, const QString &message);
+private slots:
+ WING_API void toast(QObject *caller, const QPixmap &icon,
+ const QString &message);
+ WING_API void logTrace(QObject *caller, const QString &message);
+ WING_API void logDebug(QObject *caller, const QString &message);
+ WING_API void logWarn(QObject *caller, const QString &message);
+ WING_API void logError(QObject *caller, const QString &message);
+ WING_API void logInfo(QObject *caller, const QString &message);
- WING_SERVICE bool raiseDockWidget(QObject *caller, QWidget *w);
+ WING_API bool raiseDockWidget(QObject *caller, QWidget *w);
// theme
- WING_SERVICE WingHex::AppTheme currentAppTheme(QObject *caller);
+ WING_API WingHex::AppTheme currentAppTheme(QObject *caller);
// not available for AngelScript
// only for plugin UI extenstion
- WING_SERVICE QDialog *createDialog(QObject *caller, QWidget *content);
+ WING_API QDialog *createDialog(QObject *caller, QWidget *content);
-private:
- WING_SERVICE void msgAboutQt(QObject *caller, QWidget *parent = nullptr,
- const QString &title = QString());
+private slots:
+ WING_API void msgAboutQt(QObject *caller, QWidget *parent = nullptr,
+ const QString &title = QString());
- WING_SERVICE QMessageBox::StandardButton msgInformation(
+ WING_API QMessageBox::StandardButton msgInformation(
QObject *caller, QWidget *parent, const QString &title,
const QString &text,
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
- WING_SERVICE QMessageBox::StandardButton msgQuestion(
+ WING_API QMessageBox::StandardButton msgQuestion(
QObject *caller, QWidget *parent, const QString &title,
const QString &text,
QMessageBox::StandardButtons buttons =
QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No),
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
- WING_SERVICE QMessageBox::StandardButton msgWarning(
+ WING_API QMessageBox::StandardButton msgWarning(
QObject *caller, QWidget *parent, const QString &title,
const QString &text,
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
- WING_SERVICE QMessageBox::StandardButton msgCritical(
+ WING_API QMessageBox::StandardButton msgCritical(
QObject *caller, QWidget *parent, const QString &title,
const QString &text,
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
- WING_SERVICE void msgAbout(QObject *caller, QWidget *parent,
- const QString &title, const QString &text);
+ WING_API void msgAbout(QObject *caller, QWidget *parent,
+ const QString &title, const QString &text);
- WING_SERVICE QMessageBox::StandardButton
+ WING_API QMessageBox::StandardButton
msgbox(QObject *caller, QWidget *parent, QMessageBox::Icon icon,
const QString &title, const QString &text,
QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
-private:
- WING_SERVICE QString dlgGetText(QObject *caller, QWidget *parent,
- const QString &title, const QString &label,
- QLineEdit::EchoMode echo,
- const QString &text, bool *ok,
- Qt::InputMethodHints inputMethodHints);
- WING_SERVICE QString
- dlgGetMultiLineText(QObject *caller, QWidget *parent, const QString &title,
- const QString &label, const QString &text, bool *ok,
- Qt::InputMethodHints inputMethodHints);
+private slots:
+ WING_API QString dlgGetText(QObject *caller, QWidget *parent,
+ const QString &title, const QString &label,
+ QLineEdit::EchoMode echo, const QString &text,
+ bool *ok,
+ Qt::InputMethodHints inputMethodHints);
+ WING_API QString dlgGetMultiLineText(QObject *caller, QWidget *parent,
+ const QString &title,
+ const QString &label,
+ const QString &text, bool *ok,
+ Qt::InputMethodHints inputMethodHints);
- WING_SERVICE QString dlgGetItem(QObject *caller, QWidget *parent,
- const QString &title, const QString &label,
- const QStringList &items, int current,
- bool editable, bool *ok,
- Qt::InputMethodHints inputMethodHints);
+ WING_API QString dlgGetItem(QObject *caller, QWidget *parent,
+ const QString &title, const QString &label,
+ const QStringList &items, int current,
+ bool editable, bool *ok,
+ Qt::InputMethodHints inputMethodHints);
- WING_SERVICE int dlgGetInt(QObject *caller, QWidget *parent,
- const QString &title, const QString &label,
- int value, int minValue, int maxValue, int step,
- bool *ok);
+ WING_API int dlgGetInt(QObject *caller, QWidget *parent,
+ const QString &title, const QString &label,
+ int value, int minValue, int maxValue, int step,
+ bool *ok);
- WING_SERVICE double dlgGetDouble(QObject *caller, QWidget *parent,
- const QString &title, const QString &label,
- double value, double minValue,
- double maxValue, int decimals, bool *ok,
- double step);
+ WING_API double dlgGetDouble(QObject *caller, QWidget *parent,
+ const QString &title, const QString &label,
+ double value, double minValue, double maxValue,
+ int decimals, bool *ok, double step);
-private:
- WING_SERVICE QString dlgGetExistingDirectory(QObject *caller,
- QWidget *parent,
- const QString &caption,
- const QString &dir,
- QFileDialog::Options options);
+private slots:
+ WING_API QString dlgGetExistingDirectory(QObject *caller, QWidget *parent,
+ const QString &caption,
+ const QString &dir,
+ QFileDialog::Options options);
- WING_SERVICE QString dlgGetOpenFileName(QObject *caller, QWidget *parent,
- const QString &caption,
- const QString &dir,
- const QString &filter,
- QString *selectedFilter,
- QFileDialog::Options options);
+ WING_API QString dlgGetOpenFileName(QObject *caller, QWidget *parent,
+ const QString &caption,
+ const QString &dir,
+ const QString &filter,
+ QString *selectedFilter,
+ QFileDialog::Options options);
- WING_SERVICE QStringList dlgGetOpenFileNames(
- QObject *caller, QWidget *parent, const QString &caption,
- const QString &dir, const QString &filter, QString *selectedFilter,
- QFileDialog::Options options);
+ WING_API QStringList dlgGetOpenFileNames(QObject *caller, QWidget *parent,
+ const QString &caption,
+ const QString &dir,
+ const QString &filter,
+ QString *selectedFilter,
+ QFileDialog::Options options);
- WING_SERVICE QString dlgGetSaveFileName(QObject *caller, QWidget *parent,
- const QString &caption,
- const QString &dir,
- const QString &filter,
- QString *selectedFilter,
- QFileDialog::Options options);
+ WING_API QString dlgGetSaveFileName(QObject *caller, QWidget *parent,
+ const QString &caption,
+ const QString &dir,
+ const QString &filter,
+ QString *selectedFilter,
+ QFileDialog::Options options);
-private:
- WING_SERVICE QColor dlgGetColor(QObject *caller, const QString &caption,
- QWidget *parent);
+private slots:
+ WING_API QColor dlgGetColor(QObject *caller, const QString &caption,
+ QWidget *parent);
private:
template
diff --git a/src/dialog/mainwindow.cpp b/src/dialog/mainwindow.cpp
index fc38aea..12c6a9a 100644
--- a/src/dialog/mainwindow.cpp
+++ b/src/dialog/mainwindow.cpp
@@ -3246,8 +3246,9 @@ void MainWindow::connectEditorView(EditorView *editor) {
editor->setProperty("__RELOAD__", false);
connect(editor, &EditorView::need2Reload, this, [editor, this]() {
+ auto fileName = editor->fileName();
+
if (editor->isBigFile()) {
- auto fileName = editor->fileName();
if (!QFile::exists(fileName)) {
activateWindow();
raise();
@@ -3255,19 +3256,23 @@ void MainWindow::connectEditorView(EditorView *editor) {
WingMessageBox::critical(this, tr("Error"),
tr("FileCloseBigFile"));
closeEditor(editor, true);
- }
- if (currentEditor() == editor) {
- editor->reload();
+
} else {
- editor->setProperty("__RELOAD__", true);
+ if (currentEditor() == editor) {
+ editor->reload();
+ } else {
+ editor->setProperty("__RELOAD__", true);
+ }
}
} else {
editor->hexEditor()->document()->setDocSaved(false);
if (currentEditor() == editor) {
- auto ret = WingMessageBox::question(this, tr("Reload"),
- tr("ReloadNeededYesOrNo"));
- if (ret == QMessageBox::Yes) {
- editor->reload();
+ if (QFile::exists(fileName)) {
+ auto ret = WingMessageBox::question(
+ this, tr("Reload"), tr("ReloadNeededYesOrNo"));
+ if (ret == QMessageBox::Yes) {
+ editor->reload();
+ }
}
} else {
editor->setProperty("__RELOAD__", true);
diff --git a/src/dialog/scriptingdialog.cpp b/src/dialog/scriptingdialog.cpp
index 2f9dcbc..9d4afbb 100644
--- a/src/dialog/scriptingdialog.cpp
+++ b/src/dialog/scriptingdialog.cpp
@@ -802,15 +802,10 @@ void ScriptingDialog::registerEditorView(ScriptEditor *editor) {
});
connect(editor, &ScriptEditor::need2Reload, this, [editor, this]() {
- editor->editor()->setContentModified(true);
+ auto e = editor->editor();
+ e->setContentModified(true);
if (currentEditor() == editor) {
- activateWindow();
- raise();
- auto ret = WingMessageBox::question(this, tr("Reload"),
- tr("ReloadNeededYesOrNo"));
- if (ret == QMessageBox::Yes) {
- editor->reload();
- }
+ reloadEditor(editor);
} else {
editor->setProperty("__RELOAD__", true);
}
@@ -894,12 +889,7 @@ void ScriptingDialog::swapEditor(ScriptEditor *old, ScriptEditor *cur) {
if (cur) {
auto needReload = cur->property("__RELOAD__").toBool();
if (needReload) {
- auto ret = WingMessageBox::question(this, tr("Reload"),
- tr("ReloadNeededYesOrNo"));
- if (ret == QMessageBox::Yes) {
- cur->reload();
- }
-
+ reloadEditor(cur);
cur->setProperty("__RELOAD__", false);
}
}
@@ -1151,6 +1141,19 @@ void ScriptingDialog::updateCursorPosition() {
}
}
+void ScriptingDialog::reloadEditor(ScriptEditor *editor) {
+ activateWindow();
+ raise();
+ editor->editor()->document()->setModified();
+ if (QFile::exists(editor->fileName())) {
+ auto ret = WingMessageBox::question(this, tr("Reload"),
+ tr("ReloadNeededYesOrNo"));
+ if (ret == QMessageBox::Yes) {
+ editor->reload();
+ }
+ }
+}
+
void ScriptingDialog::on_newfile() {
if (!newOpenFileSafeCheck()) {
return;
diff --git a/src/dialog/scriptingdialog.h b/src/dialog/scriptingdialog.h
index 5273659..394c45a 100644
--- a/src/dialog/scriptingdialog.h
+++ b/src/dialog/scriptingdialog.h
@@ -223,6 +223,8 @@ private:
void updateCursorPosition();
+ void reloadEditor(ScriptEditor *editor);
+
private slots:
void on_newfile();
void on_openfile();
diff --git a/src/grammar/NumCal/NumCal.g4 b/src/grammar/NumCal/NumCal.g4
index 6dc24e7..70af365 100644
--- a/src/grammar/NumCal/NumCal.g4
+++ b/src/grammar/NumCal/NumCal.g4
@@ -70,8 +70,8 @@ assignmentExpression
entryExpression
: prefixGoto? IntegerConstant EOF
| (prefixGoto Colon)? assignmentExpression EOF
- | (prefixGoto LeftBracket)? assignmentExpression RightBracket EOF
- | (prefixGoto LeftParen)? assignmentExpression RightParen EOF
+ | prefixGoto LeftBracket assignmentExpression RightBracket EOF
+ | prefixGoto LeftParen assignmentExpression RightParen EOF
;
prefixGoto
diff --git a/src/grammar/NumCal/NumCalParser.cpp b/src/grammar/NumCal/NumCalParser.cpp
index 83ee025..757a2f2 100644
--- a/src/grammar/NumCal/NumCalParser.cpp
+++ b/src/grammar/NumCal/NumCalParser.cpp
@@ -68,7 +68,7 @@ void numcalParserInitialize() {
}
);
static const int32_t serializedATNSegment[] = {
- 4,1,19,133,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,
+ 4,1,19,127,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,
7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,1,0,1,0,1,0,1,0,1,
0,3,0,32,8,0,1,1,1,1,1,1,1,1,3,1,38,8,1,1,2,1,2,1,3,1,3,3,3,44,8,3,1,
4,1,4,1,4,5,4,49,8,4,10,4,12,4,52,9,4,1,5,1,5,1,5,5,5,57,8,5,10,5,12,
@@ -76,39 +76,37 @@ void numcalParserInitialize() {
7,10,7,12,7,76,9,7,1,8,1,8,1,8,5,8,81,8,8,10,8,12,8,84,9,8,1,9,1,9,1,
9,5,9,89,8,9,10,9,12,9,92,9,9,1,10,1,10,3,10,96,8,10,1,11,3,11,99,8,11,
1,11,1,11,1,11,1,11,1,11,3,11,106,8,11,1,11,1,11,1,11,1,11,1,11,1,11,
- 3,11,114,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,123,8,11,1,11,1,
- 11,1,11,1,11,3,11,129,8,11,1,12,1,12,1,12,0,0,13,0,2,4,6,8,10,12,14,16,
- 18,20,22,24,0,5,2,0,5,6,13,13,1,0,7,9,1,0,5,6,1,0,3,4,2,0,5,6,14,14,136,
- 0,31,1,0,0,0,2,37,1,0,0,0,4,39,1,0,0,0,6,43,1,0,0,0,8,45,1,0,0,0,10,53,
- 1,0,0,0,12,61,1,0,0,0,14,69,1,0,0,0,16,77,1,0,0,0,18,85,1,0,0,0,20,95,
- 1,0,0,0,22,128,1,0,0,0,24,130,1,0,0,0,26,32,5,18,0,0,27,28,5,1,0,0,28,
- 29,3,20,10,0,29,30,5,2,0,0,30,32,1,0,0,0,31,26,1,0,0,0,31,27,1,0,0,0,
- 32,1,1,0,0,0,33,38,3,0,0,0,34,35,3,4,2,0,35,36,3,6,3,0,36,38,1,0,0,0,
- 37,33,1,0,0,0,37,34,1,0,0,0,38,3,1,0,0,0,39,40,7,0,0,0,40,5,1,0,0,0,41,
- 44,3,2,1,0,42,44,5,18,0,0,43,41,1,0,0,0,43,42,1,0,0,0,44,7,1,0,0,0,45,
- 50,3,6,3,0,46,47,7,1,0,0,47,49,3,6,3,0,48,46,1,0,0,0,49,52,1,0,0,0,50,
- 48,1,0,0,0,50,51,1,0,0,0,51,9,1,0,0,0,52,50,1,0,0,0,53,58,3,8,4,0,54,
- 55,7,2,0,0,55,57,3,8,4,0,56,54,1,0,0,0,57,60,1,0,0,0,58,56,1,0,0,0,58,
- 59,1,0,0,0,59,11,1,0,0,0,60,58,1,0,0,0,61,66,3,10,5,0,62,63,7,3,0,0,63,
- 65,3,10,5,0,64,62,1,0,0,0,65,68,1,0,0,0,66,64,1,0,0,0,66,67,1,0,0,0,67,
- 13,1,0,0,0,68,66,1,0,0,0,69,74,3,12,6,0,70,71,5,10,0,0,71,73,3,12,6,0,
- 72,70,1,0,0,0,73,76,1,0,0,0,74,72,1,0,0,0,74,75,1,0,0,0,75,15,1,0,0,0,
- 76,74,1,0,0,0,77,82,3,14,7,0,78,79,5,12,0,0,79,81,3,14,7,0,80,78,1,0,
- 0,0,81,84,1,0,0,0,82,80,1,0,0,0,82,83,1,0,0,0,83,17,1,0,0,0,84,82,1,0,
- 0,0,85,90,3,16,8,0,86,87,5,11,0,0,87,89,3,16,8,0,88,86,1,0,0,0,89,92,
- 1,0,0,0,90,88,1,0,0,0,90,91,1,0,0,0,91,19,1,0,0,0,92,90,1,0,0,0,93,96,
- 5,18,0,0,94,96,3,18,9,0,95,93,1,0,0,0,95,94,1,0,0,0,96,21,1,0,0,0,97,
- 99,3,24,12,0,98,97,1,0,0,0,98,99,1,0,0,0,99,100,1,0,0,0,100,101,5,18,
- 0,0,101,129,5,0,0,1,102,103,3,24,12,0,103,104,5,15,0,0,104,106,1,0,0,
- 0,105,102,1,0,0,0,105,106,1,0,0,0,106,107,1,0,0,0,107,108,3,20,10,0,108,
- 109,5,0,0,1,109,129,1,0,0,0,110,111,3,24,12,0,111,112,5,16,0,0,112,114,
- 1,0,0,0,113,110,1,0,0,0,113,114,1,0,0,0,114,115,1,0,0,0,115,116,3,20,
- 10,0,116,117,5,17,0,0,117,118,5,0,0,1,118,129,1,0,0,0,119,120,3,24,12,
- 0,120,121,5,1,0,0,121,123,1,0,0,0,122,119,1,0,0,0,122,123,1,0,0,0,123,
- 124,1,0,0,0,124,125,3,20,10,0,125,126,5,2,0,0,126,127,5,0,0,1,127,129,
- 1,0,0,0,128,98,1,0,0,0,128,105,1,0,0,0,128,113,1,0,0,0,128,122,1,0,0,
- 0,129,23,1,0,0,0,130,131,7,4,0,0,131,25,1,0,0,0,15,31,37,43,50,58,66,
- 74,82,90,95,98,105,113,122,128
+ 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,123,8,11,1,12,1,12,
+ 1,12,0,0,13,0,2,4,6,8,10,12,14,16,18,20,22,24,0,5,2,0,5,6,13,13,1,0,7,
+ 9,1,0,5,6,1,0,3,4,2,0,5,6,14,14,128,0,31,1,0,0,0,2,37,1,0,0,0,4,39,1,
+ 0,0,0,6,43,1,0,0,0,8,45,1,0,0,0,10,53,1,0,0,0,12,61,1,0,0,0,14,69,1,0,
+ 0,0,16,77,1,0,0,0,18,85,1,0,0,0,20,95,1,0,0,0,22,122,1,0,0,0,24,124,1,
+ 0,0,0,26,32,5,18,0,0,27,28,5,1,0,0,28,29,3,20,10,0,29,30,5,2,0,0,30,32,
+ 1,0,0,0,31,26,1,0,0,0,31,27,1,0,0,0,32,1,1,0,0,0,33,38,3,0,0,0,34,35,
+ 3,4,2,0,35,36,3,6,3,0,36,38,1,0,0,0,37,33,1,0,0,0,37,34,1,0,0,0,38,3,
+ 1,0,0,0,39,40,7,0,0,0,40,5,1,0,0,0,41,44,3,2,1,0,42,44,5,18,0,0,43,41,
+ 1,0,0,0,43,42,1,0,0,0,44,7,1,0,0,0,45,50,3,6,3,0,46,47,7,1,0,0,47,49,
+ 3,6,3,0,48,46,1,0,0,0,49,52,1,0,0,0,50,48,1,0,0,0,50,51,1,0,0,0,51,9,
+ 1,0,0,0,52,50,1,0,0,0,53,58,3,8,4,0,54,55,7,2,0,0,55,57,3,8,4,0,56,54,
+ 1,0,0,0,57,60,1,0,0,0,58,56,1,0,0,0,58,59,1,0,0,0,59,11,1,0,0,0,60,58,
+ 1,0,0,0,61,66,3,10,5,0,62,63,7,3,0,0,63,65,3,10,5,0,64,62,1,0,0,0,65,
+ 68,1,0,0,0,66,64,1,0,0,0,66,67,1,0,0,0,67,13,1,0,0,0,68,66,1,0,0,0,69,
+ 74,3,12,6,0,70,71,5,10,0,0,71,73,3,12,6,0,72,70,1,0,0,0,73,76,1,0,0,0,
+ 74,72,1,0,0,0,74,75,1,0,0,0,75,15,1,0,0,0,76,74,1,0,0,0,77,82,3,14,7,
+ 0,78,79,5,12,0,0,79,81,3,14,7,0,80,78,1,0,0,0,81,84,1,0,0,0,82,80,1,0,
+ 0,0,82,83,1,0,0,0,83,17,1,0,0,0,84,82,1,0,0,0,85,90,3,16,8,0,86,87,5,
+ 11,0,0,87,89,3,16,8,0,88,86,1,0,0,0,89,92,1,0,0,0,90,88,1,0,0,0,90,91,
+ 1,0,0,0,91,19,1,0,0,0,92,90,1,0,0,0,93,96,5,18,0,0,94,96,3,18,9,0,95,
+ 93,1,0,0,0,95,94,1,0,0,0,96,21,1,0,0,0,97,99,3,24,12,0,98,97,1,0,0,0,
+ 98,99,1,0,0,0,99,100,1,0,0,0,100,101,5,18,0,0,101,123,5,0,0,1,102,103,
+ 3,24,12,0,103,104,5,15,0,0,104,106,1,0,0,0,105,102,1,0,0,0,105,106,1,
+ 0,0,0,106,107,1,0,0,0,107,108,3,20,10,0,108,109,5,0,0,1,109,123,1,0,0,
+ 0,110,111,3,24,12,0,111,112,5,16,0,0,112,113,3,20,10,0,113,114,5,17,0,
+ 0,114,115,5,0,0,1,115,123,1,0,0,0,116,117,3,24,12,0,117,118,5,1,0,0,118,
+ 119,3,20,10,0,119,120,5,2,0,0,120,121,5,0,0,1,121,123,1,0,0,0,122,98,
+ 1,0,0,0,122,105,1,0,0,0,122,110,1,0,0,0,122,116,1,0,0,0,123,23,1,0,0,
+ 0,124,125,7,4,0,0,125,25,1,0,0,0,13,31,37,43,50,58,66,74,82,90,95,98,
+ 105,122
};
staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0]));
@@ -1057,22 +1055,22 @@ tree::TerminalNode* NumCalParser::EntryExpressionContext::Colon() {
return getToken(NumCalParser::Colon, 0);
}
-tree::TerminalNode* NumCalParser::EntryExpressionContext::RightBracket() {
- return getToken(NumCalParser::RightBracket, 0);
-}
-
tree::TerminalNode* NumCalParser::EntryExpressionContext::LeftBracket() {
return getToken(NumCalParser::LeftBracket, 0);
}
-tree::TerminalNode* NumCalParser::EntryExpressionContext::RightParen() {
- return getToken(NumCalParser::RightParen, 0);
+tree::TerminalNode* NumCalParser::EntryExpressionContext::RightBracket() {
+ return getToken(NumCalParser::RightBracket, 0);
}
tree::TerminalNode* NumCalParser::EntryExpressionContext::LeftParen() {
return getToken(NumCalParser::LeftParen, 0);
}
+tree::TerminalNode* NumCalParser::EntryExpressionContext::RightParen() {
+ return getToken(NumCalParser::RightParen, 0);
+}
+
size_t NumCalParser::EntryExpressionContext::getRuleIndex() const {
return NumCalParser::RuleEntryExpression;
@@ -1099,9 +1097,9 @@ NumCalParser::EntryExpressionContext* NumCalParser::entryExpression() {
exitRule();
});
try {
- setState(128);
+ setState(122);
_errHandler->sync(this);
- switch (getInterpreter()->adaptivePredict(_input, 14, _ctx)) {
+ switch (getInterpreter()->adaptivePredict(_input, 12, _ctx)) {
case 1: {
enterOuterAlt(_localctx, 1);
setState(98);
@@ -1146,52 +1144,30 @@ NumCalParser::EntryExpressionContext* NumCalParser::entryExpression() {
case 3: {
enterOuterAlt(_localctx, 3);
- setState(113);
- _errHandler->sync(this);
-
- switch (getInterpreter()->adaptivePredict(_input, 12, _ctx)) {
- case 1: {
- setState(110);
- prefixGoto();
- setState(111);
- match(NumCalParser::LeftBracket);
- break;
- }
-
- default:
- break;
- }
- setState(115);
+ setState(110);
+ prefixGoto();
+ setState(111);
+ match(NumCalParser::LeftBracket);
+ setState(112);
assignmentExpression();
- setState(116);
+ setState(113);
match(NumCalParser::RightBracket);
- setState(117);
+ setState(114);
match(NumCalParser::EOF);
break;
}
case 4: {
enterOuterAlt(_localctx, 4);
- setState(122);
- _errHandler->sync(this);
-
- switch (getInterpreter()->adaptivePredict(_input, 13, _ctx)) {
- case 1: {
- setState(119);
- prefixGoto();
- setState(120);
- match(NumCalParser::LeftParen);
- break;
- }
-
- default:
- break;
- }
- setState(124);
+ setState(116);
+ prefixGoto();
+ setState(117);
+ match(NumCalParser::LeftParen);
+ setState(118);
assignmentExpression();
- setState(125);
+ setState(119);
match(NumCalParser::RightParen);
- setState(126);
+ setState(120);
match(NumCalParser::EOF);
break;
}
@@ -1255,7 +1231,7 @@ NumCalParser::PrefixGotoContext* NumCalParser::prefixGoto() {
});
try {
enterOuterAlt(_localctx, 1);
- setState(130);
+ setState(124);
_la = _input->LA(1);
if (!((((_la & ~ 0x3fULL) == 0) &&
((1ULL << _la) & 16480) != 0))) {
diff --git a/src/grammar/NumCal/NumCalParser.h b/src/grammar/NumCal/NumCalParser.h
index a7963b5..dd67f87 100644
--- a/src/grammar/NumCal/NumCalParser.h
+++ b/src/grammar/NumCal/NumCalParser.h
@@ -244,10 +244,10 @@ public:
PrefixGotoContext *prefixGoto();
AssignmentExpressionContext *assignmentExpression();
antlr4::tree::TerminalNode *Colon();
- antlr4::tree::TerminalNode *RightBracket();
antlr4::tree::TerminalNode *LeftBracket();
- antlr4::tree::TerminalNode *RightParen();
+ antlr4::tree::TerminalNode *RightBracket();
antlr4::tree::TerminalNode *LeftParen();
+ antlr4::tree::TerminalNode *RightParen();
virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override;