├── .clog.toml ├── .github └── workflows │ ├── backup-to-gitlab.yml │ ├── call-auto-tag.yml │ ├── call-build-distribution.yml │ ├── call-chatOps.yml │ ├── call-clacheck.yml │ ├── call-commitlint.yml │ ├── call-license-check.yml │ └── cppcheck.yml ├── .gitignore ├── .obs └── workflows.yml ├── .project.json ├── .reuse └── dep5 ├── .tx ├── config ├── deepin.conf ├── transifex.yaml └── ts2desktop ├── CHANGELOG.md ├── CMakeLists.txt ├── LICENSE ├── LICENSES ├── CC-BY-4.0.txt ├── CC0-1.0.txt ├── GPL-3.0-or-later.txt └── LGPL-3.0-or-later.txt ├── README.md ├── README.zh_CN.md ├── arm64 └── linglong.yaml ├── debian ├── changelog ├── compat ├── control ├── copyright ├── deepin-font-manager.1 ├── manpages ├── rules └── source │ └── format ├── deepin-font-manager-assets ├── add-font-hover.svg ├── add-font-normal.svg ├── add-font-press.svg ├── checkbox_unchecked_dark.svg ├── checkbox_unchecked_light.svg ├── close_hover.svg ├── close_normal.svg ├── close_press.svg ├── collection_hover.svg ├── collection_normal.svg ├── collection_press.svg ├── contents.txt ├── dark_collection_hover.svg ├── dark_collection_normal.svg ├── dark_uncollection_hover.svg ├── dark_uncollection_normal.svg ├── deepin-font-manager.desktop ├── deepin-font-manager.qrc ├── deepin-font-manager.svg ├── deepin-font-manager │ └── font-manager │ │ ├── common │ │ ├── add.svg │ │ ├── add_normal.svg │ │ ├── attention.svg │ │ ├── close_icon.svg │ │ ├── collection_normal.svg │ │ ├── deepin-font-manager.svg │ │ ├── deepin_font_manager.svg │ │ ├── deepin_launcher.svg │ │ ├── icon_menu.svg │ │ ├── icon_plus.svg │ │ ├── notes.svg │ │ ├── plus.svg │ │ ├── search.svg │ │ ├── tips.svg │ │ ├── uncollection.svg │ │ └── uncollection_normal.svg │ │ ├── en_US │ │ ├── fig │ │ │ ├── font_delete.png │ │ │ ├── hotkey.png │ │ │ ├── info.png │ │ │ └── main.png │ │ └── font-manager.md │ │ ├── zh_CN │ │ ├── fig │ │ │ ├── delete.png │ │ │ ├── hotkey.png │ │ │ ├── info.png │ │ │ ├── main.png │ │ │ ├── multi.png │ │ │ ├── p_multi.png │ │ │ ├── p_single.png │ │ │ └── single.png │ │ └── font-manager.md │ │ ├── zh_HK │ │ ├── fig │ │ │ ├── delete.png │ │ │ ├── hotkey.png │ │ │ ├── info.png │ │ │ ├── main.png │ │ │ ├── multi.png │ │ │ └── single.png │ │ └── font-manager.md │ │ └── zh_TW │ │ ├── fig │ │ ├── font_delete.png │ │ ├── hotkey.png │ │ ├── info.png │ │ ├── main.png │ │ ├── multi.png │ │ └── single.png │ │ └── font-manager.md ├── exception-logo.svg ├── font-info-logo.svg ├── font-manager_pm.sh ├── font-x-generic.svg ├── font_loaded.svg ├── font_unload.svg ├── icon.svg ├── ok.svg ├── split_line.svg ├── translate_generation.sh ├── uncollection_hover.svg ├── uncollection_normal.svg └── uncollection_press.svg ├── deepin-font-manager ├── .gitignore ├── CMakeLists.txt ├── environments.h.in ├── globaldef.h ├── interfaces │ ├── dcomworker.cpp │ ├── dcomworker.h │ ├── dfmxmlwrapper.cpp │ ├── dfmxmlwrapper.h │ ├── dfontbasedialog.cpp │ ├── dfontbasedialog.h │ ├── dfontmenumanager.cpp │ ├── dfontmenumanager.h │ ├── dfontpreviewer.cpp │ ├── dfontpreviewer.h │ ├── dfontpreviewitemdelegate.cpp │ ├── dfontpreviewitemdelegate.h │ ├── dfontpreviewlistdatathread.cpp │ ├── dfontpreviewlistdatathread.h │ ├── dfontpreviewlistview.cpp │ ├── dfontpreviewlistview.h │ ├── dfontpreviewproxymodel.cpp │ ├── dfontpreviewproxymodel.h │ ├── getuseraddfontthread.cpp │ ├── getuseraddfontthread.h │ ├── loadfontdatathread.cpp │ └── loadfontdatathread.h ├── main.cpp ├── performancemonitor.cpp ├── performancemonitor.h ├── singlefontapplication.cpp ├── singlefontapplication.h ├── utils.cpp ├── utils.h └── views │ ├── dfdeletedialog.cpp │ ├── dfdeletedialog.h │ ├── dfinstallerrordialog.cpp │ ├── dfinstallerrordialog.h │ ├── dfinstallerroritemmodel.h │ ├── dfinstallerrorlistview.cpp │ ├── dfinstallerrorlistview.h │ ├── dfinstallnormalwindow.cpp │ ├── dfinstallnormalwindow.h │ ├── dfontinfodialog.cpp │ ├── dfontinfodialog.h │ ├── dfontinfoscrollarea.cpp │ ├── dfontinfoscrollarea.h │ ├── dfontmgrmainwindow.cpp │ ├── dfontmgrmainwindow.h │ ├── dfontspinner.cpp │ ├── dfontspinner.h │ ├── dfontspinnerwidget.cpp │ ├── dfontspinnerwidget.h │ ├── dfquickinstallwindow.cpp │ ├── dfquickinstallwindow.h │ ├── dsplitlistwidget.cpp │ ├── dsplitlistwidget.h │ ├── fonticontext.cpp │ └── fonticontext.h ├── deepin-font-preview-plugin ├── CMakeLists.txt ├── deepin-font-preview-plugin.json ├── deepin-font-preview-plugin.pro ├── fontpreview.cpp ├── fontpreview.h └── main.cpp ├── deploy_dep ├── install_dep ├── libdeepin-font-manager ├── dcopyfilesmanager.cpp ├── dcopyfilesmanager.h ├── dfmdbmanager.cpp ├── dfmdbmanager.h ├── dfontinfomanager.cpp ├── dfontinfomanager.h ├── dfontloadthread.cpp ├── dfontloadthread.h ├── dfontpreview.cpp ├── dfontpreview.h ├── dfontpreviewitemdef.h ├── dfontwidget.cpp ├── dfontwidget.h ├── dsqliteutil.cpp ├── dsqliteutil.h ├── fontmanagercore.cpp ├── fontmanagercore.h ├── pkgconfig │ └── deepin-font-manager.pc ├── schemas │ └── com.deepin.font-manager.gschema.xml ├── signalmanager.cpp └── signalmanager.h ├── linglong.yaml ├── loong64 └── linglong.yaml ├── tests ├── CMakeLists.txt ├── cmake-lcov-test.sh ├── include │ └── commonheaderfile.h ├── src │ ├── deepin-font-manager-test │ │ ├── interfaces │ │ │ ├── ut_dfmxmlwrapper.cpp │ │ │ ├── ut_dfontbasedialog.cpp │ │ │ ├── ut_dfontmenumanager.cpp │ │ │ ├── ut_dfontpreviewitemdelegate.cpp │ │ │ ├── ut_dfontpreviewlistdatathread.cpp │ │ │ ├── ut_dfontpreviewlistview.cpp │ │ │ ├── ut_dfontpreviewproxymodel.cpp │ │ │ ├── ut_getuseraddfontthread.cpp │ │ │ └── ut_loadfontdatathread.cpp │ │ ├── ut_utils.cpp │ │ └── views │ │ │ ├── ut_dfdeletedialog.cpp │ │ │ ├── ut_dfinstallerrordialog.cpp │ │ │ ├── ut_dfinstallerrorlistview.cpp │ │ │ ├── ut_dfinstallnormalwindow.cpp │ │ │ ├── ut_dfontInfo.cpp │ │ │ ├── ut_dfontinfodialog.cpp │ │ │ ├── ut_dfontmgrmainwindow.cpp │ │ │ ├── ut_dfontspinner.cpp │ │ │ ├── ut_dfontspinnerwidget.cpp │ │ │ ├── ut_dfquickinstallwindow.cpp │ │ │ ├── ut_dsplitlistwidget.cpp │ │ │ └── ut_fonticontext.cpp │ ├── main.cpp │ ├── ut_dcopyfilesmanager.cpp │ ├── ut_dfmdbmanager.cpp │ ├── ut_dfontloadthread.cpp │ ├── ut_dfontmanager.cpp │ ├── ut_dfontpreview.cpp │ ├── ut_dfontpreviewLib.cpp │ ├── ut_dfontpreviewitemdef.cpp │ ├── ut_dfontwidget.cpp │ ├── ut_dsqliteutil.cpp │ └── ut_performancemonitor.cpp ├── test-prj-running.sh └── third-party │ └── stub │ ├── addr_pri.h │ └── stub.h ├── translations ├── deepin-font-manager.ts ├── deepin-font-manager_am_ET.ts ├── deepin-font-manager_ar.ts ├── deepin-font-manager_ast.ts ├── deepin-font-manager_az.ts ├── deepin-font-manager_bg.ts ├── deepin-font-manager_bn.ts ├── deepin-font-manager_bo.ts ├── deepin-font-manager_br.ts ├── deepin-font-manager_ca.ts ├── deepin-font-manager_cs.ts ├── deepin-font-manager_da.ts ├── deepin-font-manager_de.ts ├── deepin-font-manager_el.ts ├── deepin-font-manager_en.ts ├── deepin-font-manager_es.ts ├── deepin-font-manager_et.ts ├── deepin-font-manager_fi.ts ├── deepin-font-manager_fr.ts ├── deepin-font-manager_gl_ES.ts ├── deepin-font-manager_he.ts ├── deepin-font-manager_hi_IN.ts ├── deepin-font-manager_hr.ts ├── deepin-font-manager_hu.ts ├── deepin-font-manager_id.ts ├── deepin-font-manager_it.ts ├── deepin-font-manager_ja.ts ├── deepin-font-manager_ko.ts ├── deepin-font-manager_lt.ts ├── deepin-font-manager_mn.ts ├── deepin-font-manager_ms.ts ├── deepin-font-manager_ne.ts ├── deepin-font-manager_nl.ts ├── deepin-font-manager_pl.ts ├── deepin-font-manager_pt.ts ├── deepin-font-manager_pt_BR.ts ├── deepin-font-manager_ro.ts ├── deepin-font-manager_ru.ts ├── deepin-font-manager_sk.ts ├── deepin-font-manager_sl.ts ├── deepin-font-manager_sq.ts ├── deepin-font-manager_sr.ts ├── deepin-font-manager_tr.ts ├── deepin-font-manager_ug.ts ├── deepin-font-manager_uk.ts ├── deepin-font-manager_vi.ts ├── deepin-font-manager_zh_CN.ts ├── deepin-font-manager_zh_HK.ts ├── deepin-font-manager_zh_TW.ts └── desktop │ ├── desktop.ts │ ├── desktop_ar.ts │ ├── desktop_ast.ts │ ├── desktop_az.ts │ ├── desktop_bg.ts │ ├── desktop_bn.ts │ ├── desktop_bo.ts │ ├── desktop_br.ts │ ├── desktop_ca.ts │ ├── desktop_cs.ts │ ├── desktop_da.ts │ ├── desktop_de.ts │ ├── desktop_el.ts │ ├── desktop_es.ts │ ├── desktop_et.ts │ ├── desktop_fi.ts │ ├── desktop_fr.ts │ ├── desktop_gl_ES.ts │ ├── desktop_he.ts │ ├── desktop_hi_IN.ts │ ├── desktop_hr.ts │ ├── desktop_hu.ts │ ├── desktop_id.ts │ ├── desktop_it.ts │ ├── desktop_ja.ts │ ├── desktop_ko.ts │ ├── desktop_lt.ts │ ├── desktop_mn.ts │ ├── desktop_ms.ts │ ├── desktop_ne.ts │ ├── desktop_nl.ts │ ├── desktop_pl.ts │ ├── desktop_pt.ts │ ├── desktop_pt_BR.ts │ ├── desktop_ro.ts │ ├── desktop_ru.ts │ ├── desktop_si.ts │ ├── desktop_sk.ts │ ├── desktop_sl.ts │ ├── desktop_sq.ts │ ├── desktop_sr.ts │ ├── desktop_tr.ts │ ├── desktop_ug.ts │ ├── desktop_uk.ts │ ├── desktop_vi.ts │ ├── desktop_zh_CN.ts │ ├── desktop_zh_HK.ts │ └── desktop_zh_TW.ts └── updateTranslation.sh /.clog.toml: -------------------------------------------------------------------------------- 1 | [clog] 2 | repository = "https://github.com/linuxdeepin/deepin-font-installer" 3 | from-latest-tag = true 4 | 5 | changelog = "CHANGELOG.md" 6 | -------------------------------------------------------------------------------- /.github/workflows/backup-to-gitlab.yml: -------------------------------------------------------------------------------- 1 | name: backup to gitlab 2 | on: [push] 3 | 4 | concurrency: 5 | group: ${{ github.workflow }} 6 | cancel-in-progress: true 7 | 8 | jobs: 9 | backup-to-gitlabwh: 10 | uses: linuxdeepin/.github/.github/workflows/backup-to-gitlabwh.yml@master 11 | secrets: inherit 12 | 13 | backup-to-gitee: 14 | uses: linuxdeepin/.github/.github/workflows/backup-to-gitee.yml@master 15 | secrets: inherit 16 | -------------------------------------------------------------------------------- /.github/workflows/call-auto-tag.yml: -------------------------------------------------------------------------------- 1 | name: auto tag 2 | 3 | on: 4 | pull_request_target: 5 | types: [opened, synchronize, closed] 6 | paths: 7 | - "debian/changelog" 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | auto_tag: 15 | uses: linuxdeepin/.github/.github/workflows/auto-tag.yml@master 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /.github/workflows/call-build-distribution.yml: -------------------------------------------------------------------------------- 1 | name: Call build-distribution 2 | on: 3 | push: 4 | paths-ignore: 5 | - ".github/workflows/**" 6 | pull_request_target: 7 | paths-ignore: 8 | - ".github/workflows/**" 9 | 10 | jobs: 11 | check_job: 12 | uses: linuxdeepin/.github/.github/workflows/build-distribution.yml@master 13 | secrets: inherit 14 | -------------------------------------------------------------------------------- /.github/workflows/call-chatOps.yml: -------------------------------------------------------------------------------- 1 | name: chatOps 2 | on: 3 | issue_comment: 4 | types: [created] 5 | 6 | jobs: 7 | chatopt: 8 | uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master 9 | secrets: inherit 10 | -------------------------------------------------------------------------------- /.github/workflows/call-clacheck.yml: -------------------------------------------------------------------------------- 1 | name: Call CLA check 2 | on: 3 | issue_comment: 4 | types: [created] 5 | pull_request_target: 6 | types: [opened, closed, synchronize] 7 | 8 | concurrency: 9 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 10 | cancel-in-progress: true 11 | 12 | jobs: 13 | clacheck: 14 | uses: linuxdeepin/.github/.github/workflows/cla-check.yml@master 15 | secrets: inherit 16 | -------------------------------------------------------------------------------- /.github/workflows/call-commitlint.yml: -------------------------------------------------------------------------------- 1 | name: Call commitlint 2 | on: 3 | pull_request_target: 4 | 5 | concurrency: 6 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 7 | cancel-in-progress: true 8 | 9 | jobs: 10 | check_job: 11 | uses: linuxdeepin/.github/.github/workflows/commitlint.yml@master 12 | -------------------------------------------------------------------------------- /.github/workflows/call-license-check.yml: -------------------------------------------------------------------------------- 1 | name: Call License and README Check 2 | on: 3 | pull_request_target: 4 | types: [opened, synchronize, reopened] 5 | 6 | permissions: 7 | pull-requests: write 8 | contents: read 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | license-check: 16 | uses: linuxdeepin/.github/.github/workflows/license-check.yml@master 17 | -------------------------------------------------------------------------------- /.github/workflows/cppcheck.yml: -------------------------------------------------------------------------------- 1 | name: cppcheck 2 | on: 3 | pull_request_target: 4 | paths-ignore: 5 | - ".github/workflows/**" 6 | 7 | concurrency: 8 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | cppchceck: 13 | name: cppcheck 14 | runs-on: ubuntu-latest 15 | steps: 16 | - run: export 17 | - uses: actions/checkout@v3 18 | with: 19 | ref: ${{ github.event.pull_request.head.sha }} 20 | persist-credentials: false 21 | - uses: linuxdeepin/action-cppcheck@main 22 | with: 23 | github_token: ${{ secrets.GITHUB_TOKEN }} 24 | repository: ${{ github.repository }} 25 | pull_request_id: ${{ github.event.pull_request.number }} 26 | allow_approve: false 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | moc_*.o 3 | moc_*.cpp 4 | *.o 5 | *.qm 6 | build/ 7 | *.pro.user 8 | *.user 9 | obj-x86_64-linux-gnu 10 | .vscode/ 11 | 12 | #linglong building dir 13 | linglong 14 | build 15 | -------------------------------------------------------------------------------- /.obs/workflows.yml: -------------------------------------------------------------------------------- 1 | test_build: 2 | steps: 3 | - link_package: 4 | source_project: deepin:Develop:dde 5 | source_package: %{SCM_REPOSITORY_NAME} 6 | target_project: deepin:CI 7 | 8 | - configure_repositories: 9 | project: deepin:CI 10 | repositories: 11 | - name: deepin_develop 12 | paths: 13 | - target_project: deepin:CI 14 | target_repository: deepin_develop 15 | architectures: 16 | - x86_64 17 | - aarch64 18 | 19 | filters: 20 | event: pull_request 21 | 22 | tag_build: 23 | steps: 24 | - branch_package: 25 | source_project: deepin:Develop:dde 26 | source_package: %{SCM_REPOSITORY_NAME} 27 | target_project: deepin:Unstable:dde 28 | filters: 29 | event: tag_push 30 | 31 | commit_build: 32 | steps: 33 | - trigger_services: 34 | project: deepin:Develop:dde 35 | package: %{SCM_REPOSITORY_NAME} 36 | filters: 37 | event: push 38 | -------------------------------------------------------------------------------- /.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "homebrew", 3 | "3rdparty": [], 4 | "ignore": ["debian", ".git", "deepin-font-manager-assets", "translations", ".tx", "README.md", "LICENSE"], 5 | "license": ["GPLv3"] 6 | } 7 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: deepin-font-manager 3 | Upstream-Contact: UnionTech Software Technology Co., Ltd. <> 4 | Source: https://github.com/linuxdeepin/deepin-font-manager 5 | 6 | # ci 7 | Files: .github/* .obs/* 8 | Copyright: None 9 | License: CC0-1.0 10 | 11 | # gitignore 12 | Files: .gitignore 13 | Copyright: None 14 | License: CC0-1.0 15 | 16 | # xml toml json conf yaml sh 17 | Files: *.toml *.json *conf *.yaml *.sh 18 | Copyright: None 19 | License: CC0-1.0 20 | 21 | # debian 22 | Files: debian/* 23 | Copyright: None 24 | License: CC0-1.0 25 | 26 | # rpm 27 | Files: rpm/* 28 | Copyright: None 29 | License: CC0-1.0 30 | 31 | # Project file 32 | Files: *.pro *.prf *.pri *.qrc *CMakeLists.txt .tx/* 33 | Copyright: None 34 | License: CC0-1.0 35 | 36 | # README 37 | Files: README.md README.zh_CN.md 38 | Copyright: UnionTech Software Technology Co., Ltd. 39 | License: CC-BY-4.0 40 | 41 | # assets 42 | Files: assets/* 43 | Copyright: None 44 | License: LGPL-3.0-or-later 45 | 46 | # translations 47 | Files: translations/* 48 | Copyright: UnionTech Software Technology Co., Ltd. 49 | License: LGPL-3.0-or-later 50 | 51 | # src 52 | Files: src/* 53 | Copyright: UnionTech Software Technology Co., Ltd. 54 | License: GPL-3.0-or-later 55 | 56 | # tests 57 | Files: tests/* 58 | Copyright: UnionTech Software Technology Co., Ltd. 59 | License: GPL-3.0-or-later 60 | 61 | # deepin-font-manager 62 | Files: deepin-font-manager/* 63 | Copyright: UnionTech Software Technology Co., Ltd. 64 | License: GPL-3.0-or-later 65 | 66 | # deepin-font-manager-assets 67 | Files: deepin-font-manager-assets/* 68 | Copyright: UnionTech Software Technology Co., Ltd. 69 | License: GPL-3.0-or-later 70 | 71 | # deepin-font-preview-plugin 72 | Files: deepin-font-preview-plugin/* 73 | Copyright: UnionTech Software Technology Co., Ltd. 74 | License: GPL-3.0-or-later 75 | 76 | # libdeepin-font-manager 77 | Files: libdeepin-font-manager/* 78 | Copyright: UnionTech Software Technology Co., Ltd. 79 | License: GPL-3.0-or-later 80 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | minimum_perc = 80 4 | mode = developer 5 | 6 | [deepin-font-manager.deepin-font-manager] 7 | file_filter = translations/deepin-font-manager_.ts 8 | source_file = translations/deepin-font-manager.ts 9 | source_lang = en_US 10 | type = QT 11 | 12 | [deepin-font-manager.deepin-font-manager-desktop] 13 | file_filter = translations/desktop/desktop_.ts 14 | source_file = translations/desktop/desktop.ts 15 | source_lang = en 16 | type = QT 17 | -------------------------------------------------------------------------------- /.tx/deepin.conf: -------------------------------------------------------------------------------- 1 | [transifex] 2 | branch = m20 3 | -------------------------------------------------------------------------------- /.tx/transifex.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. 2 | # 3 | # SPDX-License-Identifier: CC0-1.0 4 | filters: 5 | - filter_type: file 6 | source_file: translations/deepin-font-manager.ts 7 | file_format: QT 8 | source_language: en_US 9 | translation_files_expression: translations/deepin-font-manager_.ts 10 | - filter_type: file 11 | source_file: translations/desktop/desktop.ts 12 | file_format: QT 13 | source_language: en_US 14 | translation_files_expression: translations/desktop/desktop_.ts 15 | settings: 16 | pr_branch_name: transifex_update_ 17 | -------------------------------------------------------------------------------- /.tx/ts2desktop: -------------------------------------------------------------------------------- 1 | DESKTOP_TEMP_FILE=deepin-font-manager.desktop.tmp 2 | DESKTOP_SOURCE_FILE=deepin-font-manager/deepin-font-manager.desktop 3 | DESKTOP_DEST_FILE=deepin-font-manager/deepin-font-manager.desktop 4 | DESKTOP_TS_DIR=deepin-font-manager/translations/desktop 5 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #/***************************************************************************** 2 | #* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 3 | #* 4 | #* Author: Xiao Zhiguo 5 | #* Date: 2020-09-09 6 | #* 7 | #* Maintainer: Xiao Zhiguo 8 | #* 9 | #* This program is free software: you can redistribute it and/or modify 10 | #* it under the terms of the GNU General Public License as published by 11 | #* the Free Software Foundation, either version 3 of the License, or 12 | #* any later version. 13 | #* 14 | #* This program is distributed in the hope that it will be useful, 15 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | #* GNU General Public License for more details. 18 | #* 19 | #* You should have received a copy of the GNU General Public License 20 | #* along with this program. If not, see . 21 | #* 22 | #*****************************************************************************/ 23 | 24 | CMAKE_MINIMUM_REQUIRED(VERSION 3.7) 25 | 26 | PROJECT(font-manager) 27 | 28 | IF (NOT DEFINED VERSION) 29 | SET(VERSION 1.0.0) 30 | ENDIF() 31 | 32 | SET(CMAKE_CXX_STANDARD 11) 33 | SET(CMAKE_CXX_EXTENSIONS OFF) 34 | SET(CMAKE_CXX_STANDARD_REQUIRED ON) 35 | SET(CMAKE_AUTOMOC ON) 36 | SET(CMAKE_AUTORCC ON) 37 | SET(CMAKE_VERBOSE_MAKEFILE ON) 38 | 39 | set(QT_VERSION_MAJOR 6) 40 | if (${QT_VERSION_MAJOR} GREATER_EQUAL 6) 41 | set(DTK_VERSION 6) 42 | endif() 43 | 44 | FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Svg Sql Xml DBus Network LinguistTools REQUIRED) 45 | FIND_PACKAGE(Dtk${DTK_VERSION}Widget REQUIRED) 46 | FIND_PACKAGE(Dtk${DTK_VERSION}Gui REQUIRED) 47 | FIND_PACKAGE(Freetype REQUIRED) 48 | FIND_PACKAGE(PkgConfig REQUIRED) 49 | 50 | #社区版上 MOC 时,会缺少 include 路径 /usr/include, 51 | #暂未找到原因,先手动添加 /usr/include 规避 52 | INCLUDE_DIRECTORIES(/usr/include/) 53 | 54 | PKG_SEARCH_MODULE(FontConfig REQUIRED fontconfig IMPORTED_TARGET) 55 | #PKG_SEARCH_MODULE(QGsettings REQUIRED gsettings-qt IMPORTED_TARGET) 56 | 57 | #CMAKE 3.14版本才有的模块 58 | #INCLUDE(FindFontconfig) 59 | include(GNUInstallDirs) 60 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 61 | set(CMAKE_INSTALL_PREFIX /usr) 62 | endif () 63 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ") 64 | 65 | #安全编译参数 66 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy") 67 | 68 | IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "sw_64") 69 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mieee") 70 | ENDIF() 71 | IF (CMAKE_BUILD_TYPE MATCHES "Debug") 72 | # Enable Qt builtin debug mode 73 | ADD_DEFINITIONS("-DQT_MESSAGELOGCONTEXT") 74 | ADD_SUBDIRECTORY(tests) 75 | ENDIF() 76 | ADD_SUBDIRECTORY(deepin-font-manager) 77 | ADD_SUBDIRECTORY(deepin-font-preview-plugin) 78 | 79 | #安装帮助手册需要文件 80 | install(DIRECTORY ${CMAKE_SOURCE_DIR}/deepin-font-manager-assets/deepin-font-manager 81 | DESTINATION ${CMAKE_INSTALL_DATADIR}/deepin-manual/manual-assets/application/) 82 | 83 | #代码覆盖率开关 84 | if(CMAKE_COVERAGE_ARG STREQUAL "CMAKE_COVERAGE_ARG_ON") 85 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -fprofile-arcs -ftest-coverage") 86 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -fprofile-arcs -ftest-coverage") 87 | endif() 88 | 89 | 90 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deepin Font Manager 2 | 3 | Deepin Font Manager is used to install and uninstall font file for users with bulk install function. 4 | 5 | ## Dependencies 6 | 7 | * sudo apt install libdtkwidget-dev qttools5-dev-tools libfontconfig1-dev libfreetype6-dev libdde-file-manager-dev 8 | 9 | ## Installation 10 | 11 | * mkdir build 12 | * cd build 13 | * qmake .. 14 | * make 15 | 16 | ## Usage 17 | 18 | * ./deepin-font-manager 19 | 20 | ## Getting help 21 | 22 | Any usage issues can ask for help via 23 | 24 | * [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) 25 | * [IRC channel](https://webchat.freenode.net/?channels=deepin) 26 | * [Forum](https://bbs.deepin.org) 27 | * [WiKi](https://wiki.deepin.org/) 28 | 29 | ## Getting involved 30 | 31 | We encourage you to report issues and contribute changes 32 | 33 | * [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). (English) 34 | * [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) (中文) 35 | 36 | ## License 37 | 38 | Deepin Font Manager is licensed under [GPL-3.0-or-later](LICENSE). 39 | 40 | -------------------------------------------------------------------------------- /README.zh_CN.md: -------------------------------------------------------------------------------- 1 | # Deepin Font Manager 2 | 3 | 深度字体管理器用于为具有批量安装功能的用户安装和卸载字体文件。 4 | 5 | ## 依赖关系 6 | 7 | * sudo apt install libdtkwidget-dev qttools5-dev-tools libfontconfig1-dev libfreetype6-dev libdde-file-manager-dev 8 | 9 | ## 安装 10 | 11 | * mkdir build 12 | * cd build 13 | * qmake .. 14 | * make 15 | 16 | ## 用法 17 | 18 | * ./deepin-font-manager 19 | 20 | ## 帮助 21 | 22 | Any usage issues can ask for help via 23 | 24 | * [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) 25 | * [IRC channel](https://webchat.freenode.net/?channels=deepin) 26 | * [Forum](https://bbs.deepin.org) 27 | * [WiKi](https://wiki.deepin.org/) 28 | 29 | ## 参与贡献 30 | 31 | We encourage you to report issues and contribute changes 32 | 33 | * [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). (English) 34 | * [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) (中文) 35 | 36 | ## 证书 37 | 38 | Deepin Font Manager 根据 [GPL-3.0-or-later](LICENSE)获得许可. 39 | 40 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: deepin-font-manager 2 | Section: utils 3 | Priority: optional 4 | Maintainer: Rekols 5 | Build-Depends: 6 | debhelper (>= 9), 7 | pkg-config, 8 | cmake, 9 | libdtk6widget-dev, 10 | libdtk6gui-dev, 11 | qt6-base-dev, 12 | qt6-tools-dev, 13 | qt6-tools-dev-tools, 14 | qt6-svg-dev, 15 | libfontconfig1-dev, 16 | libfreetype6-dev, 17 | dde-file-manager-dev | libdde-file-manager-dev, 18 | deepin-gettext-tools, 19 | libgtest-dev 20 | Standards-Version: 3.9.8 21 | Homepage: http://www.deepin.org 22 | 23 | Package: deepin-font-manager 24 | Architecture: any 25 | Depends: ${shlibs:Depends}, ${misc:Depends} 26 | Recommends: uos-reporter, deepin-event-log 27 | Replaces: deepin-font-installer 28 | Conflicts: deepin-font-installer 29 | Description: Deepin Font Manager binary 30 | Font manager is a powerful font management tool. With Font Manager, you are not only able to search, install, enable, disable and delete fonts among others, but also preview fonts by inputting texts and setting the text size. It supports fonts in ttf, ttc and otf formats. 31 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: deepin-font-manager 3 | 4 | Files: * 5 | Copyright: 2017 Deepin Technology Co., Ltd. 6 | License: GPL-3+ 7 | This package is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | . 12 | This package is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | . 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see 19 | . 20 | On Debian systems, the complete text of the GNU General 21 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". 22 | -------------------------------------------------------------------------------- /debian/deepin-font-manager.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .\" (C) Copyright 2022 UnionTech Software Technology Co., Ltd, 3 | .\" 4 | .TH "deepin-font-manager" "1" "2021-3-11" "Deepin" 5 | .\" Please adjust this date whenever revising the manpage. 6 | .\" 7 | .\" Some roff macros, for reference: 8 | .\" .nh disable hyphenation 9 | .\" .hy enable hyphenation 10 | .\" .ad l left justify 11 | .\" .ad b justify to both left and right margins 12 | .\" .nf disable filling 13 | .\" .fi enable filling 14 | .\" .br insert line break 15 | .\" .sp insert n+1 empty lines 16 | .\" for manpage-specific macros, see man(7) 17 | .SH NAME 18 | deepin-font-manager. 19 | .SH SYNOPSIS 20 | deepin-font-manager [Files(s)...] 21 | .SH DESCRIPTION 22 | Deepin Font Manager binary. 23 | .PP 24 | Font manager is a powerful font management tool. With Font Manager, you are not only able to search, install, enable, disable and delete fonts among others, but also preview fonts by inputting texts and setting the text size. It supports fonts in ttf, ttc and otf formats. 25 | .SH OPTIONS 26 | .PP 27 | -h show help info 28 | .PP 29 | -v show version 30 | .SH SEE ALSO 31 | https://github.com/linuxdeepin/deepin-font-manager 32 | .SH AUTHOR 33 | .PP 34 | .B deepin-font-manager 35 | is written by Deepin Technology Co., Ltd. 36 | .PP 37 | This manual page was written by 38 | .MT kongyunzhen@\:uniontech.com 39 | Kong Yun Zhen 40 | .ME 41 | for the Debian Project (but may be used by others) 42 | -------------------------------------------------------------------------------- /debian/manpages: -------------------------------------------------------------------------------- 1 | debian/deepin-font-manager.1 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | export QT_SELECT=5 4 | include /usr/share/dpkg/default.mk 5 | 6 | DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) 7 | 8 | DH_AUTO_ARGS = --parallel --buildsystem=cmake 9 | 10 | # Uncomment this to turn on verbose mode. 11 | export DH_VERBOSE=1 12 | 13 | %: 14 | dh $@ --parallel 15 | 16 | override_dh_shlibdeps: 17 | dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info -l$(shell pwd)/debian/dde-sharefiles/usr/share/deepin-font-manager/sharefiles/lib 18 | 19 | override_dh_auto_configure: 20 | dh_auto_configure -- \ 21 | -DCMAKE_BUILD_TYPE=Release \ 22 | -DCMAKE_SAFETYTEST_ARG="CMAKE_SAFETYTEST_ARG_OFF" \ 23 | -DAPP_VERSION=$(DEB_VERSION_UPSTREAM) -DVERSION=$(DEB_VERSION_UPSTREAM) LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) 24 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/add-font-hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | add-hover 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/add-font-normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | add-normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/add-font-press.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | add-press 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/checkbox_unchecked_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | checkbox_unchecked 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/checkbox_unchecked_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | checkbox_unchecked 2 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/close_hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | active_tab_close_hover 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/close_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | active_tab_close_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/close_press.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | active_tab_close_press 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/collection_hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | collection_hover 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/collection_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | collection_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/collection_press.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | collection_press 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/contents.txt: -------------------------------------------------------------------------------- 1 | fa:تلاش برای تغییر 2 | am_ET:ጠንክረን በ መስራት እንፈጥራለን 3 | ku_IQ:ئێمە ئەنجامی دەدەین ئێمە دەگۆڕێین... 4 | ar:نحن نستطيع التغيير 5 | bn_BD:নতুনের প্রত্যয়ে সর্বদা সচেষ্ট 6 | zh_CN:改变只为更好 7 | zh_TW:改變只為更好 8 | en:We do we change... 9 | cs:Pracujeme pilně a zavádíme novinky. 10 | fr:Nous créons, nous innovons. 11 | de:Wir sind die Veränderung! 12 | it:Noi facciamo, noi cambiamo 13 | pt:Fazemos a mudança 14 | ru:Съешь мягких булочек и выпей чаю 15 | sr:Ми радимо, ми стварамо... 16 | si:Spremembe in razvoj - naše poslanstvo! 17 | es:Lo hacemos, cambiamos. 18 | tr:Biz değiştiririz 19 | uk:Ми працюємо та змінюємось... 20 | ca:Fem, innovem... 21 | sr:Mi radimo. Mi menjamo 22 | sr:Ми радимо. Ми мењамо 23 | bs_BA:Mi radimo. Mi menjamo. 24 | sk:Tvoríme, meníme... 25 | pt_br:Nós fazemos. Nós inovamos... 26 | nl:wij doen, wij veranderen 27 | pl:Innowacyjne zmiany - naszą ciężką pracą z myślą o Waszej wygodzie 28 | si:අපි ක්‍රියාත්මක කරනවා අපි වෙනස ඇ ති කරනවා 29 | lt:Mes darome ir kuriame pokyčius... 30 | hi:हम करते है, हम बदलते है। 31 | mr:आम्ही करतो, आम्ही बदलतो 32 | fi:Me teemme, me innovoimme 33 | kn:ಸದಾ ಮುನ್ನಡೆಯುತ್ತಾ, ಸದಾ ಆವಿಷ್ಕರಿಸುತ್ತಾ... 34 | kr:우리는 할 것이고, 우리는 바꿀 것이다 35 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/dark_collection_hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | collection_hover 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/dark_collection_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | collection_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/dark_uncollection_hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | uncollection_hover 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/dark_uncollection_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | uncollection_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon.svg 4 | split_line.svg 5 | close_normal.svg 6 | close_hover.svg 7 | close_press.svg 8 | font-x-generic.svg 9 | font_loaded.svg 10 | font_unload.svg 11 | deepin-font-manager.svg 12 | add-font-hover.svg 13 | add-font-normal.svg 14 | add-font-press.svg 15 | exception-logo.svg 16 | font-info-logo.svg 17 | collection_normal.svg 18 | uncollection_normal.svg 19 | collection_hover.svg 20 | collection_press.svg 21 | uncollection_press.svg 22 | uncollection_hover.svg 23 | dark_collection_normal.svg 24 | dark_collection_hover.svg 25 | dark_uncollection_hover.svg 26 | dark_uncollection_normal.svg 27 | ok.svg 28 | checkbox_unchecked_light.svg 29 | checkbox_unchecked_dark.svg 30 | 31 | 32 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | deepin-font-installer-32px 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | button/add 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/add_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | add-normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/attention.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | attention 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/close_icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Rectangle 9 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/collection_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | collection_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/deepin_font_manager.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/icon_menu.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | img_upload 26 | 27 | 28 | 29 | 49 | 50 | img_upload 52 | Created with Sketch. 54 | 56 | 59 | 61 | 66 | 67 | 69 | 74 | 75 | 77 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/notes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | notes 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/plus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/tips.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | tips 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/uncollection.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | collect 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/common/uncollection_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | uncollection_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/en_US/fig/font_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/en_US/fig/font_delete.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/en_US/fig/hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/en_US/fig/hotkey.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/en_US/fig/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/en_US/fig/info.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/en_US/fig/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/en_US/fig/main.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/delete.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/hotkey.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/info.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/main.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/multi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/multi.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/p_multi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/p_multi.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/p_single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/p_single.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_CN/fig/single.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/delete.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/hotkey.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/info.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/main.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/multi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/multi.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_HK/fig/single.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/font_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/font_delete.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/hotkey.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/info.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/main.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/multi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/multi.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-font-manager/8700d84c83b664660cf7a4c5968f1c38b3eaaf0e/deepin-font-manager-assets/deepin-font-manager/font-manager/zh_TW/fig/single.png -------------------------------------------------------------------------------- /deepin-font-manager-assets/exception-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | warning 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/ok.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ok 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/split_line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | split_line 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/translate_generation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # this file is used to auto-generate .qm file from .ts file. 3 | # author: shibowen at linuxdeepin.com 4 | 5 | ts_list=(`ls ../translations/*.ts`) 6 | 7 | for ts in "${ts_list[@]}" 8 | do 9 | printf "\nprocess ${ts}\n" 10 | lrelease "${ts}" 11 | done 12 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/uncollection_hover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | uncollection_hover 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/uncollection_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | uncollection_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager-assets/uncollection_press.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | uncollection_press 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /deepin-font-manager/.gitignore: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | deepin-font-installer 6 | qrc_*.cpp 7 | -------------------------------------------------------------------------------- /deepin-font-manager/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | # SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | # 4 | # SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | SET(APP_BIN deepin-font-manager) 7 | 8 | #libdeepin-font-manager 9 | SET(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libdeepin-font-manager) 10 | FILE(GLOB LIB_SRC_FILES ${LIB_DIR}/*.cpp ${LIB_DIR}/*.h) 11 | #INSTALL(FILES ${LIB_DIR}/schemas/com.deepin.font-manager.gschema.xml 12 | # DESTINATION ${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas) 13 | #用deepin-turbo对Dapplication进行加速 14 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--as-needed -fPIE") 15 | SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") 16 | 17 | #可执行文件 18 | FILE(GLOB SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*.h 19 | ${CMAKE_CURRENT_SOURCE_DIR}/views/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/views/*.h 20 | ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/*.h) 21 | 22 | SET(QRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../deepin-font-manager-assets/deepin-font-manager.qrc) 23 | include_directories(${CMAKE_BINARY_DIR}/deepin-font-manager) 24 | CONFIGURE_FILE(environments.h.in environments.h @ONLY) 25 | 26 | #编译翻译文件 27 | file(GLOB TS LIST_DIRECTORIES false ../translations/*.ts) 28 | set_source_files_properties(${TS} PROPERTIES OUTPUT_LOCATION ${PROJECT_SOURCE_DIR}/translations) 29 | qt_create_translation(QM ${SRC_FILES} ${TS}) 30 | ADD_EXECUTABLE(${APP_BIN} ${QM}) 31 | #安装翻译文件 32 | install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../translations 33 | DESTINATION share/${APP_BIN} 34 | FILES_MATCHING PATTERN "*.qm") 35 | 36 | TARGET_SOURCES(${APP_BIN} PRIVATE ${SRC_FILES} ${QRC_FILES} ${LIB_SRC_FILES}) 37 | TARGET_INCLUDE_DIRECTORIES(${APP_BIN} PRIVATE ${LIB_DIR}) 38 | TARGET_INCLUDE_DIRECTORIES(${APP_BIN} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 39 | TARGET_INCLUDE_DIRECTORIES(${APP_BIN} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/views) 40 | TARGET_INCLUDE_DIRECTORIES(${APP_BIN} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/interfaces) 41 | 42 | TARGET_LINK_LIBRARIES(${APP_BIN} PUBLIC 43 | Qt${QT_VERSION_MAJOR}::Core 44 | Qt${QT_VERSION_MAJOR}::Widgets 45 | Qt${QT_VERSION_MAJOR}::Gui 46 | Qt${QT_VERSION_MAJOR}::Sql 47 | Qt${QT_VERSION_MAJOR}::Xml 48 | Qt${QT_VERSION_MAJOR}::Svg 49 | Qt${QT_VERSION_MAJOR}::DBus 50 | Qt${QT_VERSION_MAJOR}::Network 51 | Dtk${DTK_VERSION}::Core 52 | Dtk${DTK_VERSION}::Gui 53 | Dtk${DTK_VERSION}::Widget 54 | ${FREETYPE_LIBRARIES} 55 | ${FREETYPE_LIBRARIES} 56 | PkgConfig::FontConfig) 57 | 58 | INSTALL(TARGETS ${APP_BIN} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 59 | 60 | SET(DESKTOP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../deepin-font-manager-assets/deepin-font-manager.desktop) 61 | INSTALL(FILES ${DESKTOP_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) 62 | 63 | SET(ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../deepin-font-manager-assets/deepin-font-manager.svg) 64 | INSTALL(FILES ${ICON_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) 65 | 66 | SET(PREVIEW_CONTENT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../deepin-font-manager-assets/contents.txt) 67 | INSTALL(FILES ${PREVIEW_CONTENT_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/${APP_BIN}/) 68 | -------------------------------------------------------------------------------- /deepin-font-manager/environments.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 3 | * 4 | * Author: 5 | * 6 | * Maintainer: 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #ifndef __ENVIRONMENTS_H_ 23 | #define __ENVIRONMENTS_H_ 24 | 25 | #define VERSION "@VERSION@" 26 | 27 | #endif // __ENVIRONMENTS_H_ 28 | -------------------------------------------------------------------------------- /deepin-font-manager/globaldef.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef GLOBALDEF_H 7 | #define GLOBALDEF_H 8 | //窗口默认大小 9 | #define DEFAULT_WINDOWS_WIDTH 820 10 | #define DEFAULT_WINDOWS_HEIGHT 580 11 | #define MIN_WINDOWS_WIDTH 680 12 | #define MIN_WINDOWS_HEIGHT 300 13 | 14 | // Tool Search bar 15 | #define FTM_TITLE_FIXED_WIDTH 58 16 | #define FTM_SEARCH_BAR_W 358 17 | 18 | // Left navigation bar 19 | #define FTM_LEFT_SIDE_BAR_WIDTH 160 20 | // State bar 21 | #define FTM_SBAR_HEIGHT 56 22 | #define FTM_SBAR_COMPACT_HEIGHT 40 23 | 24 | //Alt+M rightMenuPositionParam //SP3--Alt+M右键菜单--位置参数 25 | #define POSITION_PARAM_X 158 26 | #define POSITION_PARAM_Y 50 27 | 28 | #define FTM_SBAR_TXT_EDIT_H 44 29 | #define FTM_SBAR_TXT_EDIT_W 384 // Not used,Expanding now 30 | 31 | #define FTM_SBAR_SLIDER_H 40 32 | #define FTM_SBAR_SLIDER_W 199 33 | 34 | #define FTM_SBAR_FSIZE_LABEL_H 40 35 | #define FTM_SBAR_FSIZE_LABEL_W 60 36 | 37 | // File manager binary name 38 | #define DEEPIN_FILE_MANAGE_NAME "dde-file-manager" 39 | 40 | // Left side bar debug test data 41 | #define FTM_DEBUG_DATA_ON 42 | 43 | // Uncomment follow line if need debug layout 44 | //#define FTM_DEBUG_LAYOUT_COLOR 45 | 46 | #define FTM_ENABLE_DISABLE_CACHE_DIR "/usr/local/.deep_fontmanger_cache" 47 | 48 | #define FTM_REJECT_FONT_CONF_FILENAME QString("71-DeepInFontManager-Reject.conf") 49 | 50 | //Font Manager Theme Key 51 | #define FTM_THEME_KEY "FontManagerTheme" 52 | 53 | //Font Manager MainWindow Size 54 | #define FTM_MWSIZE_H_KEY "FontManagerSizeH" 55 | #define FTM_MWSIZE_W_KEY "FontManagerSizeW" 56 | 57 | //Font Manager MainWindow Status 58 | #define FTM_MWSTATUS_KEY "FontManagerStatus" 59 | 60 | //Deepin manaul binary name 61 | #define DEEPIN_MANUAL_NAME "dman" 62 | 63 | //Font manager binary name 64 | #define DEEPIN_FONT_MANAGER "deepin-font-manager" 65 | 66 | //Font MIME 67 | #define FONT_FILE_MIME "font/collection;font/ttf;font/otf;application/x-font-otf;application/x-font-ttf;application/x-font-type1;" 68 | 69 | //默认触摸屏一次触摸时间 70 | #define DEFAULT_PRESSTIME_LENGTH 500 71 | #endif // GLOBALDEF_H 72 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/dcomworker.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | class DComWorker : public QObject, public QRunnable 12 | { 13 | Q_OBJECT 14 | public: 15 | explicit DComWorker(QObject *parent = nullptr); 16 | void run(); 17 | }; 18 | 19 | class GetFontListWorker : public DComWorker 20 | { 21 | Q_OBJECT 22 | public: 23 | enum Type { 24 | ALL, 25 | CHINESE, 26 | MONOSPACE, 27 | AllInSquence, 28 | Startup, 29 | }; 30 | explicit GetFontListWorker(Type type, QObject *parent = nullptr); 31 | void run(); 32 | 33 | private: 34 | void removeUserAddFonts(); 35 | 36 | private: 37 | Type m_type; 38 | }; 39 | 40 | class FontManager 41 | { 42 | public: 43 | static FontManager *instance(); 44 | 45 | public: 46 | void getFontListInSequence(); 47 | void getStartFontList(); 48 | void getChineseAndMonoFont(); 49 | 50 | private: 51 | static FontManager *m_fontManager; 52 | }; 53 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/dfmxmlwrapper.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFMXMLWRAPPER_H 7 | #define DFMXMLWRAPPER_H 8 | 9 | #include 10 | 11 | typedef QMap QSTRING_MAP; 12 | typedef QMap::iterator QSTRING_MAP_ITER; 13 | typedef QVector QSTRING_VECTOR; 14 | typedef QVector::Iterator QSTRING_VECTOR_ITER; 15 | 16 | /************************************************************************* 17 | DFMXmlWrapper 18 | xml文件管理类 19 | 20 | null 21 | *************************************************************************/ 22 | 23 | class DFMXmlWrapper 24 | { 25 | public: 26 | DFMXmlWrapper(); 27 | 28 | static QString m_fontConfigFilePath; 29 | 30 | public: 31 | 32 | //新建xml文件 33 | // static bool createXmlFile(const QString &fileName, 34 | // const QString &rootName, 35 | // const QString &version = "1.0", 36 | // const QString &encoding = "gb2312", 37 | // const QString &standalone = "yes"); 38 | 39 | //新建fontconfig配置文件 40 | static bool createFontConfigFile(const QString &xmlFilePath); 41 | 42 | //删除文件 43 | static bool deleteXmlFile(const QString &fileName); 44 | 45 | // 根据节点名获取节点元素 46 | static bool getNodeByName(QDomElement &rootEle, 47 | const QString &nodeName, 48 | QDomElement &node); 49 | 50 | //增加节点 51 | static bool addNodesWithText(const QString &fileName, 52 | const QString &parentNodeName, 53 | const QStringList &nodeNameList, 54 | const QList &nodeAttributeList, 55 | const QString &lastNodeText); 56 | 57 | static bool addNodesWithTextList(const QString &fileName, 58 | const QString &parentNodeName, 59 | const QStringList &nodeNameList, 60 | const QList &nodeAttributeList, 61 | const QStringList &lastNodeTextList); 62 | 63 | static bool addPatternNodesWithText(const QString &fileName, 64 | const QString &parentNodeName, 65 | const QString &lastNodeText); 66 | 67 | static bool addPatternNodesWithTextList(const QString &fileName, 68 | const QString &parentNodeName, 69 | const QStringList &lastNodeTextList); 70 | 71 | //删除节点 72 | static bool deleteNodeWithTextList(const QString &fileName, 73 | const QString &nodeName, 74 | const QStringList &nodeTextList); 75 | 76 | // 查询所有子节点文本 77 | static bool queryAllChildNodes_Text(const QString &fileName, 78 | const QString &nodeName, 79 | QStringList &textList); 80 | 81 | 82 | //查询所有禁用字体文件路径列表 83 | static QStringList getFontConfigDisableFontPathList(); 84 | }; 85 | 86 | #endif // QXMLWRAPPER_H 87 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/dfontbasedialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFONTBASEDIALOG_H 7 | #define DFONTBASEDIALOG_H 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | DWIDGET_USE_NAMESPACE 16 | 17 | /************************************************************************* 18 | DFMXmlWrapper 19 | 项目中弹出对话框的基类 20 | 21 | null 22 | *************************************************************************/ 23 | //class DWindowCloseButton; 24 | //class DLabel; 25 | class QVBoxLayout; 26 | class DFontBaseDialog : public DAbstractDialog 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit DFontBaseDialog(QWidget *parent = nullptr); 31 | ~DFontBaseDialog()Q_DECL_OVERRIDE; 32 | 33 | //窗口增加包含控件的函数 34 | void addContent(QWidget *content); 35 | 36 | //设置IconLabel的显示内容 37 | void setIconPixmap(const QPixmap &iconPixmap); 38 | 39 | //获取窗口中使用主布局的控件的函数 40 | QWidget *getContent() const; 41 | 42 | //获取右上角关闭按钮的函数 43 | DWindowCloseButton *getCloseButton() const; 44 | 45 | protected: 46 | //初始化ui界面 47 | void initUI(); 48 | //初始化信号与槽的链接 49 | void InitConnections(); 50 | 51 | //设置IconLabel是否可见 52 | void setLogoVisable(bool visible = true); 53 | 54 | //设置titlelabel显示内容 55 | void setTitle(const QString &title); 56 | //获取窗口使用的布局 57 | QLayout *getContentLayout(); 58 | 59 | //Overrides 60 | void closeEvent(QCloseEvent *event) override; 61 | signals: 62 | //窗口关闭信号 63 | void closed(); 64 | 65 | //点击右上角关闭按钮信号 66 | void closeBtnClicked(); 67 | 68 | public slots: 69 | #ifdef DTKWIDGET_CLASS_DSizeMode 70 | //紧凑模式切换 71 | void slotSizeModeChanged(DGuiApplicationHelper::SizeMode sizeMode); 72 | #endif 73 | 74 | private: 75 | QWidget *m_titleBar {nullptr}; 76 | DLabel *m_logoIcon {nullptr}; 77 | DLabel *m_tileText {nullptr}; 78 | DWindowCloseButton *m_closeButton {nullptr}; 79 | 80 | QWidget *m_content {nullptr}; 81 | QVBoxLayout *m_contentLayout {nullptr}; 82 | }; 83 | 84 | #endif // DFONTBASEDIALOG_H 85 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/dfontpreviewer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFONTPREVIEWER_H 7 | #define DFONTPREVIEWER_H 8 | 9 | #include 10 | 11 | DWIDGET_USE_NAMESPACE 12 | 13 | /************************************************************************* 14 | DFontPreviewer 15 | 负责控制quickinstallwindow中预览字体显示内容 16 | 17 | null 18 | *************************************************************************/ 19 | class DFontPreviewer : public QWidget 20 | { 21 | Q_OBJECT 22 | public: 23 | explicit DFontPreviewer(QWidget *parent = nullptr); 24 | //绘制预览字体 25 | void paintEvent(QPaintEvent *event) override; 26 | 27 | //初始化数据 28 | void InitData(); 29 | 30 | //初始化链接 31 | void InitConnections(); 32 | 33 | //设置当前字体路径 34 | void setPreviewFontPath(const QString &font); 35 | 36 | signals: 37 | //预览字体变化信号 38 | void previewFontChanged(); 39 | 40 | public slots: 41 | //预览字体变化后的处理 42 | void onPreviewFontChanged(); 43 | 44 | private: 45 | QString m_fontPath; 46 | QStringList m_previewTexts; 47 | }; 48 | 49 | #endif // DFONTPREVIEWER_H 50 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/dfontpreviewitemdelegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFONTPREVIEWITEMDELEGATE_H 7 | #define DFONTPREVIEWITEMDELEGATE_H 8 | 9 | #include "dfontpreviewitemdef.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | class DFontPreviewListView; 18 | 19 | class DFontPreviewItemDelegate : public QStyledItemDelegate 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | explicit DFontPreviewItemDelegate(QAbstractItemView *parent = nullptr); 25 | // static void setNoFont(bool noFont); 26 | //代理的绘画函数 27 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; 28 | //获取当前listview一项尺寸的大小 29 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; 30 | 31 | enum FontRole { 32 | FontPreviewRole = Dtk::UserRole + 1, 33 | FontSizeRole = Dtk::UserRole + 2, 34 | FontFamilyRole, 35 | FontStyleRole, 36 | FontOwnPreviewRole, 37 | FontFamilyStylePreviewRole, 38 | }; 39 | protected: 40 | //事件过滤器 41 | bool eventFilter(QObject *object, QEvent *event) override; 42 | 43 | private: 44 | //调整预览区域 45 | QRect adjustPreviewRect(const QRect bgRect) const; 46 | //根据预览区域和文字显示效果获取基准点 47 | QPoint adjustPreviewFontBaseLinePoint(const QRect &fontPreviewRect, const QFontMetrics &previewFontMetrics) const; 48 | //绘制字体预览列表中的复选框 49 | void paintForegroundCheckBox(QPainter *painter, const QStyleOptionViewItem &option, const FontData &itemData) const; 50 | //绘制字体预览列表中的字体名字 51 | void paintForegroundFontName(QPainter *painter, const QStyleOptionViewItem &option, const FontData &itemData) const; 52 | //绘制字体预览列表中的收藏图标 53 | void paintForegroundCollectIcon(QPainter *painter, const QStyleOptionViewItem &option, const FontData &itemData) const; 54 | //绘制字体预览列表中的预览内容 55 | void paintForegroundPreviewFont(QPainter *painter, const QStyleOptionViewItem &option, const QString &familyName, 56 | const QString &styleName, bool isEnabled, int fontPixelSize, QString &fontPreviewText) const; 57 | //绘制字体预览列表的背景 58 | void paintBackground(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; 59 | //绘制tab选中后的背景效果 60 | void paintTabFocusBackground(QPainter *painter, const QStyleOptionViewItem &option, const QRect &bgRect) const; 61 | //获取需要绘制区域的路径 62 | void setPaintPath(const QRect &bgRect, QPainterPath &path, const int xDifference, const int yDifference, const int radius) const; 63 | 64 | DFontPreviewListView *m_parentView; 65 | }; 66 | 67 | #endif // DFONTPREVIEWITEMDELEGATE_H 68 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/dfontpreviewproxymodel.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFONTPREVIEWPROXYMODEL_H 7 | #define DFONTPREVIEWPROXYMODEL_H 8 | 9 | #include 10 | #include 11 | 12 | class DFontPreviewProxyModel : public QSortFilterProxyModel 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit DFontPreviewProxyModel(QObject *parent = nullptr); 18 | ~DFontPreviewProxyModel() override; 19 | //判断给定项是否包含在模型中 20 | bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; 21 | //获取行数 22 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; 23 | //设置当前字体组 24 | void setFilterGroup(int filterGroup); 25 | //获取当前字体组 26 | int getFilterGroup(); 27 | //根据字体的信息进行分组,决定各个界面显示的字体 28 | bool isCustomFilterAcceptsRow(const QModelIndex &modelIndex) const; 29 | //判断用户字体名是否含有用户输入的内容 30 | bool isFontNameContainsPattern(QString fontName) const; 31 | //根据输入内容设置比对的模板 32 | void setFilterFontNamePattern(const QString &pattern); 33 | signals: 34 | 35 | private: 36 | int m_filterGroup; 37 | bool m_useSystemFilter; 38 | QString m_fontNamePattern; 39 | }; 40 | 41 | #endif // DFONTPREVIEWPROXYMODEL_H 42 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/getuseraddfontthread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "getuseraddfontthread.h" 7 | #include "dfmdbmanager.h" 8 | #include "dcomworker.h" 9 | #include "dfontpreviewlistdatathread.h" 10 | 11 | GetUserAddFontThread::GetUserAddFontThread(QObject *parent) 12 | : QThread(parent) 13 | { 14 | qDebug() << "Creating GetUserAddFontThread"; 15 | 16 | } 17 | 18 | void GetUserAddFontThread::run() 19 | { 20 | qDebug() << "Starting GetUserAddFontThread"; 21 | 22 | DFontInfoManager *fontInfoManager = DFontInfoManager::instance(); 23 | DFMDBManager *fDbManager = DFMDBManager::instance(); 24 | qDebug() << "Got font info and DB manager instances"; 25 | 26 | QStringList dbPathlist = fDbManager->getInstalledFontsPath(); 27 | QStringList fclistPathList = fontInfoManager->getAllFclistPathList(); 28 | qDebug() << "Got DB paths:" << dbPathlist.size() << "and fclist paths:" << fclistPathList.size(); 29 | 30 | QList fontInfolist; 31 | QStringList reduceSameFontList; 32 | DFontInfo fontInfo; 33 | //通过fc-list获取安装字体并与数据库对比,如果存在选项不在数据库这该字体不是通过字体管理器安装,把它加入列表 34 | foreach (auto it, fclistPathList) { 35 | if (!dbPathlist.contains(it)) { 36 | qDebug() << "Found user-added font:" << it; 37 | fontInfo = fontInfoManager->getFontInfo(it, true); 38 | //去重 39 | if (!fontInfolist.contains(fontInfo) && fDbManager->isFontInfoExist(fontInfo) == QString()) { 40 | qDebug() << "Adding unique font:" << fontInfo.filePath; 41 | fontInfolist << fontInfo; 42 | } else { 43 | qDebug() << "Skipping duplicate font:" << fontInfo.filePath; 44 | } 45 | } 46 | } 47 | 48 | qInfo() << "Found" << fontInfolist.size() << "user-added fonts"; 49 | 50 | FontManager::instance()->getChineseAndMonoFont(); 51 | 52 | DFontPreviewListDataThread::instance()->onRefreshUserAddFont(fontInfolist); 53 | qDebug() << "GetUserAddFontThread completed"; 54 | } 55 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/getuseraddfontthread.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef GETUSERADDFONTTHREAD_H 7 | #define GETUSERADDFONTTHREAD_H 8 | 9 | #include "dfontinfomanager.h" 10 | 11 | #include 12 | 13 | class GetUserAddFontThread : public QThread 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit GetUserAddFontThread(QObject *parent = nullptr); 19 | 20 | protected: 21 | void run(); 22 | }; 23 | 24 | #endif // GETUSERADDFONTTHREAD_H 25 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/loadfontdatathread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "loadfontdatathread.h" 7 | #include "dfontpreviewlistview.h" 8 | #include 9 | 10 | LoadFontDataThread::LoadFontDataThread(QList> &list, QObject *parent) 11 | : QThread(parent) 12 | , m_list(list) 13 | { 14 | qDebug() << "Creating LoadFontDataThread with" << list.size() << "fonts to load"; 15 | } 16 | 17 | void LoadFontDataThread::run() 18 | { 19 | qDebug() << "Starting LoadFontDataThread, thread id:" << QThread::currentThreadId(); 20 | 21 | SignalManager::m_isOnLoad = true; 22 | DFontPreviewListDataThread *thread = DFontPreviewListDataThread::instance(); 23 | QList fontinfoList = DFMDBManager::instance()->getFontInfo(m_list, &m_delFontInfoList); 24 | 25 | thread->m_fontModelList.append(fontinfoList); 26 | 27 | qDebug() << "Processing" << m_delFontInfoList.size() << "fonts to delete"; 28 | for (DFontPreviewItemData &itemData : m_delFontInfoList) { 29 | //如果字体文件已经不存在,则从t_manager表中删除 30 | //删除字体之前启用字体,防止下次重新安装后就被禁用 31 | thread->getView()->enableFont(itemData.fontInfo.filePath); 32 | DFMDBManager::instance()->deleteFontInfo(itemData); 33 | } 34 | 35 | qDebug() << "Committing deleted font info"; 36 | DFMDBManager::instance()->commitDeleteFontInfo(); 37 | thread->getView()->enableFonts(); 38 | 39 | qDebug() << "Setting up file watchers for" << fontinfoList.size() << "fonts"; 40 | foreach (auto it, fontinfoList) { 41 | thread->addPathWatcher(it.fontInfo.filePath); 42 | } 43 | 44 | m_delFontInfoList.clear(); 45 | SignalManager::m_isOnLoad = false; 46 | SignalManager::m_isDataLoadFinish = true; 47 | 48 | qDebug() << "Emitting dataLoadFinish signal with" << fontinfoList.size() << "fonts"; 49 | emit dataLoadFinish(fontinfoList); 50 | 51 | qDebug() << "LoadFontDataThread completed"; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /deepin-font-manager/interfaces/loadfontdatathread.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef LOADFONTDATATHREAD_H 7 | #define LOADFONTDATATHREAD_H 8 | #include "dfontinfomanager.h" 9 | #include "dfontpreviewlistdatathread.h" 10 | #include "dfmdbmanager.h" 11 | #include "dcopyfilesmanager.h" 12 | 13 | #include 14 | 15 | class LoadFontDataThread : public QThread 16 | { 17 | Q_OBJECT 18 | public: 19 | explicit LoadFontDataThread(QList> &list, QObject *parent = nullptr); 20 | 21 | protected: 22 | void run(); 23 | 24 | 25 | signals: 26 | void dataLoadFinish(QList &); 27 | 28 | private: 29 | QList m_delFontInfoList; 30 | QList m_startModelList; 31 | QList> m_list; 32 | 33 | QThread mThread; 34 | }; 35 | 36 | 37 | 38 | #endif // LOADFONTDATATHREAD_H 39 | -------------------------------------------------------------------------------- /deepin-font-manager/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "globaldef.h" 7 | #include "performancemonitor.h" 8 | #include "utils.h" 9 | #include "views/dfontmgrmainwindow.h" 10 | #include "singlefontapplication.h" 11 | #include "environments.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #if QT_VERSION_MAJOR <= 5 17 | #include 18 | #endif 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | DWIDGET_USE_NAMESPACE 25 | DCORE_USE_NAMESPACE 26 | 27 | /************************************************************************* 28 | main 29 | 工程主函数入口 30 | 31 | 32 | argc Description:标准参数 33 | argv[] Description:标准参数 34 | int Description:返回函数处理结果 35 | null 36 | *************************************************************************/ 37 | int main(int argc, char *argv[]) 38 | { 39 | qDebug() << "Enter main function"; 40 | PerformanceMonitor::initializeAppStart(); 41 | 42 | // 依赖DTK的程序,如果要在root下或者非deepin/uos环境下运行不会发生异常,就需要加上该环境变量 43 | if (!QString(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin")) { 44 | qInfo() << "Setting XDG_CURRENT_DESKTOP to Deepin"; 45 | setenv("XDG_CURRENT_DESKTOP", "Deepin", 1); //setenv改变或添加一个环境变量 46 | } 47 | 48 | // load dtk xcb plugin. 49 | //DEPRECATED API and remove it 50 | //DApplication::loadDXcbPlugin(); 51 | // init Dtk application's attrubites. 52 | SingleFontApplication app(argc, argv); 53 | app.setAttribute(Qt::AA_UseHighDpiPixmaps); 54 | app.loadTranslator(); 55 | app.setApplicationName("deepin-font-manager"); 56 | app.setOrganizationName("deepin"); 57 | app.setApplicationVersion(VERSION); 58 | app.setApplicationAcknowledgementPage("https://www.deepin.org/original/deepin-font-installer/"); 59 | app.setProductIcon(QIcon::fromTheme(DEEPIN_FONT_MANAGER)); 60 | app.setProductName(DApplication::translate("Main", "Font Manager")); 61 | app.setApplicationDescription(DApplication::translate("Main", "Font Manager helps users install and manage fonts.")); 62 | app.setApplicationDisplayName(DApplication::translate("Main", "Font Manager")); 63 | 64 | #if QT_VERSION_MAJOR <= 5 65 | DApplicationSettings savetheme; 66 | #endif 67 | 68 | DLogManager::registerConsoleAppender(); 69 | DLogManager::registerFileAppender(); 70 | 71 | 72 | // qDebug() << DTK_VERSION << endl; 73 | /* 使用DBus实现单例模式 UT000591 */ 74 | QDBusConnection dbus = QDBusConnection::sessionBus(); 75 | if (dbus.registerService("com.deepin.FontManager")) { 76 | qInfo() << "DBus service registered successfully"; 77 | dbus.registerObject("/com/deepin/FontManager", &app, QDBusConnection::ExportScriptableSlots); 78 | app.parseCmdLine(); 79 | app.activateWindow(); 80 | qDebug() << "Application running"; 81 | int ret = app.exec(); 82 | qDebug() << "Exit main function with code:" << ret; 83 | return ret; 84 | } else { 85 | qWarning() << "DBus service already registered, exiting"; 86 | app.parseCmdLine(true); 87 | return 0; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /deepin-font-manager/performancemonitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef PERFORMANCEMONITOR_H 7 | #define PERFORMANCEMONITOR_H 8 | 9 | #include 10 | 11 | class PerformanceMonitor : public QObject 12 | { 13 | Q_OBJECT 14 | public: 15 | explicit PerformanceMonitor(QObject *parent = nullptr); 16 | 17 | static void initializeAppStart(); 18 | static void initializeAppFinish(); 19 | 20 | static void loadFontStart(); 21 | static void loadFontFinish(); 22 | 23 | static qint64 calcInitAndLoadTime(); 24 | 25 | static void installFontStart(); 26 | static void installFontFinish(int fontCount); 27 | 28 | static void exportFontStart(); 29 | static void exportFontFinish(int fontCount); 30 | 31 | static void deleteFontStart(); 32 | static void deleteFontFinish(int fontCount); 33 | 34 | static void activeFontStart(); 35 | static void activeFontFinish(bool isDeActive, int fontCount); 36 | 37 | static void favoriteFontStart(); 38 | static void favoriteFontFinish(bool isFavorite, int fontCount); 39 | 40 | private: 41 | Q_DISABLE_COPY(PerformanceMonitor) 42 | 43 | static qint64 initializeAppStartMs; 44 | static qint64 initializeAppFinishMs; 45 | static qint64 loadFontStartMs; 46 | static qint64 loadFontFinishMs; 47 | static qint64 installFontStartMs; 48 | static qint64 installFontFinishMs; 49 | static qint64 exportFontStartMs; 50 | static qint64 exportFontFinishMs; 51 | static qint64 deleteFontStartMs; 52 | static qint64 deleteFontFinishMs; 53 | static qint64 favoriteFontStartMs; 54 | static qint64 favoriteFontFinishMs; 55 | static qint64 activeFontStartMs; 56 | static qint64 activeFontFinishMs; 57 | 58 | }; 59 | 60 | #endif // PERFORMANCEMONITOR_H 61 | -------------------------------------------------------------------------------- /deepin-font-manager/singlefontapplication.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef SINGLEFONTAPPLICATION_H 7 | #define SINGLEFONTAPPLICATION_H 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | DWIDGET_USE_NAMESPACE 15 | 16 | /************************************************************************* 17 | SingleFontApplication 18 | 返回一个应用的单例对象 19 | 20 | null 21 | *************************************************************************/ 22 | class SingleFontApplication : public DApplication 23 | { 24 | Q_OBJECT 25 | Q_CLASSINFO("D-Bus Interface", "com.deepin.FontManager") 26 | public: 27 | explicit SingleFontApplication(int &argc, char **argv); 28 | 29 | ~SingleFontApplication(); 30 | //激活应用窗口 31 | void activateWindow(); 32 | //初始化命令行 33 | bool parseCmdLine(bool bAppExist = false); 34 | 35 | public slots: 36 | //批量安装字体响应 37 | Q_SCRIPTABLE void installFonts(const QStringList &fontPathList); 38 | 39 | private slots: 40 | //批量安装字体响应 41 | void slotBatchInstallFonts(); 42 | //安装完成清空列表 43 | void onFontInstallFinished(const QStringList &fileList); 44 | 45 | private: 46 | QStringList m_selectedFiles; 47 | 48 | QScopedPointer m_qspMainWnd; // MainWindow ptr 49 | QScopedPointer m_qspQuickWnd; // QuickInstall Window ptr 50 | 51 | QSet waitForInstallSet; /* 可能存在多次安装相同的一个字体,将会接收到多次消息,QSet可以用来剔除重复的安装请求 UT000591 */ 52 | }; 53 | 54 | #endif // SINGLEFONTAPPLICATION_H 55 | -------------------------------------------------------------------------------- /deepin-font-manager/utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef UTILS_H 7 | #define UTILS_H 8 | 9 | #include 10 | #include 11 | 12 | /************************************************************************* 13 | Utils 14 | 全文索引类 15 | 16 | null 17 | *************************************************************************/ 18 | class Utils : public QObject 19 | { 20 | public: 21 | static QHash m_imgCacheHash; 22 | static QHash m_fontNameCache; 23 | 24 | //读取应用配置文件信息字符串 25 | static QString getConfigPath(); 26 | //判断当前是否为MIME类型的数据库 27 | static bool isFontMimeType(const QString &filePath); 28 | //获取文件后缀类型 29 | static QString suffixList(); 30 | //读取图像信息 31 | static QPixmap renderSVG(const QString &filePath, const QSize &size); 32 | 33 | static QString convertToPreviewString(const QString &fontFilePath, const QString &srcString); 34 | 35 | //判断是否wayland环境 36 | static bool isWayland(); 37 | 38 | //清除图像缓存 39 | static void clearImgCache(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /deepin-font-manager/views/dfinstallerrordialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFINSTALLERRORDIALOG_H 7 | #define DFINSTALLERRORDIALOG_H 8 | 9 | #include "interfaces/dfontbasedialog.h" 10 | #include "dfinstallerrorlistview.h" 11 | #include "dfinstallerroritemmodel.h" 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | DWIDGET_USE_NAMESPACE 20 | 21 | class DFInstallNormalWindow; 22 | class SignalManager; 23 | class DFInstallErrorListView; 24 | /************************************************************************* 25 | DFInstallErrorDialog 26 | 安装验证框页面-应用验证字体信息 27 | 28 | null 29 | *************************************************************************/ 30 | class DFInstallErrorDialog : public DDialog 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit DFInstallErrorDialog(QWidget *parent = nullptr, 36 | const QStringList &errorInstallFontFileList = QStringList()); 37 | ~DFInstallErrorDialog()Q_DECL_OVERRIDE; 38 | //构造时初始化字体信息列表 39 | void initData(); 40 | //字体验证框主页面 41 | void initUI(); 42 | //获取已勾选继续安装项个数 43 | int getErrorFontCheckedCount(); 44 | //获取可勾选项个数 45 | int getErrorFontSelectableCount(); 46 | 47 | private: 48 | //刷新继续按钮的状态-选中数量大于1时,继续按钮可用 49 | void resetContinueInstallBtnStatus(); 50 | //重写键盘press事件 51 | void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; 52 | //重写关闭事件-发送取消继续安装信号 53 | void closeEvent(QCloseEvent *event) override; 54 | 55 | signals: 56 | //发送取消继续安装重复字体的信号 57 | void onCancelInstall(); 58 | //发送请求继续安装重复字体的信号 59 | void onContinueInstall(const QStringList &continueInstallFontFilelList); 60 | 61 | public slots: 62 | //勾选按钮点击或回车选中事件 63 | void onListItemClicked(const QModelIndex &index); 64 | //用于处理字体验证框中选择多个字体后使用快捷键改变选中字体的选择状态 65 | void onListItemsClicked(const QModelIndexList &indexList); 66 | ///*参数1 正常筛选后筛选出的错误字体 参数2 字体验证框弹出过程中安装的所有字体 67 | //参数3 新添加到字体验证框中的字体 参数4 之前添加到字体验证框中的字体 */ 68 | void addData(QStringList &errorFileList, QStringList &halfInstalledFilelist, 69 | QStringList &addHalfInstalledFiles, QStringList &oldHalfInstalledFiles); 70 | //按钮点击事件 71 | void onControlButtonClicked(int btnIndex); 72 | 73 | #ifdef DTKWIDGET_CLASS_DSizeMode 74 | //紧凑模式切换 75 | void slotSizeModeChanged(DGuiApplicationHelper::SizeMode sizeMode); 76 | #endif 77 | 78 | private: 79 | DFInstallNormalWindow *m_parent; 80 | QWidget *m_mainFrame; 81 | QVBoxLayout *m_mainLayout; 82 | 83 | DFInstallErrorListView *m_installErrorListView; 84 | 85 | SignalManager *m_signalManager; 86 | 87 | QStringList m_errorInstallFiles; 88 | QList m_installErrorFontModelList; 89 | }; 90 | 91 | 92 | #endif // DFINSTALLERRORDIALOG_H 93 | -------------------------------------------------------------------------------- /deepin-font-manager/views/dfinstallerroritemmodel.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFINSTALLERRORITEMMODEL_H 7 | #define DFINSTALLERRORITEMMODEL_H 8 | 9 | #include 10 | #include 11 | 12 | /************************************************************************* 13 | DFInstallErrorItemModel 14 | 字体信息结构体 15 | 16 | bChecked Description:是否勾选 17 | bSelectable Description:是否可选 18 | bSystemFont Description:是否为系统字体 19 | bIsNormalUserFont Description:是否为正常字体 20 | strFontFileName Description:字体文件名属性信息 21 | strFontFilePath Description:字体路径属性信息 22 | strFontInstallStatus Description:安装状态,是否为已安装 23 | null 24 | *************************************************************************/ 25 | struct DFInstallErrorItemModel { 26 | bool bChecked; 27 | bool bSelectable; 28 | bool bSystemFont; 29 | bool bIsNormalUserFont;//SP3--安装验证页面,回车取消/选中(539)--设置字体状态 30 | QString strFontFileName; 31 | QString strFontFilePath; 32 | QString strFontInstallStatus; 33 | 34 | DFInstallErrorItemModel() 35 | : bChecked(false) 36 | , bSelectable(false) 37 | , bSystemFont(false) 38 | , bIsNormalUserFont(false) //SP3--安装验证页面,回车取消/选中(539)--初始化字体状态 39 | , strFontFileName("") 40 | , strFontFilePath("") 41 | , strFontInstallStatus("") 42 | 43 | { 44 | } 45 | }; 46 | 47 | Q_DECLARE_METATYPE(DFInstallErrorItemModel) 48 | 49 | #endif // DFINSTALLERRORITEMMODEL_H 50 | -------------------------------------------------------------------------------- /deepin-font-manager/views/dfontinfodialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFONTINFODIALOG_H 7 | #define DFONTINFODIALOG_H 8 | #include "dfontbasedialog.h" 9 | #include "dfontinfoscrollarea.h" 10 | 11 | DWIDGET_USE_NAMESPACE 12 | 13 | //类声明 14 | struct DFontPreviewItemData; 15 | class FontIconText; 16 | 17 | /************************************************************************* 18 | DFontInfoDialog 19 | 字体管理器信息页面,在本页面查看字体图标、名称、样式、类型、版本和描述、字形、类别等信息。 20 | 21 | null 22 | *************************************************************************/ 23 | class DFontInfoDialog : public DFontBaseDialog 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit DFontInfoDialog(DFontPreviewItemData *fontInfo, QWidget *parent = nullptr); 28 | //静态变量-长宽属性 29 | static constexpr int DEFAULT_WINDOW_W = 300; 30 | static constexpr int DEFAULT_WINDOW_H = 640; 31 | 32 | protected: 33 | //初始化信息页面 34 | void initUI(); 35 | //初始化信号与槽连接处理函数-主题变化信号和槽 36 | void initConnections(); 37 | //用于nametitle的第三行判断,由AutoFeed调用 38 | QString adaptiveLengthForNameTitle(QFontMetrics fm, QString thirdLineText, int lineWidth); 39 | //重新实现键盘press事件-信息页面打开快捷键关闭本窗口 40 | void keyPressEvent(QKeyEvent *ev) override; 41 | //自适应变化信息详情页面高度 42 | void autoHeight(int height); 43 | signals: 44 | 45 | public slots: 46 | 47 | private: 48 | QWidget *m_mainFrame {nullptr}; 49 | QString m_FileName; 50 | QPoint m_faCenter; 51 | SignalManager *m_signalManager = SignalManager::instance(); 52 | 53 | FontIconText *m_fontLogo {nullptr}; 54 | DLabel *m_fontFileName {nullptr}; 55 | 56 | QFrame *m_basicInfoFrame {nullptr}; 57 | QString AutoFeed(QString text); 58 | QVBoxLayout *m_baseicInfoLayout; 59 | 60 | DFontPreviewItemData *m_fontInfo; 61 | 62 | dfontinfoscrollarea *m_fontinfoArea; 63 | DScrollArea *m_scrollArea; 64 | }; 65 | 66 | #endif // DFONTINFODIALOG_H 67 | -------------------------------------------------------------------------------- /deepin-font-manager/views/dfontinfoscrollarea.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef ATTRSCROLLWIDGET_H 7 | #define ATTRSCROLLWIDGET_H 8 | 9 | #include 10 | #include "dfontbasedialog.h" 11 | #include "signalmanager.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | DWIDGET_USE_NAMESPACE 21 | 22 | /************************************************************************* 23 | dfontinfoscrollarea 24 | 字体管理器信息页面详情部分 25 | 26 | null 27 | *************************************************************************/ 28 | class dfontinfoscrollarea: public DFrame 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit dfontinfoscrollarea(DFontPreviewItemData *pData, DWidget *parent = nullptr); 34 | //用于信息页面详情信息部分长度判断 35 | QString elideText(const QString &text, const QFont &font, int nLabelSize); 36 | //在字体变化后重绘信息页面 37 | void updateText(); 38 | //重新计算信息详情页面高度参数 39 | void autoHeight(); 40 | 41 | protected: 42 | //事件过滤器-过滤到字体改变事件后更新详情页字体信息与页面高度 43 | bool eventFilter(QObject *obj, QEvent *e) override; 44 | //获取信号管理类的单例对象 45 | SignalManager *m_signalManager = SignalManager::instance(); 46 | //初始化信息页面中详情页面 47 | void initUi(); 48 | 49 | private: 50 | Q_DISABLE_COPY(dfontinfoscrollarea) 51 | //初始话信息页面详情中信息部分标签内容 52 | void createLabel(QGridLayout *layout, const int &index, const QString &objName, const QString &sData); 53 | 54 | private: 55 | //初始话信息页面详情中标题部分标签内容 56 | DFrame *addTitleFrame(const QString &sData, const QString &objName); 57 | QString elideText(QString &titleName) const; 58 | 59 | DFontPreviewItemData *m_fontInfo;//字体信息 60 | DLabel *basicLabel = nullptr; 61 | std::map pTitleMap;//存储信息title键值对 62 | std::map pLabelMap;//存储信息info label键值对 63 | }; 64 | 65 | #endif // ATTRSCROLLWIDGET_H 66 | -------------------------------------------------------------------------------- /deepin-font-manager/views/dfontspinner.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | class DFontSpinnerPrivate; 11 | 12 | class DFontSpinner : public QWidget 13 | { 14 | Q_OBJECT 15 | public: 16 | explicit DFontSpinner(QWidget *parent = nullptr); 17 | ~DFontSpinner() override; 18 | 19 | public Q_SLOTS: 20 | void start(); 21 | void stop(); 22 | 23 | protected: 24 | void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; 25 | void changeEvent(QEvent *e) override; 26 | 27 | private: 28 | // d_ptr与Qobject库中一个protected权限的指针变量重名,导致会出现警告 29 | // DFontSpinnerPrivate *const d_ptr {nullptr}; 30 | DFontSpinnerPrivate *const m_ptr {nullptr}; 31 | Q_DECLARE_PRIVATE(DFontSpinner) 32 | }; 33 | -------------------------------------------------------------------------------- /deepin-font-manager/views/dfontspinnerwidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | class DFontSpinner; 13 | 14 | class DFontSpinnerWidget : public Dtk::Widget::DWidget 15 | { 16 | public: 17 | /************************************************************************* 18 | SpinnerStyles 19 | 加载动画样式 20 | 21 | 22 | StartupLoad Description:启动应用加载 23 | Load Description:安装后加载 24 | Delete Description:删除后加载 25 | NoLabel Description:无加载提示信息 26 | null 27 | *************************************************************************/ 28 | enum SpinnerStyles { 29 | StartupLoad, 30 | Load, 31 | Delete, 32 | NoLabel, 33 | }; 34 | 35 | 36 | public: 37 | explicit DFontSpinnerWidget(QWidget *parent = nullptr, SpinnerStyles styles = SpinnerStyles::Load); 38 | void initUI(); 39 | 40 | void spinnerStart(); 41 | void spinnerStop(); 42 | ~DFontSpinnerWidget(); 43 | 44 | void setStyles(SpinnerStyles styles); 45 | 46 | private: 47 | 48 | SpinnerStyles m_Styles; 49 | DFontSpinner *m_spinner = nullptr; 50 | QLabel *m_label = nullptr; 51 | }; 52 | -------------------------------------------------------------------------------- /deepin-font-manager/views/dfquickinstallwindow.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFQUICKINSTALL_H 7 | #define DFQUICKINSTALL_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | DWIDGET_USE_NAMESPACE 16 | 17 | class DFontInfoManager; 18 | class FontManagerCore; 19 | struct DFontInfo; 20 | class DFontPreviewer; 21 | class DFMDBManager; 22 | 23 | class DFQuickInstallWindow : public DMainWindow 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit DFQuickInstallWindow(const QStringList &files = QStringList(), QWidget *parent = nullptr); 28 | 29 | ~DFQuickInstallWindow() override; 30 | 31 | static constexpr int DEFAULT_WINDOW_W = 480; 32 | static constexpr int DEFAULT_WINDOW_H = 380; 33 | 34 | protected: 35 | void initUI(); 36 | void initConnections(); 37 | void InitPreviewFont(DFontInfo &fontInfo); 38 | void installFont(const QStringList &files); 39 | 40 | void resizeEvent(QResizeEvent *event) override; 41 | signals: 42 | void fileSelected(const QStringList &fileList); 43 | void quickInstall(); 44 | void requestShowMainWindow(const QStringList &fileList); 45 | 46 | public slots: 47 | void onFileSelected(const QStringList &fileList); 48 | void onInstallBtnClicked(); 49 | void onFontInstallFinished(); 50 | 51 | private: 52 | DLabel *m_titleLabel {nullptr}; 53 | QWidget *m_mainFrame {nullptr}; 54 | 55 | DComboBox *m_fontType {nullptr}; 56 | DFontPreviewer *m_fontPreviewTxt {nullptr}; 57 | 58 | DLabel *m_stateLabel {nullptr}; 59 | DPushButton *m_actionBtn {nullptr}; 60 | 61 | DFontInfoManager *m_fontInfoManager; 62 | FontManagerCore *m_fontManager; 63 | DFMDBManager *m_dbManager; 64 | 65 | 66 | QStringList m_installFiles; 67 | 68 | DPalette m_oldPaStateLbl; 69 | }; 70 | 71 | #endif // DFQUICKINSTALL_H 72 | -------------------------------------------------------------------------------- /deepin-font-manager/views/fonticontext.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include 11 | 12 | /************************************************************************* 13 | FontIconText 14 | 构造函数-构造字体图标对象 15 | 16 | null 17 | *************************************************************************/ 18 | class FontIconText : public QWidget 19 | { 20 | Q_OBJECT 21 | public: 22 | explicit FontIconText(const QString &picPath, QWidget *parent = nullptr); 23 | //设置字体名 24 | void setFontName(const QString &familyName, const QString &styleName); 25 | //设置是否为ttf字体属性 26 | void setContent(bool isTtf); 27 | 28 | protected: 29 | //重写绘图事件 30 | void paintEvent(QPaintEvent *event); 31 | signals: 32 | 33 | public slots: 34 | private: 35 | QString m_picPath; 36 | DTK_GUI_NAMESPACE::DSvgRenderer *render; 37 | QFont m_font; 38 | bool m_isTtf; 39 | }; 40 | -------------------------------------------------------------------------------- /deepin-font-preview-plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #/***************************************************************************** 2 | #* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 3 | #* 4 | #* Author: Xiao Zhiguo 5 | #* Date: 2020-09-11 6 | #* 7 | #* Maintainer: Xiao Zhiguo 8 | #* 9 | #* This program is free software: you can redistribute it and/or modify 10 | #* it under the terms of the GNU General Public License as published by 11 | #* the Free Software Foundation, either version 3 of the License, or 12 | #* any later version. 13 | #* 14 | #* This program is distributed in the hope that it will be useful, 15 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | #* GNU General Public License for more details. 18 | #* 19 | #* You should have received a copy of the GNU General Public License 20 | #* along with this program. If not, see . 21 | #* 22 | #*****************************************************************************/ 23 | 24 | find_package(dfm${DTK_VERSION}-base) 25 | PKG_SEARCH_MODULE(DeepinFileManager dde-file-manager IMPORTED_TARGET) 26 | if (dfm${DTK_VERSION}-base_FOUND) 27 | message("dfm-base founded.") 28 | add_definitions(-DDFM_BASE) 29 | elseif(DeepinFileManager_FOUND) 30 | message("dde-file-manager founded.") 31 | endif() 32 | 33 | 34 | #libdeepin-font-manager 35 | SET(LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libdeepin-font-manager) 36 | FILE(GLOB LIB_SRC_FILES ${LIB_DIR}/*.cpp ${LIB_DIR}/*.h) 37 | 38 | FILE(GLOB SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}*.h) 39 | 40 | SET(APP_PLUGIN deepin-font-preview-plugin) 41 | ADD_LIBRARY(${APP_PLUGIN} SHARED "") 42 | 43 | TARGET_SOURCES(${APP_PLUGIN} PRIVATE ${SRC_FILES} ${LIB_SRC_FILES}) 44 | TARGET_INCLUDE_DIRECTORIES(${APP_PLUGIN} PRIVATE ${LIB_DIR}) 45 | TARGET_INCLUDE_DIRECTORIES(${APP_PLUGIN} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 46 | 47 | if (dfm-base_FOUND) 48 | TARGET_INCLUDE_DIRECTORIES(${APP_PLUGIN} PRIVATE ${dfm-base_INCLUDE_DIRS}) 49 | elseif(DeepinFileManager_FOUND) 50 | TARGET_INCLUDE_DIRECTORIES(${APP_PLUGIN} PRIVATE ${DeepinFileManager_INCLUDE_DIRS}) 51 | endif() 52 | 53 | set(LIBS 54 | ${FREETYPE_LIBRARIES} 55 | PkgConfig::FontConfig 56 | Dtk${DTK_VERSION}::Widget 57 | Qt${QT_VERSION_MAJOR}::Core 58 | Qt${QT_VERSION_MAJOR}::Widgets 59 | Qt${QT_VERSION_MAJOR}::Gui 60 | Qt${QT_VERSION_MAJOR}::Sql 61 | ) 62 | if (dfm-base_FOUND) 63 | list(APPEND LIBS dfm-base) 64 | elseif(dde-file-manager_FOUND) 65 | list(APPEND LIBS PkgConfig::DeepinFileManager) 66 | endif() 67 | 68 | TARGET_LINK_LIBRARIES(${APP_PLUGIN} PRIVATE ${LIBS}) 69 | 70 | SET(PLUGIN_INSTALL_DIR lib/${CMAKE_LIBRARY_ARCHITECTURE}/dde-file-manager/plugins/previews) 71 | INSTALL(TARGETS ${APP_PLUGIN} LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR}) 72 | -------------------------------------------------------------------------------- /deepin-font-preview-plugin/deepin-font-preview-plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys" : ["application/x-font-ttf", "application/x-font-type1", "application/x-font-otf", "font/collection", "font/ttf", "font/otf"] 3 | } 4 | -------------------------------------------------------------------------------- /deepin-font-preview-plugin/deepin-font-preview-plugin.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-04-17T11:02:31 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui widgets dtkwidget 8 | 9 | TARGET = deepin-font-preview-plugin 10 | TEMPLATE = lib 11 | CONFIG += plugin link_pkgconfig 12 | PKGCONFIG += freetype2 fontconfig dde-file-manager 13 | 14 | LIBS += -L$$OUT_PWD/../libdeepin-font-manager -ldeepin-font-manager 15 | INCLUDEPATH += $$PWD/../libdeepin-font-manager 16 | 17 | isEqual(ARCH, sw_64){ 18 | DEFINES += SW_CPUINFO 19 | QMAKE_CXXFLAGS += -mieee 20 | } 21 | 22 | isEmpty(LIB_INSTALL_DIR) { 23 | PLUGINDIR = $$[QT_INSTALL_LIBS]/dde-file-manager/plugins 24 | } else { 25 | PLUGINDIR = $$LIB_INSTALL_DIR/dde-file-manager/plugins 26 | } 27 | 28 | SOURCES += \ 29 | main.cpp \ 30 | fontpreview.cpp 31 | 32 | HEADERS += \ 33 | fontpreview.h 34 | DISTFILES += \ 35 | deepin-font-preview-plugin.json 36 | 37 | PLUGIN_INSTALL_DIR = $$PLUGINDIR/previews 38 | 39 | unix { 40 | target.path = $$PLUGIN_INSTALL_DIR 41 | INSTALLS += target 42 | } 43 | -------------------------------------------------------------------------------- /deepin-font-preview-plugin/fontpreview.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef FONTPREVIEWPLUGIN_H 7 | #define FONTPREVIEWPLUGIN_H 8 | 9 | #include "dfontwidget.h" 10 | 11 | #include 12 | 13 | #ifdef DFM_BASE 14 | #include 15 | #else 16 | #include "dfmfilepreview.h" 17 | #include "durl.h" 18 | #endif 19 | 20 | #ifdef DFM_BASE 21 | DFMBASE_BEGIN_NAMESPACE 22 | #else 23 | DFM_BEGIN_NAMESPACE 24 | #endif 25 | 26 | #ifdef DFM_BASE 27 | class FontPreview : public AbstractBasePreview 28 | #else 29 | class FontPreview : public DFMFilePreview 30 | #endif 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit FontPreview(QObject *parent = nullptr); 36 | ~FontPreview()Q_DECL_OVERRIDE; 37 | 38 | #ifdef DFM_BASE 39 | bool setFileUrl(const QUrl &url) override; 40 | QUrl fileUrl() const override; 41 | #else 42 | bool setFileUrl(const DUrl &url) Q_DECL_OVERRIDE; 43 | DUrl fileUrl() const Q_DECL_OVERRIDE; 44 | #endif 45 | 46 | QWidget *contentWidget() const Q_DECL_OVERRIDE; 47 | QString title() const Q_DECL_OVERRIDE; 48 | 49 | private: 50 | #ifdef DFM_BASE 51 | QUrl m_url; 52 | #else 53 | DUrl m_url; 54 | #endif 55 | QString m_title; 56 | 57 | DFontWidget *m_previewWidget; 58 | }; 59 | 60 | #ifdef DFM_BASE 61 | DFMBASE_END_NAMESPACE 62 | #else 63 | DFM_END_NAMESPACE 64 | #endif 65 | 66 | #endif // FONTPREVIEWPLUGIN_H 67 | -------------------------------------------------------------------------------- /deepin-font-preview-plugin/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "fontpreview.h" 7 | 8 | #ifdef DFM_BASE 9 | #include 10 | #else 11 | #include "dde-file-manager/dfmfilepreviewplugin.h" 12 | #endif 13 | 14 | #ifdef DFM_BASE 15 | DFMBASE_BEGIN_NAMESPACE 16 | #else 17 | DFM_BEGIN_NAMESPACE 18 | #endif 19 | 20 | #ifdef DFM_BASE 21 | class TextPreviewPlugin : public AbstractFilePreviewPlugin 22 | #else 23 | class TextPreviewPlugin : public DFMFilePreviewPlugin 24 | #endif 25 | { 26 | Q_OBJECT 27 | #ifdef DFM_BASE 28 | Q_PLUGIN_METADATA(IID FilePreviewFactoryInterface_iid FILE "deepin-font-preview-plugin.json") 29 | #else 30 | Q_PLUGIN_METADATA(IID DFMFilePreviewFactoryInterface_iid FILE "deepin-font-preview-plugin.json") 31 | #endif 32 | 33 | public: 34 | #ifdef DFM_BASE 35 | DFMBASE_NAMESPACE::AbstractBasePreview *create(const QString &) override { 36 | return new FontPreview(); 37 | } 38 | #else 39 | DFMFilePreview *create(const QString &key) Q_DECL_OVERRIDE { 40 | Q_UNUSED(key) 41 | 42 | return new FontPreview(); 43 | } 44 | #endif 45 | }; 46 | 47 | 48 | #ifdef DFM_BASE 49 | DFMBASE_END_NAMESPACE 50 | #else 51 | DFM_END_NAMESPACE 52 | #endif 53 | 54 | #include "main.moc" 55 | -------------------------------------------------------------------------------- /deploy_dep: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-2024 UnionTech Software Technology Co., Ltd. 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #!/bin/bash 6 | set -e 7 | 8 | # 生成安装目录/文件和运行时依赖的必要库 9 | # 获取应用id 10 | ID_VALUE=$(awk -F ': ' '/^ id: / {print $2}' linglong.yaml) 11 | 12 | ## 获取安装的文件列表并写入安装脚本(排除头文件、pc和cmake文件) 13 | # cmake 安装 14 | if ! grep -- "-- Installing:" install.log | sed 's/-- Installing: //' | grep -vE '\.(h|cmake|pc)$' > ${ID_VALUE}.install; then 15 | echo "cmake install files are empty!" 16 | fi 17 | # qmake 安装 18 | if ! grep -- "-install qinstall" install.log | awk '{print $NF}' | grep -vE '\.(h|cmake|pc)$' >> ${ID_VALUE}.install; then 19 | echo "qmake install files are empty!" 20 | fi 21 | # 动态库软连接 22 | if ! grep -- "^ln -f -s " install.log | awk '{print $NF}' >> ${ID_VALUE}.install; then 23 | echo "Get library softlink empty!" 24 | fi 25 | 26 | # glib-compile-schemas 文件添加到 install 文件 27 | for SCHEMAS in "${PREFIX}"/share/glib-2.0/schemas/gschema*; do 28 | if [[ -f "$SCHEMAS" ]]; then 29 | echo "$SCHEMAS" >> "${ID_VALUE}.install" 30 | fi 31 | done 32 | 33 | # 获取依赖的所有文件 34 | for LDFILE in "$@"; do 35 | 36 | # 判断文件是否以 .so 结尾 37 | if [[ "$LDFILE" == *.so ]]; then 38 | FILE_PATH="${PREFIX}/lib/${TRIPLET}/$LDFILE" 39 | 40 | # 添加依赖库到 install 文件 41 | for SOFILE in "${PREFIX}/lib/${TRIPLET}"/${LDFILE}*; do 42 | if [[ -f "$SOFILE" ]]; then 43 | echo "$SOFILE" >> "${ID_VALUE}.install" 44 | fi 45 | done 46 | else 47 | FILE_PATH="${PREFIX}/bin/$LDFILE" 48 | fi 49 | 50 | # 获取依赖库 51 | DEPENDENCIES=$(ldd "$FILE_PATH" | grep "$PREFIX") || continue 52 | if [[ ! -z "$DEPENDENCIES" ]]; then 53 | echo "$DEPENDENCIES" | while IFS= read -r line; do 54 | LIB_PATH=${line##*=> } 55 | LIB_PATH=${LIB_PATH%%(*} 56 | 57 | # 获取基本库名并匹配相关库 58 | LIB_DIR=$(dirname "$LIB_PATH") 59 | BASE_LIB_NAME=$(basename "$LIB_PATH") 60 | 61 | # 使用通配符查找相关库文件并将结果倒序存储到 install 文件 62 | for FILE in "$LIB_DIR"/${BASE_LIB_NAME%.*}*; do 63 | if [[ -f "$FILE" ]]; then 64 | echo "$FILE" 65 | fi 66 | done | sort -r >> "${ID_VALUE}.install" 67 | 68 | done 69 | fi 70 | done 71 | 72 | # 排除静态链接库 73 | #echo '^'${PREFIX}'/'${TRIPLET}'/.+(?> "${ID_VALUE}.install" 74 | #echo '^'${PREFIX}'/lib/.+(?> "${ID_VALUE}.install" 75 | -------------------------------------------------------------------------------- /libdeepin-font-manager/dcopyfilesmanager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #define FONTS_DESKTOP_DIR (QString("%1/%2/").arg(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)).arg(QApplication::translate("DFontMgrMainWindow", "Fonts"))) 13 | 14 | /** 15 | * @brief 拷贝文件线程类 16 | * 进行文件的批量拷贝 17 | */ 18 | class CopyFontThread : public QObject, public QRunnable 19 | { 20 | Q_OBJECT 21 | public: 22 | /** 23 | * @brief The OPType (拷贝类型:导出/安装) 24 | */ 25 | enum OPType { 26 | EXPORT = 0, 27 | INSTALL, 28 | INVALID, 29 | }; 30 | 31 | CopyFontThread(OPType type, short index); 32 | void run() override; 33 | void appendFile(const QString &filePath); 34 | 35 | signals: 36 | void fileInstalled(const QString &familyName, const QString &targetName); 37 | 38 | private: 39 | //拷贝类型:导出 安装 40 | short m_opType; 41 | //线程下标 42 | short m_index; 43 | //需要拷贝文件的源路径列表 44 | QStringList m_srcFiles; 45 | //需要拷贝文件的目标路径列表 46 | QStringList m_targetFiles; 47 | }; 48 | 49 | 50 | class QGSettings; 51 | /** 52 | * @brief 拷贝文件管理类 53 | * 进行文件批量拷贝的管理 54 | */ 55 | class DCopyFilesManager : public QObject 56 | { 57 | Q_OBJECT 58 | 59 | public: 60 | explicit DCopyFilesManager(QObject *parent = nullptr); 61 | 62 | static DCopyFilesManager *instance(); 63 | //拷贝文件列表 64 | void copyFiles(CopyFontThread::OPType type, QStringList &fontList); 65 | //取消安装 66 | static inline void cancelInstall() 67 | { 68 | m_installCanceled = true; 69 | } 70 | 71 | //安装是否已被取消 72 | static inline bool isInstallCanceled() 73 | { 74 | return m_installCanceled; 75 | } 76 | 77 | //获取字体源路径、目标路径和familyName 78 | static QString getTargetPath(const QString &inPath, QString &srcPath, QString &targetPath); 79 | 80 | //删除取消安装时已经安装的字体文件列表 81 | static void deleteFiles(const QStringList &fileList, bool isTarget); 82 | 83 | //获取线程池 84 | inline QThreadPool *getPool() 85 | { 86 | if (m_useGlobalPool) 87 | return QThreadPool::globalInstance(); 88 | 89 | return m_localPool; 90 | } 91 | 92 | //获取排序后的字体列表,默认升序 93 | inline void sortFontList(QStringList &fonts) 94 | { 95 | if (m_sortOrder == 0 || fonts.isEmpty() || fonts.size() == 1) 96 | return; 97 | 98 | int end = fonts.size() / 2; 99 | 100 | for (int i = 0; i < end; ++i) { 101 | #if QT_VERSION_MAJOR > 5 102 | fonts.swapItemsAt(i, fonts.size() - 1 - i); 103 | #else 104 | fonts.swap(i, fonts.size() - 1 - i); 105 | #endif 106 | } 107 | } 108 | 109 | private: 110 | //单例 111 | static DCopyFilesManager *inst; 112 | //专有线程池 113 | QThreadPool *m_localPool; 114 | //文件拷贝类型:导出 安装 115 | static qint8 m_type; 116 | //安装是否被取消 117 | static volatile bool m_installCanceled; 118 | //使用专有线程池还是全局线程池 119 | bool m_useGlobalPool; 120 | //最大线程个数 121 | qint8 m_maxThreadCnt; 122 | //导出最大线程个数 123 | qint8 m_exportMaxThreadCnt; 124 | //安装最大线程个数 125 | qint8 m_installMaxThreadCnt; 126 | //升序倒序 0: asc 1 : desc 127 | qint8 m_sortOrder; 128 | //expiracy time 129 | int m_expiryTimeout; 130 | }; 131 | -------------------------------------------------------------------------------- /libdeepin-font-manager/dfmdbmanager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFMDBMANAGER_H 7 | #define DFMDBMANAGER_H 8 | 9 | #include "dsqliteutil.h" 10 | #include "dfontpreviewitemdef.h" 11 | 12 | class DFMDBManager: public QObject 13 | { 14 | Q_OBJECT 15 | 16 | 17 | public: 18 | static DFMDBManager *instance(); 19 | static QList> recordList; 20 | explicit DFMDBManager(QObject *parent = nullptr); 21 | ~DFMDBManager(); 22 | 23 | QList getAllFontInfo(QList *deletedFontInfo = nullptr); 24 | QList getFontInfo(const int count, QList *deletedFontInfo = nullptr); 25 | QList getFontInfo(QList> list, QList *deletedFontInfo = nullptr); 26 | int getRecordCount(); 27 | int getCurrMaxFontId(); 28 | QStringList getInstalledFontsPath(); 29 | QString isFontInfoExist(const DFontInfo &newFileFontInfo); 30 | // 获取指定字体文件的fontname列表 31 | QStringList getSpecifiedFontName(const QString &filePath); 32 | bool addFontInfo(const DFontPreviewItemData &itemData); 33 | bool updateFontInfo(const QMap &whereMap, const QMap &dataMap); 34 | 35 | void updateSP3FamilyName(const QList &fontList, bool inFontList = false); 36 | 37 | // batch operation 38 | void commitAddFontInfo(); 39 | void addFontInfo(const QList &fontList); 40 | void deleteFontInfo(const DFontPreviewItemData &itemData); 41 | void deleteFontInfo(const QList &fontList); 42 | void commitDeleteFontInfo(); 43 | void updateFontInfo(const DFontPreviewItemData &itemData, const QString &strKey); 44 | void updateFontInfo(const QList &fontList, const QString &strKey); 45 | void commitUpdateFontInfo(); 46 | void getAllRecords(); 47 | void syncOldRecords(); 48 | //去除非法记录 49 | void checkIfEmpty(); 50 | //开启事务 51 | void beginTransaction() 52 | { 53 | m_sqlUtil->m_db.transaction(); 54 | } 55 | //关闭事务 56 | void endTransaction() 57 | { 58 | m_sqlUtil->m_db.commit(); 59 | } 60 | 61 | bool isSystemFont(const QString &filePath) 62 | { 63 | return filePath.contains("/usr/share/fonts/"); 64 | } 65 | 66 | //获取数据库是否被清空重建 67 | bool isDBDeleted(){return m_sqlUtil->isDBDeleted();} 68 | private: 69 | DFontPreviewItemData parseRecordToItemData(const QMap &record); 70 | QMap mapItemData(DFontPreviewItemData itemData); 71 | DFontInfo getDFontInfo(const QMap &record); 72 | inline void appendAllKeys(QList &keyList); 73 | 74 | DSqliteUtil *m_sqlUtil; 75 | QList m_addFontList; 76 | QList m_delFontList; 77 | QList m_updateFontList; 78 | QString m_strKey; 79 | }; 80 | 81 | #endif // DFMDBMANAGER_H 82 | -------------------------------------------------------------------------------- /libdeepin-font-manager/dfontloadthread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "dfontloadthread.h" 7 | #include 8 | #include 9 | 10 | DFontLoadThread::DFontLoadThread(QObject *parent) 11 | : QThread(parent) 12 | { 13 | qDebug() << "DFontLoadThread created"; 14 | } 15 | 16 | DFontLoadThread::~DFontLoadThread() 17 | { 18 | } 19 | 20 | void DFontLoadThread::open(const QString &filepath) 21 | { 22 | qDebug() << "Preparing to load font file:" << filepath; 23 | m_filePath = filepath; 24 | } 25 | 26 | void DFontLoadThread::run() 27 | { 28 | qDebug() << "Starting to load font file:" << m_filePath; 29 | QFile file(m_filePath); 30 | 31 | if (file.open(QIODevice::ReadOnly)) { 32 | qDebug() << "Successfully opened font file:" << m_filePath; 33 | QByteArray fileContent = file.readAll(); 34 | qDebug() << "Read" << fileContent.size() << "bytes from font file"; 35 | 36 | emit loadFinished(fileContent); 37 | } else { 38 | qWarning() << "Failed to open font file:" << m_filePath << "Error:" << file.errorString(); 39 | emit loadFinished(QByteArray()); 40 | } 41 | 42 | file.close(); 43 | qDebug() << "Font loading thread finished"; 44 | } 45 | -------------------------------------------------------------------------------- /libdeepin-font-manager/dfontloadthread.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFONTLOADTHREAD_H 7 | #define DFONTLOADTHREAD_H 8 | 9 | #include 10 | 11 | class DFontLoadThread : public QThread 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit DFontLoadThread(QObject *parent = nullptr); 17 | ~DFontLoadThread(); 18 | 19 | void run(); 20 | void open(const QString &filepath); 21 | 22 | signals: 23 | void loadFinished(const QByteArray &data); 24 | 25 | private: 26 | QString m_filePath; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /libdeepin-font-manager/dfontpreview.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFONTPREVIEW_H 7 | #define DFONTPREVIEW_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #include FT_FREETYPE_H 16 | 17 | /************************************************************************* 18 | DFontPreview 19 | 字体预览视图类 20 | 21 | null 22 | *************************************************************************/ 23 | class DFontPreview : public QWidget 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit DFontPreview(QWidget *parent = nullptr); 29 | ~DFontPreview(); 30 | //传入当前预览字体的路径 31 | void setFileUrl(const QString &url); 32 | //检查字体库中是否有当前字符信息 33 | static bool checkFontContainText(FT_Face face, const QString &text); 34 | //构建预览字符串 35 | static QString buildCharlistForFace(FT_Face face, int length); 36 | 37 | QFontDatabase fontDatabase; 38 | 39 | bool m_needScroll = false; 40 | int viewWidth = 1204; 41 | int currentMaxWidth = 1; 42 | protected: 43 | //重写绘图事件-实现预览效果 44 | void paintEvent(QPaintEvent *); 45 | //获取预览绘制的起始点 46 | QPoint adjustPreviewFontBaseLinePoint(const QRect &fontPreviewRect, const QFontMetrics &previewFontMetrics) const; 47 | //判断是否需要出现底部水平滚动条 48 | void isNeedScroll(const int width); 49 | 50 | private: 51 | //初始化预览文本内容 52 | void initContents(); 53 | //获取预览文本-获取小写英文文本 54 | QString getSampleString(); 55 | //获得当前语言下可预览字符串 56 | QString getLanguageSampleString(const QString &language); 57 | 58 | private: 59 | FT_Library m_library; 60 | FT_Face m_face; 61 | FT_Error m_error = 1; 62 | QHash m_contents; 63 | }; 64 | 65 | #endif // DFONTPREVIEW_H 66 | -------------------------------------------------------------------------------- /libdeepin-font-manager/dfontwidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef DFONTWIDGET_H 7 | #define DFONTWIDGET_H 8 | 9 | #include "dspinner.h" 10 | #include "dfontpreview.h" 11 | #include "dfontloadthread.h" 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | DWIDGET_USE_NAMESPACE 22 | 23 | /************************************************************************* 24 | DFontWidget 25 | 字体预览类 26 | 27 | null 28 | *************************************************************************/ 29 | class DFontWidget : public QWidget 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit DFontWidget(QWidget *parent = nullptr); 35 | ~DFontWidget() override; 36 | //传入字体路径 37 | void setFileUrl(const QString &url); 38 | QSize sizeHint() const override; 39 | protected: 40 | 41 | private: 42 | //显示预览结果 43 | void handleFinished(const QByteArray &data); 44 | 45 | private: 46 | QStackedLayout *m_layout; 47 | DFontPreview *m_preview; 48 | DScrollArea *m_area; 49 | DFontLoadThread *m_thread; 50 | DSpinner *m_spinner; 51 | QString m_filePath; 52 | QLabel *m_errMsg; 53 | QTranslator m_translator; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /libdeepin-font-manager/pkgconfig/deepin-font-manager.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | 7 | Name: deepin-font-manager 8 | Description: Deepin Font Manager Header Files 9 | Version: 1.0.0 10 | Libs: -ldeepin-font-manager 11 | Cflags: 12 | 13 | -------------------------------------------------------------------------------- /libdeepin-font-manager/schemas/com.deepin.font-manager.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 7 | use global thread pool: false(0) and true(1) 8 | 9 | 10 | -1 11 | 12 | max-thread-count 13 | 14 | 15 | -1 16 | 17 | export-max-thread-count 18 | 19 | 20 | -1 21 | 22 | install-max-thread-count 23 | 24 | 25 | 1 26 | 27 | sort order: asc(0) and desc(1) 28 | 29 | 30 | -1 31 | 32 | expiry timeout 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /libdeepin-font-manager/signalmanager.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "signalmanager.h" 7 | 8 | #include 9 | 10 | bool SignalManager::m_isOnLoad = false; 11 | bool SignalManager::m_isOnStartupLoad = false; 12 | bool SignalManager::m_isDataLoadFinish = false; 13 | 14 | SignalManager *SignalManager::m_signalManager = nullptr; 15 | 16 | 17 | /************************************************************************* 18 | instance 19 | 信号处理类对象单例构造函数 20 | 21 | null 22 | SignalManager::instance() Description:返回信号管理类对象的单例 23 | null 24 | *************************************************************************/ 25 | SignalManager *SignalManager::instance() 26 | { 27 | if (m_signalManager == nullptr) { 28 | qDebug() << "Creating new SignalManager instance"; 29 | m_signalManager = new SignalManager; 30 | } else { 31 | qDebug() << "Using existing SignalManager instance"; 32 | } 33 | 34 | return m_signalManager; 35 | } 36 | 37 | SignalManager::~SignalManager() 38 | { 39 | qDebug() << "Destroying SignalManager instance"; 40 | m_signalManager = nullptr; 41 | } 42 | 43 | /************************************************************************* 44 | SignalManager 45 | 构造函数 46 | 47 | 48 | parent Description:父对象 49 | SignalManager Description:返回信号管理类对象 50 | null 51 | *************************************************************************/ 52 | SignalManager::SignalManager(QObject *parent) : QObject(parent) 53 | { 54 | qDebug() << "SignalManager initialized"; 55 | } 56 | -------------------------------------------------------------------------------- /libdeepin-font-manager/signalmanager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef SIGNALMANAGER_H 7 | #define SIGNALMANAGER_H 8 | 9 | #include 10 | #include 11 | 12 | /************************************************************************* 13 | SignalManager 14 | 信号管理类-负责信号分发管理 15 | 16 | null 17 | *************************************************************************/ 18 | class SignalManager : public QObject 19 | { 20 | Q_OBJECT 21 | public: 22 | static SignalManager *instance(); 23 | ~SignalManager(); 24 | signals: 25 | //触发完成安装信号 26 | void finishFontInstall(const QStringList &fileList); 27 | 28 | //触发刷新用户字体列表信号 29 | void refreshUserFont(); 30 | 31 | //触发大小改变信号 32 | void sizeChange(int height); 33 | //触发弹出字体验证框请求 34 | void popInstallErrorDialog(); 35 | //触发字体验证框隐藏信号 36 | void hideInstallErrorDialog(); 37 | //触发字体验证框列表刷新信号 38 | void updateInstallErrorListview(QStringList &errorFileList, QStringList &halfInstalledFiles, 39 | QStringList &addHalfInstalledFiles, QStringList &oldHalfInstalledFiles); 40 | //触发字体验证框弹出中途安装信号 41 | void installDuringPopErrorDialog(const QStringList &fileList); 42 | //触发左侧菜单栏是否可滚动信号 43 | void setSpliteWidgetScrollEnable(bool isInstalling); 44 | //触发字体列表改变信号 45 | void changeView(); 46 | //触发删除确认取消信号 47 | void cancelDel(); 48 | //触发更新预览大小跟随滑块信号 49 | void fontSizeRequestToSlider(); 50 | //触发切换焦点至菜单 51 | void requestSetLeftSiderBarFocus(); 52 | //清空待恢复选中状态索引列表 53 | void clearRecoverList(); 54 | //更新标志位:是否从字体列表获取焦点 55 | void setLostFocusState(bool isTrue); 56 | //请求设置addbutton焦点 57 | void requestSetTabFocusToAddBtn(); 58 | //右键菜单关闭请求触发操作 59 | void menuHidden(); 60 | private: 61 | explicit SignalManager(QObject *parent = nullptr); 62 | public: 63 | static bool m_isOnLoad; 64 | static bool m_isOnStartupLoad; 65 | static bool m_isDataLoadFinish; 66 | 67 | private: 68 | static SignalManager *m_signalManager; 69 | }; 70 | 71 | #endif // SIGNALMANAGER_H 72 | -------------------------------------------------------------------------------- /tests/cmake-lcov-test.sh: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | utdir=build-ut 6 | rm -r $utdir 7 | rm -r ../$utdir 8 | mkdir ../$utdir 9 | cd ../$utdir 10 | 11 | cmake -DCMAKE_BUILD_TYPE=Debug .. 12 | make -j16 13 | 14 | ./tests/font-manager-test --gtest_output=xml:./report/report.xml 15 | 16 | mkdir -p report 17 | 18 | lcov -d ../ -c -o ./report/coverage.info 19 | 20 | lcov --extract ./report/coverage.info '*/deepin-font-manager/*' '*/deepin-font-preview-plugin/*' '*/libdeepin-font-manager/*' -o ./report/coverage.info 21 | 22 | lcov --remove ./report/coverage.info '*/tests/*' -o ./report/coverage.info 23 | 24 | genhtml -o ./report ./report/coverage.info 25 | 26 | exit 0 -------------------------------------------------------------------------------- /tests/include/commonheaderfile.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #ifndef COMMONHEADERFILE_H 7 | #define COMMONHEADERFILE_H 8 | 9 | #define SAFE_DELETE_ELE( ptr ) \ 10 | if (ptr != nullptr) \ 11 | { \ 12 | delete ptr; \ 13 | ptr = nullptr; \ 14 | } 15 | 16 | #define SAFE_DELETE_ARRAY( ptr ) \ 17 | if (ptr != nullptr) \ 18 | { \ 19 | delete[] ptr; \ 20 | ptr = nullptr; \ 21 | } 22 | 23 | #endif // COMMONHEADERFILE_H 24 | -------------------------------------------------------------------------------- /tests/src/deepin-font-manager-test/interfaces/ut_dfontbasedialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "dfontbasedialog.h" 7 | 8 | #include 9 | 10 | #include "../third-party/stub/stub.h" 11 | #include "utils.h" 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace { 19 | class TestDFontBaseDialog : public testing::Test 20 | { 21 | 22 | protected: 23 | void SetUp() 24 | { 25 | fm = new DFontBaseDialog(w); 26 | } 27 | void TearDown() 28 | { 29 | delete fm; 30 | } 31 | // Some expensive resource shared by all tests. 32 | QWidget *w = new QWidget; 33 | DFontBaseDialog *fm; 34 | }; 35 | } 36 | 37 | 38 | 39 | TEST_F(TestDFontBaseDialog, checkSetIconPixmap) 40 | { 41 | #if QT_VERSION_MAJOR <= 5 42 | QPixmap map(Utils::renderSVG("://ok.svg", QSize(32, 32))); 43 | 44 | fm->setIconPixmap(map); 45 | EXPECT_TRUE(*fm->m_logoIcon->pixmap() == map); 46 | #endif 47 | } 48 | 49 | TEST_F(TestDFontBaseDialog, checkGetCloseButton) 50 | { 51 | DWindowCloseButton *b = fm->getCloseButton(); 52 | EXPECT_TRUE(b == fm->m_closeButton); 53 | } 54 | 55 | TEST_F(TestDFontBaseDialog, checkSetLogoVisable) 56 | { 57 | //设置为true,但结果仍不可见,怀疑时没有窗口弹出的问题,与代码无关。 58 | 59 | fm->setLogoVisable(false); 60 | EXPECT_TRUE(fm->m_logoIcon->isVisible() == false); 61 | } 62 | 63 | TEST_F(TestDFontBaseDialog, checkSetTitle) 64 | { 65 | fm->setTitle("first"); 66 | EXPECT_TRUE(fm->m_tileText->text() == "first"); 67 | } 68 | 69 | TEST_F(TestDFontBaseDialog, checkGetContentLayout) 70 | { 71 | QLayout * vbl = fm->getContentLayout(); 72 | EXPECT_TRUE(fm->m_contentLayout == vbl); 73 | } 74 | 75 | TEST_F(TestDFontBaseDialog, checkAddContent) 76 | { 77 | QWidget *w = new QWidget; 78 | fm->addContent(w); 79 | EXPECT_FALSE(fm->getContentLayout()->isEmpty()); 80 | } 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /tests/src/deepin-font-manager-test/interfaces/ut_getuseraddfontthread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "getuseraddfontthread.h" 7 | #include "dcomworker.h" 8 | #include "dfontpreviewlistdatathread.h" 9 | 10 | #include 11 | #include "../third-party/stub/stub.h" 12 | //#include "commonheaderfile.h" 13 | 14 | 15 | #include 16 | 17 | namespace { 18 | class TestGetUserAddFontThread : public testing::Test 19 | { 20 | 21 | protected: 22 | void SetUp() 23 | { 24 | fm = new GetUserAddFontThread(); 25 | } 26 | void TearDown() 27 | { 28 | delete fm; 29 | } 30 | 31 | GetUserAddFontThread *fm; 32 | }; 33 | } 34 | 35 | TEST_F(TestGetUserAddFontThread, initTest) 36 | { 37 | 38 | } 39 | 40 | void getChineseAndMonoFont_stub() 41 | { 42 | return; 43 | } 44 | void onRefreshUserAddFont_stub(QList &fontInfoList) 45 | { 46 | return; 47 | } 48 | 49 | QStringList getAllFclistPathList_stub() 50 | { 51 | QStringList strlist; 52 | strlist << "111" << "22334"; 53 | return strlist; 54 | } 55 | 56 | TEST_F(TestGetUserAddFontThread, checkrun) 57 | { 58 | Stub stub; 59 | stub.set(ADDR(FontManager, getChineseAndMonoFont), getChineseAndMonoFont_stub); 60 | stub.set(ADDR(DFontPreviewListDataThread, onRefreshUserAddFont), onRefreshUserAddFont_stub); 61 | stub.set(ADDR(DFontInfoManager, getAllFclistPathList), getAllFclistPathList_stub); 62 | fm->run(); 63 | } 64 | -------------------------------------------------------------------------------- /tests/src/deepin-font-manager-test/interfaces/ut_loadfontdatathread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "loadfontdatathread.h" 7 | #include "dfontpreviewlistview.h" 8 | #include "dfmdbmanager.h" 9 | #include "../third-party/stub/stub.h" 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | 17 | 18 | namespace { 19 | class TestLoadFontDataThread : public testing::Test 20 | { 21 | 22 | protected: 23 | void SetUp() 24 | { 25 | fpm = new LoadFontDataThread(list); 26 | } 27 | void TearDown() 28 | { 29 | delete fpm; 30 | } 31 | // Some expensive resource shared by all tests. 32 | LoadFontDataThread *fpm; 33 | QList> list; 34 | }; 35 | 36 | QList stub_getFontInfo(void *obj, QList>, QList *) 37 | { 38 | QList list; 39 | DFontPreviewItemData data; 40 | data.appFontId = 1; 41 | 42 | list << data; 43 | 44 | return list; 45 | } 46 | 47 | } 48 | 49 | TEST_F(TestLoadFontDataThread, checkDowork) 50 | { 51 | Stub stub; 52 | stub.set((QList(DFMDBManager::*)(QList>, QList *)) 53 | ADDR(DFMDBManager, getFontInfo), stub_getFontInfo); 54 | 55 | DFontPreviewListDataThread::instance()->m_fontModelList.clear(); 56 | DFontPreviewItemData ptiemdata; 57 | fpm->m_delFontInfoList.append(ptiemdata); 58 | 59 | fpm->run(); 60 | EXPECT_TRUE(1 == DFontPreviewListDataThread::instance()->m_fontModelList.count()); 61 | EXPECT_FALSE(SignalManager::m_isOnLoad); 62 | EXPECT_TRUE(SignalManager::m_isDataLoadFinish); 63 | } 64 | -------------------------------------------------------------------------------- /tests/src/deepin-font-manager-test/ut_utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "utils.h" 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include "../third-party/stub/stub.h" 15 | //#include "commonheaderfile.h" 16 | 17 | namespace { 18 | class TestUtils : public testing::Test 19 | { 20 | 21 | protected: 22 | void SetUp() 23 | { 24 | fm = new Utils(); 25 | } 26 | void TearDown() 27 | { 28 | delete fm; 29 | } 30 | 31 | Utils *fm; 32 | 33 | }; 34 | } 35 | 36 | TEST_F(TestUtils, initTest) 37 | { 38 | 39 | } 40 | 41 | TEST_F(TestUtils, checksuffixList) 42 | { 43 | EXPECT_EQ(fm->suffixList().toStdString(), "Font Files (*.ttf *.ttc *.otf)"); 44 | } 45 | 46 | TEST_F(TestUtils, checkisFontMimeType) 47 | { 48 | EXPECT_EQ(fm->isFontMimeType("方正兰亭特黑_SC.otf"), false); 49 | } 50 | 51 | TEST_F(TestUtils, checkgetConfigPath) 52 | { 53 | EXPECT_EQ(fm->getConfigPath().isEmpty(), false); 54 | } 55 | 56 | 57 | TEST_F(TestUtils, checkrenderSVG_001) 58 | { 59 | EXPECT_EQ(fm->renderSVG("://ok.svg", QSize(32, 32)).isNull(), false); 60 | } 61 | 62 | TEST_F(TestUtils, checkconvertToPreviewString) 63 | { 64 | EXPECT_EQ(fm->convertToPreviewString("", "hello").toStdString(), "hello"); 65 | } 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /tests/src/deepin-font-manager-test/views/ut_dfontspinner.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "views/dfontspinner.h" 7 | 8 | 9 | #include 10 | #include "../third-party/stub/stub.h" 11 | #include "commonheaderfile.h" 12 | #include "utils.h" 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | namespace { 24 | class TestDFontSpinner : public testing::Test 25 | { 26 | 27 | protected: 28 | void SetUp() 29 | { 30 | fs = new DFontSpinner(w); 31 | } 32 | void TearDown() 33 | { 34 | delete fs; 35 | delete w; 36 | } 37 | // Some expensive resource shared by all tests. 38 | QWidget *w = new QWidget; 39 | DFontSpinner *fs; 40 | }; 41 | static QString g_funcname; 42 | void stub_start(void *) 43 | { 44 | g_funcname = __FUNCTION__; 45 | } 46 | 47 | void stub_stop() 48 | { 49 | g_funcname = __FUNCTION__; 50 | } 51 | void stub_addEllipse(void *, const QRectF &) 52 | { 53 | g_funcname = __FUNCTION__; 54 | } 55 | void stub_clear(void *) 56 | { 57 | g_funcname = __FUNCTION__; 58 | } 59 | } 60 | 61 | 62 | TEST_F(TestDFontSpinner, checkStart) 63 | { 64 | Stub s; 65 | s.set((void(QTimer::*)())ADDR(QTimer, start), stub_start); 66 | 67 | fs->start(); 68 | EXPECT_TRUE(g_funcname == QLatin1String("stub_start")); 69 | } 70 | 71 | TEST_F(TestDFontSpinner, checkPaintEvent) 72 | { 73 | Stub s; 74 | s.set((void(QPainterPath::*)(const QRectF &))ADDR(QPainterPath, addEllipse), stub_addEllipse); 75 | 76 | QRect f; 77 | QPaintEvent *paint = new QPaintEvent(f); 78 | fs->paintEvent(paint); 79 | SAFE_DELETE_ELE(paint) 80 | EXPECT_TRUE(g_funcname == QLatin1String("stub_addEllipse")); 81 | } 82 | 83 | 84 | TEST_F(TestDFontSpinner, checkChangeEvent) 85 | { 86 | Stub s; 87 | s.set((void(QList>::*)())ADDR(QList>, clear), stub_clear); 88 | 89 | QEvent *e = new QEvent(QEvent::PaletteChange); 90 | fs->changeEvent(e); 91 | SAFE_DELETE_ELE(e) 92 | EXPECT_TRUE(g_funcname == QLatin1String("stub_clear")); 93 | } 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /tests/src/deepin-font-manager-test/views/ut_dfontspinnerwidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "views/dfontspinnerwidget.h" 7 | 8 | 9 | #include 10 | #include "../third-party/stub/stub.h" 11 | #include "utils.h" 12 | 13 | #include "views/dfontspinnerwidget.h" 14 | #include "views/dfontspinner.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | namespace { 23 | class TestDFontSpinnerWidget : public testing::Test 24 | { 25 | 26 | protected: 27 | void SetUp() 28 | { 29 | fsp = new DFontSpinnerWidget(w); 30 | } 31 | void TearDown() 32 | { 33 | delete fsp; 34 | } 35 | // Some expensive resource shared by all tests. 36 | QWidget *w = new QWidget; 37 | DFontSpinnerWidget *fsp; 38 | }; 39 | 40 | static QString g_funcname; 41 | void stub_start(void *) 42 | { 43 | g_funcname = __FUNCTION__; 44 | } 45 | 46 | void stub_stop() 47 | { 48 | g_funcname = __FUNCTION__; 49 | } 50 | } 51 | 52 | TEST_F(TestDFontSpinnerWidget, checkStartAndStop) 53 | { 54 | Stub s; 55 | s.set(ADDR(DFontSpinner, stop), stub_stop); 56 | s.set(ADDR(DFontSpinner, start), stub_start); 57 | 58 | fsp->spinnerStart(); 59 | EXPECT_TRUE(g_funcname == QLatin1String("stub_start")); 60 | fsp->spinnerStop(); 61 | EXPECT_TRUE(g_funcname == QLatin1String("stub_stop")); 62 | } 63 | 64 | TEST_F(TestDFontSpinnerWidget, checkSetStyles) 65 | { 66 | fsp->setStyles(DFontSpinnerWidget::SpinnerStyles::Load); 67 | EXPECT_TRUE(fsp->m_label->text() == "Loading fonts, please wait..."); 68 | 69 | fsp->setStyles(DFontSpinnerWidget::SpinnerStyles::Delete); 70 | EXPECT_TRUE(fsp->m_label->text() == "Deleting fonts, please wait..."); 71 | 72 | fsp->setStyles(DFontSpinnerWidget::SpinnerStyles::NoLabel); 73 | EXPECT_TRUE(fsp->m_label->text() == QString()); 74 | } 75 | -------------------------------------------------------------------------------- /tests/src/deepin-font-manager-test/views/ut_fonticontext.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "views/fonticontext.h" 7 | #include "commonheaderfile.h" 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include "../third-party/stub/stub.h" 20 | #include "utils.h" 21 | 22 | 23 | namespace { 24 | class TestFontIconText : public testing::Test 25 | { 26 | 27 | protected: 28 | void SetUp() 29 | { 30 | fit = new FontIconText(""); 31 | } 32 | void TearDown() 33 | { 34 | delete fit; 35 | } 36 | 37 | // Some expensive resource shared by all tests. 38 | QWidget *w = new QWidget; 39 | FontIconText *fit; 40 | }; 41 | 42 | class TestcheckStyleName : public::testing::TestWithParam 43 | { 44 | public: 45 | FontIconText *fit = new FontIconText(""); 46 | }; 47 | 48 | 49 | } 50 | 51 | TEST_F(TestFontIconText, checkPaintEvent) 52 | { 53 | QPaintEvent *e = new QPaintEvent(QRect()); 54 | 55 | fit->setContent(true); 56 | EXPECT_TRUE(fit->m_isTtf); 57 | fit->paintEvent(e); 58 | 59 | fit->setContent(false); 60 | EXPECT_FALSE(fit->m_isTtf); 61 | fit->paintEvent(e); 62 | 63 | SAFE_DELETE_ELE(e) 64 | } 65 | 66 | 67 | //checkStyleName 函数出错 20200806 68 | TEST_P(TestcheckStyleName, checkStyleName_Is_Normal) 69 | { 70 | QString n = GetParam(); 71 | 72 | fit->setFontName("first", n); 73 | EXPECT_TRUE(fit->m_font.family() == QLatin1String("first")); 74 | } 75 | 76 | 77 | INSTANTIATE_TEST_CASE_P(HandleTrueReturn, TestcheckStyleName, testing::Values("Italic", "Regular", "Light", "Thin", "ExtraLight", 78 | "ExtraBold", "Medium", "DemiBold", "Black")); 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /tests/src/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // 首先要添加安全性测试的接口头文件 11 | #if defined(CMAKE_SAFETYTEST_ARG_ON) 12 | #include 13 | #endif 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | qDebug() << "start libdeepin-font-manager test cases .............."; 18 | 19 | qputenv("QT_QPA_PLATFORM", "offscreen"); 20 | QApplication application(argc, argv); 21 | 22 | ::testing::InitGoogleTest(&argc, argv); 23 | int ret = RUN_ALL_TESTS(); 24 | qDebug() << "end libdeepin-font-manager test cases .............."; 25 | 26 | // 之后在程序函数主入口添加log输出的代码 27 | #if defined(CMAKE_SAFETYTEST_ARG_ON) 28 | __sanitizer_set_report_path("asan.log"); 29 | #endif 30 | 31 | return ret; 32 | } 33 | -------------------------------------------------------------------------------- /tests/src/ut_dfontloadthread.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "dfontloadthread.h" 7 | 8 | #include 9 | #include "../third-party/stub/stub.h" 10 | 11 | #include "dfontinfomanager.h" 12 | #include "dsqliteutil.h" 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | namespace { 19 | class TestDdFontloadthread : public testing::Test 20 | { 21 | 22 | protected: 23 | void SetUp() 24 | { 25 | flt = new DFontLoadThread; 26 | } 27 | void TearDown() 28 | { 29 | delete flt; 30 | } 31 | // Some expensive resource shared by all tests. 32 | DFontLoadThread *flt; 33 | }; 34 | 35 | static QString g_funcname; 36 | QByteArray stub_readAll() 37 | { 38 | g_funcname = __FUNCTION__; 39 | return QByteArray(); 40 | } 41 | bool stub_open(QIODevice::OpenMode) 42 | { 43 | g_funcname = __FUNCTION__; 44 | return true; 45 | } 46 | } 47 | 48 | TEST_F(TestDdFontloadthread, checkopen) 49 | { 50 | flt->open("testfilepath"); 51 | EXPECT_TRUE(flt->m_filePath == "testfilepath"); 52 | } 53 | 54 | TEST_F(TestDdFontloadthread, checkRun) 55 | { 56 | QSignalSpy spy(flt, SIGNAL(loadFinished(QByteArray))); 57 | flt->open(""); 58 | g_funcname.clear(); 59 | flt->run(); 60 | EXPECT_EQ(1, spy.count()); 61 | EXPECT_TRUE(g_funcname.isEmpty()); 62 | 63 | Stub s; 64 | s.set(ADDR(QIODevice, readAll), stub_readAll); 65 | typedef bool (*fptr)(QFile *, QIODevice::OpenMode); 66 | fptr QFile_open = (fptr)((bool(QFile::*)(QIODevice::OpenMode))&QFile::open); //获取虚函数地址 67 | s.set(QFile_open, stub_open); 68 | 69 | flt->open("/usr123/share/fonts/truetype/noto/NotoSansNKo-Regular.ttf"); 70 | flt->run(); 71 | EXPECT_EQ(2, spy.count()); 72 | EXPECT_TRUE(g_funcname == QLatin1String("stub_readAll")); 73 | } 74 | -------------------------------------------------------------------------------- /tests/src/ut_dfontpreviewLib.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "dfontpreview.h" 7 | #include "dfontwidget.h" 8 | 9 | #include 10 | #include 11 | #if QT_VERSION_MAJOR <= 5 12 | #include 13 | #endif 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include "../third-party/stub/stub.h" 27 | #include "commonheaderfile.h" 28 | 29 | #define FTM_DEFAULT_PREVIEW_CN_TEXT QString("因理想而出生,为责任而成长") 30 | #define FTM_DEFAULT_PREVIEW_EN_TEXT QString("Don't let your dreams be dreams") 31 | #define FTM_DEFAULT_PREVIEW_DIGIT_TEXT QString("0123456789") 32 | 33 | namespace { 34 | class TestDFontPreview : public testing::Test 35 | { 36 | 37 | protected: 38 | void SetUp() 39 | { 40 | fp = new DFontPreview(); 41 | } 42 | void TearDown() 43 | { 44 | SAFE_DELETE_ELE(fp) 45 | } 46 | // Some expensive resource shared by all tests. 47 | DFontPreview *fp; 48 | }; 49 | 50 | static QString g_funcname; 51 | QString stub_getSampleString() 52 | { 53 | g_funcname = __FUNCTION__; 54 | return "SampleString"; 55 | } 56 | // typedef struct FT_FaceRec_* FT_Face; 57 | FT_Error stub_FT_New_Face(FT_Library, const char *, FT_Long, FT_Face *aface) 58 | { 59 | *aface = new FT_FaceRec_; 60 | (*aface)->style_name = new char[8]; 61 | const char *tmp = "Regular"; 62 | memcpy((*aface)->style_name, tmp, 8); 63 | return 0; 64 | } 65 | FT_Error stub_FT_Done_Face(FT_Face face) 66 | { 67 | SAFE_DELETE_ARRAY(face->style_name) 68 | SAFE_DELETE_ELE(face) 69 | return 0; 70 | } 71 | } 72 | 73 | TEST_F(TestDFontPreview, checkSetFileUrl) 74 | { 75 | Stub s; 76 | s.set(ADDR(DFontPreview, getSampleString), stub_getSampleString); 77 | 78 | //传入错误参数 79 | g_funcname.clear(); 80 | fp->setFileUrl("file:///usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf"); 81 | EXPECT_FALSE(g_funcname == QLatin1String("stub_getSampleString")); 82 | 83 | s.set(FT_New_Face, stub_FT_New_Face); 84 | s.set(FT_Done_Face, stub_FT_Done_Face); 85 | //传入正常参数 86 | fp->setFileUrl("/usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf"); 87 | EXPECT_TRUE(g_funcname == QLatin1String("stub_getSampleString")); 88 | SAFE_DELETE_ELE(fp) 89 | } 90 | 91 | TEST_F(TestDFontPreview, checkPaintEvent) 92 | { 93 | 94 | QRect r; 95 | QString filepath = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf"; 96 | QFile file(filepath); 97 | file.open(QIODevice::ReadOnly); 98 | QByteArray fileContent = file.readAll(); 99 | 100 | qDebug() << fp->fontDatabase.addApplicationFontFromData(fileContent); 101 | 102 | fp->setFileUrl(filepath); 103 | QPaintEvent *p = new QPaintEvent(r); 104 | fp->m_error = false; 105 | //不要滚动条 106 | fp->paintEvent(p); 107 | 108 | //要滚动条 109 | fp->currentMaxWidth = 1500; 110 | fp->paintEvent(p); 111 | 112 | SAFE_DELETE_ELE(p) 113 | } 114 | 115 | TEST_F(TestDFontPreview, checkGetLanguageSampleString) 116 | { 117 | fp->m_contents.clear(); 118 | fp->m_contents.insert("es", "first"); 119 | //不存在的语言 120 | EXPECT_TRUE(fp->getLanguageSampleString("first").isEmpty()); 121 | 122 | //构建特殊语言 123 | EXPECT_TRUE(fp->getLanguageSampleString("es_first") == "first"); 124 | } 125 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /tests/src/ut_dfontpreviewitemdef.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "dfontpreviewitemdef.h" 7 | 8 | #include 9 | #include "../third-party/stub/stub.h" 10 | 11 | namespace { 12 | class TestFontData : public testing::Test 13 | { 14 | 15 | protected: 16 | 17 | }; 18 | } 19 | 20 | TEST_F(TestFontData, checkFontData) 21 | { 22 | FontData fd("aaa", true, false, false, true, FontType::OTF, true); 23 | EXPECT_EQ(fd.isEnabled(), true); 24 | EXPECT_EQ(fd.isCollected(), false); 25 | EXPECT_EQ(fd.isChinese(), false); 26 | EXPECT_EQ(fd.isMonoSpace(), true); 27 | 28 | FontData fd2("aaa", true, false, false, true, "TrueType", true); 29 | EXPECT_EQ(fd2.isEnabled(), true); 30 | EXPECT_EQ(fd2.isCollected(), false); 31 | EXPECT_EQ(fd2.isChinese(), false); 32 | EXPECT_EQ(fd2.isMonoSpace(), true); 33 | 34 | fd2.setFontType(FontType::TTF); 35 | EXPECT_EQ(fd2.getFontType(), FontType::TTF); 36 | fd2.setFontType(FontType::TTC); 37 | EXPECT_EQ(fd2.getFontType(), FontType::TTC); 38 | fd2.setFontType(FontType::UNKNOWN); 39 | EXPECT_EQ(fd2.getFontType(), FontType::UNKNOWN); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /tests/src/ut_dfontwidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include "dfontwidget.h" 7 | 8 | #include 9 | #include "../third-party/stub/stub.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace { 17 | class TestDFontWidget : public testing::Test 18 | { 19 | protected: 20 | void SetUp() 21 | { 22 | fw = new DFontWidget(); 23 | } 24 | void TearDown() 25 | { 26 | delete fw; 27 | } 28 | // Some expensive resource shared by all tests. 29 | QString filepath = "/home/zhaogongqiang/Desktop/1048字体/ArkanaScriptRough.otf"; 30 | DFontWidget *fw; 31 | }; 32 | 33 | static QString g_funcname; 34 | int stub_addApplicationFontFromData(const QByteArray &) 35 | { 36 | return 0; 37 | } 38 | void stub_setFileUrl(const QString &) 39 | { 40 | g_funcname = __FUNCTION__; 41 | } 42 | } 43 | 44 | TEST_F(TestDFontWidget, initTest) 45 | { 46 | 47 | } 48 | 49 | TEST_F(TestDFontWidget, checkSetFileUrl) 50 | { 51 | QString filepath = "/home/zhaogongqiang/Desktop/1048字体/ArkanaScriptRough.otf"; 52 | fw->setFileUrl(filepath); 53 | EXPECT_EQ(true, fw->m_spinner->isPlaying()); 54 | EXPECT_EQ(true, fw->m_layout->currentIndex() == 0); 55 | EXPECT_EQ(true, fw->m_filePath == filepath); 56 | fw->m_thread->quit(); 57 | fw->m_thread->wait(); 58 | } 59 | 60 | TEST_F(TestDFontWidget, checkHandleFinished_dataEmpty) 61 | { 62 | QByteArray data; 63 | fw->handleFinished(data); 64 | EXPECT_EQ(true, fw->m_layout->currentIndex() == 0); 65 | EXPECT_EQ(false, fw->m_preview->isVisible()); 66 | EXPECT_TRUE(fw->m_errMsg->text() == DApplication::translate("DFontWidget", "Broken file")); 67 | } 68 | 69 | TEST_F(TestDFontWidget, checkHandleFinished_data) 70 | { 71 | Stub s; 72 | s.set(ADDR(QFontDatabase, addApplicationFontFromData), stub_addApplicationFontFromData); 73 | s.set(ADDR(DFontPreview, setFileUrl), stub_setFileUrl); 74 | 75 | QString filepath = "/home/zhaogongqiang/Desktop/1048字体/ArkanaScriptRough.otf"; 76 | QFile file(filepath); 77 | file.open(QIODevice::ReadOnly); 78 | QByteArray fileContent = file.readAll(); 79 | fw->handleFinished(fileContent); 80 | EXPECT_FALSE(fw->m_errMsg->text() == DApplication::translate("DFontWidget", "Broken file")); 81 | EXPECT_TRUE(g_funcname == QLatin1String("stub_setFileUrl")); 82 | } 83 | -------------------------------------------------------------------------------- /tests/src/ut_performancemonitor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. 2 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 3 | // 4 | // SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | #include 7 | #include "../third-party/stub/stub.h" 8 | 9 | #include 10 | #include 11 | #include "performancemonitor.h" 12 | 13 | namespace { 14 | class TestPerformanceMonitor: public testing::Test 15 | { 16 | 17 | protected: 18 | void SetUp() 19 | { 20 | m_pM = new PerformanceMonitor; 21 | } 22 | void TearDown() 23 | { 24 | delete m_pM; 25 | } 26 | 27 | PerformanceMonitor *m_pM; 28 | }; 29 | 30 | qint64 stub_toMSecSZero() 31 | { 32 | qint64 i = 0; 33 | return i; 34 | } 35 | 36 | qint64 stub_toMSecSOne() 37 | { 38 | qint64 i = 1; 39 | return i; 40 | } 41 | 42 | } 43 | 44 | TEST_F(TestPerformanceMonitor, checkInitializeAppStart) 45 | { 46 | Stub s; 47 | s.set(ADDR(QDateTime, toMSecsSinceEpoch), stub_toMSecSZero); 48 | 49 | m_pM->initializeAppStart(); 50 | 51 | EXPECT_TRUE(m_pM->initializeAppStartMs == 0); 52 | } 53 | 54 | TEST_F(TestPerformanceMonitor, checkInitializeAppFinish) 55 | { 56 | Stub s; 57 | s.set(ADDR(QDateTime, toMSecsSinceEpoch), stub_toMSecSOne); 58 | 59 | m_pM->initializeAppFinish(); 60 | EXPECT_TRUE(m_pM->initializeAppFinishMs == 1); 61 | } 62 | 63 | TEST_F(TestPerformanceMonitor, checkInstallFontStart) 64 | { 65 | Stub s; 66 | s.set(ADDR(QDateTime, toMSecsSinceEpoch), stub_toMSecSOne); 67 | 68 | m_pM->installFontStart(); 69 | EXPECT_TRUE(m_pM->installFontStartMs == 1); 70 | } 71 | 72 | 73 | TEST_F(TestPerformanceMonitor, checkExportFontFinish) 74 | { 75 | Stub s; 76 | s.set(ADDR(QDateTime, toMSecsSinceEpoch), stub_toMSecSOne); 77 | 78 | m_pM->exportFontFinish(1); 79 | EXPECT_TRUE(m_pM->exportFontFinishMs == 1); 80 | } 81 | 82 | TEST_F(TestPerformanceMonitor, checkDeleteFontStart) 83 | { 84 | Stub s; 85 | s.set(ADDR(QDateTime, toMSecsSinceEpoch), stub_toMSecSOne); 86 | 87 | m_pM->deleteFontStart(); 88 | EXPECT_TRUE(m_pM->deleteFontStartMs == 1); 89 | } 90 | 91 | -------------------------------------------------------------------------------- /tests/test-prj-running.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | builddir=build 8 | reportdir=build-ut 9 | rm -r $builddir 10 | rm -r ../$builddir 11 | rm -r $reportdir 12 | rm -r ../$reportdir 13 | mkdir ../$builddir 14 | mkdir ../$reportdir 15 | cd ../$builddir 16 | #编译 17 | cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_SAFETYTEST_ARG="CMAKE_SAFETYTEST_ARG_ON" .. 18 | make -j8 19 | #生成asan日志和ut测试xml结果 20 | ./tests/font-manager-test --gtest_output=xml:./report/report_deepin-font-manager.xml 21 | 22 | workdir=$(cd ../$(dirname $0)/$builddir; pwd) 23 | 24 | mkdir -p report 25 | #统计代码覆盖率并生成html报告 26 | lcov -d $workdir -c -o ./coverage.info 27 | 28 | lcov --extract ./coverage.info '*/deepin-font-manager/*' '*/deepin-font-preview-plugin/*' '*/libdeepin-font-manager/*' -o ./coverage.info 29 | 30 | lcov --remove ./coverage.info '*/tests/*' -o ./coverage.info 31 | 32 | genhtml -o ./html ./coverage.info 33 | 34 | mv ./html/index.html ./html/cov_deepin-font-manager.html 35 | #对asan、ut、代码覆盖率结果收集至指定文件夹 36 | cp -r html ../$reportdir/ 37 | cp -r report ../$reportdir/ 38 | cp -r asan*.log* ../$reportdir/asan_deepin-font-manager.log 39 | 40 | exit 0 41 | -------------------------------------------------------------------------------- /translations/desktop/desktop.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Font ManagerFont ManagerFont Manager -------------------------------------------------------------------------------- /translations/desktop/desktop_ar.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font Managerمدير خطوط ديبينFont Managerمدير الخطوط -------------------------------------------------------------------------------- /translations/desktop/desktop_ast.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Font ManagerFont ManagerXestor de fontes -------------------------------------------------------------------------------- /translations/desktop/desktop_az.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Şrift İdarəetməsiFont ManagerŞrift İdarəetməsi -------------------------------------------------------------------------------- /translations/desktop/desktop_bg.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin инсталатор на шрифтFont ManagerИнсталатор на шрифт -------------------------------------------------------------------------------- /translations/desktop/desktop_bn.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font Managerডিপিন ফন্ট ইনস্টলারFont Managerফন্ট ইনস্টলার -------------------------------------------------------------------------------- /translations/desktop/desktop_bo.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font Managerགཏིང་ཟབ་ཡིག་གཟུགས་དོ་དམ་ཆས།Font Managerཡིག་གཟུགས་དོ་དམ་ཆས། -------------------------------------------------------------------------------- /translations/desktop/desktop_br.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerMerer skriturioù DeepinFont ManagerMerer skriturioù -------------------------------------------------------------------------------- /translations/desktop/desktop_ca.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerGestor de lletres del DeepinFont ManagerGestor de lletres -------------------------------------------------------------------------------- /translations/desktop/desktop_cs.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Správa písemFont ManagerSpráva písem -------------------------------------------------------------------------------- /translations/desktop/desktop_da.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin skrifttypehåndteringFont ManagerSkrifttypehåndtering -------------------------------------------------------------------------------- /translations/desktop/desktop_de.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Schriftarten-ManagerFont ManagerSchriftarten-Manager -------------------------------------------------------------------------------- /translations/desktop/desktop_el.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Διαχείριση ΓραμματοσειρώνFont ManagerΔιαχείριση Γραμματοσειρών -------------------------------------------------------------------------------- /translations/desktop/desktop_es.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerAdministrador de fuentesFont ManagerAdministrador de fuentes -------------------------------------------------------------------------------- /translations/desktop/desktop_et.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerPientakesikäigute tekstipakkumineFont ManagerTekstipakkumine -------------------------------------------------------------------------------- /translations/desktop/desktop_fi.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin kirjasimetFont ManagerKirjasimet -------------------------------------------------------------------------------- /translations/desktop/desktop_fr.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerGestionnaire de polices DeepinFont ManagerGestionnaire des polices -------------------------------------------------------------------------------- /translations/desktop/desktop_gl_ES.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerXestor de fontes de DeepinFont ManagerXestor de fontes -------------------------------------------------------------------------------- /translations/desktop/desktop_he.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font Managerמנהל גלישת דיפיןFont Managerמנהל גלישת טקסט -------------------------------------------------------------------------------- /translations/desktop/desktop_hi_IN.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font Managerदीपिन मुद्रलिपि प्रबंधकFont Managerमुद्रलिपि प्रबंधक -------------------------------------------------------------------------------- /translations/desktop/desktop_hr.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Upravitelj fontovimaFont ManagerUpravitelj fontovima -------------------------------------------------------------------------------- /translations/desktop/desktop_hu.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin® Betűkészlet KezelőFont ManagerBetűkészlet Kezelő -------------------------------------------------------------------------------- /translations/desktop/desktop_id.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Font ManagerFont ManagerPengelola Huruf -------------------------------------------------------------------------------- /translations/desktop/desktop_it.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Font ManagerFont ManagerFont Manager -------------------------------------------------------------------------------- /translations/desktop/desktop_ja.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin フォントマネージャーFont Managerフォントマネージャー -------------------------------------------------------------------------------- /translations/desktop/desktop_ko.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin 글꼴 관리자Font Manager글꼴 관리자 -------------------------------------------------------------------------------- /translations/desktop/desktop_lt.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin šriftų tvarkytuvėFont ManagerŠriftų tvarkytuvė -------------------------------------------------------------------------------- /translations/desktop/desktop_mn.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerДээпин фонт суулгагчFont ManagerФонт суулгагч -------------------------------------------------------------------------------- /translations/desktop/desktop_ms.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerPengurus Fon DeepinFont ManagerPengurus Fon -------------------------------------------------------------------------------- /translations/desktop/desktop_ne.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font Managerदीपिन फन्ट प्रबन्धकFont Managerफन्ट प्रबन्धक -------------------------------------------------------------------------------- /translations/desktop/desktop_nl.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin LettertypebeheerFont ManagerLettertypebeheer -------------------------------------------------------------------------------- /translations/desktop/desktop_pl.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerZarządzanie czcionkami DeepinFont ManagerZarządzanie czcionkami -------------------------------------------------------------------------------- /translations/desktop/desktop_pt.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerGestor de Fontes DeepinFont ManagerGestor de Fontes -------------------------------------------------------------------------------- /translations/desktop/desktop_pt_BR.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerGerenciador de FontesFont ManagerGerenciador de Fontes -------------------------------------------------------------------------------- /translations/desktop/desktop_ro.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerInstalator Deepin FontFont ManagerInstalator font -------------------------------------------------------------------------------- /translations/desktop/desktop_ru.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerМенеджер Шрифтов DeepinFont ManagerМенеджер Шрифтов -------------------------------------------------------------------------------- /translations/desktop/desktop_si.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin අකුරු කළමනාකරුFont Managerඅකුරු කළමනාකරු -------------------------------------------------------------------------------- /translations/desktop/desktop_sk.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Inštalátor písemFont ManagerInštalátor písem -------------------------------------------------------------------------------- /translations/desktop/desktop_sl.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin upravitelj pisavFont ManagerUpravitelj pisav -------------------------------------------------------------------------------- /translations/desktop/desktop_sq.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerPërgjegjës Shkronjash DeepinFont ManagerPërgjegjës Shkronjash -------------------------------------------------------------------------------- /translations/desktop/desktop_sr.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerДипин Управник ФонтоваFont ManagerУправник Фонтова -------------------------------------------------------------------------------- /translations/desktop/desktop_tr.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin Yazı Tipi YöneticisiFont ManagerYazı Tipi Yöneticisi -------------------------------------------------------------------------------- /translations/desktop/desktop_ug.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin خەت شەكلى باشقۇرغۇچFont Managerخەت شەكلى باشقۇرغۇچ -------------------------------------------------------------------------------- /translations/desktop/desktop_uk.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerКерування шрифтами DeepinFont ManagerКерування шрифтами -------------------------------------------------------------------------------- /translations/desktop/desktop_vi.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerQuản lý FontFont ManagerQuản lý Font -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_CN.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font Manager深度字体管理器Font Manager字体管理器 -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_HK.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin 字體管理器Font Manager字體管理器 -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_TW.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Font ManagerDeepin 字體管理器Font Manager字體管理器 -------------------------------------------------------------------------------- /updateTranslation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #update ts or qm 3 | #If you enter ts, update ts, otherwise update qm 4 | 5 | if [ "$1" = "ts" ] 6 | then 7 | #1. update ts 8 | echo "update ts" 9 | lupdate ./deepin-font-manager ./deepin-font-preview-plugin ./libdeepin-font-manager -ts ./translations/*.ts -no-obsolete 10 | else 11 | #2. update qm 12 | echo "update qm" 13 | lrelease ./translations/*.ts 14 | fi 15 | 16 | read -s -t 2 -p "Please input Enter! " 17 | --------------------------------------------------------------------------------