Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Howaner committed Feb 10, 2018
0 parents commit a5a6226
Show file tree
Hide file tree
Showing 81 changed files with 3,641 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
nbproject/
CMakeFiles/
Releases/
build/
src/Version.h
cmake_install.cmake
CMakeCache.txt
compile_commands.json
Makefile
moc_*.cpp
nbteditor_automoc.cpp
ui_*.h
nbteditor
nbteditor.exe
.dep.inc
39 changes: 39 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.1.0)

project(nbteditor VERSION 1.0)
set (NBTEDITOR_VERSION 1.0)

find_package(Qt5Widgets)

find_package( ZLIB REQUIRED )
if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
endif(ZLIB_FOUND)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -finput-charset=UTF-8 -fexec-charset=UTF-8 -Wall")

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/Version.h")

set(nbteditor_res "${CMAKE_CURRENT_SOURCE_DIR}/resources/resources.qrc")
# For Windows release build: set(nbteditor_res "${CMAKE_CURRENT_SOURCE_DIR}/resources/resources.qrc" "${CMAKE_CURRENT_SOURCE_DIR}/resources/nbteditor.rc" "${CMAKE_CURRENT_SOURCE_DIR}/resources/qt_de.qm")
file(GLOB_RECURSE nbteditor_src "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/UI/*.ui")

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/window")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/resources")
include_directories( ${CMAKE_BINARY_DIR} )

## set_target_properties(Qt5::Core PROPERTIES MAP_IMPORTED_CONFIG_COVERAGE "RELEASE")

# Tell CMake to create the nbteditor executable
add_executable(nbteditor ${MOC_HEADERS} ${nbteditor_src} ${nbteditor_res})
# For Windows release build: add_executable(nbteditor WIN32 ${MOC_HEADERS} ${nbteditor_src} ${nbteditor_res})

# Use the Widgets module from Qt 5.
target_link_libraries(nbteditor Qt5::Widgets ${ZLIB_LIBRARIES})
Binary file added Image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# NBTEditor (1.0)
A nbt editor software to edit minecraft binary files. Currently it can be used to edit .dat and .schematic files.
![NBTEditor](Image.png)

## Download
- Windows Portable: http://dl.howaner.de/NBTEditor/1.0/NBTEditor.zip
- Windows Installer: http://dl.howaner.de/NBTEditor/1.0/NBTEditor.msi
- Ubuntu 16.04 Deb: http://dl.howaner.de/NBTEditor/1.0/nbteditor_1.0-1_amd64.deb


## Used frameworks
The software is written in C++ with the Qt5 framework and Zlib.

## How to compile it on linux
```
apt-get install build-essential qt5-default qttools5-dev-tools cmake zlib1g-dev
mkdir build
cmake ..
make
./nbteditor
```

