This commit is contained in:
寂静的羽夏 2022-08-23 16:37:30 +08:00
parent 77d16bea39
commit 86e9b9b6ec
11 changed files with 86 additions and 155 deletions

View File

@ -39,8 +39,6 @@ SOURCES += \
findbar.cpp \
linebar.cpp \
replacebar.cpp \
aboutsoftwaredialog.cpp \
sponsordialog.cpp \
scriptmanager.cpp \
scriptcenterwindow.cpp
@ -89,8 +87,6 @@ HEADERS += \
findbar.h \
linebar.h \
replacebar.h \
aboutsoftwaredialog.h \
sponsordialog.h \
scriptmanager.h \
scriptcenterwindow.h \
PythonQt/PythonQt_QtAll.h \

Binary file not shown.

View File

@ -116,7 +116,7 @@
<context>
<name>ScriptManager</name>
<message>
<location filename="scriptmanager.cpp" line="75"/>
<location filename="scriptmanager.cpp" line="50"/>
<source>NoScript</source>
<translation></translation>
</message>
@ -124,133 +124,133 @@
<context>
<name>ScriptWindow</name>
<message>
<location filename="scriptwindow.cpp" line="37"/>
<location filename="scriptwindow.cpp" line="36"/>
<source>WingHexPyScriptWindow</source>
<translation> Python </translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="73"/>
<location filename="scriptwindow.cpp" line="72"/>
<source>File</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="75"/>
<location filename="scriptwindow.cpp" line="74"/>
<location filename="scriptwindow.cpp" line="177"/>
<source>New</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="79"/>
<location filename="scriptwindow.cpp" line="78"/>
<location filename="scriptwindow.cpp" line="179"/>
<source>Open</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="83"/>
<location filename="scriptwindow.cpp" line="82"/>
<location filename="scriptwindow.cpp" line="181"/>
<source>Save</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="87"/>
<location filename="scriptwindow.cpp" line="86"/>
<location filename="scriptwindow.cpp" line="183"/>
<source>SaveAs</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="92"/>
<location filename="scriptwindow.cpp" line="91"/>
<source>RecentFile</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="96"/>
<location filename="scriptwindow.cpp" line="95"/>
<source>Close</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="102"/>
<location filename="scriptwindow.cpp" line="101"/>
<source>Edit</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="104"/>
<location filename="scriptwindow.cpp" line="103"/>
<location filename="scriptwindow.cpp" line="186"/>
<source>Undo</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="110"/>
<location filename="scriptwindow.cpp" line="109"/>
<location filename="scriptwindow.cpp" line="190"/>
<source>Redo</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="117"/>
<location filename="scriptwindow.cpp" line="116"/>
<location filename="scriptwindow.cpp" line="194"/>
<source>Cut</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="121"/>
<location filename="scriptwindow.cpp" line="120"/>
<location filename="scriptwindow.cpp" line="196"/>
<source>Copy</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="125"/>
<location filename="scriptwindow.cpp" line="124"/>
<location filename="scriptwindow.cpp" line="198"/>
<source>Paste</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="130"/>
<location filename="scriptwindow.cpp" line="129"/>
<location filename="scriptwindow.cpp" line="201"/>
<source>Find</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="134"/>
<location filename="scriptwindow.cpp" line="133"/>
<location filename="scriptwindow.cpp" line="203"/>
<source>Replace</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="138"/>
<location filename="scriptwindow.cpp" line="137"/>
<location filename="scriptwindow.cpp" line="205"/>
<location filename="scriptwindow.cpp" line="558"/>
<source>Goto</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="145"/>
<location filename="scriptwindow.cpp" line="144"/>
<source>Script</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="147"/>
<location filename="scriptwindow.cpp" line="146"/>
<location filename="scriptwindow.cpp" line="208"/>
<source>Run</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="151"/>
<location filename="scriptwindow.cpp" line="150"/>
<location filename="scriptwindow.cpp" line="210"/>
<source>RunFile</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="158"/>
<location filename="scriptwindow.cpp" line="157"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="160"/>
<location filename="scriptwindow.cpp" line="159"/>
<location filename="scriptwindow.cpp" line="213"/>
<source>AboutPlugin</source>
<translation></translation>
</message>
<message>
<location filename="scriptwindow.cpp" line="162"/>
<location filename="scriptwindow.cpp" line="161"/>
<location filename="scriptwindow.cpp" line="215"/>
<source>Sponsor</source>
<translation></translation>
@ -350,102 +350,100 @@
<context>
<name>SponsorDialog</name>
<message>
<location filename="sponsordialog.cpp" line="6"/>
<source>Sponsor</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="sponsordialog.cpp" line="9"/>
<source>ThanksForSponsor</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>WingHexPy</name>
<message>
<location filename="winghexpy.cpp" line="45"/>
<location filename="winghexpy.cpp" line="183"/>
<location filename="winghexpy.cpp" line="50"/>
<location filename="winghexpy.cpp" line="182"/>
<source>WingHexPy</source>
<translation>WingHexPy</translation>
</message>
<message>
<location filename="winghexpy.cpp" line="47"/>
<location filename="winghexpy.cpp" line="52"/>
<source>ScriptEditor</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="49"/>
<location filename="winghexpy.cpp" line="105"/>
<location filename="winghexpy.cpp" line="54"/>
<location filename="winghexpy.cpp" line="114"/>
<source>Run File</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="51"/>
<location filename="winghexpy.cpp" line="93"/>
<location filename="winghexpy.cpp" line="56"/>
<location filename="winghexpy.cpp" line="102"/>
<source>Database</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="56"/>
<location filename="winghexpy.cpp" line="61"/>
<source>Script</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="64"/>
<location filename="winghexpy.cpp" line="69"/>
<source>Console</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="67"/>
<location filename="winghexpy.cpp" line="112"/>
<location filename="winghexpy.cpp" line="72"/>
<location filename="winghexpy.cpp" line="121"/>
<source>InfoList</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="71"/>
<location filename="winghexpy.cpp" line="126"/>
<location filename="winghexpy.cpp" line="76"/>
<location filename="winghexpy.cpp" line="135"/>
<source>InfoTree</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="74"/>
<location filename="winghexpy.cpp" line="119"/>
<location filename="winghexpy.cpp" line="79"/>
<location filename="winghexpy.cpp" line="128"/>
<source>InfoTable</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="78"/>
<location filename="winghexpy.cpp" line="133"/>
<location filename="winghexpy.cpp" line="83"/>
<location filename="winghexpy.cpp" line="142"/>
<source>InfoTxt</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="86"/>
<location filename="winghexpy.cpp" line="95"/>
<source>ScriptWindow</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="141"/>
<location filename="winghexpy.cpp" line="145"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="148"/>
<location filename="winghexpy.cpp" line="155"/>
<source>Sponsor</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="156"/>
<location filename="winghexpy.cpp" line="153"/>
<source>Wiki</source>
<translation> Wiki</translation>
</message>
<message>
<location filename="winghexpy.cpp" line="164"/>
<location filename="winghexpy.cpp" line="163"/>
<source>ChooseFile</source>
<translation></translation>
</message>
<message>
<location filename="winghexpy.cpp" line="188"/>
<location filename="winghexpy.cpp" line="187"/>
<source>A useful plugin for python3.7 support.</source>
<translation> Python 3.7 </translation>
</message>

View File

@ -1,23 +0,0 @@
#include "aboutsoftwaredialog.h"
#include <DLabel>
#include <DTextBrowser>
#include <QPixmap>
AboutSoftwareDialog::AboutSoftwareDialog(DMainWindow *parent)
: DDialog(parent) {
QPixmap pic;
pic.load(HOSTAUTHORPIMG);
auto l = new DLabel(this);
l->setFixedSize(100, 100);
l->setScaledContents(true);
l->setPixmap(pic);
addContent(l, Qt::AlignHCenter);
addSpacing(10);
auto b = new DTextBrowser(this);
b->setSearchPaths(QStringList({":/WingHexPy", ":/WingHexPy/img"}));
b->setSource(QUrl("README.md"), QTextDocument::MarkdownResource);
b->setFixedSize(800, 500);
b->setOpenExternalLinks(true);
addContent(b);
}

View File

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

View File

@ -1,9 +1,7 @@
#include "scriptwindow.h"
#include "../../WingHexExplorer/wing-hex-explorer.sourcecode/WingHexExplorer/plugin/iwingplugin.h"
#include "QCodeEditor/QPythonHighlighter.hpp"
#include "aboutsoftwaredialog.h"
#include "plginterface.h"
#include "sponsordialog.h"
#include <DFileDialog>
#include <DInputDialog>
#include <DMessageManager>
@ -568,11 +566,11 @@ void ScriptWindow::on_jmp() {
}
void ScriptWindow::on_about() {
AboutSoftwareDialog d;
d.exec();
emit sigAbout();
raise();
}
void ScriptWindow::on_sponsor() {
SponsorDialog d;
d.exec();
emit sigSponsor();
raise();
}

View File

@ -49,6 +49,10 @@ private:
void setSaved(bool b);
signals:
void sigAbout();
void sigSponsor();
private:
QCodeEditor *editor;
static ScriptWindow *m_instance;

