This commit is contained in:
寂静的羽夏 2022-09-03 22:59:40 +08:00
parent ddaa460c7c
commit cc10ca8416
21 changed files with 705 additions and 274 deletions

View File

@ -27,7 +27,8 @@ HEADERS += $$PWD/document/commands/hex/hexcommand.h \
$$PWD/QHexEdit2/chunks.h \
$$PWD/document/commands/meta/metashowcommand.h \
$$PWD/document/commands/baseaddrcommand.h \
$$PWD/document/commands/encodingchangecommand.h
$$PWD/document/commands/encodingchangecommand.h \
$$PWD/document/buffer/qfileregionbuffer.h
SOURCES += $$PWD/document/commands/hex/hexcommand.cpp \
$$PWD/document/commands/hex/insertcommand.cpp \
@ -56,6 +57,7 @@ SOURCES += $$PWD/document/commands/hex/hexcommand.cpp \
$$PWD/QHexEdit2/chunks.cpp \
$$PWD/document/commands/meta/metashowcommand.cpp \
$$PWD/document/commands/baseaddrcommand.cpp \
$$PWD/document/commands/encodingchangecommand.cpp
$$PWD/document/commands/encodingchangecommand.cpp \
$$PWD/document/buffer/qfileregionbuffer.cpp
INCLUDEPATH += $$PWD

View File

@ -0,0 +1,64 @@
#include "qfileregionbuffer.h"
#include <QFile>
#include <QFileInfo>
#include <unistd.h>
QFileRegionBuffer::QFileRegionBuffer(QObject *parent) : QHexBuffer(parent) {}
qint64 QFileRegionBuffer::length() const { return buffer.length(); }
void QFileRegionBuffer::insert(qint64 offset, const QByteArray &data) {
Q_UNUSED(offset);
Q_UNUSED(data);
// 不支持插入,仅支持复写
return;
}
void QFileRegionBuffer::remove(qint64 offset, int length) {
// 在此模式下,删除视为按 0 填充
replace(offset, QByteArray(length, 0));
}
QByteArray QFileRegionBuffer::read(qint64 offset, int length) {
return buffer.mid(int(offset), length);
}
bool QFileRegionBuffer::read(QIODevice *iodevice) {
auto file = qobject_cast<QFile *>(iodevice);
if (file && file->open(QFile::ReadOnly)) {
lseek(file->handle(), offset,
SEEK_SET); // 有些特殊的文件 Qt 是不支持 seek 的,用原生函数
buffer = file->read(maxlength);
file->close();
return true;
}
return false;
}
void QFileRegionBuffer::write(QIODevice *iodevice) {
QFile file(iodevice);
if (file.open(QFile::WriteOnly)) {
lseek(file.handle(), offset, SEEK_SET);
file.write(buffer);
file.close();
}
}
qint64 QFileRegionBuffer::indexOf(const QByteArray &ba, qint64 from) {
return buffer.indexOf(ba, int(from));
}
qint64 QFileRegionBuffer::lastIndexOf(const QByteArray &ba, qint64 from) {
return buffer.lastIndexOf(ba, int(from));
}
void QFileRegionBuffer::setReadOffset(qint64 offset) { this->offset = offset; }
qint64 QFileRegionBuffer::readOffset() { return offset; }
qint64 QFileRegionBuffer::readMaxBytes() { return maxlength; }
void QFileRegionBuffer::setReadMaxBytes(qint64 maxlength) {
if (maxlength)
this->maxlength = maxlength;
}

View File

@ -0,0 +1,34 @@
#ifndef QFILEREGIONBUFFER_H
#define QFILEREGIONBUFFER_H
#include "qhexbuffer.h"
class QFileRegionBuffer : public QHexBuffer {
Q_OBJECT
public:
explicit QFileRegionBuffer(QObject *parent = nullptr);
public:
qint64 length() const override;
void insert(qint64 offset, const QByteArray &data) override;
void remove(qint64 offset, int length) override;
QByteArray read(qint64 offset, int length) override;
bool read(QIODevice *iodevice) override;
void write(QIODevice *iodevice) override;
qint64 indexOf(const QByteArray &ba, qint64 from) override;
qint64 lastIndexOf(const QByteArray &ba, qint64 from) override;
void setReadOffset(qint64 offset);
qint64 readOffset();
qint64 readMaxBytes();
void setReadMaxBytes(qint64 maxlength);
private:
qint64 offset = 0;
qint64 maxlength = 1024;
QByteArray buffer;
};
#endif // QFILEREGIONBUFFER_H

View File

@ -1,5 +1,6 @@
#include "qhexdocument.h"
#include "buffer/qfilebuffer.h"
#include "buffer/qfileregionbuffer.h"
#include "commands/baseaddrcommand.h"
#include "commands/bookmark/bookmarkaddcommand.h"
#include "commands/bookmark/bookmarkclearcommand.h"
@ -94,9 +95,12 @@ void QHexDocument::setDocSaved(bool b) {
emit documentSaved(b);
}
DocumentType QHexDocument::documentType() { return m_doctype; }
void QHexDocument::setDocumentType(DocumentType type) { m_doctype = type; }
bool QHexDocument::isReadOnly() { return m_readonly; }
bool QHexDocument::isKeepSize() { return m_keepsize; }
bool QHexDocument::isLocked() { return m_islocked; }
bool QHexDocument::setLockedFile(bool b) {
if (m_readonly)
return false;
@ -109,6 +113,9 @@ bool QHexDocument::setLockedFile(bool b) {
bool QHexDocument::setKeepSize(bool b) {
if (m_readonly)
return false;
if (!b && m_doctype == DocumentType::RegionFile)
return false;
m_keepsize = b;
if (b)
m_cursor->setInsertionMode(QHexCursor::OverwriteMode);
@ -335,6 +342,24 @@ bool QHexDocument::removeSelection() {
return res;
}
QHexDocument *QHexDocument::fromRegionFile(QString filename, qint64 start,
qint64 length, bool readonly,
QObject *parent) {
QFile iodevice(filename);
auto hexbuffer = new QFileRegionBuffer;
hexbuffer->setReadOffset(start);
hexbuffer->setReadMaxBytes(length);
if (hexbuffer->read(&iodevice)) {
return new QHexDocument(hexbuffer, readonly, parent);
} else {
delete hexbuffer;
}
return nullptr;
}
bool QHexDocument::cut(bool hex) {
if (!m_cursor->hasSelection() || m_keepsize)
return false;

View File

@ -18,6 +18,8 @@ struct BookMarkStruct {
enum class BookMarkModEnum { Insert, Modify, Remove, Apply, Clear };
enum class DocumentType { File, WorkSpace, RegionFile };
/*=========================*/
class QHexDocument : public QObject {
@ -83,7 +85,8 @@ public:
bool isDocSaved();
void setDocSaved(bool b = true);
bool isWorkspace = false;
DocumentType documentType();
void setDocumentType(DocumentType type);
void setMetafgVisible(bool b);
void setMetabgVisible(bool b);
@ -152,6 +155,11 @@ public:
template <typename T>
static QHexDocument *fromFile(QString filename, bool readonly = false,
QObject *parent = nullptr);
static QHexDocument *fromRegionFile(QString filename, qint64 start,
qint64 length, bool readonly = false,
QObject *parent = nullptr);
template <typename T>
static QHexDocument *fromMemory(char *data, int size, bool readonly = false,
QObject *parent = nullptr);
@ -209,6 +217,8 @@ private:
bool m_metabg = true;
bool m_metacomment = true;
DocumentType m_doctype = DocumentType::File;
/*======================*/
};
@ -222,8 +232,7 @@ QHexDocument *QHexDocument::fromDevice(QIODevice *iodevice, bool readonly,
if (!iodevice->isOpen()) {
needsclose = true;
iodevice->open(readonly ? QIODevice::ReadOnly
: QIODevice::ReadWrite); // modifed by wingsummer
iodevice->open(QIODevice::ReadOnly);
}
QHexBuffer *hexbuffer = new T();

View File

@ -18,17 +18,6 @@
QHexRenderer *QHexView::renderer() { return m_renderer; }
int QHexView::getWorkSpaceState(QHexDocument *doc, bool b) {
if (doc->isWorkspace) {
if (b)
return 1;
else
return 0;
} else {
return -1;
}
}
void QHexView::switchDocument(QHexDocument *document, QHexRenderer *renderer,
int vBarValue) {
if (document && renderer) {

View File

@ -46,7 +46,6 @@ public:
void setAddressBase(quint64 base);
bool isSaved();
int getWorkSpaceState(QHexDocument *doc, bool b);
static QFont getHexeditorFont();
void getStatus();

View File

@ -19,7 +19,8 @@ SOURCES += \
$$PWD/class/logger.cpp \
$$PWD/dialog/settingwindow.cpp \
$$PWD/mlicense/licensemanager.cpp \
$$PWD/mlicense/lincensedialog.cpp
$$PWD/mlicense/lincensedialog.cpp \
$$PWD/dialog/openregiondialog.cpp
RESOURCES += resources.qrc
@ -49,7 +50,8 @@ HEADERS += \
$$PWD/dialog/settingwindow.h \
$$PWD/mlicense/licensemanager.h \
$$PWD/mlicense/lincensedialog.h \
$$PWD/mlicense/qaesencryption.h
$$PWD/mlicense/qaesencryption.h \
$$PWD/dialog/openregiondialog.h
LIBS += $$PWD/mlicense/libQtAES.a

View File

@ -40,6 +40,8 @@ DriverSelectorDialog::DriverSelectorDialog(DMainWindow *parent)
connect(s, &QShortcut::activated, this, &DriverSelectorDialog::on_accepted);
connect(drivers, &QListWidget::itemSelectionChanged, this,
&DriverSelectorDialog::on_list_selectionChanged);
drivers->setCurrentRow(0); // 我不信你没有驱动器
}
void DriverSelectorDialog::on_list_selectionChanged() {

View File

@ -6,8 +6,7 @@
#include <QListWidgetItem>
#include <QShortcut>
EncodingDialog::EncodingDialog(DMainWindow *parent) {
Q_UNUSED(parent);
EncodingDialog::EncodingDialog(DMainWindow *parent) : DDialog(parent) {
this->setWindowTitle(tr("Encoding"));
this->setFixedSize(500, 600);
auto l = new DLabel(tr("ChooseEncoding"), this);

View File

@ -1,11 +1,13 @@
#include "mainwindow.h"
#include "QHexView/document/buffer/qfilebuffer.h"
#include "QHexView/document/buffer/qfileregionbuffer.h"
#include "QHexView/document/buffer/qmemorybuffer.h"
#include "QHexView/document/qhexcursor.h"
#include "QHexView/document/qhexmetadata.h"
#include "aboutsoftwaredialog.h"
#include "class/appmanager.h"
#include "class/recentfilemanager.h"
#include "dialog/openregiondialog.h"
#include "driverselectordialog.h"
#include "encodingdialog.h"
#include "finddialog.h"
@ -152,11 +154,15 @@ MainWindow::MainWindow(DMainWindow *parent) {
auto keynewb = QKeySequence(Qt::KeyboardModifier::ControlModifier |
Qt::KeyboardModifier::ShiftModifier | Qt::Key_N);
auto keyopenr = QKeySequence(Qt::KeyboardModifier::ControlModifier |
Qt::KeyboardModifier::ShiftModifier | Qt::Key_O);
AddToolSubMenuShortcutAction("newb", tr("NewBigFile"),
MainWindow::on_newbigfile, keynewb);
AddToolSubMenuShortcutAction("open", tr("OpenF"), MainWindow::on_openfile,
QKeySequence::Open);
AddToolSubMenuShortcutAction("openr", tr("OpenFR"), MainWindow::on_openregion,
keyopenr);
auto keysaveas =
QKeySequence(Qt::KeyboardModifier::ControlModifier |
@ -513,7 +519,12 @@ MainWindow::MainWindow(DMainWindow *parent) {
}
AddToolBtnEnd2();
AddToolBarTool("open", MainWindow::on_openfile, tr("OpenF"));
AddToolBtnBegin2("open") {
AddToolBtnBtn("open", tr("OpenF"), MainWindow::on_openfile);
AddToolBtnBtn("openr", tr("OpenFR"), MainWindow::on_openregion);
}
AddToolBtnEnd2();
AddToolBarTool("workspace", MainWindow::on_openworkspace,
tr("OpenWorkSpace"));
AddToolBarTool("opendriver", MainWindow::on_opendriver, tr("OpenD"));
@ -2391,10 +2402,18 @@ void MainWindow::connectControl(IWingPlugin *plugin) {
plgsys->resetTimeout(qobject_cast<IWingPlugin *>(sender()));
newFile();
});
ConnectControlLamba2(WingPlugin::Controller::openFile,
[=](QString filename, bool readonly, int *openedIndex) {
plgsys->resetTimeout(
qobject_cast<IWingPlugin *>(sender()));
return openFile(filename, readonly, openedIndex);
});
ConnectControlLamba2(
WingPlugin::Controller::openFile, [=](QString filename, bool readonly) {
WingPlugin::Controller::openRegionFile,
[=](QString filename, bool readonly, int *openedIndex, qint64 start,
qint64 length) {
plgsys->resetTimeout(qobject_cast<IWingPlugin *>(sender()));
return openFile(filename, readonly);
return openRegionFile(filename, readonly, openedIndex, start, length);
});
ConnectControlLamba2(WingPlugin::Controller::openDriver, [=](QString driver) {
plgsys->resetTimeout(qobject_cast<IWingPlugin *>(sender()));
@ -2571,6 +2590,103 @@ void MainWindow::newFile(bool bigfile) {
}
}
ErrFile MainWindow::openRegionFile(QString filename, bool readonly,
int *openedindex, qint64 start,
qint64 length) {
QList<QVariant> params;
if (_enableplugin) {
params << filename << readonly;
plgsys->raiseDispatch(HookIndex::OpenFileBegin, params);
}
QFileInfo info(filename);
if (info.exists()) {
if (!info.permission(QFile::ReadUser)) {
if (_enableplugin) {
params << ErrFile::Permission;
plgsys->raiseDispatch(HookIndex::OpenFileEnd, params);
}
return ErrFile::Permission;
}
if (!readonly && !info.permission(QFile::WriteUser)) {
if (_enableplugin) {
params << ErrFile::Permission;
plgsys->raiseDispatch(HookIndex::OpenFileEnd, params);
}
return ErrFile::Permission;
}
int i = 0;
for (auto item : hexfiles) {
if (item.filename == filename) {
if (openedindex) {
*openedindex = i;
}
if (_enableplugin) {
params << ErrFile::AlreadyOpened;
plgsys->raiseDispatch(HookIndex::OpenFileEnd, params);
}
return ErrFile::AlreadyOpened;
}
i++;
}
HexFile hf;
auto *p =
QHexDocument::fromRegionFile(filename, start, length, readonly, this);
if (p == nullptr) {
if (_enableplugin) {
params << ErrFile::Permission;
plgsys->raiseDispatch(HookIndex::OpenFileEnd, params);
}
return ErrFile::Permission;
}
hexeditor->setVisible(true);
hf.doc = p;
hf.filename = filename;
hf.workspace.clear();
hf.vBarValue = -1;
p->setDocumentType(DocumentType::RegionFile);
hf.isdriver = false;
hexeditor->setDocument(p);
hexeditor->setLockedFile(readonly);
hexeditor->setKeepSize(true);
hexeditor->renderer()->setEncoding(_encoding);
hf.render = hexeditor->renderer();
hexfiles.push_back(hf);
p->setDocSaved();
hexeditor->getStatus();
QIcon qicon;
QMimeDatabase db;
auto t = db.mimeTypeForFile(filename);
auto ico = t.iconName();
qicon = QIcon::fromTheme(ico, QIcon(ico));
tabs->addTab(qicon, info.fileName());
auto index = hexfiles.count() - 1;
tabs->setCurrentIndex(index);
tabs->setTabToolTip(index, filename);
setEditModeEnabled(true);
_currentfile = index;
if (_enableplugin) {
params << ErrFile::Success;
plgsys->raiseDispatch(HookIndex::OpenFileEnd, params);
}
return ErrFile::Success;
}
if (_enableplugin) {
params << ErrFile::NotExist;
plgsys->raiseDispatch(HookIndex::OpenFileEnd, params);
}
return ErrFile::NotExist;
}
ErrFile MainWindow::openFile(QString filename, bool readonly, int *openedindex,
QString workspace, bool *oldworkspace) {
QList<QVariant> params;
@ -2615,8 +2731,6 @@ ErrFile MainWindow::openFile(QString filename, bool readonly, int *openedindex,
i++;
}
hexeditor->setVisible(true);
HexFile hf;
auto *p =
info.size() > FILEMAXBUFFER
@ -2625,17 +2739,19 @@ ErrFile MainWindow::openFile(QString filename, bool readonly, int *openedindex,
if (p == nullptr) {
if (_enableplugin) {
params << ErrFile::Error;
params << ErrFile::Permission;
plgsys->raiseDispatch(HookIndex::OpenFileEnd, params);
}
return ErrFile::Error;
return ErrFile::Permission;
}
hexeditor->setVisible(true);
hf.doc = p;
hf.filename = filename;
hf.workspace = workspace;
hf.vBarValue = -1;
p->isWorkspace = workspace.length() > 0;
p->setDocumentType(workspace.length() > 0 ? DocumentType::WorkSpace
: DocumentType::File);
hf.isdriver = false;
hexeditor->setDocument(p);
hexeditor->setLockedFile(readonly);
@ -2648,7 +2764,7 @@ ErrFile MainWindow::openFile(QString filename, bool readonly, int *openedindex,
QIcon qicon;
if (p->isWorkspace) {
if (p->documentType() == DocumentType::WorkSpace) {
qicon = ICONRES("pro");
} else {
QMimeDatabase db;
@ -2856,16 +2972,40 @@ void MainWindow::on_openfile() {
QMessageBox::critical(this, tr("Error"), tr("FileNotExist"));
return;
}
if (res == ErrFile::Permission &&
openFile(filename, true, &index) == ErrFile::Permission) {
QMessageBox::critical(this, tr("Error"), tr("FilePermission"));
return;
}
if (res == ErrFile::AlreadyOpened) {
setFilePage(index);
return;
}
if (res == ErrFile::Permission &&
openFile(filename, true) == ErrFile::Permission) {
recentmanager->addRecentFile(filename);
}
}
void MainWindow::on_openregion() {
OpenRegionDialog d;
if (d.exec()) {
auto res = d.getResult();
int index;
auto ret =
openRegionFile(res.filename, false, &index, res.start, res.length);
if (ret == ErrFile::NotExist) {
QMessageBox::critical(this, tr("Error"), tr("FileNotExist"));
return;
}
if (ret == ErrFile::Permission &&
openRegionFile(res.filename, true, &index, res.start, res.length) ==
ErrFile::Permission) {
QMessageBox::critical(this, tr("Error"), tr("FilePermission"));
return;
}
recentmanager->addRecentFile(filename);
if (ret == ErrFile::AlreadyOpened) {
setFilePage(index);
return;
}
}
}
@ -3365,7 +3505,10 @@ void MainWindow::on_bookmarkChanged(BookMarkModEnum flag, int index, qint64 pos,
void MainWindow::on_documentSwitched() {
iReadWrite->setPixmap(hexeditor->isReadOnly() ? infoReadonly : infoWriteable);
if (hexfiles.count()) {
iw->setPixmap(hexeditor->document()->isWorkspace ? infow : infouw);
iw->setPixmap(hexeditor->document()->documentType() ==
DocumentType::WorkSpace
? infow
: infouw);
} else {
iw->setPixmap(infouw);
}
@ -3394,7 +3537,7 @@ ErrFile MainWindow::save(int index) {
doc->metadata()->getallMetas(), infos);
if (!b)
return ErrFile::WorkSpaceUnSaved;
f.doc->isWorkspace = true;
f.doc->setDocumentType(DocumentType::WorkSpace);
iw->setPixmap(infow);
tabs->setTabIcon(index, ICONRES("pro"));
f.doc->setDocSaved();
@ -3409,7 +3552,7 @@ ErrFile MainWindow::save(int index) {
if (!b)
return ErrFile::WorkSpaceUnSaved;
hexfiles[index].workspace = f.filename + PROEXT;
f.doc->isWorkspace = true;
f.doc->setDocumentType(DocumentType::WorkSpace);
iw->setPixmap(infow);
tabs->setTabIcon(index, ICONRES("pro"));
f.doc->setDocSaved();
@ -3473,7 +3616,7 @@ ErrFile MainWindow::saveAs(QString filename, int index) {
if (!b)
return ErrFile::WorkSpaceUnSaved;
hexfiles[index].workspace = filename + PROEXT;
f.doc->isWorkspace = true;
f.doc->setDocumentType(DocumentType::WorkSpace);
iw->setPixmap(infow);
tabs->setTabIcon(index, ICONRES("pro"));
f.doc->setDocSaved();
@ -3690,7 +3833,7 @@ void MainWindow::setEditModeEnabled(bool b, bool isdriver) {
if (b) {
enableDirverLimit(isdriver);
auto dm = hexeditor->document()->isWorkspace;
auto dm = hexeditor->document()->documentType() == DocumentType::WorkSpace;
iw->setPixmap(dm ? infow : infouw);
auto doc = hexeditor->document();
doc->canRedoChanged(doc->canRedo());

View File

@ -137,6 +137,9 @@ public:
private:
void newFile(bool bigfile = false);
ErrFile openRegionFile(QString filename, bool readonly = false,
int *openedindex = nullptr, qint64 start = 0,
qint64 length = 1024);
ErrFile openDriver(QString driver);
ErrFile closeFile(int index, bool force = false);
ErrFile save(int index);
@ -165,6 +168,7 @@ private:
void on_newfile();
void on_newbigfile();
void on_openfile();
void on_openregion();
void on_redofile();
void on_undofile();
void on_copyfile();

View File

@ -0,0 +1,70 @@
#include "openregiondialog.h"
#include "utilities.h"
#include <DDialogButtonBox>
#include <DLabel>
#include <DMessageManager>
#include <QShortcut>
OpenRegionDialog::OpenRegionDialog(DMainWindow *parent) : DDialog(parent) {
this->setWindowTitle(tr("OpenRegion"));
addContent(new DLabel(tr("ChooseFile"), this));
addSpacing(5);
filepath = new DFileChooserEdit(this);
filepath->initDialog();
addContent(filepath);
addSpacing(10);
addContent(new DLabel(tr("Start"), this));
addSpacing(5);
sbStart = new DSpinBox(this);
sbStart->setRange(0, INT_MAX);
sbStart->setPrefix("0x");
sbStart->setDisplayIntegerBase(16);
addContent(sbStart);
addSpacing(10);
addContent(new DLabel(tr("Len"), this));
addSpacing(5);
sbLength = new DSpinBox(this);
sbLength->setRange(1, INT_MAX);
addContent(sbLength);
addSpacing(20);
auto dbbox = new DDialogButtonBox(
DDialogButtonBox::Ok | DDialogButtonBox::Cancel, this);
connect(dbbox, &DDialogButtonBox::accepted, this,
&OpenRegionDialog::on_accept);
connect(dbbox, &DDialogButtonBox::rejected, this,
&OpenRegionDialog::on_reject);
auto key = QKeySequence(Qt::Key_Return);
auto s = new QShortcut(key, this);
connect(s, &QShortcut::activated, this, &OpenRegionDialog::on_accept);
addContent(dbbox);
}
RegionFileResult OpenRegionDialog::getResult() { return res; }
void OpenRegionDialog::on_accept() {
auto file = filepath->lineEdit()->text();
if (file.length()) {
if (!QFile::exists(file)) {
DMessageManager::instance()->sendMessage(this, ICONRES("open"),
tr("FileNotExist"));
}
} else {
DMessageManager::instance()->sendMessage(this, ICONRES("open"),
tr("NoFileSelected"));
return;
}
res.filename = file;
res.start = sbStart->value();
res.length = sbLength->value();
done(1);
}
void OpenRegionDialog::on_reject() { done(0); }
void OpenRegionDialog::closeEvent(QCloseEvent *event) {
Q_UNUSED(event);
done(0);
}

View File

@ -0,0 +1,37 @@
#ifndef OPENREGIONDIALOG_H
#define OPENREGIONDIALOG_H
#include <DDialog>
#include <DFileChooserEdit>
#include <DMainWindow>
#include <DSpinBox>
DWIDGET_USE_NAMESPACE
struct RegionFileResult {
QString filename;
qint64 start;
qint64 length;
};
class OpenRegionDialog : public DDialog {
Q_OBJECT
public:
OpenRegionDialog(DMainWindow *parent = nullptr);
RegionFileResult getResult();
private:
void on_accept();
void on_reject();
private:
DFileChooserEdit *filepath;
DSpinBox *sbStart, *sbLength;
RegionFileResult res;
protected:
void closeEvent(QCloseEvent *event) override;
};
#endif // OPENREGIONDIALOG_H

BIN
WingHexExplorer/images/openr.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,8 @@ int main(int argc, char *argv[]) {
a.setOrganizationName("WingCloud");
a.setApplicationName(QObject::tr("WingHexExplorer"));
a.setApplicationVersion("1.4.9");
a.setApplicationVersion("1.4.10");
a.setApplicationLicense("GPL-3.0");
a.setProductIcon(QIcon(":/images/icon.png"));
a.setProductName(QObject::tr("WingHexExplorer"));
a.setApplicationDescription(QObject::tr("AppDescription"));
@ -81,14 +82,13 @@ int main(int argc, char *argv[]) {
// 保存程序的窗口主题设置
DApplicationSettings as;
Q_UNUSED(as)
Q_UNUSED(as);
auto manager = AppManager::instance();
MainWindow w;
manager->mWindow = &w;
manager->openFiles(urls);
w.show();
dbus.registerObject(com, manager, QDBusConnection::ExportScriptableSlots);
Dtk::Widget::moveToCenter(&w);
return a.exec();

View File

@ -11,7 +11,7 @@
#include <QWidget>
#include <QtCore>
#define SDKVERSION 8
#define SDKVERSION 9
#define GETPLUGINQM(name) \
(QCoreApplication::applicationDirPath() + "/plglang/" + name)
#define PLUGINDIR (QCoreApplication::applicationDirPath() + "/plugin")
@ -309,7 +309,11 @@ signals:
// mainwindow
void newFile(bool bigfile = false);
ErrFile openFile(QString filename, bool readonly = false);
ErrFile openFile(QString filename, bool readonly = false,
int *openedIndex = nullptr);
ErrFile openRegionFile(QString filename, bool readonly = false,
int *openedIndex = nullptr, qint64 start = 0,
qint64 length = 1024);
ErrFile openDriver(QString driver);
ErrFile closeFile(int index, bool force = false);
ErrFile saveFile(int index);

View File

@ -81,6 +81,7 @@
<file>images/usr.jpg</file>
<file>images/fullscreen.png</file>
<file>images/reload.png</file>
<file>images/openr.png</file>
</qresource>
<qresource prefix="/resources">
<file>settings.json</file>

View File

@ -1,5 +1,10 @@
更新日志(由寂静的羽夏编写):
1.4.10
1. 修复打开驱动器未选中直接点确定崩溃的 Bug
2. 更新打开相关接口
3. 修复文件打开失败但仍显示编辑区的 Bug
1.4.9
1. 增加“解码字符串”解码字节长度限制,防止卡死界面内存溢出
2. 修复最后选中行没有任何字节坐标溢出的 Bug