尽可能使用内部资源,降低内存占用

This commit is contained in:
寂静的羽夏 2022-08-23 12:50:07 +08:00
parent 98fbc3982a
commit 77d16bea39
33 changed files with 45 additions and 71 deletions

View File

@ -6,7 +6,7 @@
AboutSoftwareDialog::AboutSoftwareDialog(DMainWindow *parent)
: DDialog(parent) {
QPixmap pic;
pic.load(":/WingHexPy/img/author.jpg");
pic.load(HOSTAUTHORPIMG);
auto l = new DLabel(this);
l->setFixedSize(100, 100);
l->setScaledContents(true);

View File

@ -1,6 +1,7 @@
#ifndef ABOUTSOFTWAREDIALOG_H
#define ABOUTSOFTWAREDIALOG_H
#include "../../WingHexExplorer/wing-hex-explorer.sourcecode/WingHexExplorer/plugin/iwingplugin.h"
#include <DDialog>
#include <DMainWindow>
#include <QObject>
@ -11,10 +12,6 @@ class AboutSoftwareDialog : public DDialog {
Q_OBJECT
public:
explicit AboutSoftwareDialog(DMainWindow *parent = nullptr);
signals:
public slots:
};
#endif // ABOUTSOFTWAREDIALOG_H

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -5,41 +5,15 @@
<file>img/pys.png</file>
<file alias="drakula.xml">QCodeEditor/drakula.xml</file>
<file>img/icon.png</file>
<file>img/author.jpg</file>
<file>img/author.png</file>
<file>img/copy.png</file>
<file>img/cut.png</file>
<file>img/del.png</file>
<file>img/file.png</file>
<file>img/jmp.png</file>
<file>img/new.png</file>
<file>img/open.png</file>
<file>img/paste.png</file>
<file>img/redo.png</file>
<file>img/save.png</file>
<file>img/saveas.png</file>
<file>img/soft.png</file>
<file>img/sponsor.png</file>
<file>img/undo.png</file>
<file>img/clearhis.png</file>
<file>img/close.png</file>
<file>img/edit.png</file>
<file>img/run.png</file>
<file>img/runf.png</file>
<file>img/find.png</file>
<file>img/replace.png</file>
<file>sponsor.png</file>
<file>img/README.md</file>
<file>img/infolist.png</file>
<file>img/infotable.png</file>
<file>img/infotree.png</file>
<file>img/infotxt.png</file>
<file>img/writable.png</file>
<file>img/unsaved.png</file>
<file>img/saved.png</file>
<file>img/readonly.png</file>
<file>img/pydb.png</file>
<file>img/py.png</file>
<file>img/wiki.png</file>
</qresource>
</RCC>

View File

@ -17,6 +17,7 @@
#include <QTextDocumentFragment>
#define ICONRES(name) QIcon(":/WingHexPy/img/" name ".png")
#define HOSTICONRES(name) QIcon(HOSTRESPIMG(name))
ScriptWindow *ScriptWindow::m_instance = nullptr;
@ -71,20 +72,20 @@ ScriptWindow::ScriptWindow(DMainWindow *parent) : DMainWindow(parent) {
Q_UNUSED(a);
QMenu *m;
PluginMenuInitBegin(m, tr("File")) {
m->setIcon(ICONRES("file"));
PluginMenuAddItemIconAction(m, tr("New"), ICONRES("new"),
m->setIcon(HOSTICONRES("file"));
PluginMenuAddItemIconAction(m, tr("New"), HOSTICONRES("new"),
ScriptWindow::on_new);
a->setShortcut(QKeySequence::New);
a->setShortcutVisibleInContextMenu(true);
PluginMenuAddItemIconAction(m, tr("Open"), ICONRES("open"),
PluginMenuAddItemIconAction(m, tr("Open"), HOSTICONRES("open"),
ScriptWindow::on_open);
a->setShortcut(QKeySequence::Open);
a->setShortcutVisibleInContextMenu(true);
PluginMenuAddItemIconAction(m, tr("Save"), ICONRES("save"),
PluginMenuAddItemIconAction(m, tr("Save"), HOSTICONRES("save"),
ScriptWindow::on_save);
a->setShortcut(QKeySequence::Save);
a->setShortcutVisibleInContextMenu(true);
PluginMenuAddItemIconAction(m, tr("SaveAs"), ICONRES("saveas"),
PluginMenuAddItemIconAction(m, tr("SaveAs"), HOSTICONRES("saveas"),
ScriptWindow::on_saveas);
a->setShortcut(QKeySequence::SaveAs);
a->setShortcutVisibleInContextMenu(true);
@ -93,41 +94,41 @@ ScriptWindow::ScriptWindow(DMainWindow *parent) : DMainWindow(parent) {
recentmanager = new RecentFileManager(rm, this);
recentmanager->apply();
m->addMenu(rm);
PluginMenuAddItemIconAction(m, tr("Close"), ICONRES("close"),
PluginMenuAddItemIconAction(m, tr("Close"), HOSTICONRES("closefile"),
ScriptWindow::on_close);
}
PluginMenuInitEnd();
menu->addMenu(m);
PluginMenuInitBegin(m, tr("Edit")) {
m->setIcon(ICONRES("edit"));
PluginMenuAddItemIconAction(m, tr("Undo"), ICONRES("undo"),
m->setIcon(HOSTICONRES("edit"));
PluginMenuAddItemIconAction(m, tr("Undo"), HOSTICONRES("undo"),
ScriptWindow::on_undo);
a->setShortcut(QKeySequence::Undo);
a->setShortcutVisibleInContextMenu(true);
a->setEnabled(false);
mundo = a;
PluginMenuAddItemIconAction(m, tr("Redo"), ICONRES("redo"),
PluginMenuAddItemIconAction(m, tr("Redo"), HOSTICONRES("redo"),
ScriptWindow::on_redo);
a->setShortcut(QKeySequence::Redo);
a->setShortcutVisibleInContextMenu(true);
a->setEnabled(false);
mredo = a;
m->addSeparator();
PluginMenuAddItemIconAction(m, tr("Cut"), ICONRES("cut"),
PluginMenuAddItemIconAction(m, tr("Cut"), HOSTICONRES("cut"),
ScriptWindow::on_cut);
a->setShortcut(QKeySequence::Cut);
a->setShortcutVisibleInContextMenu(true);
PluginMenuAddItemIconAction(m, tr("Copy"), ICONRES("copy"),
PluginMenuAddItemIconAction(m, tr("Copy"), HOSTICONRES("copy"),
ScriptWindow::on_copy);
a->setShortcut(QKeySequence::Copy);
a->setShortcutVisibleInContextMenu(true);
PluginMenuAddItemIconAction(m, tr("Paste"), ICONRES("paste"),
PluginMenuAddItemIconAction(m, tr("Paste"), HOSTICONRES("paste"),
ScriptWindow::on_paste);
a->setShortcut(QKeySequence::Paste);
a->setShortcutVisibleInContextMenu(true);
m->addSeparator();
PluginMenuAddItemIconAction(m, tr("Find"), ICONRES("find"),
PluginMenuAddItemIconAction(m, tr("Find"), HOSTICONRES("find"),
ScriptWindow::on_find);
a->setShortcut(QKeySequence::Find);
a->setShortcutVisibleInContextMenu(true);
@ -135,7 +136,7 @@ ScriptWindow::ScriptWindow(DMainWindow *parent) : DMainWindow(parent) {
ScriptWindow::on_replace);
a->setShortcut(QKeySequence::Replace);
a->setShortcutVisibleInContextMenu(true);
PluginMenuAddItemIconAction(m, tr("Goto"), ICONRES("jmp"),
PluginMenuAddItemIconAction(m, tr("Goto"), HOSTICONRES("jmp"),
ScriptWindow::on_jmp);
a->setShortcut(scgoto);
a->setShortcutVisibleInContextMenu(true);
@ -156,10 +157,10 @@ ScriptWindow::ScriptWindow(DMainWindow *parent) : DMainWindow(parent) {
PluginMenuInitEnd();
menu->addMenu(m);
PluginMenuInitBegin(m, tr("About")) {
m->setIcon(ICONRES("author"));
PluginMenuAddItemIconAction(m, tr("AboutPlugin"), ICONRES("soft"),
m->setIcon(HOSTICONRES("author"));
PluginMenuAddItemIconAction(m, tr("AboutPlugin"), HOSTICONRES("soft"),
ScriptWindow::on_about);
PluginMenuAddItemIconAction(m, tr("Sponsor"), ICONRES("sponsor"),
PluginMenuAddItemIconAction(m, tr("Sponsor"), HOSTICONRES("sponsor"),
ScriptWindow::on_sponsor);
}
PluginMenuInitEnd();
@ -174,35 +175,35 @@ ScriptWindow::ScriptWindow(DMainWindow *parent) : DMainWindow(parent) {
PluginToolBarInitBegin(toolbar, "", "") {
toolbar->toggleViewAction()->setVisible(false);
PluginToolBarAddAction(toolbar, ICONRES("new"), ScriptWindow::on_new,
PluginToolBarAddAction(toolbar, HOSTICONRES("new"), ScriptWindow::on_new,
tr("New"));
PluginToolBarAddAction(toolbar, ICONRES("open"), ScriptWindow::on_open,
PluginToolBarAddAction(toolbar, HOSTICONRES("open"), ScriptWindow::on_open,
tr("Open"));
PluginToolBarAddAction(toolbar, ICONRES("save"), ScriptWindow::on_save,
PluginToolBarAddAction(toolbar, HOSTICONRES("save"), ScriptWindow::on_save,
tr("Save"));
PluginToolBarAddAction(toolbar, ICONRES("saveas"), ScriptWindow::on_saveas,
tr("SaveAs"));
PluginToolBarAddAction(toolbar, HOSTICONRES("saveas"),
ScriptWindow::on_saveas, tr("SaveAs"));
toolbar->addSeparator();
PluginToolBarAddAction(toolbar, ICONRES("undo"), ScriptWindow::on_undo,
PluginToolBarAddAction(toolbar, HOSTICONRES("undo"), ScriptWindow::on_undo,
tr("Undo"));
a->setEnabled(false);
aundo = a;
PluginToolBarAddAction(toolbar, ICONRES("redo"), ScriptWindow::on_redo,
PluginToolBarAddAction(toolbar, HOSTICONRES("redo"), ScriptWindow::on_redo,
tr("Redo"));
a->setEnabled(false);
aredo = a;
PluginToolBarAddAction(toolbar, ICONRES("cut"), ScriptWindow::on_cut,
PluginToolBarAddAction(toolbar, HOSTICONRES("cut"), ScriptWindow::on_cut,
tr("Cut"));
PluginToolBarAddAction(toolbar, ICONRES("copy"), ScriptWindow::on_copy,
PluginToolBarAddAction(toolbar, HOSTICONRES("copy"), ScriptWindow::on_copy,
tr("Copy"));
PluginToolBarAddAction(toolbar, ICONRES("paste"), ScriptWindow::on_paste,
tr("Paste"));
PluginToolBarAddAction(toolbar, HOSTICONRES("paste"),
ScriptWindow::on_paste, tr("Paste"));
toolbar->addSeparator();
PluginToolBarAddAction(toolbar, ICONRES("find"), ScriptWindow::on_find,
PluginToolBarAddAction(toolbar, HOSTICONRES("find"), ScriptWindow::on_find,
tr("Find"));
PluginToolBarAddAction(toolbar, ICONRES("replace"),
ScriptWindow::on_replace, tr("Replace"));
PluginToolBarAddAction(toolbar, ICONRES("jmp"), ScriptWindow::on_jmp,
PluginToolBarAddAction(toolbar, HOSTICONRES("jmp"), ScriptWindow::on_jmp,
tr("Goto"));
toolbar->addSeparator();
PluginToolBarAddAction(toolbar, ICONRES("run"), ScriptWindow::on_run,
@ -210,9 +211,9 @@ ScriptWindow::ScriptWindow(DMainWindow *parent) : DMainWindow(parent) {
PluginToolBarAddAction(toolbar, ICONRES("runf"), ScriptWindow::on_runfile,
tr("RunFile"));
toolbar->addSeparator();
PluginToolBarAddAction(toolbar, ICONRES("soft"), ScriptWindow::on_about,
PluginToolBarAddAction(toolbar, HOSTICONRES("soft"), ScriptWindow::on_about,
tr("AboutPlugin"));
PluginToolBarAddAction(toolbar, ICONRES("sponsor"),
PluginToolBarAddAction(toolbar, HOSTICONRES("sponsor"),
ScriptWindow::on_sponsor, tr("Sponsor"));
}
PluginToolBarInitEnd();
@ -221,7 +222,7 @@ ScriptWindow::ScriptWindow(DMainWindow *parent) : DMainWindow(parent) {
status = new DStatusBar(this);
#define LoadPixMap(Var, Icon) Var.load(":/WingHexPy/images/" Icon ".png");
#define LoadPixMap(Var, Icon) Var.load(HOSTRESPIMG(Icon));
DLabel *l;
@ -466,7 +467,7 @@ void ScriptWindow::on_open() {
f.close();
setSaved(true);
} else {
DMessageManager::instance()->sendMessage(this, ICONRES("open"),
DMessageManager::instance()->sendMessage(this, HOSTICONRES("open"),
tr("OpenFail"));
}
}
@ -483,7 +484,7 @@ void ScriptWindow::on_save() {
f.close();
setSaved(true);
} else {
DMessageManager::instance()->sendMessage(this, ICONRES("save"),
DMessageManager::instance()->sendMessage(this, HOSTICONRES("save"),
tr("SaveFail"));
}
}
@ -501,7 +502,7 @@ void ScriptWindow::on_saveas() {
setSaved(true);
iReadWrite->setPixmap(infoWriteable);
} else {
DMessageManager::instance()->sendMessage(this, ICONRES("saveas"),
DMessageManager::instance()->sendMessage(this, HOSTICONRES("saveas"),
tr("SaveAsFail"));
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 KiB

View File

@ -8,7 +8,7 @@ SponsorDialog::SponsorDialog(DMainWindow *parent) : DDialog(parent) {
addSpacing(5);
addContent(new DLabel(tr("ThanksForSponsor"), this), Qt::AlignHCenter);
addSpacing(5);
QPixmap sponsor(":/WingHexPy/sponsor.png");
QPixmap sponsor(SPONSORQRCODE);
auto l = new DLabel(this);
l->setPixmap(sponsor);

View File

@ -1,6 +1,7 @@
#ifndef SPONSORDIALOG_H
#define SPONSORDIALOG_H
#include "../../WingHexExplorer/wing-hex-explorer.sourcecode/WingHexExplorer/plugin/iwingplugin.h"
#include <DDialog>
#include <DMainWindow>
#include <QObject>

View File

@ -9,6 +9,7 @@
#include <QMessageBox>
#define ICONRES(name) QIcon(":/WingHexPy/img/" name ".png")
#define HOSTICONRES(name) QIcon(HOSTRESPIMG(name))
WingHexPy::WingHexPy(QObject *parent) { Q_UNUSED(parent) }
@ -133,14 +134,14 @@ bool WingHexPy::init(QList<WingPluginInfo> loadedplugin) {
tr("InfoTxt"));
tb->addSeparator();
PluginToolBarAddLamba(
tb, ICONRES("author"),
tb, HOSTICONRES("author"),
[=] {
AboutSoftwareDialog d;
d.exec();
},
tr("About"));
PluginToolBarAddLamba(
tb, ICONRES("wiki"),
tb, HOSTICONRES("wiki"),
[=] {
QDesktopServices::openUrl(
QUrl("https://code.gitlink.org.cn/wingsummer/WingHexPy/wiki/"
@ -148,7 +149,7 @@ bool WingHexPy::init(QList<WingPluginInfo> loadedplugin) {
},
tr("Wiki"));
PluginToolBarAddLamba(
tb, ICONRES("sponsor"),
tb, HOSTICONRES("sponsor"),
[=] {
SponsorDialog d;
d.exec();