-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement hex editor/viewer via Dax89/QHexView.
- Loading branch information
1 parent
004720b
commit d94b7d8
Showing
11 changed files
with
115 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "Qt-Frameless-Window-DarkStyle"] | ||
path = Qt-Frameless-Window-DarkStyle | ||
url = https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle | ||
[submodule "QHexView"] | ||
path = QHexView | ||
url = https://github.com/Dax89/QHexView.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@include html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
keywords \b[a-zA-Z0-9.]+= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@include yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <QFile> | ||
#include <QVBoxLayout> | ||
#include "document/buffer/qmemorybuffer.h" | ||
#include "hexedit.h" | ||
|
||
HexEdit::HexEdit(QWidget *parent) | ||
: QWidget(parent) | ||
{ | ||
auto layout = new QVBoxLayout(); | ||
layout->addWidget(m_HexView = new QHexView(this)); | ||
layout->setContentsMargins(0, 0, 0, 0); | ||
setLayout(layout); | ||
} | ||
|
||
QString HexEdit::filePath() | ||
{ | ||
return m_FilePath; | ||
} | ||
|
||
void HexEdit::open(const QString &path) | ||
{ | ||
auto document = QHexDocument::fromFile<QMemoryBuffer>(path); | ||
m_HexView->setDocument(document); | ||
m_FilePath = path; | ||
} | ||
|
||
bool HexEdit::save() | ||
{ | ||
QFile file(m_FilePath); | ||
if (file.open(QFile::WriteOnly)) { | ||
m_HexView->document()->saveTo(&file); | ||
file.close(); | ||
return true; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef HEXEDIT_H | ||
#define HEXEDIT_H | ||
|
||
#include <QWidget> | ||
#include "qhexview.h" | ||
|
||
class HexEdit : public QWidget | ||
{ | ||
Q_OBJECT | ||
private: | ||
QString m_FilePath; | ||
QHexView *m_HexView; | ||
public: | ||
explicit HexEdit(QWidget *parent = nullptr); | ||
QString filePath(); | ||
void open(const QString &path); | ||
bool save(); | ||
}; | ||
|
||
#endif // HEXEDIT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d94b7d8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey sap bro i need your help android studio failed to compile my source code to apk