diff --git a/.gitee/Dockerfile b/.gitee/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..826791b9a1a370a4ac519bbecc626b8e1d199485 --- /dev/null +++ b/.gitee/Dockerfile @@ -0,0 +1,4 @@ +FROM shenmo7192/uos-21-dtk5.4:1.0 +ADD . /root/workdir +WORKDIR /root/workdir +RUN dpkg-buildpackage diff --git a/.gitee/callback.py b/.gitee/callback.py new file mode 100644 index 0000000000000000000000000000000000000000..6abf80e9ca30498011f4bd7bfdacd3030fdeca4d --- /dev/null +++ b/.gitee/callback.py @@ -0,0 +1,31 @@ +import os +import requests +import json + + +# sha=os.system("git rev-parse HEAD") +sha = os.getenv("GIT_COMMIT") +# sha = '48fed26c51a8c42554e45f72f43e49703e04c97f' +#get sha from environment +url = "https://gitee.com/api/v5/repos/spark-store-project/spark-store/commits/{}/comments".format(sha) + +token = os.getenv("gitee_token") + +# process = os.popen("git symbolic-ref --short -q HEAD") + +body = "构建详情请见" + os.getenv("JENKINS_URL") + "blue/organizations/jenkins/" + os.getenv("JOB_NAME").replace("/", "/detail/") + "/" + str(os.getenv("BUILD_ID")) + +# process.close() + +d = { + 'access_token': token, + "body": body +} + +h = { + "Content-Type": "application/json;charset=UTF-8" +} + +res = requests.post(url,headers=h, data=json.dumps(d)) +# print(res.status_code) +# print(res.content) \ No newline at end of file diff --git a/.gitignore b/.gitignore index 79c9ac747f0c3456ff6cb7038d7f8ccbded49aa5..709ed4d9d80aee932cb1d1fe684dc6a7ab47881c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,3 @@ -build -.vscode -.cache -CMakeLists.txt.user -CMakeLists.txt.user.* -obj-x86_64-linux-gnu # C++ objects and libs *.slo *.lo @@ -12,6 +6,7 @@ obj-x86_64-linux-gnu *.la *.lai *.so +*.so.* *.dll *.dylib @@ -34,13 +29,12 @@ ui_*.h *.jsc Makefile* *build-* +*.qm +*.prl # Qt unit tests target_wrapper.* -# Qt qm files -translations/*.qm - # QtCreator *.autosave @@ -50,13 +44,23 @@ translations/*.qm # QtCreator CMake CMakeLists.txt.user* -build -# Debian dpkg-buildpackage +# QtCreator 4.8< compilation database +compile_commands.json + +# QtCreator local machine specific files for imported projects +*creator.user* + +*_qmlcache.qrc + +# debian debian/*.debhelper* debian/files debian/*.substvars -debian/spark-update-tool +debian/spark-store -.vscode/* -src/spark-update-tool +# Others +build +obj-* +.vscode +.cache \ No newline at end of file diff --git a/.workflow/dtk-build-commit-20220425.yml b/.workflow/dtk-build-commit-20220425.yml new file mode 100644 index 0000000000000000000000000000000000000000..807bb7cc0c90452e8c6a8b6a699cebc3eb67be57 --- /dev/null +++ b/.workflow/dtk-build-commit-20220425.yml @@ -0,0 +1,39 @@ +version: '1.0' +name: dtk-build-commit-20220425 +displayName: dtk-build-commit +triggers: + trigger: auto + pr: + branches: + prefix: + - '' +stages: + - name: stage-4e566164 + displayName: build + strategy: naturally + trigger: auto + executor: [] + steps: + - step: execute@docker + name: execute_by_docker + displayName: 基于镜像的脚本执行 + certificate: '' + image: docker.io/debian:buster + command: + - sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list + - '# 换源' + - apt update + - export DEBIAN_FRONTEND=noninteractive + - echo "安装git devscripts equivs ..." + - apt install git devscripts equivs curl -y >/dev/null 2>&1 + - git clone https://gitlink.org.cn/shenmo7192/dtk-old-bundle.git + - cd dtk-old-bundle + - apt install ./*.deb -y + - cd .. + - rm -rf dtk-old-bundle + - 'mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes -y" ' + - dpkg-buildpackage -j2 -b -us -uc + - cd .. + - ls -all + - pwd + strategy: {} diff --git a/.workflow/dtk-build-release-tag-20220425.yml b/.workflow/dtk-build-release-tag-20220425.yml new file mode 100644 index 0000000000000000000000000000000000000000..e7631b1027cd954b5f6c7b5132d657493eeeb603 --- /dev/null +++ b/.workflow/dtk-build-release-tag-20220425.yml @@ -0,0 +1,66 @@ +version: '1.0' +name: dtk-build-release-tag-20220425 +displayName: dtk-build-release-tag +triggers: + trigger: manual + push: + tags: + prefix: + - '' +stages: + - name: stage-4e566164 + displayName: build + strategy: naturally + trigger: auto + executor: [] + steps: + - step: execute@docker + name: execute_by_docker + displayName: 基于镜像的DTK构建 + certificate: '' + image: docker.io/debian:buster + command: + - sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list + - '# 换源' + - apt update + - export DEBIAN_FRONTEND=noninteractive + - echo "安装git devscripts equivs curl..." + - 'apt install git devscripts equivs curl -y ' + - git clone https://gitlink.org.cn/shenmo7192/dtk-old-bundle.git + - cd dtk-old-bundle + - apt install ./*.deb -y + - cd .. + - rm -rf dtk-old-bundle + - '' + - 'mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes -y" ' + - dpkg-buildpackage -j2 -b -us -uc + - cd .. + - ls -all + - pwd + - '' + - 'mkdir target ' + - for f in $(find . -type f -name "*.deb") + - do + - ' mv $f target' + - done + artifacts: + - name: BUILD_ARTIFACT + path: + - ../target + notify: [] + strategy: + retry: '0' + - name: stage-29f3ffbb + displayName: 上传 + strategy: naturally + trigger: auto + executor: [] + steps: + - step: publish@general_artifacts + name: publish_general_artifacts + displayName: 上传制品 + dependArtifact: BUILD_ARTIFACT + artifactName: output + notify: [] + strategy: + retry: '0' diff --git a/.workflow/pipeline-dtk-build-aarch64.yml b/.workflow/pipeline-dtk-build-aarch64.yml new file mode 100644 index 0000000000000000000000000000000000000000..1f2561874f92c2454b87598e2b4793935a1d976a --- /dev/null +++ b/.workflow/pipeline-dtk-build-aarch64.yml @@ -0,0 +1,48 @@ +version: '1.0' +name: pipeline-dtk-build-aarch64 +displayName: dtk-build-aarch64 +triggers: + trigger: manual + push: + tags: + prefix: + - '' +stages: + - name: stage-2c12cce1 + displayName: 编译 + strategy: naturally + trigger: auto + executor: [] + steps: + - step: execute@docker + name: execute_by_docker + displayName: 基于镜像的脚本执行 + certificate: '' + image: docker.io/debian:buster + command: + - '# 请在此输入您想执行的脚本' + - sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list + - apt update + - export DEBIAN_FRONTEND=noninteractive + - echo "安装wget qemu-user-static" + - apt install git wget qemu-user-static xz-utils binfmt-support -y + - mkdir ../spark-store-git + - mv * ../spark-store-git + - git clone https://gitlink.org.cn/shenmo7192/debian-container-aarch64.git + - mv debian-container-aarch64/DEBIANARM.tar.xz . + - rm -rf debian-container-aarch64 + - tar -xf DEBIANARM.tar.xz + - mkdir -p DEBIAN/root/build-spark + - mv ../spark-store-git DEBIAN/root/build-spark/spark-store + - wget https://gitee.com/spark-store-project/repo_auto_update_script/raw/master/spark-build-aarch64.sh && mv spark-build-aarch64.sh DEBIAN/root + - mv /usr/bin/qemu-aarch64-static DEBIAN/ + - chroot DEBIAN /qemu-aarch64-static /bin/bash /root/spark-build-aarch64.sh + - '' + - '' + artifacts: + - name: BUILD_ARTIFACT + path: + - ./DEBIAN/root/build-spark/target + notify: [] + strategy: + retry: '0' diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c624b4124ab1ed429631b3c37067b6a54087247..69cbd7a571697beffb8986e24be7987b14d152f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,75 +1,44 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.12) -project(spark-update-tool VERSION 0.1 LANGUAGES CXX) +project(spark-store) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) +if(NOT DEFINED VERSION) + set(VERSION 4.0.0) +endif() +add_compile_definitions(APP_VERSION="${VERSION}") + +execute_process( + COMMAND git symbolic-ref --short -q HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE BRANCH +) +string(STRIP "${BRANCH}" BRANCH) +add_compile_definitions(APP_BRANCH="${BRANCH}") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(AUTOMOC_COMPILER_PREDEFINES ON) -find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network Concurrent) -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network Concurrent) - -set(PROJECT_SOURCES - src/main.cpp - src/mainwindow.cpp - src/mainwindow.h - src/mainwindow.ui -) - -if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) - qt_add_executable(spark-update-tool - MANUAL_FINALIZATION - ${PROJECT_SOURCES} - src/aptssupdater.h src/aptssupdater.cpp - src/icons.qrc - src/appdelegate.h src/appdelegate.cpp - src/applistmodel.h src/applistmodel.cpp - src/downloadmanager.h src/downloadmanager.cpp - ) -# Define target properties for Android with Qt 6 as: -# set_property(TARGET spark-update-tool APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR -# ${CMAKE_CURRENT_SOURCE_DIR}/android) -# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation -else() - if(ANDROID) - add_library(spark-update-tool SHARED - ${PROJECT_SOURCES} - ) -# Define properties for Android with Qt 5 after find_package() calls as: -# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") - else() - add_executable(spark-update-tool - ${PROJECT_SOURCES} - ) - endif() -endif() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall") +if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "sw_64") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mieee") +endif () +if (NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") +endif () -target_link_libraries(spark-update-tool PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Concurrent) +add_compile_definitions(QT_MESSAGELOGCONTEXT) -# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. -# If you are developing for iOS or macOS you should consider setting an -# explicit, fixed bundle identifier manually though. -if(${QT_VERSION} VERSION_LESS 6.1.0) - set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.spark-update-tool) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX /usr) endif() -set_target_properties(spark-update-tool PROPERTIES - ${BUNDLE_ID_OPTION} - MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} - MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} - MACOSX_BUNDLE TRUE - WIN32_EXECUTABLE TRUE -) include(GNUInstallDirs) -install(TARGETS spark-update-tool - BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) -if(QT_VERSION_MAJOR EQUAL 6) - qt_finalize_executable(spark-update-tool) -endif() +add_subdirectory(src) +add_subdirectory(translations) +add_subdirectory(spark-update-tool) \ No newline at end of file diff --git a/DOCS/.keep b/DOCS/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/DOCS/json-api-doc.md b/DOCS/json-api-doc.md new file mode 100644 index 0000000000000000000000000000000000000000..5af00c2087e36260b8d2b59a156068527d3c0e13 --- /dev/null +++ b/DOCS/json-api-doc.md @@ -0,0 +1,48 @@ +# 基本格式 +0. 应用信息 + +例子:https://cdn.d.store.deepinos.org.cn/store/tools/spark-store/app.json + +```json +{ + "Name": "星火应用商店", + "Version": "4.2.7.1", + "Filename": "spark-store_4.2.7.1_amd64.deb", + "Torrent_address": "spark-store_4.2.7.1_amd64.deb.torrent", + "Pkgname": "spark-store", + "Author": "shenmo ", + "Contributor": "shenmo ", + "Website": "https://www.spark-app.store/", + "Update": "2023-09-01 23:22:23", + "Size": "590.5 KB", + "More": "* 修复:aptss加锁失败现在会正常报错\n * 新增:在aptss的特定操作时添加了提示\n * 新增:在aptss提示加粗\n * 调整:ssinstall验证支持使用cdn.d.获取", + "Tags": "community;ubuntu;deepin;uos;dtk5", + "img_urls": "[\"https://examine-spark.oss-cn-shanghai.aliyuncs.com/images/2023/09/01/411c32fd691544bb985ecba87d151ea0.png\",\"https://examine-spark.oss-cn-shanghai.aliyuncs.com/images/2023/09/01/f44b3c2242c045e28f1161980d805e0d.png\",\"https://examine-spark.oss-cn-shanghai.aliyuncs.com/images/2023/09/01/00263ba857894667bd99240558bec69c.png\",\"https://examine-spark.oss-cn-shanghai.aliyuncs.com/images/2023/09/01/6fd248ad9eea4ef18c9c4acc2a9d372d.png\"]", + "icons": "https://examine-spark.oss-cn-shanghai.aliyuncs.com/icons/2023/09/01/a88dd18cc1734396a02e7e3c6be59718.png" +} +``` + +*注意:img_urls和icons的信息不保证有效!大部分是有效的,少部分app.json可能缺失此项目!* + +**对于icon和截图的获取需求请参考第三点** + +1. 对于某分类下的所有应用信息 +`{SOURCE_URL}/{ARCH}/{CATOGARY}/applist.json` +说明:SOURCE_URL:线路链接,目前推荐 https://cdn.d.store.deepinos.org.cn,你也可以使用其他的星火线路 +ARCH:架构文件夹 x86是store或amd64-store,arm是aarch64-store。特别的,如果你使用非https://cdn.d.store.deepinos.org.cn的线路,你可能会发现amd64-store会返回404,因为不是所有的服务器都支持软连接 +CATOGARY:分类目录。参考 https://gitee.com/spark-store-project/spark-store/blob/dev/DOCS/spk-doc.md 中 store 直达的对应关系 + +例子:https://cdn.d.store.deepinos.org.cn/aarch64-store/tools/applist.json + +2. 对于单个应用的应用信息 +`{SOURCE_URL}/{ARCH}/{CATOGARY}/{Package Name}/app.json` +Package Name是包名。可从上级的applist.json读取 + +例子:https://cdn.d.store.deepinos.org.cn/store/tools/spark-store/app.json + +3. 对应用截图和icon的获取 + +`{SOURCE_URL}/{ARCH}/{CATOGARY}/{Package Name}/icon.png` +`{SOURCE_URL}/{ARCH}/{CATOGARY}/{Package Name}/screen_n.png`(n=1-5)(至少为1,不是所有的都有到5. 404是正常的) + + diff --git a/DOCS/spk-doc.md b/DOCS/spk-doc.md new file mode 100644 index 0000000000000000000000000000000000000000..184e2eaafdfa8442ada81e36093a8ccd85df0c14 --- /dev/null +++ b/DOCS/spk-doc.md @@ -0,0 +1,34 @@ +#### 调用参数(spk规则) + +* store直达 + +该url应当遵循这种格式:`spk://store/web分类/包名` + + + +例如: + +[spk://store/games/store.spark-app.hmcl](spk://store/games/store.spark-app.hmcl) + + +可选的web分类: + +| 分类名称 | web分类   | +| -------- | -------------- | +| 网络 | network | +| 社交 | chat | +| 音乐 | music | +| 视频 | video | +| 图像 | image_graphics | +| 游戏 | games | +| 办公 | office | +| 阅读 | reading | +| 开发 | development | +| 工具 | tools | +| 主题 | themes | +| 其他 | others | + + +* search搜索 + +spk://search/pkgname diff --git a/DOCS/write-preview-skeleton.md b/DOCS/write-preview-skeleton.md new file mode 100644 index 0000000000000000000000000000000000000000..19d984bb0dbccebc1ef3e6525afe3c26da25d0f1 --- /dev/null +++ b/DOCS/write-preview-skeleton.md @@ -0,0 +1,82 @@ +# 关于编写 "描述主体结构预览说明" 的规范 + +1. 主体结构预览 + + 一般以 `tree` 命令进行获取目录结构进行展示所需要描述的预览内容。 + +2. 对主体结构中的内容单独说明 + + 并使用所用语言进行非侵入式独立描述,而不是在代码中填充说明与注释。 + + 在单行描述中,尽量不超过您认为最大的字符数量宽度,可以收缩内容的重要性。 + + 在此种说明文档中,尽量使用您所描述的对象支持的代码注释,而不是以白底黑字进行描述。 + + 对于规范的全部:主体结构 + 单独内容中进行简单(而不是简少)的说明。 + +一个简单的例子,例如: 有关项目源代码结构的预览说明 + +- 项目结构预览 + + ``` + . + ├── assets + ├── debian + ├── DOCS + ├── patchs + ├── src + ├── tool + └── translations + + 10 directories, 9 files + ``` + +- 来自 debian 目录的说明 + + ```shell + # 将此项目进行 debian 的标志,基于 debian 系列的发行版可对包含 + # 此种目录的开源项目进行构建 deb 软件包。 + + # 1. 构建软件包(打包) + # 执行 dpkg-buildpackage 命令以尝试构建此软件包 + dpkg-buildpackage + # 如果构建将会在上级目录中产生一个 deb,而源代码目录不会有任何变化。 + + # 如果出现以下内容可忽视,仅需要查看是否已成功构建软件包: + # gpg: 已跳过 "": 无效的用户ID + # gpg: ...: clear-sign failed: 无效的用户ID + # dpkg-buildpackage: error: failed to sign .dsc file + ``` + +- 来自 patchs 目录的说明 + + ```shell + # 一种用于可扩展的补丁,主要目的是为项目提供可选的应用方案,而不是直接堆砌到 + # 当前项目的分支中。您可以认为所有分支都是主线分支。 + # 例如: + # 主线稳定分支: master + # 主线开发分支: dev + # 主线其它: ... + + # 注意: + # 当您认为您所提交的内容并不会为主线带来 bug fix 之类的内容,请使用补丁。 + # 当您所提交的内容会带来不可预知的问题的时候,或会改变目前主线的开发模式时, + # 此种方式可确保您提交的方案可被任意时间被弃用,而不是由其它维护者耗费精力 + # 去试图移除您提交的内容,而不是等待由提交者进行新的维护。 + ``` + +- 来自其它的内容...可随时由任何人进行补充 + + +- 一些在关此种预览描述的文档 + + ```shell + # 此种描述还将出现在 `src/README.md` 的描述中。 + # 当然,我预期会由其它维护者进行移动到 `DOCS` 之下。 + + # 另外在 `patchs/zinface-community-cmake-build-system.patch` 补丁文件中, + # 也随附过一个简要的文档内容,而它是记录了 `Spark` 为名的构建模式。 + + # 在未应用此补丁时,将不会出现在任何地方。 + ``` + \ No newline at end of file diff --git "a/DOCS/\345\206\205\347\275\221\351\203\250\347\275\262.md" "b/DOCS/\345\206\205\347\275\221\351\203\250\347\275\262.md" new file mode 100644 index 0000000000000000000000000000000000000000..7fa01ec1ee7c4d236017b3662616dfabe0facce1 --- /dev/null +++ "b/DOCS/\345\206\205\347\275\221\351\203\250\347\275\262.md" @@ -0,0 +1,7 @@ +需要修改的内容:商店默认源位置,aptss获取apt-fast.conf和sparkstore.list的地址,ssinstall做安装检查的源位置 + +服务器使用update.sh进行同步。 + +为方便使用(其实是早期屎山使然),请将仓库放置于 `/home/ftp/spark-store` + +仓库管理相关代码请移步 [这里](https://gitee.com/spark-store-project/repo_auto_update_script),update.sh请联系 @shenmo 获取 \ No newline at end of file diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 0000000000000000000000000000000000000000..84887892361c163b74c7bd6ef98645ef6f26d656 --- /dev/null +++ b/FAQ.md @@ -0,0 +1,91 @@ +# FAQ +## Spark Store FAQ and Support Guide + +### Introduction +The Spark Store is an application store designed for Linux users, supporting various Linux distributions. Below are some frequently asked questions and their solutions. Please note that this document primarily targets ordinary users unfamiliar with Linux and the `apt` package management system. + +--- + +### Communication and Feedback +**Q: How can I participate in discussions?** +**A:** You can click [this link](https://bbs.spark-app.store/) to enter the Spark Forum for communication. +> 📣 You can also join our QQ Discussion Groups: 872690351 and 865927727. + +--- + +### Difference Between arm64 and amd64 + +#### arm64 + +* Full Name: Advanced RISC Machine 64-bit +* Primary Use: Mainly applied to mobile devices, embedded systems, and some new servers and desktop computers +* Advantages: Low power consumption, high efficiency, suitable for battery-powered and heat-sensitive devices +* Major Manufacturers: Apple, Qualcomm, HiSilicon, Phytium, etc. + +#### amd64 + +* Full Name: AMD 64-bit, also known as x86_64 +* Primary Use: Mainly applied to desktop computers, laptops, and servers +* Advantages: High performance, suitable for compute-intensive applications +* Major Manufacturers: Intel and AMD + +The main difference between the two lies in their instruction sets and application scenarios. amd64 is typically used for high-performance computers and servers, while arm64 is more commonly used in environments with strict power consumption requirements. + +#### How to Check: + +- Open the Linux terminal +- Enter the command `uname -m` or `arch` and press `Enter` +- You will see your computer's processor architecture (e.g., x86_64, aarch64) + +--- + +### Domestic Architecture Support +**Q: My computer uses a domestic architecture. How can I obtain the Spark Store?** +**A:** Currently, the Spark Store supports **ARM** architecture and **LoongArch New World** architecture. You can download deb packages (software installation packages) for arm64 and loong64 architectures. +> ⚠️ Please note that this support is experimental. If you encounter issues, please report them to us via the Spark Forum or QQ Discussion Group. + +--- + +### Dependency Installation Issues +**Q: What if dependency package installation fails?** +**A:** If you are using UOS or deepin, do not install dependencies. Only some Linux distributions require dependency packages. For unsupported distributions, you may need to compile manually. See the [Spark Store Introduction](https://gitee.com/spark-store-project/spark-store/blob/dev/README.md). +> 💡 When errors occur, run `sudo apt update` first and try again. If the issue persists, refer to the above and seek help via communication platforms. + +--- + +### Software Submission and Updates +**Q: Where can I submit software?** +**A:** You can find the "Submit Application" option in the top-right menu of the app store interface. We provide two submission methods: **Submission Tools** and **Online Platform**. + +--- + +### Support for Non-deepin/UOS Users +**Q: Can I use Spark Store if I am not a deepin/UOS user?** +**A:** It can be installed normally on Debian-based distributions. For example, if you use Ubuntu 22.04, install directly. For Ubuntu 20.04 / Debian 10 / Debian 11, install dependencies first. Additionally, experience may not be guaranteed if installed on non-Debian Linux distributions. + +--- + +### Installation Methods +**Q: Can I install using `dpkg -i`?** +**A:** We **strongly advise against this**. In the directory where the package is saved, use `sudo apt install ./spark-store*.deb` or a graphical installer like Gdebi. +> ⚠️ Direct use of `dpkg` generally does not handle software dependencies, potentially causing installation failures or damaging the system's dependency environment. + +--- + +### System Updates +**Q: Will Spark Store affect normal system updates?** +**A:** No. The current version of Spark Store has decoupled its application sources from system sources and will not affect normal system updates. + +--- + +### Reporting Issues and Application Removal +**Q: Some applications are outdated or invalid. I want them removed.** +**A:** You can [report issues here](https://gitee.com/spark-store-project/software_-issue). + +--- + +### Installing Spark Store +If you need to install Spark Store, visit the [Release Page](https://gitee.com/spark-store-project/spark-store/releases), find the latest version, and download the installer suitable for your system. + +> ⚠️ Special Note: If you are using Debian 10 / Debian 11 or Ubuntu 20.04, you need to download the dependency supplementary package additionally. After downloading, extract multiple times until dependency instructions are visible, then follow steps to install dependencies. For Ubuntu 22.04 and later, no dependency package is required. Follow the above instructions to install the main program directly. +--- \ No newline at end of file diff --git a/FAQ.zh.md b/FAQ.zh.md new file mode 100644 index 0000000000000000000000000000000000000000..003205287167006624c14bab1bba6ad10cf32235 --- /dev/null +++ b/FAQ.zh.md @@ -0,0 +1,91 @@ +# FAQ +## 星火应用商店 FAQ 与支持指南 + +### 简介 +星火应用商店是一个面向 Linux 用户的应用商店,支持多种不同的 Linux 发行版。以下是一些常见问题及解决方案。请注意,该文档主要面向对 Linux 和 `apt` 软件包管理系统不熟悉的普通用户。 + +--- + +### 交流与反馈 +**Q: 如何参与交流讨论?** +**A:** 您可以点击[此链接](https://bbs.spark-app.store/)进入星火社区论坛进行交流。 +> 📣 您还可以加入我们的 QQ 交流群,群号是 872690351 和 865927727。 + +--- + +### arm64 与 amd64 的区别 + +#### arm64 + +* 全称: Advanced RISC Machine 64-bit; +* 主要用途: 主要应用于移动设备、嵌入式系统以及一些新型的服务器和桌面计算机; +* 优势: 低功耗、高效率,适合用在电池驱动和热敏感的设备; +* 主要生产商: 苹果、高通、海思、飞腾等。 + +#### amd64 + +* 全称: AMD 64-bit, 也被称为 x86_64; +* 主要用途: 主要应用于桌面计算机、笔记本以及服务器; +* 优势: 高性能,适用于计算密集型应用; +* 主要生产商: Intel 和 AMD。 + +两者最主要的不同在于指令集和应用场景。amd64 通常用于高性能需求的计算机和服务器,而arm64则更多应用于功耗要求更严格的场合。 + +#### 查看方法: + +- 打开 Linux 终端; +- 输入命令 `uname -m` 或 `arch` 并按 `Enter` 键执行; +- 您将看到您计算机的处理器架构(可能是 x86_64, aarch64 等)。 +--- + +### 国产架构支持 +**Q: 我的计算机属于国产架构,如何获取星火应用商店?** +**A:** 目前,星火商店支持 **ARM** 架构和**龙芯·新世界**架构的国产芯片。您可以下载适用于 arm64 架构和 loong64 架构的 deb 包(软件安装包)。 +> ⚠️ 请注意,这项支持是实验性的。若遇到问题,请在星火社区论坛或 QQ 交流群向我们反馈。 + +--- + +### 安装依赖问题 +**Q: 安装依赖包出现错误,怎么办?** +**A:** 如果您使用 UOS 或 deepin,请不要安装依赖包。仅有部分 Linux 发行版需要安装依赖包,此外对于不在支持列表中的发行版可能需要您自行编译安装,详见[星火应用商店简介](https://gitee.com/spark-store-project/spark-store/blob/dev/README.zh.md)。 +> 💡 出现错误时,请运行 `sudo apt update` 后再尝试安装。如果问题仍然存在,请参考上文,进入交流平台寻求帮助。 + +--- + +### 投稿与应用更新 +**Q: 在哪里可以投稿软件?** +**A:** 您可以在应用商店界面的右上角菜单找到“投递应用”的选项,我们提供了**投递工具**和**在线平台**两种投稿方案。 + +--- + +### 非 deepin/UOS 用户支持 +**Q: 我不是 deepin/UOS 用户,可以使用星火应用商店吗?** +**A:** 在 Debian 系发行版可正常安装使用。例如,如果您使用 Ubuntu 22.04,请直接安装;对于 Ubuntu 20.04 / Debian 10 / Debian 11,请先安装依赖包。此外,如果您在非 Debian 系 Linux 发行版安装使用星火应用商店,软件的体验可能无法得到保证。 + +--- + +### 安装方法 +**Q: 我可以用 `dpkg -i` 安装吗?** +**A:** 我们**极不建议您这样做**。请在安装包保存目录下,使用 `sudo apt install ./spark-store*.deb` 安装,或使用 Gdebi 等图形化安装器。 +> ⚠️ 直接使用 `dpkg` 一般不会处理软件依赖,可能致使安装失败、破坏系统依赖环境。 + +--- + +### 系统更新 +**Q: 星火应用商店会影响系统正常更新吗?** +**A:** 不会,当前版本的星火应用商店已将应用源与系统源解耦合,不会影响系统的正常更新。 + +--- + +### 报告问题和应用下架 +**Q: 有些应用已经过时或者失效了,我想让它下架。** +**A:** 您可以[前往这里](https://gitee.com/spark-store-project/software_-issue)报告问题。 + +--- + +### 安装星火应用商店 +如果您需要安装星火应用商店,请打开 [Release 页面](https://gitee.com/spark-store-project/spark-store/releases),找到最新版本,并选择适用于当前系统的安装包下载。 + +> ⚠️ 特别提示: 如果您在使用 Debian 10 / Debian 11 或 Ubuntu 20.04,则需要额外下载依赖补充包;您需要在下载完依赖包后,解压多次直至内部的依赖包使用说明可见,按照步骤安装依赖。对于 Ubuntu 22.04 以后的操作系统版本,您无需安装依赖包,按照上面的操作直接安装本体程序即可。 + +--- \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000000000000000000000000000000000..1d958d96bf0cf411d8e4a820de9fac498e7a8602 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,33 @@ +pipeline { + agent any + stages { + stage('build') { + agent { + docker { + image 'jerry979/dtke:5.11.1' + } + + } + steps { + sh 'mkdir build && cd build && qmake .. && make ' + archiveArtifacts(artifacts: 'build/src/spark-store', allowEmptyArchive: true, defaultExcludes: true) + } + } + + stage('send') { + agent { + dockerfile { + filename '.gitee/Dockerfile' + } + + } + environment { + gitee_token = credentials('1') + } + steps { + sh "python3 .gitee/callback.py" + } + } + + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index 3877ae0a7ff6f94ac222fd704e112723db776114..7ed453065f53b91a331edafa15a637cbbf29b541 100644 --- a/LICENSE +++ b/LICENSE @@ -1,674 +1,41 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 +星火开源软件协议(Spark Opensource LICENSE) - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +版权所有 (C) 2023 星火社区 - Preamble +根据 GNU 通用公共许可证第三版(GPL v3),本软件是自由软件,您可以修改和再发布它。但是,为了维护原作者的权益并保护社区用户的权益,请遵守以下条款: - The GNU General Public License is a free, copyleft license for -software and other kinds of works. +1. 对本仓库下的所有文件生效:本许可证适用于本仓库(或项目)下的所有文件。任何使用、修改或再发布本软件的个人或组织都必须遵守本许可证。 +2. 版权声明和许可证文件:您不得移除、隐藏或更改本软件中包含的原作者的版权声明和许可证文件。保留原作者的权益信息对于维护开源软件生态系统至关重要。 +3. 版本标注: 如果您对本软件做出修改并再发布,您必须在醒目位置标注此版本并非星火社区官方提供。这样可以避免误导使用者认为该软件为星火社区官方提供的版本。此软件仅授权用于个人非盈利用途,任何将其用于商业目的或在盈利性组织中使用的行为均需事先获得星火社区的书面许可。 +4. 商标使用:您不得在再发布版本中使用“星火应用商店”、“Spark Store”或星火应用商店的Logo等可能误导使用者此软件由星火社区官方提供的信息。 +5. 服务条款:您使用星火商店软件的行为将被视为您同意星火在不侵犯您隐私的前提下搜集版本、日志等信息,以便于星火社区更好地为您提供服务。 +6. 仓库版权条款:为了更好的提供持续性服务,星火仅对个人用户免费开放服务仓库,如您或您的组织需要提供商业服务或者您的组织为盈利性组织,请联系星火社区获取商业授权。 +7. 禁止恶意行为和批量爬取: 用户或组织在使用本软件时,严禁进行任何形式的恶意行为,包括但不限于恶意攻击、滥用、破坏、批量爬取软件仓库等。恶意行为的定义由星火社区自行判断,违反者将被追究法律责任。 +8. 分发与再分发权利: 星火社区保留对其制作的软件包的分发权利。未经明确授权,禁止任何个人或组织将星火社区软件包用于商业目的或在未获得星火社区许可的情况下进行再分发。此条款旨在确保开源精神的同时,维护星火社区的知识产权。 +9. 商业应用限制:您不得使用本软件的代码开发商业应用,也不得在商业应用中使用本软件的代码,除非获得星火社区和火穗(沈阳)计算机软件开发有限公司的书面许可。 +10. 其他条款:除上述约定外,若您使用了星火商店的主程序或其部分代码,您应遵守 GPL v3 的所有其他条款和要求。若本协议条款的内容与GPL V3中的内容不同的,以本协议条款为准 +11. 其他约定:本许可以简体中文版本为最准确释义 - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. +GPLV3许可证的完整文本可以在以下链接找到:https://www.gnu.org/licenses/gpl-3.0.html - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. +--------------------------------------------------------------------------------------------------------------------------------- - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. +Spark Opensource LICENSE - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. +Copyright (C) 2023 The Spark Community - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. +This software is free software; you can modify and redistribute it under the terms of the GNU General Public License version 3 (GPL v3). However, to protect the rights of the original authors and the interests of the community users, please adhere to the following terms: - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. +1. Applicability to all files in this repository: This license applies to all files in this repository (or project). Any individuals or organizations that use, modify, or redistribute this software must comply with this license. +2. Copyright notice and license files: You must not remove, hide, or modify the copyright notice and license files of the original authors included in this software. Preserving the rights information of the original authors is essential for maintaining the open-source software ecosystem. +3. Version annotation: If you modify and redistribute this software, you must mark in a prominent position that this version is not officially provided by the Spark community. This avoids misleading users into thinking that the software is an official version provided by the Spark community. This software is licensed for personal, non-profit use only, and any use of it for commercial purposes or in for-profit organizations requires the prior written permission of the Spark Community. +4. Trademark usage: You are not allowed to use terms such as "Spark App Store," "Spark Store," or the logo of Spark App Store in redistributed versions, as they may mislead users into believing that the software is provided by the official Spark community. +5. Terms of Service: Your use of the software of Spark Store will be deemed as your consent to collect version, log and other information on the premise of not violating your privacy, so as to facilitate the Spark community to provide you with better services. +6. Warehouse copyright terms: In order to better provide continuous services, Spark is only free for individual users to open the service warehouse, if you or your organization needs to provide commercial services or your organization is a for-profit organization, please contact Spark community to obtain commercial authorization. +7. Prohibited malicious behavior and mass crawling: Users or organizations are strictly prohibited to engage in any form of malicious behavior when using the software, including but not limited to malicious attacks, abuse, destruction, and mass crawling of software warehouses. The definition of malicious behavior is judged by the Spark community, and violators will be held legally responsible. +8. Distribution and redistribution rights: Spark Community reserves the right to distribute the software packages it produces. Any person or organization is prohibited from using the Spark Community software package for commercial purposes or redistributing it without the express authorization of the Spark Community. This clause is intended to ensure the spirit of open source while safeguarding the intellectual property rights of the Spark community. +9. Business Application Restriction: You are not permitted to utilize the code of this software for developing commercial applications, nor are you allowed to integrate the code of this software into commercial applications without obtaining written consent from both the Spark Community and Flamescion (Shenyang) Computer Software Development Co., Ltd. +10. Other Terms: In addition to the above provisions, if you use the main program or any part of the code of Spark Store, you must comply with all other terms and requirements of GPL v3. In case of any inconsistency between the terms of this agreement and those of GPL v3, the terms of this agreement shall prevail. +11. Additional Agreements: This license shall be interpreted most accurately in its Simplified Chinese version. - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. +You can find the full text of GPLV3 license at: https://www.gnu.org/licenses/gpl-3.0.html \ No newline at end of file diff --git a/LICENSE-GPL3 b/LICENSE-GPL3 new file mode 100644 index 0000000000000000000000000000000000000000..818433ecc0e094a4db1023c68b33f24344643ad8 --- /dev/null +++ b/LICENSE-GPL3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md index 778029c221a0805c9647f56e8c7b83d71322b8ff..822e122916b93547c24cdfc685d03c27ce7bddbe 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,179 @@ -### Spark Update Tool -#### Introduction +# Spark Store +[![star](https://gitee.com/spark-store-project/spark-store/badge/star.svg?theme=gvp)](https://gitee.com/spark-store-project/spark-store/stargazers) [![fork](https://gitee.com/spark-store-project/spark-store/badge/fork.svg?theme=gvp)](https://gitee.com/spark-store-project/spark-store/members) +![star](https://gitcode.com/spark-store-project/spark-store/star/badge.svg) -Welcome to Spark Software Updater. Use this tool to update applications on your Linux system. -This version is specifically designed for Linux distributions with Qt6 support. -Please run under root privileges (recommended: use `sudo`). -#### Currently Supported Linux Distributions -- [x] GXDE OS -- [x] Ubuntu -- [x] deepin -- [ ] Kylin +## Introduction -#### Contact & Feedback -momen@momen.world +Welcome to the **Spark Store**! This is an application store designed for Linux platform users, aiming to address the issues of fragmented and difficult-to-obtain software within the Linux ecosystem. Regardless of your Linux distribution, you may find suitable software packages here. + +The number of Linux applications is relatively limited, and obtaining Wine software can also be challenging. Excellent development kits and tool resources are scattered across various communities and forums, making it difficult for the entire ecosystem to achieve comprehensive improvement. + +Ecosystem construction does not rely on isolated individual efforts but requires full community participation. Only when everyone's "spark" gathers in one place can it ignite a prairie fire. + +To improve this situation, we have launched the Spark Store. The Spark Community extensively collects software packages for various user needs, aggregates high-quality small tools, and proactively adapts Wine applications. All resources are stored in our repository, allowing users to conveniently access these applications. + +**Currently supported Linux distributions include (but are not limited to):** + +- **amd64 Architecture:** deepin 20 / deepin 23 / Ubuntu 20.04 / Ubuntu 22.04 / UOS Home Edition 20 / Debian 11+ +- **arm64 Architecture:** UOS Professional Edition 1060 / Ubuntu 22.04 / deepin 23 +- **loong64 Architecture:** deepin 23 + +> Special Note: Spark Store also supports all Ubuntu OS versions newer than Ubuntu 22.04, such as Ubuntu 22.10, 23.04, 23.10, etc. Additionally, Spark Store may adapt to other Linux distributions beyond the listed platforms; you may conduct installation tests accordingly. + +**Important Notice:** This software cannot guarantee continuous availability, uninterrupted operation, or meeting specific performance requirements. The Spark community makes no commitment to the functional completeness, stability, or error-free operation of this software. For example, if you plan to use it on UOS Professional Edition (or other similar specific platforms), please ensure you understand and enable the "Developer Mode" features. Basic troubleshooting capabilities are required. It is important to note that the Spark community cannot conduct extensive testing on some special platforms. Therefore, using the Spark Store client on these platforms may lead to various issues such as system update failures or data loss. Using this software indicates your understanding and acceptance that all risks must be borne by the user. + +## About Team Collaboration + +Organization Repository Links: + +https://gitee.com/spark-store-project/spark-store + +https://gitcode.com/spark-store-project/spark-store + +https://github.com/spark-store-project/spark-store + +Refer to [this link](https://wiki.spark-app.store/#/Dev/Spark-Store-Git-Repo) for detailed documentation on branch management. + +We warmly welcome you to join our development team. Whether you wish to participate in development or plan to submit applications, you can find your place here to jointly promote the development of the Linux application ecosystem. + +You can track our Issue processing status in real-time via the [Issue Board](https://gitee.com/spark-store-project/spark-store/board). + +If you have software packages to submit, please [click here to contribute](https://wiki.spark-app.store/#/Submit/Submit). + +## Table of Contents + +- [Read the Copyright Notice](#read-the-copyright-notice) +- [Determine Your System Architecture](#determine-your-system-architecture) +- [System Support and Installation Instructions](#system-support-and-installation-instructions) + - [For deepin Users](#for-deepin-users) + - [For Ubuntu Users](#for-ubuntu-users) + - [For Debian Users](#for-debian-users) +- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq) +- [Contact and Feedback](#contact-and-feedback) + +--- + +## Read the [Copyright Notice](LICENSE) + + +## Determine Your System Architecture + +Before installing any software, you need to know which architecture your computer is running on (e.g., x86_64/amd64 or aarch64/arm64), which also applies to the Spark Store. + +**How to Check:** + +1. Open the Linux terminal. +2. Enter the command `uname -m` or `arch` and press `Enter`. + +You will see the terminal output result, which helps determine your system architecture. Examples: + +- If you see `x86_64`, your system is amd64 architecture. +- If you see `aarch64`, your system is arm64 architecture. + +Based on this result, you need to download the corresponding version of the Spark Store installer to use it properly. + +--- + +## System Support and Installation Instructions + +Based on your Linux distribution and system architecture, here are detailed steps to install Spark Store. + +### For deepin Users + +#### For deepin Users + +1. **Download and Install** + + You can directly search for `Spark Store` in the deepin App Store for installation, or copy this link to your browser address bar to jump to the deepin App Store installation page. + + > appstore://deepin-home-appstore-client?app_detail_info/spark-store + + Versions published in the deepin App Store may not be the latest. To use the latest version, visit the Spark Store [Gitee Release Page](https://gitee.com/spark-store-project/spark-store/releases) or [Gitcode Release Page](https://gitcode.com/spark-store-project/spark-store/releases) and download the latest version for deepin, then install it. + + Assuming you downloaded the installer to the Downloads folder under your home directory, we recommend using the `apt` tool for installation to avoid potential dependency issues: + + ```shell + cd ~/Downloads + sudo apt install ./spark-store*.deb + ``` + +### For Ubuntu Users + +#### For Ubuntu 20.04 Users + +1. **Download Dependencies** + * Visit the [Spark Store Dependency Package Download Page](https://gitee.com/spark-store-project/spark-store-dependencies/releases) to download the latest dependency package; + * Extract the dependency package multiple times until you see numerous `.deb` installation packages; + * Follow the instructions inside the dependency package to install all dependencies at once. + +2. **Download and Install** + + Visit the Spark Store [Gitee Release Page](https://gitee.com/spark-store-project/spark-store/releases) or [Gitcode Release Page](https://gitcode.com/spark-store-project/spark-store/releases) to download and install the installer matching your computer's architecture. + + Assuming you downloaded the installer to the Downloads folder under your home directory, we recommend using the `apt` tool for installation to avoid potential dependency issues: + + ```shell + cd ~/Downloads + sudo apt install ./spark-store*.deb + ``` + +#### For Ubuntu 22.04 and Newer Ubuntu Versions +1. **No Dependency Package Required** + +2. **Download and Install** + + Visit the Spark Store [Gitee Release Page](https://gitee.com/spark-store-project/spark-store/releases) or [Gitcode Release Page](https://gitcode.com/spark-store-project/spark-store/releases) to download and install the installer matching your computer's architecture. + + Assuming you downloaded the installer to the Downloads folder under your home directory, we recommend using the `apt` tool for installation to avoid potential dependency issues: + + ```shell + cd ~/Downloads + sudo apt install ./spark-store*.deb + ``` + +### For Debian Users + +#### For Debian 11 Users + +1. **Download Dependencies** + * Visit the [Spark Store Dependency Package Download Page](https://gitee.com/spark-store-project/spark-store-dependencies/releases) to download the latest dependency package; + * Extract the dependency package multiple times until you see numerous `.deb` installation packages; + * Follow the instructions inside the dependency package to install all dependencies at once. + +2. **Download and Install** + + Visit the Spark Store [Gitee Release Page](https://gitee.com/spark-store-project/spark-store/releases) or [Gitcode Release Page](https://gitcode.com/spark-store-project/spark-store/releases) to download and install the installer. + +#### For Debian 12+ Users + +1. **No Dependency Package Required** + +2. **Download and Install** + + Visit the Spark Store [Gitee Release Page](https://gitee.com/spark-store-project/spark-store/releases) or [Gitcode Release Page](https://gitcode.com/spark-store-project/spark-store/releases) to download and install the installer matching your computer's architecture. + + Assuming you downloaded the installer to the Downloads folder under your home directory, we recommend using the `apt` tool for installation to avoid potential dependency issues: + + ```shell + cd ~/Downloads + sudo apt install ./spark-store*.deb + ``` + +--- + +## Frequently Asked Questions (FAQ) + +Please refer to the [Spark Store FAQ and Support Guide](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.md); +For advanced users requiring custom aptss config configuration, please refer to the [aptss Repository](https://gitee.com/GXDE-OS/aptss). + +--- + +## Contact and Feedback + +- If you have any questions or suggestions, please submit issues via email or the [Issue Page](https://gitee.com/spark-store-project/spark-store/issues); +- If you want to follow our development progress, visit the [Spark Store Board](https://gitee.com/spark-store-project/spark-store/board) for more information; +- Welcome to visit the [Spark Community Forum](https://bbs.spark-app.store/) to join discussions; +- Our QQ Discussion Group: 872690351 and 865927727; +- If you or your organization requires commercial support, please leave a message for consultation. +--- \ No newline at end of file diff --git a/README.zh.md b/README.zh.md index c597ce448be3bab03e01bc2a09b74b9a3c3525e7..ca1f1d9581c40ca8b73a88b15553704e003ee1f7 100644 --- a/README.zh.md +++ b/README.zh.md @@ -1,25 +1,202 @@ -### 星火软件更新器 -#### 简介 - -欢迎使用星火软件更新器,您可以使用此更新器更新位于您 Linux 计算机的程序。 -此版本专为有qt6的Linux发行版所使用。 -请在root环境下运行。 -#### 当前支持的 Linux 发行版 -- [x] GXDE OS -- [x] Ubuntu -- [x] deepin -- [ ] Kylin - -#### 功能清单 - -| 功能模块 | 描述 | -|------------------|--------------------------------------| -| 应用名识别 | 基于 `ss-do-upgrade.sh` 部分代码实现 | -| 应用包大小识别 | 通过 dpkg 获取包大小信息 | -| 获取应用图标 | 利用 QDesktopServices 实现 | -| 支持 ACE 兼容环境| | -| 多线程下载 | 基于 aptss 方案 | - -如您已安装星火应用商店,则会附带本程序。 -#### 联系与反馈 -momen@momen.world \ No newline at end of file +# 星火应用商店 +[![star](https://gitee.com/spark-store-project/spark-store/badge/star.svg?theme=gvp)](https://gitee.com/spark-store-project/spark-store/stargazers) [![fork](https://gitee.com/spark-store-project/spark-store/badge/fork.svg?theme=gvp)](https://gitee.com/spark-store-project/spark-store/members) +![star](https://gitcode.com/spark-store-project/spark-store/star/badge.svg) + + +## 简介 + +欢迎来到**星火应用商店**!这是一个为 Linux 平台用户设计的应用商店,旨在解决 Linux 生态下应用分散、难以获取的问题。无论您使用什么类型的 Linux 发行版,在这里都有可能找到适合您的软件包。 + +Linux 应用的数量相对有限,Wine 软件的可获取性也颇为困难。优秀的开发套件和工具资源散布在各大社区和论坛之间,这种分散化让整个生态系统难以得到全面的提升。 + +生态系统的构建并非依赖个体的孤立努力,而需要全社区共同参与。只有当大家的“星火”聚集一处,方可引发“燎原之势”。 + +为了改善这一现状,我们推出了星火应用商店。星火社区广泛地收录了各种用户需求的软件包,汇集了高质量的小工具,并主动对 Wine 应用进行了适配,一切都储存在我们的软件库中,使得用户可以方便地获取这些应用。 + +**当前支持的 Linux 发行版包括(但不限于):** + +- **amd64 架构:** deepin 20 / deepin 23 / Ubuntu 20.04 / Ubuntu 22.04 / UOS 家庭版 20 / Debian 11+ +- **arm64 架构:** UOS 专业版 1060 / Ubuntu 22.04 / deepin 23 +- **loong64 架构:** deepin 23 + +> 特别说明:星火应用商店还支持所有版本高于 Ubuntu 22.04 的 Ubuntu 操作系统,例如 Ubuntu 22.10、23.04、23.10 等。此外星火应用商店也可能适配除上述平台的其他 Linux 发行版,您可自行进行安装测试。 + +**重要须知:** 本软件无法保证持续可用、无中断运行或满足特定性能要求。星火社区对其功能完整性、稳定性及无错误运行不作任何承诺。例如,若您计划在 UOS 专业版(或其他类似特定平台)上使用,请务必了解并启用“开发者模式”相关功能。请确保您具备基础的故障排查能力。需要明确的是,星火社区无法在部分特殊平台上进行广泛测试。因此,在这些平台上使用星火应用商店客户端可能会导致一系列问题,如系统更新失败、数据丢失等;使用该软件,即代表您理解并同意所有风险需由用户自行承担。 + + + +## 关于团队协作 + +组织仓库链接: + +https://gitee.com/spark-store-project/spark-store + +https://gitcode.com/spark-store-project/spark-store + +https://github.com/spark-store-project/spark-store + +参见[此链接](https://wiki.spark-app.store/#/Dev/Spark-Store-Git-Repo)以获取分支管理相关的详细文档。 + +我们热忱欢迎您加入我们的开发团队。无论您是希望参与开发,还是计划提交应用,都能在这里找到属于您的一席之地,共同推动 Linux 应用生态的发展。 + +您可以通过以下链接,实时跟踪我们的 Issue 处理状态:[Issue 看板](https://gitee.com/spark-store-project/spark-store/board)。 + +若您有软件包需要提交,敬请[点击此处进行投稿](https://wiki.spark-app.store/#/Submit/Submit)。 + + + + +## 目录 + +- [星火应用商店](#星火应用商店) + - [简介](#简介) + - [关于团队协作](#关于团队协作) + - [目录](#目录) + - [阅读版权声明](#阅读版权声明) + - [确定你的系统架构](#确定你的系统架构) + - [系统支持与安装指引](#系统支持与安装指引) + - [对于 deepin 用户](#对于-deepin-用户) + - [对于 deepin 用户](#对于-deepin-用户-1) + - [对于 Ubuntu 用户](#对于-ubuntu-用户) + - [对于 Ubuntu 20.04 用户](#对于-ubuntu-2004-用户) + - [对于 Ubuntu 22.04 及更高版本的 Ubuntu 用户](#对于-ubuntu-2204-及更高版本的-ubuntu-用户) + - [对于 Debian 用户](#对于-debian-用户) + - [对于 Debian 11 用户](#对于-debian-11-用户) + - [对于 Debian 12+ 用户](#对于-debian-12-用户) + - [常见问题(FAQ)](#常见问题faq) + - [联系与反馈](#联系与反馈) + +--- + +## 阅读[版权声明](LICENSE) + + +## 确定你的系统架构 + +在安装任何软件之前,您需要知道你的计算机运行在何种架构之上(如 x86_64/amd64 或 aarch64/arm64),对于星火应用商店亦是如此。 + +**如何检查:** + +1. 打开 Linux 终端。 +2. 输入命令 `uname -m` 或 `arch` 并按 `Enter` 键执行。 + +您会看到终端输出结果,借此您可判断计算机的系统架构。举例: + +- 如果您看到 `x86_64`,说明您的系统为 amd64 架构。 +- 如果您看到 `aarch64`,说明您的系统为 arm64 架构。 + +根据这一结果,您需要下载对应版本的星火应用商店安装包以正常使用。 + +--- + +## 系统支持与安装指引 + +根据您的 Linux 发行版和系统架构,以下是安装星火应用商店的详细步骤。 + +### 对于 deepin 用户 + +#### 对于 deepin 用户 + +1. **下载并安装** + + 您可直接在深度应用商店搜索 `星火应用商店` 安装,或复制此链接到浏览器地址栏,跳转至深度应用商店安装。 + + > appstore://deepin-home-appstore-client?app_detail_info/spark-store + + + 深度应用商店发布的版本可能不是最新的。若要使用最新版本,请访问星火应用商店 [Gitee 的 Release 页面](https://gitee.com/spark-store-project/spark-store/releases)或 [Gitcode 的 Release 页面](https://gitcode.com/spark-store-project/spark-store/releases)并下载适用于 deepin 的最新版本,安装后即可使用。 + + 假设您将安装包下载至用户目录下的 Downloads 文件夹,我们推荐您使用 `apt` 工具进行安装以避免潜在的依赖问题: + + ```shell + cd ~/Downloads + sudo apt install ./spark-store*.deb + ``` + +### 对于 Ubuntu 用户 + +#### 对于 Ubuntu 20.04 用户 + +1. **下载依赖包** +* 请访问[星火应用商店依赖包下载页面](https://gitee.com/spark-store-project/spark-store-dependencies/releases),下载最新的依赖包; +* 请多次解压依赖包,直至您可以看到诸多以 deb 结尾的安装包; +* 依据依赖包内的说明,一次性安装所有的依赖包。 + + +2. **下载并安装** + + 请访问星火应用商店 [Gitee 的 Release 页面](https://gitee.com/spark-store-project/spark-store/releases)或 [Gitcode 的 Release 页面](https://gitcode.com/spark-store-project/spark-store/releases),下载和您电脑相同架构的安装包并安装。 + + 假设您将安装包下载至用户目录下的 Downloads 文件夹,我们推荐您使用 `apt` 工具进行安装以避免潜在的依赖问题: + + ```shell + cd ~/Downloads + sudo apt install ./spark-store*.deb + ``` + +#### 对于 Ubuntu 22.04 及更高版本的 Ubuntu 用户 +1. **无需安装依赖包** + + +2. **下载并安装** + + 请访问星火应用商店 [Gitee 的 Release 页面](https://gitee.com/spark-store-project/spark-store/releases)或 [Gitcode 的 Release 页面](https://gitcode.com/spark-store-project/spark-store/releases),下载和您电脑相同架构的安装包并安装。 + + 假设您将安装包下载至用户目录下的 Downloads 文件夹,我们推荐您使用 `apt` 工具进行安装以避免潜在的依赖问题: + + ```shell + cd ~/Downloads + sudo apt install ./spark-store*.deb + ``` + +### 对于 Debian 用户 + +#### 对于 Debian 11 用户 + +1. **下载依赖包** +* 请访问[星火应用商店依赖包下载页面](https://gitee.com/spark-store-project/spark-store-dependencies/releases), 下载最新的依赖包; +* 请多次解压依赖包,直到您可以看到诸多以 deb 结尾的安装包; +* 依据依赖包内的说明,一次性安装所有的依赖包。 + +2. **下载并安装** + + 请访问星火应用商店 [Gitee 的 Release 页面](https://gitee.com/spark-store-project/spark-store/releases)或 [Gitcode 的 Release 页面](https://gitcode.com/spark-store-project/spark-store/releases)并下载,安装后即可使用。 + + +#### 对于 Debian 12+ 用户 + +1. **无需安装依赖包** + + +2. **下载并安装** + + 请访问星火应用商店 [Gitee 的 Release 页面](https://gitee.com/spark-store-project/spark-store/releases)或 [Gitcode 的 Release 页面](https://gitcode.com/spark-store-project/spark-store/releases),下载和您电脑相同架构的安装包并安装。 + + 假设您将安装包下载至用户目录下的 Downloads 文件夹,我们推荐您使用 `apt` 工具进行安装以避免潜在的依赖问题: + + ```shell + cd ~/Downloads + sudo apt install ./spark-store*.deb + ``` +--- + +## 常见问题(FAQ) + +请参见[星火应用商店 FAQ 与支持指南](https://gitee.com/spark-store-project/spark-store/blob/dev/FAQ.zh.md); + +对于高级用户,如需自定义配置 aptss config,请参阅 [aptss 软件仓库](https://gitee.com/GXDE-OS/aptss)。 + +对于星火更新器,请参阅[Spark-Update-Tool](https://gitee.com/spark-store-project/Spark-Update-Tool) + + +--- + +## 联系与反馈 + +- 如果您有任何问题或建议,请通过邮件或在 [Issue 页面](https://gitee.com/spark-store-project/spark-store/issues)上提交问题; +- 如果你想关注我们的开发进度,可以跳转至[星火应用商店 Board](https://gitee.com/spark-store-project/spark-store/board) 获取更多信息; +- 欢迎访问[星火社区论坛](https://bbs.spark-app.store/)加入讨论; +- 我们的 QQ 交流群号:872690351 和 865927727; +- 若您和您的组织需要寻求商业支持,请留言咨询。 + +--- diff --git a/build_and_install.sh b/build_and_install.sh new file mode 100755 index 0000000000000000000000000000000000000000..152cec7d87c119ffb2c3a398240eb06946dd2849 --- /dev/null +++ b/build_and_install.sh @@ -0,0 +1,24 @@ + +# Deepin V20/UOS 21 系统下, 安装依赖 + +# ```shell +# sudo apt install git qt5-default debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev fakeroot qtwayland5 qtwayland5-dev-tools dde-qt5wayland-plugin + +# ``` + +# Ubuntu 22.04 系统下, 安装依赖 +# ```shell +# sudo apt install git qtbase5-dev debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev qtwayland5 qtwayland5-dev-tools + +# ``` + +echo "Deepin V20/UOS 21 系统下, 安装依赖" +echo "sudo apt install git qt5-default debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev fakeroot qtwayland5 qtwayland5-dev-tools dde-qt5wayland-plugin" + +echo "Ubuntu 22.04 系统下, 安装依赖" +echo "sudo apt install git qtbase5-dev debhelper pkg-config qtchooser libqt5core5a libqt5gui5 libqt5widgets5 libqt5network5 libqt5concurrent5 libdtkcore-dev libdtkgui-dev libdtkwidget-dev qttools5-private-dev libnotify-dev qtwebengine5-dev qtwayland5 qtwayland5-dev-tools" + +dpkg-buildpackage -j$(cat /proc/cpuinfo | grep processor | wc -l) +sudo apt reinstall ../spark-store_*.deb + +rm ../spark-store_* \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index b414feaa62fe2af76faad258dcb2e6256d7b272c..5332404141a4104e68fd2de1c0a2d167afe5d1b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,800 @@ -spark-update-tool (1.0.0) unstable; urgency=low +spark-store (4.8.1~test1) UNRELEASED; urgency=medium - * Initial release. + * 添加全新的更新器 + * 替换了新版更新器的polkit policy + -- momen Tue, 15 Jul 2025 01:03:08 +0800 + +spark-store (4.8.0) UNRELEASED; urgency=medium - -- momen Wed, 18 Jun 2025 00:00:00 +0000 \ No newline at end of file + * ssinstall重写,支持安装到ACE和自动安装到ACE,支持只允许安装到本地 + * 商店支持展示ACE标识,支持识别 native amber-ce-bookworm amber-ce-trixie amber-ce-sid amber-ce-deepin23 + * 投稿器支持新版spec + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + +spark-store (4.5.2) UNRELEASED; urgency=medium + + * 支持安装到 ACE Bookworm + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + + spark-store (4.5.1) UNRELEASED; urgency=medium + + * 修复 aptss 部分报错 + * 重新设计了 Tag 区的展示方式 + * 新增 Fish 补全 + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + +spark-store (4.5.0) UNRELEASED; urgency=medium + + * 支持从商店中直接启动应用 + * ssinstall 修复安装时不再指定版本号以避免出现问题 + * aptss支持fish补全 + * 修复: distrobox下无法正常校验应用hash + * aptss 4.5.0 + * 应用更新新增进度条 + * 支持识别Debian + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + +spark-store (4.3.3.2) UNRELEASED; urgency=medium + + * 提升升级工具体验,不再反复弹窗 + * 提升aptss使用体验,汇报目前所在阶段而不是卡住不动 + * 修复debian sid 无法卸载 + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + +spark-store (4.3.3.1) UNRELEASED; urgency=medium + + * 修复点击更新需要输入密码的问题 + * 修复安装速度下降的问题 + * 修复闪退问题 + * 修复错误地展示已安装 + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + +spark-store (4.3.2.0) UNRELEASED; urgency=medium + + * 后续更新请从4.3.2.0版本号开始,4.3.2版本仅用于GXDE测试 + * 支持dummyapps 安装包安装 + * 支持紧凑模式 + * 修复部分情况下升级安装失败的问题 + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + +spark-store (4.3.2) UNRELEASED; urgency=medium + + * ssinstall支持安装conflict包 + * 支持紧凑模式 + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + +spark-store (4.3.1) UNRELEASED; urgency=medium + + * 修复自提权更新问题 + * 提升aptss稳定性 + + -- shenmo Tue, 24 Sep 2024 11:27:08 +0800 + +spark-store (4.3.0-fix5) stable; urgency=medium + +* 支持GXDE,重启空链接清理 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + + + +spark-store (4.3.0-fix4) stable; urgency=medium + +* 修复:安装失败时仍然锁定 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.3.0-fix3) stable; urgency=medium + +* 修复:创建快捷方式失效 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + + +spark-store (4.3.0-fix2) stable; urgency=medium + +* aptss配置调整 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + + +spark-store (4.3.0-fix1) stable; urgency=medium + +* 上游改为d.spark-app.store + + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + +spark-store (4.3) stable; urgency=medium + +* 修复客户端不支持301跳转的问题 +* 修复UOS下错误地提示开发者模式未启动 +* 现在会记住上次的窗口大小 +* 删除无用依赖,修复Debian 13依赖问题 + + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + +spark-store (4.2.14) stable; urgency=medium + + +* 上游改为d.spark-app.store + + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 +spark-store (4.3.0) stable; urgency=medium + +* 修复部分客户端启动白屏 + + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 +spark-store (4.3) stable; urgency=medium + +* 修复客户端不支持301跳转的问题 +* 修复UOS下错误地提示开发者模式未启动 +* 现在会记住上次的窗口大小 +* 删除无用依赖,修复Debian 13依赖问题 + + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 +spark-store (4.2.13) stable; urgency=medium + +* 未经测试文案修改 +* 龙芯平台并入主线 +* 修复:更新过程中中断无法再次启动更新检查 +* 调整:提高超时时长,适应较差的网络环境 + + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 +spark-store (4.2.12.1) stable; urgency=medium + + * 修复:龙芯自动--no-sandbox + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + +spark-store (4.2.12) stable; urgency=medium + + * 修复:飞腾部分设备上白屏的问题 + * 修复:下载开始时长时等待(降低链接超时时长) + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + +spark-store (4.2.11) stable; urgency=medium + + * 修复:判断是否安装状态错误 + * 修改:部分组件重构提升清晰度 + * 修复:v23下部分应用图标失效 + + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.10) stable; urgency=medium + + * 修复:部分发行版上无法启动自动创建的桌面图标 + * 修复:发行版统计信息 + * 修复:Gitee反馈链接错误 + * 修复:ACE下无法安装,支持ACE下软件更新 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.9) stable; urgency=medium + + * 修复:软件详情图片排序调整为服务器排序,而不是按加载顺序排序 + * 修复: build error on Deepin V23 + * 修复:容器内无限等待 + * 新增:高分屏截图支持 + * 新增:更新界面支持显示软件名称 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + +spark-store (4.2.8.1) stable; urgency=medium + + * 修复:A2D应用释放无效的Desktop到桌面上 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + +spark-store (4.2.8) stable; urgency=medium + + * 修复:在aptss上锁时支持等待释放锁而不是直接报错退出 + * 调整:下载安装按钮文案修改 + * 优化 KDE 深色模式支持实现方式 + * 新增:ssinstall现在会自动创建desktop文件 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + +spark-store (4.2.7.3) stable; urgency=medium + + * 修复:aptss现在会正确地透传错误码而不是exit 0 + * 修复:下载时如果卡0%(无法下载metalink),会在超时后报错中断而不是一直傻等 + * 修复:排队下载时CPU占满单核的bug https://gitee.com/spark-store-project/spark-store/issues/I7B91V + * 修复:在终端中打开的icon过大导致无法投稿到UOS + * 修复:v23下编译出错 + * 薪怎:支持崩溃日志收集系统 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + + +spark-store (4.2.7.2) stable; urgency=medium + + * 新增:内置在终端打开功能 + * 调整:散列验证更改为使用sha512 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + + +spark-store (4.2.7.1) stable; urgency=medium + + * 修复:aptss加锁失败现在会正常报错 + * 新增:在aptss的特定操作时添加了提示 + * 新增:在aptss提示加粗 + * 调整:ssinstall验证支持使用cdn.d.获取 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.7) stable; urgency=medium + + * 修复:更新星火商店后禁止更新提醒的配置失效 + * 新增:支持在设置中关闭平台不兼容提示 + * 调整:更改了下载量统计的方式,减少漏数 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.6.6) stable; urgency=medium + + * 调整:文案修改:安装失败后引导查看详情而不是重新安装 + * 修复:dpkg阻塞出现漏掉的安装失败,现在在安装后检测是否安装 + * 修复:UOS专业版上安装成功仍然显示失败的问题:方式:忽略E:等消息,仅检查脚本报错 + * 调整:卸载应用时采用autopurge以一并卸载依赖 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.6.5) stable; urgency=medium + + * 调整:ssaudit安装结束时会提示安装结束 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.6.4) stable; urgency=medium + + * 修复:关于页面的入口过时 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.6.3) stable; urgency=medium + + * 修复:部分下载统计线路失效 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.6.2) stable; urgency=medium + + * 新增:支持arm架构搜索 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.6.1) stable; urgency=medium + + * 修复:mint下更新检测不正常 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.6) stable; urgency=medium + + * 修复:截图加载失败时点击闪退 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.5.1) stable; urgency=medium + + * 调整:重写了spark-dstore-patch,速度提升,尤其对机械硬盘下 + * 调整:优化了aptss源文件同步策略 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.5) stable; urgency=medium + + * 修复:ssinstall在文件不存在时仍然报安装成功 + * 修复:删除不再需要的依赖:libc6-dev + * 在aarch64架构安装时也启用32位支持 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.4) stable; urgency=medium + + * 修复:ssinstall校验失败的时候仍然提示安装成功 + * 新增:ssinstall可以自动刷新ssupdate以防止仓库更新中导致的安装校验失败 + * 修复:在不受支持的平台安装应用时弹出提示不正确 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.3.3) stable; urgency=medium + + * aptss 不再使用bwrap,去除依赖,支持容器中启动 + * aptss 支持非root模式启动 + * aptss 添加transhell支持 + * 关于界面自动获取分支名称 + * 现在安装成功则自动删除安装包 + * 完成 arm 架构大部分功能适配 + * 修复依赖不完整的问题 + * 4.3 roadmap 实现,在浏览不支持的应用时会出现提示 + * 4.3 roadmap 实现,在下载文件夹没有读写权限时会出现提示 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.3.2~Reason10) stable; urgency=medium + + * 完成除web外大部分功能适配 + * 修复依赖不完整的问题 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.3.2~Reason9) stable; urgency=medium + + * sender-d.sh + * ssinstall和ssaudit的安装测试转到upgrade-worker + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.3.2~Reason8) stable; urgency=medium + + * sender-d改用cpp重写,在aarch64上稳定运行 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.3.2~Reason7) stable; urgency=medium + * ssinstall发现无法验证时尝试update而不是ssupdate + * 启动每日aptss update + * ssinstall在发现无法安装后尝试先进行下aptss update + * 修复:安装商店后首次启动无法安装任何软件 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.3.2~Reason5) stable; urgency=medium + + * aptss 不再使用bwrap,去除依赖,支持容器中启动 + * aptss 支持非root模式启动 + * aptss 添加transhell支持 + * 关于界面自动获取分支名称 + * 现在安装成功则自动删除安装包 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.3.2~Reason3) stable; urgency=medium + + * 现在可在x86上编译,使用同一套代码 + * 暂时在aarch64上使用旧web----等待柚子 + * 空间,疾疫,现在是静谧 + + -- shenmo Sun, 5 Mar 2022 11:45:14 +0800 + + +spark-store (4.2.3.2~only-for-test1) stable; urgency=medium + + * 注意!!!!!! 此版本仅为启动测试,还需要进一步完善——hardcode需要改善——关于web界面的调用方式需要在柚子做好之后修改成新的 + * fix: hardcode + * fix: sender-d + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2.3.1) stable; urgency=medium + * 修复: ssinstall验证签名出错 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2.3) stable; urgency=medium + * 修复: 编译依赖不全 + * 修复: prerm导致的dpkg崩溃 + * 新增: aptss 检查package配置增加sdu,store + * 新增: 一键编译并安装脚本 + * 新增: 后台安装结束后退出任务栏驻留 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2.3~test4) stable; urgency=medium + + * 修复: aptss 无法安装 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2.3~test3) stable; urgency=medium + + * 调整:打包时从 debian/changelog 自动获取构建版本号并写入关于窗口保证与deb一致 + * 新增:支持 DTK 5.6.4 关于对话框“版本特性”显示功能。目前只在deepin编译安装时开启 + * 修复:修复下载列表对话框中,点击某个 item 取消下载按钮后下载列表无法再次显示的问题 + * 修复:多个应用安装可能会出现某一个应用没有安装 + * 修复:修复下载按钮点击/双击/拖动时,主窗口动作与下载管理对话框动作同时触发问题 + * aptss 获取线路信息 转到从 d. 服务器获取 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2.3~test2) stable; urgency=medium + + * 调整:开启安装包加固 + * 添加:zh_TW翻译 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2.3~test1) stable; urgency=medium + + * 修复:因判断安装状态错误创建多个相同任务的bug + * 测试中:尝试修复安装结束的闪退问题 https://gitee.com/spark-store-project/spark-store/commit/cb093dcc2bb0a193db89aa0ce5f20ea9cc5d56eb + * 修复:Deepin 显示开发者模式未开启 + * 修复:从托盘打开主窗口时透明度动画不流畅 + * 修复:主窗口关闭后,从托盘打开关于窗口会被主窗口遮挡 + + -- shenmo Sun, 05 Feb 2023 23:00:00 +0800 + + +spark-store (4.2.2) stable; urgency=medium + + * 调整:脚本应用的transhell支持转为source导入 + * 修复:ssinstall弹窗支持wayland + * 新增:应用托盘,下载时候可以放心关闭窗口了 + * 新增:支持spk://search/内容 格式链接 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2.1) stable; urgency=medium + + * 调整:支持在安装前进行测试(ss-do-upgrade-worker),但是未实装到appinfo + * 修复:因依赖不完全导致在LinuxMint下无法下载统计 + * 新增:脚本系列应用支持英文 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2) stable; urgency=medium + + * 调整:UOS开发者模式提示现在不会那么挤了 + * 修复:wayland下可正常弹出更新提示 + * 调整:dwine5标签的文案改为:Wine应用 + * 新增:更新软件时弹窗会显示正在更新的软件包名 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2~test3) stable; urgency=medium + + * 修复: aptss ssupdates + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2~test2) stable; urgency=medium + + * 修复: 420t1版本中ssinstall有时会重新下载软件包的问题 + * 新增: 安装前会对软件包安装进行dry run以判断是否能正确安装 + * 调整: aptss在进行任何操作前均检测是否存在Packages文件,若存在,则不进行ssupdate + * 调整: 修改apt-fast源代码以指定conf位置为/tmp/apt-fast,这部分不再使用bwrap模拟 + * 新增: aptss检测Package文件支持分目录(目前指定为store) + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.2~test1) stable; urgency=medium + + * 新增: aptss支持显示报错 + * 新增: aptss部分提示汉化 + * 修复: 修复部分情况下ssinstall实际未安装但是错误显示 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.1.2) stable; urgency=medium + + * feat: 初步的wayland支持 + * feat: UOS下检测开发者模式是否开启,若未开启则拒绝安装 + * fix: 首页的捐赠页面在中文环境下显示中文 + * fix: 更新检测模块在aptss ssupdate操作失败后现在会正确地移除锁而不是错误的残留锁。 + * chore: ssinstall现在拒绝安装验证失败的包,审核操作现在需要改用ssaudit + * fix: Ubuntu下下载列表无法关闭 + * fix: 修复进入详情页时焦点默认在分享链接按钮上的问题 + * fix: 修复特定情况下的内存泄漏问题 + * fix: 适配c11代码规范,消除qt编译警告 + * fix: 默认服务器域名指向cdn域名 + * fix: 消除内部函数的无用变量,限制作用域 + * feat: aptss 除ssupdate外的操作时候如果检测到存在源文件存在则不再重复获取 + * fix: 修复在apt list锁被锁定的时候异常弹出有更新可用 + * chore: 去除安装依赖:g++ + * fix: 修复下载列表中进度提示文字显示不完整的问题 + * feat: ssinstall支持从单独文件夹中校验软件包 + * feat: 支持分单文件夹下载。具体内容参见:https://gitee.com/spark-store-project/repo_auto_update_script/blob/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list + * info: 非常感谢 @jwyh 对星火商店代码仓库设计了很多标准,参见 https://wiki.spark-app.store/#/Dev/Spark-Store-Git-Repo?id=%e6%9b%b4%e6%96%b0%e6%97%a5%e5%bf%97%e8%a7%84%e5%88%99 ,不过shenmo是自由的 + + + * chore: 添加 Application 类,继承 DApplication,将 main 函数中设置属性、关于信息等操作移至 Application 构造函数中进行 + * chore: 添加 setOrganizationName 操作,设置组织名称为 spark-union,与 SWRT 保持一致 + * chore: 设置组织名称后,QStandardPaths::AppConfigLocation 等路径相应改变,修改所有配置文件和缓存文件路径 + * chore: 关于对话框设置父对象后,对话框背景色受主窗口样式表影响,移动部分控件样式表设置方式与位置 + * chore: 去除 .pro 文件中无效的更新翻译文件脚本调用,整理 .pro 文件,添加编译时更新 ts 文件脚本调用 + * chore: 继续修复偶现关闭客户端时崩溃问题(疑似 aria2c 进程未启动,pid 未初始化为随机值,执行 kill 操作时未判断导致) + * chore: 新增编译依赖,测试安装时不会出现报错 + * chore: 暂时去除没有意义的 DBus 接口,使用 DGuiApplicationHelper::newProcessInstance 获取新进程的启动参数 + * chore: 更新翻译文件,去除已经不存在的翻译 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.1.2~test2) stable; urgency=medium + + * feat: ssinstall支持从单独文件夹中校验软件包 + * feat: 支持分单文件夹下载。具体内容参见:https://gitee.com/spark-store-project/repo_auto_update_script/blob/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list + * info: 非常感谢 @jwyh 对星火商店代码仓库设计了很多标准,参见 https://wiki.spark-app.store/#/Dev/Spark-Store-Git-Repo ,不过shenmo是自由的 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.1.2~test1) stable; urgency=medium + + * feat: 初步的wayland支持 + * feat: UOS下检测开发者模式是否开启,若未开启则拒绝安装 + * fix: 首页的捐赠页面在中文环境下显示中文 + * fix: 更新检测模块在aptss ssupdate操作失败后现在会正确地移除锁而不是错误的残留锁。 + * chore: ssinstall现在拒绝安装验证失败的包,审核操作现在需要改用ssaudit + * fix: Ubuntu下下载列表无法关闭 + * fix: 修复进入详情页时焦点默认在分享链接按钮上的问题 + * fix: 修复特定情况下的内存泄漏问题 + * fix: 适配c11代码规范,消除qt编译警告 + * fix: 默认服务器域名指向cdn域名 + * fix: 消除内部函数的无用变量,限制作用域 + * feat: aptss 除ssupdate外的操作时候如果检测到存在源文件存在则不再重复获取 + * fix: 修复在apt list锁被锁定的时候异常弹出有更新可用 + * chore: 去除安装依赖:g++ + * fix: 修复下载列表中进度提示文字显示不完整的问题 + + + * chore: 添加 Application 类,继承 DApplication,将 main 函数中设置属性、关于信息等操作移至 Application 构造函数中进行 + * chore: 添加 setOrganizationName 操作,设置组织名称为 spark-union,与 SWRT 保持一致 + * chore: 设置组织名称后,QStandardPaths::AppConfigLocation 等路径相应改变,修改所有配置文件和缓存文件路径 + * chore: 关于对话框设置父对象后,对话框背景色受主窗口样式表影响,移动部分控件样式表设置方式与位置 + * chore: 去除 .pro 文件中无效的更新翻译文件脚本调用,整理 .pro 文件,添加编译时更新 ts 文件脚本调用 + * chore: 继续修复偶现关闭客户端时崩溃问题(疑似 aria2c 进程未启动,pid 未初始化为随机值,执行 kill 操作时未判断导致) + * chore: 新增编译依赖,测试安装时不会出现报错 + * chore: 暂时去除没有意义的 DBus 接口,使用 DGuiApplicationHelper::newProcessInstance 获取新进程的启动参数 + * chore: 更新翻译文件,去除已经不存在的翻译 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.1.1) stable; urgency=medium + + * fix:更新失效 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.1.0) stable; urgency=medium + + * feat: 现在可以支持UOS签名包问题了 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.0.1) stable; urgency=medium + + * feat: 提升Ubuntu下的显示效果 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.0.0) stable; urgency=medium + + * feat: 修复了成吨的bug后开始正式版 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.0.0~test2) stable; urgency=medium + + * feat: 修复了成吨的bug后开始公测 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (4.0.0~test1) stable; urgency=medium + + * feat: 柚子过来补充一下啦 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.4~test1) stable; urgency=medium + + * feat: aptss不再尝试安装apt-fast,转而自带 + * chore: 删除password-check模块 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.3) stable; urgency=medium + + * feat: 首页链接调用浏览器打开 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.3~test5) stable; urgency=medium + + * 修复可能的内存泄漏问题 + * 修复应用搜索为空但仍显示上一次搜索结果的问题 + * 修复动画加载延后的问题 + * 修复统计下载量卡主渲染线程的问题 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.3~test4) stable; urgency=medium + + * Enable i386 arch support by default + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.3~test3) stable; urgency=medium + + * Now use ss-apt-fast instead of apt-fast + * 修复:右上角 更新和安装设置 菜单中进入更新列表失效 + +-- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.3~test2) stable; urgency=medium + + * bug fix: 更新和检查更新出错时不报错.此更新需要一个推送 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.3~test1) stable; urgency=medium + + * 3.3.3将会是修复大部分bug后的最终版本 + * 图形环境中所有root权限的组件剥离到cli(可用于deepin 23 daily,只保证商店本体正常运作,不处理安装依赖不满足) + * 文案更改:更新检查-->检查更新 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.1~test1) stable; urgency=medium + + * 安装时不再需要联网 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.0.4) stable; urgency=medium + + * 为减轻服务器压力,不再单独更新某一个应用,而是作为整体更新 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.0.3) stable; urgency=medium + + * 回滚 更新中行为到进度条而不是实时输出 + * 更新应用时显示正在更新哪个应用 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.0.2) stable; urgency=medium + + * 修复 pkexec未执行 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3.0.1) stable; urgency=medium + + * 修复 检查更新的更新进程未实际运行 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3) stable; urgency=medium + + * 修复 检查更新 未刷新软件源 + * 把检查更新单独拿出作为左列 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3~test3) stable; urgency=medium + + * 把检查更新加入免密码 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3~test2) stable; urgency=medium + + * 更新检测功能全部更改到zenity + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.3~test1) stable; urgency=medium + + * zenity,选择可更新应用 + * 自动更新检测现在会跳过hold + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.2.4) stable; urgency=medium + + * 修改tag相关的文案内容:wine相关环境已可自动配置了 + * 准备发版 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.2.4~test4) stable; urgency=medium + + * 现在在商店启动后点击spk链接仍会正常启动 https://gitee.com/spark-store-project/spark-store/commit/dd6780d636042bf12d77414e6f1552cc7d1ed24c + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.2.4~test3) stable; urgency=medium + + * 发版,合入到master + * 翻译完毕 + * 合入先前的各项改动,为:客户端集成投稿器入口和支持,修复:安装依赖时间较长时错误地返回“安装完毕”结果,现在客户端版本更新时不关闭免密码登录,UOS安装进程合并正常aptss中 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.2.4~test2) stable; urgency=medium + + * 客户端集成投稿器入口和支持 + * 修复:安装依赖时间较长时错误地返回“安装完毕”结果 + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + + +spark-store (3.2.4~test1) stable; urgency=medium + + * 客户端更新时不关闭免密码登录 + * U + diff --git a/debian/compat b/debian/compat index f11c82a4cb6cc2e8f3bdf52b5cdeaad4d5bb214e..b4de3947675361a7770d29b8982c407b0ec6b2a0 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -9 \ No newline at end of file +11 diff --git a/debian/control b/debian/control index 19c9d62467db6f87af7ff74c3aae2c2ef5a921fe..a7489bf358e4616aec4fd37ee70287d5bb1ab8be 100644 --- a/debian/control +++ b/debian/control @@ -1,13 +1,38 @@ -Source: spark-update-tool +Source: spark-store +Maintainer: shenmo Section: utils Priority: optional -Maintainer: momen -Build-Depends: debhelper (>= 9) -Standards-Version: 3.9.6 -Homepage: https://gitee.com/spark-store-project/Spark-Update-Tool +Build-Depends: + cmake, + debhelper (>= 11), + pkg-config, + qtchooser (>= 55-gc9562a1-1~), + qt6-base-dev, + qt6-svg-dev, + qt6-tools-dev, + qt6-webengine-dev, + libdtkcommon-dev, + libdtk6core-dev, + libdtk6gui-dev, + libdtk6widget-dev +Standards-Version: 4.1.7 +Homepage: https://www.spark-app.store/ -Package: spark-update-tool +Package: spark-store Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Spark Update Tool - 星火应用商店更新组件。This package provides the Spark Update Tool. It includes features for checking for updates, downloading, and applying them seamlessly. \ No newline at end of file +Provides: spark-store-console-in-container +Depends: ${shlibs:Depends}, ${misc:Depends}, + dde-qt6integration, + curl, + openssl, + aria2, + qtwayland5, + gnupg, + zenity, + policykit-1 | pkexec, + libnotify-bin, + desktop-file-utils, + dpkg-dev, + lsb-release, +Description: Spark Store + A community powered app store, based on DTK. diff --git a/debian/copyright b/debian/copyright index 163489ed5542380605ce4603456e9658d8c72a3a..ac61728001548ba4d8c7a6796034bb0fff6b0fd9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,7 +1,22 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: spark-update-tool -Source: https://gitee.com/spark-store-project/Spark-Update-Tool +Upstream-Name: spark-store +Source: https://gitee.com/spark-store-project/spark-store Files: * -Copyright: 2025, momen -License: GPL-3.0+ \ No newline at end of file +Copyright: The Spark Project Developers + +License: GPL-3+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General diff --git a/debian/rules b/debian/rules index 1159ac4f0b7d8abe9203098f7b5da03c42c24257..e2af6fcb245f9c3e68da406d8a4ecbf1ec70e93b 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,36 @@ #!/usr/bin/make -f +include /usr/share/dpkg/default.mk + +export QT_SELECT = qt6 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +DEB_CFLAGS ?= $(shell dpkg-buildflags --get CFLAGS) +DEB_CPPFLAGS ?= $(shell dpkg-buildflags --get CPPFLAGS) +DEB_CXXFLAGS ?= $(shell dpkg-buildflags --get CXXFLAGS) + +DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +# Use realtime timestamp instead of the latest entry in debian/changelog +SOURCE_DATE_EPOCH := $(shell date +%s) + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE = 1 + %: - dh $@ + dh $@ --parallel override_dh_auto_configure: - dh_auto_configure -- -DCMAKE_INSTALL_PREFIX=/usr + dh_auto_configure -- \ + -DVERSION=$(DEB_VERSION_UPSTREAM) \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_FLAGS="$(DEB_CFLAGS) $(DEB_CPPFLAGS)" \ + -DCMAKE_CXX_FLAGS="$(DEB_CXXFLAGS) $(DEB_CPPFLAGS)" + +#Ignore the dpkg-shlibdeps: warning (it uses none of the library's symbols) +#Qt Mutidedia lib will ref to network libraray. +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--warnings=0 --exclude=opt/durapps/spark-store/bin/ss-feedback/ +override_dh_strip: + dh_strip --exclude=opt/durapps/spark-store/bin/ss-feedback/ \ No newline at end of file diff --git a/debian/spark-store.postinst b/debian/spark-store.postinst new file mode 100755 index 0000000000000000000000000000000000000000..879a976e1c6cabe6ee475b3c7a77ee10d734f740 --- /dev/null +++ b/debian/spark-store.postinst @@ -0,0 +1,78 @@ +#!/bin/bash + +case "$1" in + configure) + + case `arch` in + x86_64) + echo "Enabling i386 arch..." + dpkg --add-architecture i386 + ;; + + aarch64) + echo "Will not enable armhf since 4271" + ;; + loongarch64) + echo "Nope we DO NOT WANT ABI1 now" + dpkg --remove-architecture loongarch64 + ;; + + *) + echo "Unknown architecture, skip enable 32-bit arch" + ;; + esac + + mkdir -p /var/lib/aptss/lists + + # Remove the sources.list file + rm -f /etc/apt/sources.list.d/sparkstore.list + + # Check if /usr/local/bin existed + mkdir -p /usr/local/bin + ## I hate /usr/local/bin. We will abandon them later + # Create symbol links for binary files + ln -s -f /opt/durapps/spark-store/bin/spark-store /usr/local/bin/spark-store + ln -s -f /opt/durapps/spark-store/bin/ssinstall /usr/local/bin/ssinstall + ln -s -f /opt/durapps/spark-store/bin/ssaudit /usr/local/bin/ssaudit + ln -s -f /opt/durapps/spark-store/bin/ssinstall /usr/bin/ssinstall + ln -s -f /opt/durapps/spark-store/bin/ssaudit /usr/bin/ssaudit + ln -s -f /opt/durapps/spark-store/bin/spark-dstore-patch /usr/local/bin/spark-dstore-patch + ln -s -f /opt/durapps/spark-store/bin/spark-dstore-patch /usr/bin/spark-dstore-patch + ln -s -f /opt/durapps/spark-store/bin/aptss /usr/local/bin/ss-apt-fast + + ln -s -f /opt/durapps/spark-store/bin/aptss /usr/bin/aptss + + + + # Install key + mkdir -p /tmp/spark-store-install/ + cp -f /opt/durapps/spark-store/bin/spark-store.asc /tmp/spark-store-install/spark-store.asc + gpg --dearmor /tmp/spark-store-install/spark-store.asc + cp -f /tmp/spark-store-install/spark-store.asc.gpg /etc/apt/trusted.gpg.d/spark-store.gpg + + + + # Start upgrade detect service + systemctl daemon-reload + systemctl enable spark-update-notifier + systemctl start spark-update-notifier + + + # Update certain caches + update-icon-caches /usr/share/icons/hicolor || true + update-desktop-database /usr/share/applications || true + xdg-mime default spark-store.desktop x-scheme-handler/spk + update-mime-database /usr/share/mime || true + + # Send email for statistics + #/tmp/spark-store-install/feedback.sh + + # Remove temp dir + rm -rf /tmp/spark-store-install + ;; + + triggered) + spark-dstore-patch + + ;; +esac diff --git a/debian/spark-store.postrm b/debian/spark-store.postrm new file mode 100755 index 0000000000000000000000000000000000000000..4b19c635c8390a7cea7b30aed2bc15c58c7186e5 --- /dev/null +++ b/debian/spark-store.postrm @@ -0,0 +1,6 @@ +#!/bin/bash + +# Update certain caches +update-icon-caches /usr/share/icons/hicolor || true +update-desktop-database /usr/share/applications || true +update-mime-database /usr/share/mime || true diff --git a/debian/spark-store.preinst b/debian/spark-store.preinst new file mode 100755 index 0000000000000000000000000000000000000000..1eae804c4b5f04b90119dbaf2543668db7da63be --- /dev/null +++ b/debian/spark-store.preinst @@ -0,0 +1,28 @@ +#!/bin/bash +#检测网络链接畅通 +function network-check() +{ + #超时时间 + local timeout=15 + + #目标网站 + local target=www.baidu.com + + #获取响应状态码 + local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1` + + if [ "x$ret_code" = "x200" ]; then + echo "Network Checked successful ! Continue..." + echo "网络通畅,继续安装" + else + #网络不畅通 + echo "Network failed ! Cancel the installation" + echo "网络不畅,终止安装" + exit -1 + fi + +} + + +#network-check +echo "不再检测网络" \ No newline at end of file diff --git a/debian/spark-store.prerm b/debian/spark-store.prerm new file mode 100755 index 0000000000000000000000000000000000000000..49edfde9ad6bcd9096e6cddab81e92f98d6c2b48 --- /dev/null +++ b/debian/spark-store.prerm @@ -0,0 +1,64 @@ +#!/bin/bash + +function notify-send() +{ + # Detect the user using such display + local user=$(who | awk '{print $1}' | head -n 1) + + # Detect the id of the user + local uid=$(id -u $user) + + sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus notify-send "$@" +} + +if [ "$1" = "remove" -o "$1" = "purge" ] ; then + echo "$1" + echo "卸载操作,进行配置清理" + + # Remove residual symbol links + unlink /usr/local/bin/spark-store + unlink /usr/local/bin/ssinstall + unlink /usr/local/bin/ssaudit + unlink /usr/bin/ssinstall + unlink /usr/bin/ssaudit + unlink /usr/local/bin/spark-dstore-patch + unlink /usr/bin/spark-dstore-patch + unlink /usr/local/bin/ss-apt-fast + unlink /usr/bin/aptss + + rm -rf /etc/aptss/ + rm -rf /var/lib/aptss/ + + # Remove residual symbol links to stop upgrade detect + rm -f /etc/xdg/autostart/spark-update-notifier.desktop + # Remove config files +for username in `ls /home` + do + echo /home/$username + if [ -d /home/$username/.config/spark-union/spark-store ] + then + rm -rf /home/$username/.config/spark-union/spark-store + fi + done + + + # Shutdown services + systemctl stop spark-update-notifier + # Stop update detect service + systemctl disable spark-update-notifier + + + + # Remove gpg key file + rm -f /etc/apt/trusted.gpg.d/spark-store.gpg + apt-key del '9D9A A859 F750 24B1 A1EC E16E 0E41 D354 A29A 440C' || true +else + + if [ ! -z "`pidof spark-store`" ] ; then + echo "关闭已有 spark-store.." + notify-send "正在升级星火商店" "请在升级结束后重启星火商店" -i spark-store + killall spark-store + fi +fi + + diff --git a/debian/spark-store.triggers b/debian/spark-store.triggers new file mode 100644 index 0000000000000000000000000000000000000000..96a1351ffbab14a0a598127ca1ced8c058e01e08 --- /dev/null +++ b/debian/spark-store.triggers @@ -0,0 +1 @@ +interest-noawait /opt/apps diff --git a/patchs/README.md b/patchs/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f62895d80d3d088d96ba6ff90fd3f2b1c368e050 --- /dev/null +++ b/patchs/README.md @@ -0,0 +1,44 @@ +# 补丁操作说明 + +- 克隆与构建本项目 + + > 用于 zinface-community-cmake-build-system.patch 补丁化构建方式 + + ```shell + git clone https://gitee.com/spark-store-project/spark-store + cd spark-store + git am < patchs/zinface-community-cmake-build-system.patch + make package + sudo dpkg -i build/*.deb + ``` + + +- 在应用补丁时,并对补丁进行的更新操作 + + ```shell + # 切换到一个新的分支,即可开始进行补丁内的更新提交 + git checkout -b cmake-build-system + + # origin/dev 表示本仓库的 dev 开发分支 + # 在应用过补丁,并产生了新的提交,即可在当前所在补丁更新分支内 + # 相对基于 origin/dev 为参考,目前所包含的所有最新提交内容将生成为一个补丁文件(其中尾部为增量更新) + git format-patch --stdout origin/dev > patchs/zinface-community-cmake-build-system.patch + + # 最后,回到你的原 dev 分支,将被改变的补丁文件进行提交 + # 在推送完成后,即可放弃你在 cmake-build-system 分支中所有产生的内容(因为都已经进入补丁) + ``` + +- 一些注意事项 + + ```shell + # 在不了解补丁时,你需要认识一下补丁,但补丁与补丁之间有着不同的用法 + # 本 patchs/zinface-community-cmake-build-system.patch 补丁为 cmake 化构建 + + # 关于补丁的一些方面 + # 1. 首先你需要了解 git 是什么,以及简单的使用 + # 2. 你需要了解补丁是什么,以及简单的使用(应用补丁) + # 3. 你需要了解如何创建一个补丁,最基本的就是相对于旧目标分支,将本分区新增的提交进行导出为补丁 + # 4. 你可能只会将单个提交、或多个提交导出为补丁,但这还不够,你需要具有绝对的对于补丁的理解 + # 5. 对于不同的目的补丁,应该是多个 patch 文件存在的形式 + # 6. 最后,不管在什么时候,你在应用补丁前,你应该考虑是否应用到当前分支?为什么不切换到一个新的分支呢? + ``` diff --git a/patchs/zinface-community-cmake-build-system.patch b/patchs/zinface-community-cmake-build-system.patch new file mode 100644 index 0000000000000000000000000000000000000000..d0eed58c8eab5690b3066144ec1407cba12eddcb --- /dev/null +++ b/patchs/zinface-community-cmake-build-system.patch @@ -0,0 +1,4919 @@ +From 2b0f5447a8c13fa63aed5286cf4b3bdbf2f04e46 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Sun, 11 Dec 2022 22:27:23 +0800 +Subject: [PATCH 01/12] =?UTF-8?q?repo:=20=E4=B8=80=E6=AC=A1=E6=80=A7?= + =?UTF-8?q?=E5=AF=BC=E5=85=A5=20spark=20=E9=AA=A8=E6=9E=B6=E4=BB=A5?= + =?UTF-8?q?=E5=8F=98=E4=B8=BA=20cmake=20=E6=9E=84=E5=BB=BA?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +TODO: 需处理 deb 安装脚本的问题 +Signed-off-by: zinface +--- + .gitignore | 35 +++ + CMakeLists.txt | 93 ++++++++ + Makefile | 60 +++++ + assets/spark.png | Bin 0 -> 4959 bytes + cmake/DebPackageConfig.cmake | 327 +++++++++++++++++++++++++++ + cmake/SparkAppimageConfig.cmake | 132 +++++++++++ + cmake/SparkBuildGraphviz.cmake | 8 + + cmake/SparkDesktopMacros.cmake | 35 +++ + cmake/SparkEnvConfig.cmake | 8 + + cmake/SparkFindDtkConfig.cmake | 11 + + cmake/SparkFindLibraries.cmake | 7 + + cmake/SparkFindQt5Config.cmake | 154 +++++++++++++ + cmake/SparkFindQt6Config.cmake | 24 ++ + cmake/SparkInstallMacrosConfig.cmake | 132 +++++++++++ + cmake/SparkMacrosConfig.cmake | 129 +++++++++++ + cmake/SparkMacrosExtendConfig.cmake | 196 ++++++++++++++++ + cmake/SparkTranslatorConfig.cmake | 27 +++ + cmake/linuxdeployqt-help | 48 ++++ + cmake/package-deb.descript | 44 ++++ + cmake/spark-appimage.desktop.in | 9 + + cmake/spark-desktop.desktop.in | 11 + + 21 files changed, 1490 insertions(+) + create mode 100644 CMakeLists.txt + create mode 100644 Makefile + create mode 100644 assets/spark.png + create mode 100644 cmake/DebPackageConfig.cmake + create mode 100644 cmake/SparkAppimageConfig.cmake + create mode 100644 cmake/SparkBuildGraphviz.cmake + create mode 100644 cmake/SparkDesktopMacros.cmake + create mode 100644 cmake/SparkEnvConfig.cmake + create mode 100644 cmake/SparkFindDtkConfig.cmake + create mode 100644 cmake/SparkFindLibraries.cmake + create mode 100644 cmake/SparkFindQt5Config.cmake + create mode 100644 cmake/SparkFindQt6Config.cmake + create mode 100644 cmake/SparkInstallMacrosConfig.cmake + create mode 100644 cmake/SparkMacrosConfig.cmake + create mode 100644 cmake/SparkMacrosExtendConfig.cmake + create mode 100644 cmake/SparkTranslatorConfig.cmake + create mode 100644 cmake/linuxdeployqt-help + create mode 100644 cmake/package-deb.descript + create mode 100644 cmake/spark-appimage.desktop.in + create mode 100644 cmake/spark-desktop.desktop.in + +diff --git a/.gitignore b/.gitignore +index 21d239c..b55ce0c 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -54,3 +54,38 @@ debian/spark-store + + .vscode/* + src/spark-store ++ ++# Ignore the build directory generated by the vsocde cmake extension ++build/ ++# Ignore the build directory generated by the vsocde clangd extension ++.cache ++ ++# Created by https://www.toptal.com/developers/gitignore/api/cmake ++# Edit at https://www.toptal.com/developers/gitignore?templates=cmake ++ ++### CMake ### ++CMakeLists.txt.user ++CMakeCache.txt ++CMakeFiles ++CMakeScripts ++Testing ++Makefile ++cmake_install.cmake ++install_manifest.txt ++compile_commands.json ++CTestTestfile.cmake ++_deps ++ ++### CMake Patch ### ++# External projects ++*-prefix/ ++ ++# End of https://www.toptal.com/developers/gitignore/api/cmake ++ ++!/Makefile ++# Ignore the build directory generated by the vsocde cmake extension ++build/ ++# Ignore the build directory generated by the vsocde clangd extension ++.cache ++# Ignore the make package/copytosource ++*.deb +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..51cc090 +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,93 @@ ++ ++cmake_minimum_required(VERSION 3.5.1) ++ ++project(spark-store LANGUAGES CXX VERSION 4.0.0) ++ ++include(cmake/SparkEnvConfig.cmake) # 设置一些有关QT构建的开关 ++include(cmake/SparkMacrosConfig.cmake) # 声明了一些 spark_ 开头的 macro 宏 ++include(cmake/SparkFindLibraries.cmake) # 提供了基于 spark_ 宏生成的 target_link_ 用于目标链接 的库 ++include(cmake/SparkFindQt5Config.cmake) # 提供了 target_link_qt5 用于目标链接 qt5 的库 ++include(cmake/SparkFindDtkConfig.cmake) # 提供了 target_link_dtk 用于目标链接 dtk 的库 ++include(cmake/SparkTranslatorConfig.cmake) # 提供了 qt5 ts转qm 的操作,最终生成 SPARK_QM_TRANSLATIONS 变量用于构建可执行文件时参与编译 ++include(cmake/SparkMacrosExtendConfig.cmake) # 使用了 spark_ 宏基于已提供的宏参数自动展开构建可执行目标文件 ++include(cmake/SparkInstallMacrosConfig.cmake) # 提供了 spark_install 开头的 macro 宏用于安装 target、file、program、directory、changelog 等内容 ++ ++# 资源文件路径 ++set(QRC_SOURCES "src/assets/assets.qrc") ++ ++include_directories(src) ++ ++# 基于传入的项进行构建 ++# 可接受的值为: 路径列表 ++# 可接受的值为: 路径列表+依赖库A+依赖库B ++spark_add_library_realpaths( ++ src/dbus ++ src/utils+dbus ++ src/backend+utils ++ src/widgets/common+backend ++ src/widgets+common ++ src/pages+widgets ++) ++ ++target_link_qt5_dbus(dbus) ++target_link_qt5_Concurrent(common) ++target_link_qt5_Concurrent(backend) ++target_link_qt5_WebEngineWidgets(common) ++ ++spark_add_executable_path(${PROJECT_NAME} src ++ ${QRC_SOURCES} ${SPARK_QM_TRANSLATIONS} ++) ++target_link_dbus(${PROJECT_NAME}) ++target_link_pages(${PROJECT_NAME}) ++target_link_dtk(${PROJECT_NAME}) ++ ++ ++spark_add_executable_path(spark-dstore-patch src/spark-dstore-patch) ++target_link_qt5(spark-dstore-patch) ++ ++ ++# 安装主程序 spark-store 与 spark-dstore-patch ++spark_install_target(/opt/durapps/${PROJECT_NAME}/bin ++ ${PROJECT_NAME} ++ spark-dstore-patch) ++ ++# 安装 systemd 服务(Spark Store更新通知程序) ++spark_install_file(/usr/lib/systemd/system/ ++ pkg/usr/lib/systemd/system/spark-update-notifier.service) ++ ++# 安装 polkit 操作(运行 ss-do-upgrade-worker 需要权限) ++spark_install_file(/usr/share/polkit-1/actions/ ++ pkg/usr/share/polkit-1/actions/store.spark-app.ss-do-upgrade-worker.policy) ++ ++# 安装 spark-store 所需要的 tool 脚本 ++spark_install_directory(/opt/durapps/${PROJECT_NAME}/bin ++ tool/*) ++ ++# 安装 bash_completion ++spark_install_file(/usr/share/bash-completion/completions ++ pkg/usr/share/bash-completion/completions/aptss) ++ ++# 安装 desktop 文件 ++spark_install_file(/usr/share/applications ++ pkg/usr/share/applications/spark-store.desktop) ++ ++# 安装 icon 文件 ++spark_install_file(/usr/share/icons/hicolor/scalable/apps ++ pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg) ++ ++# 安装什么脚本? ++spark_install_program(/tmp/spark-store-install ++ pkg/tmp/spark-store-install/feedback.sh) ++ ++# 安装 qm 文件? ++spark_install_file(/usr/share/spark-store/translations ++ ${SPARK_QM_TRANSLATIONS}) ++ ++# 安装 changelog 文件,将自动使用 gzip 压缩 ++spark_install_changelog(${CMAKE_SOURCE_DIR}/debian/changelog) ++ ++include(cmake/SparkBuildGraphviz.cmake) ++ ++# 注释行(使用方式) ++find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) ++add_package_descript(cmake/package-deb.descript) +\ No newline at end of file +diff --git a/Makefile b/Makefile +new file mode 100644 +index 0000000..334ead1 +--- /dev/null ++++ b/Makefile +@@ -0,0 +1,60 @@ ++CPUS=$(shell nproc) ++CALENDAR=$(shell date '+%Y%m%d') ++OSID=$(shell lsb_release -si) ++OSRELEASE=$(shell lsb_release -sr) ++SUFFIX= ++ifneq ("$(OSID)", "") ++SUFFIX=_$(OSID)$(OSRELEASE) ++endif ++ ++PROJECT_NAME=spark-store ++ ++all: ++ mkdir -p build ++ cd build && cmake .. ++ cd build && make -j$(CPUS) ++ ++run: all ++ exec $(shell find build/ -maxdepth 1 -type f -executable | grep $(PROJECT_NAME)) ++ ++debug: ++ mkdir -p build ++ cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. ++ cd build && make -j$(CPUS) ++ ++release: ++ mkdir -p build ++ cd build && cmake -DCMAKE_BUILD_TYPE=Release -DPACKAGE_SUFFIX="$(SUFFIX)" .. ++ cd build && make -j$(CPUS) ++ ++package: release ++ cd build && make package ++ tree build/_CPack_Packages/Linux/DEB/$(PROJECT_NAME)-* ++ dpkg-deb --contents build/$(PROJECT_NAME)_*$(CALENDAR)*$(SUFFIX).deb ++ # cd build/_CPack_Packages/Linux/DEB/$(PROJECT_NAME)_*$(CALENDAR)*$(SUFFIX).deb && find . ++ ++builddeps: ++ cd build && make builddeps ++ ++cpus: ++ @echo "CPU数量: $(CPUS)" ++ ++copytosource:package ++ cp build/$(PROJECT_NAME)_*$(CALENDAR)*.deb . ++ ++# 进入 qdebug 模式,在 deepin 中默认被禁用,可 env | grep QT 查看,并在 /etc/X11/Xsession.d/00deepin-dde-env 配置中已定义 ++# 1. 禁止 qt 的 debug 打印: qt.*.debug=false ++# qt.qpa.input.events ++# qt.qpa.events ++# 2. 禁止 dtk 的 debug 打印: dtk.*.debug=false ++# dtk.dpluginloader ++# 3. 禁止 qtcreator 本身的 debug 打印 ++# qtc.autotest.testcodeparser ++# qtc.clangbackend.server ++# ... ++# 4. 关闭其它的太麻烦了,直接只启用本地 debug ++# .debug=true ++enter-qdebug-mode: ++ # 进入新的 bash 环境 ++ @# export QT_LOGGING_RULES=".debug=true; qt.*.debug=false; dtk.*.debug=false; dde.*.debug=false; qtc*=false; " && bash ++ export QT_LOGGING_RULES=".debug=true" && bash +\ No newline at end of file +diff --git a/assets/spark.png b/assets/spark.png +new file mode 100644 +index 0000000000000000000000000000000000000000..544e2c7cff5f70894e27a7a717d4a62120630b7a +GIT binary patch +literal 4959 +zcmZ9Qc|26n`^T?!hOvx&4Pz%{EZLPYvTq^E5@pRcGGvX$AW~VT?0YC8CHu}WL)I*j +zCA+d^OJw_v@Avn|@AZ4V?z!iAo%_7*bMCpH^W6J>;>=8R>1nxX0RW)a*F)YU^_YtW +zrY4=^DWIpMj{2UVE)p04)_~)Bx;9qQ2n|Z_wm$&K2wgO?prUJmq(Kl`-&hB=G~+P>c2E7|m)F7F$6%61XMsolUg0zXycp@v@GZ1K>rt9xd?C!>%*+W7 +z%C&esu?1QvJQKjm(&8q^?oTJ)%8V0?)|OjY&d?Gr6jy6+xCM5i6!*6NB4P1KRCNm^ +zm+NR*M%4c-!-n9r0lIJ!D)W+&T9oD)Dem^7SRik@V(WfPQ@fFKyaf2lH?CLvA5uka +za&warZ&7cj6r);vpGc6CZ?~=95k;2K+aF*1m@^PTnvH2@U9bunlhI3nmsfK^BZU;4=_*3}V}PoZ +zEP*COH$^QdyIwzO=Shp{b@@LAC7u=@nYJ8)oEoIduWITqMn>MScBnM|V;V8ajW%>c +z2|9_!;}u5SRyWpkQzR8giy|l$Ivq`@U%TZM4}hv^OUIk_s0z#=s!u~04W3Iv&C;FbL%51jwmUPHQ@0l~qZwrDUlHbTaRh}I7O +zg75zlU9YVkytJ~+#_*>+av3b*ZLbM`=lrm(GyKlhzDKd&-~YS-XuB{i6aEdZrmT8V +z5=&CIeIGmv+apvfRY7`h1Zf4_L_-7KYf+zDaL#{K)Hw61>q|2q>%TNiMk|sXtmY*1 +z`E77tq7vBO#3uo(t!jj^QMa-dh___m=cxM&AL^ +zdT&14OSgK$%!-|9_M)?`i4B)w7eegd!IoH)mWyyhiqc1~EPAqoCCYEgl(hFM{^Ftj +z%GS_$^uT6K)$jtUK69tc1oS-cV3H( +zyzVwJW(p>4KWuO@dx-z65M|t#j~xmYkY<&V$cV9IcL@+9-%Akb(9C^=$km21|8lq_ +za=b^e+n~SA!s?z86LD4&0RU2Vl|bwCrvOB*uG>-oaP+AaCy?IW;MZ7A&oS_=puC#x +zTSjKS2X}HZv)}oKicKX7<~q>8hy|~*HpzV*Y^DRSBNNv-=R$KtX-5a5FE!_Wj#!o0njA +z8JkG4+{e@({dOMVP51|1y`CGI?{rMiLdMQTV)8ojeNwqrgP)*5q}hq9`jG=rE*1L0 +z=0gY)xu5I$L0nYIwuM<@k7MqNbid7Ko1mz?Wtyzjo`jUhJJU|J`Jq_(fZ+l%ogp5Y +zIDI`mBjycCE3h-oAO06y%KHv_U0fWu7`0F)$u5yL6u~KnhuEC++z(})gQ{w9X}O1^ +ziig+EPJfUA4&ecpZ?0Sc06XsoNMjeO3Wcj3%MW32I2nYaNKiwF#jknm8fO-R8aEHO +zS;P_Zcdx7H>7UoVjHFijGh;WVUGy??)C=6c|6BJ?%amgTP(}HCU2Z0Y^Sx|AO%6>B +z7k8KD-1)Kga0b7Xt>)Jmz><_Svi*-IB6_0ky0@X$d%1Z$EAcD*>w~VW$*SRrQOa6E +z)cKJdzv;DO-USxsZnV8sfR>g0;TF*eXKlHEv~kBDQlVHocet}SvAsdI1E^G1doNa$er}pksd?U1pF|_rB +zSIJIEOQLI~-J9cO}P)Oz~yJ4z~jwPCIW7GR>tKG}oJGSkdoz};#7?(Sg>_x?Y_Q?4k +zZ$BO!ta2Sdt}R&N@%WDQoxFGNn8p;VW$7qF|8D7og^|0?JUW*}Y|jx!#LUqPlwg=m +zRt9aEBD1%*_tO_~T=|(R%DbCN?p_VFK+vzERN1}RWAZ6OAYYD(J}CcnVj9+as%G)o +z;NJXAE1<2%q6D=&D&c&^K7J$1uCL+uS>u|xgNGNU%c~o5r72Q`D?M*NaI@;bFQ#CT +zV0IV|1Ll4vb*8mCG70}W_>J!pbL`q(Mk#Luq5Ho-?sljN6JfW)-Tyt?3`DZ%L +z>1cfFaA%b9aDM4sjzPiuCSI52j;PmRFq03dvd{@)=@Z9{wG$dz~4@#t3rj;1m%CZ{=~k9~XcBC6v7NckqV@1WVYQ<43f3{9(XPWS>EN{EO~*-CK*bt;ZS;!OLuY +z87ft)RVyp(Cw{BC?#*W-X}?E8n+mG`{Ikbd@Mf3BkFQ_T3aIyS+g0*qIBMqV83`?o +zX*3SoyLQT=V65w9M3)n><3cpp4wMiSNQ6I0WTSfL@yq6O5RJ^;rpPEzOSf?<#OEal +z#JE8?_%;i?y7A-hXB(+R7p{hi!m)9NPT7A;G|icpHm~wS^k`I({`l+|qO9g~*i~G*9imYv^HH~-3PeB-S_xwv+Y2l=g6>lXZk|B1v+dn| +zeA>r~Z}f3>@rByy3Q&w80&#K>pvR%5geJnqq +z#YL_Lw5jl$vkg7ZRPvcNku1Nz{`lM2`2I+BH-`3Ba?R1ny-~VYe +z9l%0>oH`pOV?m#)LN)yxXMS#M>?$?Ja6PLFE);UCNl#M06nrh>lc`K1PMyM&Ka>tI +zyKVLSSwJ-z2RXNRh*UcPO%t2{i@X_0uuwJ6@h;-=Qef3g6X8cFUHPoCZIv{}R78rZ%99agCe;SpR +z2&R5q?E=vp9E`14e_L9iWfefrys(&*EXOenhi}(uR8D%;1^v32tF*i$meYY6!3~@Q +zv5OSB5c`O2eYdLw^yThU*z33iu!U)sm(UUi!Yh5@S`weCs{BaFFDP7dWAap2{nG=s +zg+-P;PwqQ+?wHvS{X^xRx~)ampA>1zW`P2@zwfa|>{ +z(Zt?9q>hUSNyY-w8WjF3)S{^{Y;7-zeNdEWXCYNlYE#WdCdLmAQQa{ib}eB{46!Vm +zo13!fMtVj@*A05r-xRqe1O+nR=OyKWG>u1mlD&rJ7WUEOHCORSf`H4G9m&D*U>eu{ +zLp6o#gU{59h79h}@mqyQxAYnwjZ3|e)+cm~c9C*PmcN-nJ13-pb9}j+aMZB3eWbuU +z(aP`J@@Js(3eo*K%?H@(M#W~b(~+qW`F;+iobQ&M*W>{=WjBNNZqtpbh4N5N(I2dG +z-RX`fI|JPp?}OI)XaR2iVs;j=E!yAobeUouDw>}0b0z1W+MTAGY0eJ{GDB$rxn+Jx +zijgtNgG}Ip-xgzR(6Yw>ce#I{RXF)m?YpDnSx1P +z-qxP|)1Pe80-2Yo{|kjzD-b|ra*a%GbQ-JEf +zY4Ef^R`Uo`;5%GzqsAjSR8OWeT$^xkT*!`awX@U|_Abd2Kni%MHCjtQr!HimpSd78 +zqrPOZv^3?zweIu9Gt!GTOD19I)$#R&XHcKG{N6t4Uzm)% +z_&ik-;lla8ao5f-XCXafQiDpVG*V0{N!aCZPn=1CN`%)rVO5b3-l1<&5Rm>dgqG6& +zi6I?9NDN#D1uh~vl;mU=49d2IlV^tnzNl6O2YpihPema^^jse;K;WdUa}|$oaghqg +z(6Awt@Duo-@b4d^62bJ31eGM@W)0Qd@X!Ndd;7ddj(j^*YY2nz}q(w%?j=RPLP@eEF|B$PQ2KtCtcE0TG0n}qx$Q0g;>#Q +zXb4R~mYm3CJ1RdzfK4TCyeNO)4km{6`QK7Rtf74G7sV*O8|HzS0B>>4yF}W2o(lp* +zM{UWrv+Ba@vnVNI88u6!KF%=Wbx&cqT*am6q30wD#F98KVc5!5oJkm|LweHam10~r +zX@~3#%zVK@yDeBv6!qOETx37pSa`UBTxI#cHI-Sl3=?)E1K4yNsZ5YEKwM8qGV1Vn +zk8qYSbHYB+UTkQmS +t;Jjx^&~6n@&egfT2m_h_UkqA5Co_+SJESY3=}2`iKwrlMS%GlG{15vgE&>1m + +literal 0 +HcmV?d00001 + +diff --git a/cmake/DebPackageConfig.cmake b/cmake/DebPackageConfig.cmake +new file mode 100644 +index 0000000..d0351ec +--- /dev/null ++++ b/cmake/DebPackageConfig.cmake +@@ -0,0 +1,327 @@ ++cmake_minimum_required(VERSION 3.0.0) ++ ++# function(add_deb_package PACKAGE_NAME PACKAGE_VERSION PACKAGE_MAINTAINER PACKAGE_EMAIL PACKAGE_SHORT_DESCRIPTION PACKAGE_LONG_DESCRIPTION) ++ ++# endfunction(add_deb_package PACKAGE_NAME PACKAGE_VERSION PACKAGE_MAINTAINER PACKAGE_EMAIL PACKAGE_SHORT_DESCRIPTION PACKAGE_LONG_DESCRIPTION) ++ ++# if(add_deb_package VALUE) set(Package ${VALUE} PARENT_SCOPE) endif(add_deb_package VALUE) ++# if(add_deb_version VALUE) set(Version ${VALUE} PARENT_SCOPE) endif(add_deb_version VALUE) ++# if(add_deb_maintainer VALUE) set(Maintainer ${VALUE} PARENT_SCOPE) endif(add_deb_maintainer VALUE) ++# if(add_deb_email VALUE) set(Email ${VALUE} PARENT_SCOPE) endif(add_deb_email VALUE) ++# if(add_deb_descrition VALUE) set(Descrition ${VALUE} PARENT_SCOPE) endif(add_deb_descrition VALUE) ++# if(add_deb_detail VALUE) set(Detail ${VALUE} PARENT_SCOPE) endif(add_deb_detail VALUE) ++ ++ ++# set(Package "") ++# set(Version "") ++# set(Architecture "") ++# set(Maintainer "") ++# set(Email "") ++# set(Descrition "") ++ ++function(find_str _IN _SEP _OUT) ++ string(FIND "${_IN}" "${_SEP}" _TMP) ++ set(${_OUT} ${_TMP} PARENT_SCOPE) ++endfunction(find_str _IN _SEP _OUT) ++ ++ ++function(find_next _IN _OUT) ++ find_str("${_IN}" "\n" _TMP) ++ set(${_OUT} ${_TMP} PARENT_SCOPE) ++endfunction(find_next _IN _OUT) ++ ++function(sub_next _IN _INDEX _OUT __OUT) ++ find_next(${_IN} _NEXTINDEX) ++ string(SUBSTRING "${_IN}" ${_INDEX} ${_NEXTINDEX} _TMP) ++ math(EXPR _NEXTINDEX ${_NEXTINDEX}+1) ++ string(SUBSTRING "${_IN}" ${_NEXTINDEX} -1 __TMP) ++ set(${_OUT} ${_TMP} PARENT_SCOPE) ++ set(${__OUT} ${__TMP} PARENT_SCOPE) ++endfunction(sub_next _IN _INDEX _OUT) ++ ++function(trim_str _IN _OUT) ++ string(STRIP "${_IN}" _TMP) ++ set(${_OUT} ${_TMP} PARENT_SCOPE) ++endfunction(trim_str _IN _OUT) ++ ++function(split_str _IN _SEP _OUT) ++ string(FIND "${_IN}" "${_SEP}" _TMP_INDEX) ++ if(NOT _TMP_INDEX EQUAL -1) ++ string(SUBSTRING "${_IN}" 0 ${_TMP_INDEX} _TMP) ++ math(EXPR _TMP_INDEX ${_TMP_INDEX}+1) ++ string(SUBSTRING "${_IN}" ${_TMP_INDEX} -1 __TMP) ++ set(${_OUT} "${_TMP};${__TMP}" PARENT_SCOPE) ++ else() ++ set(${_OUT} ${_IN} PARENT_SCOPE) ++ endif(NOT _TMP_INDEX EQUAL -1) ++endfunction(split_str _IN _SEP _OUT) ++ ++function(split_str_p _IN _SEP _OUT __OUT) ++ split_str("${_IN}" "${_SEP}" _TMP) ++ list(GET _TMP 0 __TMP) ++ list(GET _TMP 1 ___TMP) ++ set(${_OUT} ${__TMP} PARENT_SCOPE) ++ set(${__OUT} ${___TMP} PARENT_SCOPE) ++endfunction(split_str_p _IN _SEP _OUT __OUT) ++ ++function(split_str_n _IN _SEP _OUT _N) ++ if(_N GREATER 1) ++ set(_C ${_N}) ++ set(_RET "") ++ set(_NEXT ${_IN}) ++ while(NOT _C EQUAL 0) ++ split_str("${_NEXT}" "${_SEP}" _TMP) ++ list(LENGTH _TMP _TMP_LEN) ++ if(_TMP_LEN EQUAL 2) ++ list(GET _TMP 0 __TMP) ++ list(GET _TMP 1 _NEXT) ++ list(APPEND _RET ${__TMP}) ++ else() ++ break() ++ endif(_TMP_LEN EQUAL 2) ++ math(EXPR _C "${_C}-1") ++ endwhile(NOT _C EQUAL 0) ++ list(APPEND _RET ${_NEXT}) ++ set(${_OUT} ${_RET} PARENT_SCOPE) ++ else() ++ split_str("${_IN}" "${_SEP}" _TMP) ++ set(${_OUT} ${_TMP} PARENT_SCOPE) ++ endif(_N GREATER 1) ++endfunction(split_str_n _IN _SEP _OUT _N) ++ ++ ++function(set_package_vars _IN_KEY _IN_VAL) ++ ++ # trim_str("${_IN_KEY}" _IN_KEY) ++ ++ find_str("${_IN_KEY}" "Type" _Type) ++ if(_Type EQUAL "0") ++ string(TOUPPER "${_IN_VAL}" _IN_VAL_UPPER) ++ string(TOLOWER "${_IN_VAL}" _IN_VAL_LOWER) ++ set(CPACK_GENERATOR "${_IN_VAL_UPPER}" PARENT_SCOPE) ++ message("--> 软件包类型: ${_IN_VAL_LOWER}") ++ endif(_Type EQUAL "0") ++ ++ find_str("${_IN_KEY}" "Package" _Package) ++ if(_Package EQUAL "0") ++ if(_IN_VAL STREQUAL "auto") ++ set(CPACK_DEBIAN_PACKAGE_NAME "${PROJECT_NAME}" PARENT_SCOPE) ++ else() ++ set(CPACK_DEBIAN_PACKAGE_NAME "${_IN_VAL}" PARENT_SCOPE) ++ endif(_IN_VAL STREQUAL "auto") ++ message("--> 软件包名: ${_IN_VAL}") ++ endif(_Package EQUAL "0") ++ ++ find_str("${_IN_KEY}" "Version" _Version) ++ if(_Version EQUAL "0") ++ if(_IN_VAL STREQUAL "auto") ++ set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}" PARENT_SCOPE) ++ else() ++ set(CPACK_DEBIAN_PACKAGE_VERSION "${_IN_VAL}" PARENT_SCOPE) ++ endif(_IN_VAL STREQUAL "auto") ++ ++ message("--> 软件版本: ${_IN_VAL}") ++ endif(_Version EQUAL "0") ++ ++ find_str("${_IN_KEY}" "CalVer" _CalVer) ++ if(_CalVer EQUAL "0") ++ set(CalVer "${_IN_VAL}" PARENT_SCOPE) ++ message("--> 日历化版本: ${_IN_VAL}") ++ endif(_CalVer EQUAL "0") ++ ++ find_str("${_IN_KEY}" "Architecture" _Architecture) ++ if(_Architecture EQUAL "0") ++ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE) ++ if(_IN_VAL STREQUAL "auto") ++ execute_process( ++ COMMAND dpkg --print-architecture ++ OUTPUT_VARIABLE _RETV ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ ) ++ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_RETV}" PARENT_SCOPE) ++ endif(_IN_VAL STREQUAL "auto") ++ message("--> 软件架构: ${_IN_VAL}") ++ endif(_Architecture EQUAL "0") ++ ++ find_str("${_IN_KEY}" "Priority" _Priority) ++ if(_Priority EQUAL "0") ++ set(CPACK_DEBIAN_PACKAGE_PRIORITY "${_IN_VAL}" PARENT_SCOPE) ++ message("--> 优先级: ${_IN_VAL}") ++ endif(_Priority EQUAL "0") ++ ++ find_str("${_IN_KEY}" "Depends" _Depends) ++ if(_Depends EQUAL "0") ++ set(CPACK_DEBIAN_PACKAGE_DEPENDS "${_IN_VAL}" PARENT_SCOPE) ++ message("--> 软件依赖: ${_IN_VAL}") ++ endif(_Depends EQUAL "0") ++ ++ find_str("${_IN_KEY}" "Maintainer" _Maintainer) ++ if(_Maintainer EQUAL "0") ++ set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${_IN_VAL}" PARENT_SCOPE) ++ message("--> 软件维护者: ${_IN_VAL}") ++ endif(_Maintainer EQUAL "0") ++ ++ find_str("${_IN_KEY}" "Homepage" _Homepage) ++ if(_Homepage EQUAL "0") ++ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${_IN_VAL}" PARENT_SCOPE) ++ message("--> 软件主页: ${_IN_VAL}") ++ endif(_Homepage EQUAL "0") ++ ++ find_str("${_IN_KEY}" "Recommends" _Recommends) ++ if(_Recommends EQUAL "0") ++ set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "${_IN_VAL}" PARENT_SCOPE) ++ message("--> 软件建议: ${_IN_VAL}") ++ endif(_Recommends EQUAL "0") ++ ++endfunction(set_package_vars _IN_KEY _IN_VAL) ++ ++# 定义一个自定义(add_package_descript)函数 ++# 用于按特定配置约定自动化构建软件包配置 ++function(add_package_descript IN_DES) ++ set(PACKAGE_DES_PATH "${IN_DES}") ++ ++ if(EXISTS ${IN_DES}) ++ ++ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${IN_DES}") ++ set(PACKAGE_DES_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${IN_DES}") ++ else() ++ message(FATAL_ERROR "!! Not Found Path: ${PACKAGE_DES_PATH}") ++ return() ++ endif(EXISTS ${IN_DES}) ++ ++ file(READ ${PACKAGE_DES_PATH} DES_CONTENT) ++ trim_str("${DES_CONTENT}" DES_CONTENT) ++ ++ ################## 解析 ################## ++ ++ sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT) ++ set(PREV_DES "") ++ while(NOT DES_LINE STREQUAL "${PREV_DES}") ++ # 检查该描述行是否是 # 注释开头,是的话将跳过该行 ++ find_str("${DES_LINE}" "#" _COMMENT) ++ if(_COMMENT EQUAL "0") ++ message("--> !!!!!!! ${DES_LINE}") ++ sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT) ++ continue() ++ endif(_COMMENT EQUAL "0") ++ ++ # 检查该描述行是否是 Descrition 开头,是的话说明描述结尾了 ++ find_str("${DES_LINE}" "Descrition" _DESCRIPTION) ++ if(_DESCRIPTION EQUAL "0") ++ break() ++ endif(_DESCRIPTION EQUAL "0") ++ ++ split_str_n("${DES_LINE}" ":" _TMP 1) ++ list(LENGTH _TMP _TMP_LEN) ++ ++ if(_TMP_LEN EQUAL 2) ++ split_str_p("${DES_LINE}" ":" _TMP __TMP) ++ trim_str("${__TMP}" __TMP) ++ string(LENGTH "${__TMP}" __TMP_LENGTH) ++ if(NOT __TMP_LENGTH EQUAL "0") ++ set_package_vars("${_TMP}" "${__TMP}") ++ endif(NOT __TMP_LENGTH EQUAL "0") ++ endif(_TMP_LEN EQUAL 2) ++ ++ # 记录当前行,获取下一行,可能是已经结尾了(将保持重复行) ++ set(PREV_DES "${DES_LINE}") ++ sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT) ++ endwhile(NOT DES_LINE STREQUAL "${PREV_DES}") ++ ++ ++ # 再一次检查该描述行是否是 Descrition 开头,是的话将进行分析描述行 ++ find_str("${DES_LINE}" "Descrition" _DESCRIPTION) ++ if(_DESCRIPTION EQUAL "0") ++ split_str_p("${DES_LINE}" ":" _TMP __TMP) ++ trim_str("${__TMP}" __TMP) ++ set(Descrition ${__TMP}) ++ set(PREV_DES_LINE "") ++ while(NOT PREV_DES_LINE STREQUAL DES_LINE) ++ if(NOT PREV_DES_LINE STREQUAL "") ++ set(Descrition "${Descrition}\n${DES_LINE}") ++ endif(NOT PREV_DES_LINE STREQUAL "") ++ set(PREV_DES_LINE "${DES_LINE}") ++ sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT) ++ endwhile(NOT PREV_DES_LINE STREQUAL DES_LINE) ++ # set(Descrition "${Descrition}") ++ message("--> 软件说明: ${Descrition}") ++ ++ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${Descrition}) ++ endif(_DESCRIPTION EQUAL "0") ++ ++ ##################### deb ##################### ++ # ARCHITECTURE ++ if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") ++ set(ARCHITECTURE "amd64") ++ elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "aarch64") ++ set(ARCHITECTURE "arm64") ++ endif() ++ ++ #################### Calendar Version ################### ++ if("${CalVer}" STREQUAL "true") ++ string(TIMESTAMP BUILD_TIME "%Y%m%d") ++ set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_DEBIAN_PACKAGE_VERSION}-${BUILD_TIME}") ++ endif("${CalVer}" STREQUAL "true") ++ ++ ++ ++ ##################### deb file name ##################### ++ set(_Package "${CPACK_DEBIAN_PACKAGE_NAME}") ++ set(_Version "${CPACK_DEBIAN_PACKAGE_VERSION}") ++ set(_Architecture "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") ++ ++ set(_DebFileName ++ "${_Package}_${_Version}_${_Architecture}${PACKAGE_SUFFIX}.deb" ++ ) ++ set(CPACK_DEBIAN_FILE_NAME ${_DebFileName}) ++ ++ ++ # set(CPACK_DEBIAN_PACKAGE_NAME "${Package}") ++ # set(CPACK_DEBIAN_PACKAGE_VERSION "${Version}") ++ # set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${Architecture}") ++ # set(CPACK_DEBIAN_PACKAGE_DEPENDS "${Depends}") ++ # set(CPACK_DEBIAN_PACKAGE_PRIORITY "${Priority}") ++ # set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${Maintainer}") ++ # set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${Descrition}") ++ ++ # 设置即将使用的标准脚本 ++ set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ++ # "${CMAKE_SOURCE_DIR}/config/DEBIAN/preinst" ++ # "${CMAKE_SOURCE_DIR}/config/DEBIAN/postinst" ++ # "${CMAKE_SOURCE_DIR}/config/DEBIAN/prerm" ++ # "${CMAKE_SOURCE_DIR}/config/DEBIAN/postrm" ++ "${CMAKE_SOURCE_DIR}/debian/spark-store.postinst" ++ "${CMAKE_SOURCE_DIR}/debian/spark-store.postrm" ++ "${CMAKE_SOURCE_DIR}/debian/spark-store.preinst" ++ "${CMAKE_SOURCE_DIR}/debian/spark-store.prerm" ++ ) ++ ++ # 设置为ON,以便使用 dpkg-shlibdeps 生成更好的包依赖列表。 ++ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) ++ # set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) ++ # set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY "=") ++ ++ include(CPack) ++ ++endfunction(add_package_descript IN_DES) ++ ++ ++# TODO: ++# CPACK_GENERATOR ++# CPACK_DEBIAN_FILE_NAME - n ++# CPACK_DEBIAN_PACKAGE_NAME - y ++# CPACK_DEBIAN_PACKAGE_VERSION - y ++# CPACK_DEBIAN_PACKAGE_ARCHITECTURE - y(auto) ++# CPACK_DEBIAN_PACKAGE_DEPENDS - y ++# CPACK_DEBIAN_PACKAGE_PRIORITY - y ++# CPACK_DEBIAN_PACKAGE_MAINTAINER - y ++# CPACK_DEBIAN_PACKAGE_DESCRIPTION - y ++ ++# ARCHITECTURE ++# if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") ++# set(ARCHITECTURE "amd64") ++# elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "aarch64") ++# set(ARCHITECTURE "arm64") ++# endif() ++ ++# string(TIMESTAMP BUILD_TIME "%Y%m%d") +diff --git a/cmake/SparkAppimageConfig.cmake b/cmake/SparkAppimageConfig.cmake +new file mode 100644 +index 0000000..45f4e25 +--- /dev/null ++++ b/cmake/SparkAppimageConfig.cmake +@@ -0,0 +1,132 @@ ++# export PATH=/usr/lib/x86_64-linux-gnu/qt5/bin:$PATH ++# export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH ++# export QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins:$QT_PLUGIN_PATH ++# export QML2_IMPORT_PATH=/usr/lib/x86_64-linux-gnu/qt5/qml:$QML2_IMPORT_PATH ++ ++# export PATH=/usr/lib/x86_64-linux-gnu/qt5/bin:$PATH ++# ~/linuxdeployqt-continuous-x86_64.AppImage spark-store-submitter -appimage ++# cd .. ++# ~/appimagetool-x86_64.AppImage appimage/ ++ ++# LINUXDEPLOYQT=/home/zinface/linuxdeployqt-continuous-x86_64.AppImage ++# APPIMAGETOOL=/home/zinface/appimagetool-x86_64.AppImage ++ ++# if () ++set(APPIMAGE_OUTPUT "${CMAKE_BINARY_DIR}/appimage") ++set(APPIMAGE_ICON "${APPIMAGE_OUTPUT}/default.png") ++set(APPIMAGE_DESTKOP "${APPIMAGE_OUTPUT}/default.desktop") ++# set(LINUXDEPLOYQT) ++# set(APPIMAGETOOL) ++ ++function(execute_linuxdeploy _PATH) ++ execute_process(COMMAND ${LINUXDEPLOYQT} ++ WORKING_DIRECTORY "${APPIMAGE_OUTPUT}" ++ ) ++endfunction(execute_linuxdeploy _PATH) ++ ++function(target_linuxdeploy) ++ add_custom_target(linuxdeploy pwd ++ BYPRODUCTS appimage ++ COMMAND cp ../${PROJECT_NAME} . ++ COMMAND "${LINUXDEPLOYQT}" ${PROJECT_NAME} -appimage -unsupported-allow-new-glibc -verbose=3 -no-strip|| true ++ COMMAND cp ../spark-appimage.desktop default.desktop ++ COMMAND cp ../spark-appimage.png default.png ++ WORKING_DIRECTORY "${APPIMAGE_OUTPUT}") ++endfunction(target_linuxdeploy) ++ ++function(target_appimage) ++ add_custom_target(copy-desktop-appimage ++ COMMAND cp ../spark-appimage.desktop default.desktop ++ COMMAND cp ../spark-appimage.png default.png ++ WORKING_DIRECTORY "${APPIMAGE_OUTPUT}") ++ add_custom_target(appimage pwd ++ COMMAND ${APPIMAGETOOL} ${APPIMAGE_OUTPUT} ++ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" ++ DEPENDS copy-desktop-appimage) ++endfunction(target_appimage) ++ ++function(add_appimage) ++ # check linuxdeploy ++ if(NOT DEFINED LINUXDEPLOYQT) ++ message("AppImage> Not Found LINUXDEPLOYQT Variable!") ++ return() ++ endif(NOT DEFINED LINUXDEPLOYQT) ++ if(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) ++ message("> cmake version is less than 3.19") ++ message(WARNING "!Relative paths are not supported!") ++ else() ++ file(REAL_PATH ${LINUXDEPLOYQT} LINUXDEPLOYQT_REAL_PATH) ++ endif(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) ++ message("AppImage> Found LINUXDEPLOYQT Variable: ${LINUXDEPLOYQT_REAL_PATH}") ++ ++ # check appimagetool ++ if(NOT DEFINED APPIMAGETOOL) ++ message("AppImage> Not Found APPIMAGETOOL Variable!") ++ return() ++ endif(NOT DEFINED APPIMAGETOOL) ++ if(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) ++ # execute_process(COMMAND realpath ${APPIMAGETOOL} OUTPUT_VARIABLE APPIMAGETOOL_REAL_PATH) ++ message("> cmake version is less than 3.19") ++ message(WARNING "!Relative paths are not supported!") ++ else() ++ file(REAL_PATH ${APPIMAGETOOL} APPIMAGETOOL_REAL_PATH) ++ endif(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) ++ message("AppImage> Found APPIMAGETOOL Variable: ${LINUXDEPLOYQT_REAL_PATH}") ++ ++ # do add_custome_target ++ make_directory(${APPIMAGE_OUTPUT}) ++ target_linuxdeploy() ++ target_appimage() ++endfunction(add_appimage) ++ ++function(add_appimage_desktop) ++ configure_file(cmake/spark-appimage.desktop.in ++ ${CMAKE_BINARY_DIR}/spark-appimage.desktop @ONLY) ++endfunction(add_appimage_desktop) ++ ++function(add_appimage_icon _ICON_PATH) ++ if(CMAKE_VERSION VERSION_LESS 3.21) ++ message("> cmake version is less than 3.21") ++ configure_file(${_ICON_PATH} ${CMAKE_BINARY_DIR}/spark-appimage.png COPYONLY) ++ else() ++ file(COPY_FILE ${_ICON_PATH} ${CMAKE_BINARY_DIR}/spark-appimage.png) ++ endif(CMAKE_VERSION VERSION_LESS 3.21) ++endfunction(add_appimage_icon _ICON_PATH) ++ ++ ++ ++# 如果glic>=2.27,你就需要加上参数 -unsupported-allow-new-glibc (意思就是不再低版本发行版使用了) ++# 或 -unsupported-bundle-everything(大概的意思是尝试兼容,实际测试,到其他发行版直接用不了了,有可能是发行版的原因,还是建议用前者,虽然放弃了低版本) ++ ++# -unsupported-bundle-everything ++ # 捆绑所有依赖库,包括 ld-linux.so 加载器和 glibc。这将允许构建在较新系统上的应用程序在较旧的目标系统上运行,但不建议这样做,因为它会导致捆绑包超出所需的大小(并且可能到其他发行版无法使用) ++# -unsupported-allow-new-glibc ++ # 允许 linuxdeployqt 在比仍受支持的最旧 Ubuntu LTS 版本更新的发行版上运行。这将导致 AppImage无法在所有仍受支持的发行版上运行,既不推荐也不测试或支持 ++ ++# ./linuxdeployqt-7-x86_64.AppImage 程序目录/程序 -appimage -unsupported-allow-new-glibc ++# ./linuxdeployqt-7-x86_64.AppImage 程序目录/程序 -appimage -unsupported-bundle-everything ++ ++ ++ ++ ++# 1. 在顶层构建中导入 Appimage 的构建 ++# include(cmake/SparkAppimageConfig.cmake) # 导入来自 Spark 构建的 Appimage 构建 ++# add_appimage_icon(assets/spark.png) # 添加到 Appimage 中的默认的图标 ++# add_appimage_desktop() # 添加到 Appimage 中的默认desktop(使用来自 Spark 构建的 Desktop 构建中配置的信息(必须要求 spark-desktop)) ++# add_appimage() # 应用对 Appimage 的构建 ++ ++# 2. 在 Makefile 进行构建目标构建 Appimage ++# Appimage 的构建流 -- ++# 在 Makefile 进行构建目标构建 Appimage (要求提供工具的绝对路径,然后可依次进行linuxdeployqt, genrate-appimage) ++# 来自于 https://github.com/probonopd/linuxdeployqt 的 linuxdeployqt ++# 来自于 https://github.com/AppImage/AppImageKit 的 appimagetool ++# LINUXDEPLOYQT := "/home/zinface/Downloads/linuxdeployqt-continuous-x86_64.AppImage" ++# APPIMAGETOOL := "/home/zinface/Downloads/appimagetool-x86_64.AppImage" ++ ++# linuxdeploy: all ++# cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL) ++# cd build && make linuxdeploy ++ ++# genrate-appimage: ++# cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL) ++# cd build && make appimage +diff --git a/cmake/SparkBuildGraphviz.cmake b/cmake/SparkBuildGraphviz.cmake +new file mode 100644 +index 0000000..ce9dbc3 +--- /dev/null ++++ b/cmake/SparkBuildGraphviz.cmake +@@ -0,0 +1,8 @@ ++cmake_minimum_required(VERSION 3.5.1) ++ ++# 添加构建项目依赖图目标: make builddeps ++add_custom_target(builddeps ++ COMMAND "${CMAKE_COMMAND}" "--graphviz=graphviz/builddeps.dot" . ++ COMMAND dot -Tpng graphviz/builddeps.dot -o builddeps.png ++ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" ++) +\ No newline at end of file +diff --git a/cmake/SparkDesktopMacros.cmake b/cmake/SparkDesktopMacros.cmake +new file mode 100644 +index 0000000..223ac6b +--- /dev/null ++++ b/cmake/SparkDesktopMacros.cmake +@@ -0,0 +1,35 @@ ++ ++macro(spark_desktop_macros _APP_NAME _APP_NAME_ZH_CN _APP_COMMENT _APP_TYPE _APP_EXECUTE_PATH _APP_EXECUTE_ICON_PATH _APP_CATEGORIES) ++ set(APP_NAME ${_APP_NAME}) ++ set(APP_NAME_ZH_CN ${_APP_NAME_ZH_CN}) ++ set(APP_COMMENT ${_APP_COMMENT}) ++ set(APP_TYPE ${_APP_TYPE}) ++ set(APP_EXECUTE_PATH ${_APP_EXECUTE_PATH}) ++ set(APP_EXECUTE_ICON_PATH ${_APP_EXECUTE_ICON_PATH}) ++ set(APP_CATEGORIES ${_APP_CATEGORIES}) ++ configure_file(cmake/spark-desktop.desktop.in ++ ${CMAKE_BINARY_DIR}/${_APP_NAME}.desktop ++ ) ++endmacro(spark_desktop_macros _APP_NAME _APP_NAME_ZH_CN _APP_COMMENT _APP_TYPE _APP_EXECUTE_PATH _APP_EXECUTE_ICON_PATH _APP_CATEGORIES) ++ ++# include(cmake/SparkDesktopMacros.cmake) ++# 内容默认应用名称: Name= 应与项目名称相同 ++# spark_desktop_macros( ++ # 应用名称: Name= ++ # 应用名称: Name[zh_CN]= ++ # 应用说明: Comment= ++ # 应用类型: Type= ++ # 执行程序: Exec= ++ # 图标路径: Icon= ++ # 应用分类: Category= ++# ) ++ ++# configure_file( ++# [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS | ++# FILE_PERMISSIONS ...] ++# [COPYONLY] [ESCAPE_QUOTES] [@ONLY] ++# [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) ++ ++# install(FILES ${APP_NAME}.desktop ++# DESTINATION /usr/share/applications ++# ) +\ No newline at end of file +diff --git a/cmake/SparkEnvConfig.cmake b/cmake/SparkEnvConfig.cmake +new file mode 100644 +index 0000000..797faf4 +--- /dev/null ++++ b/cmake/SparkEnvConfig.cmake +@@ -0,0 +1,8 @@ ++cmake_minimum_required(VERSION 3.5.1) ++ ++set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++set(CMAKE_AUTOMOC ON) ++set(CMAKE_AUTOUIC ON) ++set(CMAKE_AUTORCC ON) ++# set(CMAKE_BUILD_TYPE "Debug") +\ No newline at end of file +diff --git a/cmake/SparkFindDtkConfig.cmake b/cmake/SparkFindDtkConfig.cmake +new file mode 100644 +index 0000000..d1b2dfc +--- /dev/null ++++ b/cmake/SparkFindDtkConfig.cmake +@@ -0,0 +1,11 @@ ++cmake_minimum_required(VERSION 3.5.1) ++ ++# include(SparkFindQt5Config.cmake) ++find_package(Dtk COMPONENTS Core Widget Gui) ++ ++function(target_link_dtk NAME) ++ target_link_libraries(${NAME} ++ ${DtkCore_LIBRARIES} ++ ${DtkWidget_LIBRARIES} ++ ${DtkGui_LIBRARIES}) ++endfunction(target_link_dtk NAME) +\ No newline at end of file +diff --git a/cmake/SparkFindLibraries.cmake b/cmake/SparkFindLibraries.cmake +new file mode 100644 +index 0000000..a1b936c +--- /dev/null ++++ b/cmake/SparkFindLibraries.cmake +@@ -0,0 +1,7 @@ ++cmake_minimum_required(VERSION 3.5.1) ++ ++# spark_find_library(notify libnotify) ++ ++# function(target_link_${_prefix} TARGET) ++# target_link_libraries(${TARGET} ${_prefix}) ++# endfunction(target_link_${_prefix} TARGET) +\ No newline at end of file +diff --git a/cmake/SparkFindQt5Config.cmake b/cmake/SparkFindQt5Config.cmake +new file mode 100644 +index 0000000..6efade6 +--- /dev/null ++++ b/cmake/SparkFindQt5Config.cmake +@@ -0,0 +1,154 @@ ++cmake_minimum_required(VERSION 3.5.1) ++ ++find_package(Qt5 COMPONENTS Core Widgets Network Concurrent WebEngineWidgets Sql WebSockets REQUIRED) ++ ++# function(target_link_qt5 NAME) ++# target_link_libraries(${NAME} ++# Qt5::Core ++# Qt5::Widgets ++# Qt5::Network) ++# endfunction(target_link_qt5 NAME) ++ ++# 使用 spark_add_link 生成 target_link_qt5 以替代上面内容 ++spark_add_link(qt5 Qt5::Core Qt5::Widgets Qt5::Network) ++ ++ ++# spark_add_link_qt5 ++# 自定义宏 spark_add_link_qt5 以扩展 target_link_qt5_ 结构 ++ # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 名称 ++ # 同等于 spark_add_link(qt_ ${ARGN}) ++macro(spark_add_link_qt5 _IN_NAME) ++ spark_add_link(qt5_${_IN_NAME} ${ARGN}) ++endmacro(spark_add_link_qt5 _IN_NAME) ++ ++# 使用 spark_add_link_qt5 生成 target_link_qt5_ 的宏 ++spark_add_link_qt5(Concurrent Qt5::Concurrent) ++spark_add_link_qt5(Sql Qt5::Sql) ++spark_add_link_qt5(WebEngineWidgets Qt5::WebEngineWidgets) ++spark_add_link_qt5(WebSockets Qt5::WebSockets) ++ ++# 高级自定义 ++# spark_add_links_qt5 ++# 自定义宏 spark_add_links_qt5 以扩展 spark_add_link_qt5 宏配置组 ++ # 特点: 任意长度参数 ++ # qt5_item: 为进行遍历后的单项,类似于 python3 中的 (for item in items:) ++ # 例如: qt5_item 为 Core: ++ # spark_add_link_qt5(${qt5_item} Qt5::${qt5_item}) ++ # 展开为 spark_add_link_qt5(Core Qt5::Core) ++ # 展开为 spark_add_link(qt5_Core Qt5::Core) ++ # 展开为 spark_add_link(qt5_Core Qt5::Core) ++ # 特性: 增加 qt5_Core 转 qt5_core ++ # string(TOLOWER ) ++macro(spark_add_links_qt5) ++ set(qt5_items ${ARGN}) ++ foreach(qt5_item IN LISTS qt5_items) ++ find_package(Qt5${qt5_item}) ++ spark_add_link_qt5(${qt5_item} Qt5::${qt5_item}) ++ ++ string(TOLOWER "${qt5_item}" qt5_lower_item) ++ spark_add_link_qt5(${qt5_lower_item} Qt5::${qt5_item}) ++ message("add_target_link_qt5_${qt5_item} or add_target_link_qt5_${qt5_lower_item}") ++ endforeach(qt5_item IN LISTS qt5_items) ++endmacro(spark_add_links_qt5) ++ ++ ++# Core 用于其它模块的核心非图形类。 ++# GUI 图形用户界面 GUI 组件基类。包括 OpenGL。 ++# Multimedia 音频 视频 无线电 摄像头功能类。 ++# Multimedia Widgets 用于实现多媒体功能,基于 Widget 的类。 ++# Network 使网络编程更容易和更可移植的类。 ++ ++# QML QML 和 JavaScript 语言类。 ++# Quick 以自定义用户界面 UI 构建高动态应用程序的声明性框架。 ++# Quick Controls 为桌面、嵌入式及移动设备创建高性能用户界面提供轻量 QML 类型。这些类型运用简单样式化体系结构且非常高效。 ++# Quick Dialogs 用于从 Qt Quick 应用程序创建系统对话框,并与之交互的类型。 ++# Quick Layouts 布局是用于在用户界面中排列基于 Qt Quick 2 项的项。 ++# Quick Test 用于 QML 应用程序的单元测试框架,其测试案例被编写成 JavaScript 函数。 ++ # 注意: 二进制保证不兼容 Qt Quick Test,但源代码仍兼容。 ++ ++# Qt SQL 集成使用 SQL 数据库的类。 ++# Qt Test 单元测试 Qt 应用程序和库的类。 ++ # 注意: 二进制保证不兼容 Qt Test,但源代码仍兼容。 ++# Qt Widgets 以 C++ 小部件扩展 Qt GUI 的类。 ++ ++ ++ ++# 找出所有 Qt5 模板 ++# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 ++ ++# 掐头去尾,洗一次 ++# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 | sed 's@^Qt5@@; s@Config.cmake$@@; /^\s*$/d' ++ ++# 排序 ++# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 | sed 's@^Qt5@@; s@Config.cmake$@@; /^\s*$/d' | sort | pr -t -3 ++ ++spark_add_links_qt5( ++ # AccessibilitySupport ++ # AttributionsScannerTools ++ Concurrent ++ # Core ++ DBus ++ # Designer ++ # DesignerComponents ++ # DeviceDiscoverySupport ++ # DocTools ++ # EdidSupport ++ # EglFSDeviceIntegration ++ # EglFsKmsSupport ++ # EglSupport ++ # EventDispatcherSupport ++ # FbSupport ++ # FontDatabaseSupport ++ # GlxSupport ++ # Gui ++ # Help ++ # InputSupport ++ # KmsSupport ++ # LinguistTools ++ # LinuxAccessibilitySupport ++ # Network ++ # OpenGL ++ # OpenGLExtensions ++ # PacketProtocol ++ # PlatformCompositorSupport ++ # Positioning ++ # PositioningQuick ++ # PrintSupport ++ # Qml ++ # QmlDebug ++ # QmlDevTools ++ # QmlImportScanner ++ # QmlModels ++ # QmlWorkerScript ++ # Quick ++ # QuickCompiler ++ # QuickControls2 ++ # QuickParticles ++ # QuickShapes ++ # QuickTemplates2 ++ # QuickTest ++ # QuickWidgets ++ # SerialBus ++ # SerialPort ++ # ServiceSupport ++ # Sql ++ # Svg ++ # Test ++ # ThemeSupport ++ # UiPlugin ++ # UiTools ++ # VulkanSupport ++ # WebChannel ++ # WebEngine ++ # WebEngineCore ++ WebEngineWidgets ++ # WebKit ++ # WebKitWidgets ++ # WebSockets ++ # Widgets ++ # X11Extras ++ # XcbQpa ++ # XkbCommonSupport ++ # Xml ++ # XmlPatterns ++) +\ No newline at end of file +diff --git a/cmake/SparkFindQt6Config.cmake b/cmake/SparkFindQt6Config.cmake +new file mode 100644 +index 0000000..dfd8917 +--- /dev/null ++++ b/cmake/SparkFindQt6Config.cmake +@@ -0,0 +1,24 @@ ++cmake_minimum_required(VERSION 3.5.1) ++ ++find_package(Qt6 COMPONENTS Core Widgets Network Concurrent) ++ ++# function(target_link_qt6 NAME) ++# target_link_libraries(${NAME} ++# Qt6::Core ++# Qt6::Widgets ++# Qt6::Network) ++# endfunction(target_link_qt6 NAME) ++ ++# 使用 spark_add_link 生成 target_link_qt6 以替代上面内容 ++spark_add_link(qt6 Qt6::Core Qt6::Widgets Qt6::Network) ++ ++ ++# spark_add_link_qt6 ++# 自定义宏 target_link_qt6 以扩展 target_link_qt6_ 结构 ++ # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 名称 ++ # 同等于 spark_add_link(qt_ ${ARGN}) ++macro(spark_add_link_qt6 _IN_NAME) ++ spark_add_link(qt6_${_IN_NAME} ${ARGN}) ++endmacro(spark_add_link_qt6 _IN_NAME) ++ ++# 使用 spark_add_link_qt6 生成 target_link_qt6_ 的宏 +diff --git a/cmake/SparkInstallMacrosConfig.cmake b/cmake/SparkInstallMacrosConfig.cmake +new file mode 100644 +index 0000000..bf906bf +--- /dev/null ++++ b/cmake/SparkInstallMacrosConfig.cmake +@@ -0,0 +1,132 @@ ++ ++# spark_install_target ++# 基于传入的路径/目标进行安装 ++# 可接受的值为: 安装路径 目标A ++# 可接受的值为: 安装路径 目标A 目标B 目标C... ++macro(spark_install_target INSTALL_TARGET_DIR INSTALL_TARGETS) ++ install(TARGETS ++ ${INSTALL_TARGETS} ${ARGN} ++ DESTINATION ${INSTALL_TARGET_DIR}) ++endmacro(spark_install_target INSTALL_TARGET_DIR INSTALL_TARGETS) ++ ++# spark_install_file ++# 基于传入的路径/文件进行安装 ++# 可接受的值为: 安装路径 文件A ++# 可接受的值为: 安装路径 文件A 文件B 文件C... ++macro(spark_install_file INSTALL_FILE_DIR INSTALL_FILE) ++ install(FILES ++ ${INSTALL_FILE} ${ARGN} ++ DESTINATION ${INSTALL_FILE_DIR}) ++endmacro(spark_install_file INSTALL_FILE_DIR INSTALL_FILE) ++ ++# spark_install_program ++# 基于传入的路径/文件进行安装,并自动为其添加可执行权限 ++# 可接受的值为: 安装路径 文件A ++# 可接受的值为: 安装路径 文件A 文件B 文件C... ++macro(spark_install_program INSTALL_PROGRAM_DIR INSTALL_PROGRAM) ++ install(PROGRAMS ++ ${INSTALL_PROGRAM} ${ARGN} ++ DESTINATION ${INSTALL_PROGRAM_DIR}) ++endmacro(spark_install_program INSTALL_PROGRAM_DIR INSTALL_PROGRAM) ++ ++ ++# spark_install_directory ++# 基于传入的路径/目录进行安装 ++# 可接受的值为: 安装路径 路径A ++# 可接受的值为: 安装路径 路径A/* 为安装路径A下所有内容 ++macro(spark_install_directory INSTALL_DIRECTORY_DIR INSTALL_DIRECOTRY) ++ # INSTALL_DIRECOTRY 可能包含 * ? ++ # 1. 找到 '*', 截取,列出目录下所有文件,安装 ++ # 2. 是文件的直接使用 spark_install_file 安装 ++ # 2. 是目录的直接使用 spark_install_directory 安装 ++ # message(FATAL_ERROR "${INSTALL_DIRECTORY_DIR}") ++ # string(FIND [REVERSE]) ++ string(FIND "${INSTALL_DIRECOTRY}" "*" INSTALL_DIRECTORY_FIND_INDEX) ++ # message(FATAL_ERROR "${INSTALL_DIRECTORY_FIND_INDEX}: ${INSTALL_DIRECTORY_DIR}") ++ ++ # file(GLOB ++ # [LIST_DIRECTORIES true|false] [RELATIVE ] [CONFIGURE_DEPENDS] ++ # [...]) ++ ++ if (NOT INSTALL_DIRECTORY_FIND_INDEX EQUAL -1) ++ # string(SUBSTRING ) ++ string(SUBSTRING "${INSTALL_DIRECOTRY}" 0 ${INSTALL_DIRECTORY_FIND_INDEX} INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING) ++ # message(FATAL_ERROR "directory: ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING}") ++ ++ # file(GLOB ++ # [LIST_DIRECTORIES true|false] [RELATIVE ] [CONFIGURE_DEPENDS] ++ # [...]) ++ ++ file(GLOB INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING}/*) ++ list(LENGTH INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST_LENGTH) ++ foreach(item IN LISTS INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST) ++ # message("-> ${item}") ++ if(IS_DIRECTORY ${item}) ++ message("-> ${item} IS_DIRECTORY") ++ # spark_install_directory(${INSTALL_DIRECTORY_DIR} ${item}) ++ install(DIRECTORY ++ ${item} ++ DESTINATION ${INSTALL_DIRECTORY_DIR} ++ USE_SOURCE_PERMISSIONS) ++ else() ++ message("-> ${item} NOT IS_DIRECTORY") ++ spark_install_program(${INSTALL_DIRECTORY_DIR} ${item}) ++ # spark_install_file(${INSTALL_DIRECTORY_DIR} ${item}) ++ endif(IS_DIRECTORY ${item}) ++ endforeach(item IN LISTS INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST) ++ ++ # message(FATAL_ERROR " directory: ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST}") ++ # message(FATAL_ERROR " directory: ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST_LENGTH}") ++ ++ else() ++ message(FATAL_ERROR "install: ${INSTALL_DIRECTORY_DIR}") ++ ++ install(DIRECTORY ++ ${INSTALL_DIRECOTRY} ${ARGN} ++ DESTINATION ${INSTALL_DIRECTORY_DIR}) ++ endif(NOT INSTALL_DIRECTORY_FIND_INDEX EQUAL -1) ++ ++endmacro(spark_install_directory INSTALL_DIRECTORY_DIR INSTALL_DIRECOTRY) ++ ++ ++# spark_install_changelog ++# 基于传入的路径/ changelog 文件路径进行安装,经过一系列检查并使用 gzip 进行压缩并安装 ++# 可接受的值为: 安装路径 changelog文件路径 ++macro(spark_install_changelog CHANGE_LOG_FILE) ++ set(SOURCE_CHANGE_LOG_FILE ${CHANGE_LOG_FILE}) ++ if (EXISTS ${SOURCE_CHANGE_LOG_FILE}) ++ ++ execute_process(COMMAND test -f ${SOURCE_CHANGE_LOG_FILE} ++ RESULT_VARIABLE changelog_test ++ ) ++ execute_process(COMMAND which gzip ++ RESULT_VARIABLE gzip_test ++ ) ++ if (NOT changelog_test EQUAL 0) ++ message(FATAL_ERROR "NOTE: 不是常规文件: ${SOURCE_CHANGE_LOG_FILE}") ++ endif(NOT changelog_test EQUAL 0) ++ ++ if (NOT gzip_test EQUAL 0) ++ message(FATAL_ERROR "NOTE: 未安装 gzip, 无法压缩 changelog") ++ endif(NOT gzip_test EQUAL 0) ++ ++ # 压缩与安装日志文件 ++ add_custom_command( ++ OUTPUT "${CMAKE_BINARY_DIR}/changelog.gz" ++ COMMAND gzip -cn9 "${SOURCE_CHANGE_LOG_FILE}" > "${CMAKE_BINARY_DIR}/changelog.gz" ++ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ++ COMMENT "Compressing changelog" ++ ) ++ add_custom_target(changelog ALL DEPENDS "${CMAKE_BINARY_DIR}/changelog.gz") ++ ++ # include(GNUInstallDirs) ++ set(SPARK_INSTALL_CHANGE_LOG_DIR "/usr/share/doc/${PROJECT_NAME}/") ++ install(FILES ++ ${CMAKE_BINARY_DIR}/changelog.gz ++ debian/copyright ++ ++ DESTINATION ${SPARK_INSTALL_CHANGE_LOG_DIR}) ++ else() ++ message(FATAL_ERROR "未找到: ${SOURCE_CHANGE_LOG_FILE}") ++ endif(EXISTS ${SOURCE_CHANGE_LOG_FILE}) ++endmacro(spark_install_changelog CHANGE_LOG_FILE) +diff --git a/cmake/SparkMacrosConfig.cmake b/cmake/SparkMacrosConfig.cmake +new file mode 100644 +index 0000000..67d84e1 +--- /dev/null ++++ b/cmake/SparkMacrosConfig.cmake +@@ -0,0 +1,129 @@ ++cmake_minimum_required(VERSION 3.5.1) ++ ++# 定义一些 macro 用于自动生成构建结构 ++ ++# spark_add_library [files]... ++# 构建一个库,基于指定的源文件 ++ # 并根据库名生成 target_link_ 函数 ++macro(spark_add_library _lib_name) ++ message("================ ${_lib_name} Library ================") ++ add_library(${_lib_name} ${ARGN}) ++ ++ set(SRCS ${ARGN}) ++ foreach(item IN LISTS SRCS) ++ message(" -> ${item}") ++ endforeach(item IN LISTS SRCS) ++ ++ function(target_link_${_lib_name} TARGET) ++ message("${_lib_name}") ++ target_link_libraries(${TARGET} ${_lib_name}) ++ endfunction(target_link_${_lib_name} TARGET) ++ ++endmacro(spark_add_library _lib_name) ++ ++# spark_add_library_path ++# 构建一个库,基于指定的路径 ++ # 并根据库名生成 target_link_ 函数 ++ # 函数内增加以 头文件搜索路径 ++macro(spark_add_library_path _lib_name _lib_path) ++ aux_source_directory(${_lib_path} ${_lib_name}_SOURCES) ++ ++ message("================ spark_add_library_path: ${_lib_name} ================") ++ file(GLOB UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_lib_path}/*.ui) ++ add_library(${_lib_name} ${${_lib_name}_SOURCES} ${UI_LIST}) ++ foreach(item IN LISTS ${_lib_name}_SOURCES) ++ message(" -> ${item}") ++ endforeach(item IN LISTS ${_lib_name}_SOURCES) ++ ++ function(target_link_${_lib_name} TARGET) ++ # message("target_link_${_lib_name}") ++ message(" -> (include): ${_lib_path}") ++ target_include_directories(${TARGET} PUBLIC "${_lib_path}") ++ target_link_libraries(${TARGET} ${_lib_name}) ++ endfunction(target_link_${_lib_name} TARGET) ++ ++ function(target_include_${_lib_name} TARGET) ++ # message("target_link_${_lib_name}") ++ message(" -> (include): ${_lib_path}") ++ target_include_directories(${TARGET} PUBLIC "${_lib_path}") ++ # target_link_libraries(${TARGET} ${_lib_name}) ++ endfunction(target_include_${_lib_name} TARGET) ++ ++endmacro(spark_add_library_path _lib_name _lib_path) ++ ++# spark_add_executable [files]... ++# 构建一个可执行文件,基于指定的源文件 ++ # Qt编译时源文件包括很多类型,需要指定 *.h/*.cpp/*.qrc/*.qm/... 等 ++macro(spark_add_executable _exec_name) ++ ++ message("================ ${_exec_name} Executable ================") ++ add_executable(${_exec_name} ${ARGN}) ++ ++endmacro(spark_add_executable _exec_name) ++ ++macro(spark_add_executable_path _exec_name _exec_path) ++ aux_source_directory(${_exec_path} ${_exec_name}_SOURCES) ++ ++ message("================ ${_exec_name} Executable ================") ++ file(GLOB UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_exec_path}/*.ui) ++ add_executable(${_exec_name} ${${_exec_name}_SOURCES} ${ARGN} ${UI_LIST}) ++ foreach(item IN LISTS ${_exec_name}_SOURCES) ++ message(" -> ${item}") ++ endforeach(item IN LISTS ${_exec_name}_SOURCES) ++ ++ # function(target_link_${_exec_name} TARGET) ++ # message("target_link_${_lib_name}") ++ message(" -> (include): ${_exec_path}") ++ target_include_directories(${_exec_name} PUBLIC "${_exec_path}") ++ # target_link_libraries(${TARGET} ${_lib_name}) ++ # endfunction(target_link_${_exec_name} TARGET) ++ # target_link_${_exec_name}(${_exec_name}) ++ ++endmacro(spark_add_executable_path _exec_name _exec_path) ++ ++# spark_find_library ++# 搜索一个库,基于指定的库名,调用 pkg-config 搜索库 ++ # 并根据库名生成一个 target_link_ 函数 ++macro(spark_find_library _prefix) ++ find_package(PkgConfig REQUIRED) ++ ++ # libnotify ++ pkg_check_modules(${_prefix} ${ARGN}) ++ function(target_link_${_prefix} TARGET) ++ target_include_directories(${TARGET} PUBLIC ++ ${${_prefix}_INCLUDE_DIRS}) ++ target_link_libraries(${TARGET} ++ ${${_prefix}_LIBRARIES}) ++ endfunction(target_link_${_prefix} TARGET) ++ ++endmacro(spark_find_library _prefix) ++ ++ ++# spark_add_executable_paths ++# 自定义构建宏,基于指定的前缀名称,处理后续参数为子目录 ++ # item: 为进行遍历后的单项,类似于 python3 中的 (for item in items:) ++ # file: 为在目录中不以递归(GLOB_RECURSE)方式寻找 qrc 文件,需要将其参与编译才能被 rcc ++ # 并根据 prefix- 生成构建目标, ++macro(spark_add_executable_paths _prefix_path) ++ set(PATHS ${ARGN}) ++ foreach(item IN LISTS PATHS) ++ file(GLOB QRCS "${item}/*.qrc") ++ message(">>> add_executable: " "${_prefix_path}-${item} ${item} + ${QRCS}") ++ spark_add_executable_path(${_prefix_path}-${item} ${item} ${QRCS}) ++ target_link_qt5(${_prefix_path}-${item}) ++ endforeach(item IN LISTS PATHS) ++endmacro(spark_add_executable_paths _prefix_path) ++ ++# spark_add_link ++# 自定义宏以代替当前使用 fucntion 定义 target_link_ 结构 ++ # _IN_NAME: 此宏生成 target_link_ 的要求参数 ++ # ARGN: 此宏剩余的参数列表 ++ # 在使用 target_link_ 时 ++ # _NAME: 用于此 fucntion 中的要求参数: <_NAME>目标将要连接此库 ++macro(spark_add_link _IN_NAME) ++ function(target_link_${_IN_NAME} _NAME) ++ message("LINK ${_NAME} ${ARGN}") ++ target_link_libraries(${_NAME} ++ ${ARGN}) ++ endfunction(target_link_${_IN_NAME} _NAME) ++endmacro(spark_add_link _IN_NAME) +\ No newline at end of file +diff --git a/cmake/SparkMacrosExtendConfig.cmake b/cmake/SparkMacrosExtendConfig.cmake +new file mode 100644 +index 0000000..bad0620 +--- /dev/null ++++ b/cmake/SparkMacrosExtendConfig.cmake +@@ -0,0 +1,196 @@ ++ ++# find_plus ++# 寻找 INVAl 传入的字符串,如果存在 + 字符将写入位置到 OUTVAL ++function(find_plus INVAL OUTVAL) ++ string(FIND "${INVAL}" "+" plus_index) ++ set(${OUTVAL} ${plus_index} PARENT_SCOPE) ++ # if(plus_index LESS 0) ++ # set(${OUTVAL} -1 PARENT_SCOPE) ++ # else() ++ # set(${OUTVAL} ${plus_index} PARENT_SCOPE) ++ # endif(plus_index LESS 0) ++endfunction(find_plus INVAL OUTVAL) ++ ++# find_plus("FF" FFFF) ++# message("--> FFFF ${FFFF}") # --> FFFF -1 ++# find_plus("F+F" FFFF) ++# message("--> FFFF ${FFFF}") # --> FFFF 1 ++# find_plus("+F+F" FFFF) ++# message("--> FFFF ${FFFF}") # --> FFFF 0 ++ ++# set(FFF) ++# list(APPEND FFFF ) ++# list(APPEND FFFF "F") ++# list(APPEND FFFF "FA") ++# message("--> FFFF: ${FFFF}") # --> FFFF: F;FA ++ ++# set(FFFFS "") ++# list(APPEND FFFFS ${FFFF}) ++# message("--> FFFFS: ${FFFFS}") # --> FFFFS: F;FA ++ ++# set(FFFF "+AA+BB+CC+DD") ++# string(REPLACE "+" ";" FFFFL "${FFFF}") ++# list(LENGTH FFFFL FFFFLEN) ++# message("--> FFFFL: ${FFFFL} --> ${FFFFLEN}") # --> FFFFL: F; ++ ++# plus_list ++# 将传入的 "+AAA+BBB+CCC" 类型数据变成一个 列表(list) ++# 适用于不使用 string 进行替换 + 为 ";" 的情况下使用直接变成 list ++function(plus_list INVAL OUTVAL OUTVALLEN) ++ # set(${OUTVAL} "..." PARENT_SCOPE) ++ # set(${OUTVALLEN} 0 PARENT_SCOPE) ++ ++ set(_tmps "") # 设置为空的 ++ ++ # 寻找下一个 + 位置 ++ find_plus(${INVAL} RIGHT_PLUS) ++ ++ string(LENGTH "${INVAL}" INVALLEN) ++ message("--> 传入的 INVAL: --> 内容: ${INVAL}") ++ message("--> 传入的 INVAL: --> 长度: ${INVALLEN}") ++ message("--> 传入的 INVAL: --> +位置: ${RIGHT_PLUS}") ++ ++ # 判断是否有右侧 + 号 ++ if(RIGHT_PLUS LESS 0) ++ message("--> 传入的 INVAL: --> 无需计算新的+位置") ++ # message("--> 计算新的 + 位置: ${_PLUSINDEX}") ++ list(APPEND _tmps ${INVAL}) ++ else() ++ math(EXPR _PLUSINDEX "${RIGHT_PLUS}+1") ++ message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX}") ++ ++ string(SUBSTRING "${INVAL}" ${_PLUSINDEX} ${INVALLEN} NewVal) ++ message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX} -> 内容: ${NewVal}") ++ # string(REPLACE "+" ";" _tmps "${NewVal}") ++ # list(LENGTH FFFFL FFFFLEN) ++ ++ # message("--> 计算新的 + 位置: ${_PLUSINDEX} --> 后面的 NewVal: ${NewVal}") ++ ++ # find_plus(${NewVal} _NextPlus) ++ # if(_NextPlus LESS 0) ++ # list(APPEND _tmps ${NewVal}) ++ # message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的") ++ # else() ++ # message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的") ++ # # 重新 ++ # # plus_list(${NewVal} NewValS ) ++ # # foreach(item) ++ # # list(APPEND _tmps ${item}) ++ # # endforeach(item) ++ # endif(_NextPlus LESS 0) ++ endif(RIGHT_PLUS LESS 0) ++ ++ set(${OUTVAL} ${_tmps} PARENT_SCOPE) ++ list(LENGTH _tmps _tmps_len) ++ set(${OUTVALLEN} ${_tmps_len} PARENT_SCOPE) ++ ++endfunction(plus_list INVAL OUTVAL OUTVALLEN) ++ ++# plus_list("+AAA+BBB+CCC+DDD" FFF FFLEN) ++# message("--------> ${FFF}: -> ${FFLEN}") ++ ++# spark_add_library_realpaths ++# 基于传入的项进行构建 ++# 可接受的值为: 路径列表 ++# 可接受的值为: 路径列表+依赖库A+依赖库B ++macro(spark_add_library_realpaths) ++ message("---> 基于传入的项进行构建 <---") ++ # message("--> src/unclassified/ItemDelegates/NdStyledItemDelegate") ++ # string(FIND [REVERSE]) ++ # string(SUBSTRING ) ++ # math(EXPR value "100 * 0xA" OUTPUT_FORMAT DECIMAL) # value is set to "1000" ++ ++ set(REALPATHS ${ARGN}) ++ foreach(REALPATH IN LISTS REALPATHS) ++ message("---> 传入路径: ${REALPATH} <--- ") ++ string(LENGTH "${REALPATH}" REALPATH_LENGTH) ++ message("---> 计算传入路径长度: --> 长度: ${REALPATH_LENGTH}") ++ ++ string(FIND "${REALPATH}" "/" LASTINDEX REVERSE) ++ message("---> 计算传入路径末尾/位置: --> 长度: ${LASTINDEX}") ++ math(EXPR LASTINDEX "${LASTINDEX}+1") ++ message("---> 计算传入路径末尾/右移: --> 长度: ${LASTINDEX}") ++ string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALPATH_LENGTH} REALNAME_Dependency) ++ ++ # 找 + 号下标,这是找+号的函数 ++ find_plus(${REALPATH} RIGHT_PLUS) ++ ++ # 判断是否有找到 + 号下标,值为 -1 或 正整数 ++ if(RIGHT_PLUS LESS 0) # 小于0: 不存在 + 号 ++ set(REALNAME "${REALNAME_Dependency}") ++ message("---> 传入路径末尾/右移部分: --> ${REALNAME} <-- 无依赖+") ++ ++ message("---> 构建 ${REALNAME} -> ${REALNAME} ${REALPATH} ") ++ ++ spark_add_library_path(${REALNAME} ${REALPATH}) ++ target_link_qt5(${REALNAME}) ++ else() ++ message("---> 传入路径末尾/右移部分: --> ${REALNAME_Dependency} <-- 依赖+") ++ ++ # 存在+号,将截取从 / 到 + 号之间的内容作为目标名称 ++ # 例如 src/unclassified/widgets/DocTypeListView+JsonDeploy ++ # ^(LASTINDEX) ^(RIGHT_PLUS) ++ # 将 RIGHT_PLUS - LASTINDEX 计算出 DocTypeListView 字符长度 ++ math(EXPR REALNAME_LENGTH "${RIGHT_PLUS}-${LASTINDEX}") ++ ++ message("---> 计算传入路径末尾/右移部分: --> 位置: ${RIGHT_PLUS}") ++ # message("---> 计算传入路径末尾/右移部分: --> 长度: ${REALNAME_Dependency}") ++ ++ # 目标名称为 DocTypeListView ++ # 依赖为 JsonDeploy ++ # set(REALNAME "") ++ string(SUBSTRING "${REALPATH}" 0 ${RIGHT_PLUS} _REALPATH_DIR) ++ string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALNAME_LENGTH} REALNAME) ++ ++ message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME}") ++ ++ string(SUBSTRING "${REALPATH}" ${RIGHT_PLUS} ${REALPATH_LENGTH} Dependency) ++ message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency}") ++ ++ # plus_list(${Dependency} dependencies dependencies_len) ++ string(REPLACE "+" ";" dependencies "${Dependency}") ++ message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency} --> 列表: ${dependencies} <-- ") ++ ++ ++ message("---> 构建 ${REALNAME} -> ${REALNAME} ${_REALPATH_DIR}") ++ ++ spark_add_library_path(${REALNAME} ${_REALPATH_DIR}) ++ # target_link_qt5(${REALNAME}) # 使用依赖的依赖或许也不错 ++ ++ target_include_directories(${REALNAME} PUBLIC ${_REALPATH_DIR}) ++ target_link_libraries(${REALNAME} ${dependencies}) ++ ++ endif(RIGHT_PLUS LESS 0) ++ endforeach(REALPATH IN LISTS REALPATHS) ++ ++endmacro(spark_add_library_realpaths) ++ ++ ++# spark_add_source_paths ++# 将指定路径中的文件变成可用的源文件列表 ++# ++macro(spark_add_source_paths SOURCE_VARIABLE_NAME) ++ set(SOURCE_PATHS ${ARGN}) ++ set(${SOURCE_VARIABLE_NAME}_PATHS "") ++ set(${SOURCE_VARIABLE_NAME} "") ++ foreach(SOURCE_PATH IN LISTS SOURCE_PATHS) ++ list(APPEND ${SOURCE_VARIABLE_NAME}_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_PATH}) ++ aux_source_directory(${SOURCE_PATH} _SOURCES) ++ foreach(item IN LISTS _SOURCES) ++ # message(" -> ${item}") ++ list(APPEND ${SOURCE_VARIABLE_NAME} ${item}) ++ endforeach(item IN LISTS _SOURCES) ++ ++ # file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCE_PATH}/*.h) ++ # foreach(item IN LISTS HEADER_LIST) ++ # # message(" -> ${item}") ++ # list(APPEND ${SOURCE_VARIABLE_NAME} ${item}) ++ # endforeach(item IN LISTS HEADER_LIST) ++ ++ file(GLOB UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCE_PATH}/*.ui) ++ foreach(item IN LISTS UI_LIST) ++ # message(" -> ${item}") ++ list(APPEND ${SOURCE_VARIABLE_NAME} ${item}) ++ endforeach(item IN LISTS UI_LIST) ++ endforeach(SOURCE_PATH IN LISTS SOURCE_PATHS) ++endmacro(spark_add_source_paths SOURCE_VARIABLE_NAME) +diff --git a/cmake/SparkTranslatorConfig.cmake b/cmake/SparkTranslatorConfig.cmake +new file mode 100644 +index 0000000..5375fe3 +--- /dev/null ++++ b/cmake/SparkTranslatorConfig.cmake +@@ -0,0 +1,27 @@ ++cmake_minimum_required(VERSION 3.5.1) ++ ++find_package(Qt5LinguistTools) ++ ++file(GLOB SPARK_TRANSLATIONS ${CMAKE_SOURCE_DIR}/translations/*.ts) ++ ++message("================ Translations ================") ++foreach(item IN LISTS SPARK_TRANSLATIONS) ++ message("-> ${item}") ++endforeach(item IN LISTS SPARK_TRANSLATIONS) ++ ++qt5_add_translation(SPARK_QM_TRANSLATIONS ++ ${SPARK_TRANSLATIONS}) ++ ++message("translator(ts -> qm):") ++foreach(item IN LISTS SPARK_QM_TRANSLATIONS) ++ message("-> ${item}") ++endforeach(item IN LISTS SPARK_QM_TRANSLATIONS) ++ ++ ++# 注意,必须将 SPARK_QM_TRANSLATIONS 加入到 add_executable 参数中才能在编译时生成只有原文的ts文件 ++ ++# qt5_create_translation ++ # ts文件会在 make clean 或重新编译的时候一并被删除,再编译的时候生成全新的ts(原有的翻译会丢失,万分注意!!) ++ ++# qt5_add_translation ++ # 此宏比较稳定 +diff --git a/cmake/linuxdeployqt-help b/cmake/linuxdeployqt-help +new file mode 100644 +index 0000000..12ac506 +--- /dev/null ++++ b/cmake/linuxdeployqt-help +@@ -0,0 +1,48 @@ ++linuxdeployqt (commit 5fa79fa), build 36 built on 2022-08-21 12:36:03 UTC ++WARNING: Not checking glibc on the host system. ++ The resulting AppDir or AppImage may not run on older systems. ++ This mode is unsupported and discouraged. ++ For more information, please see ++ https://github.com/probonopd/linuxdeployqt/issues/340 ++ ++Usage: linuxdeployqt [options] ++ ++Options: ++ -always-overwrite : Copy files even if the target file exists. ++ -appimage : Create an AppImage (implies -bundle-non-qt-libs). ++ -bundle-non-qt-libs : Also bundle non-core, non-Qt libraries. ++ -exclude-libs= : List of libraries which should be excluded, ++ separated by comma. ++ -ignore-glob= : Glob pattern relative to appdir to ignore when ++ searching for libraries. ++ -executable= : Let the given executable use the deployed libraries ++ too ++ -extra-plugins= : List of extra plugins which should be deployed, ++ separated by comma. ++ -no-copy-copyright-files : Skip deployment of copyright files. ++ -no-plugins : Skip plugin deployment. ++ -no-strip : Don't run 'strip' on the binaries. ++ -no-translations : Skip deployment of translations. ++ -qmake= : The qmake executable to use. ++ -qmldir= : Scan for QML imports in the given path. ++ -qmlimport= : Add the given path to QML module search locations. ++ -show-exclude-libs : Print exclude libraries list. ++ -verbose=<0-3> : 0 = no output, 1 = error/warning (default), ++ 2 = normal, 3 = debug. ++ -updateinformation= : Embed update information STRING; if zsyncmake is installed, generate zsync file ++ -qtlibinfix= : Adapt the .so search if your Qt distribution has infix. ++ -version : Print version statement and exit. ++ ++linuxdeployqt takes an application as input and makes it ++self-contained by copying in the Qt libraries and plugins that ++the application uses. ++ ++By default it deploys the Qt instance that qmake on the $PATH points to. ++The '-qmake' option can be used to point to the qmake executable ++to be used instead. ++ ++Plugins related to a Qt library are copied in with the library. ++ ++See the "Deploying Applications on Linux" topic in the ++documentation for more information about deployment on Linux. ++zinface@zinface-PC:/tmp/tmp.5gmZKUqn9s$ +\ No newline at end of file +diff --git a/cmake/package-deb.descript b/cmake/package-deb.descript +new file mode 100644 +index 0000000..2b485d1 +--- /dev/null ++++ b/cmake/package-deb.descript +@@ -0,0 +1,44 @@ ++# 注释行(使用方式) ++# find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) ++# add_package_descript(cmake/package-deb.descript) ++ ++# 打包后的文件名称 ++# FileName: 待定 ++# 配置 PACKAGE_SUFFIX 变量可添加尾巴名称 ++# 如在 Makefile 中硬编码方式 ++# OSID=$(shell lsb_release -si) ++# OSRELEASE=$(shell lsb_release -sr) ++# -DPACKAGE_SUFFIX="_$(OSID)$(OSRELEASE)" ++ ++# deb 安装包的安装时脚本 ++# 1.安装[前|后]执行脚本(preinst,postinst), ++# 2.卸载[前|后]执行脚本(prerm,postrm) ++# ControlExtra: 未定义(暂不支持) ++# 如需指定请修改 DebPackageConfig.cmake 模板(第252行) ++# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA 变量 ++ ++# 打包类型,暂支持 deb, 未来支持 tgz(tar.gz) ++Type: deb ++# 软件包名称(自动, 使用 PROJECT_NAME 变量值) ++Package: auto ++# 软件包版本(自动, 使用 PROJECT_VERSION 变量值) ++Version: auto ++# 日历化尾部版本 ++CalVer: true ++# 软件包架构(自动) ++Architecture: auto ++# 软件包属于的系统部分[admin|cli-mono|comm|database|debug|devel|doc|editors|education|electronics|embedded|fonts|games|gnome|gnu-r|gnustep|graphics|hamradio|haskell|httpd|interpreters|introspection|java|javascript|kde|kernel|libdevel|libs|lisp|localization|mail|math|metapackages|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|rust|science|shells|sound|tasks|tex|text|utils|vcs|video|web|x11|xfce|zope] ++Section: utils ++# 软件包优先级[required|important|stantard|optional|extra] ++Priority: optional ++# 软件包依赖 ++Depends: curl, aria2 ++# 软件包维护者(组织或个人) ++Maintainer: shenmo ++# 软件包主页 ++Homepage: https://www.spark-app.store/ ++# 软件包建议 ++Recommends: ++# 软件包描述信息 ++Descrition: Spark Store ++ A community powered app store, based on DTK. +diff --git a/cmake/spark-appimage.desktop.in b/cmake/spark-appimage.desktop.in +new file mode 100644 +index 0000000..228a84a +--- /dev/null ++++ b/cmake/spark-appimage.desktop.in +@@ -0,0 +1,9 @@ ++[Desktop Entry] ++Name=@APP_NAME@ ++Name[zh_CN]=@APP_NAME_ZH_CN@ ++Exec=AppRun %F ++Icon=default ++Comment=@APP_COMMENT@ ++Terminal=true ++Type=Application ++Categories=@APP_CATEGORIES@ +\ No newline at end of file +diff --git a/cmake/spark-desktop.desktop.in b/cmake/spark-desktop.desktop.in +new file mode 100644 +index 0000000..0fa070b +--- /dev/null ++++ b/cmake/spark-desktop.desktop.in +@@ -0,0 +1,11 @@ ++[Desktop Entry] ++Version=1.0 ++Name=@APP_NAME@ ++Name[zh_CN]=@APP_NAME_ZH_CN@ ++Comment=@APP_COMMENT@ ++Type=@APP_TYPE@ ++Exec=@APP_EXECUTE_PATH@ ++Icon=@APP_EXECUTE_ICON_PATH@ ++Categories=@APP_CATEGORIES@ ++ ++# Generated from the DesktopGenerater component of the z-Tools toolkit +\ No newline at end of file +-- +2.33.1 + + +From 4926bf79dce4b057c16338c21b2f50eb517a0e4f Mon Sep 17 00:00:00 2001 +From: zinface +Date: Sun, 11 Dec 2022 22:37:26 +0800 +Subject: [PATCH 02/12] =?UTF-8?q?repo:=20=E5=A4=84=E7=90=86=20deb=20?= + =?UTF-8?q?=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC=E7=9A=84=E9=97=AE=E9=A2=98?= + =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E6=88=90=20cmake=20=E5=8C=96=E6=9E=84?= + =?UTF-8?q?=E5=BB=BA?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: zinface +--- + Makefile | 16 +++++++++++++++- + cmake/DebPackageConfig.cmake | 8 ++++---- + 2 files changed, 19 insertions(+), 5 deletions(-) + +diff --git a/Makefile b/Makefile +index 334ead1..6fdc69b 100644 +--- a/Makefile ++++ b/Makefile +@@ -27,7 +27,21 @@ release: + cd build && cmake -DCMAKE_BUILD_TYPE=Release -DPACKAGE_SUFFIX="$(SUFFIX)" .. + cd build && make -j$(CPUS) + +-package: release ++# 在 make package 时自动处理此内容 ++# 这是由于 CMake 打包需要纯粹的安装脚本名称 ++debian-build-scripts: ++ mkdir -p build/debian ++ cp debian/spark-store.postinst build/debian/postinst ++ cp debian/spark-store.postrm build/debian/postrm ++ cp debian/spark-store.preinst build/debian/preinst ++ cp debian/spark-store.prerm build/debian/prerm ++ ++ chmod +x build/debian/postinst ++ chmod +x build/debian/postrm ++ chmod +x build/debian/preinst ++ chmod +x build/debian/prerm ++ ++package: release debian-build-scripts + cd build && make package + tree build/_CPack_Packages/Linux/DEB/$(PROJECT_NAME)-* + dpkg-deb --contents build/$(PROJECT_NAME)_*$(CALENDAR)*$(SUFFIX).deb +diff --git a/cmake/DebPackageConfig.cmake b/cmake/DebPackageConfig.cmake +index d0351ec..d88fd51 100644 +--- a/cmake/DebPackageConfig.cmake ++++ b/cmake/DebPackageConfig.cmake +@@ -290,10 +290,10 @@ function(add_package_descript IN_DES) + # "${CMAKE_SOURCE_DIR}/config/DEBIAN/postinst" + # "${CMAKE_SOURCE_DIR}/config/DEBIAN/prerm" + # "${CMAKE_SOURCE_DIR}/config/DEBIAN/postrm" +- "${CMAKE_SOURCE_DIR}/debian/spark-store.postinst" +- "${CMAKE_SOURCE_DIR}/debian/spark-store.postrm" +- "${CMAKE_SOURCE_DIR}/debian/spark-store.preinst" +- "${CMAKE_SOURCE_DIR}/debian/spark-store.prerm" ++ "${CMAKE_BINARY_DIR}/debian/postinst" ++ "${CMAKE_BINARY_DIR}/debian/postrm" ++ "${CMAKE_BINARY_DIR}/debian/preinst" ++ "${CMAKE_BINARY_DIR}/debian/prerm" + ) + + # 设置为ON,以便使用 dpkg-shlibdeps 生成更好的包依赖列表。 +-- +2.33.1 + + +From 054db0da4a5b55db3bef8baec70538a10f6612bb Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 12 Dec 2022 00:50:01 +0800 +Subject: [PATCH 03/12] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=20Spark=20?= + =?UTF-8?q?=E6=9E=84=E5=BB=BA=20=E4=B8=8E=20CMake=20=E6=9E=84=E5=BB=BA?= + =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=A2=84=E8=A7=88=E6=96=87=E6=A1=A3?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: zinface +--- + DOCS/spark-cmake-build-system.md | 301 +++++++++++++++++++++++++++++++ + 1 file changed, 301 insertions(+) + create mode 100644 DOCS/spark-cmake-build-system.md + +diff --git a/DOCS/spark-cmake-build-system.md b/DOCS/spark-cmake-build-system.md +new file mode 100644 +index 0000000..b72805e +--- /dev/null ++++ b/DOCS/spark-cmake-build-system.md +@@ -0,0 +1,301 @@ ++# Spark 构建 与 CMake 构建系统预览 ++ ++- 前言 ++ ++ ```cmake ++ # 在 v4.0 之前,我们一直使用 `qmake` 来进行构建星火应用商店。 ++ ++ # 在 v4.0 之后,我们加入了 cmake 构建,并使用 spark 构建为扩展进行开展项目的构建处理。 ++ ++ # 当然,这对于星火应用商店传统的 qmake 构建风格,我们表示还是可以继续保留。 ++ ``` ++ ++- 有关 `CMake` 与 `Spark` 之间的关系 ++ ++ 在进行 `CMake` 化构建时,我们摒弃了传统 `CMake` 语法,使用以 `Spark` 为代号进行一种可扩展的 `CMake` 构建模块设计。 ++ ++ 以下是使用传统 `CMake` 进行构建一个简单的 `Qt` 应用程序: ++ ++ ```cmake ++ cmake_minimum_required(VERSION 3.5.1) ++ ++ project(template LANGUAGES CXX VERSION 0.0.1) ++ ++ set(CMAKE_INCLUDE_CURRENT_DIR ON) ++ set(CMAKE_AUTOMOC ON) ++ set(CMAKE_AUTOUIC ON) ++ set(CMAKE_AUTORCC ON) ++ ++ find_package(Qt5 COMPONENTS Core Widgets Network) ++ ++ # 头文件目录 ++ include_directories() ++ ++ # 资源文件路径 ++ set(QRC_SOURCES "") ++ ++ add_executable(${PROJECT_NAME} "main.cpp" ++ "mainwindow.cpp" "mainwindow.h" ++ ${QRC_SOURCES} ++ ) ++ target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Network) ++ ``` ++ ++ 在传统的 `CMake` 项目中,它保留了基于 `Makefile` 构建项目的风格设计,在每一个构建点都会有一个 `CMakeLists.txt` 存在,它就是所谓的 `Makefile` 构建的超集。 ++ ++ 终于,我们在编写了大量 `CMakeLists.txt` 之后,觉得需要一个更快的构建方式,最起码是移除原有的 `类C` 写法,通过包装不同的目的来完成构建工作,而不是在构建脚本中出现一大堆 `CMake` 传统语法。 ++ ++ 通过初的设计,我们仅保留了最顶层的 `CMakeLists.txt`,并将其作为一个唯一构建点。 ++ ++ ```cmake ++ cmake_minimum_required(VERSION 3.5.1) ++ ++ project(spark-store LANGUAGES CXX VERSION 0.0.1) ++ ++ # 构建 spark-stop 的配置流程 ++ include(cmake/SparkEnvConfig.cmake) # 设置一些有关QT构建的开关 ++ include(cmake/SparkMacrosConfig.cmake) # 声明了一些 spark_ 开头的 macro 宏 ++ include(cmake/SparkFindQt5Config.cmake) # 提供了 target_link_qt5 用于目标链接 qt5 的库 ++ include(cmake/SparkFindDtkConfig.cmake) # 提供了 target_link_dtk 用于目标链接 dtk 的库 ++ include(cmake/SparkThirdLibraryConfig.cmake) # 提供了 third-party 下对应的 target_link_ 用于目标链接 的库 ++ include(cmake/SparkFindLibraries.cmake) # 提供了基于 spark_ 宏生成的 target_link_ 用于目标链接 的库 ++ include(cmake/SparkTranslatorConfig.cmake) # 提供了 qt5 ts转qm 的操作,最终生成 SPARK_QM_TRANSLATIONS 变量用于构建可执行文件时参与编译 ++ include(cmake/SparkBuild.cmake) # 使用了 spark_ 宏基于已提供的宏参数自动展开构建可执行目标文件 ++ ++ # 构建 spark-store 可执行文件 (用于显式展开 SparkBuild.cmake 内容,如果使用 SparkBuild.cmake 此处将需要注释) ++ # spark_add_executable_path(${PROJECT_NAME} src ${SPARK_SOURCES} ${SPARK_QM_TRANSLATIONS}) ++ # target_link_qt5(${PROJECT_NAME}) # 构建的目标需要使用 qt5 库 ++ # target_link_dtk(${PROJECT_NAME}) # 构建的目标需要使用 dtk 库 ++ # target_link_notify(${PROJECT_NAME}) # 构建的目标需要使用 notify 库 ++ # target_link_QtNetworkService(${PROJECT_NAME}) # 构建的目标需要使用 third-part 库 ++ ++ # 子构建 spark-dstore-patch ++ # add_subdirectory(src/spark-dstore-patch) # 传统构建方式,但已经可使用 spark_ 宏构建目标 ++ spark_add_executable_path(spark-dstore-patch src/spark-dstore-patch) ++ target_link_qt5(spark-dstore-patch) # 构建的目标需要使用 qt5 库 ++ ++ include(cmake/SparkInstall.cmake) # 使用了 DebPackage 提供的安装模式 ++ include(cmake/SparkBuildGraphviz.cmake) # 添加了 builddeps 目标构建,make builddeps 将会生成依赖图 ++ ``` ++ ++ 这样一写,我们觉得这是一种非常独特的构建工作,旨在为一些 Linux Qt 项目进行构建时,苦于没有一个较好的构建模板设计,每次在编写一个新的项目时,只能从头开始写构建脚本的一种解决方式。 ++ ++ 我们并不打算发明构建工具,只不过在研究打破 `CMake` 传统构建风格时,我发现了 `XMake`,当时这是我当时安装一个 `XMake` 版本。 ++ ++ ``` ++ $ xmake --version ++ xmake v2.6.2+202201121245, A cross-platform build utility based on Lua ++ Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io ++ _ ++ __ ___ __ __ __ _| | ______ ++ \ \/ / | \/ |/ _ | |/ / __ \ ++ > < | \__/ | /_| | < ___/ ++ /_/\_\_|_| |_|\__ \|_|\_\____| ++ by ruki, xmake.io ++ ++ 👉 Manual: https://xmake.io/#/getting_started ++ 🙏 Donate: https://xmake.io/#/sponsor ++ ``` ++ ++ 在准备尝试使用最适用于 `Linux Qt` 项目的构建方式,也为更快构建一个 `Linux` 应用项目来进行扩展构建。 ++ ++ 我们最开始完成了简单的封装一个 `spark_` 开头的函数来定义简单的构建库目标、构建可执行目标。 ++ ++ 当时使用的是 `function`,并没有使用宏 `macro`,起初认为是无太大区别,后来都转用 `macro` 来定义了。 ++ ++ ```cmake ++ # SparkMacrosConfig.cmake ++ ++ cmake_minimum_required(VERSION 3.5.1) ++ ++ # 定义一些 macro 用于自动生成构建结构 ++ ++ # spark_add_library [files]... ++ # 构建一个库,基于指定的源文件 ++ # 并根据库名生成 target_link_ 函数 ++ macro(spark_add_library _lib_name) ++ message("================ ${_lib_name} Library ================") ++ add_library(${_lib_name} ${ARGN}) ++ ++ set(SRCS ${ARGN}) ++ foreach(item IN LISTS SRCS) ++ message(" -> ${item}") ++ endforeach(item IN LISTS SRCS) ++ ++ function(target_link_${_lib_name} TARGET) ++ message("${_lib_name}") ++ target_link_libraries(${TARGET} ${_lib_name}) ++ endfunction(target_link_${_lib_name} TARGET) ++ ++ endmacro(spark_add_library _lib_name) ++ ++ ++ # spark_add_executable [files]... ++ # 构建一个可执行文件,基于指定的源文件 ++ # Qt编译时源文件包括很多类型,需要指定 *.h/*.cpp/*.qrc/*.qm/... 等 ++ macro(spark_add_executable _exec_name) ++ ++ message("================ ${_exec_name} Executable ================") ++ add_executable(${_exec_name} ${ARGN}) ++ ++ endmacro(spark_add_executable _exec_name) ++ ``` ++ ++ 这样,我们就完成了一个简单的构建目标的方式,通过包装一个 `add_library` 我们可以达到相同的目的。 ++ ++ 并为其创建一个 `target_link_` 开头的`function`来明确声明这个库目标被使用者给依赖。 ++ ++ ```cmake ++ # 例如构建一个 hellworld 目标,并链接到到 `qt5` 的基础库 ++ # target_link_qt5 并不是由 spark_add_library 产生的。 ++ # 只是为了更方便使用 Qt 库, 我们对其进行了一次简单的定义, ++ # 而 target_link_ 可以在使用 macro 宏时生成。 ++ ++ # target_link_qt5 中只定义了有限的几个核心组件: Qt5::Core Qt5::Widgets Qt5::Network ++ ++ spark_add_executable(helloworld ++ main.cpp) ++ ++ target_link_qt5(helloworld) # 表示 helloworld 可执行目标依赖于 Qt5 ++ ``` ++ ++ 当然也可以这样 ++ ++ ```cmake ++ # 构建一个库目标 Say ,它依赖于 qt5 核心库进行构建 ++ spark_add_library(Say say.h say.cpp) ++ target_link_qt5(Say) ++ ++ # 构建一个可执行目标 helloworld,它将依赖于 Say 库 ++ spark_add_executable(helloworld main.cpp) ++ target_link_Say(helloworld) ++ ``` ++ ++ ++- 来到 `Spark` 构建的世界 ++ ++ 这个 `Spark` 构建,最主要的方向就是追求扩展与应用到现有 `Linux Qt` 项目,并替换现有使用传统 `CMake` 构建的 `Linux Qt` 项目。 ++ ++ `Spark` 一直在追求新的构建风格,新的扩展模块,从最开始的封装简单的构建库与可执行文件,到生成 `desktop` 文件的模块,构建 `deb` 软件包的模块,构建新的 `install` 安装方案。 ++ ++ 其中,从基于指定的源代码构建库与可执行文件,发展到使用指定的路径来构建为一个模块。 ++ ++ ```cmake ++ # 构建一个 bigimage 库,它将依赖于 qt5 ++ spark_add_libraries_path(bigimage src/spark-widgets/bigimage) ++ target_link_qt5(bigimage) ++ ++ ++ # 构建一个 imageshow 库,它将依赖于 bigimage ++ spark_add_libraries_path(imageshow src/spark-widgets/imageshow) ++ target_link_bigimage(imageshow) ++ ++ ... ++ ``` ++ ++ 后来,这种方式也基本上被认为最繁琐的构建方式,我们开始了"一行一库"的构建时代,以上的构建内容可以被认为只有两行构建。 ++ ++ 一是构建 bigimage 库,二是构建 imageshow 库,三是 imageshow 依赖了 bigimage,当然,依赖列表就用'+'来进行表示吧。 ++ ++ ```cmake ++ # 基于传入的项进行构建 ++ # 可接受的值为: 路径列表 ++ # 可接受的值为: 路径列表+依赖库A+依赖库B ++ spark_add_library_realpaths( ++ src/spark-widgets/bigimage ++ src/spark-widgets/imageshow+bigimage) ++ ``` ++ ++- `Spark` 构建与 `DTK` ++ ++ 我们在为基于 Deepin Tool Kit(DTK) 的应用程序添加了简单的扩展,使用以下内容即可使你的程序依赖于 `DTK` ++ ++ ```cmake ++ # 引入 SparkFindDtk 模块 ++ include(cmake/SparkFindDtkConfig.cmake) ++ ++ # 构建一个 bigimage 库,它将自动依赖于 qt5 ++ spark_add_library_realpaths( ++ src/spark-widgets/bigimage) ++ ++ # 为 bigimage 库目标进行链接 DTK ++ target_link_dtk(bigimage) ++ ``` ++ ++- `Spark` 构建与 `deb` 打包 ++ ++ 我们在为基于 `CMakeLists.txt` 中使用的 `install` 指令进行了 `CPack` 打包扩展,因为我们不喜欢类似 `Makefile` 这种 `make install` 安装的方式。 ++ ++ 所以我们也增加了一个扩展模块 `DebPackageConfig.cmake`,因为它是早于 `Spark` 构建出现,所以并不为它进行 `Spark` 命名,它拥有一个模板配置,可以通过简单的填充包描述信息即可实现打包。 ++ ++ 注意,它的最开始三行即是使用方式说明,通过(cv)复制粘贴到您的顶层构建脚本中,即可完成打包功能,更多的软件包打包设定功能仍在 `DebPackageConfig.cmake` 中预留被注释的部分。 ++ ++ 例如您想生成软件包依赖列表等,在其中 `SHLIBDEPS` 字样的部分已预留注释。 ++ ++ 例如您想为软件包增加 `pre[inst|rm]、post[inst|rm]` 等脚本,在其中 `CONTROL` 字样的部分已预留注释。 ++ ++ 描述文件还为您专门提供了可选的自动化填充软件包名称、软件包版本、软件包架构等,而无需要每次更新描述文件。 ++ ++ ```ini ++ # 注释行(使用方式) ++ # find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) ++ # add_package_descript(cmake/package-deb.descript) ++ ++ # 打包后的文件名称 ++ # FileName: 待定 ++ # 配置 PACKAGE_SUFFIX 变量可添加尾巴名称 ++ # 如在 Makefile 中硬编码方式 ++ # OSID=$(shell lsb_release -si) ++ # OSRELEASE=$(shell lsb_release -sr) ++ # -DPACKAGE_SUFFIX="_$(OSID)$(OSRELEASE)" ++ ++ # deb 安装包的安装时脚本 ++ # 1.安装[前|后]执行脚本(preinst,postinst), ++ # 2.卸载[前|后]执行脚本(prerm,postrm) ++ # ControlExtra: 未定义(暂不支持) ++ # 如需指定请修改 DebPackageConfig.cmake 模板(第252行) ++ # CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA 变量 ++ ++ # 打包类型,暂支持 deb, 未来支持 tgz(tar.gz) ++ Type: deb ++ # 软件包名称(自动, 使用 PROJECT_NAME 变量值) ++ Package: auto ++ # 软件包版本(自动, 使用 PROJECT_VERSION 变量值) ++ Version: auto ++ # 日历化尾部版本 ++ CalVer: true ++ # 软件包架构(自动) ++ Architecture: auto ++ # 软件包属于的系统部分[admin|cli-mono|comm|database|debug|devel|doc|editors|education|electronics|embedded|fonts|games|gnome|gnu-r|gnustep|graphics|hamradio|haskell|httpd|interpreters|introspection|java|javascript|kde|kernel|libdevel|libs|lisp|localization|mail|math|metapackages|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|rust|science|shells|sound|tasks|tex|text|utils|vcs|video|web|x11|xfce|zope] ++ Section: utils ++ # 软件包优先级[required|important|stantard|optional|extra] ++ Priority: optional ++ # 软件包依赖 ++ Depends: curl, aria2 ++ # 软件包维护者(组织或个人) ++ Maintainer: shenmo ++ # 软件包主页 ++ Homepage: https://www.spark-app.store/ ++ # 软件包建议 ++ Recommends: ++ # 软件包描述信息 ++ Descrition: Spark Store ++ A community powered app store, based on DTK. ++ ``` ++ ++ ++- 写在后面,有关 `Spark` 构建的起源与未来 ++ ++ `Spark` 构建真正意义上只是一个有趣的想法,并且为它付诸一定的实现。 ++ ++ 我们拥抱过 qmake,我们也拥抱过 cmake。我们是混乱的 IDE 或是代码编辑器的忠实用户,就像是在 IDE 与 编辑器之间的战争从未停止过。 ++ ++ 在着手 `Spark` 构建之前,它就是一个想法,目的是为了尝试将星火应用商店从 `qmake` 构建转为 `cmake` 构建,它就像星星之火中的野火,它有自己的想法。而这个想法就是打破传统的构建方式,或尝试改造现有的构建模式。 ++ ++ 而这并没有为星火商店付出什么,甚至没有提交过任何 `bug fix`,只是一个因为喜欢安份但又不守已的试图破坏(改变)星火应用商店传统构建的疯狂的 `VSCode` 用户,事实上是一个 `CMake` 用户,因为他无法在 `VSCode` 中使用 `qmake` 增强 `VSCode` 的代码能力。 ++ ++ 只能试图在一个已经发展了多年了项目上开始进行破坏(改造),将其转化为以 `cmake` 为主的构建,并在其它开源项目中寻找 `Spark` 的构建瓶颈以及拓展它疯狂的可扩展模块。 ++ ++ 在很久之后,这个想法终于在星火商店的 `4.0` 计划下开始正式实施,此时 `Spark` 构建已经为很多 `Linux Qt` 项目进行构建,包括非常复杂的构建探索,打破了一个又一个构建方式,最终完善了基本的构建模板。 ++ ++ 现在,`Spark` 构建在强大的 `CMake` 扩展下增强了 `VSCode` 的代码编写能力,在绕了一大圈之后,终于回到了起源的地方,并开始了它的构建使命,为星火应用商店构建 `4.0` 以及未来的版本。 +\ No newline at end of file +-- +2.33.1 + + +From 75aab8e3b58a250fce670f8e434bf76ad7866275 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Thu, 15 Dec 2022 19:59:46 +0800 +Subject: [PATCH 04/12] =?UTF-8?q?repo:=20=E6=9B=B4=E6=96=B0=E7=94=A8?= + =?UTF-8?q?=E4=BA=8E=20Qt5=20Svg=20=E4=BE=9D=E8=B5=96=E7=9A=84=E6=9E=84?= + =?UTF-8?q?=E5=BB=BA=E5=86=85=E5=AE=B9?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + CMakeLists.txt | 1 + + cmake/SparkFindQt5Config.cmake | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 51cc090..f3edc6c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,6 +32,7 @@ spark_add_library_realpaths( + target_link_qt5_dbus(dbus) + target_link_qt5_Concurrent(common) + target_link_qt5_Concurrent(backend) ++target_link_qt5_Svg(common) + target_link_qt5_WebEngineWidgets(common) + + spark_add_executable_path(${PROJECT_NAME} src +diff --git a/cmake/SparkFindQt5Config.cmake b/cmake/SparkFindQt5Config.cmake +index 6efade6..0300b3d 100644 +--- a/cmake/SparkFindQt5Config.cmake ++++ b/cmake/SparkFindQt5Config.cmake +@@ -1,6 +1,6 @@ + cmake_minimum_required(VERSION 3.5.1) + +-find_package(Qt5 COMPONENTS Core Widgets Network Concurrent WebEngineWidgets Sql WebSockets REQUIRED) ++find_package(Qt5 COMPONENTS Core Widgets Network Concurrent WebEngineWidgets REQUIRED) + + # function(target_link_qt5 NAME) + # target_link_libraries(${NAME} +@@ -132,7 +132,7 @@ spark_add_links_qt5( + # SerialPort + # ServiceSupport + # Sql +- # Svg ++ Svg + # Test + # ThemeSupport + # UiPlugin +-- +2.33.1 + + +From 0ae64f99cd269a06009818d0c553661e2fd5981b Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 19 Dec 2022 02:58:17 +0800 +Subject: [PATCH 05/12] =?UTF-8?q?repo:=20=E6=9B=B4=E6=96=B0=E7=94=A8?= + =?UTF-8?q?=E4=BA=8E=E6=94=AF=E6=8C=81=20BaseWidgetOpacity=20=E5=9F=BA?= + =?UTF-8?q?=E7=A1=80=E7=B1=BB=E7=9A=84=E6=9E=84=E5=BB=BA?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + CMakeLists.txt | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f3edc6c..d469796 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,11 +24,13 @@ spark_add_library_realpaths( + src/dbus + src/utils+dbus + src/backend+utils ++ src/widgets/base + src/widgets/common+backend + src/widgets+common + src/pages+widgets + ) + ++target_link_dtk(base) + target_link_qt5_dbus(dbus) + target_link_qt5_Concurrent(common) + target_link_qt5_Concurrent(backend) +@@ -38,9 +40,9 @@ target_link_qt5_WebEngineWidgets(common) + spark_add_executable_path(${PROJECT_NAME} src + ${QRC_SOURCES} ${SPARK_QM_TRANSLATIONS} + ) ++target_link_base(${PROJECT_NAME}) + target_link_dbus(${PROJECT_NAME}) + target_link_pages(${PROJECT_NAME}) +-target_link_dtk(${PROJECT_NAME}) + + + spark_add_executable_path(spark-dstore-patch src/spark-dstore-patch) +-- +2.33.1 + + +From 3815f39926a5761769b55922cb3471ffa6e60baf Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 30 Jan 2023 20:48:25 +0800 +Subject: [PATCH 06/12] =?UTF-8?q?spark:=20=E5=88=9B=E5=BB=BA=E6=96=B0?= + =?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=9D=97=E7=94=A8=E4=BA=8E=20debian/changelo?= + =?UTF-8?q?g=20=E7=9A=84=E7=89=88=E6=9C=AC=E5=8F=B7=E9=87=8D=E5=86=99?= + =?UTF-8?q?=E8=A7=84=E5=88=99?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. SparkDebianChangelogVersion.cmake + 在此文件中提供 spark_debian_changelog_override_version 宏: + 基于指定的 debian/changelog 文件并用于读取最新版本号并覆盖到项目版本 + +@Since: v4.0.0 +--- + CMakeLists.txt | 4 ++ + cmake/SparkDebianChangelogVersion.cmake | 58 +++++++++++++++++++++++++ + 2 files changed, 62 insertions(+) + create mode 100644 cmake/SparkDebianChangelogVersion.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d469796..990c7be 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,6 +11,10 @@ include(cmake/SparkFindDtkConfig.cmake) # 提供了 target_link_dtk 用 + include(cmake/SparkTranslatorConfig.cmake) # 提供了 qt5 ts转qm 的操作,最终生成 SPARK_QM_TRANSLATIONS 变量用于构建可执行文件时参与编译 + include(cmake/SparkMacrosExtendConfig.cmake) # 使用了 spark_ 宏基于已提供的宏参数自动展开构建可执行目标文件 + include(cmake/SparkInstallMacrosConfig.cmake) # 提供了 spark_install 开头的 macro 宏用于安装 target、file、program、directory、changelog 等内容 ++include(cmake/SparkDebianChangelogVersion.cmake)# 提供了 spark_debian_ 开头的宏进行进行覆盖 PROJECT_VERSION ++ ++# 在开始之前,使用项目中提供的 debian/changelog 进行重写本构建系统的 PROJECT_VERSION ++spark_debian_changelog_override_version(debian/changelog) + + # 资源文件路径 + set(QRC_SOURCES "src/assets/assets.qrc") +diff --git a/cmake/SparkDebianChangelogVersion.cmake b/cmake/SparkDebianChangelogVersion.cmake +new file mode 100644 +index 0000000..3b3add4 +--- /dev/null ++++ b/cmake/SparkDebianChangelogVersion.cmake +@@ -0,0 +1,58 @@ ++# SparkDebianChangelogVersion ++ ++# 尝试读取 debian/changelog 文件的第一行数据,并查找 ++# spark-store (4.2.2) stable; urgency=medium ++# 将 (version) 信息应用用于 PROJECT_VERSION ++ ++ ++macro(spark_debian_changelog_override_version _CHANGELOG_FILE_PATH) ++ set(CHANGELOG_FILE_PATH ${_CHANGELOG_FILE_PATH}) ++ set(CHANGELOG_FILE_EXISTS FALSE) ++ ++ # 首次判断,如果判断文件不存在,将尽可能的判断文件是存在的 ++ if(NOT EXISTS ${CHANGELOG_FILE_PATH}) ++ ++ # 在 CMake v3.19 起,可以使用 file(REAL_PATH ) 进行获取 path 的绝对路径 ++ if(CMAKE_VERSION GREATER_EQUAL 3.19) ++ file(REAL_PATH ${CHANGELOG_FILE_PATH} CHANGELOG_FILE_ABSOLUTE_PATH) ++ if(EXISTS ${CHANGELOG_FILE_ABSOLUTE_PATH}) ++ set(CHANGELOG_FILE_EXISTS TRUE) ++ set(CHANGELOG_FILE_PATH ${CHANGELOG_FILE_ABSOLUTE_PATH}) ++ endif(EXISTS ${CHANGELOG_FILE_ABSOLUTE_PATH}) ++ endif(CMAKE_VERSION GREATER_EQUAL 3.19) ++ ++ # 第二次判断与处理 使用 file(SIZE) 方式 ++ if(NOT CHANGELOG_FILE_EXISTS) ++ file(SIZE ${CHANGELOG_FILE_PATH} CHANGELOG_FILE_SIZE) ++ if(CHANGELOG_FILE_SIZE GREATER 0) ++ set(CHANGELOG_FILE_EXISTS TRUE) ++ endif(CHANGELOG_FILE_SIZE GREATER 0) ++ endif(NOT CHANGELOG_FILE_EXISTS) ++ ++ # 第三次判断与处理 使用路径拼接方式 ++ if(NOT CHANGELOG_FILE_EXISTS) ++ if(EXISTS ${CMAKE_SOURCE_DIR}/${CHANGELOG_FILE_PATH}) ++ set(CHANGELOG_FILE_PATH ${CMAKE_SOURCE_DIR}/${CHANGELOG_FILE_PATH}) ++ set(CHANGELOG_FILE_EXISTS TRUE) ++ endif(EXISTS ${CMAKE_SOURCE_DIR}/${CHANGELOG_FILE_PATH}) ++ endif(NOT CHANGELOG_FILE_EXISTS) ++ endif(NOT EXISTS ${CHANGELOG_FILE_PATH}) ++ ++ message("> V = ${CHANGELOG_FILE_PATH}") ++ if(CHANGELOG_FILE_EXISTS) ++ file(READ ${CHANGELOG_FILE_PATH} CHANGELOG_CONTENT LIMIT 20) ++ ++ string(FIND ${CHANGELOG_CONTENT} "(" V_PRE) # +1 to V_BEGIN ++ string(FIND ${CHANGELOG_CONTENT} ")" V_END) ++ ++ math(EXPR V_BEGIN "${V_PRE}+1") ++ math(EXPR V_LENGTH "${V_END}-${V_BEGIN}") ++ ++ string(SUBSTRING ${CHANGELOG_CONTENT} ${V_BEGIN} ${V_LENGTH} V) ++ ++ message("> V = ${CHANGELOG_CONTENT}") ++ message("> V = [${V}]") ++ ++ set(PROJECT_VERSION ${V}) ++ endif(CHANGELOG_FILE_EXISTS) ++endmacro(spark_debian_changelog_override_version _CHANGELOG_FILE_PATH) +-- +2.33.1 + + +From 0f8ec4935071280518a8466ce36fbbd84ed1cbb0 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 30 Jan 2023 21:23:15 +0800 +Subject: [PATCH 07/12] =?UTF-8?q?spark:=20=E5=AF=B9=20SparkDebianChangelog?= + =?UTF-8?q?Version.cmake=20=E6=A8=A1=E5=9D=97=E7=9A=84=E6=89=A9=E5=B1=95?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. 增加 SPARK_OVERRIDE_VERSION 的文件输出 + 以解决 Makefile 中无法明确多个 deb 包时无法确定最新版本的情况 +--- + Makefile | 15 +++++++++++++-- + cmake/SparkDebianChangelogVersion.cmake | 1 + + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 6fdc69b..a68d7d1 100644 +--- a/Makefile ++++ b/Makefile +@@ -8,6 +8,17 @@ SUFFIX=_$(OSID)$(OSRELEASE) + endif + + PROJECT_NAME=spark-store ++PROJECT_VERSION=* ++ ++ifneq ($(wildcard build/SPARK_OVERRIDE_VERSION),) ++SPARK_OVERRIDE_VERSION=`cat build/SPARK_OVERRIDE_VERSION` ++.PHONY: override-version ++override-version: ++ @echo $(SPARK_OVERRIDE_VERSION) ++ @echo "wildcard - good: $(wildcard build/SPARK_OVERRIDE_VERSION)" ++ @echo "wildcard - bad.: $(wildcard build/SPARK_OVERRIDE_VERSIONS)" ++PROJECT_VERSION=$(SPARK_OVERRIDE_VERSION)- ++endif + + all: + mkdir -p build +@@ -44,7 +55,7 @@ debian-build-scripts: + package: release debian-build-scripts + cd build && make package + tree build/_CPack_Packages/Linux/DEB/$(PROJECT_NAME)-* +- dpkg-deb --contents build/$(PROJECT_NAME)_*$(CALENDAR)*$(SUFFIX).deb ++ dpkg-deb --contents build/$(PROJECT_NAME)_$(PROJECT_VERSION)$(CALENDAR)*$(SUFFIX).deb + # cd build/_CPack_Packages/Linux/DEB/$(PROJECT_NAME)_*$(CALENDAR)*$(SUFFIX).deb && find . + + builddeps: +@@ -54,7 +65,7 @@ cpus: + @echo "CPU数量: $(CPUS)" + + copytosource:package +- cp build/$(PROJECT_NAME)_*$(CALENDAR)*.deb . ++ cp build/$(PROJECT_NAME)_$(PROJECT_VERSION)$(CALENDAR)*.deb . + + # 进入 qdebug 模式,在 deepin 中默认被禁用,可 env | grep QT 查看,并在 /etc/X11/Xsession.d/00deepin-dde-env 配置中已定义 + # 1. 禁止 qt 的 debug 打印: qt.*.debug=false +diff --git a/cmake/SparkDebianChangelogVersion.cmake b/cmake/SparkDebianChangelogVersion.cmake +index 3b3add4..05f9e52 100644 +--- a/cmake/SparkDebianChangelogVersion.cmake ++++ b/cmake/SparkDebianChangelogVersion.cmake +@@ -54,5 +54,6 @@ macro(spark_debian_changelog_override_version _CHANGELOG_FILE_PATH) + message("> V = [${V}]") + + set(PROJECT_VERSION ${V}) ++ file(WRITE ${CMAKE_BINARY_DIR}/SPARK_OVERRIDE_VERSION ${V}) + endif(CHANGELOG_FILE_EXISTS) + endmacro(spark_debian_changelog_override_version _CHANGELOG_FILE_PATH) +-- +2.33.1 + + +From 5455594cf1134a29dee32257e6d8d3d8b78c8fd6 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 30 Jan 2023 23:17:24 +0800 +Subject: [PATCH 08/12] =?UTF-8?q?repo:=20=E5=A4=84=E7=90=86=20v4.2.2=20?= + =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=97=B6=E6=9C=9F=E6=96=B0=E5=A2=9E=E7=9A=84?= + =?UTF-8?q?=E5=AE=89=E8=A3=85=E6=96=87=E4=BB=B6?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +pkg/usr/share/ssinstall/transhell + -> /usr/share/ssinstall +--- + CMakeLists.txt | 5 +++++ + cmake/SparkInstallMacrosConfig.cmake | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 990c7be..4e22685 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -86,6 +86,11 @@ spark_install_file(/usr/share/icons/hicolor/scalable/apps + spark_install_program(/tmp/spark-store-install + pkg/tmp/spark-store-install/feedback.sh) + ++# 安装什么翻译? Since: v4.2.2 ++spark_install_directory(/usr/share/ssinstall ++ pkg/usr/share/ssinstall/transhell ++) ++ + # 安装 qm 文件? + spark_install_file(/usr/share/spark-store/translations + ${SPARK_QM_TRANSLATIONS}) +diff --git a/cmake/SparkInstallMacrosConfig.cmake b/cmake/SparkInstallMacrosConfig.cmake +index bf906bf..e1fd7a0 100644 +--- a/cmake/SparkInstallMacrosConfig.cmake ++++ b/cmake/SparkInstallMacrosConfig.cmake +@@ -79,7 +79,7 @@ macro(spark_install_directory INSTALL_DIRECTORY_DIR INSTALL_DIRECOTRY) + # message(FATAL_ERROR " directory: ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST_LENGTH}") + + else() +- message(FATAL_ERROR "install: ${INSTALL_DIRECTORY_DIR}") ++ # message(FATAL_ERROR "install: ${INSTALL_DIRECTORY_DIR}") + + install(DIRECTORY + ${INSTALL_DIRECOTRY} ${ARGN} +-- +2.33.1 + + +From e4e6ca8b83f86e50ab32582a00b85bbe7057f454 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 30 Jan 2023 23:18:44 +0800 +Subject: [PATCH 09/12] =?UTF-8?q?spark:=20=E5=AF=B9=20SparkTranslatorConfi?= + =?UTF-8?q?g.cmake=20=E6=A8=A1=E5=9D=97=E7=9A=84=E6=89=A9=E5=B1=95?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. 增加 SPARK_QM_TRANSLATIONS 的文件输出 + 无任何其它变动 +--- + cmake/SparkTranslatorConfig.cmake | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/cmake/SparkTranslatorConfig.cmake b/cmake/SparkTranslatorConfig.cmake +index 5375fe3..46de519 100644 +--- a/cmake/SparkTranslatorConfig.cmake ++++ b/cmake/SparkTranslatorConfig.cmake +@@ -12,6 +12,11 @@ endforeach(item IN LISTS SPARK_TRANSLATIONS) + qt5_add_translation(SPARK_QM_TRANSLATIONS + ${SPARK_TRANSLATIONS}) + ++file(WRITE ${CMAKE_BINARY_DIR}/SPARK_QM_TRANSLATIONS "") ++foreach(item IN LISTS SPARK_QM_TRANSLATIONS) ++ file(APPEND ${CMAKE_BINARY_DIR}/SPARK_QM_TRANSLATIONS "${item}\n") ++endforeach(item IN LISTS SPARK_QM_TRANSLATIONS) ++ + message("translator(ts -> qm):") + foreach(item IN LISTS SPARK_QM_TRANSLATIONS) + message("-> ${item}") +-- +2.33.1 + + +From a0eb885925c78b8966c46540a993f4cc6983c4c6 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 30 Jan 2023 23:20:12 +0800 +Subject: [PATCH 10/12] =?UTF-8?q?make:=20=E5=A4=84=E7=90=86=E9=BB=98?= + =?UTF-8?q?=E8=AE=A4=20make=20=E7=9B=AE=E6=A0=87=E4=B8=BA=20override-versi?= + =?UTF-8?q?on=20=E7=9A=84=E9=97=AE=E9=A2=98?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + Makefile | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/Makefile b/Makefile +index a68d7d1..ba45029 100644 +--- a/Makefile ++++ b/Makefile +@@ -12,11 +12,6 @@ PROJECT_VERSION=* + + ifneq ($(wildcard build/SPARK_OVERRIDE_VERSION),) + SPARK_OVERRIDE_VERSION=`cat build/SPARK_OVERRIDE_VERSION` +-.PHONY: override-version +-override-version: +- @echo $(SPARK_OVERRIDE_VERSION) +- @echo "wildcard - good: $(wildcard build/SPARK_OVERRIDE_VERSION)" +- @echo "wildcard - bad.: $(wildcard build/SPARK_OVERRIDE_VERSIONS)" + PROJECT_VERSION=$(SPARK_OVERRIDE_VERSION)- + endif + +@@ -82,4 +77,13 @@ copytosource:package + enter-qdebug-mode: + # 进入新的 bash 环境 + @# export QT_LOGGING_RULES=".debug=true; qt.*.debug=false; dtk.*.debug=false; dde.*.debug=false; qtc*=false; " && bash +- export QT_LOGGING_RULES=".debug=true" && bash +\ No newline at end of file ++ export QT_LOGGING_RULES=".debug=true" && bash ++ ++ ++ifneq ($(wildcard build/SPARK_OVERRIDE_VERSION),) ++.PHONY: override-version ++override-version: ++ @echo $(SPARK_OVERRIDE_VERSION) ++ @echo "wildcard - good: $(wildcard build/SPARK_OVERRIDE_VERSION)" ++ @echo "wildcard - bad.: $(wildcard build/SPARK_OVERRIDE_VERSIONS)" ++endif +\ No newline at end of file +-- +2.33.1 + + +From a22611edeb5706aa6b574b508f29b25f599346f5 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Sun, 5 Feb 2023 16:09:40 +0800 +Subject: [PATCH 11/12] =?UTF-8?q?spark:=20=E5=A4=84=E7=90=86=E7=89=88?= + =?UTF-8?q?=E6=9C=AC=E5=8F=B7=204.2.3~test1=20=E6=97=B6=E9=BB=98=E8=AE=A4?= + =?UTF-8?q?=E7=9A=84=E6=88=AA=E5=8F=96=E5=AD=97=E7=AC=A6=E6=95=B0=E8=BF=87?= + =?UTF-8?q?=E7=9F=AD=E9=97=AE=E9=A2=98?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + cmake/SparkDebianChangelogVersion.cmake | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/cmake/SparkDebianChangelogVersion.cmake b/cmake/SparkDebianChangelogVersion.cmake +index 05f9e52..ee2f339 100644 +--- a/cmake/SparkDebianChangelogVersion.cmake ++++ b/cmake/SparkDebianChangelogVersion.cmake +@@ -40,7 +40,8 @@ macro(spark_debian_changelog_override_version _CHANGELOG_FILE_PATH) + + message("> V = ${CHANGELOG_FILE_PATH}") + if(CHANGELOG_FILE_EXISTS) +- file(READ ${CHANGELOG_FILE_PATH} CHANGELOG_CONTENT LIMIT 20) ++ file(READ ${CHANGELOG_FILE_PATH} CHANGELOG_CONTENT LIMIT 30) ++ # fix: spark-store (4.2.3~test1) 已经超过 20 字符位,所以使用 30 进行保守计算 + + string(FIND ${CHANGELOG_CONTENT} "(" V_PRE) # +1 to V_BEGIN + string(FIND ${CHANGELOG_CONTENT} ")" V_END) +-- +2.33.1 + + +From 64d92ae46637c672842a7734327cbe0cb4f89ae1 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Sat, 3 Feb 2024 02:38:06 +0800 +Subject: [PATCH 12/12] =?UTF-8?q?repo:=20=E4=B8=80=E6=AC=A1=E6=80=A7?= + =?UTF-8?q?=E5=A4=84=E7=90=86=204.2.3=20-4.2.10=20=E6=97=B6=E6=9C=9F?= + =?UTF-8?q?=E7=9A=84=E8=B7=A8=E8=B6=8A=E5=BC=8F=E6=9E=84=E5=BB=BA=E4=B8=8E?= + =?UTF-8?q?=E5=85=A8=E9=87=8F=E7=BA=A7=E6=9B=B4=E6=96=B0?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + CMakeLists.txt | 72 ++- + assets/spark.png | Bin 4959 -> 8822 bytes + cmake/SparkAppimageConfig.cmake | 210 ++++--- + ...nfig.cmake => SparkDebPackageConfig.cmake} | 41 +- + cmake/SparkDebianChangelogVersion.cmake | 6 +- + cmake/SparkDesktopMacros.cmake | 43 +- + cmake/SparkEnvConfig.cmake | 18 +- + cmake/SparkFindDtkConfig.cmake | 2 +- + cmake/SparkFindQt5Config.cmake | 13 +- + cmake/SparkFindQt6Config.cmake | 110 +++- + cmake/SparkMacrosConfig.cmake | 348 +++++++++-- + cmake/SparkMacrosExtendConfig.cmake | 547 +++++++++++++----- + cmake/SparkTranslatorConfig.cmake | 77 ++- + cmake/linuxdeployqt-help | 2 +- + ...sktop.in => spark-appimage.desktop.in.txt} | 2 +- + ...eb.descript => spark-deb-package.descript} | 8 +- + ...esktop.in => spark-desktop.desktop.in.txt} | 4 +- + 17 files changed, 1127 insertions(+), 376 deletions(-) + rename cmake/{DebPackageConfig.cmake => SparkDebPackageConfig.cmake} (90%) + rename cmake/{spark-appimage.desktop.in => spark-appimage.desktop.in.txt} (83%) + rename cmake/{package-deb.descript => spark-deb-package.descript} (91%) + rename cmake/{spark-desktop.desktop.in => spark-desktop.desktop.in.txt} (88%) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4e22685..90fc62d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,48 +15,53 @@ include(cmake/SparkDebianChangelogVersion.cmake)# 提供了 spark_debian_ 开头 + + # 在开始之前,使用项目中提供的 debian/changelog 进行重写本构建系统的 PROJECT_VERSION + spark_debian_changelog_override_version(debian/changelog) ++# 使用 git 获取当前分支名称 ++execute_process(COMMAND ++ git symbolic-ref --short -q HEAD ++ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ OUTPUT_VARIABLE PROJECT_BRANCH) ++ ++spark_debug_message("APP_BRANCH: ${PROJECT_BRANCH}") ++spark_debug_message("APP_VERSION: ${PROJECT_VERSION}") ++add_compile_definitions(APP_BRANCH="${PROJECT_BRANCH}") ++add_compile_definitions(APP_VERSION="${PROJECT_VERSION}") + + # 资源文件路径 + set(QRC_SOURCES "src/assets/assets.qrc") + +-include_directories(src) ++translator_qt(SPARK_QM_TRANSLATIONS ${CMAKE_SOURCE_DIR}/translations/*.ts) ++spark_debug_message("SPARK_QM_TRANSLATIONS: ${SPARK_QM_TRANSLATIONS}") + +-# 基于传入的项进行构建 +-# 可接受的值为: 路径列表 +-# 可接受的值为: 路径列表+依赖库A+依赖库B +-spark_add_library_realpaths( ++# spark_add_executable_path [files ... paths] ++# 构建一个可执行程序,基于指定的路径 ++spark_add_executable_path(${PROJECT_NAME} src + src/dbus +- src/utils+dbus +- src/backend+utils ++ src/utils ++ src/backend + src/widgets/base +- src/widgets/common+backend +- src/widgets+common +- src/pages+widgets +-) +- +-target_link_dtk(base) +-target_link_qt5_dbus(dbus) +-target_link_qt5_Concurrent(common) +-target_link_qt5_Concurrent(backend) +-target_link_qt5_Svg(common) +-target_link_qt5_WebEngineWidgets(common) +- +-spark_add_executable_path(${PROJECT_NAME} src ++ src/widgets/common ++ src/widgets ++ src/pages + ${QRC_SOURCES} ${SPARK_QM_TRANSLATIONS} + ) +-target_link_base(${PROJECT_NAME}) +-target_link_dbus(${PROJECT_NAME}) +-target_link_pages(${PROJECT_NAME}) ++target_link_qt5(${PROJECT_NAME}) ++target_link_dtk(${PROJECT_NAME}) ++target_link_qt5_svg(${PROJECT_NAME}) ++target_link_qt5_dbus(${PROJECT_NAME}) ++target_link_qt5_concurrent(${PROJECT_NAME}) ++target_link_qt5_WebEngineWidgets(${PROJECT_NAME}) + + +-spark_add_executable_path(spark-dstore-patch src/spark-dstore-patch) +-target_link_qt5(spark-dstore-patch) ++# spark_add_executable_path(spark-dstore-patch src/spark-dstore-patch) ++# target_link_qt5(spark-dstore-patch) + + + # 安装主程序 spark-store 与 spark-dstore-patch + spark_install_target(/opt/durapps/${PROJECT_NAME}/bin + ${PROJECT_NAME} +- spark-dstore-patch) ++ # spark-dstore-patch ++) + + # 安装 systemd 服务(Spark Store更新通知程序) + spark_install_file(/usr/lib/systemd/system/ +@@ -76,16 +81,23 @@ spark_install_file(/usr/share/bash-completion/completions + + # 安装 desktop 文件 + spark_install_file(/usr/share/applications +- pkg/usr/share/applications/spark-store.desktop) ++ pkg/usr/share/applications/spark-store.desktop ++ pkg/usr/share/applications/open-me-in-terminal.desktop) + + # 安装 icon 文件 + spark_install_file(/usr/share/icons/hicolor/scalable/apps +- pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg) ++ pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg ++ pkg/usr/share/icons/hicolor/scalable/apps/open-me-in-terminal.png) + + # 安装什么脚本? + spark_install_program(/tmp/spark-store-install + pkg/tmp/spark-store-install/feedback.sh) + ++# 安装什么翻译? Since: v4.3.10 ++spark_install_file(/usr/share/aptss/transhell ++ pkg/usr/share/aptss/transhell/aptss_en_US.transhell ++ pkg/usr/share/aptss/transhell/aptss_zh_CN.transhell) ++ + # 安装什么翻译? Since: v4.2.2 + spark_install_directory(/usr/share/ssinstall + pkg/usr/share/ssinstall/transhell +@@ -101,5 +113,5 @@ spark_install_changelog(${CMAKE_SOURCE_DIR}/debian/changelog) + include(cmake/SparkBuildGraphviz.cmake) + + # 注释行(使用方式) +-find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) +-add_package_descript(cmake/package-deb.descript) +\ No newline at end of file ++find_package(SparkDebPackage PATHS ${CMAKE_SOURCE_DIR}) ++add_package_descript(cmake/spark-deb-package.descript) +\ No newline at end of file +diff --git a/assets/spark.png b/assets/spark.png +index 544e2c7cff5f70894e27a7a717d4a62120630b7a..bac324f1a8a025c65ea260274ebf078f6f52ce39 100644 +GIT binary patch +literal 8822 +zcmX9^2RK{r7dB(mUZq0SrdladTkTaNwivagVzfqVwJBO^6QV|iwu(ya+M9~nwOc!4 +z)TXrl@%uk{ZtnBk``vTT_nvd!bH4N41c-qaE%hyGA|fJM9c^`E!ny4Fpac;9{n+%j +z2`7N#V=Z+eVj?dhBP4(|o^XZgxi-|7i0D4w^+6n1`pBPfk-|?$UxQ+UhJu9rhJX5} +zNWvu!KMhMiwP&85E?#~_YCbLwelE^D0d9Uzd9-x&Ar_HzH;IUNh;-CdOao_kP;PJd +z*TUA{o(@-hOu^xB1splt>-I8IJeo`-acVsFZpU0)0YzO*j=LOxDq2(I4ud5R7wDh4nwcXk%*+WtSHl)Y +zGGeuHvs}Z!2UiMvS66IMtC8Y1q#YR%MY}9TDH*c&cSqy7)9HNE>B_H2e&Nz;PtJVb +z4GQh6VsPVXhjVc_s}&2nnLlB00j_Lzz!N@GJ6~EN@|N&s*KY@bni6s?mX)Fv+R+SqyAFZ+O%*Jke0xX +zePXNd{Li;b_Y2K*OHsB5@b_mr4%@GRk9X5v(#|oW#7z1#RE-dNrPki+2wztOmF|<;Y>|UGajWUV!F_6*AlR=->qZAN2bxs;~r!qF_3(C{#lye +zF`I^AW0}!FL`6)nt420!N +zu63Zd%5Zeq$U8gK55~Txwbg8(y%nP%g}=$qmdi?MAF&6mtcub%%qSHEhj_>=N7x9` +zxHl@l*?YMiBc&i=-cwLnjp$-d)*$|SCWqIM9UDWkjKo|WpvsBQZS2RspLd>d9&bXE +z&^3B@hFB84?1Nu$z{GEmW)855(y}bIO6?^1CiOK8%hr&S%Q>-jR_N$RCD7#|~P2LSs#IJE^ezRP3PbLE7s+uPJ&J$kvXSsq& +zP%?JkA*K$^cyjA8d +zP*$z3oLcLNz&BC&i@C?cX*|NjX+ANNH(}ke?>FUYG(H`T-Q(Hnbr?J?QPTmxXi26`ez6EZcy=63h*C&TY&qDWeidm&1X%S4H +zRKTd)nc57N1GVfBA{f&pm^jyl7%1Fhq@e0O0lsU%n|6DZ6_L(Yr8ZpeZZs|+ltcX3 +zLRWP|c+?m4GOj8z7Q8C)b<%1w5zDfNz%@~%)q`vZ&P8Wl6-FQtP +z_FljGtxH`8LbW9_RN3Y=-(R#?AI%>e7k(vmL9(q|OnL7TfDP{`{$qi-9Mt9Rqe7mG((Wkic +zOM;*;qhR4vfKQ_R+uL4Xwc!JLqfK4n{5jUPcZmg8mDWcd&V^D7?c1Hy1cW;>aX}ud +z2R{we{Hkatz&@nIdSU>ljr6~m(wkU8|HvShSAPG +z*}g4Jx|>Rs% +zw+=`I;m#=>ieQSQ8dNF|?Yh_8K9hnm)$`X+m4Lu~sm;S3!xf_N)-f7z>{)(=$vsnN +z6nOJoyi0TB4?s7{3-s-N<#PJac!L6}H`pH&xs`;`d<`{4tgTex{qB?$odlm6QiM9bT{bv+y|;| +z;W2`zF-g^WaAIzJgqYDrzbA9_2@1)ub6*xq!GEyVmpcGVgf@cVO<TBu}34dP~O1yIpvvKgI$2hl;JDF6>;dEuO~8Odhy#R}oTMauxksv(e36LvWAtWGQ%o`kI;aPYC +zW9jRe@#!0?67}j?qSx?k*#cAq1xW{FmLD{(9yH#?RtKmzuQcUGk-V;jh05sH`Kwg)2}FxoN{df`=3v7!K7rfXs8H!QO37H8G|Vbh-(LmxfIvSHHh0 +zF{^eDbdZzR4U;~iYWQF$$pFuKt|H=BOXM}z%0pm`D+aS*CRO`6V4Oo;c=)B#Rmi>| +z>#%aAF!0%TAyW&Z!=9hzGd5Gu=z_Lvr-X#^v2iO9A|0u);YqAF$wzi|n5#T$E?sRhHXsK^9N6q-px!l;(3C+{)+yde}_ +z*uMUCWodYv72ZTeovA(rEvXt8QoM4S*qnh+ag@sp0d%{K-Vh!Oa+4KhPrcOfZ=#*=BFk=_>%dgyRQ4ZYX5YTTtj) +zBvHIF$=KvDotpXFa{OsoIQw0x_X6E@I9!^;-b1l+V03gNMF?2ujcD+0idB7RGgN4& +zx2*qlNgN<;SvVt#w-@1ds{P#z9=s?ItGJdJ$`veFtUcn7!B+YSG`{seeT;>pI1LOGN?MhHJ*FblFQR8t{D9QQ}g0!9>!4EgP3o) +zb3FYf297_kM9|E^{^5GQZ?B2?%cZ{EEoGb08P97UE0G35?L^I^1Ig!6dfD188XWiV +z)I%EY(aOvn;RO<_a49_fas5(HheFqL(Hq`%d5EdPjQ}4pZ<&fC4!H%2D>&^V^<4wr%D@IsM5Zf){WjqjP#D3X +z4W@9``R+3$Q@%al6C@@k#9AIwgUqRygX}x$!*>X`bvWgG@|@fhlWdG=Gxrlnz%A00 +zXhQu#`ZoRG`(b^T*2qbXfz?Q=q=}4=hNP-X=oaJl2Y9@vo6QM};!uPQ^ne*}9oj`Y_Au=+sFl*)Bb%IY?x) +z(pro_E>TK?8+}U=f`8-~?XQWf>i=RUK>7p^D!e5&k^Geo9L@lTXFaLPLx@JY67u2s +zU&8z{E7I>*x^(E>V7ikkt6!XmEK{|05B7qT)nMgnH-=lvVD8Wj%~r~-WV|NsO?kP| +zc&d>7oMS~v4c=*a2>;zdi_ycZC*v5S +zsR6~x7X)KOt%UKO3P8Ex|BU>~an2|MJaF%KyokqRAabGD;BwC +z$QE0?F26j%DRWvdj(IZm9u8oeuE_)N@d;qdjWIT%Mj-u2&(F!vo|}$h%0hOJYp|h4 +zJ!6_|4il?ev)yMg$Aw;J3&y7aHY;fCdG83_@AND)nZC8IcT>9AUk3!(=> +z$L+3|7!v@lRjvOr4A^_Xp(ByNM(f`AEw9$*O4JXQa*XydMIRzt1y +z5lf0k^aIdP=du->#%(Ru(Q*c%np)Rd@!ESi$T4taOk_cRl6WmdiZsccWAoMdtRQ`h +zO#KaTEJTK9z;=L;_z%~fjHWY@MCXEX1d=!R4<-LvVVco})=(I`yCIf%?qErR9qw&z +zbT}hyf(h+u&PK$&F36t)-5WaX(QKECLbgjNt$Qe1*zLwvX6;uGiRj*vEDMz>1La^S-$#BsL_CDiU?KQ)0N% +z8Rbw^c4kk4c8m1g#lL6N^$spSKi^RuX1`v}SCs#HpPu5d)Qa!0JT)}f|9;rxHO?H< +z{zYtQ38dep%Rb`4kRS(UW+IoQX9HDWPPc7$ymYm3KFCm5VTva75HR +zX?IF_6cPV62sq$OgBFR=dHK@RQG#dGJ*8mS8CAr%;a}*QZ)}-GZZ7qETbjG?W?QJZ +zFtOOjn$#@PmqStciaQ2X?>1oa`i7^`IB7i1YnhLNqI_Dz@6;VO0m}Sej|P2Zf~R+? +z@7+(l+WM22)Yqif+?oVUD)_<~vg^n+9zMlEeQovJawACro$u75np#@F<*Od0kk$hu +z++IfW*AG5eP?ozdFD<5U^tEKA7RC&P33qe2!0B{Z;OGeJWMF%e_}k81e4qWT*M=J< +zWZJ#o4-ZM2^haE4umwqyA13%?cm#}CrVkoU7o7qR&ePesIVzs79rVuB`wd{;NaCfT!S%eeOT3B;q)Sl32FB +z5TOa;i +z8b3P9L!6lA8+`<)GsPC+B7j}>cJi^-$qUqZ`(r`M!P|PvGHAse091^+ +z`9v=Eb4!VR)54QxYwa2W6CTq>Tk&%Oe$~({x(oJnKxkv8gw`VW5()Y +z8M3ZxkGFd)iho^EUo4~*wffD@M}GbY3yAtX1q@PTjS;yH$7idS%f6B0=|ovB;BRux1dtO3 +zzY|Pu#QuSfpDFNo(nRK9CeO-ewUrxBX*e}AJUjkuYR2q3D0{|XV}^0Bk)$#cPS33CdH}K32W|Mtvkh91-^`Gf!6ANC~V3QLiX(q&8<3#}m1%Ie_U#u!Y5_e?} +z08;e6Q!{SC4+rJs1r6xIdt0pF$16>Rfw;Ae=W`1I5!OWYT`GE~=y+K?q4a8=D=K?i +zfpJ>i27{e4REIwP`0T4S*>ImoRW*_lsSQ?O8>#xz%KOnhjd|kZU-e);qm7 +zn&N065!&9&$TnR)7X^a4% +zW%DZVe?;Cx2z_w*{?=h&D>4sj?{KV#53p?5m1v +z6LS6~MfbWse#UiM|LvECc|W%GVL2D*tom!^0YaedP9S55>Zl-8GS7kR@-#oP0(~DO +zMzWAUkX33xcG-P>lyY_0p>W?|-DpCr-zV_tt^f3S>lR-?@KNP~83de(#FFMEJ;_BI +z@2f)agGh)R}6FpG>+5SB%j&sp(O1K@7yv7Ma@y@ +z#o5z8x#pYDRK#p%r7c|=av+eVP3BR+5+T#~3H35-2c!}7L(|dh5TAr`zoe%unv$8+ +z4|tNuQu2}%f?$56)JA7Bu$@$qfdO)OH>>XU896_p77i-r;osqJCOf;T?5;Eg@0WV&vo}~;(23D+Hw~#k>XX53aGp6|w +zUSBThIUeM$LT5{r%0#qJMotbwJpi>dQPX(*EK0ZooP89tP@>cA#LGg-pS(BIaBB!daN<2=))YV>e5n0rtT8>g^21axc +zza}*mWY;!oUp*Vh6#KUoAgDuOEg&F|+a10C>}W+%G%u9OQq*~GJEpg?ap5bcea5Ee1cSIb+@!M +z?p>3&P+nNt?PvPQ`=3?QKj#2J +z#0;X#!sD+?#x%BPIQnd*X;$LGqS-krUzKdNT$a0D_s?oe)IQSF3~onj9#v!`#vn%N +z3^EJt?f>K>7o_FAzJ@G$%;^GMh+p=I7*i##k#t@C4P*^J@w&D5*O3F0B&tW({~%&2 +zsf2f88kb(sDwnn8g8E_xmup=AOX$AezQI4uZ#t1~43r5JuRa9yrII>qP*SuLw4%!J +zz4VhvX}jzrzpOePmkAJvk8+%RRZ^UPz1Cxv%{oh~n#X8PiNr@CV-o*JfT{IDiM4k( +zoAzZT&~110Q?#g?3&w{6+IOZm|Dwf7_}3v3HUX_U)O#(sa~ +z!oDAR+Z`P_quz1(n4=a)0brEwkBP|7e4VMyJI@$zuA}qJ5=$tVbVxYcg&tEYg>X&p41xs}i6$Yp)oRiR7#u9wDa*7H>- +zX}MmZ<^HFFWGfqI)4XU|Z&O}_qD{bk@yg|{0a=>@I~8 +z=3S?+U&Z$*P#h#97!yo8S~Kc6KNHJKmZqm7qZP~-ACAoJ>l;6`obT@fc|t_Lnf!3G +zvJIIkhKb<6h++)vt}|DOzR5UZmG6T5!Ai8^LgK5$gk_>~Jrybyb0cr1mRFMLzByJl +zYELAImcL8gI=a+N7U2GXo3HPe3roNt;7!9F0MH9eKS)5<)H>C{?qR@5pKvU{$@B5< +z)h)maCBnwrj7EiPlKsP~cWz|3Ml(Ah&rolxcj)O)egycdfk +zu^hO$pVz2y=^^^MF_VU+i$$vRSMUyZu#$OtfweP=c1d#*$MvrqI(S#)dDjBA!Aq)+ +zmruhafv|f+)78FK3cmF7p|e=Gcq39?edpw$>vzP#_#R<7xo}fIuW+5OwH&vb+6Rc) +zpYd)fb8l%QX~E4uHc5#@K52iXU-r4WAQ~(7hJjs}UeR!(xa`7gy0w2s3T(R~2@;Hv +z1|t^syy8|ImAyEOhSd$2pxB+N_k4) +z*AdCeIXfdL+eRipchcM2f&8`sdLP#*T9ZhZjNMiy?7?UgeB}OUI)i1F?Vy|+xQ(zn +zPrvsbdTV;&ZcOg28Mfh$Fj9e&LkDOMbZ9x-#4SJ1wp|y^Lt`2t4>3EsWX>)i+s&!& +zmwRtv!VOpQ`J?w|DDORv()XxZ#s^|>!gc--49Q@qU}FiDsE>JTQ2M~crEvCj2?5Ub +zQXxn#V(ivLXjvLE`E1^MA*`?aTqI2Eg?_gYy5l(_h*0TZe|63?P5DymVdo?u)}!gs +zgzb$lcfiuG@rz7b-V6V>?1AL=A{Omcu$#Y=a6#XyTnOXLjzZOW>wX;j5V}$6NMI(# +zQ?7=aKY|L|v|fDbGh!kyW%+cd)(Csx&E4p!;3R{s@#x9!Fo<}im73lqSgqo9&4 +zBkkzT^{ncwyHjAueZ}y!rDNqqy#gX>hdH2WG1-R>^-mn6rs>4fVdj_Ql!xOtUBhdc +zw1_PS*?#X=j5F*QWSDaZiz|+>_J(UaMCLwxDkk`Ad$N?d>`_kGQ%C;f{)8(i9HINpK#hV`Xtk2fv|`=tO(0FYCg5{OA4oIZ`_lHs_P_Yo +zrG5R=SNNrWdu_FJVIr)L?R%b|^k2+wS0#%Z|H~Whfvz$26cn*!#rrQCJ~LH1ySluR +Wz1WyJE+u>pLZqW%pkAqJAN4<3s|e5l + +literal 4959 +zcmZ9Qc|26n`^T?!hOvx&4Pz%{EZLPYvTq^E5@pRcGGvX$AW~VT?0YC8CHu}WL)I*j +zCA+d^OJw_v@Avn|@AZ4V?z!iAo%_7*bMCpH^W6J>;>=8R>1nxX0RW)a*F)YU^_YtW +zrY4=^DWIpMj{2UVE)p04)_~)Bx;9qQ2n|Z_wm$&K2wgO?prUJmq(Kl`-&hB=G~+P>c2E7|m)F7F$6%61XMsolUg0zXycp@v@GZ1K>rt9xd?C!>%*+W7 +z%C&esu?1QvJQKjm(&8q^?oTJ)%8V0?)|OjY&d?Gr6jy6+xCM5i6!*6NB4P1KRCNm^ +zm+NR*M%4c-!-n9r0lIJ!D)W+&T9oD)Dem^7SRik@V(WfPQ@fFKyaf2lH?CLvA5uka +za&warZ&7cj6r);vpGc6CZ?~=95k;2K+aF*1m@^PTnvH2@U9bunlhI3nmsfK^BZU;4=_*3}V}PoZ +zEP*COH$^QdyIwzO=Shp{b@@LAC7u=@nYJ8)oEoIduWITqMn>MScBnM|V;V8ajW%>c +z2|9_!;}u5SRyWpkQzR8giy|l$Ivq`@U%TZM4}hv^OUIk_s0z#=s!u~04W3Iv&C;FbL%51jwmUPHQ@0l~qZwrDUlHbTaRh}I7O +zg75zlU9YVkytJ~+#_*>+av3b*ZLbM`=lrm(GyKlhzDKd&-~YS-XuB{i6aEdZrmT8V +z5=&CIeIGmv+apvfRY7`h1Zf4_L_-7KYf+zDaL#{K)Hw61>q|2q>%TNiMk|sXtmY*1 +z`E77tq7vBO#3uo(t!jj^QMa-dh___m=cxM&AL^ +zdT&14OSgK$%!-|9_M)?`i4B)w7eegd!IoH)mWyyhiqc1~EPAqoCCYEgl(hFM{^Ftj +z%GS_$^uT6K)$jtUK69tc1oS-cV3H( +zyzVwJW(p>4KWuO@dx-z65M|t#j~xmYkY<&V$cV9IcL@+9-%Akb(9C^=$km21|8lq_ +za=b^e+n~SA!s?z86LD4&0RU2Vl|bwCrvOB*uG>-oaP+AaCy?IW;MZ7A&oS_=puC#x +zTSjKS2X}HZv)}oKicKX7<~q>8hy|~*HpzV*Y^DRSBNNv-=R$KtX-5a5FE!_Wj#!o0njA +z8JkG4+{e@({dOMVP51|1y`CGI?{rMiLdMQTV)8ojeNwqrgP)*5q}hq9`jG=rE*1L0 +z=0gY)xu5I$L0nYIwuM<@k7MqNbid7Ko1mz?Wtyzjo`jUhJJU|J`Jq_(fZ+l%ogp5Y +zIDI`mBjycCE3h-oAO06y%KHv_U0fWu7`0F)$u5yL6u~KnhuEC++z(})gQ{w9X}O1^ +ziig+EPJfUA4&ecpZ?0Sc06XsoNMjeO3Wcj3%MW32I2nYaNKiwF#jknm8fO-R8aEHO +zS;P_Zcdx7H>7UoVjHFijGh;WVUGy??)C=6c|6BJ?%amgTP(}HCU2Z0Y^Sx|AO%6>B +z7k8KD-1)Kga0b7Xt>)Jmz><_Svi*-IB6_0ky0@X$d%1Z$EAcD*>w~VW$*SRrQOa6E +z)cKJdzv;DO-USxsZnV8sfR>g0;TF*eXKlHEv~kBDQlVHocet}SvAsdI1E^G1doNa$er}pksd?U1pF|_rB +zSIJIEOQLI~-J9cO}P)Oz~yJ4z~jwPCIW7GR>tKG}oJGSkdoz};#7?(Sg>_x?Y_Q?4k +zZ$BO!ta2Sdt}R&N@%WDQoxFGNn8p;VW$7qF|8D7og^|0?JUW*}Y|jx!#LUqPlwg=m +zRt9aEBD1%*_tO_~T=|(R%DbCN?p_VFK+vzERN1}RWAZ6OAYYD(J}CcnVj9+as%G)o +z;NJXAE1<2%q6D=&D&c&^K7J$1uCL+uS>u|xgNGNU%c~o5r72Q`D?M*NaI@;bFQ#CT +zV0IV|1Ll4vb*8mCG70}W_>J!pbL`q(Mk#Luq5Ho-?sljN6JfW)-Tyt?3`DZ%L +z>1cfFaA%b9aDM4sjzPiuCSI52j;PmRFq03dvd{@)=@Z9{wG$dz~4@#t3rj;1m%CZ{=~k9~XcBC6v7NckqV@1WVYQ<43f3{9(XPWS>EN{EO~*-CK*bt;ZS;!OLuY +z87ft)RVyp(Cw{BC?#*W-X}?E8n+mG`{Ikbd@Mf3BkFQ_T3aIyS+g0*qIBMqV83`?o +zX*3SoyLQT=V65w9M3)n><3cpp4wMiSNQ6I0WTSfL@yq6O5RJ^;rpPEzOSf?<#OEal +z#JE8?_%;i?y7A-hXB(+R7p{hi!m)9NPT7A;G|icpHm~wS^k`I({`l+|qO9g~*i~G*9imYv^HH~-3PeB-S_xwv+Y2l=g6>lXZk|B1v+dn| +zeA>r~Z}f3>@rByy3Q&w80&#K>pvR%5geJnqq +z#YL_Lw5jl$vkg7ZRPvcNku1Nz{`lM2`2I+BH-`3Ba?R1ny-~VYe +z9l%0>oH`pOV?m#)LN)yxXMS#M>?$?Ja6PLFE);UCNl#M06nrh>lc`K1PMyM&Ka>tI +zyKVLSSwJ-z2RXNRh*UcPO%t2{i@X_0uuwJ6@h;-=Qef3g6X8cFUHPoCZIv{}R78rZ%99agCe;SpR +z2&R5q?E=vp9E`14e_L9iWfefrys(&*EXOenhi}(uR8D%;1^v32tF*i$meYY6!3~@Q +zv5OSB5c`O2eYdLw^yThU*z33iu!U)sm(UUi!Yh5@S`weCs{BaFFDP7dWAap2{nG=s +zg+-P;PwqQ+?wHvS{X^xRx~)ampA>1zW`P2@zwfa|>{ +z(Zt?9q>hUSNyY-w8WjF3)S{^{Y;7-zeNdEWXCYNlYE#WdCdLmAQQa{ib}eB{46!Vm +zo13!fMtVj@*A05r-xRqe1O+nR=OyKWG>u1mlD&rJ7WUEOHCORSf`H4G9m&D*U>eu{ +zLp6o#gU{59h79h}@mqyQxAYnwjZ3|e)+cm~c9C*PmcN-nJ13-pb9}j+aMZB3eWbuU +z(aP`J@@Js(3eo*K%?H@(M#W~b(~+qW`F;+iobQ&M*W>{=WjBNNZqtpbh4N5N(I2dG +z-RX`fI|JPp?}OI)XaR2iVs;j=E!yAobeUouDw>}0b0z1W+MTAGY0eJ{GDB$rxn+Jx +zijgtNgG}Ip-xgzR(6Yw>ce#I{RXF)m?YpDnSx1P +z-qxP|)1Pe80-2Yo{|kjzD-b|ra*a%GbQ-JEf +zY4Ef^R`Uo`;5%GzqsAjSR8OWeT$^xkT*!`awX@U|_Abd2Kni%MHCjtQr!HimpSd78 +zqrPOZv^3?zweIu9Gt!GTOD19I)$#R&XHcKG{N6t4Uzm)% +z_&ik-;lla8ao5f-XCXafQiDpVG*V0{N!aCZPn=1CN`%)rVO5b3-l1<&5Rm>dgqG6& +zi6I?9NDN#D1uh~vl;mU=49d2IlV^tnzNl6O2YpihPema^^jse;K;WdUa}|$oaghqg +z(6Awt@Duo-@b4d^62bJ31eGM@W)0Qd@X!Ndd;7ddj(j^*YY2nz}q(w%?j=RPLP@eEF|B$PQ2KtCtcE0TG0n}qx$Q0g;>#Q +zXb4R~mYm3CJ1RdzfK4TCyeNO)4km{6`QK7Rtf74G7sV*O8|HzS0B>>4yF}W2o(lp* +zM{UWrv+Ba@vnVNI88u6!KF%=Wbx&cqT*am6q30wD#F98KVc5!5oJkm|LweHam10~r +zX@~3#%zVK@yDeBv6!qOETx37pSa`UBTxI#cHI-Sl3=?)E1K4yNsZ5YEKwM8qGV1Vn +zk8qYSbHYB+UTkQmS +t;Jjx^&~6n@&egfT2m_h_UkqA5Co_+SJESY3=}2`iKwrlMS%GlG{15vgE&>1m + +diff --git a/cmake/SparkAppimageConfig.cmake b/cmake/SparkAppimageConfig.cmake +index 45f4e25..7384b47 100644 +--- a/cmake/SparkAppimageConfig.cmake ++++ b/cmake/SparkAppimageConfig.cmake +@@ -1,62 +1,99 @@ +-# export PATH=/usr/lib/x86_64-linux-gnu/qt5/bin:$PATH +-# export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH +-# export QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins:$QT_PLUGIN_PATH +-# export QML2_IMPORT_PATH=/usr/lib/x86_64-linux-gnu/qt5/qml:$QML2_IMPORT_PATH +- +-# export PATH=/usr/lib/x86_64-linux-gnu/qt5/bin:$PATH +-# ~/linuxdeployqt-continuous-x86_64.AppImage spark-store-submitter -appimage +-# cd .. +-# ~/appimagetool-x86_64.AppImage appimage/ +- +-# LINUXDEPLOYQT=/home/zinface/linuxdeployqt-continuous-x86_64.AppImage +-# APPIMAGETOOL=/home/zinface/appimagetool-x86_64.AppImage +- +-# if () +-set(APPIMAGE_OUTPUT "${CMAKE_BINARY_DIR}/appimage") +-set(APPIMAGE_ICON "${APPIMAGE_OUTPUT}/default.png") +-set(APPIMAGE_DESTKOP "${APPIMAGE_OUTPUT}/default.desktop") +-# set(LINUXDEPLOYQT) +-# set(APPIMAGETOOL) +- +-function(execute_linuxdeploy _PATH) +- execute_process(COMMAND ${LINUXDEPLOYQT} +- WORKING_DIRECTORY "${APPIMAGE_OUTPUT}" +- ) +-endfunction(execute_linuxdeploy _PATH) +- +-function(target_linuxdeploy) +- add_custom_target(linuxdeploy pwd +- BYPRODUCTS appimage +- COMMAND cp ../${PROJECT_NAME} . +- COMMAND "${LINUXDEPLOYQT}" ${PROJECT_NAME} -appimage -unsupported-allow-new-glibc -verbose=3 -no-strip|| true +- COMMAND cp ../spark-appimage.desktop default.desktop +- COMMAND cp ../spark-appimage.png default.png +- WORKING_DIRECTORY "${APPIMAGE_OUTPUT}") +-endfunction(target_linuxdeploy) ++# SparkAppimageConfig.cmake ++ ++# 1. 在使用时通过准备默认的 icon 与 SparkDesktopConfig.cmake 在生成 desktop 文件 ++ # 时进行借用 desktop 文件中的基本描述完成 spark-appimage.dekstop 文件的生成, ++ # 并在使用 add_appimage 时完成所有逻辑判断与目标的定义 ++ # add_appimage_icon ++ # add_appimage_desktop ++ # add_appimage ++ ++# 2. 在 add_appimage 中,我们判断了是否为 cmake 提供了 LINUXDEPLOYQT 宏, ++ # 并获取此工具的真实路径。并继续判断了 APPIMAGETOOL 宏与该工具的真实路径。 ++ # 然后,创建一个目录,用于即将进行的 Appimage 打包。 ++ ++ # 通过调用 target_linuxdeploy() 来完成 linuxdeploy 的目标创建 ++ # 通过调用 target_appimage() 来完成 appimage 的目标创建 ++ ++# 3. 对于 linuxdeploy 目标,大致上就是通过执行 linuxdeployqt 命令与 -appimage ++ # 参数来创建可用于 Appimage 打包的内容结构,并且使用一些参数来处理相关库的依赖。 ++ # 其次就是,将 spark-appimage.desktop 复制为 default.desktop ++ # 另一个就是 spark-appimage.png 复制为 default.png ++ ++# 4. 对于 appimage 目标,大致上就是通过执行 appimagetool 命令将准备好打包的目录 ++ # 结构进行打包为 Appimage 可执行文件,其中为了避免可能缺失的文件,重复了对 ++ # default.desktop 文件与 default.png 文件的生成。 ++ # 这是一个依赖的 copy-desktop-appimage 目标,并先行执行 ++ ++# 要求: ++ # LINUXDEPLOYQT 提供的外部参数,一般指 linuxdeployqt 程序路径 ++ # APPIMAGETOOL 提供的外部参数,一般指 appimagetool 程序路径 ++ ++option(USE_APPIMAGE_NEW_GLIBC "允许在打包过程中使用较新版本的 glibc 库" ON) ++ ++set(APPIMAGE_OUTPUT "${CMAKE_BINARY_DIR}/appimage") ++set(APPIMAGE_OUTPUT_ICON "${APPIMAGE_OUTPUT}/default.png") ++set(APPIMAGE_OUTPUT_DESTKOP "${APPIMAGE_OUTPUT}/default.desktop") ++ ++# 1. 添加一个可以用于 Appimage 使用的图标文件 ++function(add_appimage_icon _icon) ++ if(CMAKE_VERSION VERSION_LESS 3.21) ++ message("> cmake version is less than 3.21") ++ configure_file(${_icon} ${APPIMAGE_OUTPUT_ICON} COPYONLY) ++ else() ++ file(MAKE_DIRECTORY ${APPIMAGE_OUTPUT}) ++ file(COPY_FILE ${_icon} ${APPIMAGE_OUTPUT_ICON}) ++ endif(CMAKE_VERSION VERSION_LESS 3.21) ++endfunction(add_appimage_icon _icon) ++ ++# 2. 基于 SparkDesktopMacros.cmake 提供的宏来定义 desktop 内容说明 ++ # 使用与自身的 desktop.in 模板进行生成 ++function(add_appimage_desktop) ++ configure_file(cmake/spark-appimage.desktop.in.txt ++ ${APPIMAGE_OUTPUT_DESTKOP} @ONLY) ++endfunction(add_appimage_desktop) ++ ++function(target_linuxdeploy _target) ++ ++ if(USE_APPIMAGE_NEW_GLIBC) ++ message("Use New glibc") ++ add_custom_target(linuxdeploy pwd ++ BYPRODUCTS appimage ++ COMMAND "${LINUXDEPLOYQT}" $ -appimage -unsupported-allow-new-glibc -verbose=3 -no-strip || true ++ WORKING_DIRECTORY "${APPIMAGE_OUTPUT}") ++ else() ++ message("Un Use New glibc") ++ add_custom_target(linuxdeploy pwd ++ BYPRODUCTS appimage ++ COMMAND "${LINUXDEPLOYQT}" $ -appimage -verbose=3 -no-strip || true ++ WORKING_DIRECTORY "${APPIMAGE_OUTPUT}") ++ endif(USE_APPIMAGE_NEW_GLIBC) ++ ++endfunction(target_linuxdeploy _target) + + function(target_appimage) +- add_custom_target(copy-desktop-appimage +- COMMAND cp ../spark-appimage.desktop default.desktop +- COMMAND cp ../spark-appimage.png default.png +- WORKING_DIRECTORY "${APPIMAGE_OUTPUT}") + add_custom_target(appimage pwd + COMMAND ${APPIMAGETOOL} ${APPIMAGE_OUTPUT} +- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" +- DEPENDS copy-desktop-appimage) ++ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") + endfunction(target_appimage) + +-function(add_appimage) ++# 3. 添加对目标的 Appimage 构建,Appimage 在一个项目中只能构建一个目标 ++function(add_appimage_target _target) + # check linuxdeploy + if(NOT DEFINED LINUXDEPLOYQT) + message("AppImage> Not Found LINUXDEPLOYQT Variable!") + return() + endif(NOT DEFINED LINUXDEPLOYQT) +- if(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) ++ if(CMAKE_VERSION VERSION_LESS 3.19) + message("> cmake version is less than 3.19") +- message(WARNING "!Relative paths are not supported!") ++ if(CMAKE_VERSION VERSION_GREATER 3.4) ++ get_filename_component(LINUXDEPLOYQT_REAL_PATH ${LINUXDEPLOYQT} REALPATH) ++ else() ++ message("> cmake version is less than 3.4") ++ message(WARNING "!Relative paths are not supported!") ++ endif(CMAKE_VERSION VERSION_GREATER 3.4) + else() + file(REAL_PATH ${LINUXDEPLOYQT} LINUXDEPLOYQT_REAL_PATH) +- endif(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) ++ endif(CMAKE_VERSION VERSION_LESS 3.19) + message("AppImage> Found LINUXDEPLOYQT Variable: ${LINUXDEPLOYQT_REAL_PATH}") + + # check appimagetool +@@ -64,47 +101,58 @@ function(add_appimage) + message("AppImage> Not Found APPIMAGETOOL Variable!") + return() + endif(NOT DEFINED APPIMAGETOOL) +- if(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) ++ if(CMAKE_VERSION VERSION_LESS 3.19) + # execute_process(COMMAND realpath ${APPIMAGETOOL} OUTPUT_VARIABLE APPIMAGETOOL_REAL_PATH) + message("> cmake version is less than 3.19") +- message(WARNING "!Relative paths are not supported!") ++ if(CMAKE_VERSION VERSION_GREATER 3.4) ++ get_filename_component(APPIMAGETOOL_REAL_PATH ${APPIMAGETOOL} REALPATH) ++ else() ++ message("> cmake version is less than 3.4") ++ message(WARNING "!Relative paths are not supported!") ++ endif(CMAKE_VERSION VERSION_GREATER 3.4) + else() + file(REAL_PATH ${APPIMAGETOOL} APPIMAGETOOL_REAL_PATH) +- endif(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) +- message("AppImage> Found APPIMAGETOOL Variable: ${LINUXDEPLOYQT_REAL_PATH}") ++ endif(CMAKE_VERSION VERSION_LESS 3.19) ++ message("AppImage> Found APPIMAGETOOL Variable: ${APPIMAGETOOL}") + + # do add_custome_target + make_directory(${APPIMAGE_OUTPUT}) +- target_linuxdeploy() ++ target_linuxdeploy(${_target}) + target_appimage() +-endfunction(add_appimage) + +-function(add_appimage_desktop) +- configure_file(cmake/spark-appimage.desktop.in +- ${CMAKE_BINARY_DIR}/spark-appimage.desktop @ONLY) +-endfunction(add_appimage_desktop) ++ # 重设目标输出的目录 ++ set_target_properties(${_target} ++ PROPERTIES ++ RUNTIME_OUTPUT_DIRECTORY "${APPIMAGE_OUTPUT}") + +-function(add_appimage_icon _ICON_PATH) +- if(CMAKE_VERSION VERSION_LESS 3.21) +- message("> cmake version is less than 3.21") +- configure_file(${_ICON_PATH} ${CMAKE_BINARY_DIR}/spark-appimage.png COPYONLY) +- else() +- file(COPY_FILE ${_ICON_PATH} ${CMAKE_BINARY_DIR}/spark-appimage.png) +- endif(CMAKE_VERSION VERSION_LESS 3.21) +-endfunction(add_appimage_icon _ICON_PATH) ++ # 为解决在不使用 -unsupported-allow-new-glibc 参数时, ++ # 可能不会生成 AppRun 软链接的问题 ++ if(NOT USE_APPIMAGE_NEW_GLIBC) ++ set_target_properties(${_target} ++ PROPERTIES ++ RUNTIME_OUTPUT_NAME "AppRun") ++ endif(NOT USE_APPIMAGE_NEW_GLIBC) + ++endfunction(add_appimage_target _target) + + +-# 如果glic>=2.27,你就需要加上参数 -unsupported-allow-new-glibc (意思就是不再低版本发行版使用了) +-# 或 -unsupported-bundle-everything(大概的意思是尝试兼容,实际测试,到其他发行版直接用不了了,有可能是发行版的原因,还是建议用前者,虽然放弃了低版本) ++# 如果 glic>=2.27, 你就需要加上参数 -unsupported-allow-new-glibc 意思就是不再低版本发行版使用了 ++# 或 -unsupported-bundle-everything ++# 大概的意思是尝试兼容,实际测试,到其他发行版直接用不了了,有可能是发行版的原因,还是建议用前者,虽然放弃了低版本 + + # -unsupported-bundle-everything +- # 捆绑所有依赖库,包括 ld-linux.so 加载器和 glibc。这将允许构建在较新系统上的应用程序在较旧的目标系统上运行,但不建议这样做,因为它会导致捆绑包超出所需的大小(并且可能到其他发行版无法使用) ++ # 捆绑所有依赖库,包括 ld-linux.so 加载器和 glibc。 ++ # 这将允许构建在较新系统上的应用程序在较旧的目标系统上运行, ++ # 但不建议这样做,因为它会导致捆绑包超出所需的大小(并且可能到其他发行版无法使用) + # -unsupported-allow-new-glibc +- # 允许 linuxdeployqt 在比仍受支持的最旧 Ubuntu LTS 版本更新的发行版上运行。这将导致 AppImage无法在所有仍受支持的发行版上运行,既不推荐也不测试或支持 ++ # 允许 linuxdeployqt 在比仍受支持的最旧 Ubuntu LTS 版本更新的发行版上运行。 ++ # 这将导致 AppImage无法在所有仍受支持的发行版上运行,既不推荐也不测试或支持 + +-# ./linuxdeployqt-7-x86_64.AppImage 程序目录/程序 -appimage -unsupported-allow-new-glibc +-# ./linuxdeployqt-7-x86_64.AppImage 程序目录/程序 -appimage -unsupported-bundle-everything ++# 对 linuxdeployqt 的使用 ++# ./linuxdeployqt-7-x86_64.AppImage ++ # 程序目录/程序 -appimage -unsupported-allow-new-glibc ++# ./linuxdeployqt-7-x86_64.AppImage ++ # 程序目录/程序 -appimage -unsupported-bundle-everything + + + +@@ -113,20 +161,32 @@ endfunction(add_appimage_icon _ICON_PATH) + # include(cmake/SparkAppimageConfig.cmake) # 导入来自 Spark 构建的 Appimage 构建 + # add_appimage_icon(assets/spark.png) # 添加到 Appimage 中的默认的图标 + # add_appimage_desktop() # 添加到 Appimage 中的默认desktop(使用来自 Spark 构建的 Desktop 构建中配置的信息(必须要求 spark-desktop)) +-# add_appimage() # 应用对 Appimage 的构建 ++# add_appimage_target(${PROJECT_NAME}) # 添加到 Appimage 中的默认目标,应用对 Appimage 的构建 + +-# 2. 在 Makefile 进行构建目标构建 Appimage +-# Appimage 的构建流 -- ++# 2. 在 Makefile 进行构建目标构建 Appimage 的构建流 -- + # 在 Makefile 进行构建目标构建 Appimage (要求提供工具的绝对路径,然后可依次进行linuxdeployqt, genrate-appimage) + # 来自于 https://github.com/probonopd/linuxdeployqt 的 linuxdeployqt + # 来自于 https://github.com/AppImage/AppImageKit 的 appimagetool +-# LINUXDEPLOYQT := "/home/zinface/Downloads/linuxdeployqt-continuous-x86_64.AppImage" +-# APPIMAGETOOL := "/home/zinface/Downloads/appimagetool-x86_64.AppImage" ++# 来自于 https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git 托管存储的工具 ++ ++# 或指定你所想存放克隆项目的位置 ++# BUNDLE_LINUXDEPLOYQT := $(shell pwd)/build/bundle-linuxdeployqt ++ ++# download-bundle-linuxdeploytools: ++# -git clone https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git $(BUNDLE_LINUXDEPLOYQT) + +-# linuxdeploy: all ++# LINUXDEPLOYQT := "$(BUNDLE_LINUXDEPLOYQT)/linuxdeployqt-continuous-x86_64.AppImage" ++# APPIMAGETOOL := "$(BUNDLE_LINUXDEPLOYQT)/appimagetool-x86_64.AppImage" ++ ++# linuxdeploy: release download-bundle-linuxdeploytools + # cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL) + # cd build && make linuxdeploy + + # genrate-appimage: + # cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL) + # cd build && make appimage ++ ++ ++ ++# NOTE: ++# 如果使用的库不存在于系统路径,则需要配置 export LD_LIBRARY_PATH=<路径> 以便 linuxdeployqt 可搜索到库的位置 +diff --git a/cmake/DebPackageConfig.cmake b/cmake/SparkDebPackageConfig.cmake +similarity index 90% +rename from cmake/DebPackageConfig.cmake +rename to cmake/SparkDebPackageConfig.cmake +index d88fd51..7ad5b33 100644 +--- a/cmake/DebPackageConfig.cmake ++++ b/cmake/SparkDebPackageConfig.cmake +@@ -1,7 +1,7 @@ + cmake_minimum_required(VERSION 3.0.0) + + # function(add_deb_package PACKAGE_NAME PACKAGE_VERSION PACKAGE_MAINTAINER PACKAGE_EMAIL PACKAGE_SHORT_DESCRIPTION PACKAGE_LONG_DESCRIPTION) +- ++ + # endfunction(add_deb_package PACKAGE_NAME PACKAGE_VERSION PACKAGE_MAINTAINER PACKAGE_EMAIL PACKAGE_SHORT_DESCRIPTION PACKAGE_LONG_DESCRIPTION) + + # if(add_deb_package VALUE) set(Package ${VALUE} PARENT_SCOPE) endif(add_deb_package VALUE) +@@ -119,7 +119,7 @@ function(set_package_vars _IN_KEY _IN_VAL) + else() + set(CPACK_DEBIAN_PACKAGE_VERSION "${_IN_VAL}" PARENT_SCOPE) + endif(_IN_VAL STREQUAL "auto") +- ++ + message("--> 软件版本: ${_IN_VAL}") + endif(_Version EQUAL "0") + +@@ -131,7 +131,7 @@ function(set_package_vars _IN_KEY _IN_VAL) + + find_str("${_IN_KEY}" "Architecture" _Architecture) + if(_Architecture EQUAL "0") +- set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE) ++ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE) + if(_IN_VAL STREQUAL "auto") + execute_process( + COMMAND dpkg --print-architecture +@@ -142,7 +142,7 @@ function(set_package_vars _IN_KEY _IN_VAL) + endif(_IN_VAL STREQUAL "auto") + message("--> 软件架构: ${_IN_VAL}") + endif(_Architecture EQUAL "0") +- ++ + find_str("${_IN_KEY}" "Priority" _Priority) + if(_Priority EQUAL "0") + set(CPACK_DEBIAN_PACKAGE_PRIORITY "${_IN_VAL}" PARENT_SCOPE) +@@ -173,6 +173,12 @@ function(set_package_vars _IN_KEY _IN_VAL) + message("--> 软件建议: ${_IN_VAL}") + endif(_Recommends EQUAL "0") + ++ find_str("${_IN_KEY}" "Conflicts" _Conflicts) ++ if(_Conflicts EQUAL "0") ++ set(CPACK_DEBIAN_PACKAGE_CONFLICTS "${_IN_VAL}" PARENT_SCOPE) ++ message("--> 软件冲突: ${_IN_VAL}") ++ endif(_Conflicts EQUAL "0") ++ + endfunction(set_package_vars _IN_KEY _IN_VAL) + + # 定义一个自定义(add_package_descript)函数 +@@ -188,7 +194,7 @@ function(add_package_descript IN_DES) + message(FATAL_ERROR "!! Not Found Path: ${PACKAGE_DES_PATH}") + return() + endif(EXISTS ${IN_DES}) +- ++ + file(READ ${PACKAGE_DES_PATH} DES_CONTENT) + trim_str("${DES_CONTENT}" DES_CONTENT) + +@@ -238,7 +244,12 @@ function(add_package_descript IN_DES) + set(PREV_DES_LINE "") + while(NOT PREV_DES_LINE STREQUAL DES_LINE) + if(NOT PREV_DES_LINE STREQUAL "") +- set(Descrition "${Descrition}\n${DES_LINE}") ++ if ("${CMAKE_VERSION}" VERSION_LESS "3.15") ++ set(Descrition "${Descrition}\n${DES_LINE}") ++ else() ++ string(STRIP "${DES_LINE}" STRIP_DES_LINE) ++ set(Descrition "${Descrition}\n${STRIP_DES_LINE}") ++ endif("${CMAKE_VERSION}" VERSION_LESS "3.15") + endif(NOT PREV_DES_LINE STREQUAL "") + set(PREV_DES_LINE "${DES_LINE}") + sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT) +@@ -262,7 +273,7 @@ function(add_package_descript IN_DES) + string(TIMESTAMP BUILD_TIME "%Y%m%d") + set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_DEBIAN_PACKAGE_VERSION}-${BUILD_TIME}") + endif("${CalVer}" STREQUAL "true") +- ++ + + + ##################### deb file name ##################### +@@ -270,11 +281,22 @@ function(add_package_descript IN_DES) + set(_Version "${CPACK_DEBIAN_PACKAGE_VERSION}") + set(_Architecture "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + +- set(_DebFileName ++ set(_DebFileName + "${_Package}_${_Version}_${_Architecture}${PACKAGE_SUFFIX}.deb" + ) + set(CPACK_DEBIAN_FILE_NAME ${_DebFileName}) + ++ # 标识: spark-deb-package ++ if(NOT "${PACKAGE_SUFFIX}" STREQUAL "") ++ # eg: remove '_' of '_Debian' ++ string(SUBSTRING "${PACKAGE_SUFFIX}" 1 -1 DISTRIBUTION) ++ if ("${CMAKE_VERSION}" VERSION_LESS "3.15") ++ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${Descrition}\n .\n Build for ${DISTRIBUTION} through spark-deb-build.") ++ else() ++ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${Descrition} "\n.\nBuild for ${DISTRIBUTION} through spark-deb-build.") ++ endif("${CMAKE_VERSION}" VERSION_LESS "3.15") ++ ++ endif(NOT "${PACKAGE_SUFFIX}" STREQUAL "") + + # set(CPACK_DEBIAN_PACKAGE_NAME "${Package}") + # set(CPACK_DEBIAN_PACKAGE_VERSION "${Version}") +@@ -311,7 +333,7 @@ endfunction(add_package_descript IN_DES) + # CPACK_DEBIAN_FILE_NAME - n + # CPACK_DEBIAN_PACKAGE_NAME - y + # CPACK_DEBIAN_PACKAGE_VERSION - y +-# CPACK_DEBIAN_PACKAGE_ARCHITECTURE - y(auto) ++# CPACK_DEBIAN_PACKAGE_ARCHITECTURE - y(auto) -> dpkg --print-architecture + # CPACK_DEBIAN_PACKAGE_DEPENDS - y + # CPACK_DEBIAN_PACKAGE_PRIORITY - y + # CPACK_DEBIAN_PACKAGE_MAINTAINER - y +@@ -324,4 +346,5 @@ endfunction(add_package_descript IN_DES) + # set(ARCHITECTURE "arm64") + # endif() + ++ + # string(TIMESTAMP BUILD_TIME "%Y%m%d") +diff --git a/cmake/SparkDebianChangelogVersion.cmake b/cmake/SparkDebianChangelogVersion.cmake +index ee2f339..e439d37 100644 +--- a/cmake/SparkDebianChangelogVersion.cmake ++++ b/cmake/SparkDebianChangelogVersion.cmake +@@ -43,13 +43,13 @@ macro(spark_debian_changelog_override_version _CHANGELOG_FILE_PATH) + file(READ ${CHANGELOG_FILE_PATH} CHANGELOG_CONTENT LIMIT 30) + # fix: spark-store (4.2.3~test1) 已经超过 20 字符位,所以使用 30 进行保守计算 + +- string(FIND ${CHANGELOG_CONTENT} "(" V_PRE) # +1 to V_BEGIN +- string(FIND ${CHANGELOG_CONTENT} ")" V_END) ++ string(FIND "${CHANGELOG_CONTENT}" "(" V_PRE) # +1 to V_BEGIN ++ string(FIND "${CHANGELOG_CONTENT}" ")" V_END) + + math(EXPR V_BEGIN "${V_PRE}+1") + math(EXPR V_LENGTH "${V_END}-${V_BEGIN}") + +- string(SUBSTRING ${CHANGELOG_CONTENT} ${V_BEGIN} ${V_LENGTH} V) ++ string(SUBSTRING "${CHANGELOG_CONTENT}" ${V_BEGIN} ${V_LENGTH} V) + + message("> V = ${CHANGELOG_CONTENT}") + message("> V = [${V}]") +diff --git a/cmake/SparkDesktopMacros.cmake b/cmake/SparkDesktopMacros.cmake +index 223ac6b..bea9da8 100644 +--- a/cmake/SparkDesktopMacros.cmake ++++ b/cmake/SparkDesktopMacros.cmake +@@ -1,16 +1,19 @@ ++# SparkDesktopMacros.cmake + +-macro(spark_desktop_macros _APP_NAME _APP_NAME_ZH_CN _APP_COMMENT _APP_TYPE _APP_EXECUTE_PATH _APP_EXECUTE_ICON_PATH _APP_CATEGORIES) +- set(APP_NAME ${_APP_NAME}) +- set(APP_NAME_ZH_CN ${_APP_NAME_ZH_CN}) +- set(APP_COMMENT ${_APP_COMMENT}) +- set(APP_TYPE ${_APP_TYPE}) +- set(APP_EXECUTE_PATH ${_APP_EXECUTE_PATH}) +- set(APP_EXECUTE_ICON_PATH ${_APP_EXECUTE_ICON_PATH}) +- set(APP_CATEGORIES ${_APP_CATEGORIES}) +- configure_file(cmake/spark-desktop.desktop.in +- ${CMAKE_BINARY_DIR}/${_APP_NAME}.desktop ++macro(spark_desktop_macros) ++ set(APP_NAME ${ARGV0}) ++ set(APP_NAME_ZH_CN ${ARGV1}) ++ set(APP_COMMENT ${ARGV2}) ++ set(APP_TYPE ${ARGV3}) ++ set(APP_EXECUTE_PATH ${ARGV4}) ++ set(APP_EXECUTE_ICON_PATH ${ARGV5}) ++ set(APP_CATEGORIES ${ARGV6}) ++ set(APP_MIME_TYPE ${ARGV7}) ++ configure_file(cmake/spark-desktop.desktop.in.txt ++ ${CMAKE_BINARY_DIR}/${ARGV0}.desktop + ) +-endmacro(spark_desktop_macros _APP_NAME _APP_NAME_ZH_CN _APP_COMMENT _APP_TYPE _APP_EXECUTE_PATH _APP_EXECUTE_ICON_PATH _APP_CATEGORIES) ++ set(SPARK_DESKTOP_FILE ${CMAKE_BINARY_DIR}/${ARGV0}.desktop) ++endmacro(spark_desktop_macros) + + # include(cmake/SparkDesktopMacros.cmake) + # 内容默认应用名称: Name= 应与项目名称相同 +@@ -21,15 +24,27 @@ endmacro(spark_desktop_macros _APP_NAME _APP_NAME_ZH_CN _APP_COMMENT _APP_TYPE _ + # 应用类型: Type= + # 执行程序: Exec= + # 图标路径: Icon= +- # 应用分类: Category= ++ # 应用分类: Categories= ++ # MIME类型: MimeType= + # ) + ++# TODO 安装位置:INSTALL(将自动实现 install 文件,如 /usr/share/applications) ++ ++# install(FILES ${APP_NAME}.desktop ++# DESTINATION /usr/share/applications ++# ) ++ # 或者 ++# install(FILES ${SPARK_DESKTOP_FILE} ++# DESTINATION /usr/share/applications ++# ) ++ ++# 基于 configure_file 填充内容配置 + # configure_file( + # [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS | + # FILE_PERMISSIONS ...] + # [COPYONLY] [ESCAPE_QUOTES] [@ONLY] + # [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) + +-# install(FILES ${APP_NAME}.desktop ++# install(FILES ${SPARK_DESKTOP_FILE}.desktop + # DESTINATION /usr/share/applications +-# ) +\ No newline at end of file ++# ) +diff --git a/cmake/SparkEnvConfig.cmake b/cmake/SparkEnvConfig.cmake +index 797faf4..f9b4d55 100644 +--- a/cmake/SparkEnvConfig.cmake ++++ b/cmake/SparkEnvConfig.cmake +@@ -5,4 +5,20 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTOUIC ON) + set(CMAKE_AUTORCC ON) +-# set(CMAKE_BUILD_TYPE "Debug") +\ No newline at end of file ++# set(CMAKE_BUILD_TYPE "Debug") ++ ++option(SPARK_DEBUG_MESSAGE "CMake Spark Module Debug Message." OFF) ++set(SPAKK_DEBUG_LOGFILE "${CMAKE_BINARY_DIR}/spark_debug.log" CACHE STRING "Spark Build Debug logfile." FORCE) ++file(WRITE ${SPAKK_DEBUG_LOGFILE}) ++ ++macro(spark_debug_message) ++ if(SPARK_DEBUG_MESSAGE) ++ set(SPARK_ONECE_LOG ${ARGN}) ++ if(NOT "${SPARK_ONECE_LOG}" STREQUAL "") ++ message("[SPARK_MESSAGE]: " ${SPARK_ONECE_LOG}) ++ endif(NOT "${SPARK_ONECE_LOG}" STREQUAL "") ++ file(APPEND ${SPAKK_DEBUG_LOGFILE} ${SPARK_ONECE_LOG} "\n") ++ unset(SPARK_ONECE_LOG) ++ endif(SPARK_DEBUG_MESSAGE) ++endmacro(spark_debug_message) ++ +diff --git a/cmake/SparkFindDtkConfig.cmake b/cmake/SparkFindDtkConfig.cmake +index d1b2dfc..278d0d1 100644 +--- a/cmake/SparkFindDtkConfig.cmake ++++ b/cmake/SparkFindDtkConfig.cmake +@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.5.1) + find_package(Dtk COMPONENTS Core Widget Gui) + + function(target_link_dtk NAME) +- target_link_libraries(${NAME} ++ target_link_libraries(${NAME} + ${DtkCore_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DtkGui_LIBRARIES}) +diff --git a/cmake/SparkFindQt5Config.cmake b/cmake/SparkFindQt5Config.cmake +index 0300b3d..cb095b6 100644 +--- a/cmake/SparkFindQt5Config.cmake ++++ b/cmake/SparkFindQt5Config.cmake +@@ -1,6 +1,8 @@ + cmake_minimum_required(VERSION 3.5.1) + +-find_package(Qt5 COMPONENTS Core Widgets Network Concurrent WebEngineWidgets REQUIRED) ++set(SPARK_FIND_QT5 TRUE) ++ ++find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED) + + # function(target_link_qt5 NAME) + # target_link_libraries(${NAME} +@@ -22,10 +24,7 @@ macro(spark_add_link_qt5 _IN_NAME) + endmacro(spark_add_link_qt5 _IN_NAME) + + # 使用 spark_add_link_qt5 生成 target_link_qt5_ 的宏 +-spark_add_link_qt5(Concurrent Qt5::Concurrent) +-spark_add_link_qt5(Sql Qt5::Sql) +-spark_add_link_qt5(WebEngineWidgets Qt5::WebEngineWidgets) +-spark_add_link_qt5(WebSockets Qt5::WebSockets) ++# spark_add_link_qt5(Concurrent Qt5::Concurrent) + + # 高级自定义 + # spark_add_links_qt5 +@@ -47,7 +46,7 @@ macro(spark_add_links_qt5) + + string(TOLOWER "${qt5_item}" qt5_lower_item) + spark_add_link_qt5(${qt5_lower_item} Qt5::${qt5_item}) +- message("add_target_link_qt5_${qt5_item} or add_target_link_qt5_${qt5_lower_item}") ++ spark_debug_message("add_target_link_qt5_${qt5_item} or add_target_link_qt5_${qt5_lower_item}") + endforeach(qt5_item IN LISTS qt5_items) + endmacro(spark_add_links_qt5) + +@@ -151,4 +150,4 @@ spark_add_links_qt5( + # XkbCommonSupport + # Xml + # XmlPatterns +-) +\ No newline at end of file ++) +diff --git a/cmake/SparkFindQt6Config.cmake b/cmake/SparkFindQt6Config.cmake +index dfd8917..2c9d8cc 100644 +--- a/cmake/SparkFindQt6Config.cmake ++++ b/cmake/SparkFindQt6Config.cmake +@@ -1,6 +1,8 @@ + cmake_minimum_required(VERSION 3.5.1) + +-find_package(Qt6 COMPONENTS Core Widgets Network Concurrent) ++set(SPARK_FIND_QT6 TRUE) ++ ++find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED) + + # function(target_link_qt6 NAME) + # target_link_libraries(${NAME} +@@ -14,7 +16,7 @@ spark_add_link(qt6 Qt6::Core Qt6::Widgets Qt6::Network) + + + # spark_add_link_qt6 +-# 自定义宏 target_link_qt6 以扩展 target_link_qt6_ 结构 ++# 自定义宏 spark_add_link_qt6 以扩展 target_link_qt6_ 结构 + # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 名称 + # 同等于 spark_add_link(qt_ ${ARGN}) + macro(spark_add_link_qt6 _IN_NAME) +@@ -22,3 +24,107 @@ macro(spark_add_link_qt6 _IN_NAME) + endmacro(spark_add_link_qt6 _IN_NAME) + + # 使用 spark_add_link_qt6 生成 target_link_qt6_ 的宏 ++# spark_add_link_qt5(Concurrent Qt6::Concurrent) ++ ++# 高级自定义 ++# spark_add_links_qt6 ++# 自定义宏 spark_add_links_qt6 以扩展 spark_add_link_qt6 宏配置组 ++ # 特点: 任意长度参数 ++ # qt6_item: 为进行遍历后的单项,类似于 python3 中的 (for item in items:) ++ # 例如: qt6_item 为 Core: ++ # spark_add_link_qt6(${qt6_item} Qt6::${qt6_item}) ++ # 展开为 spark_add_link_qt6(Core Qt6::Core) ++ # 展开为 spark_add_link(qt6_Core Qt6::Core) ++ # 展开为 spark_add_link(qt6_Core Qt6::Core) ++ # 特性: 增加 qt6_Core 转 qt6_core ++ # string(TOLOWER ) ++macro(spark_add_links_qt6) ++ set(qt6_items ${ARGN}) ++ foreach(qt6_item IN LISTS qt6_items) ++ find_package(Qt6${qt6_item}) ++ spark_add_link_qt6(${qt6_item} Qt6::${qt6_item}) ++ ++ string(TOLOWER "${qt6_item}" qt6_lower_item) ++ spark_add_link_qt6(${qt6_lower_item} Qt6::${qt6_item}) ++ spark_debug_message("add_target_link_qt6_${qt6_item} or add_target_link_qt6_${qt6_lower_item}") ++ endforeach(qt6_item IN LISTS qt6_items) ++endmacro(spark_add_links_qt6) ++ ++# 找出所有 Qt6 模板 ++# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt6@Qt6@;' | grep ^Qt6 ++ ++# 掐头去尾,洗一次 ++# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 | sed 's@^Qt5@@; s@Config.cmake$@@; /^\s*$/d' ++ ++# 排序 ++# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 | sed 's@^Qt5@@; s@Config.cmake$@@; /^\s*$/d' | sort | pr -t -3 ++# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt6@Qt6@;' | grep ^Qt6 | sed 's@^Qt6@@; s@Config.cmake$@@; /^\s*$/d' | sort | pr -t -3 ++ ++spark_add_links_qt6( ++ # BuildInternals ++ # BuildInternals/StandaloneTests/Qt5CompatTests ++ # BuildInternals/StandaloneTests/QtBaseTests ++ # Concurrent ++ # Core ++ # Core5Compat ++ # CoreTools ++ # DBus ++ # DBusTools ++ # DeviceDiscoverySupportPrivate ++ # EglFSDeviceIntegrationPrivate ++ # EglFsKmsGbmSupportPrivate ++ # EglFsKmsSupportPrivate ++ # FbSupportPrivate ++ # Gui ++ # GuiTools ++ # HostInfo ++ # InputSupportPrivate ++ # KmsSupportPrivate ++ # Network ++ # OpenGL ++ # OpenGLWidgets ++ # PrintSupport ++ # QComposePlatformInputContextPlugin ++ # QCupsPrinterSupportPlugin ++ # QEglFSEmulatorIntegrationPlugin ++ # QEglFSIntegrationPlugin ++ # QEglFSKmsEglDeviceIntegrationPlugin ++ # QEglFSKmsGbmIntegrationPlugin ++ # QEglFSX11IntegrationPlugin ++ # QEvdevKeyboardPlugin ++ # QEvdevMousePlugin ++ # QEvdevTabletPlugin ++ # QEvdevTouchScreenPlugin ++ # QGifPlugin ++ # QGtk3ThemePlugin ++ # QIBaseDriverPlugin ++ # QIbusPlatformInputContextPlugin ++ # QICOPlugin ++ # QJpegPlugin ++ # QLibInputPlugin ++ # QLinuxFbIntegrationPlugin ++ # QMinimalEglIntegrationPlugin ++ # QMinimalIntegrationPlugin ++ # QMYSQLDriverPlugin ++ # QNetworkManagerNetworkInformationPlugin ++ # QODBCDriverPlugin ++ # QOffscreenIntegrationPlugin ++ # QPSQLDriverPlugin ++ # QSQLiteDriverPlugin ++ # QTlsBackendCertOnlyPlugin ++ # QTlsBackendOpenSSLPlugin ++ # QTsLibPlugin ++ # QTuioTouchPlugin ++ # QVkKhrDisplayIntegrationPlugin ++ # QVncIntegrationPlugin ++ # QXcbEglIntegrationPlugin ++ # QXcbGlxIntegrationPlugin ++ # QXcbIntegrationPlugin ++ # QXdgDesktopPortalThemePlugin ++ # Sql ++ # Test ++ # Widgets ++ # WidgetsTools ++ # XcbQpaPrivate ++ # Xml ++) +diff --git a/cmake/SparkMacrosConfig.cmake b/cmake/SparkMacrosConfig.cmake +index 67d84e1..fd515be 100644 +--- a/cmake/SparkMacrosConfig.cmake ++++ b/cmake/SparkMacrosConfig.cmake +@@ -2,20 +2,62 @@ cmake_minimum_required(VERSION 3.5.1) + + # 定义一些 macro 用于自动生成构建结构 + ++# spark_aux_source_directory outvar invar [skip] ++# 获取目录下的所有源代码 ++macro(spark_aux_source_directory OUTVAR INVAR) ++ # iv: internal_variable ++ set(iv_args ${ARGN}) ++ list(LENGTH iv_args iv_arglen) ++ ++ file(GLOB iv_SOURCE_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${INVAR}/*.c ${INVAR}/*.cpp) ++ file(GLOB iv_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${INVAR}/*.h ${INVAR}/*.hpp) ++ file(GLOB iv_QT_UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${INVAR}/*.ui ${INVAR}/*.qrc) ++ ++ if(iv_arglen EQUAL 1) ++ list(APPEND ${OUTVAR} ${iv_SOURCE_LIST} ${iv_HEADER_LIST} ${iv_QT_UI_LIST}) ++ else() ++ set(${OUTVAR} ${iv_SOURCE_LIST} ${iv_HEADER_LIST} ${iv_QT_UI_LIST}) ++ endif(iv_arglen EQUAL 1) ++ ++ unset(iv_args) ++ unset(iv_arglen) ++ unset(iv_SOURCE_LIST) ++ unset(iv_HEADER_LIST) ++ unset(iv_QT_UI_LIST) ++ ++endmacro(spark_aux_source_directory OUTVAR INVAR) ++ ++# spark_aux_source_directories outvar invar [...] ++# 获取目录列表下的所有源代码 ++ # spark_aux_source_directory 的扩展,支持多个 invar 与追加参数 ++macro(spark_aux_source_directories OUTVAR INVAR) ++ set(iv_aux_directories ${ARGN}) ++ ++ spark_aux_source_directory(${OUTVAR} ${INVAR}) ++ ++ foreach(iv_directory IN LISTS iv_aux_directories) ++ spark_aux_source_directory(${OUTVAR} ${iv_directory} SKIP) ++ endforeach(iv_directory IN LISTS iv_aux_directories) ++ ++ unset(iv_aux_directories) ++ ++endmacro(spark_aux_source_directories OUTVAR INVAR) ++ ++ + # spark_add_library [files]... + # 构建一个库,基于指定的源文件 + # 并根据库名生成 target_link_ 函数 + macro(spark_add_library _lib_name) +- message("================ ${_lib_name} Library ================") ++ spark_debug_message("================ ${_lib_name} Library ================") + add_library(${_lib_name} ${ARGN}) + + set(SRCS ${ARGN}) + foreach(item IN LISTS SRCS) +- message(" -> ${item}") ++ spark_debug_message(" -> ${item}") + endforeach(item IN LISTS SRCS) + + function(target_link_${_lib_name} TARGET) +- message("${_lib_name}") ++ spark_debug_message("${_lib_name}") + target_link_libraries(${TARGET} ${_lib_name}) + endfunction(target_link_${_lib_name} TARGET) + +@@ -26,59 +68,271 @@ endmacro(spark_add_library _lib_name) + # 并根据库名生成 target_link_ 函数 + # 函数内增加以 头文件搜索路径 + macro(spark_add_library_path _lib_name _lib_path) +- aux_source_directory(${_lib_path} ${_lib_name}_SOURCES) + +- message("================ spark_add_library_path: ${_lib_name} ================") +- file(GLOB UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_lib_path}/*.ui) +- add_library(${_lib_name} ${${_lib_name}_SOURCES} ${UI_LIST}) +- foreach(item IN LISTS ${_lib_name}_SOURCES) +- message(" -> ${item}") +- endforeach(item IN LISTS ${_lib_name}_SOURCES) ++ # 0. 建立初始变量体系 ++ set(${_lib_name}_TYPE) ++ set(${_lib_name}_TYPE_MESSAGE "STATIC(Default)") ++ set(${_lib_name}_ARGN ${ARGN}) ++ ++ # 1. 判断 _lib_path 是否是 SHARED 或 STATIC ++ if(${_lib_path} STREQUAL SHARED OR ${_lib_path} STREQUAL STATIC) ++ set(${_lib_name}_TYPE ${_lib_path}) ++ set(${_lib_name}_TYPE_MESSAGE ${${_lib_name}_TYPE}) ++ ++ if(${ARGC} LESS 3) ++ message(FATAL_ERROR "Missing parameter, library path not specified.") ++ endif(${ARGC} LESS 3) ++ else() ++ # 如没有则将 _lib_path 加入到 ARGN ++ list(APPEND ${_lib_name}_ARGN ${_lib_path}) ++ endif(${_lib_path} STREQUAL SHARED OR ${_lib_path} STREQUAL STATIC) ++ ++ # 1. 处理由 spark_add_library_realpaths 构建转本构建时的清洗机制 ++ spark_debug_message("> Building: ${_lib_name}, type: ${${_lib_name}_TYPE_MESSAGE}") ++ set(${_lib_name}_ARGN_REF ${${_lib_name}_ARGN}) ++ unset(${_lib_name}_ARGN) ++ foreach(_old IN LISTS ${_lib_name}_ARGN_REF) ++ set(_new ${_old}) ++ string(FIND "${_old}" "+" _plus_index) ++ if(${_plus_index} GREATER 0) ++ string(SUBSTRING "${_old}" 0 ${_plus_index} _new) ++ spark_debug_message(" [CONVERT] ${_new} <- ${_old}") ++ endif(${_plus_index} GREATER 0) ++ list(APPEND ${_lib_name}_ARGN ${_new}) ++ endforeach(_old IN LISTS ${_lib_name}_ARGN_REF) ++ ++ ++ # 2.目标参数项分析出子项 ++ # 拆分出源代码、路径、未知项等 ++ set(${_lib_name}_ARGN_SOURCES) ++ set(${_lib_name}_ARGN_APPEND_PATHS) ++ set(${_lib_name}_ARGN_UNKNOW) ++ foreach(item IN LISTS ${_lib_name}_ARGN) ++ spark_debug_message(" [ARGN] check:" ${item}) ++ if(NOT EXISTS ${item}) ++ set(item ${CMAKE_CURRENT_LIST_DIR}/${item}) ++ endif() ++ if(EXISTS ${item}) ++ # spark_debug_message(" exists: true") ++ file(REAL_PATH ${item} ${_lib_name}_ARGN_item) ++ if(IS_DIRECTORY ${${_lib_name}_ARGN_item}) ++ list(APPEND ${_lib_name}_ARGN_APPEND_PATHS ${item}) ++ else() ++ list(APPEND ${_lib_name}_ARGN_SOURCES ${item}) ++ endif(IS_DIRECTORY ${${_lib_name}_ARGN_item}) ++ else() ++ list(APPEND ${_lib_name}_ARGN_UNKNOW ${item}) ++ spark_debug_message(" exists: false") ++ endif() ++ endforeach() ++ ++ list(LENGTH ${_lib_name}_ARGN_SOURCES ${_lib_name}_ARGN_SOURCES_LENGTH) ++ list(LENGTH ${_lib_name}_ARGN_APPEND_PATHS ${_lib_name}_ARGN_APPEND_PATHS_LENGTH) ++ list(LENGTH ${_lib_name}_ARGN_UNKNOW ${_lib_name}_ARGN_UNKNOW_LENGTH) ++ spark_debug_message(" result: files(${${_lib_name}_ARGN_SOURCES_LENGTH}), paths(${${_lib_name}_ARGN_APPEND_PATHS_LENGTH}), unknow(${${_lib_name}_ARGN_UNKNOW_LENGTH})" ${item}) ++ ++ # 3. 获取所以源代码为 any_files ++ spark_debug_message(" files:") ++ set(any_files ${${_lib_name}_ARGN_SOURCES}) ++ foreach(item IN LISTS ${_lib_name}_ARGN_APPEND_PATHS) ++ spark_aux_source_directory(item_files ${item}) ++ list(APPEND any_files ${item_files}) ++ foreach(item_file IN LISTS item_files) ++ spark_debug_message(" ${item_file}") ++ endforeach(item_file IN LISTS item_files) ++ endforeach(item IN LISTS ${_lib_name}_ARGN_APPEND_PATHS) ++ ++ # 4. 构建目标库 ++ add_library(${_lib_name} ${${_lib_name}_TYPE} ++ ${${_lib_name}_ARGN_SOURCES} ++ ${any_files}) ++ ++ # 5. 建立引用点 ++ # target_link_<_lib_name> 函数 ++ # target_include_<_lib_name> 函数 ++ ++ # target_<_lib_name>_include 函数 ++ # target_<_lib_name>_link 函数 + ++ function(target_${_lib_name}_include _include) ++ spark_debug_message("添加引用: ${_lib_name} <- ${_include} ${${_lib_name}_INCLUDE_ARGN}") ++ target_include_directories(${_lib_name} PRIVATE ${_include}) ++ endfunction(target_${_lib_name}_include _include) ++ ++ function(target_${_lib_name}_link _library) ++ spark_debug_message("添加链接: ${_lib_name} <- ${_library} ${${_lib_name}_LINK_ARGN}") ++ target_link_libraries(${_lib_name} ${_library}) ++ endfunction(target_${_lib_name}_link _library) ++ + function(target_link_${_lib_name} TARGET) +- # message("target_link_${_lib_name}") +- message(" -> (include): ${_lib_path}") +- target_include_directories(${TARGET} PUBLIC "${_lib_path}") ++ spark_debug_message("链接引用: ${TARGET} <- ${_lib_name}") ++ target_include_directories(${TARGET} PRIVATE ++ "${${_lib_name}_SOURCE_PATH}" ${${_lib_name}_ARGN_APPEND_PATHS}) + target_link_libraries(${TARGET} ${_lib_name}) + endfunction(target_link_${_lib_name} TARGET) + + function(target_include_${_lib_name} TARGET) +- # message("target_link_${_lib_name}") +- message(" -> (include): ${_lib_path}") +- target_include_directories(${TARGET} PUBLIC "${_lib_path}") +- # target_link_libraries(${TARGET} ${_lib_name}) ++ spark_debug_message("引入引用: ${TARGET} <- ${_lib_name}") ++ target_include_directories(${TARGET} PUBLIC ++ "${${_lib_name}_SOURCE_PATH}" ${${_lib_name}_ARGN_APPEND_PATHS}) + endfunction(target_include_${_lib_name} TARGET) + ++ ++ target_include_directories(${_lib_name} PRIVATE ++ "${${_lib_name}_ARGN_APPEND_PATHS}") ++ ++ # 输出 includes ++ spark_debug_message(" ${_lib_name}_ARGN_APPEND_PATHS: ") ++ foreach(item IN LISTS ${_lib_name}_ARGN_APPEND_PATHS) ++ string(REPLACE "${CMAKE_SOURCE_DIR}/" "" item_var "${item}") ++ spark_debug_message(" ${item_var}") ++ endforeach(item IN LISTS ${_lib_name}_ARGN_APPEND_PATHS) ++ ++ # 如果想用以下操作手动实现 target_link_include_directories ++ # 请注意对 LIST 类型使用 "" 进行包围 ++ # target_link_include_directories 的 PUBLIC 将会填充(追加)目标的 INCLUDE_DIRECTORIES 属性 ++ # target_link_include_directories 支持 cmake 生成大表达式,更容易操作,手动将无法实现此类能力 ++ # target_link_include_directories 支持相对路径和绝对路径参数 ++ # 手动操作将必须使用绝对路径,这是不好的地方 ++ # get_target_property(_lib_include_directories ${_lib_name} INCLUDE_DIRECTORIES) ++ # list(APPEND _lib_include_directories "${CMAKE_CURRENT_LIST_DIR}/${${_lib_name}_SOURCE_PATH}") ++ # spark_debug_message("----> ${CMAKE_CURRENT_LIST_DIR}/${${_lib_name}_SOURCE_PATH}") ++ # spark_debug_message("----> ${_lib_include_directories}") ++ # set_target_properties(${_lib_name} PROPERTIES ++ # INCLUDE_DIRECTORIES "${_lib_include_directories}" ++ # INTERFACE_INCLUDE_DIRECTORIES "${_lib_include_directories}" ++ # ) ++ + endmacro(spark_add_library_path _lib_name _lib_path) + ++# spark_add_shared_library [files ...] ++# 构建一个共享库,基于指定的源代码 ++ # 并根据库名生成 target_link_ 函数 ++macro(spark_add_shared_library _lib_name) ++ spark_add_library(${_lib_name} SHARED ${ARGN}) ++endmacro(spark_add_shared_library _lib_name) ++ ++# spark_add_shared_library_path [files ... paths] ++# 构建一个共享库,基于指定的路径 ++ # 并根据库名生成 target_link_ 函数 ++macro(spark_add_shared_library_path _lib_name) ++ spark_add_library_path(${_lib_name} SHARED ${ARGN}) ++endmacro(spark_add_shared_library_path _lib_name) ++ + # spark_add_executable [files]... + # 构建一个可执行文件,基于指定的源文件 + # Qt编译时源文件包括很多类型,需要指定 *.h/*.cpp/*.qrc/*.qm/... 等 + macro(spark_add_executable _exec_name) + +- message("================ ${_exec_name} Executable ================") ++ set(${_exec_name}_TYPE_MESSAGE "可执行程序") ++ spark_debug_message("> Building: ${_exec_name}, type: ${${_exec_name}_TYPE_MESSAGE}") ++ + add_executable(${_exec_name} ${ARGN}) + + endmacro(spark_add_executable _exec_name) + ++# spark_add_executable_path [files ... paths] ++# 构建一个可执行程序,基于指定的路径 + macro(spark_add_executable_path _exec_name _exec_path) +- aux_source_directory(${_exec_path} ${_exec_name}_SOURCES) +- +- message("================ ${_exec_name} Executable ================") +- file(GLOB UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_exec_path}/*.ui) +- add_executable(${_exec_name} ${${_exec_name}_SOURCES} ${ARGN} ${UI_LIST}) +- foreach(item IN LISTS ${_exec_name}_SOURCES) +- message(" -> ${item}") +- endforeach(item IN LISTS ${_exec_name}_SOURCES) +- +- # function(target_link_${_exec_name} TARGET) +- # message("target_link_${_lib_name}") +- message(" -> (include): ${_exec_path}") +- target_include_directories(${_exec_name} PUBLIC "${_exec_path}") +- # target_link_libraries(${TARGET} ${_lib_name}) +- # endfunction(target_link_${_exec_name} TARGET) +- # target_link_${_exec_name}(${_exec_name}) ++ spark_add_executable(${_exec_name}) ++ ++ # 0. 建立初始变量体系 ++ # set(${_exec_name}_TYPE) ++ # set(${_exec_name}_TYPE_MESSAGE "可执行程序") ++ set(${_exec_name}_ARGN ${ARGN}) + ++ # 1. 处理由 spark_add_executable_realpaths 构建转本构建时的清洗机制 ++ # spark_debug_message("> Building: ${_exec_name}, type: ${${_exec_name}_TYPE_MESSAGE}") ++ set(${_exec_name}_ARGN_REF ${${_exec_name}_ARGN}) ++ unset(${_exec_name}_ARGN) ++ foreach(_old IN LISTS ${_exec_name}_ARGN_REF) ++ set(_new ${_old}) ++ string(FIND "${_old}" "+" _plus_index) ++ if(${_plus_index} GREATER 0) ++ string(SUBSTRING "${_old}" 0 ${_plus_index} _new) ++ spark_debug_message(" [CONVERT] ${_new} <- ${_old}") ++ endif(${_plus_index} GREATER 0) ++ list(APPEND ${_exec_name}_ARGN ${_new}) ++ endforeach(_old IN LISTS ${_exec_name}_ARGN_REF) ++ ++ # 1.目标参数项分析出子项 ++ # 拆分出源代码、路径、未知项等 ++ # spark_debug_message("> Building: ${_exec_name}, type: ${${_exec_name}_TYPE_MESSAGE}") ++ set(${_exec_name}_ARGN_SOURCES) ++ set(${_exec_name}_ARGN_APPEND_PATHS ${_exec_path}) ++ set(${_exec_name}_ARGN_UNKNOW) ++ foreach(item IN LISTS ${_exec_name}_ARGN) ++ spark_debug_message(" [ARGN] check:" ${item}) ++ if(CMAKE_VERSION VERSION_LESS 3.14) ++ string(REGEX MATCH "\.qm$" fext "${item}") ++ else() ++ get_filename_component(fext "${item}" LAST_EXT) ++ endif(CMAKE_VERSION VERSION_LESS 3.14) ++ ++ if(NOT EXISTS ${item} AND NOT "${fext}" STREQUAL ".qm") ++ set(item ${CMAKE_CURRENT_LIST_DIR}/${item}) ++ endif() ++ if(EXISTS ${item}) ++ # spark_debug_message(" exists: true") ++ file(REAL_PATH ${item} ${_exec_name}_ARGN_item) ++ if(IS_DIRECTORY ${${_exec_name}_ARGN_item}) ++ list(APPEND ${_exec_name}_ARGN_APPEND_PATHS ${item}) ++ else() ++ list(APPEND ${_exec_name}_ARGN_SOURCES ${item}) ++ endif(IS_DIRECTORY ${${_exec_name}_ARGN_item}) ++ else() ++ if("${fext}" STREQUAL ".qm") ++ list(APPEND ${_exec_name}_ARGN_SOURCES ${item}) ++ else() ++ list(APPEND ${_exec_name}_ARGN_UNKNOW ${item}) ++ spark_debug_message(" exists: false") ++ endif("${fext}" STREQUAL ".qm") ++ endif() ++ endforeach() ++ ++ list(LENGTH ${_exec_name}_ARGN_SOURCES ${_exec_name}_ARGN_SOURCES_LENGTH) ++ list(LENGTH ${_exec_name}_ARGN_APPEND_PATHS ${_exec_name}_ARGN_APPEND_PATHS_LENGTH) ++ list(LENGTH ${_exec_name}_ARGN_UNKNOW ${_exec_name}_ARGN_UNKNOW_LENGTH) ++ spark_debug_message(" result: files(${${_exec_name}_ARGN_SOURCES_LENGTH}), paths(${${_exec_name}_ARGN_APPEND_PATHS_LENGTH}), unknow(${${_exec_name}_ARGN_UNKNOW_LENGTH})" ${item}) ++ ++ ++ # 2. 获取所以源代码为 any_files ++ spark_debug_message(" files:") ++ set(any_files ${${_exec_name}_ARGN_SOURCES}) ++ foreach(item IN LISTS ${_exec_name}_ARGN_APPEND_PATHS) ++ spark_aux_source_directory(item_files ${item}) ++ list(APPEND any_files ${item_files}) ++ foreach(item_file IN LISTS item_files) ++ spark_debug_message(" ${item_file}") ++ endforeach(item_file IN LISTS item_files) ++ endforeach(item IN LISTS ${_exec_name}_ARGN_APPEND_PATHS) ++ ++ # 3. 构建可执行目标所需要的文件 ++ # add_executable(${_exec_name} ++ # ${${_exec_name}_ARGN_SOURCES} ++ # ${any_files}) ++ ++ target_sources(${_exec_name} PRIVATE ++ ${${_exec_name}_ARGN_SOURCES} ++ ${any_files}) ++ ++ # 4. 建立引用点 ++ # target_<_exec_name>_include 函数 ++ # target_<_exec_name>_link 函数 ++ function(target_${_exec_name}_include _include) ++ spark_debug_message("添加引用: ${_exec_name} <- ${_include} ${${_exec_name}_INCLUDE_ARGN}") ++ target_include_directories(${_exec_name} PRIVATE ${_include}) ++ endfunction(target_${_exec_name}_include _include) ++ ++ function(target_${_exec_name}_link _library) ++ spark_debug_message("添加链接: ${_exec_name} <- ${_library} ${${_exec_name}_LINK_ARGN}") ++ target_link_libraries(${_exec_name} ${_library}) ++ endfunction(target_${_exec_name}_link _library) ++ ++ target_include_directories(${_exec_name} PRIVATE ++ ${_exec_path}) ++ spark_debug_message(" include: ${_exec_path}\n") ++ + endmacro(spark_add_executable_path _exec_name _exec_path) + + # spark_find_library +@@ -98,6 +352,15 @@ macro(spark_find_library _prefix) + + endmacro(spark_find_library _prefix) + ++macro(target_link_qt) ++ ++ if(SPARK_FIND_QT6) ++ target_link_qt6(${ARGN}) ++ elseif(SPARK_FIND_QT5) ++ target_link_qt5(${ARGN}) ++ endif(SPARK_FIND_QT6) ++ ++endmacro(target_link_qt) + + # spark_add_executable_paths + # 自定义构建宏,基于指定的前缀名称,处理后续参数为子目录 +@@ -108,9 +371,9 @@ macro(spark_add_executable_paths _prefix_path) + set(PATHS ${ARGN}) + foreach(item IN LISTS PATHS) + file(GLOB QRCS "${item}/*.qrc") +- message(">>> add_executable: " "${_prefix_path}-${item} ${item} + ${QRCS}") ++ spark_debug_message(">>> add_executable: " "${_prefix_path}-${item} ${item} + ${QRCS}") + spark_add_executable_path(${_prefix_path}-${item} ${item} ${QRCS}) +- target_link_qt5(${_prefix_path}-${item}) ++ target_link_qt(${_prefix_path}-${item}) + endforeach(item IN LISTS PATHS) + endmacro(spark_add_executable_paths _prefix_path) + +@@ -120,10 +383,11 @@ endmacro(spark_add_executable_paths _prefix_path) + # ARGN: 此宏剩余的参数列表 + # 在使用 target_link_ 时 + # _NAME: 用于此 fucntion 中的要求参数: <_NAME>目标将要连接此库 +-macro(spark_add_link _IN_NAME) +- function(target_link_${_IN_NAME} _NAME) +- message("LINK ${_NAME} ${ARGN}") +- target_link_libraries(${_NAME} ++macro(spark_add_link _name) ++ function(target_link_${_name} _link) ++ spark_debug_message("> Linking: ${_link}") ++ spark_debug_message(" <- ${ARGN}\n") ++ target_link_libraries(${_link} + ${ARGN}) +- endfunction(target_link_${_IN_NAME} _NAME) +-endmacro(spark_add_link _IN_NAME) +\ No newline at end of file ++ endfunction(target_link_${_name} _link) ++endmacro(spark_add_link _name) +diff --git a/cmake/SparkMacrosExtendConfig.cmake b/cmake/SparkMacrosExtendConfig.cmake +index bad0620..0a4dcb2 100644 +--- a/cmake/SparkMacrosExtendConfig.cmake ++++ b/cmake/SparkMacrosExtendConfig.cmake +@@ -4,193 +4,428 @@ + function(find_plus INVAL OUTVAL) + string(FIND "${INVAL}" "+" plus_index) + set(${OUTVAL} ${plus_index} PARENT_SCOPE) +- # if(plus_index LESS 0) +- # set(${OUTVAL} -1 PARENT_SCOPE) +- # else() +- # set(${OUTVAL} ${plus_index} PARENT_SCOPE) +- # endif(plus_index LESS 0) + endfunction(find_plus INVAL OUTVAL) + +-# find_plus("FF" FFFF) +-# message("--> FFFF ${FFFF}") # --> FFFF -1 +-# find_plus("F+F" FFFF) +-# message("--> FFFF ${FFFF}") # --> FFFF 1 +-# find_plus("+F+F" FFFF) +-# message("--> FFFF ${FFFF}") # --> FFFF 0 +- +-# set(FFF) +-# list(APPEND FFFF ) +-# list(APPEND FFFF "F") +-# list(APPEND FFFF "FA") +-# message("--> FFFF: ${FFFF}") # --> FFFF: F;FA +- +-# set(FFFFS "") +-# list(APPEND FFFFS ${FFFF}) +-# message("--> FFFFS: ${FFFFS}") # --> FFFFS: F;FA +- +-# set(FFFF "+AA+BB+CC+DD") +-# string(REPLACE "+" ";" FFFFL "${FFFF}") +-# list(LENGTH FFFFL FFFFLEN) +-# message("--> FFFFL: ${FFFFL} --> ${FFFFLEN}") # --> FFFFL: F; +- +-# plus_list +-# 将传入的 "+AAA+BBB+CCC" 类型数据变成一个 列表(list) +-# 适用于不使用 string 进行替换 + 为 ";" 的情况下使用直接变成 list +-function(plus_list INVAL OUTVAL OUTVALLEN) +- # set(${OUTVAL} "..." PARENT_SCOPE) +- # set(${OUTVALLEN} 0 PARENT_SCOPE) +- +- set(_tmps "") # 设置为空的 +- +- # 寻找下一个 + 位置 +- find_plus(${INVAL} RIGHT_PLUS) +- +- string(LENGTH "${INVAL}" INVALLEN) +- message("--> 传入的 INVAL: --> 内容: ${INVAL}") +- message("--> 传入的 INVAL: --> 长度: ${INVALLEN}") +- message("--> 传入的 INVAL: --> +位置: ${RIGHT_PLUS}") +- +- # 判断是否有右侧 + 号 +- if(RIGHT_PLUS LESS 0) +- message("--> 传入的 INVAL: --> 无需计算新的+位置") +- # message("--> 计算新的 + 位置: ${_PLUSINDEX}") +- list(APPEND _tmps ${INVAL}) +- else() +- math(EXPR _PLUSINDEX "${RIGHT_PLUS}+1") +- message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX}") +- +- string(SUBSTRING "${INVAL}" ${_PLUSINDEX} ${INVALLEN} NewVal) +- message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX} -> 内容: ${NewVal}") +- # string(REPLACE "+" ";" _tmps "${NewVal}") +- # list(LENGTH FFFFL FFFFLEN) +- +- # message("--> 计算新的 + 位置: ${_PLUSINDEX} --> 后面的 NewVal: ${NewVal}") +- +- # find_plus(${NewVal} _NextPlus) +- # if(_NextPlus LESS 0) +- # list(APPEND _tmps ${NewVal}) +- # message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的") +- # else() +- # message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的") +- # # 重新 +- # # plus_list(${NewVal} NewValS ) +- # # foreach(item) +- # # list(APPEND _tmps ${item}) +- # # endforeach(item) +- # endif(_NextPlus LESS 0) +- endif(RIGHT_PLUS LESS 0) +- +- set(${OUTVAL} ${_tmps} PARENT_SCOPE) +- list(LENGTH _tmps _tmps_len) +- set(${OUTVALLEN} ${_tmps_len} PARENT_SCOPE) +- +-endfunction(plus_list INVAL OUTVAL OUTVALLEN) +- +-# plus_list("+AAA+BBB+CCC+DDD" FFF FFLEN) +-# message("--------> ${FFF}: -> ${FFLEN}") +- +-# spark_add_library_realpaths ++function(find_plus_v INVAL OUTVAL) ++ string(FIND "${${INVAL}}" "+" plus_index) ++ set(${OUTVAL} ${plus_index} PARENT_SCOPE) ++endfunction(find_plus_v INVAL OUTVAL) ++ ++function(find_colon INVAL OUTVAL) ++ string(FIND "${INVAL}" ":" colon_index) ++ set(${OUTVAL} ${colon_index} PARENT_SCOPE) ++endfunction(find_colon INVAL OUTVAL) ++ ++function(find_colon_v INVAL OUTVAL) ++ string(FIND "${${INVAL}}" ":" colon_index) ++ set(${OUTVAL} ${colon_index} PARENT_SCOPE) ++endfunction(find_colon_v INVAL OUTVAL) ++ ++function(find_dir INVAL OUTVAL) ++ string(FIND "${INVAL}" "/" _STR ${ARGN}) ++ set(${OUTVAL} ${_STR} PARENT_SCOPE) ++endfunction(find_dir INVAL OUTVAL) ++ ++function(find_dir_v INVAL OUTVAL) ++ string(FIND "${${INVAL}}" "/" _STR ${ARGN}) ++ set(${OUTVAL} ${_STR} PARENT_SCOPE) ++endfunction(find_dir_v INVAL OUTVAL) ++ ++# ++function(str_left INVAL INDEX OUTVAL) ++ set(LEFT_INDEX ${INDEX}) ++ string(SUBSTRING "${INVAL}" 0 ${LEFT_INDEX} _LEFT_V) ++ set(${OUTVAL} ${_LEFT_V} PARENT_SCOPE) ++endfunction(str_left INVAL INDEX OUTVAL) ++ ++function(str_right INVAL INDEX OUTVAL) ++ math(EXPR RIGHT_INDEX ${INDEX}+1) ++ string(SUBSTRING "${INVAL}" ${RIGHT_INDEX} -1 _RIGHT_V) ++ set(${OUTVAL} ${_RIGHT_V} PARENT_SCOPE) ++endfunction(str_right INVAL INDEX OUTVAL) ++ ++function(str_left_v INVAL INDEX OUTVAL) ++ set(LEFT_INDEX ${${INDEX}}) ++ string(SUBSTRING "${${INVAL}}" 0 ${LEFT_INDEX} _LEFT_V) ++ set(${OUTVAL} ${_LEFT_V} PARENT_SCOPE) ++endfunction(str_left_v INVAL INDEX OUTVAL) ++ ++function(str_right_v INVAL INDEX OUTVAL) ++ math(EXPR RIGHT_INDEX ${${INDEX}}+1) ++ string(SUBSTRING "${${INVAL}}" ${RIGHT_INDEX} -1 _RIGHT_V) ++ set(${OUTVAL} ${_RIGHT_V} PARENT_SCOPE) ++endfunction(str_right_v INVAL INDEX OUTVAL) ++ ++# ++function(find_colon_plus INVAL OUTVAL) ++ find_colon(${INVAL} COLON_INDEX) ++ str_right(${INVAL} ${COLON_INDEX} COLON_RIGHT) ++ find_plus_v(COLON_RIGHT PLUS_INDEX) ++ str_left_v(COLON_RIGHT PLUS_INDEX COLON_RIGHT_LEFT_PLUS) ++ ++ set(${OUTVAL} ${COLON_RIGHT_LEFT_PLUS} PARENT_SCOPE) ++endfunction(find_colon_plus INVAL OUTVAL) ++ ++function(find_colon_plus_v INVAL OUTVAL) ++ find_colon_v(${INVAL} COLON_INDEX) ++ str_right_v(${INVAL} COLON_INDEX COLON_RIGHT) ++ find_plus_v(COLON_RIGHT PLUS_INDEX) ++ str_left_v(COLON_RIGHT PLUS_INDEX COLON_RIGHT_LEFT_PLUS) ++ ++ set(${OUTVAL} ${COLON_RIGHT_LEFT_PLUS} PARENT_SCOPE) ++endfunction(find_colon_plus_v INVAL OUTVAL) ++ ++function(find_dir_plus INVAL OUTVAL) ++ # t:*/*+d ++ # ^ ++ find_dir("${INVAL}" SLASH_INDEX REVERSE) ++ str_right("${INVAL}" ${SLASH_INDEX} SLASH_RIGHT) ++ find_plus_v(SLASH_RIGHT PLUS_INDEX) ++ str_left_v(SLASH_RIGHT PLUS_INDEX SLASH_RIGHT_LEFT_PLUS) ++ ++ set(${OUTVAL} ${SLASH_RIGHT_LEFT_PLUS} PARENT_SCOPE) ++endfunction(find_dir_plus INVAL OUTVAL) ++ ++function(find_dir_plus_v INVAL OUTVAL) ++ # t:*/*+d ++ # ^ ++ find_dir("${${INVAL}}" SLASH_INDEX REVERSE) ++ str_right("${${INVAL}}" ${SLASH_INDEX} SLASH_RIGHT) ++ find_plus_v(SLASH_RIGHT PLUS_INDEX) ++ str_left_v(SLASH_RIGHT PLUS_INDEX SLASH_RIGHT_LEFT_PLUS) ++ ++ set(${OUTVAL} ${SLASH_RIGHT_LEFT_PLUS} PARENT_SCOPE) ++endfunction(find_dir_plus_v INVAL OUTVAL) ++ ++ ++# spark_add_library_source ... ++# 扩展 一行一可执行目标 的构建的扩展宏 ++# 在构建时将会另外加入这些资源 ++macro(spark_add_library_source target) ++ set(${target}_ADD_SOURCE ${ARGN}) ++endmacro(spark_add_library_source target) ++ ++# 冗余的 target_link_qt5 或 qt6 的处理逻辑 ++macro(_handle_spark_target_link_qt_macro _target) ++ target_link_qt(${_target}) ++endmacro(_handle_spark_target_link_qt_macro _target) ++ ++# spark_add_library_realpaths [dirs ...] + # 基于传入的项进行构建 +-# 可接受的值为: 路径列表 +-# 可接受的值为: 路径列表+依赖库A+依赖库B ++ # 可接受的值为: 路径列表 ++ # 可接受的值为: 路径列表+依赖库A+依赖库B + macro(spark_add_library_realpaths) +- message("---> 基于传入的项进行构建 <---") +- # message("--> src/unclassified/ItemDelegates/NdStyledItemDelegate") +- # string(FIND [REVERSE]) +- # string(SUBSTRING ) +- # math(EXPR value "100 * 0xA" OUTPUT_FORMAT DECIMAL) # value is set to "1000" + + set(REALPATHS ${ARGN}) + foreach(REALPATH IN LISTS REALPATHS) +- message("---> 传入路径: ${REALPATH} <--- ") +- string(LENGTH "${REALPATH}" REALPATH_LENGTH) +- message("---> 计算传入路径长度: --> 长度: ${REALPATH_LENGTH}") +- +- string(FIND "${REALPATH}" "/" LASTINDEX REVERSE) +- message("---> 计算传入路径末尾/位置: --> 长度: ${LASTINDEX}") +- math(EXPR LASTINDEX "${LASTINDEX}+1") +- message("---> 计算传入路径末尾/右移: --> 长度: ${LASTINDEX}") +- string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALPATH_LENGTH} REALNAME_Dependency) + ++ # # 找 : 号下标,这是找:号的函数 ++ # find_colon(${REALPATH} COLON_INDEX) ++ # 找 / 号下标,这是找/号的函数 ++ find_dir_v(REALPATH SLASH_INDEX REVERSE) + # 找 + 号下标,这是找+号的函数 +- find_plus(${REALPATH} RIGHT_PLUS) ++ find_plus_v(REALPATH PLUS_INDEX) ++ ++ # + ++ if(PLUS_INDEX LESS 0) ++ # 完全没有 + 的情况下,它就是一个基于目录的构建 ++ set(dir ${REALPATH}) ++ str_right_v(REALPATH SLASH_INDEX target) ++ ++ spark_add_library_path(${target} ++ ${dir} ++ ${${target}_ADD_SOURCE} ++ ) ++ # 使用 spark_add_library_realpaths 构建的依赖将允许直接引用库头文件 ++ target_include_directories(${target} PUBLIC ${dir}) ++ _handle_spark_target_link_qt_macro(${target}) ++ else() ++ # 有 + 的情况下,获取 + 号下标右侧所有内容为 target_depends_str 并转为列表 ++ str_right_v(REALPATH PLUS_INDEX target_depends_str) ++ string(REPLACE "+" ";" target_depends "${target_depends_str}") ++ ++ find_dir_plus_v(REALPATH target) ++ str_left_v(REALPATH PLUS_INDEX dir) ++ ++ spark_add_library_path(${target} ++ ${dir} ++ ${${target}_ADD_SOURCE} ++ ) ++ spark_debug_message(" [INCLUDE_DIRS]: ${dir} ${dir}/.. \n") ++ target_include_directories(${target} PUBLIC ${dir} ${dir}/..) ++ target_link_libraries(${target} ${target_depends}) ++ endif(PLUS_INDEX LESS 0) + +- # 判断是否有找到 + 号下标,值为 -1 或 正整数 +- if(RIGHT_PLUS LESS 0) # 小于0: 不存在 + 号 +- set(REALNAME "${REALNAME_Dependency}") +- message("---> 传入路径末尾/右移部分: --> ${REALNAME} <-- 无依赖+") ++ endforeach(REALPATH IN LISTS REALPATHS) + +- message("---> 构建 ${REALNAME} -> ${REALNAME} ${REALPATH} ") ++endmacro(spark_add_library_realpaths) + +- spark_add_library_path(${REALNAME} ${REALPATH}) +- target_link_qt5(${REALNAME}) +- else() +- message("---> 传入路径末尾/右移部分: --> ${REALNAME_Dependency} <-- 依赖+") + +- # 存在+号,将截取从 / 到 + 号之间的内容作为目标名称 +- # 例如 src/unclassified/widgets/DocTypeListView+JsonDeploy +- # ^(LASTINDEX) ^(RIGHT_PLUS) +- # 将 RIGHT_PLUS - LASTINDEX 计算出 DocTypeListView 字符长度 +- math(EXPR REALNAME_LENGTH "${RIGHT_PLUS}-${LASTINDEX}") ++# spark_add_shared_library_realpaths [dirs ...] ++# 基于传入的项进行构建 ++ # 可接受的值为: 路径列表 ++ # 可接受的值为: 路径列表+依赖库A+依赖库B ++macro(spark_add_shared_library_realpaths) ++ ++ set(REALPATHS ${ARGN}) ++ foreach(REALPATH IN LISTS REALPATHS) + +- message("---> 计算传入路径末尾/右移部分: --> 位置: ${RIGHT_PLUS}") +- # message("---> 计算传入路径末尾/右移部分: --> 长度: ${REALNAME_Dependency}") ++ # # 找 : 号下标,这是找:号的函数 ++ # find_colon(${REALPATH} COLON_INDEX) ++ # 找 / 号下标,这是找/号的函数 ++ find_dir_v(REALPATH SLASH_INDEX REVERSE) ++ # 找 + 号下标,这是找+号的函数 ++ find_plus_v(REALPATH PLUS_INDEX) ++ ++ # + ++ if(PLUS_INDEX LESS 0) ++ # 完全没有 + 的情况下,它就是一个基于目录的构建 ++ set(dir ${REALPATH}) ++ str_right_v(REALPATH SLASH_INDEX target) ++ ++ spark_add_library_path(${target} SHARED ++ ${dir} ++ ${${target}_ADD_SOURCE} ++ ) ++ # 使用 spark_add_library_realpaths 构建的依赖将允许直接引用库头文件 ++ target_include_directories(${target} PUBLIC ${dir}) ++ _handle_spark_target_link_qt_macro(${target}) ++ else() ++ # 有 + 的情况下,获取 + 号下标右侧所有内容为 target_depends_str 并转为列表 ++ str_right_v(REALPATH PLUS_INDEX target_depends_str) ++ string(REPLACE "+" ";" target_depends "${target_depends_str}") ++ ++ find_dir_plus_v(REALPATH target) ++ str_left_v(REALPATH PLUS_INDEX dir) ++ ++ spark_add_library_path(${target} SHARED ++ ${dir} ++ ${${target}_ADD_SOURCE} ++ ) ++ spark_debug_message(" [INCLUDE_DIRS]: ${dir} ${dir}/.. \n") ++ target_include_directories(${target} PUBLIC ${dir} ${dir}/..) ++ target_link_libraries(${target} ${target_depends}) ++ endif(PLUS_INDEX LESS 0) + +- # 目标名称为 DocTypeListView +- # 依赖为 JsonDeploy +- # set(REALNAME "") +- string(SUBSTRING "${REALPATH}" 0 ${RIGHT_PLUS} _REALPATH_DIR) +- string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALNAME_LENGTH} REALNAME) ++ endforeach(REALPATH IN LISTS REALPATHS) + +- message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME}") ++endmacro(spark_add_shared_library_realpaths) + +- string(SUBSTRING "${REALPATH}" ${RIGHT_PLUS} ${REALPATH_LENGTH} Dependency) +- message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency}") ++# spark_aux_source_paths ++# 将指定路径中的文件变成可用的AUX源文件列表 ++macro(spark_aux_source_paths AUX_VAR) ++ set(${AUX_VAR} "") ++ set(${AUX_VAR}_PATHS ${ARGN}) + +- # plus_list(${Dependency} dependencies dependencies_len) +- string(REPLACE "+" ";" dependencies "${Dependency}") +- message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency} --> 列表: ${dependencies} <-- ") ++ foreach(aux_path IN LISTS ${AUX_VAR}_PATHS) ++ # spark_debug_message("aux_path: ${aux_path}") ++ aux_source_directory(${aux_path} ${AUX_VAR}) ++ endforeach(aux_path IN LISTS ${AUX_VAR}_PATHS) + ++endmacro(spark_aux_source_paths AUX_VAR) + +- message("---> 构建 ${REALNAME} -> ${REALNAME} ${_REALPATH_DIR}") ++# spark_file_glob ++# 使用用 file(GLOB) 的匹配规则,并一次可匹配多个规则 ++# ++macro(spark_file_glob FGLOB_VAR) ++ set(${FGLOB_VAR} "") ++ set(${FGLOB_VAR}_PATHS ${ARGN}) + +- spark_add_library_path(${REALNAME} ${_REALPATH_DIR}) +- # target_link_qt5(${REALNAME}) # 使用依赖的依赖或许也不错 ++ foreach(fglob_path IN LISTS ${FGLOB_VAR}_PATHS) + +- target_include_directories(${REALNAME} PUBLIC ${_REALPATH_DIR}) +- target_link_libraries(${REALNAME} ${dependencies}) ++ file(GLOB FGLOB_PATH_SRCS ${fglob_path}) ++ foreach(fglob_path_src IN LISTS FGLOB_PATH_SRCS) ++ # spark_debug_message(" -> ${item}") ++ list(APPEND ${FGLOB_VAR} ${fglob_path_src}) ++ endforeach(fglob_path_src IN LISTS FGLOB_PATH_SRCS) + +- endif(RIGHT_PLUS LESS 0) +- endforeach(REALPATH IN LISTS REALPATHS) ++ endforeach(fglob_path IN LISTS ${FGLOB_VAR}_PATHS) + +-endmacro(spark_add_library_realpaths) ++endmacro(spark_file_glob FGLOB_VAR) + + + # spark_add_source_paths + # 将指定路径中的文件变成可用的源文件列表 + # +-macro(spark_add_source_paths SOURCE_VARIABLE_NAME) +- set(SOURCE_PATHS ${ARGN}) +- set(${SOURCE_VARIABLE_NAME}_PATHS "") +- set(${SOURCE_VARIABLE_NAME} "") +- foreach(SOURCE_PATH IN LISTS SOURCE_PATHS) +- list(APPEND ${SOURCE_VARIABLE_NAME}_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_PATH}) +- aux_source_directory(${SOURCE_PATH} _SOURCES) +- foreach(item IN LISTS _SOURCES) +- # message(" -> ${item}") +- list(APPEND ${SOURCE_VARIABLE_NAME} ${item}) +- endforeach(item IN LISTS _SOURCES) ++macro(spark_add_source_paths SOURCE_VAR) ++ set(${SOURCE_VAR} "") ++ set(${SOURCE_VAR}_PATHS ${ARGN}) ++ ++ spark_aux_source_paths(${SOURCE_VAR} ${ARGN}) ++ foreach(source_path IN LISTS ${SOURCE_VAR}_PATHS) ++ # list(APPEND ${SOURCE_VAR}_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_PATH}) ++ # aux_source_directory(${SOURCE_PATH} _SOURCES) ++ # foreach(item IN LISTS _SOURCES) ++ # # spark_debug_message(" -> ${item}") ++ # list(APPEND ${SOURCE_VAR} ${item}) ++ # endforeach(item IN LISTS _SOURCES) + + # file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCE_PATH}/*.h) + # foreach(item IN LISTS HEADER_LIST) +- # # message(" -> ${item}") +- # list(APPEND ${SOURCE_VARIABLE_NAME} ${item}) ++ # # spark_debug_message(" -> ${item}") ++ # list(APPEND ${SOURCE_VAR} ${item}) + # endforeach(item IN LISTS HEADER_LIST) + +- file(GLOB UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCE_PATH}/*.ui) +- foreach(item IN LISTS UI_LIST) +- # message(" -> ${item}") +- list(APPEND ${SOURCE_VARIABLE_NAME} ${item}) +- endforeach(item IN LISTS UI_LIST) +- endforeach(SOURCE_PATH IN LISTS SOURCE_PATHS) +-endmacro(spark_add_source_paths SOURCE_VARIABLE_NAME) ++ file(GLOB UI_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${source_path}/*.ui) ++ foreach(ui_src IN LISTS UI_SRCS) ++ # spark_debug_message(" -> ${item}") ++ list(APPEND ${SOURCE_VAR} ${ui_src}) ++ endforeach(ui_src IN LISTS UI_SRCS) ++ endforeach(source_path IN LISTS ${SOURCE_VAR}_PATHS) ++endmacro(spark_add_source_paths SOURCE_VAR) ++ ++ ++# spark_add_library_file_glob ++ # ++macro(spark_add_library_file_glob _lib_name) ++ spark_file_glob(${_lib_name}_SOURCES ${ARGN}) ++ spark_add_library(${_lib_name} ${${_lib_name}_SOURCES}) ++endmacro(spark_add_library_file_glob _lib_name) ++ ++ ++ ++# spark_add_executable_source ... ++# 扩展 一行一可执行目标 的构建的扩展宏 ++# 在构建时将会另外加入这些资源 ++macro(spark_add_executable_source target) ++ set(${target}_ADD_SOURCE ${ARGN}) ++endmacro(spark_add_executable_source target) ++ ++# 冗余的 spark_add_executable_realpaths 的 dir 处理逻辑 ++macro(_handle_spark_add_executable_realpaths_if_dir_empty_macro) ++ if("${dir}" STREQUAL "") ++ spark_add_executable(${target} ++ ${${target}_ADD_SOURCE} ++ ) ++ else() ++ spark_add_executable_path(${target} ++ ${dir} ++ ${${target}_ADD_SOURCE} ++ ) ++ endif("${dir}" STREQUAL "") ++endmacro(_handle_spark_add_executable_realpaths_if_dir_empty_macro) ++ ++# spark_add_executable_realpaths ++# 基于传入的项进行构建 ++# 可接受的值为: 可执行目标:路径列表 ++# 可接受的值为: 可执行目标:路径列表+依赖库A+依赖库B ++macro(spark_add_executable_realpaths) ++ ++ set(REALPATHS ${ARGN}) ++ foreach(REALPATH IN LISTS REALPATHS) ++ ++ # 找 : 号下标,这是找:号的函数 ++ find_colon(${REALPATH} COLON_INDEX) ++ ++ if(COLON_INDEX LESS 0) ++ # do not anything ++ else() ++ # 找到 : 号,将截取 target 名称 ++ # string(SUBSTRING "${REALPATH}" 0 ${COLON_INDEX} REALTARGET) ++ find_colon_v(REALPATH COLON_INDEX) ++ str_left_v(REALPATH COLON_INDEX target) ++ str_right_v(REALPATH COLON_INDEX COLON_REMAIN) ++ # message(FATAL_ERROR "构建一个: ${target}") # 已验证 ++ ++ endif(COLON_INDEX LESS 0) ++ ++ # 找 + 号下标,这是找+号的函数 ++ find_plus_v(REALPATH PLUS_INDEX) ++ ++ if(PLUS_INDEX LESS 0) ++ # 完全没有 + 的情况下,它就是一个基于目录的构建 ++ set(dir ${COLON_REMAIN}) ++ # spark_add_executable_path(${target} ++ # ${dir} ++ # ${${target}_ADD_SOURCE} ++ # ) ++ _handle_spark_add_executable_realpaths_if_dir_empty_macro() ++ _handle_spark_target_link_qt_macro(${target}) ++ else() ++ # 有 + 的情况下,获取 + 号下标右侧所有内容为 target_depends_str 并转为列表 ++ str_right_v(REALPATH PLUS_INDEX target_depends_str) ++ string(REPLACE "+" ";" target_depends "${target_depends_str}") ++ ++ # 再从主要内容中获取 dir ,以及 ++ find_colon_plus_v(REALPATH dir) ++ # spark_add_executable_path(${target} ++ # ${dir} ++ # ${${target}_ADD_SOURCE} ++ # ) ++ _handle_spark_add_executable_realpaths_if_dir_empty_macro() ++ target_include_directories(${target} PUBLIC ${dir} ${dir}/..) ++ target_link_libraries(${target} ${target_depends}) ++ endif(PLUS_INDEX LESS 0) ++ endforeach(REALPATH IN LISTS REALPATHS) ++ ++endmacro(spark_add_executable_realpaths) ++ ++ ++# 一行一库概念构建 ++# 1.构建一个库,基于指定的目录路径进行构建 ++# src/widgets/DocTypeListView ++# ^目录将被用于制作的目标名称 ++# 目录下的所有文件将被用于制作此库的源代码文件 ++# ++# 2.构建一个库,基于指定的目录路径进行构建,并依赖其后面所列出的依赖项 ++# src/widgets/MaintainerInfoView+DocTypeListView+... ++# ^此库将被用于 MaintainerInfoView 库的依赖 ++# ^此符号'+'将被视为依赖项列表的分隔符 ++ ++# 一行一可执行目标概念 ++# 1.构建一个可执行目标,基于指定的目录路径进行构建(行不通,可执行目标很少为一个目录) ++# 2.构建一个可执行目标,基于指定的文件路径进行构建(也许可以) ++# 3.构建一个可执行目标,基于指定的文件名称进行构建() ++# 4.构建一个可执行目标,基于指定命名规则(target:dir:dir+depend+depend...) ++ ++ ++# 一行一目标概念:集成(一行一库 + 一行一可执行目标) ++# 1.构建一个目标,基于指定的目录进行构建(适用于library与executable) ++# 3.构建一个目标,命名规则与集成相同,类型只需要写一个前缀标识 ++# s[hared],d[yamic],t[可执行] ++# 静态库 s:dir+depend+depend... ++# 动态库 d:dir+depend+depend... ++# 可执行 t::dir+depend+depend... ++# ^ 可执行目标名称 ++ ++# 一行一目标 ++# spark_add_target_realpaths [realpaths] ++# realpaths: ++ # s: static (s:src/libs/hello) ++ # d: shared (d:src/libs/say) ++ # t: target (t::src+hello+say) ++# 参考 ++ # spark_add_executable_realpaths ++ # spark_add_shared_library_realpaths ++ # spark_add_library_realpaths ++macro(spark_add_target_realpaths tag) ++ set(${tag}_ARGN ${ARGN}) ++ ++ foreach(item IN LISTS ${tag}_ARGN) ++ str_left(${item} 1 item_type) ++ str_right(${item} 1 item_val) ++ ++ if("${item_type}" STREQUAL "t") ++ set(item_message "可执行文件") ++ elseif("${item_type}" STREQUAL "d") ++ set(item_message "动态库") ++ elseif("${item_type}" STREQUAL "s") ++ set(item_message "静态库") ++ endif("${item_type}" STREQUAL "t") ++ ++ spark_debug_message("代号: [${tag}] 构建 ${item_val}, 类型: ${item_message}") ++ spark_debug_message(" * ${item_val}") ++ ++ if("${item_type}" STREQUAL "t") ++ spark_add_executable_realpaths(${item_val}) ++ elseif("${item_type}" STREQUAL "d") ++ spark_add_shared_library_realpaths(${item_val}) ++ elseif("${item_type}" STREQUAL "s") ++ spark_add_library_realpaths(${item_val}) ++ endif("${item_type}" STREQUAL "t") ++ ++ spark_debug_message("") ++ ++ endforeach(item IN LISTS ${tag}_ARGN) ++ ++endmacro(spark_add_target_realpaths tag) +diff --git a/cmake/SparkTranslatorConfig.cmake b/cmake/SparkTranslatorConfig.cmake +index 46de519..8714e12 100644 +--- a/cmake/SparkTranslatorConfig.cmake ++++ b/cmake/SparkTranslatorConfig.cmake +@@ -1,32 +1,49 @@ + cmake_minimum_required(VERSION 3.5.1) + +-find_package(Qt5LinguistTools) +- +-file(GLOB SPARK_TRANSLATIONS ${CMAKE_SOURCE_DIR}/translations/*.ts) +- +-message("================ Translations ================") +-foreach(item IN LISTS SPARK_TRANSLATIONS) +- message("-> ${item}") +-endforeach(item IN LISTS SPARK_TRANSLATIONS) +- +-qt5_add_translation(SPARK_QM_TRANSLATIONS +- ${SPARK_TRANSLATIONS}) +- +-file(WRITE ${CMAKE_BINARY_DIR}/SPARK_QM_TRANSLATIONS "") +-foreach(item IN LISTS SPARK_QM_TRANSLATIONS) +- file(APPEND ${CMAKE_BINARY_DIR}/SPARK_QM_TRANSLATIONS "${item}\n") +-endforeach(item IN LISTS SPARK_QM_TRANSLATIONS) +- +-message("translator(ts -> qm):") +-foreach(item IN LISTS SPARK_QM_TRANSLATIONS) +- message("-> ${item}") +-endforeach(item IN LISTS SPARK_QM_TRANSLATIONS) +- +- +-# 注意,必须将 SPARK_QM_TRANSLATIONS 加入到 add_executable 参数中才能在编译时生成只有原文的ts文件 +- +-# qt5_create_translation +- # ts文件会在 make clean 或重新编译的时候一并被删除,再编译的时候生成全新的ts(原有的翻译会丢失,万分注意!!) +- +-# qt5_add_translation +- # 此宏比较稳定 ++# translator_qt5 _qmvar [... *.ts] ++macro(translator_qt5 _qmvar) ++ ++ set(${_qmvar}_ARNG ${ARGN}) ++ file(GLOB ${_qmvar}_TS_FILES ${${_qmvar}_ARNG}) ++ ++ find_package(Qt5LinguistTools) ++ qt5_add_translation(${_qmvar} ++ ${${_qmvar}_TS_FILES}) ++ ++ spark_debug_message("> QT Translation: ${_qmvar}") ++ file(WRITE ${CMAKE_BINARY_DIR}/${_qmvar} "") ++ foreach(item IN LISTS ${_qmvar}) ++ file(APPEND ${CMAKE_BINARY_DIR}/${_qmvar} "${item}\n") ++ spark_debug_message(" ${item}") ++ endforeach(item IN LISTS ${_qmvar}) ++ ++ # 注意,必须将 SPARK_QM_TRANSLATIONS 或 ${_qmvar} 加入到 add_executable 参数中才能在编译时生成只有原文的ts文件 ++ ++ # qt5_create_translation ++ # ts文件会在 make clean 或重新编译的时候一并被删除,再编译的时候生成全新的ts(原有的翻译会丢失,万分注意!!) ++ ++ # qt5_add_translation ++ # 此宏比较稳定 ++endmacro(translator_qt5 _qmvar) ++ ++ ++# translator_qt6 _qmvar [... *.ts] ++macro(translator_qt6 _qmvar) ++ # todo ++endmacro(translator_qt6 _qmvar) ++ ++# 冗余的 translator_qt5 或 qt6 的处理逻辑 ++macro(_handle_spark_translator_qt_macro _outvar) ++ if(SPARK_FIND_QT5) ++ translator_qt5(${_outvar} ${ARGN}) ++ endif(SPARK_FIND_QT5) ++ ++ if(SPARK_FIND_QT6) ++ translator_qt6(${_outvar} ${ARGN}) ++ endif(SPARK_FIND_QT6) ++endmacro(_handle_spark_translator_qt_macro _outvar) ++ ++# translator_qt _qmvar [... *.ts | match] ++macro(translator_qt) ++ _handle_spark_translator_qt_macro(${ARGN}) ++endmacro(translator_qt) +diff --git a/cmake/linuxdeployqt-help b/cmake/linuxdeployqt-help +index 12ac506..1b72fda 100644 +--- a/cmake/linuxdeployqt-help ++++ b/cmake/linuxdeployqt-help +@@ -45,4 +45,4 @@ Plugins related to a Qt library are copied in with the library. + + See the "Deploying Applications on Linux" topic in the + documentation for more information about deployment on Linux. +-zinface@zinface-PC:/tmp/tmp.5gmZKUqn9s$ +\ No newline at end of file ++zinface@zinface-PC:/tmp/tmp.5gmZKUqn9s$ +\ No newline at end of file +diff --git a/cmake/spark-appimage.desktop.in b/cmake/spark-appimage.desktop.in.txt +similarity index 83% +rename from cmake/spark-appimage.desktop.in +rename to cmake/spark-appimage.desktop.in.txt +index 228a84a..491716d 100644 +--- a/cmake/spark-appimage.desktop.in ++++ b/cmake/spark-appimage.desktop.in.txt +@@ -6,4 +6,4 @@ Icon=default + Comment=@APP_COMMENT@ + Terminal=true + Type=Application +-Categories=@APP_CATEGORIES@ +\ No newline at end of file ++Categories=@APP_CATEGORIES@; +\ No newline at end of file +diff --git a/cmake/package-deb.descript b/cmake/spark-deb-package.descript +similarity index 91% +rename from cmake/package-deb.descript +rename to cmake/spark-deb-package.descript +index 2b485d1..f352d6c 100644 +--- a/cmake/package-deb.descript ++++ b/cmake/spark-deb-package.descript +@@ -1,6 +1,6 @@ + # 注释行(使用方式) +-# find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) +-# add_package_descript(cmake/package-deb.descript) ++# find_package(SparkDebPackage PATHS ${CMAKE_SOURCE_DIR}) ++# add_package_descript(cmake/spark-deb-package.descript) + + # 打包后的文件名称 + # FileName: 待定 +@@ -38,7 +38,9 @@ Maintainer: shenmo + # 软件包主页 + Homepage: https://www.spark-app.store/ + # 软件包建议 +-Recommends: ++Recommends: ++# 软件冲突 ++Conflicts: + # 软件包描述信息 + Descrition: Spark Store + A community powered app store, based on DTK. +diff --git a/cmake/spark-desktop.desktop.in b/cmake/spark-desktop.desktop.in.txt +similarity index 88% +rename from cmake/spark-desktop.desktop.in +rename to cmake/spark-desktop.desktop.in.txt +index 0fa070b..75663a2 100644 +--- a/cmake/spark-desktop.desktop.in ++++ b/cmake/spark-desktop.desktop.in.txt +@@ -7,5 +7,7 @@ Type=@APP_TYPE@ + Exec=@APP_EXECUTE_PATH@ + Icon=@APP_EXECUTE_ICON_PATH@ + Categories=@APP_CATEGORIES@ ++MimeType=@APP_MIME_TYPE@ ++ ++# Generated from the DesktopGenerater component of the z-Tools toolkit + +-# Generated from the DesktopGenerater component of the z-Tools toolkit +\ No newline at end of file +-- +2.33.1 + diff --git a/pkg/etc/apt/preferences.d/sparkstore b/pkg/etc/apt/preferences.d/sparkstore new file mode 100644 index 0000000000000000000000000000000000000000..8c9cac3f282a59f95e33c1470757498ab58413ff --- /dev/null +++ b/pkg/etc/apt/preferences.d/sparkstore @@ -0,0 +1,3 @@ +Package: * +Pin: origin *.deepinos.org.cn +Pin-Priority: 400 diff --git a/pkg/lib/systemd/system/spark-update-notifier.service b/pkg/lib/systemd/system/spark-update-notifier.service new file mode 100644 index 0000000000000000000000000000000000000000..de8f8fa92559e23233e16d376f67ecbb7030458b --- /dev/null +++ b/pkg/lib/systemd/system/spark-update-notifier.service @@ -0,0 +1,14 @@ +[Unit] +Description=Spark Store update notifier +After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service + + +[Service] +Type=simple +RemainAfterExit=yes +ExecStart=/opt/durapps/spark-store/bin/update-upgrade/ss-update-notifier.sh +Restart=on-failure +RestartSec=10 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/pkg/lib/systemd/system/spark-update-notifier.timer b/pkg/lib/systemd/system/spark-update-notifier.timer new file mode 100644 index 0000000000000000000000000000000000000000..b8a48186e953a13fd7554ec83c47ca74e533eaea --- /dev/null +++ b/pkg/lib/systemd/system/spark-update-notifier.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Timer for Spark Update Notifier + +[Timer] +# 开机后第一次执行 +OnBootSec=1min +# 每天执行一次 +OnUnitActiveSec=1d + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/pkg/tmp/spark-store-install/feedback.sh b/pkg/tmp/spark-store-install/feedback.sh new file mode 100755 index 0000000000000000000000000000000000000000..007f97619495ffb4e27d513d7a0952cbec9313b3 --- /dev/null +++ b/pkg/tmp/spark-store-install/feedback.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +echo "From:sparkstorefeedback@163.com +To:sparkstorefeedback@163.com +Subject: spark-store_3.0.2: $(lsb_release -a | grep "Description" | sed -e "s#\t#@#" | cut -d "@" -f 2) + +$(uname -a)" | tee /tmp/spark-store-install/feedback.txt > /dev/null + +curl -s --url "smtp://smtp.163.com" --mail-from "${MAIL_FEEDBACK}" --mail-rcpt "${MAIL_FEEDBACK}" --upload-file /tmp/spark-store-install/feedback.txt --user "${MAIL_FEEDBACK}:${M}AIL_AUTH" diff --git a/pkg/usr/share/applications/open-me-in-terminal.desktop b/pkg/usr/share/applications/open-me-in-terminal.desktop new file mode 100644 index 0000000000000000000000000000000000000000..8502cbe50768051986236aa740b0823bb793a5c4 --- /dev/null +++ b/pkg/usr/share/applications/open-me-in-terminal.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Categories=Development; +Encoding=UTF-8 +Exec=/opt/durapps/spark-store/bin/open-in-terminal/open-in-terminal %U +Icon=open-me-in-terminal +MimeType=application/x-desktop +Name=Open me in terminal +Name[zh_CN]=在终端中打开 +NoDisplay=true +StartupWMClass=在终端中打开 +Terminal=true +Type=Application diff --git a/pkg/usr/share/applications/spark-store.desktop b/pkg/usr/share/applications/spark-store.desktop new file mode 100644 index 0000000000000000000000000000000000000000..d2090f55ff0b88dcc1b6c917237867124910f7d5 --- /dev/null +++ b/pkg/usr/share/applications/spark-store.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Categories=System; +Exec=spark-store %u +Icon=spark-store +Name=Spark Store +Name[zh_CN]=星火应用商店 +Keywords=appstore; +Terminal=false +StartupNotify=true +StartupWMClass=spark-store +MimeType=x-scheme-handler/spk diff --git a/pkg/usr/share/aptss/transhell/aptss_en_US.transhell b/pkg/usr/share/aptss/transhell/aptss_en_US.transhell new file mode 100644 index 0000000000000000000000000000000000000000..b74b38857cd6b1536bfe6e1c47829ff05709f373 --- /dev/null +++ b/pkg/usr/share/aptss/transhell/aptss_en_US.transhell @@ -0,0 +1,5 @@ +#!/bin/bash +TRANSHELL_CONTENT_RUNNING_IN_NOT_ROOT_USER="INFO:Running in non-root mode! If error occurs, please try to excute me as root." +TRANSHELL_CONTENT_INFO_SOURCES_LIST_D_IS_EMPTY="INFO:sources.list.d directory is empty,will not try to sync" +TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST="Getting server and mirror lists..." +TRANSHELL_CONTENT_PLEASE_USE_APTSS_INSTEAD_OF_APT="Please note: Although the error message suggests using \"apt\" (such as \"apt install --fix-broken\"), please use \"aptss\" instead of \"apt\" when troubleshooting errors (for example, change to \"aptss install --fix-broken\")." diff --git a/pkg/usr/share/aptss/transhell/aptss_zh_CN.transhell b/pkg/usr/share/aptss/transhell/aptss_zh_CN.transhell new file mode 100644 index 0000000000000000000000000000000000000000..97d8e948cbbde289356cdbee946cb1267e01942f --- /dev/null +++ b/pkg/usr/share/aptss/transhell/aptss_zh_CN.transhell @@ -0,0 +1,5 @@ +#!/bin/bash +TRANSHELL_CONTENT_RUNNING_IN_NOT_ROOT_USER="信息:正在使用非root权限模式启动!若出现问题,请尝试使用root权限执行指令" +TRANSHELL_CONTENT_INFO_SOURCES_LIST_D_IS_EMPTY="信息:sources.list.d文件夹是空的,将不会尝试同步" +TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST="从服务器获取配置和镜像列表..." +TRANSHELL_CONTENT_PLEASE_USE_APTSS_INSTEAD_OF_APT="注意:尽管报错信息中提示使用apt(如apt install --fix-broken),请在排查错误的时候使用aptss而不是apt(对于例子,改为使用 aptss install --fix-broken)." diff --git a/pkg/usr/share/bash-completion/completions/aptss b/pkg/usr/share/bash-completion/completions/aptss new file mode 100644 index 0000000000000000000000000000000000000000..91e12ef6606cb932af6ca99fa542e358324a0277 --- /dev/null +++ b/pkg/usr/share/bash-completion/completions/aptss @@ -0,0 +1,228 @@ +# Debian apt(8) completion -*- shell-script -*- + +_aptss() +{ + local sourcesdir="/etc/apt/sources.list.d" + local cur prev words cword + _init_completion || return + + local GENERIC_APT_GET_OPTIONS=' + -d --download-only + -y --assume-yes + --assume-no + -u --show-upgraded + -m --ignore-missing + -t --target-release + --download + --fix-missing + --ignore-hold + --upgrade + --only-upgrade + --allow-change-held-packages + --allow-remove-essential + --allow-downgrades + --print-uris + --trivial-only + --remove + --arch-only + --allow-unauthenticated + --allow-insecure-repositories + --install-recommends + --install-suggests + --no-install-recommends + --no-install-suggests + --fix-policy + ' + + # see if the user selected a command already + local COMMANDS=( + "ssupdate" + "list" + "search" + "show" "showsrc" + "install" "remove" "purge" "autoremove" "autopurge" + "update" + "upgrade" "full-upgrade" "dist-upgrade" + "edit-sources" + "help" + "source" "build-dep" + "clean" "autoclean" + "download" "changelog" + "moo" + "depends" "rdepends" + "policy") + + local command i + for (( i=0; i < ${#words[@]}-1; i++ )); do + if [[ ${COMMANDS[@]} =~ ${words[i]} ]]; then + command=${words[i]} + break + fi + done + + # Complete a -t + case $prev in + -t|--target-release) + COMPREPLY=( $( compgen -W "$( apt-cache policy -o Dir::Cache="/var/lib/aptss/" | egrep -o 'a=[^,]*|n=[^,]*' | cut -f2- -d= | sort -u)" -- "$cur" ) ) + return 0 + ;; + esac + + # supported options per command + if [[ "$cur" == -* ]]; then + case $command in + install|remove|purge|upgrade|dist-upgrade|full-upgrade|autoremove) + COMPREPLY=( $( compgen -W '--show-progress + --fix-broken --purge --verbose-versions --auto-remove + -s --simulate --dry-run + --download + --fix-missing + --fix-policy + --ignore-hold + --force-yes + --trivial-only + --reinstall --solver + -t --target-release'"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) + return 0 + ;; + update) + COMPREPLY=( $( compgen -W '--list-cleanup + --print-uris + --allow-insecure-repositories + ' -- "$cur" ) ) + return 0 + ;; + list) + COMPREPLY=( $( compgen -W '--installed --upgradable + --manual-installed + -v --verbose + -a --all-versions + -t --target-release + ' -- "$cur" ) ) + return 0 + ;; + show) + COMPREPLY=( $( compgen -W '-a --all-versions + ' -- "$cur" ) ) + return 0 + ;; + depends|rdepends) + COMPREPLY=( $( compgen -W '-i + --important + --installed + --pre-depends + --depends + --recommends + --suggests + --replaces + --breaks + --conflicts + --enhances + --recurse + --implicit' -- "$cur" ) ) + return 0 + ;; + search) + COMPREPLY=( $( compgen -W ' + -n --names-only + -f --full' -- "$cur" ) ) + return 0 + ;; + showsrc) + COMPREPLY=( $( compgen -W ' + --only-source' -- "$cur" ) ) + return 0 + ;; + source) + COMPREPLY=( $( compgen -W ' + -s --simulate --dry-run + -b --compile --build + -P --build-profiles + --diff-only --debian-only + --tar-only + --dsc-only + -t --target-release + '"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) + return 0 + ;; + build-dep) + COMPREPLY=( $( compgen -W ' + -a --host-architecture + -s --simulate --dry-run + -P --build-profiles + -t --target-release + --purge --solver + '"$GENERIC_APT_GET_OPTIONS" -- "$cur" ) ) + return 0 + ;; + moo) + COMPREPLY=( $( compgen -W ' + --color + ' -- "$cur" ) ) + return 0 + ;; + clean|autoclean) + COMPREPLY=( $( compgen -W ' + -s --simulate --dry-run + ' -- "$cur" ) ) + return 0 + ;; + esac + fi + + # specific command arguments + if [[ -n $command ]]; then + case $command in + remove|purge|autoremove) + if [[ -f /etc/debian_version ]]; then + # Debian system + COMPREPLY=( $( \ + _xfunc dpkg _comp_dpkg_installed_packages $cur ) ) + else + # assume RPM based + _xfunc rpm _rpm_installed_packages + fi + return 0 + ;; + show|list|download|changelog|depends|rdepends) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \ + 2> /dev/null ) ) + return 0 + ;; + install) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \ + 2> /dev/null ) ) + if [[ "$cur" == ./* || "$cur" == /* ]]; then + _filedir "deb" + fi + return 0 + ;; + source|build-dep|showsrc|policy) + COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" -o Dir::Cache="/var/lib/aptss/" \ + 2> /dev/null ) $( apt-cache dumpavail -o Dir::Cache="/var/lib/aptss/" | \ + command grep "^Source: $cur" | sort -u | cut -f2 -d" " ) ) + return 0 + ;; + edit-sources) + COMPREPLY=( $( compgen -W '$( command ls $sourcesdir )' \ + -- "$cur" ) ) + return 0 + ;; + moo) + COMPREPLY=( $( compgen -W 'moo' \ + -- "$cur" ) ) + return 0 + ;; + esac + fi + + # no command yet, show what commands we have + if [ "$command" = "" ]; then + COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "$cur" ) ) + fi + + return 0 +} && +complete -F _aptss aptss + +# ex: ts=4 sw=4 et filetype=sh diff --git a/pkg/usr/share/dsg/org.deepin.dtkwidget.feature-display.json b/pkg/usr/share/dsg/org.deepin.dtkwidget.feature-display.json new file mode 100644 index 0000000000000000000000000000000000000000..8d1bbeef4fc1bd0da0e4bac1ee7b81f7ef5813a2 --- /dev/null +++ b/pkg/usr/share/dsg/org.deepin.dtkwidget.feature-display.json @@ -0,0 +1,26 @@ +{ + "magic": "dsg.config.meta", + "version": "1.0", + "contents": { + "featureUpdated": { + "value": false, + "serial": 0, + "flags": [], + "name": "Whether the application has new feature updates", + "name[zh_CN]": "配置应用的更新状态", + "description": "Configure the update status of the application", + "permissions": "readwrite", + "visibility": "public" + }, + "autoDisplayFeature": { + "value": false, + "serial": 0, + "flags": [], + "name": "The application automatically display new features once", + "name[zh_CN]": "配置应用是否自动展示一次新特性", + "description": "The application automatically display updated contents once", + "permissions": "readwrite", + "visibility": "public" + } + } +} \ No newline at end of file diff --git a/pkg/usr/share/fish/completions/aptss.fish b/pkg/usr/share/fish/completions/aptss.fish new file mode 100644 index 0000000000000000000000000000000000000000..0bb08fa5fa55dc51f519bb703ed65601c3861f03 --- /dev/null +++ b/pkg/usr/share/fish/completions/aptss.fish @@ -0,0 +1,242 @@ +# 清除已有的 aptss 补全(如果有的话) +complete -c aptss -e + +# 禁用默认的文件补全(避免显示当前目录文件) +complete -c aptss -f + +######################################################################## +# aptss Fish 补全脚本(中文说明版,软件包补全显示简介) +# +# 说明: +# 1. 子命令和选项的说明采用中文显示。 +# 2. 软件包补全部分不再调用 apt-cache,而是解析 aptss 自有的软件源索引文件, +# 从 /var/lib/aptss/lists/*Packages(或 *Sources)中提取软件包名称及简介信息。 +# +# 注意:如果你的 aptss 软件源索引文件位置或格式有变化,请相应修改下面的 awk 命令。 +######################################################################## + +### 辅助函数 + +# 解析 /var/lib/aptss/lists/*Packages 文件,输出符合当前输入前缀的“软件包简介” +function __fish_aptss_print_packages + set cur (commandline -ct) + # 将所有匹配的 Packages 文件拼接后,用 awk 分段解析(RS="" 表示以空行为分段) + awk -v cur="$cur" ' + BEGIN { RS=""; FS="\n" } + { + pkg = ""; desc = ""; + for(i=1; i<=NF; i++){ + if($i ~ /^Package: /) { pkg = substr($i, 10) } # “Package: ”共9个字符 + else if($i ~ /^Description: /) { desc = substr($i, 14) } # “Description: ”共13个字符 + } + if(pkg != "" && (cur == "" || pkg ~ ("^" cur))) { + print pkg "\t" desc + } + } + ' /var/lib/aptss/lists/*Packages 2>/dev/null +end + +# 解析已安装软件包(这里仍使用 dpkg-query,如果需要使用 aptss 数据,可另外构造) +function __fish_aptss_print_installed_packages + set cur (commandline -ct) + dpkg-query -W -f='${Package}\t${Description}\n' 2>/dev/null | grep -i "^$cur" +end + +# 解析 /var/lib/aptss/lists/*Sources 文件,输出源代码包信息(如果存在) +function __fish_aptss_print_source_packages + set cur (commandline -ct) + awk -v cur="$cur" ' + BEGIN { RS=""; FS="\n" } + { + pkg = ""; desc = ""; + for(i=1; i<=NF; i++){ + if($i ~ /^Package: /) { pkg = substr($i, 10) } + else if($i ~ /^Description: /) { desc = substr($i, 14) } + } + if(pkg != "" && (cur == "" || pkg ~ ("^" cur))) { + print pkg "\t" desc + } + } + ' /var/lib/aptss/lists/*Sources 2>/dev/null +end + +# 翻译子命令为中文说明(用于补全时显示在括号内) +function __fish_translate_aptss_cmd + switch $argv[1] + case ssupdate + echo "更新软件源" + case list + echo "列出软件包" + case search + echo "搜索软件包" + case show + echo "显示软件包信息" + case showsrc + echo "显示源包信息" + case install + echo "安装软件包" + case remove + echo "移除软件包" + case purge + echo "彻底移除软件包" + case autoremove + echo "自动移除不必要的软件包" + case update + echo "更新软件包列表" + case upgrade + echo "升级软件包" + case full-upgrade + echo "完全升级(可能移除其他软件包)" + case dist-upgrade + echo "发行版升级" + case edit-sources + echo "编辑软件源列表" + case help + echo "显示帮助信息" + case source + echo "下载源代码包" + case build-dep + echo "安装构建依赖" + case clean + echo "清除软件包缓存" + case autoclean + echo "自动清理旧缓存" + case download + echo "下载软件包" + case changelog + echo "显示更新日志" + case moo + echo "彩蛋" + case depends + echo "显示软件包依赖" + case rdepends + echo "显示软件包逆向依赖" + case policy + echo "显示软件包策略" + case '*' + echo $argv[1] + end +end + +### 定义各类子命令组 + +# 所有子命令列表 +set -g __aptss_commands ssupdate list search show showsrc install remove purge autoremove update upgrade full-upgrade dist-upgrade edit-sources help source build-dep clean autoclean download changelog moo depends rdepends policy + +# 需要补全二进制软件包名称的子命令(例如 install、show、search、download、changelog、depends、rdepends) +set -l __aptss_pkg_subcmds install show search download changelog depends rdepends + +# 需要补全已安装软件包的子命令(例如 remove、purge、autoremove) +set -l __aptss_installed_pkg_subcmds remove purge autoremove + +# 需要补全源代码包的子命令(例如 source、build-dep、showsrc、policy) +set -l __aptss_src_pkg_subcmds source build-dep showsrc policy + +### 子命令补全 +# 未输入子命令时,显示所有候选子命令,并在括号中显示中文说明 +for cmd in $__aptss_commands + set desc (__fish_translate_aptss_cmd $cmd) + complete -c aptss -a $cmd -d "$desc" -n "not __fish_seen_subcommand_from $__aptss_commands" +end + +### 公共选项(适用于一组子命令) +set -l group1 "install remove purge upgrade dist-upgrade full-upgrade autoremove" + +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l show-progress -d '显示进度' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l fix-broken -d '修复损坏的依赖' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l purge -d '清除配置文件' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l verbose-versions -d '显示详细版本' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l auto-remove -d '自动移除依赖' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -s s -l simulate -d '模拟/试运行' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l download -d '下载软件包' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l fix-missing -d '修复丢失文件' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l fix-policy -d '修复策略' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l ignore-hold -d '忽略锁定' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l force-yes -d '强制确认' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l trivial-only -d '仅处理简单情况' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l reinstall -d '重新安装' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l solver -d '使用求解器' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -s t -l target-release -d '目标版本' + +# 附加的 GENERIC 选项 +complete -c aptss -n "__fish_seen_subcommand_from $group1" -s d -l download-only -d '仅下载' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -s y -l assume-yes -d '默认确认' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -l assume-no -d '默认否定' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -s u -l show-upgraded -d '显示升级情况' +complete -c aptss -n "__fish_seen_subcommand_from $group1" -s m -l ignore-missing -d '忽略缺失' + +### 针对各个子命令的专用选项 + +# update 命令 +complete -c aptss -n "__fish_seen_subcommand_from update" -l list-cleanup -d '清理列表' +complete -c aptss -n "__fish_seen_subcommand_from update" -l print-uris -d '显示 URI' +complete -c aptss -n "__fish_seen_subcommand_from update" -l allow-insecure-repositories -d '允许不安全的仓库' + +# list 命令 +complete -c aptss -n "__fish_seen_subcommand_from list" -l installed -d '已安装的软件包' +complete -c aptss -n "__fish_seen_subcommand_from list" -l upgradable -d '可升级的软件包' +complete -c aptss -n "__fish_seen_subcommand_from list" -l manual-installed -d '手动安装的软件包' +complete -c aptss -n "__fish_seen_subcommand_from list" -s v -l verbose -d '详细模式' +complete -c aptss -n "__fish_seen_subcommand_from list" -s a -l all-versions -d '显示所有版本' +complete -c aptss -n "__fish_seen_subcommand_from list" -s t -l target-release -d '目标版本' + +# show 命令 +complete -c aptss -n "__fish_seen_subcommand_from show" -s a -l all-versions -d '显示所有版本' + +# depends 和 rdepends 命令(逐项添加各选项) +for opt in i important installed pre-depends depends recommends suggests replaces breaks conflicts enhances recurse implicit + complete -c aptss -n "__fish_seen_subcommand_from depends rdepends" -l $opt -d $opt +end +complete -c aptss -n "__fish_seen_subcommand_from depends rdepends" -s i -d '选项 -i' + +# search 命令 +complete -c aptss -n "__fish_seen_subcommand_from search" -s n -l names-only -d '仅匹配名称' +complete -c aptss -n "__fish_seen_subcommand_from search" -s f -l full -d '全文搜索' + +# showsrc 命令 +complete -c aptss -n "__fish_seen_subcommand_from showsrc" -l only-source -d '仅显示源代码' + +# source 命令 +complete -c aptss -n "__fish_seen_subcommand_from source" -s s -l simulate -d '模拟' +complete -c aptss -n "__fish_seen_subcommand_from source" -s b -l compile -d '编译/构建' +complete -c aptss -n "__fish_seen_subcommand_from source" -s P -l build-profiles -d '构建配置' +complete -c aptss -n "__fish_seen_subcommand_from source" -l diff-only -d '仅显示差异' +complete -c aptss -n "__fish_seen_subcommand_from source" -l debian-only -d '仅限 Debian' +complete -c aptss -n "__fish_seen_subcommand_from source" -l tar-only -d '仅打包 tar' +complete -c aptss -n "__fish_seen_subcommand_from source" -l dsc-only -d '仅下载 DSC' +complete -c aptss -n "__fish_seen_subcommand_from source" -s t -l target-release -d '目标版本' + +# build-dep 命令 +complete -c aptss -n "__fish_seen_subcommand_from build-dep" -s a -l host-architecture -d '主机架构' +complete -c aptss -n "__fish_seen_subcommand_from build-dep" -s s -l simulate -d '模拟' +complete -c aptss -n "__fish_seen_subcommand_from build-dep" -s P -l build-profiles -d '构建配置' +complete -c aptss -n "__fish_seen_subcommand_from build-dep" -s t -l target-release -d '目标版本' +complete -c aptss -n "__fish_seen_subcommand_from build-dep" -l purge -d '清除' +complete -c aptss -n "__fish_seen_subcommand_from build-dep" -l solver -d '求解依赖' + +# moo 命令 +complete -c aptss -n "__fish_seen_subcommand_from moo" -l color -d '彩蛋模式' + +# clean 和 autoclean 命令 +complete -c aptss -n "__fish_seen_subcommand_from clean autoclean" -s s -l simulate -d '模拟' + +### 针对 -t/--target-release 的特殊补全 +complete -c aptss -n ' + begin + set -l prev (commandline -poc | string trim) + test "$prev" = "-t" -o "$prev" = "--target-release" + end +' -a '(__fish_aptss_target_release)' -d '目标版本' + +### 软件包补全 +# 对于需要二进制软件包名称的子命令,调用 __fish_aptss_print_packages, +# 输出的每一行格式为 "包名简介",Fish 会将 TAB 后内容显示为注释。 +complete -c aptss -n "__fish_seen_subcommand_from $__aptss_pkg_subcmds" -a '(__fish_aptss_print_packages)' + +# 对于 remove、purge、autoremove 命令,补全已安装的软件包(使用 dpkg-query 输出) +complete -c aptss -n "__fish_seen_subcommand_from $__aptss_installed_pkg_subcmds" -a '(__fish_aptss_print_installed_packages)' -d '已安装软件包' + +# 对于 source、build-dep、showsrc、policy 命令,补全源代码包, +# 如果存在对应的 Sources 索引文件,则调用 __fish_aptss_print_source_packages, +# 否则可考虑默认使用二进制包的索引。 +complete -c aptss -n "__fish_seen_subcommand_from $__aptss_src_pkg_subcmds" -a '(__fish_aptss_print_source_packages)' -d '源代码包' diff --git a/pkg/usr/share/icons/hicolor/512x512/apps/open-me-in-terminal.png b/pkg/usr/share/icons/hicolor/512x512/apps/open-me-in-terminal.png new file mode 100644 index 0000000000000000000000000000000000000000..bdcabb7f5be62ad8eb0ff8152b1d9c5eccc3ab3f Binary files /dev/null and b/pkg/usr/share/icons/hicolor/512x512/apps/open-me-in-terminal.png differ diff --git a/pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg b/pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg new file mode 100644 index 0000000000000000000000000000000000000000..a84891b75c05348e2aea6f95df77c93bc992bea7 --- /dev/null +++ b/pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pkg/usr/share/polkit-1/actions/store.spark-app.ssinstall.policy b/pkg/usr/share/polkit-1/actions/store.spark-app.ssinstall.policy new file mode 100644 index 0000000000000000000000000000000000000000..8b2111b7add70f1598edaf47a34b7dd7e1a6d0bf --- /dev/null +++ b/pkg/usr/share/polkit-1/actions/store.spark-app.ssinstall.policy @@ -0,0 +1,18 @@ + + + + Spark Store + x-package-repository + + 运行ssinstall需要权限 + 要使用ssinstall需要权限 + + yes + yes + yes + + /usr/local/bin/ssinstall + true + + diff --git a/pkg/usr/share/polkit-1/actions/store.spark-update-tool.policy b/pkg/usr/share/polkit-1/actions/store.spark-update-tool.policy new file mode 100644 index 0000000000000000000000000000000000000000..012a66abdf8f189ba1bd67c72bf7b23bbbd4bff1 --- /dev/null +++ b/pkg/usr/share/polkit-1/actions/store.spark-update-tool.policy @@ -0,0 +1,16 @@ + + + + + Run the Spark Update Tool + Authentication is required to update the system + /usr/bin/spark-update-tool + true + + yes + no + + + diff --git a/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_en_US.transhell b/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_en_US.transhell new file mode 100644 index 0000000000000000000000000000000000000000..7d3fbf1d0c0aeea8e679ff457e22854cabaad53c --- /dev/null +++ b/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_en_US.transhell @@ -0,0 +1,6 @@ +#!/bin/bash +TRANSHELL_CONTENT_HASH_CHECK_FAILED="Failed in checking package hash! \nPossibly reason can be the package is broken, laggy in sync of Spark Store repository, or, there is a malware attempt to attack. \nIf you don't know what happend, please try install again after execute the command below\n sudo aptss update\n\nIf the problem still happen, please click APP Feedback button in the APP information page to feedback to us.\n\n If you are in the Audition Group,Please use ssaudit instead of ssinstall to audit APPs,for ssinstall is used for password-free install now.\nIf you want to install an app that is removed from Spark Store repository,you can also use ssaudit." +TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT="Please run ssinstall as root" +TRANSHELL_CONTENT_FILE_NOT_EXIST="File not exist" +TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB="No delete after install option given, will not delete the deb" +TRANSHELL_CONTENT_DEB_IS_DELETED="--delete-after-install option is given and the installation is succeeded, delete the deb file." diff --git a/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_zh_CN.transhell b/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_zh_CN.transhell new file mode 100644 index 0000000000000000000000000000000000000000..680af76c9b7be571c566806f10c4bdedd882237b --- /dev/null +++ b/pkg/usr/share/ssinstall-local/transhell/ssinstall-local_zh_CN.transhell @@ -0,0 +1,6 @@ +#!/bin/bash +TRANSHELL_CONTENT_HASH_CHECK_FAILED="软件包校验失败!这不应该发生!\n可能是因为软件包已损坏,星火仓库未同步,或者最坏的情况:恶意软件尝试利用自动安装来入侵系统!\n如果你不清楚发生了什么,请执行 sudo aptss update 后再尝试安装。\n如果问题仍然存在,请在应用信息界面点击 应用反馈 来提交反馈给我们!\n\n 如果你是审核人员,请使用 ssaudit来替代ssinstall进行审核工作,因为现在ssinstall已经被用于免密安装。\n如果你正在尝试安装已经下架的星火应用,也可用ssaudit来替代ssinstall" +TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT="请使用root启动ssinstall" +TRANSHELL_CONTENT_FILE_NOT_EXIST="文件不存在" +TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB="未指定安装后删除或安装出错,不删除deb包" +TRANSHELL_CONTENT_DEB_IS_DELETED="使用了--delete-after-install选项且安装未出错,删除deb包" diff --git a/pkg/usr/share/ssinstall/transhell/ssinstall_en_US.transhell b/pkg/usr/share/ssinstall/transhell/ssinstall_en_US.transhell new file mode 100644 index 0000000000000000000000000000000000000000..7d3fbf1d0c0aeea8e679ff457e22854cabaad53c --- /dev/null +++ b/pkg/usr/share/ssinstall/transhell/ssinstall_en_US.transhell @@ -0,0 +1,6 @@ +#!/bin/bash +TRANSHELL_CONTENT_HASH_CHECK_FAILED="Failed in checking package hash! \nPossibly reason can be the package is broken, laggy in sync of Spark Store repository, or, there is a malware attempt to attack. \nIf you don't know what happend, please try install again after execute the command below\n sudo aptss update\n\nIf the problem still happen, please click APP Feedback button in the APP information page to feedback to us.\n\n If you are in the Audition Group,Please use ssaudit instead of ssinstall to audit APPs,for ssinstall is used for password-free install now.\nIf you want to install an app that is removed from Spark Store repository,you can also use ssaudit." +TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT="Please run ssinstall as root" +TRANSHELL_CONTENT_FILE_NOT_EXIST="File not exist" +TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB="No delete after install option given, will not delete the deb" +TRANSHELL_CONTENT_DEB_IS_DELETED="--delete-after-install option is given and the installation is succeeded, delete the deb file." diff --git a/pkg/usr/share/ssinstall/transhell/ssinstall_zh_CN.transhell b/pkg/usr/share/ssinstall/transhell/ssinstall_zh_CN.transhell new file mode 100644 index 0000000000000000000000000000000000000000..680af76c9b7be571c566806f10c4bdedd882237b --- /dev/null +++ b/pkg/usr/share/ssinstall/transhell/ssinstall_zh_CN.transhell @@ -0,0 +1,6 @@ +#!/bin/bash +TRANSHELL_CONTENT_HASH_CHECK_FAILED="软件包校验失败!这不应该发生!\n可能是因为软件包已损坏,星火仓库未同步,或者最坏的情况:恶意软件尝试利用自动安装来入侵系统!\n如果你不清楚发生了什么,请执行 sudo aptss update 后再尝试安装。\n如果问题仍然存在,请在应用信息界面点击 应用反馈 来提交反馈给我们!\n\n 如果你是审核人员,请使用 ssaudit来替代ssinstall进行审核工作,因为现在ssinstall已经被用于免密安装。\n如果你正在尝试安装已经下架的星火应用,也可用ssaudit来替代ssinstall" +TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT="请使用root启动ssinstall" +TRANSHELL_CONTENT_FILE_NOT_EXIST="文件不存在" +TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB="未指定安装后删除或安装出错,不删除deb包" +TRANSHELL_CONTENT_DEB_IS_DELETED="使用了--delete-after-install选项且安装未出错,删除deb包" diff --git a/spark-update-tool/.gitignore b/spark-update-tool/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..79c9ac747f0c3456ff6cb7038d7f8ccbded49aa5 --- /dev/null +++ b/spark-update-tool/.gitignore @@ -0,0 +1,62 @@ +build +.vscode +.cache +CMakeLists.txt.user +CMakeLists.txt.user.* +obj-x86_64-linux-gnu +# C++ objects and libs +*.slo +*.lo +*.o +*.a +*.la +*.lai +*.so +*.dll +*.dylib + +# Qt-es +object_script.*.Release +object_script.*.Debug +*_plugin_import.cpp +/.qmake.cache +/.qmake.stash +*.pro.user +*.pro.user.* +*.qbs.user +*.qbs.user.* +*.moc +moc_*.cpp +moc_*.h +qrc_*.cpp +ui_*.h +*.qmlc +*.jsc +Makefile* +*build-* + +# Qt unit tests +target_wrapper.* + +# Qt qm files +translations/*.qm + +# QtCreator +*.autosave + +# QtCreator Qml +*.qmlproject.user +*.qmlproject.user.* + +# QtCreator CMake +CMakeLists.txt.user* +build + +# Debian dpkg-buildpackage +debian/*.debhelper* +debian/files +debian/*.substvars +debian/spark-update-tool + +.vscode/* +src/spark-update-tool diff --git a/spark-update-tool/CMakeLists.txt b/spark-update-tool/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c624b4124ab1ed429631b3c37067b6a54087247 --- /dev/null +++ b/spark-update-tool/CMakeLists.txt @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 3.16) + +project(spark-update-tool VERSION 0.1 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) + +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network Concurrent) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network Concurrent) + +set(PROJECT_SOURCES + src/main.cpp + src/mainwindow.cpp + src/mainwindow.h + src/mainwindow.ui +) + +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + qt_add_executable(spark-update-tool + MANUAL_FINALIZATION + ${PROJECT_SOURCES} + src/aptssupdater.h src/aptssupdater.cpp + src/icons.qrc + src/appdelegate.h src/appdelegate.cpp + src/applistmodel.h src/applistmodel.cpp + src/downloadmanager.h src/downloadmanager.cpp + ) +# Define target properties for Android with Qt 6 as: +# set_property(TARGET spark-update-tool APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR +# ${CMAKE_CURRENT_SOURCE_DIR}/android) +# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation +else() + if(ANDROID) + add_library(spark-update-tool SHARED + ${PROJECT_SOURCES} + ) +# Define properties for Android with Qt 5 after find_package() calls as: +# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") + else() + add_executable(spark-update-tool + ${PROJECT_SOURCES} + ) + endif() +endif() + +target_link_libraries(spark-update-tool PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Concurrent) + +# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. +# If you are developing for iOS or macOS you should consider setting an +# explicit, fixed bundle identifier manually though. +if(${QT_VERSION} VERSION_LESS 6.1.0) + set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.spark-update-tool) +endif() +set_target_properties(spark-update-tool PROPERTIES + ${BUNDLE_ID_OPTION} + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE +) + +include(GNUInstallDirs) +install(TARGETS spark-update-tool + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +if(QT_VERSION_MAJOR EQUAL 6) + qt_finalize_executable(spark-update-tool) +endif() diff --git a/spark-update-tool/LICENSE b/spark-update-tool/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..3877ae0a7ff6f94ac222fd704e112723db776114 --- /dev/null +++ b/spark-update-tool/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/spark-update-tool/README.md b/spark-update-tool/README.md new file mode 100644 index 0000000000000000000000000000000000000000..778029c221a0805c9647f56e8c7b83d71322b8ff --- /dev/null +++ b/spark-update-tool/README.md @@ -0,0 +1,15 @@ +### Spark Update Tool +#### Introduction + +Welcome to Spark Software Updater. Use this tool to update applications on your Linux system. +This version is specifically designed for Linux distributions with Qt6 support. +Please run under root privileges (recommended: use `sudo`). +#### Currently Supported Linux Distributions +- [x] GXDE OS +- [x] Ubuntu +- [x] deepin +- [ ] Kylin + + +#### Contact & Feedback +momen@momen.world diff --git a/spark-update-tool/README.zh.md b/spark-update-tool/README.zh.md new file mode 100644 index 0000000000000000000000000000000000000000..c597ce448be3bab03e01bc2a09b74b9a3c3525e7 --- /dev/null +++ b/spark-update-tool/README.zh.md @@ -0,0 +1,25 @@ +### 星火软件更新器 +#### 简介 + +欢迎使用星火软件更新器,您可以使用此更新器更新位于您 Linux 计算机的程序。 +此版本专为有qt6的Linux发行版所使用。 +请在root环境下运行。 +#### 当前支持的 Linux 发行版 +- [x] GXDE OS +- [x] Ubuntu +- [x] deepin +- [ ] Kylin + +#### 功能清单 + +| 功能模块 | 描述 | +|------------------|--------------------------------------| +| 应用名识别 | 基于 `ss-do-upgrade.sh` 部分代码实现 | +| 应用包大小识别 | 通过 dpkg 获取包大小信息 | +| 获取应用图标 | 利用 QDesktopServices 实现 | +| 支持 ACE 兼容环境| | +| 多线程下载 | 基于 aptss 方案 | + +如您已安装星火应用商店,则会附带本程序。 +#### 联系与反馈 +momen@momen.world \ No newline at end of file diff --git a/spark-update-tool/debian/changelog b/spark-update-tool/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..b414feaa62fe2af76faad258dcb2e6256d7b272c --- /dev/null +++ b/spark-update-tool/debian/changelog @@ -0,0 +1,5 @@ +spark-update-tool (1.0.0) unstable; urgency=low + + * Initial release. + + -- momen Wed, 18 Jun 2025 00:00:00 +0000 \ No newline at end of file diff --git a/spark-update-tool/debian/compat b/spark-update-tool/debian/compat new file mode 100644 index 0000000000000000000000000000000000000000..f11c82a4cb6cc2e8f3bdf52b5cdeaad4d5bb214e --- /dev/null +++ b/spark-update-tool/debian/compat @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/spark-update-tool/debian/control b/spark-update-tool/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..19c9d62467db6f87af7ff74c3aae2c2ef5a921fe --- /dev/null +++ b/spark-update-tool/debian/control @@ -0,0 +1,13 @@ +Source: spark-update-tool +Section: utils +Priority: optional +Maintainer: momen +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.6 +Homepage: https://gitee.com/spark-store-project/Spark-Update-Tool + +Package: spark-update-tool +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Spark Update Tool + 星火应用商店更新组件。This package provides the Spark Update Tool. It includes features for checking for updates, downloading, and applying them seamlessly. \ No newline at end of file diff --git a/spark-update-tool/debian/copyright b/spark-update-tool/debian/copyright new file mode 100644 index 0000000000000000000000000000000000000000..163489ed5542380605ce4603456e9658d8c72a3a --- /dev/null +++ b/spark-update-tool/debian/copyright @@ -0,0 +1,7 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: spark-update-tool +Source: https://gitee.com/spark-store-project/Spark-Update-Tool + +Files: * +Copyright: 2025, momen +License: GPL-3.0+ \ No newline at end of file diff --git a/debian/install b/spark-update-tool/debian/install similarity index 100% rename from debian/install rename to spark-update-tool/debian/install diff --git a/debian/postrm b/spark-update-tool/debian/postrm similarity index 100% rename from debian/postrm rename to spark-update-tool/debian/postrm diff --git a/spark-update-tool/debian/rules b/spark-update-tool/debian/rules new file mode 100755 index 0000000000000000000000000000000000000000..1159ac4f0b7d8abe9203098f7b5da03c42c24257 --- /dev/null +++ b/spark-update-tool/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_auto_configure: + dh_auto_configure -- -DCMAKE_INSTALL_PREFIX=/usr diff --git a/spark-update-tool/debian/source/format b/spark-update-tool/debian/source/format new file mode 100644 index 0000000000000000000000000000000000000000..9f6742789cd14191dbf0065f875340a67a042086 --- /dev/null +++ b/spark-update-tool/debian/source/format @@ -0,0 +1 @@ +3.0 (native) \ No newline at end of file diff --git a/debian/spark-update-tool.desktop b/spark-update-tool/debian/spark-update-tool.desktop similarity index 100% rename from debian/spark-update-tool.desktop rename to spark-update-tool/debian/spark-update-tool.desktop diff --git a/resources/128*128/spark-update-tool.png b/spark-update-tool/resources/128*128/spark-update-tool.png similarity index 100% rename from resources/128*128/spark-update-tool.png rename to spark-update-tool/resources/128*128/spark-update-tool.png diff --git a/resources/default_icon.svg b/spark-update-tool/resources/default_icon.svg similarity index 100% rename from resources/default_icon.svg rename to spark-update-tool/resources/default_icon.svg diff --git a/resources/down_arrow.svg b/spark-update-tool/resources/down_arrow.svg similarity index 100% rename from resources/down_arrow.svg rename to spark-update-tool/resources/down_arrow.svg diff --git a/resources/spark-update-tool.svg b/spark-update-tool/resources/spark-update-tool.svg similarity index 100% rename from resources/spark-update-tool.svg rename to spark-update-tool/resources/spark-update-tool.svg diff --git a/src/appdelegate.cpp b/spark-update-tool/src/appdelegate.cpp similarity index 100% rename from src/appdelegate.cpp rename to spark-update-tool/src/appdelegate.cpp diff --git a/src/appdelegate.h b/spark-update-tool/src/appdelegate.h similarity index 100% rename from src/appdelegate.h rename to spark-update-tool/src/appdelegate.h diff --git a/src/applistmodel.cpp b/spark-update-tool/src/applistmodel.cpp similarity index 100% rename from src/applistmodel.cpp rename to spark-update-tool/src/applistmodel.cpp diff --git a/src/applistmodel.h b/spark-update-tool/src/applistmodel.h similarity index 100% rename from src/applistmodel.h rename to spark-update-tool/src/applistmodel.h diff --git a/src/aptssupdater.cpp b/spark-update-tool/src/aptssupdater.cpp similarity index 100% rename from src/aptssupdater.cpp rename to spark-update-tool/src/aptssupdater.cpp diff --git a/src/aptssupdater.h b/spark-update-tool/src/aptssupdater.h similarity index 100% rename from src/aptssupdater.h rename to spark-update-tool/src/aptssupdater.h diff --git a/src/downloadmanager.cpp b/spark-update-tool/src/downloadmanager.cpp similarity index 100% rename from src/downloadmanager.cpp rename to spark-update-tool/src/downloadmanager.cpp diff --git a/src/downloadmanager.h b/spark-update-tool/src/downloadmanager.h similarity index 100% rename from src/downloadmanager.h rename to spark-update-tool/src/downloadmanager.h diff --git a/src/icons.qrc b/spark-update-tool/src/icons.qrc similarity index 100% rename from src/icons.qrc rename to spark-update-tool/src/icons.qrc diff --git a/spark-update-tool/src/main.cpp b/spark-update-tool/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a3df5a4312ec4aa1ab077ce7d200b51a928e7f71 --- /dev/null +++ b/spark-update-tool/src/main.cpp @@ -0,0 +1,86 @@ +#include "mainwindow.h" +#include +#include +#include +#include // for geteuid +#include // for getenv +#include // For debugging output + +bool isRoot() { + return geteuid() == 0; +} + +bool elevateToRoot() { + QString program = QCoreApplication::applicationFilePath(); + qDebug() << "Current application path:" << program; + + QByteArray display = qgetenv("DISPLAY"); + QByteArray xauthority = qgetenv("XAUTHORITY"); + + QStringList args; + args << "env" + << "DISPLAY=" + display + << "XAUTHORITY=" + xauthority + << program; + + QProcess process; + process.setProgram("pkexec"); + process.setArguments(args); + + qDebug() << "Attempting to elevate using pkexec with arguments:" << args; + + process.start(); + if (!process.waitForStarted(5000)) { + qDebug() << "Failed to start pkexec."; + return false; + } + + // 阻塞等待提权进程退出(比如主程序窗口关闭) + if (!process.waitForFinished(-1)) { // 等待直到新进程退出 + qDebug() << "pkexec process waitForFinished failed."; + return false; + } + + int exitCode = process.exitCode(); + QProcess::ExitStatus exitStatus = process.exitStatus(); + + qDebug() << "pkexec exit code:" << exitCode; + qDebug() << "pkexec exit status:" << exitStatus; + qDebug() << "pkexec stderr:" << process.readAllStandardError(); + + return (exitStatus == QProcess::NormalExit && exitCode == 0); +} + +int main(int argc, char *argv[]) +{ + // 必须在 QGuiApplication 实例创建之前调用 + // QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); + + QApplication a(argc, argv); + a.setWindowIcon(QIcon(":/resources/128*128/spark-update-tool.png")); + if (!isRoot()) { + qDebug() << "Not running as root. Attempting to elevate..."; + if (!elevateToRoot()) { + qDebug() << "Elevation failed or pkexec command was not executed successfully."; + QMessageBox::critical(nullptr, + "权限不足", + "提权失败!\n\n您的系统可能不支持 `pkexec` 或 `polkit` 配置不正确," + "或者您取消了授权。\n\n请尝试使用 `sudo` 命令运行此程序:" + "\n\n在终端中输入:\n`sudo " + QCoreApplication::applicationName() + "`"); + return 0; // 提权失败,退出程序 + } else { + // 如果 elevateToRoot 返回 true,说明 pkexec 命令本身执行成功 + // 但这并不意味着原始程序以 root 权限启动了 + // 因为 elevateToRoot 启动的是一个新的进程,当前进程应该退出 + // 否则会并行运行两个程序实例 + qDebug() << "pkexec command executed successfully (new process likely started). Exiting current process."; + return 0; // 当前非root进程退出 + } + } else { + qDebug() << "Running as root."; + } + + MainWindow w; + w.show(); + return a.exec(); +} \ No newline at end of file diff --git a/src/mainwindow.cpp b/spark-update-tool/src/mainwindow.cpp similarity index 100% rename from src/mainwindow.cpp rename to spark-update-tool/src/mainwindow.cpp diff --git a/src/mainwindow.h b/spark-update-tool/src/mainwindow.h similarity index 97% rename from src/mainwindow.h rename to spark-update-tool/src/mainwindow.h index bc7f9d72b40c29fb3ed279dd204efaaf4271c4d7..d754b5f741c3034e519b5385f265b330c6828f48 100644 --- a/src/mainwindow.h +++ b/spark-update-tool/src/mainwindow.h @@ -7,7 +7,7 @@ #include "appdelegate.h" #include #include // 添加头文件 - +#include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; diff --git a/src/mainwindow.ui b/spark-update-tool/src/mainwindow.ui similarity index 100% rename from src/mainwindow.ui rename to spark-update-tool/src/mainwindow.ui diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..203b654d7d0f4746f6951a9f97741cb1b917601c --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,45 @@ +find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network Svg WebEngineWidgets Concurrent) +find_package(Dtk6 REQUIRED COMPONENTS Core Gui Widget) + +# 添加构建时间宏 +string(TIMESTAMP BUILD_DATE "%Y.%m.%d" UTC) +string(TIMESTAMP BUILD_TIME "%H:%M:%S" UTC) +add_definitions(-DBUILD_DATE="${BUILD_DATE}") +add_definitions(-DBUILD_TIME="${BUILD_TIME}") + +include(src.cmake) + +add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES} ${QRC_FILE}) + +target_include_directories(${PROJECT_NAME} PUBLIC + Qt6::Core + Qt6::Gui + Qt6::Widgets + Qt6::Concurrent + Qt6::Network + Qt6::Svg + Qt6::WebEngineWidgets + Dtk6::Core + Dtk6::Gui + Dtk6::Widget +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Widgets + Qt6::Concurrent + Qt6::Network + Qt6::Svg + Qt6::WebEngineWidgets + Dtk6::Core + Dtk6::Gui + Dtk6::Widget +) + +install(TARGETS ${PROJECT_NAME} DESTINATION /opt/durapps/${PROJECT_NAME}/bin) + +install(DIRECTORY ${CMAKE_SOURCE_DIR}/tool/ DESTINATION /opt/durapps/${PROJECT_NAME}/bin USE_SOURCE_PERMISSIONS) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/pkg/lib/ DESTINATION /lib USE_SOURCE_PERMISSIONS) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/pkg/tmp/ DESTINATION /tmp USE_SOURCE_PERMISSIONS) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/pkg/usr/ DESTINATION ${CMAKE_INSTALL_PREFIX} USE_SOURCE_PERMISSIONS) diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4e9e490dbd89cb3a91b4403766dac6f6e31b595a --- /dev/null +++ b/src/README.md @@ -0,0 +1,30 @@ +# 有关 src 下的一些改进预览 + +> 1. 主体结构预览 +> 2. 主体结构中的内容单独说明 +> 并使用所用语言进行非侵入式独立描述,而不是在代码中填充说明与注释。 +> +> 这是简单的预览说明规范 + +- widget/base 结构 + + ``` + src/widgets/base/ + ├── basewidgetopacity.cpp + └── basewidgetopacity.h + + 0 directories, 2 files + ``` + +- 来源于 widget/base 的说明 + + ```c++ + // BaseWidgetOpacity 是一个提供了淡出/淡入动画的基础类: + // 1. closeEvent 窗口关闭时进行淡出动画 + // 此前在 MainWindow 中实现的淡出动画将由 BaseWidgetOpacity 来实现。 + + // 此前 MainWindow 原有的 DBlurEffectWidget 父类将移交至 BaseWidgetOpacity 继承。 + + // 注意: + // 如果 MainWindow 在未来重写 closeEvent 事件时将可能丢失 BaseWidgetOpacity 中的淡出效果 + ``` \ No newline at end of file diff --git a/src/application.cpp b/src/application.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9555bc492ea732e692672b0c276907369f20589a --- /dev/null +++ b/src/application.cpp @@ -0,0 +1,233 @@ +#include "application.h" +#include "mainwindow-dtk.h" +#include "utils/utils.h" + +#include +#include +#include +#include +#include +#include +#if (DTK_VERSION >= DTK_VERSION_CHECK(5, 6, 4, 0)) +#include +#endif + +#include +#include +#include + +DCORE_USE_NAMESPACE + +Application::Application(int &argc, char **argv) + : DApplication(argc, argv) +{ + // Wayland 环境下使用,防止子控件 Native 化 + if (!DPlatformWindowHandle::pluginVersion().isEmpty()) { + setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); + } + + setQuitOnLastWindowClosed(false); // 启用托盘图标时,关闭窗口程序仍然运行 + + loadTranslator(); // 载入翻译 + + setOrganizationName("spark-union"); + setApplicationName("spark-store"); // 影响 ~/.config/spark-union ~/.local/share/spark-union 下文件夹名称 + setApplicationDisplayName(QObject::tr("Spark Store")); // 设置窗口显示标题 (Wayland 下会显示 Qt 原生标题栏) + setProductName(QObject::tr("Spark Store")); + setProductIcon(QIcon(":/icon/sparky.png")); + setApplicationHomePage("https://gitee.com/spark-store-project"); + setApplicationDescription( + QObject::tr( + "An appstore powered by community
" + "Sparky is our mascot, designed by Tyson Tan
")); + setApplicationLicense(" GPL V3 "); + + // 检查 ~/.config/spark-union/spark-store 文件夹是否存在 + checkAppConfigLocation(); + + // 初始化日志模块 (默认日志位置 ~/.cache/spark-union/spark-store) + DLogManager::registerConsoleAppender(); + DLogManager::registerFileAppender(); + + // 获取版本特性信息 + m_featuresJsonObj = Utils::parseFeatureJsonFile(); +} + +void Application::handleAboutAction() +{ + if (aboutDialog() && aboutDialog()->parent() == m_mainWindow) { + DApplication::handleAboutAction(); + return; + } + + initAboutDialog(); +#if (DTK_VERSION >= DTK_VERSION_CHECK(5, 6, 4, 0)) + initFeatureDisplayDialog(); // 初始化版本特性对话框 +#endif + DApplication::handleAboutAction(); +} + +bool Application::notify(QObject *receiver, QEvent *event) +{ + if (m_mainWindow) { + m_mainWindow->notify(receiver, event); + } + + return DApplication::notify(receiver, event); +} + +void Application::checkAppConfigLocation() +{ + QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)); + if (!dir.exists()) { + qWarning() << "AppConfigLocation not existed, creating..."; + dir.mkpath(dir.absolutePath()); + } +} + +void Application::setBuildDateTime(const QString &buildDateTime) +{ + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + if (config.value("build/version").toString() != QString(APP_VERSION)) { + qDebug() << "Spark Store has been updated!"; + + config.setValue("build/version", QString(APP_VERSION)); + config.setValue("build/branch", QString(APP_BRANCH)); + config.setValue("build/time", buildDateTime); + config.sync(); + } + + setApplicationVersion(DApplication::buildVersion(QString(APP_VERSION) + "-" + QString(APP_BRANCH) + "-" + buildDateTime)); +} + +void Application::setMainWindow(MainWindow *window) +{ + m_mainWindow = window; + if (aboutDialog() == nullptr || aboutDialog()->parent() != m_mainWindow) + { + initAboutDialog(); + } +#if (DTK_VERSION >= DTK_VERSION_CHECK(5, 6, 4, 0)) + if (featureDisplayDialog() == nullptr || featureDisplayDialog()->parent() != m_mainWindow) + { + initFeatureDisplayDialog(); // 初始化版本特性对话框 + } +#endif +} + +MainWindow *Application::mainWindow() +{ + return m_mainWindow; +} + +void Application::initAboutDialog() +{ + if (m_mainWindow == nullptr) + { + return; + } + + if (aboutDialog()) + { + aboutDialog()->deleteLater(); + setAboutDialog(nullptr); + } + + // 自定义 DAboutDialog + DAboutDialog *dialog = new DAboutDialog(m_mainWindow); + dialog->setProductName(productName()); + dialog->setProductIcon(productIcon()); + dialog->setVersion(translate("DAboutDialog", "Version: %1").arg(applicationVersion())); + if (runtimeDtkVersion() >= DTK_VERSION_CHECK(5, 6, 4, 0)) { + dialog->setVersion(applicationVersion()); + } + // 根据 shenmo 要求,不显示组织 Logo + // dialog->setCompanyLogo(QPixmap(":/icon/Logo-Spark.png")); + dialog->setCompanyLogo(QPixmap()); + dialog->setWebsiteName(QObject::tr("Spark Project")); + dialog->setWebsiteLink(applicationHomePage()); + dialog->setDescription(applicationDescription()); + dialog->setLicense(translate("DAboutDialog", "%1 is released under %2").arg(productName()).arg(applicationLicense())); + + setAboutDialog(dialog); + connect(aboutDialog(), &DAboutDialog::destroyed, this, [=]() { + setAboutDialog(nullptr); + }); + + dialog->hide(); +} + +void Application::loadTranslator() +{ + DApplication::loadTranslator(); + + if (QLocale::system().language() == QLocale::Chinese) { + QTranslator *webengineTranslator = new QTranslator(this); + bool loaded = webengineTranslator->load(QLocale(QLocale::Chinese), "qtwebengine", "_", ":/translations"); + if (!loaded) { + qWarning() << "Failed to load webengine translator"; + } + installTranslator(webengineTranslator); + } +} + +#if (DTK_VERSION >= DTK_VERSION_CHECK(5, 6, 4, 0)) +/** + * @brief Application::initFeatureDisplayDialog 初始化版本特性对话框 + */ +void Application::initFeatureDisplayDialog() +{ + if (featureDisplayDialog()) + { + featureDisplayDialog()->deleteLater(); + setFeatureDisplayDialog(nullptr); + } + + // 自定义 DFeatureDisplayDialog + DFeatureDisplayDialog *dialog = new DFeatureDisplayDialog(m_mainWindow); + // 标题 + dialog->setTitle(m_featuresJsonObj.value("title").toString()); + // NOTE: json 文件中支持多语言;考虑到维护性,不放入翻译文件处理 + if (m_featuresJsonObj.contains(QString("title[%1]").arg(QLocale::system().name()))) + { + dialog->setTitle(m_featuresJsonObj.value(QString("title[%1]").arg(QLocale::system().name())).toString()); + } + + // 特性项 + QList items; + foreach (const QJsonValue &jsonValue, m_featuresJsonObj.value("items").toArray()) + { + QJsonObject jsonObj = jsonValue.toObject(); + QString name = jsonObj.value("name").toString(); + if (jsonObj.contains(QString("name[%1]").arg(QLocale::system().name()))) + { + name = jsonObj.value(QString("name[%1]").arg(QLocale::system().name())).toString(); + } + QString description = jsonObj.value("description").toString(); + if (jsonObj.contains(QString("description[%1]").arg(QLocale::system().name()))) + { + description = jsonObj.value(QString("description[%1]").arg(QLocale::system().name())).toString(); + } + + DFeatureItem *item = new DFeatureItem(QIcon::fromTheme("spark-store"), name, description, dialog); + items.append(item); + } + dialog->addItems(items); // NOTE: 也支持 addItem 依次添加单个 item + + // “了解更多”链接按钮 + dialog->setLinkUrl(m_featuresJsonObj.value("linkUrl").toString()); + dialog->setLinkButtonVisible(m_featuresJsonObj.value("linkButtonVisible").toBool()); + + setFeatureDisplayDialog(dialog); + connect(featureDisplayDialog(), &DFeatureDisplayDialog::destroyed, this, [=]() { + setFeatureDisplayDialog(nullptr); + }); +#if (DTK_VERSION >= DTK_VERSION_CHECK(5, 6, 4, 0)) + connect(aboutDialog(), &DAboutDialog::featureActivated, this, [=]() { + featureDisplayDialog()->show(); + }); +#endif + + dialog->hide(); +} +#endif diff --git a/src/application.h b/src/application.h new file mode 100644 index 0000000000000000000000000000000000000000..22f6b145030e4038a7b82627e99b9e1ad6a6ff97 --- /dev/null +++ b/src/application.h @@ -0,0 +1,41 @@ +#ifndef APPLICATION_H +#define APPLICATION_H + +#include + +#include + +DWIDGET_USE_NAMESPACE + +class MainWindow; +class Application : public DApplication +{ + Q_OBJECT + +public: + Application(int &argc, char **argv); + void handleAboutAction() override; + bool notify(QObject *receiver, QEvent *event) override; + + static void checkAppConfigLocation(); + + void setBuildDateTime(const QString &buildDateTime); + + void setMainWindow(MainWindow *window); + MainWindow *mainWindow(); + +private: + void initAboutDialog(); +#if (DTK_VERSION >= DTK_VERSION_CHECK(5, 6, 4, 0)) + void initFeatureDisplayDialog(); +#endif + + void loadTranslator(); + +private: + QJsonObject m_featuresJsonObj; + + MainWindow *m_mainWindow = nullptr; +}; + +#endif // APPLICATION_H diff --git a/src/assets/assets.qrc b/src/assets/assets.qrc new file mode 100644 index 0000000000000000000000000000000000000000..c46a72f8b0479844b60ea560ad9924449b758836 --- /dev/null +++ b/src/assets/assets.qrc @@ -0,0 +1,93 @@ + + + icon/Logo-Spark.png + icon/dark/back.svg + icon/dark/box.svg + icon/dark/calendar.svg + icon/dark/download.svg + icon/dark/folder.svg + icon/dark/globe.svg + icon/dark/leftbutton_0.svg + icon/dark/leftbutton_1.svg + icon/dark/leftbutton_2.svg + icon/dark/leftbutton_3.svg + icon/dark/leftbutton_4.svg + icon/dark/leftbutton_5.svg + icon/dark/leftbutton_6.svg + icon/dark/leftbutton_7.svg + icon/dark/leftbutton_8.svg + icon/dark/leftbutton_9.svg + icon/dark/leftbutton_10.svg + icon/dark/leftbutton_11.svg + icon/dark/leftbutton_12.svg + icon/dark/text.svg + icon/dark/update.svg + icon/light/back.svg + icon/light/download.svg + icon/light/leftbutton_0.svg + icon/light/leftbutton_1.svg + icon/light/leftbutton_2.svg + icon/light/leftbutton_3.svg + icon/light/leftbutton_4.svg + icon/light/leftbutton_5.svg + icon/light/leftbutton_6.svg + icon/light/leftbutton_7.svg + icon/light/leftbutton_8.svg + icon/light/leftbutton_9.svg + icon/light/leftbutton_10.svg + icon/light/leftbutton_11.svg + icon/light/leftbutton_12.svg + icon/light/box.svg + icon/light/calendar.svg + icon/light/globe.svg + icon/light/folder.svg + icon/light/text.svg + icon/light/update.svg + icon/logo.svg + icon/sparky.png + json/features.json + tags/a2d_full.svg + tags/a2d.png + tags/a2d.svg + tags/community_full.svg + tags/community.png + tags/community.svg + tags/debian_full.svg + tags/debian.png + tags/debian.svg + tags/deepin_full.svg + tags/deepin.png + tags/deepin.svg + tags/dtk_full.svg + tags/dtk.png + tags/dtk.svg + tags/dwine2_full.svg + tags/dwine2.png + tags/dwine2.svg + tags/dwine5_full.svg + tags/dwine5.png + tags/dwine5.svg + tags/ubuntu_full.svg + tags/ubuntu.png + tags/ubuntu.svg + tags/uos_full.svg + tags/uos.png + tags/uos.svg + tags/amber-ce-bookworm_full.svg + tags/amber-ce-bookworm.png + tags/amber-ce-bookworm.svg + tags/amber-ce-sid_full.svg + tags/amber-ce-sid.png + tags/amber-ce-sid.svg + tags/amber-ce-trixie_full.svg + tags/amber-ce-trixie.png + tags/amber-ce-trixie.svg + tags/native_full.svg + tags/native.png + tags/native.svg + translations/qtwebengine_zh.qm + tags/amber-ce-deepin_full.svg + tags/amber-ce-deepin.svg + tags/amber-ce-deepin.png + + diff --git a/src/assets/icon/Logo-Spark.png b/src/assets/icon/Logo-Spark.png new file mode 100644 index 0000000000000000000000000000000000000000..905224c8fe7ee658a431e74f9d31c5f210915895 Binary files /dev/null and b/src/assets/icon/Logo-Spark.png differ diff --git a/src/assets/icon/dark/back.svg b/src/assets/icon/dark/back.svg new file mode 100644 index 0000000000000000000000000000000000000000..8c357a4d669ac6117733233b814e5b6f8d06f3cc --- /dev/null +++ b/src/assets/icon/dark/back.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/box.svg b/src/assets/icon/dark/box.svg new file mode 100644 index 0000000000000000000000000000000000000000..1fa71a266babe6b714694b2af91a903f458808ec --- /dev/null +++ b/src/assets/icon/dark/box.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/calendar.svg b/src/assets/icon/dark/calendar.svg new file mode 100644 index 0000000000000000000000000000000000000000..0b9d73ec3e29f8f4ad9ed1a308cd646790fd5bbe --- /dev/null +++ b/src/assets/icon/dark/calendar.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/download.svg b/src/assets/icon/dark/download.svg new file mode 100644 index 0000000000000000000000000000000000000000..07d5e4f002bcb486b3d75f8eea90005f32ec4929 --- /dev/null +++ b/src/assets/icon/dark/download.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/folder.svg b/src/assets/icon/dark/folder.svg new file mode 100644 index 0000000000000000000000000000000000000000..7ef30a94cf9ec37ecbf31d3d0803fcbd6d1a6ca0 --- /dev/null +++ b/src/assets/icon/dark/folder.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/globe.svg b/src/assets/icon/dark/globe.svg new file mode 100644 index 0000000000000000000000000000000000000000..c28295c5fc8d35ab80321d0e852d086293ca5be9 --- /dev/null +++ b/src/assets/icon/dark/globe.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_0.svg b/src/assets/icon/dark/leftbutton_0.svg new file mode 100644 index 0000000000000000000000000000000000000000..d000529a0fda2b4bf27217659b0ebf61c446a29a --- /dev/null +++ b/src/assets/icon/dark/leftbutton_0.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_1.svg b/src/assets/icon/dark/leftbutton_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..c28295c5fc8d35ab80321d0e852d086293ca5be9 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_1.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_10.svg b/src/assets/icon/dark/leftbutton_10.svg new file mode 100644 index 0000000000000000000000000000000000000000..8f7b753dd191189f73d5dfffb6cd33a495e82a70 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_10.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_11.svg b/src/assets/icon/dark/leftbutton_11.svg new file mode 100644 index 0000000000000000000000000000000000000000..a652454ab863236af01a12ee15880d263379b3dc --- /dev/null +++ b/src/assets/icon/dark/leftbutton_11.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/assets/icon/dark/leftbutton_12.svg b/src/assets/icon/dark/leftbutton_12.svg new file mode 100644 index 0000000000000000000000000000000000000000..baf33c10dd08aa89e692739f837635eb69d6ca85 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_12.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_2.svg b/src/assets/icon/dark/leftbutton_2.svg new file mode 100644 index 0000000000000000000000000000000000000000..13fc3a73801eb3040538bc50e10c36b47312bc5a --- /dev/null +++ b/src/assets/icon/dark/leftbutton_2.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/icon/dark/leftbutton_3.svg b/src/assets/icon/dark/leftbutton_3.svg new file mode 100644 index 0000000000000000000000000000000000000000..15e4b68b4058be0ea4b04cfcd0ccd8415e7172a5 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_3.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_4.svg b/src/assets/icon/dark/leftbutton_4.svg new file mode 100644 index 0000000000000000000000000000000000000000..2bf9f5987d3e1ee2741abed590eefb73d444a9e5 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_4.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_5.svg b/src/assets/icon/dark/leftbutton_5.svg new file mode 100644 index 0000000000000000000000000000000000000000..7bd09c15ab1fdc9bdfee49570960ba562bd29681 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_5.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_6.svg b/src/assets/icon/dark/leftbutton_6.svg new file mode 100644 index 0000000000000000000000000000000000000000..e37d008b92aca64fccd00335af8c11fdcf361fd3 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_6.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/leftbutton_7.svg b/src/assets/icon/dark/leftbutton_7.svg new file mode 100644 index 0000000000000000000000000000000000000000..e14514b50c54ea8ed9bcd95dd209e2a35ad7af70 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_7.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/assets/icon/dark/leftbutton_8.svg b/src/assets/icon/dark/leftbutton_8.svg new file mode 100644 index 0000000000000000000000000000000000000000..3bcc21118416d485d416472f1cf6aac873a4bd84 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_8.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/icon/dark/leftbutton_9.svg b/src/assets/icon/dark/leftbutton_9.svg new file mode 100644 index 0000000000000000000000000000000000000000..31f7b4fe6d1946a328f18ca188af65bc860407f4 --- /dev/null +++ b/src/assets/icon/dark/leftbutton_9.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/text.svg b/src/assets/icon/dark/text.svg new file mode 100644 index 0000000000000000000000000000000000000000..342d99eac501c73732048bcd12e0af1184657329 --- /dev/null +++ b/src/assets/icon/dark/text.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/dark/update.svg b/src/assets/icon/dark/update.svg new file mode 100644 index 0000000000000000000000000000000000000000..f9e5d1b80d1f44e63b8bf0fd2ba0e0ce6027e26b --- /dev/null +++ b/src/assets/icon/dark/update.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icon/light/back.svg b/src/assets/icon/light/back.svg new file mode 100644 index 0000000000000000000000000000000000000000..7c6cbfbfcd70345fbac4c4f4c66f065047d08275 --- /dev/null +++ b/src/assets/icon/light/back.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/box.svg b/src/assets/icon/light/box.svg new file mode 100644 index 0000000000000000000000000000000000000000..034168ce57fd0cc99c8b2d46aa0f2f24dc58075f --- /dev/null +++ b/src/assets/icon/light/box.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/calendar.svg b/src/assets/icon/light/calendar.svg new file mode 100644 index 0000000000000000000000000000000000000000..7bc6f35d444247ace01fb6fe02ad018a52fda33c --- /dev/null +++ b/src/assets/icon/light/calendar.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/download.svg b/src/assets/icon/light/download.svg new file mode 100644 index 0000000000000000000000000000000000000000..d088fb3b84a26814c83a654cf18aecc67171e59d --- /dev/null +++ b/src/assets/icon/light/download.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/folder.svg b/src/assets/icon/light/folder.svg new file mode 100644 index 0000000000000000000000000000000000000000..f5b0f896163fde8adbdccc466bf6e36f99cda5d7 --- /dev/null +++ b/src/assets/icon/light/folder.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/globe.svg b/src/assets/icon/light/globe.svg new file mode 100644 index 0000000000000000000000000000000000000000..94d7ff8342507ade152d2cf946faa83dac3159b2 --- /dev/null +++ b/src/assets/icon/light/globe.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_0.svg b/src/assets/icon/light/leftbutton_0.svg new file mode 100644 index 0000000000000000000000000000000000000000..a99113dabee328d0508696c8c675762cb4413cca --- /dev/null +++ b/src/assets/icon/light/leftbutton_0.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_1.svg b/src/assets/icon/light/leftbutton_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..94d7ff8342507ade152d2cf946faa83dac3159b2 --- /dev/null +++ b/src/assets/icon/light/leftbutton_1.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_10.svg b/src/assets/icon/light/leftbutton_10.svg new file mode 100644 index 0000000000000000000000000000000000000000..430da5ea83bce98efc685ab6fd7fdf737deb63fc --- /dev/null +++ b/src/assets/icon/light/leftbutton_10.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_11.svg b/src/assets/icon/light/leftbutton_11.svg new file mode 100644 index 0000000000000000000000000000000000000000..9adc870bfaca9c3feb204fb1b59a16d1113bd647 --- /dev/null +++ b/src/assets/icon/light/leftbutton_11.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/assets/icon/light/leftbutton_12.svg b/src/assets/icon/light/leftbutton_12.svg new file mode 100644 index 0000000000000000000000000000000000000000..5f7dc51ab27805bb56d3abf494db10c19cbb306f --- /dev/null +++ b/src/assets/icon/light/leftbutton_12.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_2.svg b/src/assets/icon/light/leftbutton_2.svg new file mode 100644 index 0000000000000000000000000000000000000000..e4e7d62a122e1d3342f8b1972ae3d66a873b49f5 --- /dev/null +++ b/src/assets/icon/light/leftbutton_2.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/icon/light/leftbutton_3.svg b/src/assets/icon/light/leftbutton_3.svg new file mode 100644 index 0000000000000000000000000000000000000000..320ac66e71ed8d8d65cc39644822541e4abbd475 --- /dev/null +++ b/src/assets/icon/light/leftbutton_3.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_4.svg b/src/assets/icon/light/leftbutton_4.svg new file mode 100644 index 0000000000000000000000000000000000000000..430e96bae1abaa0e5fafac7e2c2e0be7fdce86f9 --- /dev/null +++ b/src/assets/icon/light/leftbutton_4.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_5.svg b/src/assets/icon/light/leftbutton_5.svg new file mode 100644 index 0000000000000000000000000000000000000000..baac32ecad81e16aa4b4bd7d93a96171f358c7b4 --- /dev/null +++ b/src/assets/icon/light/leftbutton_5.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_6.svg b/src/assets/icon/light/leftbutton_6.svg new file mode 100644 index 0000000000000000000000000000000000000000..e2be8037c9f90ab73176662e8c22faf3dd381060 --- /dev/null +++ b/src/assets/icon/light/leftbutton_6.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/leftbutton_7.svg b/src/assets/icon/light/leftbutton_7.svg new file mode 100644 index 0000000000000000000000000000000000000000..017fafd01fa2cb3874b64e2f6cabfc9ecc794cf1 --- /dev/null +++ b/src/assets/icon/light/leftbutton_7.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/assets/icon/light/leftbutton_8.svg b/src/assets/icon/light/leftbutton_8.svg new file mode 100644 index 0000000000000000000000000000000000000000..e542fd591394f3cf40cc85a4b9d25588e2569f80 --- /dev/null +++ b/src/assets/icon/light/leftbutton_8.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/icon/light/leftbutton_9.svg b/src/assets/icon/light/leftbutton_9.svg new file mode 100644 index 0000000000000000000000000000000000000000..827e68cc838b3c21ec565e8ee0885251a0d73e58 --- /dev/null +++ b/src/assets/icon/light/leftbutton_9.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/text.svg b/src/assets/icon/light/text.svg new file mode 100644 index 0000000000000000000000000000000000000000..6185b6a8aa18f3d3d297f6040e105e89b7fa14c7 --- /dev/null +++ b/src/assets/icon/light/text.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icon/light/update.svg b/src/assets/icon/light/update.svg new file mode 100644 index 0000000000000000000000000000000000000000..2efd6bcbe1c6de90b9acc5578fb5cbf4e9cf29f8 --- /dev/null +++ b/src/assets/icon/light/update.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icon/logo-no-border.svg b/src/assets/icon/logo-no-border.svg new file mode 100644 index 0000000000000000000000000000000000000000..0b54c6dd4a14705fccf24ad356434bef6b60b602 --- /dev/null +++ b/src/assets/icon/logo-no-border.svg @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/src/assets/icon/logo.svg b/src/assets/icon/logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..5ef9a4008d03f73c181e3601533dbb71d42b2ff0 --- /dev/null +++ b/src/assets/icon/logo.svg @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icon/logo.xcf b/src/assets/icon/logo.xcf new file mode 100644 index 0000000000000000000000000000000000000000..7a02e0c232ead42ab7d21a0157f66189e2d76efd Binary files /dev/null and b/src/assets/icon/logo.xcf differ diff --git a/src/assets/icon/logo_old.svg b/src/assets/icon/logo_old.svg new file mode 100644 index 0000000000000000000000000000000000000000..0306cc05ae4186baaa6090d3063545b9acd626da --- /dev/null +++ b/src/assets/icon/logo_old.svg @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icon/spark-store.svg b/src/assets/icon/spark-store.svg new file mode 100644 index 0000000000000000000000000000000000000000..a84891b75c05348e2aea6f95df77c93bc992bea7 --- /dev/null +++ b/src/assets/icon/spark-store.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icon/sparky.png b/src/assets/icon/sparky.png new file mode 100644 index 0000000000000000000000000000000000000000..cf154b00a3d827707178327b2c90b14721101f7b Binary files /dev/null and b/src/assets/icon/sparky.png differ diff --git a/src/assets/json/features.json b/src/assets/json/features.json new file mode 100644 index 0000000000000000000000000000000000000000..8c7772b0da19efa594ce49f1f8b60de51798c8e7 --- /dev/null +++ b/src/assets/json/features.json @@ -0,0 +1,25 @@ +{ + "title": "Features", + "title[zh_CN]": "版本特性", + "items": [ + { + "icon": "/usr/share/icons/hicolor/scalable/apps/spark-store.svg", + "name": "Feature 1", + "name[zh_CN]": "特性 1", + "description": "Please click the learn more button to check", + "description[zh_CN]": "请点击 了解更多 按钮来获取特性" + }, + { + "icon": ":/icon/logo.svg", + "name": "Feature 2", + "description": "Feature 2 detailed description..." + }, + { + "icon": "spark-store", + "name": "Fix 1", + "description": "Fix 1 detailed description..." + } + ], + "linkUrl": "https://gitee.com/spark-store-project/spark-store/releases/", + "linkButtonVisible": true +} diff --git a/src/assets/tags/a2d.png b/src/assets/tags/a2d.png new file mode 100644 index 0000000000000000000000000000000000000000..548e7ee0e89c1f6c0195a13c92e3d7a720d0e2d6 Binary files /dev/null and b/src/assets/tags/a2d.png differ diff --git a/src/assets/tags/a2d.svg b/src/assets/tags/a2d.svg new file mode 100644 index 0000000000000000000000000000000000000000..b3e0da454cb065632ab43421a4679628a5208dfd --- /dev/null +++ b/src/assets/tags/a2d.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/a2d_full.svg b/src/assets/tags/a2d_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..c2da7faabb067422f76e795d6f6333b0effc94cf --- /dev/null +++ b/src/assets/tags/a2d_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-bookworm.png b/src/assets/tags/amber-ce-bookworm.png new file mode 100644 index 0000000000000000000000000000000000000000..9047cd5cef3a09e8cf0628f475c240d6bc8d2c67 Binary files /dev/null and b/src/assets/tags/amber-ce-bookworm.png differ diff --git a/src/assets/tags/amber-ce-bookworm.svg b/src/assets/tags/amber-ce-bookworm.svg new file mode 100644 index 0000000000000000000000000000000000000000..60638cf7bddc423efbfec2638eb22edb6236ed8d --- /dev/null +++ b/src/assets/tags/amber-ce-bookworm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-bookworm_full.svg b/src/assets/tags/amber-ce-bookworm_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..4ed208d4bda982091e8e79c67ea381bc339216d9 --- /dev/null +++ b/src/assets/tags/amber-ce-bookworm_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-deepin.png b/src/assets/tags/amber-ce-deepin.png new file mode 100644 index 0000000000000000000000000000000000000000..9b215a7e2ee95a8af5cc1b8b4f56b09ea59ad2ed Binary files /dev/null and b/src/assets/tags/amber-ce-deepin.png differ diff --git a/src/assets/tags/amber-ce-deepin.svg b/src/assets/tags/amber-ce-deepin.svg new file mode 100644 index 0000000000000000000000000000000000000000..90cb44b13b88c45ebd238bce0cfe78229f989ed3 --- /dev/null +++ b/src/assets/tags/amber-ce-deepin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-deepin_full.svg b/src/assets/tags/amber-ce-deepin_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..a0faa1b62926317f73b94f1928b715502368db98 --- /dev/null +++ b/src/assets/tags/amber-ce-deepin_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-sid.png b/src/assets/tags/amber-ce-sid.png new file mode 100644 index 0000000000000000000000000000000000000000..79bf6fac3a375b590da9ecd4c6e6fc3d91bd1e53 Binary files /dev/null and b/src/assets/tags/amber-ce-sid.png differ diff --git a/src/assets/tags/amber-ce-sid.svg b/src/assets/tags/amber-ce-sid.svg new file mode 100644 index 0000000000000000000000000000000000000000..6b28b6b77b856cb336f4c1294c1542fee6375bf7 --- /dev/null +++ b/src/assets/tags/amber-ce-sid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-sid_full.svg b/src/assets/tags/amber-ce-sid_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..bfa1651fe1e76beddc7d3919bc2fab6cff5a4320 --- /dev/null +++ b/src/assets/tags/amber-ce-sid_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-trixie.png b/src/assets/tags/amber-ce-trixie.png new file mode 100644 index 0000000000000000000000000000000000000000..d19de919256d288ddc2d5848864e00cd55c9e263 Binary files /dev/null and b/src/assets/tags/amber-ce-trixie.png differ diff --git a/src/assets/tags/amber-ce-trixie.svg b/src/assets/tags/amber-ce-trixie.svg new file mode 100644 index 0000000000000000000000000000000000000000..d675bcf07bbebac07b288fcec65781d539d92907 --- /dev/null +++ b/src/assets/tags/amber-ce-trixie.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/amber-ce-trixie_full.svg b/src/assets/tags/amber-ce-trixie_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..7669a3a8e92d7920b607f757689e3286c6f591d2 --- /dev/null +++ b/src/assets/tags/amber-ce-trixie_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/community.png b/src/assets/tags/community.png new file mode 100644 index 0000000000000000000000000000000000000000..7105a111b59994de6edd0a7b02e0bdf7054dec52 Binary files /dev/null and b/src/assets/tags/community.png differ diff --git a/src/assets/tags/community.svg b/src/assets/tags/community.svg new file mode 100644 index 0000000000000000000000000000000000000000..c80583927da386ddf953d19081a7efe2abc02d3a --- /dev/null +++ b/src/assets/tags/community.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/community_full.svg b/src/assets/tags/community_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..5a10d978c65a3b3b1d9a25da34dc79125b8bf328 --- /dev/null +++ b/src/assets/tags/community_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/debian.png b/src/assets/tags/debian.png new file mode 100644 index 0000000000000000000000000000000000000000..944a253bd30f4f604122f82886a7eb08f0378501 Binary files /dev/null and b/src/assets/tags/debian.png differ diff --git a/src/assets/tags/debian.svg b/src/assets/tags/debian.svg new file mode 100644 index 0000000000000000000000000000000000000000..a508890cf98830c355a07780918e8fe79ce8a6d7 --- /dev/null +++ b/src/assets/tags/debian.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/debian_full.svg b/src/assets/tags/debian_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..1e0b885b3f31fc2637fe028d3f37f5207ee61ef3 --- /dev/null +++ b/src/assets/tags/debian_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/deepin.png b/src/assets/tags/deepin.png new file mode 100644 index 0000000000000000000000000000000000000000..bcff425a2614bd64fa5924b52a3c92ec321c6a0c Binary files /dev/null and b/src/assets/tags/deepin.png differ diff --git a/src/assets/tags/deepin.svg b/src/assets/tags/deepin.svg new file mode 100644 index 0000000000000000000000000000000000000000..213593e2711b4da69c6e9cfb6f1bda8d84cab4d5 --- /dev/null +++ b/src/assets/tags/deepin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/deepin_full.svg b/src/assets/tags/deepin_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..0d5d23735035eee78ee1e3b8d3806ec2f2344abb --- /dev/null +++ b/src/assets/tags/deepin_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/dtk.png b/src/assets/tags/dtk.png new file mode 100644 index 0000000000000000000000000000000000000000..76f73d653ee55c1de911778263c1785451415c21 Binary files /dev/null and b/src/assets/tags/dtk.png differ diff --git a/src/assets/tags/dtk.svg b/src/assets/tags/dtk.svg new file mode 100644 index 0000000000000000000000000000000000000000..59ee2afa6f75e60e5f9c3abeb5f96d3d438b49a3 --- /dev/null +++ b/src/assets/tags/dtk.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/dtk_full.svg b/src/assets/tags/dtk_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..215d31a0bcbaebe9f475502afcd2b5e477c14838 --- /dev/null +++ b/src/assets/tags/dtk_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/dwine2.png b/src/assets/tags/dwine2.png new file mode 100644 index 0000000000000000000000000000000000000000..0de4631723107001405daaea079595b2bcab0309 Binary files /dev/null and b/src/assets/tags/dwine2.png differ diff --git a/src/assets/tags/dwine2.svg b/src/assets/tags/dwine2.svg new file mode 100644 index 0000000000000000000000000000000000000000..1e583359e923b0a1ac9f13144e89b04a38dfde98 --- /dev/null +++ b/src/assets/tags/dwine2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/dwine2_full.svg b/src/assets/tags/dwine2_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..e89decbf76e35d76ea94ca2019f45d61fa0fb91d --- /dev/null +++ b/src/assets/tags/dwine2_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/dwine5.png b/src/assets/tags/dwine5.png new file mode 100644 index 0000000000000000000000000000000000000000..1e06ee41c58cd91ed6a7f5fe4135bb962bb5acb4 Binary files /dev/null and b/src/assets/tags/dwine5.png differ diff --git a/src/assets/tags/dwine5.svg b/src/assets/tags/dwine5.svg new file mode 100644 index 0000000000000000000000000000000000000000..de41389d92169691be15fd5b5b72b71df6ebd6cd --- /dev/null +++ b/src/assets/tags/dwine5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/dwine5_full.svg b/src/assets/tags/dwine5_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..5c68cbb86ce1ebe82c77cc7df9025359ce45dd36 --- /dev/null +++ b/src/assets/tags/dwine5_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/native.png b/src/assets/tags/native.png new file mode 100644 index 0000000000000000000000000000000000000000..8d617857d48af5714b5559dd0621ca3964c3c25e Binary files /dev/null and b/src/assets/tags/native.png differ diff --git a/src/assets/tags/native.svg b/src/assets/tags/native.svg new file mode 100644 index 0000000000000000000000000000000000000000..96bfb030749c8510e3acf5caded65ab2e467d6e3 --- /dev/null +++ b/src/assets/tags/native.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/native_full.svg b/src/assets/tags/native_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..6c633d24d003b4cca598d1d8a44780dd0027cfb7 --- /dev/null +++ b/src/assets/tags/native_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/ubuntu.png b/src/assets/tags/ubuntu.png new file mode 100644 index 0000000000000000000000000000000000000000..f5c29073ace88797f5586deee1757b9f87897d2b Binary files /dev/null and b/src/assets/tags/ubuntu.png differ diff --git a/src/assets/tags/ubuntu.svg b/src/assets/tags/ubuntu.svg new file mode 100644 index 0000000000000000000000000000000000000000..7c2ae4b9d39937a69fd770f4bf1c7107df1bb10e --- /dev/null +++ b/src/assets/tags/ubuntu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/ubuntu_full.svg b/src/assets/tags/ubuntu_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..d33074ccceed07d114125075d6913c3717587909 --- /dev/null +++ b/src/assets/tags/ubuntu_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/uos.png b/src/assets/tags/uos.png new file mode 100644 index 0000000000000000000000000000000000000000..2c1f3bb5b26677b62a2e8a91fbb1528041919934 Binary files /dev/null and b/src/assets/tags/uos.png differ diff --git a/src/assets/tags/uos.svg b/src/assets/tags/uos.svg new file mode 100644 index 0000000000000000000000000000000000000000..b1dca2c639b6fc4d74769445149d8ae16195200d --- /dev/null +++ b/src/assets/tags/uos.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/tags/uos_full.svg b/src/assets/tags/uos_full.svg new file mode 100644 index 0000000000000000000000000000000000000000..a052a08bb6bf4ced38d4557a145076f3636381b8 --- /dev/null +++ b/src/assets/tags/uos_full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/translations/qtwebengine_zh.qm b/src/assets/translations/qtwebengine_zh.qm new file mode 100644 index 0000000000000000000000000000000000000000..d3c927ba266d9f1658169cc59ef19eaa8d7339a2 Binary files /dev/null and b/src/assets/translations/qtwebengine_zh.qm differ diff --git a/src/assets/translations/qtwebengine_zh.ts b/src/assets/translations/qtwebengine_zh.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1167fb037e5ee026b99e24a28c7e129c809ce39 --- /dev/null +++ b/src/assets/translations/qtwebengine_zh.ts @@ -0,0 +1,305 @@ + + + + + QWebEnginePage + + Cut + 剪切 + + + Back + 后退 + + + Copy + 复制 + + + Redo + 恢复 + + + Stop + 停止 + + + Undo + 撤销 + + + &Back + &后退 + + + Paste + 粘贴 + + + Copy Image URL + 复制图片地址 + + + Open Link in This Window + 在当前窗口中打开链接 + + + Toggle Mute + 切换静音 + + + Inspect Element + 检查元素 + + + Toggle Media Controls + 切换媒体控制 + + + Reload + 重新加载 + + + Copy Link URL + 复制链接地址 + + + Exit Full Screen Mode + 退出全屏模式 + + + Paste and Match Style + Pegar y coincidir estilo + + + Follow Link + Seguir vínculo + + + Open Link in New Tab + 在新标签页中打开链接 + + + Reload and Bypass Cache + 重新加载且绕过缓存 + + + Select folder to upload + Seleccionar una carpeta para subir + + + Save Image + 保存图片 + + + Save Media + 保存媒体 + + + Toggle Looping + 切换循环播放 + + + Close Page + 关闭页面 + + + Toggle Play/Pause + 切换播放/暂停 + + + Copy Image + 复制图片 + + + &Reload + &重新加载 + + + Select All + 全选 + + + Save Link + Guardar enlace + + + Copy Media URL + 复制媒体地址 + + + Forward + 前进 + + + &Forward + &前进 + + + Open Link in New Window + 在新窗口中打开链接 + + + Are you sure you want to leave this page? + 您确定要离开当前页面吗? + + + + QQuickWebEngineView + + Back + 后退 + + + Copy + 复制 + + + Copy Image URL + 复制图片地址 + + + Toggle Mute + 切换静音 + + + Inspect Element + 检查元素 + + + Toggle Media Controls + 切换媒体控制 + + + Reload + 重新加载 + + + Copy Link URL + 复制链接地址 + + + Exit Full Screen Mode + 退出全屏模式 + + + Follow Link + 跳转链接 + + + Save Image + 保存图片 + + + Save Media + 保存媒体 + + + Toggle Looping + 切换循环播放 + + + Toggle Play/Pause + 切换播放/暂停 + + + Copy Image + 复制图片 + + + Save Link + 保存链接 + + + Copy Media URL + 复制媒体地址 + + + Forward + 前进 + + + + QtWebEngineCore + + Javascript Alert - %1 + Javascript 警告 - %1 + + + Javascript Confirm - %1 + Javascript 确认 - %1 + + + Javascript Prompt - %1 + Javascript 提示 - %1 + + + Are you sure you want to leave this page? + 您确定要离开当前页面吗? + + + + QtWebEnginePlugin + + Cannot create a separate instance of WebEngineDownloadItem + 无法创建一个 WebEngineDownloadItem 的独立实例 + + + Cannot create separate instance of WebEngineLoadRequest + 无法创建一个 WebEngineLoadRequest 的独立实例 + + + Cannot create a separate instance of WebEngineSettings + 无法创建一个 WebEngineSettings 的独立实例 + + + Cannot create separate instance of WebEngineNavigationRequest + 无法创建一个 WebEngineNavigationRequest 的独立实例 + + + Cannot create separate instance of WebEngineNewViewRequest + 无法创建一个 WebEngineNewViewRequest 的独立实例 + + + Cannot create separate instance of WebEngineCertificateError + 无法创建一个 WebEngineCertificateError 的独立实例 + + + Cannot create a separate instance of FullScreenRequest + 无法创建一个 FullScreenRequest 的独立实例 + + + Cannot create a separate instance of NavigationHistory + 无法创建一个 NavigationHistory 的独立实例 + + + + QtWebEngineExperimentalPlugin + + Cannot create a separate instance of WebEngineViewExperimental + 无法创建一个 WebEngineViewExperimental 的独立实例 + + + Cannot create a separate instance of WebEngineViewport + 无法创建一个 WebEngineViewport 的独立实例 + + + + UIDelegatesManager + + Enter username and password for "%1" at %2://%3 + 为在 %2://%3 的“%1”输入用户名和密码 + + + Connect to proxy "%1" using: + 使用“%1”连接代理: + + + + QtWebEngineTestSupportPlugin + + Cannot create a separate instance of WebEngineErrorPage + 无法创建一个 WebEngineErrorPage 的独立实例 + + + diff --git a/src/backend/DataCollectorAndUploader.cpp b/src/backend/DataCollectorAndUploader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e0421e5ffc704dc7e2480f2e19361ad37bfc4808 --- /dev/null +++ b/src/backend/DataCollectorAndUploader.cpp @@ -0,0 +1,86 @@ +#include "DataCollectorAndUploader.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DataCollectorAndUploader::DataCollectorAndUploader(QObject *parent) : QObject(parent) +{ +} + +void DataCollectorAndUploader::collectAndUploadData() +{ + collectData(); +} + +void DataCollectorAndUploader::collectData() +{ + QString distributor_id; + QString release; + QString architecture; + + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + QString version = config.value("build/version").toString(); + QString uuid = config.value("info/uuid").toString(); + + // Read /etc/os-release file + QFile osReleaseFile("/etc/os-release"); + if (osReleaseFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&osReleaseFile); + while (!in.atEnd()) { + QString line = in.readLine(); + if (line.startsWith("ID=")) { + distributor_id = line.mid(3).remove('"').trimmed(); + } else if (line.startsWith("VERSION_ID=")) { + release = line.mid(11).remove('"').trimmed(); + } + } + osReleaseFile.close(); + } else { + qWarning() << "Could not open /etc/os-release file"; + } + + // Execute uname -m to get the architecture + QProcess unameProcess; + unameProcess.start("uname", QStringList() << "-m"); + unameProcess.waitForFinished(); + architecture = unameProcess.readAllStandardOutput().trimmed(); + + // Create a JSON object + QJsonObject json; + json.insert("Distributor ID", distributor_id); + json.insert("Release", release); + json.insert("Architecture", architecture); + json.insert("Store_Version", version); + json.insert("UUID", uuid); + + // Convert to byte array + QJsonDocument doc(json); + QByteArray jsonData = doc.toJson(); + + // Initialize a network request + QNetworkAccessManager *manager = new QNetworkAccessManager(this); + QUrl url("https://status.spark-app.store/upload"); + + QNetworkRequest request(url); + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); + + // Send the POST request + QNetworkReply *reply = manager->post(request, jsonData); + + connect(reply, &QNetworkReply::finished, [=]() { + if (reply->error() == QNetworkReply::NoError) { + emit uploadSuccessful(); + } else { + emit uploadFailed(reply->errorString()); + } + reply->deleteLater(); + }); +} diff --git a/src/backend/DataCollectorAndUploader.h b/src/backend/DataCollectorAndUploader.h new file mode 100644 index 0000000000000000000000000000000000000000..d251b3c9148739573817cf3d4ff33c866c84428d --- /dev/null +++ b/src/backend/DataCollectorAndUploader.h @@ -0,0 +1,21 @@ +#ifndef DATACOLLECTORANDUPLOADER_H +#define DATACOLLECTORANDUPLOADER_H + +#include + +class DataCollectorAndUploader : public QObject +{ + Q_OBJECT +public: + explicit DataCollectorAndUploader(QObject *parent = nullptr); + void collectAndUploadData(); + +signals: + void uploadSuccessful(); + void uploadFailed(QString errorString); + +private: + void collectData(); +}; + +#endif // DATACOLLECTORANDUPLOADER_H diff --git a/src/backend/ThemeChecker.cpp b/src/backend/ThemeChecker.cpp new file mode 100755 index 0000000000000000000000000000000000000000..754c3bb04ae2ab6e0490f2d06cb4828dde031dad --- /dev/null +++ b/src/backend/ThemeChecker.cpp @@ -0,0 +1,147 @@ +#include "ThemeChecker.h" + +#include +#include + +Q_GLOBAL_STATIC(ThemeChecker, m_instance) + +constexpr char kFreedesktopPortalServiceName[] = "org.freedesktop.portal.Desktop"; +constexpr char kFreedesktopPortalServicePath[] = "/org/freedesktop/portal/desktop"; +constexpr char kFreedesktopPortalSettingsInterface[] = "org.freedesktop.portal.Settings"; + +ThemeChecker::ThemeChecker(QObject *parent) + : QObject(parent) + , m_paletteType(Dtk::Gui::DGuiApplicationHelper::instance()->paletteType()) +{ + m_interface = new QDBusInterface(kFreedesktopPortalServiceName, + kFreedesktopPortalServicePath, + kFreedesktopPortalSettingsInterface, + QDBusConnection::sessionBus(), + this); + + initThemeType(); + initConnections(); +} + +ThemeChecker *ThemeChecker::instance() +{ + return m_instance; +} + +bool ThemeChecker::useDarkTheme() +{ + if (m_paletteType == Dtk::Gui::DGuiApplicationHelper::ColorType::UnknownType) { + return m_themeType == Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType; + } else { + return m_paletteType == Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType; + } +} + +void ThemeChecker::initThemeType() +{ + QVariantList args { "org.freedesktop.appearance", "color-scheme" }; + QDBusMessage msg = m_interface->callWithArgumentList(QDBus::Block, "Read", args); + if (msg.type() != QDBusMessage::MessageType::ReplyMessage || msg.arguments().size() < 1) { + qWarning().noquote() << "Init color-scheme from D-Bus failed:" << msg.errorName() << msg.errorMessage(); + m_themeType = Dtk::Gui::DGuiApplicationHelper::toColorType(Dtk::Gui::DGuiApplicationHelper::fetchPalette(Dtk::Gui::DGuiApplicationHelper::instance()->applicationTheme())); + return; + } + + quint32 colorScheme = qvariant_cast(qvariant_cast(msg.arguments().first()).variant()).variant().toUInt(); + switch (colorScheme) { + case 1: + m_themeType = Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType; + break; + case 2: + m_themeType = Dtk::Gui::DGuiApplicationHelper::ColorType::LightType; + break; + default: + qInfo().noquote() << QString("color-scheme: %1, fetching themeType according to QPalette::Window").arg(colorScheme); + m_themeType = Dtk::Gui::DGuiApplicationHelper::toColorType(Dtk::Gui::DGuiApplicationHelper::fetchPalette(Dtk::Gui::DGuiApplicationHelper::instance()->applicationTheme())); + break; + } + + if (m_paletteType == Dtk::Gui::DGuiApplicationHelper::ColorType::UnknownType) { + Dtk::Gui::DGuiApplicationHelper::instance()->setApplicationPalette(Dtk::Gui::DGuiApplicationHelper::standardPalette(m_themeType)); + } +} + +void ThemeChecker::initConnections() +{ + QDBusConnection::sessionBus().connect(kFreedesktopPortalServiceName, + kFreedesktopPortalServicePath, + kFreedesktopPortalSettingsInterface, + "SettingChanged", + this, + SLOT(slotSettingChanged(const QString &, const QString &, const QDBusVariant &))); + + connect(Dtk::Gui::DGuiApplicationHelper::instance()->applicationTheme(), &Dtk::Gui::DPlatformTheme::themeNameChanged, this, &ThemeChecker::slotThemeNameChanged); + connect(Dtk::Gui::DGuiApplicationHelper::instance(), &Dtk::Gui::DGuiApplicationHelper::paletteTypeChanged, this, &ThemeChecker::slotPaletteTypeChanged); +} + +void ThemeChecker::slotSettingChanged(const QString &_namespace, const QString &key, const QDBusVariant &variant) +{ + if (_namespace != "org.freedesktop.appearance" || key != "color-scheme") { + return; + } + + Dtk::Gui::DGuiApplicationHelper::ColorType colorType = Dtk::Gui::DGuiApplicationHelper::ColorType::UnknownType; + + quint32 colorScheme = variant.variant().toUInt(); + switch (colorScheme) { + case 1: + colorType = Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType; + break; + case 2: + colorType = Dtk::Gui::DGuiApplicationHelper::ColorType::LightType; + break; + default: + qInfo().noquote() << QString("color-scheme: %1, fetching themeType according to QPalette::Window").arg(colorScheme); + colorType = Dtk::Gui::DGuiApplicationHelper::toColorType(Dtk::Gui::DGuiApplicationHelper::fetchPalette(Dtk::Gui::DGuiApplicationHelper::instance()->applicationTheme())); + break; + } + + if (m_paletteType != Dtk::Gui::DGuiApplicationHelper::ColorType::UnknownType) { + m_themeType = colorType; + return; + } + + if (m_themeType != colorType) { + Dtk::Gui::DGuiApplicationHelper::instance()->setApplicationPalette(Dtk::Gui::DGuiApplicationHelper::standardPalette(colorType)); + emit themeChanged(colorType == Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType); + m_themeType = colorType; + } +} + +void ThemeChecker::slotThemeNameChanged(const QByteArray &theme) +{ + Dtk::Gui::DGuiApplicationHelper::ColorType themeType = Dtk::Gui::DGuiApplicationHelper::ColorType::LightType; + if (theme.endsWith("dark")) { + themeType = Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType; + } + + if (m_paletteType != Dtk::Gui::DGuiApplicationHelper::ColorType::UnknownType) { + m_themeType = themeType; + return; + } + + if (m_themeType != themeType) { + Dtk::Gui::DGuiApplicationHelper::instance()->setApplicationPalette(Dtk::Gui::DGuiApplicationHelper::standardPalette(themeType)); + emit themeChanged(themeType == Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType); + m_themeType = themeType; + } +} + +void ThemeChecker::slotPaletteTypeChanged(Dtk::Gui::DGuiApplicationHelper::ColorType paletteType) +{ + m_paletteType = paletteType; + + if (m_paletteType != Dtk::Gui::DGuiApplicationHelper::ColorType::UnknownType) { + Dtk::Gui::DGuiApplicationHelper::instance()->setApplicationPalette(Dtk::Gui::DGuiApplicationHelper::standardPalette(m_paletteType)); + emit themeChanged(m_paletteType == Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType); + return; + } + + Dtk::Gui::DGuiApplicationHelper::instance()->setApplicationPalette(Dtk::Gui::DGuiApplicationHelper::standardPalette(m_themeType)); + emit themeChanged(m_themeType == Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType); +} diff --git a/src/backend/ThemeChecker.h b/src/backend/ThemeChecker.h new file mode 100755 index 0000000000000000000000000000000000000000..f74ae447bc57cb2065cf658b6fdc6c1c292d7bed --- /dev/null +++ b/src/backend/ThemeChecker.h @@ -0,0 +1,40 @@ +#ifndef THEMECHECKER_H +#define THEMECHECKER_H + +#include +#include +#include + +#include +#include + +class ThemeChecker : public QObject +{ + Q_OBJECT + +public: + explicit ThemeChecker(QObject *parent = nullptr); + static ThemeChecker *instance(); + + bool useDarkTheme(); + +private: + void initThemeType(); + void initConnections(); + +signals: + void themeChanged(bool isDark); + +private slots: + void slotSettingChanged(const QString &_namespace, const QString &key, const QDBusVariant &variant); + void slotThemeNameChanged(const QByteArray &theme); + void slotPaletteTypeChanged(Dtk::Gui::DGuiApplicationHelper::ColorType paletteType); + +private: + QDBusInterface *m_interface = nullptr; + + Dtk::Gui::DGuiApplicationHelper::ColorType m_paletteType; + Dtk::Gui::DGuiApplicationHelper::ColorType m_themeType; +}; + +#endif // THEMECHECKER_H diff --git a/src/backend/downloadworker.cpp b/src/backend/downloadworker.cpp new file mode 100644 index 0000000000000000000000000000000000000000..720f35b794d15b121d581ae88d56d6b7e8357918 --- /dev/null +++ b/src/backend/downloadworker.cpp @@ -0,0 +1,305 @@ +#include "downloadworker.h" + +#include +#include +#include +#include + +#define DEFAULTURL "d.store.deepinos.org.cn" +#define MAXWAITTIME 200000 + +DownloadController::DownloadController(QObject *parent) +{ + Q_UNUSED(parent) + + // 初始化默认域名 + domains.clear(); + domains.append(DEFAULTURL); + + /* + domains = { + "d1.store.deepinos.org.cn", + "d2.store.deepinos.org.cn", + "d3.store.deepinos.org.cn", + "d4.store.deepinos.org.cn", + "d5.store.deepinos.org.cn" + }; + */ + this->threadNum = domains.size(); +} + +void DownloadController::setFilename(QString filename) +{ + this->filename = filename; +} + +bool checkMeatlink(QString metaUrl) +{ + QFile metaStatus("/tmp/spark-store/metaStatus.txt"); + if (metaStatus.exists()) + { + metaStatus.remove(); + } + QString cmd = QString("curl -I -s --connect-timeout 5 %1 -w %{http_code} |tail -n1 > /tmp/spark-store/metaStatus.txt").arg(metaUrl); + [[maybe_unused]] int ret = system(cmd.toUtf8().data());//不这样写就会-Wunused-variable 警告导致无法打包 + if (metaStatus.open(QFile::ReadOnly) && QString(metaStatus.readAll()).toUtf8() == "200") + { + metaStatus.remove(); + return true; + } + return false; +} + +void gennerateDomain(QVector &domains) +{ + QFile serverList(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/server.list"); + if (serverList.open(QFile::ReadOnly)) + { + QStringList list = QString(serverList.readAll()).trimmed().split("\n"); + qDebug() << list << list.size(); + domains.clear(); + + for (int i = 0; i < list.size(); i++) + { + if (list.at(i).contains("镜像源 Download only") && i + 1 < list.size()) + { + for (int j = i + 1; j < list.size(); j++) + { + domains.append(list.at(j)); + } + break; + } + } + if (domains.size() == 0) + { + domains.append(DEFAULTURL); + } + } + else + { + domains.append(DEFAULTURL); + } +} + +/** + * @brief 开始下载 + */ +void DownloadController::startDownload(const QString &url) +{ + // 获取下载任务信息 + fileSize = getFileSize(url); + if (fileSize == 0) + { + emit errorOccur("文件大小获取失败"); + return; + } + + auto future = QtConcurrent::run([=]() + { + QString metaUrl = url + ".metalink"; + qDebug() << "metalink" << metaUrl; + bool useMetalink = false; + if (checkMeatlink(metaUrl)) + { + useMetalink = true; + qDebug() << "useMetalink:" << useMetalink; + } + else + { + gennerateDomain(domains); + // qDebug() << domains << domains.size(); + } + + QString aria2Command = "-d"; //下载目录 + QString aria2Urls = ""; //下载地址 + QString aria2Verbose = "--summary-interval=1"; //显示下载速度 + QString aria2SizePerThreads = "--min-split-size=1M"; //最小分片大小 + QString aria2NoConfig = "--no-conf"; //不使用配置文件 + QString aria2NoSeeds = "--seed-time=0"; //不做种 + QStringList command; + QString downloadDir = "/tmp/spark-store/"; //下载目录 + QString aria2ConnectionPerServer = "--max-connection-per-server=1"; //每个服务器最大连接数 + QString aria2ConnectionMax = "--max-concurrent-downloads=16"; //最大同时下载数 + QString aria2ConnectionTimeout = "--connect-timeout=5"; // 5 秒服务器连接超时 + QString aria2MaxRetry = "--max-tries=1"; //设置最大重试次数 + + + if (useMetalink) //如果是metalink + { + command.append(metaUrl.toUtf8()); + } + else + { + for (int i = 0; i < domains.size(); i++) //遍历域名 + { + command.append(replaceDomain(url, domains.at(i)).replace("+","%2B").toUtf8()); //对+进行转译,避免oss出错 + } + } + + + qint64 downloadSizeRecord = 0; //下载大小记录 + qint8 failDownloadTimes = 0; // 记录重试次数 + const qint8 maxRetryTimes = 3; //最大重试次数 + QString speedInfo = ""; //显示下载速度 + QString percentInfo = ""; //显示下载进度 + command.append(aria2Command.toUtf8()); + command.append(downloadDir.toUtf8()); + command.append(aria2Verbose.toUtf8()); + command.append(aria2NoConfig.toUtf8()); + command.append(aria2SizePerThreads.toUtf8()); + command.append(aria2ConnectionPerServer.toUtf8()); + command.append(aria2ConnectionMax.toUtf8()); + command.append(aria2ConnectionTimeout.toUtf8()); + command.append(aria2MaxRetry.toUtf8()); + + if (useMetalink) + { + command.append(aria2NoSeeds.toUtf8()); + } + qDebug() << command; + + bool downloadSuccess = true; + QProcess cmd; + cmd.setProcessChannelMode(QProcess::MergedChannels); + cmd.setProgram("aria2c"); + cmd.setArguments(command); + cmd.start(); + cmd.waitForStarted(-1); //等待启动完成 + + // Timer + QTimer *timeoutTimer = new QTimer(this); + timeoutTimer->setSingleShot(true); // 单次触发 + connect(timeoutTimer, &QTimer::timeout, [&]() { + if (failDownloadTimes < maxRetryTimes) { + qDebug() << "Download timeout, restarting..."; + // 重新启动下载任务的代码 + restartDownload(cmd, command); // 调用重新启动下载任务的函数 + failDownloadTimes += 1; + timeoutTimer->start(MAXWAITTIME); // 重新启动定时器 + } else{ + emit errorOccur(tr("Download Failed, please retry :(")); // 下载失败 + downloadSuccess = false; + cmd.close(); + cmd.terminate(); // 终止当前的下载进程 + cmd.waitForFinished(); // 等待进程结束 + } + }); + + connect(&cmd, &QProcess::readyReadStandardOutput, [&]() + { + timeoutTimer->start(MAXWAITTIME); // 重置超时计时器,15秒超时 + //通过读取输出计算下载速度 + QString message = cmd.readAllStandardOutput().data(); + message = message.replace(" ", ""); + QStringList list; + qint64 downloadSize = 0; + int downloadSizePlace1 = message.indexOf("("); + int downloadSizePlace2 = message.indexOf(")"); + int speedPlace1 = message.indexOf("DL:"); + int speedPlace2 = message.indexOf("ETA"); + if (downloadSizePlace1 != -1 && downloadSizePlace2 != -1) + { + percentInfo = message.mid(downloadSizePlace1 + 1, downloadSizePlace2 - downloadSizePlace1 - 1).replace("%", ""); + if (percentInfo != "s") + { + int percentInfoNumber = percentInfo.toUInt(); + + downloadSize = percentInfoNumber * fileSize / 100; + } + } + if (speedPlace1 != -1 && speedPlace2 != -1 && speedPlace2 - speedPlace1 <= 15) + { + speedInfo = message.mid(speedPlace1 + 3, speedPlace2 - speedPlace1 - 3); + speedInfo += "/s"; + } + if (downloadSize >= downloadSizeRecord) + { + downloadSizeRecord = downloadSize; + timeoutTimer->stop(); // 如果有进度,停止超时计时器 + } + if (percentInfo == "OK") + { + finished = true; + emit downloadProcess("", fileSize, fileSize); + qDebug() << "finished:" << finished; + } + else + { + emit downloadProcess(speedInfo, downloadSizeRecord, fileSize); + } + }); + connect(&cmd, &QProcess::readyReadStandardError, [&]() + { + emit errorOccur(cmd.readAllStandardError().data()); + downloadSuccess = false; + cmd.close(); + }); + + pidNumber = cmd.processId(); + + cmd.waitForFinished(-1); + cmd.close(); + + if(!downloadSuccess) + { + return; + } + + // 统计下载量 + QString SenderdPath = "/opt/durapps/spark-store/bin/ss-feedback/sender-d"; + /* + * https://en.wikipedia.org/wiki/HD_70642 + * HD 70642 is a star with an exoplanetary companion in the southern constellation of Puppis. + */ + QProcess mailProcess; + mailProcess.start(SenderdPath.toUtf8(), QStringList() << metaUrl << "HD70642"); + mailProcess.waitForStarted(); + mailProcess.waitForFinished(3000); + mailProcess.close(); + + emit downloadFinished(); }); +} + +/** + * @brief 停止下载 + */ +void DownloadController::stopDownload() +{ + if (pidNumber < 0) + { + return; + } + + // 实现下载进程退出 + QString killCmd = QString("kill -9 %1").arg(pidNumber); + [[maybe_unused]] int ret = system(killCmd.toUtf8()); + qDebug() << "kill aria2!"; + pidNumber = -1; +} + +void DownloadController::restartDownload(QProcess &cmd, const QStringList &command) +{ + cmd.terminate(); // 终止当前的下载进程 + cmd.waitForFinished(); // 等待进程结束 + cmd.setArguments(command); // 重新设置参数 + cmd.start(); // 重新启动下载 + cmd.waitForStarted(-1); // 等待启动完成 +} + +qint64 DownloadController::getFileSize(const QString &url) +{ + // 已经无需使用 qtnetwork 再获取 filesize,完全交给 aria2 来计算进度。 为保证兼容性,故保留此函数。 + qDebug() << "Begin download:" << url; + qint64 fileSize = 10000; + return fileSize; +} + +QString DownloadController::replaceDomain(const QString &url, const QString domain) +{ + QRegularExpression regex(R"((?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9])"); + if (regex.match(url).hasMatch()) + { + return QString(url).replace(regex.match(url).captured(), domain); + } + return url; +} diff --git a/src/backend/downloadworker.h b/src/backend/downloadworker.h new file mode 100644 index 0000000000000000000000000000000000000000..1f3217a831fd3ce41ccac04a48585deda0a94fc1 --- /dev/null +++ b/src/backend/downloadworker.h @@ -0,0 +1,37 @@ +#ifndef DOWNLOADWORKER_H +#define DOWNLOADWORKER_H + +#include +#include +#include + +class DownloadController : public QObject +{ + Q_OBJECT + +public: + explicit DownloadController(QObject *parent = nullptr); + + void setFilename(QString filename); + void startDownload(const QString &url); + void stopDownload(); + void restartDownload(QProcess &cmd, const QStringList &command); + qint64 getFileSize(const QString& url); + QString replaceDomain(const QString& url, const QString domain); + +signals: + void errorOccur(const QString& msg); + void downloadProcess(QString, qint64, qint64); + void downloadFinished(); + +private: + int threadNum; + qint64 pidNumber = -1; + QString filename; + qint64 fileSize; + QVector> ranges; + bool finished = false; + QVector domains; +}; + +#endif // FILEDOWNLOADWORKER_H diff --git a/src/backend/image_show.cpp b/src/backend/image_show.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ee1ab142a4aa36e4b74bac43d433526042c8c38a --- /dev/null +++ b/src/backend/image_show.cpp @@ -0,0 +1,57 @@ +#include "image_show.h" + +#include +#include // Qt5 不再建议使用 QDesktopWidget +#include + +image_show::image_show(QWidget *parent) : QWidget(parent), + m_dialog(new big_image), + m_label(new QLabel) +{ + QHBoxLayout *layout = new QHBoxLayout; + layout->addWidget(m_label); + setLayout(layout); + m_label->setText("layout"); + m_label->setScaledContents(true); +} + +void image_show::setImage(QPixmap image) +{ + QImage screen0; + screen0 = image.toImage(); + QImage re_screen1; + QImage re_screen0 = screen0.scaled(QSize(400, 300), Qt::KeepAspectRatio, Qt::SmoothTransformation); + + // 获取当前app所在的主屏幕尺寸 + desktop_w = QGuiApplication::screenAt(QCursor().pos())->geometry().width(); + desktop_h = QGuiApplication::screenAt(QCursor().pos())->geometry().height(); + + if (screen0.width() > int(desktop_w / 3 * 2) || screen0.height() > int(desktop_h / 3 * 2)) + { + re_screen1 = screen0.scaled(QSize(int(desktop_w / 3 * 2), int(desktop_h / 3 * 2)), Qt::KeepAspectRatio, Qt::SmoothTransformation); + m_image = QPixmap::fromImage(re_screen1); + } + else + { + m_image = image; + } + + m_label->setPixmap(QPixmap::fromImage(re_screen0)); +} + +void image_show::mousePressEvent(QMouseEvent *) +{ + m_dialog->setimage(m_image); + + // 识别主屏幕尺寸并设置 widget 大小 + m_dialog->setFixedSize(qMin(desktop_w, m_image.width() + int(desktop_h / 16 * m_image.width() / m_image.height())), qMin(desktop_h, m_image.height() + int(desktop_h / 16))); + + m_dialog->move(QGuiApplication::screenAt(QCursor().pos())->geometry().center() - m_dialog->rect().center()); + + m_dialog->show(); +} +image_show::~image_show() +{ + delete m_dialog; + delete m_label; +} diff --git a/src/backend/image_show.h b/src/backend/image_show.h new file mode 100644 index 0000000000000000000000000000000000000000..0812e770416f1f65016e493aa7c1d9cff6c5b735 --- /dev/null +++ b/src/backend/image_show.h @@ -0,0 +1,32 @@ +#ifndef IMAGE_SHOW_H +#define IMAGE_SHOW_H + +#include +#include + +#include "widgets/big_image.h" + +class image_show : public QWidget +{ + Q_OBJECT + +public: + explicit image_show(QWidget *parent = nullptr); + + int desktop_w; + int desktop_h; + + void setImage(QPixmap); + ~image_show(); + +protected: + void mousePressEvent(QMouseEvent *event) override; + +private: + big_image *m_dialog; + QLabel *m_label; + QLabel image; + QPixmap m_image; +}; + +#endif // IMAGE_SHOW_H diff --git a/src/backend/sparkapi.cpp b/src/backend/sparkapi.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8c64d1c9b6b110eda40bee6acf385e7d5cfd32b7 --- /dev/null +++ b/src/backend/sparkapi.cpp @@ -0,0 +1,101 @@ +#include "sparkapi.h" + +#include +#include +#include + +QString SparkAPI::serverUrl = ""; +#ifdef __x86_64__ + QString SparkAPI::serverUrlDir = "store"; + +#elif __aarch64__ + QString SparkAPI::serverUrlDir = "aarch64-store"; +#elif __loongarch__ + QString SparkAPI::serverUrlDir = "loong64-store"; +#endif + +SparkAPI::SparkAPI(QObject *parent) : QObject(parent) +{ + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + if (!config.value("server/choose").toString().isEmpty() && config.value("server/updated").toBool()) + { + SparkAPI::setServerUrl(config.value("server/choose").toString()); + } +} + +void SparkAPI::get(QUrl url) +{ + QNetworkRequest request; + HttpRequest *httprequest = new HttpRequest; + request.setUrl(QUrl(url.toString().replace("+", "%2B"))); + connect(httprequest, &HttpRequest::finished, [=](QString data) + { + QByteArray arr = data.toUtf8(); + // 解析 Json + QJsonParseError error; + if(QJsonDocument::fromJson(arr,&error).isArray()) + { + auto doc = QJsonDocument::fromJson(arr,&error).array(); + emit finished(doc); + } else { + auto doc = QJsonDocument::fromJson(arr,&error).object(); + emit finishedObject(doc); + } + + httprequest->deleteLater(); + }); + + httprequest->getRequest(request); +} + +void SparkAPI::getRAW(QUrl url) +{ + QNetworkRequest request; + HttpRequest *httprequest = new HttpRequest; + request.setUrl(QUrl(url.toString().replace("+", "%2B"))); + connect(httprequest, &HttpRequest::finished, [=](QString data) + { + emit finishedRAW(data); + httprequest->deleteLater(); }); + httprequest->getRequest(request); +} + +void SparkAPI::getAppList(QString type) +{ + get(QUrl(getServerUrl() + SparkAPI::serverUrlDir + "/" + type + "/applist.json")); +} + +void SparkAPI::getSearchList(QString keyword) +{ + get(QUrl("https://search.deepinos.org.cn/appinfo/search?keyword=" + keyword)); +} + +void SparkAPI::getAppInfo(QUrl spk) +{ + get(QUrl(getServerUrl() + SparkAPI::serverUrlDir + spk.path().replace("+", "%2B") + "/app.json")); +} + +QString SparkAPI::getArchDir() +{ + return SparkAPI::serverUrlDir; +} + +void SparkAPI::getAppDownloadTimes(QUrl spk) +{ + getRAW(QUrl(getServerUrl() + SparkAPI::serverUrlDir + spk.path().replace("+", "%2B") + "/download-times.txt")); +} + +QString SparkAPI::getServerUrl() +{ + return SparkAPI::serverUrl; +} + +QString SparkAPI::getImgServerUrl() +{ + return SparkAPI::serverUrl; +} + +void SparkAPI::setServerUrl(QString url) +{ + SparkAPI::serverUrl = url; +} diff --git a/src/backend/sparkapi.h b/src/backend/sparkapi.h new file mode 100644 index 0000000000000000000000000000000000000000..df9d8d34d4bc4a203f7361a2f6e194e7211e26c2 --- /dev/null +++ b/src/backend/sparkapi.h @@ -0,0 +1,40 @@ +#ifndef SPARKAPI_H +#define SPARKAPI_H + +#include "utils/httprequest.h" + +#include +#include +#include +#include +#include + +class SparkAPI : public QObject +{ + Q_OBJECT + +public: + explicit SparkAPI(QObject *parent = nullptr); + + static QString getServerUrl(); + static QString getImgServerUrl(); + static void setServerUrl(QString url); + void getAppDownloadTimes(QUrl spk); + void getSearchList(QString keyword); + void get(QUrl url); + void getRAW(QUrl url); + void getAppList(QString type); + void getAppInfo(QUrl spk); + static QString getArchDir(); + +signals: + void finished(QJsonArray); + void finishedRAW(QString); + void finishedObject(QJsonObject); + +private: + static QString serverUrl; + static QString serverUrlDir; +}; + +#endif // SPARKAPI_H diff --git a/src/dbus/dbussparkstoreservice.cpp b/src/dbus/dbussparkstoreservice.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aaa4bb39ccf8d73a28a3b8958da77ac91d3c6223 --- /dev/null +++ b/src/dbus/dbussparkstoreservice.cpp @@ -0,0 +1,11 @@ +#include "dbussparkstoreservice.h" +#include +DBusSparkStoreService::DBusSparkStoreService(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ +} + +void DBusSparkStoreService::activeWindow(const QString &arg) +{ + emit sigOpenUrl(arg); +} diff --git a/src/dbus/dbussparkstoreservice.h b/src/dbus/dbussparkstoreservice.h new file mode 100644 index 0000000000000000000000000000000000000000..7b1fdc8310af2c2bfd6f1798e3066c82806ccfbe --- /dev/null +++ b/src/dbus/dbussparkstoreservice.h @@ -0,0 +1,24 @@ +#ifndef DBUSSPARKSTORESERVICE_H +#define DBUSSPARKSTORESERVICE_H + +#include +#include +#include + +class Wallpaper; +class DBusSparkStoreService : public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.gitee.spark.store") +public: + explicit DBusSparkStoreService(QObject *parent); + +signals : + void sigOpenUrl(const QString &url); + +public Q_SLOTS: + void activeWindow(const QString &arg); + +}; + +#endif // DBUSSPARKSTORESERVICE_H diff --git a/src/main.cpp b/src/main.cpp index a3df5a4312ec4aa1ab077ce7d200b51a928e7f71..2e155e8a4a26698d664c580fb85e293dae1ee0d2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,86 +1,202 @@ -#include "mainwindow.h" -#include -#include -#include -#include // for geteuid -#include // for getenv -#include // For debugging output - -bool isRoot() { - return geteuid() == 0; -} +#include "application.h" +#include "mainwindow-dtk.h" +#include "utils/utils.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +DCORE_USE_NAMESPACE +DWIDGET_USE_NAMESPACE -bool elevateToRoot() { - QString program = QCoreApplication::applicationFilePath(); - qDebug() << "Current application path:" << program; +static QString buildDateTime; + + +void gatherInfo(FILE *fp, std::ofstream& logFile, const char* description) { + if (fp) { + char buffer[512]; + logFile << description << ":\n"; + while (fgets(buffer, sizeof(buffer), fp) != NULL) { + buffer[strcspn(buffer, "\n")] = 0; + logFile << buffer << "\n"; + } + pclose(fp); + } else { + logFile << "Failed to gather " << description << " info.\n"; + } +} - QByteArray display = qgetenv("DISPLAY"); - QByteArray xauthority = qgetenv("XAUTHORITY"); - QStringList args; - args << "env" - << "DISPLAY=" + display - << "XAUTHORITY=" + xauthority - << program; +void crashHandler(int sig) { + void *array[50]; + size_t size = backtrace(array, 50); + if (size == 0) { + perror("backtrace"); + exit(1); + } - QProcess process; - process.setProgram("pkexec"); - process.setArguments(args); + time_t t = time(NULL); + struct tm tm = *localtime(&t); + char filename[128]; + snprintf(filename, sizeof(filename), "/tmp/spark_store_crash_log_%04d%02d%02d_%02d%02d%02d.txt", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); - qDebug() << "Attempting to elevate using pkexec with arguments:" << args; + std::ofstream logFile(filename, std::ios::out); - process.start(); - if (!process.waitForStarted(5000)) { - qDebug() << "Failed to start pkexec."; - return false; + if (!logFile.is_open()) { + perror("ofstream"); + exit(1); } - // 阻塞等待提权进程退出(比如主程序窗口关闭) - if (!process.waitForFinished(-1)) { // 等待直到新进程退出 - qDebug() << "pkexec process waitForFinished failed."; - return false; + logFile << "Please send this log to the developer. QQ Group: 872690351\n"; + logFile << "Gitee: https://gitee.com/spark-store-project/spark-store/issues\n"; + logFile << "Gihub: https://github.com/spark-store-project/spark-store/issues\n"; + logFile << "Build Date and Time: " << buildDateTime.toStdString() << "\n"; + gatherInfo(popen("cat ~/.config/spark-union/spark-store/config.ini", "r"), logFile, "User Config File"); + + // Collecting System Information + gatherInfo(popen("LANG=en_US.UTF-8 uname -m", "r"), logFile, "CPU Architecture"); + gatherInfo(popen("LANG=en_US.UTF-8 lsb_release -a", "r"), logFile, "Distribution info"); + gatherInfo(popen("LANG=en_US.UTF-8 lscpu", "r"), logFile, "All CPU Info"); + gatherInfo(popen("LANG=en_US.UTF-8 free -h | grep Mem | awk '{print $2}'", "r"), logFile, "Memory Size"); + + + + logFile << "Error: signal " << sig << ":\n"; + for (size_t i = 0; i < size; i++) { + char **strings = backtrace_symbols(&array[i], 1); + if (strings != NULL && strings[0] != NULL) { + logFile << strings[0] << "\n"; + } else { + logFile << "Failed to get symbol.\n"; + } + free(strings); } - int exitCode = process.exitCode(); - QProcess::ExitStatus exitStatus = process.exitStatus(); + logFile.close(); - qDebug() << "pkexec exit code:" << exitCode; - qDebug() << "pkexec exit status:" << exitStatus; - qDebug() << "pkexec stderr:" << process.readAllStandardError(); + char openCmd[256]; + snprintf(openCmd, sizeof(openCmd), "xdg-open %s", filename); + if (system(openCmd) == -1) { + perror("system"); + } - return (exitStatus == QProcess::NormalExit && exitCode == 0); + fprintf(stderr, "Error: signal %d:\n", sig); + backtrace_symbols_fd(array, size, STDERR_FILENO); + + exit(1); } + int main(int argc, char *argv[]) { - // 必须在 QGuiApplication 实例创建之前调用 - // QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); - - QApplication a(argc, argv); - a.setWindowIcon(QIcon(":/resources/128*128/spark-update-tool.png")); - if (!isRoot()) { - qDebug() << "Not running as root. Attempting to elevate..."; - if (!elevateToRoot()) { - qDebug() << "Elevation failed or pkexec command was not executed successfully."; - QMessageBox::critical(nullptr, - "权限不足", - "提权失败!\n\n您的系统可能不支持 `pkexec` 或 `polkit` 配置不正确," - "或者您取消了授权。\n\n请尝试使用 `sudo` 命令运行此程序:" - "\n\n在终端中输入:\n`sudo " + QCoreApplication::applicationName() + "`"); - return 0; // 提权失败,退出程序 - } else { - // 如果 elevateToRoot 返回 true,说明 pkexec 命令本身执行成功 - // 但这并不意味着原始程序以 root 权限启动了 - // 因为 elevateToRoot 启动的是一个新的进程,当前进程应该退出 - // 否则会并行运行两个程序实例 - qDebug() << "pkexec command executed successfully (new process likely started). Exiting current process."; - return 0; // 当前非root进程退出 - } - } else { - qDebug() << "Running as root."; + // 崩溃处理 + signal(SIGSEGV, crashHandler); // 注册SIGSEGV处理函数 + + + // // Get build time + // static const QDate buildDate = QLocale(QLocale::English).toDate(QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy"); + // static const QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss"); + // buildDateTime = buildDate.toString("yyyy.MM.dd") + "-" + buildTime.toString("hh:mm:ss"); + + //在cmakelist.txt中设置 buildDateTime + QString buildDateTime = QString("%1-%2").arg(QString(BUILD_DATE)).arg(QString(BUILD_TIME)); + + // NOTE: 提前设置组织名称和应用名称,避免配置文件位置错误 + DApplication::setOrganizationName("spark-union"); + DApplication::setApplicationName("spark-store"); + Application::checkAppConfigLocation(); // 检查 ~/.config/spark-union/spark-store 文件夹是否存在 + + // 初始化 config.ini 配置文件 + Utils::initConfig(); + + // 回传版本信息,不涉及个人隐私 + DataCollectorAndUploader uploader; + QObject::connect(&uploader, &DataCollectorAndUploader::uploadSuccessful, [](){ + qDebug() << "Data uploaded successfully"; + }); + QObject::connect(&uploader, &DataCollectorAndUploader::uploadFailed, [](QString error){ + qDebug() << "Upload failed with error: " << error; + }); + + uploader.collectAndUploadData(); + + // Set display backend + Utils::setQPAPlatform(); + + // 龙芯机器配置,使得 DApplication 能正确加载 QtWebEngine + qputenv("DTK_FORCE_RASTER_WIDGETS", "FALSE"); + + // 设置 QtWebEngine 环境变量 + QStringList chromium_flags; + // 浏览器开启 GPU 支持 + // chromium_flags.append("--disable-features=UseModernMediaControls"); + // chromium_flags.append("--disable-web-security"); + // 全平台软件渲染Webkit + chromium_flags.append("--disable-gpu"); +#if defined __sw_64__ || __loongarch__ + chromium_flags.append("--no-sandbox"); +#endif + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", chromium_flags.join(" ").toUtf8()); + + /** + * NOTE: https://zhuanlan.zhihu.com/p/550285855 + * 避免 wayland 环境下从 QtWebEngine 后退回到 QWidget 时黑屏闪烁 + */ + if (Utils::isWayland()) { + qputenv("QMLSCENE_DEVICE", "softwarecontext"); + DApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); + } + + // 强制使用 DTK 平台插件 + QVector fakeArgs(argc + 2); + fakeArgs[0] = argv[0]; + fakeArgs[1] = const_cast("-platformtheme"); + fakeArgs[2] = const_cast("deepin"); + for (int i = 1; i < argc; i++) + { + fakeArgs[i + 2] = argv[i]; + } + int fakeArgc = argc + 2; // QCoreApplication 的 argc 要用引用,避免 c++ 编译器优化 + Application a(fakeArgc, fakeArgs.data()); + // 设置版本和构建时间 + a.setBuildDateTime(buildDateTime); + + // 限制单实例运行 + if (!a.setSingleInstance("spark-store")) + { + qWarning() << "Another instance has already started, activating..."; + return -1; } MainWindow w; + a.setMainWindow(&w); // 设置应用程序主窗口,用于初始化关于对话框 + + if (argc > 1) + { + QString arg1 = argv[1]; + if (arg1.trimmed().startsWith("spk://")) + { + w.openUrl(arg1); + } + } w.show(); + return a.exec(); -} \ No newline at end of file +} diff --git a/src/mainwindow-dtk.cpp b/src/mainwindow-dtk.cpp new file mode 100755 index 0000000000000000000000000000000000000000..2a4c037fbc3db99f35844d97fe63985565abdb09 --- /dev/null +++ b/src/mainwindow-dtk.cpp @@ -0,0 +1,560 @@ +#include "mainwindow-dtk.h" +#include "ui_mainwindow-dtk.h" +#include "utils/widgetanimation.h" +#include "widgets/common/progressbutton.h" +#include "widgets/downloadlistwidget.h" +#include "widgets/common/downloaditem.h" +#include "dbus/dbussparkstoreservice.h" +#include "application.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define AppPageApplist 0 +#define AppPageSearchlist 1 +#define AppPageAppdetail 2 +#define AppPageSettings 3 +#define UploadServerUrl "https://upload.deepinos.org.cn/" + +MainWindow::MainWindow(QWidget *parent) + : BaseWidgetOpacity(parent) + , ui(new Ui::MainWindow) + , downloadlistwidget(new DownloadListWidget) + , trayIcon(new QSystemTrayIcon(QIcon::fromTheme("spark-store"), this)) +{ + ui->setupUi(this); + + initUI(); + initConnections(); + + initTmpDir(); + + ui->appintopage->setDownloadWidget(downloadlistwidget); +} + +MainWindow::~MainWindow() +{ + delete ui; + + downloadlistwidget->deleteLater(); + + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + config.setValue("window/width", width()); + config.setValue("window/height", height()); + config.sync(); +} + +void MainWindow::initDbus() +{ + DBusSparkStoreService *dbusInter = new DBusSparkStoreService(this); + + QDBusConnection::sessionBus().registerService("com.gitee.spark.store"); + QDBusConnection::sessionBus().registerObject("/com/gitee/spark/store", "com.gitee.spark.store", this); + connect(dbusInter, &DBusSparkStoreService::sigOpenUrl, this, &MainWindow::onGetUrl); +} + +void MainWindow::onGetUrl(const QString &url) +{ + if (url.trimmed().startsWith("spk://")) + { + openUrl(url); + } + + showWindowAnimation = false; + closeWindowAnimation = false; + + setWindowState(windowState() & Qt::WindowActive); + activateWindow(); + show(); +} + +void MainWindow::onNewProcessInstance(qint64 pid, const QStringList &arguments) +{ + Q_UNUSED(pid) + + onGetUrl(arguments.value(1, "")); +} + +void MainWindow::openUrl(const QString &url) +{ + if (url.startsWith("spk://search/")) + { + QString keyword = url.mid(13); + if (keyword == "%") + { + qWarning() << "keyword '%' is not valid, which will cause QtWebEngine crash."; + return; + } + ui->applistpage_1->getSearchList(keyword); + switchPage(AppPageSearchlist); + } + else if (url.startsWith("spk://")) + { + ui->appintopage->openUrl(QUrl::fromUserInput(url)); + switchPage(AppPageAppdetail); + } + else + { + QDesktopServices::openUrl(QUrl::fromUserInput(url)); + } +} + +bool MainWindow::isCloseWindowAnimation() +{ + return closeWindowAnimation; +} + +void MainWindow::closeEvent(QCloseEvent *event) +{ + // 判断下载任务数量,如果没有要下载的,就直接退出主程序 + if(!downloadlistwidget->isDownloadInProcess()){ + // 已经全部下载完成 + qApp->quit(); + } + + BaseWidgetOpacity::closeEvent(event); +} + +void MainWindow::changeEvent(QEvent *event) +{ + if (event->type() != QEvent::StyleChange) { + return BaseWidgetOpacity::changeEvent(event); + } + + BaseWidgetOpacity::changeEvent(event); + downloadButton->setFixedSize(searchEdit->sizeHint().height(), searchEdit->sizeHint().height()); +} + +void MainWindow::initUI() +{ + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + QSize size; + size.rwidth() = config.value("window/width").toInt(); + size.rheight() = config.value("window/height").toInt(); + if (!size.isEmpty()) { + resize(size); + } + + // 让打开时界面显示在正中 + moveToCenter(this); + + setWindowTitle(QObject::tr("Spark Store")); + setMaskAlpha(250); + + initTitleBar(); + initLeftMenu(); + + ui->stackedWidget->setCurrentIndex(0); + updateUi(0); + + initTrayIcon(); + + refreshTheme(ThemeChecker::instance()->useDarkTheme()); +} + +void MainWindow::initTitleBar() +{ + ui->titlebar->setIcon(QIcon::fromTheme("spark-store")); + ui->titlebar->setBackgroundTransparent(true); + + // 初始化标题栏控件 + DLabel *titleLabel = new DLabel(ui->titlebar); + titleLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + titleLabel->setText(tr("Spark Store")); + + backButton = new DPushButton(ui->titlebar); + + searchEdit = new DSearchEdit(ui->titlebar); + searchEdit->setPlaceholderText(tr("Search or enter spk://")); + searchEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + searchEdit->lineEdit()->setFixedWidth(350); + + downloadButton = new ProgressButton(ui->titlebar); + downloadButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + downloadButton->setDownloadListWidget(downloadlistwidget); + downloadButton->setFocusPolicy(Qt::FocusPolicy::ClickFocus); + downloadButton->setFixedSize(searchEdit->sizeHint().height(), searchEdit->sizeHint().height()); + downloadlistwidget->setFocusProxy(downloadButton); + + QWidget *customWidget = new QWidget(ui->titlebar); + customWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + ui->titlebar->setCustomWidget(customWidget); + + QHBoxLayout *customWidgetLayout = new QHBoxLayout(customWidget); + customWidgetLayout->setContentsMargins(8, 0, 0, 0); + customWidgetLayout->setSpacing(0); + customWidgetLayout->addWidget(titleLabel, 0, Qt::AlignLeft); + customWidgetLayout->addSpacing(8); + customWidgetLayout->addWidget(backButton, 0, Qt::AlignLeft); + QWidget *centralWidget = new QWidget(customWidget); + centralWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + customWidgetLayout->addWidget(centralWidget, 1, Qt::AlignHCenter); + + QHBoxLayout *centralLayout = new QHBoxLayout(centralWidget); + centralLayout->setContentsMargins(20, 0, 10, 0); + centralLayout->setSpacing(0); + + centralLayout->addWidget(searchEdit, 0, Qt::AlignHCenter); + centralLayout->addSpacing(10); + centralLayout->addWidget(downloadButton, 0, Qt::AlignHCenter); + + initTitleBarMenu(); + + backButton->setDisabled(true); + downloadlistwidget->hide(); +} + +void MainWindow::initTitleBarMenu() +{ + QAction *actionSubmission = new QAction(tr("Submit App"), this); + QAction *actionSubmissionWithClient = new QAction(tr("Submit App with client(Recommanded)"), this); + QAction *setting = new QAction(tr("Settings")); + QAction *upgrade = new QAction(tr("APP Upgrade and Install Settings")); + QMenu *menu = new QMenu(ui->titlebar); + menu->addAction(setting); + menu->addAction(upgrade); + menu->addAction(actionSubmission); + menu->addAction(actionSubmissionWithClient); + + ui->titlebar->setMenu(menu); + + connect(actionSubmission, &QAction::triggered, this, [=] + { QDesktopServices::openUrl(QUrl(UploadServerUrl)); }); + connect(setting, &QAction::triggered, this, [=] + { + switchPage(AppPageSettings); + ui->settingspage->updateUI(); }); + connect(upgrade, &QAction::triggered, this, [=] + { QProcess::startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-update-controler.sh", QStringList()); }); + // 投稿器 + connect(actionSubmissionWithClient, &QAction::triggered, this, [=] + { + QString submitterSpk = "spk://store/tools/spark-store-submitter"; + QFile actionSubmissionClientStatus("/opt/spark-store-submitter/bin/spark-store-submitter"); + if (actionSubmissionClientStatus.exists()) + { + qDebug() << "投稿器存在"; + QProcess::startDetached("/opt/spark-store-submitter/bin/spark-store-submitter", QStringList()); + } + else + { + qDebug() << "投稿器不存在,跳转页面"; + openUrl(submitterSpk); + } }); +} + +void MainWindow::initLeftMenu() +{ + // 侧边栏按钮 + foreach (QAbstractButton *button, ui->buttonGroup->buttons()) + { + button->setStyleSheet("QPushButton{qproperty-icon: url(data/images/userMangaer/teacher.png);}"); + connect(button, &QPushButton::toggled, [=](bool checked) + { + if (checked == true) { + searchEdit->clearEdit(); + updateUi(ui->buttonGroup->buttons().indexOf(button)); + } }); + } +} + +void MainWindow::initTrayIcon() +{ + trayIcon->setToolTip(tr("Spark Store")); + + QMenu *menu = new QMenu(this); + QAction *showAction = new QAction(QObject::tr("Show MainWindow"), menu); + QAction *aboutAction = new QAction(qApp->translate("TitleBarMenu", "About"), menu); + QAction *exitAction = new QAction(qApp->translate("TitleBarMenu", "Exit"), menu); + menu->addAction(showAction); + menu->addAction(aboutAction); + menu->addAction(exitAction); + trayIcon->setContextMenu(menu); + + connect(showAction, &QAction::triggered, this, [=]() + { + showWindowAnimation = false; + closeWindowAnimation = false; + + setWindowState(windowState() & Qt::WindowActive); + activateWindow(); + show(); }); + connect(aboutAction, &QAction::triggered, this, [=]() + { + qobject_cast(qApp)->handleAboutAction(); }); + connect(exitAction, &QAction::triggered, this, [=]() + { + qobject_cast(qApp)->quit(); }); + + trayIcon->show(); +} + +void MainWindow::refreshTheme(bool isDarkMode) +{ + // 使用isDarkMode变量来判断是否是深色模式 + if (isDarkMode) { + //深色模式 + setMaskColor(QColor("#2a2b2b")); + backButton->setIcon(QIcon(":/icon/dark/back.svg")); + downloadButton->setIcon(":/icon/dark/download.svg"); + downloadButton->setBackgroundColor(QColor("#444444")); + downloadButton->setColor(QColor("#66CCFF")); + ui->pushButton_14->setIcon(QIcon(":/icon/dark/update.svg")); + for (int i = 0; i < ui->buttonGroup->buttons().size(); i++) { + ui->buttonGroup->buttons()[i]->setIcon(QIcon(":/icon/dark/leftbutton_" + QString::number(i) + ".svg")); + if (QLocale::system().name() == "zh_CN") { + ui->buttonGroup->buttons()[i]->setStyleSheet("QPushButton{background-color:transparent;}\ + QPushButton:hover{background-color:#7a7a7a;border:0px;border-radius:8px;}\ + QPushButton:checked{background-color:#6e6e6e;border:0px;border-radius:8px;}"); + } else { + ui->buttonGroup->buttons()[i]->setStyleSheet("QPushButton{background-color:transparent;text-align: left; padding-left: 15px;}\ + QPushButton:hover{background-color:#7a7a7a;border:0px;border-radius:8px;text-align: left; padding-left: 15px;}\ + QPushButton:checked{background-color:#6e6e6e;border:0px;border-radius:8px;text-align: left; padding-left: 15px;}"); + } + } + } else { + //亮色模式 + setMaskColor(QColor("#f3f7f8")); + backButton->setIcon(QIcon(":/icon/light/back.svg")); + downloadButton->setBackgroundColor(QColor("#e3e4e4")); + downloadButton->setColor(QColor("#66CCFF")); + downloadButton->setIcon(":/icon/light/download.svg"); + ui->pushButton_14->setIcon(QIcon(":/icon/light/update.svg")); + for (int i = 0; i < ui->buttonGroup->buttons().size(); i++) { + ui->buttonGroup->buttons()[i]->setIcon(QIcon(":/icon/light/leftbutton_" + QString::number(i) + ".svg")); + if (QLocale::system().name() == "zh_CN") { + ui->buttonGroup->buttons()[i]->setStyleSheet("QPushButton{background-color:transparent;}\ + QPushButton:hover{background-color:#eAeAeA;border:0px;border-radius:8px;}\ + QPushButton:checked{background-color:#dddddd;border:0px;border-radius:8px;}"); + } else { + ui->buttonGroup->buttons()[i]->setStyleSheet("QPushButton{background-color:transparent;text-align: left; padding-left: 15px;}\ + QPushButton:hover{background-color:#eAeAeA;border:0px;border-radius:8px;text-align: left; padding-left: 15px;}\ + QPushButton:checked{background-color:#dddddd;border:0px;border-radius:8px;text-align: left; padding-left: 15px;}"); + } + } + } + ui->pushButton_14->setStyleSheet(ui->pushButton_4->styleSheet()); + ui->applistpage->setTheme(isDarkMode); + ui->applistpage_1->setTheme(isDarkMode); + ui->appintopage->setTheme(isDarkMode); + ui->settingspage->setTheme(isDarkMode); +} + +void MainWindow::initConnections() +{ + // 主题切换 + connect(ThemeChecker::instance(), &ThemeChecker::themeChanged, this, &MainWindow::refreshTheme); + + // appintopage按下下载按钮时标题栏下载列表按钮抖动 + connect(ui->appintopage, &AppIntoPage::clickedDownloadBtn, [=]() + { + WidgetAnimation::widgetShake(downloadButton, 6); // 第一个参数是抖动的控件,第二个参数是抖动范围(像素) + }); + + connect(backButton, &QPushButton::clicked, [=]() + { + ui->stackedWidget->setCurrentIndex(pageHistory.at(pageHistory.count() - 2)); + pageHistory.removeLast(); + if (pageHistory.count() > 1) { + backButton->setEnabled(true); + } else { + backButton->setDisabled(true); + } }); + + // 搜索事件 + connect(searchEdit, &DSearchEdit::returnPressed, this, [=]() + { + QString searchtext = searchEdit->text(); + if (!searchtext.isEmpty()) { + if (searchtext.startsWith("spk://")) { + openUrl(searchtext); + searchEdit->clearEdit(); + } else { + if (searchtext == "%") + { + qWarning() << "keyword '%' matches too many results, which will cause QtWebEngine crash."; + } + else + { + ui->applistpage_1->getSearchList(searchtext); + switchPage(AppPageSearchlist); + } + } + } + this->setFocus(); }); + + connect(downloadlistwidget, &DownloadListWidget::downloadProgress, this, [=](int i) + { downloadButton->setProgress(i); }); + // 列表点击事件 + connect(ui->applistpage, &AppListPage::clicked, this, [=](QUrl spk) + { openUrl(spk.toString()); }); + connect(ui->applistpage_1, &AppListPage::clicked, this, [=](QUrl spk) + { openUrl(spk.toString()); }); + connect(ui->settingspage, &SettingsPage::openUrl, this, [=](QUrl spk) + { openUrl(spk.toString()); }); + + // 托盘图标点击事件 + connect(trayIcon, &QSystemTrayIcon::activated, this, [=](QSystemTrayIcon::ActivationReason reason) + { + switch (reason) { + case QSystemTrayIcon::Trigger: + { + showWindowAnimation = false; + closeWindowAnimation = false; + + setWindowState(windowState() & Qt::WindowActive); + activateWindow(); + show(); + + Q_FALLTHROUGH(); + } + default: + break; + } }); + + connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::newProcessInstance, this, &MainWindow::onNewProcessInstance); +} + +void MainWindow::initTmpDir() +{ + // 新建临时文件夹 + QDir dir; + dir.mkpath("/tmp/spark-store"); + + // 检查写入权限 + QFileInfo info("/tmp/spark-store"); + + if (info.isWritable() == false) + { + auto future = QtConcurrent::run([=] + { + sleep(3); + auto upgradeP = new QProcess(); + upgradeP->startDetached("zenity", QStringList() << "--warning" + << "--text" + << "用户未拥有 /tmp/spark-store 写入权限,星火商店会因此工作异常,请检查!" + << "--title" + << "权限受限提示" + << "--width" + << "360" + ); + upgradeP->waitForStarted(); + upgradeP->waitForFinished(30); + upgradeP->deleteLater(); }); + } +} + +void MainWindow::switchPage(int now) // 临时方案,回家后修改 +{ + qDebug() << pageHistory.count(); + if (pageHistory.count() >= 1) + { + backButton->setEnabled(true); + } + else + { + backButton->setDisabled(true); + } + ui->stackedWidget->setCurrentIndex(now); + ui->stackedWidget->currentWidget()->setFocus(); + pageHistory << now; +} + +// 刷新界面 +void MainWindow::updateUi(int now) +{ + pageHistory.clear(); + QStringList itemlist; + itemlist << "" + << "network" + << "chat" + << "music" + << "video" + << "image_graphics" + << "games" + << "office" + << "reading" + << "development" + << "tools" + << "themes" + << "others"; + ui->applistpage->getAppList(itemlist[now]); + qDebug() << itemlist[now]; + switchPage(AppPageApplist); +} + +void MainWindow::notify(QObject *receiver, QEvent *event) +{ + if (!receiver) { + return; + } + + Dtk::Widget::DStyle *o_ptr = qobject_cast(receiver); + if (o_ptr) { + return; + } + + if (receiver->inherits("QWidgetWindow") + || receiver->inherits("QStyleSheetStyle")) { + return; + } + + if (event->type() == QEvent::FocusIn) { + QList list = downloadButton->findChildren(QString(), Qt::FindChildrenRecursively); + list << downloadlistwidget->findChildren(QString(), Qt::FindChildrenRecursively); + if (receiver != downloadButton && receiver != downloadlistwidget && !list.contains(receiver)) { + downloadlistwidget->hide(); + } + } else if (event->type() == QEvent::FocusOut) { + if (!downloadlistwidget->isActiveWindow() && !isActiveWindow()) { + downloadlistwidget->hide(); + } + } +} + +void MainWindow::on_pushButton_14_clicked() +{ + QString appPath; + // #ifdef QT_DEBUG + // appPath = QCoreApplication::applicationDirPath() ; + // QDir dir(appPath); + // dir.cdUp(); + // appPath = dir.absolutePath()+"/spark-update-tool/spark-update-tool"; + // qDebug() << "Spark Update Tool Path: " << appPath; + // if(appPath.isEmpty()) + // { + // qWarning() << "Spark Update Tool not found!"; + // return; + // } + // QProcess *process = new QProcess(this); + // QStringList arguments; + // arguments << appPath <<"--silent"; + // process->start(appPath, {"--silent"}); + // #else + // appPath = QStandardPaths::findExecutable("spark-update-tool"); + // QString program = "pkexec"; + // QStringList arguments; + // arguments << appPath; + // QProcess *process = new QProcess(this); + // process->start(program, arguments); + // #endif + appPath = QStandardPaths::findExecutable("spark-update-tool"); + qDebug() << "Spark Update Tool Path: " << appPath; + QString program = "pkexec"; + QStringList arguments; + arguments << appPath; + QProcess *process = new QProcess(this); + process->start(program, arguments); + +} \ No newline at end of file diff --git a/src/mainwindow-dtk.h b/src/mainwindow-dtk.h new file mode 100755 index 0000000000000000000000000000000000000000..791e885a9c10bd3ddf643ef7845ef17791df7a04 --- /dev/null +++ b/src/mainwindow-dtk.h @@ -0,0 +1,73 @@ +#ifndef MAINWINDOWDTK_H +#define MAINWINDOWDTK_H + +#include "widgets/base/basewidgetopacity.h" + +#include +#include +#include +#include +#include + +#include + +DWIDGET_USE_NAMESPACE + +namespace Ui { +class MainWindow; +} + +class ProgressButton; +class DownloadListWidget; +class MainWindow : public BaseWidgetOpacity +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = nullptr); + ~MainWindow() override; + + void openUrl(const QString &url); + + bool isCloseWindowAnimation(); + Q_INVOKABLE void refreshTheme(bool isDarkMode); + +protected: + void closeEvent(QCloseEvent *event) override; + void changeEvent(QEvent *event) override; + +private: + void initUI(); + void initTitleBar(); + void initTitleBarMenu(); + void initLeftMenu(); + void initTrayIcon(); + void initConnections(); + void initDbus(); + void initTmpDir(); + void switchPage(int now); + void updateUi(int now); + +public slots: + void notify(QObject *receiver, QEvent *event); + +private slots: + //接受来自dbus的url + void onGetUrl(const QString &url); + void onNewProcessInstance(qint64 pid, const QStringList &arguments); + void on_pushButton_14_clicked(); + +private: + Ui::MainWindow *ui; + + DPushButton *backButton; + DSearchEdit *searchEdit; + ProgressButton *downloadButton; + DownloadListWidget *downloadlistwidget; + + QSystemTrayIcon *trayIcon = nullptr; + + QList pageHistory; +}; + +#endif // MAINWINDOWDTK_H diff --git a/src/mainwindow-dtk.ui b/src/mainwindow-dtk.ui new file mode 100644 index 0000000000000000000000000000000000000000..490e7008cbd34d117ea9e2b57efda8a129f69e73 --- /dev/null +++ b/src/mainwindow-dtk.ui @@ -0,0 +1,668 @@ + + + MainWindow + + + + 0 + 0 + 1190 + 656 + + + + MainWindow + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 150 + 0 + + + + + 150 + 16777215 + + + + + + + + 0 + 36 + + + + Home + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Network + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Chat + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Music + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Video + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Picture + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Game + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Office + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Reading + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Development + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Tool + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Theme + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + Other + + + true + + + true + + + true + + + true + + + buttonGroup + + + + + + + + 0 + 36 + + + + APP Upgrade + + + false + + + true + + + true + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + false + + + .QWidget#mainpage { + background: transparent; + border-radius: 14px; +} + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + + + + + + + + + DTitlebar + QWidget +
DTitlebar
+ 1 +
+ + AppListPage + QWidget +
pages/applistpage.h
+ 1 +
+ + AppIntoPage + QWidget +
pages/appintopage.h
+ 1 +
+ + SettingsPage + QWidget +
pages/settingspage.h
+ 1 +
+
+ + + + + +
diff --git a/src/pages/appintopage.cpp b/src/pages/appintopage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..37a5a3ae2ef3e974b0b63f884b01103d66b1cbff --- /dev/null +++ b/src/pages/appintopage.cpp @@ -0,0 +1,661 @@ +#include "appintopage.h" +#include "ui_appintopage.h" +#include "backend/sparkapi.h" +#include "widgets/downloadlistwidget.h" +#include "widgets/common/downloaditem.h" +#include "backend/image_show.h" +#include "application.h" +#include "utils/utils.h" +#include "pages/settingspage.h" + +#include +#include +#include + +#include +#include + +AppIntoPage::AppIntoPage(QWidget *parent) + : QWidget(parent) + , ui(new Ui::AppIntoPage) + , api(new SparkAPI(this)) +{ + initUI(); + initConnections(); + m_userAgent = QString("Mozilla/5.0 Spark-Store/" + QString(APP_VERSION) + " (Linux; " + QSysInfo::prettyProductName().toUtf8() + ";)").toLatin1(); +} + +AppIntoPage::~AppIntoPage() +{ + delete ui; +} + +void AppIntoPage::openUrl(const QUrl &url) +{ + clear(); + + // qDebug() << url; + spk = url; + + SparkAPI *api1 = new SparkAPI(this); + connect(api1, &SparkAPI::finishedObject, [=](const QJsonObject &appinfo) + { + info = appinfo; + + // 显示基本信息 + ui->title->setText(info["Name"].toString()); + ui->version->setText(info["Version"].toString()); + ui->author->setText(info["Author"].toString()); + ui->d_author->setText(info["Author"].toString()); + ui->d_size->setText(info["Size"].toString()); + ui->d_update->setText(info["Update"].toString()); + ui->d_pkgname->setText(info["Pkgname"].toString()); + ui->d_website->setText("" + tr("Click Open")); + ui->d_contributor->setText(info["Contributor"].toString()); + ui->label_2->setText(info["More"].toString()); + + // 显示 tags + #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QStringList taglist = info["Tags"].toString().split(";", Qt::SkipEmptyParts); + #else + QStringList taglist = info["Tags"].toString().split(";", QString::SkipEmptyParts); + #endif + + setAppinfoTags(taglist); + + // 获取图标和截图 + QString pkgUrlBase = api->getImgServerUrl() + SparkAPI::getArchDir() + url.path(); + // 创建网络请求管理器 + QNetworkAccessManager *iconManager = new QNetworkAccessManager(this); + + // 获取图标 + QNetworkRequest iconRequest; + iconRequest.setUrl(QUrl(pkgUrlBase + "/icon.png")); + iconRequest.setHeader(QNetworkRequest::UserAgentHeader, m_userAgent); + iconRequest.setHeader(QNetworkRequest::ContentTypeHeader, "charset='utf-8'"); + + + iconManager->get(iconRequest); + QObject::connect(iconManager, &QNetworkAccessManager::finished, [=](QNetworkReply *reply) + { + QByteArray jpegData = reply->readAll(); + iconpixmap.loadFromData(jpegData); + iconpixmap = iconpixmap.scaled(210, 200, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + ui->icon->setPixmap(iconpixmap); + ui->icon->setScaledContents(true); + + iconManager->deleteLater(); + reply->deleteLater(); + }); + + + for (int i = 0; i < 5 /* 魔法数字,最多五个截图 */; i++) + { + QString imgUrl = pkgUrlBase + "/screen_" + QString::number(i + 1) + ".png"; + QNetworkRequest request; + QNetworkAccessManager *manager = new QNetworkAccessManager(this); + request.setUrl(QUrl(imgUrl)); + request.setHeader(QNetworkRequest::UserAgentHeader, m_userAgent); + request.setHeader(QNetworkRequest::ContentTypeHeader, "charset='utf-8'"); + manager->get(request); + QObject::connect(manager, &QNetworkAccessManager::finished, [=](QNetworkReply *reply) + { + QByteArray jpegData = reply->readAll(); + QPixmap pixmap; + if (pixmap.loadFromData(jpegData)) + { + pixmap.scaled(100, 100, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + image_show *img = new image_show(this); + img->setImage(pixmap); + // img->setScaledContents(true); + QListWidgetItem *pItem = new QListWidgetItem(); + pItem->setSizeHint(QSize(280, 200)); + ui->listWidget->insertItem(i, pItem); + ui->listWidget->setItemWidget(pItem, img); + qDebug() << imgUrl; + } + + manager->deleteLater(); + }); + } + + + /** + * NOTE: No need to judget developmode status + */ + // Check UOS + // QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + // if (config.contains("UOS/EnableDeveloperMode") && !config.value("UOS/EnableDeveloperMode").toBool()){ + if (false) { + qDebug() << "UOS Developer Mode has not been enabled!"; + ui->downloadButton->setText(tr("Developer Mode Disabled")); + ui->downloadButton->setEnabled(false); + ui->downloadButton->show(); + } + else // 非 UOS 或 UOS 已经开启开发者模式 + { + QProcess isInstall; + bool isInstalled; + bool isUpdated; + QString packagename = info["Pkgname"].toString(); + isInstall.start("/opt/durapps/spark-store/bin/store-helper/check-is-installed", QStringList() << info["Pkgname"].toString()); + qDebug() << info["Pkgname"].toString(); + isInstall.waitForFinished(180 * 1000); // 默认超时 3 分钟 + + int exitCode = isInstall.exitCode(); + QProcess::ExitStatus exitStatus = isInstall.exitStatus(); + isInstall.close(); + + if (exitCode == 0 && exitStatus == QProcess::NormalExit) + { + isInstalled = true; + + // QProcess isUpdate; + // isUpdate.start("dpkg-query", QStringList() << "--showformat='${Version}'" + // << "--show" << info["Pkgname"].toString()); + // isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟 + // QString localVersion = isUpdate.readAllStandardOutput(); + // localVersion.replace("'", ""); + + // isUpdate.start("dpkg", QStringList() << "--compare-versions" << localVersion << "ge" << info["Version"].toString()); + // isUpdate.waitForFinished(180 * 1000); // 默认超时 3 分钟 + // if (isUpdate.exitCode() == 0 && isUpdate.exitStatus() == QProcess::NormalExit) + // { + // isUpdated = true; + // } + // else + // { + // isUpdated = false; + // } + // isUpdate.close(); + isUpdated = true; //去掉直接点击升级的功能 + } + else + { + isInstalled = false; + isUpdated = false; + } + + if (isInstalled) + { + if (isUpdated) + { + QProcess process; + QStringList arguments; + arguments << "check" << info["Pkgname"].toString(); + process.start("/opt/durapps/spark-store/bin/store-helper/ss-launcher", arguments); + if (process.waitForFinished()) { + exitCode = process.exitCode(); + exitStatus = process.exitStatus(); + if (exitCode != 0){ + ui->downloadButton->setText(tr("Reinstall")); + }else{ + ui->downloadButton->setText(tr("Launch")); + } + } + ui->downloadButton->setEnabled(true); + ui->downloadButton->show(); + ui->pushButton_3->show(); + } + else + { + ui->downloadButton->setText(tr("Upgrade")); + ui->downloadButton->setEnabled(true); + ui->downloadButton->show(); + ui->pushButton_3->show(); + } + } + else + { + ui->downloadButton->setText(tr("Download and Install")); + ui->downloadButton->setEnabled(true); + ui->downloadButton->show(); + } + + isDownloading(SparkAPI::getServerUrl() + SparkAPI::getArchDir() + spk.path() + "/" + info["Filename"].toString()); + } + + api1->disconnect(); + api1->deleteLater(); }); + + api1->getAppInfo(url); + + api->getAppDownloadTimes(url); +} + +void AppIntoPage::clear() +{ + ui->tag_a2d->hide(); + ui->tag_uos->hide(); + ui->tag_dtk5->hide(); + ui->tag_deepin->hide(); + ui->tag_dwine2->hide(); + ui->tag_dwine5->hide(); + ui->tag_debian->hide(); + ui->tag_ubuntu->hide(); + ui->tag_community->hide(); + ui->tag_native->hide(); + ui->tag_amber_ce_bookworm->hide(); + ui->tag_amber_ce_trixie->hide(); + ui->tag_amber_ce_sid->hide(); + ui->tag_amber_ce_deepin23->hide(); + + ui->icon->clear(); + ui->title->clear(); + ui->version->clear(); + ui->author->clear(); + ui->d_author->clear(); + ui->d_size->clear(); + ui->d_update->clear(); + ui->d_pkgname->clear(); + ui->d_website->clear(); + ui->d_contributor->clear(); + ui->label_2->clear(); + ui->downloadButton->hide(); + ui->downloadButton->setEnabled(false); + ui->pushButton_3->hide(); + + + + ui->listWidget->clear(); // NOTE: QListWidget::clear() 会析构所有 items +} + +void AppIntoPage::setTheme(bool dark) +{ + if (dark) + { + QString frameStyleSheet ="#frame,#frame_2,#frame_3,#frame_4 {background-color: #252525; border-radius: 14px; border: 1px solid rgb(64, 64, 64);}\ + QLabel#cardtitle,QLabel#title,QLabel#title_1,QLabel#title_2,QLabel#title_3 {color: #FFFFFF}"; + ui->frame->setStyleSheet(frameStyleSheet); + ui->frame_2->setStyleSheet(frameStyleSheet); + ui->frame_3->setStyleSheet(frameStyleSheet); + ui->frame_4->setStyleSheet(frameStyleSheet); + + ui->icon_1->setPixmap(QPixmap(":/icon/dark/box.svg")); + ui->icon_2->setPixmap(QPixmap(":/icon/dark/box.svg")); + ui->icon_3->setPixmap(QPixmap(":/icon/dark/calendar.svg")); + ui->icon_4->setPixmap(QPixmap(":/icon/dark/text.svg")); + ui->icon_5->setPixmap(QPixmap(":/icon/dark/folder.svg")); + ui->icon_6->setPixmap(QPixmap(":/icon/dark/globe.svg")); + } + else + { + //亮色模式 + QString frameStyleSheet ="#frame,#frame_2,#frame_3,#frame_4 {background-color: #fbfbfb; border-radius: 14px; border: 1px solid rgb(229,229,229);}\ + QLabel#cardtitle,QLabel#title,QLabel#title_1,QLabel#title_2,QLabel#title_3 {color: #000000}"; + ui->frame->setStyleSheet(frameStyleSheet); + ui->frame_2->setStyleSheet(frameStyleSheet); + ui->frame_3->setStyleSheet(frameStyleSheet); + ui->frame_4->setStyleSheet(frameStyleSheet); + + ui->icon_1->setPixmap(QPixmap(":/icon/light/box.svg")); + ui->icon_2->setPixmap(QPixmap(":/icon/light/box.svg")); + ui->icon_3->setPixmap(QPixmap(":/icon/light/calendar.svg")); + ui->icon_4->setPixmap(QPixmap(":/icon/light/text.svg")); + ui->icon_5->setPixmap(QPixmap(":/icon/light/folder.svg")); + ui->icon_6->setPixmap(QPixmap(":/icon/light/globe.svg")); + } +} + +void AppIntoPage::setDownloadWidget(DownloadListWidget *w) +{ + if (dw) + { + dw->deleteLater(); + dw = nullptr; + } + + dw = w; + connect(w, &DownloadListWidget::downloadFinished, this, [=]() { + isDownloading(SparkAPI::getServerUrl() + SparkAPI::getArchDir() + spk.path() + "/" + info["Filename"].toString()); + }, + Qt::QueuedConnection); +} + +void AppIntoPage::initUI() +{ + ui->setupUi(this); + + ui->listWidget->setViewMode(QListView::IconMode); + ui->listWidget->setFlow(QListView::TopToBottom); + ui->listWidget->setMovement(QListView::Static); + ui->listWidget->setMaximumHeight(200); + + clear(); +} + +void AppIntoPage::initConnections() +{ + connect(api, &SparkAPI::finishedRAW, [=](QString download_times) + { + download_times = download_times.trimmed(); + qDebug() << "Download Times:" + download_times; + ui->download_times->setText(download_times); }); +} + +void AppIntoPage::isDownloading(const QUrl &url) +{ + int index = dw->getUrlList().lastIndexOf(url); + if (index == -1) + { + ui->downloadButton->setEnabled(true); + return; + } + + DownloadItem *item = dw->getDIList().at(index); + if (item == nullptr) + { + ui->downloadButton->setEnabled(true); + return; + } + + ui->downloadButton->setEnabled(false); + ui->pushButton_3->hide(); + if (item->download == 2) + { + ui->downloadButton->setEnabled(true); + ui->downloadButton->setText(tr("Download and Install")); + } + if (item->download == 1) + { + ui->downloadButton->setEnabled(true); + ui->downloadButton->setText(tr("Install")); + } + if (item->isInstall) + { + ui->downloadButton->setEnabled(false); + ui->downloadButton->setText(tr("Installing")); + return; + } + if (item->download == 3) + { + QString packageName = info["Pkgname"].toString(); + QProcess process; + process.start("/opt/durapps/spark-store/bin/store-helper/check-is-installed", {packageName}); + process.waitForFinished(-1); + + int exitCode = process.exitCode(); + QProcess::ExitStatus exitStatus = process.exitStatus(); + + if (exitCode == 0 && exitStatus == QProcess::NormalExit) + { + QStringList arguments; + arguments << "check" << info["Pkgname"].toString(); + process.start("/opt/durapps/spark-store/bin/store-helper/ss-launcher", arguments); + if (process.waitForFinished()) { + exitCode = process.exitCode(); + exitStatus = process.exitStatus(); + if (exitCode != 0){ + ui->downloadButton->setText(tr("Reinstall")); + }else{ + ui->downloadButton->setText(tr("Launch")); + } + } + ui->downloadButton->setEnabled(true); + ui->downloadButton->show(); + ui->pushButton_3->show(); + process.close(); + } + else + { + ui->downloadButton->setEnabled(true); + ui->downloadButton->setText(tr("Download and Install")); + } + } +} + +void AppIntoPage::setAppinfoTags(const QStringList &tagList) +{ + bool ubuntuSupport = false; + bool deepinSupport = false; + bool uosSupport = false; + bool debianSupport = false; + bool hasAmberTag = false; + + // First pass: Check if any Amber tags exist + foreach (const QString &tag, tagList) + { + if (tag.startsWith("amber-ce-")) + { + hasAmberTag = true; + break; // No need to continue checking + } + } + + + // Second pass: Apply tags based on whether we have Amber tags + foreach (const QString &tag, tagList) + { + if (tag.isEmpty()) + continue; + + if (tag == "native") + ui->tag_native->show(); + + else if (tag == "community") + ui->tag_community->show(); + + else if (tag == "dtk5") + ui->tag_dtk5->show(); + + else if (tag == "dwine2") + ui->tag_dwine2->show(); + + else if (tag == "dwine5") + ui->tag_dwine5->show(); + + else if (tag == "a2d") + ui->tag_a2d->show(); + + else if (tag == "amber-ce-bookworm") + ui->tag_amber_ce_bookworm->show(); + + else if (tag == "amber-ce-trixie") + ui->tag_amber_ce_trixie->show(); + + else if (tag == "amber-ce-deepin23") + ui->tag_amber_ce_deepin23->show(); + + else if (tag == "amber-ce-sid") + ui->tag_amber_ce_sid->show(); + + // Only process distro tags if there are no Amber tags + else if (!hasAmberTag) + { + if (tag == "debian") + { + ui->tag_debian->show(); + debianSupport = true; + } + else if (tag == "ubuntu") + { + ui->tag_ubuntu->show(); + ubuntuSupport = true; + } + else if (tag == "deepin") + { + ui->tag_deepin->show(); + deepinSupport = true; + } + else if (tag == "uos") + { + ui->tag_uos->show(); + uosSupport = true; + } + } + } + + if (!hasAmberTag) + notifyUserUnsupportedTags(ubuntuSupport, deepinSupport, uosSupport, debianSupport); +} + + + +void AppIntoPage::notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport, bool debianSupport) +{ + if (!SettingsPage::needUncompatibleNotification) { + return; + } + + bool isDeepin = Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Deepin; + bool isUOS = Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Uos; + bool checkdeepin = (isDeepin && !deepinSupport); + bool checkuos = (isUOS && !uosSupport); + bool isUbuntu = false; + bool isDebian = false; + if (!checkdeepin && !checkuos) + { + // 使用更可靠的/etc/os-release检测 + QFile osRelease("/etc/os-release"); + if (osRelease.open(QIODevice::ReadOnly)) { + QString content = osRelease.readAll(); + isUbuntu = content.contains("ID=ubuntu"); + isDebian = content.contains("ID=debian") || content.contains("ID_LIKE=debian"); // 合并Debian系检测 + osRelease.close(); + } + } + + bool checkubuntu = (isUbuntu && !ubuntuSupport); + bool checkdebian = (isDebian && !debianSupport); + + if (checkdeepin) + { + Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on deepin, there may be problems")); + } + else if (checkuos) + { + Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on UOS, there may be problems")); + } + else if (checkubuntu) + { + Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on Ubuntu, there may be problems")); + } + else if (checkdebian) + { + Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on Debian, there may be problems")); + } + if (!isUbuntu && !isDeepin && !isUOS && !isDebian) + { + Utils::sendNotification("spark-store", tr("Warning"), tr("The current application does not support or tested on current platform, there may be problems")); + } + + return; + +} + +void AppIntoPage::on_downloadButton_clicked() +{ + QString downloadUrl = SparkAPI::getServerUrl() + SparkAPI::getArchDir() + spk.path() + "/" + info["Filename"].toString(); + if (ui->downloadButton->text() == tr("Install")) + { + DownloadItem *item = dw->getDIList()[dw->getUrlList().lastIndexOf(downloadUrl)]; + if (item == nullptr) + { + return; + } + + connect(item, &DownloadItem::finished, this, [=]() { + isDownloading(downloadUrl); + }, + Qt::QueuedConnection); + + item->install(0); + isDownloading(downloadUrl); + + return; + } + else if (ui->downloadButton->text() == tr("Launch")) + { + QString scriptPath = "/opt/durapps/spark-store/bin/store-helper/ss-launcher"; + QStringList arguments; + arguments << "launch" << info["Pkgname"].toString(); + QProcess process; + process.startDetached(scriptPath, arguments); + return; + } + + emit clickedDownloadBtn(); + + // 处理 tags,设置 installExtraArg + QString installExtraArg; +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QStringList taglist = info["Tags"].toString().split(";", Qt::SkipEmptyParts); +#else + QStringList taglist = info["Tags"].toString().split(";", QString::SkipEmptyParts); +#endif + if (taglist.contains("native")) { + installExtraArg = "--native"; + } else if (taglist.contains("amber-ce-bookworm")) { + installExtraArg = "--amber-ce-bookworm"; + } else if (taglist.contains("amber-ce-trixie")) { + installExtraArg = "--amber-ce-trixie"; + } else if (taglist.contains("amber-ce-sid")) { + installExtraArg = "--amber-ce-sid"; + } else if (taglist.contains("amber-ce-deepin23")) { + installExtraArg = "--amber-ce-deepin23"; + } + + DownloadItem *item = dw->addItem(info["Name"].toString(), info["Filename"].toString(), info["Pkgname"].toString(), + iconpixmap, downloadUrl, installExtraArg); + if (item == nullptr) + { + return; + } + if (ui->downloadButton->text() == tr("Reinstall")) + { + item->reinstall = true; + } + ui->downloadButton->setEnabled(false); + connect(item, &DownloadItem::finished, this, [=]() { + isDownloading(downloadUrl); + }, + Qt::QueuedConnection); + + isDownloading(downloadUrl); +} + +void AppIntoPage::on_pushButton_3_clicked() +{ + auto future = QtConcurrent::run([=]() + { + ui->downloadButton->setEnabled(false); + ui->pushButton_3->setEnabled(false); + + QProcess uninstall; + uninstall.start("pkexec", QStringList() << "/opt/durapps/spark-store/bin/store-helper/uninstaller" << info["Pkgname"].toString().toLower()); + uninstall.waitForFinished(-1); + uninstall.close(); + + // QProcess check; + // check.start("dpkg", QStringList() << "-s" << info["Pkgname"].toString().toLower()); + // check.waitForFinished(-1); + + if (uninstall.exitCode() != 0 || uninstall.exitStatus() != QProcess::NormalExit) + { + ui->downloadButton->setText(tr("Download and Install")); + ui->pushButton_3->hide(); + + Utils::sendNotification("spark-store",tr("Spark Store"),tr("Uninstall succeeded")); + } + + ui->downloadButton->setEnabled(true); + ui->pushButton_3->setEnabled(true); + + // check.close(); + }); +} + +void AppIntoPage::on_shareButton_clicked() +{ + qDebug() << "Share" << spk; + Application::clipboard()->setText(spk.toString()); + + Utils::sendNotification("spark-store", tr("Spark Store"), tr("The URL has been copied to the clipboard")); +} + +void AppIntoPage::on_updateButton_clicked() +{ + QString feedbackURL = "https://bbs.spark-app.store/"; + QProcess::startDetached("xdg-open", QStringList{feedbackURL}); +} + diff --git a/src/pages/appintopage.h b/src/pages/appintopage.h new file mode 100644 index 0000000000000000000000000000000000000000..0f548540802a5fd445bfdaf9e7d8d23cb6b0b1e7 --- /dev/null +++ b/src/pages/appintopage.h @@ -0,0 +1,56 @@ +#ifndef APPINTOPAGE_H +#define APPINTOPAGE_H + +#include +#include +#include + +namespace Ui { +class AppIntoPage; +} + +class SparkAPI; +class DownloadListWidget; +class AppIntoPage : public QWidget +{ + Q_OBJECT + +public: + explicit AppIntoPage(QWidget *parent = nullptr); + ~AppIntoPage() override; + + void openUrl(const QUrl &url); + void clear(); + void setTheme(bool dark); + void setDownloadWidget(DownloadListWidget *w); + +private: + void initUI(); + void initConnections(); + void isDownloading(const QUrl &url); + void setAppinfoTags(const QStringList &tagList); + void notifyUserUnsupportedTags(bool ubuntuSupport, bool deepinSupport, bool uosSupport, bool debianSupport); + +signals: + void clickedDownloadBtn(); + +private slots: + void on_downloadButton_clicked(); + void on_pushButton_3_clicked(); + void on_shareButton_clicked(); + void on_updateButton_clicked(); + +private: + Ui::AppIntoPage *ui; + + SparkAPI *api; + DownloadListWidget *dw = nullptr; + + QJsonObject info; + QPixmap iconpixmap; + QUrl spk; + + QByteArray m_userAgent; +}; + +#endif // APPINTOPAGE_H diff --git a/src/pages/appintopage.ui b/src/pages/appintopage.ui new file mode 100644 index 0000000000000000000000000000000000000000..3c8845a434454a156c929baae82c0462099db7fa --- /dev/null +++ b/src/pages/appintopage.ui @@ -0,0 +1,1645 @@ + + + AppIntoPage + + + + 0 + 0 + 806 + 601 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 300 + 16777215 + + + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Qt::Vertical + + + + 20 + 74 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 100 + + + + + 100 + 100 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + + 14 + true + + + + + + + Qt::AlignCenter + + + true + + + + + + + + + + Qt::AlignCenter + + + true + + + + + + + + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Download and Install + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Uninstall + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + 0 + + + + + 0 + + + 0 + + + + + + 14 + + + + 0 + + + Qt::AlignCenter + + + + + + + Download Times + + + Qt::AlignCenter + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 13 + 37 + + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> + + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> + + + :/tags/ubuntu.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>Capable to UOS home 20</p></body></html> + + + <html><head/><body><p>Capable to UOS home 20</p></body></html> + + + :/tags/uos.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + + + :/tags/deepin.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>Capable to Debian Stable</p></body></html> + + + <html><head/><body><p>Capable to Debian Stable</p></body></html> + + + :/tags/debian.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + :/tags/native.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + :/tags/amber-ce-bookworm.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + :/tags/amber-ce-trixie.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + :/tags/amber-ce-sid.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + :/tags/amber-ce-deepin.png + + + + + + + Qt::Horizontal + + + + 18 + 37 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>An Appimage to deb app.</p></body></html> + + + <html><head/><body><p>An Appimage to deb app.</p></body></html> + + + :/tags/a2d.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> + + + :/tags/community.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> + + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> + + + :/tags/dtk.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> + + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> + + + :/tags/dwine2.png + + + + + + + + 40 + 40 + + + + + 40 + 40 + + + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> + + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> + + + :/tags/dwine5.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Share + + + + + + + APP Feedback + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + + + + + + 0 + + + 0 + + + + + QScrollArea,QWidget#viewport,QWidget#scrollAreaWidgetContents +{ + background-color:transparent; + margin:0px; +} + + + QFrame::NoFrame + + + true + + + + + 0 + 0 + 482 + 601 + + + + false + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 16 + + + 16 + + + + + + 0 + 0 + + + + + 0 + 40 + + + + + 16777215 + 16777215 + + + + + 12 + true + + + + Introduction + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + + + + + 0 + 1 + + + + + 16777215 + 1 + + + + Qt::Horizontal + + + + + + + 16 + + + 8 + + + 16 + + + 8 + + + + + + 0 + 0 + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 16 + + + 16 + + + + + + 0 + 0 + + + + + 0 + 40 + + + + + 16777215 + 16777215 + + + + + 12 + true + + + + Screen capture + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + + + + + 0 + 1 + + + + + 16777215 + 1 + + + + Qt::Horizontal + + + + + + + 8 + + + 8 + + + 4 + + + + + + 0 + 0 + + + + + 0 + 205 + + + + + 16777215 + 205 + + + + QListView,QScrollArea,QWidget#viewport,QWidget#scrollAreaWidgetContents +{ + background-color:transparent; + margin:0px; +} +/**列表项选中*/ +QListWidget::item::selected +{ + background-color:transparent; +} + + + QFrame::StyledPanel + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOn + + + true + + + 5 + + + QListView::Fixed + + + + + + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 16 + + + 16 + + + + + + 0 + 0 + + + + + 0 + 40 + + + + + 16777215 + 16777215 + + + + + 12 + true + + + + Description + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + + + + + 0 + 1 + + + + + 16777215 + 1 + + + + Qt::Horizontal + + + + + + + 16 + + + 8 + + + 16 + + + 8 + + + 6 + + + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + Update + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + + + + true + + + + + + + Contributor + + + + + + + Pkgname + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + true + + + + + + + Author + + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + true + + + + + + + Size + + + + + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + true + + + + + + + Website + + + + + + + false + + + true + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + CustomLabel + QLabel +
widgets/common/customlabel.h
+
+
+ + + + +
diff --git a/src/pages/applistpage.cpp b/src/pages/applistpage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..12168f505a2446b033c6484e42c8de211f46eea3 --- /dev/null +++ b/src/pages/applistpage.cpp @@ -0,0 +1,105 @@ +#include "applistpage.h" +#include "ui_applistpage.h" + +#define BUILD_URL(theme, arch) \ + api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/" + (type.isEmpty() ? "?" : "applist?type=" + type + "&") + theme + "&arch=" + arch + +AppListPage::AppListPage(QWidget *parent) : QWidget(parent), + ui(new Ui::AppListPage) +{ + ui->setupUi(this); + ui->webEngineView->page()->setBackgroundColor(Qt::transparent); +} +void AppListPage::setTheme(bool dark) +{ + isDark = dark; + if (dark) + { + this->setStyleSheet("#frame{background-color: #252525;border-radius:14px;border:1px solid rgb(64, 64, 64);}"); + } + else + { + // 亮色模式 + this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}"); + } + if (isSearch) + { + getSearchList(nowType); + } + else + { + getAppList(nowType); + } +} +void AppListPage::getAppList(QString type) +{ + isSearch = false; + nowType = type; + SparkAPI *api = new SparkAPI(this); + QString url; + QString theme; + if (isDark) + { + theme = "theme=dark"; + } + else + { + theme = "theme=light"; + } + + #ifdef __aarch64__ + url = BUILD_URL(theme, "aarch64"); + #elif __loongarch__ + url = BUILD_URL(theme, "loong64"); + #else + url = BUILD_URL(theme, "x86"); + #endif + + ui->webEngineView->setUrl(url); + delete api; +} + +void AppListPage::getSearchList(const QString &keyword) +{ + isSearch = true; + nowType = keyword; + SparkAPI *api = new SparkAPI(this); + QString url; + QString theme; + if (isDark) + { + theme = "theme=dark"; + } + else + { + theme = "theme=light"; + } + + url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=x86"; + #ifdef __aarch64__ + url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=aarch64"; + #elif __loongarch__ + url = api->getServerUrl() + SparkAPI::getArchDir() + "/#/flamescion/search?keywords=" + QUrl::toPercentEncoding(keyword) + "&" + theme + "&" + "arch=loong64"; + #endif + ui->webEngineView->setUrl(url); + delete api; +} + +AppListPage::~AppListPage() +{ + delete ui; +} + +void AppListPage::on_webEngineView_urlChanged(const QUrl &arg1) +{ + if (arg1.path().right(8) == "app.json") + { + QString url = arg1.toString(); + url = url.mid(url.indexOf("/" + SparkAPI::getArchDir() + "/")); + url = "spk:/" + url; + url = url.mid(0, url.indexOf("/app.json")); + qDebug() << "程序跳转链接地址:" << url; + ui->webEngineView->back(); + emit clicked(url); + } +} diff --git a/src/pages/applistpage.h b/src/pages/applistpage.h new file mode 100644 index 0000000000000000000000000000000000000000..cb8c0cbe0c6fc3194823b771903f334d49abed22 --- /dev/null +++ b/src/pages/applistpage.h @@ -0,0 +1,34 @@ +#ifndef APPLISTPAGE_H +#define APPLISTPAGE_H +#include +#include +#include +#include "backend/sparkapi.h" +namespace Ui { +class AppListPage; +} + +class AppListPage : public QWidget +{ + Q_OBJECT + +public: + void setTheme(bool dark); + void getSearchList(const QString &keyword); + void getAppList(QString type); + explicit AppListPage(QWidget *parent = nullptr); + ~AppListPage(); + +private: + QMutex mutex; // 禁止多次搜索事件同时发生 + bool isDark; + bool isSearch; + QString nowType; + Ui::AppListPage *ui; +signals: + void clicked(QUrl spk); +private slots: + void on_webEngineView_urlChanged(const QUrl &arg1); +}; + +#endif // APPLISTPAGE_H diff --git a/src/pages/applistpage.ui b/src/pages/applistpage.ui new file mode 100644 index 0000000000000000000000000000000000000000..3fee0991c8a66660cce2e8eadf914b1a23505a63 --- /dev/null +++ b/src/pages/applistpage.ui @@ -0,0 +1,84 @@ + + + AppListPage + + + + 0 + 0 + 645 + 409 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 4 + + + 4 + + + 4 + + + 0 + + + + + + 0 + 0 + + + + + about:blank + + + + + + + + + + + + QWebEngineView + QWidget +
QtWebEngineWidgets/QWebEngineView
+
+ + WebEngineView + QWebEngineView +
widgets/common/webengineview.h
+
+
+ + +
diff --git a/src/pages/settingspage.cpp b/src/pages/settingspage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c380ea6ceb3a66136872cd949e7734b0e0c72ae6 --- /dev/null +++ b/src/pages/settingspage.cpp @@ -0,0 +1,263 @@ +#include "settingspage.h" +#include "ui_settingspage.h" +#include "../backend/sparkapi.h" +#include "utils/utils.h" + +#include +#include +#include + +#define TMP_PATH "/tmp/spark-store" +#define DEFAULT_SERVER_URL "https://cdn-d.spark-app.store/" + + +bool SettingsPage::needUncompatibleNotification = true; +bool SettingsPage::isdownload = false; + +SettingsPage::SettingsPage(QWidget *parent) + : QWidget(parent) + , ui(new Ui::SettingsPage) +{ + ui->setupUi(this); + + configCanSave = false; + initConfig(); +} + +void SettingsPage::setTheme(bool dark) +{ + if (dark) + { + this->setStyleSheet("#frame{background-color: #252525;border-radius:14px;border:1px solid rgb(64, 64, 64);}"); + } + else + { + // 亮色模式 + this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}"); + } +} + +void SettingsPage::readServerList() +{ + // 读取服务器列表并初始化 + QFile file(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/server.list"); + + // 判断文件是否存在 + if (!file.exists()) + { + ui->comboBox_server->addItem(DEFAULT_SERVER_URL); + return; + } + + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + qWarning() << "无法读取 server.list"; + return; + } + + // 创建 QTextStream 对象 + QTextStream textStream(&file); + + textStream.seek(0); // 回到开头 + QString lineData = textStream.readLine(); // 读取文件的第一行 + ui->comboBox_server->addItem(lineData); + while (!lineData.isNull()) + { + lineData = textStream.readLine(); + ui->comboBox_server->addItem(lineData); + } + for (int i = 0; i < ui->comboBox_server->count(); i++) + { + if (ui->comboBox_server->itemText(i) == "开发者模式 Dev only") + { + ui->comboBox_server->model()->setData(ui->comboBox_server->model()->index(i, 0), QVariant(0), Qt::UserRole - 1); + } + if (ui->comboBox_server->itemText(i) == "镜像源 Download only") + { + for (int j = i; j < ui->comboBox_server->count(); j++) + { + ui->comboBox_server->model()->setData(ui->comboBox_server->model()->index(j, 0), QVariant(0), Qt::UserRole - 1); + } + break; + } + } + file.close(); +} + +void SettingsPage::initConfig() +{ + readServerList(); + + // 读取服务器URL并初始化菜单项的链接 + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + if (!config.value("server/choose").toString().isEmpty() && config.value("server/updated").toBool()) + { + qDebug() << config.value("server/choose").toString(); + ui->comboBox_server->setCurrentText(config.value("server/choose").toString()); + SparkAPI::setServerUrl(config.value("server/choose").toString()); + } + configCanSave = true; //  防止触发保存配置信号 + + needUncompatibleNotification = config.value("other/uncompatibleNotification", needUncompatibleNotification).toBool(); + ui->checkBox->setChecked(needUncompatibleNotification); +} + +SettingsPage::~SettingsPage() +{ + delete ui; +} + +void SettingsPage::on_pushButton_updateServer_clicked() +{ + auto future = QtConcurrent::run([=]() + { + ui->pushButton_updateServer->setEnabled(false); + + + QFile::remove(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/server.list"); + auto updateSuccess = system("curl -o " + QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toUtf8() + "/server.list " /* 注意空格的问题 */ + DEFAULT_SERVER_URL + "store/server-and-mirror.list"); + qDebug() << "Update serverlist status:" << updateSuccess; + if (updateSuccess != 0) // 更新失败不换服务器配置 + { + QFile file(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/server.list"); + if (file.exists()) + { + file.remove(); + } + // FIXME: 向用户提示更新失败 + ui->pushButton_updateServer->setEnabled(true); + return; + } + ui->comboBox_server->clear(); + ui->pushButton_updateServer->setEnabled(true); + readServerList(); + ui->comboBox_server->setCurrentIndex(0); }); +} + +void SettingsPage::on_comboBox_server_currentTextChanged(const QString &arg1) +{ + SparkAPI::setServerUrl(arg1); // 服务器信息更新 + qDebug() << arg1; + bool updatedInfo = true; + if(configCanSave) + { + // ui->label_setting1->show(); + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + config.setValue("server/choose", arg1); + config.setValue("server/updated", updatedInfo); + config.sync(); + } +} + +void SettingsPage::setIsDownload(bool isdownload) +{ + SettingsPage::isdownload = isdownload; +} + +void SettingsPage::updateUI() +{ + if (isdownload) + { + ui->pushButton_clear->setEnabled(false); + } + else + { + ui->pushButton_clear->setEnabled(true); + } + // 显示缓存占用空间 + quint64 tmp_size = dirFileSize(QString::fromUtf8(TMP_PATH)); + QString tmp_size_str; + if (tmp_size < 1024) + { + tmp_size_str = QString::number(tmp_size) + "B"; + } + else if (tmp_size < (1024 * 1024)) + { + tmp_size_str = QString::number(0.01 * int(100 * (tmp_size / 1024))) + "KB"; + } + else if (tmp_size < (1024 * 1024 * 1024)) + { + tmp_size_str = QString::number(0.01 * int(100 * (tmp_size / (1024 * 1024)))) + "MB"; + } + else + { + tmp_size_str = QString::number(0.01 * int(100 * (tmp_size / (1024 * 1024 * 1024)))) + "GB"; + } + + ui->tmp_size_ui->setText(tmp_size_str); +} + +quint64 SettingsPage::dirFileSize(const QString &path) +{ + QDir dir(path); + quint64 size = 0; + // dir.entryInfoList(QDir::Files); // 返回文件信息 + foreach (QFileInfo fileInfo, dir.entryInfoList(QDir::Files)) + { + // 计算文件大小 + size += quint64(fileInfo.size()); + } + // dir.entryList(QDir::Dirs|QDir::NoDotAndDotDot); // 返回所有子目录,并进行过滤 + foreach (QString subDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) + { + // 若存在子目录,则递归调用 dirFileSize() 函数 + size += dirFileSize(path + QDir::separator() + subDir); + } + return size; +} + +void SettingsPage::on_pushButton_updateApt_clicked() +{ + auto future = QtConcurrent::run([=]() + { + ui->pushButton_updateApt->setEnabled(false); + ui->label_aptserver->setText(tr("Updating, please wait...")); + + emit openUrl(QUrl("spk://store/tools/spark-store")); + ui->label_aptserver->setText(tr("")); + + ui->pushButton_updateApt->setEnabled(true); + }); +} + +void SettingsPage::on_pushButton_clear_clicked() +{ + auto future = QtConcurrent::run([=]() + { + ui->pushButton_clear->setEnabled(false); + + QDir tmpdir(QString::fromUtf8(TMP_PATH)); + tmpdir.setFilter(QDir::Files); + int quantity = int(tmpdir.count()); + for(int i = 0; i < quantity; i++) + { + tmpdir.remove(tmpdir[i]); + } + Utils::sendNotification("spark-store",tr("Spark Store"),tr("Temporary cache was cleaned")); + ui->pushButton_clear->setEnabled(true); + updateUI(); }); +} + +void SettingsPage::on_pushButton_clearWebCache_clicked() +{ + auto future = QtConcurrent::run([=]() + { + QString localDataLocation = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/QtWebEngine"; + qDebug() << localDataLocation; + QDir dataDir(localDataLocation); + dataDir.removeRecursively(); + + QString cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/QtWebEngine"; + qDebug() << cacheLocation; + QDir cacheDir(cacheLocation); + cacheDir.removeRecursively(); + }); +} + +void SettingsPage::on_checkBox_clicked(bool checked) +{ + needUncompatibleNotification = checked; + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + config.setValue("other/uncompatibleNotification", needUncompatibleNotification); + config.sync(); +} diff --git a/src/pages/settingspage.h b/src/pages/settingspage.h new file mode 100644 index 0000000000000000000000000000000000000000..6a82a651146e27e1ac072393581494d5103f2b2e --- /dev/null +++ b/src/pages/settingspage.h @@ -0,0 +1,50 @@ +#ifndef SETTINGSPAGE_H +#define SETTINGSPAGE_H + +#include +#include + +namespace Ui { +class SettingsPage; +} + +class SettingsPage : public QWidget +{ + Q_OBJECT + +public: + static void setIsDownload(bool isdownload); + void updateUI(); + explicit SettingsPage(QWidget *parent = nullptr); + void setTheme(bool dark); + ~SettingsPage(); + +private slots: + void on_pushButton_updateServer_clicked(); + + void on_comboBox_server_currentTextChanged(const QString &arg1); + + void on_pushButton_updateApt_clicked(); + + void on_pushButton_clear_clicked(); + + void on_pushButton_clearWebCache_clicked(); + + void on_checkBox_clicked(bool checked); + +public: + static bool needUncompatibleNotification; + +private: + static bool isdownload; + bool configCanSave; + quint64 dirFileSize(const QString &path); + void readServerList(); + void initConfig(); + Ui::SettingsPage *ui; + +signals: + void openUrl(QUrl spk); +}; + +#endif // SETTINGSPAGE_H diff --git a/src/pages/settingspage.ui b/src/pages/settingspage.ui new file mode 100644 index 0000000000000000000000000000000000000000..28609ae299d5ec96390e03f0697682ceb092583a --- /dev/null +++ b/src/pages/settingspage.ui @@ -0,0 +1,396 @@ + + + SettingsPage + + + + 0 + 0 + 690 + 548 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 4 + + + 4 + + + 4 + + + 0 + + + + + + + + QFrame::NoFrame + + + 0 + + + true + + + + + 0 + 0 + 688 + 940 + + + + + + + + + + + 18 + + + + Line Settings + + + + + + + + + + + 100 + 16777215 + + + + Choose Line: + + + + + + + + 300 + 0 + + + + + 300 + 16777215 + + + + + + + + Refresh + + + + + + + + 160 + 16777215 + + + + Take effect immediately + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + color:#808080 + + + <html><head/><body><p>Check update for Spark Store. </p></body></html> + + + true + + + + + + + Spark Store Update + + + + + + + Update + + + + + + + + + + + + + + + + + + + + + + + + 18 + + + + Other Settings + + + + + + + + + + Enable notification for apps not compatible with current system + + + true + + + + + + + + + + + + + + + + + 18 + + + + Temp + + + + + + + + + + color:#808080 + + + Since the dictionary is at /tmp,It would be cleaned automatically when system reboot. + + + + + + + 0B + + + + + + + Location:/tmp/spark-store + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Clean + + + + + + + + 80 + 16777215 + + + + Size: + + + + + + + Clear Web Cache + + + + + + + + + + + + + + + + + 18 + + + + About us + + + + + + + <html><head/><body><p>Our services and software are free for individuals and non-profit organizations to use, communicate and learn, but you must comply with local laws and regulations in the process of use, otherwise any problems have nothing to do with us. </p><p>We don't make a profit from the Community version store, we rely on donations from the community for most of our operating expenses, and we appreciate that this allows us to spend less energy worrying about money. However, in order to better provide continuous service, Spark is only free for individual users to open the service warehouse, if you or your organization needs to provide commercial services or your organization is a for-profit organization, please contact us to obtain commercial authorization. </p><p>When using the Software, users or organizations are strictly forbidden to engage in any form of malicious behavior, including but not limited to malicious attacks, abuse, destruction, bulk crawling of the software warehouse, etc. The definition of malicious behavior is judged by the Spark community, and violators will be held legally responsible. Spark Community reserves the right to distribute the software packages it produces. </p><p>Any person or organization is prohibited from using the Spark Community software package for commercial purposes or redistributing it without the express authorization of the Spark Community. This clause is intended to ensure the spirit of open source while safeguarding the intellectual property rights of the Spark community. In addition to the above, if you use the Spark Store main program or part of its code, you are subject to all other terms and requirements of the GPL v3.</p><p>If any part of the store infringes your rights, please tell us <a href="mailto:jifengshenmo@outlook.com"><span style=" text-decoration: underline; color:#0082fa;">jifengshenmo@outlook.com</span></a> we will remove the infringing content as soon as possible. </p><p>If you'd like to get involved with us too, whether you're involved in development, design, pitching or submitting work, we welcome you to join us. </p><p><span style=" text-decoration: underline; color:#0000ff;"><br/></span>Our contact method can be found at <a href="https://blog.shenmo.tech/post/%E6%95%85%E9%9A%9C%E5%85%AC%E5%91%8A/"><span style=" text-decoration: underline; color:#0082fa;">Here</span></a></p></body></html> + + + true + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + diff --git a/src/spark-store.pro b/src/spark-store.pro new file mode 100644 index 0000000000000000000000000000000000000000..e6ffa3e0a83288a9c34eb7ae422ac34dd6a3e337 --- /dev/null +++ b/src/spark-store.pro @@ -0,0 +1,110 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2021-10-29T16:58:36 +# +#------------------------------------------------- + +QT += core gui concurrent dbus network svg webenginewidgets + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = spark-store +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +# Get build version from qmake +VERSION = $$BUILD_VERSION +isEmpty(VERSION): VERSION = 4.0.0 +DEFINES += APP_VERSION=\\\"'$${VERSION}'\\\" +DEFINES += APP_BRANCH=\\\"'$$system(git symbolic-ref --short -q HEAD)'\\\" +# Disable qWarning / qDebug output in Release +#CONFIG(release, debug | release): DEFINES += QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT + +CONFIG += c++11 link_pkgconfig +PKGCONFIG += dtkcore dtkgui dtkwidget + +SOURCES += \ + backend/DataCollectorAndUploader.cpp \ + backend/ThemeChecker.cpp \ + backend/downloadworker.cpp \ + backend/image_show.cpp \ + backend/sparkapi.cpp \ + dbus/dbussparkstoreservice.cpp \ + pages/appintopage.cpp \ + pages/applistpage.cpp \ + pages/settingspage.cpp \ + utils/httprequest.cpp \ + utils/utils.cpp \ + utils/widgetanimation.cpp \ + widgets/base/basewidgetopacity.cpp \ + widgets/common/downloaditem.cpp \ + widgets/common/progressbutton.cpp \ + widgets/common/smoothlistwidget.cpp \ + widgets/common/smoothscrollbar.cpp \ + widgets/common/webenginepage.cpp \ + widgets/common/webengineview.cpp \ + widgets/big_image.cpp \ + widgets/downloadlistwidget.cpp \ + application.cpp \ + main.cpp \ + mainwindow-dtk.cpp + +HEADERS += \ + backend/DataCollectorAndUploader.h \ + backend/ThemeChecker.h \ + backend/downloadworker.h \ + backend/image_show.h \ + backend/sparkapi.h \ + dbus/dbussparkstoreservice.h \ + pages/appintopage.h \ + pages/applistpage.h \ + pages/settingspage.h \ + utils/httprequest.h \ + utils/utils.h \ + utils/widgetanimation.h \ + widgets/base/basewidgetopacity.h \ + widgets/common/downloaditem.h \ + widgets/common/progressbutton.h \ + widgets/common/smoothlistwidget.h \ + widgets/common/smoothscrollbar.h \ + widgets/common/webenginepage.h \ + widgets/common/webengineview.h \ + widgets/big_image.h \ + widgets/downloadlistwidget.h \ + application.h \ + mainwindow-dtk.h + +FORMS += \ + pages/appintopage.ui \ + pages/applistpage.ui \ + pages/settingspage.ui \ + widgets/common/downloaditem.ui \ + widgets/downloadlistwidget.ui \ + mainwindow-dtk.ui + +RESOURCES += \ + assets/assets.qrc + +TRANSLATIONS += \ + ../translations/spark-store_en.ts \ + ../translations/spark-store_es.ts \ + ../translations/spark-store_fr.ts \ + ../translations/spark-store_zh_CN.ts \ + ../translations/spark-store_zh_TW.ts + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/durapps/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +DISTFILES += diff --git a/src/src.cmake b/src/src.cmake new file mode 100644 index 0000000000000000000000000000000000000000..89b47da11b206943c62ef89fd850dc3a79f109c7 --- /dev/null +++ b/src/src.cmake @@ -0,0 +1,18 @@ +include_directories(backend) +include_directories(dbus) +include_directories(pages) +include_directories(utils) +include_directories(widgets) + +# https://cmake.org/cmake/help/v3.12/command/file.html#glob-recurse +file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/*.h" + "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp" +) + +file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/*.ui" +) + +qt6_add_resources(QRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}/assets/assets.qrc) diff --git a/src/utils/httprequest.cpp b/src/utils/httprequest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8baf92a88c761b4e55e042340da5dc1f4ce182db --- /dev/null +++ b/src/utils/httprequest.cpp @@ -0,0 +1,47 @@ +#include "httprequest.h" + +HttpRequest::HttpRequest(QObject *parent):QObject(parent) +{ + QString headers = "Mozilla/5.0 Spark-Store/"+ QString(APP_VERSION)+" (Linux; "+QSysInfo::prettyProductName().toUtf8()+");"; + QByteArray ba = headers.toLatin1(); + rawHeaders = strdup(ba.data()); +} +// 在析构函数中释放 rawHeaders 的内存 +HttpRequest::~HttpRequest() +{ + free(rawHeaders); +} + +void HttpRequest::getRequest(QNetworkRequest request) +{ + QNetworkAccessManager *naManager = new QNetworkAccessManager(this); + request.setRawHeader("User-Agent", rawHeaders); + request.setRawHeader("Content-Type", "charset='utf-8'"); + request.setRawHeader("Content-Type", "application/json"); + + naManager->get(request); + QObject::connect(naManager, &QNetworkAccessManager::finished, this, &HttpRequest::readdata_slot); +} +void HttpRequest::readdata_slot(QNetworkReply *reply) +{ + emit finished(reply->readAll()); +} +QString HttpRequest::postRequest(QString url, QString jsondata) +{ + QByteArray array = jsondata.toLatin1(); + QNetworkRequest request; + QNetworkAccessManager *naManager = new QNetworkAccessManager(this); + QUrl strUrl = url.replace("+", "%2B"); + request.setUrl(strUrl); + request.setRawHeader("User-Agent", rawHeaders); + request.setRawHeader("Content-Type", "charset='utf-8'"); + request.setRawHeader("Content-Type", "application/json"); + + QNetworkReply *reply = naManager->post(request, array); + QEventLoop eventLoop; + connect(naManager, SIGNAL(finished(QNetworkReply *)), &eventLoop, SLOT(quit())); + eventLoop.exec(); + QString strReply(reply->readAll()); + reply->deleteLater(); + return strReply; +} diff --git a/src/utils/httprequest.h b/src/utils/httprequest.h new file mode 100644 index 0000000000000000000000000000000000000000..c55bc52c45e6698486014511f9c768d9e13dd3a9 --- /dev/null +++ b/src/utils/httprequest.h @@ -0,0 +1,28 @@ +#ifndef HTTPREQUEST_H +#define HTTPREQUEST_H + +#include +#include +#include +#include +#include +class HttpRequest : public QObject +{ + Q_OBJECT +private: + char* rawHeaders; +public: + HttpRequest(QObject *parent = nullptr); + ~HttpRequest(); + + void getRequest(QNetworkRequest request); + + QString postRequest(QString url, QString jsondata); +signals: + void finished(QString); +private slots: + void readdata_slot(QNetworkReply *reply); +}; + +#endif // HTTPREQUEST_H + diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d2705444449cb2d6637057b71edd347db7f0405 --- /dev/null +++ b/src/utils/utils.cpp @@ -0,0 +1,263 @@ +#include "utils.h" +#include "application.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#define UOSDeveloperModeFile "/var/lib/deepin/developer-mode/enabled" + +/** + * @author chatGPT + * @brief Utils::sendNotification 发送系统通知 + * @param icon 图标名称 + * @param title 通知标题 + * @param body 通知内容 + */ +void Utils::sendNotification(const QString &icon, const QString &title, const QString &body) +{ + QDBusInterface interface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications", + "org.freedesktop.Notifications"); + + QVariantList args; + args << Application::applicationName() // the name of the application + << static_cast(0) // replaces the previous notification with the same ID + << icon // the application icon of the notification + << title // the title of the notification + << body // the body of the notification + << QStringList() // no actions + << QVariantMap() // no hints + << -1; // no timeout + + interface.callWithArgumentList(QDBus::AutoDetect, "Notify", args); +} + +/** + * @brief Utils::isDDE 判断是否使用 DDE 桌面环境 + * @return + */ +bool Utils::isDDE() +{ + bool isDDE = true; + if (!QString::fromUtf8(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin")) + { + qputenv("XDG_CURRENT_DESKTOP", "Deepin"); + isDDE = false; + } + + return isDDE; +} + +/** + * @brief Utils::isWayland 判断是否使用 wayland 显示协议 + * @return bool true: 使用 wayland 显示协议 false: 使用 x11 显示协议 + */ +bool Utils::isWayland() +{ + bool isWayland = false; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QString XDG_SESSION_TYPE = env.value(QStringLiteral("XDG_SESSION_TYPE")); + QString WAYLAND_DISPLAY = env.value(QStringLiteral("WAYLAND_DISPLAY")); + if (XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive)) + { + isWayland = true; + } + + return isWayland; +} + +/** + * @brief 判断是否使用 TreeLand 混合器 + * @return bool true: 使用 TreeLand 混合器 false: 非 TreeLand 混合器 + */ +bool Utils::isTreeLand() +{ + bool isTreeLand = false; + if (qgetenv("DDE_CURRENT_COMPOSITOR").toLower() == "treeland") { + isTreeLand = true; + } + + return isTreeLand; +} + +bool Utils::isPhytium() +{ + bool isPhytium = false; + QProcess process; + process.start("lscpu"); + process.waitForFinished(); + + + QString output = process.readAllStandardOutput(); + if (output.contains(QLatin1String("Phytium"))) + { + isPhytium = true; + } + + return isPhytium; +} +/** + * @brief Utils::initConfig 初始化 config.ini 配置文件,去除废弃字段 + */ +void Utils::initConfig() +{ + // WARNING: 请在 组织名称 和 应用程序名称 初始化完成后调用 + bool useWayland = true; + + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + if (config.contains("build/useWayland")) + { + useWayland = config.value("build/useWayland").toBool(); + } + config.remove("build/isDeepinOS"); + config.remove("build/isWayland"); + config.remove("build/useWayland"); + + config.setValue("runtime/isDDE", isDDE()); + config.setValue("runtime/isWayland", isWayland()); + // Check config file, if there is no wayland config, then set it to default, which means use wayland if possible. + if (!config.contains("runtime/useWayland")) + { + config.setValue("runtime/useWayland", useWayland); + } + + // check uuid + if (!config.contains("info/uuid")){ + config.setValue("info/uuid", initUUID()); + } + config.sync(); // 写入更改至 config.ini,并同步最新内容 + + checkUOSDeveloperMode(); // Check UOS developer mode +} + +/** + * @brief Utils::isUOS 判断是否为 UOS 操作系统 + * @return bool true: UOS 操作系统 false: 非 UOS 操作系统 + */ +bool Utils::isUOS() +{ + // WARNING: 请在 组织名称 和 应用程序名称 初始化完成后调用 + bool isUOS = false; + + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + if (Dtk::Core::DSysInfo::productType() == Dtk::Core::DSysInfo::Uos) + { + isUOS = true; + config.setValue("UOS/isUOS", true); + } + else + { + isUOS = false; + config.remove("UOS"); + } + config.sync(); // 写入更改至 config.ini,并同步最新内容 + + return isUOS; +} + +/** + * @brief Utils::initUUID 生成 UUID +*/ +QString Utils::initUUID(){ + QUuid uuid = QUuid::createUuid(); + return uuid.toString(); +} + +/** + * @brief Utils::setQPAPlatform Set display backend + */ +void Utils::setQPAPlatform() +{ + // WARNING: 请在 initConfig() 执行后调用 + bool isDDE = Utils::isDDE(); // WARNING: 只能执行一次,后续执行时环境变量已经被覆盖,导致判断错误 + bool isWayland = Utils::isWayland(); + + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + bool useWayland = config.value("runtime/useWayland").toBool(); + + qDebug() << "System Wayland enabled:" << isWayland << "Spark Wayland enabled:" << useWayland; + + /** + * NOTE: https://github.com/linuxdeepin/developer-center/issues/7217#issuecomment-1922653903 + * DDE Wayland has been deprecated, so using wayland plugin only + */ + if (isWayland && useWayland /*&& !(Dtk::Core::DSysInfo::isDeepin() || isDDE)*/) + { + qputenv("QT_QPA_PLATFORM", "wayland"); + } + // else if (isWayland && useWayland && (Dtk::Core::DSysInfo::isDeepin() && isDDE)) + // { + // qputenv("QT_QPA_PLATFORM", "dwayland"); + // } + else + { + qputenv("QT_QPA_PLATFORM", "dxcb;xcb"); + } +} + +/** + * @brief Utils::checkUOSDeveloperMode Check UOS developer mode + */ +void Utils::checkUOSDeveloperMode() +{ + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + + QFile file(UOSDeveloperModeFile); + if (Utils::isUOS() && file.exists() && file.open(QFile::ReadOnly | QFile::Text)) + { + QString lineData = QString::fromUtf8(file.readLine()); + bool devmode = lineData.trimmed().toInt(); + qDebug() << "UOS Developer Mode Status:" << devmode; + config.setValue("UOS/EnableDeveloperMode", devmode); + } + else + { + /** + * NOTE: Utils::isUOS() 中,判断为非 UOS 时已经从 config 中删除 UOS 组, + * 此处若包含该字段则一定是 UOS,直接写入开发者模式开关状态即可 + */ + if (config.contains("UOS/EnableDeveloperMode")) + { + config.setValue("UOS/EnableDeveloperMode", false); + } + } + file.close(); + config.sync(); // 写入更改至 config.ini,并同步最新内容 +} + +/** + * @brief Utils::parseFeatureJsonFile 解析版本特性 json 文件 + * @return 返回 QJsonObject + */ +QJsonObject Utils::parseFeatureJsonFile() +{ + QFile file(":/json/features.json"); + if (!file.open(QFile::ReadOnly)) + { + qWarning() << Q_FUNC_INFO << "features.json open failed"; + return QJsonObject(); + } + + QJsonParseError error; + QJsonDocument jsonDoc = QJsonDocument::fromJson(file.readAll(), &error); + if (error.error != QJsonParseError::NoError || jsonDoc.isNull()) + { + qWarning() << Q_FUNC_INFO << "features.json validate failed:" << error.errorString(); + return QJsonObject(); + } + + if (jsonDoc.isEmpty() || !jsonDoc.isObject()) + { + qWarning() << Q_FUNC_INFO << "features jsonDoc parse failed:" << jsonDoc; + return QJsonObject(); + } + + return jsonDoc.object(); +} diff --git a/src/utils/utils.h b/src/utils/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..a85d64ac9916aae4e48d143e9441e73109ffa105 --- /dev/null +++ b/src/utils/utils.h @@ -0,0 +1,23 @@ +#ifndef UTILS_H +#define UTILS_H + +#include +#include + +class Utils +{ +public: + static void sendNotification(const QString &icon, const QString &title, const QString &body); + static bool isDDE(); + static bool isWayland(); + static bool isTreeLand(); + static void initConfig(); + static bool isUOS(); + static bool isPhytium(); + static QString initUUID(); + static void setQPAPlatform(); + static void checkUOSDeveloperMode(); + static QJsonObject parseFeatureJsonFile(); +}; + +#endif // UTILS_H diff --git a/src/utils/widgetanimation.cpp b/src/utils/widgetanimation.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4c46b5d2e04e511cbf2ee9ae0612acc055af3975 --- /dev/null +++ b/src/utils/widgetanimation.cpp @@ -0,0 +1,59 @@ +#include "widgetanimation.h" +#include "widgets/base/basewidgetopacity.h" + +void WidgetAnimation::widgetShake(QWidget *pWidget, int nRange) +{ + int nX = pWidget->x(); + int nY = pWidget->y(); + QPropertyAnimation *pAnimation = new QPropertyAnimation(pWidget, "geometry"); + pAnimation->setEasingCurve(QEasingCurve::InOutSine); + pAnimation->setDuration(400); + pAnimation->setStartValue(QRect(QPoint(nX, nY), pWidget->size())); + + int nShakeCount = 8; + double nStep = 1.0 / nShakeCount; + for (int i = 1; i < nShakeCount; i++) + { + nRange = i & 1 ? -nRange : nRange; + pAnimation->setKeyValueAt(nStep * i, QRect(QPoint(nX + nRange, nY), pWidget->size())); + } + + pAnimation->setEndValue(QRect(QPoint(nX, nY), pWidget->size())); + pAnimation->start(QAbstractAnimation::DeleteWhenStopped); +} + +QPropertyAnimation *WidgetAnimation::createWidgetOpacity(QWidget *pWidget, bool isAppear) +{ + QPropertyAnimation *animation = new QPropertyAnimation(pWidget, "windowOpacity", pWidget); + // 设置动画时间(单位:毫秒) + animation->setDuration(500); + if (isAppear) + { + // 设置动画效果 + animation->setEasingCurve(QEasingCurve::Linear); + // 设置动画步长值,以及在该位置时显示的透明度(即动画关键帧) + animation->setKeyValueAt(0.0, 0.0); + animation->setKeyValueAt(1.0, 1.0); + } + else + { + animation->setEasingCurve(QEasingCurve::OutQuart); + animation->setKeyValueAt(0.0, 1.0); + animation->setKeyValueAt(1.0, 0.0); + + QObject::connect(animation, &QPropertyAnimation::finished, pWidget, [=]() { pWidget->close(); }); + } + + QObject::connect(animation, &QPropertyAnimation::valueChanged, pWidget, [=]() + { + pWidget->update(); // NOTE: 保证窗口透明度动画平滑 + }); + + return animation; +} + +void WidgetAnimation::widgetOpacity(QWidget *pWidget, bool isAppear) +{ + // 启动/关闭动画 + createWidgetOpacity(pWidget, isAppear)->start(QPropertyAnimation::DeleteWhenStopped); +} diff --git a/src/utils/widgetanimation.h b/src/utils/widgetanimation.h new file mode 100644 index 0000000000000000000000000000000000000000..2c3c8050394ecd43c0457dac113e5957a9341451 --- /dev/null +++ b/src/utils/widgetanimation.h @@ -0,0 +1,16 @@ +#ifndef WIDGETANIMATION_H +#define WIDGETANIMATION_H + +#include +#include + +class WidgetAnimation +{ +public: + static void widgetShake(QWidget *pWidget, int nRange); + + static QPropertyAnimation* createWidgetOpacity(QWidget *pWidget, bool isAppear); + static void widgetOpacity(QWidget *pWidget, bool isAppear); +}; + +#endif // WIDGETANIMATION_H diff --git a/src/widgets/base/basewidgetopacity.cpp b/src/widgets/base/basewidgetopacity.cpp new file mode 100644 index 0000000000000000000000000000000000000000..712aade8301a5d1e01270275d7562516e19de423 --- /dev/null +++ b/src/widgets/base/basewidgetopacity.cpp @@ -0,0 +1,61 @@ +#include "basewidgetopacity.h" +#include "utils/widgetanimation.h" +#include "utils/utils.h" + +#include +#include +#include +#include + +BaseWidgetOpacity::BaseWidgetOpacity(QWidget *parent) : DBlurEffectWidget(parent) +{ +} + +/** + * @brief 窗口显示事件 + * @param event + */ +void BaseWidgetOpacity::showEvent(QShowEvent *event) +{ + // FIXME: wayland 不支持直接设置窗口透明度,需要调用 wayland 相关库(考虑抄控制中心“窗口移动时启用透明特效”代码?) + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + bool isWayland = Utils::isWayland(); + if (!isWayland) + { + if (!showWindowAnimation) + { + showWindowAnimation = true; + WidgetAnimation::widgetOpacity(this, true); + } + } + + DBlurEffectWidget::showEvent(event); +} + +/** + * @brief 窗口关闭事件 + * @param event + */ +void BaseWidgetOpacity::closeEvent(QCloseEvent *event) +{ + // FIXME: wayland 不支持直接设置窗口透明度,需要调用 wayland 相关库(考虑抄控制中心“窗口移动时启用透明特效”代码?) + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + bool isWayland = Utils::isWayland(); + if (isWayland) + { + closeWindowAnimation = true; + return DBlurEffectWidget::closeEvent(event); + } + + if (!closeWindowAnimation) + { + closeWindowAnimation = true; + WidgetAnimation::widgetOpacity(this, false); + + event->ignore(); + } + else + { + event->accept(); + } +} diff --git a/src/widgets/base/basewidgetopacity.h b/src/widgets/base/basewidgetopacity.h new file mode 100644 index 0000000000000000000000000000000000000000..406f865c7cbc737a9f2a22618baf75710892adcb --- /dev/null +++ b/src/widgets/base/basewidgetopacity.h @@ -0,0 +1,24 @@ +#ifndef BASEWIDGETOPACITY_H +#define BASEWIDGETOPACITY_H + +#include + +DWIDGET_USE_NAMESPACE + +class BaseWidgetOpacity : public DBlurEffectWidget +{ + Q_OBJECT + +public: + explicit BaseWidgetOpacity(QWidget *parent = nullptr); + +protected: + void showEvent(QShowEvent *event) override; + void closeEvent(QCloseEvent *event) override; + +protected: + bool showWindowAnimation = false; + bool closeWindowAnimation = false; +}; + +#endif // BASEWIDGETOPACITY_H diff --git a/src/widgets/big_image.cpp b/src/widgets/big_image.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3bcf988680c00f7ad50e42109a355848783ca40 --- /dev/null +++ b/src/widgets/big_image.cpp @@ -0,0 +1,45 @@ +#include "big_image.h" +#include "qapplication.h" + +#include +#include +#include + +big_image::big_image(DBlurEffectWidget *parent) : DBlurEffectWidget(parent), + m_image(new QLabel) +{ + // setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint); // 设置图片对话框总在最前 + setWindowModality(Qt::ApplicationModal); // 以上无效不如直接使用 模态化对话框 + setRadius(0); + setMaskAlpha(60); + setMaskColor(QColor("#000000")); + + QHBoxLayout *layout = new QHBoxLayout; + setLayout(layout); + layout->addWidget(m_image); + layout->setContentsMargins(0, 0, 0, 0); + + // Make sure the image has a parent so that it will be freed. + m_image->setParent(this); + // m_image->setMaximumSize(1360,768); + m_image->setAlignment(Qt::AlignCenter); +} + +void big_image::setimage(QPixmap image) +{ + QScreen *screen = QApplication::primaryScreen(); + image.setDevicePixelRatio(screen->devicePixelRatio()); + m_image->setPixmap(image); +} + +void big_image::mousePressEvent(QMouseEvent *) +{ + hide(); + m_image->clear(); +} + +void big_image::focusOutEvent(QFocusEvent *) +{ + hide(); + m_image->clear(); +} diff --git a/src/widgets/big_image.h b/src/widgets/big_image.h new file mode 100644 index 0000000000000000000000000000000000000000..c35306284a34eddcce436b9604eb3aa2cd7501f0 --- /dev/null +++ b/src/widgets/big_image.h @@ -0,0 +1,27 @@ +#ifndef BIG_IMAGE_H +#define BIG_IMAGE_H + +#include +#include + +#include + +DWIDGET_USE_NAMESPACE + +class big_image : public DBlurEffectWidget +{ + Q_OBJECT + +public: + explicit big_image(DBlurEffectWidget *parent = nullptr); + + QLabel *m_image; + + void setimage(QPixmap); + +protected: + void mousePressEvent(QMouseEvent *event) override; + void focusOutEvent(QFocusEvent *event) override; +}; + +#endif // BIG_IMAGE_H diff --git a/src/widgets/common/customlabel.cpp b/src/widgets/common/customlabel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dcb90243975a8993e030b375b1e42c0a1afff2fe --- /dev/null +++ b/src/widgets/common/customlabel.cpp @@ -0,0 +1,25 @@ +#include "customlabel.h" + +#include + +CustomLabel::CustomLabel(QWidget *parent, + Qt::WindowFlags f) + : QLabel(parent, f) +{ +} + +QPixmap CustomLabel::pixmap() const +{ + return QLabel::pixmap(); +} + +void CustomLabel::setPixmap(const QPixmap &pixmap) +{ + QPixmap _pixmap = pixmap; + _pixmap.setDevicePixelRatio(qApp->devicePixelRatio()); + _pixmap = _pixmap.scaled(size() * _pixmap.devicePixelRatio(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation); + + QLabel::setPixmap(_pixmap); +} diff --git a/src/widgets/common/customlabel.h b/src/widgets/common/customlabel.h new file mode 100644 index 0000000000000000000000000000000000000000..f1d55b45218f7ef22f019cca66f0a51344c79dd3 --- /dev/null +++ b/src/widgets/common/customlabel.h @@ -0,0 +1,19 @@ +#ifndef CUSTOMLABEL_H +#define CUSTOMLABEL_H + +#include + +class CustomLabel : public QLabel +{ + Q_OBJECT + Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) + +public: + explicit CustomLabel(QWidget *parent = nullptr, + Qt::WindowFlags f = Qt::WindowFlags()); + + virtual QPixmap pixmap() const; + virtual void setPixmap(const QPixmap &pixmap); +}; + +#endif // CUSTOMLABEL_H diff --git a/src/widgets/common/downloaditem.cpp b/src/widgets/common/downloaditem.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3a25ab8f2f8c63491d012a678874119e7c08db3e --- /dev/null +++ b/src/widgets/common/downloaditem.cpp @@ -0,0 +1,256 @@ +#include "downloaditem.h" +#include "ui_downloaditem.h" + +#include +#include + +bool DownloadItem::isInstall = false; + +DownloadItem::DownloadItem(QWidget *parent) : QWidget(parent), + reinstall(false), + close(false), + ui(new Ui::DownloadItem), + output_w(new DDialog), + textbrowser(new QTextBrowser) +{ + ui->setupUi(this); + + ui->pushButton_install->setEnabled(false); + ui->progressBar->setValue(0); + ui->label_filename->hide(); + ui->pushButton_install->hide(); + ui->pushButton_3->hide(); + ui->widget_spinner->start(); + ui->widget_spinner->hide(); + + ui->label->setElideMode(Qt::TextElideMode::ElideRight); + ui->label_2->setElideMode(Qt::TextElideMode::ElideRight); +} + +DownloadItem::~DownloadItem() +{ + delete ui; +} + +void DownloadItem::setValue(qint64 value) +{ + ui->progressBar->setValue(qint32(value)); + ui->label_2->setText(QString::number(double(value) / 100) + "% (" + speed + ")"); + ui->label_2->setToolTip(QString::number(double(value) / 100) + "% (" + speed + ")"); + if (ui->label_2->text().left(4) == "100%") + { + download = 1; + ui->label_2->setText(tr("Download Complete.")); + ui->label_2->setToolTip(tr("Download Complete.")); + } +} + +void DownloadItem::setMax(qint64 max) +{ + ui->progressBar->setMaximum(qint32(max)); +} + +void DownloadItem::setName(QString name) +{ + ui->label->setText(name); + ui->label->setToolTip(name); +} + +QString DownloadItem::getName() +{ + return ui->label_filename->text(); +} + + +/*************************************************************** + * @brief 告知界面,准备安装 + * @param + * @note 如果正在安装,返回-1 + * @Sample usage: DownloadItem::install(0); + **************************************************************/ +int DownloadItem::readyInstall() +{ + // 检查是否正在安装,如果是返回错误 -1 + if (isInstall) + { + return -1; + } + + if (!close) + { + ui->progressBar->hide(); + ui->pushButton_install->setEnabled(true); + ui->pushButton_install->show(); + DownloadItem::install(0); + ui->pushButton_2->hide(); + return 1; + } + return 0; +} + +void DownloadItem::setFileName(QString fileName) +{ + ui->label_filename->setText(fileName); +} + +void DownloadItem::seticon(const QPixmap icon) +{ + ui->label_3->setPixmap(icon); +} + +void DownloadItem::closeDownload() +{ + on_pushButton_2_clicked(); +} + +void DownloadItem::setSpeed(QString s) +{ + speed = s; +} + +/*************************************************************** + * @brief 安装当前应用 + * @param int t, t为安装方式,可以为 0,1,2 + * @note 执行这个函数时,需要已经检查是否可以安装,但该函数仍然会再检测一次! + * @Sample usage: DownloadItem::install(0); + **************************************************************/ +void DownloadItem::install(int t) +{ + if (!isInstall) + { + isInstall = true; + ui->pushButton_install->hide(); + ui->widget_spinner->show(); + qDebug() << "/tmp/spark-store/" + ui->label_filename->text().toUtf8(); + ui->label_2->setText(tr("Installing")); + ui->label_2->setToolTip(tr("Installing")); + + auto future = QtConcurrent::run([=]() + { + slotAsyncInstall(t); + }); + + qDebug() << ui->label_filename->text().toUtf8(); + } +} + +void DownloadItem::on_pushButton_install_clicked() +{ + DownloadItem::install(0); +} + +void DownloadItem::on_pushButton_2_clicked() +{ + ui->label_2->setText(tr("Download canceled")); + ui->label_2->setToolTip(tr("Download canceled")); + download = 2; + ui->pushButton_2->setEnabled(false); + ui->progressBar->hide(); + close = true; +} + +void DownloadItem::on_pushButton_3_clicked() +{ + textbrowser->setLineWidth(0); + textbrowser->setText(out); + textbrowser->setMinimumHeight(500); + + output_w->setMinimumHeight(600); + output_w->setAttribute(Qt::WA_TranslucentBackground); + output_w->setTitle(ui->label->text()); + output_w->layout()->setContentsMargins(20, 20, 20, 20); + output_w->layout()->addWidget(textbrowser); + output_w->show(); +} + +/*************************************************************** + * @brief 实际安装应用 + * @param int t, t为安装方式,可以为 0,1,2 + * @note 备注 + * @Sample usage: slotAsyncInstall(0); + **************************************************************/ +void DownloadItem::slotAsyncInstall(int t) +{ + QProcess installer; + switch (t) + { + case 0: + { + QStringList args; + args << "/usr/local/bin/ssinstall" + << "/tmp/spark-store/" + ui->label_filename->text().toUtf8(); + if (!installExtraArg.isEmpty()) { + args << installExtraArg; + } + args << "--delete-after-install"; + installer.start("pkexec", args); + } + break; + case 1: + installer.start("deepin-deb-installer", QStringList() << "/tmp/spark-store/" + ui->label_filename->text().toUtf8()); + break; + case 2: + installer.start("pkexec", QStringList() << "gdebi" + << "-n" + << "/tmp/spark-store/" + ui->label_filename->text().toUtf8()); + break; + } + + bool haveError = false; + bool notRoot = false; + installer.waitForFinished(-1); // 不设置超时 + out = installer.readAllStandardOutput(); + + QStringList everyOut = out.split("\n"); + QString tempOutput; + for (int i = 0; i < everyOut.size(); i++) + { + tempOutput = everyOut[i]; + if (tempOutput.contains("OMG-IT-GOES-WRONG")) + { + haveError = true; + } + if (tempOutput.contains("Not authorized")) + { + notRoot = true; + } + } + + QProcess isInstall; + // isInstall.start("dpkg", QStringList() << "-s" << pkgName); + // isInstall.waitForFinished(180 * 1000); // 默认超时 3 分钟 + // int error = QString::fromStdString(isInstall.readAllStandardError().toStdString()).length(); + if ( !haveError) + { + ui->pushButton_install->hide(); + Utils::sendNotification("spark-store", tr("Spark Store"), ui->label->text() + " " + tr("Installation complete.")); + ui->label_2->setText(tr("Finish")); + ui->label_2->setToolTip(tr("Finish")); + download = 3; + ui->pushButton_3->show(); + } + else + { + ui->pushButton_install->show(); + ui->pushButton_install->setText(tr("Retry")); + download = 1; + Utils::sendNotification("spark-store", tr("Spark Store"), tr("Error happened in dpkg progress , please check the install info or try to reinstall.")); + ui->label_2->setText(tr("Error happened in dpkg progress , please check the install info or try to reinstall.")); + ui->label_2->setToolTip(tr("Error happened in dpkg progress , please check the install info or try to reinstall.")); + ui->pushButton_3->show(); + } + + if (notRoot) + { + Utils::sendNotification("spark-store", tr("Spark Store"), tr("dpkg progress had been aborted, please check the install info or try to reinstall.")); + ui->label_2->setText(tr("dpkg progress had been aborted, please check the install info or try to reinstall.")); + ui->label_2->setToolTip(tr("dpkg progress had been aborted, please check the install info or try to reinstall.")); + ui->pushButton_install->show(); + ui->pushButton_3->hide(); + } + + ui->widget_spinner->hide(); + DownloadItem::isInstall = false; + + emit finished(!haveError && !notRoot); +} diff --git a/src/widgets/common/downloaditem.h b/src/widgets/common/downloaditem.h new file mode 100644 index 0000000000000000000000000000000000000000..afd479c48617b5e4921b53f1d922a33381261cc9 --- /dev/null +++ b/src/widgets/common/downloaditem.h @@ -0,0 +1,71 @@ +#ifndef DOWNLOADITEM_H +#define DOWNLOADITEM_H + +#include +#include +#include +#include +#include "utils/utils.h" +#include +DWIDGET_USE_NAMESPACE + +namespace Ui { +class DownloadItem; +} + +class DownloadItem : public QWidget +{ + Q_OBJECT + +public: + explicit DownloadItem(QWidget *parent = nullptr); + ~DownloadItem(); + + int num; + bool free; + static bool isInstall; + bool reinstall; + QString speed; + QString out; + QString pkgName; + bool close; + int download; + void setValue(qint64); + void setMax(qint64); + void setName(QString); + QString getName(); + int readyInstall(); + + void setFileName(QString); + void seticon(const QPixmap); + void closeDownload(); + void setSpeed(QString); + + void install(int); + + // 新增:安装时额外参数 + QString installExtraArg; + +private: + Ui::DownloadItem *ui; + + QMenu *menu_install; + QAction *action_dpkg; + QAction *action_deepin; + QAction *action_gdebi; + + DDialog *output_w; + QTextBrowser *textbrowser; + +private slots: + void on_pushButton_install_clicked(); + void on_pushButton_2_clicked(); + void on_pushButton_3_clicked(); + + void slotAsyncInstall(int t); + +signals: + void finished(bool success); +}; + +#endif // DOWNLOADITEM_H diff --git a/src/widgets/common/downloaditem.ui b/src/widgets/common/downloaditem.ui new file mode 100644 index 0000000000000000000000000000000000000000..476f609d375be17616e0db0d7f6ee0440927c847 --- /dev/null +++ b/src/widgets/common/downloaditem.ui @@ -0,0 +1,336 @@ + + + DownloadItem + + + + 0 + 0 + 666 + 56 + + + + + 0 + 0 + + + + + 0 + 56 + + + + + 16777215 + 56 + + + + Form + + + + + + + 2 + + + 4 + + + 4 + + + 4 + + + 4 + + + + + + 0 + 0 + + + + + 48 + 48 + + + + + 48 + 48 + + + + icon + + + true + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 0 + 0 + + + + + 120 + 48 + + + + + 120 + 48 + + + + Name + + + + + + + + 0 + 16777215 + + + + TextLabel + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 500 + 16777215 + + + + + 2 + + + 0 + + + 8 + + + 0 + + + 8 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 500 + 10 + + + + 24 + + + false + + + + + + + + 9 + + + + Waiting to download + + + Qt::AlignCenter + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 30 + 0 + + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + Install + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + Cancel + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + Info + + + + + + + + DSpinner + QWidget +
dspinner.h
+ 1 +
+ + DLabel + QLabel +
dlabel.h
+
+
+ + +
diff --git a/src/widgets/common/progressbutton.cpp b/src/widgets/common/progressbutton.cpp new file mode 100644 index 0000000000000000000000000000000000000000..005b096c401aea581c8d0836f104c4984aeef60d --- /dev/null +++ b/src/widgets/common/progressbutton.cpp @@ -0,0 +1,227 @@ +#include "progressbutton.h" +#include "widgets/downloadlistwidget.h" + +#include +#include +#include +#include + +ProgressButton::ProgressButton(QWidget *parent) + : QWidget{parent} +{ + svgPath = ""; + backColor = Qt::transparent; + + connect(this, &ProgressButton::startProcessing, this, &ProgressButton::operationProcessing, Qt::QueuedConnection); +} + +ProgressButton::~ProgressButton() +{ +} + +void ProgressButton::setProgress(int progress) +{ + buttonState = state::openProgress; + ProgressButton::progress = progress; + if (progress == 0) + { + buttonState = state::normal; + update(); + } + if (progress == 100) + { + buttonState = state::closeProgress; + update(); + WaterDrop *waterDrop = new WaterDrop(parentWidget()); + waterDrop->move(QRectF(geometry()).center()); + waterDrop->show(); + } + repaint(); + update(); +} + +void ProgressButton::setDownloadListWidget(DownloadListWidget *widget) +{ + m_downloadListWidget = widget; +} + +void ProgressButton::setIcon(QString svgPATH) +{ + svgPath = svgPATH; + update(); +} + +void ProgressButton::setBackgroundColor(QColor color) +{ + backColor = color; + update(); +} + +void ProgressButton::setColor(QColor color) +{ + ProgressButton::color = color; + update(); +} + +void ProgressButton::mousePressEvent(QMouseEvent *event) +{ + m_mouseMoved = false; + m_isDownloadListWidgetVisible = m_downloadListWidget->isVisible(); + m_downloadListWidget->hide(); + QWidget::mousePressEvent(event); +} + +void ProgressButton::mouseReleaseEvent(QMouseEvent *event) +{ + if (buttonState == state::hover + || buttonState == state::normal + || buttonState == state::closeProgress) + { + update(); + } + + if (m_mouseMoved) { + return QWidget::mouseReleaseEvent(event); + } + + if (m_isDownloadListWidgetVisible) { + m_downloadListWidget->hide(); + } else { + QPoint pos(this->mapToGlobal(QPoint(0, 0))); + pos += QPoint(width() / 2 - m_downloadListWidget->width() / 2, height() + 5); + m_downloadListWidget->m_move(pos.x(), pos.y()); + m_downloadListWidget->setWindowState(windowState() & Qt::WindowState::WindowActive); + m_downloadListWidget->activateWindow(); + m_downloadListWidget->show(); + m_downloadListWidget->raise(); + } + m_isDownloadListWidgetVisible = m_downloadListWidget->isVisible(); + QWidget::mouseReleaseEvent(event); +} + +void ProgressButton::mouseDoubleClickEvent(QMouseEvent *event) +{ + event->accept(); +} + +void ProgressButton::mouseMoveEvent(QMouseEvent *event) +{ + m_mouseMoved = true; + QWidget::mouseMoveEvent(event); +} + +void ProgressButton::leaveEvent(QEvent *event) +{ + if (buttonState == state::hover) + { + buttonState = state::normal; + update(); + } + QWidget::leaveEvent(event); +} + +void ProgressButton::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing, true); + QRectF rect = this->rect(); + + if (buttonState == state::normal || buttonState == state::hover) + { + qreal radius = rect.height() / 2; + painter.translate(rect.center()); + painter.setPen(Qt::transparent); + painter.setBrush(backColor); + painter.drawEllipse(QPointF(0, 0), radius, radius); + + QSvgRenderer m_svgRender; + m_svgRender.load(svgPath); + m_svgRender.render(&painter, QRectF(-radius / 2, -radius / 2, radius, radius)); + } + else if (buttonState == state::openProgress) + { + qreal radius = rect.height() / 2 - 1; + painter.translate(rect.center()); + painter.setPen(QPen(backColor.darker(), 2)); + painter.setBrush(backColor); + painter.drawEllipse(QPointF(0, 0), radius, radius); + + QRectF rectF = QRectF(-radius, -radius, radius * 2, radius * 2); + painter.setPen(QPen(color.darker(100), 2)); + qreal angle = progress * 360 / 100 * 1.0; + painter.drawArc(rectF, 90 * 16, -qIntCast(angle * 16)); + + QSvgRenderer m_svgRender; + m_svgRender.load(svgPath); + m_svgRender.render(&painter, QRectF(-radius / 2, -radius / 2, radius, radius)); + } + else if (buttonState == state::closeProgress) + { + qreal radius = rect.height() / 2 - 1; + painter.translate(rect.center()); + painter.setPen(QPen(color.darker(100), 2)); + painter.setBrush(backColor); + painter.drawEllipse(QPointF(0, 0), radius, radius); + + painter.setPen(QPen(color, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.drawLine(QPointF(-radius / 3, 0), + QPointF(-radius / 5, radius / 3)); + painter.drawLine(QPointF(-radius / 5, radius / 3), + QPointF(radius / 4, -radius / 4)); + } + QWidget::paintEvent(event); +} + +void ProgressButton::operationProcessing() +{ +} + +const int RADIUS = 30; +WaterDrop::WaterDrop(QWidget *parent) + : QWidget(parent) + , m_waterDropAnimation(new QVariantAnimation(this)) + , m_animationRadius(0) +{ + this->setFixedSize(QSize(RADIUS * 2, RADIUS * 2)); + // this->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); + // this->setAttribute(Qt::WA_TranslucentBackground); + // this->setAttribute(Qt::WA_DeleteOnClose); + + // m_waterDropAnimation->setEasingCurve(QEasingCurve(static_cast(QRandomGenerator::global()->bounded(40)))); +} + +// 把鼠标点击的点转换为圆心点坐标 +void WaterDrop::move(const QPointF &point) +{ + QPointF translatePoint = point - QRectF(rect()).center(); + QWidget::move(qRound(translatePoint.x()), qRound(translatePoint.y())); +} + +void WaterDrop::show() +{ + m_waterDropAnimation->setStartValue(0); + m_waterDropAnimation->setEndValue(RADIUS - 2); + m_waterDropAnimation->setDuration(350); + + connect(m_waterDropAnimation, &QVariantAnimation::valueChanged, this, &WaterDrop::onRadiusChanged); + connect(m_waterDropAnimation, &QVariantAnimation::finished, this, &WaterDrop::deleteLater); + m_waterDropAnimation->start(QVariantAnimation::DeleteWhenStopped); + QWidget::show(); +} + +void WaterDrop::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + QPen pen(QBrush(QColor("#ffff80")), 4.0); + painter.setPen(pen); + painter.drawEllipse(QRectF(rect()).center(), m_animationRadius, m_animationRadius); + + QWidget::paintEvent(event); +} + +void WaterDrop::onRadiusChanged(const QVariant &value) +{ + m_animationRadius = value.toInt(); + update(); +} diff --git a/src/widgets/common/progressbutton.h b/src/widgets/common/progressbutton.h new file mode 100644 index 0000000000000000000000000000000000000000..6b036cf3bc1b500508010777e73f60dccf38967f --- /dev/null +++ b/src/widgets/common/progressbutton.h @@ -0,0 +1,81 @@ +#ifndef PROGRESSBUTTON_H +#define PROGRESSBUTTON_H + +#include +#include +#include + +class DownloadListWidget; +class ProgressButton : public QWidget +{ + Q_OBJECT + +public: + explicit ProgressButton(QWidget *parent = nullptr); + ~ProgressButton() override; + + void setIcon(QString svgPATH); + void setBackgroundColor(QColor color); + void setColor(QColor color); + void setProgress(int progress); + + void setDownloadListWidget(DownloadListWidget *widget); + +protected: + void mousePressEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void leaveEvent(QEvent *event) override; + void paintEvent(QPaintEvent *event) override; + +signals: + void startProcessing(); + void clicked(); + +private slots: + void operationProcessing(); + +private: + enum state + { + normal, + hover, + openProgress, + closeProgress, + recovery + }; + + DownloadListWidget *m_downloadListWidget = nullptr; + + state buttonState{state::normal}; + QColor backColor; + QColor color; + QString svgPath; + int progress{0};//处理百分比 + + bool m_mouseMoved = false; + bool m_isDownloadListWidgetVisible = true; +}; + +class WaterDrop : public QWidget +{ + Q_OBJECT + +public: + explicit WaterDrop(QWidget *parent = nullptr); + void show(); + void move(const QPointF &point); + +protected: + void paintEvent(QPaintEvent *event); + +private slots: + void onRadiusChanged(const QVariant &value); + +private: + QVariantAnimation *m_waterDropAnimation = nullptr; + int m_animationRadius; +}; + +#endif // PROGRESSBUTTON_H diff --git a/src/widgets/common/smoothlistwidget.cpp b/src/widgets/common/smoothlistwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6e96ee274925b39205307ab0a6ba8faf2d6e0fdc --- /dev/null +++ b/src/widgets/common/smoothlistwidget.cpp @@ -0,0 +1,24 @@ +#include "smoothlistwidget.h" +#include +#include +#include +#include +SmoothListWidget::SmoothListWidget(QWidget *parent) : QListWidget(parent) +{ + vScrollBar->setOrientation(Qt::Orientation::Vertical); // 将滚动条设置为纵向 + setVerticalScrollBar(vScrollBar); // 设置纵向滚动条 + connect(vScrollBar, SIGNAL(valueChanged(int)), this, SLOT(onSliderChanged(int))); +} +void SmoothListWidget::wheelEvent(QWheelEvent *e) +{ + // 当捕获到事件后,调用相对滚动的槽函数 + vScrollBar->scroll(e->angleDelta().y()); +} +void SmoothListWidget::onSliderChanged(int p) +{ + if (p == vScrollBar->maximum()) + { + emit reachedBottom(); // 1 + } + emit msliderChanged(p); // 2 +} diff --git a/src/widgets/common/smoothlistwidget.h b/src/widgets/common/smoothlistwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..8c58c03416ef2064f7c30c47cade1dcd0e6feb51 --- /dev/null +++ b/src/widgets/common/smoothlistwidget.h @@ -0,0 +1,24 @@ +#ifndef SMOOTHLISTWIDGET_H +#define SMOOTHLISTWIDGET_H + +#include +#include +#include +#include "smoothscrollbar.h" +class SmoothListWidget: public QListWidget +{ + Q_OBJECT +public: + explicit SmoothListWidget(QWidget *parent = nullptr); + SmoothScrollBar* vScrollBar=new SmoothScrollBar(); //纵向滚动条 +private: + void wheelEvent(QWheelEvent* e); //捕获鼠标滚轮事件 +signals: + void msliderChanged(int p); + void reachedBottom(); + +private slots: + void onSliderChanged(int p); +}; + +#endif // SMOOTHLISTWIDGET_H diff --git a/src/widgets/common/smoothscrollbar.cpp b/src/widgets/common/smoothscrollbar.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5fd190b551b0bd02c22c956c8f89b0cf4cb5a9fa --- /dev/null +++ b/src/widgets/common/smoothscrollbar.cpp @@ -0,0 +1,56 @@ +#include "smoothscrollbar.h" +#include +#include +SmoothScrollBar::SmoothScrollBar(QWidget *parent) : QScrollBar(parent) +{ + m_scrollAni = new QPropertyAnimation(this); + m_scrollAni->setTargetObject(this); + m_scrollAni->setPropertyName("value"); + m_scrollAni->setEasingCurve(QEasingCurve::OutQuint); // 设置动画曲线,在Qt文档中有详细的介绍 + m_scrollAni->setDuration(500); // 设置动画时间,数值越小播放越快 + m_targetValue_v = value(); // 将m_targetValue_v初始化 +} + +void SmoothScrollBar::setValue(int value) +{ + m_scrollAni->stop(); // 停止现在的动画,防止出现冲突 + m_scrollAni->setStartValue(this->value()); // 设置动画滚动的初始值为当前位置 + m_scrollAni->setEndValue(value); // 设置动画的结束位置为目标值 + m_scrollAni->start(); // 开始动画 +} +void SmoothScrollBar::scrollTop() +{ + setValue(-m_targetValue_v); // 开始动画 + m_targetValue_v = 0; +} +void SmoothScrollBar::scroll(int value) +{ + // 这里推荐评论区中大佬优化的写法 + if (m_targetValue_v - value >= 0) + { + m_targetValue_v -= value; // 将目标值和相对位置进行运算 + setValue(m_targetValue_v); // 开始动画 + } +} + +void SmoothScrollBar::mousePressEvent(QMouseEvent *e) +{ + // 当使用鼠标操作滚动条时,不会刷新m_targetValue_v的值,因而需要重写事件,对其进行刷新。 + m_scrollAni->stop(); + QScrollBar::mousePressEvent(e); + m_targetValue_v = value(); +} + +void SmoothScrollBar::mouseReleaseEvent(QMouseEvent *e) +{ + m_scrollAni->stop(); + QScrollBar::mouseReleaseEvent(e); + m_targetValue_v = value(); +} + +void SmoothScrollBar::mouseMoveEvent(QMouseEvent *e) +{ + m_scrollAni->stop(); + QScrollBar::mouseMoveEvent(e); + m_targetValue_v = value(); +} diff --git a/src/widgets/common/smoothscrollbar.h b/src/widgets/common/smoothscrollbar.h new file mode 100644 index 0000000000000000000000000000000000000000..91c0d4b2d14a1963e0360358a5c2970718748bf7 --- /dev/null +++ b/src/widgets/common/smoothscrollbar.h @@ -0,0 +1,27 @@ +#ifndef SMOOTHSCROLLBAR_H +#define SMOOTHSCROLLBAR_H + +#include +#include +class SmoothScrollBar : public QScrollBar +{ + Q_OBJECT +public: + SmoothScrollBar(QWidget *parent=nullptr); +private: + //这里重写鼠标事件的目的是在手动点击或拖动滚动条时更新m_targetValue_v变量,并且在拖动时立即结束滚动的动画。 + //这里如果不明白作用,可以先注释掉看看手动拖动滚动条时对动画有什么影响。 + void mousePressEvent(QMouseEvent *) override; + void mouseReleaseEvent(QMouseEvent *) override; + void mouseMoveEvent(QMouseEvent *) override; + + QPropertyAnimation *m_scrollAni; //用来实现动画 + int m_targetValue_v; //用来记录目标位置的变量 +public slots: + void scrollTop(); + void setValue(int value); //重写的setValue槽函数,实现动画效果 + void scroll(int value); //新增相对滚动的槽函数,value为滚动距离的矢量表示 +signals: +}; + +#endif // SMOOTHSCROLLBAR_H diff --git a/src/widgets/common/webenginepage.cpp b/src/widgets/common/webenginepage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..767caae8db1a19edb913506a131e6a9062e735db --- /dev/null +++ b/src/widgets/common/webenginepage.cpp @@ -0,0 +1,61 @@ +#include "webenginepage.h" + +#include +#include +#include + +WebEnginePage::WebEnginePage(QObject *parent) + : QWebEnginePage(parent) +{ + initHttpAcceptLanguage(); +} + +WebEnginePage::~WebEnginePage() +{ +} + +void WebEnginePage::setUrl(const QUrl &url) +{ + if (m_currentUrl == url) + { + return; + } + + m_currentUrl = url; + QWebEnginePage::setUrl(url); +} + +QWebEnginePage *WebEnginePage::createWindow(QWebEnginePage::WebWindowType type) +{ + Q_UNUSED(type) + + WebEnginePage *page = new WebEnginePage(parent()); + connect(page, &WebEnginePage::urlChanged, this, &WebEnginePage::slotUrlChanged); + return page; +} + +void WebEnginePage::initHttpAcceptLanguage() +{ + switch (QLocale::system().language()) { + case QLocale::Chinese: { + // 系统语言是中文,获取网页为中文 @momen @uniartisan + profile()->setHttpAcceptLanguage("zh-CN,zh;q=0.8,en;q=0.6"); + } break; + default: + break; + } +} + +void WebEnginePage::slotUrlChanged(const QUrl &url) +{ + if (m_currentUrl == url) + { + sender()->deleteLater(); + return; + } + + qDebug() << Q_FUNC_INFO << m_currentUrl << url; + + QDesktopServices::openUrl(url); + sender()->deleteLater(); +} diff --git a/src/widgets/common/webenginepage.h b/src/widgets/common/webenginepage.h new file mode 100644 index 0000000000000000000000000000000000000000..15f0cf39c93569cd797b6a3f5e469c46a849286c --- /dev/null +++ b/src/widgets/common/webenginepage.h @@ -0,0 +1,29 @@ +#ifndef WEBENGINEPAGE_H +#define WEBENGINEPAGE_H + +#include + +class WebEnginePage : public QWebEnginePage +{ + Q_OBJECT + +public: + explicit WebEnginePage(QObject *parent = nullptr); + ~WebEnginePage() override; + + void setUrl(const QUrl &url); + +protected: + QWebEnginePage *createWindow(WebWindowType type) override; + +private: + void initHttpAcceptLanguage(); + +private slots: + void slotUrlChanged(const QUrl &url); + +private: + QUrl m_currentUrl; +}; + +#endif // WEBENGINEPAGE_H diff --git a/src/widgets/common/webengineview.cpp b/src/widgets/common/webengineview.cpp new file mode 100644 index 0000000000000000000000000000000000000000..afd500b7a2094d6fd8f1d34ced5ef0a55924cd16 --- /dev/null +++ b/src/widgets/common/webengineview.cpp @@ -0,0 +1,8 @@ +#include "webengineview.h" +#include "webenginepage.h" + +WebEngineView::WebEngineView(QWidget *parent) + : QWebEngineView(parent) +{ + setPage(new WebEnginePage(this)); +} diff --git a/src/widgets/common/webengineview.h b/src/widgets/common/webengineview.h new file mode 100644 index 0000000000000000000000000000000000000000..8846bc39212f52d4f384d4f7d241a12b24d9646e --- /dev/null +++ b/src/widgets/common/webengineview.h @@ -0,0 +1,14 @@ +#ifndef WEBENGINEVIEW_H +#define WEBENGINEVIEW_H + +#include + +class WebEngineView : public QWebEngineView +{ + Q_OBJECT + +public: + explicit WebEngineView(QWidget *parent = nullptr); +}; + +#endif // WEBENGINEVIEW_H diff --git a/src/widgets/downloadlistwidget.cpp b/src/widgets/downloadlistwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b4b19fc3f591d5179697922329eae6a16a50fa5c --- /dev/null +++ b/src/widgets/downloadlistwidget.cpp @@ -0,0 +1,260 @@ +#include "downloadlistwidget.h" +#include "ui_downloadlistwidget.h" +#include "widgets/common/downloaditem.h" +#include "backend/sparkapi.h" +#include "backend/downloadworker.h" +#include "utils/utils.h" +#include "application.h" +#include "mainwindow-dtk.h" + +#include +#include +#include + +DownloadListWidget::DownloadListWidget(QWidget *parent) : DBlurEffectWidget(parent), + ui(new Ui::DownloadListWidget) +{ + ui->setupUi(this); + setWindowTitle(QObject::tr("Download list")); + installEventFilter(this); + this->setAttribute(Qt::WA_Hover, true); + setFocus(); + setFixedSize(500, 400); + setMaskAlpha(250); + ui->listWidget->hide(); + ui->widget->show(); + // 计算显示下载速度 + download_speed.setInterval(1000); + download_speed.start(); + connect(&download_speed, &QTimer::timeout, [=]() + { + if(isdownload && theSpeed == "") + { + size1 = download_size; + double bspeed; + bspeed = size1 - size2; + if(bspeed < 1024) + { + theSpeed = QString::number(bspeed) + "B/s"; + } + else if(bspeed < 1024 * 1024) + { + theSpeed = QString::number(0.01 * int(100 * (bspeed / 1024))) + "KB/s"; + } + else if(bspeed < 1024 * 1024 * 1024) + { + theSpeed = QString::number(0.01 * int(100 * (bspeed / (1024 * 1024)))) + "MB/s"; + } + else + { + theSpeed = QString::number(0.01 * int(100 * (bspeed / (1024 * 1024 * 1024)))) + "GB/s"; + } + size2 = download_size; + } + if(isdownload){ + downloaditemlist[nowDownload - 1]->setSpeed(theSpeed); + }else{ + emit downloadProgress(0); + } }); +} + +DownloadListWidget::~DownloadListWidget() +{ + if (downloadController) + { + downloadController->disconnect(); + downloadController->stopDownload(); + // 这里没有释放 downloadController,使用懒汉式单例 + } + + clearItem(); + delete ui; +} + +bool DownloadListWidget::isDownloadInProcess() +{ + if (toDownload > 0) + { + return true; + } + return false; +} + +void DownloadListWidget::clearItem() +{ + ui->listWidget->clear(); +} + +DownloadItem* DownloadListWidget::addItem(QString name, QString fileName, QString pkgName, + const QPixmap icon, QString downloadurl, + const QString &installExtraArg) +{ + if (fileName.isEmpty()) + { + return nullptr; + } + + urList.append(downloadurl); + allDownload += 1; + toDownload += 1; + + DownloadItem *di = new DownloadItem; + connect(di, &DownloadItem::finished, this, &DownloadListWidget::slotInstallFinished, Qt::QueuedConnection); + + dlist << downloadurl; + downloaditemlist << di; + di->setName(name); + di->setFileName(fileName); + di->pkgName = pkgName; + di->installExtraArg = installExtraArg; + di->seticon(icon); + QListWidgetItem *pItem = new QListWidgetItem(); + pItem->setSizeHint(QSize(240, 56)); // ui 中单个 downloaditem 高度固定 56px(上下 margin 8px,图片固定 48x48) + ui->listWidget->addItem(pItem); + ui->listWidget->setItemWidget(pItem, di); + if (!isBusy) + { + nowDownload += 1; + startRequest(urList.at(nowDownload - 1), fileName); // 进行链接请求 + } + + return di; +} + +QList DownloadListWidget::getDIList() +{ + return downloaditemlist; +} + +QList DownloadListWidget::getUrlList() +{ + return urList; +} + +void DownloadListWidget::startRequest(QUrl url, QString fileName) +{ + ui->listWidget->show(); + ui->widget->hide(); + isBusy = true; + isdownload = true; + downloaditemlist[allDownload - 1]->free = false; + + // 使用懒汉式单例来存储downloadController + if (downloadController == nullptr) + { + downloadController = new DownloadController; // 并发下载,在第一次点击下载按钮的时候才会初始化 + } + else + { + downloadController->disconnect(); + downloadController->stopDownload(); + } + + connect(downloadController, &DownloadController::downloadProcess, this, &DownloadListWidget::updateDataReadProgress); + connect(downloadController, &DownloadController::downloadFinished, this, &DownloadListWidget::httpFinished); + // connect(downloadController, &DownloadController::errorOccur, this, [=](QString msg){this->sendNotification(msg);}); + downloadController->setFilename(fileName); + downloadController->startDownload(url.toString()); +} + +/*************************************************************** + * @brief 下载列表完成下载的回调函数 + * @param + * @note 如果正在安装,则在新开的线程空间中等待上一个安装完 + * @Sample usage: + **************************************************************/ +void DownloadListWidget::httpFinished() // 完成下载 +{ + isdownload = false; + isBusy = false; + + auto future = QtConcurrent::run([=]() + { + while (downloaditemlist[nowDownload - 1]->readyInstall() == -1) // 安装当前应用,堵塞安装,后面的下载suspend + { + QThread::msleep(500); // 休眠500ms,减少CPU负担 + continue; + } + downloaditemlist[nowDownload - 1]->free = true; + emit downloadFinished(); + + if (nowDownload < allDownload) + { + // 如果有排队则下载下一个 + qDebug() << "Download: 切换下一个下载..."; + nowDownload += 1; + while (nowDownload <= allDownload && downloaditemlist[nowDownload - 1]->close) + { + nowDownload += 1; + } + if (nowDownload <= allDownload) + { + QString fileName = downloaditemlist[nowDownload - 1]->getName(); + startRequest(urList.at(nowDownload - 1), fileName); + } + } + }); +} + +void DownloadListWidget::updateDataReadProgress(QString speedInfo, qint64 bytesRead, qint64 totalBytes) +{ + if (totalBytes <= 0) + { + return; + } + theSpeed = speedInfo; + downloaditemlist[nowDownload - 1]->setMax(10000); // 最大值 + downloaditemlist[nowDownload - 1]->setValue(int(bytesRead * 100 / totalBytes) * 100); // 当前值 + emit downloadProgress(int(bytesRead * 100 / totalBytes)); + download_size = bytesRead; + if (downloaditemlist[nowDownload - 1]->close) + { + // 随时检测下载是否被取消 + downloadController->disconnect(); + downloadController->stopDownload(); + downloaditemlist[nowDownload - 1]->closeDownload(); + httpFinished(); + } +} + +void DownloadListWidget::m_move(int x, int y) +{ + m_rect.setX(x); + m_rect.setY(y); + move(x, y); + return; +} + +void DownloadListWidget::mouseMoveEvent(QMouseEvent *event) +{ + setGeometry(m_rect); +} + +void DownloadListWidget::on_pushButton_clicked() +{ + QDesktopServices::openUrl(QUrl("file:///tmp/spark-store", QUrl::TolerantMode)); +} + +void DownloadListWidget::slotInstallFinished(bool success) +{ + // NOTE: 仅在安装成功后判断是否需要退出后台 + if (!success) { + qDebug() << "Download: install failed"; + return; + } + + if (toDownload > 0) { + toDownload -= 1; + qDebug() << "Download: toDownload" << toDownload; + } + + if (toDownload == 0) { + Application *app = qobject_cast(qApp); + MainWindow *mainWindow = app->mainWindow(); + if (mainWindow->isCloseWindowAnimation() == true) + { + qDebug() << "Download: 后台安装结束,退出程序"; + qApp->quit(); + } + } +} diff --git a/src/widgets/downloadlistwidget.h b/src/widgets/downloadlistwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..263c16074a7de4ee5a69e18613b61400bc393608 --- /dev/null +++ b/src/widgets/downloadlistwidget.h @@ -0,0 +1,68 @@ +#ifndef DOWNLOADLISTWIDGET_H +#define DOWNLOADLISTWIDGET_H + +#include + +#include +#include + +namespace Ui { +class DownloadListWidget; +} + +DWIDGET_USE_NAMESPACE + +class DownloadItem; +class DownloadController; +class DownloadListWidget : public DBlurEffectWidget +{ + Q_OBJECT + +public: + DownloadItem *addItem(QString name, QString fileName, QString pkgName, + const QPixmap icon, QString downloadurl, + const QString &installExtraArg); + int nowDownload = 0; + int allDownload = 0; + int toDownload = 0; + QList getDIList(); + QList getUrlList(); + void m_move(int x, int y); + explicit DownloadListWidget(QWidget *parent = nullptr); + ~DownloadListWidget() override; + + bool isDownloadInProcess(); + +protected: + void mouseMoveEvent(QMouseEvent *event) override; + +private: + int isdownload = false; + bool isBusy = false; + QStringList dlist; + QList urList; + QList downloaditemlist; + DownloadController *downloadController = nullptr; + int nowdownload = 0; + QString theSpeed; + QTimer download_speed; + long download_size = 0; + long size1 = 0; + long size2 = 0; + void startRequest(QUrl url, QString fileName); + void httpFinished(); + void updateDataReadProgress(QString speedInfo, qint64 bytesRead, qint64 totalBytes); + void clearItem(); + QRect m_rect; + Ui::DownloadListWidget *ui; + +signals: + void downloadFinished(); + void downloadProgress(int i); + +private slots: + void on_pushButton_clicked(); + void slotInstallFinished(bool success); +}; + +#endif // DOWNLOADLISTWIDGET_H diff --git a/src/widgets/downloadlistwidget.ui b/src/widgets/downloadlistwidget.ui new file mode 100644 index 0000000000000000000000000000000000000000..e46a65560ecac32ca0a2b2894023666fdbdf3a4c --- /dev/null +++ b/src/widgets/downloadlistwidget.ui @@ -0,0 +1,131 @@ + + + DownloadListWidget + + + + 0 + 0 + 547 + 416 + + + + Form + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 11 + + + + The list is currently empty. Go and download some softwares! + + + Qt::AlignCenter + + + false + + + + + + + Qt::Vertical + + + + 20 + 56 + + + + + + + + + + + + 0 + 0 + + + + QListView,QScrollArea,QWidget#viewport,QWidget#scrollAreaWidgetContents +{ + background-color:transparent; + margin:0px; +} +/**列表项选中*/ +QListWidget::item::selected +{ + background-color:transparent; +} + + + QFrame::NoFrame + + + Qt::ScrollBarAsNeeded + + + Qt::ScrollBarAlwaysOff + + + true + + + 10 + + + QAbstractItemView::NoEditTriggers + + + QListView::Fixed + + + 4 + + + + + + + Open download directory + + + + + + + + SmoothListWidget + QListWidget +
widgets/common/smoothlistwidget.h
+
+
+ + +
diff --git a/tool/apt-fast-conf/apt-fast.conf b/tool/apt-fast-conf/apt-fast.conf new file mode 100644 index 0000000000000000000000000000000000000000..328a7e2a9fa598b3c801fbf6d89ab86fa54b76c6 --- /dev/null +++ b/tool/apt-fast-conf/apt-fast.conf @@ -0,0 +1,169 @@ +################################################################### +# CONFIGURATION OPTIONS +################################################################### +# Every item has a default value besides MIRRORS (which is unset). + +# Use aptitude, apt-get, or apt? +# Note that apt-get is used as a fallback for outputting the +# package URI list for e.g. aptitude, which can't do this +# Optionally add the FULLPATH to apt-get or apt-rpm or aptitude +# e.g. /usr/bin/aptitude +# +# Default: apt-get +# +_APTMGR=apt-get + +if [ -x "$(command -v apt)" ]; then +_APTMGR=apt +fi + + +if grep -Eqi "linuxmint" /etc/os-release;then +_APTMGR=apt-get +fi + +if [ -x "$(command -v oyo)" ]; then +_APTMGR=/usr/bin/apt +fi + +#### +# +# UOS sources auth config +# +# +if grep -Eqi "UnionTech" /etc/issue || grep -Eq "UnionTech" /etc/*-release;then +AUTH_UOS_USER="uos-https://license.chinauos.com-apt" +AUTH_UOS_PASSWD="`cat /etc/apt/auth.conf.d/uos.conf | grep home-packages.chinauos.com`" +AUTH_UOS_PASSWD=`echo ${AUTH_UOS_PASSWD#*password }` + +fi +##### UOS自动读取账号密码以实现使用aptss来加速下载 + +# Enable DOWNLOADBEFORE to suppress apt-fast confirmation dialog and download +# packages directly. +# +# Default: dialog enabled +# +DOWNLOADBEFORE=true + + +# Choose mirror list to speed up downloads from same archive. To select some +# mirrors take a look at your distribution's archive mirror lists. +# Debian: http://www.debian.org/mirror/list +# Ubuntu: https://launchpad.net/ubuntu/+archivemirrors +# +# It is required to add mirrors in the sources.list to this array as well, so +# apt-fast can destinguish between different distributions. +# +# Examples: +# +# Different distributions (as in operating systems): +# +# sources.list: +# deb http://deb.debian.org/debian/ unstable main non-free contrib +# deb http://de.archive.ubuntu.com/ubuntu/ bionic main universe +# +# apt-fast.conf: +# MIRRORS=( 'http://deb.debian.org/debian','http://ftp.debian.org/debian,http://ftp2.de.debian.org/debian,http://ftp.de.debian.org/debian,ftp://ftp.uni-kl.de/debian' +# 'http://archive.ubuntu.com/ubuntu,http://de.archive.ubuntu.com/ubuntu,http://ftp.halifax.rwth-aachen.de/ubuntu,http://ftp.uni-kl.de/pub/linux/ubuntu,http://mirror.informatik.uni-mannheim.de/pub/linux/distributions/ubuntu/' ) +# +# +# Single distribution: +# +# sources.list: +# deb http://fr.archive.ubuntu.com/ubuntu/ bionic main +# deb http://fr.archive.ubuntu.com/ubuntu/ artful main +# +# apt-fast.conf: +# MIRRORS=( 'http://fr.archive.ubuntu.com/ubuntu,http://bouyguestelecom.ubuntu.lafibre.info/ubuntu,http://mirror.ovh.net/ubuntu,http://ubuntu-archive.mirrors.proxad.net/ubuntu' ) +# +# Default: disabled +# +MIRRORS=( 'https://d.store.deepinos.org.cn/,https://zunyun01.store.deepinos.org.cn/,https://mirrors.sdu.edu.cn/spark-store-repository/,http://cdn.dl.uniartisan.com:9000/deepinos/,https://d1.store.deepinos.org.cn/,https://d2.store.deepinos.org.cn/,https://d3.store.deepinos.org.cn/,https://d4.store.deepinos.org.cn/,https://d5.store.deepinos.org.cn/' ) + + +# Maximum number of connections +# You can use this value in _DOWNLOADER command. Escape with ${}: ${_MAXNUM} +# +# Default: 5 +# +_MAXNUM=16 + + +# Maximum number of connections per server +# Default: 10 +# +_MAXCONPERSRV=1 + + + + + +# Split size i.e. size of each piece +# Possible Values: 1M-1024M +# +_MINSPLITSZ=1M + + +# Piece selection algorithm to use +# Available values are: default, inorder, geom +# default: selects piece so that it reduces the number of establishing connection, reasonable for most cases +# inorder: selects pieces in sequential order starting from first piece +# geom: selects piece which has minimum index like inorder, but it exponentially increasingly keeps space from previously selected pieces +# +_PIECEALGO=default + + + +# Downloadmanager listfile +# You can use this value in _DOWNLOADER command. Escape with ${}: ${DLLIST} +# +# Default: /tmp/apt-fast.list +# +DLLIST='/tmp/apt-fast.list' + + +# Download command to use. Temporary download list is designed for aria2. But +# you can choose another download command or download manager. It has to +# support following input file syntax (\t is tab character): +# +# # Comment +# MIRROR1\tMIRROR2\tMIRROR3... +# out=FILENAME1 +# MIRROR1\tMIRROR2\tMIRROR3... +# out=FILENAME2 +# ... +# +# Examples: +# aria2c with a proxy (set username, proxy, ip and password!) +# _DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --http-proxy=http://username:password@proxy_ip:proxy_port -i ${DLLIST}' +# +# Default: _DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0' +# +_DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0 --http-user ${AUTH_UOS_USER} --http-passwd ${AUTH_UOS_PASSWD}' + + +# Download temp folder for Downloadmanager +# example /tmp/apt-fast. Standard is /var/cache/apt-fast +# +# Default: /var/cache/apt/apt-fast +# +DLDIR='/var/cache/apt/apt-fast' + + +# APT archives cache directory +# +# Default /var/cache/apt/archives +# (APT configuration items Dir::Cache and Dir::Cache::archives) +# +APTCACHE='/var/cache/apt/archives' + + +# apt-fast colors +# Colors are disabled when not using a terminal. +# +# Default colors are: +# cGreen='\e[0;32m' +# cRed='\e[0;31m' +# cBlue='\e[0;34m' +# endColor='\e[0m' diff --git a/tool/apt-fast-conf/aptss-apt.conf b/tool/apt-fast-conf/aptss-apt.conf new file mode 100644 index 0000000000000000000000000000000000000000..a6e0d63300aa32655f0a418dbe2f660c1d29637f --- /dev/null +++ b/tool/apt-fast-conf/aptss-apt.conf @@ -0,0 +1,16 @@ +Debug::RunScripts true; +Dir::Cache::archives "/var/cache/apt/archives"; +Dir::Cache "/var/lib/aptss/"; +Dir::Etc::SourceParts "/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/"; +Dir::State::lists "/var/lib/aptss/lists/"; + +APT::Get::Fix-Broken true; +APT::Get::List-Cleanup="0"; + +Acquire::GzipIndexes "false"; + +#clear APT::Update::Post-Invoke-Success; + +#clear DPkg::Post-Invoke; + +#clear DPkg::Pre-Install-Pkgs; diff --git a/tool/apt-fast-conf/sources.list.d/.keep b/tool/apt-fast-conf/sources.list.d/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tool/apt-fast/ss-apt-fast b/tool/apt-fast/ss-apt-fast new file mode 100755 index 0000000000000000000000000000000000000000..dea3648a65d0dbacb18b06379509f6f1677065f5 --- /dev/null +++ b/tool/apt-fast/ss-apt-fast @@ -0,0 +1,839 @@ +#!/bin/bash +# +# apt-fast v1.10.0 +# Use this just like aptitude or apt-get for faster package downloading. +# +# Copyright: 2008-2012 Matt Parnell, http://www.mattparnell.com +# Improvements, maintenance, revisions - 2012, 2017-2019 Dominique Lasserre +# +# You may distribute this file under the terms of the GNU General +# Public License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# + +shopt -s nullglob +[ -n "$DEBUG" ] && set -xv + +# Print colored messages. +# Usage: msg "message text" "message type" "optional: err" +# Message types are 'normal', 'hint' or 'warning'. Warnings and messages with a +# third argument are piped to stderr. + +THREADS=$(nproc 2>/dev/null || echo 4) +msg(){ + msg_options=() + case "$2" in + normal) beginColor="$cGreen";; + hint) beginColor="$cBlue";; + warning) beginColor="$cRed";; + question) beginColor="$cRed"; msg_options=(-n);; + *) beginColor= ;; + esac + + if [ -z "$3" ] && [ "$2" != "warning" ]; then + echo -e "${msg_options[@]}" "${aptfast_prefix}${beginColor}$1${endColor}" + else + echo -e "${msg_options[@]}" "${aptfast_prefix}${beginColor}$1${endColor}" >&2 + fi +} + +# Search for known options and decide if root privileges are needed. +root=$# +option= +for argument in "$@"; do + case "$argument" in + upgrade | full-upgrade | install | dist-upgrade | build-dep) + option="install" + ;; + clean | autoclean) + option="clean" + ;; + download) + option="download" + root=0 + ;; + source) + option="source" + root=0 + ;; + *) + root=0 + ;; + esac +done + +# To handle priority of options correctly (environment over config file vars) +# we need to preserve all interesting env variables. As this wouldn't be +# difficult enough we have to preserve complete env vars (especially if value +# ist set (even empty) or not) when changing context (sudo)... +# Set a 'random' string to all unset variables. +TMP_RANDOM="13979853562951413" +TMP_LCK_FILE="${LCK_FILE-${TMP_RANDOM}}" +TMP_DOWNLOADBEFORE="${DOWNLOADBEFORE-${TMP_RANDOM}}" +TMP__APTMGR="${_APTMGR-${TMP_RANDOM}}" +TMP_APTCACHE="${APTCACHE-${TMP_RANDOM}}" +TMP_DLDIR="${DLDIR-${TMP_RANDOM}}" +TMP_DLLIST="${DLLIST-${TMP_RANDOM}}" +TMP__MAXNUM="${MAXNUM-${TMP_RANDOM}}" +TMP__MAXCONPERSRV="${MAXCONPERSRV-${TMP_RANDOM}}" +TMP__SPLITCON="${SPLITCON-${TMP_RANDOM}}" +TMP__MINSPLITSZ=${MINSPLITSZ-${TMP_RANDOM}} +TMP__PIECEALGO=${PIECEALGO-${TMP_RANDOM}} +TMP_aptfast_prefix="${aptfast_prefix-${TMP_RANDOM}}" +TMP_APT_FAST_TIMEOUT="${APT_FAST_TIMEOUT-${TMP_RANDOM}}" +TMP_APT_FAST_APT_AUTH="${APT_FAST_APT_AUTH-${TMP_RANDOM}}" +TMP_VERBOSE_OUTPUT="${VERBOSE_OUTPUT-${TMP_RANDOM}}" +TMP_ftp_proxy="${ftp_proxy-${TMP_RANDOM}}" +TMP_http_proxy="${http_proxy-${TMP_RANDOM}}" +TMP_https_proxy="${https_proxy-${TMP_RANDOM}}" + +# Check for proper privileges. +# Call explicitly with environment variables to get them into root conext. +if [ "$root" -ne 0 ] && [ "$UID" != 0 ]; then + exec sudo DEBUG="$DEBUG" \ + LCK_FILE="$TMP_LCK_FILE" \ + DOWNLOADBEFORE="$TMP_DOWNLOADBEFORE" \ + _APTMGR="$TMP__APTMGR" \ + APTCACHE="$TMP_APTCACHE" \ + DLDIR="$TMP_DLDIR" \ + DLLIST="$TMP_DLLIST" \ + _MAXNUM="$TMP__MAXNUM" \ + _MAXCONPERSRV="$TMP__MAXCONPERSRV" \ + _SPLITCON="$TMP__SPLITCON" \ + _MINSPLITSZ="$TMP__MINSPLITSZ" \ + _PIECEALGO="$TMP__PIECEALGO" \ + aptfast_prefix="$TMP_aptfast_prefix" \ + APT_FAST_TIMEOUT="$TMP_APT_FAST_TIMEOUT" \ + APT_FAST_APT_AUTH="$TMP_APT_FAST_APT_AUTH" \ + VERBOSE_OUTPUT="$TMP_VERBOSE_OUTPUT" \ + ftp_proxy="$TMP_ftp_proxy" \ + http_proxy="$TMP_http_proxy" \ + https_proxy="$TMP_https_proxy" \ + "$0" "$@" +fi + +# Define lockfile. +# Use /tmp as directory because everybody (not only root) has to have write +# permissions. +# We need lock for non-root commands too, because we only have one download +# list file. +if [ "$IS_ACE_ENV" != "" ];then +LCK_FILE="/tmp/apt-fast-in-container.lock" +else +LCK_FILE="/tmp/apt-fast.lock" +fi +LCK_FD=99 + +# Set default package manager, APT cache, temporary download dir, +# temporary download list file, and maximal parallel downloads +_APTMGR=apt-get +eval "$(apt-config shell APTCACHE Dir::Cache::archives/d)" +# Check if APT config option Dir::Cache::archives::apt-fast-partial is set. +eval "$(apt-config shell apt_fast_partial Dir::Cache::archives::apt-fast-partial/d)" +if [ -z "$apt_fast_partial" ]; then + DLDIR="$(realpath "${APTCACHE}/../apt-fast")" +else + DLDIR="${apt_fast_partial}" +fi + +# Check for apt auth files +eval "$(apt-config shell NETRC Dir::Etc::netrc/f)" +eval "$(apt-config shell NETRCDIR Dir::Etc::netrcparts/d)" +APTAUTHFILES=() +if [ -f "$NETRC" ]; then + APTAUTHFILES=("$NETRC") +fi +APTAUTHFILES+=("$NETRCDIR"*) + +if [ "$IS_ACE_ENV" != "" ];then +DLLIST="/tmp/apt-fast-in-container.list" +else +DLLIST="/tmp/apt-fast.list" +fi + + + +_MAXNUM=5 +_MAXCONPERSRV=10 +_SPLITCON=8 +_MINSPLITSZ="1M" +_PIECEALGO="default" +MIRRORS=() + +# Prefix in front of apt-fast output: +aptfast_prefix= +# aptfast_prefix="$(date '+%b %_d %T.%N') apt-fast: " + +# Set color variables. +cGreen='\e[0;32m' +cRed='\e[0;31m' +cBlue='\e[0;34m' +endColor='\e[0m' + +# Set timout value for apt-fast download confirmation dialog. +# Value is in seconds. +APT_FAST_TIMEOUT=60 + +# Ask for download confirmation if unset +DOWNLOADBEFORE= + +# Enable APT authentication support +APT_FAST_APT_AUTH=1 + +# Formatted package list in download confirmation if unset +VERBOSE_OUTPUT= + +# Download command. +_DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} -i ${DLLIST} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --connect-timeout=60 --timeout=600 -m0' + +# 定义默认的配置文件列表(按加载顺序排列) +CONFIG_FILES=( + "/tmp/aptss-conf/apt-fast.conf" # 原始配置文件位置 + "/etc/aptss/apt-fast.conf" # 系统级配置 +) + + +# 按顺序加载所有配置文件 +for conf_file in "${CONFIG_FILES[@]}"; do + if [ -e "$conf_file" ]; then + source "$conf_file" + fi +done + + + +# no proxy as default +ftp_proxy= +http_proxy= +https_proxy= + +# Now overwrite with preserved values if values were set before (compare with +# 'random' string). +[ "$TMP_LCK_FILE" = "$TMP_RANDOM" ] || LCK_FILE="$TMP_LCK_FILE" +[ "$TMP_DOWNLOADBEFORE" = "$TMP_RANDOM" ] || DOWNLOADBEFORE="$TMP_DOWNLOADBEFORE" +[ "$TMP__APTMGR" = "$TMP_RANDOM" ] || _APTMGR="$TMP__APTMGR" +[ "$TMP_APTCACHE" = "$TMP_RANDOM" ] || APTCACHE="$TMP_APTCACHE" +[ "$TMP_DLDIR" = "$TMP_RANDOM" ] || DLDIR="$TMP_DLDIR" +[ "$TMP_DLLIST" = "$TMP_RANDOM" ] || DLLIST="$TMP_DLLIST" +[ "$TMP__MAXNUM" = "$TMP_RANDOM" ] || _MAXNUM="$TMP__MAXNUM" +[ "$TMP__MAXCONPERSRV" = "$TMP_RANDOM" ] || _MAXCONPERSRV="$TMP__MAXCONPERSRV" +[ "$TMP__SPLITCON" = "$TMP_RANDOM" ] || _SPLITCON="$TMP__SPLITCON" +[ "$TMP__MINSPLITSZ" = "$TMP_RANDOM" ] || _MINSPLITSZ="$TMP__MINSPLITSZ" +[ "$TMP__PIECEALGO" = "$TMP_RANDOM" ] || _PIECEALGO="$TMP__PIECEALGO" +[ "$TMP_aptfast_prefix" = "$TMP_RANDOM" ] || aptfast_prefix="$TMP_aptfast_prefix" +[ "$TMP_APT_FAST_TIMEOUT" = "$TMP_RANDOM" ] || APT_FAST_TIMEOUT="$TMP_APT_FAST_TIMEOUT" +[ "$TMP_APT_FAST_APT_AUTH" = "$TMP_RANDOM" ] || APT_FAST_APT_AUTH="$TMP_APT_FAST_APT_AUTH" +[ "$TMP_VERBOSE_OUTPUT" = "$TMP_RANDOM" ] || VERBOSE_OUTPUT="$TMP_VERBOSE_OUTPUT" +[ "$TMP_ftp_proxy" = "$TMP_RANDOM" ] || ftp_proxy="$TMP_ftp_proxy" +[ "$TMP_http_proxy" = "$TMP_RANDOM" ] || http_proxy="$TMP_http_proxy" +[ "$TMP_https_proxy" = "$TMP_RANDOM" ] || https_proxy="$TMP_https_proxy" + + +# Disable colors if not executed in terminal. +if [ ! -t 1 ]; then + cGreen= + cRed= + cBlue= + endColor= + #FIXME: Time not updated. + [ -z "$aptfast_prefix" ] && aptfast_prefix="[apt-fast $(date +"%T")]" +fi + + +msg_already_running() +{ + msg "Other aptss is running. Waited $timer senconds..." "normal" + msg "有其他的aptss正在运行。已经等待了$timer秒" "normal" +} + +# Check if a lock file exists. +#if [ -f "$LCK_FILE.lock" ]; then +# msg_already_running +# exit 1 +#fi + + +# create the lock file and lock it, die on failure +_create_lock() +{ + eval "exec $LCK_FD>\"$LCK_FILE.lock\"" + + # 设置 trap 来清理资源 + trap "cleanup_aptfast" EXIT + trap "cleanup_aptfast; exit 1" INT TERM + + timer=0 + max_wait=180 # 最大等待时间为180秒(3分钟) + + until $(flock -xn $LCK_FD); do + msg_already_running + sleep 1 + let timer+=1 + + if [ $timer -ge $max_wait ]; then + echo "timeout" + exit 1 + fi + done + + unset timer +} + +# unlock and remove the lock file +_remove_lock() +{ + flock -u "$LCK_FD" 2>/dev/null + rm -f "$LCK_FILE.lock" +} + +# Move download file away so missing permissions won't stop usage. +CLEANUP_STATE=0 +cleanup_dllist() +{ + if [ -f "$DLLIST" ] + then + if ! mv -- "$DLLIST{,.old}" 2>/dev/null + then + if ! rm -f -- "$DLLIST" 2>/dev/null + then + msg "Could not clean up download list file." "warning" + msg "无法清除下载列表文件." "warning" + CLEANUP_STATE=1 + fi + fi + fi +} + +cleanup_aptfast() +{ + local last_exit_code=$? + [ "$CLEANUP_STATE" -eq 0 ] && CLEANUP_STATE=$last_exit_code + cleanup_dllist + _remove_lock +} + +exit_cleanup_state() +{ + exit $CLEANUP_STATE +} + +# decode url string +# translates %xx but must not convert '+' in spaces +urldecode() +{ + printf '%b' "${1//%/\\x}" +} + +# Check if mirrors are available. And if so add all mirrors to download list. +############ SPARK ADJUST: Now we ignore the first config for business request +get_mirrors(){ + # Check all mirror lists. + for mirrorstr in "${MIRRORS[@]}"; do + # Build mirrors array from comma separated string. + IFS=", " read -r -a mirrors <<< "$mirrorstr" + # Check for all mirrors if URI of $1 is from mirror. If so add all other + # mirrors to (resmirror) list and break all loops. + for mirror in "${mirrors[@]}"; do + # Real expension. + if [[ "$1" == "$mirror"* ]]; then + filepath="${1#"${mirror}"}" + # Build list for aria download list. + list="${mirrors[*]:1}" + echo -e "${list// /${filepath}\\t}$filepath\n" + return 0 + fi + done + done + # No other mirrors found. + echo "$1" +} + +##########SPARK ADJUST: END + +AUTH_INFO_PARSED=() +# Parse apt authentication files. +# Undefined behavior on whitespaces in host, username or password. +prepare_auth(){ + if [ "$APT_FAST_APT_AUTH" -eq 0 ]; then + return + fi + for auth_file in "${APTAUTHFILES[@]}"; do + # auth files have netrc syntax, possible multiline entries starting with "machine" + auth_info="$(tr '\n' ' ' < "$auth_file" | sed 's/\(\\)/\n\1/g' | sed '1d')" + while IFS= read -r auth; do + machine="$(echo "$auth" | sed 's/.*\[ \t]\+\([^ \t]\+\).*/\1/')" + login="$(echo "$auth" | sed 's/.*\[ \t]\+\([^ \t]\+\).*/\1/')" + password="$(echo "$auth" | sed 's/.*\[ \t]\+\([^ \t]\+\).*/\1/')" + # if machine does not have protocol, try https:// + if ! [[ "$machine" =~ ^.*:// ]]; then + machine="https://$machine" + fi + if [ -z "$machine" ] || [ -z "$login" ] || [ -z "$password" ]; then + msg "Could not parse apt authentication (skipping): $auth ($auth_file)" "warning" + continue + fi + # use space separated string to convert back to array later + AUTH_INFO_PARSED+=("$machine $login $password") + done <<< "$auth_info" + done + if [ "${#AUTH_INFO_PARSED[@]}" -eq 0 ]; then + # acts like auth disabled when no auth info is provided to improve performance + APT_FAST_APT_AUTH=0 + fi +} + +# Gets URI as parameter and tries to add basic http credentials. Will fail on +# credentials that contain characters that need URL-encoding. +get_auth(){ + for auth_info in "${AUTH_INFO_PARSED[@]}"; do + # convert to array, don't escape variable here + auth_info_arr=($auth_info) + machine="${auth_info_arr[0]}" + # takes first match + if [[ "$1" == "$machine"* ]]; then + login="${auth_info_arr[1]}" + password="${auth_info_arr[2]}" + uri="$(echo "$1" | sed "s|^\([^:]\+://\)|\1$login:$password@|")" + echo "$uri" + return + fi + done + echo "$1" +} + +# Globals to save package name, version, size and overall size. +DOWNLOAD_DISPLAY= +DOWNLOAD_SIZE=0 + +# 获取包的URI +# Get the package URLs. +get_uris(){ + if [ ! -d "$(dirname "$DLLIST")" ] + then + if ! mkdir -p -- "$(dirname "$DLLIST")" + then + msg "Could not create download file directory." "warning" + msg "无法创建下载目录" "warning" + CLEANUP_STATE=1 + exit + fi + elif [ -f "$DLLIST" ]; then + if ! rm -f -- "$DLLIST" 2>/dev/null && ! touch -- "$DLLIST" 2>/dev/null + then + msg "Unable to write to download file. Try restarting with root permissions or run 'apt-fast clean' first." "warning" + msg "无法下载文件。尝试使用root权限,或者运行 'aptss clean'" "warning" + CLEANUP_STATE=1 + exit + fi + fi + + # Add header to overwrite file. + echo "# apt-fast mirror list: $(date)" > "$DLLIST" + # NOTE: "aptitude" doesn't have this functionality + # so we use "${_APTMGR}" to get package URI's + case "$(basename "${_APTMGR}")" in + 'apt'|'apt-get') uri_mgr="${_APTMGR}";; + *) uri_mgr='apt-get';; + esac + uris_full="$("$uri_mgr" "${APT_SCRIPT_WARNING[@]}" -y --print-uris "$@")" + CLEANUP_STATE="$?" + if [ "$CLEANUP_STATE" -ne 0 ] + then + msg "Package manager quit with exit code. Here is the log" "warning" + msg "包管理器以错误代码退出.日志如下" "warning" + msg "${uris_full}" + exit "$CLEANUP_STATE" + fi + prepare_auth + local tmpdir + tmpdir=$(mktemp -d) || { + msg "Failed to create tmp dir" "warning" + msg "无法创建临时目录" "warning" + exit 1 + } + ## --print-uris format is: + # 'fileurl' filename filesize checksum_hint:filechecksum + # 修改:process_package函数增加第二个参数表示当前线程的临时输出文件 + process_package() { + local pkg_uri_info="$1" + local thread_file="$2" + local display_line="" # 初始化显示信息为空 + IFS=' ' read -r uri filename filesize checksum_string _ <<<"$pkg_uri_info" + [ -z "$uri" ] && return + uri="${uri//"'"/}" + [ "$APT_FAST_APT_AUTH" -ne 0 ] && uri="$(get_auth "$uri")" + IFS=':' read -r hash_algo checksum _ <<<"$checksum_string" + + if [[ "$filename" == *%* ]]; then + # decode url string + filename_decoded="$(printf '%b' "${filename//%/\\x}")" + else + filename_decoded="$filename" + fi + IFS='_' read -r pkg_name_decoded pkg_version_decoded _ <<<"$filename_decoded" + + display_line+="$pkg_name_decoded $pkg_version_decoded $filesize\n" + if [ -n "$HASH_SUPPORTED" ]; then + case "$hash_algo" in + SHA512) [ -z "$SHA512_SUPPORTED" ] && hash_algo= || hash_algo=sha-512 ;; + SHA256) [ -z "$SHA256_SUPPORTED" ] && hash_algo= || hash_algo=sha-256 ;; + SHA1) [ -z "$SHA1_SUPPORTED" ] && hash_algo= || hash_algo=sha-1 ;; + MD5Sum) [ -z "$MD5sum_SUPPORTED" ] && hash_algo= || hash_algo=md5 ;; + *) hash_algo= + esac + + + # Using apt-cache show package=version to ensure recover single and + # correct package version. + # Warning: assuming that package naming uses '_' as field separator. + # Therefore, this code expects package-name_version_arch.deb Otherwise + # below code will fail resoundingly + if [ -z "$hash_algo" ]; then + IFS='_' read -r pkg_name _ <<<"$filename" + pkg_version="$pkg_version_decoded" + # Transform multi-line field output from apt-cache to single line and sort checksums, strongest first + package_info="$(apt-cache show "$pkg_name=$pkg_version" | sed ':r;$!{N;br};s/\n / /g' | sort -r)" + + while IFS=': ' read -r field checksum _ + do + case "$field" in + SHA512) + [ -n "$SHA512_SUPPORTED" ] || continue + hash_algo="sha-512" + break ;; + SHA256) + [ -n "$SHA256_SUPPORTED" ] || continue + hash_algo="sha-256" + break ;; + SHA1) + [ -n "$SHA1_SUPPORTED" ] || continue + hash_algo="sha-1" + break ;; + MD5sum) + [ -n "$MD5sum_SUPPORTED" ] || continue + hash_algo="md5" + break ;; + esac + done <<<"$package_info" + + if [ -z "$hash_algo" ]; then + checksum= + msg "Couldn't get supported checksum for $pkg_name ($pkg_version)." "warning" + msg "无法获得 $pkg_name ($pkg_version) 版本受到支持的散列验证值" "warning" + REMOVE_WORKING_MESSAGE= + fi + fi + else + hash_algo= + fi + + # 原来利用文件锁写入,现在改为写入当前线程的临时文件 + { + get_mirrors "$uri" + [ -n "$hash_algo" ] && echo " checksum=$hash_algo=$checksum" + echo " out=$filename" + } >> "$thread_file" + + echo -e "$display_line" >> "$tmpdir/display" + echo "$filesize" >> "$tmpdir/sizes" + } + + # 主并行处理逻辑 + mapfile -t pkg_uri_list < <(echo "$uris_full" | grep -E "^'(http(s|)|(s|)ftp)://") + total_pkgs=${#pkg_uri_list[@]} + threads=${THREADS:-4} # 默认4线程 + per_thread=$(( (total_pkgs + threads - 1) / threads )) # 向上取整 + + # 分配任务到不同线程,每个线程使用自己的临时文件 + for ((i=0; i "$thread_file" # 清空或创建临时文件 + start=$((i * per_thread)) + end=$((start + per_thread -1)) + [ $end -ge $total_pkgs ] && end=$((total_pkgs -1)) + + # 启动后台线程处理任务块 + ( + for ((j=start; j<=end; j++)); do + [ -z "${pkg_uri_list[j]}" ] && continue + process_package "${pkg_uri_list[j]}" "$thread_file" + done + ) & + done + + # 等待所有后台任务完成 + wait + + # 合并所有线程的临时文件到最终的 $DLLIST 中(保留之前添加的 header) + for ((i=0; i> "$DLLIST" + rm -f "$thread_file" + fi + done + + # 合并显示信息 + if [ -f "$tmpdir/display" ]; then + DOWNLOAD_DISPLAY+="\n$(cat "$tmpdir/display")" + fi + + # 计算总下载大小 + if [ -f "$tmpdir/sizes" ]; then + DOWNLOAD_SIZE=$(awk '{sum+=$1} END{print sum}' "$tmpdir/sizes") + fi + + # 清理临时目录 + rm -rf "$tmpdir" +} + + + +display_downloadfile(){ + if [ -n "$VERBOSE_OUTPUT" ]; then + cat "$DLLIST" + else + DISPLAY_SORT_OPTIONS=(-k 1,1) + # Sort output after package download size (decreasing): + #DISPLAY_SORT_OPTIONS=(-k 3,3 -hr) + while IFS=' ' read -r pkg ver size _; do + [ -z "$pkg" ] && continue + printf '%s%-40s %-20s %10s\n' "$aptfast_prefix" "$pkg" "$ver" "$size" + done <<<"$(echo -e "$DOWNLOAD_DISPLAY" | sort "${DISPLAY_SORT_OPTIONS[@]}" | numfmt --to=iec-i --suffix=B --field=3)" + fi + msg "Download size: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal" + msg "下载大小: $(echo "$DOWNLOAD_SIZE" | numfmt --to=iec-i --suffix=B)" "normal" +} + + +# Create and insert a PID number to lockfile. + +_create_lock + +# Make sure aria2c (in general first parameter from _DOWNLOADER) is available. +CMD="$(echo "$_DOWNLOADER" | sed 's/^\s*\([^ ]\+\).*$/\1/')" +if [ ! "$(command -v "$CMD")" ]; then + msg "Command not found: $CMD" "normal" "err" + msg "You must configure $CONFFILE to use aria2c or another supported download manager" "normal" "err" + CLEANUP_STATE=1 + exit +fi + +# Make sure package manager is available. +if [ ! "$(command -v "$_APTMGR")" ]; then + msg "\`$_APTMGR\` command not available." "warning" + msg "You must configure $CONFFILE to use either apt-get or aptitude." "normal" "err" + CLEANUP_STATE=1 + exit +fi + +# Disable script warning if apt is used. +APT_SCRIPT_WARNING=() +if [ "$(basename "${_APTMGR}")" == 'apt' ]; then + APT_SCRIPT_WARNING=(-o "Apt::Cmd::Disable-Script-Warning=true") +fi + +# Set supported hash algorithms by aria2c (and also by Debian repository). +SHA512_SUPPORTED= +SHA256_SUPPORTED= +SHA1_SUPPORTED= +MD5sum_SUPPORTED= +HASH_SUPPORTED= +if [ "$CMD" == "aria2c" ]; then + for supported_hash in $(LC_ALL=C aria2c -v | sed '/^Hash Algorithms:/!d; s/\(^Hash Algorithms: \|,\)\+//g'); do + case "$supported_hash" in + sha-512) SHA512_SUPPORTED=y; HASH_SUPPORTED=y ;; + sha-256) SHA256_SUPPORTED=y; HASH_SUPPORTED=y ;; + sha-1) SHA1_SUPPORTED=y; HASH_SUPPORTED=y ;; + md5) MD5sum_SUPPORTED=y; HASH_SUPPORTED=y ;; + esac + done + if [ -z "$HASH_SUPPORTED" ]; then + msg "Couldn't find supported checksum algorithm from aria2c. Checksums disabled." "warning" + msg "无法找到aria2c支持的散列验证算法. 散列验证已被禁用." "warning" + fi +fi + +# Check if "assume yes" switch is enabled and if yes enable $DOWNLOADBEFORE. +# Also check if "download only" switch is enabled. +#TODO: Get real value over APT items APT::Get::Assume-Yes and +# APT::Get::Assume-No . +# Respectively Aptitude::CmdLine::Download-Only and APT::Get::Download-Only. +DOWNLOAD_ONLY= +while true; do + while getopts ":dy-:" optchar; do + case "${optchar}" in + -) + case "${OPTARG}" in + yes | assume-yes) DOWNLOADBEFORE=true ;; + assume-no) DOWNLOADBEFORE= ;; + download-only) DOWNLOAD_ONLY=true ;; + esac + ;; + y) + DOWNLOADBEFORE=true + ;; + d) + DOWNLOAD_ONLY=true + ;; + *) + ;; + esac + done + ((OPTIND++)) + [ $OPTIND -gt $# ] && break +done + +# Configure proxies. Use apt values over environment variables. +# Note: If proxy setting is not set, there is no apt-config output. +# Therefore variable doesn't get overriden, which is intended. +# Export the variables to make them available in subshells (aka the +# downloader command). +eval "$(apt-config shell ftp_proxy Acquire::ftp::proxy)" +export ftp_proxy +eval "$(apt-config shell http_proxy Acquire::http::proxy)" +export http_proxy +eval "$(apt-config shell https_proxy Acquire::https::proxy)" +export https_proxy + +# aria2 has no socks support (see https://github.com/aria2/aria2/issues/153) +if echo "$http_proxy" | grep -q "^socks5h://" || echo "$https_proxy" | grep -q "^socks5h://"; then + msg "Socks proxy detected. Falling back to ${_APTMGR}" "hint" + "${_APTMGR}" "${APT_SCRIPT_WARNING[@]}" "$@" + exit 0 +fi + +# Run actions. +if [ "$option" == "install" ]; then + msg + msg "Working... this may take a while." "normal" + msg "正在工作中,请稍等" "normal" + REMOVE_WORKING_MESSAGE=y + + get_uris "$@" + [ -t 1 ] && [ -n "$REMOVE_WORKING_MESSAGE" ] && tput cuu 1 && tput el && tput cuu 1 + # Test /tmp/apt-fast.list file exists and not just the apt-fast comment line. + # Then download all files from the list. + if [ -f "$DLLIST" ] && [ "$(wc -l "$DLLIST" | cut -d' ' -f1)" -gt 1 ] && [ ! "$DOWNLOADBEFORE" ]; then + display_downloadfile + msg + msg "Do you want to download the packages? [Y/n] " "question" + + while ((!updsys)); do + read -r -sn1 -t "$APT_FAST_TIMEOUT" answer || { msg; msg "Timed out." "warning"; CLEANUP_STATE=1; exit; } + case "$answer" in + [JjYy]) result=1; updsys=1 ;; + [Nn]) result=0; updsys=1 ;; + "") result=1; updsys=1 ;; + *) updsys=0 ;; + esac + done + else + result=1 + fi + + if ((DOWNLOAD_SIZE)); then + msg + # Continue if answer was right or DOWNLOADBEFORE is enabled. + if ((result)); then + if [ -s "$DLLIST" ]; then + # Test if apt-fast directory is present where we put packages. + if [ ! -d "$DLDIR" ]; then + mkdir -p -- "$DLDIR" + fi + + cd "$DLDIR" &>/dev/null || { msg; msg "Not able to change into download directory." "warning"; CLEANUP_STATE=1; exit; } + + eval "${_DOWNLOADER}" # execute downloadhelper command + if [ "$(find "$DLDIR" -printf . | wc -c)" -gt 1 ]; then + + # Delete incomplete/corrupted downloaded files, if any: Not recursive, as we don't expect any dirs to exist within $DLDIR. + + # When Aria2c downloads a file and detects it is corrupted, its filename won't be renamed back to its actual name, + # preserving .aria2 file extension, which also indicates when a file hasn't been completely downloaded. + for x in *.aria2; do + rm -f "$x" "${x%.aria2}" + done + + # Move all packages to the apt install directory by force to ensure + # already existing debs which may be incomplete are replaced + find . -type f \( -name '*.deb' -o -name '*.ddeb' \) -execdir mv -ft "$APTCACHE" {} \+ + fi + cd - &>/dev/null || msg "Failed to change back directory" "warning" + fi + else + CLEANUP_STATE=1 + exit + fi + else + [ -t 1 ] && tput el + fi + + # different problem resolving for aptitude + if [ -z "$DOWNLOAD_ONLY" ] || [ "$(basename "${_APTMGR}")" == 'aptitude' ]; then + "${_APTMGR}" "${APT_SCRIPT_WARNING[@]}" "$@" + fi + + +elif [ "$option" == "clean" ]; then + "${_APTMGR}" "${APT_SCRIPT_WARNING[@]}" "$@" && { + if [ -d "$DLDIR" ]; then + find "$DLDIR" -maxdepth 1 -type f -delete + CLEANUP_STATE="$?" + [ -f "$DLLIST" ] && rm -f -- "$DLLIST"* || true + fi + } + +elif [ "$option" == "download" ]; then + msg + msg "Working... this may take a while." "normal" + msg "正在工作中,请稍等" "normal" + REMOVE_WORKING_MESSAGE=y + + get_uris "$@" + + [ -t 1 ] && [ -n "$REMOVE_WORKING_MESSAGE" ] && tput cuu 1 && tput el && tput cuu 1 + + if [ -f "$DLLIST" ] && [ "$(wc -l "$DLLIST" | cut -d' ' -f1)" -gt 1 ]; then + display_downloadfile + eval "${_DOWNLOADER}" + fi + + # different problem resolving for aptitude + if [ "$(basename "${_APTMGR}")" == 'aptitude' ]; then + "${_APTMGR}" "$@" + fi + +elif [ "$option" == "source" ]; then + msg + msg "Working... this may take a while." "normal" + msg "正在工作中,请稍等" "normal" + REMOVE_WORKING_MESSAGE=y + + get_uris "$@" + + [ -t 1 ] && [ -n "$REMOVE_WORKING_MESSAGE" ] && tput cuu 1 && tput el && tput cuu 1 + + if [ -f "$DLLIST" ] && [ "$(wc -l "$DLLIST" | cut -d' ' -f1)" -gt 1 ]; then + display_downloadfile + eval "${_DOWNLOADER}" + fi + # We use APT manager here to provide more verbose output. This method is + # slightly slower then extractiong packages manually after download but also + # more hardened (e.g. some options like --compile are available). + "${_APTMGR}" "${APT_SCRIPT_WARNING[@]}" "$@" + # Uncomment following snippet to extract source directly and comment + # both lines before. + #while read srcfile; do + # # extract only .dsc files + # echo "$srcfile" | grep -q '\.dsc$' || continue + # dpkg-source -x "$(basename "$srcfile")" + #done < "$DLLIST" + +# Execute package manager directly if unknown options are passed. +else + "${_APTMGR}" "${APT_SCRIPT_WARNING[@]}" "$@" +fi + +# After error or all done remove our lockfile (done with EXIT trap) + diff --git a/tool/aptss b/tool/aptss new file mode 100755 index 0000000000000000000000000000000000000000..acee277e472d170abadc20d7c41a95bfee5bfd27 --- /dev/null +++ b/tool/aptss @@ -0,0 +1,130 @@ +#!/bin/bash + +SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/" +SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store" +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +source /opt/durapps/spark-store/bin/bashimport/log.amber +load_transhell + +case `arch` in + x86_64 | i686 | i386) + STORE_URL="store" + STORE_LIST_URL="" + ;; + aarch64) + STORE_URL="aarch64-store" + STORE_LIST_URL="-aarch64" + ;; + loongarch64) + STORE_URL="loong64-store" + STORE_LIST_URL="-loong64" + ;; + riscv64) + STORE_URL="riscv64-store" + STORE_LIST_URL="-riscv64" + ;; +esac +SS_APT_FAST="/opt/durapps/spark-store/bin/apt-fast/ss-apt-fast" + + +is_empty_dir(){ + return `ls -A $1|wc -w` +} + +function update_list(){ +curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "${SPARK_DOWNLOAD_SERVER_URL}/sparkstore${STORE_LIST_URL}.list" +log.info "sparkstore${STORE_LIST_URL}.list update done" +} + +function update_conf(){ +mkdir -p /tmp/aptss-conf/ +curl --progress-bar -o /tmp/aptss-conf/apt-fast.conf "${SPARK_DOWNLOAD_SERVER_URL}/apt-fast.conf" +log.info "apt-fast.conf update done" +chmod -R 755 /tmp/aptss-conf +} + +if [ "$(id -u)" != "0" ];then +#############################无root权限时 +echo -e "\e[1;32m${TRANSHELL_CONTENT_RUNNING_IN_NOT_ROOT_USER}\e[0m" + +else + + +ln -sf /etc/apt/sources.list.d/* /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d +###让这里和系统同步,先链接,然后清除无效链接 +find /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d -xtype l -delete + +fi + +if [ ! -e "/tmp/aptss-conf/apt-fast.conf" ];then +###刷新apt-fast配置 +mkdir -p /tmp/aptss-conf/ +echo -e "\e[1;32m${TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST}\e[0m" +echo +update_conf + +fi + + +if [ ! -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ] && [ ! -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && [ ! -e "/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" ];then + +mkdir -p /tmp/aptss-conf/ +echo -e "\e[1;32m${TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST}\e[0m" +echo + +update_list +update_conf + +#只更新星火源 + + +fi + + + + + +if [ "$1" = "install" ] || [ "$1" = "upgrade" ] || [ "$1" = "full-upgrade" ] || [ "$1" = "dist-upgrade" ]; then + + + +###执行 + +${SS_APT_FAST} "$@" --allow-downgrades -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf +ret="$?" +if [ "$ret" -ne 0 ];then +echo -e "\e[1;33m$TRANSHELL_CONTENT_PLEASE_USE_APTSS_INSTEAD_OF_APT\e[0m" +exit $ret +fi + + + + +elif [ "$1" = "ssupdate" ];then + +mkdir -p /tmp/aptss-conf/ +echo -e "\e[1;32m${TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST}\e[0m" +echo + + +update_list +update_conf + +/usr/bin/apt update -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -o Dir::Etc::sourcelist="/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list" + +#只更新星火源 + +elif [ "$1" = "update" ];then + +echo -e "\e[1;32m${TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST}\e[0m" +echo +update_list +update_conf +### 额外一份拿来给aptss自动补全用 + + ${SS_APT_FAST} "$@" -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf + +else + ${SS_APT_FAST} "$@" -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf +fi + diff --git a/tool/bashimport/log.amber b/tool/bashimport/log.amber new file mode 100644 index 0000000000000000000000000000000000000000..fe97bef364d9c8402afe7487c5ee81f027d03704 --- /dev/null +++ b/tool/bashimport/log.amber @@ -0,0 +1,5 @@ +#!/bin/bash +log.warn() { echo -e "[\e[33mWARN\e[0m]: \e[1m$*\e[0m"; } +log.error() { echo -e "[\e[31mERROR\e[0m]: \e[1m$*\e[0m"; } +log.info() { echo -e "[\e[96mINFO\e[0m]: \e[1m$*\e[0m"; } +log.debug() { echo -e "[\e[32mDEBUG\e[0m]: \e[1m$*\e[0m"; } diff --git a/tool/bashimport/transhell.amber b/tool/bashimport/transhell.amber new file mode 100755 index 0000000000000000000000000000000000000000..73b8d90a2a49247c1fb75dfdda69220b30cdfe46 --- /dev/null +++ b/tool/bashimport/transhell.amber @@ -0,0 +1,31 @@ +#!/bin/bash + +##load transhell +function load_transhell_debug() +{ +local WORK_PATH="$(cd "$(dirname "${0}")" && pwd)" +local CURRENT_LANG="$(echo ${LANG%.*})" +if [ -e "/usr/share/$(basename $0)/transhell/$(basename $0)_en_US.transhell" ]; then source /usr/share/$(basename $0)/transhell/$(basename $0)_en_US.transhell; echo "Loading transhell from /usr/share/$(basename $0)/transhell/$(basename $0)_en_US.transhell ..."; fi +if [ -e "/usr/share/$(basename $0)/transhell/$(basename $0)_$CURRENT_LANG.transhell" ]; then source /usr/share/$(basename $0)/transhell/$(basename $0)_$CURRENT_LANG.transhell; echo "Loading transhell from /usr/share/$(basename $0)/transhell/$(basename $0)_$CURRENT_LANG.transhell ..."; fi +if [ -e "${WORK_PATH}/transhell/$(basename $0)_en_US.transhell" ]; then source ${WORK_PATH}/transhell/$(basename $0)_en_US.transhell; echo "Loading transhell from ${WORK_PATH}/transhell/$(basename $0)_en_US.transhell ..."; fi +if [ -e "${WORK_PATH}/transhell/$(basename $0)_$CURRENT_LANG.transhell" ]; then source ${WORK_PATH}/transhell/$(basename $0)_$CURRENT_LANG.transhell; echo "Loading transhell from ${WORK_PATH}/transhell/$(basename $0)_$CURRENT_LANG.transhell ..."; fi + +echo "-----------------------------------------------------------------------------" +} + +function load_transhell() +{ +local WORK_PATH="$(cd "$(dirname "${0}")" && pwd)" +local CURRENT_LANG="$(echo ${LANG%.*})" +if [ -e "/usr/share/$(basename $0)/transhell/$(basename $0)_en_US.transhell" ]; then source /usr/share/$(basename $0)/transhell/$(basename $0)_en_US.transhell; fi +if [ -e "/usr/share/$(basename $0)/transhell/$(basename $0)_$CURRENT_LANG.transhell" ]; then source /usr/share/$(basename $0)/transhell/$(basename $0)_$CURRENT_LANG.transhell; fi +if [ -e "${WORK_PATH}/transhell/$(basename $0)_en_US.transhell" ]; then source ${WORK_PATH}/transhell/$(basename $0)_en_US.transhell; fi +if [ -e "${WORK_PATH}/transhell/$(basename $0)_$CURRENT_LANG.transhell" ]; then source ${WORK_PATH}/transhell/$(basename $0)_$CURRENT_LANG.transhell; fi + +} + +function update_transhell() +{ +load_transhell $@ +} + diff --git a/tool/open-in-terminal/open-in-terminal b/tool/open-in-terminal/open-in-terminal new file mode 100755 index 0000000000000000000000000000000000000000..fda426d3c49832896a049f70c861ec5b5e1e497e --- /dev/null +++ b/tool/open-in-terminal/open-in-terminal @@ -0,0 +1,33 @@ +#!/bin/bash +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +load_transhell +# 检查是否传入了路径参数 +if [ -z "$1" ]; then + echo "${TRANSHELL_CONTENT_PLEASE_PROVIDE_FILE_PATH}" + exit 1 +fi + + DESKTOP_FILE_PATH=$1 + + if [[ $DESKTOP_FILE_PATH == file://* ]]; then + # 如果是,移除 'file://' 部分并输出结果 + DESKTOP_FILE_PATH="${DESKTOP_FILE_PATH#file://}" + fi + + # 获取文件内容中第一个 Exec= 后的命令 + exec_command=$(grep -m 1 -oP "(?<=Exec=).*" "$DESKTOP_FILE_PATH") + + # 删除 exec_command 中最后的 % 及其后面的内容 + exec_command="${exec_command%\%*}" + + # 打印提取的命令 + echo "$exec_command" + + # 在默认终端执行命令 + eval "$exec_command" + +echo -------------------------------------- +echo "${TRANSHELL_CONTENT_ABOVE_IS_TERMINAL_OUTPUT}" +echo "${TRANSHELL_CONTENT_PRESS_ENTER_TO_FINISH}" +read + diff --git a/tool/open-in-terminal/transhell/open-in-terminal_en_US.transhell b/tool/open-in-terminal/transhell/open-in-terminal_en_US.transhell new file mode 100644 index 0000000000000000000000000000000000000000..0950339ff8c782fde3ec151a1e40e12982f19ad0 --- /dev/null +++ b/tool/open-in-terminal/transhell/open-in-terminal_en_US.transhell @@ -0,0 +1,5 @@ +#!/bin/bash +TRANSHELL_CONTENT_PLEASE_PROVIDE_FILE_PATH="Please provide a file path as an argument" +TRANSHELL_CONTENT_ABOVE_IS_TERMINAL_OUTPUT="The above is the output executed in the terminal. Please copy and paste it when providing feedback." +TRANSHELL_CONTENT_PRESS_ENTER_TO_FINISH="Press Enter to finish" + diff --git a/tool/open-in-terminal/transhell/open-in-terminal_zh_CN.transhell b/tool/open-in-terminal/transhell/open-in-terminal_zh_CN.transhell new file mode 100644 index 0000000000000000000000000000000000000000..e1682c266eef2129eed4fd0e68734867b3d11906 --- /dev/null +++ b/tool/open-in-terminal/transhell/open-in-terminal_zh_CN.transhell @@ -0,0 +1,5 @@ +#!/bin/bash +TRANSHELL_CONTENT_PLEASE_PROVIDE_FILE_PATH="请传入文件路径作为参数" +TRANSHELL_CONTENT_ABOVE_IS_TERMINAL_OUTPUT="以上是在终端中执行的输出,请在反馈问题的时候完整复制并贴上" +TRANSHELL_CONTENT_PRESS_ENTER_TO_FINISH="按回车结束" + diff --git a/tool/spark-dstore-patch b/tool/spark-dstore-patch new file mode 100755 index 0000000000000000000000000000000000000000..9d07294a56daa371eaaf605775f53d7cacf0fa8e --- /dev/null +++ b/tool/spark-dstore-patch @@ -0,0 +1,128 @@ +#!/bin/bash + + + + + +enumAppInfoList() { + appInfoList=() + apps="/opt/apps" + list=$(ls $apps 2>/dev/null) + for appID in $list; do + appInfoList+=("$appID") + done + echo "${appInfoList[@]}" +} +linkDir() { + ensureTargetDir() { + targetFile=$1 + t=$(dirname "$targetFile") + mkdir -p "$t" + } + + source=$1 + target=$2 + sourceDir=$(dirname "$source") + targetDir=$(dirname "$target") + find "$source" -type f | while read sourceFile; do + targetFile="$targetDir/${sourceFile#$sourceDir/}" + + + ensureTargetDir "$targetFile" + sourceFile=$(realpath --relative-to="$(dirname $targetFile)" "$sourceFile" ) + if [ ! -e ${targetFile} ];then + ln -sv "$sourceFile" "$targetFile" + fi + done +} + + +linkApp() { + appID=$1 + appEntriesDir="/opt/apps/$appID/entries" + appLibsDir="/opt/apps/$appID/files/lib" + autoStartDir="$appEntriesDir/autostart" + + if [ -d "$autoStartDir" ]; then + linkDir "$autoStartDir" "/etc/xdg/autostart" + fi + + # link application + sysShareDir="/usr/share" + for folder in "$appEntriesDir/applications" "$appEntriesDir/icons" "$appEntriesDir/mime" "$appEntriesDir/glib-2.0" "$appEntriesDir/services" "$appEntriesDir/GConf" "$appEntriesDir/help" "$appEntriesDir/locale" "$appEntriesDir/fcitx"; do + if [ ! -d "$folder" ]; then + continue + fi + if [ "$folder" = "$appEntriesDir/polkit" ]; then + linkDir "$folder" "/usr/share/polkit-1" + elif [ "$folder" = "$appEntriesDir/fonts/conf" ]; then + linkDir "$folder" "/etc/fonts/conf.d" + else + linkDir "$folder" "$sysShareDir/${folder##*/}" + fi + done +} + +function exec_uos_package_link(){ + +for app in $(enumAppInfoList); do + linkApp "$app" & + +done +wait +} + +function exec_v23_icon_link(){ +# Fix v23 broken icon +if [ ! -d "/usr/share/icons/hicolor/scalable/apps" ];then +mkdir -p /usr/share/icons/hicolor/scalable/apps +fi + +for icon_root_icon_path in $(ls /usr/share/icons/*.png /usr/share/icons/*.svg 2>/dev/null) +do +target_icon_path=/usr/share/icons/hicolor/scalable/apps/$(basename ${icon_root_icon_path}) +if [ ! -e ${target_icon_path} ];then +ln -sv $(realpath --relative-to=/usr/share/icons/hicolor/scalable/apps ${icon_root_icon_path}) /usr/share/icons/hicolor/scalable/apps +fi +done +} + +function exec_link_clean(){ +# remove broken links in /usr/share + + find /usr/share/applications -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/icons -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/mime/packages -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/glib-2.0 -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/dbus-1/services -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/help -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/locale -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/fcitx -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/lib/mozilla/plugins -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/polkit-1/actions -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /usr/share/fonts -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + find /etc/fonts/conf.d -xtype l -exec echo '{} is invalid now and going to be cleaned' \; -exec unlink {} \; 2>/dev/null & + + +} +function exec_uos_package_update(){ + update-icon-caches /usr/share/icons/* > /dev/null 2>&1 & + update-desktop-database -q > /dev/null 2>&1 & + update-mime-database -V /usr/share/mime > /dev/null 2>&1 & + glib-compile-schemas /usr/share/glib-2.0/schemas/ > /dev/null 2>&1 & + +} + +######################################################################################### +echo "----------------Running Spark DStore Patch----------------" +if [ ! -e /usr/bin/deepin-app-store-tool ];then +# execute linkApp function for each app and print output +exec_uos_package_link + +fi +#exec_v23_icon_link +exec_link_clean +wait +exec_uos_package_update +echo "----------------Finished----------------" diff --git a/tool/spark-store.asc b/tool/spark-store.asc new file mode 100644 index 0000000000000000000000000000000000000000..9333af9ded8007dd9c4886884ef624c98cbf010c --- /dev/null +++ b/tool/spark-store.asc @@ -0,0 +1,41 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBF7sGtgBDADKux63RQqGjbilEBErDjbGH+/sya9VjNBZdge1G/kK+8SEU7x9 +QFkSoprS7MN9qEtLhdN4+jqKDwwwlB0kjOK/L3BTsSjeP1fonY+Foprnc5sBBNDq +2g4SQr1joafJq/d/E1GzCFCtUeo1/g8siEB9O2A8LFAqKB0ti6cXFQBc7QrRKNqb +mUQYYkva5TeyYXwg8dV/jlQ1HkRftHO+mDOlxhSZxjH8o/3cHpVB/Ef7LUbUfzTL +jT4Lxu5k6jFYeNI9EmIl36Nfz6o4T+iG19PQjv0d9aZe+4ceFeRQNPPqeubGJO9Z +STNhHBFisgr/NdCKDVimR9wR7NSDceO+NswgMZzzo2xIFCsTB+JrMpTkDEBF1eFC +F2RHwi6T4vJmFdt1rHhBfufgHrGNekZytgZw6tL9WDvDCiCKKZSGetfuBfaNYy63 +QNVszRVT5IOf6Rg2vtBIWM/iiAI6E9RsNhElRQj/cQLriIzuwHfgdHx8gPsRSgVx +ZgizW0/2u4ZkrHUAEQEAAbQiRENTdG9yZSA8amlmZW5nc2hlbm1vQG91dGxvb2su +Y29tPokBzgQTAQoAOAIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgBYhBJ2aqFn3 +UCSxoezhbg5B01SimkQMBQJirsYKAAoJEA5B01SimkQMCx0L/2OvTYmOr4y4wC7i +oC/uCZpWt9eCMEkC1kB2a9xjPX2GbxTnzvrdkiqHDD8uR2gfO7NkHyoGies+zeCT +LcHH1Li+8KnGy3wye1KWgGTpxS3OV1gHawXi2w6OVhoQvod0y3cbGAOtOWpnbg1n +SiJdDy3cjC+BNYSNPuF3qoY6YEdIfE9SaXANxe/57TUbN0TaiQFYdRd7GyyevjtC +KNW8R06QKQ/zNqJSaoMHVVtDICXDCR4yvzmqXJppfMJKwHW9sPLC2c1xVx3pmyXc +yFzIPOyeu3CDvdbXlh1gfoMTnUfWQyB7oIZxmCfFJGdodZwoxA+pkAcyhx87JYpE +L4gy3SERvAog+/dD47gCb5alGYvyk9t7PQAAvwY8yr/6gf7f1U7DzxuT386LefW7 +6p5ET/R7xcuNLwRH0ZOp/eQECj72A7KXhQ5IL47Rfdh7VzCkf0MGKBFEIET9OV0G +zv1q/z281pt08wHPGM3CetPWUFWUD9/H/UvBUSmpoSLgBsMhdbkBjQRe7BrYAQwA +mAKDNHieo2P1WGNBMi4pPuhhgv8JyBzk8yrSOU+8s1ZTI4mI82iBEy5zAnAx3W1k +unXVlDyq1/LfzL2Nt8Apr5aQdyEqSu4zN/6JBETB0LIkdrwdwBciAHzAKPfJWCR8 +t+Ox76I2MNeVsVQFAjGeb/7QR1Ge6Sx/sgSG7NTWYD6PmQtqmH0xKJsfXYfgayRG +RF1rfu6CV0b2rPFfXOwB+3qQ8YInrPlI/9dswZiVElGGmbQTo3fGqk3T5iShqSnZ +wCYDj2ODDknoPrfE1uUkF7CoYEkGrPbrUMwFK/SHvvG6cUz0EFUENPg7nECPmHGm +GPWByBx/Yo0Jg68JavIeX7q9mnnlTP/3sp1JFLAQpR8q4S9lFOv6uYKJNUxQeBF+ +lBUkiafHzeHxJNP3ymDkrRRi640TubEZfVGjp5cskLY+U6KIpAXK/kCp42uPY7ob +cuc3vAZ+5EcYCOY+LI80urQ5a+iMqo2ZTxL7C0BAX79QLgTDmH/FW4ejkSbrXH8v +ABEBAAGJAbYEGAEKACACGwwWIQSdmqhZ91AksaHs4W4OQdNUoppEDAUCYq7GEwAK +CRAOQdNUoppEDOm8C/9w3/Qtd14531O+ZsrQkfQ+ByIvGFKrnz4BIqD/99lR7UXj +3Z2/bN7IGbwNUrBpgFqzlWAzpX9tiGhnwDphwSVeYNsvwepKmtmMAaPkP+ujR95E +62UKpdVVrHH/VOCT4ZsSddwEVOLeI9LltO6RmPr54e3bpBXv6bijGnjhgRyJU2Jg +DVE+UOU3m26fTQZZf3G9W55TBNdtpA1gggppJ7SgbwmuWcFjeF1gaEOeW2P5jaYe ++Nx4Xpc4uf341elTfym8NQ/CfEfgAn3zs0ZOmnCX3JlmFh7gPW8fOSIDTC0NkJtU +6LlguuprKhAUCSPKDlod7f7SmiwMsqvaAH+6Hi402tFnIwA1zjQk4BoCsUAVXVQx +l2LC2UD3zBZw9WO6Y/YDgzM6Q2TlI9l1IjmkMHBWHalZ2afA7Uutv4JeNm0joT1D +O5TmDYkkjjfu/+t+QnmBt5KgN2+HwF83ceJOqbPETvEviG5Wh+RXIT5kSgqgRPuV +44jA/CTiR2VibEJ22D0= +=mGFM +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tool/ss-feedback/sender-d b/tool/ss-feedback/sender-d new file mode 100755 index 0000000000000000000000000000000000000000..51d7b152038e867f18729cb25c23be2dc5b5ad03 --- /dev/null +++ b/tool/ss-feedback/sender-d @@ -0,0 +1,17 @@ +#!/bin/bash + +HERE=$(dirname $0) + +case `uname -m` in + x86_64) + sender_appendix="amd64" + ;; + aarch64) + sender_appendix="arm64" + ;; + loongarch64) + sender_appendix="loong64" + ;; +esac + +${HERE}/sender-d-${sender_appendix} $@ diff --git a/tool/ss-feedback/sender-d-amd64 b/tool/ss-feedback/sender-d-amd64 new file mode 100755 index 0000000000000000000000000000000000000000..63febd3b06d1f29715073fd7fbc40744135e184d Binary files /dev/null and b/tool/ss-feedback/sender-d-amd64 differ diff --git a/tool/ss-feedback/sender-d-arm64 b/tool/ss-feedback/sender-d-arm64 new file mode 100755 index 0000000000000000000000000000000000000000..b49d84f90d5d12143f8af9ff1eab067d523e5dd3 Binary files /dev/null and b/tool/ss-feedback/sender-d-arm64 differ diff --git a/tool/ss-feedback/sender-d-loong64 b/tool/ss-feedback/sender-d-loong64 new file mode 100755 index 0000000000000000000000000000000000000000..7b218d2acd5d27e5fe5d6773d8c8e258197e25e6 Binary files /dev/null and b/tool/ss-feedback/sender-d-loong64 differ diff --git a/tool/ssaudit b/tool/ssaudit new file mode 100755 index 0000000000000000000000000000000000000000..490987655c44f331d4c297c6611666f4b3024e00 --- /dev/null +++ b/tool/ssaudit @@ -0,0 +1,520 @@ +#!/bin/bash +# 初始化常量和全局变量 +readonly SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/" +readonly SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store" +# ACE环境配置 - 修改此数组即可添加或删除支持的环境——记得修改 store-helper 里的 uninstaller check-is-installed 和 ss-launcher +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) +readonly ACE_ENVIRONMENTS_FOR_AUTOINSTALL=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" +) +function get_current_user() { + # 优先通过 who 命令获取用户 + local user + user=$(who | awk '{print $1}' | head -n 1 2>/dev/null) + + # 如果 who 无输出,则通过 loginctl 获取 + if [[ -z "$user" ]]; then + user=$(loginctl list-sessions --no-legend 2>/dev/null | awk '{print $3}' | head -n 1) + fi + + # 返回最终结果(可能为空) + echo "${user}" +} + +function zenity() { + local user=$(get_current_user) + local uid=$(id -u "$user") + sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus zenity "$@" +} + + +# 全局变量初始化(位于 parse_args 前) +ACE_PARAMS=() + +# 生成ACE环境参数帮助信息 +function generate_ace_help() { + local help_text="" + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + help_text+=" $ace_param 使用${ace_entry%%:*} ACE容器安装\n" + done + echo -e "$help_text" +} +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +# 脚本工作变量 +DELETE_AFTER_INSTALL="0" +DEBPATH="" +FORCE_ACE_ENV="" +FORCE_NATIVE="0" +NO_CREATE_DESKTOP="0" +FORCE_CREATE_DESKTOP="0" + +# 加载翻译和调试 +load_transhell_debug +export DEBIAN_FRONTEND=noninteractive +# 根据架构设置仓库URL +case $(arch) in + x86_64) STORE_URL="store" ;; + aarch64) STORE_URL="aarch64-store" ;; + loongarch64) STORE_URL="loong64-store" ;; +esac +# 帮助函数 +function show_help() { + echo "Spark Store Anstall script. 星火商店审核脚本" + echo "用法: $0 [选项] " + echo "选项:" + echo " -h, --help 显示帮助信息" + echo " --delete-after-install 安装成功后删除软件包" + echo " --no-create-desktop-entry 不创建桌面快捷方式" + echo " --force-create-desktop-entry 强制创建桌面快捷方式" + echo "$(generate_ace_help)" + echo " --native 只在主机安装,不使用ACE容器" +} +# 参数解析 +function parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + show_help + exit 0 + ;; + --delete-after-install) + DELETE_AFTER_INSTALL="1" + shift + ;; + --native) + FORCE_NATIVE="1" + shift + ;; + --no-create-desktop-entry) + NO_CREATE_DESKTOP="1" + shift + ;; + --force-create-desktop-entry) + FORCE_CREATE_DESKTOP="1" + shift + ;; + *) + # 检查是否为ACE环境参数 + local is_ace_param=0 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + if [ "$1" = "$ace_param" ]; then + # 将ACE环境命令名加入数组 + ACE_PARAMS+=("${ace_entry%%:*}") + is_ace_param=1 + shift + break + fi + done + + # 如果不是ACE环境参数,则视为DEB路径 + if [ "$is_ace_param" -eq 0 ]; then + DEBPATH="$1" + shift + fi + ;; + esac + done +} + + +# 验证当前用户 +function validate_user() { + if [ "$(id -u)" != "0" ]; then + echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi +} + +# 验证文件存在或尝试下载 +function validate_or_download_file() { + if [ ! -f "$1" ]; then + echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST},Trying to redownload" + aptss update + FILEPATH=$(dirname "$1") + FILENAME=$(basename "$1") + PACKAGE_NAME=$(echo "$FILENAME" | sed -r 's/^([^_]+)_.*$/\1/') + VERSION=$(echo "$FILENAME" | sed -r 's/^[^_]+_([^_]+)_.*$/\1/') + pushd "${FILEPATH}" >/dev/null || exit 1 + aptss download "${PACKAGE_NAME}" + popd >/dev/null || exit 1 + + if [ ! -f "$1" ]; then + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + fi +} + +# 哈希校验 +function hash_check() { + local PACKAGES_DATA_PATH="" + + # 检查可能的仓库位置 + if [ -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ]; then + PACKAGES_DATA_PATH="/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" + elif [ -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ]; then + PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" + else + PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" + fi + + echo "正在运行包验证..." + echo "Running Spark Package Verify..." + + DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1) + unset IS_SHA512SUM_CHECKED + IS_SHA512SUM_CHECKED=$(grep -F "$DEB_SHA512SUM" "$PACKAGES_DATA_PATH") +} + +# 确保aptss存在 +function ensure_aptss_exist() { + if ! command -v aptss &>/dev/null; then + local deb_file="/tmp/spark-store-console-in-container_latest_all.deb" + + if ! wget -O "$deb_file" "https://amber-ce-resource.spark-app.store/store/depends/spark-store-console-in-container_latest_all.deb"; then + echo "下载 .deb 安装包失败" >&2 + return 1 + fi + + if ! apt install -y "$deb_file"; then + echo "安装 .deb 包失败" >&2 + rm -f "$deb_file" + return 1 + fi + rm -f "$deb_file" + + if ! command -v aptss &>/dev/null; then + echo "成功安装但未找到 aptss 命令" >&2 + return 1 + fi + fi +} +export -f ensure_aptss_exist + +# 确保ACE环境存在 +function ensure_ace_env() { + local ace_env_pkg="${1}" + + if ! dpkg -l "$ace_env_pkg" &>/dev/null; then + echo "ACE环境$ace_env_pkg未安装,正在尝试安装..." + zenity --info --text="首次使用$ace_env_pkg环境,重启或注销桌面后才能在启动器中展示,不影响应用启动。安装将在后台继续。" --title="ACE环境安装" & + if ! aptss install -y "$ace_env_pkg"; then + echo "安装$ace_env_pkg失败" + return 1 + fi + fi + return 0 +} +export user=$(who | awk '{print $1}' | head -n 1) +# 在桌面创建快捷方式 +function create_desktop_file() { + # 如果明确要求不要创建或明确要创建,则跳过配置文件检查 + if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then + echo "根据参数要求,跳过创建桌面快捷方式" + return + fi + + if [ "$FORCE_CREATE_DESKTOP" -eq 0 ]; then + if [ -e "$(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop" ]; then + echo "根据配置要求,跳过创建桌面快捷方式" + return + fi + fi + + exec_create_desktop_file +} +export CURRENT_USER_DIR_DESKTOP=$(sudo -u "$user" xdg-user-dir DESKTOP) +function exec_create_desktop_file() { + local desktop_files=() + + # 收集所有桌面文件 + desktop_files+=($(dpkg -L "$package_name" | grep '/usr/share/applications/.*\.desktop$')) + desktop_files+=($(dpkg -L "$package_name" | grep '/opt/apps/'"$package_name"'/entries/applications/.*\.desktop$')) + + for desktop_file_path in "${desktop_files[@]}"; do + if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || [ -z "$(grep 'NoDisplay=true' "$desktop_file_path")" ]; then + echo "$desktop_file_path is checked and will be installed to desktop" + chmod +x "$desktop_file_path" + sudo -u "$user" cp "$desktop_file_path" "${CURRENT_USER_DIR_DESKTOP}" + fi + done +} +export -f exec_create_desktop_file + +# 在ACE环境中创建桌面快捷方式 +function create_desktop_in_ace() { + local ace_cmd="$1" + local package_name="$2" + + # 如果明确要求不要创建,则直接返回 + if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then + echo "根据参数要求,跳过在ACE中创建桌面快捷方式" + return 0 + fi + + # 如果是强制创建,或者没有配置禁止创建 + if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || ! $ace_cmd "[ -e ~/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ]"; then + echo "在ACE环境中创建桌面快捷方式..." + export -f exec_create_desktop_file + export package_name + export FORCE_CREATE_DESKTOP + $ace_cmd "exec_create_desktop_file" + else + echo "根据ACE环境中的配置,跳过创建桌面快捷方式" + fi +} + +# 在指定ACE环境中安装 +function install_in_ace_env() { + local ace_cmd="$1" + local deb_path="$2" + local ace_env_pkg="${3#*:}" + + if [ "$IS_ACE_ENV" != "" ] || command -v termux-chroot; then + echo "无法在ACE/termux/小小电脑中安装ACE包" + return 1 + fi + if ! ensure_ace_env "$ace_env_pkg"; then + return 1 + fi + + echo "----------------------------------------" + echo "正在尝试使用 $ace_cmd 环境安装..." + echo "----------------------------------------" + $ace_cmd "ensure_aptss_exist" + + # 首先尝试dry-run测试 + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "初始dry-run测试失败,尝试更新后重试..." + $ace_cmd "aptss update" + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "dry-run测试仍然失败,放弃安装" + echo "OMG_IT_GOES_WRONG" + return 1 + fi + fi + + # dry-run成功后执行实际安装 + $ace_cmd "aptss install store.spark-app.app-runtime-base --no-install-recommends -yfq" + if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then + return 0 + else + return 1 + fi +} + +# 在主机安装 +function install_in_host() { + local deb_path="$1" + + # 首先尝试dry-run测试 + if ! aptss install --dry-run "$deb_path"; then + echo "初始dry-run测试失败,尝试更新后重试..." + aptss update + if ! aptss install --dry-run "$deb_path"; then + echo "dry-run测试仍然失败,放弃安装" + return 1 + fi + fi + + # dry-run成功后执行实际安装 + if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then + return 0 + else + return 1 + fi +} + +# 自动尝试在各种环境中安装 +function auto_try_install() { + local deb_path="$1" + + # 首先尝试在主机安装 + if install_in_host "$deb_path"; then + create_desktop_file + return 0 + fi + + # 如果主机安装失败,并非在ACE内运行且不在强制本地模式,尝试ACE环境 + if [ "$FORCE_NATIVE" -eq 0 ] && [ "$IS_ACE_ENV" = "" ] && ! command -v termux-chroot; then + for ace_entry in "${ACE_ENVIRONMENTS_FOR_AUTOINSTALL[@]}"; do + local ace_cmd=${ace_entry%%:*} + local ace_env_pkg=${ace_entry#*:} + + # 确保ACE环境存在 + if ensure_ace_env "$ace_env_pkg"; then + if install_in_ace_env "$ace_cmd" "$deb_path" "$ace_env_pkg"; then + # 在ACE环境中创建桌面快捷方式 + create_desktop_in_ace "$ace_cmd" "$package_name" + return 0 + fi + fi + done + fi + + return 1 +} +# 清理安装后的文件 +function post_install_cleanup() { + local success=$1 + local deb_path="$2" + local package_name="$3" + + if [ "$success" -eq 0 ] && [ "$DELETE_AFTER_INSTALL" -eq "1" ]; then + # 检查是否安装在主机 + if [ "$FORCE_NATIVE" -eq 1 ] || [ -n "$FORCE_ACE_ENV" ]; then + if [ "$FORCE_NATIVE" -eq 1 ]; then + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已在主机安装:$package_name" + create_desktop_file + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + else + echo "软件包未在主机安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + else + # ACE环境中安装的情况,不检查主机dpkg数据库 + echo "软件包已在ACE环境安装:$package_name" + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + fi + else + # 自动模式下,如果ACE安装成功也会走到这里 + echo "软件包已安装:$package_name" + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + fi + else + echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" + if [ "$FORCE_NATIVE" -eq 1 ] && ! dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包未在主机安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + exit 1 + elif [ -n "$FORCE_ACE_ENV" ] && ! command -v "$FORCE_ACE_ENV" >/dev/null 2>&1; then + echo "指定的ACE环境不可用" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + fi +} + +# 文件锁定/解锁函数 +function lock_file() { + chattr +i "$1" +} + +function unlock_file() { + if [ -e "$1" ];then + chattr -i "$1" + fi +} + +# 主安装流程 +function main_install() { + parse_args "$@" + + if [ -z "$DEBPATH" ]; then + echo "没有接收到参数,退出" + show_help + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + + # 设置退出时的文件解锁 + trap 'unlock_file $DEBPATH' EXIT + validate_user + validate_or_download_file "$DEBPATH" + + DEBPATH=$(realpath "$DEBPATH") + lock_file "$DEBPATH" + + + + package_name=$(dpkg-deb -f "$DEBPATH" Package) + local install_success=1 + if [ "$FORCE_NATIVE" -eq 1 ] || [ "$IS_ACE_ENV" = "1" ]; then + # 优先使用主机安装,忽略所有ACE参数 + echo "忽略ACE,使用主机安装 $package_name" + install_in_host "$DEBPATH" + install_success=$? + # 安装成功后在主机创建桌面快捷方式 + if [ "$install_success" -eq 0 ]; then + create_desktop_file + fi + + elif [ ${#ACE_PARAMS[@]} -gt 0 ] && [ "$IS_ACE_ENV" = "" ]; then + # 用户指定了一个或多个ACE环境,且未要求原生安装 + echo "使用ACE环境安装,已指定环境: ${ACE_PARAMS[*]}" + + # 查找第一个已安装的ACE环境 + chosen_env="" + for env_cmd in "${ACE_PARAMS[@]}"; do + if command -v "$env_cmd" >/dev/null 2>&1; then + chosen_env="$env_cmd" + break + fi + done + # 如果没有安装任何环境,则使用第一个指定的环境 + if [ -z "$chosen_env" ]; then + chosen_env="${ACE_PARAMS[0]}" + echo "未发现已安装的ACE环境,准备安装 $chosen_env..." + # 查找对应的ACE环境软件包名 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + if [ "${ace_entry%%:*}" = "$chosen_env" ]; then + ace_pkg="${ace_entry#*:}" + break + fi + done + # 安装ACE环境(示例使用aptss工具,可根据实际情况调整) + ensure_ace_env "$ace_pkg" -y + fi + + # 再次确认ACE环境命令是否可用 + if command -v "$chosen_env" >/dev/null 2>&1; then + # 查找软件包名(仅首次查找即可) + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + if [ "${ace_entry%%:*}" = "$chosen_env" ]; then + ace_pkg="${ace_entry#*:}" + break + fi + done + echo "在 ACE 环境 $chosen_env 中安装 $package_name" + install_in_ace_env "$chosen_env" "$DEBPATH" "$ace_pkg" + install_success=$? + if [ "$install_success" -eq 0 ]; then + create_desktop_in_ace "$chosen_env" "$package_name" + fi + else + echo "指定的ACE环境 $chosen_env 不可用" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + + else + # 未指定ACE环境和--native,使用自动安装逻辑(先主机再ACE) + echo "自动选择安装方式" + auto_try_install "$DEBPATH" + install_success=$? + fi + + post_install_cleanup "$install_success" "$DEBPATH" "$package_name" +} + +# 执行主函数 +main_install "$@" diff --git a/tool/ssinstall b/tool/ssinstall new file mode 100755 index 0000000000000000000000000000000000000000..e84a186f8a331e175f017c4ff471f9c6447b6fd1 --- /dev/null +++ b/tool/ssinstall @@ -0,0 +1,532 @@ +#!/bin/bash +# 初始化常量和全局变量 +readonly SPARK_DOWNLOAD_SERVER_URL="https://d.spark-app.store/" +readonly SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL="d.spark-app.store" +# ACE环境配置 - 修改此数组即可添加或删除支持的环境——记得修改 store-helper 里的 uninstaller check-is-installed 和 ss-launcher +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) +readonly ACE_ENVIRONMENTS_FOR_AUTOINSTALL=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" +) +function get_current_user() { + # 优先通过 who 命令获取用户 + local user + user=$(who | awk '{print $1}' | head -n 1 2>/dev/null) + + # 如果 who 无输出,则通过 loginctl 获取 + if [[ -z "$user" ]]; then + user=$(loginctl list-sessions --no-legend 2>/dev/null | awk '{print $3}' | head -n 1) + fi + + # 返回最终结果(可能为空) + echo "${user}" +} + +function zenity() { + local user=$(get_current_user) + local uid=$(id -u "$user") + sudo -u "$user" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$uid"/bus zenity "$@" +} + + +# 全局变量初始化(位于 parse_args 前) +ACE_PARAMS=() + +# 生成ACE环境参数帮助信息 +function generate_ace_help() { + local help_text="" + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + help_text+=" $ace_param 使用${ace_entry%%:*} ACE容器安装\n" + done + echo -e "$help_text" +} +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +# 脚本工作变量 +DELETE_AFTER_INSTALL="0" +DEBPATH="" +FORCE_ACE_ENV="" +FORCE_NATIVE="0" +NO_CREATE_DESKTOP="0" +FORCE_CREATE_DESKTOP="0" + +# 加载翻译和调试 +load_transhell_debug +export DEBIAN_FRONTEND=noninteractive +# 根据架构设置仓库URL +case $(arch) in + x86_64) STORE_URL="store" ;; + aarch64) STORE_URL="aarch64-store" ;; + loongarch64) STORE_URL="loong64-store" ;; +esac +# 帮助函数 +function show_help() { + echo "Spark Store Install script. 星火商店安装脚本" + echo "用法: $0 [选项] " + echo "选项:" + echo " -h, --help 显示帮助信息" + echo " --delete-after-install 安装成功后删除软件包" + echo " --no-create-desktop-entry 不创建桌面快捷方式" + echo " --force-create-desktop-entry 强制创建桌面快捷方式" + echo "$(generate_ace_help)" + echo " --native 只在主机安装,不使用ACE容器" +} +# 参数解析 +function parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + show_help + exit 0 + ;; + --delete-after-install) + DELETE_AFTER_INSTALL="1" + shift + ;; + --native) + FORCE_NATIVE="1" + shift + ;; + --no-create-desktop-entry) + NO_CREATE_DESKTOP="1" + shift + ;; + --force-create-desktop-entry) + FORCE_CREATE_DESKTOP="1" + shift + ;; + *) + # 检查是否为ACE环境参数 + local is_ace_param=0 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + if [ "$1" = "$ace_param" ]; then + # 将ACE环境命令名加入数组 + ACE_PARAMS+=("${ace_entry%%:*}") + is_ace_param=1 + shift + break + fi + done + + # 如果不是ACE环境参数,则视为DEB路径 + if [ "$is_ace_param" -eq 0 ]; then + DEBPATH="$1" + shift + fi + ;; + esac + done +} + + +# 验证当前用户 +function validate_user() { + if [ "$(id -u)" != "0" ]; then + echo "${TRANSHELL_CONTENT_PLEASE_RUN_AS_ROOT}" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi +} + +# 验证文件存在或尝试下载 +function validate_or_download_file() { + if [ ! -f "$1" ]; then + echo "${TRANSHELL_CONTENT_FILE_NOT_EXIST},Trying to redownload" + aptss update + FILEPATH=$(dirname "$1") + FILENAME=$(basename "$1") + PACKAGE_NAME=$(echo "$FILENAME" | sed -r 's/^([^_]+)_.*$/\1/') + VERSION=$(echo "$FILENAME" | sed -r 's/^[^_]+_([^_]+)_.*$/\1/') + pushd "${FILEPATH}" >/dev/null || exit 1 + aptss download "${PACKAGE_NAME}" + popd >/dev/null || exit 1 + + if [ ! -f "$1" ]; then + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + fi +} + +# 哈希校验 +function hash_check() { + local PACKAGES_DATA_PATH="" + + # 检查可能的仓库位置 + if [ -e "/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" ]; then + PACKAGES_DATA_PATH="/var/lib/aptss/lists/${SPARK_DOWNLOAD_SERVER_URL_NO_PROTOCOL}_${STORE_URL}_Packages" + elif [ -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ]; then + PACKAGES_DATA_PATH="/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" + else + PACKAGES_DATA_PATH="/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" + fi + + echo "正在运行包验证..." + echo "Running Spark Package Verify..." + + DEB_SHA512SUM=$(sha512sum "$1" | cut -d ' ' -f 1) + unset IS_SHA512SUM_CHECKED + IS_SHA512SUM_CHECKED=$(grep -F "$DEB_SHA512SUM" "$PACKAGES_DATA_PATH") +} + +# 确保aptss存在 +function ensure_aptss_exist() { + if ! command -v aptss &>/dev/null; then + local deb_file="/tmp/spark-store-console-in-container_latest_all.deb" + + if ! wget -O "$deb_file" "https://amber-ce-resource.spark-app.store/store/depends/spark-store-console-in-container_latest_all.deb"; then + echo "下载 .deb 安装包失败" >&2 + return 1 + fi + + if ! apt install -y "$deb_file"; then + echo "安装 .deb 包失败" >&2 + rm -f "$deb_file" + return 1 + fi + rm -f "$deb_file" + + if ! command -v aptss &>/dev/null; then + echo "成功安装但未找到 aptss 命令" >&2 + return 1 + fi + fi +} +export -f ensure_aptss_exist + +# 确保ACE环境存在 +function ensure_ace_env() { + local ace_env_pkg="${1}" + + if ! dpkg -l "$ace_env_pkg" &>/dev/null; then + echo "ACE环境$ace_env_pkg未安装,正在尝试安装..." + zenity --info --text="首次使用$ace_env_pkg环境,重启或注销桌面后才能在启动器中展示,不影响应用启动。安装将在后台继续。" --title="ACE环境安装" & + if ! aptss install -y "$ace_env_pkg"; then + echo "安装$ace_env_pkg失败" + return 1 + fi + fi + return 0 +} +export user=$(who | awk '{print $1}' | head -n 1) +# 在桌面创建快捷方式 +function create_desktop_file() { + # 如果明确要求不要创建或明确要创建,则跳过配置文件检查 + if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then + echo "根据参数要求,跳过创建桌面快捷方式" + return + fi + + if [ "$FORCE_CREATE_DESKTOP" -eq 0 ]; then + if [ -e "$(sudo -u "$user" xdg-user-dir)/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop" ]; then + echo "根据配置要求,跳过创建桌面快捷方式" + return + fi + fi + + exec_create_desktop_file +} +export CURRENT_USER_DIR_DESKTOP=$(sudo -u "$user" xdg-user-dir DESKTOP) +function exec_create_desktop_file() { + local desktop_files=() + + # 收集所有桌面文件 + desktop_files+=($(dpkg -L "$package_name" | grep '/usr/share/applications/.*\.desktop$')) + desktop_files+=($(dpkg -L "$package_name" | grep '/opt/apps/'"$package_name"'/entries/applications/.*\.desktop$')) + + for desktop_file_path in "${desktop_files[@]}"; do + if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || [ -z "$(grep 'NoDisplay=true' "$desktop_file_path")" ]; then + echo "$desktop_file_path is checked and will be installed to desktop" + chmod +x "$desktop_file_path" + sudo -u "$user" cp "$desktop_file_path" "${CURRENT_USER_DIR_DESKTOP}" + fi + done +} +export -f exec_create_desktop_file + +# 在ACE环境中创建桌面快捷方式 +function create_desktop_in_ace() { + local ace_cmd="$1" + local package_name="$2" + + # 如果明确要求不要创建,则直接返回 + if [ "$NO_CREATE_DESKTOP" -eq 1 ]; then + echo "根据参数要求,跳过在ACE中创建桌面快捷方式" + return 0 + fi + + # 如果是强制创建,或者没有配置禁止创建 + if [ "$FORCE_CREATE_DESKTOP" -eq 1 ] || ! $ace_cmd "[ -e ~/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ]"; then + echo "在ACE环境中创建桌面快捷方式..." + export -f exec_create_desktop_file + export package_name + export FORCE_CREATE_DESKTOP + $ace_cmd "exec_create_desktop_file" + else + echo "根据ACE环境中的配置,跳过创建桌面快捷方式" + fi +} + +# 在指定ACE环境中安装 +function install_in_ace_env() { + local ace_cmd="$1" + local deb_path="$2" + local ace_env_pkg="${3#*:}" + + if [ "$IS_ACE_ENV" != "" ] || command -v termux-chroot; then + echo "无法在ACE/termux/小小电脑中安装ACE包" + return 1 + fi + if ! ensure_ace_env "$ace_env_pkg"; then + return 1 + fi + + echo "----------------------------------------" + echo "正在尝试使用 $ace_cmd 环境安装..." + echo "----------------------------------------" + $ace_cmd "ensure_aptss_exist" + + # 首先尝试dry-run测试 + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "初始dry-run测试失败,尝试更新后重试..." + $ace_cmd "aptss update" + if ! $ace_cmd "aptss install --dry-run '$deb_path'"; then + echo "dry-run测试仍然失败,放弃安装" + echo "OMG_IT_GOES_WRONG" + return 1 + fi + fi + + # dry-run成功后执行实际安装 + $ace_cmd "aptss install store.spark-app.app-runtime-base --no-install-recommends -yfq" + if $ace_cmd "dpkg -i '$deb_path' || aptss install '$deb_path' -yfq"; then + return 0 + else + return 1 + fi +} + +# 在主机安装 +function install_in_host() { + local deb_path="$1" + + # 首先尝试dry-run测试 + if ! aptss install --dry-run "$deb_path"; then + echo "初始dry-run测试失败,尝试更新后重试..." + aptss update + if ! aptss install --dry-run "$deb_path"; then + echo "dry-run测试仍然失败,放弃安装" + return 1 + fi + fi + + # dry-run成功后执行实际安装 + if dpkg -i "$deb_path" || aptss install "$deb_path" -yfq; then + return 0 + else + return 1 + fi +} + +# 自动尝试在各种环境中安装 +function auto_try_install() { + local deb_path="$1" + + # 首先尝试在主机安装 + if install_in_host "$deb_path"; then + create_desktop_file + return 0 + fi + + # 如果主机安装失败,并非在ACE内运行且不在强制本地模式,尝试ACE环境 + if [ "$FORCE_NATIVE" -eq 0 ] && [ "$IS_ACE_ENV" = "" ] && ! command -v termux-chroot; then + for ace_entry in "${ACE_ENVIRONMENTS_FOR_AUTOINSTALL[@]}"; do + local ace_cmd=${ace_entry%%:*} + local ace_env_pkg=${ace_entry#*:} + + # 确保ACE环境存在 + if ensure_ace_env "$ace_env_pkg"; then + if install_in_ace_env "$ace_cmd" "$deb_path" "$ace_env_pkg"; then + # 在ACE环境中创建桌面快捷方式 + create_desktop_in_ace "$ace_cmd" "$package_name" + return 0 + fi + fi + done + fi + + return 1 +} +# 清理安装后的文件 +function post_install_cleanup() { + local success=$1 + local deb_path="$2" + local package_name="$3" + + if [ "$success" -eq 0 ] && [ "$DELETE_AFTER_INSTALL" -eq "1" ]; then + # 检查是否安装在主机 + if [ "$FORCE_NATIVE" -eq 1 ] || [ -n "$FORCE_ACE_ENV" ]; then + if [ "$FORCE_NATIVE" -eq 1 ]; then + if dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包已在主机安装:$package_name" + create_desktop_file + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + else + echo "软件包未在主机安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + else + # ACE环境中安装的情况,不检查主机dpkg数据库 + echo "软件包已在ACE环境安装:$package_name" + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + fi + else + # 自动模式下,如果ACE安装成功也会走到这里 + echo "软件包已安装:$package_name" + unlock_file "$deb_path" + rm "$deb_path" + echo "${TRANSHELL_CONTENT_DEB_IS_DELETED}" + fi + else + echo "${TRANSHELL_CONTENT_WILL_NOT_DELETE_DEB}" + if [ "$FORCE_NATIVE" -eq 1 ] && ! dpkg -s "$package_name" >/dev/null 2>&1; then + echo "软件包未在主机安装:$package_name" + echo "安装异常!抛出错误" + echo "OMG-IT-GOES-WRONG" + exit 1 + elif [ -n "$FORCE_ACE_ENV" ] && ! command -v "$FORCE_ACE_ENV" >/dev/null 2>&1; then + echo "指定的ACE环境不可用" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + fi +} + +# 文件锁定/解锁函数 +function lock_file() { + chattr +i "$1" +} + +function unlock_file() { + if [ -e "$1" ];then + chattr -i "$1" + fi +} + +# 主安装流程 +function main_install() { + parse_args "$@" + + if [ -z "$DEBPATH" ]; then + echo "没有接收到参数,退出" + show_help + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + + # 设置退出时的文件解锁 + trap 'unlock_file $DEBPATH' EXIT + validate_user + validate_or_download_file "$DEBPATH" + + DEBPATH=$(realpath "$DEBPATH") + lock_file "$DEBPATH" + + hash_check "$DEBPATH" + + if [ -z "$IS_SHA512SUM_CHECKED" ]; then + echo "尝试更新仓库信息重新校验" + aptss ssupdate + hash_check "$DEBPATH" + if [ -z "$IS_SHA512SUM_CHECKED" ]; then + echo -e "$TRANSHELL_CONTENT_HASH_CHECK_FAILED" + zenity --info --icon-name=spark-store --height 270 --width 500 --text "$TRANSHELL_CONTENT_HASH_CHECK_FAILED" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + fi + + package_name=$(dpkg-deb -f "$DEBPATH" Package) + local install_success=1 + if [ "$FORCE_NATIVE" -eq 1 ] || [ "$IS_ACE_ENV" = "1" ]; then + # 优先使用主机安装,忽略所有ACE参数 + echo "忽略ACE,使用主机安装 $package_name" + install_in_host "$DEBPATH" + install_success=$? + # 安装成功后在主机创建桌面快捷方式 + if [ "$install_success" -eq 0 ]; then + create_desktop_file + fi + + elif [ ${#ACE_PARAMS[@]} -gt 0 ] && [ "$IS_ACE_ENV" = "" ]; then + # 用户指定了一个或多个ACE环境,且未要求原生安装 + echo "使用ACE环境安装,已指定环境: ${ACE_PARAMS[*]}" + + # 查找第一个已安装的ACE环境 + chosen_env="" + for env_cmd in "${ACE_PARAMS[@]}"; do + if command -v "$env_cmd" >/dev/null 2>&1; then + chosen_env="$env_cmd" + break + fi + done + # 如果没有安装任何环境,则使用第一个指定的环境 + if [ -z "$chosen_env" ]; then + chosen_env="${ACE_PARAMS[0]}" + echo "未发现已安装的ACE环境,准备安装 $chosen_env..." + # 查找对应的ACE环境软件包名 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + if [ "${ace_entry%%:*}" = "$chosen_env" ]; then + ace_pkg="${ace_entry#*:}" + break + fi + done + # 安装ACE环境(示例使用aptss工具,可根据实际情况调整) + ensure_ace_env "$ace_pkg" -y + fi + + # 再次确认ACE环境命令是否可用 + if command -v "$chosen_env" >/dev/null 2>&1; then + # 查找软件包名(仅首次查找即可) + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + if [ "${ace_entry%%:*}" = "$chosen_env" ]; then + ace_pkg="${ace_entry#*:}" + break + fi + done + echo "在 ACE 环境 $chosen_env 中安装 $package_name" + install_in_ace_env "$chosen_env" "$DEBPATH" "$ace_pkg" + install_success=$? + if [ "$install_success" -eq 0 ]; then + create_desktop_in_ace "$chosen_env" "$package_name" + fi + else + echo "指定的ACE环境 $chosen_env 不可用" + echo "OMG-IT-GOES-WRONG" + exit 1 + fi + + else + # 未指定ACE环境和--native,使用自动安装逻辑(先主机再ACE) + echo "自动选择安装方式" + auto_try_install "$DEBPATH" + install_success=$? + fi + + post_install_cleanup "$install_success" "$DEBPATH" "$package_name" +} + +# 执行主函数 +main_install "$@" diff --git a/tool/store-helper/check-is-installed b/tool/store-helper/check-is-installed new file mode 100755 index 0000000000000000000000000000000000000000..3251815417d959b1e52bf92186769c6e7e2f8631 --- /dev/null +++ b/tool/store-helper/check-is-installed @@ -0,0 +1,45 @@ +#!/bin/bash +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) +dpkg -s "$1" > /dev/null +RET="$?" +if [[ "$RET" != "0" ]] &&[[ "$IS_ACE_ENV" == "" ]];then ## 如果未在ACE环境中 + + + +for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + ace_cmd=${ace_entry%%:*} + if command -v "$ace_cmd" >/dev/null 2>&1; then + echo "----------------------------------------" + echo "正在检查 $ace_cmd 环境的安装..." + echo "----------------------------------------" + + # 在ACE环境中执行安装检测 + $ace_cmd dpkg -l | grep "^ii $1 " > /dev/null + try_run_ret="$?" + + + # 最终检测结果处理 + if [ "$try_run_ret" -eq 0 ]; then + echo "----------------------------------------" + echo "在 $ace_cmd 环境中找到了安装" + echo "----------------------------------------" + exit $try_run_ret + else + echo "----------------------------------------" + echo "在 $ace_cmd 环境中未能找到安装,继续查找" + echo "----------------------------------------" + fi + fi + done + echo "----------------------------------------" + echo "所有已安装的 ACE 环境中未能找到安装,退出" + echo "----------------------------------------" + exit "$RET" + fi +## 如果在ACE环境中或者未出错 +exit "$RET" diff --git a/tool/store-helper/pass-auth.sh b/tool/store-helper/pass-auth.sh new file mode 100755 index 0000000000000000000000000000000000000000..dd668b159e35af6bafba0ed51f768a486e63f863 --- /dev/null +++ b/tool/store-helper/pass-auth.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# We use sudo twice to avoid ACE bug here +# https://gitee.com/amber-ce/amber-ce-bookworm/commit/43e1a1599ede474b37e41aa10c53fd8afc4d35a1 + +#!/bin/bash +# We use sudo twice to avoid ACE bug here +# https://gitee.com/amber-ce/amber-ce-bookworm/commit/43e1a1599ede474b37e41aa10c53fd8afc4d35a1 + +function zenity_prompt() { + if [[ -e /usr/bin/garma ]]; then + garma "$@" + else + $(command -v zenity) "$@" + fi +} + +# 检查sudo是否需要密码 +if sudo -n true 2>/dev/null; then + echo "sudo 无需密码,继续执行" +else + # 循环输入密码直到成功或用户取消 + while true; do + # 使用zenity弹出密码输入框 + PASSWORD=$(zenity_prompt --password --title="需要sudo权限") + + # 检查用户是否取消输入 + if [ -z "$PASSWORD" ]; then + zenity_prompt --error --text="操作已取消" + exit 1 + fi + + # 尝试使用输入的密码执行sudo命令 + echo "$PASSWORD" | sudo -S -v 2>/dev/null + + # 检查sudo是否成功 + if [ $? -eq 0 ]; then + echo "密码正确,继续执行" + break + else + zenity_prompt --error --text="密码错误,请重新输入" + fi + done +fi + +# 使用sudo命令执行目标程序 +echo "$PASSWORD" | sudo sudo -S "$@" diff --git a/tool/store-helper/ss-launcher b/tool/store-helper/ss-launcher new file mode 100755 index 0000000000000000000000000000000000000000..0460eaef5d1d739c45adcbe2a4821da75ac0e4f8 --- /dev/null +++ b/tool/store-helper/ss-launcher @@ -0,0 +1,164 @@ +#!/bin/bash + +# ===== ACE环境配置 ===== +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) + +# ===== 日志和函数 ===== +[ -f /opt/durapps/spark-store/bin/bashimport/log.amber ] && \ + source /opt/durapps/spark-store/bin/bashimport/log.amber || { + log.info() { echo "INFO: $*"; } + log.warn() { echo "WARN: $*"; } + log.error() { echo "ERROR: $*"; } + log.debug() { echo "DEBUG: $*"; } +} + +# ===== 功能函数 ===== +function scan_desktop_file_log() { + unset desktop_file_path + local package_name=$1 + # 标准desktop文件检测 + while IFS= read -r path; do + [ -z "$(grep 'NoDisplay=true' "$path")" ] && { + log.info "Found valid desktop file: $path" + export desktop_file_path="$path" + return 0 + } + done < <(dpkg -L "$package_name" 2>/dev/null | grep -E '/usr/share/applications/.*\.desktop$|/opt/apps/.*/entries/applications/.*\.desktop$') + + # 深度环境特殊处理 + while IFS= read -r path; do + [ -z "$(grep 'NoDisplay=true' "$path")" ] && { + log.info "Found deepin desktop file: $path" + export desktop_file_path="$path" + return 0 + } + done < <(find /opt/apps/$package_name -path '*/entries/applications/*.desktop' 2>/dev/null) + return 1 +} + +function scan_desktop_file() { + local package_name=$1 result="" + # 标准结果收集 + while IFS= read -r path; do + [ -z "$(grep 'NoDisplay=true' "$path")" ] && result+="$path," + done < <(dpkg -L "$package_name" 2>/dev/null | grep -E '/usr/share/applications/.*\.desktop$|/opt/apps/.*/entries/applications/.*\.desktop$') + + # 深度环境补充扫描 + while IFS= read -r path; do + [ -z "$(grep 'NoDisplay=true' "$path")" ] && result+="$path," + done < <(find /opt/apps/$package_name -path '*/entries/applications/*.desktop' 2>/dev/null) + + echo "${result%,}" +} + +function launch_app() { + local DESKTOP_FILE_PATH="${1#file://}" + # 提取并净化Exec命令 + exec_command=$(grep -m1 '^Exec=' "$DESKTOP_FILE_PATH" | cut -d= -f2- | sed 's/%.//g') + [ -z "$exec_command" ] && return 1 + [ ! -z "$IS_ACE_ENV" ] && HOST_PREFIX="host-spawn" + exec_command="${HOST_PREFIX} $exec_command" + log.info "Launching: $exec_command" + ${SHELL:-bash} -c " $exec_command" & + +} + +# 导出函数以便在ACE环境中使用 +export -f launch_app scan_desktop_file scan_desktop_file_log log.info log.warn log.debug log.error + +# ===== ACE环境执行器 ===== +function ace_runner() { + local action=$1 + local target=$2 + + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_cmd=${ace_entry%%:*} + local ace_env=${ace_entry#*:} + + if ! command -v "$ace_cmd" >/dev/null; then + log.debug "$ace_cmd not found, skipping..." + continue + fi + + log.info "Attempting in $ace_env environment..." + + case "$action" in + check) + if "$ace_cmd" scan_desktop_file_log "$target"; then + log.info "Found desktop file in $ace_env" + return 0 + fi + ;; + list) + local result + if result=$("$ace_cmd" scan_desktop_file "$target"); then + echo "$result" + return 0 + fi + ;; + launch|start) +"$ace_cmd" scan_desktop_file_log "$target" + if desktop_path=$("$ace_cmd" scan_desktop_file_log "$target"); then + log.info "Launching from $ace_env..." + "$ace_cmd" launch_app $("$ace_cmd" scan_desktop_file "$target") + return 0 + fi + ;; + esac + + log.debug "Attempt in $ace_env failed" + done + + return 1 +} + +# ===== 主逻辑 ===== +[ $# -lt 2 ] && { + log.error "Usage: $0 {check|launch|list|start} package_name/desktop_file" + exit 1 +} + +case $1 in +check) + # 当前环境检查 + if scan_desktop_file_log "$2"; then + exit 0 + else + # 非ACE环境下执行ACE环境扫描 + [ -z "$IS_ACE_ENV" ] && ace_runner check "$2" + exit $? + fi + ;; + +list) + # 当前环境列表 + if result=$(scan_desktop_file "$2"); then + echo "$result" + exit 0 + else + # 非ACE环境下执行ACE环境扫描 + [ -z "$IS_ACE_ENV" ] && ace_runner list "$2" + exit $? + fi + ;; + +launch|start) + # 当前环境启动 + if scan_desktop_file_log "$2" && launch_app "$desktop_file_path"; then + exit 0 + else + # 非ACE环境下通过ACE环境启动 + [ -z "$IS_ACE_ENV" ] && ace_runner launch "$2" + exit $? + fi + ;; +*) + log.error "Invalid command: $1" + exit 2 + ;; +esac diff --git a/tool/store-helper/uninstaller b/tool/store-helper/uninstaller new file mode 100755 index 0000000000000000000000000000000000000000..ea10febac07a056636e9090aee2b0b17370dfeb7 --- /dev/null +++ b/tool/store-helper/uninstaller @@ -0,0 +1,190 @@ +#!/bin/bash +# ===== ACE环境配置 ===== + +readonly ACE_ENVIRONMENTS=( + "bookworm-run:amber-ce-bookworm" + "trixie-run:amber-ce-trixie" + "deepin23-run:amber-ce-deepin23" + "sid-run:amber-ce-sid" +) +# 生成ACE环境参数帮助信息 +function generate_ace_help() { + local help_text="" + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + help_text+=" $ace_param 使用${ace_entry%%:*} ACE容器卸载\n" + done + echo -e "$help_text" +} +# 帮助函数 +function show_help() { + echo "Spark Store Uninstall script. 星火商店卸载脚本" + echo "用法: $0 [选项] 包名" + echo "选项:" + echo " -h, --help 显示帮助信息" + echo " --delete-after-install 安装成功后删除软件包" + echo " --no-create-desktop-entry 不创建桌面快捷方式" + echo " --force-create-desktop-entry 强制创建桌面快捷方式" + echo "$(generate_ace_help)" + echo " --native 只在主机卸载,不使用ACE容器" +} + + +# 参数解析 +function parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + show_help + exit 0 + ;; + --delete-after-install) + DELETE_AFTER_INSTALL="1" + shift + ;; + --native) + FORCE_NATIVE="1" + shift + ;; + --no-create-desktop-entry) + NO_CREATE_DESKTOP="1" + shift + ;; + --force-create-desktop-entry) + FORCE_CREATE_DESKTOP="1" + shift + ;; + *) + # 检查是否为ACE环境参数 + local is_ace_param=0 + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + local ace_param="--${ace_entry#*:}" + if [ "$1" = "$ace_param" ]; then + # 将ACE环境命令名加入数组 + ACE_PARAMS+=("${ace_entry%%:*}") + is_ace_param=1 + shift + break + fi + done + + # 如果不是ACE环境参数,则视为包名 + if [ "$is_ace_param" -eq 0 ]; then + PACKAGE_NAME="$1" + shift + fi + ;; + esac + done +} + +# ===== 日志和函数 ===== +[ -f /opt/durapps/spark-store/bin/bashimport/log.amber ] && \ + source /opt/durapps/spark-store/bin/bashimport/log.amber || { + log.info() { echo "INFO: $*"; } + log.warn() { echo "WARN: $*"; } + log.error() { echo "ERROR: $*"; } + log.debug() { echo "DEBUG: $*"; } +} + +# 初始化变量 +FORCE_NATIVE=0 +ACE_PARAMS=() +PACKAGE_NAME="" +uninstall_success=0 + +# 解析参数 +parse_args "$@" + +if [ -z "$PACKAGE_NAME" ]; then + log.error "请指定要卸载的包名" + exit 1 +fi + +# 尝试在本地卸载 +try_native_uninstall() { + if [ "$FORCE_NATIVE" -eq 1 ] || [ ${#ACE_PARAMS[@]} -eq 0 ]; then + echo "----------------------------------------" + echo "正在检查本地环境中的安装..." + echo "----------------------------------------" + + dpkg -s "$PACKAGE_NAME" > /dev/null + RET="$?" + if [[ "$RET" == "0" ]]; then + echo "----------------------------------------" + echo "在本地环境中找到了安装" + echo "----------------------------------------" + apt autopurge "$PACKAGE_NAME" -y + uninstall_success=1 + return 0 + else + echo "----------------------------------------" + echo "在本地环境中未能找到安装" + echo "----------------------------------------" + fi + fi + return 1 +} + +# 尝试在ACE环境中卸载 +try_ace_uninstall() { + local ace_cmd="$1" + if command -v "$ace_cmd" >/dev/null 2>&1; then + echo "----------------------------------------" + echo "正在检查 $ace_cmd 环境的安装..." + echo "----------------------------------------" + + $ace_cmd dpkg -l | grep "^ii $PACKAGE_NAME " > /dev/null + try_run_ret="$?" + + if [ "$try_run_ret" -eq 0 ]; then + echo "----------------------------------------" + echo "在 $ace_cmd 环境中找到了安装" + echo "----------------------------------------" + $ace_cmd apt autopurge "$PACKAGE_NAME" -y + uninstall_success=1 + return 0 + else + echo "----------------------------------------" + echo "在 $ace_cmd 环境中未能找到安装" + echo "----------------------------------------" + fi + fi + return 1 +} + +# 主卸载逻辑 +if [ $FORCE_NATIVE -eq 1 ] && [ ${#ACE_PARAMS[@]} -eq 0 ]; then + # 只有 --native 参数时,只尝试本地卸载 + try_native_uninstall || exit $? +elif [ $FORCE_NATIVE -eq 0 ] && [ ${#ACE_PARAMS[@]} -gt 0 ]; then + # 只有 ACE 参数时,只尝试指定的 ACE 环境卸载 + for ace_param in "${ACE_PARAMS[@]}"; do + try_ace_uninstall "$ace_param" + done +elif [ $FORCE_NATIVE -eq 1 ] && [ ${#ACE_PARAMS[@]} -gt 0 ]; then + # 同时有 --native 和 ACE 参数时,先尝试本地卸载,再尝试 ACE 环境卸载 + try_native_uninstall + for ace_param in "${ACE_PARAMS[@]}"; do + try_ace_uninstall "$ace_param" + done +else + # 无参数时,先尝试本地卸载,再尝试所有 ACE 环境卸载 + try_native_uninstall + + for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do + ace_cmd=${ace_entry%%:*} + if command -v "$ace_cmd" >/dev/null 2>&1; then + try_ace_uninstall "$ace_cmd" + fi + done +fi + +if [ $uninstall_success -eq 0 ]; then + echo "----------------------------------------" + echo "在所有指定的环境中未能找到安装,退出" + echo "----------------------------------------" + exit 1 +fi + +exit 0 diff --git a/tool/update-upgrade/ss-do-upgrade-worker.sh b/tool/update-upgrade/ss-do-upgrade-worker.sh new file mode 100755 index 0000000000000000000000000000000000000000..4f2a8e60ad5cb5a27ad138ad421a17eda7a842f4 --- /dev/null +++ b/tool/update-upgrade/ss-do-upgrade-worker.sh @@ -0,0 +1,84 @@ +#!/bin/bash +export LANGUAGE=en_US +export DEBIAN_FRONTEND=noninteractive +case $1 in + ssupdate) +if [ "$(id -u)" != "0" ] ; then + pkexec "$0" "$@" + exit +fi + aptss ssupdate 2>&1 | tee /tmp/spark-store-app-ssupdate-log.txt + IS_SSUPDATE_ERROR=`cat /tmp/spark-store-app-ssupdate-log.txt | grep "E: "` + echo "$IS_SSUPDATE_ERROR" > /tmp/spark-store-app-ssupdate-status.txt + chmod 777 /tmp/spark-store-app-ssupdate-status.txt + chmod 777 /tmp/spark-store-app-ssupdate-log.txt + ;; + + upgradable-list) + output=$(env LANGUAGE=en_US /usr/bin/apt -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf list --upgradable -o Dir::Etc::sourcelist="/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="/dev/null" -o APT::Get::List-Cleanup="0" | awk NR\>1) + + IFS_OLD="$IFS" + IFS=$'\n' + + for line in $output ; do + PKG_NAME=$(echo $line | awk -F '/' '{print $1}') + PKG_NEW_VER=$(echo $line | awk -F ' ' '{print $2}') + PKG_CUR_VER=$(echo $line | awk -F ' ' '{print $6}' | awk -F ']' '{print $1}') + echo "${PKG_NAME} ${PKG_NEW_VER} ${PKG_CUR_VER}" + done + + IFS="$IFS_OLD" + ;; + + upgrade-app) +if [ "$(id -u)" != "0" ] ; then + pkexec "$0" "$@" + exit +fi + + aptss install "${@:2}" --only-upgrade 2>&1 | tee /tmp/spark-store-app-upgrade-log.txt + sed -i '1i--------------------------------------------------------------' /tmp/spark-store-app-upgrade-log.txt + sed -i '1i更新失败可能是由于系统版本过低,您可先【卸载】此应用后再在商店【安装】此应用来尝试修复此问题,商店会在安装时尝试自动解决问题。若仍无法解决,请按照指引进行反馈' /tmp/spark-store-app-upgrade-log.txt + chmod 777 /tmp/spark-store-app-upgrade-log.txt + IS_UPGRADE_ERROR=`cat /tmp/spark-store-app-upgrade-log.txt | grep "Package manager quit with exit code."` + echo "$IS_UPGRADE_ERROR" > /tmp/spark-store-app-upgrade-status.txt + ;; + test-install-app) +if [ "$(id -u)" != "0" ] ; then + pkexec "$0" "$@" + exit +fi + +try_run_output=$(aptss --dry-run install $2) +try_run_ret="$?" + +if [ "$try_run_ret" -ne 0 ] + then + echo "Package manager quit with exit code.Here is the log" + echo "包管理器以错误代码退出.日志如下" + echo + echo -e "${try_run_output}" + echo "Will try after run aptss update" + echo "将会在aptss update之后再次尝试" + aptss update + echo ---------------------------------------------------------------------------- + try_run_output=$(aptss --dry-run install $2) + try_run_ret="$?" + if [ "$try_run_ret" -ne 0 ] + then + echo "Package manager quit with exit code.Here is the log" + echo "包管理器以错误代码退出.日志如下" + echo + echo -e "${try_run_output}" + exit "$try_run_ret" + fi + +fi + exit 0 + ;; + + clean-log) + + rm -f /tmp/spark-store-app-ssupdate-status.txt /tmp/spark-store-app-ssupdate-log.txt /tmp/spark-store-app-upgrade-log.txt /tmp/spark-store-app-upgrade-status.txt + ;; +esac diff --git a/tool/update-upgrade/ss-do-upgrade.sh b/tool/update-upgrade/ss-do-upgrade.sh new file mode 100755 index 0000000000000000000000000000000000000000..dee6321ea413c11687b6798f2306a5bbf755ffc7 --- /dev/null +++ b/tool/update-upgrade/ss-do-upgrade.sh @@ -0,0 +1,172 @@ +#!/bin/bash + +if [ "$(id -u)" != "0" ] ; then + if [ "$IS_ACE_ENV" = "1" ] ; then + /opt/durapps/spark-store/bin/store-helper/pass-auth.sh "$0" "$@" + else + xhost + + pkexec "$0" "$@" + exit + fi +fi +HERE=$(dirname $0) +trap "rm -f /tmp/spark-store/upgradeStatus.txt" EXIT +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +load_transhell_debug + +function get_name_from_desktop_file() { + local app_name_in_desktop + local name_orig + local name_i18n + local package_name + package_name=$1 + for desktop_file_path in $(dpkg -L "$package_name" |grep /usr/share/applications/ | awk '/\.desktop$/ {print}') ; do + if [ "$(grep -m 1 '^NoDisplay=' "$desktop_file_path" | cut -d '=' -f 2)" = "true" ] || [ "$(grep -m 1 '^NoDisplay=' "$desktop_file_path" | cut -d '=' -f 2)" = "True" ] ; then + continue + else + name_orig=$(awk -F= '/^\[Desktop Entry\]$/ {found=1} found && /^Name=/ {print $2; exit} /^\[.*\]$/ && !/\[Desktop Entry\]/ {exit}' "$desktop_file_path") + name_i18n=$(awk -v lang="Name[$LANGUAGE]" -F= '/^\[Desktop Entry\]$/ {found=1} found && /^Name\[/ && $1 == lang {print $2; exit} /^\[.*\]$/ && !/\[Desktop Entry\]/ {exit}' "$desktop_file_path") + if [ -z "$name_i18n" ] ; then + app_name_in_desktop=$name_orig + else + app_name_in_desktop=$name_i18n + fi + fi + done + + for desktop_file_path in $(dpkg -L "$package_name" |grep /opt/apps/$package_name/entries/applications | awk '/\.desktop$/ {print}') ; do + if [ "$(grep -m 1 '^NoDisplay=' "$desktop_file_path" | cut -d '=' -f 2)" = "true" ] || [ "$(grep -m 1 '^NoDisplay=' "$desktop_file_path" | cut -d '=' -f 2)" = "True" ] ; then + continue + else + name_orig=$(awk -F= '/^\[Desktop Entry\]$/ {found=1} found && /^Name=/ {print $2; exit} /^\[.*\]$/ && !/\[Desktop Entry\]/ {exit}' "$desktop_file_path") + name_i18n=$(awk -v lang="Name[$LANGUAGE]" -F= '/^\[Desktop Entry\]$/ {found=1} found && /^Name\[/ && $1 == lang {print $2; exit} /^\[.*\]$/ && !/\[Desktop Entry\]/ {exit}' "$desktop_file_path") + if [ -z "$name_i18n" ] ; then + app_name_in_desktop=$name_orig + else + app_name_in_desktop=$name_i18n + fi + fi + done + + if [ -z "$app_name_in_desktop" ] ; then + app_name_in_desktop=${package_name} + fi + + echo ${app_name_in_desktop} +} + +touch /tmp/spark-store/upgradeStatus.txt + +# 执行 apt update +pkexec ${HERE}/ss-do-upgrade-worker.sh ssupdate 2>&1 > /dev/null | zenity --progress --auto-close --pulsate --no-cancel --text="${TRANSHELL_CONTENT_UPDATE_CHEKING_PLEASE_WAIT}" --height 70 --width 400 --title="${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg + +if [ -z `cat /tmp/spark-store-app-ssupdate-status.txt` ] ; then + ${HERE}/ss-do-upgrade-worker.sh clean-log +else + zenity --error --text "${TRANSHELL_CONTENT_CHECK_UPDATE_PROCESS_ERROR_PRESS_CONFIRM_TO_CHECK}" --title "${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --height 200 --width 350 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg + zenity --text-info --filename=/tmp/spark-store-app-ssupdate-log.txt --checkbox="${TRANSHELL_CONTENT_I_ALREDY_COPIED_THE_LOG_HERE_AND_WILL_USE_IT_TO_FEEDBACK}" --title="${TRANSHELL_CONTENT_FEEDBACK_CAN_BE_FOUND_IN_THE_SETTINGS}" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg + ${HERE}/ss-do-upgrade-worker.sh clean-log + rm -f /tmp/spark-store/upgradeStatus.txt + exit +fi + +# 获取可更新应用列表 +PKG_LIST="$(${HERE}/ss-do-upgrade-worker.sh upgradable-list)" +## 如果没更新,就弹出不需要更新 +if [ -z "$PKG_LIST" ] ; then + zenity --info --text "${TRANSHELL_CONTENT_NO_NEED_TO_UPGRADE}" --title "${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg +else + ## 获取用户选择的要更新的应用 + ### 指定分隔符为 \n + IFS_OLD="$IFS" + IFS=$'\n' + + PKG_UPGRADE_LIST=$(for line in $PKG_LIST ; do + PKG_NAME=$(echo $line | awk -F ' ' '{print $1}') + PKG_NEW_VER=$(echo $line | awk -F ' ' '{print $2}') + PKG_CUR_VER=$(echo $line | awk -F ' ' '{print $3}') + + dpkg --compare-versions $PKG_NEW_VER le $PKG_CUR_VER + if [ $? -eq 0 ] ; then + continue + fi + APP_NAME=$(get_name_from_desktop_file $PKG_NAME) + #### 检测是否是 hold 状态 + PKG_STA=$(dpkg-query -W -f='${db:Status-Want}' $PKG_NAME) + if [ "$PKG_STA" != "hold" ] ; then + echo "true" + echo "$APP_NAME" + echo "$PKG_NEW_VER" + echo "$PKG_CUR_VER" + echo "$PKG_NAME" + else + echo "false" + echo "$APP_NAME${TRANSHELL_CONTENT_CAN_NOT_UPGRADE_FOR_BEING_HOLD}" + echo "$PKG_NEW_VER" + echo "$PKG_CUR_VER" + echo "$PKG_NAME" + fi +done) + + ### 还原分隔符 + IFS="$IFS_OLD" + + ## 如果没有应用需要更新,则直接退出 + if [ -z "$PKG_UPGRADE_LIST" ] ; then + zenity --info --text "${TRANSHELL_CONTENT_NO_NEED_TO_UPGRADE}" --title "${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --height 150 --width 300 + exit 0 + fi + + + while true;do + PKG_UPGRADE_LIST=$(echo "$PKG_UPGRADE_LIST" | zenity --list --text="${TRANSHELL_CONTENT_CHOOSE_APP_TO_UPGRADE}" --column="${TRANSHELL_CONTENT_CHOOSE}" --column="${TRANSHELL_CONTENT_APP_NAME}" --column="${TRANSHELL_CONTENT_NEW_VERSION}" --column="${TRANSHELL_CONTENT_UPGRADE_FROM}" --column="${TRANSHELL_CONTENT_PKG_NAME}" --separator=" " --checklist --multiple --print-column=5 --height 350 --width 650 ) + ## 如果没有选择,则直接退出 + if [ -z "$PKG_UPGRADE_LIST" ] ; then + zenity --info --text "${TRANSHELL_CONTENT_NO_APP_IS_CHOSEN}" --title "${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --height 150 --width 300 + exit 0 + fi + if [[ "$PKG_UPGRADE_LIST" == *"(null)"* ]]; then + zenity --error --text "${TRANSHELL_CONTENT_LIST_NOT_LOADED_PLEASE_WAIT}" --title "${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --height 150 --width 300 + else + break + fi +done + ### 更新用户选择的应用 +# for PKG_UPGRADE in $PKG_UPGRADE_LIST;do +# APP_UPGRADE="$(get_name_from_desktop_file $PKG_UPGRADE)" +# update_transhell + +( +total=$(echo "$PKG_UPGRADE_LIST" | wc -w) +count=0 + +for PKG_UPGRADE in $PKG_UPGRADE_LIST; do + count=$((count + 1)) + APP_UPGRADE="$(get_name_from_desktop_file $PKG_UPGRADE)" + update_transhell + + # 启动升级任务 + (yes n | pkexec ${HERE}/ss-do-upgrade-worker.sh upgrade-app $PKG_UPGRADE -yfq 2>&1 > /dev/null ) & + + # 计算进度百分比 + progress=$(( count * 100 / total - 1)) + + # 动态修改zenity的文本 + echo "# ${TRANSHELL_CONTENT_UPGRADING_PLEASE_WAIT}" + echo "$progress" + wait +done +) | zenity --progress --auto-close --no-cancel --text="Preparing..." --height 70 --width 400 --title="${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg + + + #### 更新成功 + if [ -z "`cat /tmp/spark-store-app-upgrade-status.txt`" ] ; then + zenity --info --text "${TRANSHELL_CONTENT_CHOSEN_APP_UPGRADE_FINISHED}" --title "${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --height 150 --width 300 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg + else #### 更新异常 + zenity --error --text "${TRANSHELL_CONTENT_APP_UGRADE_PROCESS_ERROR_PRESS_CONFIRM_TO_CHECK}" --title "${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL}" --height 200 --width 350 --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg + zenity --text-info --filename=/tmp/spark-store-app-upgrade-log.txt --checkbox="${TRANSHELL_CONTENT_I_ALREDY_COPIED_THE_LOG_HERE_AND_WILL_USE_IT_TO_FEEDBACK}" --title="${TRANSHELL_CONTENT_FEEDBACK_CAN_BE_FOUND_IN_THE_SETTINGS}" --window-icon=/usr/share/icons/hicolor/scalable/apps/spark-store.svg + fi +fi + +rm -f /tmp/spark-store/upgradeStatus.txt +# 从最开头 diff --git a/tool/update-upgrade/ss-update-controler.sh b/tool/update-upgrade/ss-update-controler.sh new file mode 100755 index 0000000000000000000000000000000000000000..74f6130ae6f7acb565df94023ad8f1e0a913e394 --- /dev/null +++ b/tool/update-upgrade/ss-update-controler.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +load_transhell_debug + +endloop=0 + +#####################检测是否启动过了更新检测工具 +while [ $endloop -eq 0 ] ;do + +if [ ! -e $HOME/.config/spark-union/spark-store/ssshell-config-do-not-show-upgrade-notify ];then +text_update_open="${TRANSHELL_CONTENT_CLOSE}" +#已经开启了就显示关闭 +else +text_update_open="${TRANSHELL_CONTENT_OPEN}" +fi + +if [ ! -e $HOME/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ];then +CONTENT_SET_CREATE_DESKTOP="${TRANSHELL_CONTENT_CLOSE_CREATE_DESKTOP}" +#已经开启了就显示关闭 +else +CONTENT_SET_CREATE_DESKTOP="${TRANSHELL_CONTENT_OPEN_CREATE_DESKTOP}" +fi + +update_transhell + +option=$(zenity --list --text="${TRANSHELL_CONTENT_WELCOME_AND_CHOOSE_ONE_TO_RUN}" --column 数字 --column=${TRANSHELL_CONTENT_OPTIONS} --print-column=2 --height 350 --width 760 0 "${TRANSHELL_CONTENT_OPEN_OR_CLOSE_UPGRADE_CHECK}" 1 "${CONTENT_SET_CREATE_DESKTOP}" 2 "${TRANSHELL_CONTENT_CHECK_FOR_UPDATE}" 3 "${TRANSHELL_CONTENT_EXIT}" --hide-column=1 --print-column=1) + +case $option in + 0) + if [ ! -e $HOME/.config/spark-union/spark-store/ssshell-config-do-not-show-upgrade-notify ];then + mkdir -p $HOME/.config/spark-union/spark-store/ + touch $HOME/.config/spark-union/spark-store/ssshell-config-do-not-show-upgrade-notify + zenity --info --icon-name=spark-store --height 150 --width 200 --text "${TRANSHELL_CONTENT_CLOSED}" --timeout=2 + else + rm -f $HOME/.config/spark-union/spark-store/ssshell-config-do-not-show-upgrade-notify + zenity --info --icon-name=spark-store --height 150 --width 200 --text "${TRANSHELL_CONTENT_OPENED}" --timeout=2 + fi + ;; + 1) + if [ ! -e $HOME/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop ];then + mkdir -p $HOME/.config/spark-union/spark-store/ + touch $HOME/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop + zenity --info --icon-name=spark-store --height 150 --width 200 --text "${TRANSHELL_CONTENT_CLOSED}" --timeout=2 + else + rm -f $HOME/.config/spark-union/spark-store/ssshell-config-do-not-create-desktop + zenity --info --icon-name=spark-store --height 150 --width 200 --text "${TRANSHELL_CONTENT_OPENED}" --timeout=2 + fi + ;; + 2) + /opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh + ;; + + 3) + exit 0 + ;; + *) + exit 0 +esac + +done diff --git a/tool/update-upgrade/ss-update-notifier.sh b/tool/update-upgrade/ss-update-notifier.sh new file mode 100755 index 0000000000000000000000000000000000000000..18ab8bf976dbe3c2e198b425e37cedba8f592ade --- /dev/null +++ b/tool/update-upgrade/ss-update-notifier.sh @@ -0,0 +1,126 @@ +#!/bin/bash + +source /opt/durapps/spark-store/bin/bashimport/transhell.amber +load_transhell_debug + +############################################################# + +# 发送通知 +function notify-send() { + # Detect user using the display + local user=$(who | awk '{print $1}' | head -n 1) + + # Detect uid of the user + local uid=$(id -u $user) + + sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus notify-send "$@" +} + +# 检测网络链接畅通 +function network-check() { + # 超时时间 + local timeout=15 + + # 目标网站 + local target=www.baidu.com + + # 获取响应状态码 + local ret_code=$(curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1) + + if [ "$ret_code" = "200" ]; then + # 网络畅通 + return 0 + else + # 网络不畅通 + return 1 + fi +} + +# 初始化等待时间和最大等待时间 +initial_wait_time=15 # 初始等待时间 15 秒 +max_wait_time=$((12 * 3600)) # 最大等待时间 12 小时 + +# 检测网络,若不通则进行重试,采用指数退避算法 +wait_time=$initial_wait_time +while ! network-check; do + echo "$TRANSHELL_CONTENT_NETWORK_FAIL" + echo "Waiting for network to recover... Retrying in ${wait_time} seconds." + + sleep $wait_time + wait_time=$((wait_time * 2)) # 等待时间翻倍 + if [ $wait_time -gt $max_wait_time ]; then + wait_time=$max_wait_time # 最大等待时间限制为12小时 + fi +done + +# 每日更新星火源文件 +aptss update + +updatetext=`LANGUAGE=en_US aptss ssupdate 2>&1` + +# 在网络恢复后,继续更新操作 +retry_count=0 +max_retries=12 # 最大重试次数,防止死循环 + +until ! echo $updatetext | grep -q "E:"; do + if [ $retry_count -ge $max_retries ]; then + echo "Reached maximum retry limit for aptss ssupdate." + exit 1 + fi + + echo "${TRANSHELL_CONTENT_UPDATE_ERROR_AND_WAIT_15_SEC}" + sleep 15 + updatetext=`LANGUAGE=en_US aptss ssupdate 2>&1` + retry_count=$((retry_count + 1)) +done + +update_app_number=$(env LANGUAGE=en_US /usr/bin/apt -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf list --upgradable -o Dir::Etc::sourcelist="/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="/dev/null" -o APT::Get::List-Cleanup="0" 2>/dev/null | grep -c upgradable) + +if [ "$update_app_number" -le 0 ]; then + exit 0 +fi + +# 获取用户选择的要更新的应用 +PKG_LIST="$(/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade-worker.sh upgradable-list)" +# 指定分隔符为 \n +IFS_OLD="$IFS" +IFS=$'\n' + +for line in $PKG_LIST; do + PKG_NAME=$(echo $line | awk -F ' ' '{print $1}') + PKG_NEW_VER=$(echo $line | awk -F ' ' '{print $2}') + PKG_CUR_VER=$(echo $line | awk -F ' ' '{print $3}') + + dpkg --compare-versions $PKG_NEW_VER le $PKG_CUR_VER + + if [ $? -eq 0 ]; then + let update_app_number=$update_app_number-1 + continue + fi + + # 检测是否是 hold 状态 + PKG_STA=$(dpkg-query -W -f='${db:Status-Want}' $PKG_NAME) + if [ "$PKG_STA" = "hold" ]; then + let update_app_number=$update_app_number-1 + fi +done + +# 还原分隔符 +IFS="$IFS_OLD" +if [ $update_app_number -le 0 ]; then + exit 0 +fi +update_transhell + +# 如果都是hold或者版本一致的那就直接退出,否则把剩余的给提醒了 +# TODO: 除了apt-mark hold之外额外有一个禁止检查列表 +# 如果不想提示就不提示 + +user=$(who | awk '{print $1}' | head -n 1) +if [ -e "/home/$user/.config/spark-union/spark-store/ssshell-config-do-not-show-upgrade-notify" ]; then + echo "他不想站在世界之巅,好吧" + echo "Okay he don't want to be at the top of the world, okay" + exit +else + notify-send -a spark-store "${TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_NOTIFY}" "${TRANSHELL_CONTENT_THERE_ARE_APPS_TO_UPGRADE}" || true # Some machine don't have bus, or who command just print nothing. +fi diff --git a/tool/update-upgrade/transhell/ss-do-upgrade.sh_en_US.transhell b/tool/update-upgrade/transhell/ss-do-upgrade.sh_en_US.transhell new file mode 100644 index 0000000000000000000000000000000000000000..ae708e7dff47f8996b54d3810e1f58e1b0849371 --- /dev/null +++ b/tool/update-upgrade/transhell/ss-do-upgrade.sh_en_US.transhell @@ -0,0 +1,18 @@ +#!/bin/bash +TRANSHELL_CONTENT_UPDATE_CHEKING_PLEASE_WAIT="Checking for update, please wait..." +TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL="Spark Store APP Upgrade module" +TRANSHELL_CONTENT_CHECK_UPDATE_PROCESS_ERROR_PRESS_CONFIRM_TO_CHECK="Error occured in checking for update! Press Confirm to get the error log (Can be useful when feedback)" +TRANSHELL_CONTENT_I_ALREDY_COPIED_THE_LOG_HERE_AND_WILL_USE_IT_TO_FEEDBACK="I already copied the log in the text box and I will attach it when feeding back. You can find feedback entry in the settings which is located in the top right of the store." +TRANSHELL_CONTENT_FEEDBACK_CAN_BE_FOUND_IN_THE_SETTINGS="Feedback entry in the settings which is located in the top right of the store" +TRANSHELL_CONTENT_NO_NEED_TO_UPGRADE="All APPs are up to date." +TRANSHELL_CONTENT_CAN_NOT_UPGRADE_FOR_BEING_HOLD="(Unable to upgrade: Being marked as hold)" +TRANSHELL_CONTENT_CHOOSE_APP_TO_UPGRADE="Choose the app you want to upgrade" +TRANSHELL_CONTENT_CHOOSE="Choose" +TRANSHELL_CONTENT_APP_NAME="APP name" +TRANSHELL_CONTENT_PKG_NAME="Package Name" +TRANSHELL_CONTENT_NEW_VERSION="New version" +TRANSHELL_CONTENT_UPGRADE_FROM="Upgrade from" +TRANSHELL_CONTENT_NO_APP_IS_CHOSEN="No app is chosen" +TRANSHELL_CONTENT_UPGRADING_PLEASE_WAIT="Upgrading $APP_UPGRADE , please wait..." +TRANSHELL_CONTENT_CHOSEN_APP_UPGRADE_FINISHED="The chosen app is upgraded" +TRANSHELL_CONTENT_APP_UGRADE_PROCESS_ERROR_PRESS_CONFIRM_TO_CHECK="Error occured when upgrading! Press Confirm to get the error log (Can be useful when feedback)" diff --git a/tool/update-upgrade/transhell/ss-do-upgrade.sh_zh_CN.transhell b/tool/update-upgrade/transhell/ss-do-upgrade.sh_zh_CN.transhell new file mode 100644 index 0000000000000000000000000000000000000000..58311a6449072d3ee6c64f185ee368969598b6a7 --- /dev/null +++ b/tool/update-upgrade/transhell/ss-do-upgrade.sh_zh_CN.transhell @@ -0,0 +1,18 @@ +#!/bin/bash +TRANSHELL_CONTENT_UPDATE_CHEKING_PLEASE_WAIT="正在检查更新,请稍候..." +TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL="星火商店更新模块" +TRANSHELL_CONTENT_CHECK_UPDATE_PROCESS_ERROR_PRESS_CONFIRM_TO_CHECK="检查更新进程出现错误!按确定查看报错,可用于反馈" +TRANSHELL_CONTENT_I_ALREDY_COPIED_THE_LOG_HERE_AND_WILL_USE_IT_TO_FEEDBACK="我已复制了此文本框中的日志,且将会在反馈时附上。反馈渠道可以在右上角菜单的设置中找到" +TRANSHELL_CONTENT_FEEDBACK_CAN_BE_FOUND_IN_THE_SETTINGS="反馈渠道在商店右上角的设置里" +TRANSHELL_CONTENT_NO_NEED_TO_UPGRADE="没有软件需要更新" +TRANSHELL_CONTENT_CAN_NOT_UPGRADE_FOR_BEING_HOLD="(无法更新:已被标记为保留)" +TRANSHELL_CONTENT_CHOOSE_APP_TO_UPGRADE="选择你想更新的应用" +TRANSHELL_CONTENT_CHOOSE="选择" +TRANSHELL_CONTENT_APP_NAME="应用名" +TRANSHELL_CONTENT_PKG_NAME="包名" +TRANSHELL_CONTENT_NEW_VERSION="新版本" +TRANSHELL_CONTENT_UPGRADE_FROM="从该版本更新" +TRANSHELL_CONTENT_NO_APP_IS_CHOSEN="没有选中任何软件" +TRANSHELL_CONTENT_UPGRADING_PLEASE_WAIT="正在更新 $APP_UPGRADE ,请稍候..." +TRANSHELL_CONTENT_CHOSEN_APP_UPGRADE_FINISHED="选中的软件已经更新完毕" +TRANSHELL_CONTENT_APP_UGRADE_PROCESS_ERROR_PRESS_CONFIRM_TO_CHECK="更新出现错误!按确定查看报错,可用于反馈" diff --git a/tool/update-upgrade/transhell/ss-do-upgrade.sh_zh_TW.transhell b/tool/update-upgrade/transhell/ss-do-upgrade.sh_zh_TW.transhell new file mode 100644 index 0000000000000000000000000000000000000000..c7f4b55e7233fab5671505959f53d92ff2dc621d --- /dev/null +++ b/tool/update-upgrade/transhell/ss-do-upgrade.sh_zh_TW.transhell @@ -0,0 +1,18 @@ +#!/bin/bash +TRANSHELL_CONTENT_UPDATE_CHEKING_PLEASE_WAIT="正在檢查更新,請稍候…" +TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_MODEL="星火商店更新模塊" +TRANSHELL_CONTENT_CHECK_UPDATE_PROCESS_ERROR_PRESS_CONFIRM_TO_CHECK="檢查更新行程出現錯誤! 按確定查看報錯,可用於回報" +TRANSHELL_CONTENT_I_ALREDY_COPIED_THE_LOG_HERE_AND_WILL_USE_IT_TO_FEEDBACK="我已複製了此文字方塊中的日誌,且將會在回報時附上。 迴響通路可以在右上角選單的設定中找到 " +TRANSHELL_CONTENT_FEEDBACK_CAN_BE_FOUND_IN_THE_SETTINGS="回報入口在商店右上角的設定裏" +TRANSHELL_CONTENT_NO_NEED_TO_UPGRADE="沒有軟體需要更新" +TRANSHELL_CONTENT_CAN_NOT_UPGRADE_FOR_BEING_HOLD="(无法更新:已被标记为保留)" +TRANSHELL_CONTENT_CHOOSE_APP_TO_UPGRADE="选择你想更新的应用" +TRANSHELL_CONTENT_CHOOSE="选择" +TRANSHELL_CONTENT_APP_NAME="应用名" +TRANSHELL_CONTENT_PKG_NAME="包名" +TRANSHELL_CONTENT_NEW_VERSION="新版本" +TRANSHELL_CONTENT_UPGRADE_FROM="从该版本更新" +TRANSHELL_CONTENT_NO_APP_IS_CHOSEN="没有选中任何軟體" +TRANSHELL_CONTENT_UPGRADING_PLEASE_WAIT="正在更新 $APP_UPGRADE ,请稍候..." +TRANSHELL_CONTENT_CHOSEN_APP_UPGRADE_FINISHED="选中的軟體已经更新完毕" +TRANSHELL_CONTENT_APP_UGRADE_PROCESS_ERROR_PRESS_CONFIRM_TO_CHECK="更新出现错误!按确定查看报错,可用于反馈" diff --git a/tool/update-upgrade/transhell/ss-update-controler.sh_en_US.transhell b/tool/update-upgrade/transhell/ss-update-controler.sh_en_US.transhell new file mode 100644 index 0000000000000000000000000000000000000000..8b16f7d8667472b3fd007057ca62a0c83fb301b5 --- /dev/null +++ b/tool/update-upgrade/transhell/ss-update-controler.sh_en_US.transhell @@ -0,0 +1,14 @@ +#!/bin/bash +TRANSHELL_CONTENT_CLOSE="Disable" +TRANSHELL_CONTENT_OPEN="Enable" +TRANSHELL_CONTENT_WELCOME_AND_CHOOSE_ONE_TO_RUN="Welcome to Spark Store APP Upgrade Settings\nPlease choose one option to run" +TRANSHELL_CONTENT_OPTIONS="Options" +TRANSHELL_CONTENT_OPEN_OR_CLOSE_UPGRADE_CHECK="$text_update_open Spark Store APP upgrade check. (Will notify APP upgrade at start up if opened.)" +TRANSHELL_CONTENT_CHECK_FOR_UPDATE="Check Upgradable app list." +TRANSHELL_CONTENT_EXIT="Exit" +TRANSHELL_CONTENT_CLOSING_UPGRADE_CHECK="Please authorize to close APP upgrade check" +TRANSHELL_CONTENT_CLOSED="Disabled" +TRANSHELL_CONTENT_OPENING_UPGRADE_CHECK="Please authorize to open APP upgrade check" +TRANSHELL_CONTENT_OPENED="Enabled" +TRANSHELL_CONTENT_CLOSE_CREATE_DESKTOP="Disable auto create desktop shortcut" +TRANSHELL_CONTENT_OPEN_CREATE_DESKTOP="Enable auto create desktop shortcut" diff --git a/tool/update-upgrade/transhell/ss-update-controler.sh_zh_CN.transhell b/tool/update-upgrade/transhell/ss-update-controler.sh_zh_CN.transhell new file mode 100644 index 0000000000000000000000000000000000000000..50151d0cf34d0fec679935172562140bd07b2b07 --- /dev/null +++ b/tool/update-upgrade/transhell/ss-update-controler.sh_zh_CN.transhell @@ -0,0 +1,14 @@ +#!/bin/bash +TRANSHELL_CONTENT_CLOSE="关闭" +TRANSHELL_CONTENT_OPEN="开启" +TRANSHELL_CONTENT_WELCOME_AND_CHOOSE_ONE_TO_RUN="欢迎使用星火更新和安装设置工具\n请在以下操作中选择一个进行~" +TRANSHELL_CONTENT_OPTIONS="操作选项" +TRANSHELL_CONTENT_OPEN_OR_CLOSE_UPGRADE_CHECK="$text_update_open星火更新检测工具(如果开启则会在系统启动后自动检测更新。如有更新则会弹出通知)" +TRANSHELL_CONTENT_CHECK_FOR_UPDATE="查看可更新软件包列表" +TRANSHELL_CONTENT_EXIT="退出" +TRANSHELL_CONTENT_CLOSING_UPGRADE_CHECK="执行关闭自动更新检测,请授权" +TRANSHELL_CONTENT_CLOSED="已关闭" +TRANSHELL_CONTENT_OPENING_UPGRADE_CHECK="执行启动自动更新检测,请授权" +TRANSHELL_CONTENT_OPENED="已开启" +TRANSHELL_CONTENT_CLOSE_CREATE_DESKTOP="关闭自动创建桌面启动器" +TRANSHELL_CONTENT_OPEN_CREATE_DESKTOP="开启自动创建桌面启动器" diff --git a/tool/update-upgrade/transhell/ss-update-controler.sh_zh_TW.transhell b/tool/update-upgrade/transhell/ss-update-controler.sh_zh_TW.transhell new file mode 100644 index 0000000000000000000000000000000000000000..50151d0cf34d0fec679935172562140bd07b2b07 --- /dev/null +++ b/tool/update-upgrade/transhell/ss-update-controler.sh_zh_TW.transhell @@ -0,0 +1,14 @@ +#!/bin/bash +TRANSHELL_CONTENT_CLOSE="关闭" +TRANSHELL_CONTENT_OPEN="开启" +TRANSHELL_CONTENT_WELCOME_AND_CHOOSE_ONE_TO_RUN="欢迎使用星火更新和安装设置工具\n请在以下操作中选择一个进行~" +TRANSHELL_CONTENT_OPTIONS="操作选项" +TRANSHELL_CONTENT_OPEN_OR_CLOSE_UPGRADE_CHECK="$text_update_open星火更新检测工具(如果开启则会在系统启动后自动检测更新。如有更新则会弹出通知)" +TRANSHELL_CONTENT_CHECK_FOR_UPDATE="查看可更新软件包列表" +TRANSHELL_CONTENT_EXIT="退出" +TRANSHELL_CONTENT_CLOSING_UPGRADE_CHECK="执行关闭自动更新检测,请授权" +TRANSHELL_CONTENT_CLOSED="已关闭" +TRANSHELL_CONTENT_OPENING_UPGRADE_CHECK="执行启动自动更新检测,请授权" +TRANSHELL_CONTENT_OPENED="已开启" +TRANSHELL_CONTENT_CLOSE_CREATE_DESKTOP="关闭自动创建桌面启动器" +TRANSHELL_CONTENT_OPEN_CREATE_DESKTOP="开启自动创建桌面启动器" diff --git a/tool/update-upgrade/transhell/ss-update-notifier.sh_en_US.transhell b/tool/update-upgrade/transhell/ss-update-notifier.sh_en_US.transhell new file mode 100644 index 0000000000000000000000000000000000000000..fa28962a6429f99aa382f847cea2bfa395061e03 --- /dev/null +++ b/tool/update-upgrade/transhell/ss-update-notifier.sh_en_US.transhell @@ -0,0 +1,5 @@ +#!/bin/bash +TRANSHELL_CONTENT_NETWORK_FAIL="Network fail. Stop to avoid bother dpkg" +TRANSHELL_CONTENT_UPDATE_ERROR_AND_WAIT_15_SEC="Update error! Wait for 15 seconds..." +TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_NOTIFY="Spark Store Upgrade Notifier" +TRANSHELL_CONTENT_THERE_ARE_APPS_TO_UPGRADE="There are ${update_app_number} APPs available to upgrade! Please go to Spark Store to upgrade." diff --git a/tool/update-upgrade/transhell/ss-update-notifier.sh_zh_CN.transhell b/tool/update-upgrade/transhell/ss-update-notifier.sh_zh_CN.transhell new file mode 100644 index 0000000000000000000000000000000000000000..668fa144a5b3669aac97f42d1855c33751976019 --- /dev/null +++ b/tool/update-upgrade/transhell/ss-update-notifier.sh_zh_CN.transhell @@ -0,0 +1,5 @@ +#!/bin/bash +TRANSHELL_CONTENT_NETWORK_FAIL="网络错误!为防止阻塞dpkg,停止" +TRANSHELL_CONTENT_UPDATE_ERROR_AND_WAIT_15_SEC="更新出现异常状况,等待十五秒" +TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_NOTIFY="星火更新提醒" +TRANSHELL_CONTENT_THERE_ARE_APPS_TO_UPGRADE="星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理" diff --git a/tool/update-upgrade/transhell/ss-update-notifier.sh_zh_TW.transhell b/tool/update-upgrade/transhell/ss-update-notifier.sh_zh_TW.transhell new file mode 100644 index 0000000000000000000000000000000000000000..668fa144a5b3669aac97f42d1855c33751976019 --- /dev/null +++ b/tool/update-upgrade/transhell/ss-update-notifier.sh_zh_TW.transhell @@ -0,0 +1,5 @@ +#!/bin/bash +TRANSHELL_CONTENT_NETWORK_FAIL="网络错误!为防止阻塞dpkg,停止" +TRANSHELL_CONTENT_UPDATE_ERROR_AND_WAIT_15_SEC="更新出现异常状况,等待十五秒" +TRANSHELL_CONTENT_SPARK_STORE_UPGRADE_NOTIFY="星火更新提醒" +TRANSHELL_CONTENT_THERE_ARE_APPS_TO_UPGRADE="星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理" diff --git a/translate_generation.sh b/translate_generation.sh new file mode 100755 index 0000000000000000000000000000000000000000..f64e4ca08db1eb7240009cf667cca36d4b840052 --- /dev/null +++ b/translate_generation.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# this file is used to auto-generate .qm file from .ts file. + +cd $(dirname $0) + +lrelease ./src/spark-store.pro diff --git a/translate_update.sh b/translate_update.sh new file mode 100755 index 0000000000000000000000000000000000000000..6c9b030f5ccb7624aa2b0cb719b6c9f03d570822 --- /dev/null +++ b/translate_update.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# this file is used to auto-update .ts file. + +cd $(dirname $0) + +lupdate ./src/spark-store.pro -no-obsolete diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..789bfe616a1c351323a0e1b3fa959d438c1f826b --- /dev/null +++ b/translations/CMakeLists.txt @@ -0,0 +1,19 @@ +# Have to disable cleaning for this folder because cmake deletes .ts files upon clean +# Not sure what else wont clean up / dirty workaround of Qt bug +# @ref https://bugreports.qt.io/browse/QTBUG-41736 +# @ref https://stackoverflow.com/a/24245615/1917249 +set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM TRUE) + +find_package(Qt6 REQUIRED COMPONENTS LinguistTools) + +# Update ts files and release qm files only in Release build +file(GLOB TS_FILES "*.ts") +if (NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug") + set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}) + qt6_create_translation(QM_FILES ${CMAKE_SOURCE_DIR}/src ${TS_FILES} OPTIONS -no-obsolete) + # https://stackoverflow.com/questions/70665191/cmake-does-not-generate-ts-files + add_custom_target(${PROJECT_NAME}_translations DEPENDS ${TS_FILES} ${QM_FILES}) + add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_translations) +endif () + +install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations) diff --git a/translations/spark-store_en.ts b/translations/spark-store_en.ts new file mode 100644 index 0000000000000000000000000000000000000000..b093bf8ed2a0df07d59c8dd4bbe6907b4b25b105 --- /dev/null +++ b/translations/spark-store_en.ts @@ -0,0 +1,680 @@ + + + + + AppIntoPage + + + Form + + + + + Uninstall + + + + + 0 + 0B {0?} + + + + Download Times + + + + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + + + + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> + + + + + + <html><head/><body><p>Capable to UOS home 20</p></body></html> + + + + + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> + + + + + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> + + + + + + <html><head/><body><p>An Appimage to deb app.</p></body></html> + + + + + Share + Spk share link + + + + APP Feedback + + + + + Introduction + + + + + Description + + + + + Screen capture + + + + + + + + + Download and Install + + + + + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> + + + + + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> + + + + + + <html><head/><body><p>Capable to Debian Stable</p></body></html> + + + + + Update + + + + + Contributor + + + + + Pkgname + + + + + Author + + + + + Size + + + + + Website + + + + + Click Open + + + + + Developer Mode Disabled + + + + + + + Reinstall + + + + + + + Launch + + + + + Upgrade + + + + + + Install + + + + + Installing + + + + + + + + + Warning + + + + + The current application does not support or tested on deepin, there may be problems + + + + + The current application does not support or tested on UOS, there may be problems + + + + + The current application does not support or tested on Ubuntu, there may be problems + + + + + The current application does not support or tested on Debian, there may be problems + + + + + The current application does not support or tested on current platform, there may be problems + + + + + + Spark Store + + + + + Uninstall succeeded + + + + + The URL has been copied to the clipboard + + + + + AppListPage + + + Form + + + + + about:blank + + + + + DAboutDialog + + + Version: %1 + + + + + %1 is released under %2 + + + + + DownloadController + + + Download Failed, please retry :( + + + + + DownloadItem + + + Form + + + + + icon + + + + + TextLabel + + + + + Name + + + + + Waiting to download + + + + + Install + + + + + Cancel + + + + + Info + + + + + + Download Complete. + + + + + + + Spark Store + + + + + + Installing + + + + + Installation complete. + + + + + + Finish + + + + + Retry + + + + + + + Error happened in dpkg progress , please check the install info or try to reinstall. + + + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. + + + + + + Download canceled + + + + + DownloadListWidget + + + Form + + + + + The list is currently empty. Go and download some softwares! + + + + + Open download directory + + + + + MainWindow + + + MainWindow + + + + + Home + + + + + Network + + + + + Chat + + + + + Music + + + + + Video + + + + + Picture + + + + + Game + + + + + Office + + + + + Reading + + + + + Development + + + + + Tool + + + + + Theme + + + + + Other + + + + + APP Upgrade + + + + + Submit App + + + + + Submit App with client(Recommanded) + + + + + Settings + + + + + APP Upgrade and Install Settings + + + + + + Spark Store + + + + + Search or enter spk:// + + + + + QObject + + + + + Spark Store + + + + + <span style=' font-size:10pt;font-weight:60;'>An appstore powered by community</span><br/><span style=' font-size:10pt;font-weight:60;'>Sparky is our mascot, designed by <a href='https://tai3.cn/'>Tyson Tan</a></span><br/> + + + + + Spark Project + + + + + Download list + + + + + Show MainWindow + + + + + SettingsPage + + + Form + + + + + Line Settings + + + + + Choose Line: + + + + + Refresh + + + + + Take effect immediately + + + + + <html><head/><body><p>Check update for Spark Store. </p></body></html> + + + + + Update + + + + + Spark Store Update + + + + + Other Settings + + + + + Enable notification for apps not compatible with current system + + + + + Temp + + + + + Since the dictionary is at /tmp,It would be cleaned automatically when system reboot. + + + + + 0B + 0B + + + + Location:/tmp/spark-store + + + + + Clean + + + + + Size: + + + + + Clear Web Cache + + + + + About us + + + + + <html><head/><body><p>Our services and software are free for individuals and non-profit organizations to use, communicate and learn, but you must comply with local laws and regulations in the process of use, otherwise any problems have nothing to do with us. </p><p>We don't make a profit from the Community version store, we rely on donations from the community for most of our operating expenses, and we appreciate that this allows us to spend less energy worrying about money. However, in order to better provide continuous service, Spark is only free for individual users to open the service warehouse, if you or your organization needs to provide commercial services or your organization is a for-profit organization, please contact us to obtain commercial authorization. </p><p>When using the Software, users or organizations are strictly forbidden to engage in any form of malicious behavior, including but not limited to malicious attacks, abuse, destruction, bulk crawling of the software warehouse, etc. The definition of malicious behavior is judged by the Spark community, and violators will be held legally responsible. Spark Community reserves the right to distribute the software packages it produces. </p><p>Any person or organization is prohibited from using the Spark Community software package for commercial purposes or redistributing it without the express authorization of the Spark Community. This clause is intended to ensure the spirit of open source while safeguarding the intellectual property rights of the Spark community. In addition to the above, if you use the Spark Store main program or part of its code, you are subject to all other terms and requirements of the GPL v3.</p><p>If any part of the store infringes your rights, please tell us <a href="mailto:jifengshenmo@outlook.com"><span style=" text-decoration: underline; color:#0082fa;">jifengshenmo@outlook.com</span></a> we will remove the infringing content as soon as possible. </p><p>If you'd like to get involved with us too, whether you're involved in development, design, pitching or submitting work, we welcome you to join us. </p><p><span style=" text-decoration: underline; color:#0000ff;"><br/></span>Our contact method can be found at <a href="https://blog.shenmo.tech/post/%E6%95%85%E9%9A%9C%E5%85%AC%E5%91%8A/"><span style=" text-decoration: underline; color:#0082fa;">Here</span></a></p></body></html> + + + + + Updating, please wait... + + + + + Spark Store + + + + + Temporary cache was cleaned + + + + + TitleBarMenu + + + About + + + + + Exit + + + + diff --git a/translations/spark-store_es.ts b/translations/spark-store_es.ts new file mode 100644 index 0000000000000000000000000000000000000000..f38a6f0476309b049abd4f40fbf955e1ca0dbf46 --- /dev/null +++ b/translations/spark-store_es.ts @@ -0,0 +1,680 @@ + + + + + AppIntoPage + + + Form + Tipo + + + + Uninstall + Desinstalar + + + + 0 + 0 + + + + Download Times + Número de descargas + + + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + + + + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> + <html><head/><body><p>Esta aplicación fue desarrollada por usuarios de la comunidad y la Etiquetamos en honor a aquellos que contribuyeron a la ecología de linux.</p></body></html> + + + + + <html><head/><body><p>Capable to UOS home 20</p></body></html> + <html><head/><body><p>Capaz de UOS home 20</p></body></html> + + + + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> + <html><head/><body><p>A deepin-wine2 app. La tienda Spark le configurará automáticamente un traje de vino.</p></body></html> + + + + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> + <html><head/><body><p>Esta es una aplicación dtk5, lo que significa que funcionará mejor en un entorno de escritorio profundo.</p></body></html> + + + + + <html><head/><body><p>An Appimage to deb app.</p></body></html> + <html><head/><body><p>Appimage de la aplicación deb.</p></body></html> + + + + Share + Comunión + + + + APP Feedback + Comentarios de la app + + + + Introduction + Introducción + + + + Description + Descripción + + + + Screen capture + Captura de pantalla + + + + + + + + Download and Install + Descargar e instalar + + + + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> + <html><head/><body><p>Capaz de Ubuntu 22.04</p></body></html> + + + + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> + <html><head/><body><p>La aplicación wine. Spark Store configurará automáticamente el kit Wine para usted</p></body></html> + + + + + <html><head/><body><p>Capable to Debian Stable</p></body></html> + + + + + Update + Modernizar + + + + Contributor + Contribuyentes + + + + Pkgname + Nombre del embalaje + + + + Author + Autor + + + + Size + Tamaño + + + + Website + Sitio web + + + + Click Open + Haga clic en "abrir" + + + + Developer Mode Disabled + Se ha desactivado el modo desarrollador + + + + + + Reinstall + Reinstalación + + + + + + Launch + + + + + Upgrade + Actualización + + + + + Install + Instalación + + + + Installing + Se está instalando + + + + + + + + Warning + Aviso + + + + The current application does not support or tested on deepin, there may be problems + + + + + The current application does not support or tested on UOS, there may be problems + + + + + The current application does not support or tested on Ubuntu, there may be problems + + + + + The current application does not support or tested on Debian, there may be problems + + + + + The current application does not support or tested on current platform, there may be problems + + + + + + Spark Store + SPARK Store + + + + Uninstall succeeded + Desinstalación exitosa + + + + The URL has been copied to the clipboard + La URL ha sido copiada al portapapeles + + + + AppListPage + + + Form + Tipo + + + + about:blank + Sobre: en blanco + + + + DAboutDialog + + + Version: %1 + Versión %1 + + + + %1 is released under %2 + %1 publicado bajo %2 + + + + DownloadController + + + Download Failed, please retry :( + Descarga fall, por favor vuelva a intentarlo + + + + DownloadItem + + + Form + Tipo + + + + icon + ídolo + + + + TextLabel + Etiquetas de texto + + + + Name + Nombre + + + + Waiting to download + Esperando descargar + + + + Install + Instalación + + + + Cancel + Cancelación + + + + Info + Información + + + + + Download Complete. + Descarga completada. + + + + + + Spark Store + SPARK Store + + + + + Installing + Se está instalando + + + + Installation complete. + La instalación está completa. + + + + + Finish + Completado + + + + Retry + Reinterpretar + + + + + + Error happened in dpkg progress , please check the install info or try to reinstall. + Se produjo un error durante el proceso dpkg, verifique la información de instalación o intente reinstalar. + + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. + El proceso de DPKG ha sido interrumpido, compruebe la información de instalación o intente reinstalar. + + + + + Download canceled + Descarga cancelada + + + + DownloadListWidget + + + Form + Tipo + + + + The list is currently empty. Go and download some softwares! + La lista está actualmente vacía. ¡Ve a descargar un poco de software! + + + + Open download directory + Abrir el catálogo de descargas + + + + MainWindow + + + MainWindow + Ventana principal + + + + Home + Casa + + + + Network + Red + + + + Chat + Charla + + + + Music + Música + + + + Video + Vídeo + + + + Picture + Foto + + + + Game + Juego + + + + Office + Oficina + + + + Reading + Leer + + + + Development + Desarrollo + + + + Tool + Herramientas + + + + Theme + Tema + + + + Other + Además + + + + APP Upgrade + Actualización de app + + + + Submit App + Presentación de la aplicación + + + + Submit App with client(Recommanded) + Enviar la aplicación al cliente (recomendación) + + + + Settings + Configuración + + + + APP Upgrade and Install Settings + Actualización e instalación de app + + + + + Spark Store + SPARK Store + + + + Search or enter spk:// + Buscar o introducir spk: /% + + + + QObject + + + + + Spark Store + SPARK Store + + + + <span style=' font-size:10pt;font-weight:60;'>An appstore powered by community</span><br/><span style=' font-size:10pt;font-weight:60;'>Sparky is our mascot, designed by <a href='https://tai3.cn/'>Tyson Tan</a></span><br/> + + + + + Spark Project + Proyecto spark + + + + Download list + Descargar lista + + + + Show MainWindow + Mostrar la ventana principal + + + + SettingsPage + + + Form + Tipo + + + + Line Settings + Configuración de la línea + + + + Choose Line: + Selección de líneas: + + + + Refresh + Refrescar + + + + Take effect immediately + Entrada en vigor inmediata + + + + <html><head/><body><p>Check update for Spark Store. </p></body></html> + <html><head/><body><p>Revisa las actualizaciones de la Spark Store. </p></body></html> + + + + Update + Modernizar + + + + Spark Store Update + Actualización de la tienda spark + + + + Other Settings + Otras configuraciones + + + + Enable notification for apps not compatible with current system + Habilitar notificaciones para aplicaciones incompatibles con el sistema actual + + + + Temp + Empleados temporales + + + + Since the dictionary is at /tmp,It would be cleaned automatically when system reboot. + Debido a que el diccionario se encuentra en / tmp, se limpia automáticamente cuando el sistema se reinicia. + + + + 0B + 0B + + + + Location:/tmp/spark-store + Ubicación: / TMP / Spark Storage + + + + Clean + Limpio + + + + Size: + Tamaño: + + + + Clear Web Cache + Borrar la caché web + + + + About us + Sobre nosotros + + + + <html><head/><body><p>Our services and software are free for individuals and non-profit organizations to use, communicate and learn, but you must comply with local laws and regulations in the process of use, otherwise any problems have nothing to do with us. </p><p>We don't make a profit from the Community version store, we rely on donations from the community for most of our operating expenses, and we appreciate that this allows us to spend less energy worrying about money. However, in order to better provide continuous service, Spark is only free for individual users to open the service warehouse, if you or your organization needs to provide commercial services or your organization is a for-profit organization, please contact us to obtain commercial authorization. </p><p>When using the Software, users or organizations are strictly forbidden to engage in any form of malicious behavior, including but not limited to malicious attacks, abuse, destruction, bulk crawling of the software warehouse, etc. The definition of malicious behavior is judged by the Spark community, and violators will be held legally responsible. Spark Community reserves the right to distribute the software packages it produces. </p><p>Any person or organization is prohibited from using the Spark Community software package for commercial purposes or redistributing it without the express authorization of the Spark Community. This clause is intended to ensure the spirit of open source while safeguarding the intellectual property rights of the Spark community. In addition to the above, if you use the Spark Store main program or part of its code, you are subject to all other terms and requirements of the GPL v3.</p><p>If any part of the store infringes your rights, please tell us <a href="mailto:jifengshenmo@outlook.com"><span style=" text-decoration: underline; color:#0082fa;">jifengshenmo@outlook.com</span></a> we will remove the infringing content as soon as possible. </p><p>If you'd like to get involved with us too, whether you're involved in development, design, pitching or submitting work, we welcome you to join us. </p><p><span style=" text-decoration: underline; color:#0000ff;"><br/></span>Our contact method can be found at <a href="https://blog.shenmo.tech/post/%E6%95%85%E9%9A%9C%E5%85%AC%E5%91%8A/"><span style=" text-decoration: underline; color:#0082fa;">Here</span></a></p></body></html> + + + + + Updating, please wait... + Se está actualizando, por favor Espere... + + + + Spark Store + SPARK Store + + + + Temporary cache was cleaned + Se ha limpiado la caché temporal + + + + TitleBarMenu + + + About + Sobre + + + + Exit + Exportaciones + + + diff --git a/translations/spark-store_fr.ts b/translations/spark-store_fr.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a6823d688dd5c1e7b1d29ed1631f2fadf136912 --- /dev/null +++ b/translations/spark-store_fr.ts @@ -0,0 +1,680 @@ + + + + + AppIntoPage + + + Form + Type + + + + Uninstall + Désinstaller + + + + 0 + 0 + + + + Download Times + Nombre de téléchargements + + + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + + + + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> + <html><head/><body><p>Cette application a été développée par des utilisateurs de la communauté et nous avons donné ce label à ceux qui ont contribué à l'écologie de Linux</p></body></html> + + + + + <html><head/><body><p>Capable to UOS home 20</p></body></html> + <html><head/><body><p>Capable de la home UOS 20</p></body></html> + + + + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> + <html><head/><body><p>Une application deepin-wine2. Le Spark Store configure automatiquement votre pack de vins.</p></body></html> + + + + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> + <html><head/><body><p>C'est une application dtk5, ce qui signifie qu'elle fonctionnera mieux dans un environnement de bureau profond.</p></body></html> + + + + + <html><head/><body><p>An Appimage to deb app.</p></body></html> + <html><head/><body><p>Appimage pour l'application DEB</p></body></html> + + + + Share + Au total + + + + APP Feedback + App feedback + + + + Introduction + Présentation + + + + Description + Description + + + + Screen capture + Captures d'écran + + + + + + + + Download and Install + Télécharger et installer + + + + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> + <html><head/><body><p>Capable de la Ubuntu 22.04</p></body></html> + + + + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> + <html><head/><body><p>L'application wine. Spark Store configure automatiquement le kit Wine pour vous</p></body></html> + + + + + <html><head/><body><p>Capable to Debian Stable</p></body></html> + + + + + Update + Moderniser + + + + Contributor + Contributeurs + + + + Pkgname + Nom de l'emballage + + + + Author + Auteur + + + + Size + Taille + + + + Website + Site Web + + + + Click Open + Cliquez sur Ouvrir + + + + Developer Mode Disabled + Mode développeur désactivé + + + + + + Reinstall + Réinstaller + + + + + + Launch + + + + + Upgrade + Mise à niveau + + + + + Install + Installation + + + + Installing + Installation en cours + + + + + + + + Warning + Avertissement + + + + The current application does not support or tested on deepin, there may be problems + + + + + The current application does not support or tested on UOS, there may be problems + + + + + The current application does not support or tested on Ubuntu, there may be problems + + + + + The current application does not support or tested on Debian, there may be problems + + + + + The current application does not support or tested on current platform, there may be problems + + + + + + Spark Store + Le Spark store + + + + Uninstall succeeded + Désinstallation réussie + + + + The URL has been copied to the clipboard + L'URL a été copiée dans le presse - papiers + + + + AppListPage + + + Form + Type + + + + about:blank + Re: vide + + + + DAboutDialog + + + Version: %1 + Version: %1 + + + + %1 is released under %2 + %1 publié sous %2 + + + + DownloadController + + + Download Failed, please retry :( + Le téléchargement a échoué, veuillez réessayer + + + + DownloadItem + + + Form + Type + + + + icon + Idoles + + + + TextLabel + Étiquettes de texte + + + + Name + Le nom + + + + Waiting to download + En attente de téléchargement + + + + Install + Installation + + + + Cancel + Annulation + + + + Info + Informations + + + + + Download Complete. + Le téléchargement est terminé. + + + + + + Spark Store + Le Spark store + + + + + Installing + Installation en cours + + + + Installation complete. + L'installation est terminée. + + + + + Finish + Terminé + + + + Retry + Essayez à nouveau + + + + + + Error happened in dpkg progress , please check the install info or try to reinstall. + Une erreur s'est produite dans le processus dpkg, vérifiez les informations d'installation ou essayez de réinstaller. + + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. + La progression de DPKG a été interrompue, veuillez vérifier les informations d’installation ou essayer de réinstaller. + + + + + Download canceled + Le téléchargement a été annulé + + + + DownloadListWidget + + + Form + Type + + + + The list is currently empty. Go and download some softwares! + La liste est actuellement vide. Allez télécharger quelques logiciels! + + + + Open download directory + Ouvrir le catalogue de téléchargement + + + + MainWindow + + + MainWindow + Fenêtre principale + + + + Home + Maison + + + + Network + Réseau + + + + Chat + Bavarder + + + + Music + Musique + + + + Video + Vidéo + + + + Picture + Photos + + + + Game + Jeux + + + + Office + Bureaux + + + + Reading + Lire + + + + Development + Développement + + + + Tool + Outils + + + + Theme + Thèmes + + + + Other + En outre + + + + APP Upgrade + Mise à niveau app + + + + Submit App + Soumettre une application + + + + Submit App with client(Recommanded) + Soumettre une demande au client (recommandé) + + + + Settings + Paramètres + + + + APP Upgrade and Install Settings + Paramètres de mise à niveau et d'installation de l'app + + + + + Spark Store + Le Spark store + + + + Search or enter spk:// + Rechercher ou entrer SPK / + + + + QObject + + + + + Spark Store + Le Spark store + + + + <span style=' font-size:10pt;font-weight:60;'>An appstore powered by community</span><br/><span style=' font-size:10pt;font-weight:60;'>Sparky is our mascot, designed by <a href='https://tai3.cn/'>Tyson Tan</a></span><br/> + + + + + Spark Project + Le projet Spark + + + + Download list + Télécharger la Liste + + + + Show MainWindow + Afficher la fenêtre principale + + + + SettingsPage + + + Form + Type + + + + Line Settings + Configuration de la ligne + + + + Choose Line: + Sélectionnez la ligne: + + + + Refresh + Rafraîchir + + + + Take effect immediately + Entrée en vigueur immédiate + + + + <html><head/><body><p>Check update for Spark Store. </p></body></html> + <html><head/><body><p>Vérifiez les mises à jour sur le Spark Store. </p></body></html> + + + + Update + Moderniser + + + + Spark Store Update + Mise à jour du Spark store + + + + Other Settings + Autres paramètres + + + + Enable notification for apps not compatible with current system + Activer les notifications pour les applications incompatibles avec le système actuel + + + + Temp + Employés temporaires + + + + Since the dictionary is at /tmp,It would be cleaned automatically when system reboot. + Comme le dictionnaire se trouve dans / tmp, il est nettoyé automatiquement lorsque le système redémarre. + + + + 0B + 0B + + + + Location:/tmp/spark-store + Emplacement: / tmp / Spark stockage + + + + Clean + Nettoyé + + + + Size: + Dimensions: + + + + Clear Web Cache + Effacer le cache Web + + + + About us + À propos de nous + + + + <html><head/><body><p>Our services and software are free for individuals and non-profit organizations to use, communicate and learn, but you must comply with local laws and regulations in the process of use, otherwise any problems have nothing to do with us. </p><p>We don't make a profit from the Community version store, we rely on donations from the community for most of our operating expenses, and we appreciate that this allows us to spend less energy worrying about money. However, in order to better provide continuous service, Spark is only free for individual users to open the service warehouse, if you or your organization needs to provide commercial services or your organization is a for-profit organization, please contact us to obtain commercial authorization. </p><p>When using the Software, users or organizations are strictly forbidden to engage in any form of malicious behavior, including but not limited to malicious attacks, abuse, destruction, bulk crawling of the software warehouse, etc. The definition of malicious behavior is judged by the Spark community, and violators will be held legally responsible. Spark Community reserves the right to distribute the software packages it produces. </p><p>Any person or organization is prohibited from using the Spark Community software package for commercial purposes or redistributing it without the express authorization of the Spark Community. This clause is intended to ensure the spirit of open source while safeguarding the intellectual property rights of the Spark community. In addition to the above, if you use the Spark Store main program or part of its code, you are subject to all other terms and requirements of the GPL v3.</p><p>If any part of the store infringes your rights, please tell us <a href="mailto:jifengshenmo@outlook.com"><span style=" text-decoration: underline; color:#0082fa;">jifengshenmo@outlook.com</span></a> we will remove the infringing content as soon as possible. </p><p>If you'd like to get involved with us too, whether you're involved in development, design, pitching or submitting work, we welcome you to join us. </p><p><span style=" text-decoration: underline; color:#0000ff;"><br/></span>Our contact method can be found at <a href="https://blog.shenmo.tech/post/%E6%95%85%E9%9A%9C%E5%85%AC%E5%91%8A/"><span style=" text-decoration: underline; color:#0082fa;">Here</span></a></p></body></html> + + + + + Updating, please wait... + Mise à jour en cours, veuillez patienter... + + + + Spark Store + Le Spark store + + + + Temporary cache was cleaned + Cache temporaire nettoyé + + + + TitleBarMenu + + + About + À propos + + + + Exit + Exportations + + + diff --git a/translations/spark-store_zh_CN.ts b/translations/spark-store_zh_CN.ts new file mode 100644 index 0000000000000000000000000000000000000000..6df066c1610c438ffc0b668ef28104f13fe85d93 --- /dev/null +++ b/translations/spark-store_zh_CN.ts @@ -0,0 +1,680 @@ + + + + + AppIntoPage + + + Form + + + + + Uninstall + 卸载 + + + + 0 + + + + + Download Times + 下载量 + + + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + + + + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> + <html><head/><body><p>这款应用是社区开发者开发的,我们为社区开发者颁发这款勋章以表彰他们对Linux生态的贡献</p></body></html> + + + + + <html><head/><body><p>Capable to UOS home 20</p></body></html> + <html><head/><body><p>支持UOS家庭版 20</p></body></html> + + + + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> + 这是一款 deepin-wine2 应用。星火商店会为你自动配置wine环境 + + + + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> + <html><head/><body><p>这是一款DTK5应用,请使用深度桌面环境来获得最完美的体验</p></body></html> + + + + + <html><head/><body><p>An Appimage to deb app.</p></body></html> + <html><head/><body><p>这是一款Appimage转制应用.</p></body></html> + + + + Share + Spk分享链接 + + + + APP Feedback + 应用反馈 + + + + Description + 描述 + + + + Screen capture + 屏幕截图 + + + + + + + + Download and Install + 下载并安装 + + + + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> + <html><head/><body><p>支持Ubuntu 22.04</p></body></html> + + + + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> + 这是一款 Wine 应用。星火商店会为你自动配置wine环境 + + + + + <html><head/><body><p>Capable to Debian Stable</p></body></html> + <html><head/><body><p>支持Debian Stable</p></body></html> + + + + Introduction + 介绍 + + + + Update + 更新时间 + + + + Contributor + 投稿用户 + + + + Pkgname + 软件包名 + + + + Author + 软件作者 + + + + Size + 软件大小 + + + + Website + 软件官网 + + + + Click Open + 点击跳转 + + + + Developer Mode Disabled + 开发者模式未开启 + + + + + + Reinstall + 重新安装 + + + + + + Launch + 启动应用 + + + + Upgrade + 升级 + + + + + Install + 安装 + + + + Installing + 正在安装 + + + + + + + + Warning + 警告 + + + + The current application does not support or tested on deepin, there may be problems + 当前应用不支持或未在deepin上测试过,安装后可能会出现问题 + + + + The current application does not support or tested on UOS, there may be problems + 当前应用不支持或未在UOS上测试过,安装后可能会出现问题 + + + + The current application does not support or tested on Ubuntu, there may be problems + 当前应用不支持或未在Ubuntu上测试过,安装后可能会出现问题 + + + + The current application does not support or tested on Debian, there may be problems + 当前应用不支持或未在Debian上测试过,安装后可能会出现问题 + + + + The current application does not support or tested on current platform, there may be problems + 当前应用不支持或未在您的平台上测试过,安装后可能会出现问题 + + + + + Spark Store + 星火应用商店 + + + + Uninstall succeeded + 卸载成功 + + + + The URL has been copied to the clipboard + 链接已复制到剪贴板 + + + + AppListPage + + + Form + + + + + about:blank + + + + + DAboutDialog + + + Version: %1 + 版本:%1 + + + + %1 is released under %2 + %1遵循%2协议发布 + + + + DownloadController + + + Download Failed, please retry :( + 下载失败,请重试 + + + + DownloadItem + + + Form + + + + + icon + + + + + TextLabel + + + + + Name + 软件名 + + + + Waiting to download + 正在等待下载 + + + + Install + 安装 + + + + Cancel + 取消 + + + + Info + 详情 + + + + + Download Complete. + 下载完成. + + + + + + Spark Store + 星火应用商店 + + + + + Installing + 正在安装 + + + + Installation complete. + 安装完成. + + + + + Finish + 完成 + + + + Retry + 重试 + + + + + + Error happened in dpkg progress , please check the install info or try to reinstall. + 安装出现错误,请检查安装详情或尝试重新安装。 + + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. + 安装被中止,请检查安装详情或尝试重新安装。 + + + + + Download canceled + 下载已取消 + + + + DownloadListWidget + + + Form + + + + + The list is currently empty. Go and download some softwares! + 当前下载列表为空。去下载些软件吧! + + + + Open download directory + 打开下载文件夹 + + + + MainWindow + + + MainWindow + + + + + Home + 主页 + + + + Network + 网络 + + + + Chat + 社交 + + + + Music + 音乐 + + + + Video + 视频 + + + + Picture + 图像 + + + + Game + 游戏 + + + + Office + 办公 + + + + Reading + 阅读 + + + + Development + 开发 + + + + Tool + 工具 + + + + Theme + 主题 + + + + Other + 其他 + + + + APP Upgrade + 更新 + + + + Submit App + 投递应用 + + + + Submit App with client(Recommanded) + 使用本地投稿器投递应用(推荐) + + + + Settings + 设置 + + + + APP Upgrade and Install Settings + 应用更新和安装设置 + + + + + Spark Store + 星火应用商店 + + + + Search or enter spk:// + 搜索或打开链接 + + + + QObject + + + + + Spark Store + 星火应用商店 + + + + <span style=' font-size:10pt;font-weight:60;'>An appstore powered by community</span><br/><span style=' font-size:10pt;font-weight:60;'>Sparky is our mascot, designed by <a href='https://tai3.cn/'>Tyson Tan</a></span><br/> + + + + + Spark Project + 星火计划 + + + + Download list + 下载列表 + + + + Show MainWindow + 显示主窗口 + + + + SettingsPage + + + Form + + + + + Line Settings + 线路设置 + + + + Choose Line: + 线路选择: + + + + Refresh + 刷新 + + + + Take effect immediately + 设置后立即生效 + + + + <html><head/><body><p>Check update for Spark Store. </p></body></html> + 检查星火应用商店更新 + + + + Update + 更新 + + + + Spark Store Update + 星火应用商店更新检测 + + + + Other Settings + 其他设置 + + + + Enable notification for apps not compatible with current system + 开启应用不兼容当前系统提示 + + + + Temp + 缓存目录 + + + + Since the dictionary is at /tmp,It would be cleaned automatically when system reboot. + 因为这个目录位于/tmp下,所以即使你不手动清空的话,其也将在系统重启时自动清空。 + + + + 0B + + + + + Location:/tmp/spark-store + 目录位置:/tmp/spark-store + + + + Clean + 清空 + + + + Size: + 目录大小: + + + + Clear Web Cache + 清理网页缓存 + + + + About us + 关于我们 + + + + <html><head/><body><p>Our services and software are free for individuals and non-profit organizations to use, communicate and learn, but you must comply with local laws and regulations in the process of use, otherwise any problems have nothing to do with us. </p><p>We don't make a profit from the Community version store, we rely on donations from the community for most of our operating expenses, and we appreciate that this allows us to spend less energy worrying about money. However, in order to better provide continuous service, Spark is only free for individual users to open the service warehouse, if you or your organization needs to provide commercial services or your organization is a for-profit organization, please contact us to obtain commercial authorization. </p><p>When using the Software, users or organizations are strictly forbidden to engage in any form of malicious behavior, including but not limited to malicious attacks, abuse, destruction, bulk crawling of the software warehouse, etc. The definition of malicious behavior is judged by the Spark community, and violators will be held legally responsible. Spark Community reserves the right to distribute the software packages it produces. </p><p>Any person or organization is prohibited from using the Spark Community software package for commercial purposes or redistributing it without the express authorization of the Spark Community. This clause is intended to ensure the spirit of open source while safeguarding the intellectual property rights of the Spark community. In addition to the above, if you use the Spark Store main program or part of its code, you are subject to all other terms and requirements of the GPL v3.</p><p>If any part of the store infringes your rights, please tell us <a href="mailto:jifengshenmo@outlook.com"><span style=" text-decoration: underline; color:#0082fa;">jifengshenmo@outlook.com</span></a> we will remove the infringing content as soon as possible. </p><p>If you'd like to get involved with us too, whether you're involved in development, design, pitching or submitting work, we welcome you to join us. </p><p><span style=" text-decoration: underline; color:#0000ff;"><br/></span>Our contact method can be found at <a href="https://blog.shenmo.tech/post/%E6%95%85%E9%9A%9C%E5%85%AC%E5%91%8A/"><span style=" text-decoration: underline; color:#0082fa;">Here</span></a></p></body></html> + <html><head/><body><p>我们的服务和软件免费供个人和非营利组织使用、交流和学习,但您在使用过程中必须遵守当地的法律法规,否则出现的任何问题与我们无关。</p><p>我们不从社区版本商店中获利,我们的大部分运营费用依靠社区的捐赠,我们很感激这让我们可以花更少的精力担心钱。但是,为了更好地提供持续的服务,Spark只对个人用户免费开放服务仓库,如果您或您的组织需要提供商业服务或者您的组织是营利性组织,请联系我们获取商业授权。</p><p>严禁用户或组织在使用本软件时从事任何形式的恶意行为,包括但不限于恶意攻击、滥用、破坏、批量抓取软件仓库等。恶意行为的定义由Spark社区判断,违规者将承担法律责任。Spark Community保留发布其生成的软件包的权利。</p><p>未经Spark Community明确授权,禁止任何个人或组织将Spark Community软件包用于商业目的或重新分发。该条款旨在确保开源精神,同时保护Spark社区的知识产权。除此之外,如果您使用Spark Store主程序或其部分代码,则必须遵守GPL v3的所有其他条款和要求。<span style=" font - family:宋体;" <span style=" font - family:宋体;color:#0082fa;">jifengshenmo@outlook.com</span></a>我们会尽快删除侵权内容。</p><p>如果你也想加入我们,无论你是参与开发、设计、推销还是提交作品,我们都欢迎你加入我们。<br/></span>我们的联系方法可以在<a href="https://blog.shenmo.tech/post/%E6%95%85%E9%9A%9C%E5%85%AC%E5%91%8A/"><span style=" text-decoration: underline; color:#0082fa;">找到</span></a></p></body></html> + + + + Updating, please wait... + 正在更新,请稍候…… + + + + Spark Store + 星火应用商店 + + + + Temporary cache was cleaned + 缓存目录已清空 + + + + TitleBarMenu + + + About + 关于 + + + + Exit + 退出 + + + diff --git a/translations/spark-store_zh_TW.ts b/translations/spark-store_zh_TW.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6cf9adeeeed1319063f94453fb577fa0897c716 --- /dev/null +++ b/translations/spark-store_zh_TW.ts @@ -0,0 +1,680 @@ + + + + + AppIntoPage + + + Form + + + + + Uninstall + 移除安裝 + + + + 0 + + + + + Download Times + 下載次數 + + + + + <html><head/><body><p>Capable to deepin 23</p></body></html> + + + + + + <html><head/><body><p>This app can only be installed natively</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian12 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian13 ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to debian SID ACE</p></body></html> + + + + + + <html><head/><body><p>This app will be installed to deepin23 ACE</p></body></html> + + + + + + <html><head/><body><p>This app is developed by community user,we give this tag to honor those who contribute to the Linux Ecology</p></body></html> + <html><head/><body><p>这款应用是社区开发者开发的,我们为社区开发者颁发这款勋章以表彰他们对Linux生态的贡献</p></body></html> + + + + + <html><head/><body><p>Capable to UOS home 20</p></body></html> + <html><head/><body><p>支持UOS家庭版 20</p></body></html> + + + + + <html><head/><body><p>A deepin-wine2 app. Spark Store will automatically configure the wine kit for you.</p></body></html> + 这是一款 deepin-wine2 应用。星火商店会为你自动配置wine环境 + + + + + <html><head/><body><p>This is a DTK5 app,which means it would have better effect on Deepin Desktop Environment</p></body></html> + <html><head/><body><p>这是一款DTK5应用,请使用深度桌面环境来获得最完美的体验</p></body></html> + + + + + <html><head/><body><p>An Appimage to deb app.</p></body></html> + <html><head/><body><p>这是一款Appimage转制应用.</p></body></html> + + + + Share + Spk共享链接 + + + + APP Feedback + 軟件錯誤回報 + + + + Description + 軟體詳細資料 + + + + Screen capture + 軟體演示 + + + + + + + + Download and Install + 下載並安裝 + + + + + <html><head/><body><p>Capable to Ubuntu 22.04</p></body></html> + <html><head/><body><p>支持Ubuntu 22.04</p></body></html> + + + + + <html><head/><body><p>A Wine app.Spark Store will automatically configure the wine kit for you</p></body></html> + 这是一款 Wine 应用。星火商店会为你自动配置wine环境 + + + + + <html><head/><body><p>Capable to Debian Stable</p></body></html> + + + + + Introduction + 軟體介紹 + + + + Update + 更新时间 + + + + Contributor + 投稿用户 + + + + Pkgname + 软件包名 + + + + Author + 软件作者 + + + + Size + 软件大小 + + + + Website + 软件官网 + + + + Click Open + 点击跳转 + + + + Developer Mode Disabled + 开发者模式未开启 + + + + + + Reinstall + 重新安裝 + + + + + + Launch + + + + + Upgrade + 升级 + + + + + Install + 安装 + + + + Installing + 正在安装 + + + + + + + + Warning + + + + + The current application does not support or tested on deepin, there may be problems + + + + + The current application does not support or tested on UOS, there may be problems + + + + + The current application does not support or tested on Ubuntu, there may be problems + + + + + The current application does not support or tested on Debian, there may be problems + + + + + The current application does not support or tested on current platform, there may be problems + + + + + + Spark Store + 星火应用商店 + + + + Uninstall succeeded + 卸载成功 + + + + The URL has been copied to the clipboard + 链接已复制到剪贴板 + + + + AppListPage + + + Form + + + + + about:blank + + + + + DAboutDialog + + + Version: %1 + 版本:%1 + + + + %1 is released under %2 + %1遵循%2协议发布 + + + + DownloadController + + + Download Failed, please retry :( + 下載失敗,請重試 + + + + DownloadItem + + + Form + + + + + icon + + + + + TextLabel + + + + + Name + 软件名 + + + + Waiting to download + 正在等待下载 + + + + Install + 安裝 + + + + Cancel + 取消 + + + + Info + 详情 + + + + + Download Complete. + 下載完成. + + + + + + Spark Store + 星火应用商店 + + + + + Installing + 正在安裝 + + + + Installation complete. + 安裝完成. + + + + + Finish + 完成 + + + + Retry + 重试 + + + + + + Error happened in dpkg progress , please check the install info or try to reinstall. + 安裝出現錯誤,請檢查安裝詳情或嘗試重新安裝。 + + + + + + dpkg progress had been aborted, please check the install info or try to reinstall. + 安裝被中止,請檢查安裝詳情或嘗試重新安裝。 + + + + + Download canceled + 下载已取消 + + + + DownloadListWidget + + + Form + + + + + The list is currently empty. Go and download some softwares! + 当前下载列表为空。去下载些软件吧! + + + + Open download directory + 打开下载文件夹 + + + + MainWindow + + + MainWindow + + + + + Home + 首頁 + + + + Network + 網路 + + + + Chat + 聊天 + + + + Music + 音樂 + + + + Video + 播放 + + + + Picture + 圖片 + + + + Game + 遊戲 + + + + Office + 辦公 + + + + Reading + 閱讀 + + + + Development + 開發 + + + + Tool + 工具 + + + + Theme + 主題 + + + + Other + 其他 + + + + APP Upgrade + 軟體更新 + + + + Submit App + 上傳軟體 + + + + Submit App with client(Recommanded) + 從客戶端上傳軟體(推薦的) + + + + Settings + 設定 + + + + APP Upgrade and Install Settings + 軟體升級 和 安裝設定 + + + + + Spark Store + 星火应用商店 + + + + Search or enter spk:// + 搜索或打开链接 + + + + QObject + + + + + Spark Store + 星火应用商店 + + + + <span style=' font-size:10pt;font-weight:60;'>An appstore powered by community</span><br/><span style=' font-size:10pt;font-weight:60;'>Sparky is our mascot, designed by <a href='https://tai3.cn/'>Tyson Tan</a></span><br/> + + + + + Spark Project + 星火计划 + + + + Download list + 下载列表 + + + + Show MainWindow + 显示主窗口 + + + + SettingsPage + + + Form + + + + + Line Settings + 线路设置 + + + + Choose Line: + 线路选择: + + + + Refresh + 刷新 + + + + Take effect immediately + 设置后立即生效 + + + + <html><head/><body><p>Check update for Spark Store. </p></body></html> + 检查星火应用商店更新 + + + + Update + 更新 + + + + Spark Store Update + 星火应用商店更新检测 + + + + Other Settings + 其他設定 + + + + Enable notification for apps not compatible with current system + 開啟應用不相容當前系統提示 + + + + Temp + 缓存目录 + + + + Since the dictionary is at /tmp,It would be cleaned automatically when system reboot. + 因为这个目录位于/tmp下,所以即使你不手动清空的话,其也将在系统重启时自动清空。 + + + + 0B + + + + + Location:/tmp/spark-store + 目录位置:/tmp/spark-store + + + + Clean + 清空 + + + + Size: + 目录大小: + + + + Clear Web Cache + 清理网页缓存 + + + + About us + 关于我们 + + + + <html><head/><body><p>Our services and software are free for individuals and non-profit organizations to use, communicate and learn, but you must comply with local laws and regulations in the process of use, otherwise any problems have nothing to do with us. </p><p>We don't make a profit from the Community version store, we rely on donations from the community for most of our operating expenses, and we appreciate that this allows us to spend less energy worrying about money. However, in order to better provide continuous service, Spark is only free for individual users to open the service warehouse, if you or your organization needs to provide commercial services or your organization is a for-profit organization, please contact us to obtain commercial authorization. </p><p>When using the Software, users or organizations are strictly forbidden to engage in any form of malicious behavior, including but not limited to malicious attacks, abuse, destruction, bulk crawling of the software warehouse, etc. The definition of malicious behavior is judged by the Spark community, and violators will be held legally responsible. Spark Community reserves the right to distribute the software packages it produces. </p><p>Any person or organization is prohibited from using the Spark Community software package for commercial purposes or redistributing it without the express authorization of the Spark Community. This clause is intended to ensure the spirit of open source while safeguarding the intellectual property rights of the Spark community. In addition to the above, if you use the Spark Store main program or part of its code, you are subject to all other terms and requirements of the GPL v3.</p><p>If any part of the store infringes your rights, please tell us <a href="mailto:jifengshenmo@outlook.com"><span style=" text-decoration: underline; color:#0082fa;">jifengshenmo@outlook.com</span></a> we will remove the infringing content as soon as possible. </p><p>If you'd like to get involved with us too, whether you're involved in development, design, pitching or submitting work, we welcome you to join us. </p><p><span style=" text-decoration: underline; color:#0000ff;"><br/></span>Our contact method can be found at <a href="https://blog.shenmo.tech/post/%E6%95%85%E9%9A%9C%E5%85%AC%E5%91%8A/"><span style=" text-decoration: underline; color:#0082fa;">Here</span></a></p></body></html> + <html><head/><body><p>我们的服务和软件免费供个人和非营利组织使用、交流和学习,但您在使用过程中必须遵守当地的法律法规,否则出现的任何问题与我们无关。</p><p>我们不从社区版本商店中获利,我们的大部分运营费用依靠社区的捐赠,我们很感激这让我们可以花更少的精力担心钱。但是,为了更好地提供持续的服务,Spark只对个人用户免费开放服务仓库,如果您或您的组织需要提供商业服务或者您的组织是营利性组织,请联系我们获取商业授权。</p><p>严禁用户或组织在使用本软件时从事任何形式的恶意行为,包括但不限于恶意攻击、滥用、破坏、批量抓取软件仓库等。恶意行为的定义由Spark社区判断,违规者将承担法律责任。Spark Community保留发布其生成的软件包的权利。</p><p>未经Spark Community明确授权,禁止任何个人或组织将Spark Community软件包用于商业目的或重新分发。该条款旨在确保开源精神,同时保护Spark社区的知识产权。除此之外,如果您使用Spark Store主程序或其部分代码,则必须遵守GPL v3的所有其他条款和要求。<span style=" font - family:宋体;" <span style=" font - family:宋体;color:#0082fa;">jifengshenmo@outlook.com</span></a>我们会尽快删除侵权内容。</p><p>如果你也想加入我们,无论你是参与开发、设计、推销还是提交作品,我们都欢迎你加入我们。<br/></span>我们的联系方法可以在<a href="https://blog.shenmo.tech/post/%E6%95%85%E9%9A%9C%E5%85%AC%E5%91%8A/"><span style=" text-decoration: underline; color:#0082fa;">找到</span></a></p></body></html> + + + + Updating, please wait... + 正在更新,请稍候…… + + + + Spark Store + 星火应用商店 + + + + Temporary cache was cleaned + 缓存目录已清空 + + + + TitleBarMenu + + + About + 关于 + + + + Exit + 退出 + + +