遵守最新插件规范
This commit is contained in:
parent
acbfa531eb
commit
54c35e8674
|
@ -6,7 +6,8 @@ AuthorDialog::AuthorDialog(QWidget *parent)
|
|||
ui->setupUi(this);
|
||||
ui->retranslateUi(this);
|
||||
auto txtb = ui->txtb;
|
||||
txtb->setSearchPaths(QStringList({":/", ":/image"}));
|
||||
txtb->setSearchPaths(
|
||||
QStringList({":/WingElfParser", ":/WingElfParser/image"}));
|
||||
txtb->setSource(QUrl("README.md"), QTextDocument::MarkdownResource);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="sources.qrc">:/image/author.jpg</pixmap>
|
||||
<pixmap resource="sources.qrc">:/WingElfParser/image/author.jpg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<qresource prefix="/WingElfParser">
|
||||
<file>image/sponsor.png</file>
|
||||
<file>image/setting.png</file>
|
||||
<file>image/author.png</file>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="sources.qrc">:/image/sp.png</pixmap>
|
||||
<pixmap resource="sources.qrc">:/WingElfParser/image/sp.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <QTreeWidgetItem>
|
||||
#include <elf.h>
|
||||
|
||||
#define ICONRES(name) QIcon(":/WingElfParser/image/" name ".png")
|
||||
|
||||
#define QTWI(parent, title, offset, len) \
|
||||
p = new QTreeWidgetItem(parent, {title}); \
|
||||
p->setData(0, Qt::UserRole, QVariant::fromValue(Analysis{offset, len}));
|
||||
|
@ -46,7 +48,7 @@ bool WingElfPlugin::init(QList<WingPluginInfo> loadedplugin) {
|
|||
return false;
|
||||
}
|
||||
|
||||
auto icon = QIcon(":/image/icon.png");
|
||||
auto icon = ICONRES("icon");
|
||||
|
||||
PluginMenuInitBegin(menu, tr("WingElfParser")) {
|
||||
menu->setIcon(icon);
|
||||
|
@ -55,23 +57,19 @@ bool WingElfPlugin::init(QList<WingPluginInfo> loadedplugin) {
|
|||
auto settings = Settings::instance();
|
||||
settings->setAddMetadata(!settings->addMetadata());
|
||||
});
|
||||
PluginMenuAddItemIconAction(menu, tr("Analyse"),
|
||||
QIcon(":/image/analyse.png"),
|
||||
PluginMenuAddItemIconAction(menu, tr("Analyse"), ICONRES("analyse"),
|
||||
WingElfPlugin::analyse);
|
||||
menu->addSeparator();
|
||||
PluginMenuAddItemIconAction(menu, tr("Setting"),
|
||||
QIcon(":/image/setting.png"),
|
||||
PluginMenuAddItemIconAction(menu, tr("Setting"), ICONRES("setting"),
|
||||
WingElfPlugin::on_setting);
|
||||
PluginMenuAddItemIconLamba(menu, tr("Author"), QIcon(":/image/author.png"),
|
||||
[=] {
|
||||
AuthorDialog d;
|
||||
d.exec();
|
||||
});
|
||||
PluginMenuAddItemIconLamba(menu, tr("Sponsor"),
|
||||
QIcon(":/image/sponsor.png"), [=] {
|
||||
SponsorDialog d;
|
||||
d.exec();
|
||||
});
|
||||
PluginMenuAddItemIconLamba(menu, tr("Author"), ICONRES("author"), [=] {
|
||||
AuthorDialog d;
|
||||
d.exec();
|
||||
});
|
||||
PluginMenuAddItemIconLamba(menu, tr("Sponsor"), ICONRES("sponsor"), [=] {
|
||||
SponsorDialog d;
|
||||
d.exec();
|
||||
});
|
||||
}
|
||||
PluginMenuInitEnd();
|
||||
|
||||
|
@ -82,11 +80,9 @@ bool WingElfPlugin::init(QList<WingPluginInfo> loadedplugin) {
|
|||
|
||||
QMenu *tmenu;
|
||||
PluginMenuInitBegin(tmenu, "") {
|
||||
PluginMenuAddItemIconAction(tmenu, tr("Analyse"),
|
||||
QIcon(":/image/analyse.png"),
|
||||
PluginMenuAddItemIconAction(tmenu, tr("Analyse"), ICONRES("analyse"),
|
||||
WingElfPlugin::analyse);
|
||||
PluginMenuAddItemIconAction(tmenu, tr("Setting"),
|
||||
QIcon(":/image/setting.png"),
|
||||
PluginMenuAddItemIconAction(tmenu, tr("Setting"), ICONRES("setting"),
|
||||
WingElfPlugin::on_setting);
|
||||
}
|
||||
PluginMenuInitEnd();
|
||||
|
@ -122,10 +118,10 @@ void WingElfPlugin::on_setting() {
|
|||
|
||||
void WingElfPlugin::analyse() {
|
||||
if (reader.currentDoc() < 0) {
|
||||
toast(QIcon(":/image/icon.png"), tr("NoFile"));
|
||||
toast(ICONRES("icon"), tr("NoFile"));
|
||||
} else {
|
||||
if (this->parse()) {
|
||||
toast(QIcon(":/image/icon.png"), tr("Success"));
|
||||
toast(ICONRES("icon"), tr("Success"));
|
||||
} else {
|
||||
QMessageBox::critical(nullptr, tr("WingElfParser"), tr("Error"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue