diff --git a/ShareMemoryDrv/CMakeLists.txt b/ShareMemoryDrv/CMakeLists.txt index 6a0b408..814430f 100644 --- a/ShareMemoryDrv/CMakeLists.txt +++ b/ShareMemoryDrv/CMakeLists.txt @@ -18,39 +18,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv option(TEST_MODE TRUE) -# Set the location where the SDK is stored. Only iwingplugin.h and settingpage.h -# are required. - -# 设置存放 SDK 的位置,只须 iwingplugin.h 和 settingpage.h 存在 - -# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -set(WINGHEX_SDK "${CMAKE_CURRENT_SOURCE_DIR}/../src/plugin") - -set(PLUGIN_INTERFACE_BASE_FOUND FALSE) -set(PLUGIN_INTERFACE_FOUND FALSE) -set(PLUGIN_SETPAGE_FOUND FALSE) -if(EXISTS "${WINGHEX_SDK}/iwingpluginbase.h") - set(PLUGIN_INTERFACE_BASE_FOUND TRUE) -endif() -if(EXISTS "${WINGHEX_SDK}/iwingdevice.h") - set(PLUGIN_INTERFACE_FOUND TRUE) -endif() -if(EXISTS "${WINGHEX_SDK}/settingpage.h") - set(PLUGIN_SETPAGE_FOUND TRUE) -endif() -if(PLUGIN_INTERFACE_FOUND - AND PLUGIN_INTERFACE_BASE_FOUND - AND PLUGIN_SETPAGE_FOUND) - message(STATUS "${WINGHEX_SDK} is valid SDK path") -else() - message(FATAL_ERROR "Invalid SDK path!") -endif() - -set(WINGHEX_SDK_HEADER - "${WINGHEX_SDK}/iwingdevice.h" "${WINGHEX_SDK}/iwingpluginbase.h" - "${WINGHEX_SDK}/settingpage.h") -include_directories(${WINGHEX_SDK}) - # For Qt find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools) find_package( @@ -81,7 +48,6 @@ add_plugin_translations_resource(QM_RES shmem ${QM_FILES}) add_library( ShareMemoryDrv SHARED - ${WINGHEX_SDK_HEADER} sharememorydrv.h sharememorydrv.cpp ShareMemoryDrv.json @@ -112,4 +78,4 @@ if(TEST_MODE) $ ${WINGHEX_DRV_PATH}) endif() -target_link_libraries(ShareMemoryDrv PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) +target_link_libraries(ShareMemoryDrv PRIVATE Qt${QT_VERSION_MAJOR}::Widgets WingPlugin) diff --git a/ShareMemoryDrv/lang/shmem_zh_CN.ts b/ShareMemoryDrv/lang/shmem_zh_CN.ts index 8a89f10..6909362 100644 --- a/ShareMemoryDrv/lang/shmem_zh_CN.ts +++ b/ShareMemoryDrv/lang/shmem_zh_CN.ts @@ -4,27 +4,27 @@ SharedMemoryDriver - + SharedMemoryDriver 共享内存驱动 - + An extension for opening sshared memory in WingHexExplorer2. 一个提供羽云十六进制编辑器2的插件打开共享内存的驱动 - + ShareMemory 共享内存 - + SharedMemory 共享内存 - + PleaseInputID: 请输入标识: diff --git a/ShareMemoryDrv/sharedmemory.h b/ShareMemoryDrv/sharedmemory.h index 533d42f..b66cc0a 100644 --- a/ShareMemoryDrv/sharedmemory.h +++ b/ShareMemoryDrv/sharedmemory.h @@ -18,7 +18,7 @@ #ifndef SHAREDMEMORY_H #define SHAREDMEMORY_H -#include "iwingdevice.h" +#include "WingPlugin/iwingdevice.h" #include #include diff --git a/ShareMemoryDrv/sharememorydrv.cpp b/ShareMemoryDrv/sharememorydrv.cpp index 7132d78..1d06a84 100644 --- a/ShareMemoryDrv/sharememorydrv.cpp +++ b/ShareMemoryDrv/sharememorydrv.cpp @@ -25,10 +25,6 @@ SharedMemoryDriver::~SharedMemoryDriver() {} int SharedMemoryDriver::sdkVersion() const { return WingHex::SDKVERSION; } -const QString SharedMemoryDriver::signature() const { - return WingHex::WINGSUMMER; -} - bool SharedMemoryDriver::init(const std::unique_ptr &set) { Q_UNUSED(set); return true; @@ -72,9 +68,8 @@ QIcon SharedMemoryDriver::supportedFileIcon() const { QString SharedMemoryDriver::onOpenFileBegin() { bool ok; - auto id = - emit inputbox.getText(nullptr, tr("SharedMemory"), tr("PleaseInputID:"), - QLineEdit::Normal, {}, &ok); + auto id = getText(nullptr, tr("SharedMemory"), tr("PleaseInputID:"), + QLineEdit::Normal, {}, &ok); if (!ok) { return {}; } diff --git a/ShareMemoryDrv/sharememorydrv.h b/ShareMemoryDrv/sharememorydrv.h index b96e2d3..6defbbf 100644 --- a/ShareMemoryDrv/sharememorydrv.h +++ b/ShareMemoryDrv/sharememorydrv.h @@ -18,7 +18,7 @@ #ifndef SHAREDMEMORYDRIVER_H #define SHAREDMEMORYDRIVER_H -#include "iwingdevice.h" +#include "WingPlugin/iwingdevice.h" class SharedMemoryDriver final : public WingHex::IWingDevice { Q_OBJECT @@ -35,7 +35,6 @@ public: // IWingPlugin interface public: virtual int sdkVersion() const override; - virtual const QString signature() const override; virtual bool init(const std::unique_ptr &set) override; virtual void unload(std::unique_ptr &set) override; virtual const QString pluginName() const override; diff --git a/TestPlugin/CMakeLists.txt b/TestPlugin/CMakeLists.txt index 71bf4c7..9ba9585 100644 --- a/TestPlugin/CMakeLists.txt +++ b/TestPlugin/CMakeLists.txt @@ -44,7 +44,6 @@ add_plugin_translations_resource(QM_RES TestPlugin ${QM_FILES}) add_library( TestPlugin SHARED - ${WINGHEX_SDK_HEADER} testplugin.h testplugin.cpp TestPlugin.json diff --git a/qt-template/README.md b/qt-template/README.md deleted file mode 100644 index 1da9119..0000000 --- a/qt-template/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Qt-Template - -  该目录是模板目录,用于存放与插件开发的相关模板,极大的提高开发 WingHexExploer2 的插件便利性。 - -  目前该目录下只有一个`winghexplugin`,这个存放着 QT 认可的项目模板向导相关文件。而`qt-template-installer.py`是安装管理器,用于方便模板的卸载和安装,你可以使用以下方式进行安装/卸载: - -```bash -python3 qt-template-installer.py install # 安装模板 -python3 qt-template-installer.py uninstall # 卸载模板 -``` - -  当然,你可以手动进行安装,只需把`winghexplugin`拷贝到对应的模板存放目录,具体请看 [官方文档](https://docs.huihoo.com/qt/qtcreator/4.2/creator-project-wizards.html#locating-wizards) 。 - -  安装完毕之后,你在新建项目的 Library 分类下将会看到你已经安装好的模板: - -![模板](screenshot.png) - -  它和创建`Qt Creator Plugin`的逻辑比较相像,但有不同之处,就是需要指定插件版本和开发库目录以及主程序目录: - -![详情](image.png) - -  `SDK Paths`填写开发头文件放置的位置,`WingHexExplorer2 Installation`填写安装该十六进制编辑器的安装目录,这里启动程序 **请不要填写安装器给你安装的目录位置,因为启动测试模式会把编译的测试 Dll 拷贝到插件目录,如果没有管理员权限会导致拷贝失败。** 这个软件可以认为是绿色软件的性质,只是建立了文件关联和在个人电脑保存了配置。完全可以把安装目录单独拷贝到一个不需要管理员权限的位置然后继续。 - -![选择构建](image-1.png) - -  在选择构建套件时候一定要注意你开发插件的套件的 QT 版本一定要和`WingHexExplorer2`保持一致,不然开发编译之后的插件会因为 Qt 版本检查不通过导致插件无法加载。详细的 QT 版本细节可以到 **软件设置** 的 **基本** 下查看,如下图所示: - -![Qt 版本查看](image-2.png) - -  最后祝你开发插件愉快! diff --git a/qt-template/image-1.png b/qt-template/image-1.png deleted file mode 100644 index 96b2e39..0000000 Binary files a/qt-template/image-1.png and /dev/null differ diff --git a/qt-template/image-2.png b/qt-template/image-2.png deleted file mode 100644 index dee85cd..0000000 Binary files a/qt-template/image-2.png and /dev/null differ diff --git a/qt-template/image.png b/qt-template/image.png deleted file mode 100644 index a5dad22..0000000 Binary files a/qt-template/image.png and /dev/null differ diff --git a/qt-template/qt-template-installer.py b/qt-template/qt-template-installer.py deleted file mode 100644 index 9c3363f..0000000 --- a/qt-template/qt-template-installer.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding:utf-8 -*- -# @Time : 2024/12/27 -# @Author : 寂静的羽夏(wingsummer) -# @FileName: qt-template-installer.py - -import argparse -import sys -import os -import shutil -import pathlib -from colorama import Fore, Style - -def install(): - installer_path = os.path.dirname(os.path.abspath(__file__)) - install_path = os.path.join(getQtTemplateDir(), "winghexplugin") - shutil.rmtree(install_path, ignore_errors=True) # uninstall first - shutil.copytree(os.path.join(installer_path, "winghexplugin"), - install_path, dirs_exist_ok=True) - print(Fore.GREEN + "WingHexExplorer2 plugin Template was installed under: " + install_path + Style.RESET_ALL) - -def uninstall(): - install_path = os.path.join(getQtTemplateDir(), "winghexplugin") - shutil.rmtree(install_path) - print(Fore.RED + "WingHexExplorer2 plugin Template was removed: " + install_path + Style.RESET_ALL) - - -def getQtTemplateDir() -> pathlib.Path: - # https://docs.huihoo.com/qt/qtcreator/4.2/creator-project-wizards.html#locating-wizards - home = pathlib.Path.home() - if sys.platform == "win32": - return home / "AppData/Roaming/QtProject/qtcreator/templates/wizards" - else: - return home / ".config/QtProject/qtcreator/templates/wizards" - -def main(): - parser = argparse.ArgumentParser( - prog="qt-template-installer.py", description=f"A WingHexExplorer2 Plugin tempalte installer for QT.") - parser.add_argument( - "action", - choices=["install", "uninstall"], - nargs="?", - help="Action to perform: install or uninstall." - ) - - args = parser.parse_args() - - # checking build toolkits - if args.action == "install": - install() - elif args.action == "uninstall": - uninstall() - - exit(0) - - - -if __name__ == "__main__": - main() -else: - print( - Fore.RED + "[Error] Please run this script in main mode" + Style.RESET_ALL) \ No newline at end of file diff --git a/qt-template/requirements.txt b/qt-template/requirements.txt deleted file mode 100644 index e9405b3..0000000 --- a/qt-template/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -colorama==0.4.6 diff --git a/qt-template/screenshot.png b/qt-template/screenshot.png deleted file mode 100644 index bf620ff..0000000 Binary files a/qt-template/screenshot.png and /dev/null differ diff --git a/qt-template/winghexplugin/.clang-format b/qt-template/winghexplugin/.clang-format deleted file mode 100644 index c61c172..0000000 --- a/qt-template/winghexplugin/.clang-format +++ /dev/null @@ -1,150 +0,0 @@ ---- -Language: Cpp -# BasedOnStyle: LLVM -AccessModifierOffset: -4 -AlignAfterOpenBracket: Align -AlignConsecutiveMacros: false -AlignConsecutiveAssignments: false -AlignConsecutiveBitFields: false -AlignConsecutiveDeclarations: false -AlignEscapedNewlines: Right -AlignOperands: Align -AlignTrailingComments: true -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: true -AllowShortBlocksOnASingleLine: Never -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All -AllowShortLambdasOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Never -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: Never - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false - BeforeLambdaBody: false - BeforeWhile: false - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Attach -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DeriveLineEnding: true -DerivePointerAlignment: false -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IncludeBlocks: Preserve -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - SortPriority: 0 - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 - SortPriority: 0 - - Regex: '.*' - Priority: 1 - SortPriority: 0 -IncludeIsMainRegex: '(Test)?$' -IncludeIsMainSourceRegex: '' -IndentCaseLabels: false -IndentCaseBlocks: false -IndentGotoLabels: true -IndentPPDirectives: None -IndentExternBlock: AfterExternBlock -IndentWidth: 4 -IndentWrappedFunctionNames: false -InsertTrailingCommas: None -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 -ObjCBreakBeforeNestedBlockParam: true -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right -ReflowComments: true -SortIncludes: true -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInConditionalStatement: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -BitFieldColonSpacing: Both -Standard: Latest -StatementMacros: - - Q_UNUSED - - QT_REQUIRE_VERSION -TabWidth: 8 -UseCRLF: false -UseTab: Never -WhitespaceSensitiveMacros: - - STRINGIZE - - PP_STRINGIZE - - BOOST_PP_STRINGIZE -... - diff --git a/qt-template/winghexplugin/.cmake-format.py b/qt-template/winghexplugin/.cmake-format.py deleted file mode 100644 index 2b405a3..0000000 --- a/qt-template/winghexplugin/.cmake-format.py +++ /dev/null @@ -1,20 +0,0 @@ -# ----------------------------- -# Options effecting formatting. -# ----------------------------- -with section("format"): - - # How wide to allow formatted cmake files - line_width = 80 - - # How many spaces to tab for indent - tab_size = 4 - - # If true, separate flow control names from their parentheses with a space - separate_ctrl_name_with_space = False - - # If true, separate function names from parentheses with a space - separate_fn_name_with_space = False - - # If a statement is wrapped to more than one line, than dangle the closing - # parenthesis on its own line. - dangle_parens = False diff --git a/qt-template/winghexplugin/CMakeLists.txt b/qt-template/winghexplugin/CMakeLists.txt deleted file mode 100644 index 9d1c7c8..0000000 --- a/qt-template/winghexplugin/CMakeLists.txt +++ /dev/null @@ -1,123 +0,0 @@ -cmake_minimum_required(VERSION 3.16) - -project(%{ProjectName} LANGUAGES CXX) - -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(CMAKE_INCLUDE_CURRENT_DIR TRUE) - -if(MSVC) - string(APPEND CMAKE_CXX_FLAGS " /utf-8") - string(APPEND CMAKE_C_FLAGS " /utf-8") -endif() - -option(TEST_MODE TRUE) - -if(NOT EXISTS "${WINGHEX_SDK}") - message(FATAL_ERROR "Please config the SDK Path - WINGHEX_SDK") -endif() - -set(PLUGIN_INTERFACE_BASE_FOUND FALSE) -set(PLUGIN_INTERFACE_FOUND FALSE) -set(PLUGIN_SETPAGE_FOUND FALSE) -if(EXISTS "${WINGHEX_SDK}/iwingpluginbase.h") - set(PLUGIN_INTERFACE_BASE_FOUND TRUE) -endif() -if(EXISTS "${WINGHEX_SDK}/iwingplugin.h") - set(PLUGIN_INTERFACE_FOUND TRUE) -endif() -if(EXISTS "${WINGHEX_SDK}/settingpage.h") - set(PLUGIN_SETPAGE_FOUND TRUE) -endif() -if(PLUGIN_INTERFACE_FOUND - AND PLUGIN_INTERFACE_BASE_FOUND - AND PLUGIN_SETPAGE_FOUND) - message(STATUS "${WINGHEX_SDK} is valid SDK path") -else() - message(FATAL_ERROR "Invalid SDK path!") -endif() - -set(WINGHEX_SDK_HEADER - "${WINGHEX_SDK}/iwingplugin.h" "${WINGHEX_SDK}/iwingpluginbase.h" - "${WINGHEX_SDK}/settingpage.h") -include_directories(${WINGHEX_SDK}) - -find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools) -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools) - -@if %{HasTranslation} -set(TS_FILES %{TsFileName}) - -set(TRANSLATION_PATH ${CMAKE_CURRENT_SOURCE_DIR}) - -if(${QT_VERSION_MAJOR} EQUAL 5) - qt5_create_translation(QM_FILES ${TRANSLATION_PATH} ${TS_FILES}) -elseif(${QT_VERSION_MAJOR} EQUAL 6) - qt6_create_translation(QM_FILES ${TRANSLATION_PATH} ${TS_FILES}) -else() - message(FATAL_ERROR "Unsupported QT version") -endif() - -include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/TranslationUtils.cmake) -add_plugin_translations_resource(QM_RES %{ProjectName} ${QM_FILES}) -@else -## Example for WingHexExplorer2 Plugin Localization - -# set(TS_FILES ) - -# set(TRANSLATION_PATH ${CMAKE_CURRENT_SOURCE_DIR}) - -# if(${QT_VERSION_MAJOR} EQUAL 5) -# qt5_create_translation(QM_FILES ${TRANSLATION_PATH} ${TS_FILES}) -# elseif(${QT_VERSION_MAJOR} EQUAL 6) -# qt6_create_translation(QM_FILES ${TRANSLATION_PATH} ${TS_FILES}) -# else() -# message(FATAL_ERROR "Unsupported QT version") -# endif() - -# include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/TranslationUtils.cmake) -# add_plugin_translations_resource(QM_RES %{ProjectName} ${QM_FILES}) -@endif - -add_library(%{ProjectName} SHARED - ${WINGHEX_SDK_HEADER} -@if %{HasTranslation} - ${QM_FILES} - ${QM_RES} -@else - # ${QM_FILES} - # ${QM_RES} -@endif - %{SrcFileName} - %{HdrFileName} - %{PluginJsonFile} -) - -set_target_properties(%{ProjectName} PROPERTIES SUFFIX ".wingplg") - -if(TEST_MODE) - # If you want to be able to debug easily every time you compile, please set - # this variable. Because this test plugin is a subproject of the main - # project, use CMAKE_BINARY_DIR - - if(NOT EXISTS "${WINGHEX_PATH}") - message( - FATAL_ERROR "Please config the WingHexExplorer2 Path - WINGHEX_PATH" - ) - endif() - - set(WINGHEX_PLUGIN_PATH "${WINGHEX_PATH}/plugin") - add_custom_command( - TARGET %{ProjectName} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${WINGHEX_PLUGIN_PATH} - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - ${WINGHEX_PLUGIN_PATH}) -endif() - -target_link_libraries(%{ProjectName} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) diff --git a/qt-template/winghexplugin/MyPlugin.json.in b/qt-template/winghexplugin/MyPlugin.json.in deleted file mode 100644 index 847adca..0000000 --- a/qt-template/winghexplugin/MyPlugin.json.in +++ /dev/null @@ -1,12 +0,0 @@ -{ - \"Id\" : \"%{JS: value('PluginName').toLowerCase()}\", - \"Name\" : \"%{PluginName}\", - \"Version\" : \"0.0.1\", - \"Vendor\" : \"%{VendorName}\", - \"Dependencies\": [ - - ], - \"Author\" : \"%{Author}\", - \"License\" : \"%{License}\", - \"Url\" : \"%{Url}\" -} diff --git a/qt-template/winghexplugin/cmake/LICENSE.txt b/qt-template/winghexplugin/cmake/LICENSE.txt deleted file mode 100644 index c27ac62..0000000 --- a/qt-template/winghexplugin/cmake/LICENSE.txt +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2019-2022, Pedro López-Cabanillas -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/qt-template/winghexplugin/cmake/TranslationUtils.cmake b/qt-template/winghexplugin/cmake/TranslationUtils.cmake deleted file mode 100644 index a2321ce..0000000 --- a/qt-template/winghexplugin/cmake/TranslationUtils.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# ============================================================================== -# Copyright (C) 2024-2027 WingSummer -# -# You can redistribute this file and/or modify it under the terms of the BSD -# 3-Clause. -# -# THIS FILE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# ============================================================================= - -if(NOT TARGET Qt${QT_VERSION_MAJOR}::lconvert) - message( - FATAL_ERROR - "The package \\"Qt${QT_VERSION_MAJOR}LinguistTools\\" is required.") -endif() - -set(Qt_LCONVERT_EXECUTABLE Qt${QT_VERSION_MAJOR}::lconvert) - -function(ADD_PLUGIN_TRANSLATIONS_RESOURCE res_file target) - set(_qm_files ${ARGN}) - set(_res_file ${CMAKE_CURRENT_BINARY_DIR}/app_translations.qrc) - - file( - WRITE ${_res_file} - "\\n \\n" - ) - foreach(_lang ${_qm_files}) - get_filename_component(_filename ${_lang} NAME) - file(APPEND ${_res_file} " ${_filename}\\n") - endforeach() - file(APPEND ${_res_file} " \\n\\n") - - set(${res_file} - ${_res_file} - PARENT_SCOPE) -endfunction() - -add_custom_target( - lupdate - COMMAND ${Qt${QT_VERSION_MAJOR}_LUPDATE_EXECUTABLE} -recursive - ${PROJECT_SOURCE_DIR} -ts *.ts - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMENT "Updating translations") diff --git a/qt-template/winghexplugin/git.ignore b/qt-template/winghexplugin/git.ignore deleted file mode 100644 index ab0726c..0000000 --- a/qt-template/winghexplugin/git.ignore +++ /dev/null @@ -1,80 +0,0 @@ -# This file is used to ignore files which are generated -# ---------------------------------------------------------------------------- - -*~ -*.autosave -*.a -*.moc -*.o -*.obj -*.orig -*.rej -*.so -*.so.* -*_pch.h.cpp -*_resource.rc -*.qm -.#* -*.*# -tags -.DS_Store -.directory -*.debug -Makefile* -*.prl -*.app -moc_*.cpp -ui_*.h -qrc_*.cpp -Thumbs.db -*.res -*.rc -*.deb -*.rpm -RC* -!app.rc -!favicon.rc - -/.qmake.cache -/.qmake.stash - -# qtcreator generated files -build/ -*.pro.user* -CMakeLists.txt.user* - -# xemacs temporary files -*.flc - -# Vim temporary files -.*.swp - -# Visual Studio generated files -*.ib_pdb_index -*.idb -*.ilk -*.pdb -*.sln -*.suo -*.vcproj -*vcproj.*.*.user -*.ncb -*.sdf -*.opensdf -*.vcxproj -*vcxproj.* - -# MinGW generated files -*.Debug -*.Release - -# Python byte code -*.pyc - -# Binaries -# -------- -*.dll -*.exe - -#VSCode -.vscode/ diff --git a/qt-template/winghexplugin/lib.cpp b/qt-template/winghexplugin/lib.cpp deleted file mode 100644 index 00393b9..0000000 --- a/qt-template/winghexplugin/lib.cpp +++ /dev/null @@ -1,26 +0,0 @@ -%{Cpp:LicenseTemplate}\ -#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}" - -%{CN}::%{CN}() : WingHex::IWingPlugin(){ -} - -%{CN}::~%{CN}() {} - -int %{CN}::sdkVersion() const { return WingHex::SDKVERSION; } - -const QString %{CN}::signature() const { return WingHex::WINGSUMMER; } - -bool %{CN}::init(const std::unique_ptr &set) { - // Your codes there - return true; -} - -void %{CN}::unload(std::unique_ptr &set) { - // Your unloading codes here -} - -const QString %{CN}::pluginName() const { return tr("%{CN}"); } - -const QString %{CN}::pluginComment() const { - return tr("%{Description}%"); -} diff --git a/qt-template/winghexplugin/lib.h b/qt-template/winghexplugin/lib.h deleted file mode 100644 index 26a8874..0000000 --- a/qt-template/winghexplugin/lib.h +++ /dev/null @@ -1,39 +0,0 @@ -%{Cpp:LicenseTemplate}\ -@if '%{Cpp:PragmaOnce}' -#pragma once -@else -#ifndef %{GUARD} -#define %{GUARD} -@endif - -#include "iwingplugin.h" - -class %{CN} final : public WingHex::IWingPlugin { - Q_OBJECT - Q_PLUGIN_METADATA(IID "com.wingsummer.iwingplugin" FILE "%{PluginJsonFile}") - Q_INTERFACES(WingHex::IWingPlugin) - -public: - explicit %{CN}(); - virtual ~%{CN}(); - -// If you are writing codes with QtCreator, -// you can press Alt+Enter in a empty line or line with spaces only to -// trigger "Insert Virtual Functions of Base Classes" to select optional -// virtual functions you want to implement. - -public: - virtual int sdkVersion() const override; - virtual const QString signature() const override; - virtual bool init(const std::unique_ptr &set) override; - virtual void unload(std::unique_ptr &set) override; - virtual const QString pluginName() const override; - virtual const QString pluginComment() const override; - -private: - // Your private members -}; - -@if ! '%{Cpp:PragmaOnce}' -#endif // %{GUARD} -@endif diff --git a/qt-template/winghexplugin/winghexplugin.png b/qt-template/winghexplugin/winghexplugin.png deleted file mode 100644 index 8cf085d..0000000 Binary files a/qt-template/winghexplugin/winghexplugin.png and /dev/null differ diff --git a/qt-template/winghexplugin/winghexplugin@2x.png b/qt-template/winghexplugin/winghexplugin@2x.png deleted file mode 100644 index 3402a17..0000000 Binary files a/qt-template/winghexplugin/winghexplugin@2x.png and /dev/null differ diff --git a/qt-template/winghexplugin/wizard.json b/qt-template/winghexplugin/wizard.json deleted file mode 100644 index d09ddc7..0000000 --- a/qt-template/winghexplugin/wizard.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "version": 1, - "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject" ], - "id": "H.WingHex2Plugin", - "category": "G.Library", - "trDescription": "Creates a plugin for WingHexExplorer2.", - "trDisplayName": "WingHexExplorer2 Plugin", - "trDisplayCategory": "Library", - "icon": "winghexplugin.png", - "iconKind": "Themed", - "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && value('Plugins').indexOf('CMakeProjectManager') >= 0 }", - - "options": - [ - { "key": "ProjectFile", "value": "%{JS: value('CMakeFile') }" }, - { "key": "PluginNameLower", "value": "%{JS: value('PluginName').toLowerCase()}"}, - { "key": "PluginJsonFile", "value": "%{JS: Util.fileName(value('PluginName'), 'json.in')}" }, - { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, - { "key": "PluginJsonFile", "value": "%{JS: Util.fileName(value('ProjectName'), 'json')}" }, - { "key": "SrcFileName", "value": "%{JS: Util.fileName(value('PluginNameLower'), Util.preferredSuffix('text/x-c++src'))}" }, - { "key": "HdrFileName", "value": "%{JS: Util.fileName(value('PluginNameLower'), Util.preferredSuffix('text/x-c++hdr'))}" }, - { "key": "BaseClassName", "value": "%{JS: value('BaseClassInfo').BaseClassName }" }, - { "key": "CN", "value": "%{JS: Cpp.className(value('PluginName'))}" }, - { "key": "GUARD", "value": "%{JS: Cpp.headerGuard(value('HdrFileName'))}" }, - { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" } - ], - - "pages": - [ - { - "trDisplayName": "Project Location", - "trShortTitle": "Location", - "typeId": "Project", - "data": { "trDescription": "This wizard creates a plugin for WingHexExplorer2." } - }, - { - "trDisplayName": "Define Project Details", - "trShortTitle": "Details", - "typeId": "Fields", - "data": - [ - { - "name": "ClassPageDescription", - "type": "Label", - "data": - { - "trText": "Specify details about your WingHexExplorer2 plugin.", - "wordWrap": true - } - }, - { - "name": "PluginName", - "trDisplayName": "Plugin name:", - "mandatory": true, - "type": "LineEdit", - "data": - { - "validator": "[a-zA-Z_][a-zA-Z_0-9]*", - "text": "%{JS: value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1)}" - } - }, - { - "name": "VendorName", - "persistenceKey": "VendorName", - "trDisplayName": "Vendor name:", - "mandatory": true, - "type": "LineEdit", - "data": - { - "trText": "MyCompany" - } - }, - { - "name": "Author", - "trDisplayName": "Author:", - "mandatory": true, - "type": "LineEdit", - "data": - { - "trText": "MyName" - } - }, - { - "name": "License", - "trDisplayName": "License:", - "mandatory": true, - "type": "LineEdit", - "data": - { - "trText": "Put short license information here" - } - }, - { - "name": "Url", - "persistenceKey": "VendorUrl", - "trDisplayName": "URL:", - "mandatory": true, - "type": "LineEdit", - "data": - { - "text": "https://www.%{JS: encodeURIComponent(value('VendorName').toLowerCase())}.com" - } - } - ] - }, - { - "trDisplayName": "Translation File", - "trShortTitle": "Translation", - "data": { "enabled": "yes" }, - "typeId": "QtTranslation" - }, - { - "trDisplayName": "Kit Selection", - "trShortTitle": "Kits", - "typeId": "Kits", - "data": { "projectFilePath": "%{ProjectFile}" } - }, - - { - "trDisplayName": "Project Management", - "trShortTitle": "Summary", - "typeId": "Summary" - } - ], - "generators": - [ - { - "typeId": "File", - "data": - [ - { - "source": "CMakeLists.txt", - "openAsProject": true - }, - { - "source": "lib.cpp", - "target": "%{SrcFileName}", - "openInEditor": true - }, - { - "source": "lib.h", - "target": "%{HdrFileName}" - }, - { - "source": "cmake/TranslationUtils.cmake", - "target": "cmake/TranslationUtils.cmake" - }, - { - "source": "cmake/LICENSE.txt", - "target": "cmake/LICENSE.txt" - }, - { - "source": "MyPlugin.json.in", - "target": "%{PluginJsonFile}" - }, - { - "source": "git.ignore", - "target": ".gitignore" - }, - { - "source": ".clang-format", - "target": ".clang-format" - }, - { - "source": ".cmake-format.py", - "target": ".cmake-format.py" - } - ] - } - ] -} diff --git a/src/class/wingcstruct.h b/src/class/wingcstruct.h index a51661b..1609fda 100644 --- a/src/class/wingcstruct.h +++ b/src/class/wingcstruct.h @@ -27,7 +27,7 @@ class CScriptArray; class WingCStruct : public WingHex::IWingPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "com.wingsummer.iwingplugin") + Q_INTERFACES(WingHex::IWingPlugin) public: explicit WingCStruct();