diff options
Diffstat (limited to 'src/plugins/t9write/3rdparty/t9write')
-rw-r--r-- | src/plugins/t9write/3rdparty/t9write/CMakeLists.txt | 70 | ||||
-rw-r--r-- | src/plugins/t9write/3rdparty/t9write/t9write-build.pri | 83 | ||||
-rw-r--r-- | src/plugins/t9write/3rdparty/t9write/t9write.pro | 27 | ||||
-rw-r--r-- | src/plugins/t9write/3rdparty/t9write/unpack.py | 278 |
4 files changed, 0 insertions, 458 deletions
diff --git a/src/plugins/t9write/3rdparty/t9write/CMakeLists.txt b/src/plugins/t9write/3rdparty/t9write/CMakeLists.txt deleted file mode 100644 index 8f3baf69..00000000 --- a/src/plugins/t9write/3rdparty/t9write/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -# Generated from t9write.pro. - -##################################################################### -## BundledT9Write_Db Generic Library: -##################################################################### - -qt_add_3rdparty_library(BundledT9Write_Db - STATIC - SOURCES - api/* - PUBLIC_LIBRARIES - Qt::Core -) - -file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/arabic/*.bin") -foreach(file IN LISTS resource_glob_0) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -file(GLOB resource_glob_1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/hebrew/*.bin") -foreach(file IN LISTS resource_glob_1) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -file(GLOB resource_glob_2 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/thai/*.bin") -foreach(file IN LISTS resource_glob_2) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -file(GLOB resource_glob_3 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/*.bin") -foreach(file IN LISTS resource_glob_3) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -file(GLOB resource_glob_4 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/*.ldb") -foreach(file IN LISTS resource_glob_4) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -file(GLOB resource_glob_5 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/*.hdb") -foreach(file IN LISTS resource_glob_5) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -file(GLOB resource_glob_6 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "data/*.phd") -foreach(file IN LISTS resource_glob_6) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -# Resources: -set(qmake_t9write_db_resource_files - ${resource_glob_0} - ${resource_glob_1} - ${resource_glob_2} - ${resource_glob_3} - ${resource_glob_4} - ${resource_glob_5} - ${resource_glob_6} -) - -qt_add_resource(BundledT9Write_Db "qmake_t9write_db" - PREFIX - "/QtQuick/VirtualKeyboard/T9Write" - FILES - ${qmake_t9write_db_resource_files} -) - - -#### Keys ignored in scope 1:.:.:t9write.pro:<TRUE>: -# QMAKE_RESOURCE_FLAGS = "-no-compress" diff --git a/src/plugins/t9write/3rdparty/t9write/t9write-build.pri b/src/plugins/t9write/3rdparty/t9write/t9write-build.pri deleted file mode 100644 index a39291fa..00000000 --- a/src/plugins/t9write/3rdparty/t9write/t9write-build.pri +++ /dev/null @@ -1,83 +0,0 @@ -# -# Automatically detects the T9Write build directory and sets the following variables: -# -# T9WRITE_FOUND: 0/1 T9Write SDK found -# T9WRITE_BUILD_STATIC: 0/1 Static libraries found (0 == shared libraries) -# T9WRITE_ALPHABETIC_FOUND: 0/1 T9 Write Alphabetic API header found -# T9WRITE_CJK_FOUND: 0/1 T9 Write CJK API header found -# T9WRITE_INCLUDE_DIRS: T9 Write include directories -# T9WRITE_ALPHABETIC_LIBS: Absolute path to the target library file -# T9WRITE_ALPHABETIC_BINS: Absolute path to the target binary file (shared library) -# T9WRITE_CJK_LIBS: Absolute path to the target library file -# T9WRITE_CJK_BINS: Absolute path to the target binary file (shared library) -# - -T9WRITE_FOUND = 0 -T9WRITE_ALPHABETIC_FOUND = 0 -T9WRITE_CJK_FOUND = 0 -T9WRITE_INCLUDE_DIRS = $$PWD/api -contains(QT_ARCH, arm) { - T9WRITE_BUILD_SHARED_DIR = lib/arm/shared - T9WRITE_BUILD_STATIC_DIR = lib/arm/static -} else:linux { - T9WRITE_BUILD_SHARED_DIR = lib/linux/shared - T9WRITE_BUILD_STATIC_DIR = lib/linux/static -} else:win32 { - T9WRITE_BUILD_SHARED_DIR = lib/win32/shared - T9WRITE_BUILD_STATIC_DIR = lib/win32/static -} - -defineReplace(findStaticLibrary) { - win32 { - result = $$files($$1/*.obj) - isEmpty(result): result = $$files($$1/*.lib) - } else { - result = $$files($$1/*.o) - isEmpty(result): result = $$files($$1/*.a) - } - return($$result) -} - -defineReplace(findSharedLibrary) { - win32 { - result = $$files($$1/*.lib) - } else { - result = $$files($$1/*.so) - } - return($$result) -} - -defineReplace(findSharedBinary) { - win32 { - result = $$files($$1/*.dll) - } else { - result = $$files($$1/*.so) - } - return($$result) -} - -for(include_dir, T9WRITE_INCLUDE_DIRS) { - exists($${include_dir}/decuma_hwr.h): T9WRITE_ALPHABETIC_FOUND = 1 - exists($${include_dir}/decuma_hwr_cjk.h): T9WRITE_CJK_FOUND = 1 -} - -equals(T9WRITE_ALPHABETIC_FOUND, 1)|equals(T9WRITE_CJK_FOUND, 1) { - equals(T9WRITE_ALPHABETIC_FOUND, 1) { - T9WRITE_ALPHABETIC_LIBS = $$findSharedLibrary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/alphabetic) - !isEmpty(T9WRITE_ALPHABETIC_LIBS) { - T9WRITE_ALPHABETIC_BINS = $$findSharedBinary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/alphabetic) - } else { - T9WRITE_ALPHABETIC_LIBS = $$findStaticLibrary($$PWD/$$T9WRITE_BUILD_STATIC_DIR/alphabetic) - } - } - equals(T9WRITE_CJK_FOUND, 1) { - T9WRITE_CJK_LIBS = $$findSharedLibrary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/cjk) - !isEmpty(T9WRITE_CJK_LIBS) { - T9WRITE_CJK_BINS = $$findSharedBinary($$PWD/$$T9WRITE_BUILD_SHARED_DIR/cjk) - } else { - T9WRITE_CJK_LIBS = $$findStaticLibrary($$PWD/$$T9WRITE_BUILD_STATIC_DIR/cjk) - } - } - equals(T9WRITE_ALPHABETIC_FOUND, 1):!isEmpty(T9WRITE_ALPHABETIC_LIBS): T9WRITE_FOUND = 1 - equals(T9WRITE_CJK_FOUND, 1):!isEmpty(T9WRITE_CJK_LIBS): T9WRITE_FOUND = 1 -} diff --git a/src/plugins/t9write/3rdparty/t9write/t9write.pro b/src/plugins/t9write/3rdparty/t9write/t9write.pro deleted file mode 100644 index c7f0a86b..00000000 --- a/src/plugins/t9write/3rdparty/t9write/t9write.pro +++ /dev/null @@ -1,27 +0,0 @@ -TARGET = qtt9write_db -CONFIG += static - -HEADERS += $$files(api/*) - -T9WRITE_RESOURCE_FILES = \ - $$files(data/arabic/*.bin) \ - $$files(data/hebrew/*.bin) \ - $$files(data/thai/*.bin) \ - $$files(data/*.bin) \ - $$files(data/*.ldb) \ - $$files(data/*.hdb) \ - $$files(data/*.phd) - -# Note: Compression is disabled, because the resource is accessed directly from the memory -QMAKE_RESOURCE_FLAGS += -no-compress -CONFIG += resources_big - -t9write_db.files = $$T9WRITE_RESOURCE_FILES -t9write_db.prefix =/QtQuick/VirtualKeyboard/T9Write -RESOURCES += t9write_db - -load(qt_helper_lib) - -# Needed for resources -CONFIG += qt -QT = core diff --git a/src/plugins/t9write/3rdparty/t9write/unpack.py b/src/plugins/t9write/3rdparty/t9write/unpack.py deleted file mode 100644 index 4fc1f4dc..00000000 --- a/src/plugins/t9write/3rdparty/t9write/unpack.py +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the Qt Virtual Keyboard module of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:GPL$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 or (at your option) any later version -## approved by the KDE Free Qt Foundation. The licenses are as published by -## the Free Software Foundation and appearing in the file LICENSE.GPL3 -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import os -import sys -import zipfile -import tempfile -import shutil -import fnmatch - -# -# This utility script unpacks the T9 Write SDK to appropriate directory -# structure for Qt Virtual Keyboard. -# -# Usage: unpack.py <filename.zip> <target dir> -# unpack.py <input dir> <target dir> -# -# The script will happily overwrite existing files, so be careful. -# - -# -# Unpack rule list -# -# Each list entry is a dictionary consisting of target directory as -# key and matching pattern as value. The dictionary can be defined in -# the following ways: -# -# Note: The rules within the dictionary are executed in arbitrary order. -# Add a new list entry if the order is significant. -# -# Format: -# 1. { 'target dir 1': [ 'pattern1', 'pattern2', ... ], 'target dir 2': ... } -# - Each pattern is matched against the zip file contents. The file is -# copied to target dir if the pattern matches. Each pattern is handled -# independent of each other. -# -# 2. { 'target dir 1': [ [ 'file group pattern', 'sub pattern1', ... ] ], 'target dir 2': ... } -# - First the file group pattern is matched against the zip file contents. -# Then all the sub patterns are matched in the sub directory specified by -# the first match. If all the sub patterns match, then first match from -# file group pattern and all the matching files from sub pattterns are copied. -# The purpose of this option is to copy coupled files, e.g. DLL and LIB -# files found in the same directory. -# - -UNPACK_RULES = [ -{ # Header files -'api': [ - '*/decuma_hwr.h', - '*/decuma_hwr_cjk.h', - '*/decuma_hwr_types.h', - '*/decuma_point.h', - '*/decumaBasicTypes.h', - '*/decumaBasicTypesMinMax.h', - '*/decumaCharacterSetType.h', - '*/decumaCurve.h', - '*/decumaFunctionalSupport.h', - '*/decumaFunctionalSupportCheck.h', - '*/decumaLanguages.h', - '*/decumaLiteFunctionalSupport.h', - '*/decumaPlusFunctionalSupport.h', - '*/decumaRuntimeMallocData.h', - '*/decumaStatus.h', - '*/decumaStorageSpecifiers.h', - '*/decumaSymbolCategories.h', - '*/decumaUnicodeTypes.h', - '*/t9write_alpha_version.h', - '*/t9write_api_version.h', - '*/t9write_cjk_version.h', - '*/xxt9wApiOem.h', - '*/xxt9wOem.h', -], -}, { # Data: Arabic and Hebrew database must be copied first (the file name collides with Alphabetic database) -'data/arabic': [ - '*/Arabic/*_le.bin', -], -'data/hebrew': [ - '*/Hebrew/*_le.bin', -], -'data/thai': [ - '*/*Thai*/*_le.bin', -], -}, { # Data: Alphabetic and CJK databases -'data': [ - '*/*_le.bin', - '*/*.hdb', - '*/*.phd', - '*/*.ldb', -], -}, { # Libraries -'lib/arm/static/alphabetic': [ - '*T9Write_Alpha*/*Android_ARM*/*.a', - '*T9Write_Alpha*/*Android_ARM*/*.o', -], -'lib/arm/shared/alphabetic': [ - '*T9Write_Alpha*/*Android_ARM*/*.so', -], -'lib/arm/static/cjk': [ - '*T9Write_CJK*/*Android_ARM*/*.a', - '*T9Write_CJK*/*Android_ARM*/*.o', -], -'lib/arm/shared/cjk': [ - '*T9Write_CJK*/*Android_ARM*/*.so', -], -'lib/linux/static/alphabetic': [ - '*T9Write_Alpha*/*Android_x86*/*.a', - '*T9Write_Alpha*/*Android_x86*/*.o', -], -'lib/linux/shared/alphabetic': [ - '*T9Write_Alpha*/*Android_x86*/*.so', -], -'lib/linux/static/cjk': [ - '*T9Write_CJK*/*Android_x86*/*.a', - '*T9Write_CJK*/*Android_x86*/*.o', -], -'lib/linux/shared/cjk': [ - '*T9Write_CJK*/*Android_x86*/*.so', -], -'lib/win32/static/alphabetic': [ - '*T9Write_Alpha*/*.obj', -], -'lib/win32/shared/alphabetic': [ - [ '*T9Write_Alpha*/*.dll', '*.lib' ], -], -'lib/win32/static/cjk': [ - '*T9Write_CJK*/*.obj', -], -'lib/win32/shared/cjk': [ - [ '*T9Write_CJK*/*.dll', '*.lib' ], -], -'lib/win32/shared/alphabetic': [ - [ '*T9Write_Alpha*/*.dll', '*.lib' ], -], -} -] - -# -# Blacklist -# -# File matching rules for blacklisted items. Matched before UNPACK_RULES. -# - -BLACKLIST_RULES = [ -'*__MACOSX*', -'*/.DS_Store', -] - -def blacklist(file_list): - result = [] - for file_name in file_list: - match = False - for blacklist_rule in BLACKLIST_RULES: - match = fnmatch.fnmatch(file_name, blacklist_rule) - if match: - break - if not match: - result.append(file_name) - return result - -def unzip(zip_file, target_dir): - zip_list = [] - if os.path.isdir(zip_file): - base_dir, sdk_dir = os.path.split(zip_file.replace('\\', '/').rstrip('/')) - base_dir_length = len(base_dir) + 1 if base_dir else 0 - if not 'T9Write' in sdk_dir: - print("Error: The input directory name '" + sdk_dir + "' does not contain 'T9Write'.") - print("Please unzip the file to a directory named after the zip file and try again.") - return zip_list - for root, dirs, files in os.walk(zip_file): - for file_name in files: - sub_dir = root[base_dir_length:] - dst_dir = os.path.join(target_dir, sub_dir) - if not os.path.exists(dst_dir): - os.makedirs(dst_dir) - shutil.copy2(os.path.join(root, file_name), dst_dir) - os.chmod(os.path.join(dst_dir, file_name), 0o644) - zip_list.append(os.path.join(sub_dir, file_name).replace('\\', '/')) - return zip_list - with zipfile.ZipFile(zip_file, 'r') as z: - zip_list = sorted(blacklist(z.namelist())) - zip_basename = os.path.splitext(os.path.basename(zip_file))[0] - if zip_list and zip_basename in zip_list[0]: - zip_basename = '' - zip_list = [os.path.join(zip_basename, zip_name).replace('\\', '/') for zip_name in zip_list] - z.extractall(os.path.join(target_dir, zip_basename)) - return zip_list - -def match_file_list(file_list, base_dir, fnpattern): - return [file_name for file_name in file_list \ - if fnmatch.fnmatch(file_name, fnpattern) and \ - os.path.isfile(os.path.join(base_dir, file_name))] - -def unpack(zip_list, zip_dir, out_dir): - if not zip_list: - return - - for unpack_rules in UNPACK_RULES: - process_unpack_rules(zip_list, zip_dir, out_dir, unpack_rules) - -def process_unpack_rules(zip_list, zip_dir, out_dir, unpack_rules): - for (target_dir, match_rules) in unpack_rules.items(): - for match_rule in match_rules: - # Match - match_rule_group = match_rule if isinstance(match_rule, list) else [match_rule] - match_group_candidates = [match_file_list(zip_list, zip_dir, match_rule_group[0])] - if len(match_rule_group) > 1: - while len(match_group_candidates[0]) > 0: - match_group0_candidate = match_group_candidates[0][0] - all_sub_groups_match = True - for sub_group_rule in match_rule_group[1:]: - fnpattern = os.path.join(os.path.dirname(match_group0_candidate), sub_group_rule).replace('\\', '/') - sub_group_candidates = match_file_list(zip_list, zip_dir, fnpattern) - if not sub_group_candidates: - all_sub_groups_match = False - break - match_group_candidates.append(sub_group_candidates) - if all_sub_groups_match: - match_group_candidates[0] = [match_group0_candidate] - break - else: - match_group_candidates = [match_group_candidates[0][1:]] - - # Copy - if match_group_candidates: - for match_group_candidate in match_group_candidates: - for zip_name in match_group_candidate: - dst_dir = os.path.join(out_dir, target_dir) - if not os.path.exists(dst_dir): - os.makedirs(dst_dir) - src = os.path.join(zip_dir, zip_name).replace('\\', '/') - dst = os.path.join(dst_dir, os.path.basename(zip_name)).replace('\\', '/') - print(zip_name + ' -> ' + dst) - shutil.copy2(src, dst) - zip_list.remove(zip_name) - -if __name__ == '__main__': - if len(sys.argv) != 3: - print("Usage: %s <filename.zip> <target dir>" % os.path.basename(__file__)) - exit() - - out_dir = sys.argv[2] - zip_dir = tempfile.mkdtemp() - - try: - unpack(unzip(sys.argv[1], zip_dir), zip_dir, out_dir) - except Exception as e: - print(e) - finally: - shutil.rmtree(zip_dir) |