View File

@ -1,17 +0,0 @@
#include "sponsordialog.h"
#include <DLabel>
#include <QPixmap>
SponsorDialog::SponsorDialog(DMainWindow *parent) : DDialog(parent) {
setWindowTitle(tr("Sponsor"));
addSpacing(5);
addContent(new DLabel(tr("ThanksForSponsor"), this), Qt::AlignHCenter);
addSpacing(5);
QPixmap sponsor(SPONSORQRCODE);
auto l = new DLabel(this);
l->setPixmap(sponsor);
l->setScaledContents(true);
addContent(l);
}

View File

@ -1,20 +0,0 @@
#ifndef SPONSORDIALOG_H
#define SPONSORDIALOG_H
#include "../../WingHexExplorer/wing-hex-explorer.sourcecode/WingHexExplorer/plugin/iwingplugin.h"
#include <DDialog>
#include <DMainWindow>
#include <QObject>
DWIDGET_USE_NAMESPACE
class SponsorDialog : public DDialog {
Q_OBJECT
public:
explicit SponsorDialog(DMainWindow *parent = nullptr);
signals:
public slots:
};
#endif // SPONSORDIALOG_H

View File

@ -1,8 +1,6 @@
#include "winghexpy.h"
#include "aboutsoftwaredialog.h"
#include "scriptcenterwindow.h"
#include "scriptwindow.h"
#include "sponsordialog.h"
#include <QApplication>
#include <QDesktopServices>
#include <QFileDialog>
@ -26,8 +24,14 @@ QString WingHexPy::signature() { return WINGSUMMER; }
bool WingHexPy::init(QList<WingPluginInfo> loadedplugin) {
Q_UNUSED(loadedplugin);
auto translator = new QTranslator(this);
if (SDKVERSION < 8) {
QMessageBox::critical(nullptr, "Error",
"UnSupported Plugin System Version!",
QMessageBox::Ok);
return false;
}
auto translator = new QTranslator(this);
auto s = GETPLUGINQM("WingHexPy.qm");
if (!translator->load(s) || !QApplication::installTranslator(translator)) {
QMessageBox::critical(nullptr, "Error", "Error Loading Translation File!",
@ -81,6 +85,10 @@ bool WingHexPy::init(QList<WingPluginInfo> loadedplugin) {
plgint->initInfo(infolist, infotree, infotable, infotxt);
auto sw = ScriptWindow::instance();
connect(sw, &ScriptWindow::sigAbout, this, &WingHexPy::on_about);
connect(sw, &ScriptWindow::sigSponsor, this, &WingHexPy::on_sponsor);
PluginToolBarInitBegin(tb, "WingHexPy", "WingHexPy") {
PluginToolBarAddLamba(
tb, ICONRES("pys"), [=] { ScriptWindow::instance()->show(); },
@ -133,13 +141,8 @@ bool WingHexPy::init(QList<WingPluginInfo> loadedplugin) {
},
tr("InfoTxt"));
tb->addSeparator();
PluginToolBarAddLamba(
tb, HOSTICONRES("author"),
[=] {
AboutSoftwareDialog d;
d.exec();
},
tr("About"));
PluginToolBarAddAction(tb, HOSTICONRES("author"), WingHexPy::on_about,
tr("About"));
PluginToolBarAddLamba(
tb, HOSTICONRES("wiki"),
[=] {
@ -148,13 +151,8 @@ bool WingHexPy::init(QList<WingPluginInfo> loadedplugin) {
"%E6%95%99%E7%A8%8B"));
},
tr("Wiki"));
PluginToolBarAddLamba(
tb, HOSTICONRES("sponsor"),
[=] {
SponsorDialog d;
d.exec();
},
tr("Sponsor"));
PluginToolBarAddAction(tb, HOSTICONRES("sponsor"), WingHexPy::on_sponsor,
tr("Sponsor"));
}
PluginToolBarInitEnd();
@ -205,3 +203,15 @@ void WingHexPy::registerDockWidget(
QToolBar *WingHexPy::registerToolBar() { return tb; }
void WingHexPy::log(QString message) { txt->consoleMessage(message); }
void WingHexPy::on_about() {
auto authord = newAboutDialog(QPixmap(), {":/WingHexPy", ":/WingHexPy/img"});
authord->exec();
delete authord;
}
void WingHexPy::on_sponsor() {
auto sponsor = newSponsorDialog();
sponsor->exec();
delete sponsor;
}

View File

@ -39,6 +39,8 @@ public:
public:
void log(QString message);
void on_about();
void on_sponsor();
public:
void RunPyFile(QString filename);