fix: 插件函数重命名;完善插件系统;
This commit is contained in:
parent
58cabdfe08
commit
606e55c057
|
@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON)
|
|||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(PROJECT_VERSION "2.1.0")
|
||||
set(PROJECT_VERSION "2.2.0")
|
||||
|
||||
find_package(
|
||||
QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network Concurrent
|
||||
|
@ -165,8 +165,6 @@ set(DIALOG_SRC
|
|||
src/dialog/colorpickerdialog.h
|
||||
src/dialog/colorpickerdialog.cpp
|
||||
src/dialog/colorpickerdialog.ui
|
||||
src/dialog/showtextdialog.h
|
||||
src/dialog/showtextdialog.cpp
|
||||
src/dialog/splashdialog.ui
|
||||
src/dialog/splashdialog.cpp
|
||||
src/dialog/splashdialog.h
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
|
||||
  如果你想将本软件的代码用于闭源的商业代码,想要解除`GPL`系列的必须开源的限制,请必须亲自咨询我,商讨商业授权相关事宜。
|
||||
|
||||
  对于插件开发相关的,对应的开源协议就不一样了。只针对本仓库下的`src/plugin/iwingplugin.h`、`src/plugin/iwingpluginbase.h`、`src/plugin/iwingdevice.h`和`src/plugin/settingpage.h`遵守`BSD 3-Clause`协议,以允许想要做闭源和商业开发。对于本仓库下的`TestPlugin`的代码(除`TranslationUtils.cmake`这一个文件遵守`BSD 3-Clause`)遵守`MIT`协议。
|
||||
  对于插件开发相关的,对应的开源协议就不一样了。只针对本仓库下的`WingPlugin`的代码遵守`BSD 3-Clause`协议,以允许闭源商业开发。对于本仓库下的`TestPlugin`的代码(除`TranslationUtils.cmake`这一个文件遵守`BSD 3-Clause`)遵守`MIT`协议。
|
||||
|
||||
### 使用声明
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ This software complies with the `AGPL-3.0` agreement. Please do not use it for p
|
|||
|
||||
If you want to use the code of this software for closed-source commercial code and want to lift the restriction of the `GPL` series that it must be open source, please consult me in person to discuss commercial licensing matters.
|
||||
|
||||
For plugin development, the corresponding open source agreements are different. Only `src/plugin/iwingplugin.h`, `src/plugin/iwingpluginbase.h`, `src/plugin/iwingdevice.h` and `src/plugin/settingpage.h` in this repository comply with the `BSD 3-Clause` agreement to allow closed-source and commercial development. The code of `TestPlugin` in this repository (except the file `TranslationUtils.cmake` which complies with `BSD 3-Clause`) complies with the `MIT` agreement.
|
||||
For plugin development, the corresponding open source agreements are different. Only the code of `WingPlugin` in this repository comply with the `BSD 3-Clause` agreement to allow closed-source commercial development. The code of `TestPlugin` in this repository (except the file `TranslationUtils.cmake` which complies with `BSD 3-Clause`) complies with the `MIT` agreement.
|
||||
|
||||
### Usage Statement
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ QIcon SharedMemoryDriver::supportedFileIcon() const {
|
|||
|
||||
QString SharedMemoryDriver::onOpenFileBegin() {
|
||||
bool ok;
|
||||
auto id = getText(nullptr, tr("SharedMemory"), tr("PleaseInputID:"),
|
||||
QLineEdit::Normal, {}, &ok);
|
||||
auto id = dlgGetText(nullptr, tr("SharedMemory"), tr("PleaseInputID:"),
|
||||
QLineEdit::Normal, {}, &ok);
|
||||
if (!ok) {
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
CtlTestForm::CtlTestForm(WingHex::IWingPlugin *plg, QTextBrowser *br,
|
||||
QWidget *parent)
|
||||
: QWidget(parent), WingHex::IWingPluginAPICalls(plg),
|
||||
ui(new Ui::CtlTestForm), _plg(plg), _br(br) {
|
||||
: WingHex::WingPluginWidget(plg, parent), ui(new Ui::CtlTestForm), _br(br) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
@ -32,8 +31,8 @@ CtlTestForm::~CtlTestForm() { delete ui; }
|
|||
|
||||
void CtlTestForm::on_btnInt8_clicked() {
|
||||
bool ok;
|
||||
auto ret = getInt(this, QStringLiteral("Test"), tr("PleaseInputInt8"), 0,
|
||||
INT8_MIN, UINT8_MAX, 1, &ok);
|
||||
auto ret = dlgGetInt(this, QStringLiteral("Test"), tr("PleaseInputInt8"), 0,
|
||||
INT8_MIN, UINT8_MAX, 1, &ok);
|
||||
if (ok) {
|
||||
auto buffer = qint8(ret);
|
||||
if (ui->rbInsert->isChecked()) {
|
||||
|
@ -56,8 +55,8 @@ void CtlTestForm::on_btnInt8_clicked() {
|
|||
|
||||
void CtlTestForm::on_btnInt16_clicked() {
|
||||
bool ok;
|
||||
auto ret = getInt(this, QStringLiteral("Test"), tr("PleaseInputInt16"), 0,
|
||||
INT16_MIN, UINT16_MAX, 1, &ok);
|
||||
auto ret = dlgGetInt(this, QStringLiteral("Test"), tr("PleaseInputInt16"),
|
||||
0, INT16_MIN, UINT16_MAX, 1, &ok);
|
||||
if (ok) {
|
||||
auto buffer = qint16(ret);
|
||||
if (ui->rbInsert->isChecked()) {
|
||||
|
@ -80,8 +79,8 @@ void CtlTestForm::on_btnInt16_clicked() {
|
|||
|
||||
void CtlTestForm::on_btnInt32_clicked() {
|
||||
bool ok;
|
||||
auto ret = getInt(this, QStringLiteral("Test"), tr("PleaseInputInt32"), 0,
|
||||
INT32_MIN, INT32_MAX, 1, &ok);
|
||||
auto ret = dlgGetInt(this, QStringLiteral("Test"), tr("PleaseInputInt32"),
|
||||
0, INT32_MIN, INT32_MAX, 1, &ok);
|
||||
if (ok) {
|
||||
auto buffer = qint32(ret);
|
||||
if (ui->rbInsert->isChecked()) {
|
||||
|
@ -104,8 +103,8 @@ void CtlTestForm::on_btnInt32_clicked() {
|
|||
|
||||
void CtlTestForm::on_btnInt64_clicked() {
|
||||
bool ok;
|
||||
auto ret = getText(this, QStringLiteral("Test"), tr("PleaseInputInt64"),
|
||||
QLineEdit::Normal, QStringLiteral("0"), &ok);
|
||||
auto ret = dlgGetText(this, QStringLiteral("Test"), tr("PleaseInputInt64"),
|
||||
QLineEdit::Normal, QStringLiteral("0"), &ok);
|
||||
if (ok) {
|
||||
auto buffer = qint64(ret.toULongLong(&ok));
|
||||
if (ok) {
|
||||
|
@ -131,8 +130,9 @@ void CtlTestForm::on_btnInt64_clicked() {
|
|||
void CtlTestForm::on_btnFloat_clicked() {
|
||||
bool ok;
|
||||
auto limit = std::numeric_limits<float>();
|
||||
auto ret = getDouble(this, QStringLiteral("Test"), tr("PleaseInputFloat"),
|
||||
0, limit.min(), limit.max(), 0.0, &ok);
|
||||
auto ret =
|
||||
dlgGetDouble(this, QStringLiteral("Test"), tr("PleaseInputFloat"), 0,
|
||||
limit.min(), limit.max(), 0.0, &ok);
|
||||
if (ok) {
|
||||
auto buffer = float(ret);
|
||||
if (ui->rbInsert->isChecked()) {
|
||||
|
@ -156,8 +156,9 @@ void CtlTestForm::on_btnFloat_clicked() {
|
|||
void CtlTestForm::on_btnDouble_clicked() {
|
||||
bool ok;
|
||||
auto limit = std::numeric_limits<double>();
|
||||
auto ret = getDouble(this, QStringLiteral("Test"), tr("PleaseInputFloat"),
|
||||
0, limit.min(), limit.max(), 0.0, &ok);
|
||||
auto ret =
|
||||
dlgGetDouble(this, QStringLiteral("Test"), tr("PleaseInputFloat"), 0,
|
||||
limit.min(), limit.max(), 0.0, &ok);
|
||||
if (ok) {
|
||||
auto buffer = double(ret);
|
||||
if (ui->rbInsert->isChecked()) {
|
||||
|
@ -180,8 +181,9 @@ void CtlTestForm::on_btnDouble_clicked() {
|
|||
|
||||
void CtlTestForm::on_btnString_clicked() {
|
||||
bool ok;
|
||||
auto buffer = getText(this, QStringLiteral("Test"), tr("PleaseInputString"),
|
||||
QLineEdit::Normal, "wingsummer", &ok);
|
||||
auto buffer =
|
||||
dlgGetText(this, QStringLiteral("Test"), tr("PleaseInputString"),
|
||||
QLineEdit::Normal, "wingsummer", &ok);
|
||||
if (ok) {
|
||||
if (ui->rbInsert->isChecked()) {
|
||||
ok = insertContent(ui->sbOffset->value(), buffer);
|
||||
|
@ -195,9 +197,9 @@ void CtlTestForm::on_btnString_clicked() {
|
|||
|
||||
void CtlTestForm::on_btnByteArray_clicked() {
|
||||
bool ok;
|
||||
auto ret = getText(this, QStringLiteral("Test"),
|
||||
tr("PleaseInputByteArray(00 23 5A)"), QLineEdit::Normal,
|
||||
QStringLiteral("00"), &ok);
|
||||
auto ret = dlgGetText(this, QStringLiteral("Test"),
|
||||
tr("PleaseInputByteArray(00 23 5A)"),
|
||||
QLineEdit::Normal, QStringLiteral("00"), &ok);
|
||||
if (ok) {
|
||||
auto buffer = QByteArray::fromHex(ret.toUtf8());
|
||||
if (buffer.isEmpty()) {
|
||||
|
|
|
@ -22,15 +22,14 @@
|
|||
#define CTLTESTFORM_H
|
||||
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
#include "WingPlugin/iwingplugin.h"
|
||||
#include "WingPlugin/wingpluginwidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class CtlTestForm;
|
||||
}
|
||||
|
||||
class CtlTestForm : public QWidget, public WingHex::IWingPluginAPICalls {
|
||||
class CtlTestForm : public WingHex::WingPluginWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -58,7 +57,6 @@ private slots:
|
|||
private:
|
||||
template <typename T>
|
||||
bool writeContent(qsizetype offset, const T &value) {
|
||||
Q_ASSERT(_plg);
|
||||
if constexpr (std::is_integral_v<T>) {
|
||||
if constexpr (sizeof(T) == sizeof(qint8)) {
|
||||
return writeInt8(offset, value);
|
||||
|
@ -90,7 +88,6 @@ private:
|
|||
|
||||
template <typename T>
|
||||
bool insertContent(qsizetype offset, const T &value) {
|
||||
Q_ASSERT(_plg);
|
||||
if constexpr (std::is_integral_v<T>) {
|
||||
if constexpr (sizeof(T) == sizeof(qint8)) {
|
||||
return insertInt8(offset, value);
|
||||
|
@ -122,7 +119,6 @@ private:
|
|||
|
||||
template <typename T>
|
||||
bool appendContent(const T &value) {
|
||||
Q_ASSERT(_plg);
|
||||
if constexpr (std::is_integral_v<T>) {
|
||||
if constexpr (sizeof(T) == sizeof(qint8)) {
|
||||
return appendInt8(value);
|
||||
|
@ -155,7 +151,6 @@ private:
|
|||
private:
|
||||
Ui::CtlTestForm *ui;
|
||||
|
||||
WingHex::IWingPlugin *_plg;
|
||||
QTextBrowser *_br;
|
||||
};
|
||||
|
||||
|
|
|
@ -34,38 +34,38 @@
|
|||
<translation>类型</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ctltestform.cpp" line="35"/>
|
||||
<location filename="../ctltestform.cpp" line="34"/>
|
||||
<source>PleaseInputInt8</source>
|
||||
<translation>请输入8位整数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ctltestform.cpp" line="59"/>
|
||||
<location filename="../ctltestform.cpp" line="58"/>
|
||||
<source>PleaseInputInt16</source>
|
||||
<translation>请输入16位整数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ctltestform.cpp" line="83"/>
|
||||
<location filename="../ctltestform.cpp" line="82"/>
|
||||
<source>PleaseInputInt32</source>
|
||||
<translation>请输入32位整数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ctltestform.cpp" line="107"/>
|
||||
<location filename="../ctltestform.cpp" line="106"/>
|
||||
<source>PleaseInputInt64</source>
|
||||
<translation>请输入64位整数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ctltestform.cpp" line="134"/>
|
||||
<location filename="../ctltestform.cpp" line="159"/>
|
||||
<location filename="../ctltestform.cpp" line="160"/>
|
||||
<source>PleaseInputFloat</source>
|
||||
<translation>请输入单精度浮点数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ctltestform.cpp" line="183"/>
|
||||
<location filename="../ctltestform.cpp" line="185"/>
|
||||
<source>PleaseInputString</source>
|
||||
<translation>请输入字符串</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ctltestform.cpp" line="199"/>
|
||||
<location filename="../ctltestform.cpp" line="201"/>
|
||||
<source>PleaseInputByteArray(00 23 5A)</source>
|
||||
<translation>请输入字节数组(举例:00 23 5A)</translation>
|
||||
</message>
|
||||
|
@ -272,23 +272,23 @@
|
|||
<translation>数据可视化</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="336"/>
|
||||
<location filename="../testform.cpp" line="345"/>
|
||||
<location filename="../testform.cpp" line="340"/>
|
||||
<location filename="../testform.cpp" line="349"/>
|
||||
<source>UpdateTextTreeError</source>
|
||||
<translation>更新文本树失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="360"/>
|
||||
<location filename="../testform.cpp" line="364"/>
|
||||
<source>UpdateTextListByModelError</source>
|
||||
<translation>通过模型更新文本列表失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="370"/>
|
||||
<location filename="../testform.cpp" line="374"/>
|
||||
<source>UpdateTextTableByModelError</source>
|
||||
<translation>通过模型更新文本表格失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../testform.cpp" line="381"/>
|
||||
<location filename="../testform.cpp" line="385"/>
|
||||
<source>UpdateTextTreeByModelError</source>
|
||||
<translation>通过模型更新文本树失败</translation>
|
||||
</message>
|
||||
|
@ -357,7 +357,7 @@
|
|||
<context>
|
||||
<name>TestPluginPage</name>
|
||||
<message>
|
||||
<location filename="../testpluginpage.cpp" line="16"/>
|
||||
<location filename="../testpluginpage.cpp" line="36"/>
|
||||
<source>TestPluginPage</source>
|
||||
<translation>测试插件页</translation>
|
||||
</message>
|
||||
|
@ -365,7 +365,7 @@
|
|||
<context>
|
||||
<name>TestWingEditorViewWidget</name>
|
||||
<message>
|
||||
<location filename="../testwingeditorviewwidget.cpp" line="28"/>
|
||||
<location filename="../testwingeditorviewwidget.cpp" line="48"/>
|
||||
<source>TestWingEditorView</source>
|
||||
<translation>测试插件编辑视图</translation>
|
||||
</message>
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
ReaderTestForm::ReaderTestForm(WingHex::IWingPlugin *plg, QTextBrowser *br,
|
||||
QWidget *parent)
|
||||
: QWidget(parent), WingHex::IWingPluginCalls(plg),
|
||||
ui(new Ui::ReaderTestForm), _plg(plg), _br(br) {
|
||||
: WingHex::WingPluginWidget(plg, parent), ui(new Ui::ReaderTestForm),
|
||||
_br(br) {
|
||||
ui->setupUi(this);
|
||||
ui->sbOffset->setRange(0, INT_MAX);
|
||||
}
|
||||
|
|
|
@ -22,15 +22,14 @@
|
|||
#define READERTESTFORM_H
|
||||
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
#include "WingPlugin/iwingplugin.h"
|
||||
#include "WingPlugin/wingpluginwidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class ReaderTestForm;
|
||||
}
|
||||
|
||||
class ReaderTestForm : public QWidget, public WingHex::IWingPluginCalls {
|
||||
class ReaderTestForm : public WingHex::WingPluginWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -63,7 +62,6 @@ private:
|
|||
private:
|
||||
Ui::ReaderTestForm *ui;
|
||||
|
||||
WingHex::IWingPlugin *_plg;
|
||||
QTextBrowser *_br;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "testform.h"
|
||||
#include "WingPlugin/iwingpluginbase.h"
|
||||
#include "ui_testform.h"
|
||||
|
||||
#include "ctltestform.h"
|
||||
|
@ -33,7 +34,7 @@
|
|||
#include <QStringListModel>
|
||||
|
||||
TestForm::TestForm(WingHex::IWingPlugin *plg, QWidget *parent)
|
||||
: QWidget(parent), WingHex::IWingPluginAPICalls(plg), ui(new Ui::TestForm) {
|
||||
: WingHex::WingPluginWidget(plg, parent), ui(new Ui::TestForm) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->teDataVisual->setAcceptRichText(false);
|
||||
|
@ -153,32 +154,32 @@ QFileDialog::Options TestForm::getFileDialogOptions() const {
|
|||
}
|
||||
|
||||
void TestForm::onDVClicked(const QModelIndex &index) {
|
||||
warn(QStringLiteral("[Test - Click] ") +
|
||||
index.model()->data(index).toString());
|
||||
logWarn(QStringLiteral("[Test - Click] ") +
|
||||
index.model()->data(index).toString());
|
||||
}
|
||||
|
||||
void TestForm::onDVDoubleClicked(const QModelIndex &index) {
|
||||
warning(this, QStringLiteral("Test - DoubleClick"),
|
||||
index.model()->data(index).toString());
|
||||
msgWarning(this, QStringLiteral("Test - DoubleClick"),
|
||||
index.model()->data(index).toString());
|
||||
}
|
||||
|
||||
void TestForm::on_btnSendLog_clicked() {
|
||||
auto txt = ui->leLogText->text();
|
||||
switch (Level(ui->cbLogLevel->currentIndex())) {
|
||||
case q1ERROR:
|
||||
error(txt);
|
||||
logError(txt);
|
||||
break;
|
||||
case q2WARN:
|
||||
warn(txt);
|
||||
logWarn(txt);
|
||||
break;
|
||||
case q3INFO:
|
||||
info(txt);
|
||||
logInfo(txt);
|
||||
break;
|
||||
case q4DEBUG:
|
||||
debug(txt);
|
||||
logDebug(txt);
|
||||
break;
|
||||
case q5TRACE:
|
||||
trace(txt);
|
||||
logTrace(txt);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -193,17 +194,17 @@ void TestForm::on_btnSendToast_clicked() {
|
|||
}
|
||||
|
||||
void TestForm::on_btnAboutQt_clicked() {
|
||||
aboutQt(this, ui->leAboutTitle->text());
|
||||
msgAboutQt(this, ui->leAboutTitle->text());
|
||||
}
|
||||
|
||||
void TestForm::on_btnQuestion_clicked() {
|
||||
question(
|
||||
msgQuestion(
|
||||
this, ui->leMsgTitle->text(), ui->leMsgText->text(), getMsgButtons(),
|
||||
QMessageBox::StandardButton(ui->cbMsgDefButton->currentData().toInt()));
|
||||
}
|
||||
|
||||
void TestForm::on_btnWarning_clicked() {
|
||||
warning(
|
||||
msgWarning(
|
||||
this, ui->leMsgTitle->text(), ui->leMsgText->text(), getMsgButtons(),
|
||||
QMessageBox::StandardButton(ui->cbMsgDefButton->currentData().toInt()));
|
||||
}
|
||||
|
@ -215,7 +216,7 @@ void TestForm::on_btnCritical_clicked() {
|
|||
}
|
||||
|
||||
void TestForm::on_btnAbout_clicked() {
|
||||
about(this, ui->leMsgTitle->text(), ui->leMsgText->text());
|
||||
msgAbout(this, ui->leMsgTitle->text(), ui->leMsgText->text());
|
||||
}
|
||||
|
||||
void TestForm::on_btnMsgBox_clicked() {
|
||||
|
@ -227,8 +228,9 @@ void TestForm::on_btnMsgBox_clicked() {
|
|||
|
||||
void TestForm::on_btnText_clicked() {
|
||||
bool ok = false;
|
||||
auto ret = getText(this, ui->leInputTitle->text(), ui->leInputLabel->text(),
|
||||
QLineEdit::Normal, __FUNCTION__, &ok);
|
||||
auto ret =
|
||||
dlgGetText(this, ui->leInputTitle->text(), ui->leInputLabel->text(),
|
||||
QLineEdit::Normal, __FUNCTION__, &ok);
|
||||
ui->tbInputLogger->append(
|
||||
QStringLiteral("[getText] ( ") %
|
||||
(ok ? QStringLiteral("true") : QStringLiteral("false")) %
|
||||
|
@ -237,8 +239,8 @@ void TestForm::on_btnText_clicked() {
|
|||
|
||||
void TestForm::on_btnMultiLineText_clicked() {
|
||||
bool ok = false;
|
||||
auto ret = getMultiLineText(this, ui->leInputTitle->text(),
|
||||
ui->leInputLabel->text(), __FUNCTION__, &ok);
|
||||
auto ret = dlgGetMultiLineText(this, ui->leInputTitle->text(),
|
||||
ui->leInputLabel->text(), __FUNCTION__, &ok);
|
||||
ui->tbInputLogger->append(
|
||||
QStringLiteral("[getText] ( ") %
|
||||
(ok ? QStringLiteral("true") : QStringLiteral("false")) %
|
||||
|
@ -251,8 +253,8 @@ void TestForm::on_btnItem_clicked() {
|
|||
l.append(QStringLiteral("WingSummer WingHex2 - %1").arg(i));
|
||||
}
|
||||
bool ok = false;
|
||||
auto ret = getItem(this, ui->leInputTitle->text(), ui->leInputLabel->text(),
|
||||
l, 0, true, &ok);
|
||||
auto ret = dlgGetItem(this, ui->leInputTitle->text(),
|
||||
ui->leInputLabel->text(), l, 0, true, &ok);
|
||||
ui->tbInputLogger->append(
|
||||
QStringLiteral("[getItem] ( ") %
|
||||
(ok ? QStringLiteral("true") : QStringLiteral("false")) %
|
||||
|
@ -261,8 +263,9 @@ void TestForm::on_btnItem_clicked() {
|
|||
|
||||
void TestForm::on_btnInt_clicked() {
|
||||
bool ok = false;
|
||||
auto ret = getInt(this, ui->leInputTitle->text(), ui->leInputLabel->text(),
|
||||
0, 0, WingHex::SDKVERSION, 1, &ok);
|
||||
auto ret =
|
||||
dlgGetInt(this, ui->leInputTitle->text(), ui->leInputLabel->text(), 0,
|
||||
0, WingHex::SDKVERSION, 1, &ok);
|
||||
ui->tbInputLogger->append(
|
||||
QStringLiteral("[getInt] ( ") %
|
||||
(ok ? QStringLiteral("true") : QStringLiteral("false")) %
|
||||
|
@ -272,9 +275,9 @@ void TestForm::on_btnInt_clicked() {
|
|||
void TestForm::on_btnDouble_clicked() {
|
||||
bool ok = false;
|
||||
auto ret =
|
||||
getDouble(this, ui->leInputTitle->text(), ui->leInputLabel->text(),
|
||||
QLineEdit::Normal, -double(WingHex::SDKVERSION), 0.0,
|
||||
double(WingHex::SDKVERSION), &ok);
|
||||
dlgGetDouble(this, ui->leInputTitle->text(), ui->leInputLabel->text(),
|
||||
QLineEdit::Normal, -double(WingHex::SDKVERSION), 0.0,
|
||||
double(WingHex::SDKVERSION), &ok);
|
||||
ui->tbInputLogger->append(
|
||||
QStringLiteral("[getDouble] ( ") %
|
||||
(ok ? QStringLiteral("true") : QStringLiteral("false")) %
|
||||
|
@ -282,21 +285,21 @@ void TestForm::on_btnDouble_clicked() {
|
|||
}
|
||||
|
||||
void TestForm::on_btnExistingDirectory_clicked() {
|
||||
auto ret = getExistingDirectory(this, ui->leFileCaption->text(),
|
||||
qApp->applicationDirPath(),
|
||||
getFileDialogOptions());
|
||||
auto ret = dlgGetExistingDirectory(this, ui->leFileCaption->text(),
|
||||
qApp->applicationDirPath(),
|
||||
getFileDialogOptions());
|
||||
ui->tbFileLogger->append(QStringLiteral("[getExistingDirectory] ") % ret);
|
||||
}
|
||||
|
||||
void TestForm::on_btnOpenFileName_clicked() {
|
||||
auto ret = getOpenFileName(
|
||||
auto ret = dlgGetOpenFileName(
|
||||
this, ui->leFileCaption->text(), qApp->applicationDirPath(),
|
||||
ui->leFileFilter->text(), nullptr, getFileDialogOptions());
|
||||
ui->tbFileLogger->append(QStringLiteral("[getOpenFileName] ") % ret);
|
||||
}
|
||||
|
||||
void TestForm::on_btnOpenFileNames_clicked() {
|
||||
auto ret = getOpenFileNames(
|
||||
auto ret = dlgGetOpenFileNames(
|
||||
this, ui->leFileCaption->text(), qApp->applicationDirPath(),
|
||||
ui->leFileFilter->text(), nullptr, getFileDialogOptions());
|
||||
ui->tbFileLogger->append(QStringLiteral("[getOpenFileName] ") %
|
||||
|
@ -304,14 +307,14 @@ void TestForm::on_btnOpenFileNames_clicked() {
|
|||
}
|
||||
|
||||
void TestForm::on_btnSaveFileName_clicked() {
|
||||
auto ret = getSaveFileName(
|
||||
auto ret = dlgGetSaveFileName(
|
||||
this, ui->leFileCaption->text(), qApp->applicationDirPath(),
|
||||
ui->leFileFilter->text(), nullptr, getFileDialogOptions());
|
||||
ui->tbFileLogger->append(QStringLiteral("[getSaveFileName] ") % ret);
|
||||
}
|
||||
|
||||
void TestForm::on_btnGetColor_clicked() {
|
||||
auto ret = getColor(ui->leColorCaption->text(), this);
|
||||
auto ret = dlgGetColor(ui->leColorCaption->text(), this);
|
||||
if (ret.isValid()) {
|
||||
ui->wColor->setStyleSheet(QStringLiteral("background-color:") +
|
||||
ret.name());
|
||||
|
@ -321,26 +324,27 @@ void TestForm::on_btnGetColor_clicked() {
|
|||
}
|
||||
|
||||
void TestForm::on_btnText_2_clicked() {
|
||||
updateText(ui->teDataVisual->toPlainText(), QStringLiteral("TestForm"));
|
||||
dataVisualText(ui->teDataVisual->toPlainText(), QStringLiteral("TestForm"));
|
||||
}
|
||||
|
||||
void TestForm::on_btnTextList_clicked() {
|
||||
auto txts = ui->teDataVisual->toPlainText().split('\n');
|
||||
updateTextList(txts, QStringLiteral("TestForm"), _click, _dblclick);
|
||||
dataVisualTextList(txts, QStringLiteral("TestForm"), _click, _dblclick);
|
||||
}
|
||||
|
||||
void TestForm::on_btnTextTree_clicked() {
|
||||
auto ret = updateTextTree(ui->teDataVisual->toPlainText(),
|
||||
QStringLiteral("TestForm"), _click, _dblclick);
|
||||
auto ret =
|
||||
dataVisualTextTree(ui->teDataVisual->toPlainText(),
|
||||
QStringLiteral("TestForm"), _click, _dblclick);
|
||||
if (!ret) {
|
||||
critical(this, QStringLiteral("Test"), tr("UpdateTextTreeError"));
|
||||
}
|
||||
}
|
||||
|
||||
void TestForm::on_btnTextTable_clicked() {
|
||||
auto ret = updateTextTable(ui->teDataVisual->toPlainText(),
|
||||
{"wingsummer", "wingsummer"}, {},
|
||||
QStringLiteral("TestForm"), _click, _dblclick);
|
||||
auto ret = dataVisualTextTable(
|
||||
ui->teDataVisual->toPlainText(), {"wingsummer", "wingsummer"}, {},
|
||||
QStringLiteral("TestForm"), _click, _dblclick);
|
||||
if (!ret) {
|
||||
critical(this, QStringLiteral("Test"), tr("UpdateTextTreeError"));
|
||||
}
|
||||
|
@ -353,8 +357,8 @@ void TestForm::on_btnTextListByModel_clicked() {
|
|||
buffer.append("wingsummer" % QString::number(i));
|
||||
}
|
||||
model->setStringList(buffer);
|
||||
auto ret = updateTextListByModel(model, QStringLiteral("TestForm"), _click,
|
||||
_dblclick);
|
||||
auto ret = dataVisualTextListByModel(model, QStringLiteral("TestForm"),
|
||||
_click, _dblclick);
|
||||
if (!ret) {
|
||||
critical(this, QStringLiteral("Test"),
|
||||
tr("UpdateTextListByModelError"));
|
||||
|
@ -363,8 +367,8 @@ void TestForm::on_btnTextListByModel_clicked() {
|
|||
|
||||
void TestForm::on_btnTextTableByModel_clicked() {
|
||||
auto model = new TestTableModel;
|
||||
auto ret = updateTextTableByModel(model, QStringLiteral("TestForm"), _click,
|
||||
_dblclick);
|
||||
auto ret = dataVisualTextTableByModel(model, QStringLiteral("TestForm"),
|
||||
_click, _dblclick);
|
||||
if (!ret) {
|
||||
critical(this, QStringLiteral("Test"),
|
||||
tr("UpdateTextTableByModelError"));
|
||||
|
@ -374,8 +378,8 @@ void TestForm::on_btnTextTableByModel_clicked() {
|
|||
void TestForm::on_btnTextTreeByModel_clicked() {
|
||||
auto model = new QFileSystemModel;
|
||||
model->setRootPath(QDir::currentPath());
|
||||
auto ret = updateTextTreeByModel(model, QStringLiteral("TestForm"), _click,
|
||||
_dblclick);
|
||||
auto ret = dataVisualTextTreeByModel(model, QStringLiteral("TestForm"),
|
||||
_click, _dblclick);
|
||||
if (!ret) {
|
||||
critical(this, QStringLiteral("Test"),
|
||||
tr("UpdateTextTreeByModelError"));
|
||||
|
|
|
@ -21,15 +21,13 @@
|
|||
#ifndef TESTFORM_H
|
||||
#define TESTFORM_H
|
||||
|
||||
#include "WingPlugin/iwingplugin.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include "WingPlugin/wingpluginwidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class TestForm;
|
||||
}
|
||||
|
||||
class TestForm : public QWidget, public WingHex::IWingPluginAPICalls {
|
||||
class TestForm : public WingHex::WingPluginWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
|
|
@ -238,7 +238,7 @@ bool TestPlugin::init(const std::unique_ptr<QSettings> &set) {
|
|||
QStringLiteral("(%1, %2)").arg(i).arg(y));
|
||||
connect(tb, &QToolButton::clicked, this, [this] {
|
||||
auto tb = qobject_cast<QToolButton *>(sender());
|
||||
information(nullptr, tr("Click"), tb->text());
|
||||
msgInformation(nullptr, tr("Click"), tb->text());
|
||||
});
|
||||
tbtb.tools.append(tb);
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ bool TestPlugin::init(const std::unique_ptr<QSettings> &set) {
|
|||
auto a = new QAction(
|
||||
micon, QStringLiteral("Test - ") + QString::number(i), _tmenu);
|
||||
connect(a, &QAction::triggered, this, [this, a]() {
|
||||
information(nullptr, QStringLiteral("Test"), a->text());
|
||||
msgInformation(nullptr, QStringLiteral("Test"), a->text());
|
||||
});
|
||||
_tmenu->addAction(a);
|
||||
}
|
||||
|
@ -511,10 +511,10 @@ QVariant TestPlugin::testCrash(const QVariantList ¶ms) {
|
|||
return {};
|
||||
}
|
||||
|
||||
void TestPlugin::test_a() { debug(__FUNCTION__); }
|
||||
void TestPlugin::test_a() { logDebug(__FUNCTION__); }
|
||||
|
||||
void TestPlugin::test_b(const QString &b) {
|
||||
warn(__FUNCTION__ + QStringLiteral(" : ") % b);
|
||||
logWarn(__FUNCTION__ + QStringLiteral(" : ") % b);
|
||||
}
|
||||
|
||||
void TestPlugin::test_c(const QVector<int> &c) {
|
||||
|
@ -529,7 +529,7 @@ void TestPlugin::test_c(const QVector<int> &c) {
|
|||
|
||||
content += QStringLiteral(" }");
|
||||
|
||||
warn(content);
|
||||
logWarn(content);
|
||||
}
|
||||
|
||||
void TestPlugin::test_d(const QVariantHash &d) {
|
||||
|
@ -544,21 +544,21 @@ void TestPlugin::test_d(const QVariantHash &d) {
|
|||
content += hash.join(", ");
|
||||
}
|
||||
content += QStringLiteral(" }");
|
||||
warn(content);
|
||||
logWarn(content);
|
||||
}
|
||||
|
||||
bool TestPlugin::test_e() {
|
||||
warn(__FUNCTION__);
|
||||
logWarn(__FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
|
||||
QByteArray TestPlugin::test_f() {
|
||||
warn(__FUNCTION__);
|
||||
logWarn(__FUNCTION__);
|
||||
return "wingsummer";
|
||||
}
|
||||
|
||||
QString TestPlugin::test_g() {
|
||||
warn(__FUNCTION__);
|
||||
logWarn(__FUNCTION__);
|
||||
return "wingsummer";
|
||||
}
|
||||
|
||||
|
@ -604,8 +604,8 @@ void TestPlugin::destoryTestShareMem() {
|
|||
}
|
||||
|
||||
void TestPlugin::printLogTestSharedMemData() {
|
||||
warn(QByteArray(reinterpret_cast<const char *>(_tsharemem->data()), 20)
|
||||
.toHex(' '));
|
||||
logWarn(QByteArray(reinterpret_cast<const char *>(_tsharemem->data()), 20)
|
||||
.toHex(' '));
|
||||
}
|
||||
|
||||
void TestPlugin::setPluginMetaTestEnabled(bool b) {
|
||||
|
@ -613,7 +613,6 @@ void TestPlugin::setPluginMetaTestEnabled(bool b) {
|
|||
ENABLE_META = b;
|
||||
for (auto &i : TestWingEditorViewWidget::instances()) {
|
||||
i->setEnableMeta(b);
|
||||
i->docSaved(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
** in the Software without restriction, including without limitation the rights
|
||||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
** copies of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
** THE SOFTWARE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "testpluginpage.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
** in the Software without restriction, including without limitation the rights
|
||||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
** copies of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
** THE SOFTWARE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef TESTPLUGINPAGE_H
|
||||
#define TESTPLUGINPAGE_H
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
** in the Software without restriction, including without limitation the rights
|
||||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
** copies of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
** THE SOFTWARE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "testsettingpage.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
** in the Software without restriction, including without limitation the rights
|
||||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
** copies of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
** THE SOFTWARE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef TESTSETTINGPAGE_H
|
||||
#define TESTSETTINGPAGE_H
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
** in the Software without restriction, including without limitation the rights
|
||||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
** copies of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
** THE SOFTWARE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "testtablemodel.h"
|
||||
#include "WingPlugin/iwingpluginbase.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
** in the Software without restriction, including without limitation the rights
|
||||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
** copies of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
** THE SOFTWARE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef TESTTABLEMODEL_H
|
||||
#define TESTTABLEMODEL_H
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
** in the Software without restriction, including without limitation the rights
|
||||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
** copies of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
** THE SOFTWARE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "testwingeditorviewwidget.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
@ -33,8 +53,8 @@ QString TestWingEditorViewWidget::Creator::id() const {
|
|||
}
|
||||
|
||||
void TestWingEditorViewWidget::toggled(bool isVisible) {
|
||||
warn(__FUNCTION__ + QStringLiteral(": ") +
|
||||
(isVisible ? QStringLiteral("true") : QStringLiteral("false")));
|
||||
logWarn(__FUNCTION__ + QStringLiteral(": ") +
|
||||
(isVisible ? QStringLiteral("true") : QStringLiteral("false")));
|
||||
}
|
||||
|
||||
WingHex::WingEditorViewWidget *TestWingEditorViewWidget::clone() {
|
||||
|
@ -42,7 +62,7 @@ WingHex::WingEditorViewWidget *TestWingEditorViewWidget::clone() {
|
|||
}
|
||||
|
||||
void TestWingEditorViewWidget::loadState(const QByteArray &state) {
|
||||
warn(__FUNCTION__ + QStringLiteral(": ") + QString::fromUtf8(state));
|
||||
logWarn(__FUNCTION__ + QStringLiteral(": ") + QString::fromUtf8(state));
|
||||
}
|
||||
|
||||
bool TestWingEditorViewWidget::hasUnsavedState() { return m_unSaved; }
|
||||
|
@ -50,8 +70,8 @@ bool TestWingEditorViewWidget::hasUnsavedState() { return m_unSaved; }
|
|||
QByteArray TestWingEditorViewWidget::saveState() { return "wingsummer"; }
|
||||
|
||||
void TestWingEditorViewWidget::onWorkSpaceNotify(bool isWorkSpace) {
|
||||
warn(__FUNCTION__ + QStringLiteral(": ") +
|
||||
(isWorkSpace ? QStringLiteral("true") : QStringLiteral("false")));
|
||||
logWarn(__FUNCTION__ + QStringLiteral(": ") +
|
||||
(isWorkSpace ? QStringLiteral("true") : QStringLiteral("false")));
|
||||
}
|
||||
|
||||
QList<TestWingEditorViewWidget *> TestWingEditorViewWidget::instances() {
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
** of this software and associated documentation files (the "Software"), to deal
|
||||
** in the Software without restriction, including without limitation the rights
|
||||
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
** copies of the Software, and to permit persons to whom the Software is
|
||||
** furnished to do so.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
** THE SOFTWARE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef TESTWINGEDITORVIEWWIDGET_H
|
||||
#define TESTWINGEDITORVIEWWIDGET_H
|
||||
|
||||
|
|
|
@ -32,7 +32,10 @@ add_library(
|
|||
iwingpluginbasecalls.cpp
|
||||
iwingplugincalls.h
|
||||
iwingplugincalls.cpp
|
||||
wingplugincallconvertor.h wingplugincallconvertor.cpp)
|
||||
wingplugincallconvertor.h
|
||||
wingplugincallconvertor.cpp
|
||||
wingpluginwidget.h
|
||||
wingpluginwidget.cpp)
|
||||
|
||||
target_link_libraries(WingPlugin PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2018, the respective contributors, as shown by the AUTHORS file.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace WingHex {
|
||||
|
||||
Q_DECL_UNUSED constexpr auto SDKVERSION = 15;
|
||||
Q_DECL_UNUSED constexpr auto SDKVERSION = 16;
|
||||
|
||||
WINGPLUGIN_EXPORT QString PLUGINDIR();
|
||||
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "iwingpluginbasecalls.h"
|
||||
|
||||
#include "WingPlugin/wingcore.h"
|
||||
|
@ -14,32 +34,32 @@ void IWingPluginBaseCalls::toast(const QPixmap &icon, const QString &message) {
|
|||
WINGAPI_ARG(icon), WINGAPI_ARG(message));
|
||||
}
|
||||
|
||||
void IWingPluginBaseCalls::trace(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::trace);
|
||||
void IWingPluginBaseCalls::logTrace(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logTrace);
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
||||
WINGAPI_ARG(message));
|
||||
}
|
||||
|
||||
void IWingPluginBaseCalls::debug(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::debug);
|
||||
void IWingPluginBaseCalls::logDebug(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logDebug);
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
||||
WINGAPI_ARG(message));
|
||||
}
|
||||
|
||||
void IWingPluginBaseCalls::warn(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::warn);
|
||||
void IWingPluginBaseCalls::logWarn(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logWarn);
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
||||
WINGAPI_ARG(message));
|
||||
}
|
||||
|
||||
void IWingPluginBaseCalls::error(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::error);
|
||||
void IWingPluginBaseCalls::logError(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logError);
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
||||
WINGAPI_ARG(message));
|
||||
}
|
||||
|
||||
void IWingPluginBaseCalls::info(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::info);
|
||||
void IWingPluginBaseCalls::logInfo(const QString &message) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::logInfo);
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
||||
WINGAPI_ARG(message));
|
||||
}
|
||||
|
@ -60,18 +80,31 @@ QDialog *IWingPluginBaseCalls::createDialog(QWidget *content) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void IWingPluginBaseCalls::aboutQt(QWidget *parent, const QString &title) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::aboutQt);
|
||||
void IWingPluginBaseCalls::msgAboutQt(QWidget *parent, const QString &title) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgAboutQt);
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
||||
WINGAPI_ARG(parent), WINGAPI_ARG(title));
|
||||
}
|
||||
|
||||
QMessageBox::StandardButton IWingPluginBaseCalls::msgInformation(
|
||||
QWidget *parent, const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgInformation);
|
||||
QMessageBox::StandardButton ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
WINGAPI_ARG(text), WINGAPI_ARG(buttons),
|
||||
WINGAPI_ARG(defaultButton));
|
||||
return ret;
|
||||
}
|
||||
|
||||
QMessageBox::StandardButton
|
||||
IWingPluginBaseCalls::information(QWidget *parent, const QString &title,
|
||||
IWingPluginBaseCalls::msgQuestion(QWidget *parent, const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::information);
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgQuestion);
|
||||
QMessageBox::StandardButton ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
|
@ -81,25 +114,11 @@ IWingPluginBaseCalls::information(QWidget *parent, const QString &title,
|
|||
}
|
||||
|
||||
QMessageBox::StandardButton
|
||||
IWingPluginBaseCalls::question(QWidget *parent, const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::question);
|
||||
QMessageBox::StandardButton ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
WINGAPI_ARG(text), WINGAPI_ARG(buttons),
|
||||
WINGAPI_ARG(defaultButton));
|
||||
return ret;
|
||||
}
|
||||
|
||||
QMessageBox::StandardButton
|
||||
IWingPluginBaseCalls::warning(QWidget *parent, const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::warning);
|
||||
IWingPluginBaseCalls::msgWarning(QWidget *parent, const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgWarning);
|
||||
QMessageBox::StandardButton ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
|
@ -122,9 +141,9 @@ IWingPluginBaseCalls::critical(QWidget *parent, const QString &title,
|
|||
return ret;
|
||||
}
|
||||
|
||||
void IWingPluginBaseCalls::about(QWidget *parent, const QString &title,
|
||||
const QString &text) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::about);
|
||||
void IWingPluginBaseCalls::msgAbout(QWidget *parent, const QString &title,
|
||||
const QString &text) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::msgAbout);
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, getSenderObj(),
|
||||
WINGAPI_ARG(parent), WINGAPI_ARG(title), WINGAPI_ARG(text));
|
||||
}
|
||||
|
@ -143,12 +162,12 @@ IWingPluginBaseCalls::msgbox(QWidget *parent, QMessageBox::Icon icon,
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString IWingPluginBaseCalls::getText(QWidget *parent, const QString &title,
|
||||
const QString &label,
|
||||
QLineEdit::EchoMode echo,
|
||||
const QString &text, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getText);
|
||||
QString
|
||||
IWingPluginBaseCalls::dlgGetText(QWidget *parent, const QString &title,
|
||||
const QString &label, QLineEdit::EchoMode echo,
|
||||
const QString &text, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetText);
|
||||
QString ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
|
@ -157,10 +176,10 @@ QString IWingPluginBaseCalls::getText(QWidget *parent, const QString &title,
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString IWingPluginBaseCalls::getMultiLineText(
|
||||
QString IWingPluginBaseCalls::dlgGetMultiLineText(
|
||||
QWidget *parent, const QString &title, const QString &label,
|
||||
const QString &text, bool *ok, Qt::InputMethodHints inputMethodHints) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getMultiLineText);
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetMultiLineText);
|
||||
QString ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
|
@ -169,12 +188,12 @@ QString IWingPluginBaseCalls::getMultiLineText(
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString IWingPluginBaseCalls::getItem(QWidget *parent, const QString &title,
|
||||
const QString &label,
|
||||
const QStringList &items, int current,
|
||||
bool editable, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getItem);
|
||||
QString
|
||||
IWingPluginBaseCalls::dlgGetItem(QWidget *parent, const QString &title,
|
||||
const QString &label, const QStringList &items,
|
||||
int current, bool editable, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetItem);
|
||||
QString ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
|
@ -184,10 +203,11 @@ QString IWingPluginBaseCalls::getItem(QWidget *parent, const QString &title,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int IWingPluginBaseCalls::getInt(QWidget *parent, const QString &title,
|
||||
const QString &label, int value, int minValue,
|
||||
int maxValue, int step, bool *ok) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getInt);
|
||||
int IWingPluginBaseCalls::dlgGetInt(QWidget *parent, const QString &title,
|
||||
const QString &label, int value,
|
||||
int minValue, int maxValue, int step,
|
||||
bool *ok) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetInt);
|
||||
int ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
|
@ -196,11 +216,11 @@ int IWingPluginBaseCalls::getInt(QWidget *parent, const QString &title,
|
|||
return ret;
|
||||
}
|
||||
|
||||
double IWingPluginBaseCalls::getDouble(QWidget *parent, const QString &title,
|
||||
const QString &label, double value,
|
||||
double minValue, double maxValue,
|
||||
int decimals, bool *ok, double step) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getDouble);
|
||||
double IWingPluginBaseCalls::dlgGetDouble(QWidget *parent, const QString &title,
|
||||
const QString &label, double value,
|
||||
double minValue, double maxValue,
|
||||
int decimals, bool *ok, double step) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetDouble);
|
||||
double ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(title),
|
||||
|
@ -210,10 +230,10 @@ double IWingPluginBaseCalls::getDouble(QWidget *parent, const QString &title,
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString IWingPluginBaseCalls::getExistingDirectory(
|
||||
QString IWingPluginBaseCalls::dlgGetExistingDirectory(
|
||||
QWidget *parent, const QString &caption, const QString &dir,
|
||||
QFileDialog::Options options) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getExistingDirectory);
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetExistingDirectory);
|
||||
QString ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(caption),
|
||||
|
@ -221,13 +241,13 @@ QString IWingPluginBaseCalls::getExistingDirectory(
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString IWingPluginBaseCalls::getOpenFileName(QWidget *parent,
|
||||
const QString &caption,
|
||||
const QString &dir,
|
||||
const QString &filter,
|
||||
QString *selectedFilter,
|
||||
QFileDialog::Options options) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getOpenFileName);
|
||||
QString IWingPluginBaseCalls::dlgGetOpenFileName(QWidget *parent,
|
||||
const QString &caption,
|
||||
const QString &dir,
|
||||
const QString &filter,
|
||||
QString *selectedFilter,
|
||||
QFileDialog::Options options) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetOpenFileName);
|
||||
QString ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(caption),
|
||||
|
@ -236,11 +256,11 @@ QString IWingPluginBaseCalls::getOpenFileName(QWidget *parent,
|
|||
return ret;
|
||||
}
|
||||
|
||||
QStringList IWingPluginBaseCalls::getOpenFileNames(
|
||||
QStringList IWingPluginBaseCalls::dlgGetOpenFileNames(
|
||||
QWidget *parent, const QString &caption, const QString &dir,
|
||||
const QString &filter, QString *selectedFilter,
|
||||
QFileDialog::Options options) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getOpenFileNames);
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetOpenFileNames);
|
||||
QStringList ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(caption),
|
||||
|
@ -249,13 +269,13 @@ QStringList IWingPluginBaseCalls::getOpenFileNames(
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString IWingPluginBaseCalls::getSaveFileName(QWidget *parent,
|
||||
const QString &caption,
|
||||
const QString &dir,
|
||||
const QString &filter,
|
||||
QString *selectedFilter,
|
||||
QFileDialog::Options options) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getSaveFileName);
|
||||
QString IWingPluginBaseCalls::dlgGetSaveFileName(QWidget *parent,
|
||||
const QString &caption,
|
||||
const QString &dir,
|
||||
const QString &filter,
|
||||
QString *selectedFilter,
|
||||
QFileDialog::Options options) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetSaveFileName);
|
||||
QString ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(parent), WINGAPI_ARG(caption),
|
||||
|
@ -264,8 +284,9 @@ QString IWingPluginBaseCalls::getSaveFileName(QWidget *parent,
|
|||
return ret;
|
||||
}
|
||||
|
||||
QColor IWingPluginBaseCalls::getColor(const QString &caption, QWidget *parent) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::getColor);
|
||||
QColor IWingPluginBaseCalls::dlgGetColor(const QString &caption,
|
||||
QWidget *parent) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginBaseCalls::dlgGetColor);
|
||||
QColor ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(caption), WINGAPI_ARG(parent));
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef IWINGPLUGINBASECALLS_H
|
||||
#define IWINGPLUGINBASECALLS_H
|
||||
|
||||
|
@ -21,11 +41,11 @@ public:
|
|||
|
||||
public:
|
||||
void toast(const QPixmap &icon, const QString &message);
|
||||
void trace(const QString &message);
|
||||
void debug(const QString &message);
|
||||
void warn(const QString &message);
|
||||
void error(const QString &message);
|
||||
void info(const QString &message);
|
||||
void logTrace(const QString &message);
|
||||
void logDebug(const QString &message);
|
||||
void logWarn(const QString &message);
|
||||
void logError(const QString &message);
|
||||
void logInfo(const QString &message);
|
||||
|
||||
bool raiseDockWidget(QWidget *w);
|
||||
|
||||
|
@ -38,30 +58,31 @@ public:
|
|||
QDialog *createDialog(QWidget *content);
|
||||
|
||||
public:
|
||||
void aboutQt(QWidget *parent = nullptr, const QString &title = QString());
|
||||
void msgAboutQt(QWidget *parent = nullptr,
|
||||
const QString &title = QString());
|
||||
|
||||
QMessageBox::StandardButton information(
|
||||
QMessageBox::StandardButton msgInformation(
|
||||
QWidget *parent, const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
||||
|
||||
QMessageBox::StandardButton question(
|
||||
QMessageBox::StandardButton msgQuestion(
|
||||
QWidget *parent, const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons =
|
||||
QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No),
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
||||
|
||||
QMessageBox::StandardButton
|
||||
warning(QWidget *parent, const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
||||
QMessageBox::StandardButton msgWarning(
|
||||
QWidget *parent, const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
||||
|
||||
QMessageBox::StandardButton
|
||||
critical(QWidget *parent, const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
||||
|
||||
void about(QWidget *parent, const QString &title, const QString &text);
|
||||
void msgAbout(QWidget *parent, const QString &title, const QString &text);
|
||||
|
||||
QMessageBox::StandardButton
|
||||
msgbox(QWidget *parent, QMessageBox::Icon icon, const QString &title,
|
||||
|
@ -71,61 +92,60 @@ public:
|
|||
|
||||
public:
|
||||
Q_REQUIRED_RESULT QString
|
||||
getText(QWidget *parent, const QString &title, const QString &label,
|
||||
QLineEdit::EchoMode echo = QLineEdit::Normal,
|
||||
const QString &text = QString(), bool *ok = nullptr,
|
||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||
Q_REQUIRED_RESULT QString getMultiLineText(
|
||||
dlgGetText(QWidget *parent, const QString &title, const QString &label,
|
||||
QLineEdit::EchoMode echo = QLineEdit::Normal,
|
||||
const QString &text = QString(), bool *ok = nullptr,
|
||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||
Q_REQUIRED_RESULT QString dlgGetMultiLineText(
|
||||
QWidget *parent, const QString &title, const QString &label,
|
||||
const QString &text = QString(), bool *ok = nullptr,
|
||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||
|
||||
Q_REQUIRED_RESULT QString
|
||||
getItem(QWidget *parent, const QString &title, const QString &label,
|
||||
const QStringList &items, int current = 0, bool editable = true,
|
||||
bool *ok = nullptr,
|
||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||
dlgGetItem(QWidget *parent, const QString &title, const QString &label,
|
||||
const QStringList &items, int current = 0, bool editable = true,
|
||||
bool *ok = nullptr,
|
||||
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
|
||||
|
||||
Q_REQUIRED_RESULT int getInt(QWidget *parent, const QString &title,
|
||||
const QString &label, int value = 0,
|
||||
int minValue = -2147483647,
|
||||
int maxValue = 2147483647, int step = 1,
|
||||
bool *ok = nullptr);
|
||||
Q_REQUIRED_RESULT int dlgGetInt(QWidget *parent, const QString &title,
|
||||
const QString &label, int value = 0,
|
||||
int minValue = -2147483647,
|
||||
int maxValue = 2147483647, int step = 1,
|
||||
bool *ok = nullptr);
|
||||
|
||||
Q_REQUIRED_RESULT double getDouble(QWidget *parent, const QString &title,
|
||||
const QString &label, double value = 0,
|
||||
double minValue = -2147483647,
|
||||
double maxValue = 2147483647,
|
||||
int decimals = 1, bool *ok = nullptr,
|
||||
double step = 1);
|
||||
Q_REQUIRED_RESULT double
|
||||
dlgGetDouble(QWidget *parent, const QString &title, const QString &label,
|
||||
double value = 0, double minValue = -2147483647,
|
||||
double maxValue = 2147483647, int decimals = 1,
|
||||
bool *ok = nullptr, double step = 1);
|
||||
|
||||
public:
|
||||
Q_REQUIRED_RESULT QString getExistingDirectory(
|
||||
Q_REQUIRED_RESULT QString dlgGetExistingDirectory(
|
||||
QWidget *parent = nullptr, const QString &caption = QString(),
|
||||
const QString &dir = QString(),
|
||||
QFileDialog::Options options = QFileDialog::ShowDirsOnly);
|
||||
|
||||
Q_REQUIRED_RESULT QString getOpenFileName(
|
||||
Q_REQUIRED_RESULT QString dlgGetOpenFileName(
|
||||
QWidget *parent = nullptr, const QString &caption = QString(),
|
||||
const QString &dir = QString(), const QString &filter = QString(),
|
||||
QString *selectedFilter = nullptr,
|
||||
QFileDialog::Options options = QFileDialog::Options());
|
||||
|
||||
Q_REQUIRED_RESULT QStringList getOpenFileNames(
|
||||
Q_REQUIRED_RESULT QStringList dlgGetOpenFileNames(
|
||||
QWidget *parent = nullptr, const QString &caption = QString(),
|
||||
const QString &dir = QString(), const QString &filter = QString(),
|
||||
QString *selectedFilter = nullptr,
|
||||
QFileDialog::Options options = QFileDialog::Options());
|
||||
|
||||
Q_REQUIRED_RESULT QString getSaveFileName(
|
||||
Q_REQUIRED_RESULT QString dlgGetSaveFileName(
|
||||
QWidget *parent = nullptr, const QString &caption = QString(),
|
||||
const QString &dir = QString(), const QString &filter = QString(),
|
||||
QString *selectedFilter = nullptr,
|
||||
QFileDialog::Options options = QFileDialog::Options());
|
||||
|
||||
public:
|
||||
Q_REQUIRED_RESULT QColor getColor(const QString &caption,
|
||||
QWidget *parent = nullptr);
|
||||
Q_REQUIRED_RESULT QColor dlgGetColor(const QString &caption,
|
||||
QWidget *parent = nullptr);
|
||||
};
|
||||
|
||||
} // namespace WingHex
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "iwingplugincalls.h"
|
||||
#include "WingPlugin/wingcore.h"
|
||||
|
||||
|
@ -5,6 +25,8 @@
|
|||
|
||||
using namespace WingHex;
|
||||
|
||||
HexPosition::HexPosition() : line(0), column(0), lineWidth(0), nibbleindex(0) {}
|
||||
|
||||
qsizetype HexPosition::offset() const {
|
||||
return static_cast<qsizetype>(line * lineWidth) + column;
|
||||
}
|
||||
|
@ -281,6 +303,38 @@ qint64 IWingPluginCalls::readInt64(qsizetype offset) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
quint8 IWingPluginCalls::readUInt8(qsizetype offset) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::readUInt8);
|
||||
quint8 ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset));
|
||||
return ret;
|
||||
}
|
||||
|
||||
quint16 IWingPluginCalls::readUInt16(qsizetype offset) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::readUInt16);
|
||||
quint16 ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset));
|
||||
return ret;
|
||||
}
|
||||
|
||||
quint32 IWingPluginCalls::readUInt32(qsizetype offset) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::readUInt32);
|
||||
quint32 ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset));
|
||||
return ret;
|
||||
}
|
||||
|
||||
quint64 IWingPluginCalls::readUInt64(qsizetype offset) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::readUInt64);
|
||||
quint64 ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset));
|
||||
return ret;
|
||||
}
|
||||
|
||||
float IWingPluginCalls::readFloat(qsizetype offset) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::readFloat);
|
||||
float ret;
|
||||
|
@ -459,6 +513,38 @@ bool IWingPluginCalls::writeInt64(qsizetype offset, qint64 value) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::writeUInt8(qsizetype offset, quint8 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::writeUInt8);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::writeUInt16(qsizetype offset, quint16 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::writeInt16);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::writeUInt32(qsizetype offset, quint32 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::writeUInt32);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::writeUInt64(qsizetype offset, quint64 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::writeUInt64);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::writeFloat(qsizetype offset, float value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::writeFloat);
|
||||
bool ret;
|
||||
|
@ -525,6 +611,38 @@ bool IWingPluginCalls::insertInt64(qsizetype offset, qint64 value) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::insertUInt8(qsizetype offset, quint8 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::insertUInt8);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::insertUInt16(qsizetype offset, quint16 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::insertUInt16);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::insertUInt32(qsizetype offset, quint32 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::insertUInt32);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::insertUInt64(qsizetype offset, quint64 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::insertUInt64);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(offset), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::insertFloat(qsizetype offset, float value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::insertFloat);
|
||||
bool ret;
|
||||
|
@ -591,6 +709,38 @@ bool IWingPluginCalls::appendInt64(qint64 value) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::appendUInt8(quint8 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::appendUInt8);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::appendUInt16(quint16 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::appendUInt16);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::appendUInt32(quint32 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::appendUInt32);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::appendUInt64(quint64 value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::appendUInt64);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(value));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::appendFloat(float value) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::appendFloat);
|
||||
bool ret;
|
||||
|
@ -784,19 +934,20 @@ bool IWingPluginCalls::closeAllFiles() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::updateText(const QString &data, const QString &title) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::updateText);
|
||||
bool IWingPluginCalls::dataVisualText(const QString &data,
|
||||
const QString &title) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::dataVisualText);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(data), WINGAPI_ARG(title));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::updateTextList(const QStringList &data,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::updateTextList);
|
||||
bool IWingPluginCalls::dataVisualTextList(const QStringList &data,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::dataVisualTextList);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(data), WINGAPI_ARG(title),
|
||||
|
@ -804,10 +955,11 @@ bool IWingPluginCalls::updateTextList(const QStringList &data,
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::updateTextTree(const QString &json, const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::updateTextTree);
|
||||
bool IWingPluginCalls::dataVisualTextTree(const QString &json,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::dataVisualTextTree);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(json), WINGAPI_ARG(title),
|
||||
|
@ -815,13 +967,13 @@ bool IWingPluginCalls::updateTextTree(const QString &json, const QString &title,
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::updateTextTable(const QString &json,
|
||||
const QStringList &headers,
|
||||
const QStringList &headerNames,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::updateTextTable);
|
||||
bool IWingPluginCalls::dataVisualTextTable(const QString &json,
|
||||
const QStringList &headers,
|
||||
const QStringList &headerNames,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::dataVisualTextTable);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(json), WINGAPI_ARG(headers),
|
||||
|
@ -830,11 +982,11 @@ bool IWingPluginCalls::updateTextTable(const QString &json,
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::updateTextListByModel(QAbstractItemModel *model,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::updateTextListByModel);
|
||||
bool IWingPluginCalls::dataVisualTextListByModel(QAbstractItemModel *model,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::dataVisualTextListByModel);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(model), WINGAPI_ARG(title),
|
||||
|
@ -842,11 +994,11 @@ bool IWingPluginCalls::updateTextListByModel(QAbstractItemModel *model,
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::updateTextTableByModel(QAbstractItemModel *model,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::updateTextTableByModel);
|
||||
bool IWingPluginCalls::dataVisualTextTableByModel(QAbstractItemModel *model,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::dataVisualTextTableByModel);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(model), WINGAPI_ARG(title),
|
||||
|
@ -854,11 +1006,11 @@ bool IWingPluginCalls::updateTextTableByModel(QAbstractItemModel *model,
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool IWingPluginCalls::updateTextTreeByModel(QAbstractItemModel *model,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::updateTextTreeByModel);
|
||||
bool IWingPluginCalls::dataVisualTextTreeByModel(QAbstractItemModel *model,
|
||||
const QString &title,
|
||||
ClickedCallBack clicked,
|
||||
ClickedCallBack dblClicked) {
|
||||
SETUP_CALL_CONTEXT(&IWingPluginCalls::dataVisualTextTreeByModel);
|
||||
bool ret;
|
||||
m.invoke(callReceiver(), Qt::DirectConnection, WINGAPI_RETURN_ARG(ret),
|
||||
getSenderObj(), WINGAPI_ARG(model), WINGAPI_ARG(title),
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef IWINGPLUGINCALLS_H
|
||||
#define IWINGPLUGINCALLS_H
|
||||
|
||||
|
@ -13,6 +33,7 @@ struct WINGPLUGIN_EXPORT HexPosition {
|
|||
quint8 lineWidth;
|
||||
int nibbleindex;
|
||||
|
||||
HexPosition();
|
||||
Q_REQUIRED_RESULT qsizetype offset() const;
|
||||
qsizetype operator-(const HexPosition &rhs) const;
|
||||
bool operator==(const HexPosition &rhs) const;
|
||||
|
@ -93,6 +114,10 @@ public:
|
|||
Q_REQUIRED_RESULT qint16 readInt16(qsizetype offset);
|
||||
Q_REQUIRED_RESULT qint32 readInt32(qsizetype offset);
|
||||
Q_REQUIRED_RESULT qint64 readInt64(qsizetype offset);
|
||||
Q_REQUIRED_RESULT quint8 readUInt8(qsizetype offset);
|
||||
Q_REQUIRED_RESULT quint16 readUInt16(qsizetype offset);
|
||||
Q_REQUIRED_RESULT quint32 readUInt32(qsizetype offset);
|
||||
Q_REQUIRED_RESULT quint64 readUInt64(qsizetype offset);
|
||||
Q_REQUIRED_RESULT float readFloat(qsizetype offset);
|
||||
Q_REQUIRED_RESULT double readDouble(qsizetype offset);
|
||||
Q_REQUIRED_RESULT QString readString(qsizetype offset,
|
||||
|
@ -124,6 +149,10 @@ public:
|
|||
Q_REQUIRED_RESULT bool writeInt16(qsizetype offset, qint16 value);
|
||||
Q_REQUIRED_RESULT bool writeInt32(qsizetype offset, qint32 value);
|
||||
Q_REQUIRED_RESULT bool writeInt64(qsizetype offset, qint64 value);
|
||||
Q_REQUIRED_RESULT bool writeUInt8(qsizetype offset, quint8 value);
|
||||
Q_REQUIRED_RESULT bool writeUInt16(qsizetype offset, quint16 value);
|
||||
Q_REQUIRED_RESULT bool writeUInt32(qsizetype offset, quint32 value);
|
||||
Q_REQUIRED_RESULT bool writeUInt64(qsizetype offset, quint64 value);
|
||||
Q_REQUIRED_RESULT bool writeFloat(qsizetype offset, float value);
|
||||
Q_REQUIRED_RESULT bool writeDouble(qsizetype offset, double value);
|
||||
Q_REQUIRED_RESULT bool writeString(qsizetype offset, const QString &value,
|
||||
|
@ -134,6 +163,10 @@ public:
|
|||
Q_REQUIRED_RESULT bool insertInt16(qsizetype offset, qint16 value);
|
||||
Q_REQUIRED_RESULT bool insertInt32(qsizetype offset, qint32 value);
|
||||
Q_REQUIRED_RESULT bool insertInt64(qsizetype offset, qint64 value);
|
||||
Q_REQUIRED_RESULT bool insertUInt8(qsizetype offset, quint8 value);
|
||||
Q_REQUIRED_RESULT bool insertUInt16(qsizetype offset, quint16 value);
|
||||
Q_REQUIRED_RESULT bool insertUInt32(qsizetype offset, quint32 value);
|
||||
Q_REQUIRED_RESULT bool insertUInt64(qsizetype offset, quint64 value);
|
||||
Q_REQUIRED_RESULT bool insertFloat(qsizetype offset, float value);
|
||||
Q_REQUIRED_RESULT bool insertDouble(qsizetype offset, double value);
|
||||
Q_REQUIRED_RESULT bool insertString(qsizetype offset, const QString &value,
|
||||
|
@ -145,6 +178,10 @@ public:
|
|||
Q_REQUIRED_RESULT bool appendInt16(qint16 value);
|
||||
Q_REQUIRED_RESULT bool appendInt32(qint32 value);
|
||||
Q_REQUIRED_RESULT bool appendInt64(qint64 value);
|
||||
Q_REQUIRED_RESULT bool appendUInt8(quint8 value);
|
||||
Q_REQUIRED_RESULT bool appendUInt16(quint16 value);
|
||||
Q_REQUIRED_RESULT bool appendUInt32(quint32 value);
|
||||
Q_REQUIRED_RESULT bool appendUInt64(quint64 value);
|
||||
Q_REQUIRED_RESULT bool appendFloat(float value);
|
||||
Q_REQUIRED_RESULT bool appendDouble(double value);
|
||||
Q_REQUIRED_RESULT bool appendString(const QString &value,
|
||||
|
@ -216,35 +253,38 @@ public:
|
|||
bool closeAllFiles();
|
||||
|
||||
public:
|
||||
bool updateText(const QString &data, const QString &title = {});
|
||||
bool updateTextList(const QStringList &data, const QString &title = {},
|
||||
bool dataVisualText(const QString &data, const QString &title = {});
|
||||
bool dataVisualTextList(const QStringList &data, const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
|
||||
Q_REQUIRED_RESULT bool
|
||||
dataVisualTextTree(const QString &json, const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
Q_REQUIRED_RESULT bool
|
||||
dataVisualTextTable(const QString &json, const QStringList &headers,
|
||||
const QStringList &headerNames = {},
|
||||
const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
|
||||
Q_REQUIRED_RESULT bool
|
||||
updateTextTree(const QString &json, const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
Q_REQUIRED_RESULT bool
|
||||
updateTextTable(const QString &json, const QStringList &headers,
|
||||
const QStringList &headerNames = {},
|
||||
const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
|
||||
// API for Qt Plugin Only
|
||||
Q_REQUIRED_RESULT bool
|
||||
updateTextListByModel(QAbstractItemModel *model, const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
dataVisualTextListByModel(QAbstractItemModel *model,
|
||||
const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
Q_REQUIRED_RESULT bool
|
||||
updateTextTableByModel(QAbstractItemModel *model, const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
dataVisualTextTableByModel(QAbstractItemModel *model,
|
||||
const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
Q_REQUIRED_RESULT bool
|
||||
updateTextTreeByModel(QAbstractItemModel *model, const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
dataVisualTextTreeByModel(QAbstractItemModel *model,
|
||||
const QString &title = {},
|
||||
WingHex::ClickedCallBack clicked = {},
|
||||
WingHex::ClickedCallBack dblClicked = {});
|
||||
};
|
||||
|
||||
class WINGPLUGIN_EXPORT IWingPluginAPICalls : public IWingPluginCalls,
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
|
|
|
@ -22,14 +22,20 @@
|
|||
|
||||
WingHex::WingEditorViewWidget::WingEditorViewWidget(IWingPlugin *plg,
|
||||
QWidget *parent)
|
||||
: QWidget(parent), WingHex::IWingPluginAPICalls(plg) {}
|
||||
|
||||
void WingHex::WingEditorViewWidget::docSaved(bool saved) {
|
||||
// TODO
|
||||
}
|
||||
: WingPluginWidget(plg, parent) {}
|
||||
|
||||
void WingHex::WingEditorViewWidget::raiseView() {
|
||||
// TODO
|
||||
constexpr auto VIEW_PROPERTY = "__VIEW__";
|
||||
constexpr auto VIEW_ID_PROPERTY = "__ID__";
|
||||
|
||||
auto rawptr =
|
||||
reinterpret_cast<QObject *>(property(VIEW_PROPERTY).value<quintptr>());
|
||||
auto ptr = qobject_cast<QWidget *>(rawptr);
|
||||
auto id = property(VIEW_ID_PROPERTY).toString();
|
||||
if (ptr && !id.isEmpty()) {
|
||||
QMetaObject::invokeMethod(ptr, "raiseAndSwitchView",
|
||||
Qt::DirectConnection, WINGAPI_ARG(id));
|
||||
}
|
||||
}
|
||||
|
||||
void WingHex::WingEditorViewWidget::loadState(const QByteArray &state) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef WINGEDITORVIEWWIDGET_H
|
||||
#define WINGEDITORVIEWWIDGET_H
|
||||
|
||||
#include "WingPlugin/wingpluginwidget.h"
|
||||
#include "iwingplugincalls.h"
|
||||
#include "wingplugin_global.h"
|
||||
#include <QWidget>
|
||||
|
@ -29,9 +30,7 @@ namespace WingHex {
|
|||
|
||||
class IWingPlugin;
|
||||
|
||||
class WINGPLUGIN_EXPORT WingEditorViewWidget
|
||||
: public QWidget,
|
||||
protected WingHex::IWingPluginAPICalls {
|
||||
class WINGPLUGIN_EXPORT WingEditorViewWidget : public WingPluginWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -58,12 +57,12 @@ public:
|
|||
|
||||
virtual WingEditorViewWidget *clone() = 0;
|
||||
|
||||
public slots:
|
||||
void docSaved(bool saved);
|
||||
signals:
|
||||
void savedStateChanged(bool b);
|
||||
|
||||
public slots:
|
||||
void raiseView();
|
||||
|
||||
public slots:
|
||||
virtual void toggled(bool isVisible) = 0;
|
||||
|
||||
virtual void loadState(const QByteArray &state);
|
||||
|
|
|
@ -45,10 +45,10 @@
|
|||
|
||||
#define WINGAPI_ARG_SPEC(Type) \
|
||||
inline QArgument<Type> WINGAPI_ARG(const Type &t) { \
|
||||
return QArgument<Type>(#Type, t); \
|
||||
return QArgument<Type>(QT_STRINGIFY(Type), t); \
|
||||
} \
|
||||
inline QReturnArgument<Type> WINGAPI_RETURN_ARG(Type &t) { \
|
||||
return QReturnArgument<Type>(#Type, t); \
|
||||
return QReturnArgument<Type>(QT_STRINGIFY(Type), t); \
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "wingplugincallconvertor.h"
|
||||
|
||||
#include "WingPlugin/wingplugin_global.h"
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef WINGPLUGINCALLCONVERTOR_H
|
||||
#define WINGPLUGINCALLCONVERTOR_H
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "wingpluginwidget.h"
|
||||
|
||||
using namespace WingHex;
|
||||
|
||||
WingPluginWidget::WingPluginWidget(IWingPlugin *plg, QWidget *parent)
|
||||
: QWidget(parent), WingHex::IWingPluginAPICalls(plg) {}
|
||||
|
||||
WingPluginWidget::~WingPluginWidget() {}
|
||||
|
||||
WingPluginDialog::WingPluginDialog(IWingPlugin *plg, QWidget *parent)
|
||||
: QDialog(parent), WingHex::IWingPluginAPICalls(plg) {}
|
||||
|
||||
WingPluginDialog::~WingPluginDialog() {}
|
||||
|
||||
WingPluginWindow::WingPluginWindow(IWingPlugin *plg, QWindow *parent)
|
||||
: QWindow(parent), WingHex::IWingPluginAPICalls(plg) {}
|
||||
|
||||
WingPluginWindow::WingPluginWindow(IWingPlugin *plg, QScreen *parent)
|
||||
: QWindow(parent), WingHex::IWingPluginAPICalls(plg) {}
|
||||
|
||||
WingPluginWindow::~WingPluginWindow() {}
|
||||
|
||||
WingPluginMainWindow::WingPluginMainWindow(IWingPlugin *plg, QWidget *parent)
|
||||
: QMainWindow(parent), WingHex::IWingPluginAPICalls(plg) {}
|
||||
|
||||
WingPluginMainWindow::~WingPluginMainWindow() {}
|
|
@ -0,0 +1,84 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** You can redistribute this file and/or modify it under the terms of the
|
||||
** BSD 3-Clause.
|
||||
**
|
||||
** THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
** POSSIBILITY OF SUCH DAMAGE.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef WINGPLUGINWIDGET_H
|
||||
#define WINGPLUGINWIDGET_H
|
||||
|
||||
#include "WingPlugin/iwingplugincalls.h"
|
||||
#include "wingplugin_global.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMainWindow>
|
||||
#include <QWidget>
|
||||
#include <QWindow>
|
||||
|
||||
namespace WingHex {
|
||||
|
||||
class IWingPlugin;
|
||||
|
||||
class WINGPLUGIN_EXPORT WingPluginWidget
|
||||
: public QWidget,
|
||||
protected WingHex::IWingPluginAPICalls {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WingPluginWidget(WingHex::IWingPlugin *plg,
|
||||
QWidget *parent = nullptr);
|
||||
virtual ~WingPluginWidget();
|
||||
};
|
||||
|
||||
class WINGPLUGIN_EXPORT WingPluginDialog
|
||||
: public QDialog,
|
||||
protected WingHex::IWingPluginAPICalls {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WingPluginDialog(WingHex::IWingPlugin *plg,
|
||||
QWidget *parent = nullptr);
|
||||
virtual ~WingPluginDialog();
|
||||
};
|
||||
|
||||
class WINGPLUGIN_EXPORT WingPluginWindow
|
||||
: public QWindow,
|
||||
protected WingHex::IWingPluginAPICalls {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WingPluginWindow(WingHex::IWingPlugin *plg,
|
||||
QWindow *parent = nullptr);
|
||||
explicit WingPluginWindow(WingHex::IWingPlugin *plg,
|
||||
QScreen *parent = nullptr);
|
||||
virtual ~WingPluginWindow();
|
||||
};
|
||||
|
||||
class WINGPLUGIN_EXPORT WingPluginMainWindow
|
||||
: public QMainWindow,
|
||||
protected WingHex::IWingPluginAPICalls {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WingPluginMainWindow(WingHex::IWingPlugin *plg,
|
||||
QWidget *parent = nullptr);
|
||||
virtual ~WingPluginMainWindow();
|
||||
};
|
||||
|
||||
} // namespace WingHex
|
||||
|
||||
#endif // WINGPLUGINWIDGET_H
|
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -107,7 +107,6 @@
|
|||
<file>images/unover.png</file>
|
||||
<file>images/unsaved.png</file>
|
||||
<file>images/update.png</file>
|
||||
<file>images/viewtxt.png</file>
|
||||
<file>images/wiki.png</file>
|
||||
<file>images/win.png</file>
|
||||
<file>images/workspace.png</file>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -378,16 +378,16 @@ public:
|
|||
const QPixmap &icon, const QString &message);
|
||||
|
||||
// logging
|
||||
WING_SERVICE void trace(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void debug(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void info(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void warn(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void error(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void logTrace(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void logDebug(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void logInfo(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void logWarn(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE void logError(WingHex::IWingPluginBase *sender,
|
||||
const QString &message);
|
||||
WING_SERVICE bool raiseDockWidget(WingHex::IWingPluginBase *sender,
|
||||
QWidget *w);
|
||||
WING_SERVICE WingHex::AppTheme
|
||||
|
@ -396,30 +396,31 @@ public:
|
|||
QWidget *content);
|
||||
|
||||
public:
|
||||
WING_SERVICE void aboutQt(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title);
|
||||
WING_SERVICE void msgAboutQt(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title);
|
||||
WING_SERVICE QMessageBox::StandardButton
|
||||
information(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
msgInformation(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton);
|
||||
WING_SERVICE QMessageBox::StandardButton
|
||||
msgQuestion(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton);
|
||||
WING_SERVICE QMessageBox::StandardButton
|
||||
question(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton);
|
||||
msgWarning(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton);
|
||||
WING_SERVICE QMessageBox::StandardButton
|
||||
warning(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton);
|
||||
WING_SERVICE QMessageBox::StandardButton
|
||||
critical(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton);
|
||||
WING_SERVICE void about(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &text);
|
||||
msgCritical(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton);
|
||||
WING_SERVICE void msgAbout(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title,
|
||||
const QString &text);
|
||||
WING_SERVICE QMessageBox::StandardButton
|
||||
msgbox(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
QMessageBox::Icon icon, const QString &title, const QString &text,
|
||||
|
@ -427,51 +428,52 @@ public:
|
|||
QMessageBox::StandardButton defaultButton);
|
||||
|
||||
public:
|
||||
WING_SERVICE QString getText(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title,
|
||||
const QString &label, QLineEdit::EchoMode echo,
|
||||
const QString &text, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints);
|
||||
WING_SERVICE QString getMultiLineText(
|
||||
WING_SERVICE QString dlgGetText(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title,
|
||||
const QString &label,
|
||||
QLineEdit::EchoMode echo,
|
||||
const QString &text, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints);
|
||||
WING_SERVICE QString dlgGetMultiLineText(
|
||||
WingHex::IWingPluginBase *sender, QWidget *parent, const QString &title,
|
||||
const QString &label, const QString &text, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints);
|
||||
WING_SERVICE QString getItem(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title,
|
||||
const QString &label, const QStringList &items,
|
||||
int current, bool editable, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints);
|
||||
WING_SERVICE int getInt(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &title, const QString &label,
|
||||
int value, int minValue, int maxValue, int step,
|
||||
bool *ok);
|
||||
WING_SERVICE double getDouble(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title,
|
||||
const QString &label, double value,
|
||||
double minValue, double maxValue,
|
||||
int decimals, bool *ok, double step);
|
||||
WING_SERVICE QString dlgGetItem(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title,
|
||||
const QString &label,
|
||||
const QStringList &items, int current,
|
||||
bool editable, bool *ok,
|
||||
Qt::InputMethodHints inputMethodHints);
|
||||
WING_SERVICE int dlgGetInt(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title,
|
||||
const QString &label, int value, int minValue,
|
||||
int maxValue, int step, bool *ok);
|
||||
WING_SERVICE double dlgGetDouble(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent, const QString &title,
|
||||
const QString &label, double value,
|
||||
double minValue, double maxValue,
|
||||
int decimals, bool *ok, double step);
|
||||
|
||||
public:
|
||||
WING_SERVICE QString getExistingDirectory(WingHex::IWingPluginBase *sender,
|
||||
QWidget *parent,
|
||||
const QString &caption,
|
||||
const QString &dir,
|
||||
QFileDialog::Options options);
|
||||
WING_SERVICE QString getOpenFileName(
|
||||
WING_SERVICE QString
|
||||
dlgGetExistingDirectory(WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &caption, const QString &dir,
|
||||
QFileDialog::Options options);
|
||||
WING_SERVICE QString dlgGetOpenFileName(
|
||||
WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &caption, const QString &dir, const QString &filter,
|
||||
QString *selectedFilter, QFileDialog::Options options);
|
||||
WING_SERVICE QStringList getOpenFileNames(
|
||||
WING_SERVICE QStringList dlgGetOpenFileNames(
|
||||
WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &caption, const QString &dir, const QString &filter,
|
||||
QString *selectedFilter, QFileDialog::Options options);
|
||||
WING_SERVICE QString getSaveFileName(
|
||||
WING_SERVICE QString dlgGetSaveFileName(
|
||||
WingHex::IWingPluginBase *sender, QWidget *parent,
|
||||
const QString &caption, const QString &dir, const QString &filter,
|
||||
QString *selectedFilter, QFileDialog::Options options);
|
||||
|
||||
WING_SERVICE QColor getColor(WingHex::IWingPluginBase *sender,
|
||||
const QString &caption, QWidget *parent);
|
||||
WING_SERVICE QColor dlgGetColor(WingHex::IWingPluginBase *sender,
|
||||
const QString &caption, QWidget *parent);
|
||||
|
||||
// IWingPlugin API
|
||||
public:
|
||||
|
@ -552,6 +554,18 @@ public:
|
|||
WING_SERVICE qint64 readInt64(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset);
|
||||
|
||||
WING_SERVICE quint8 readUInt8(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset);
|
||||
|
||||
WING_SERVICE quint16 readUInt16(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset);
|
||||
|
||||
WING_SERVICE quint32 readUInt32(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset);
|
||||
|
||||
WING_SERVICE quint64 readUInt64(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset);
|
||||
|
||||
WING_SERVICE float readFloat(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset);
|
||||
|
||||
|
@ -616,6 +630,18 @@ public:
|
|||
WING_SERVICE bool writeInt64(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, qint64 value);
|
||||
|
||||
WING_SERVICE bool writeUInt8(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, quint8 value);
|
||||
|
||||
WING_SERVICE bool writeUInt16(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, quint16 value);
|
||||
|
||||
WING_SERVICE bool writeUInt32(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, quint32 value);
|
||||
|
||||
WING_SERVICE bool writeUInt64(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, quint64 value);
|
||||
|
||||
WING_SERVICE bool writeFloat(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, float value);
|
||||
|
||||
|
@ -641,6 +667,18 @@ public:
|
|||
WING_SERVICE bool insertInt64(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, qint64 value);
|
||||
|
||||
WING_SERVICE bool insertUInt8(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, quint8 value);
|
||||
|
||||
WING_SERVICE bool insertUInt16(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, quint16 value);
|
||||
|
||||
WING_SERVICE bool insertUInt32(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, quint32 value);
|
||||
|
||||
WING_SERVICE bool insertUInt64(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, quint64 value);
|
||||
|
||||
WING_SERVICE bool insertFloat(WingHex::IWingPluginBase *sender,
|
||||
qsizetype offset, float value);
|
||||
|
||||
|
@ -665,6 +703,18 @@ public:
|
|||
WING_SERVICE bool appendInt64(WingHex::IWingPluginBase *sender,
|
||||
qint64 value);
|
||||
|
||||
WING_SERVICE bool appendUInt8(WingHex::IWingPluginBase *sender,
|
||||
quint8 value);
|
||||
|
||||
WING_SERVICE bool appendUInt16(WingHex::IWingPluginBase *sender,
|
||||
quint16 value);
|
||||
|
||||
WING_SERVICE bool appendUInt32(WingHex::IWingPluginBase *sender,
|
||||
quint32 value);
|
||||
|
||||
WING_SERVICE bool appendUInt64(WingHex::IWingPluginBase *sender,
|
||||
quint64 value);
|
||||
|
||||
WING_SERVICE bool appendFloat(WingHex::IWingPluginBase *sender,
|
||||
float value);
|
||||
|
||||
|
@ -774,44 +824,58 @@ public:
|
|||
// extension
|
||||
WING_SERVICE bool closeAllFiles(WingHex::IWingPluginBase *sender);
|
||||
|
||||
WING_SERVICE bool updateText(WingHex::IWingPluginBase *sender,
|
||||
const QString &data, const QString &title);
|
||||
public:
|
||||
WING_SERVICE bool dataVisualText(WingHex::IWingPluginBase *sender,
|
||||
const QString &data, const QString &title);
|
||||
|
||||
WING_SERVICE bool updateTextList(WingHex::IWingPluginBase *sender,
|
||||
const QStringList &data,
|
||||
const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
WING_SERVICE bool dataVisualTextList(WingHex::IWingPluginBase *sender,
|
||||
const QStringList &data,
|
||||
const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
|
||||
WING_SERVICE bool updateTextTree(WingHex::IWingPluginBase *sender,
|
||||
const QString &json, const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
WING_SERVICE bool dataVisualTextTree(WingHex::IWingPluginBase *sender,
|
||||
const QString &json,
|
||||
const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
|
||||
WING_SERVICE bool
|
||||
updateTextTable(WingHex::IWingPluginBase *sender, const QString &json,
|
||||
const QStringList &headers, const QStringList &headerNames,
|
||||
const QString &title, WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
WING_SERVICE bool dataVisualTextTable(WingHex::IWingPluginBase *sender,
|
||||
const QString &json,
|
||||
const QStringList &headers,
|
||||
const QStringList &headerNames,
|
||||
const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
|
||||
// API for Qt Plugin Only
|
||||
WING_SERVICE bool
|
||||
updateTextListByModel(WingHex::IWingPluginBase *sender,
|
||||
QAbstractItemModel *model, const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
dataVisualTextListByModel(WingHex::IWingPluginBase *sender,
|
||||
QAbstractItemModel *model, const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
|
||||
WING_SERVICE bool
|
||||
updateTextTableByModel(WingHex::IWingPluginBase *sender,
|
||||
QAbstractItemModel *model, const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
dataVisualTextTableByModel(WingHex::IWingPluginBase *sender,
|
||||
QAbstractItemModel *model, const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
|
||||
WING_SERVICE bool
|
||||
updateTextTreeByModel(WingHex::IWingPluginBase *sender,
|
||||
QAbstractItemModel *model, const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
dataVisualTextTreeByModel(WingHex::IWingPluginBase *sender,
|
||||
QAbstractItemModel *model, const QString &title,
|
||||
WingHex::ClickedCallBack clicked,
|
||||
WingHex::ClickedCallBack dblClicked);
|
||||
|
||||
private:
|
||||
WingHex::IWingPlugin *checkPluginAndReport(WingHex::IWingPluginBase *sender,
|
||||
const char *func);
|
||||
|
||||
WingHex::IWingDevice *checkBaseAndReport(WingHex::IWingPluginBase *sender,
|
||||
const char *func);
|
||||
|
||||
bool checkErrAllAllowAndReport(WingHex::IWingPluginBase *sender,
|
||||
const char *func);
|
||||
|
||||
private:
|
||||
CallTable _plgFns;
|
||||
|
|
|
@ -268,23 +268,23 @@ void WingAngelAPI::installLogAPI(asIScriptEngine *engine) {
|
|||
Q_UNUSED(r);
|
||||
|
||||
registerAPI<void(const QString &)>(
|
||||
engine, std::bind(&WingAngelAPI::info, this, std::placeholders::_1),
|
||||
engine, std::bind(&WingAngelAPI::logInfo, this, std::placeholders::_1),
|
||||
"void info(const string &in message)");
|
||||
|
||||
registerAPI<void(const QString &)>(
|
||||
engine, std::bind(&WingAngelAPI::trace, this, std::placeholders::_1),
|
||||
engine, std::bind(&WingAngelAPI::logTrace, this, std::placeholders::_1),
|
||||
"void trace(const string &in message)");
|
||||
|
||||
registerAPI<void(const QString &)>(
|
||||
engine, std::bind(&WingAngelAPI::debug, this, std::placeholders::_1),
|
||||
engine, std::bind(&WingAngelAPI::logDebug, this, std::placeholders::_1),
|
||||
"void debug(const string &in message)");
|
||||
|
||||
registerAPI<void(const QString &)>(
|
||||
engine, std::bind(&WingAngelAPI::warn, this, std::placeholders::_1),
|
||||
engine, std::bind(&WingAngelAPI::logWarn, this, std::placeholders::_1),
|
||||
"void warn(const string &in message)");
|
||||
|
||||
registerAPI<void(const QString &)>(
|
||||
engine, std::bind(&WingAngelAPI::error, this, std::placeholders::_1),
|
||||
engine, std::bind(&WingAngelAPI::logError, this, std::placeholders::_1),
|
||||
"void error(const string &in message)");
|
||||
|
||||
engine->SetDefaultNamespace("");
|
||||
|
@ -306,7 +306,7 @@ void WingAngelAPI::installMsgboxAPI(asIScriptEngine *engine) {
|
|||
|
||||
registerAPI<void(const QString &)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::aboutQt, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::msgAboutQt, this, nullptr,
|
||||
std::placeholders::_1),
|
||||
"void aboutQt(const string &in title =\"\")");
|
||||
|
||||
|
@ -314,7 +314,7 @@ void WingAngelAPI::installMsgboxAPI(asIScriptEngine *engine) {
|
|||
QMessageBox::StandardButtons,
|
||||
QMessageBox::StandardButton)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::information, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::msgInformation, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4),
|
||||
"void information(const string &in title, const string &in text, "
|
||||
|
@ -325,7 +325,7 @@ void WingAngelAPI::installMsgboxAPI(asIScriptEngine *engine) {
|
|||
QMessageBox::StandardButtons,
|
||||
QMessageBox::StandardButton)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::question, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::msgQuestion, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4),
|
||||
"void question(const string &in title, const string &in text, "
|
||||
|
@ -337,7 +337,7 @@ void WingAngelAPI::installMsgboxAPI(asIScriptEngine *engine) {
|
|||
QMessageBox::StandardButtons,
|
||||
QMessageBox::StandardButton)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::warning, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::msgWarning, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4),
|
||||
"void warning(const string &in title, const string &in text, "
|
||||
|
@ -370,7 +370,7 @@ void WingAngelAPI::installMsgboxAPI(asIScriptEngine *engine) {
|
|||
|
||||
registerAPI<void(const QString &, const QString &)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::about, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::msgAbout, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"void about(const string &in title, const string &in text)");
|
||||
|
||||
|
@ -386,7 +386,7 @@ void WingAngelAPI::installInputboxAPI(asIScriptEngine *engine) {
|
|||
const QString &, bool *,
|
||||
Qt::InputMethodHints inputMethodHints)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::getText, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::dlgGetText, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5, std::placeholders::_6),
|
||||
|
@ -398,7 +398,7 @@ void WingAngelAPI::installInputboxAPI(asIScriptEngine *engine) {
|
|||
registerAPI<QString(const QString &, const QString &, const QString &,
|
||||
bool *, Qt::InputMethodHints inputMethodHints)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::getMultiLineText, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::dlgGetMultiLineText, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5),
|
||||
|
@ -410,7 +410,7 @@ void WingAngelAPI::installInputboxAPI(asIScriptEngine *engine) {
|
|||
registerAPI<int(const QString &, const QString &, int, int, int, int,
|
||||
bool *)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::getInt, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::dlgGetInt, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5, std::placeholders::_6,
|
||||
|
@ -423,7 +423,7 @@ void WingAngelAPI::installInputboxAPI(asIScriptEngine *engine) {
|
|||
registerAPI<int(const QString &, const QString &, double, double, double,
|
||||
int, bool *, double)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::getDouble, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::dlgGetDouble, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5, std::placeholders::_6,
|
||||
|
@ -456,7 +456,7 @@ void WingAngelAPI::installFileDialogAPI(asIScriptEngine *engine) {
|
|||
registerAPI<QString(const QString &, const QString &,
|
||||
QFileDialog::Options)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::getExistingDirectory, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::dlgGetExistingDirectory, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3),
|
||||
"string getExistingDirectory(const string &in caption = \"\", "
|
||||
|
@ -466,7 +466,7 @@ void WingAngelAPI::installFileDialogAPI(asIScriptEngine *engine) {
|
|||
registerAPI<QString(const QString &, const QString &, const QString &,
|
||||
QString *, QFileDialog::Options)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::getOpenFileName, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::dlgGetOpenFileName, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5),
|
||||
|
@ -477,7 +477,7 @@ void WingAngelAPI::installFileDialogAPI(asIScriptEngine *engine) {
|
|||
registerAPI<QString(const QString &, const QString &, const QString &,
|
||||
QString *, QFileDialog::Options)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::getSaveFileName, this, nullptr,
|
||||
std::bind(&WingHex::IWingPlugin::dlgGetSaveFileName, this, nullptr,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4,
|
||||
std::placeholders::_5),
|
||||
|
@ -507,8 +507,8 @@ void WingAngelAPI::installColorDialogAPI(asIScriptEngine *engine) {
|
|||
|
||||
registerAPI<QColor(const QString &)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::getColor, this, std::placeholders::_1,
|
||||
nullptr),
|
||||
std::bind(&WingHex::IWingPlugin::dlgGetColor, this,
|
||||
std::placeholders::_1, nullptr),
|
||||
"color getColor(const string &in caption)");
|
||||
|
||||
engine->SetDefaultNamespace("");
|
||||
|
@ -690,21 +690,41 @@ void WingAngelAPI::installHexReaderAPI(asIScriptEngine *engine) {
|
|||
std::bind(&WingHex::IWingPlugin::readInt8, this, std::placeholders::_1),
|
||||
"int8 readInt8(" QSIZETYPE " offset)");
|
||||
|
||||
registerAPI<quint8(qsizetype)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::readUInt8,
|
||||
this, std::placeholders::_1),
|
||||
"uint8 readUInt8(" QSIZETYPE " offset)");
|
||||
|
||||
registerAPI<qint16(qsizetype)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::readInt16,
|
||||
this, std::placeholders::_1),
|
||||
"int16 readInt16(" QSIZETYPE " offset)");
|
||||
|
||||
registerAPI<quint16(qsizetype)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::readUInt16,
|
||||
this, std::placeholders::_1),
|
||||
"uint16 readUInt16(" QSIZETYPE " offset)");
|
||||
|
||||
registerAPI<qint32(qsizetype)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::readInt32,
|
||||
this, std::placeholders::_1),
|
||||
"int readInt32(" QSIZETYPE " offset)");
|
||||
|
||||
registerAPI<quint32(qsizetype)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::readUInt32,
|
||||
this, std::placeholders::_1),
|
||||
"uint readUInt32(" QSIZETYPE " offset)");
|
||||
|
||||
registerAPI<qint64(qsizetype)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::readInt64,
|
||||
this, std::placeholders::_1),
|
||||
"int64 readInt64(" QSIZETYPE " offset)");
|
||||
|
||||
registerAPI<quint64(qsizetype)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::readUInt64,
|
||||
this, std::placeholders::_1),
|
||||
"uint64 readUInt64(" QSIZETYPE " offset)");
|
||||
|
||||
registerAPI<float(qsizetype)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::readFloat,
|
||||
this, std::placeholders::_1),
|
||||
|
@ -803,24 +823,48 @@ void WingAngelAPI::installHexControllerAPI(asIScriptEngine *engine) {
|
|||
std::placeholders::_2),
|
||||
"bool writeInt8(" QSIZETYPE " offset, int8 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, quint8)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::writeUInt8, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool writeUInt8(" QSIZETYPE " offset, uint8 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, qint16)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::writeInt16, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool writeInt16(" QSIZETYPE " offset, int16 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, quint16)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::writeUInt16, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool writeUInt16(" QSIZETYPE " offset, uint16 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, qint32)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::writeInt32, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool writeInt32(" QSIZETYPE " offset, int value)");
|
||||
|
||||
registerAPI<bool(qsizetype, quint32)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::writeUInt32, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool writeUInt32(" QSIZETYPE " offset, uint value)");
|
||||
|
||||
registerAPI<bool(qsizetype, qint64)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::writeInt64, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool writeInt64(" QSIZETYPE " offset, int64 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, quint64)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::writeUInt64, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool writeUInt64(" QSIZETYPE " offset, uint64 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, float)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::writeFloat, this,
|
||||
|
@ -853,24 +897,48 @@ void WingAngelAPI::installHexControllerAPI(asIScriptEngine *engine) {
|
|||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool insertInt8(" QSIZETYPE " offset, int8 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, quint8)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::insertUInt8, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool insertUInt8(" QSIZETYPE " offset, uint8 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, qint16)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::insertInt16, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool insertInt16(" QSIZETYPE " offset, int16 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, quint16)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::insertUInt16, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool insertUInt16(" QSIZETYPE " offset, uint16 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, qint32)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::insertInt32, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool insertInt32(" QSIZETYPE " offset, int value)");
|
||||
|
||||
registerAPI<bool(qsizetype, qint32)>(
|
||||
registerAPI<bool(qsizetype, quint32)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::insertUInt32, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool insertUInt32(" QSIZETYPE " offset, uint value)");
|
||||
|
||||
registerAPI<bool(qsizetype, qint64)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::insertInt64, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool insertInt64(" QSIZETYPE " offset, int64 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, quint64)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::insertUInt64, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool insertUInt64(" QSIZETYPE " offset, uint64 value)");
|
||||
|
||||
registerAPI<bool(qsizetype, float)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::insertFloat, this,
|
||||
|
@ -902,21 +970,41 @@ void WingAngelAPI::installHexControllerAPI(asIScriptEngine *engine) {
|
|||
std::placeholders::_1),
|
||||
"bool appendInt8(int8 value)");
|
||||
|
||||
registerAPI<bool(quint8)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::appendUInt8,
|
||||
this, std::placeholders::_1),
|
||||
"bool appendUInt8(uint8 value)");
|
||||
|
||||
registerAPI<bool(qint16)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::appendInt16,
|
||||
this, std::placeholders::_1),
|
||||
"bool appendInt16(int16 value)");
|
||||
|
||||
registerAPI<bool(quint16)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::appendUInt16,
|
||||
this, std::placeholders::_1),
|
||||
"bool appendUInt16(uint16 value)");
|
||||
|
||||
registerAPI<bool(qint32)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::appendInt32,
|
||||
this, std::placeholders::_1),
|
||||
"bool appendInt32(int value)");
|
||||
|
||||
registerAPI<bool(qint32)>(engine,
|
||||
registerAPI<bool(quint32)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::appendUInt32,
|
||||
this, std::placeholders::_1),
|
||||
"bool appendUInt32(uint value)");
|
||||
|
||||
registerAPI<bool(qint64)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::appendInt64,
|
||||
this, std::placeholders::_1),
|
||||
"bool appendInt64(int64 value)");
|
||||
|
||||
registerAPI<bool(quint64)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::appendUInt64,
|
||||
this, std::placeholders::_1),
|
||||
"bool appendUInt64(uint64 value)");
|
||||
|
||||
registerAPI<bool(float)>(engine,
|
||||
std::bind(&WingHex::IWingPlugin::appendFloat, this,
|
||||
std::placeholders::_1),
|
||||
|
@ -1150,7 +1238,7 @@ void WingAngelAPI::installDataVisualAPI(asIScriptEngine *engine) {
|
|||
|
||||
registerAPI<bool(const QString &, const QString &)>(
|
||||
engine,
|
||||
std::bind(&WingHex::IWingPlugin::updateText, this,
|
||||
std::bind(&WingHex::IWingPlugin::dataVisualText, this,
|
||||
std::placeholders::_1, std::placeholders::_2),
|
||||
"bool updateText(string &in data, string &in title=\"\")");
|
||||
|
||||
|
@ -2305,7 +2393,7 @@ bool WingAngelAPI::_HexController_writeBytes(qsizetype offset,
|
|||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
return emit writeBytes(offset, bab);
|
||||
return writeBytes(offset, bab);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ WingProgressDialog::WingProgressDialog(const QString &labelText,
|
|||
buildUpContent(m_dialog);
|
||||
|
||||
connect(m_dialog, &QProgressDialog::canceled, this,
|
||||
&WingProgressDialog::canceled);
|
||||
&WingProgressDialog::cancel);
|
||||
connect(m_dialog, &QProgressDialog::finished, this,
|
||||
&FramelessDialogBase::done);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
constexpr qsizetype FILE_MAX_BUFFER = 0x6400000; // 100MB
|
||||
constexpr auto CLONE_LIMIT = 3;
|
||||
|
||||
constexpr auto VIEW_PROPERTY = "__VIEW__";
|
||||
constexpr auto VIEW_ID_PROPERTY = "__ID__";
|
||||
|
||||
QString EditorView::getDeviceFileName(const QString &ext, const QString &file) {
|
||||
return QStringLiteral("wdrv:///") + ext + QStringLiteral("/") + file;
|
||||
}
|
||||
|
@ -126,6 +129,9 @@ void EditorView::registerView(const QString &id, WingEditorViewWidget *view) {
|
|||
Q_ASSERT(view);
|
||||
m_others.insert(id, view);
|
||||
m_stack->addWidget(view);
|
||||
view->setProperty(VIEW_PROPERTY, quintptr(this));
|
||||
view->setProperty(VIEW_ID_PROPERTY, id);
|
||||
view->installEventFilter(this);
|
||||
if (!isCloneFile()) {
|
||||
if (_pluginData.contains(id)) {
|
||||
view->loadState(_pluginData.value(id));
|
||||
|
@ -641,6 +647,11 @@ void EditorView::notifyOnWorkSpace(bool b) {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorView::raiseAndSwitchView(const QString &id) {
|
||||
raise();
|
||||
switchView(id);
|
||||
}
|
||||
|
||||
void EditorView::connectDocSavedFlag(EditorView *editor) {
|
||||
connect(editor->m_hex->document().get(), &QHexDocument::documentSaved, this,
|
||||
[=](bool b) {
|
||||
|
@ -655,7 +666,7 @@ void EditorView::connectDocSavedFlag(EditorView *editor) {
|
|||
}
|
||||
QString content;
|
||||
|
||||
if (b) {
|
||||
if (b && !checkHasUnsavedState()) {
|
||||
content = fileName;
|
||||
} else {
|
||||
content = QStringLiteral("* ") + fileName;
|
||||
|
@ -889,3 +900,14 @@ QString EditorView::fileName() const {
|
|||
}
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
bool EditorView::eventFilter(QObject *watched, QEvent *event) {
|
||||
if (event->type() == QEvent::DynamicPropertyChange) {
|
||||
auto e = static_cast<QDynamicPropertyChangeEvent *>(event);
|
||||
if (e->propertyName() == VIEW_PROPERTY ||
|
||||
e->propertyName() == VIEW_ID_PROPERTY) {
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
return ads::CDockWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
|
|
@ -97,6 +97,9 @@ public:
|
|||
void notifyOnWorkSpace(bool b);
|
||||
|
||||
public slots:
|
||||
void raiseAndSwitchView(const QString &id);
|
||||
|
||||
public:
|
||||
EditorView *clone();
|
||||
|
||||
void registerView(const QString &id, WingHex::WingEditorViewWidget *view);
|
||||
|
@ -172,6 +175,9 @@ signals:
|
|||
void sigOnMetadata();
|
||||
void sigOnBookMark();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
QStackedWidget *m_stack = nullptr;
|
||||
GotoWidget *m_goto = nullptr;
|
||||
|
|
|
@ -92,7 +92,8 @@ int Toast::fontPointSize() const { return m_drawFont.pointSize(); }
|
|||
|
||||
QSize Toast::calculateTextSize() {
|
||||
QFontMetrics metrice(m_drawFont);
|
||||
QStringList ls = m_strContent.split(QRegularExpression("\r\n|\n"));
|
||||
static QRegularExpression regex(QStringLiteral("\r\n|\n"));
|
||||
QStringList ls = m_strContent.split(regex);
|
||||
int nWidthInPixel = 0;
|
||||
for (int i = 0; i < ls.size(); i++) {
|
||||
int tmpWidth = metrice.horizontalAdvance(ls.at(i));
|
||||
|
@ -104,7 +105,8 @@ QSize Toast::calculateTextSize() {
|
|||
|
||||
void Toast::init() {
|
||||
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint |
|
||||
Qt::WindowSystemMenuHint | Qt::BypassWindowManagerHint);
|
||||
Qt::WindowSystemMenuHint | Qt::BypassWindowManagerHint |
|
||||
Qt::WindowTransparentForInput);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setAttribute(Qt::WA_ShowWithoutActivating);
|
||||
|
||||
|
|
|
@ -310,9 +310,6 @@ MainWindow::MainWindow(SplashDialog *splash) : FramelessMainWindow() {
|
|||
|
||||
if (splash)
|
||||
splash->setInfoText(tr("SetupWaiting"));
|
||||
// others
|
||||
_showtxt = new ShowTextDialog(this);
|
||||
qApp->processEvents();
|
||||
|
||||
// update status
|
||||
updateEditModeEnabled();
|
||||
|
@ -1471,9 +1468,6 @@ RibbonTabContent *MainWindow::buildViewPage(RibbonTabContent *tab) {
|
|||
m_editStateWidgets << addPannelAction(
|
||||
pannel, QStringLiteral("scalereset"), tr("ResetScale"),
|
||||
[this] { this->setCurrentHexEditorScale(1.0); });
|
||||
m_editStateWidgets << addPannelAction(pannel, QStringLiteral("viewtxt"),
|
||||
tr("ViewText"),
|
||||
&MainWindow::on_viewtxt);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -2980,14 +2974,6 @@ void MainWindow::on_selectionChanged() {
|
|||
{QVariant::fromValue(buffer), isPreview});
|
||||
}
|
||||
|
||||
void MainWindow::on_viewtxt() {
|
||||
auto hexeditor = currentHexView();
|
||||
if (hexeditor == nullptr) {
|
||||
return;
|
||||
}
|
||||
_showtxt->load(hexeditor->document()->buffer());
|
||||
}
|
||||
|
||||
void MainWindow::on_fullScreen() {
|
||||
if (this->isFullScreen()) {
|
||||
this->showMaximized();
|
||||
|
@ -3183,14 +3169,10 @@ void MainWindow::registerEditorView(EditorView *editor, const QString &ws) {
|
|||
auto v = w->create(p->first, editor);
|
||||
auto id = w->id();
|
||||
editor->registerView(id, v);
|
||||
connect(v, &WingEditorViewWidget::docSaved, this,
|
||||
connect(v, &WingEditorViewWidget::savedStateChanged, this,
|
||||
[editor](bool saved) {
|
||||
editor->hexEditor()->document()->setDocSaved(saved);
|
||||
});
|
||||
connect(v, &WingEditorViewWidget::raiseView, this, [editor, id]() {
|
||||
editor->raise();
|
||||
editor->switchView(id);
|
||||
});
|
||||
}
|
||||
}
|
||||
for (auto &m : m_hexContextMenu) {
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "model/numshowmodel.h"
|
||||
#include "scriptingdialog.h"
|
||||
#include "settingdialog.h"
|
||||
#include "showtextdialog.h"
|
||||
#include "utilities.h"
|
||||
|
||||
class PluginSystem;
|
||||
|
@ -198,7 +197,6 @@ private slots:
|
|||
void on_locChanged();
|
||||
void on_selectionChanged();
|
||||
|
||||
void on_viewtxt();
|
||||
void on_fullScreen();
|
||||
void on_saveLayout();
|
||||
void on_exportlog();
|
||||
|
@ -629,8 +627,6 @@ private:
|
|||
bool m_islittle = true;
|
||||
bool m_enablePlugin = true;
|
||||
|
||||
ShowTextDialog *_showtxt = nullptr;
|
||||
|
||||
// Guard against recursion
|
||||
bool _isHandlingEvent = false;
|
||||
};
|
||||
|
|
|
@ -651,7 +651,6 @@ ScriptingDialog::buildSymbolShowDock(ads::CDockManager *dock,
|
|||
ads::CDockAreaWidget *areaw) {
|
||||
Q_ASSERT(m_consoleout);
|
||||
m_sym = new ASObjTreeWidget(this);
|
||||
m_sym->header()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
auto dw =
|
||||
buildDockWidget(dock, QStringLiteral("Symbol"), tr("Symbol"), m_sym);
|
||||
return dock->addDockWidget(area, dw, areaw);
|
||||
|
|
|
@ -1,246 +0,0 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#include "showtextdialog.h"
|
||||
|
||||
#include "class/qkeysequences.h"
|
||||
#include "class/wingmessagebox.h"
|
||||
#include "class/wingprogressdialog.h"
|
||||
#include "control/codeedit.h"
|
||||
#include "control/toast.h"
|
||||
#include "dialog/encodingdialog.h"
|
||||
#include "qeditor.h"
|
||||
|
||||
#include <QThread>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
constexpr auto EMPTY_FUNC = [] {};
|
||||
|
||||
ShowTextDialog::ShowTextDialog(QWidget *parent) : FramelessDialogBase(parent) {
|
||||
this->setUpdatesEnabled(false);
|
||||
|
||||
// build up UI
|
||||
buildUpRibbonBar();
|
||||
|
||||
auto cw = new QWidget(this);
|
||||
cw->setSizePolicy(
|
||||
QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
||||
auto layout = new QVBoxLayout(cw);
|
||||
layout->setContentsMargins(1, 0, 1, 0);
|
||||
layout->setSpacing(0);
|
||||
layout->addWidget(q_check_ptr(m_ribbon));
|
||||
|
||||
m_edit = new CodeEdit(false, this, false);
|
||||
auto editor = m_edit->editor();
|
||||
editor->setCodec(QStringLiteral("ASCII"));
|
||||
connect(editor, &QEditor::needLoading, this,
|
||||
[this]() { load(m_last.buffer, m_last.offset, m_last.size); });
|
||||
|
||||
editor->setFlag(QEditor::ReadOnly, true);
|
||||
editor->setAcceptDrops(false);
|
||||
editor->setUndoRedoEnabled(false);
|
||||
editor->createSimpleBasicContextMenu(true, true);
|
||||
layout->addWidget(editor);
|
||||
|
||||
m_status = new QStatusBar(this);
|
||||
layout->addWidget(m_status);
|
||||
buildUpContent(cw);
|
||||
|
||||
// ok, preparing for starting...
|
||||
this->setWindowTitle(tr("TextBroswer"));
|
||||
this->setWindowIcon(ICONRES(QStringLiteral("viewtxt")));
|
||||
this->setMinimumSize(800, 600);
|
||||
|
||||
this->setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
ShowTextDialog::~ShowTextDialog() {}
|
||||
|
||||
void ShowTextDialog::load(QHexBuffer *buffer, const QString encoding,
|
||||
qsizetype offset, qsizetype size) {
|
||||
auto editor = m_edit->editor();
|
||||
editor->blockSignals(true);
|
||||
editor->setCodec(encoding);
|
||||
load(buffer, offset, size);
|
||||
editor->blockSignals(false);
|
||||
}
|
||||
|
||||
void ShowTextDialog::load(QHexBuffer *buffer, qsizetype offset,
|
||||
qsizetype size) {
|
||||
if (buffer == nullptr || offset < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_canceled = false;
|
||||
|
||||
if (size < 0) {
|
||||
size = buffer->length();
|
||||
}
|
||||
|
||||
if (size >= std::numeric_limits<decltype(size)>::max()) {
|
||||
WingMessageBox::critical(this, this->windowTitle(), tr("TooHugeFile"));
|
||||
return;
|
||||
}
|
||||
|
||||
auto editor = m_edit->editor();
|
||||
editor->setUpdatesEnabled(false);
|
||||
|
||||
auto doc = editor->document();
|
||||
auto orign = offset;
|
||||
|
||||
WingProgressDialog pdialog(tr("Loading"), tr("Cancel"), 0, size - orign);
|
||||
pdialog.setAutoClose(false);
|
||||
pdialog.setAutoReset(true);
|
||||
|
||||
connect(&pdialog, &WingProgressDialog::canceled, this,
|
||||
&ShowTextDialog::on_cancel);
|
||||
pdialog.open();
|
||||
|
||||
QEventLoop loop;
|
||||
|
||||
auto th = QThread::create([&] {
|
||||
QByteArray ba;
|
||||
auto codec = editor->codecName();
|
||||
|
||||
doc->startChunkLoading();
|
||||
constexpr auto CHUNK_SIZE = 100000;
|
||||
|
||||
do {
|
||||
ba = buffer->read(offset, CHUNK_SIZE);
|
||||
offset += ba.size();
|
||||
|
||||
if (codec.size())
|
||||
doc->addChunk(QCE::convertString(codec, ba));
|
||||
else
|
||||
doc->addChunk(QString::fromLatin1(ba));
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
qApp, [&] { pdialog.setValue(offset - orign); });
|
||||
qApp->processEvents();
|
||||
} while (!m_canceled && (offset < size) && ba.size());
|
||||
|
||||
pdialog.setRange(-1, -1);
|
||||
doc->stopChunkLoading();
|
||||
editor->setCursor(QDocumentCursor(doc));
|
||||
pdialog.close();
|
||||
});
|
||||
|
||||
connect(th, &QThread::finished, this,
|
||||
[this, buffer, orign, th, &offset, &loop] {
|
||||
// record
|
||||
m_last.buffer = buffer;
|
||||
m_last.offset = orign;
|
||||
m_last.size = offset;
|
||||
|
||||
show();
|
||||
loop.quit();
|
||||
th->deleteLater();
|
||||
});
|
||||
|
||||
th->start();
|
||||
|
||||
loop.exec();
|
||||
editor->setUpdatesEnabled(true);
|
||||
m_status->showMessage(editor->codecName());
|
||||
}
|
||||
|
||||
void ShowTextDialog::buildUpRibbonBar() {
|
||||
m_ribbon = new Ribbon(this);
|
||||
m_ribbon->setAcceptDrops(false);
|
||||
buildEditPage(m_ribbon->addTab(tr("Edit")));
|
||||
buildViewPage(m_ribbon->addTab(tr("View")));
|
||||
}
|
||||
|
||||
RibbonTabContent *ShowTextDialog::buildEditPage(RibbonTabContent *tab) {
|
||||
auto shortcuts = QKeySequences::instance();
|
||||
{
|
||||
auto pannel = tab->addGroup(tr("General"));
|
||||
|
||||
auto a = addPannelAction(pannel, QStringLiteral("copy"), tr("Copy"),
|
||||
&ShowTextDialog::on_copyfile);
|
||||
setPannelActionToolTip(a, QKeySequence::Copy);
|
||||
|
||||
a = addPannelAction(pannel, QStringLiteral("find"), tr("Find"),
|
||||
&ShowTextDialog::on_findfile);
|
||||
setPannelActionToolTip(a, QKeySequence::Find);
|
||||
|
||||
a = addPannelAction(pannel, QStringLiteral("jmp"), tr("Goto"),
|
||||
&ShowTextDialog::on_gotoline);
|
||||
setPannelActionToolTip(a,
|
||||
shortcuts.keySequence(QKeySequences::Key::GOTO));
|
||||
|
||||
addPannelAction(pannel, QStringLiteral("encoding"), tr("Encoding"),
|
||||
&ShowTextDialog::on_encoding,
|
||||
shortcuts.keySequence(QKeySequences::Key::ENCODING));
|
||||
}
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
RibbonTabContent *ShowTextDialog::buildViewPage(RibbonTabContent *tab) {
|
||||
auto shortcuts = QKeySequences::instance();
|
||||
|
||||
auto pannel = tab->addGroup(tr("Display"));
|
||||
auto menu = new QMenu(this);
|
||||
menu->addAction(newAction(QStringLiteral("80%"),
|
||||
[this] { this->setCurrentEditorScale(0.8); }));
|
||||
menu->addAction(newAction(QStringLiteral("90%"),
|
||||
[this] { this->setCurrentEditorScale(0.9); }));
|
||||
menu->addAction(newAction(QStringLiteral("100%"),
|
||||
[this] { this->setCurrentEditorScale(1.0); }));
|
||||
menu->addSeparator();
|
||||
menu->addAction(newAction(QStringLiteral("120%"),
|
||||
[this] { this->setCurrentEditorScale(1.2); }));
|
||||
menu->addAction(newAction(QStringLiteral("150%"),
|
||||
[this] { this->setCurrentEditorScale(1.5); }));
|
||||
menu->addAction(newAction(QStringLiteral("200%"),
|
||||
[this] { this->setCurrentEditorScale(2.0); }));
|
||||
menu->addAction(newAction(QStringLiteral("250%"),
|
||||
[this] { this->setCurrentEditorScale(2.5); }));
|
||||
menu->addAction(newAction(QStringLiteral("300%"),
|
||||
[this] { this->setCurrentEditorScale(3.0); }));
|
||||
addPannelAction(pannel, QStringLiteral("scale"), tr("Scale"), EMPTY_FUNC,
|
||||
{}, menu);
|
||||
addPannelAction(pannel, QStringLiteral("scalereset"), tr("ResetScale"),
|
||||
[this] { this->setCurrentEditorScale(1.0); });
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
void ShowTextDialog::setCurrentEditorScale(qreal rate) {
|
||||
m_edit->editor()->setScaleRate(rate);
|
||||
}
|
||||
|
||||
void ShowTextDialog::on_copyfile() {
|
||||
m_edit->editor()->copy();
|
||||
Toast::toast(this, NAMEICONRES(QStringLiteral("copy")),
|
||||
tr("CopyToClipBoard"));
|
||||
}
|
||||
|
||||
void ShowTextDialog::on_findfile() { m_edit->editor()->find(); }
|
||||
|
||||
void ShowTextDialog::on_gotoline() { m_edit->editor()->gotoLine(); }
|
||||
|
||||
void ShowTextDialog::on_encoding() {
|
||||
EncodingDialog d;
|
||||
if (d.exec()) {
|
||||
auto res = d.getResult();
|
||||
m_edit->editor()->setCodec(res);
|
||||
}
|
||||
}
|
||||
|
||||
void ShowTextDialog::on_cancel() { m_canceled = true; }
|
|
@ -1,137 +0,0 @@
|
|||
/*==============================================================================
|
||||
** Copyright (C) 2024-2027 WingSummer
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify it under
|
||||
** the terms of the GNU Affero General Public License as published by the Free
|
||||
** Software Foundation, version 3.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
** FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
** details.
|
||||
**
|
||||
** You should have received a copy of the GNU Affero General Public License
|
||||
** along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
** =============================================================================
|
||||
*/
|
||||
|
||||
#ifndef SHOWTEXTDIALOG_H
|
||||
#define SHOWTEXTDIALOG_H
|
||||
|
||||
#include "QHexView/document/buffer/qhexbuffer.h"
|
||||
|
||||
#include "QWingRibbon/ribbon.h"
|
||||
#include "QWingRibbon/ribbonbuttongroup.h"
|
||||
#include "QWingRibbon/ribbontabcontent.h"
|
||||
#include "control/codeedit.h"
|
||||
#include "framelessdialogbase.h"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <QShortcut>
|
||||
#include <QStatusBar>
|
||||
#include <QToolButton>
|
||||
|
||||
class ShowTextDialog : public FramelessDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ShowTextDialog(QWidget *parent = nullptr);
|
||||
virtual ~ShowTextDialog();
|
||||
|
||||
public:
|
||||
void load(QHexBuffer *buffer, const QString encoding, qsizetype offset = 0,
|
||||
qsizetype size = -1);
|
||||
void load(QHexBuffer *buffer, qsizetype offset = 0, qsizetype size = -1);
|
||||
|
||||
private:
|
||||
void buildUpRibbonBar();
|
||||
|
||||
RibbonTabContent *buildEditPage(RibbonTabContent *tab);
|
||||
RibbonTabContent *buildViewPage(RibbonTabContent *tab);
|
||||
|
||||
void setCurrentEditorScale(qreal rate);
|
||||
|
||||
private:
|
||||
template <typename Func>
|
||||
inline QToolButton *
|
||||
addPannelAction(RibbonButtonGroup *pannel, const QString &iconName,
|
||||
const QString &title, Func &&slot,
|
||||
const QKeySequence &shortcut = QKeySequence(),
|
||||
QMenu *menu = nullptr) {
|
||||
return addPannelAction(pannel, ICONRES(iconName), title, slot, shortcut,
|
||||
menu);
|
||||
}
|
||||
|
||||
template <typename Func>
|
||||
inline QToolButton *
|
||||
addPannelAction(RibbonButtonGroup *pannel, const QIcon &icon,
|
||||
const QString &title, Func &&slot,
|
||||
const QKeySequence &shortcut = QKeySequence(),
|
||||
QMenu *menu = nullptr) {
|
||||
Q_ASSERT(pannel);
|
||||
auto a = new QToolButton(pannel);
|
||||
a->setText(title);
|
||||
a->setIcon(icon);
|
||||
setPannelActionToolTip(a, shortcut);
|
||||
|
||||
if (!shortcut.isEmpty()) {
|
||||
auto shortCut = new QShortcut(shortcut, this);
|
||||
shortCut->setContext(Qt::WindowShortcut);
|
||||
connect(shortCut, &QShortcut::activated, a, &QToolButton::click);
|
||||
}
|
||||
|
||||
a->setMenu(menu);
|
||||
if (menu) {
|
||||
a->setPopupMode(QToolButton::InstantPopup);
|
||||
}
|
||||
connect(a, &QToolButton::clicked, this, slot);
|
||||
pannel->addButton(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
template <typename Func>
|
||||
inline QAction *newAction(const QString &title, Func &&slot,
|
||||
const QKeySequence &shortcut = QKeySequence()) {
|
||||
auto a = new QAction;
|
||||
a->setText(title);
|
||||
a->setShortcutVisibleInContextMenu(true);
|
||||
a->setShortcut(shortcut);
|
||||
connect(a, &QAction::triggered, this, slot);
|
||||
return a;
|
||||
}
|
||||
|
||||
inline void
|
||||
setPannelActionToolTip(QToolButton *action,
|
||||
const QKeySequence &shortcut = QKeySequence()) {
|
||||
Q_ASSERT(action);
|
||||
auto title = action->text();
|
||||
action->setToolTip(
|
||||
shortcut.isEmpty()
|
||||
? QStringLiteral("<p align=\"center\">%1</p>").arg(title)
|
||||
: QStringLiteral(
|
||||
"<p align=\"center\">%1</p><p align=\"center\">%2</p>")
|
||||
.arg(title, shortcut.toString()));
|
||||
}
|
||||
|
||||
private slots:
|
||||
void on_copyfile();
|
||||
void on_findfile();
|
||||
void on_gotoline();
|
||||
void on_encoding();
|
||||
|
||||
void on_cancel();
|
||||
|
||||
private:
|
||||
Ribbon *m_ribbon = nullptr;
|
||||
CodeEdit *m_edit = nullptr;
|
||||
bool m_canceled = false;
|
||||
|
||||
QStatusBar *m_status = nullptr;
|
||||
|
||||
struct {
|
||||
QHexBuffer *buffer = nullptr;
|
||||
qsizetype offset = 0;
|
||||
qsizetype size = -1;
|
||||
} m_last;
|
||||
};
|
||||
|
||||
#endif // SHOWTEXTDIALOG_H
|
Loading…
Reference in New Issue