Skip to content

Commit

Permalink
Merge pull request e8tools#229 from dmpas/feature/gui
Browse files Browse the repository at this point in the history
Гуй
  • Loading branch information
dmpas authored Mar 23, 2018
2 parents 8520f08 + 8a3079d commit 86e8739
Show file tree
Hide file tree
Showing 88 changed files with 5,953 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ before_install:
- sudo apt-get -qq update
install: sudo apt-get install -y cmake zlib1g-dev libboost-filesystem-dev libboost-system-dev libboost-regex-dev
script:
- cmake . && cmake --build .
- cmake -DNOGUI=YES . && cmake --build . --target testproject
- bin/testproject
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project(tool1cd_project)

set(SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)

option(NOGUI "disable building GUI project")

set(BINARY_DIR "${CMAKE_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BINARY_DIR}/lib")
Expand All @@ -12,6 +14,11 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BINARY_DIR}/lib")
# Это нужно, чтобы под Windows Tool1CD не требовал vcredist
if (MSVC)

add_definitions (-DBOOST_ALL_NO_LIB)
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED OFF)
set (Boost_USE_STATIC_RUNTIME ON)

foreach (flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
Expand Down Expand Up @@ -42,3 +49,8 @@ add_subdirectory(${SOURCE_DIR}/SystemClasses)
add_subdirectory(${SOURCE_DIR}/tool1cd)
add_subdirectory(${SOURCE_DIR}/ctool1cd)
add_subdirectory(${SOURCE_DIR}/tests)

if(NOT NOGUI)
add_subdirectory(${SOURCE_DIR}/gtool1cd)
endif()

58 changes: 38 additions & 20 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,62 @@ version: 1.0.0.{build}
pull_requests:
do_not_increment_build_number: true
clone_depth: 1
environment:
MY_BOOST_ROOT: C:\projects\boost
MY_BOOST_INCLUDEDIR: C:\projects\boost
MY_BOOST_LIBRARYDIR: C:\projects\boost\stage\lib
matrix:
- ID: minw32-x86-boost1.63
GENERATOR: MinGW Makefiles
BOOST_VERSION: 1_63_0
BOOST_DOT_VERSION: 1.63.0
MINGW_ROOT: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32
ADD_PATH: C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin
BOOST_TOOLSET: gcc
ALLOW_FAILURE: no
MY_Qt5Widgets_DIR: C:\Qt\5.10.1\mingw53_32\lib\cmake\Qt5Widgets

init:
- ps: Set-WinSystemLocale ru-RU
- ps: Start-Sleep -s 5
- ps: Restart-Computer
environment:
VCDIR: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\
BOOST_ROOT: c:\Libraries\boost_1_63_0
BOOST_LIBRARYDIR: C:\Libraries\boost_1_63_0\lib32-msvc-14.0
BOOST_INCLUDEDIR: C:\Libraries\boost_1_63_0
install:
- cmd: >-
appveyor DownloadFile https://github.com/madler/zlib/archive/v1.2.8.zip -FileName zlib-1.2.8.zip
echo %PATH%
7z x zlib-1.2.8.zip > NUL
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%;%ADD_PATH%
cd zlib-1.2.8
cd ..
md build
curl -o boost.7z -L
https://sourceforge.net/projects/boost/files/boost/%BOOST_DOT_VERSION%/boost_%BOOST_VERSION%.7z/download
cd build
7z x boost.7z
cmake -DCMAKE_SHARED_LINKER_FLAGS="/NODEFAULTLIB:MSVCRT" -DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /D NDEBUG" ..
rename boost_%BOOST_VERSION% boost
cmake --build . --config Release --target zlibstatic
- cmd: >-
cd boost
copy zconf.h ..
.\bootstrap.bat
cd ..
.\b2.exe toolset=%BOOST_TOOLSET% --with-system --with-filesystem --with-regex --with-program_options
cd %APPVEYOR_BUILD_FOLDER%
cd ..
build_script:
- cmd: >-
"%VCDIR%"\vcvarsall.bat
cmake -G "Visual Studio 14" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8\build\Release\zlibstatic.lib -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8 .
cmake -G "%GENERATOR%" -DBOOST_ROOT="%MY_BOOST_ROOT%"
-DBOOST_LIBRARYDIR="%MY_BOOST_LIBRARYDIR%"
-DBOOST_INCLUDEDIR="%MY_BOOST_INCLUDEDIR%"
-DQt5Widgets_DIR="%MY_Qt5Widgets_DIR%"
-DZLIB_INCLUDE_DIR="%MINGW_ROOT%\\i686-w64-mingw32\include"
-DZLIB_LIBRARY="%MINGW_ROOT%\i686-w64-mingw32\lib\libz.a" .
cmake --build . --config Release
test_script:
- bin\Release\testproject.exe --reporter junit --out junit.xml
- bin\testproject.exe --reporter junit --out junit.xml

on_finish:
- ps: >-
Expand All @@ -58,8 +74,10 @@ after_build:
light -out tool1cd-%APPVEYOR_BUILD_VERSION%.msi tool1cd.wixobj
artifacts:
- path: bin\Release\ctool1cd.exe
- path: bin\ctool1cd.exe
name: ctool1cd.exe
- path: bin\gtool1cd.exe
name: gtool1cd.exe
- path: tool1cd-*.msi
name: installer
deploy: off
5 changes: 0 additions & 5 deletions src/SystemClasses/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ set (SYSTEM_HEADERS String.hpp System.Classes.hpp System.hpp

add_library (SystemClasses STATIC ${SYSTEM_SOURCES} ${SYSTEM_HEADERS})

add_definitions (-DBOOST_ALL_NO_LIB)
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED OFF)
set (Boost_USE_STATIC_RUNTIME ON)

find_package (Boost 1.53 REQUIRED COMPONENTS filesystem regex system)

include_directories (${Boost_INCLUDE_DIRS})
Expand Down
5 changes: 0 additions & 5 deletions src/ctool1cd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ target_link_libraries (ctool1cd SystemClasses)
include_directories (${SOURCE_DIR}/tool1cd)
target_link_libraries (ctool1cd tool1cd)

add_definitions (-DBOOST_ALL_NO_LIB)
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED OFF)
set (Boost_USE_STATIC_RUNTIME ON)

find_package (Boost 1.53 REQUIRED COMPONENTS filesystem regex system)
include_directories (${Boost_INCLUDE_DIRS})
target_link_libraries (ctool1cd ${Boost_LIBRARIES})
Expand Down
11 changes: 0 additions & 11 deletions src/ctool1cd/ctool1cd.workspace

This file was deleted.

77 changes: 77 additions & 0 deletions src/gtool1cd/CMakeLists.txt
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)
20 changes: 20 additions & 0 deletions src/gtool1cd/QHexEdit/LICENSE
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.
31 changes: 31 additions & 0 deletions src/gtool1cd/QHexEdit/QHexEdit.pri
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
58 changes: 58 additions & 0 deletions src/gtool1cd/QHexEdit/README.md
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
6 changes: 6 additions & 0 deletions src/gtool1cd/QHexEdit/document/commands/hexcommand.cpp
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)
{

}
18 changes: 18 additions & 0 deletions src/gtool1cd/QHexEdit/document/commands/hexcommand.h
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
Loading

0 comments on commit 86e8739

Please sign in to comment.