update
This commit is contained in:
parent
7d71e45d6c
commit
af5164ab4d
|
@ -26,27 +26,17 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||
SOURCES += \
|
||||
wingelfparser.cpp \
|
||||
settingdialog.cpp \
|
||||
settings.cpp \
|
||||
sponsordialog.cpp \
|
||||
authordialog.cpp
|
||||
settings.cpp
|
||||
|
||||
HEADERS += \
|
||||
../WingHexExplorer/wing-hex-explorer.sourcecode/WingHexExplorer/plugin/iwingplugin.h \
|
||||
wingelfparser.h \
|
||||
elfhelper.h \
|
||||
settingdialog.h \
|
||||
settings.h \
|
||||
sponsordialog.h \
|
||||
authordialog.h
|
||||
settings.h
|
||||
|
||||
DISTFILES += WingElfParser.json
|
||||
|
||||
FORMS += \
|
||||
settingdialog.ui \
|
||||
sponsordialog.ui \
|
||||
authordialog.ui
|
||||
|
||||
|
||||
TRANSLATIONS += \
|
||||
$$PWD/WingElfParser.ts
|
||||
|
||||
|
|
|
@ -4,125 +4,121 @@
|
|||
<context>
|
||||
<name>AuthorDialog</name>
|
||||
<message>
|
||||
<location filename="authordialog.ui" line="14"/>
|
||||
<source>Dialog</source>
|
||||
<translation>关于作者</translation>
|
||||
<translation type="vanished">关于作者</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingDialog</name>
|
||||
<message>
|
||||
<location filename="settingdialog.ui" line="20"/>
|
||||
<location filename="settingdialog.cpp" line="14"/>
|
||||
<source>SettingDialog</source>
|
||||
<translation>设置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingdialog.ui" line="50"/>
|
||||
<location filename="settingdialog.cpp" line="17"/>
|
||||
<source>elf_header color</source>
|
||||
<translation>elf 文件头颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingdialog.ui" line="57"/>
|
||||
<location filename="settingdialog.ui" line="71"/>
|
||||
<location filename="settingdialog.ui" line="85"/>
|
||||
<location filename="settingdialog.ui" line="99"/>
|
||||
<location filename="settingdialog.ui" line="113"/>
|
||||
<source>ChooseColor</source>
|
||||
<translation>选择颜色</translation>
|
||||
<translation type="vanished">选择颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingdialog.ui" line="64"/>
|
||||
<location filename="settingdialog.cpp" line="23"/>
|
||||
<source>program_table color</source>
|
||||
<translation>程序表颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingdialog.ui" line="78"/>
|
||||
<location filename="settingdialog.cpp" line="30"/>
|
||||
<source>section_header_table color</source>
|
||||
<translation>节区头表颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingdialog.ui" line="92"/>
|
||||
<location filename="settingdialog.cpp" line="36"/>
|
||||
<source>symbol_table color</source>
|
||||
<translation>符号表颜色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingdialog.ui" line="106"/>
|
||||
<location filename="settingdialog.cpp" line="42"/>
|
||||
<source>dynamic_symbol_table color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dynamic_symbol_table</source>
|
||||
<translation>动态符号表颜色</translation>
|
||||
<translation type="vanished">动态符号表颜色</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SponsorDialog</name>
|
||||
<message>
|
||||
<location filename="sponsordialog.ui" line="14"/>
|
||||
<source>Dialog</source>
|
||||
<translation>赞助</translation>
|
||||
<translation type="vanished">赞助</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="sponsordialog.ui" line="26"/>
|
||||
<source>Thanks for sponsor!</source>
|
||||
<translation>感谢大家的赞助支持!</translation>
|
||||
<translation type="vanished">感谢大家的赞助支持!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WingElfPlugin</name>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="30"/>
|
||||
<location filename="wingelfparser.cpp" line="41"/>
|
||||
<location filename="wingelfparser.cpp" line="96"/>
|
||||
<location filename="wingelfparser.cpp" line="118"/>
|
||||
<location filename="wingelfparser.cpp" line="34"/>
|
||||
<location filename="wingelfparser.cpp" line="52"/>
|
||||
<location filename="wingelfparser.cpp" line="107"/>
|
||||
<location filename="wingelfparser.cpp" line="129"/>
|
||||
<source>WingElfParser</source>
|
||||
<translation>羽云 ELF 分析器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="34"/>
|
||||
<location filename="wingelfparser.cpp" line="38"/>
|
||||
<source>A Marker plugin for Elf</source>
|
||||
<translation>一个用于分析标注 ELF 文件结构的插件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="44"/>
|
||||
<location filename="wingelfparser.cpp" line="55"/>
|
||||
<source>AddMetaData</source>
|
||||
<translation>是否添加标注</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="48"/>
|
||||
<location filename="wingelfparser.cpp" line="75"/>
|
||||
<location filename="wingelfparser.cpp" line="59"/>
|
||||
<location filename="wingelfparser.cpp" line="86"/>
|
||||
<source>Analyse</source>
|
||||
<translation>分析</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="52"/>
|
||||
<location filename="wingelfparser.cpp" line="78"/>
|
||||
<location filename="wingelfparser.cpp" line="62"/>
|
||||
<location filename="wingelfparser.cpp" line="88"/>
|
||||
<source>Setting</source>
|
||||
<translation>设置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="55"/>
|
||||
<location filename="wingelfparser.cpp" line="64"/>
|
||||
<source>Author</source>
|
||||
<translation>作者</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="60"/>
|
||||
<location filename="wingelfparser.cpp" line="70"/>
|
||||
<source>Sponsor</source>
|
||||
<translation>赞助</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="70"/>
|
||||
<location filename="wingelfparser.cpp" line="81"/>
|
||||
<source>Value</source>
|
||||
<translation>值</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="113"/>
|
||||
<location filename="wingelfparser.cpp" line="124"/>
|
||||
<source>NoFile</source>
|
||||
<translation>没有打开的文件!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="116"/>
|
||||
<location filename="wingelfparser.cpp" line="127"/>
|
||||
<source>Success</source>
|
||||
<translation>分析完毕!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="wingelfparser.cpp" line="118"/>
|
||||
<location filename="wingelfparser.cpp" line="129"/>
|
||||
<source>Error</source>
|
||||
<translation>分析过程中出现错误!</translation>
|
||||
</message>
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#include "authordialog.h"
|
||||
#include "../WingHexExplorer/wing-hex-explorer.sourcecode/WingHexExplorer/plugin/iwingplugin.h"
|
||||
#include "ui_authordialog.h"
|
||||
|
||||
AuthorDialog::AuthorDialog(QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::AuthorDialog) {
|
||||
ui->setupUi(this);
|
||||
ui->retranslateUi(this);
|
||||
auto txtb = ui->txtb;
|
||||
ui->label->setPixmap(QPixmap(HOSTAUTHORPIMG));
|
||||
txtb->setSearchPaths(
|
||||
QStringList({":/WingElfParser", ":/WingElfParser/image"}));
|
||||
txtb->setSource(QUrl("README.md"), QTextDocument::MarkdownResource);
|
||||
}
|
||||
|
||||
AuthorDialog::~AuthorDialog() { delete ui; }
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef AUTHORDIALOG_H
|
||||
#define AUTHORDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AuthorDialog;
|
||||
}
|
||||
|
||||
class AuthorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AuthorDialog(QWidget *parent = nullptr);
|
||||
~AuthorDialog();
|
||||
|
||||
private:
|
||||
Ui::AuthorDialog *ui;
|
||||
};
|
||||
|
||||
#endif // AUTHORDIALOG_H
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AuthorDialog</class>
|
||||
<widget class="QDialog" name="AuthorDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>20</y>
|
||||
<width>150</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextBrowser" name="txtb">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>190</y>
|
||||
<width>511</width>
|
||||
<height>381</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="markdown">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,30 +1,77 @@
|
|||
#include "settingdialog.h"
|
||||
#include "ui_settingdialog.h"
|
||||
#include <QColorDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPalette>
|
||||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
|
||||
SettingDialog::SettingDialog(QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::SettingDialog) {
|
||||
ui->setupUi(this);
|
||||
ui->retranslateUi(this);
|
||||
SettingDialog::SettingDialog(IWingPlugin *plugin) {
|
||||
// 这里自己确保 plugin != nullptr
|
||||
|
||||
dialog = plugin->newDDialog();
|
||||
dialog->resize(450, 500);
|
||||
dialog->setWindowTitle(tr("SettingDialog"));
|
||||
|
||||
plugin->addSpace(dialog, 20);
|
||||
auto btn_elf_header = new QPushButton(tr("elf_header color"), dialog);
|
||||
btn_elf_header->setMinimumWidth(400);
|
||||
connect(btn_elf_header, &QPushButton::clicked, this,
|
||||
&SettingDialog::on_btn_elf_header_clicked);
|
||||
plugin->addContent(dialog, btn_elf_header, Qt::AlignCenter);
|
||||
plugin->addSpace(dialog, 20);
|
||||
auto btn_program_table = new QPushButton(tr("program_table color"), dialog);
|
||||
btn_program_table->setMinimumWidth(400);
|
||||
connect(btn_program_table, &QPushButton::clicked, this,
|
||||
&SettingDialog::on_btn_program_table_clicked);
|
||||
plugin->addContent(dialog, btn_program_table, Qt::AlignCenter);
|
||||
plugin->addSpace(dialog, 20);
|
||||
auto btn_section_header =
|
||||
new QPushButton(tr("section_header_table color"), dialog);
|
||||
btn_section_header->setMinimumWidth(400);
|
||||
connect(btn_section_header, &QPushButton::clicked, this,
|
||||
&SettingDialog::on_btn_section_header_clicked);
|
||||
plugin->addContent(dialog, btn_section_header, Qt::AlignCenter);
|
||||
plugin->addSpace(dialog, 20);
|
||||
auto btn_symbol = new QPushButton(tr("symbol_table color"), dialog);
|
||||
btn_symbol->setMinimumWidth(400);
|
||||
connect(btn_symbol, &QPushButton::clicked, this,
|
||||
&SettingDialog::on_btn_symbol_clicked);
|
||||
plugin->addContent(dialog, btn_symbol, Qt::AlignCenter);
|
||||
plugin->addSpace(dialog, 20);
|
||||
auto btn_dysymbol = new QPushButton(tr("dynamic_symbol_table color"), dialog);
|
||||
btn_dysymbol->setMinimumWidth(400);
|
||||
connect(btn_dysymbol, &QPushButton::clicked, this,
|
||||
&SettingDialog::on_btn_dysymbol_clicked);
|
||||
plugin->addContent(dialog, btn_dysymbol, Qt::AlignCenter);
|
||||
plugin->addSpace(dialog, 25);
|
||||
auto dbox = new QDialogButtonBox(
|
||||
QDialogButtonBox::Cancel | QDialogButtonBox::Ok, dialog);
|
||||
plugin->addContent(dialog, dbox);
|
||||
connect(dbox, &QDialogButtonBox::accepted, this,
|
||||
&SettingDialog::on_buttonBox_accepted);
|
||||
connect(dbox, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
||||
|
||||
settings = Settings::instance();
|
||||
settings->getAllColor(elf_header_color, program_table_color,
|
||||
section_header_color, symbol_color, dysymbol_color);
|
||||
|
||||
QPalette pe;
|
||||
pe.setColor(QPalette::ButtonText, elf_header_color);
|
||||
ui->btn_elf_header->setPalette(pe);
|
||||
btn_elf_header->setPalette(pe);
|
||||
pe.setColor(QPalette::ButtonText, program_table_color);
|
||||
ui->btn_program_table->setPalette(pe);
|
||||
btn_program_table->setPalette(pe);
|
||||
pe.setColor(QPalette::ButtonText, section_header_color);
|
||||
ui->btn_section_header->setPalette(pe);
|
||||
btn_section_header->setPalette(pe);
|
||||
pe.setColor(QPalette::ButtonText, symbol_color);
|
||||
ui->btn_symbol->setPalette(pe);
|
||||
btn_symbol->setPalette(pe);
|
||||
pe.setColor(QPalette::ButtonText, dysymbol_color);
|
||||
ui->btn_dysymbol->setPalette(pe);
|
||||
btn_dysymbol->setPalette(pe);
|
||||
}
|
||||
|
||||
SettingDialog::~SettingDialog() { delete ui; }
|
||||
SettingDialog::~SettingDialog() { delete dialog; }
|
||||
|
||||
int SettingDialog::show() { return dialog->exec(); }
|
||||
|
||||
#define CHOOSECOLOR(color) \
|
||||
if (chooseColor(color, color)) { \
|
||||
|
@ -50,6 +97,7 @@ void SettingDialog::on_btn_dysymbol_clicked() { CHOOSECOLOR(dysymbol_color) }
|
|||
void SettingDialog::on_buttonBox_accepted() {
|
||||
settings->saveAllColor(elf_header_color, program_table_color,
|
||||
section_header_color, symbol_color, dysymbol_color);
|
||||
dialog->done(1);
|
||||
}
|
||||
|
||||
bool SettingDialog::chooseColor(QColor orign, QColor &color) {
|
||||
|
|
|
@ -1,41 +1,35 @@
|
|||
#ifndef SETTINGDIALOG_H
|
||||
#define SETTINGDIALOG_H
|
||||
|
||||
#include "../WingHexExplorer/wing-hex-explorer.sourcecode/WingHexExplorer/plugin/iwingplugin.h"
|
||||
#include "settings.h"
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class SettingDialog;
|
||||
}
|
||||
|
||||
class SettingDialog : public QDialog {
|
||||
class SettingDialog : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingDialog(QWidget *parent = nullptr);
|
||||
explicit SettingDialog(IWingPlugin *plugin);
|
||||
~SettingDialog();
|
||||
|
||||
int show();
|
||||
|
||||
private slots:
|
||||
void on_btn_elf_header_clicked();
|
||||
|
||||
void on_btn_program_table_clicked();
|
||||
|
||||
void on_btn_section_header_clicked();
|
||||
|
||||
void on_btn_symbol_clicked();
|
||||
|
||||
void on_btn_dysymbol_clicked();
|
||||
|
||||
void on_buttonBox_accepted();
|
||||
|
||||
private:
|
||||
Ui::SettingDialog *ui;
|
||||
|
||||
QColor elf_header_color, program_table_color, section_header_color,
|
||||
symbol_color, dysymbol_color;
|
||||
|
||||
Settings *settings;
|
||||
|
||||
QDialog *dialog = nullptr;
|
||||
|
||||
private:
|
||||
bool chooseColor(QColor orign, QColor &color);
|
||||
};
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#include "sponsordialog.h"
|
||||
#include "../WingHexExplorer/wing-hex-explorer.sourcecode/WingHexExplorer/plugin/iwingplugin.h"
|
||||
#include "ui_sponsordialog.h"
|
||||
|
||||
SponsorDialog::SponsorDialog(QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::SponsorDialog) {
|
||||
ui->setupUi(this);
|
||||
ui->retranslateUi(this);
|
||||
ui->label_2->setPixmap(QPixmap(SPONSORQRCODE));
|
||||
}
|
||||
|
||||
SponsorDialog::~SponsorDialog() { delete ui; }
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef SPONSORDIALOG_H
|
||||
#define SPONSORDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class SponsorDialog;
|
||||
}
|
||||
|
||||
class SponsorDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SponsorDialog(QWidget *parent = nullptr);
|
||||
~SponsorDialog();
|
||||
|
||||
private:
|
||||
Ui::SponsorDialog *ui;
|
||||
};
|
||||
|
||||
#endif // SPONSORDIALOG_H
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SponsorDialog</class>
|
||||
<widget class="QDialog" name="SponsorDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>481</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Thanks for sponsor!</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>481</width>
|
||||
<height>351</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,8 +1,6 @@
|
|||
#include "wingelfparser.h"
|
||||
#include "authordialog.h"
|
||||
#include "settingdialog.h"
|
||||
#include "settings.h"
|
||||
#include "sponsordialog.h"
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QTreeWidgetItem>
|
||||
|
@ -61,16 +59,19 @@ bool WingElfPlugin::init(QList<WingPluginInfo> loadedplugin) {
|
|||
PluginMenuAddItemIconAction(menu, tr("Analyse"), ICONRES("analyse"),
|
||||
WingElfPlugin::analyse);
|
||||
menu->addSeparator();
|
||||
PluginMenuAddItemIconAction(menu, tr("Setting"), ICONRES("setting"),
|
||||
PluginMenuAddItemIconAction(menu, tr("Setting"), HOSTICONRES("setting"),
|
||||
WingElfPlugin::on_setting);
|
||||
PluginMenuAddItemIconLamba(menu, tr("Author"), HOSTICONRES("author"), [=] {
|
||||
AuthorDialog d;
|
||||
d.exec();
|
||||
auto authord = newAboutDialog(
|
||||
QPixmap(), {":/WingElfParser", ":/WingElfParser/image"});
|
||||
authord->exec();
|
||||
delete authord;
|
||||
});
|
||||
PluginMenuAddItemIconLamba(menu, tr("Sponsor"), HOSTICONRES("sponsor"),
|
||||
[=] {
|
||||
SponsorDialog d;
|
||||
d.exec();
|
||||
auto sponsor = newSponsorDialog();
|
||||
sponsor->exec();
|
||||
delete sponsor;
|
||||
});
|
||||
}
|
||||
PluginMenuInitEnd();
|
||||
|
@ -114,8 +115,8 @@ void WingElfPlugin::plugin2MessagePipe(WingPluginMessage type,
|
|||
}
|
||||
|
||||
void WingElfPlugin::on_setting() {
|
||||
SettingDialog s;
|
||||
s.exec();
|
||||
SettingDialog s(this);
|
||||
s.show();
|
||||
}
|
||||
|
||||
void WingElfPlugin::analyse() {
|
||||
|
@ -1030,7 +1031,7 @@ HookIndex WingElfPlugin::getHookSubscribe() { return HookIndex::None; }
|
|||
|
||||
void WingElfPlugin::unload() {}
|
||||
|
||||
uint WingElfPlugin::pluginVersion() { return 1; }
|
||||
uint WingElfPlugin::pluginVersion() { return 2; }
|
||||
|
||||
QMenu *WingElfPlugin::registerMenu() { return menu; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue