forked from e8tools/tool1cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request e8tools#229 from dmpas/feature/gui
Гуй
- Loading branch information
Showing
88 changed files
with
5,953 additions
and
87 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
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
This file was deleted.
Oops, something went wrong.
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,77 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
project(gtool1cd) | ||
|
||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
find_package(Qt5Widgets REQUIRED) | ||
|
||
set (QHEXEDIT_HEADERS | ||
QHexEdit/document/commands/hexcommand.h | ||
QHexEdit/document/commands/insertcommand.h | ||
QHexEdit/document/commands/removecommand.h | ||
QHexEdit/document/commands/replacecommand.h | ||
QHexEdit/document/gapbuffer.h | ||
QHexEdit/document/qhexcursor.h | ||
QHexEdit/document/qhexdocument.h | ||
QHexEdit/document/qhextheme.h | ||
QHexEdit/paint/qhexmetrics.h | ||
QHexEdit/paint/qhexpainter.h | ||
QHexEdit/qhexedit.h | ||
QHexEdit/qhexeditprivate.h | ||
QHexEdit/document/metadata/qhexmetadataitem.h | ||
QHexEdit/document/metadata/qhexmetadata.h | ||
) | ||
|
||
set (QHEXEDIT_SOURCES | ||
QHexEdit/document/commands/hexcommand.cpp | ||
QHexEdit/document/commands/insertcommand.cpp | ||
QHexEdit/document/commands/removecommand.cpp | ||
QHexEdit/document/commands/replacecommand.cpp | ||
QHexEdit/document/gapbuffer.cpp | ||
QHexEdit/document/qhexcursor.cpp | ||
QHexEdit/document/qhexdocument.cpp | ||
QHexEdit/document/qhextheme.cpp | ||
QHexEdit/paint/qhexmetrics.cpp | ||
QHexEdit/paint/qhexpainter.cpp | ||
QHexEdit/qhexedit.cpp | ||
QHexEdit/qhexeditprivate.cpp | ||
QHexEdit/document/metadata/qhexmetadataitem.cpp | ||
QHexEdit/document/metadata/qhexmetadata.cpp | ||
) | ||
|
||
|
||
file (GLOB MODEL_HEADERS "models/*.h") | ||
file (GLOB MODEL_SOURCES "models/*.cpp") | ||
|
||
set(HEADER_FILES mainwindow.h starter.h littlelogwindow.h cache.h table_fields_window.h table_data_window.h | ||
skobkatextwindow.h models/tables_list_model.h models/fields_list_model.h models/table_data_model.h | ||
export_table_to_xml_dialog.h configurations_window.h | ||
${MODEL_HEADERS} ${QHEXEDIT_HEADERS}) | ||
set(UI_FILES mainwindow.ui starter.ui littlelogwindow.ui table_fields_window.ui table_data_window.ui | ||
skobkatextwindow.ui export_table_to_xml_dialog.ui configurations_window.ui) | ||
set(SOURCE_FILES main.cpp mainwindow.cpp starter.cpp littlelogwindow.cpp cache.cpp table_fields_window.cpp table_data_window.cpp | ||
skobkatextwindow.cpp export_table_to_xml_dialog.cpp configurations_window.cpp | ||
${MODEL_SOURCES} ${QHEXEDIT_SOURCES}) | ||
|
||
add_executable(gtool1cd WIN32 ${SOURCE_FILES} ${HEADER_FILES} ${UI_FILES}) | ||
|
||
include_directories (${SOURCE_DIR}/SystemClasses) | ||
target_link_libraries (gtool1cd SystemClasses) | ||
|
||
include_directories (${SOURCE_DIR}/tool1cd) | ||
target_link_libraries (gtool1cd tool1cd) | ||
|
||
|
||
find_package (Boost 1.53 REQUIRED COMPONENTS filesystem regex system) | ||
include_directories (${Boost_INCLUDE_DIRS}) | ||
target_link_libraries (gtool1cd ${Boost_LIBRARIES}) | ||
|
||
find_package (ZLIB REQUIRED) | ||
include_directories (${ZLIB_INCLUDE_DIRS}) | ||
target_link_libraries (gtool1cd ${ZLIB_LIBRARIES}) | ||
|
||
install (TARGETS gtool1cd DESTINATION bin) | ||
|
||
qt5_use_modules(gtool1cd Widgets) |
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 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Dax89 | ||
|
||
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, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
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. |
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,31 @@ | ||
HEADERS += $$PWD/document/commands/hexcommand.h \ | ||
$$PWD/document/commands/insertcommand.h \ | ||
$$PWD/document/commands/removecommand.h \ | ||
$$PWD/document/commands/replacecommand.h \ | ||
$$PWD/document/gapbuffer.h \ | ||
$$PWD/document/qhexcursor.h \ | ||
$$PWD/document/qhexdocument.h \ | ||
$$PWD/document/qhextheme.h \ | ||
$$PWD/paint/qhexmetrics.h \ | ||
$$PWD/paint/qhexpainter.h \ | ||
$$PWD/qhexedit.h \ | ||
$$PWD/qhexeditprivate.h \ | ||
$$PWD/document/metadata/qhexmetadataitem.h \ | ||
$$PWD/document/metadata/qhexmetadata.h | ||
|
||
SOURCES += $$PWD/document/commands/hexcommand.cpp \ | ||
$$PWD/document/commands/insertcommand.cpp \ | ||
$$PWD/document/commands/removecommand.cpp \ | ||
$$PWD/document/commands/replacecommand.cpp \ | ||
$$PWD/document/gapbuffer.cpp \ | ||
$$PWD/document/qhexcursor.cpp \ | ||
$$PWD/document/qhexdocument.cpp \ | ||
$$PWD/document/qhextheme.cpp \ | ||
$$PWD/paint/qhexmetrics.cpp \ | ||
$$PWD/paint/qhexpainter.cpp \ | ||
$$PWD/qhexedit.cpp \ | ||
$$PWD/qhexeditprivate.cpp \ | ||
$$PWD/document/metadata/qhexmetadataitem.cpp \ | ||
$$PWD/document/metadata/qhexmetadata.cpp | ||
|
||
INCLUDEPATH += $$PWD |
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,58 @@ | ||
QHexEdit | ||
======== | ||
QHexEdit is a hexadecimal widget for Qt5 | ||
|
||
<p align="center"> | ||
<img height="400" src="https://raw.githubusercontent.com/Dax89/QHexEdit/master/screenshots/QHexEdit.png"> | ||
</p> | ||
|
||
Features | ||
----- | ||
- Partial large file support (Gap Buffer algorithm). | ||
- Unlimited Undo/Redo. | ||
- Fully Customizable. | ||
- Easy to Use. | ||
|
||
Usage | ||
----- | ||
The data is managed by QHexEdit through QHexDocument class.<br> | ||
You can load a generic QIODevice using the method fromDevice() of QHexDocument class, also, helper methods are provided in order to load a QFile a In-Memory buffer in QHexEdit:<br> | ||
``` | ||
// Load data from In-Memory Buffer... | ||
QHexDocument* document = QHexDocument::fromMemory(bytearray); | ||
// ...from a generic I/O device... | ||
QHexDocument* document = QHexDocument::fromDevice(iodevice); | ||
/* ...or from File */ | ||
QHexDocument* document = QHexDocument::fromFile("data.bin"); | ||
QHexEdit* hexedit = new QHexEdit(); | ||
hexedit->setDocument(document); // Associate QHexEditData with this QHexEdit | ||
// Metatadata management | ||
document->highlightBackRange(0, 10, QColor(Qt::Red)); // Highlight background from 0 to 10 (10 included) | ||
document->highlightForeRange(0, 15, QColor(Qt::darkBLue)); // Highlight foreground from 0 to 15 (15 included) | ||
document->clearHighlighting(); // Clear Highlighting | ||
document->commentRange(0, 12, "I'm a comment!"); // Add a comment | ||
document->clearComments(); // Clear all comments | ||
// Bulk metadata management (paints only one time) | ||
document->beginMetadata(); // Lock repaint | ||
document->highlightBackRange(0, 10, QColor(Qt::Red)); // Highlight background from 0 to 10 (10 included) | ||
document->highlightForeRange(0, 15, QColor(Qt::darkBLue)); // Highlight foreground from 0 to 15 (15 included) | ||
document->clearHighlighting(); // Clear Highlighting | ||
document->commentRange(0, 12, "I'm a comment!"); // Add a comment | ||
document->clearComments(); // Clear all comments | ||
document->endMetadata(); // Unlock repaint | ||
// Data editing | ||
QByteArray data = document->read(24, 78); // Read 78 bytes starting from offset 24 | ||
document->insert(4, QString("Hello QHexEdit").toUTF8()); // Insert an UTF-8 string from offset 4 | ||
document->remove(6, 10); // Delete bytes from offset 6 to offset 10 | ||
document->replace(30, 12, QString("New Data").toUTF8()); // Replace 12 bytes from offset 30 with the UTF-8 string "New Data" | ||
``` | ||
|
||
License | ||
----- | ||
QHexEdit is released under MIT license |
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,6 @@ | ||
#include "hexcommand.h" | ||
|
||
HexCommand::HexCommand(GapBuffer *gapbuffer, QUndoCommand *parent): QUndoCommand(parent), _gapbuffer(gapbuffer), _offset(0), _length(0) | ||
{ | ||
|
||
} |
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,18 @@ | ||
#ifndef HEXCOMMAND_H | ||
#define HEXCOMMAND_H | ||
|
||
#include <QUndoCommand> | ||
#include "../gapbuffer.h" | ||
|
||
class HexCommand: public QUndoCommand | ||
{ | ||
public: | ||
HexCommand(GapBuffer* gapbuffer, QUndoCommand* parent = 0); | ||
|
||
protected: | ||
GapBuffer* _gapbuffer; | ||
integer_t _offset, _length; | ||
QByteArray _data; | ||
}; | ||
|
||
#endif // HEXCOMMAND_H |
Oops, something went wrong.