## How to compile it on windows
1. Install qt5 developer framework with mingw-32 compiler
2. Install cmake
3. Compile static zlib library
4. Follow linux introductions
2 changes: 2 additions & 0 deletions nbteditor.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SOURCES = src/UI/TreeContextMenu.cpp src/UI/AddElementDialog.ui src/UI/EditArrayDialog.ui src/UI/MainForm.ui src/UI/AboutDialog.ui src/UI/MainForm.cpp
TRANSLATIONS = resources/qt_de.ts
Binary file added resources/application.ico
Binary file not shown.
Binary file added resources/icon-add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icon-delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icon-edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icon-insertbelow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lang_de.qm
Binary file not shown.
202 changes: 202 additions & 0 deletions resources/lang_de.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<context>
<name>AboutDialog</name>
<message>
<location filename="../src/UI/AboutDialog.ui" line="32"/>
<source>About</source>
<translation>Info</translation>
</message>
<message>
<location filename="../src/UI/AboutDialog.ui" line="75"/>
<source>NBT Editor v%1</source>
<translation>NBT Editor v%1</translation>
</message>
<message>
<location filename="../src/UI/AboutDialog.ui" line="91"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2018 Franz Reiter&lt;br/&gt;Used Frameworks: Qt5, Zlib&lt;/p&gt;&lt;p&gt;License: GNU General Public License 3&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2018 Franz Reiter&lt;br/&gt;Benutzte Frameworks: Qt5, Zlib&lt;/p&gt;&lt;p&gt;Lizenz: GNU General Public License 3&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<location filename="../src/UI/AboutDialog.ui" line="101"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://nbt-editor.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;Open Internet Site&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://nbt-editor.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;Internet Seite öffnen&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
</context>
<context>
<name>AddElementDialog</name>
<message>
<location filename="../src/UI/AddElementDialog.ui" line="23"/>
<source>Add element</source>
<translation>Element hinzufügen</translation>
</message>
<message>
<location filename="../src/UI/AddElementDialog.ui" line="35"/>
<source>Name:</source>
<translation>Name:</translation>
</message>
<message>
<location filename="../src/UI/AddElementDialog.ui" line="45"/>
<source>Type:</source>
<translation>Typ:</translation>
</message>
</context>
<context>
<name>EditArrayDialog</name>
<message>
<location filename="../src/UI/EditArrayDialog.ui" line="14"/>
<source>Edit array</source>
<translation>Array bearbeiten</translation>
</message>
</context>
<context>
<name>MainForm</name>
<message>
<location filename="../src/UI/MainForm.ui" line="95"/>
<source>&amp;File</source>
<translation>&amp;Datei</translation>
</message>
<message>
<location filename="../src/UI/MainForm.ui" line="105"/>
<source>&amp;Help</source>
<translation>&amp;Hilfe</translation>
</message>
<message>
<location filename="../src/UI/MainForm.ui" line="115"/>
<source>toolBar</source>
<translation>Toolbar</translation>
</message>
<message>
<location filename="../src/UI/MainForm.ui" line="136"/>
<source>&amp;Open</source>
<translation>&amp;Öffnen</translation>
</message>
<message>
<location filename="../src/UI/MainForm.ui" line="148"/>
<source>&amp;Save</source>
<translation>&amp;Speichern</translation>
</message>
<message>
<location filename="../src/UI/MainForm.ui" line="160"/>
<source>Save as ...</source>
<translation>Speichern unter ...</translation>
</message>
<message>
<location filename="../src/UI/MainForm.ui" line="169"/>
<source>&amp;New</source>
<translation>&amp;Neu</translation>
</message>
<message>
<location filename="../src/UI/MainForm.ui" line="178"/>
<source>&amp;About</source>
<translation>&amp;Info</translation>
</message>
</context>
<context>
<name>UI::MainForm</name>
<message>
<location filename="../src/UI/MainForm.cpp" line="74"/>
<source>Can&apos;t load file</source>
<translation>Fehler beim Laden</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="74"/>
<source>The NBT file could not be loaded:
%1</source>
<translation>Die NBT Datei konnte nicht geladen werden:
%1</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="89"/>
<source>Can&apos;t save file</source>
<translation>Fehler beim Speichern</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="89"/>
<source>The NBT data could not be saved:
%1</source>
<translation>The NBT data could not be saved:
%1</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="107"/>
<location filename="../src/UI/MainForm.cpp" line="119"/>
<location filename="../src/UI/MainForm.cpp" line="150"/>
<source>Are you sure?</source>
<translation>Bist du sicher?</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="107"/>
<location filename="../src/UI/MainForm.cpp" line="150"/>
<source>Do you really want to load a new file? All previous changes will be lost.</source>
<translation>Willst du wirklich eine neue Datei laden? Alle bisherigen Änderungen gehen verloren.</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="119"/>
<source>Do you really want to create a new NBT document? All previous changes will be lost.</source>
<translation>Willst du wirklich ein neues NBT Dokument erstellen? Alle bisherigen Änderungen gehen verloren.</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="155"/>
<source>Open file</source>
<translation>Datei öffnen</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="155"/>
<location filename="../src/UI/MainForm.cpp" line="180"/>
<source>NBT File (*.dat);;All Files (*)</source>
<translation>NBT Datei (*.dat);;Alle Dateien (*)</translation>
</message>
<message>
<location filename="../src/UI/MainForm.cpp" line="180"/>
<source>Save file</source>
<translation>Datei speichern</translation>
</message>
</context>
<context>
<name>UI::TreeContextMenu</name>
<message>
<location filename="../src/UI/TreeContextMenu.cpp" line="67"/>
<source>Add to element</source>
<translation>In Element einfügen</translation>
</message>
<message>
<location filename="../src/UI/TreeContextMenu.cpp" line="70"/>
<source>Insert below</source>
<translation>Darunter hinzufügen</translation>
</message>
<message>
<location filename="../src/UI/TreeContextMenu.cpp" line="73"/>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
<location filename="../src/UI/TreeContextMenu.cpp" line="76"/>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
<message>
<location filename="../src/UI/TreeContextMenu.cpp" line="154"/>
<source>Element already exists</source>
<translation>Element bereits vorhanden</translation>
</message>
<message>
<location filename="../src/UI/TreeContextMenu.cpp" line="154"/>
<source>A element with the name %1 is already existing</source>
<translation>Es gibt bereits ein Element mit dem Namen %1</translation>
</message>
<message>
<location filename="../src/UI/TreeContextMenu.cpp" line="201"/>
<location filename="../src/UI/TreeContextMenu.cpp" line="213"/>
<source>Invalid data</source>
<translation>Fehlerhafte Daten</translation>
</message>
<message>
<location filename="../src/UI/TreeContextMenu.cpp" line="201"/>
<location filename="../src/UI/TreeContextMenu.cpp" line="213"/>
<source>The input data is invalid.</source>
<translation>Die Eingabedaten sind ungültig.</translation>
</message>
</context>
</TS>
Binary file added resources/logo-template.old.xcf
Binary file not shown.
Binary file added resources/logo-template.xcf
Binary file not shown.
Binary file added resources/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-array.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-byte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-compound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-double.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-float.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-int.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-long.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-short.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-string.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/nbt-template.xcf
Binary file not shown.
1 change: 1 addition & 0 deletions resources/nbteditor.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IDR_MAINFRAME ICON "resources/application.ico"
33 changes: 33 additions & 0 deletions resources/resources.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<RCC>
<qresource prefix="general">
<file>logo.png</file>
</qresource>
<qresource prefix="languages">
<file>lang_de.qm</file>
</qresource>
<qresource prefix="icons">
<file>icon-edit.png</file>
<file>icon-delete.png</file>
<file>icon-add.png</file>
<file>icon-insertbelow.png</file>
</qresource>
<qresource prefix="treeview_icons">
<file>stylesheet-vline.png</file>
<file>stylesheet-branch-closed.png</file>
<file>stylesheet-branch-end.png</file>
<file>stylesheet-branch-more.png</file>
<file>stylesheet-branch-open.png</file>
</qresource>
<qresource prefix="nbt_icons">
<file>nbt-double.png</file>
<file>nbt-float.png</file>
<file>nbt-byte.png</file>
<file>nbt-array.png</file>
<file>nbt-compound.png</file>
<file>nbt-int.png</file>
<file>nbt-list.png</file>
<file>nbt-long.png</file>
<file>nbt-short.png</file>
<file>nbt-string.png</file>
</qresource>
</RCC>
Binary file added resources/stylesheet-branch-closed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/stylesheet-branch-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/stylesheet-branch-more.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/stylesheet-branch-open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/stylesheet-vline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions src/Exception/Exception.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once
#include <string>

namespace Exception {

class Exception : public std::exception {

public:
explicit Exception(const char* message): msg(message)
{
}

explicit Exception(const std::string& message): msg(message)
{
}

virtual ~Exception() throw () {};

const std::string& GetMessage() const { return msg; }

virtual const char* what() const throw() {
return msg.c_str();
}

protected:
std::string msg;
};

}
15 changes: 15 additions & 0 deletions src/Exception/FileException.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include "Exception.h"

namespace Exception {
class FileException : public Exception {
public:
FileException(const char* error, const char* filePath, int ioErrorCode)
: Exception("Exception while reading file " + std::string(filePath) + ": " + std::string(error) + ", code " + std::to_string(ioErrorCode))
{
}

private:

};
}
15 changes: 15 additions & 0 deletions src/Exception/GzipException.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include "Exception.h"

namespace Exception {
class GzipException : public Exception {
public:
explicit GzipException(const char* message): Exception(message)
{
}

explicit GzipException(const std::string& message): Exception(message)
{
}
};
}
Loading

0 comments on commit a5a6226

Please sign in to comment.