feat: 重构插件系统的撤销机制;优化历史记录机制;完善本地化;

This commit is contained in:
寂静的羽夏 2025-01-19 20:43:44 +08:00
parent 3e75b23329
commit a22e1f8f00
25 changed files with 1093 additions and 728 deletions

View File

@ -176,7 +176,7 @@ QHexView::QHexView(QWidget *parent)
QHexDocument::fromMemory<QMemoryBuffer>(QByteArray(), false)));
}
QHexView::~QHexView() {}
QHexView::~QHexView() { m_blinktimer->stop(); }
QSharedPointer<QHexDocument> QHexView::document() { return m_document; }

View File

@ -121,31 +121,12 @@ void QtSingleApplication::sysInit(const QString &appId) {
}
/*!
Creates a QtSingleApplication object. The application identifier
will be QCoreApplication::applicationFilePath(). \a argc, \a
argv, and \a GUIenabled are passed on to the QAppliation constructor.
If you are creating a console application (i.e. setting \a
GUIenabled to false), you may consider using
QtSingleCoreApplication instead.
Creates a QtSingleApplication object.
*/
QtSingleApplication::QtSingleApplication(int &argc, char **argv,
bool GUIenabled)
: QApplication(argc, argv, GUIenabled) {
sysInit(genBlockServerName());
}
/*!
Creates a QtSingleApplication object with the application
identifier \a appId. \a argc and \a argv are passed on to the
QAppliation constructor.
*/
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc,
char **argv)
QtSingleApplication::QtSingleApplication(int &argc, char **argv)
: QApplication(argc, argv) {
sysInit(appId);
sysInit(genBlockServerName());
}
/*!

View File

@ -12,9 +12,7 @@ class QtSingleApplication : public QApplication {
Q_OBJECT
public:
explicit QtSingleApplication(int &argc, char **argv,
bool GUIenabled = true);
explicit QtSingleApplication(const QString &id, int &argc, char **argv);
explicit QtSingleApplication(int &argc, char **argv);
public:
bool isRunning();

View File

@ -14,7 +14,6 @@
- [有关仓库](#有关仓库)
- [WIKI](#wiki)
- [插件库](#插件库)
- [应用商店](#应用商店)
---
@ -33,7 +32,6 @@
<p align="center">
<img src="https://github.com/Wing-summer/WingHexExplorer2/actions/workflows/clang-format-check.yml/badge.svg" />
<img src="https://github.com/Wing-summer/WingHexExplorer2/actions/workflows/cmake-format-check.yml/badge.svg" />
<img src="https://github.com/Wing-summer/WingHexExplorer2/actions/workflows/conventional-commit-check-push.yml/badge.svg" />
</p>
- 开源不易,给个 Star 或者 [捐助](#捐助) 吧
@ -95,6 +93,10 @@
> 对于 Qt 5 版本,仅支持 5.15.2 或更高版本Qt 6 的话 6.6.2 或更高的版本,其他低版本由于关键库的 API 缺失和自身的一些 Bug所以不提供支持。
另外:
> QT5 版本主动编译支持将会在 2025/05/26 停止,届时相关 GitAction 自动化测试将会撤销。如果因特殊需要 QT5 版本,请咨询我商业合作和付费技术支持。
&emsp;&emsp;该仓库代码使用 Qt 5.15.2 和 6.6.2 在最新版 Windows 和 Ubuntu 编译情况: ![Status](https://github.com/Wing-summer/WingHexExplorer2/actions/workflows/qt-build-test.yml/badge.svg)
## WingHexExplorer2
@ -107,7 +109,7 @@
&emsp;&emsp;如果你想将本软件的代码用于闭源的商业代码,想要解除`GPL`系列的必须开源的限制,请必须亲自咨询我,商讨商业授权相关事宜。
&emsp;&emsp;对于插件开发相关的,对应的开源协议就不一样了。只针对本仓库下的`src/plugin/iwingplugin.h`和`src/plugin/settingpage.h`遵守`BSD 3-Clause`协议,以允许想要做闭源和商业开发。对于本仓库下的`TestPlugin`的代码(除`TranslationUtils.cmake`这一个文件遵守`BSD 3-Clause`)遵守`MIT`协议。
&emsp;&emsp;对于插件开发相关的,对应的开源协议就不一样了。只针对本仓库下的`src/plugin/iwingplugin.h`、`src/plugin/iwingpluginbase.h`、`src/plugin/iwingdevice.h`和`src/plugin/settingpage.h`遵守`BSD 3-Clause`协议,以允许想要做闭源和商业开发。对于本仓库下的`TestPlugin`的代码(除`TranslationUtils.cmake`这一个文件遵守`BSD 3-Clause`)遵守`MIT`协议。
### 使用声明
@ -176,8 +178,5 @@
## 插件库
> 敬请期待
## 应用商店
> 敬请期待
- [WingAsm](https://github.com/Wing-summer/WingAsm) : 一个提供汇编和反汇编的插件,作者 **寂静的羽夏** ,协议 **APGL-v3.0**
- [WingCStruct](https://github.com/Wing-summer/WingCStruct) : 一个提供分析文件结构基础支持的插件,作者 **寂静的羽夏** ,协议 **APGL-v3.0**

View File

@ -14,7 +14,6 @@
- [Related Repository](#related-repository)
- [WIKI](#wiki)
- [Plugins](#plugins)
- [App Store](#app-store)
---
@ -33,7 +32,6 @@
<p align="center">
<img src="https://github.com/Wing-summer/WingHexExplorer2/actions/workflows/clang-format-check.yml/badge.svg" />
<img src="https://github.com/Wing-summer/WingHexExplorer2/actions/workflows/cmake-format-check.yml/badge.svg" />
<img src="https://github.com/Wing-summer/WingHexExplorer2/actions/workflows/conventional-commit-check-push.yml/badge.svg" />
</p>
- Not easy to open source, please Star or [Donate](#donate)
@ -95,6 +93,10 @@ Make sure that you follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) while contrib
> For Qt 5, only version 5.15.2 or higher is supported, and for Qt 6, only version 6.6.2 or higher is supported. Other lower versions are not supported due to missing APIs of key libraries and some bugs of their own.
And also:
> Active compilation support for QT5 will be discontinued on 2025/05/26, and the related GitAction automated tests will be revoked at that time. 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: ![Status](https://github.com/Wing-summer/WingHexExplorer2/actions/workflows/qt-build-test.yml/badge.svg)
## WingHexExplorer2
@ -107,7 +109,7 @@ This software complies with the `AGPL-3.0` agreement. Please do not use it for p
If you want to use the code of this software for closed-source commercial code and want to lift the restriction of the `GPL` series that it must be open source, please consult me in person to discuss commercial licensing matters.
For plugin development, the corresponding open source agreements are different. Only `src/plugin/iwingplugin.h` and `src/plugin/settingpage.h` in this repository comply with the `BSD 3-Clause` agreement to allow closed-source and commercial development. The code of `TestPlugin` in this repository (except the file `TranslationUtils.cmake` which complies with `BSD 3-Clause`) complies with the `MIT` agreement.
For plugin development, the corresponding open source agreements are different. Only `src/plugin/iwingplugin.h`, `src/plugin/iwingpluginbase.h`, `src/plugin/iwingdevice.h` and `src/plugin/settingpage.h` in this repository comply with the `BSD 3-Clause` agreement to allow closed-source and commercial development. The code of `TestPlugin` in this repository (except the file `TranslationUtils.cmake` which complies with `BSD 3-Clause`) complies with the `MIT` agreement.
### Usage Statement
@ -169,7 +171,7 @@ Of course, there are other repositories as mirror for Chinese users (which will
- Gitee<https://gitee.com/wing-cloud/WingHexExplorer2>
- Gitlink<https://www.gitlink.org.cn/wingsummer/WingHexExplorer2>
- GitCodeI don't consider it, because "stealing code".
- GitCodeI don't consider it, because of "stealing code".
## WIKI
@ -177,8 +179,5 @@ Of course, there are other repositories as mirror for Chinese users (which will
## Plugins
> Stay tuned
## App Store
> Stay tuned
- [WingAsm](https://github.com/Wing-summer/WingAsm) : A plugin that provides assembly and disassembly features. Author: **wingsummer**. License: **APGL-v3.0**.
- [WingCStruct](https://github.com/Wing-summer/WingCStruct) : A plugin that provides basic support for analyzing file structures. Author: **wingsummer**. License: **APGL-v3.0**.

View File

@ -128,7 +128,7 @@
<message>
<location filename="../testform.ui" line="97"/>
<location filename="../testform.ui" line="194"/>
<location filename="../testform.ui" line="693"/>
<location filename="../testform.ui" line="842"/>
<source>Text</source>
<translation> </translation>
</message>
@ -143,8 +143,8 @@
<location filename="../testform.ui" line="228"/>
<location filename="../testform.ui" line="293"/>
<location filename="../testform.ui" line="444"/>
<location filename="../testform.ui" line="983"/>
<location filename="../testform.ui" line="1144"/>
<location filename="../testform.ui" line="1132"/>
<location filename="../testform.ui" line="1293"/>
<source>Clear</source>
<translation></translation>
</message>
@ -155,7 +155,7 @@
</message>
<message>
<location filename="../testform.ui" line="184"/>
<location filename="../testform.ui" line="730"/>
<location filename="../testform.ui" line="879"/>
<source>Icon</source>
<translation></translation>
</message>
@ -200,48 +200,89 @@
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="626"/>
<location filename="../testform.ui" line="635"/>
<source>begin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../testform.ui" line="645"/>
<source>length</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../testform.ui" line="655"/>
<source>foreground</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../testform.ui" line="665"/>
<source>background</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../testform.ui" line="675"/>
<source>comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../testform.ui" line="693"/>
<location filename="../testform.ui" line="759"/>
<source>Apply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../testform.ui" line="714"/>
<source>BookMark</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="631"/>
<location filename="../testform.ui" line="662"/>
<location filename="../testform.ui" line="731"/>
<source>Position</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../testform.ui" line="741"/>
<source>Comment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../testform.ui" line="780"/>
<location filename="../testform.ui" line="811"/>
<source>MessageBox</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="639"/>
<location filename="../testform.ui" line="676"/>
<location filename="../testform.ui" line="853"/>
<location filename="../testform.ui" line="788"/>
<location filename="../testform.ui" line="825"/>
<location filename="../testform.ui" line="1002"/>
<source>Title</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="710"/>
<location filename="../testform.ui" line="859"/>
<source>Buttons</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="720"/>
<location filename="../testform.ui" line="869"/>
<source>DefaultButton</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="831"/>
<location filename="../testform.ui" line="980"/>
<source>InputBox</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="846"/>
<location filename="../testform.ui" line="995"/>
<source>Label</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="311"/>
<location filename="../testform.ui" line="882"/>
<location filename="../testform.ui" line="1056"/>
<location filename="../testform.ui" line="1245"/>
<location filename="../testform.ui" line="1031"/>
<location filename="../testform.ui" line="1205"/>
<location filename="../testform.ui" line="1394"/>
<source>Type</source>
<translation></translation>
</message>
@ -251,64 +292,64 @@
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="995"/>
<location filename="../testform.ui" line="1144"/>
<source>FileDialog</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="1010"/>
<location filename="../testform.ui" line="1159"/>
<source>Filter</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="1017"/>
<location filename="../testform.ui" line="1170"/>
<location filename="../testform.ui" line="1166"/>
<location filename="../testform.ui" line="1319"/>
<source>Caption</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="1038"/>
<location filename="../testform.ui" line="1187"/>
<source>Options</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="1156"/>
<location filename="../testform.ui" line="1305"/>
<source>ColorDialog</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="1184"/>
<location filename="../testform.ui" line="1333"/>
<source>Color</source>
<translation></translation>
</message>
<message>
<location filename="../testform.ui" line="1230"/>
<location filename="../testform.ui" line="1379"/>
<source>DataVisual</source>
<translation></translation>
</message>
<message>
<location filename="../testform.cpp" line="348"/>
<location filename="../testform.cpp" line="359"/>
<location filename="../testform.cpp" line="350"/>
<location filename="../testform.cpp" line="361"/>
<source>UpdateTextTreeError</source>
<translation></translation>
</message>
<message>
<location filename="../testform.cpp" line="374"/>
<location filename="../testform.cpp" line="376"/>
<source>UpdateTextListByModelError</source>
<translation></translation>
</message>
<message>
<location filename="../testform.cpp" line="384"/>
<location filename="../testform.cpp" line="386"/>
<source>UpdateTextTableByModelError</source>
<translation></translation>
</message>
<message>
<location filename="../testform.cpp" line="395"/>
<location filename="../testform.cpp" line="397"/>
<source>UpdateTextTreeByModelError</source>
<translation></translation>
</message>
<message>
<location filename="../testform.cpp" line="496"/>
<location filename="../testform.cpp" line="498"/>
<source>Choose</source>
<translation></translation>
</message>

View File

@ -53,6 +53,8 @@ TestForm::TestForm(WingHex::IWingPlugin *plg, QWidget *parent)
initFileDialogOps();
initFileHandleListWidget();
ui->sbposition->setRange(0, INT_MAX);
_click = std::bind(&TestForm::onDVClicked, this, std::placeholders::_1);
_dblclick =
std::bind(&TestForm::onDVDoubleClicked, this, std::placeholders::_1);
@ -532,3 +534,13 @@ void TestForm::on_btnCloseFile_clicked() {
e.valueToKey(ret));
}
}
void TestForm::on_btnApplyBookMark_clicked() {
if (emit _plg->reader.existBookMark(ui->sbposition->value())) {
Q_UNUSED(emit _plg->controller.modBookMark(ui->sbposition->value(),
ui->lecomment->text()));
} else {
Q_UNUSED(emit _plg->controller.addBookMark(ui->sbposition->value(),
ui->lecomment->text()));
}
}

View File

@ -125,6 +125,8 @@ private slots:
void on_btnCloseFile_clicked();
void on_btnApplyBookMark_clicked();
private:
void initLogCombo();

View File

@ -620,11 +620,160 @@
<attribute name="title">
<string>Metadata</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_26">
<item>
<layout class="QFormLayout" name="formLayout_8">
<property name="horizontalSpacing">
<number>8</number>
</property>
<property name="verticalSpacing">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="beginLabel">
<property name="text">
<string>begin</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="sbbegin"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lengthLabel">
<property name="text">
<string>length</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="sbmlength"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="foregroundLabel">
<property name="text">
<string>foreground</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="wforeground" native="true"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="backgroundLabel">
<property name="text">
<string>background</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QWidget" name="wbackground" native="true"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="commentLabel_2">
<property name="text">
<string>comment</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lemcomment"/>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btnApplyMeta">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>169</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_11">
<attribute name="title">
<string>BookMark</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_25">
<property name="spacing">
<number>8</number>
</property>
<item>
<layout class="QFormLayout" name="formLayout_4">
<property name="horizontalSpacing">
<number>8</number>
</property>
<property name="verticalSpacing">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="positionLabel">
<property name="text">
<string>Position</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="sbposition"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="commentLabel">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lecomment"/>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btnApplyBookMark">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>245</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">

BIN
images/openapp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -76,20 +76,30 @@
<context>
<name>AppManager</name>
<message>
<location filename="../../src/class/appmanager.cpp" line="66"/>
<location filename="../../src/class/appmanager.cpp" line="67"/>
<source>GenericCallNotFullySupported</source>
<translation>退</translation>
</message>
<message>
<location filename="../../src/class/appmanager.cpp" line="84"/>
<location filename="../../src/class/appmanager.cpp" line="85"/>
<source>SetupClang</source>
<translation> Clang </translation>
</message>
<message>
<location filename="../../src/class/appmanager.cpp" line="115"/>
<location filename="../../src/class/appmanager.cpp" line="116"/>
<source>OpeningFiles</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/appmanager.cpp" line="163"/>
<location filename="../../src/class/appmanager.cpp" line="173"/>
<location filename="../../src/class/appmanager.cpp" line="190"/>
<location filename="../../src/class/appmanager.cpp" line="206"/>
<location filename="../../src/class/appmanager.cpp" line="224"/>
<location filename="../../src/class/appmanager.cpp" line="240"/>
<source>AlreadyOpened</source>
<translation></translation>
</message>
</context>
<context>
<name>BookMarksModel</name>
@ -272,7 +282,7 @@
<message>
<location filename="../../src/dialog/driverselectordialog.cpp" line="52"/>
<source>DriverTips</source>
<translation>*_*</translation>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/driverselectordialog.cpp" line="72"/>
@ -793,57 +803,57 @@
<context>
<name>Logger</name>
<message>
<location filename="../../src/class/logger.cpp" line="94"/>
<location filename="../../src/class/logger.cpp" line="96"/>
<source>[Trace]</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="102"/>
<location filename="../../src/class/logger.cpp" line="104"/>
<source>[Warn]</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="110"/>
<location filename="../../src/class/logger.cpp" line="112"/>
<source>[Info]</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="117"/>
<location filename="../../src/class/logger.cpp" line="119"/>
<source>[Debug]</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="125"/>
<location filename="../../src/class/logger.cpp" line="127"/>
<source>[Error]</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="134"/>
<location filename="../../src/class/logger.cpp" line="136"/>
<source>Critial</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="136"/>
<location filename="../../src/class/logger.cpp" line="138"/>
<source>Error</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="138"/>
<location filename="../../src/class/logger.cpp" line="140"/>
<source>Warning</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="140"/>
<location filename="../../src/class/logger.cpp" line="142"/>
<source>Info</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="142"/>
<location filename="../../src/class/logger.cpp" line="144"/>
<source>Debug</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/logger.cpp" line="144"/>
<location filename="../../src/class/logger.cpp" line="146"/>
<source>Trace</source>
<translation></translation>
</message>
@ -895,7 +905,7 @@
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="280"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1476"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1601"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1603"/>
<source>Plugin</source>
<translation></translation>
</message>
@ -906,7 +916,7 @@
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="482"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1567"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1569"/>
<source>Log</source>
<translation></translation>
</message>
@ -943,8 +953,8 @@
<location filename="../../src/dialog/mainwindow.cpp" line="894"/>
<location filename="../../src/dialog/mainwindow.cpp" line="962"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1034"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2129"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2314"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2131"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2316"/>
<source>CopyToClipBoard</source>
<translation></translation>
</message>
@ -984,8 +994,8 @@
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="734"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1305"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2392"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2400"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2394"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2402"/>
<source>BookMark</source>
<translation></translation>
</message>
@ -1025,7 +1035,7 @@
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1178"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1579"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1581"/>
<source>Basic</source>
<translation></translation>
</message>
@ -1087,9 +1097,9 @@
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1242"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1599"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1622"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1601"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1624"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1626"/>
<source>General</source>
<translation></translation>
</message>
@ -1172,7 +1182,7 @@
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1295"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2335"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2337"/>
<source>Fill</source>
<translation></translation>
</message>
@ -1484,99 +1494,99 @@
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1559"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1562"/>
<source>RestoreLayout</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1563"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2811"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1565"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2815"/>
<source>SaveLayout</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1568"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1570"/>
<source>ExportLog</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1570"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1572"/>
<source>ClearLog</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1580"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1582"/>
<source>ScriptEditor</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1585"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1587"/>
<source>Scripts</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1607"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1609"/>
<source>PluginFunctions</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1630"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1632"/>
<source>ScriptSetting</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1636"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1638"/>
<source>PluginSettings</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1646"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1648"/>
<source>Info</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1648"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1650"/>
<source>Software</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1651"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1653"/>
<source>Sponsor</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1660"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1662"/>
<source>CheckUpdate</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1654"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1656"/>
<source>Wiki</source>
<translation> Wiki</translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1657"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1659"/>
<source>AboutQT</source>
<translation> QT</translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1734"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1736"/>
<source>SetPageIDEmptyTryUseName</source>
<translation> ID 使 ID</translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1742"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1744"/>
<source>SetPageDupNameIgnored</source>
<translation> ID </translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1776"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1778"/>
<source>Plugin %1 contains a duplicate ID (%2) that is already registered by plugin %3</source>
<translation> %1 ID (%2) ID %3 </translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1818"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1869"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1820"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1871"/>
<source>ChooseFile</source>
<translation></translation>
</message>
@ -1586,29 +1596,29 @@
<location filename="../../src/dialog/mainwindow.cpp" line="1081"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1091"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1153"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1824"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1828"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1851"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1855"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1876"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1880"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1900"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1906"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1910"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1935"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1961"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2024"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2063"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2960"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3194"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1826"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1830"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1853"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1857"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1878"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1882"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1902"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1908"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1912"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1937"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1963"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2026"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2065"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2975"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3209"/>
<source>Error</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1824"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1851"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1876"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1906"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1826"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1853"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1878"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1908"/>
<source>FileNotExist</source>
<translation></translation>
</message>
@ -1618,31 +1628,31 @@
<location filename="../../src/dialog/mainwindow.cpp" line="1082"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1092"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1154"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1828"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1855"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1880"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1910"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1961"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1830"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1857"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1882"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1912"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1963"/>
<source>FilePermission</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1869"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1871"/>
<source>ProjectFile (*.wingpro)</source>
<translation> (*.wingpro)</translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1900"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1902"/>
<source>Root Required!</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1931"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1933"/>
<source>ReloadSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1935"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1937"/>
<source>ReloadUnSuccessfully</source>
<translation></translation>
</message>
@ -1651,49 +1661,49 @@
<location filename="../../src/dialog/mainwindow.cpp" line="975"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1048"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1145"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1991"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2074"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2600"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1993"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2076"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2602"/>
<source>ChooseSaveFile</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2160"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2162"/>
<source>NoMoreClone</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2202"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2204"/>
<source>FindFininishBusy</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2206"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2208"/>
<source>MayTooMuchFindResult</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2819"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2834"/>
<source>SaveLayoutSuccess</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2822"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2837"/>
<source>SaveLayoutError</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="3550"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3565"/>
<source>ConfirmSave</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="3569"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3584"/>
<source>Column %1</source>
<translation> %1</translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="3617"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3632"/>
<source>ConfirmAPPSave</source>
<translation></translation>
</message>
@ -1702,21 +1712,21 @@
<location filename="../../src/dialog/mainwindow.cpp" line="998"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1124"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1161"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1982"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2003"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1984"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2005"/>
<source>SaveSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1977"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2008"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1979"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2010"/>
<source>SaveWSError</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1965"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2012"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2051"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1967"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2014"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2053"/>
<source>Warn</source>
<translation></translation>
</message>
@ -1726,173 +1736,178 @@
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1965"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2012"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2051"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1967"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2014"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2053"/>
<source>SourceChanged</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="1972"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2019"/>
<location filename="../../src/dialog/mainwindow.cpp" line="1974"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2021"/>
<source>SaveSourceFileError</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2024"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2026"/>
<source>SaveUnSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2037"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2039"/>
<source>ChooseExportFile</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2047"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2049"/>
<source>ExportSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2058"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2060"/>
<source>ExportSourceFileError</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2063"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2065"/>
<source>ExportUnSuccessfully</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2085"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2087"/>
<source>SaveSelSuccess</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2088"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2090"/>
<source>SaveSelError</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2115"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2300"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2117"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2302"/>
<source>CutToClipBoard</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2118"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2303"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2120"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2305"/>
<source>UnCutToClipBoard</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2132"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2317"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2134"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2319"/>
<source>UnCopyToClipBoard</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2198"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2200"/>
<source>FindFininish</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2335"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2337"/>
<source>PleaseInputFill</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2354"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2356"/>
<source>FillInputError</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2392"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2400"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2394"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2402"/>
<source>InputComment</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2455"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2496"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3050"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2457"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2498"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3065"/>
<source>NoSelection</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2492"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2494"/>
<source>NoMetaData</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2587"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2596"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2589"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2598"/>
<source>EmptyFindResult</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2641"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2643"/>
<source>SaveFindResult</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2645"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2647"/>
<source>SaveFindResultError</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2784"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2786"/>
<source>TooManyBytesDecode</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2831"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2815"/>
<source>PleaseInput</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2846"/>
<source>ExportLogError</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2834"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2849"/>
<source>ExportLogSuccess</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2842"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2857"/>
<source>ClearLogSuccess</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2898"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2913"/>
<source>BadNetwork</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2903"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2918"/>
<source>NewestVersion</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="314"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2900"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2915"/>
<source>OlderVersion</source>
<translation>使 Github Gitee </translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2906"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2921"/>
<source>CheckingUpdate</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="2961"/>
<location filename="../../src/dialog/mainwindow.cpp" line="2976"/>
<source>Too much opened files</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="3121"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3136"/>
<source>CopyLimit</source>
<translation></translation>
</message>
<message>
<location filename="../../src/dialog/mainwindow.cpp" line="3195"/>
<location filename="../../src/dialog/mainwindow.cpp" line="3210"/>
<source>ErrOpenFileBelow</source>
<translation></translation>
</message>
@ -2077,12 +2092,12 @@
<message>
<location filename="../../src/settings/pluginsettingdialog.ui" line="132"/>
<source>DevExtInfo</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.ui" line="148"/>
<source>DevExt:</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="87"/>
@ -2093,64 +2108,64 @@
<location filename="../../src/settings/pluginsettingdialog.cpp" line="115"/>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="135"/>
<source>ID</source>
<translation type="unfinished"></translation>
<translation>ID</translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="116"/>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="136"/>
<source>Name</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="117"/>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="137"/>
<source>License</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="118"/>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="138"/>
<source>Author</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="119"/>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="139"/>
<source>Vendor</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="120"/>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="140"/>
<source>Version</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="121"/>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="141"/>
<source>Comment</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="122"/>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="150"/>
<source>URL</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="143"/>
<source>pluginDependencies:</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="145"/>
<source>PUID:</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/settings/pluginsettingdialog.cpp" line="146"/>
<source>Version:</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -2163,160 +2178,160 @@
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="102"/>
<source>InvalidPluginBrokenInfo</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="578"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="604"/>
<source>FoundDrvPluginCount</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="618"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="644"/>
<source>RegisteredFnDup</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="828"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="854"/>
<source>ErrLoadPluginSign</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="832"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="858"/>
<source>ErrLoadPluginSDKVersion</source>
<translation> SDK </translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="836"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="862"/>
<source>ErrLoadPluginNoName</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="857"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="887"/>
<source>ErrLoadInitPlugin</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="864"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="894"/>
<source>PluginName :</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="865"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="895"/>
<source>PluginAuthor :</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="866"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="896"/>
<source>PluginWidgetRegister</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="968"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1000"/>
<source>ErrLoadExtPluginSign</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="972"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1004"/>
<source>ErrLoadExtPluginSDKVersion</source>
<translation> SDK </translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="976"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1008"/>
<source>ErrLoadExtPluginNoName</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="979"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1011"/>
<source>ExtPluginName :</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="980"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1012"/>
<source>ExtPluginAuthor :</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="981"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1013"/>
<source>ExtPluginWidgetRegister</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="997"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1032"/>
<source>ErrLoadInitExtPlugin</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="1064"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1099"/>
<source>EmptyNameDockWidget:</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="1074"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1109"/>
<source>InvalidNameDockWidget:</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="1082"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1117"/>
<source>InvalidNullDockWidget:</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="1222"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="1257"/>
<source>[EvilCall]</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="2815"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="2800"/>
<source>Not allowed operation in non-UI thread</source>
<translation> UI 线</translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="600"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="626"/>
<source>UnsafePluginDir</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="109"/>
<source>InvalidPluginID</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="112"/>
<source>InvalidDupPlugin</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="516"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="540"/>
<source>FoundPluginCount</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="543"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="567"/>
<source>PluginLoadingFailedSummary</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="546"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="571"/>
<source>- PluginName:</source>
<translation>- </translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="547"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="572"/>
<source>- Dependencies:</source>
<translation>- </translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="549"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="574"/>
<source>PUID:</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="550"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="575"/>
<source>Version:</source>
<translation></translation>
</message>
<message>
<location filename="../../src/plugin/pluginsystem.cpp" line="557"/>
<location filename="../../src/plugin/pluginsystem.cpp" line="582"/>
<source>PluginLoadingFinished</source>
<translation></translation>
</message>
@ -2994,7 +3009,7 @@ Do you wish to keep up to date by reloading the file?</source>
</message>
<message>
<location filename="../../src/class/recentfilemanager.cpp" line="50"/>
<location filename="../../src/class/recentfilemanager.cpp" line="190"/>
<location filename="../../src/class/recentfilemanager.cpp" line="209"/>
<source>NoHistoryDel</source>
<translation></translation>
</message>
@ -3039,12 +3054,12 @@ Do you wish to keep up to date by reloading the file?</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/recentfilemanager.cpp" line="166"/>
<location filename="../../src/class/recentfilemanager.cpp" line="185"/>
<source>FileNotExistClean</source>
<translation></translation>
</message>
<message>
<location filename="../../src/class/recentfilemanager.cpp" line="200"/>
<location filename="../../src/class/recentfilemanager.cpp" line="219"/>
<source>HistoryClearFinished</source>
<translation></translation>
</message>

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@
<file>images/metashow.png</file>
<file>images/new.png</file>
<file>images/open.png</file>
<file>images/openapp.png</file>
<file>images/opendriver.png</file>
<file>images/openother.png</file>
<file>images/openr.png</file>

View File

@ -23,6 +23,7 @@
#include "QConsoleWidget/commandhistorymanager.h"
#include "angelscript.h"
#include "clangformatmanager.h"
#include "control/toast.h"
#include "dbghelper.h"
#include "define.h"
#include "dialog/mainwindow.h"
@ -157,12 +158,23 @@ void AppManager::openFile(const QString &file, bool autoDetect, qsizetype start,
}
if (ret == ErrFile::AlreadyOpened) {
Q_ASSERT(editor);
editor->raise();
if (_w->currentEditor() == editor) {
Toast::toast(_w, NAMEICONRES("openapp"),
tr("AlreadyOpened"));
} else {
editor->raise();
}
editor->setFocus();
}
} else if (ret == ErrFile::AlreadyOpened) {
Q_ASSERT(editor);
editor->raise();
if (_w->currentEditor() == editor) {
Toast::toast(_w, NAMEICONRES("openapp"), tr("AlreadyOpened"));
} else {
editor->raise();
}
editor->setFocus();
}
}
@ -174,7 +186,12 @@ void AppManager::openRawFile(const QString &file) {
auto ret = _w->openFile(file, &editor);
if (ret == ErrFile::AlreadyOpened) {
Q_ASSERT(editor);
editor->raise();
if (_w->currentEditor() == editor) {
Toast::toast(_w, NAMEICONRES("openapp"), tr("AlreadyOpened"));
} else {
editor->raise();
}
editor->setFocus();
}
}
@ -185,7 +202,12 @@ void AppManager::openDriver(const QString &driver) {
auto ret = _w->openDriver(driver, &editor);
if (ret == ErrFile::AlreadyOpened) {
Q_ASSERT(editor);
editor->raise();
if (_w->currentEditor() == editor) {
Toast::toast(_w, NAMEICONRES("openapp"), tr("AlreadyOpened"));
} else {
editor->raise();
}
editor->setFocus();
}
}
@ -198,7 +220,12 @@ void AppManager::openRegionFile(const QString &region, qsizetype start,
auto ret = _w->openRegionFile(region, &editor, start, length);
if (ret == ErrFile::AlreadyOpened) {
Q_ASSERT(editor);
editor->raise();
if (_w->currentEditor() == editor) {
Toast::toast(_w, NAMEICONRES("openapp"), tr("AlreadyOpened"));
} else {
editor->raise();
}
editor->setFocus();
}
}
@ -209,7 +236,12 @@ void AppManager::openWorkSpace(const QString &ws) {
auto ret = _w->openWorkSpace(ws, &editor);
if (ret == ErrFile::AlreadyOpened) {
Q_ASSERT(editor);
editor->raise();
if (_w->currentEditor() == editor) {
Toast::toast(_w, NAMEICONRES("openapp"), tr("AlreadyOpened"));
} else {
editor->raise();
}
editor->setFocus();
}
}

View File

@ -36,6 +36,28 @@ QByteArray LayoutManager::layout(const QString &v) const {
qsizetype LayoutManager::layoutCount() const { return _layouts.size(); }
QDir LayoutManager::layoutDir() {
QDir pdir(Utilities::getAppDataPath());
auto lname = QStringLiteral("layouts");
return pdir.absoluteFilePath(lname);
}
QString LayoutManager::getSavedLayoutName(const QString &id) {
auto pdir = layoutDir();
auto trf = QStringLiteral("metatr.ini");
auto sep = QStringLiteral("/");
auto lid = id;
QSettings set(pdir.absoluteFilePath(trf), QSettings::IniFormat);
auto name = LanguageManager::instance().defaultLocale().name();
QString k = set.value(name + sep + id).toString().trimmed();
if (!k.isEmpty()) {
lid = k;
}
return lid;
}
LayoutManager::LayoutManager() {
ASSERT_SINGLETON;
QDir pdir(Utilities::getAppDataPath());
@ -66,7 +88,7 @@ void LayoutManager::process(const QDir &dir,
for (auto &l : dir.entryInfoList({"*.wing-layout"}, QDir::Files)) {
QString k;
if (set) {
k = set->value(name + sep + l.baseName()).toString();
k = set->value(name + sep + l.baseName()).toString().trimmed();
}
if (k.isEmpty()) {

View File

@ -36,6 +36,11 @@ public:
qsizetype layoutCount() const;
static QDir layoutDir();
// only for exporting layout
QString getSavedLayoutName(const QString &id);
private:
LayoutManager();

View File

@ -88,6 +88,8 @@ Logger::Level Logger::logLevel() const { return _level; }
void Logger::_log(const QString &message) { emit instance().log(message); }
void Logger::newLine() { _log({}); }
void Logger::trace(const QString &message) {
if (instance()._level >= q5TRACE) {
QString str = message;

View File

@ -54,8 +54,7 @@ signals:
void log(const QString &message);
public slots:
// internal use only
static void _log(const QString &message);
static void newLine();
// external use
static void trace(const QString &message);
@ -71,6 +70,8 @@ private:
virtual ~Logger();
static void _log(const QString &message);
Q_DISABLE_COPY_MOVE(Logger)
private:

View File

@ -144,16 +144,35 @@ void RecentFileManager::addRecentFile(const RecentInfo &info) {
}
auto a = new QAction(m_menu);
a->setData(QVariant::fromValue(info));
a->setText(getDisplayFileName(info));
QMimeDatabase db;
auto mt = db.mimeTypeForFile(info.fileName);
a->setText(getDisplayFileName(info) + QStringLiteral(" (") + mt.name() +
QStringLiteral(")"));
a->setToolTip(getDisplayTooltip(info));
if (info.isWorkSpace) {
a->setIcon(ICONRES(QStringLiteral("pro")));
} else {
a->setIcon(
Utilities::getIconFromFile(qApp->style(), info.fileName));
}
connect(a, &QAction::triggered, this, [=] {
auto send = qobject_cast<QAction *>(sender());
if (send) {
auto f = send->data().value<RecentInfo>();
if (existsPath(f)) {
auto idx = hitems.indexOf(a);
if (idx > 0) {
m_menu->removeAction(a);
if (hitems.count())
m_menu->insertAction(hitems.first(), a);
else
m_menu->addAction(a);
hitems.move(idx, 0);
}
emit triggered(f);
} else {
auto index = hitems.indexOf(send);

View File

@ -286,6 +286,7 @@ ErrFile EditorView::newFile(size_t index) {
auto p = QHexDocument::fromMemory<QMemoryBuffer>(QByteArray(), false);
p->setDocSaved();
m_hex->setDocument(QSharedPointer<QHexDocument>(p));
m_hex->cursor()->setInsertionMode(QHexCursor::InsertMode);
connectDocSavedFlag(this);
return ErrFile::Success;
}

View File

@ -1556,8 +1556,10 @@ RibbonTabContent *MainWindow::buildViewPage(RibbonTabContent *tab) {
p->first, [this, layout]() { m_dock->restoreState(layout); }));
}
addPannelAction(pannel, QStringLiteral("layout"), tr("RestoreLayout"),
EMPTY_FUNC, {}, menu);
m_toolBtneditors.insert(
ToolButtonIndex::LAYOUT_ACTION,
addPannelAction(pannel, QStringLiteral("layout"),
tr("RestoreLayout"), EMPTY_FUNC, {}, menu));
addPannelAction(pannel, QStringLiteral("layoutexport"),
tr("SaveLayout"), &MainWindow::on_saveLayout);
@ -2807,14 +2809,27 @@ void MainWindow::on_fullScreen() {
}
void MainWindow::on_saveLayout() {
auto filename = WingFileDialog::getSaveFileName(
this, tr("SaveLayout"), m_lastusedpath,
QStringLiteral("Layout (*.wing-layout)"));
if (!filename.isEmpty()) {
QFile f(filename);
static auto suffix = QStringLiteral(".wing-layout");
bool ok;
auto fileID = WingInputDialog::getText(
this, tr("SaveLayout"), tr("PleaseInput"), QLineEdit::Normal, {}, &ok);
if (ok) {
auto layoutDir = LayoutManager::layoutDir();
QFile f(layoutDir.absoluteFilePath(fileID + suffix));
if (f.open(QFile::WriteOnly)) {
f.write(m_dock->saveState());
auto layout = m_dock->saveState();
f.write(layout);
f.close();
// append saved layout
auto &lm = LayoutManager::instance();
auto menu =
m_toolBtneditors[ToolButtonIndex::LAYOUT_ACTION]->menu();
Q_ASSERT(menu);
menu->addAction(
newAction(lm.getSavedLayoutName(fileID),
[this, layout]() { m_dock->restoreState(layout); }));
Toast::toast(this, NAMEICONRES(QStringLiteral("layoutexport")),
tr("SaveLayoutSuccess"));
} else {

View File

@ -87,6 +87,7 @@ private:
UNDO_ACTION,
REDO_ACTION,
OPEN_EXT,
LAYOUT_ACTION,
};
private:
@ -222,9 +223,11 @@ public:
bool ignoreMd5, bool isExport = false);
ErrFile closeEditor(EditorView *editor, bool force);
IWingPlugin::FileType getEditorViewFileType(EditorView *view);
EditorView *currentEditor();
private:
IWingPlugin::FileType getEditorViewFileType(EditorView *view);
QString saveLog();
ads::CDockWidget *buildDockWidget(ads::CDockManager *dock,
@ -250,7 +253,6 @@ private:
void setCurrentHexEditorScale(qreal rate);
EditorView *currentEditor();
QHexView *currentHexView();
bool writeSafeCheck(bool isNewFile, const QString &savePath);

View File

@ -119,7 +119,7 @@ PluginSystem::loadPlugin(const QFileInfo &fileinfo, const QDir &setdir) {
} else {
loadPlugin(p, meta.value(), setdir);
}
Logger::_log("");
Logger::newLine();
}
return std::nullopt;
@ -131,14 +131,17 @@ EditorView *PluginSystem::getCurrentPluginView(IWingPlugin *plg) {
if (plg == nullptr) {
return nullptr;
}
if (!m_plgviewMap.contains(plg)) {
return nullptr;
if (!m_plgCurrentfid.contains(plg)) {
m_plgCurrentfid.insert(plg, -1);
}
auto view = m_plgviewMap.value(plg).first;
if (view == nullptr) {
view = _win->m_curEditor;
auto fid = m_plgCurrentfid[plg];
auto &plgview = m_plgviewMap[plg];
auto ctx = pluginContextById(plg, fid);
if (ctx) {
return ctx->view;
}
return view;
return _win->m_curEditor;
}
EditorView *PluginSystem::handle2EditorView(IWingPlugin *plg, int handle) {
@ -146,14 +149,11 @@ EditorView *PluginSystem::handle2EditorView(IWingPlugin *plg, int handle) {
return getCurrentPluginView(plg);
}
auto handles = m_plgHandles.value(plg);
auto r = std::find_if(handles.begin(), handles.end(),
[handle](const QPair<int, EditorView *> &d) {
return d.first == handle;
});
if (r != handles.end()) {
return r->second;
auto ctx = pluginContextById(plg, handle);
if (ctx) {
return ctx->view;
}
return nullptr;
}
@ -164,7 +164,13 @@ PluginSystem::assginHandleForPluginView(IWingPlugin *plg, EditorView *view) {
}
auto id = m_idGen.get();
m_plgHandles[plg].append(qMakePair(id, view));
PluginFileContext context;
context.fid = id;
context.linkedplg = plg;
context.view = view;
m_plgviewMap[plg].append(context);
m_viewBindings[view].append(plg);
return id;
}
@ -173,14 +179,15 @@ PluginSystem::PluginInfo
PluginSystem::parsePluginMetadata(const QJsonObject &meta) {
PluginSystem::PluginInfo info;
info.id = meta["Id"].toString();
info.version = QVersionNumber::fromString(meta["Version"].toString());
info.id = meta["Id"].toString().trimmed();
info.version =
QVersionNumber::fromString(meta["Version"].toString().trimmed());
info.name = meta["Name"].toString();
info.vendor = meta["Vendor"].toString();
info.author = meta["Author"].toString();
info.license = meta["License"].toString();
info.url = meta["Url"].toString();
info.name = meta["Name"].toString().trimmed();
info.vendor = meta["Vendor"].toString().trimmed();
info.author = meta["Author"].toString().trimmed();
info.license = meta["License"].toString().trimmed();
info.url = meta["Url"].toString().trimmed();
auto dependsObj = meta["Dependencies"];
if (!dependsObj.isNull()) {
@ -189,12 +196,12 @@ PluginSystem::parsePluginMetadata(const QJsonObject &meta) {
for (int i = 0; i < arr.size(); ++i) {
auto d = arr.at(i);
if (d.isObject()) {
auto id = d["Id"].toString();
auto id = d["Id"].toString().trimmed();
if (id.isEmpty()) {
continue;
}
auto version =
QVersionNumber::fromString(d["Version"].toString());
auto version = QVersionNumber::fromString(
d["Version"].toString().trimmed());
WingDependency dp;
dp.puid = id;
dp.version = version;
@ -215,8 +222,11 @@ PluginSystem::checkPluginMetadata(const PluginInfo &meta, bool isPlg) {
return PluginStatus::InvalidID;
}
if (meta.id.front().isDigit()) {
return PluginStatus::InvalidID;
}
auto r = std::find_if(meta.id.begin(), meta.id.end(), [](const QChar &ch) {
return !ch.isLetterOrNumber();
return !ch.isLetterOrNumber() && ch != '_';
});
if (r != meta.id.end()) {
return PluginStatus::InvalidID;
@ -242,35 +252,38 @@ bool PluginSystem::checkPluginCanOpenedFile(IWingPlugin *plg) {
if (plg == nullptr) {
return false;
}
return m_plgHandles[plg].size() <= UCHAR_MAX;
return m_plgviewMap[plg].size() <= UCHAR_MAX;
}
bool PluginSystem::checkPluginHasAlreadyOpened(IWingPlugin *plg,
EditorView *view) {
auto &maps = m_plgHandles[plg];
auto ret = std::find_if(
maps.begin(), maps.end(),
[view](const QPair<SharedUniqueId, EditorView *> &content) {
return content.second == view;
});
auto &maps = m_plgviewMap[plg];
auto ret = std::find_if(maps.begin(), maps.end(),
[view](const PluginFileContext &content) {
return content.view == view;
});
return ret != maps.end();
}
void PluginSystem::cleanUpEditorViewHandle(EditorView *view) {
if (m_viewBindings.contains(view)) {
auto v = m_viewBindings.value(view);
auto v = m_viewBindings[view];
// clean up
for (auto &plg : v) {
auto handles = m_plgHandles.value(plg);
auto &handles = m_plgviewMap[plg];
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
handles.erase(std::remove_if(
handles.begin(), handles.end(),
[view, plg, this](const QPair<int, EditorView *> &v) {
if (v.second == view) {
[view, this](const PluginFileContext &v) {
if (v.view == view) {
if (v.fid == m_plgCurrentfid[v.linkedplg]) {
m_plgCurrentfid[v.linkedplg] = -1;
}
dispatchEvent(
IWingPlugin::RegisteredEvent::PluginFileClosed,
{quintptr(plg), v.second->fileName(), v.first,
{quintptr(v.linkedplg), v.view->fileName(),
int(v.fid),
QVariant::fromValue(
_win->getEditorViewFileType(view))});
return true;
@ -279,68 +292,78 @@ void PluginSystem::cleanUpEditorViewHandle(EditorView *view) {
}));
#else
handles.removeIf(
[view, plg, this](const QPair<int, EditorView *> &v) {
if (v.second == view) {
dispatchEvent(
IWingPlugin::RegisteredEvent::PluginFileClosed,
{quintptr(plg), v.second->fileName(), v.first,
QVariant::fromValue(
_win->getEditorViewFileType(view))});
return true;
handles.removeIf([view, this](const PluginFileContext &v) {
if (v.view == view) {
if (v.fid == m_plgCurrentfid[v.linkedplg]) {
m_plgCurrentfid[v.linkedplg] = -1;
}
return false;
});
dispatchEvent(
IWingPlugin::RegisteredEvent::PluginFileClosed,
{quintptr(v.linkedplg), v.view->fileName(), int(v.fid),
QVariant::fromValue(
_win->getEditorViewFileType(view))});
return true;
}
return false;
});
#endif
}
m_viewBindings.remove(view);
// TODO cleanup
}
}
bool PluginSystem::closeEditor(IWingPlugin *plg, int handle, bool force) {
if (handle > 0) {
auto &handles = m_plgHandles[plg];
auto r = std::find_if(
handles.begin(), handles.end(),
[handle](const QPair<SharedUniqueId, EditorView *> &d) {
return (*d.first) == handle;
});
if (handle >= 0) {
auto &handles = m_plgviewMap[plg];
auto r = std::find_if(handles.begin(), handles.end(),
[handle](const PluginFileContext &d) {
return (*d.fid) == handle;
});
if (r == handles.end()) {
return false;
}
auto &bind = m_viewBindings[r->second];
auto &bind = m_viewBindings[r->view];
bind.removeOne(plg);
if (bind.isEmpty()) {
_win->closeEditor(r->second, force);
_win->closeEditor(r->view, force);
m_viewBindings.remove(r->view);
}
if (m_plgCurrentfid[plg] == handle) {
m_plgCurrentfid[plg] = -1;
}
handles.erase(r);
} else {
return false;
}
m_plgviewMap.remove(plg);
m_plgHandles.remove(plg);
return true;
}
bool PluginSystem::closeHandle(IWingPlugin *plg, int handle) {
if (handle < 1) {
if (handle < 0) {
return false;
}
auto &handles = m_plgHandles[plg];
auto r =
std::find_if(handles.begin(), handles.end(),
[handle](const QPair<SharedUniqueId, EditorView *> &d) {
return (*d.first) == handle;
});
auto &handles = m_plgviewMap[plg];
auto r = std::find_if(
handles.begin(), handles.end(),
[handle](const PluginFileContext &d) { return (*d.fid) == handle; });
if (r == handles.end()) {
return false;
}
auto &bind = m_viewBindings[r->second];
auto &bind = m_viewBindings[r->view];
bind.removeOne(plg);
if (bind.isEmpty()) {
m_viewBindings.remove(r->view);
}
if (m_plgCurrentfid[plg] == handle) {
m_plgCurrentfid[plg] = -1;
}
handles.erase(r);
return true;
}
@ -510,6 +533,7 @@ void PluginSystem::loadExtPlugin() {
plugindir.setNameFilters({"*.wingplg"});
#endif
Logger::newLine();
checkDirRootSafe(plugindir);
auto plgs = plugindir.entryInfoList();
@ -541,7 +565,8 @@ void PluginSystem::loadExtPlugin() {
if (!_lazyplgs.isEmpty()) {
Logger::critical(tr("PluginLoadingFailedSummary"));
Logger::_log({});
Logger::newLine();
for (auto &lplg : errorplg) {
Logger::critical(tr("- PluginName:") + lplg.name);
Logger::critical(tr("- Dependencies:"));
@ -572,6 +597,7 @@ void PluginSystem::loadDevicePlugin() {
devdir.setNameFilters({"*.wingdrv"});
#endif
Logger::newLine();
checkDirRootSafe(devdir);
auto plgs = devdir.entryInfoList();
@ -840,6 +866,10 @@ void PluginSystem::loadPlugin(IWingPlugin *p, PluginInfo &meta,
emit pluginLoading(p->pluginName());
if (meta.name.isEmpty()) {
meta.name = p->metaObject()->className();
}
p_tr = LanguageManager::instance().try2LoadPluginLang(meta.name);
connectLoadingInterface(p);
@ -950,7 +980,9 @@ void PluginSystem::loadPlugin(IWingPlugin *p, PluginInfo &meta,
registerEvents(p);
connectInterface(p);
m_plgviewMap.insert(p, qMakePair(nullptr, nullptr));
// prepare for file contenxt
m_plgviewMap.insert(p, {});
m_plgCurrentfid.insert(p, -1);
} catch (const QString &error) {
Logger::critical(error);
if (p_tr) {
@ -980,6 +1012,9 @@ void PluginSystem::loadPlugin(IWingDevice *p, PluginInfo &meta,
Logger::warning(tr("ExtPluginAuthor :") + meta.author);
Logger::warning(tr("ExtPluginWidgetRegister"));
if (meta.name.isEmpty()) {
meta.name = p->metaObject()->className();
}
p_tr = LanguageManager::instance().try2LoadPluginLang(meta.name);
connectLoadingInterface(p);
@ -1616,18 +1651,12 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
return false;
}
if (handle < 0) {
m_plgviewMap[plg].first = nullptr;
m_plgCurrentfid[plg] = -1;
} else {
auto handles = m_plgHandles.value(plg);
auto ret = std::find_if(
handles.begin(), handles.end(),
[handle](const QPair<int, EditorView *> &v) {
return v.first == handle;
});
if (ret == handles.end()) {
return false;
auto ctx = pluginContextById(plg, handle);
if (ctx) {
m_plgCurrentfid[plg] = handle;
}
m_plgviewMap[plg].first = ret->second;
}
return true;
});
@ -1641,22 +1670,16 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto cur = _win->m_curEditor;
if (cur) {
cur->raise();
} else {
return false;
return true;
}
} else {
auto handles = m_plgHandles.value(plg);
auto ret = std::find_if(
handles.begin(), handles.end(),
[handle](const QPair<int, EditorView *> &v) {
return v.first == handle;
});
if (ret == handles.end()) {
return false;
auto ctx = pluginContextById(plg, handle);
if (ctx) {
ctx->view->raise();
return true;
}
ret->second->raise();
}
return true;
return false;
});
connect(pctl, &WingPlugin::Controller::setLockedFile, _win,
[=](bool b) -> bool {
@ -1730,43 +1753,40 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
});
connect(pctl, &WingPlugin::Controller::beginMarco, _win,
[=](const QString &txt) -> bool {
QPair<EditorView *, QUndoCommand *> empty;
auto e = m_plgviewMap.value(plg, empty).first;
if (e) {
auto &info = m_plgviewMap[plg];
if (info.second) {
return false;
}
info.second = new QUndoCommand(txt);
return true;
auto fid = m_plgCurrentfid[plg];
if (fid < 0) {
return false;
}
return false;
auto r = pluginContextByIdIt(plg, fid);
if (r) {
(*r)->cmd = new QUndoCommand;
}
return true;
});
connect(pctl, &WingPlugin::Controller::endMarco, _win, [=]() -> bool {
auto e = m_plgviewMap.value(plg).first;
if (e) {
auto &info = m_plgviewMap[plg];
if (info.second) {
e->hexEditor()->document()->pushMakeUndo(info.second);
info.second = nullptr;
return true;
}
auto fid = m_plgCurrentfid[plg];
if (fid < 0) {
return false;
}
auto &info = m_plgviewMap[plg];
auto &e = info[fid];
if (e.cmd) {
return true;
}
return false;
});
connect(pctl, &WingPlugin::Controller::insertBytes, _win,
[=](qsizetype offset, const QByteArray &data) -> bool {
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->MakeInsert(mapitem.second, editor->cursor(),
offset, data);
if (mapitem.second == nullptr && cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd =
doc->MakeInsert(uc, editor->cursor(), offset, data);
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -1778,15 +1798,14 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
connect(pctl, &WingPlugin::Controller::writeBytes, _win,
[=](qsizetype offset, const QByteArray &data) -> bool {
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->MakeReplace(mapitem.second,
editor->cursor(), offset, data);
if (mapitem.second == nullptr && cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd =
doc->MakeReplace(uc, editor->cursor(), offset, data);
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -1824,9 +1843,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
connect(pctl, &WingPlugin::Controller::insertString, _win,
[=](qsizetype offset, const QString &value,
const QString &encoding) -> bool {
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
@ -1838,10 +1855,10 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
}
auto unicode = Utilities::encodingString(value, enco);
auto cmd = doc->MakeInsert(mapitem.second, editor->cursor(),
offset, unicode);
if (mapitem.second == nullptr && cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd =
doc->MakeInsert(uc, editor->cursor(), offset, unicode);
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -1879,9 +1896,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
connect(pctl, &WingPlugin::Controller::writeString, _win,
[=](qsizetype offset, const QString &value,
const QString &encoding) -> bool {
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
@ -1893,10 +1908,10 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
}
auto unicode = Utilities::encodingString(value, enco);
auto cmd = doc->MakeReplace(
mapitem.second, editor->cursor(), offset, unicode);
if (mapitem.second == nullptr && cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd =
doc->MakeReplace(uc, editor->cursor(), offset, unicode);
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -1932,9 +1947,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
});
connect(pctl, &WingPlugin::Controller::appendString, _win,
[=](const QString &value, const QString &encoding) -> bool {
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
@ -1947,10 +1960,10 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
}
auto unicode = Utilities::encodingString(value, enco);
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->MakeInsert(mapitem.second, editor->cursor(),
offset, unicode);
if (mapitem.second == nullptr && cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd =
doc->MakeInsert(uc, editor->cursor(), offset, unicode);
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -1962,17 +1975,15 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
connect(pctl, &WingPlugin::Controller::remove, _win,
[=](qsizetype offset, qsizetype len) -> bool {
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->MakeRemove(mapitem.second, editor->cursor(),
offset, len);
if (mapitem.second == nullptr && cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd =
doc->MakeRemove(uc, editor->cursor(), offset, len);
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -1982,18 +1993,15 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
return false;
});
connect(pctl, &WingPlugin::Controller::removeAllBytes, _win, [=]() -> bool {
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
auto len = doc->length();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd =
doc->MakeRemove(mapitem.second, editor->cursor(), 0, len);
if (mapitem.second == nullptr && cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->MakeRemove(uc, editor->cursor(), 0, len);
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -2086,11 +2094,10 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->metadata()->MakeMetadata(
m_plgviewMap[plg].second, begin, begin + length,
fgcolor, bgcolor, comment);
if (cmd) {
uc, begin, begin + length, fgcolor, bgcolor, comment);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2105,10 +2112,9 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->metadata()->MakeRemoveMetadata(
m_plgviewMap[plg].second, offset);
if (cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->metadata()->MakeRemoveMetadata(uc, offset);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2122,9 +2128,9 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->metadata()->MakeClear(m_plgviewMap[plg].second);
if (cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->metadata()->MakeClear(uc);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2140,11 +2146,10 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->metadata()->MakeComment(
m_plgviewMap[plg].second, begin, begin + length,
comment);
if (cmd) {
uc, begin, begin + length, comment);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2160,10 +2165,10 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->metadata()->MakeForeground(
m_plgviewMap[plg].second, begin, begin + length, fgcolor);
if (cmd) {
uc, begin, begin + length, fgcolor);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2179,10 +2184,10 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->metadata()->MakeBackground(
m_plgviewMap[plg].second, begin, begin + length, bgcolor);
if (cmd) {
uc, begin, begin + length, bgcolor);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2263,10 +2268,9 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->MakeAddBookMark(m_plgviewMap[plg].second,
pos, comment);
if (cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->MakeAddBookMark(uc, pos, comment);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2281,10 +2285,9 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->MakeModBookMark(m_plgviewMap[plg].second,
pos, comment);
if (cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->MakeModBookMark(uc, pos, comment);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2299,10 +2302,9 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd =
doc->MakeRemoveBookMark(m_plgviewMap[plg].second, pos);
if (cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->MakeRemoveBookMark(uc, pos);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2316,9 +2318,9 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto e = pluginCurrentEditor(plg);
if (e) {
auto doc = e->hexEditor()->document();
Q_ASSERT(m_plgviewMap.contains(plg));
auto cmd = doc->MakeClearBookMark(m_plgviewMap[plg].second);
if (cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->MakeClearBookMark(uc);
if (uc == nullptr && cmd) {
doc->pushMakeUndo(cmd);
return true;
}
@ -2337,9 +2339,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
auto view = _win->newfileGUI();
if (view) {
auto id = assginHandleForPluginView(plg, view);
auto &info = m_plgviewMap[plg];
info.first = view;
info.second = nullptr;
m_plgCurrentfid[plg] = id;
return ErrFile(int(*id));
} else {
return ErrFile::Error;
@ -2361,9 +2361,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
return ErrFile::AlreadyOpened;
}
auto id = assginHandleForPluginView(plg, view);
auto &info = m_plgviewMap[plg];
info.first = view;
info.second = nullptr;
m_plgCurrentfid[plg] = id;
return ErrFile(int(*id));
} else {
return ret;
@ -2386,9 +2384,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
return ErrFile::AlreadyOpened;
}
auto id = assginHandleForPluginView(plg, view);
auto &info = m_plgviewMap[plg];
info.first = view;
info.second = nullptr;
m_plgCurrentfid[plg] = id;
PluginSystem::instance().dispatchEvent(
IWingPlugin::RegisteredEvent::PluginFileOpened,
@ -2418,9 +2414,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
return ErrFile::AlreadyOpened;
}
auto id = assginHandleForPluginView(plg, view);
auto &info = m_plgviewMap[plg];
info.first = view;
info.second = nullptr;
m_plgCurrentfid[plg] = id;
PluginSystem::instance().dispatchEvent(
IWingPlugin::RegisteredEvent::PluginFileOpened,
@ -2450,9 +2444,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
return ErrFile::AlreadyOpened;
}
auto id = assginHandleForPluginView(plg, view);
auto &info = m_plgviewMap[plg];
info.first = view;
info.second = nullptr;
m_plgCurrentfid[plg] = id;
PluginSystem::instance().dispatchEvent(
IWingPlugin::RegisteredEvent::PluginFileOpened,
@ -2481,9 +2473,7 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
return ErrFile::AlreadyOpened;
}
auto id = assginHandleForPluginView(plg, view);
auto &info = m_plgviewMap[plg];
info.first = view;
info.second = nullptr;
m_plgCurrentfid[plg] = id;
PluginSystem::instance().dispatchEvent(
IWingPlugin::RegisteredEvent::PluginFileOpened,
@ -2576,9 +2566,8 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
}
auto id = assginHandleForPluginView(plg, view);
auto &info = m_plgviewMap[plg];
info.first = view;
info.second = nullptr;
m_plgCurrentfid[plg] = id;
return ErrFile(int(*id));
}
return ErrFile::Error;
@ -2642,16 +2631,12 @@ void PluginSystem::connectControllerInterface(IWingPlugin *plg) {
if (!checkThreadAff()) {
return false;
}
auto &maps = m_plgHandles[plg];
auto &maps = m_plgviewMap[plg];
for (auto &item : maps) {
auto &bind = m_viewBindings[item.second];
bind.removeOne(plg);
if (bind.isEmpty()) {
_win->closeEditor(item.second, true);
}
closeEditor(plg, item.fid, true);
}
m_plgviewMap.remove(plg);
m_plgHandles.remove(plg);
m_plgCurrentfid[plg] = -1;
maps.clear();
return true;
});
}
@ -2868,15 +2853,62 @@ void PluginSystem::loadAllPlugin() {
loadExtPlugin();
}
EditorView *PluginSystem::pluginCurrentEditor(IWingPlugin *sender) const {
if (sender) {
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto editor = m_plgviewMap.value(sender, empty).first;
if (editor) {
return editor;
} else {
EditorView *PluginSystem::pluginCurrentEditor(IWingPlugin *plg) const {
if (plg) {
auto fid = m_plgCurrentfid[plg];
if (fid < 0) {
return _win->currentEditor();
}
auto ctx = pluginContextById(plg, fid);
if (ctx) {
return ctx->view;
}
}
return nullptr;
}
std::optional<PluginSystem::PluginFileContext>
PluginSystem::pluginContextById(IWingPlugin *plg, int fid) const {
if (fid < 0) {
return std::nullopt;
}
auto &handles = m_plgviewMap[plg];
auto r = std::find_if(
handles.begin(), handles.end(),
[fid](const PluginFileContext &d) { return (*d.fid) == fid; });
if (r == handles.end()) {
return std::nullopt;
}
return *r;
}
std::optional<QVector<PluginSystem::PluginFileContext>::iterator>
PluginSystem::pluginContextByIdIt(IWingPlugin *plg, int fid) {
auto &handles = m_plgviewMap[plg];
if (fid < 0) {
return std::nullopt;
}
auto r = std::find_if(
handles.begin(), handles.end(),
[fid](const PluginFileContext &d) { return (*d.fid) == fid; });
if (r == handles.end()) {
return std::nullopt;
}
return r;
}
QUndoCommand *PluginSystem::pluginCurrentUndoCmd(IWingPlugin *plg) const {
if (plg) {
auto fid = m_plgCurrentfid[plg];
if (fid < 0) {
return nullptr;
}
auto ctx = pluginContextById(plg, fid);
if (ctx) {
return ctx->cmd;
}
}
return nullptr;
}

View File

@ -44,17 +44,23 @@ private:
public:
class UniqueId : public QSharedData {
public:
UniqueId() : _id(0), _gen(nullptr) {}
UniqueId() : _id(-1), _gen(nullptr) {}
UniqueId(UniqueIdGenerator *gen, int id) : _id(id), _gen(gen) {
Q_ASSERT(gen);
Q_ASSERT(id > 0);
Q_ASSERT(id >= 0);
#ifdef QT_DEBUG
qDebug() << "[UniqueId] alloced: " << id;
#endif
}
~UniqueId() {
if (_gen) {
_gen->release(_id);
}
#ifdef QT_DEBUG
qDebug() << "[UniqueId] freed: " << _id;
#endif
}
operator int() { return _id; }
@ -65,7 +71,7 @@ private:
};
public:
UniqueIdGenerator() : currentId(1) {}
UniqueIdGenerator() : currentId(0) {}
QExplicitlySharedDataPointer<UniqueId> get() {
if (!releasedIds.isEmpty()) {
@ -113,6 +119,20 @@ public:
};
Q_ENUM(PluginStatus)
private:
struct PluginFileContext {
SharedUniqueId fid;
EditorView *view = nullptr;
IWingPlugin *linkedplg = nullptr;
QUndoCommand *cmd = nullptr;
~PluginFileContext() {
if (cmd) {
delete cmd;
}
}
};
public:
static PluginSystem &instance();
@ -194,7 +214,15 @@ private:
static QString packLogMessage(const char *header, const QString &msg);
EditorView *pluginCurrentEditor(IWingPlugin *sender) const;
EditorView *pluginCurrentEditor(IWingPlugin *plg) const;
std::optional<PluginSystem::PluginFileContext>
pluginContextById(IWingPlugin *plg, int fid) const;
std::optional<QVector<PluginFileContext>::iterator>
pluginContextByIdIt(IWingPlugin *plg, int fid);
QUndoCommand *pluginCurrentUndoCmd(IWingPlugin *plg) const;
private:
void loadPlugin(IWingPlugin *p, PluginInfo &meta,
@ -246,17 +274,15 @@ private:
bool insertBasicTypeContent(IWingPlugin *plg, qsizetype offset,
const T &value) {
Q_STATIC_ASSERT(std::is_integral_v<T> || std::is_floating_point_v<T>);
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
auto buffer = reinterpret_cast<const char *>(&value);
auto cmd = doc->MakeInsert(mapitem.second, editor->cursor(), offset,
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->MakeInsert(uc, editor->cursor(), offset,
QByteArray(buffer, sizeof(T)));
if (mapitem.second == nullptr && cmd) {
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -270,17 +296,15 @@ private:
bool writeBasicTypeContent(IWingPlugin *plg, qsizetype offset,
const T &value) {
Q_STATIC_ASSERT(std::is_integral_v<T> || std::is_floating_point_v<T>);
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
auto buffer = reinterpret_cast<const char *>(&value);
auto cmd = doc->MakeReplace(mapitem.second, editor->cursor(),
offset, QByteArray(buffer, sizeof(T)));
if (mapitem.second == nullptr && cmd) {
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->MakeReplace(uc, editor->cursor(), offset,
QByteArray(buffer, sizeof(T)));
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -293,17 +317,15 @@ private:
template <typename T>
bool appendBasicTypeContent(IWingPlugin *plg, const T &value) {
Q_STATIC_ASSERT(std::is_integral_v<T> || std::is_floating_point_v<T>);
QPair<EditorView *, QUndoCommand *> empty{nullptr, nullptr};
auto mapitem = m_plgviewMap.value(plg, empty);
auto e = mapitem.first;
auto e = getCurrentPluginView(plg);
if (e) {
auto editor = e->hexEditor();
auto doc = editor->document();
auto buffer = reinterpret_cast<const char *>(&value);
auto cmd = doc->MakeAppend(mapitem.second, editor->cursor(),
auto uc = pluginCurrentUndoCmd(plg);
auto cmd = doc->MakeAppend(uc, editor->cursor(),
QByteArray(buffer, sizeof(T)));
if (mapitem.second == nullptr && cmd) {
if (uc == nullptr && cmd) {
_rwlock.lockForWrite();
doc->pushMakeUndo(cmd);
_rwlock.unlock();
@ -331,9 +353,8 @@ private:
QMap<IWingPlugin::RegisteredEvent, QList<IWingPlugin *>> _evplgs;
QHash<IWingPlugin *, QPair<EditorView *, QUndoCommand *>> m_plgviewMap;
QHash<IWingPlugin *, QList<QPair<SharedUniqueId, EditorView *>>>
m_plgHandles;
QHash<IWingPlugin *, QVector<PluginFileContext>> m_plgviewMap;
QHash<IWingPlugin *, int> m_plgCurrentfid; // fid
QHash<EditorView *, QList<IWingPlugin *>> m_viewBindings;
UniqueIdGenerator m_idGen;

View File

@ -1,2 +1,3 @@
* 简体中文寂静的羽夏wingsummer
* 繁體中文寂靜的羽夏wingsummer【通過繁簡文字轉化工具】