Merge branch 'develop' into feature/print-with-qpainter
This commit is contained in:
commit
f895ec0c1c
@ -2,8 +2,14 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
include(cmake/conan.cmake)
|
||||||
|
conan_cmake_run(CONANFILE conanfile.txt
|
||||||
|
BASIC_SETUP
|
||||||
|
BUILD missing
|
||||||
|
)
|
||||||
|
|
||||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||||
conan_basic_setup()
|
conan_basic_setup()
|
||||||
|
|
||||||
add_subdirectory(source)
|
add_subdirectory(source)
|
||||||
add_subdirectory(test)
|
#add_subdirectory(test)
|
||||||
|
516
cmake/conan.cmake
Normal file
516
cmake/conan.cmake
Normal file
@ -0,0 +1,516 @@
|
|||||||
|
# The MIT License (MIT)
|
||||||
|
|
||||||
|
# Copyright (c) 2018 JFrog
|
||||||
|
|
||||||
|
# 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 comes from: https://github.com/conan-io/cmake-conan. Please refer
|
||||||
|
# to this repository for issues and documentation.
|
||||||
|
|
||||||
|
# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called.
|
||||||
|
# It will take CMake current settings (os, compiler, compiler version, architecture)
|
||||||
|
# and translate them to conan settings for installing and retrieving dependencies.
|
||||||
|
|
||||||
|
# It is intended to facilitate developers building projects that have conan dependencies,
|
||||||
|
# but it is only necessary on the end-user side. It is not necessary to create conan
|
||||||
|
# packages, in fact it shouldn't be use for that. Check the project documentation.
|
||||||
|
|
||||||
|
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
function(_get_msvc_ide_version result)
|
||||||
|
set(${result} "" PARENT_SCOPE)
|
||||||
|
if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
|
||||||
|
set(${result} 8 PARENT_SCOPE)
|
||||||
|
elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
|
||||||
|
set(${result} 9 PARENT_SCOPE)
|
||||||
|
elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
|
||||||
|
set(${result} 10 PARENT_SCOPE)
|
||||||
|
elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
|
||||||
|
set(${result} 11 PARENT_SCOPE)
|
||||||
|
elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
|
||||||
|
set(${result} 12 PARENT_SCOPE)
|
||||||
|
elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910)
|
||||||
|
set(${result} 14 PARENT_SCOPE)
|
||||||
|
elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920)
|
||||||
|
set(${result} 15 PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(conan_cmake_settings result)
|
||||||
|
#message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER})
|
||||||
|
#message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID})
|
||||||
|
#message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION})
|
||||||
|
#message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS})
|
||||||
|
#message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE})
|
||||||
|
#message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE})
|
||||||
|
#message(STATUS "GENERATOR " ${CMAKE_GENERATOR})
|
||||||
|
#message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64})
|
||||||
|
|
||||||
|
message(STATUS "Conan: Automatic detection of conan settings from cmake")
|
||||||
|
|
||||||
|
parse_arguments(${ARGV})
|
||||||
|
|
||||||
|
if(ARGUMENTS_BUILD_TYPE)
|
||||||
|
set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE})
|
||||||
|
elseif(CMAKE_BUILD_TYPE)
|
||||||
|
set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
|
||||||
|
endif()
|
||||||
|
if(ARGUMENTS_ARCH)
|
||||||
|
set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH})
|
||||||
|
endif()
|
||||||
|
#handle -s os setting
|
||||||
|
if(CMAKE_SYSTEM_NAME)
|
||||||
|
#use default conan os setting if CMAKE_SYSTEM_NAME is not defined
|
||||||
|
set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
|
||||||
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
|
set(CONAN_SYSTEM_NAME Macos)
|
||||||
|
endif()
|
||||||
|
set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore)
|
||||||
|
list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index)
|
||||||
|
if (${_index} GREATER -1)
|
||||||
|
#check if the cmake system is a conan supported one
|
||||||
|
set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||||
|
if (";${_languages};" MATCHES ";CXX;")
|
||||||
|
set(LANGUAGE CXX)
|
||||||
|
set(USING_CXX 1)
|
||||||
|
elseif (";${_languages};" MATCHES ";C;")
|
||||||
|
set(LANGUAGE C)
|
||||||
|
set(USING_CXX 0)
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU)
|
||||||
|
# using GCC
|
||||||
|
# TODO: Handle other params
|
||||||
|
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
|
||||||
|
list(GET VERSION_LIST 0 MAJOR)
|
||||||
|
list(GET VERSION_LIST 1 MINOR)
|
||||||
|
set(COMPILER_VERSION ${MAJOR}.${MINOR})
|
||||||
|
if(${MAJOR} GREATER 4)
|
||||||
|
set(COMPILER_VERSION ${MAJOR})
|
||||||
|
endif()
|
||||||
|
set(_CONAN_SETTING_COMPILER gcc)
|
||||||
|
set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
|
||||||
|
if (USING_CXX)
|
||||||
|
conan_cmake_detect_gnu_libcxx(_LIBCXX)
|
||||||
|
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
|
||||||
|
endif ()
|
||||||
|
elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang)
|
||||||
|
# using AppleClang
|
||||||
|
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
|
||||||
|
list(GET VERSION_LIST 0 MAJOR)
|
||||||
|
list(GET VERSION_LIST 1 MINOR)
|
||||||
|
set(_CONAN_SETTING_COMPILER apple-clang)
|
||||||
|
set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
|
||||||
|
if (USING_CXX)
|
||||||
|
set(_CONAN_SETTING_COMPILER_LIBCXX libc++)
|
||||||
|
endif ()
|
||||||
|
elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang)
|
||||||
|
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
|
||||||
|
list(GET VERSION_LIST 0 MAJOR)
|
||||||
|
list(GET VERSION_LIST 1 MINOR)
|
||||||
|
if(APPLE)
|
||||||
|
cmake_policy(GET CMP0025 APPLE_CLANG_POLICY_ENABLED)
|
||||||
|
if(NOT APPLE_CLANG_POLICY_ENABLED)
|
||||||
|
message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it")
|
||||||
|
set(_CONAN_SETTING_COMPILER apple-clang)
|
||||||
|
set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
|
||||||
|
else()
|
||||||
|
set(_CONAN_SETTING_COMPILER clang)
|
||||||
|
set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
|
||||||
|
endif()
|
||||||
|
if (USING_CXX)
|
||||||
|
set(_CONAN_SETTING_COMPILER_LIBCXX libc++)
|
||||||
|
endif ()
|
||||||
|
else()
|
||||||
|
set(_CONAN_SETTING_COMPILER clang)
|
||||||
|
if(${MAJOR} GREATER 7)
|
||||||
|
set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR})
|
||||||
|
else()
|
||||||
|
set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
|
||||||
|
endif()
|
||||||
|
if (USING_CXX)
|
||||||
|
conan_cmake_detect_gnu_libcxx(_LIBCXX)
|
||||||
|
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC)
|
||||||
|
set(_VISUAL "Visual Studio")
|
||||||
|
_get_msvc_ide_version(_VISUAL_VERSION)
|
||||||
|
if("${_VISUAL_VERSION}" STREQUAL "")
|
||||||
|
message(FATAL_ERROR "Conan: Visual Studio not recognized")
|
||||||
|
else()
|
||||||
|
set(_CONAN_SETTING_COMPILER ${_VISUAL})
|
||||||
|
set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _CONAN_SETTING_ARCH)
|
||||||
|
if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64")
|
||||||
|
set(_CONAN_SETTING_ARCH x86_64)
|
||||||
|
elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM")
|
||||||
|
message(STATUS "Conan: Using default ARM architecture from MSVC")
|
||||||
|
set(_CONAN_SETTING_ARCH armv6)
|
||||||
|
elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86")
|
||||||
|
set(_CONAN_SETTING_ARCH x86)
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
conan_cmake_detect_vs_runtime(_vs_runtime)
|
||||||
|
message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}")
|
||||||
|
set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime})
|
||||||
|
|
||||||
|
if (CMAKE_GENERATOR_TOOLSET)
|
||||||
|
set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET})
|
||||||
|
elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja"))
|
||||||
|
set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Conan: compiler setup not recognized")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# If profile is defined it is used
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE)
|
||||||
|
set(_SETTINGS -pr ${ARGUMENTS_DEBUG_PROFILE})
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE)
|
||||||
|
set(_SETTINGS -pr ${ARGUMENTS_RELEASE_PROFILE})
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE)
|
||||||
|
set(_SETTINGS -pr ${ARGUMENTS_RELWITHDEBINFO_PROFILE})
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE)
|
||||||
|
set(_SETTINGS -pr ${ARGUMENTS_MINSIZEREL_PROFILE})
|
||||||
|
elseif(ARGUMENTS_PROFILE)
|
||||||
|
set(_SETTINGS -pr ${ARGUMENTS_PROFILE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL")
|
||||||
|
set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version
|
||||||
|
compiler.runtime compiler.libcxx compiler.toolset)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Automatic from CMake
|
||||||
|
foreach(ARG ${ARGUMENTS_PROFILE_AUTO})
|
||||||
|
string(TOUPPER ${ARG} _arg_name)
|
||||||
|
string(REPLACE "." "_" _arg_name ${_arg_name})
|
||||||
|
if(_CONAN_SETTING_${_arg_name})
|
||||||
|
set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(ARG ${ARGUMENTS_SETTINGS})
|
||||||
|
set(_SETTINGS ${_SETTINGS} -s ${ARG})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
message(STATUS "Conan: Settings= ${_SETTINGS}")
|
||||||
|
|
||||||
|
set(${result} ${_SETTINGS} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
function(conan_cmake_detect_gnu_libcxx result)
|
||||||
|
# Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake
|
||||||
|
if(DEFINED _GLIBCXX_USE_CXX11_ABI)
|
||||||
|
if(_GLIBCXX_USE_CXX11_ABI)
|
||||||
|
set(${result} libstdc++11 PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
else()
|
||||||
|
set(${result} libstdc++ PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check if there's any add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
|
||||||
|
get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
|
||||||
|
foreach(define ${defines})
|
||||||
|
if(define STREQUAL "_GLIBCXX_USE_CXX11_ABI=0")
|
||||||
|
set(${result} libstdc++ PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Use C++11 stdlib as default if gcc is 5.1+
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1")
|
||||||
|
set(${result} libstdc++ PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${result} libstdc++11 PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
function(conan_cmake_detect_vs_runtime result)
|
||||||
|
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
|
||||||
|
set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
|
||||||
|
foreach(variable ${variables})
|
||||||
|
string(REPLACE " " ";" flags ${${variable}})
|
||||||
|
foreach (flag ${flags})
|
||||||
|
if(${flag} STREQUAL "/MD" OR ${flag} STREQUAL "/MDd" OR ${flag} STREQUAL "/MT" OR ${flag} STREQUAL "/MTd")
|
||||||
|
string(SUBSTRING ${flag} 1 -1 runtime)
|
||||||
|
set(${result} ${runtime} PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
if(${build_type} STREQUAL "DEBUG")
|
||||||
|
set(${result} "MDd" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${result} "MD" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
macro(parse_arguments)
|
||||||
|
set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_OUTPUT_DIRS OUTPUT_QUIET)
|
||||||
|
set(oneValueArgs CONANFILE DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE
|
||||||
|
PROFILE ARCH BUILD_TYPE INSTALL_FOLDER CONAN_COMMAND)
|
||||||
|
set(multiValueArgs REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO)
|
||||||
|
cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
function(conan_cmake_install)
|
||||||
|
# Calls "conan install"
|
||||||
|
# Argument BUILD is equivalant to --build={missing, PkgName,...} or
|
||||||
|
# --build when argument is 'BUILD all' (which builds all packages from source)
|
||||||
|
# Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source
|
||||||
|
# cmake does not identify conan as command, even if it is +x and it is in the path
|
||||||
|
parse_arguments(${ARGV})
|
||||||
|
|
||||||
|
if(CONAN_CMAKE_MULTI)
|
||||||
|
set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi)
|
||||||
|
else()
|
||||||
|
set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CONAN_BUILD_POLICY "")
|
||||||
|
foreach(ARG ${ARGUMENTS_BUILD})
|
||||||
|
if(${ARG} STREQUAL "all")
|
||||||
|
set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build)
|
||||||
|
break()
|
||||||
|
else()
|
||||||
|
set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(ARGUMENTS_CONAN_COMMAND)
|
||||||
|
set(conan_command ${ARGUMENTS_CONAN_COMMAND})
|
||||||
|
else()
|
||||||
|
set(conan_command conan)
|
||||||
|
endif()
|
||||||
|
set(CONAN_OPTIONS "")
|
||||||
|
if(ARGUMENTS_CONANFILE)
|
||||||
|
set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE})
|
||||||
|
# A conan file has been specified - apply specified options as well if provided
|
||||||
|
foreach(ARG ${ARGUMENTS_OPTIONS})
|
||||||
|
set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG})
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
set(CONANFILE ".")
|
||||||
|
endif()
|
||||||
|
if(ARGUMENTS_UPDATE)
|
||||||
|
set(CONAN_INSTALL_UPDATE --update)
|
||||||
|
endif()
|
||||||
|
set(CONAN_INSTALL_FOLDER "")
|
||||||
|
if(ARGUMENTS_INSTALL_FOLDER)
|
||||||
|
set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER})
|
||||||
|
endif()
|
||||||
|
foreach(ARG ${ARGUMENTS_GENERATORS})
|
||||||
|
set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG})
|
||||||
|
endforeach()
|
||||||
|
foreach(ARG ${ARGUMENTS_ENV})
|
||||||
|
set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG})
|
||||||
|
endforeach()
|
||||||
|
set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER})
|
||||||
|
|
||||||
|
string (REPLACE ";" " " _conan_args "${conan_args}")
|
||||||
|
message(STATUS "Conan executing: ${conan_command} ${_conan_args}")
|
||||||
|
|
||||||
|
if(ARGUMENTS_OUTPUT_QUIET)
|
||||||
|
set(OUTPUT_CONTROL OUTPUT_QUIET)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(COMMAND ${conan_command} ${conan_args}
|
||||||
|
RESULT_VARIABLE return_code
|
||||||
|
OUTPUT_VARIABLE conan_output
|
||||||
|
ERROR_VARIABLE conan_output
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
message(STATUS "${conan_output}")
|
||||||
|
|
||||||
|
if(NOT "${return_code}" STREQUAL "0")
|
||||||
|
message(FATAL_ERROR "Conan install failed='${return_code}'")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
function(conan_cmake_setup_conanfile)
|
||||||
|
parse_arguments(${ARGV})
|
||||||
|
if(ARGUMENTS_CONANFILE)
|
||||||
|
# configure_file will make sure cmake re-runs when conanfile is updated
|
||||||
|
configure_file(${ARGUMENTS_CONANFILE} ${ARGUMENTS_CONANFILE}.junk)
|
||||||
|
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${ARGUMENTS_CONANFILE}.junk)
|
||||||
|
else()
|
||||||
|
conan_cmake_generate_conanfile(${ARGV})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(conan_cmake_generate_conanfile)
|
||||||
|
# Generate, writing in disk a conanfile.txt with the requires, options, and imports
|
||||||
|
# specified as arguments
|
||||||
|
# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR)
|
||||||
|
parse_arguments(${ARGV})
|
||||||
|
set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt")
|
||||||
|
|
||||||
|
file(WRITE ${_FN} "[generators]\ncmake\n\n[requires]\n")
|
||||||
|
foreach(ARG ${ARGUMENTS_REQUIRES})
|
||||||
|
file(APPEND ${_FN} ${ARG} "\n")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
file(APPEND ${_FN} ${ARG} "\n[options]\n")
|
||||||
|
foreach(ARG ${ARGUMENTS_OPTIONS})
|
||||||
|
file(APPEND ${_FN} ${ARG} "\n")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
file(APPEND ${_FN} ${ARG} "\n[imports]\n")
|
||||||
|
foreach(ARG ${ARGUMENTS_IMPORTS})
|
||||||
|
file(APPEND ${_FN} ${ARG} "\n")
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
macro(conan_load_buildinfo)
|
||||||
|
if(CONAN_CMAKE_MULTI)
|
||||||
|
set(_CONANBUILDINFO conanbuildinfo_multi.cmake)
|
||||||
|
else()
|
||||||
|
set(_CONANBUILDINFO conanbuildinfo.cmake)
|
||||||
|
endif()
|
||||||
|
# Checks for the existence of conanbuildinfo.cmake, and loads it
|
||||||
|
# important that it is macro, so variables defined at parent scope
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${_CONANBUILDINFO}")
|
||||||
|
message(STATUS "Conan: Loading ${_CONANBUILDINFO}")
|
||||||
|
include(${CMAKE_CURRENT_BINARY_DIR}/${_CONANBUILDINFO})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
macro(conan_cmake_run)
|
||||||
|
parse_arguments(${ARGV})
|
||||||
|
|
||||||
|
if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED
|
||||||
|
AND NOT ARGUMENTS_BUILD_TYPE)
|
||||||
|
set(CONAN_CMAKE_MULTI ON)
|
||||||
|
message(STATUS "Conan: Using cmake-multi generator")
|
||||||
|
else()
|
||||||
|
set(CONAN_CMAKE_MULTI OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CONAN_EXPORTED)
|
||||||
|
conan_cmake_setup_conanfile(${ARGV})
|
||||||
|
if(CONAN_CMAKE_MULTI)
|
||||||
|
foreach(CMAKE_BUILD_TYPE "Release" "Debug")
|
||||||
|
set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE})
|
||||||
|
conan_cmake_settings(settings ${ARGV})
|
||||||
|
conan_cmake_install(SETTINGS ${settings} ${ARGV})
|
||||||
|
endforeach()
|
||||||
|
set(CMAKE_BUILD_TYPE)
|
||||||
|
else()
|
||||||
|
conan_cmake_settings(settings ${ARGV})
|
||||||
|
conan_cmake_install(SETTINGS ${settings} ${ARGV})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
conan_load_buildinfo()
|
||||||
|
|
||||||
|
if(ARGUMENTS_BASIC_SETUP)
|
||||||
|
foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS)
|
||||||
|
if(ARGUMENTS_${_option})
|
||||||
|
if(${_option} STREQUAL "CMAKE_TARGETS")
|
||||||
|
list(APPEND _setup_options "TARGETS")
|
||||||
|
else()
|
||||||
|
list(APPEND _setup_options ${_option})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
conan_basic_setup(${_setup_options})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(conan_check)
|
||||||
|
# Checks conan availability in PATH
|
||||||
|
# Arguments REQUIRED and VERSION are optional
|
||||||
|
# Example usage:
|
||||||
|
# conan_check(VERSION 1.0.0 REQUIRED)
|
||||||
|
message(STATUS "Conan: checking conan executable in path")
|
||||||
|
set(options REQUIRED)
|
||||||
|
set(oneValueArgs VERSION)
|
||||||
|
cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN})
|
||||||
|
|
||||||
|
find_program(CONAN_CMD conan)
|
||||||
|
if(NOT CONAN_CMD AND CONAN_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Conan executable not found!")
|
||||||
|
endif()
|
||||||
|
message(STATUS "Conan: Found program ${CONAN_CMD}")
|
||||||
|
execute_process(COMMAND ${CONAN_CMD} --version
|
||||||
|
OUTPUT_VARIABLE CONAN_VERSION_OUTPUT
|
||||||
|
ERROR_VARIABLE CONAN_VERSION_OUTPUT)
|
||||||
|
message(STATUS "Conan: Version found ${CONAN_VERSION_OUTPUT}")
|
||||||
|
|
||||||
|
if(DEFINED CONAN_VERSION)
|
||||||
|
string(REGEX MATCH ".*Conan version ([0-9]+\.[0-9]+\.[0-9]+)" FOO
|
||||||
|
"${CONAN_VERSION_OUTPUT}")
|
||||||
|
if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION})
|
||||||
|
message(FATAL_ERROR "Conan outdated. Installed: ${CONAN_VERSION}, \
|
||||||
|
required: ${CONAN_VERSION_REQUIRED}. Consider updating via 'pip \
|
||||||
|
install conan --upgrade'.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(conan_add_remote)
|
||||||
|
# Adds a remote
|
||||||
|
# Arguments URL and NAME are required, INDEX is optional
|
||||||
|
# Example usage:
|
||||||
|
# conan_add_remote(NAME bincrafters INDEX 1
|
||||||
|
# URL https://api.bintray.com/conan/bincrafters/public-conan)
|
||||||
|
set(oneValueArgs URL NAME INDEX)
|
||||||
|
cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN})
|
||||||
|
|
||||||
|
if(DEFINED CONAN_INDEX)
|
||||||
|
set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Conan: Adding ${CONAN_NAME} remote repositoy (${CONAN_URL})")
|
||||||
|
execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_URL}
|
||||||
|
${CONAN_INDEX_ARG} -f)
|
||||||
|
endmacro()
|
||||||
|
|
@ -1,5 +1,6 @@
|
|||||||
[requires]
|
[requires]
|
||||||
protobuf/3.6.1@bincrafters/stable
|
protobuf/3.6.1@bincrafters/stable
|
||||||
|
protoc_installer/3.6.1@bincrafters/stable
|
||||||
catch2/2.4.2@bincrafters/stable
|
catch2/2.4.2@bincrafters/stable
|
||||||
|
|
||||||
[generators]
|
[generators]
|
||||||
|
@ -6,14 +6,14 @@ message DativModel
|
|||||||
{
|
{
|
||||||
message TiereModel
|
message TiereModel
|
||||||
{
|
{
|
||||||
bool Tiger = 1;
|
bool Affe = 1;
|
||||||
bool Katze = 2;
|
bool Gans = 2;
|
||||||
bool Affe = 3;
|
bool Tiger = 3;
|
||||||
bool Gans = 4;
|
bool Hund = 4;
|
||||||
bool Baer = 5;
|
bool Elefant = 5;
|
||||||
bool Pferd = 6;
|
bool Pferd = 6;
|
||||||
bool Hund = 7;
|
bool Baer = 7;
|
||||||
bool Elefant = 8;
|
bool Katze = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message VersteckeModel
|
message VersteckeModel
|
||||||
@ -28,19 +28,19 @@ message DativModel
|
|||||||
bool Baum2 = 8;
|
bool Baum2 = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message FutterModel
|
message NomTiereModel
|
||||||
{
|
{
|
||||||
bool Salat = 1;
|
bool Gans = 1;
|
||||||
bool Fleisch = 2;
|
bool Tiger = 2;
|
||||||
bool Knochen = 3;
|
bool Hund = 3;
|
||||||
bool Banane = 4;
|
bool Affe = 4;
|
||||||
bool Apfel = 5;
|
bool Elefant = 5;
|
||||||
bool Karotte = 6;
|
bool Pferd = 6;
|
||||||
bool Honig = 7;
|
bool Baer = 7;
|
||||||
bool Zucker = 8;
|
bool Katze = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiereModel Tiere = 1;
|
TiereModel Tiere = 1;
|
||||||
VersteckeModel Verstecke = 2;
|
VersteckeModel Verstecke = 2;
|
||||||
FutterModel Futter = 3;
|
NomTiereModel NomTiere = 3;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,24 @@
|
|||||||
cmake_minimum_required(VERSION 3.6)
|
cmake_minimum_required(VERSION 3.6)
|
||||||
|
|
||||||
project(ESGRAF48 LANGUAGES CXX)
|
set(BUILD_VERSION_MAJOR_MINOR 0.3)
|
||||||
|
|
||||||
|
if ($ENV{BUILD_NUMBER})
|
||||||
|
set(BUILD_VERSION_PATCH $ENV{BUILD_NUMBER})
|
||||||
|
else()
|
||||||
|
set(BUILD_VERSION_PATCH 0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
project(ESGRAF48
|
||||||
|
VERSION ${BUILD_VERSION_MAJOR_MINOR}.${BUILD_VERSION_PATCH}
|
||||||
|
DESCRIPTION "ESGRAF 4-8"
|
||||||
|
LANGUAGES CXX
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
version.h.in
|
||||||
|
version.h
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
find_package(Qt5Widgets REQUIRED)
|
find_package(Qt5Widgets REQUIRED)
|
||||||
find_package(Qt5PrintSupport REQUIRED)
|
find_package(Qt5PrintSupport REQUIRED)
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
CheckableTestModel::CheckableTestModel(QObject *parent)
|
CheckableTestModel::CheckableTestModel(QObject *parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int CheckableTestModel::rowCount(const QModelIndex &) const
|
int CheckableTestModel::rowCount(const QModelIndex &) const
|
||||||
{
|
{
|
||||||
return static_cast<int>(m_tests.size());
|
return static_cast<int>(m_tests.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int CheckableTestModel::columnCount(const QModelIndex &) const
|
int CheckableTestModel::columnCount(const QModelIndex &) const
|
||||||
@ -20,7 +20,7 @@ int CheckableTestModel::columnCount(const QModelIndex &) const
|
|||||||
|
|
||||||
for (const auto &test : m_tests)
|
for (const auto &test : m_tests)
|
||||||
{
|
{
|
||||||
columnCount = std::max(columnCount, static_cast<int>(test.size()));
|
columnCount = std::max(columnCount, static_cast<int>(test.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return columnCount;
|
return columnCount;
|
||||||
@ -37,17 +37,17 @@ QVariant CheckableTestModel::data(const QModelIndex &index, int role) const
|
|||||||
{
|
{
|
||||||
auto &item = getItem(index);
|
auto &item = getItem(index);
|
||||||
|
|
||||||
switch (role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
{
|
{
|
||||||
return item.getText().c_str();
|
return item.getText().c_str();
|
||||||
}
|
}
|
||||||
case Qt::CheckStateRole:
|
case Qt::CheckStateRole:
|
||||||
{
|
{
|
||||||
return item.isChecked() ? Qt::Checked : Qt::Unchecked;
|
return item.isChecked() ? Qt::Checked : Qt::Unchecked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::runtime_error &e)
|
catch (std::runtime_error &e)
|
||||||
{
|
{
|
||||||
@ -67,8 +67,7 @@ Qt::ItemFlags CheckableTestModel::flags(const QModelIndex &index) const
|
|||||||
return Qt::NoItemFlags;
|
return Qt::NoItemFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckableTestModel::setData(
|
bool CheckableTestModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
const QModelIndex &index, const QVariant &value, int role)
|
|
||||||
{
|
{
|
||||||
if (!isValidIndex(index))
|
if (!isValidIndex(index))
|
||||||
{
|
{
|
||||||
@ -93,18 +92,33 @@ bool CheckableTestModel::setData(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CheckableTestModel::headerData(
|
QVariant CheckableTestModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
int section, Qt::Orientation orientation, int role) const
|
|
||||||
{
|
{
|
||||||
if (role == Qt::DisplayRole && orientation == Qt::Vertical)
|
switch (orientation)
|
||||||
{
|
{
|
||||||
if (section < m_tests.size())
|
case Qt::Vertical:
|
||||||
{
|
{
|
||||||
return m_tests.at(section).name();
|
switch (role)
|
||||||
|
{
|
||||||
|
case Qt::DisplayRole:
|
||||||
|
{
|
||||||
|
if (section < m_tests.size())
|
||||||
|
{
|
||||||
|
return m_tests.at(section).name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case Qt::SizeHintRole:
|
||||||
|
{
|
||||||
|
return QSize(200, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QAbstractTableModel::headerData(section, orientation, role);
|
return QAbstractTableModel::headerData(section, orientation, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckableTestModel::isValidIndex(const QModelIndex &index) const
|
bool CheckableTestModel::isValidIndex(const QModelIndex &index) const
|
||||||
@ -127,8 +141,7 @@ CheckableItems &CheckableTestModel::getItems(const QModelIndex &index)
|
|||||||
throw std::runtime_error("invalid index");
|
throw std::runtime_error("invalid index");
|
||||||
}
|
}
|
||||||
|
|
||||||
const CheckableItems &CheckableTestModel::getItems(
|
const CheckableItems &CheckableTestModel::getItems(const QModelIndex &index) const
|
||||||
const QModelIndex &index) const
|
|
||||||
{
|
{
|
||||||
if (index.row() < m_tests.size())
|
if (index.row() < m_tests.size())
|
||||||
{
|
{
|
||||||
@ -162,7 +175,7 @@ const CheckableItem &CheckableTestModel::getItem(const QModelIndex &index) const
|
|||||||
|
|
||||||
unsigned int CheckableTestModel::getPoints() const
|
unsigned int CheckableTestModel::getPoints() const
|
||||||
{
|
{
|
||||||
unsigned int points = 0;
|
unsigned int points = 0;
|
||||||
|
|
||||||
for (const auto &test : m_tests)
|
for (const auto &test : m_tests)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "DataModel.h"
|
#include "DataModel.h"
|
||||||
#include "DataModel.pb.h"
|
#include "DataModel.pb.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
DataModel::DataModel(QObject *parent)
|
DataModel::DataModel(QObject *parent)
|
||||||
@ -12,7 +14,10 @@ DataModel::DataModel(QObject *parent)
|
|||||||
, m_results(this)
|
, m_results(this)
|
||||||
, m_akkusativ(this)
|
, m_akkusativ(this)
|
||||||
, m_dativ(this)
|
, m_dativ(this)
|
||||||
, m_v2Svk(this)
|
, m_wfModel(this)
|
||||||
|
, m_otModel(this)
|
||||||
|
, m_tPrModel(this)
|
||||||
|
, m_tPeModel(this)
|
||||||
, m_passiv(this)
|
, m_passiv(this)
|
||||||
, m_genitiv(this)
|
, m_genitiv(this)
|
||||||
{
|
{
|
||||||
@ -22,17 +27,27 @@ DataModel::DataModel(QObject *parent)
|
|||||||
connect(&m_verbEnd, &VerbEndModel::dataChanged, this, &DataModel::verbEndModelChanged);
|
connect(&m_verbEnd, &VerbEndModel::dataChanged, this, &DataModel::verbEndModelChanged);
|
||||||
connect(&m_akkusativ, &AkkusativModel::dataChanged, this, &DataModel::akkusativModelChanged);
|
connect(&m_akkusativ, &AkkusativModel::dataChanged, this, &DataModel::akkusativModelChanged);
|
||||||
connect(&m_dativ, &DativModel::dataChanged, this, &DataModel::dativModelChanged);
|
connect(&m_dativ, &DativModel::dataChanged, this, &DataModel::dativModelChanged);
|
||||||
connect(&m_v2Svk, &V2SvkModel::dataChanged, this, &DataModel::v2SvkModelChanged);
|
|
||||||
|
connect(&m_wfModel, &WFModel::dataChanged, this, &DataModel::v2SvkModelChanged);
|
||||||
|
connect(&m_otModel, &OTModel::dataChanged, this, &DataModel::v2SvkModelChanged);
|
||||||
|
connect(&m_tPrModel, &TPrModel::dataChanged, this, &DataModel::v2SvkModelChanged);
|
||||||
|
connect(&m_tPeModel, &TPeModel::dataChanged, this, &DataModel::v2SvkModelChanged);
|
||||||
|
|
||||||
connect(&m_passiv, &PassivModel::dataChanged, this, &DataModel::passivModelChanged);
|
connect(&m_passiv, &PassivModel::dataChanged, this, &DataModel::passivModelChanged);
|
||||||
connect(&m_genitiv, &GenitivModel::dataChanged, this, &DataModel::genitivModelChanged);
|
connect(&m_genitiv, &GenitivModel::dataChanged, this, &DataModel::genitivModelChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataModel::write(std::ostream &outStream) const
|
void DataModel::write(const QString &filename) const
|
||||||
{
|
{
|
||||||
ESGRAF48::DataModel dataModel;
|
ESGRAF48::DataModel dataModel;
|
||||||
|
|
||||||
m_metaData.write(*dataModel.mutable_metadata());
|
m_metaData.write(*dataModel.mutable_metadata());
|
||||||
m_v2Svk.write(*dataModel.mutable_v2svk());
|
|
||||||
|
m_wfModel.write(*dataModel.mutable_v2svk());
|
||||||
|
m_otModel.write(*dataModel.mutable_v2svk());
|
||||||
|
m_tPrModel.write(*dataModel.mutable_v2svk());
|
||||||
|
m_tPeModel.write(*dataModel.mutable_v2svk());
|
||||||
|
|
||||||
m_verbEnd.write(*dataModel.mutable_verbend());
|
m_verbEnd.write(*dataModel.mutable_verbend());
|
||||||
m_genus.write(*dataModel.mutable_genus());
|
m_genus.write(*dataModel.mutable_genus());
|
||||||
m_akkusativ.write(*dataModel.mutable_akkusativ());
|
m_akkusativ.write(*dataModel.mutable_akkusativ());
|
||||||
@ -41,16 +56,41 @@ void DataModel::write(std::ostream &outStream) const
|
|||||||
m_genitiv.write(*dataModel.mutable_lateskillsgenitiv());
|
m_genitiv.write(*dataModel.mutable_lateskillsgenitiv());
|
||||||
m_passiv.write(*dataModel.mutable_lateskillspassiv());
|
m_passiv.write(*dataModel.mutable_lateskillspassiv());
|
||||||
|
|
||||||
dataModel.SerializeToOstream(&outStream);
|
QFile outFile(filename);
|
||||||
|
if (!outFile.open(QIODevice::WriteOnly))
|
||||||
|
{
|
||||||
|
throw std::runtime_error("failed to open file");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = dataModel.SerializeToFileDescriptor(outFile.handle());
|
||||||
|
if (success == false)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("filed to write file");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataModel::read(std::istream &inStream)
|
void DataModel::read(const QString &filename)
|
||||||
{
|
{
|
||||||
|
QFile inFile(filename);
|
||||||
|
if (!inFile.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
throw std::runtime_error("failed to read file");
|
||||||
|
}
|
||||||
|
|
||||||
ESGRAF48::DataModel dataModel;
|
ESGRAF48::DataModel dataModel;
|
||||||
dataModel.ParseFromIstream(&inStream);
|
bool success = dataModel.ParseFromFileDescriptor(inFile.handle());
|
||||||
|
if (success == false)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("invalid file format");
|
||||||
|
}
|
||||||
|
|
||||||
m_metaData.read(dataModel.metadata());
|
m_metaData.read(dataModel.metadata());
|
||||||
m_v2Svk.read(dataModel.v2svk());
|
|
||||||
|
m_wfModel.read(dataModel.v2svk());
|
||||||
|
m_otModel.read(dataModel.v2svk());
|
||||||
|
m_tPrModel.read(dataModel.v2svk());
|
||||||
|
m_tPeModel.read(dataModel.v2svk());
|
||||||
|
|
||||||
m_verbEnd.read(dataModel.verbend());
|
m_verbEnd.read(dataModel.verbend());
|
||||||
m_genus.read(dataModel.genus());
|
m_genus.read(dataModel.genus());
|
||||||
m_akkusativ.read(dataModel.akkusativ());
|
m_akkusativ.read(dataModel.akkusativ());
|
||||||
@ -67,7 +107,7 @@ void DataModel::printTo(QPainter &painter) const
|
|||||||
painter.translate(0, 3 * painter.fontMetrics().lineSpacing());
|
painter.translate(0, 3 * painter.fontMetrics().lineSpacing());
|
||||||
|
|
||||||
m_metaData.printTo(painter);
|
m_metaData.printTo(painter);
|
||||||
m_v2Svk.printTo(painter);
|
m_wfModel.printTo(painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataModel::pluralModelChanged()
|
void DataModel::pluralModelChanged()
|
||||||
@ -114,8 +154,10 @@ void DataModel::dativModelChanged()
|
|||||||
|
|
||||||
void DataModel::v2SvkModelChanged()
|
void DataModel::v2SvkModelChanged()
|
||||||
{
|
{
|
||||||
m_results.setV2Result(m_v2Svk.getV2Points());
|
m_results.setV2Result(m_wfModel.getV2Points() + m_otModel.getV2Points()
|
||||||
m_results.setSvkResult(m_v2Svk.getSvkPoints());
|
+ m_tPrModel.getV2Points() + m_tPeModel.getV2Points());
|
||||||
|
m_results.setSvkResult(m_wfModel.getSvkPoints() + m_otModel.getSvkPoints()
|
||||||
|
+ m_tPrModel.getSvkPoints() + m_tPeModel.getSvkPoints());
|
||||||
|
|
||||||
emit modelChanged();
|
emit modelChanged();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,12 @@
|
|||||||
#include "PluralModel.h"
|
#include "PluralModel.h"
|
||||||
#include "AkkusativModel.h"
|
#include "AkkusativModel.h"
|
||||||
#include "DativModel.h"
|
#include "DativModel.h"
|
||||||
#include "V2SvkModel.h"
|
|
||||||
|
#include "WFModel.h"
|
||||||
|
#include "OTModel.h"
|
||||||
|
#include "TPrModel.h"
|
||||||
|
#include "TPeModel.h"
|
||||||
|
|
||||||
#include "PassivModel.h"
|
#include "PassivModel.h"
|
||||||
#include "GenitivModel.h"
|
#include "GenitivModel.h"
|
||||||
|
|
||||||
@ -27,7 +32,12 @@ public:
|
|||||||
PluralModel m_plural;
|
PluralModel m_plural;
|
||||||
AkkusativModel m_akkusativ;
|
AkkusativModel m_akkusativ;
|
||||||
DativModel m_dativ;
|
DativModel m_dativ;
|
||||||
V2SvkModel m_v2Svk;
|
|
||||||
|
WFModel m_wfModel;
|
||||||
|
OTModel m_otModel;
|
||||||
|
TPrModel m_tPrModel;
|
||||||
|
TPeModel m_tPeModel;
|
||||||
|
|
||||||
PassivModel m_passiv;
|
PassivModel m_passiv;
|
||||||
GenitivModel m_genitiv;
|
GenitivModel m_genitiv;
|
||||||
|
|
||||||
@ -36,8 +46,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
DataModel(QObject *parent);
|
DataModel(QObject *parent);
|
||||||
|
|
||||||
void write(std::ostream &outStream) const;
|
void write(const QString &filename) const;
|
||||||
void read(std::istream &inStream);
|
void read(const QString &filename);
|
||||||
|
|
||||||
void printTo(QPainter &painter) const override;
|
void printTo(QPainter &painter) const override;
|
||||||
|
|
||||||
|
@ -1,18 +1,34 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QCommandLineParser>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
QCoreApplication::setApplicationName(ESGRAF48_DESCRIPTION);
|
||||||
|
QCoreApplication::setApplicationVersion(ESGRAF48_VERSION);
|
||||||
|
|
||||||
|
QCommandLineParser cmdParser;
|
||||||
|
cmdParser.setApplicationDescription(ESGRAF48_DESCRIPTION);
|
||||||
|
cmdParser.addHelpOption();
|
||||||
|
cmdParser.addVersionOption();
|
||||||
|
cmdParser.addPositionalArgument("filename", "file to open");
|
||||||
|
|
||||||
|
cmdParser.process(app);
|
||||||
|
|
||||||
|
const QStringList args = cmdParser.positionalArguments();
|
||||||
|
|
||||||
std::unique_ptr<MainWindow> mainWindow;
|
std::unique_ptr<MainWindow> mainWindow;
|
||||||
if (argc < 2)
|
if (args.empty())
|
||||||
{
|
{
|
||||||
mainWindow = std::make_unique<MainWindow>(nullptr);
|
mainWindow = std::make_unique<MainWindow>(nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainWindow = std::make_unique<MainWindow>(nullptr, argv[1]);
|
mainWindow = std::make_unique<MainWindow>(nullptr, args.at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow->show();
|
mainWindow->show();
|
||||||
|
@ -166,3 +166,8 @@ void MetaDataModel::printTo(QPainter &painter) const
|
|||||||
|
|
||||||
painter.translate(0, 2 * height);
|
painter.translate(0, 2 * height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Age MetaDataModel::getAge() const
|
||||||
|
{
|
||||||
|
return {m_dateOfBirth, m_dateOfTest};
|
||||||
|
}
|
||||||
|
@ -25,19 +25,14 @@ public:
|
|||||||
MetaDataModel(QObject *parent);
|
MetaDataModel(QObject *parent);
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QVariant data(
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value,
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||||
int role = Qt::EditRole) override;
|
|
||||||
|
|
||||||
void read(const ESGRAF48::MetaDataModel &model);
|
void read(const ESGRAF48::MetaDataModel &model);
|
||||||
void write(ESGRAF48::MetaDataModel &model) const;
|
void write(ESGRAF48::MetaDataModel &model) const;
|
||||||
|
|
||||||
void printTo(QPainter &painter) const override;
|
void printTo(QPainter &painter) const override;
|
||||||
|
|
||||||
Age getAge() const
|
Age getAge() const;
|
||||||
{
|
|
||||||
return { m_dateOfBirth, m_dateOfTest };
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,7 @@ unsigned int PRMap::lookup(const Age &age, const unsigned int &points)
|
|||||||
|
|
||||||
if (m_ages.back() < age)
|
if (m_ages.back() < age)
|
||||||
{
|
{
|
||||||
return m_ages.size() - 1;
|
return m_ages.size() - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t index = 1; index < m_ages.size(); ++index)
|
for (size_t index = 1; index < m_ages.size(); ++index)
|
||||||
|
@ -4,11 +4,11 @@ DativModel::DativModel(QObject *parent)
|
|||||||
: CheckableTestModel(parent)
|
: CheckableTestModel(parent)
|
||||||
{
|
{
|
||||||
m_tests = {{"Dativ Nominalphrase",
|
m_tests = {{"Dativ Nominalphrase",
|
||||||
{"Tiger", "Katze", "Affe", "Gans", "Bär", "Pferd", "Hund", "Elefant"}},
|
{"Affe", "Gans", "Tiger", "Hund", "Elefant", "Pferd", "Bär", "Katze"}},
|
||||||
{"Präpositionalphrase (Verstecke)",
|
{"Präpositionalphrase (Verstecke)",
|
||||||
{"Vorhang", "Kiste", "Holz", "Kiste", "Baum", "Vorhang", "Holz", "Baum"}},
|
{"Vorhang", "Kiste", "Holz", "Kiste", "Baum", "Vorhang", "Holz", "Baum"}},
|
||||||
{"Nominalphrase (Tiere)",
|
{"Nominalphrase (Tiere)",
|
||||||
{"Salat", "Fleisch", "Knochen", "Banane", "Apfel", "Karotte", "Honig", "Zucker"}}};
|
{"Gans", "Tiger", "Hund", "Affe", "Elefant", "Pferd", "Bär", "Katze"}}};
|
||||||
}
|
}
|
||||||
|
|
||||||
void DativModel::read(const ESGRAF48::DativModel &model)
|
void DativModel::read(const ESGRAF48::DativModel &model)
|
||||||
@ -17,14 +17,14 @@ void DativModel::read(const ESGRAF48::DativModel &model)
|
|||||||
{
|
{
|
||||||
auto &testItems = m_tests.at(0).items();
|
auto &testItems = m_tests.at(0).items();
|
||||||
|
|
||||||
testItems[0].setState(tiereModel.tiger());
|
testItems[0].setState(tiereModel.affe());
|
||||||
testItems[1].setState(tiereModel.katze());
|
testItems[1].setState(tiereModel.gans());
|
||||||
testItems[2].setState(tiereModel.affe());
|
testItems[2].setState(tiereModel.tiger());
|
||||||
testItems[3].setState(tiereModel.gans());
|
testItems[3].setState(tiereModel.hund());
|
||||||
testItems[4].setState(tiereModel.baer());
|
testItems[4].setState(tiereModel.elefant());
|
||||||
testItems[5].setState(tiereModel.pferd());
|
testItems[5].setState(tiereModel.pferd());
|
||||||
testItems[6].setState(tiereModel.hund());
|
testItems[6].setState(tiereModel.baer());
|
||||||
testItems[7].setState(tiereModel.elefant());
|
testItems[7].setState(tiereModel.katze());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &versteckeModel = model.verstecke();
|
const auto &versteckeModel = model.verstecke();
|
||||||
@ -41,18 +41,18 @@ void DativModel::read(const ESGRAF48::DativModel &model)
|
|||||||
testItems[7].setState(versteckeModel.baum2());
|
testItems[7].setState(versteckeModel.baum2());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &futterModel = model.futter();
|
const auto &nomTiereModel = model.nomtiere();
|
||||||
{
|
{
|
||||||
auto &testItems = m_tests.at(2).items();
|
auto &testItems = m_tests.at(2).items();
|
||||||
|
|
||||||
testItems[0].setState(futterModel.salat());
|
testItems[0].setState(nomTiereModel.gans());
|
||||||
testItems[1].setState(futterModel.fleisch());
|
testItems[1].setState(nomTiereModel.tiger());
|
||||||
testItems[2].setState(futterModel.knochen());
|
testItems[2].setState(nomTiereModel.hund());
|
||||||
testItems[3].setState(futterModel.banane());
|
testItems[3].setState(nomTiereModel.affe());
|
||||||
testItems[4].setState(futterModel.apfel());
|
testItems[4].setState(nomTiereModel.elefant());
|
||||||
testItems[5].setState(futterModel.karotte());
|
testItems[5].setState(nomTiereModel.pferd());
|
||||||
testItems[6].setState(futterModel.honig());
|
testItems[6].setState(nomTiereModel.baer());
|
||||||
testItems[7].setState(futterModel.zucker());
|
testItems[7].setState(nomTiereModel.katze());
|
||||||
}
|
}
|
||||||
|
|
||||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||||
@ -65,14 +65,14 @@ void DativModel::write(ESGRAF48::DativModel &model) const
|
|||||||
{
|
{
|
||||||
const auto &testItems = m_tests.at(0).items();
|
const auto &testItems = m_tests.at(0).items();
|
||||||
|
|
||||||
tiereModel->set_tiger(testItems[0].isChecked());
|
tiereModel->set_affe(testItems[0].isChecked());
|
||||||
tiereModel->set_katze(testItems[1].isChecked());
|
tiereModel->set_gans(testItems[1].isChecked());
|
||||||
tiereModel->set_affe(testItems[2].isChecked());
|
tiereModel->set_tiger(testItems[2].isChecked());
|
||||||
tiereModel->set_gans(testItems[3].isChecked());
|
tiereModel->set_hund(testItems[3].isChecked());
|
||||||
tiereModel->set_baer(testItems[4].isChecked());
|
tiereModel->set_elefant(testItems[4].isChecked());
|
||||||
tiereModel->set_pferd(testItems[5].isChecked());
|
tiereModel->set_pferd(testItems[5].isChecked());
|
||||||
tiereModel->set_hund(testItems[6].isChecked());
|
tiereModel->set_baer(testItems[6].isChecked());
|
||||||
tiereModel->set_elefant(testItems[7].isChecked());
|
tiereModel->set_katze(testItems[7].isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *versteckeModel = model.mutable_verstecke();
|
auto *versteckeModel = model.mutable_verstecke();
|
||||||
@ -90,18 +90,18 @@ void DativModel::write(ESGRAF48::DativModel &model) const
|
|||||||
versteckeModel->set_baum2(testItems[7].isChecked());
|
versteckeModel->set_baum2(testItems[7].isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *futterModel = model.mutable_futter();
|
auto *nomTiereModel = model.mutable_nomtiere();
|
||||||
if (futterModel != nullptr)
|
if (nomTiereModel != nullptr)
|
||||||
{
|
{
|
||||||
const auto &testItems = m_tests.at(2).items();
|
const auto &testItems = m_tests.at(2).items();
|
||||||
|
|
||||||
futterModel->set_salat(testItems[0].isChecked());
|
nomTiereModel->set_gans(testItems[0].isChecked());
|
||||||
futterModel->set_fleisch(testItems[1].isChecked());
|
nomTiereModel->set_tiger(testItems[1].isChecked());
|
||||||
futterModel->set_knochen(testItems[2].isChecked());
|
nomTiereModel->set_hund(testItems[2].isChecked());
|
||||||
futterModel->set_banane(testItems[3].isChecked());
|
nomTiereModel->set_affe(testItems[3].isChecked());
|
||||||
futterModel->set_apfel(testItems[4].isChecked());
|
nomTiereModel->set_elefant(testItems[4].isChecked());
|
||||||
futterModel->set_karotte(testItems[5].isChecked());
|
nomTiereModel->set_pferd(testItems[5].isChecked());
|
||||||
futterModel->set_honig(testItems[6].isChecked());
|
nomTiereModel->set_baer(testItems[6].isChecked());
|
||||||
futterModel->set_zucker(testItems[7].isChecked());
|
nomTiereModel->set_katze(testItems[7].isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,21 +5,11 @@
|
|||||||
PluralModel::PluralModel(QObject *parent)
|
PluralModel::PluralModel(QObject *parent)
|
||||||
: CheckableTestModel(parent)
|
: CheckableTestModel(parent)
|
||||||
{
|
{
|
||||||
m_tests = {{"",
|
m_tests = {{"Plural",
|
||||||
{"Fisch /-e/", "Banane /-n/", "Bonbon /-s/", "Ei /-er/", "Eimer /-ø/",
|
{"Fisch /-e/", "Banane /-n/", "Bonbon /-s/", "Ei /-er/", "Eimer /-ø/",
|
||||||
"Korn UML+/-er/", "Nuss UML+/-e/", "Bär /-en/", "Apfel UML"}}};
|
"Korn UML+/-er/", "Nuss UML+/-e/", "Bär /-en/", "Apfel UML"}}};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant PluralModel::data(const QModelIndex &index, int role) const
|
|
||||||
{
|
|
||||||
if (role == Qt::SizeHintRole)
|
|
||||||
{
|
|
||||||
return QSize(180, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CheckableTestModel::data(index, role);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluralModel::read(const ESGRAF48::PluralModel &model)
|
void PluralModel::read(const ESGRAF48::PluralModel &model)
|
||||||
{
|
{
|
||||||
auto &testItems = m_tests.at(0).items();
|
auto &testItems = m_tests.at(0).items();
|
||||||
|
@ -10,9 +10,6 @@ class PluralModel : public CheckableTestModel
|
|||||||
public:
|
public:
|
||||||
PluralModel(QObject *parent);
|
PluralModel(QObject *parent);
|
||||||
|
|
||||||
QVariant data(
|
|
||||||
const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
||||||
|
|
||||||
void read(const ESGRAF48::PluralModel &model);
|
void read(const ESGRAF48::PluralModel &model);
|
||||||
void write(ESGRAF48::PluralModel &model) const;
|
void write(ESGRAF48::PluralModel &model) const;
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,8 @@ PluralWidget::PluralWidget(QWidget *parent)
|
|||||||
, ui(new Ui::PluralWidget)
|
, ui(new Ui::PluralWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->pluralTableView->horizontalHeader()->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluralWidget::~PluralWidget()
|
PluralWidget::~PluralWidget()
|
||||||
@ -18,5 +20,4 @@ PluralWidget::~PluralWidget()
|
|||||||
void PluralWidget::setModel(PluralModel *model)
|
void PluralWidget::setModel(PluralModel *model)
|
||||||
{
|
{
|
||||||
ui->pluralTableView->setModel(model);
|
ui->pluralTableView->setModel(model);
|
||||||
ui->pluralTableView->resizeColumnsToContents();
|
|
||||||
}
|
}
|
||||||
|
@ -15,17 +15,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="pluralTableView">
|
<widget class="QTableView" name="pluralTableView"/>
|
||||||
<attribute name="horizontalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
|
||||||
<number>120</number>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="verticalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -19,7 +19,10 @@ protobuf_generate_cpp(V2Svk_PROTO_SRCS V2Svk_PROTO_HDRS ${V2Svk_PROTO_FILES})
|
|||||||
|
|
||||||
add_library(${PROJECT_NAME}
|
add_library(${PROJECT_NAME}
|
||||||
V2SvkWidget.cpp
|
V2SvkWidget.cpp
|
||||||
V2SvkModel.cpp
|
WFModel.cpp
|
||||||
|
OTModel.cpp
|
||||||
|
TPrModel.cpp
|
||||||
|
TPeModel.cpp
|
||||||
${UI_HEADERS}
|
${UI_HEADERS}
|
||||||
${V2Svk_PROTO_SRCS}
|
${V2Svk_PROTO_SRCS}
|
||||||
${V2Svk_PROTO_HDRS}
|
${V2Svk_PROTO_HDRS}
|
||||||
|
105
source/SubTests/V2Svk/OTModel.cpp
Normal file
105
source/SubTests/V2Svk/OTModel.cpp
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
#include "OTModel.h"
|
||||||
|
|
||||||
|
OTModel::OTModel(QObject *parent)
|
||||||
|
: CheckableTestModel(parent)
|
||||||
|
{
|
||||||
|
m_tests = {
|
||||||
|
{"Objekt-Topikalisierung",
|
||||||
|
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
|
||||||
|
"Gans", "Gans", "Gans"}},
|
||||||
|
{"SVK: Stamm",
|
||||||
|
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
|
||||||
|
"Gans", "Gans", "Gans"}},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int OTModel::getV2Points()
|
||||||
|
{
|
||||||
|
unsigned int points = 0;
|
||||||
|
|
||||||
|
for (auto testIndex : {0})
|
||||||
|
{
|
||||||
|
const auto &test = m_tests.at(testIndex);
|
||||||
|
|
||||||
|
for (const auto &item : test.items())
|
||||||
|
{
|
||||||
|
if (item.isChecked())
|
||||||
|
{
|
||||||
|
points++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int OTModel::getSvkPoints()
|
||||||
|
{
|
||||||
|
unsigned int points = 0;
|
||||||
|
|
||||||
|
for (auto testIndex : {1})
|
||||||
|
{
|
||||||
|
const auto &test = m_tests.at(testIndex);
|
||||||
|
|
||||||
|
for (const auto &item : test.items())
|
||||||
|
{
|
||||||
|
if (item.isChecked())
|
||||||
|
{
|
||||||
|
points++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OTModel::write(ESGRAF48::V2SvkModel &model) const
|
||||||
|
{
|
||||||
|
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach *modelData, int testIndex) {
|
||||||
|
if (modelData != nullptr)
|
||||||
|
{
|
||||||
|
const auto &testItems = m_tests.at(testIndex).items();
|
||||||
|
|
||||||
|
modelData->set_affe1(testItems[0].isChecked());
|
||||||
|
modelData->set_affe2(testItems[1].isChecked());
|
||||||
|
modelData->set_affe3(testItems[2].isChecked());
|
||||||
|
modelData->set_affe4(testItems[3].isChecked());
|
||||||
|
modelData->set_schwein1(testItems[4].isChecked());
|
||||||
|
modelData->set_schwein2(testItems[5].isChecked());
|
||||||
|
modelData->set_schwein3(testItems[6].isChecked());
|
||||||
|
modelData->set_schwein4(testItems[7].isChecked());
|
||||||
|
modelData->set_gans1(testItems[8].isChecked());
|
||||||
|
modelData->set_gans2(testItems[9].isChecked());
|
||||||
|
modelData->set_gans3(testItems[10].isChecked());
|
||||||
|
modelData->set_gans4(testItems[11].isChecked());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
writeFourVals(model.mutable_objtop(), 0);
|
||||||
|
writeFourVals(model.mutable_svkstamm(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OTModel::read(const ESGRAF48::V2SvkModel &model)
|
||||||
|
{
|
||||||
|
auto readFourVals = [&](const ESGRAF48::V2SvkModel::FourEach &modelData, int testIndex) {
|
||||||
|
auto &testItems = m_tests.at(testIndex).items();
|
||||||
|
|
||||||
|
testItems[0].setState(modelData.affe1());
|
||||||
|
testItems[1].setState(modelData.affe2());
|
||||||
|
testItems[2].setState(modelData.affe3());
|
||||||
|
testItems[3].setState(modelData.affe4());
|
||||||
|
testItems[4].setState(modelData.schwein1());
|
||||||
|
testItems[5].setState(modelData.schwein2());
|
||||||
|
testItems[6].setState(modelData.schwein3());
|
||||||
|
testItems[7].setState(modelData.schwein4());
|
||||||
|
testItems[8].setState(modelData.gans1());
|
||||||
|
testItems[9].setState(modelData.gans2());
|
||||||
|
testItems[10].setState(modelData.gans3());
|
||||||
|
testItems[11].setState(modelData.gans4());
|
||||||
|
};
|
||||||
|
|
||||||
|
readFourVals(model.objtop(), 0);
|
||||||
|
readFourVals(model.svkstamm(), 1);
|
||||||
|
|
||||||
|
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||||
|
}
|
18
source/SubTests/V2Svk/OTModel.h
Normal file
18
source/SubTests/V2Svk/OTModel.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CheckableTestModel.h"
|
||||||
|
#include "V2SvkModel.pb.h"
|
||||||
|
|
||||||
|
class OTModel : public CheckableTestModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
OTModel(QObject *parent);
|
||||||
|
|
||||||
|
unsigned int getV2Points();
|
||||||
|
unsigned int getSvkPoints();
|
||||||
|
|
||||||
|
void write(ESGRAF48::V2SvkModel &model) const;
|
||||||
|
void read(const ESGRAF48::V2SvkModel &model);
|
||||||
|
};
|
95
source/SubTests/V2Svk/TPeModel.cpp
Normal file
95
source/SubTests/V2Svk/TPeModel.cpp
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#include "TPeModel.h"
|
||||||
|
|
||||||
|
TPeModel::TPeModel(QObject *parent)
|
||||||
|
: CheckableTestModel(parent)
|
||||||
|
{
|
||||||
|
m_tests = {
|
||||||
|
{"Temporaladverb Perfekt", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
||||||
|
{"Verbtrennung", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
||||||
|
{"SVK: /-e/ o. Stamm", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
||||||
|
{"Partizip", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int TPeModel::getV2Points()
|
||||||
|
{
|
||||||
|
unsigned int points = 0;
|
||||||
|
|
||||||
|
for (auto testIndex : {0, 1})
|
||||||
|
{
|
||||||
|
const auto &test = m_tests.at(testIndex);
|
||||||
|
|
||||||
|
for (const auto &item : test.items())
|
||||||
|
{
|
||||||
|
if (item.isChecked())
|
||||||
|
{
|
||||||
|
points++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int TPeModel::getSvkPoints()
|
||||||
|
{
|
||||||
|
unsigned int points = 0;
|
||||||
|
|
||||||
|
for (auto testIndex : {2, 3})
|
||||||
|
{
|
||||||
|
const auto &test = m_tests.at(testIndex);
|
||||||
|
|
||||||
|
for (const auto &item : test.items())
|
||||||
|
{
|
||||||
|
if (item.isChecked())
|
||||||
|
{
|
||||||
|
points++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPeModel::write(ESGRAF48::V2SvkModel &model) const
|
||||||
|
{
|
||||||
|
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach *modelData, int testIndex) {
|
||||||
|
if (modelData != nullptr)
|
||||||
|
{
|
||||||
|
const auto &testItems = m_tests.at(testIndex).items();
|
||||||
|
|
||||||
|
modelData->set_affe1(testItems[0].isChecked());
|
||||||
|
modelData->set_affe2(testItems[1].isChecked());
|
||||||
|
modelData->set_schwein1(testItems[2].isChecked());
|
||||||
|
modelData->set_schwein2(testItems[3].isChecked());
|
||||||
|
modelData->set_gans1(testItems[4].isChecked());
|
||||||
|
modelData->set_gans2(testItems[5].isChecked());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
writeTwoVals(model.mutable_tempperf(), 0);
|
||||||
|
writeTwoVals(model.mutable_verbtrennung2(), 1);
|
||||||
|
writeTwoVals(model.mutable_svke2(), 2);
|
||||||
|
writeTwoVals(model.mutable_partizip(), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPeModel::read(const ESGRAF48::V2SvkModel &model)
|
||||||
|
{
|
||||||
|
auto readTwoVals = [&](const ESGRAF48::V2SvkModel::TwoEach &modelData, int testIndex) {
|
||||||
|
auto &testItems = m_tests.at(testIndex).items();
|
||||||
|
|
||||||
|
testItems[0].setState(modelData.affe1());
|
||||||
|
testItems[1].setState(modelData.affe2());
|
||||||
|
testItems[2].setState(modelData.schwein1());
|
||||||
|
testItems[3].setState(modelData.schwein2());
|
||||||
|
testItems[4].setState(modelData.gans1());
|
||||||
|
testItems[5].setState(modelData.gans2());
|
||||||
|
};
|
||||||
|
|
||||||
|
readTwoVals(model.tempperf(), 0);
|
||||||
|
readTwoVals(model.verbtrennung2(), 1);
|
||||||
|
readTwoVals(model.svke2(), 2);
|
||||||
|
readTwoVals(model.partizip(), 3);
|
||||||
|
|
||||||
|
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||||
|
}
|
18
source/SubTests/V2Svk/TPeModel.h
Normal file
18
source/SubTests/V2Svk/TPeModel.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CheckableTestModel.h"
|
||||||
|
#include "V2SvkModel.pb.h"
|
||||||
|
|
||||||
|
class TPeModel : public CheckableTestModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TPeModel(QObject *parent);
|
||||||
|
|
||||||
|
unsigned int getV2Points();
|
||||||
|
unsigned int getSvkPoints();
|
||||||
|
|
||||||
|
void write(ESGRAF48::V2SvkModel &model) const;
|
||||||
|
void read(const ESGRAF48::V2SvkModel &model);
|
||||||
|
};
|
89
source/SubTests/V2Svk/TPrModel.cpp
Normal file
89
source/SubTests/V2Svk/TPrModel.cpp
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#include "TPrModel.h"
|
||||||
|
|
||||||
|
TPrModel::TPrModel(QObject *parent)
|
||||||
|
: CheckableTestModel(parent)
|
||||||
|
{
|
||||||
|
m_tests = {
|
||||||
|
{"Temporaladverb Präsens", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
||||||
|
{"SKV: /-e/ o. Stamm", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int TPrModel::getV2Points()
|
||||||
|
{
|
||||||
|
unsigned int points = 0;
|
||||||
|
|
||||||
|
for (auto testIndex : {0})
|
||||||
|
{
|
||||||
|
const auto &test = m_tests.at(testIndex);
|
||||||
|
|
||||||
|
for (const auto &item : test.items())
|
||||||
|
{
|
||||||
|
if (item.isChecked())
|
||||||
|
{
|
||||||
|
points++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int TPrModel::getSvkPoints()
|
||||||
|
{
|
||||||
|
unsigned int points = 0;
|
||||||
|
|
||||||
|
for (auto testIndex : {1})
|
||||||
|
{
|
||||||
|
const auto &test = m_tests.at(testIndex);
|
||||||
|
|
||||||
|
for (const auto &item : test.items())
|
||||||
|
{
|
||||||
|
if (item.isChecked())
|
||||||
|
{
|
||||||
|
points++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPrModel::write(ESGRAF48::V2SvkModel &model) const
|
||||||
|
{
|
||||||
|
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach *modelData, int testIndex) {
|
||||||
|
if (modelData != nullptr)
|
||||||
|
{
|
||||||
|
const auto &testItems = m_tests.at(testIndex).items();
|
||||||
|
|
||||||
|
modelData->set_affe1(testItems[0].isChecked());
|
||||||
|
modelData->set_affe2(testItems[1].isChecked());
|
||||||
|
modelData->set_schwein1(testItems[2].isChecked());
|
||||||
|
modelData->set_schwein2(testItems[3].isChecked());
|
||||||
|
modelData->set_gans1(testItems[4].isChecked());
|
||||||
|
modelData->set_gans2(testItems[5].isChecked());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
writeTwoVals(model.mutable_temppraes(), 0);
|
||||||
|
writeTwoVals(model.mutable_svke1(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TPrModel::read(const ESGRAF48::V2SvkModel &model)
|
||||||
|
{
|
||||||
|
auto readTwoVals = [&](const ESGRAF48::V2SvkModel::TwoEach &modelData, int testIndex) {
|
||||||
|
auto &testItems = m_tests.at(testIndex).items();
|
||||||
|
|
||||||
|
testItems[0].setState(modelData.affe1());
|
||||||
|
testItems[1].setState(modelData.affe2());
|
||||||
|
testItems[2].setState(modelData.schwein1());
|
||||||
|
testItems[3].setState(modelData.schwein2());
|
||||||
|
testItems[4].setState(modelData.gans1());
|
||||||
|
testItems[5].setState(modelData.gans2());
|
||||||
|
};
|
||||||
|
|
||||||
|
readTwoVals(model.temppraes(), 0);
|
||||||
|
readTwoVals(model.svke1(), 1);
|
||||||
|
|
||||||
|
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||||
|
}
|
18
source/SubTests/V2Svk/TPrModel.h
Normal file
18
source/SubTests/V2Svk/TPrModel.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CheckableTestModel.h"
|
||||||
|
#include "V2SvkModel.pb.h"
|
||||||
|
|
||||||
|
class TPrModel : public CheckableTestModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TPrModel(QObject *parent);
|
||||||
|
|
||||||
|
unsigned int getV2Points();
|
||||||
|
unsigned int getSvkPoints();
|
||||||
|
|
||||||
|
void write(ESGRAF48::V2SvkModel &model) const;
|
||||||
|
void read(const ESGRAF48::V2SvkModel &model);
|
||||||
|
};
|
@ -1,14 +1,20 @@
|
|||||||
#include "V2SvkWidget.h"
|
#include "V2SvkWidget.h"
|
||||||
#include "ui_V2SvkWidget.h"
|
#include "ui_V2SvkWidget.h"
|
||||||
|
|
||||||
#include "V2SvkModel.h"
|
#include "WFModel.h"
|
||||||
|
#include "OTModel.h"
|
||||||
|
#include "TPrModel.h"
|
||||||
|
#include "TPeModel.h"
|
||||||
|
|
||||||
V2SvkWidget::V2SvkWidget(QWidget *parent)
|
V2SvkWidget::V2SvkWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, ui(new Ui::V2SvkWidget)
|
, ui(new Ui::V2SvkWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->v2SvkTableView->horizontalHeader()->hide();
|
ui->wfTableView->horizontalHeader()->hide();
|
||||||
|
ui->otTableView->horizontalHeader()->hide();
|
||||||
|
ui->tprTableView->horizontalHeader()->hide();
|
||||||
|
ui->tpeTableView->horizontalHeader()->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
V2SvkWidget::~V2SvkWidget()
|
V2SvkWidget::~V2SvkWidget()
|
||||||
@ -16,7 +22,22 @@ V2SvkWidget::~V2SvkWidget()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void V2SvkWidget::setV2SvkModel(V2SvkModel *model)
|
void V2SvkWidget::setWFModel(WFModel *model)
|
||||||
{
|
{
|
||||||
ui->v2SvkTableView->setModel(model);
|
ui->wfTableView->setModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
void V2SvkWidget::setOTModel(OTModel *model)
|
||||||
|
{
|
||||||
|
ui->otTableView->setModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
void V2SvkWidget::setTPrModel(TPrModel *model)
|
||||||
|
{
|
||||||
|
ui->tprTableView->setModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
void V2SvkWidget::setTPeModel(TPeModel *model)
|
||||||
|
{
|
||||||
|
ui->tpeTableView->setModel(model);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class V2SvkModel;
|
class WFModel;
|
||||||
|
class OTModel;
|
||||||
|
class TPrModel;
|
||||||
|
class TPeModel;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class V2SvkWidget;
|
class V2SvkWidget;
|
||||||
@ -19,5 +22,8 @@ public:
|
|||||||
V2SvkWidget(QWidget *parent = nullptr);
|
V2SvkWidget(QWidget *parent = nullptr);
|
||||||
~V2SvkWidget();
|
~V2SvkWidget();
|
||||||
|
|
||||||
void setV2SvkModel(V2SvkModel *model);
|
void setWFModel(WFModel *model);
|
||||||
|
void setOTModel(OTModel *model);
|
||||||
|
void setTPrModel(TPrModel *model);
|
||||||
|
void setTPeModel(TPeModel *model);
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,16 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="v2SvkTableView"/>
|
<widget class="QTableView" name="wfTableView"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="otTableView"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tprTableView"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTableView" name="tpeTableView"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "V2SvkModel.h"
|
#include "WFModel.h"
|
||||||
|
|
||||||
V2SvkModel::V2SvkModel(QObject *parent)
|
WFModel::WFModel(QObject *parent)
|
||||||
: CheckableTestModel(parent)
|
: CheckableTestModel(parent)
|
||||||
{
|
{
|
||||||
m_tests = {
|
m_tests = {
|
||||||
@ -11,29 +11,14 @@ V2SvkModel::V2SvkModel(QObject *parent)
|
|||||||
{"SVK: /-st/",
|
{"SVK: /-st/",
|
||||||
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
|
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
|
||||||
"Gans", "Gans", "Gans"}},
|
"Gans", "Gans", "Gans"}},
|
||||||
|
|
||||||
{"Objekt-Topikalisierung",
|
|
||||||
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
|
|
||||||
"Gans", "Gans", "Gans"}},
|
|
||||||
{"SVK: Stamm",
|
|
||||||
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
|
|
||||||
"Gans", "Gans", "Gans"}},
|
|
||||||
|
|
||||||
{"Temporaladverb Präsens", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
|
||||||
{"SKV: /-e/ o. Stamm", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
|
||||||
|
|
||||||
{"Temporaladverb Perfekt", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
|
||||||
{"Verbtrennung", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
|
||||||
{"SVK: /-e/ o. Stamm", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
|
||||||
{"Partizip", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int V2SvkModel::getV2Points() const
|
unsigned int WFModel::getV2Points() const
|
||||||
{
|
{
|
||||||
unsigned int points = 0;
|
unsigned int points = 0;
|
||||||
|
|
||||||
for (auto testIndex : {0, 1, 3, 5, 7, 8})
|
for (auto testIndex : {0, 1})
|
||||||
{
|
{
|
||||||
const auto &test = m_tests.at(testIndex);
|
const auto &test = m_tests.at(testIndex);
|
||||||
|
|
||||||
@ -49,11 +34,11 @@ unsigned int V2SvkModel::getV2Points() const
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int V2SvkModel::getSvkPoints() const
|
unsigned int WFModel::getSvkPoints() const
|
||||||
{
|
{
|
||||||
unsigned int points = 0;
|
unsigned int points = 0;
|
||||||
|
|
||||||
for (auto testIndex : {2, 4, 6, 9, 10})
|
for (auto testIndex : {2})
|
||||||
{
|
{
|
||||||
const auto &test = m_tests.at(testIndex);
|
const auto &test = m_tests.at(testIndex);
|
||||||
|
|
||||||
@ -69,25 +54,17 @@ unsigned int V2SvkModel::getSvkPoints() const
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool V2SvkModel::isValidIndex(const QModelIndex &index) const
|
bool WFModel::isValidIndex(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
switch (index.row())
|
if (index.row() == 1)
|
||||||
{
|
{
|
||||||
case 1:
|
return index.column() == 1 || index.column() == 7 || index.column() == 10;
|
||||||
return index.column() == 1 || index.column() == 7 || index.column() == 10;
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
case 9:
|
|
||||||
case 10:
|
|
||||||
return index.column() < 6;
|
|
||||||
default:
|
|
||||||
return CheckableTestModel::isValidIndex(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CheckableTestModel::isValidIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V2SvkModel::write(ESGRAF48::V2SvkModel &model) const
|
void WFModel::write(ESGRAF48::V2SvkModel &model) const
|
||||||
{
|
{
|
||||||
auto writeOneVal = [&](ESGRAF48::V2SvkModel::OneEach *modelData, int testIndex) {
|
auto writeOneVal = [&](ESGRAF48::V2SvkModel::OneEach *modelData, int testIndex) {
|
||||||
if (modelData != nullptr)
|
if (modelData != nullptr)
|
||||||
@ -100,20 +77,6 @@ void V2SvkModel::write(ESGRAF48::V2SvkModel &model) const
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach *modelData, int testIndex) {
|
|
||||||
if (modelData != nullptr)
|
|
||||||
{
|
|
||||||
const auto &testItems = m_tests.at(testIndex).items();
|
|
||||||
|
|
||||||
modelData->set_affe1(testItems[0].isChecked());
|
|
||||||
modelData->set_affe2(testItems[1].isChecked());
|
|
||||||
modelData->set_schwein1(testItems[2].isChecked());
|
|
||||||
modelData->set_schwein2(testItems[3].isChecked());
|
|
||||||
modelData->set_gans1(testItems[4].isChecked());
|
|
||||||
modelData->set_gans2(testItems[5].isChecked());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach *modelData, int testIndex) {
|
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach *modelData, int testIndex) {
|
||||||
if (modelData != nullptr)
|
if (modelData != nullptr)
|
||||||
{
|
{
|
||||||
@ -136,18 +99,9 @@ void V2SvkModel::write(ESGRAF48::V2SvkModel &model) const
|
|||||||
|
|
||||||
writeFourVals(model.mutable_wfrage(), 0);
|
writeFourVals(model.mutable_wfrage(), 0);
|
||||||
writeOneVal(model.mutable_verbtrennung1(), 1);
|
writeOneVal(model.mutable_verbtrennung1(), 1);
|
||||||
writeFourVals(model.mutable_svkst(), 2);
|
|
||||||
writeFourVals(model.mutable_objtop(), 3);
|
|
||||||
writeFourVals(model.mutable_svkstamm(), 4);
|
|
||||||
writeTwoVals(model.mutable_temppraes(), 5);
|
|
||||||
writeTwoVals(model.mutable_svke1(), 6);
|
|
||||||
writeTwoVals(model.mutable_tempperf(), 7);
|
|
||||||
writeTwoVals(model.mutable_verbtrennung2(), 8);
|
|
||||||
writeTwoVals(model.mutable_svke2(), 9);
|
|
||||||
writeTwoVals(model.mutable_partizip(), 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void V2SvkModel::read(const ESGRAF48::V2SvkModel &model)
|
void WFModel::read(const ESGRAF48::V2SvkModel &model)
|
||||||
{
|
{
|
||||||
auto readOneVal = [&](const ESGRAF48::V2SvkModel::OneEach &modelData, int testIndex) {
|
auto readOneVal = [&](const ESGRAF48::V2SvkModel::OneEach &modelData, int testIndex) {
|
||||||
auto &testItems = m_tests.at(testIndex).items();
|
auto &testItems = m_tests.at(testIndex).items();
|
||||||
@ -157,17 +111,6 @@ void V2SvkModel::read(const ESGRAF48::V2SvkModel &model)
|
|||||||
testItems[10].setState(modelData.gans());
|
testItems[10].setState(modelData.gans());
|
||||||
};
|
};
|
||||||
|
|
||||||
auto readTwoVals = [&](const ESGRAF48::V2SvkModel::TwoEach &modelData, int testIndex) {
|
|
||||||
auto &testItems = m_tests.at(testIndex).items();
|
|
||||||
|
|
||||||
testItems[0].setState(modelData.affe1());
|
|
||||||
testItems[1].setState(modelData.affe2());
|
|
||||||
testItems[2].setState(modelData.schwein1());
|
|
||||||
testItems[3].setState(modelData.schwein2());
|
|
||||||
testItems[4].setState(modelData.gans1());
|
|
||||||
testItems[5].setState(modelData.gans2());
|
|
||||||
};
|
|
||||||
|
|
||||||
auto readFourVals = [&](const ESGRAF48::V2SvkModel::FourEach &modelData, int testIndex) {
|
auto readFourVals = [&](const ESGRAF48::V2SvkModel::FourEach &modelData, int testIndex) {
|
||||||
auto &testItems = m_tests.at(testIndex).items();
|
auto &testItems = m_tests.at(testIndex).items();
|
||||||
|
|
||||||
@ -187,20 +130,11 @@ void V2SvkModel::read(const ESGRAF48::V2SvkModel &model)
|
|||||||
|
|
||||||
readFourVals(model.wfrage(), 0);
|
readFourVals(model.wfrage(), 0);
|
||||||
readOneVal(model.verbtrennung1(), 1);
|
readOneVal(model.verbtrennung1(), 1);
|
||||||
readFourVals(model.svkst(), 2);
|
|
||||||
readFourVals(model.objtop(), 3);
|
|
||||||
readFourVals(model.svkstamm(), 4);
|
|
||||||
readTwoVals(model.temppraes(), 5);
|
|
||||||
readTwoVals(model.svke1(), 6);
|
|
||||||
readTwoVals(model.tempperf(), 7);
|
|
||||||
readTwoVals(model.verbtrennung2(), 8);
|
|
||||||
readTwoVals(model.svke2(), 9);
|
|
||||||
readTwoVals(model.partizip(), 10);
|
|
||||||
|
|
||||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void V2SvkModel::printTo(QPainter &painter) const
|
void WFModel::printTo(QPainter &painter) const
|
||||||
{
|
{
|
||||||
painter.setFont(h2Font());
|
painter.setFont(h2Font());
|
||||||
|
|
@ -5,12 +5,12 @@
|
|||||||
#include "CheckableTestModel.h"
|
#include "CheckableTestModel.h"
|
||||||
#include "V2SvkModel.pb.h"
|
#include "V2SvkModel.pb.h"
|
||||||
|
|
||||||
class V2SvkModel : public CheckableTestModel, public PrintableModel
|
class WFModel : public CheckableTestModel, public PrintableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
V2SvkModel(QObject *parent);
|
WFModel(QObject *parent);
|
||||||
|
|
||||||
unsigned int getV2Points() const;
|
unsigned int getV2Points() const;
|
||||||
unsigned int getSvkPoints() const;
|
unsigned int getSvkPoints() const;
|
@ -1,6 +1,8 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -47,7 +49,12 @@ void MainWindow::setupUi()
|
|||||||
ui->pluralWidget->setModel(&m_dataModel.m_plural);
|
ui->pluralWidget->setModel(&m_dataModel.m_plural);
|
||||||
ui->akkusativDativWidget->setAkkusativModel(&m_dataModel.m_akkusativ);
|
ui->akkusativDativWidget->setAkkusativModel(&m_dataModel.m_akkusativ);
|
||||||
ui->akkusativDativWidget->setDativModel(&m_dataModel.m_dativ);
|
ui->akkusativDativWidget->setDativModel(&m_dataModel.m_dativ);
|
||||||
ui->v2SvkWidget->setV2SvkModel(&m_dataModel.m_v2Svk);
|
|
||||||
|
ui->v2SvkWidget->setWFModel(&m_dataModel.m_wfModel);
|
||||||
|
ui->v2SvkWidget->setOTModel(&m_dataModel.m_otModel);
|
||||||
|
ui->v2SvkWidget->setTPrModel(&m_dataModel.m_tPrModel);
|
||||||
|
ui->v2SvkWidget->setTPeModel(&m_dataModel.m_tPeModel);
|
||||||
|
|
||||||
ui->lateSkillsWidget->setPassivModel(&m_dataModel.m_passiv);
|
ui->lateSkillsWidget->setPassivModel(&m_dataModel.m_passiv);
|
||||||
ui->lateSkillsWidget->setGenitivModel(&m_dataModel.m_genitiv);
|
ui->lateSkillsWidget->setGenitivModel(&m_dataModel.m_genitiv);
|
||||||
ui->resultWidget->setModel(&m_dataModel.m_results);
|
ui->resultWidget->setModel(&m_dataModel.m_results);
|
||||||
@ -59,6 +66,8 @@ void MainWindow::setupUi()
|
|||||||
connect(ui->actionPrint, &QAction::triggered, this, &MainWindow::print);
|
connect(ui->actionPrint, &QAction::triggered, this, &MainWindow::print);
|
||||||
connect(ui->actionExport_PDF, &QAction::triggered, this, qOverload<>(&MainWindow::savePdf));
|
connect(ui->actionExport_PDF, &QAction::triggered, this, qOverload<>(&MainWindow::savePdf));
|
||||||
|
|
||||||
|
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::aboutDialog);
|
||||||
|
|
||||||
connect(&m_dataModel, &DataModel::modelChanged, this, &MainWindow::dataModelChanged);
|
connect(&m_dataModel, &DataModel::modelChanged, this, &MainWindow::dataModelChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,15 +95,22 @@ void MainWindow::openFile()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
openFile(filename);
|
try
|
||||||
|
{
|
||||||
|
openFile(filename);
|
||||||
|
}
|
||||||
|
catch (std::exception &e)
|
||||||
|
{
|
||||||
|
QString errorMessage = QString("Error loading \"") + filename + "\": " + e.what();
|
||||||
|
QMessageBox::critical(this, "Error", errorMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openFile(const QString &filename)
|
void MainWindow::openFile(const QString &filename)
|
||||||
{
|
{
|
||||||
closeFile();
|
closeFile();
|
||||||
|
|
||||||
std::fstream protoInFile(filename.toStdString(), std::ios::in | std::ios::binary);
|
m_dataModel.read(filename);
|
||||||
m_dataModel.read(protoInFile);
|
|
||||||
|
|
||||||
setWindowModified(false);
|
setWindowModified(false);
|
||||||
setWindowTitle(filename + "[*]");
|
setWindowTitle(filename + "[*]");
|
||||||
@ -119,6 +135,7 @@ void MainWindow::saveFile()
|
|||||||
void MainWindow::saveFileAs()
|
void MainWindow::saveFileAs()
|
||||||
{
|
{
|
||||||
QFileDialog saveFilenameDialog(this);
|
QFileDialog saveFilenameDialog(this);
|
||||||
|
saveFilenameDialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
saveFilenameDialog.setDefaultSuffix("esgraf48");
|
saveFilenameDialog.setDefaultSuffix("esgraf48");
|
||||||
saveFilenameDialog.setFileMode(QFileDialog::AnyFile);
|
saveFilenameDialog.setFileMode(QFileDialog::AnyFile);
|
||||||
saveFilenameDialog.setNameFilter("ESGRAF 4-8 (*.esgraf48)");
|
saveFilenameDialog.setNameFilter("ESGRAF 4-8 (*.esgraf48)");
|
||||||
@ -198,9 +215,16 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||||||
|
|
||||||
void MainWindow::saveFile(const QString &filename)
|
void MainWindow::saveFile(const QString &filename)
|
||||||
{
|
{
|
||||||
std::fstream protoOutFile(filename.toStdString(),
|
try
|
||||||
std::ios::out | std::ios::trunc | std::ios::binary);
|
{
|
||||||
m_dataModel.write(protoOutFile);
|
m_dataModel.write(filename);
|
||||||
|
}
|
||||||
|
catch (std::exception &e)
|
||||||
|
{
|
||||||
|
QString errorMessage = QString("Error saving \"") + filename + "\": " + e.what();
|
||||||
|
QMessageBox::critical(this, "Error", errorMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
qDebug() << "Wrote" << filename;
|
qDebug() << "Wrote" << filename;
|
||||||
|
|
||||||
@ -225,3 +249,10 @@ void MainWindow::savePdf(const QString &filename)
|
|||||||
|
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::aboutDialog()
|
||||||
|
{
|
||||||
|
QString infoString =
|
||||||
|
QString::fromUtf8(ESGRAF48_DESCRIPTION) + " Version " + QString::fromUtf8(ESGRAF48_VERSION);
|
||||||
|
QMessageBox::information(this, ESGRAF48_DESCRIPTION, infoString);
|
||||||
|
}
|
||||||
|
@ -39,6 +39,7 @@ public slots:
|
|||||||
void print() const;
|
void print() const;
|
||||||
void dataModelChanged();
|
void dataModelChanged();
|
||||||
void savePdf();
|
void savePdf();
|
||||||
|
void aboutDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
@ -137,7 +137,14 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionQuit"/>
|
<addaction name="actionQuit"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuHelp">
|
||||||
|
<property name="title">
|
||||||
|
<string>Help</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionAbout"/>
|
||||||
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
|
<addaction name="menuHelp"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -237,6 +244,11 @@
|
|||||||
<string>Export as PDF file</string>
|
<string>Export as PDF file</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionAbout">
|
||||||
|
<property name="text">
|
||||||
|
<string>About</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
4
source/version.h.in
Normal file
4
source/version.h.in
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ESGRAF48_VERSION "@PROJECT_VERSION@"
|
||||||
|
#define ESGRAF48_DESCRIPTION "@PROJECT_DESCRIPTION@"
|
Reference in New Issue
Block a user