Skip to content

Commit ca3d24f

Browse files
committed
feat: 十六进制的编辑视图优化改动;
1 parent f3c6d8a commit ca3d24f

14 files changed

Lines changed: 875 additions & 673 deletions

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON)
88

99
set(CMAKE_CXX_STANDARD 17)
1010
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11-
set(PROJECT_VERSION "2.3.1")
11+
set(PROJECT_VERSION "2.3.2")
1212

1313
find_package(Qt6 REQUIRED COMPONENTS Widgets Network Concurrent PrintSupport
1414
Xml LinguistTools)
@@ -378,6 +378,8 @@ set(CLASS_SRC
378378
src/class/changedstringlist.cpp
379379
src/class/editorviewcontext.h
380380
src/class/editorviewcontext.cpp
381+
src/class/compositeiconengine.h
382+
src/class/compositeiconengine.cpp
381383
src/class/consolehighlighanim.h
382384
src/class/consolehighlighanim.cpp
383385
src/class/angellsp.h

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,4 @@
177177
## 插件库
178178

179179
- [WingAsm](https://github.com/Wing-summer/WingAsm) : 一个提供汇编和反汇编的插件,作者 **寂静的羽夏** ,协议 **APGL-v3.0**
180+
- [WingHexNote](https://github.com/Wing-summer/WingHexNote) : 一个羽云十六进制编辑器2的笔记插件,作者 **寂静的羽夏** ,协议 **APGL-v3.0**

README_en.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,4 @@ Of course, there are other repositories as mirror for Chinese users (which will
178178
## Plugins
179179

180180
- [WingAsm](https://github.com/Wing-summer/WingAsm) : A plugin that provides assembly and disassembly features. Author: **wingsummer**. License: **APGL-v3.0**.
181+
- [WingHexNote](https://github.com/Wing-summer/WingAsm) : A note plugin for WingHexExplorer2. Author: **wingsummer**. License: **APGL-v3.0**.

lang/en_US/winghex_en_US.ts

Lines changed: 198 additions & 197 deletions
Large diffs are not rendered by default.

lang/zh_CN/winghex_zh_CN.ts

Lines changed: 198 additions & 197 deletions
Large diffs are not rendered by default.

lang/zh_TW/winghex_zh_TW.ts

Lines changed: 199 additions & 198 deletions
Large diffs are not rendered by default.

main.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*==============================================================================
2+
** Copyright (C) 2024-2027 WingSummer
3+
**
4+
** This program is free software: you can redistribute it and/or modify it under
5+
** the terms of the GNU Affero General Public License as published by the Free
6+
** Software Foundation, version 3.
7+
**
8+
** This program is distributed in the hope that it will be useful, but WITHOUT
9+
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10+
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
11+
** details.
12+
**
13+
** You should have received a copy of the GNU Affero General Public License
14+
** along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
** =============================================================================
16+
*/
17+
118
#include "class/appmanager.h"
219
#include "class/languagemanager.h"
320
#include "class/settingmanager.h"

src/class/compositeiconengine.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*==============================================================================
2+
** Copyright (C) 2024-2027 WingSummer
3+
**
4+
** This program is free software: you can redistribute it and/or modify it under
5+
** the terms of the GNU Affero General Public License as published by the Free
6+
** Software Foundation, version 3.
7+
**
8+
** This program is distributed in the hope that it will be useful, but WITHOUT
9+
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10+
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
11+
** details.
12+
**
13+
** You should have received a copy of the GNU Affero General Public License
14+
** along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
** =============================================================================
16+
*/
17+
18+
#include "compositeiconengine.h"
19+
20+
#include <QPainter>
21+
22+
CompositeIconEngine::CompositeIconEngine(const QIcon &main,
23+
const QIcon &overlay)
24+
: mainIcon(main), overlayIcon(overlay) {}
25+
26+
QIconEngine *CompositeIconEngine::clone() const {
27+
return new CompositeIconEngine(mainIcon, overlayIcon);
28+
}
29+
30+
void CompositeIconEngine::paint(QPainter *painter, const QRect &rect,
31+
QIcon::Mode mode, QIcon::State state) {
32+
mainIcon.paint(painter, rect, Qt::AlignCenter, mode, state);
33+
auto w = rect.width() / 2;
34+
auto h = rect.height() / 2;
35+
auto x = rect.x() + w;
36+
auto y = rect.y() + h;
37+
QRect overlayRect(x, y, w, h);
38+
overlayIcon.paint(painter, overlayRect, Qt::AlignCenter, mode, state);
39+
}
40+
41+
QPixmap CompositeIconEngine::pixmap(const QSize &size, QIcon::Mode mode,
42+
QIcon::State state) {
43+
QPixmap pixmap(size);
44+
pixmap.fill(Qt::transparent);
45+
QPainter painter(&pixmap);
46+
paint(&painter, QRect(QPoint(0, 0), size), mode, state);
47+
return pixmap;
48+
}

src/class/compositeiconengine.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*==============================================================================
2+
** Copyright (C) 2024-2027 WingSummer
3+
**
4+
** This program is free software: you can redistribute it and/or modify it under
5+
** the terms of the GNU Affero General Public License as published by the Free
6+
** Software Foundation, version 3.
7+
**
8+
** This program is distributed in the hope that it will be useful, but WITHOUT
9+
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10+
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
11+
** details.
12+
**
13+
** You should have received a copy of the GNU Affero General Public License
14+
** along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
** =============================================================================
16+
*/
17+
18+
#ifndef COMPOSITEICONENGINE_H
19+
#define COMPOSITEICONENGINE_H
20+
21+
#include <QIconEngine>
22+
23+
class CompositeIconEngine : public QIconEngine {
24+
public:
25+
explicit CompositeIconEngine(const QIcon &main, const QIcon &overlay);
26+
27+
public:
28+
QIconEngine *clone() const override;
29+
30+
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode,
31+
QIcon::State state) override;
32+
33+
QPixmap pixmap(const QSize &size, QIcon::Mode mode,
34+
QIcon::State state) override;
35+
36+
private:
37+
QIcon mainIcon;
38+
QIcon overlayIcon;
39+
};
40+
41+
#endif // COMPOSITEICONENGINE_H

src/class/pluginsystem.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,15 @@ PluginSystem::PluginSystem(QObject *parent) : QObject(parent) {
5454
auto m = mobj->method(i);
5555
if (m.methodType() == QMetaMethod::Slot &&
5656
m.access() == QMetaMethod::Public) {
57+
auto total = m.parameterCount();
58+
if (total < 1 || m.parameterMetaType(0) !=
59+
QMetaType::fromType<const QObject *>()) {
60+
continue;
61+
}
62+
5763
WingHex::FunctionSig msig;
5864
msig.fnName = m.name();
59-
60-
auto total = m.parameterCount();
61-
msig.types.reserve(total);
65+
msig.types.reserve(total - 1);
6266

6367
for (int i = 1; i < total; ++i) {
6468
auto mt = m.parameterType(i);
@@ -4251,13 +4255,14 @@ void PluginSystem::loadPlugin(IWingPlugin *p, PluginInfo &meta,
42514255
QTranslator *p_tr = nullptr;
42524256

42534257
try {
4254-
if (!p->pluginName().trimmed().length()) {
4258+
auto name = p->pluginName();
4259+
if (name.trimmed().isEmpty()) {
42554260
throw tr("ErrLoadPluginNoName");
42564261
}
42574262

42584263
// dependencies had been checked
42594264

4260-
Q_EMIT pluginLoading(p->pluginName());
4265+
Q_EMIT pluginLoading(name);
42614266

42624267
p_tr = LanguageManager::instance().try2LoadPluginLang(meta.id);
42634268

@@ -4318,6 +4323,11 @@ void PluginSystem::loadPlugin(IWingDevice *p, PluginInfo &meta,
43184323
QTranslator *p_tr = nullptr;
43194324

43204325
try {
4326+
auto name = p->pluginName();
4327+
if (name.trimmed().isEmpty()) {
4328+
throw tr("ErrLoadPluginNoName");
4329+
}
4330+
43214331
Logger::debug(tr("ExtPluginAuthor :") + meta.author);
43224332
Logger::debug(tr("ExtPluginWidgetRegister"));
43234333

0 commit comments

Comments
 (0)