Skip to content

Commit

Permalink
Merge pull request #209 from carstene1ns/feature/translation
Browse files Browse the repository at this point in the history
Add/Fix translation ability
  • Loading branch information
Ghabry authored Jun 25, 2022
2 parents 4d12c4d + 342bbc7 commit 3183712
Show file tree
Hide file tree
Showing 40 changed files with 9,543 additions and 814 deletions.
148 changes: 75 additions & 73 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cmake_minimum_required(VERSION 3.9)
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW) # Support MSVC_RUNTIME_LIBRARY
endif()
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW) # Support MSVC_RUNTIME_LIBRARY

project(EasyRPG_Editor VERSION 0.1.0 LANGUAGES CXX)

Expand Down Expand Up @@ -289,9 +287,6 @@ set(EDITOR_SOURCES
src/ui/other/search_dialog.cpp
src/ui/other/search_dialog.h
src/ui/other/search_dialog.ui
src/ui/other/splash_dialog.cpp
src/ui/other/splash_dialog.h
src/ui/other/splash_dialog.ui
src/ui/other/volumebutton.cpp
src/ui/other/volumebutton.h
src/ui/picker/picker_audio_widget.cpp
Expand Down Expand Up @@ -321,11 +316,45 @@ set(EDITOR_SOURCES
src/ui/viewer/stat_curve_graphics_item.cpp
src/ui/viewer/stat_curve_graphics_item.h
)
add_library(${PROJECT_NAME} STATIC ${EDITOR_SOURCES})

if(APPLE)
# Do not code sign
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.easyrpg.editor")

# App Icon
set(EDITOR_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/app/Editor.icns")
set_source_files_properties(${EDITOR_BUNDLE_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")

set(EXE_NAME "EasyRPG-Editor.app")
set(EXE_OUTPUT_NAME "EasyRPG Editor")
add_executable(${EXE_NAME} MACOSX_BUNDLE "src/main.cpp" ${EDITOR_SOURCES} ${EDITOR_BUNDLE_ICON})
set_target_properties(${EXE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resources/app/Info.plist.in")
set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME ${EXE_OUTPUT_NAME})
else()
# Executable
set(EXE_NAME ${PROJECT_NAME})
add_executable(${EXE_NAME} WIN32 "src/main.cpp" ${EDITOR_SOURCES})
if(WIN32)
# Open console for Debug builds
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set_target_properties(${EXE_NAME} PROPERTIES WIN32_EXECUTABLE FALSE)
endif()
set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME "Editor")
# Add icon
target_sources(${EXE_NAME} PRIVATE "resources/Resources.rc")
else()
set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME "easyrpg-editor")
endif()
endif()

# Include directories
target_include_directories(${PROJECT_NAME} PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/src"
target_include_directories(${EXE_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
INTERFACE
$<BUILD_INTERFACE:${AUTOGEN_INCLUDE_DIR}>
)

# IDE source grouping
Expand All @@ -340,31 +369,17 @@ else()
set(AUTOGEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}_autogen/include)
endif()

target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${AUTOGEN_INCLUDE_DIR}>
)

# Qt Magic
set_target_properties(${PROJECT_NAME} PROPERTIES
set_target_properties(${EXE_NAME} PROPERTIES
AUTOMOC ON
AUTOUIC ON
AUTORCC ON # Enable resource compiler for exe
)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# App Icon (for macOS)
set(${PROJECT_NAME}_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/app/Editor.icns")

# Do not code sign on Macs
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.easyrpg.editor")

# Dependencies
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Multimedia REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets Core Multimedia Gui Svg)
find_package(Qt5LinguistTools CONFIG QUIET)
find_package(ZLIB REQUIRED)
# liblcf
option(EDITOR_BUILD_LIBLCF "Instead of detecting liblcf the liblcf repository is cloned into lib/liblcf and built together with the Player. This is convenient for development" OFF)
Expand All @@ -390,69 +405,56 @@ if(EDITOR_BUILD_LIBLCF)
add_subdirectory(${LIBLCF_PATH})
endfunction()
add_liblcf()
target_link_libraries(${PROJECT_NAME} lcf)
target_link_libraries(${EXE_NAME} lcf)
else()
# Use system package
find_package(liblcf REQUIRED)
target_link_libraries(${PROJECT_NAME} liblcf::liblcf)
endif()

# Find Qt deployment apps
if(APPLE)
get_target_property(_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_QT_BIN_DIR "${_QMAKE_EXECUTABLE}" DIRECTORY)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_QT_BIN_DIR}")
target_link_libraries(${EXE_NAME} liblcf::liblcf)
endif()

# Libraries
target_link_libraries(${PROJECT_NAME}
target_link_libraries(${EXE_NAME}
ZLIB::ZLIB
Qt5::Widgets Qt5::Gui Qt5::Core Qt5::Multimedia Qt5::Svg
Qt5::Widgets
Qt5::Gui
Qt5::Core
Qt5::Multimedia
Qt5::Svg
Qt5::QSvgIconPlugin
)

# Executable
# Windows: Only open console for Debug builds
if(APPLE)
set(EXE_NAME "EasyRPG-Editor.app")
set_source_files_properties(${${PROJECT_NAME}_BUNDLE_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable("${EXE_NAME}" MACOSX_BUNDLE "src/main.cpp" ${${PROJECT_NAME}_BUNDLE_ICON})
else()
set(EXE_NAME "${PROJECT_NAME}_exe")
if(CMAKE_BUILD_TYPE MATCHES "Debug")
add_executable(${PROJECT_NAME}_exe "src/main.cpp")
else()
add_executable(${PROJECT_NAME}_exe WIN32 "src/main.cpp")
endif()
endif()

if(WIN32)
set_target_properties(${PROJECT_NAME}_exe PROPERTIES OUTPUT_NAME "Editor")
elseif(APPLE)
set(EXE_OUTPUT_NAME "EasyRPG Editor")
set_target_properties("${EXE_NAME}" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resources/app/Info.plist.in")
set_target_properties("${EXE_NAME}" PROPERTIES OUTPUT_NAME ${EXE_OUTPUT_NAME})
else()
set_target_properties(${PROJECT_NAME}_exe PROPERTIES OUTPUT_NAME "easyrpg-editor")
endif()

target_link_libraries(${EXE_NAME} ${PROJECT_NAME})

# Qt Magic (Enable resource compiler for exe)
set_target_properties(${EXE_NAME} PROPERTIES
AUTORCC ON
)

# Add resources
target_sources(${EXE_NAME} PRIVATE "resources/Resources.qrc")

if(WIN32)
target_sources(${EXE_NAME} PRIVATE "resources/Resources.rc")
# Translations
if(TARGET Qt5::lrelease)
set(TRANSLATION_SOURCES
translations/editor_de.ts
)
set(TRANSLATION_RES ${CMAKE_CURRENT_BINARY_DIR}/translations/editor.qrc)
configure_file(translations/editor.qrc ${TRANSLATION_RES} COPYONLY)
set_source_files_properties(${TRANSLATION_SOURCES} PROPERTIES
OUTPUT_LOCATION "translations")
qt5_add_translation(EDITOR_TRANSLATIONS ${TRANSLATION_SOURCES}
OPTIONS -compress -nounfinished -removeidentical)
target_sources(${EXE_NAME} PRIVATE ${TRANSLATION_RES} ${EDITOR_TRANSLATIONS})
add_custom_target(translations
COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src -ts ${TRANSLATION_SOURCES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Create/Update translations..."
COMMAND_EXPAND_LISTS VERBATIM)
else()
message(STATUS "Disabling translation support")
endif()

# Installation
include(GNUInstallDirs)
if(APPLE)
# Find Qt deployment apps
get_target_property(_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_QT_BIN_DIR "${_QMAKE_EXECUTABLE}" DIRECTORY)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_QT_BIN_DIR}")

set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
install(TARGETS ${EXE_NAME} RUNTIME DESTINATION BUNDLE DESTINATION "${CMAKE_BINARY_DIR}/Package")
# Run macdeployqt
Expand Down
26 changes: 12 additions & 14 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble
Preamble

The GNU General Public License is a free, copyleft license for
software and other kinds of works.
Expand Down Expand Up @@ -69,15 +68,15 @@ patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.

TERMS AND CONDITIONS
TERMS AND CONDITIONS

0. Definitions.

"This License" refers to version 3 of the GNU General Public License.

"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
Expand Down Expand Up @@ -510,7 +509,7 @@ actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
Expand Down Expand Up @@ -619,9 +618,9 @@ an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
Expand All @@ -646,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -665,12 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

<https://www.gnu.org/licenses/why-not-lgpl.html>.
96 changes: 96 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
= EasyRPG Editor
// hide ugly links behind atributes to not interrupt plain text flow
:docs: link:docs[docs folder]
:liblcf: https://github.com/EasyRPG/liblcf[liblcf]
:qt5: https://www.qt.io[Qt 5]
:translation: link:docs/Translation.adoc[Translation]
:irc-channel: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat/#easyrpg?nick=rpgguest??
:authors-doc: link:docs/AUTHORS.adoc[AUTHORS document]
:copying-icons: link:docs/licenses/COPYING-ICONS[COPYING-ICONS]
// end of header

EasyRPG Editor is a game editor to create EasyRPG games. It can import
RPG Maker 2000 and 2003 games using liblcf to read RPG Maker game data.

EasyRPG Editor is part of the EasyRPG Project. More information is
available at the project website: https://easyrpg.org/


== Documentation

Documentation is available in the {docs} and at the documentation wiki:
https://wiki.easyrpg.org


== Requirements

- {liblcf} for RPG Maker data reading.
- {qt5} (>= 5.11)
- Qt Multimedia
- Qt SVG
- Qt Linguist (optional, for translation)

== Daily builds

Up to date binaries for assorted platforms are available at our continuous
integration service:

https://ci.easyrpg.org/view/Editor/


== Source code

EasyRPG Editor development is hosted by GitHub, project files are available
in this git repository:

https://github.com/EasyRPG/Editor

Released versions are also available at our Download Archive:

https://easyrpg.org/downloads/editor/


== Building

Building requirements:

- CMake >= 3.15

Step-by-step instructions:

[source,shell]
---------------------------------------
cmake . # generate Makefile
cmake --build # compile the executable
---------------------------------------


== Running EasyRPG Editor

Put the generated executable in the "bin" folder and launch it.


== Translating EasyRPG Editor

See {translation} document.


== Bug reporting

Available options:

* File an issue at https://github.com/EasyRPG/Editor/issues
* Open a thread at https://community.easyrpg.org/
* Chat with us via IRC: {irc-channel}[#easyrpg at irc.libera.chat]


== License

EasyRPG Editor is free software available under the GPLv3 license. See the file
link:COPYING[] for license conditions. For Author information see {authors-doc}.

=== 3rd party resources

The files in link:resources/icons[] are Breeze icons or derivates licensed under
LGPLv3. See the file {copying-icons} for license
conditions.
Loading

0 comments on commit 3183712

Please sign in to comment.