├── .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 ├── .reuse └── dep5 ├── .tx ├── config └── ts2desktop ├── CMakeLists.txt ├── DOC ├── 交互图.png ├── 客户端.png ├── 显卡驱动方案.png ├── 显卡驱动管理器1040需求文档.docx ├── 显卡驱动管理器sp4需求开发计划.xlsx ├── 显卡驱动需求拆解.xlsx └── 服务端.png ├── LICENSES ├── CC-BY-4.0.txt ├── CC0-1.0.txt └── GPL-3.0-or-later.txt ├── README.md ├── README.zh_CN.md ├── assets └── deepin-graphics-driver-manager │ └── graphics-driver-manager │ ├── common │ ├── close.svg │ ├── deepin_launcher.svg │ ├── graphics_driver_manager.svg │ ├── graphics_driver_manager_96.svg │ ├── icon_menu.svg │ └── notes.svg │ └── zh_CN │ ├── fig │ ├── amd.png │ ├── intel.png │ ├── nvidia1.png │ ├── nvidia2.png │ ├── reboot1.png │ └── reboot2.png │ └── graphics-driver-manager.md ├── com.deepin.daemon.GraphicsDriver.xml ├── debian ├── changelog ├── compat ├── control ├── copyright ├── deepin-graphics-driver-manager.1 ├── deepin-graphics-driver-manager.manpages ├── deepin-graphics-driver-manager.postinst ├── rules └── source │ └── format ├── deepin-graphics-driver-manager.desktop ├── gltest ├── CMakeLists.txt ├── gltestwidget.cpp ├── gltestwidget.h ├── gltestwindow.cpp ├── gltestwindow.h └── main.cpp ├── installer ├── CMakeLists.txt ├── deepin-gradvrmgr-installer.desktop ├── installer-waraper ├── main.cpp ├── resources.qrc └── resources │ └── icons │ ├── deepin-dialog-warning.svg │ ├── deepin-graphics-driver-manager-installing.svg │ └── deepin-graphics-driver-manager-success.svg ├── prepare ├── CMakeLists.txt ├── device.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── resolution.h ├── resolutionwidget.cpp ├── resolutionwidget.h ├── resources.qrc ├── resources │ ├── icons │ │ ├── AMD.svg │ │ ├── Intel-NVIDIA.svg │ │ ├── Intel.svg │ │ ├── NVIDIA.svg │ │ ├── deepin-graphics-driver-manager-64px.svg │ │ ├── deepin-graphics-driver-manager-installing.svg │ │ ├── deepin-graphics-driver-manager-success.svg │ │ ├── fail.svg │ │ ├── select.svg │ │ ├── select_dark.svg │ │ └── success.svg │ ├── test │ │ ├── amd.json │ │ ├── device.json │ │ ├── intel.json │ │ ├── intel_nvidia.json │ │ ├── intel_nvidia_use_intel.json │ │ ├── intel_nvidia_use_nvidia.json │ │ └── nvidia.json │ └── theme │ │ ├── dark │ │ └── dark.qss │ │ └── light │ │ └── light.qss ├── singleresolutionwidget.cpp └── singleresolutionwidget.h ├── server ├── CMakeLists.txt ├── data │ ├── com.deepin.graphicmanger.conf │ ├── com.deepin.graphicmanger.service │ ├── deepin-overlay │ └── zzz-overlay ├── graphicsdeviceinfo.cpp ├── graphicsdeviceinfo.h ├── graphicsdriveradaptor.cpp ├── graphicsdriveradaptor.h ├── graphicsdriverinterface.cpp ├── graphicsdriverinterface.h ├── main.cpp ├── resolution.cpp ├── resolution.h ├── resolutions.cpp ├── resolutions.h ├── resources │ ├── config │ │ └── resolutions │ │ │ └── resolutions.json │ └── service │ │ └── dgradvrmgr-gltest.service └── scripts │ ├── common.sh │ ├── default_stat.sh │ ├── dgradvrmgr-cancel.sh │ ├── dgradvrmgr-gltest.sh │ ├── dgradvrmgr-prepare.sh │ ├── dgradvrmgr-real-install.sh │ ├── dgradvrmgr-test-install.sh │ ├── empty.sh │ ├── gltest-set-success.sh │ ├── intel │ ├── install_glamor.sh │ ├── install_intel_opensource.sh │ ├── install_sna.sh │ ├── install_uxa.sh │ ├── intel_stat.sh │ ├── remove_glamor.sh │ ├── remove_intel_opensource.sh │ ├── remove_sna.sh │ └── remove_uxa.sh │ ├── nvidia │ ├── install_nouveau.sh │ ├── install_nvidia_closesource.sh │ ├── remove_nouveau.sh │ ├── remove_nvidia_closesource.sh │ └── status_nvidia.sh │ ├── nvidia_intel │ ├── install_nvidia_intel_bumblebee.sh │ ├── install_nvidia_intel_prime.sh │ ├── remove_nvidia_intel_bumblebee.sh │ ├── remove_nvidia_intel_prime.sh │ └── status_nvidia_intel.sh │ └── tools │ └── overlayroot-test.sh ├── test_installer ├── CMakeLists.txt ├── closeButton.cpp ├── closeButton.h ├── deepin-gradvrmgr-test-installer.desktop ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── resources.qrc └── resources │ ├── icons │ ├── AMD.svg │ ├── Intel-NVIDIA.svg │ ├── Intel.svg │ ├── NVIDIA.svg │ ├── close_normal.svg │ ├── deepin-graphics-driver-manager-64px.svg │ ├── deepin-graphics-driver-manager-installing.svg │ ├── deepin-graphics-driver-manager-success.svg │ ├── fail.svg │ ├── select.svg │ ├── select_dark.svg │ └── success.svg │ └── theme │ ├── dark │ └── dark.qss │ └── light │ └── light.qss ├── translations ├── deepin-graphics-driver-manager.ts ├── deepin-graphics-driver-manager_az.ts ├── deepin-graphics-driver-manager_bo.ts ├── deepin-graphics-driver-manager_ca.ts ├── deepin-graphics-driver-manager_de.ts ├── deepin-graphics-driver-manager_fi.ts ├── deepin-graphics-driver-manager_fr.ts ├── deepin-graphics-driver-manager_hu.ts ├── deepin-graphics-driver-manager_it.ts ├── deepin-graphics-driver-manager_nl.ts ├── deepin-graphics-driver-manager_pt.ts ├── deepin-graphics-driver-manager_pt_BR.ts ├── deepin-graphics-driver-manager_sl.ts ├── deepin-graphics-driver-manager_sq.ts ├── deepin-graphics-driver-manager_sr.ts ├── deepin-graphics-driver-manager_tr.ts ├── deepin-graphics-driver-manager_ug.ts ├── deepin-graphics-driver-manager_uk.ts ├── deepin-graphics-driver-manager_zh_CN.ts ├── deepin-graphics-driver-manager_zh_HK.ts ├── deepin-graphics-driver-manager_zh_TW.ts ├── desktop │ ├── desktop.ts │ ├── desktop_ar.ts │ ├── desktop_ast.ts │ ├── desktop_az.ts │ ├── desktop_bg.ts │ ├── desktop_bo.ts │ ├── desktop_ca.ts │ ├── desktop_cs.ts │ ├── desktop_da.ts │ ├── desktop_de.ts │ ├── desktop_es.ts │ ├── desktop_es_419.ts │ ├── desktop_et.ts │ ├── desktop_fa.ts │ ├── desktop_fi.ts │ ├── desktop_fr.ts │ ├── desktop_gl_ES.ts │ ├── desktop_hr.ts │ ├── desktop_hu.ts │ ├── desktop_id.ts │ ├── desktop_it.ts │ ├── desktop_ko.ts │ ├── desktop_lt.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_sk.ts │ ├── desktop_sl.ts │ ├── desktop_sq.ts │ ├── desktop_sr.ts │ ├── desktop_tr.ts │ ├── desktop_ug.ts │ ├── desktop_uk.ts │ ├── desktop_zh_CN.ts │ ├── desktop_zh_HK.ts │ └── desktop_zh_TW.ts └── update_ts.py └── utils ├── environments.h.in ├── graphicsdriverproxy.cpp ├── graphicsdriverproxy.h ├── utils.cpp └── utils.h /.clog.toml: -------------------------------------------------------------------------------- 1 | [clog] 2 | repository = "https://github.com/linuxdeepin/deepin-graphics-driver-manager" 3 | from-latest-tag = true 4 | changelog = "CHANGELOG.md" 5 | -------------------------------------------------------------------------------- /.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 | .idea/ 2 | cmake-build-debug/ 3 | cmake-build-release/ 4 | debian/.debhelper/ 5 | debian/debhelper-build-stamp 6 | debian/*.debhelper.log 7 | debian/*.debhelper 8 | debian/*.substvars 9 | debian/deepin-graphics-driver-manager/ 10 | debian/files 11 | debian/tmp/ 12 | *.o 13 | moc_* 14 | *.qm 15 | *.user 16 | .vscode 17 | build/ 18 | Makefile 19 | qrc_* 20 | *.a 21 | .qmake.stash 22 | obj-x86_64-linux-gnu/ 23 | 24 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: deepin-graphics-driver-manager 3 | Upstream-Contact: UnionTech Software Technology Co., Ltd. <> 4 | Source: https://github.com/linuxdeepin/deepin-graphics-driver-manager 5 | 6 | # ci 7 | Files: .github/* 8 | Copyright: None 9 | License: CC0-1.0 10 | 11 | # gitignore 12 | Files: .gitignore 13 | Copyright: None 14 | License: CC0-1.0 15 | 16 | # desktop json py 17 | Files: *.desktop *.json *.py *.service *.toml 18 | Copyright: None 19 | License: CC0-1.0 20 | 21 | # Project file 22 | Files: *.qrc *.ts *.sh .tx/* *.qss *.txt *.xml *.in installer/installer-waraper 23 | Copyright: None 24 | License: CC0-1.0 25 | 26 | # README&DOC 27 | Files: README.md README.zh_CN.md DOC/* 28 | Copyright: UnionTech Software Technology Co., Ltd. 29 | License: CC-BY-4.0 30 | 31 | # debian 32 | Files: debian/* 33 | Copyright: None 34 | License: GPL-3.0-or-later 35 | 36 | # svg 37 | Files: installer/resources/* prepare/resources/icons/* test_installer/resources/icons/* 38 | Copyright: UnionTech Software Technology Co., Ltd. 39 | License: GPL-3.0-or-later 40 | 41 | # con 42 | Files: assets/deepin-graphics-driver-manager/* 43 | Copyright: UnionTech Software Technology Co., Ltd. 44 | License: GPL-3.0-or-later 45 | 46 | # server data 47 | Files: server/data/* 48 | Copyright: UnionTech Software Technology Co., Ltd. 49 | License: GPL-3.0-or-later 50 | 51 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | minimum_perc = 80 4 | mode = developer 5 | 6 | [deepin-graphics-driver-manager.deepin-graphics-driver-manager] 7 | file_filter = translations/deepin-graphics-driver-manager_.ts 8 | source_file = translations/deepin-graphics-driver-manager.ts 9 | source_lang = en 10 | type = QT 11 | 12 | [deepin-graphics-driver-manager.deepin-graphics-driver-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/ts2desktop: -------------------------------------------------------------------------------- 1 | DESKTOP_TEMP_FILE=deepin-graphics-driver-manager.desktop.tmp 2 | DESKTOP_SOURCE_FILE=deepin-graphics-driver-manager.desktop 3 | DESKTOP_DEST_FILE=deepin-graphics-driver-manager.desktop 4 | DESKTOP_TS_DIR=translations/desktop 5 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | 3 | if (NOT DEFINED VERSION) 4 | set(VERSION 1.0.0) 5 | endif() 6 | 7 | project(deepin-graphics-driver-manager) 8 | 9 | configure_file(${CMAKE_SOURCE_DIR}/utils/environments.h.in ${CMAKE_SOURCE_DIR}/utils/environments.h @ONLY) 10 | 11 | set(CMAKE_CXX_STANDARD 17) 12 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 13 | set(CMAKE_AUTOMOC ON) 14 | set(CMAKE_AUTORCC ON) 15 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fpie -pie") 16 | 17 | # Install settings 18 | 19 | set(CMAKE_INSTALL_PREFIX /usr) 20 | 21 | if (CMAKE_BUILD_TYPE MATCHES Debug) 22 | add_definitions("-DTEST_UI") 23 | endif() 24 | 25 | execute_process(COMMAND bash "-c" "qdbuscpp2xml -A server/graphicsdriverinterface.h -o com.deepin.daemon.GraphicsDriver.xml" 26 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) 27 | 28 | execute_process(COMMAND bash "-c" "qdbusxml2cpp ../com.deepin.daemon.GraphicsDriver.xml -i graphicsdriverinterface.h -a graphicsdriveradaptor" 29 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/server) 30 | 31 | execute_process(COMMAND bash "-c" "qdbusxml2cpp ../com.deepin.daemon.GraphicsDriver.xml -p graphicsdriverproxy" 32 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/utils) 33 | 34 | 35 | if (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug")) 36 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast") 37 | endif () 38 | 39 | find_package(Qt5LinguistTools REQUIRED) 40 | 41 | 42 | file(GLOB TS_FILES 43 | ${CMAKE_SOURCE_DIR}/translations/*.ts) 44 | set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/translations) 45 | qt5_add_translation(QM_FILES ${TS_FILES}) 46 | add_custom_target(graphics-qm-update DEPENDS ${QM_FILES}) 47 | 48 | 49 | file(GLOB UTILS_FILES "${CMAKE_SOURCE_DIR}/utils/*.h" "${CMAKE_SOURCE_DIR}/utils/*.cpp") 50 | 51 | add_subdirectory(server) 52 | add_subdirectory(prepare) 53 | add_subdirectory(test_installer) 54 | add_subdirectory(installer) 55 | add_subdirectory(gltest) 56 | 57 | # Install help document 58 | #install(DIRECTORY assets/deepin-graphics-driver-manager 59 | # DESTINATION /usr/share/deepin-manual/manual-assets/application/) 60 | 61 | -------------------------------------------------------------------------------- /DOC/交互图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/DOC/交互图.png -------------------------------------------------------------------------------- /DOC/客户端.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/DOC/客户端.png -------------------------------------------------------------------------------- /DOC/显卡驱动方案.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/DOC/显卡驱动方案.png -------------------------------------------------------------------------------- /DOC/显卡驱动管理器1040需求文档.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/DOC/显卡驱动管理器1040需求文档.docx -------------------------------------------------------------------------------- /DOC/显卡驱动管理器sp4需求开发计划.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/DOC/显卡驱动管理器sp4需求开发计划.xlsx -------------------------------------------------------------------------------- /DOC/显卡驱动需求拆解.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/DOC/显卡驱动需求拆解.xlsx -------------------------------------------------------------------------------- /DOC/服务端.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/DOC/服务端.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deepin Graphics Driver Manager {#mainpage} 2 | 3 | Deepin Graphics Driver Manager(deepin-graphics-driver-manager) facilitates user to manage graphics card drivers. 4 | 5 | ## Installation 6 | 7 | ### Build from source code 8 | 9 | 1. Make sure you have installed all dependencies. 10 | ```` 11 | sudo apt build-dep 12 | ```` 13 | 14 | 2. Build: 15 | 16 | ```` 17 | $ mkdir build 18 | $ cd build 19 | $ cmake .. 20 | $ make 21 | ```` 22 | 23 | 3. Install: 24 | 25 | ```` 26 | $ sudo make install 27 | ```` 28 | 29 | ## Getting help 30 | 31 | Any usage issues can ask for help via 32 | 33 | * [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) 34 | * [IRC channel](https://webchat.freenode.net/?channels=deepin) 35 | * [Forum](https://bbs.deepin.org) 36 | * [WiKi](https://wiki.deepin.org/) 37 | 38 | ## Getting involved 39 | 40 | We encourage you to report issues and contribute changes 41 | 42 | * [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). (English) 43 | 44 | ## License 45 | 46 | Deepin Graphics Driver Manager is licensed under [GPL-3.0-or-later](LICENSE). 47 | -------------------------------------------------------------------------------- /README.zh_CN.md: -------------------------------------------------------------------------------- 1 | ## Deepin Graphics Driver Manager 2 | 3 | Deepin Graphics Driver Manager(deepin-graphics-driver-manager) 便于用户管理显卡驱动. 4 | 5 | ## 安装 6 | 7 | ### 从源代码构建 8 | 9 | 1. 确保已经安装了所有的编译依赖. 10 | ````bash 11 | sudo apt build-dep 12 | ```` 13 | 14 | 2. 构建: 15 | 16 | ```bash 17 | mkdir build 18 | cd build 19 | cmake .. 20 | make 21 | ``` 22 | 23 | 3. 安装: 24 | 25 | ```bash 26 | sudo make install 27 | ``` 28 | 29 | ## 帮助 30 | 31 | 任何使用问题都可以通过以下方式寻求帮助: 32 | 33 | * [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) 34 | * [IRC channel](https://webchat.freenode.net/?channels=deepin) 35 | * [Forum](https://bbs.deepin.org) 36 | * [WiKi](https://wiki.deepin.org/) 37 | 38 | ## 参与贡献 39 | 40 | 我们鼓励您报告问题并作出更改 41 | 42 | * [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) 43 | 44 | ## 协议 45 | 46 | 深度显卡驱动管理遵循协议 [GPL-3.0-or-later](LICENSE). 47 | -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/common/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/common/deepin_launcher.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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-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 | -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/common/notes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | notes 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/amd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/amd.png -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/intel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/intel.png -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/nvidia1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/nvidia1.png -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/nvidia2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/nvidia2.png -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/reboot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/reboot1.png -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/reboot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/deepin-graphics-driver-manager/30b92866c6a295d70a067f81443ec56d2f4ce625/assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/fig/reboot2.png -------------------------------------------------------------------------------- /assets/deepin-graphics-driver-manager/graphics-driver-manager/zh_CN/graphics-driver-manager.md: -------------------------------------------------------------------------------- 1 | # 显卡驱动管理器|../common/graphics_driver_manager_96.svg| 2 | 3 | ## 概述 4 | 5 | 显卡驱动管理器是一款小巧、简单易用的显卡驱动管理工具,包括显卡驱动的安装、切换、还原等功能。 6 | 7 | ## 使用入门 8 | 9 | 通过以下方式运行或关闭显卡驱动管理器,或者创建显卡驱动管理器的快捷方式。 10 | 11 | ### 运行显卡驱动管理器 12 | 13 | 1. 单击任务栏上的启动器 ![deepin_launcher](../common/deepin_launcher.svg),进入启动器界面。 14 | 2. 上下滚动鼠标滚轮浏览或通过搜索,找到显卡驱动管理器![graphics_driver_manager](../common/graphics_driver_manager.svg) ,单击运行。 15 | 3. 右键单击 ![graphics_driver_manager](../common/graphics_driver_manager.svg) ,您可以: 16 | 17 | - 单击 **发送到桌面**,在桌面创建快捷方式。 18 | - 单击 **发送到任务栏**,将应用程序固定到任务栏。 19 | - 单击 **开机自动启动**,将应用程序添加到开机启动项,在电脑开机时自动运行该应用。 20 | 21 | 22 | ### 关闭显卡驱动管理器 23 | 24 | - 在显卡驱动管理器界面,单击 ![close](../common/close.svg) ,退出显卡驱动管理器。 25 | - 在任务栏右键单击 ![graphics_driver_manager](../common/graphics_driver_manager.svg),选择 **关闭所有** 来退出显卡驱动管理器。 26 | - 在显卡驱动管理器界面,单击 ![icon_menu](../common/icon_menu.svg) ,选择 **退出** 来退出显卡驱动管理器。 27 | 28 | ## 操作介绍 29 | 30 | ### 台式电脑 31 | 32 | #### Intel显卡 33 | 34 | 如果台式电脑接入的是Intel显卡,显卡驱动管理器界面只显示Intel显卡的驱动名称和版本号。 35 | 36 | ![|intel](fig/intel.png) 37 | 38 | #### Nvidia显卡 39 | 40 | 如果台式电脑接入的是Nvidia显卡,则会有两种驱动模式,分别官方驱动和非官方驱动。 41 | 42 | - 官方驱动:属于闭源驱动,性能比较好,但是部分显卡会出现兼容性问题,导致屏幕出现黑屏。 43 | - 非官方驱动:属于开源驱动,性能较弱,在部分显卡上可能不稳定。 44 | 45 | 您可以参考以下步骤切换驱动。 46 | 47 | 1. 在显卡驱动管理器界面上,选择一个新的显卡驱动方案,单击 **切换**。 48 | 49 | ![|nvidia1](fig/nvidia1.png) 50 | 51 | 2. 驱动方案下载成功后,单击 **立即重启**,新驱动将在重启后自动完成安装。 52 | 53 | ![|reboot](fig/reboot1.png) 54 | 55 | 3. 观看测试动画检测新驱动的显示效果。 56 | 57 | 4. 单击 **应用** 完成驱动方案切换,或单击 **取消** 还原到切换之前的驱动方案。 58 | 59 | 5. 电脑将会自动重启,切换或还原操作将在重启后生效。 60 | 61 | ![|reboot](fig/reboot2.png) 62 | 63 | #### AMD显卡 64 | 65 | 如果台式电脑接入的是AMD显卡,显卡驱动管理器界面会显示AMD显卡信息,包括驱动名称、版本号等。 66 | 67 | ![|amd](fig/amd.png) 68 | 69 | ### 笔记本电脑 70 | 71 | #### Intel显卡 72 | 73 | Intel显卡笔记本电脑中,显卡驱动管理器界面只显示Intel显卡的驱动名称和版本号。 74 | 75 | ![|intel](fig/intel.png) 76 | 77 | #### Nvidia+Intel 双显卡 78 | 79 | 双显卡笔记本电脑会有三种驱动模式,分别为集成显卡、节能模式和性能模式。 80 | 81 | - 集显驱动:安装系统时自带的驱动方案,与节能模式、性能模式进行切换使用。 82 | 83 | - 节能模式:能节省电脑资源,提升使用续航,也称为大黄蜂方案。选中节能模式,单击 **确定** 按钮后自动进入切换页面下载驱动,采用的是官方驱动; 84 | 85 | - 性能模式:能提升系统运行性能,也称为Prime方案。选中性能模式,单击 **确定** 按钮自动进入切换页面下载驱动,采用的是官方驱动; 86 | 87 | 您可以参考以下步骤切换驱动。 88 | 1. 在显卡驱动管理器界面上,选择一个新的显卡驱动方案,单击 **切换**。 89 | 90 | ![|nvidia2](fig/nvidia2.png) 91 | 92 | 2. 驱动方案切换成功后,单击 **立即重启**,新驱动将在重启后自动完成安装。 93 | 94 | 3. 观看测试动画检测新驱动的显示效果。 95 | 96 | 4. 单击 **应用** 完成驱动方案切换,或单击 **取消** 还原到切换之前的驱动方案。 97 | 98 | 5. 电脑将会自动重启,切换或还原操作将在重启后生效。 99 | 100 | ## 主菜单 101 | 102 | ### 主题 103 | 窗口主题包含浅色主题、深色主题和系统主题。 104 | 105 | 1. 在显卡驱动管理器界面,单击![icon_menu](../common/icon_menu.svg) 。 106 | 2. 单击 **主题**,选择一个主题颜色。 107 | 108 | ### 帮助 109 | 110 | 1. 在显卡驱动管理器界面,单击 ![icon_menu](../common/icon_menu.svg)。 111 | 2. 单击 **帮助**,查看帮助手册,进一步了解和使用显卡驱动管理器。 112 | 113 | 114 | ### 关于 115 | 116 | 1. 在显卡驱动管理器界面,单击 ![icon_menu](../common/icon_menu.svg)。 117 | 2. 单击 **关于**,查看显卡驱动管理器的版本和介绍。 118 | 119 | 120 | ### 退出 121 | 122 | 1. 在显卡驱动管理器界面,单击 ![icon_menu](../common/icon_menu.svg)。 123 | 2. 单击 **退出**。 124 | 125 | -------------------------------------------------------------------------------- /com.deepin.daemon.GraphicsDriver.xml: -------------------------------------------------------------------------------- 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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | deepin-graphics-driver-manager (5.1.21-1) unstable; urgency=medium 2 | 3 | * Initial Release. 4 | 5 | -- Deepin Packages Builder Fri, 05 Feb 2021 11:14:23 +0800 6 | 7 | deepin-graphics-driver-manager (5.0.9-1) unstable; urgency=medium 8 | 9 | * Initial Release. 10 | 11 | -- Deepin Packages Builder Tue, 26 Sep 2017 17:14:51 +0800 12 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: deepin-graphics-driver-manager 2 | Section: misc 3 | Priority: optional 4 | Maintainer: Deepin Packages Builder 5 | Build-Depends: debhelper (>= 9), dh-systemd, cmake, pkg-config, libqt5widgets5, libdtkwidget-dev, libdtkcore5-bin | libdtkcore-bin, libpci-dev, libgl1-mesa-dev, freeglut3-dev, libxmu-dev, libxi-dev, qtbase5-dev, qttools5-dev, qttools5-dev-tools 6 | Standards-Version: 3.9.8 7 | Homepage: https://www.deepin.org 8 | 9 | Package: deepin-graphics-driver-manager 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends}, dialog, overlayroot, rsync, qdbus-qt5, xinit, deepin-feedback 12 | Description: deepin driver manager 13 | New version of deepin-graphics-driver-manager, rewritten with Qt5. -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: deepin-graphics-driver-manager 3 | Source: http://www.deepin.org 4 | 5 | Files: * 6 | Copyright: 2020 Deepin Technology Co., Ltd. 7 | License: GPL-3+ 8 | This package 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 | (at your option) any later version. 12 | . 13 | This package 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 package; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 | . 22 | On Debian systems, the complete text of the GNU General 23 | Public License can be found in `/usr/share/common-licenses/GPL-3'. 24 | -------------------------------------------------------------------------------- /debian/deepin-graphics-driver-manager.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .\" (C) Copyright 2021 UnionTech Software Technology Co., Ltd., 3 | .\" 4 | .TH "deepin-graphics-driver-manager "1" "2021-02-02" "deepin-graphics-driver-manager manpage" 5 | .\" Please adjust this date whenever revising the manpage. 6 | .\" 7 | .\" for manpage-specific macros, see man(7) 8 | 9 | .SH NAME 10 | deepin-graphics-driver-manager 11 | -------------------------------------------------------------------------------- /debian/deepin-graphics-driver-manager.manpages: -------------------------------------------------------------------------------- 1 | debian/deepin-graphics-driver-manager.1 2 | -------------------------------------------------------------------------------- /debian/deepin-graphics-driver-manager.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | case "$1" in 5 | configure) 6 | update-initramfs -u -k $(uname -r);; 7 | *) exit 0;; 8 | esac 9 | 10 | #DEBHELPER# 11 | exit 0 12 | 13 | # vi: ts=4 noexpandtab 14 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | include /usr/share/dpkg/default.mk 4 | 5 | %: 6 | dh $@ --with systemd --parallel 7 | 8 | override_dh_auto_configure: 9 | dh_auto_configure -- -DVERSION=$(DEB_VERSION_UPSTREAM) 10 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /gltest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | if (POLICY CMP0072) 3 | set(OpenGL_GL_PREFERENCE LEGACY) 4 | endif() 5 | 6 | find_package(PkgConfig REQUIRED) 7 | find_package(Qt5Widgets REQUIRED) 8 | find_package(Qt5DBus REQUIRED) 9 | find_package(OpenGL REQUIRED) 10 | find_package(GLUT REQUIRED) 11 | find_package(DtkCMake REQUIRED) 12 | find_package(DtkWidget REQUIRED) 13 | 14 | 15 | if (CMAKE_BUILD_TYPE MATCHES Debug) 16 | add_definitions("-DTRANSLATIONS_DIR=\"${CMAKE_BINARY_DIR}/translations/\"") 17 | else() 18 | add_definitions("-DTRANSLATIONS_DIR=\"${CMAKE_INSTALL_PREFIX}/share/deepin-graphics-driver-manager/translations/\"") 19 | endif() 20 | 21 | 22 | file(GLOB SRCS "*.h" "*.cpp") 23 | 24 | include_directories(${CMAKE_SOURCE_DIR}/utils/) 25 | 26 | add_executable(gltest ${SRCS} ${UTILS_FILES}) 27 | target_link_libraries(gltest 28 | ${OPENGL_LIBRARIES} 29 | ${GLUT_LIBRARIES} 30 | ${Qt5Widgets_LIBRARIES} 31 | ${DtkWidget_LIBRARIES} 32 | ${Qt5DBus_LIBRARIES} 33 | ) 34 | 35 | target_include_directories(installer PUBLIC 36 | ${OPENGL_INCLUDE_DIRS} 37 | ${GLUT_INCLUDE_DIRS} 38 | ${Qt5Widgets_INCLUDE_DIRS} 39 | ${DtkWidget_INCLUDE_DIRS} 40 | ${Qt5DBus_INCLUDE_DIRS} 41 | 42 | ) 43 | install(TARGETS gltest DESTINATION lib/deepin-graphics-driver-manager) 44 | #install(FILES deepin-gradvrmgr-installer.desktop DESTINATION lib/deepin-graphics-driver-manager) 45 | -------------------------------------------------------------------------------- /gltest/gltestwidget.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "gltestwidget.h" 6 | #include 7 | 8 | GLTestWidget::GLTestWidget(QWidget *parent) 9 | : QOpenGLWidget(parent), 10 | m_currPaintCnt(0), 11 | m_lastPaintCnt(0) 12 | { 13 | QTimer *auto_quit_timer = new QTimer(this); 14 | auto_quit_timer->setInterval(1000); 15 | 16 | QObject::connect(auto_quit_timer, &QTimer::timeout, [=] { 17 | qDebug() << "m_lastPaintCnt=" << m_lastPaintCnt; 18 | qDebug() << "m_currPaintCnt=" << m_currPaintCnt; 19 | if (m_currPaintCnt == m_lastPaintCnt) { 20 | qDebug() << "detect GLTest paint error"; 21 | exit(-1); 22 | } else { 23 | m_lastPaintCnt = m_currPaintCnt; 24 | } 25 | }); 26 | 27 | auto_quit_timer->start(); 28 | 29 | m_xRotated = m_yRotated = m_zRotated = 0; 30 | 31 | QTimer *t = new QTimer(this); 32 | t->setInterval(1000 / 60); 33 | t->start(); 34 | 35 | connect(t, &QTimer::timeout, this, [=] { 36 | m_xRotated += 1.0f; 37 | m_yRotated += 1.0f; 38 | m_zRotated += 1.0f; 39 | update(); 40 | }); 41 | } 42 | 43 | void GLTestWidget::initializeGL() 44 | { 45 | try { 46 | qDebug() << "@#@#@Call initializeGL"; 47 | glClearColor(0.3f, 0.3f, 0.6f, 1); 48 | glClearDepth(1.0); 49 | glEnable(GL_DEPTH_TEST); 50 | glEnable(GL_LIGHTING); 51 | glEnable(GL_LIGHT0); 52 | glEnable(GL_LIGHT1); 53 | glEnable(GL_NORMALIZE); 54 | // glEnable(GL_POLYGON_OFFSET_FILL); 55 | // glPolygonMode(GL_FRONT, GL_LINE); 56 | glShadeModel(GL_SMOOTH); 57 | } catch (QException &e) { 58 | qDebug() << "initializeGL failed:" << e.what(); 59 | exit(-1); 60 | } 61 | 62 | } 63 | 64 | void GLTestWidget::resizeGL(int w, int h) 65 | { 66 | try { 67 | qDebug() << "@#@#@Call resizeGL"; 68 | glViewport(0, 0, w, h); 69 | } catch (QException &e) { 70 | qDebug() << "resizeGL failed:" << e.what(); 71 | exit(-1); 72 | } 73 | 74 | } 75 | 76 | void GLTestWidget::paintGL() 77 | { 78 | try { 79 | glMatrixMode(GL_MODELVIEW); 80 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 81 | glLoadIdentity(); 82 | 83 | GLfloat ambientColor[] = {0.6f, 0.3f, 0.7f, 1.0f}; 84 | glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientColor); 85 | 86 | GLfloat lightColor0[] = {1.0f, 0.0f, 0.0f, 1.0f}; 87 | GLfloat lightPos0[] = {10.0f, 10.0f, 0.0f, 1.0f}; 88 | glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor0); 89 | glLightfv(GL_LIGHT0, GL_POSITION, lightPos0); 90 | 91 | GLfloat lightColor1[] = {0.4f, 0.7f, 0.2f, 1.0f}; 92 | GLfloat lightPos1[] = {0.0f, 0.0f, -5.0f, 0.0f}; 93 | glLightfv(GL_LIGHT1, GL_DIFFUSE, lightColor1); 94 | glLightfv(GL_LIGHT1, GL_POSITION, lightPos1); 95 | 96 | // glColor3f(0.3, 0.4, 0.7); 97 | glRotatef(m_xRotated, 1.0, 0.0, 0.0); 98 | glRotatef(m_yRotated, 0.0, 1.0, 0.0); 99 | glRotatef(m_zRotated, 0.0, 0.0, 1.0); 100 | glScalef(.4f, .4f, .4f); 101 | glColor3f(0.3f, 0.4f, 0.4f); 102 | glutSolidTeapot(1.0); 103 | m_currPaintCnt++; 104 | } catch (QException &e) { 105 | qDebug() << "paintGL failed:" << e.what(); 106 | exit(-1); 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /gltest/gltestwidget.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef GLTESTWIDGET_H 6 | #define GLTESTWIDGET_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class GLTestWidget : public QOpenGLWidget 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit GLTestWidget(QWidget *parent = nullptr); 24 | 25 | protected: 26 | void initializeGL(); 27 | 28 | void resizeGL(int w, int h); 29 | 30 | void paintGL(); 31 | 32 | private: 33 | float m_xRotated, m_yRotated, m_zRotated; 34 | unsigned int m_currPaintCnt; 35 | unsigned int m_lastPaintCnt; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /gltest/gltestwindow.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "gltestwindow.h" 6 | #include 7 | #include 8 | #include 9 | 10 | const QString GraphicMangerServiceName = "com.deepin.graphicmanger"; 11 | const QString GraphicMangerPath = "/com/deepin/graphicmanger"; 12 | 13 | GLTestWindow::GLTestWindow(QWidget *parent) 14 | : QWidget(parent) 15 | { 16 | m_graphicsDriver = new ComDeepinDaemonGraphicsDriverInterface( 17 | GraphicMangerServiceName, 18 | GraphicMangerPath, 19 | QDBusConnection::systemBus(), 20 | nullptr); 21 | 22 | m_acceptBtn = new QPushButton(tr("Apply")); 23 | m_acceptBtn->setFocusPolicy(Qt::NoFocus); 24 | m_cancelBtn = new QPushButton(tr("Cancel")); 25 | m_cancelBtn->setFocusPolicy(Qt::NoFocus); 26 | m_tipsLabel = new QLabel(tr("Please ensure the driver works normally without blurred screen and screen tearing")); 27 | m_tipsLabel->setAlignment(Qt::AlignCenter); 28 | 29 | m_glTestWidget = new GLTestWidget; 30 | m_glTestWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 31 | 32 | QHBoxLayout *btnsLayout = new QHBoxLayout; 33 | btnsLayout->addStretch(); 34 | btnsLayout->addWidget(m_cancelBtn); 35 | btnsLayout->addWidget(m_acceptBtn); 36 | btnsLayout->addStretch(); 37 | 38 | QVBoxLayout *centralLayout = new QVBoxLayout; 39 | centralLayout->addWidget(m_glTestWidget); 40 | centralLayout->addWidget(m_tipsLabel); 41 | centralLayout->addLayout(btnsLayout); 42 | 43 | setLayout(centralLayout); 44 | setFixedSize(qApp->primaryScreen()->geometry().size()); 45 | setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); 46 | 47 | connect(m_acceptBtn, &QPushButton::clicked, this, &GLTestWindow::onAccept); 48 | connect(m_cancelBtn, &QPushButton::clicked, this, &GLTestWindow::onCancel); 49 | } 50 | 51 | void GLTestWindow::keyPressEvent(QKeyEvent *e) 52 | { 53 | switch (e->key()) 54 | { 55 | #ifdef QT_DEBUG 56 | case Qt::Key_Escape: qApp->quit(); break; 57 | #endif 58 | default:; 59 | } 60 | } 61 | 62 | 63 | void GLTestWindow::onAccept() 64 | { 65 | QDBusPendingReply reply = m_graphicsDriver->TestSuccess(); 66 | reply.waitForFinished(); 67 | QProcess::startDetached("dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true"); 68 | qApp->exit(0); 69 | } 70 | 71 | void GLTestWindow::onCancel() 72 | { 73 | QDBusPendingReply reply = m_graphicsDriver->CancelInstall(); 74 | reply.waitForFinished(); 75 | QProcess::startDetached("dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true"); 76 | qApp->exit(-1); 77 | } 78 | -------------------------------------------------------------------------------- /gltest/gltestwindow.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef GLTESTWINDOW_H 6 | #define GLTESTWINDOW_H 7 | 8 | #include "gltestwidget.h" 9 | #include "graphicsdriverproxy.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | class GLTestWindow : public QWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit GLTestWindow(QWidget *parent = nullptr); 23 | 24 | protected: 25 | void keyPressEvent(QKeyEvent *e); 26 | 27 | private slots: 28 | void onAccept(); 29 | 30 | void onCancel(); 31 | 32 | private: 33 | bool m_exit_gltest; 34 | GLTestWidget *m_glTestWidget; 35 | QLabel *m_tipsLabel; 36 | QPushButton *m_acceptBtn; 37 | QPushButton *m_cancelBtn; 38 | ComDeepinDaemonGraphicsDriverInterface *m_graphicsDriver = nullptr; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /gltest/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #include "gltestwidget.h" 11 | #include "gltestwindow.h" 12 | 13 | #include 14 | 15 | DCORE_USE_NAMESPACE 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | glutInit(&argc, argv); 20 | QApplication app(argc, argv); 21 | QSettings settings("/usr/lib/deepin-graphics-driver-manager/working-dir/config.conf", QSettings::IniFormat); 22 | const QString lang = settings.value("lang", "en_US").toString(); 23 | QTranslator trans; 24 | trans.load(QString(TRANSLATIONS_DIR"/deepin-graphics-driver-manager_%1.qm").arg(lang)); 25 | app.installTranslator(&trans); 26 | 27 | //设置日志 28 | const QString logFormat = "%{time}{yyyyMMdd.HH:mm:ss.zzz}[%{type:1}][%{function:-40} %{line:-4} %{threadid:-8} ] %{message}\n"; 29 | const QString log_file(QString("/var/log/deepin-graphics-driver-manager-server.log")); 30 | ConsoleAppender *consoleAppender = new ConsoleAppender; 31 | consoleAppender->setFormat(logFormat); 32 | RollingFileAppender *rollingFileAppender = new RollingFileAppender(log_file); 33 | rollingFileAppender->setFormat(logFormat); 34 | rollingFileAppender->setLogFilesLimit(5); 35 | rollingFileAppender->setDatePattern(RollingFileAppender::DailyRollover); 36 | 37 | logger->registerAppender(consoleAppender); 38 | logger->registerAppender(rollingFileAppender); 39 | 40 | GLTestWindow w; 41 | w.show(); 42 | 43 | return app.exec(); 44 | 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /installer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(installer main.cpp ${UTILS_FILES} resources.qrc) 2 | 3 | find_package(PkgConfig REQUIRED) 4 | find_package(Qt5Widgets REQUIRED) 5 | find_package(Qt5DBus REQUIRED) 6 | 7 | if (CMAKE_BUILD_TYPE MATCHES Debug) 8 | add_definitions("-DTRANSLATIONS_DIR=\"${CMAKE_BINARY_DIR}/translations/\"") 9 | else() 10 | add_definitions("-DTRANSLATIONS_DIR=\"${CMAKE_INSTALL_PREFIX}/share/deepin-graphics-driver-manager/translations/\"") 11 | endif() 12 | 13 | 14 | find_package(DtkCMake REQUIRED) 15 | find_package(DtkWidget REQUIRED) 16 | 17 | include_directories(${CMAKE_SOURCE_DIR}/utils/) 18 | 19 | target_include_directories(installer PUBLIC 20 | ${DtkWidget_INCLUDE_DIRS} 21 | ${Qt5DBus_INCLUDE_DIRS} 22 | ) 23 | 24 | target_link_libraries(installer 25 | ${Qt5Widgets_LIBRARIES} 26 | ${DtkWidget_LIBRARIES} 27 | ${Qt5DBus_LIBRARIES} 28 | ) 29 | 30 | 31 | install(TARGETS installer DESTINATION lib/deepin-graphics-driver-manager) 32 | install(FILES deepin-gradvrmgr-installer.desktop DESTINATION lib/deepin-graphics-driver-manager) 33 | -------------------------------------------------------------------------------- /installer/deepin-gradvrmgr-installer.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=System; 3 | Comment=Deepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool. 4 | Exec=/usr/lib/deepin-graphics-driver-manager/installer 5 | GenericName=Graphics Driver Manager 6 | Icon=deepin-graphics-driver-manager 7 | Name=Deepin Graphics Driver Manager 8 | StartupNotify=true 9 | Terminal=false 10 | Type=Application 11 | X-Deepin-Vendor=deepin 12 | 13 | # Translations: 14 | # Do not manually modify! 15 | 16 | GenericName[ar]=مدير تعريف الرسوميات 17 | GenericName[ast]=Xestor de controladores gráficos 18 | GenericName[az]=Qrafik Sürücü İdarəetməsi 19 | GenericName[bg]=Диспечер на графичен драйвер 20 | GenericName[bo]=མངོན་ཁཱའི་སྐུལ་འདེད་དོ་དམ་ཆས། 21 | GenericName[ca]=Gestor de controladors gràfics 22 | GenericName[cs]=Správa ovladačů grafických čipů 23 | GenericName[da]=Grafikdriver-håndtering 24 | GenericName[de]=Grafiktreiberverwaltung 25 | GenericName[es]=Gestor de controladores gráficos 26 | GenericName[es_419]=Gestor de controladores gráficos 27 | GenericName[et]=Videokaardi draiverite haldamine 28 | GenericName[fa]=مدیر درایور گرافیک 29 | GenericName[fi]=Grafiikkaohjaimet 30 | GenericName[fr]=Gestionnaire de pilotes graphiques 31 | GenericName[gl_ES]=Xestor de Controladores Gráficos 32 | GenericName[hr]=Upravitelj grafičkim upravljačkim programom 33 | GenericName[hu]=Grafikus Illesztőprogram Kezelő 34 | GenericName[id]=Manajer Driver Grafis 35 | GenericName[it]=Gestore driver grafici 36 | GenericName[ko]=그래픽 드라이버 관리도구 37 | GenericName[lt]=Grafikos tvarkyklių tvarkytuvė 38 | GenericName[ms]=Pengurus Pemacu Grafik 39 | GenericName[ne]=ग्राफिक्स ड्राइभर प्रबन्धक 40 | GenericName[nl]=Grafisch Stuurprogrammabeheer 41 | GenericName[pl]=Zarządzanie sterownikami graficznymi 42 | GenericName[pt]=Gestor de Controlador Gráfico 43 | GenericName[pt_BR]=Gerenciador de Drivers Gráficos 44 | GenericName[ro]=Manager Driver Video 45 | GenericName[ru]=Менеджер Графических Драйверов 46 | GenericName[sk]=Manažér grafického ovládača 47 | GenericName[sl]=Upravitelj grafičnih gonilnikov 48 | GenericName[sq]=Përgjegjës Përudhësish Grafikë 49 | GenericName[sr]=Управник Графичких Управљача 50 | GenericName[tr]=Görüntü Aygıtı Sürücüsü Yöneticisi 51 | GenericName[ug]=گىرافىك قوزغاتقۇچ باشقۇرغۇچى 52 | GenericName[uk]=Керування драйверами графіки 53 | GenericName[zh_CN]=显卡驱动管理器 54 | GenericName[zh_HK]=顯卡驅動管理器 55 | GenericName[zh_TW]=顯示卡管理器 56 | Name[ar]=مدير تعريف رسوميات ديبن 57 | Name[ast]=Deepin Graphics Driver Manager 58 | Name[az]=Deepin Qrafik Sürücü İdarəetməsi 59 | Name[bg]=Deepin диспечер на графичен драйвер 60 | Name[bo]=གཏིང་ཚད་མངོན་ཁཱ་སྐུལ་འདེད་དོ་དམ་ཆས། 61 | Name[ca]=Gestor de controladors gràfics del Deepin 62 | Name[cs]=Správa ovladačů grafických čipů v Deepin 63 | Name[da]=Deepin grafikdriver-håndtering 64 | Name[de]=Deepin Grafiktreiberverwaltung 65 | Name[es]=Gestor de controladores gráficos Deepin 66 | Name[es_419]=Gestor de controladores gráficos Deepin 67 | Name[fa]=مدیر درایور گرافیک دیپین 68 | Name[fi]=Deepin grafiikkaohjaimen hallinta 69 | Name[fr]=Gestionnaire de pilotes graphiques Deepin 70 | Name[gl_ES]=Xestor de Controladores Gráficos do Deepin 71 | Name[hr]=Deepin upravitelj grafičkim upravljačkim programom 72 | Name[hu]=Deepin® Grafikus Illesztőprogram Kezelő 73 | Name[id]=Manajer Driver Graphis Deepin 74 | Name[it]=Gestore driver grafici di Deepin 75 | Name[ko]=Deepin 그래픽 드라이버 관리도구 76 | Name[lt]=Deepin grafikos tvarkyklių tvarkytuvė 77 | Name[ms]=Pengurus Pemacu Grafik Deepin 78 | Name[ne]=डिपिन ग्राफिक्स ड्राइभर प्रबन्धक 79 | Name[nl]=Deepin Grafisch Stuurprogrammabeheer 80 | Name[pl]=Zarządzanie sterownikami graficznymi Deepin 81 | Name[pt]=Gestor de Controlador Gráfico Deepin 82 | Name[pt_BR]=deepin Gerenciador de Drivers Gráficos 83 | Name[ro]=Manager Driver Video Deepin 84 | Name[ru]=Менеджер Графических Драйверов Deepin 85 | Name[sk]=Deepin Manažér grafického ovládača 86 | Name[sl]=Deepin upravitelj grafičnih gonilnikov 87 | Name[sq]=Përgjegjës Deepin Përudhësish Grafikë 88 | Name[sr]=Управник Графичких Управљача 89 | Name[tr]=Deepin Görüntü Aygıtı Sürücüsü Yöneticisi 90 | Name[ug]=Deepin گىرافىك قوزغاتقۇچ باشقۇرغۇچى 91 | Name[uk]=Керування драйверами графіки Deepin 92 | Name[zh_CN]=深度显卡驱动管理器 93 | Name[zh_HK]=Deepin 顯卡驅動管理器 94 | Name[zh_TW]=Deepin 顯示卡管理器 95 | -------------------------------------------------------------------------------- /installer/installer-waraper: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | pkexec /usr/lib/deepin-graphics-driver-manager/installer 3 | 4 | -------------------------------------------------------------------------------- /installer/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | resources/icons/deepin-graphics-driver-manager-installing.svg 4 | resources/icons/deepin-graphics-driver-manager-success.svg 5 | resources/icons/deepin-dialog-warning.svg 6 | 7 | 8 | -------------------------------------------------------------------------------- /installer/resources/icons/deepin-dialog-warning.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Page 1 + Path + Rectangle 115 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 | -------------------------------------------------------------------------------- /prepare/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(BIN_NAME deepin-graphics-driver-manager) 3 | 4 | if (CMAKE_BUILD_TYPE MATCHES Debug) 5 | add_definitions("-DTRANSLATIONS_DIR=\"${CMAKE_BINARY_DIR}/translations/\"") 6 | add_definitions("-DRESOURCES_DIR=\"${CMAKE_SOURCE_DIR}/prepare/resources\"") 7 | else() 8 | add_definitions("-DTRANSLATIONS_DIR=\"${CMAKE_INSTALL_PREFIX}/share/deepin-graphics-driver-manager/translations/\"") 9 | add_definitions("-DRESOURCES_DIR=\"${CMAKE_INSTALL_PREFIX}/share/deepin-graphics-driver-manager/prepare/\"") 10 | endif() 11 | 12 | find_package(PkgConfig REQUIRED) 13 | find_package(Qt5Widgets REQUIRED) 14 | find_package(Qt5DBus REQUIRED) 15 | find_package(DtkCMake REQUIRED) 16 | find_package(DtkWidget REQUIRED) 17 | 18 | file(GLOB SRCS "*.h" "*.cpp") 19 | 20 | include_directories(${CMAKE_SOURCE_DIR}/utils/) 21 | add_executable(${BIN_NAME} ${SRCS} ${UTILS_FILES} resources.qrc) 22 | 23 | target_include_directories(${BIN_NAME} PUBLIC 24 | ${DtkWidget_INCLUDE_DIRS} 25 | ${Qt5DBus_INCLUDE_DIRS} 26 | ) 27 | 28 | target_link_libraries(${BIN_NAME} 29 | ${Qt5DBus_LIBRARIES} 30 | ${Qt5Widgets_LIBRARIES} 31 | ${DtkWidget_LIBRARIES} 32 | ) 33 | add_dependencies(${BIN_NAME} graphics-qm-update) 34 | 35 | # bin 36 | install(TARGETS ${BIN_NAME} DESTINATION bin) 37 | 38 | # desktop 39 | install(FILES ../deepin-graphics-driver-manager.desktop DESTINATION share/applications) 40 | 41 | # icons 42 | foreach (ICON_SIZE 64) 43 | install(FILES resources/icons/deepin-graphics-driver-manager-${ICON_SIZE}px.svg 44 | RENAME deepin-graphics-driver-manager.svg 45 | DESTINATION share/icons/hicolor/${ICON_SIZE}x${ICON_SIZE}/apps) 46 | endforeach () 47 | install(FILES resources/icons/deepin-graphics-driver-manager-64px.svg 48 | DESTINATION share/icons/hicolor/scalable/apps) 49 | 50 | #test file 51 | file(GLOB TEST_FILE "resources/test/*") 52 | install(FILES ${TEST_FILE} 53 | DESTINATION share/deepin-graphics-driver-manager/prepare/test/) 54 | 55 | # qm files 56 | file(GLOB QM_FILES "../translations/*.qm") 57 | install(DIRECTORY ${CMAKE_BINARY_DIR}/translations 58 | DESTINATION /usr/share/deepin-graphics-driver-manager/ 59 | FILES_MATCHING PATTERN "*" 60 | ) 61 | 62 | -------------------------------------------------------------------------------- /prepare/device.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef DEVICE_H 6 | #define DEVICE_H 7 | 8 | #include 9 | #include 10 | 11 | class Device 12 | { 13 | public: 14 | explicit Device(const QJsonObject &info) 15 | { 16 | m_name = info["name"].toString(); 17 | m_info = info["info"].toString(); 18 | } 19 | 20 | inline const QString name() const { return m_name; } 21 | inline const QString info() const { return m_info; } 22 | inline bool operator==(const Device &rhs) const 23 | { 24 | return m_name == rhs.name() && m_info == rhs.name(); 25 | } 26 | private: 27 | QString m_name; 28 | QString m_info; 29 | }; 30 | 31 | typedef QList DeviceList; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /prepare/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "environments.h" 6 | #include "mainwindow.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | DCORE_USE_NAMESPACE 17 | 18 | QString getUserName() 19 | { 20 | QString userPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); 21 | return userPath.section("/", -1, -1); 22 | } 23 | 24 | int main(int argc, char* argv[]) 25 | { 26 | DApplication app(argc, argv); 27 | app.loadTranslator(); 28 | QString loc = QLocale::system().name(); 29 | 30 | QString loc_tr_file = QString(TRANSLATIONS_DIR"/deepin-graphics-driver-manager_%1.qm"); 31 | 32 | QTranslator trans; 33 | trans.load(loc_tr_file.arg(loc)); 34 | app.setAutoActivateWindows(true); 35 | app.installTranslator(&trans); 36 | 37 | QProcess *process = new QProcess; 38 | process->setProcessChannelMode(QProcess::MergedChannels); 39 | QStringList args{"-c", "ps aux | grep /usr/lib/deepin-graphics-driver-manager |grep -v grep"}; 40 | process->start("/bin/bash", args); 41 | process->waitForFinished(-1); 42 | if (!process->exitCode()){ 43 | qInfo() << "The graphics driver manager is already working"; 44 | return -1; 45 | } 46 | 47 | app.setAttribute(Qt::AA_UseHighDpiPixmaps); 48 | app.setAttribute(Qt::AA_EnableHighDpiScaling); 49 | app.setOrganizationName("deepin"); 50 | app.setApplicationName("deepin-graphics-driver-manager"); 51 | app.setApplicationVersion(VERSION); 52 | app.setApplicationAcknowledgementPage("https://www.deepin.org/acknowledgments/deepin-graphics-driver-manager/"); 53 | app.setProductIcon(QIcon(":/resources/icons/deepin-graphics-driver-manager-64px.svg")); 54 | app.setProductName(QApplication::translate("main", "Graphics Driver Manager")); 55 | app.setApplicationDescription(QApplication::translate("main", "Graphics Driver Manager is a compact and easy to use graphics driver management tool. It includes graphics card hardware detection, graphics driver installation, graphics driver solution switching, graphics driver automatic recovery and other functions.")); 56 | 57 | //主题自动保存 58 | DApplicationSettings as; 59 | 60 | //设置日志 61 | const QString logFormat = "%{time}{yyyyMMdd.HH:mm:ss.zzz}[%{type:1}][%{function:-40} %{line:-4} %{threadid:-8} ] %{message}\n"; 62 | 63 | QString log_file(QString("/home/%1/.cache/deepin/deepin-graphics-driver-manager/").arg(getUserName())); 64 | QDir dir(log_file); 65 | if (!dir.exists()) { 66 | dir.mkpath(log_file); 67 | } 68 | log_file += "deepin-graphics-driver-manager.log"; 69 | ConsoleAppender *consoleAppender = new ConsoleAppender; 70 | consoleAppender->setFormat(logFormat); 71 | RollingFileAppender *rollingFileAppender = new RollingFileAppender(log_file); 72 | rollingFileAppender->setFormat(logFormat); 73 | rollingFileAppender->setLogFilesLimit(5); 74 | rollingFileAppender->setDatePattern(RollingFileAppender::DailyRollover); 75 | 76 | logger->registerAppender(consoleAppender); 77 | logger->registerAppender(rollingFileAppender); 78 | qInfo() << "VERSION: " << VERSION; 79 | qputenv("DTK_USE_SEMAPHORE_SINGLEINSTANCE", "1"); 80 | if (!app.setSingleInstance(app.applicationName(), DApplication::UserScope)) { 81 | exit(0); 82 | } 83 | MainWindow w; 84 | w.show(); 85 | 86 | return app.exec(); 87 | } 88 | -------------------------------------------------------------------------------- /prepare/mainwindow.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef MAINWINDOW_H 6 | #define MAINWINDOW_H 7 | 8 | #include "graphicsdriverproxy.h" 9 | #include "device.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | 24 | DWIDGET_USE_NAMESPACE 25 | 26 | 27 | class QLabel; 28 | class MainWindow : public DMainWindow 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | enum SolutionType { 34 | NoResolution = 0, 35 | AMD, 36 | NVIDIA, 37 | INTEL, 38 | INTEL_NVIDIA, 39 | INTEL_NVIDIA_USE_INTEL, 40 | INTEL_NVIDIA_USE_NVIDIA 41 | }; 42 | explicit MainWindow(QWidget *parent = nullptr); 43 | ~MainWindow(); 44 | private: 45 | void keyPressEvent(QKeyEvent *e); 46 | void closeEvent(QCloseEvent *event); 47 | void noResolutions(); 48 | void loadDevice(); 49 | void setVendorIcon(); 50 | 51 | private Q_SLOTS: 52 | void loadResolutions(); 53 | void onResolutionSelected(); 54 | void onUpdateBtnClicked(); 55 | void onToggleBtnClicked(); 56 | void onRebootBtnClicked(); 57 | void onCancelBtnClicked(); 58 | void onTryClicked(); 59 | void onPreInstallProgress(int progress); 60 | void onThemeChanged(DGuiApplicationHelper::ColorType type); 61 | 62 | 63 | 64 | private: 65 | int m_usedIndex = 0; 66 | int m_selectedIndex = 0; 67 | 68 | QWidget *m_centerWidget; 69 | QVBoxLayout *m_resolutionsLayout; 70 | QLabel *m_vendorIcon; 71 | QLabel *m_vendorName; 72 | QLabel *m_tipsIcon; 73 | QLabel *m_warningTips; 74 | QLabel *m_installTips; 75 | DSpinner *m_spinner; 76 | QWidget *m_resolutionsWidget; 77 | QPushButton *m_toggleButton; 78 | QPushButton *m_updateButton; 79 | DSuggestButton *m_rebootButton; 80 | QPushButton *m_cancelButton; 81 | QPushButton *m_tryButton; 82 | QPushButton *m_okButton; 83 | ComDeepinDaemonGraphicsDriverInterface *m_graphicsDriver = nullptr; 84 | DeviceList m_devices; 85 | bool m_startPreInstall = false; 86 | 87 | }; 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /prepare/resolution.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef RESOLUTION_H 6 | #define RESOLUTION_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | static const char *translates[] = { 14 | QT_TRANSLATE_NOOP("Resolution", "Integrated Graphics"), 15 | QT_TRANSLATE_NOOP("Resolution", "Switching to the discrete graphics interface may cause a black screen"), 16 | QT_TRANSLATE_NOOP("Resolution", "Official driver"), 17 | QT_TRANSLATE_NOOP("Resolution", "Unofficial driver"), 18 | QT_TRANSLATE_NOOP("Resolution", "Only adaptive to parts of distributions and graphics cards, and it may cause a black screen"), 19 | QT_TRANSLATE_NOOP("Resolution", "Poor performance, unstable in some graphics cards"), 20 | QT_TRANSLATE_NOOP("Resolution", "Switching to the integrated graphics interface may cause a black screen"), 21 | QT_TRANSLATE_NOOP("Resolution", "Integrated Graphics"), 22 | QT_TRANSLATE_NOOP("Resolution", "Integrated graphics driver"), 23 | QT_TRANSLATE_NOOP("Resolution", "Bumblebee"), 24 | QT_TRANSLATE_NOOP("Resolution", "Save power to reduce power consumption"), 25 | QT_TRANSLATE_NOOP("Resolution", "PRIME"), 26 | QT_TRANSLATE_NOOP("Resolution", "Best performance, for computers with hybrid graphics"), 27 | }; 28 | 29 | 30 | class Resolution 31 | { 32 | public: 33 | explicit Resolution(const QJsonObject &info) 34 | { 35 | Q_UNUSED(translates) 36 | m_name = info["name"].toString(); 37 | m_title = QApplication::translate("Resolution", info["title"].toString().toStdString().c_str()); 38 | m_driver = info["driver"].toString(); 39 | m_description = QApplication::translate("Resolution", info["description"].toString().toStdString().c_str()); 40 | m_currVersion = info["currVersion"].toString(); 41 | m_repVersion = info["depoVersion"].toString(); 42 | m_enable = info["enable"].toBool(); 43 | } 44 | 45 | inline const QString name() const { return m_name; } 46 | inline const QString title() const { return m_title; } 47 | inline const QString description() const { return m_description; } 48 | inline const QString driver() const { return m_driver; } 49 | inline const QString currVersion() const { return m_currVersion; } 50 | inline const QString repVersion() const { return m_repVersion; } 51 | inline bool enable() const { return m_enable; } 52 | private: 53 | QString m_name; 54 | QString m_title; 55 | QString m_description; 56 | QString m_driver; 57 | QString m_currVersion; 58 | QString m_repVersion; 59 | bool m_enable = false; 60 | }; 61 | 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /prepare/resolutionwidget.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef RESOLUTIONWIDGET_H_ 6 | #define RESOLUTIONWIDGET_H_ 7 | 8 | #include "resolution.h" 9 | #include "graphicsdriverproxy.h" 10 | 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | DWIDGET_USE_NAMESPACE 22 | class QLabel; 23 | class ResolutionWidget: public QFrame 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit ResolutionWidget(ComDeepinDaemonGraphicsDriverInterface *graphicsDriver, const Resolution &resolution, QWidget *parent = nullptr); 29 | ~ResolutionWidget() override; 30 | virtual void initUI(); 31 | virtual void setChecked(bool checked); 32 | virtual void prepareInstall(); 33 | virtual Resolution resolution() const { return m_resolution; } 34 | virtual bool canUpdate(); 35 | 36 | signals: 37 | void clicked() const; 38 | void preInstallProgress(int); 39 | 40 | private Q_SLOTS: 41 | virtual void onThemeChanged(Dtk::Gui::DGuiApplicationHelper::ColorType type); 42 | 43 | protected: 44 | void mouseReleaseEvent(QMouseEvent *e) override; 45 | 46 | protected: 47 | ComDeepinDaemonGraphicsDriverInterface *m_graphicsDriver; 48 | Resolution m_resolution; 49 | bool m_checked = false; 50 | bool m_using = false; 51 | QLabel *m_checkedBtn = nullptr; 52 | QLabel *m_title = nullptr; 53 | QLabel *m_version = nullptr; 54 | QLabel *m_description = nullptr; 55 | QTimer *m_timer = nullptr; 56 | 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /prepare/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | resources/icons/AMD.svg 4 | resources/icons/Intel-NVIDIA.svg 5 | resources/icons/Intel.svg 6 | resources/icons/NVIDIA.svg 7 | resources/icons/success.svg 8 | resources/icons/select.svg 9 | resources/icons/select_dark.svg 10 | resources/icons/fail.svg 11 | resources/icons/deepin-graphics-driver-manager-64px.svg 12 | resources/theme/light/light.qss 13 | resources/theme/dark/dark.qss 14 | 15 | 16 | -------------------------------------------------------------------------------- /prepare/resources/icons/AMD.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AMD 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /prepare/resources/icons/NVIDIA.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NVIDIA 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /prepare/resources/icons/fail.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon/fail 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /prepare/resources/icons/select.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | select 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /prepare/resources/icons/select_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | select_dark 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /prepare/resources/icons/success.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon/success 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /prepare/resources/test/amd.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "amd", 3 | "type": 1, 4 | "resolutions": 5 | [ 6 | { 7 | "name": "amdgpu", 8 | "title": "Use AMDGPU driver", 9 | "description": "For special needs. Auto determine the acceleration way without external configuration.", 10 | "driver": "xxx", 11 | "currVersion": "yyy", 12 | "depoVersion": "zzz", 13 | "enable": true 14 | }, 15 | 16 | { 17 | "name": "raedon", 18 | "title": "Use Raedon driver", 19 | "description": "For special needs. Auto determine the acceleration way without external configuration.", 20 | "driver": "xxx", 21 | "currVersion": "yyy", 22 | "depoVersion": "zzz", 23 | "enable": false 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /prepare/resources/test/device.json: -------------------------------------------------------------------------------- 1 | { 2 | "devices": 3 | [ 4 | { 5 | "info": "Intel HD Graphics 530", 6 | "name": "intel" 7 | }, 8 | 9 | { 10 | "info": "NVIDIA GeForce MX250/1.3", 11 | "name": "nvidia" 12 | } 13 | ] 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /prepare/resources/test/intel.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "intel", 3 | "type": 3, 4 | "resolutions": 5 | [ 6 | { 7 | "title": "Integrated graphics driver", 8 | "name": "glamor", 9 | "description": "Poor compatibility for parts of old graphics cards.", 10 | "driver": "xxx", 11 | "currVersion": "yyy", 12 | "depoVersion": "yyy", 13 | "enable": true 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /prepare/resources/test/intel_nvidia.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nvidia_intel", 3 | "type": 4, 4 | "resolutions": 5 | [ 6 | { 7 | "title": "Integrated graphics driver", 8 | "name": "glamor", 9 | "description": "Poor compatibility for parts of old graphics cards.", 10 | "driver": "xxx", 11 | "currVersion": "xxx", 12 | "depoVersion": "yyy", 13 | "enable": true 14 | }, 15 | 16 | { 17 | "name": "bumblebee", 18 | "title": "Bumblebee", 19 | "description": "Save power to reduce power consumption", 20 | "driver": "nvidia", 21 | "currVersion": "1.1", 22 | "depoVersion": "1.1", 23 | "enable": false 24 | }, 25 | { 26 | "name": "prime", 27 | "title": "PRIME", 28 | "description": "Best performance, for computers with hybrid graphics", 29 | "driver": "nvidia", 30 | "currVersion": "yyy", 31 | "depoVersion": "yyy", 32 | "enable": false 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /prepare/resources/test/intel_nvidia_use_intel.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nvidia_intel_use_intel", 3 | "type": 5, 4 | "resolutions": 5 | [ 6 | { 7 | "title": "Integrated graphics driver", 8 | "name": "glamor", 9 | "description": "Poor compatibility for parts of old graphics cards.", 10 | "driver": "xxx", 11 | "currVersion": "zzz", 12 | "depoVersion": "zzz", 13 | "enable": true 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /prepare/resources/test/intel_nvidia_use_nvidia.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": 6, 3 | "name": "intel_nvidia_use_nvidia", 4 | "resolutions": 5 | [ 6 | { 7 | "title": "Unofficial driver", 8 | "name": "nouveau", 9 | "description": "Poor performance, unstable in some graphics cards", 10 | "driver": "nvidia", 11 | "currVersion": "yyy", 12 | "depoVersion": "zzz", 13 | "enable": true 14 | }, 15 | { 16 | "title": "Official driver", 17 | "name": "nvidia", 18 | "description": "Only adaptive to parts of distributions and graphics cards, and it may cause a black screen", 19 | "driver": "nvidia", 20 | "currVersion": "yyy", 21 | "depoVersion": "zzz", 22 | "enable": false 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /prepare/resources/test/nvidia.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": 2, 3 | "name": "nvidia", 4 | "resolutions": 5 | [ 6 | { 7 | "title": "Unofficial driver", 8 | "name": "nouveau", 9 | "description": "Poor performance, unstable in some graphics cards", 10 | "driver": "driver_name", 11 | "currVersion": "xxx", 12 | "depoVersion": "yyy", 13 | "enable": true 14 | }, 15 | { 16 | "title": "Official driver", 17 | "name": "nvidia", 18 | "description": "Only adaptive to parts of distributions and graphics cards, and it may cause a black screen", 19 | "driver": "driver_name", 20 | "currVersion": "xxx", 21 | "depoVersion": "yyy", 22 | "enable": false 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /prepare/resources/theme/dark/dark.qss: -------------------------------------------------------------------------------- 1 | QLabel #TopTips { 2 | font-size: 16pt; 3 | } 4 | 5 | QLabel #BottomTips { 6 | margin-top: 35px; 7 | } 8 | 9 | QWidget #ResolutionsWidget { 10 | background-color: #242424; 11 | border: 1px solid #2D2D2D; 12 | border-radius: 3px; 13 | } 14 | -------------------------------------------------------------------------------- /prepare/resources/theme/light/light.qss: -------------------------------------------------------------------------------- 1 | QLabel #TopTips { 2 | font-size: 16pt; 3 | } 4 | 5 | QLabel #BottomTips { 6 | margin-top: 35px; 7 | } 8 | 9 | QWidget #ResolutionsWidget { 10 | border: 1px solid #eee; 11 | border-radius: 3px; 12 | } 13 | -------------------------------------------------------------------------------- /prepare/singleresolutionwidget.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "singleresolutionwidget.h" 6 | #include "utils.h" 7 | 8 | #include 9 | #include 10 | 11 | SingleResolutionWidget::SingleResolutionWidget(ComDeepinDaemonGraphicsDriverInterface *graphicsDriver, const Resolution &resolution, QWidget *parent) 12 | : ResolutionWidget(graphicsDriver, resolution, parent) 13 | { 14 | 15 | } 16 | 17 | void SingleResolutionWidget::initUI() 18 | { 19 | ResolutionWidget::initUI(); 20 | m_title->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); 21 | m_version->setAlignment(Qt::AlignTop | Qt::AlignHCenter); 22 | m_description->setVisible(false); 23 | setContentsMargins(0, 50, 0, 10); 24 | } 25 | 26 | void SingleResolutionWidget::onThemeChanged(Dtk::Gui::DGuiApplicationHelper::ColorType type) 27 | { 28 | if (type == Dtk::Gui::DGuiApplicationHelper::ColorType::LightType) { 29 | Dtk::Gui::DGuiApplicationHelper::instance()->setThemeType(type); 30 | m_version->setStyleSheet("QLabel {" 31 | "color: #001A2E;" 32 | "}"); 33 | 34 | m_title->setStyleSheet("QLabel {" 35 | "font-weight: 500;" 36 | "color: #414d68;" 37 | "}"); 38 | 39 | m_description->setStyleSheet("QLabel {" 40 | "color: #526a7f;" 41 | "}"); 42 | 43 | } else if (type == Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType) { 44 | Dtk::Gui::DGuiApplicationHelper::instance()->setThemeType(type); 45 | m_version->setStyleSheet("QLabel {" 46 | "color: #c0c6d4;" 47 | "}"); 48 | 49 | m_title->setStyleSheet("QLabel {" 50 | "font-weight: 500;" 51 | "color: #C0C6D4;" 52 | "}"); 53 | 54 | m_description->setStyleSheet("QLabel {" 55 | "color: #6d7c88;" 56 | "}"); 57 | } 58 | } 59 | 60 | void SingleResolutionWidget::setChecked(const bool checked) 61 | { 62 | m_checked = checked; 63 | m_checkedBtn->setVisible(false); 64 | } 65 | -------------------------------------------------------------------------------- /prepare/singleresolutionwidget.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef SINGLE_RESOLUTION_WIDGET_H 6 | #define SINGLE_RESOLUTION_WIDGET_H 7 | 8 | #include "resolutionwidget.h" 9 | 10 | 11 | 12 | class SingleResolutionWidget : public ResolutionWidget 13 | { 14 | Q_OBJECT 15 | public: 16 | explicit SingleResolutionWidget(ComDeepinDaemonGraphicsDriverInterface *graphicsDriver, const Resolution &resolution, QWidget *parent = nullptr); 17 | 18 | private Q_SLOTS: 19 | virtual void onThemeChanged(Dtk::Gui::DGuiApplicationHelper::ColorType type); 20 | // ResolutionWidget interface 21 | public: 22 | void initUI(); 23 | void setChecked(const bool checked); 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(BIN_NAME deepin-graphics-driver-manager-service) 3 | 4 | 5 | # Defines path to resource directories 6 | if (CMAKE_BUILD_TYPE MATCHES Debug) 7 | add_definitions("-DSCRIPTS_DIR=\"${CMAKE_SOURCE_DIR}/server/scripts/\"") 8 | add_definitions("-DRESOLUTIONS_DIR=\"${CMAKE_SOURCE_DIR}/server/resources/config/resolutions/\"") 9 | else() 10 | add_definitions("-DSCRIPTS_DIR=\"${CMAKE_INSTALL_PREFIX}/lib/deepin-graphics-driver-manager/\"") 11 | add_definitions("-DRESOLUTIONS_DIR=\"${CMAKE_INSTALL_PREFIX}/lib/deepin-graphics-driver-manager/\"") 12 | add_definitions("-DRESOLUTIONS_DIR=\"${CMAKE_INSTALL_PREFIX}/lib/deepin-graphics-driver-manager/\"") 13 | endif() 14 | 15 | 16 | find_package(PkgConfig REQUIRED) 17 | find_package(Qt5DBus REQUIRED) 18 | 19 | pkg_check_modules(PCI REQUIRED libpci) 20 | pkg_check_modules(DtkWidget REQUIRED dtkwidget) 21 | 22 | file(GLOB SRCS "*.h" "*.cpp") 23 | add_executable(${BIN_NAME} ${SRCS}) 24 | 25 | target_include_directories(${BIN_NAME} PUBLIC 26 | ${DtkWidget_INCLUDE_DIRS} 27 | ${PCI_INCLUDE_DIRS} 28 | ${Qt5DBus_INCLUDE_DIRS} 29 | ) 30 | 31 | target_link_libraries(${BIN_NAME} 32 | ${PCI_LIBRARIES} 33 | ${DtkWidget_LIBRARIES} 34 | ${Qt5DBus_LIBRARIES} 35 | ) 36 | 37 | # bin 38 | install(TARGETS ${BIN_NAME} DESTINATION lib/deepin-daemon) 39 | 40 | # dbus conf 41 | install(FILES data/com.deepin.graphicmanger.conf 42 | DESTINATION share/dbus-1/system.d/) 43 | 44 | #dbus service 45 | install(FILES data/com.deepin.graphicmanger.service 46 | DESTINATION share/dbus-1/system-services/) 47 | 48 | # initramfs-tools 49 | install(PROGRAMS data/deepin-overlay 50 | DESTINATION share/initramfs-tools/scripts/init-bottom/) 51 | install(PROGRAMS data/zzz-overlay 52 | DESTINATION share/initramfs-tools/scripts/init-bottom/) 53 | 54 | 55 | # resolutions.json 56 | install(FILES resources/config/resolutions/resolutions.json 57 | DESTINATION deepin-graphics-driver-manager) 58 | 59 | # systemd servies 60 | install(FILES resources/service/dgradvrmgr-gltest.service 61 | DESTINATION /lib/systemd/system) 62 | 63 | # scripts 64 | install(DIRECTORY scripts/ 65 | DESTINATION lib/deepin-graphics-driver-manager 66 | FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) 67 | 68 | # resolutions.json 69 | install(FILES resources/config/resolutions/resolutions.json 70 | DESTINATION lib/deepin-graphics-driver-manager) 71 | -------------------------------------------------------------------------------- /server/data/com.deepin.graphicmanger.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 22 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /server/data/com.deepin.graphicmanger.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=com.deepin.graphicmanger 3 | Exec=/usr/lib/deepin-daemon/deepin-graphics-driver-manager-service 4 | User=root 5 | -------------------------------------------------------------------------------- /server/data/deepin-overlay: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case "$1" in 4 | # no pre-reqs 5 | prereqs) echo ""; exit 0;; 6 | esac 7 | 8 | PATH=/usr/sbin:/usr/bin:/sbin:/bin 9 | MYTAG="Deepin" 10 | 11 | ROOTMNT=${rootmnt} 12 | LOOP_DEV="/dev/loop0" 13 | 14 | isEnableOverlayRoot=$(grep "^overlayroot=" ${ROOTMNT}/etc/overlayroot.conf |awk -F \" '{print $2}') || isEnableOverlayRoot= 15 | 16 | if [ -z "${isEnableOverlayRoot}" ]; then 17 | echo "Overlayroot is not enable" 18 | else 19 | overlayroot_device=$(echo $isEnableOverlayRoot |awk -F \: '{print $2}' |awk -F \, '{print $1}' |awk -F \= '{print $2}') 20 | if [ "$overlayroot_device" = "$LOOP_DEV" ]; then 21 | mkdir /run/overlayroot 22 | mount -t tmpfs -o size=2G tmpfs /run/overlayroot 23 | cp ${ROOTMNT}/usr/lib/deepin-graphics-driver-manager/working-dir/overlayroot.img /run/overlayroot 24 | [ -e "${LOOP_DEV}" ] || mknod ${LOOP_DEV} b 7 0 25 | losetup ${LOOP_DEV} /run/overlayroot/overlayroot.img 26 | fi 27 | fi 28 | exit 0 29 | -------------------------------------------------------------------------------- /server/data/zzz-overlay: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case "$1" in 4 | # no pre-reqs 5 | prereqs) echo ""; exit 0;; 6 | esac 7 | 8 | PATH=/usr/sbin:/usr/bin:/sbin:/bin 9 | MYTAG="Deepin" 10 | 11 | ROOTMNT=${rootmnt} 12 | LOOP_DEV="/dev/loop0" 13 | ROOT_RO=${ROOTMNT}/media/root-ro 14 | OVERLAYROOT_CONF=${ROOT_RO}/etc/overlayroot.conf 15 | 16 | OVERLAY_DEVICE=$(cat /proc/mounts |grep ${ROOTMNT}/media/root-rw |awk '{print $1}') 17 | 18 | if [ "${OVERLAY_DEVICE}" = "${LOOP_DEV}" ]; then 19 | mount -o remount,rw ${ROOT_RO} 20 | sed -i 's:overlayroot=".*":overlayroot="":' ${OVERLAYROOT_CONF} 21 | mount -o remount,ro ${ROOT_RO} 22 | fi 23 | exit 0 24 | -------------------------------------------------------------------------------- /server/graphicsdeviceinfo.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "graphicsdeviceinfo.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | extern "C" { 12 | #include 13 | } 14 | 15 | #include 16 | 17 | #define CLASSNAME_VGA "VGA compatible controller" 18 | #define CLASSNAME_3D "3D controller" 19 | 20 | // NOTE: see more info /usr/share/misc/pci.ids 21 | inline bool is_display_controller(const uint devClass) 22 | { 23 | //qDebug() << "device_class: "<< devClass; 24 | return (devClass & 0xff00) == 0x0300 || devClass == 0x0400; 25 | } 26 | 27 | DeviceFlag GraphicsDeviceInfo::deviceType(const QString &devInfo) 28 | { 29 | if (devInfo.contains("Intel")) 30 | return DeviceFlag::INTEL; 31 | else if (devInfo.contains("NVIDIA")) 32 | return DeviceFlag::NVIDIA; 33 | else if (devInfo.contains("AMD")) 34 | return DeviceFlag::AMD; 35 | else 36 | return DeviceFlag::NoDevice; 37 | } 38 | 39 | GraphicsDeviceInfo::GraphicsDeviceInfo() 40 | { 41 | init(); 42 | } 43 | 44 | 45 | bool GraphicsDeviceInfo::isNotebook() 46 | { 47 | QDBusInterface upowerInterface("org.freedesktop.UPower", 48 | "/org/freedesktop/UPower", 49 | "org.freedesktop.UPower", 50 | QDBusConnection::systemBus()); 51 | QVariant defaultDevice(upowerInterface.property("LidIsPresent")); 52 | if (defaultDevice.type() != QVariant::Type::Bool) { 53 | qCritical() << "failed get pc type. " << defaultDevice.type(); 54 | return false; 55 | } 56 | qDebug() << "defaultDevice.toBool() = " << defaultDevice.toBool(); 57 | return defaultDevice.toBool(); 58 | } 59 | 60 | 61 | 62 | void GraphicsDeviceInfo::init() 63 | { 64 | struct pci_access *pacc; 65 | struct pci_dev *dev; 66 | char namebuf[1024]; 67 | char path[1024], *base; 68 | int n; 69 | pacc = pci_alloc(); 70 | pci_init(pacc); 71 | pci_scan_bus(pacc); 72 | for (dev = pacc->devices; dev; dev = dev->next) 73 | { 74 | pci_fill_info(dev, PCI_FILL_PHYS_SLOT | PCI_FILL_IDENT); 75 | if (!is_display_controller(dev->device_class)) 76 | continue; 77 | base = pci_get_param(dev->access, "sysfs.path"); 78 | if (!base || !base[0]){ 79 | qWarning()<<"Get sysfs.path failed!"; 80 | return; 81 | } 82 | 83 | n = snprintf(path, sizeof(path), "%s/devices/%04x:%02x:%02x.%d/", 84 | base, dev->domain, dev->bus, dev->dev, dev->func); 85 | if (n < 0 || n >= (int)sizeof(path)){ 86 | qWarning("sysfs device name too long, why?"); 87 | return; 88 | } 89 | qDebug()<<"path:" <vendor_id, dev->device_id); 113 | if (devInfo.contains("Intel")){ 114 | devName = "INTEL"; 115 | flag = DeviceFlag::INTEL; 116 | }else if (devInfo.contains("NVIDIA")){ 117 | devName = "NVIDIA"; 118 | flag= DeviceFlag::NVIDIA; 119 | }else if (devInfo.contains("AMD")){ 120 | devName = "AMD"; 121 | flag= DeviceFlag::AMD; 122 | } 123 | m_sysDevFlag |= flag; 124 | 125 | if (!isNotebook() && !boot_vga) { 126 | continue; 127 | } 128 | qDebug("devName=%s, devInfo=%s, driver=%s, boot_vga=%d, m_sysDevFlag=%d", qPrintable(devName), qPrintable(devInfo), qPrintable(driver), boot_vga, m_sysDevFlag); 129 | Device device = Device(devName, devInfo, driver, boot_vga, flag); 130 | m_devices.append(device); 131 | if(boot_vga){ 132 | m_curDevice = device; 133 | } 134 | } 135 | pci_cleanup(pacc); 136 | } 137 | -------------------------------------------------------------------------------- /server/graphicsdeviceinfo.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef GRAPHICSDEVICEINFO_H 6 | #define GRAPHICSDEVICEINFO_H 7 | 8 | #include 9 | enum DeviceFlag 10 | { 11 | NoDevice = 0, 12 | AMD = 1, 13 | NVIDIA = 1 << 1, 14 | INTEL = 1 << 2, 15 | }; 16 | 17 | class Device 18 | { 19 | public: 20 | Device(const QString &name, const QString &info, const QString &driver, bool vga, DeviceFlag flag) 21 | { 22 | m_name = name; 23 | m_info = info; 24 | m_driver = driver; 25 | boot_vga = vga; 26 | m_flag = flag; 27 | } 28 | 29 | Device(){} 30 | QString m_name; 31 | QString m_info; 32 | QString m_driver; 33 | bool boot_vga; 34 | DeviceFlag m_flag; 35 | }; 36 | 37 | class GraphicsDeviceInfo 38 | { 39 | public: 40 | 41 | Q_DECLARE_FLAGS(DeviceFlags, DeviceFlag) 42 | 43 | explicit GraphicsDeviceInfo(); 44 | 45 | int deviceFlag() const { return m_sysDevFlag; } 46 | int curDeviceFlag() const { return m_curDevFlag; } 47 | int deviceNums() const; 48 | Device curDevice() const { return m_curDevice; }; 49 | const QList devices() const { return m_devices; } 50 | bool isNotebook(); 51 | static DeviceFlag deviceType(const QString &devInfo); 52 | private: 53 | void init(); 54 | 55 | private: 56 | DeviceFlags m_sysDevFlag; 57 | DeviceFlags m_curDevFlag; 58 | QList m_devices; 59 | Device m_curDevice; 60 | }; 61 | 62 | Q_DECLARE_OPERATORS_FOR_FLAGS(GraphicsDeviceInfo::DeviceFlags) 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /server/graphicsdriveradaptor.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "graphicsdriveradaptor.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /* 15 | * Implementation of adaptor class GraphicsDriverAdaptor 16 | */ 17 | 18 | GraphicsDriverAdaptor::GraphicsDriverAdaptor(QObject *parent) 19 | : QDBusAbstractAdaptor(parent) 20 | { 21 | // constructor 22 | setAutoRelaySignals(true); 23 | } 24 | 25 | GraphicsDriverAdaptor::~GraphicsDriverAdaptor() 26 | { 27 | // destructor 28 | } 29 | 30 | void GraphicsDriverAdaptor::CancelInstall() 31 | { 32 | // handle method call com.deepin.daemon.GraphicsDriver.CancelInstall 33 | QMetaObject::invokeMethod(parent(), "CancelInstall"); 34 | } 35 | 36 | QString GraphicsDriverAdaptor::GetCurrDriverName() 37 | { 38 | // handle method call com.deepin.daemon.GraphicsDriver.GetCurrDriverName 39 | QString out0; 40 | QMetaObject::invokeMethod(parent(), "GetCurrDriverName", Q_RETURN_ARG(QString, out0)); 41 | return out0; 42 | } 43 | 44 | QString GraphicsDriverAdaptor::GetDevice() 45 | { 46 | // handle method call com.deepin.daemon.GraphicsDriver.GetDevice 47 | QString out0; 48 | QMetaObject::invokeMethod(parent(), "GetDevice", Q_RETURN_ARG(QString, out0)); 49 | return out0; 50 | } 51 | 52 | QString GraphicsDriverAdaptor::GetNewDriverName() 53 | { 54 | // handle method call com.deepin.daemon.GraphicsDriver.GetNewDriverName 55 | QString out0; 56 | QMetaObject::invokeMethod(parent(), "GetNewDriverName", Q_RETURN_ARG(QString, out0)); 57 | return out0; 58 | } 59 | 60 | QString GraphicsDriverAdaptor::GetOldDriverName() 61 | { 62 | // handle method call com.deepin.daemon.GraphicsDriver.GetOldDriverName 63 | QString out0; 64 | QMetaObject::invokeMethod(parent(), "GetOldDriverName", Q_RETURN_ARG(QString, out0)); 65 | return out0; 66 | } 67 | 68 | QString GraphicsDriverAdaptor::GetResolutionTitle() 69 | { 70 | // handle method call com.deepin.daemon.GraphicsDriver.GetResolutionTitle 71 | QString out0; 72 | QMetaObject::invokeMethod(parent(), "GetResolutionTitle", Q_RETURN_ARG(QString, out0)); 73 | return out0; 74 | } 75 | 76 | bool GraphicsDriverAdaptor::IsTestSuccess() 77 | { 78 | // handle method call com.deepin.daemon.GraphicsDriver.IsTestSuccess 79 | bool out0; 80 | QMetaObject::invokeMethod(parent(), "IsTestSuccess", Q_RETURN_ARG(bool, out0)); 81 | return out0; 82 | } 83 | 84 | void GraphicsDriverAdaptor::PrepareInstall(const QString &name, const QString &language) 85 | { 86 | // handle method call com.deepin.daemon.GraphicsDriver.PrepareInstall 87 | QMetaObject::invokeMethod(parent(), "PrepareInstall", Q_ARG(QString, name), Q_ARG(QString, language)); 88 | } 89 | 90 | void GraphicsDriverAdaptor::RealInstall() 91 | { 92 | // handle method call com.deepin.daemon.GraphicsDriver.RealInstall 93 | QMetaObject::invokeMethod(parent(), "RealInstall"); 94 | } 95 | 96 | void GraphicsDriverAdaptor::TestInstall() 97 | { 98 | // handle method call com.deepin.daemon.GraphicsDriver.TestInstall 99 | QMetaObject::invokeMethod(parent(), "TestInstall"); 100 | } 101 | 102 | void GraphicsDriverAdaptor::TestSuccess() 103 | { 104 | // handle method call com.deepin.daemon.GraphicsDriver.TestSuccess 105 | QMetaObject::invokeMethod(parent(), "TestSuccess"); 106 | } 107 | 108 | -------------------------------------------------------------------------------- /server/graphicsdriveradaptor.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef GRAPHICSDRIVERADAPTOR_H 6 | #define GRAPHICSDRIVERADAPTOR_H 7 | 8 | #include 9 | #include 10 | #include "graphicsdriverinterface.h" 11 | QT_BEGIN_NAMESPACE 12 | class QByteArray; 13 | template class QList; 14 | template class QMap; 15 | class QString; 16 | class QStringList; 17 | class QVariant; 18 | QT_END_NAMESPACE 19 | 20 | /* 21 | * Adaptor class for interface com.deepin.daemon.GraphicsDriver 22 | */ 23 | class GraphicsDriverAdaptor: public QDBusAbstractAdaptor 24 | { 25 | Q_OBJECT 26 | Q_CLASSINFO("D-Bus Interface", "com.deepin.daemon.GraphicsDriver") 27 | Q_CLASSINFO("D-Bus Introspection", "" 28 | " \n" 29 | " \n" 30 | " \n" 31 | " \n" 32 | " \n" 33 | " \n" 34 | " \n" 35 | " \n" 36 | " \n" 37 | " \n" 38 | " \n" 39 | " \n" 40 | " \n" 41 | " \n" 42 | " \n" 43 | " \n" 44 | " \n" 45 | " \n" 46 | " \n" 47 | " \n" 48 | " \n" 49 | " \n" 50 | " \n" 51 | " \n" 52 | " \n" 53 | " \n" 54 | " \n" 55 | " \n" 56 | " \n" 57 | " \n" 58 | " \n" 59 | " \n" 60 | "") 61 | public: 62 | GraphicsDriverAdaptor(QObject *parent); 63 | virtual ~GraphicsDriverAdaptor(); 64 | 65 | public: // PROPERTIES 66 | public Q_SLOTS: // METHODS 67 | void CancelInstall(); 68 | QString GetCurrDriverName(); 69 | QString GetDevice(); 70 | QString GetNewDriverName(); 71 | QString GetOldDriverName(); 72 | QString GetResolutionTitle(); 73 | bool IsTestSuccess(); 74 | void PrepareInstall(const QString &name, const QString &language); 75 | void RealInstall(); 76 | void TestInstall(); 77 | void TestSuccess(); 78 | Q_SIGNALS: // SIGNALS 79 | void Cancel(); 80 | void ReportProgress(const QString &ratio); 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /server/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "graphicsdriverinterface.h" 10 | #include "graphicsdriveradaptor.h" 11 | #include 12 | #include 13 | #include 14 | 15 | DCORE_USE_NAMESPACE 16 | 17 | const QString GraphicMangerServiceName = "com.deepin.graphicmanger"; 18 | const QString GraphicMangerPath = "/com/deepin/graphicmanger"; 19 | 20 | int main(int argc, char **argv) 21 | { 22 | QString PATH = qgetenv("PATH"); 23 | 24 | if (PATH.isEmpty()) { 25 | PATH = "/usr/bin"; 26 | } 27 | PATH += ":/usr/sbin"; 28 | PATH += ":/sbin"; 29 | qputenv("PATH", PATH.toLatin1()); 30 | 31 | QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); 32 | 33 | QCoreApplication app(argc, argv); 34 | app.setOrganizationName("deepin"); 35 | app.setApplicationName("deepin-graphics-driver-manager-server"); 36 | 37 | //设置日志 38 | const QString logFormat = "%{time}{yyyyMMdd.HH:mm:ss.zzz}[%{type:1}][%{function:-40} %{line:-4} %{threadid:-8} ] %{message}\n"; 39 | const QString log_file(QString("/var/log/deepin-graphics-driver-manager-server.log")); 40 | ConsoleAppender *consoleAppender = new ConsoleAppender; 41 | consoleAppender->setFormat(logFormat); 42 | RollingFileAppender *rollingFileAppender = new RollingFileAppender(log_file); 43 | rollingFileAppender->setFormat(logFormat); 44 | rollingFileAppender->setLogFilesLimit(5); 45 | rollingFileAppender->setDatePattern(RollingFileAppender::DailyRollover); 46 | 47 | logger->registerAppender(consoleAppender); 48 | logger->registerAppender(rollingFileAppender); 49 | 50 | QDBusConnection connection = QDBusConnection::systemBus(); 51 | 52 | GraphicsDriverInterface interface; 53 | GraphicsDriverAdaptor adaptor(&interface); 54 | 55 | if (!connection.registerService(GraphicMangerServiceName)) 56 | { 57 | qDebug() << connection.lastError().message(); 58 | exit(1); 59 | } 60 | 61 | connection.registerObject(GraphicMangerPath, &interface, QDBusConnection::ExportAllContents); 62 | 63 | return app.exec(); 64 | } 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /server/resolution.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "resolution.h" 6 | 7 | #include 8 | 9 | 10 | Resolution::Resolution() 11 | { 12 | 13 | } 14 | 15 | 16 | bool Resolution::isNull() { 17 | return m_resName.isEmpty(); 18 | } 19 | 20 | Resolution::Resolution(const QJsonObject &info) 21 | { 22 | 23 | QJsonValue shouldDisplay = info.value("display"); 24 | if (shouldDisplay == QJsonValue::Undefined) { 25 | m_display = true; 26 | } else { 27 | m_display = shouldDisplay.toBool(); 28 | } 29 | 30 | m_resId = info["id"].toInt(); 31 | m_keepGLTest = info["keep_gltest"].toBool(); 32 | m_resName = info["name"].toString(); 33 | m_resdriver = info["driver"].toString(); 34 | m_resTitle = info["title"].toString(); 35 | m_resDescription = info["description"].toString(); 36 | m_installScript = info["install"].toString(); 37 | m_removeScript = info["remove"].toString(); 38 | } 39 | -------------------------------------------------------------------------------- /server/resolution.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef RESOLUTION_H_ 6 | #define RESOLUTION_H_ 7 | 8 | #include 9 | #include 10 | 11 | class Resolution 12 | { 13 | public: 14 | Resolution(); 15 | explicit Resolution(const QJsonObject &info); 16 | bool isNull(); 17 | 18 | inline int id() const { return m_resId; } 19 | inline bool display() const { return m_display; } 20 | inline bool keep_gltest() const { return m_keepGLTest; } 21 | inline const QString name() const { return m_resName; } 22 | inline const QString driver() const { return m_resdriver; } 23 | inline const QString title() const { return m_resTitle; } 24 | inline const QString description() const { return m_resDescription; } 25 | inline const QString installScript() const { return m_installScript; } 26 | inline const QString removeScript() const { return m_removeScript; } 27 | 28 | inline bool operator==(const Resolution &rhs) const { return m_resName == rhs.m_resName; } 29 | 30 | private: 31 | int m_resId; 32 | bool m_display; 33 | bool m_keepGLTest; 34 | QString m_resName; 35 | QString m_resdriver; 36 | QString m_resTitle; 37 | QString m_resDescription; 38 | QString m_prepareScript; 39 | QString m_installScript; 40 | QString m_removeScript; 41 | QString m_conditionScript; 42 | QString m_versionScript; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /server/resolutions.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef RESOLUTIONS_H_ 6 | #define RESOLUTIONS_H_ 7 | 8 | #include "resolution.h" 9 | #include "graphicsdeviceinfo.h" 10 | 11 | #include 12 | #include 13 | 14 | class Resolutions 15 | { 16 | friend class ResolutionsBuilder; 17 | 18 | public: 19 | enum Type 20 | { 21 | NoResolution = 0, 22 | AMD, 23 | NVIDIA, 24 | INTEL, 25 | INTEL_NVIDIA, 26 | INTEL_NVIDIA_USE_INTEL, 27 | INTEL_NVIDIA_USE_NVIDIA 28 | }; 29 | Q_DECLARE_FLAGS(ResolutionsType, Type) 30 | 31 | inline const int type() const { return m_type; } 32 | inline const QString name() const { return m_name; } 33 | inline const QString iconName() const { return m_iconName; } 34 | inline const QString statusScript() const { return m_statusScript; } 35 | QList resolutions() const { return m_resolutions; } 36 | Resolution getResolutionByName(QString name); 37 | private: 38 | explicit Resolutions(); 39 | 40 | private: 41 | ResolutionsType m_type; 42 | QString m_name; 43 | QString m_iconName; 44 | QString m_statusScript; 45 | QList m_resolutions; 46 | }; 47 | 48 | class ResolutionsBuilder 49 | { 50 | public: 51 | explicit ResolutionsBuilder(const GraphicsDeviceInfo &devInfo); 52 | 53 | ResolutionsBuilder config(const QString &config); 54 | Resolutions build(); 55 | 56 | private: 57 | QString m_config; 58 | GraphicsDeviceInfo m_devInfo; 59 | }; 60 | 61 | #endif -------------------------------------------------------------------------------- /server/resources/config/resolutions/resolutions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "none" 4 | }, 5 | 6 | { 7 | "name": "amd", 8 | "icon_name": "AMD.svg", 9 | "status": "default_stat.sh", 10 | "resolutions": 11 | [ 12 | { 13 | "name": "amdgpu", 14 | "driver": "amdgpu", 15 | "title": "Use AMDGPU driver", 16 | "keep_gltest": true, 17 | "description": "For special needs. Auto determine the acceleration way without external configuration.", 18 | "install": "empty.sh", 19 | "remove": "empty.sh" 20 | }, 21 | { 22 | "name": "radeon", 23 | "driver": "radeon", 24 | "title": "Use Radeon driver", 25 | "keep_gltest": true, 26 | "description": "For special needs. Auto determine the acceleration way without external configuration.", 27 | "install": "empty.sh", 28 | "remove": "empty.sh" 29 | } 30 | ] 31 | }, 32 | 33 | { 34 | "name": "nvidia", 35 | "icon_name": "NVIDIA.svg", 36 | "status": "nvidia/status_nvidia.sh", 37 | "resolutions": 38 | [ 39 | { 40 | "name": "nouveau", 41 | "driver": "nouveau", 42 | "title": "Unofficial driver", 43 | "keep_gltest": true, 44 | "description": "Poor performance, unstable in some graphics cards", 45 | "install": "nvidia/install_nouveau.sh", 46 | "remove": "nvidia/remove_nouveau.sh" 47 | }, 48 | { 49 | "name": "nvidia", 50 | "driver": "nvidia", 51 | "title": "Official driver", 52 | "keep_gltest": true, 53 | "description": "Only adaptive to parts of distributions and graphics cards, and it may cause a black screen", 54 | "install": "nvidia/install_nvidia_closesource.sh", 55 | "remove": "nvidia/remove_nvidia_closesource.sh" 56 | } 57 | ] 58 | }, 59 | 60 | { 61 | "name": "intel", 62 | "icon_name": "Intel.svg", 63 | "status": "intel/intel_stat.sh", 64 | "resolutions": 65 | [ 66 | { 67 | "name": "glamor", 68 | "driver": "i915", 69 | "title": "Integrated graphics driver", 70 | "keep_gltest": true, 71 | "description": "Poor compatibility for parts of old graphics cards.", 72 | "install": "intel/install_glamor.sh", 73 | "remove": "intel/remove_glamor.sh" 74 | }, 75 | { 76 | "name": "uxa", 77 | "driver": "i915", 78 | "title": "Integrated graphics driver", 79 | "keep_gltest": true, 80 | "description": "Best compatibility for all Intel graphics cards to accelerate, but performance is relatively weak.", 81 | "install": "intel/install_uxa.sh", 82 | "remove": "intel/remove_uxa.sh" 83 | }, 84 | { 85 | "name": "sna", 86 | "driver": "i915", 87 | "title": "Integrated graphics driver", 88 | "keep_gltest": true, 89 | "description": "Speed up the graphics card with better performance, but unstable in some cards with screen flashing.", 90 | "install": "intel/install_sna.sh", 91 | "remove": "intel/remove_sna.sh" 92 | } 93 | ] 94 | }, 95 | 96 | { 97 | "name": "nvidia_intel", 98 | "icon_name": "Intel-NVIDIA.svg", 99 | "status": "nvidia_intel/status_nvidia_intel.sh", 100 | "resolutions": 101 | [ 102 | { 103 | "name": "bumblebee", 104 | "driver": "nvidia", 105 | "title": "Bumblebee", 106 | "keep_gltest": true, 107 | "description": "Save power to reduce power consumption", 108 | "install": "nvidia_intel/install_nvidia_intel_bumblebee.sh", 109 | "remove": "nvidia_intel/remove_nvidia_intel_bumblebee.sh" 110 | }, 111 | { 112 | "name": "prime", 113 | "driver": "nvidia", 114 | "title": "PRIME", 115 | "keep_gltest": true, 116 | "description": "Best performance, for computers with hybrid graphics", 117 | "install": "nvidia_intel/install_nvidia_intel_prime.sh", 118 | "remove": "nvidia_intel/remove_nvidia_intel_prime.sh" 119 | } 120 | ] 121 | } 122 | ] 123 | -------------------------------------------------------------------------------- /server/resources/service/dgradvrmgr-gltest.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Deepin Graphics Driver Manager - Installer 3 | Wants=network-online.target 4 | After=systemd-user-sessions.service getty@tty1.service plymouth-quit.service network.target network-online.target 5 | Before=lightdm.service 6 | ConditionPathExists=/usr/lib/deepin-graphics-driver-manager/working-dir/dgradvrmgr_gltest_flag 7 | 8 | [Service] 9 | Type=oneshot 10 | Environment=LC_ALL=C 11 | ExecStartPre=-/usr/sbin/overlayroot-chroot rm -f /usr/lib/deepin-graphics-driver-manager/working-dir/dgradvrmgr_gltest_flag 12 | ExecStartPre=-/usr/bin/xset s 0 0 13 | ExecStartPre=-/usr/bin/xset s off 14 | ExecStartPre=-/bin/dmesg --console-off 15 | ExecStartPre=-/bin/plymouth quit 16 | ExecStart=/usr/lib/deepin-graphics-driver-manager/dgradvrmgr-gltest.sh 17 | StandardInput=tty-force 18 | StandardOutput=journal 19 | StandardError=journal 20 | 21 | [Install] 22 | WantedBy=getty.target 23 | -------------------------------------------------------------------------------- /server/scripts/default_stat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | exit 0 5 | -------------------------------------------------------------------------------- /server/scripts/dgradvrmgr-cancel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /usr/lib/deepin-graphics-driver-manager/common.sh 4 | 5 | cleanWorking 6 | 7 | if [[ -n "${isInOverlayRoot}" ]]; then 8 | [ -e "${OVERLAY_LOWDIR}/${INSTALLER_DESKTOP_FILE_DEST}" ] && /usr/sbin/overlayroot-chroot rm -rf $INSTALLER_DESKTOP_FILE_DEST 9 | [ -e "${OVERLAY_LOWDIR}/${TEST_INSTALLER_DESKTOP_FILE_DEST}" ] && /usr/sbin/overlayroot-chroot rm -rf $TEST_INSTALLER_DESKTOP_FILE_DEST 10 | recovery_initramfs 11 | else 12 | [ -e "${INSTALLER_DESKTOP_FILE_DEST}" ] && rm -rf $INSTALLER_DESKTOP_FILE_DEST 13 | [ -e "${TEST_INSTALLER_DESKTOP_FILE_DEST}" ] && rm -rf $TEST_INSTALLER_DESKTOP_FILE_DEST 14 | fi 15 | 16 | exit 0 17 | -------------------------------------------------------------------------------- /server/scripts/dgradvrmgr-gltest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | systemctl stop lightdm 3 | 4 | # run this command again here to avoid disable overlayroot in service not work 5 | 6 | . /usr/lib/deepin-graphics-driver-manager/common.sh 7 | 8 | if [[ -z "${isInOverlayRoot}" ]]; then 9 | error_reboot "Overlayroot failed to mount for the second time" ${OVERLAYROOT_MOUNT_ERROR} 10 | fi 11 | 12 | overlayroot_disable 13 | recovery_initramfs 14 | 15 | 16 | if [[ -e ${PRIME_GLTEST_G} ]]; then 17 | /usr/bin/xinit ${PRIME_GLTEST_G} 18 | else 19 | /usr/bin/xinit /usr/lib/deepin-graphics-driver-manager/gltest 20 | fi 21 | 22 | error_reboot "Gltest running failed" ${GLTEST_RUNNING_ERROR} -------------------------------------------------------------------------------- /server/scripts/dgradvrmgr-prepare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /usr/lib/deepin-graphics-driver-manager/common.sh 4 | 5 | REMOVEOLD=$1 6 | INSTALL=$2 7 | 8 | OLD_DRIVER=$3 9 | NEW_DRIVER=$4 10 | 11 | USER_LANG=$5 12 | EXIT_TEST=$6 13 | 14 | 15 | #check network 16 | check_network || error_exit "The network is not working, please check the network connection" ${NETWORK_CONNECTION_ERROR} 17 | 18 | # prepare working directory 19 | mkdir -p $WORKING_DIR_G || error_exit "mkdir $WORKING_DIR_G failed" ${COMMON_ERROR} 20 | 21 | # copy remove/install scripts to working dir 22 | cp -f $REMOVEOLD $REMOVE_OLD_G || error_exit "copy $REMOVEOLD failed" ${COMMON_ERROR} 23 | 24 | cp -f $INSTALL $INSTALL_NEW_G || error_exit "copy $INSTALL failed" ${COMMON_ERROR} 25 | 26 | chmod +x $REMOVE_OLD_G 27 | chmod +x $INSTALL_NEW_G 28 | 29 | overlayroot_enable || error_exit "overlayroot-enable failed" ${COMMON_ERROR} 30 | 31 | # generate config file 32 | echo "[General] 33 | lang=$USER_LANG 34 | exit_test=$EXIT_TEST 35 | old_driver=$OLD_DRIVER 36 | new_driver=$NEW_DRIVER 37 | gltest-success=false 38 | exit_code=0 39 | notified=false 40 | " | tee $CONFIG_FILE_G 41 | 42 | chmod 666 $CONFIG_FILE_G 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /server/scripts/dgradvrmgr-real-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /usr/lib/deepin-graphics-driver-manager/common.sh 4 | 5 | 6 | #check the network 7 | check_network || error_exit "The network is not working, please check the network connection" ${NETWORK_CONNECTION_ERROR} 8 | 9 | #apt-get update 10 | apt_update || error_exit "Execute apt update failed" ${APT_UPDATE_ERROR} 11 | 12 | #remove/install drivers 13 | $REMOVE_OLD_G || error_exit "Remove old driver failed" ${PURGE_PACKAGE_ERROR} 14 | $INSTALL_NEW_G || error_exit "Install new driver failed" ${INSTALL_PACKAGE_ERROR} 15 | 16 | cleanWorking 17 | 18 | reboot 19 | -------------------------------------------------------------------------------- /server/scripts/dgradvrmgr-test-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /usr/lib/deepin-graphics-driver-manager/common.sh 4 | 5 | if [[ -z "${isInOverlayRoot}" ]]; then 6 | rm -f /etc/xdg/autostart/deepin-gradvrmgr-test-installer.desktop 7 | cp ${INSTALLER_DESKTOP_FILE_SOURCE} ${INSTALLER_DESKTOP_FILE_DEST} || error_reboot "Copy ${INSTALLER_DESKTOP_FILE_SOURCE} to ${INSTALLER_DESKTOP_FILE_DEST} failed" ${COMMON_ERROR} 8 | error_reboot "Overlayroot failed to mount for the first time" ${OVERLAYROOT_MOUNT_ERROR} 9 | fi 10 | 11 | # boot分区不被overlayroot保护,需要单独备份 12 | backup_initramfs 13 | 14 | /usr/sbin/overlayroot-chroot rm -f /etc/xdg/autostart/deepin-gradvrmgr-test-installer.desktop 15 | /usr/sbin/overlayroot-chroot cp ${INSTALLER_DESKTOP_FILE_SOURCE} ${INSTALLER_DESKTOP_FILE_DEST} || error_reboot "Overlay-chroot copy ${INSTALLER_DESKTOP_FILE_SOURCE} to ${INSTALLER_DESKTOP_FILE_DEST} failed" ${COMMON_ERROR} 16 | 17 | # 测试安装时,最小化窗口后,启动器点击无界面弹出问题 18 | cp -f ${TEST_INSTALLER_DESKTOP_FILE_SOURCE} /usr/share/applications/deepin-graphics-driver-manager.desktop 19 | 20 | #check network 21 | check_network || error_reboot "The network is not working, please check the network connection" ${NETWORK_CONNECTION_ERROR} 22 | 23 | #apt-get update 24 | apt_update || error_reboot "Execute apt update failed" ${APT_UPDATE_ERROR} 25 | 26 | #remove old driver 27 | $REMOVE_OLD_G 28 | if [ $? != 0 ]; then 29 | recovery_initramfs 30 | error_reboot "Remove old driver failed" ${PURGE_PACKAGE_ERROR} 31 | fi 32 | 33 | #install old driver 34 | $INSTALL_NEW_G 35 | if [ $? != 0 ]; then 36 | recovery_initramfs 37 | error_reboot "Install new driver failed" ${INSTALL_PACKAGE_ERROR} 38 | fi 39 | 40 | /usr/sbin/overlayroot-chroot touch ${GLTEST_FLAG} || error_reboot "Overlay-chroot touch ${GLTEST_FLAG} failed" ${COMMON_ERROR} 41 | 42 | #save the upperdir 43 | overlayroot_save || error_reboot "Overlayroot save failed" ${OVERLAYROOT_SAVE_ERROR} 44 | 45 | overlayroot-chroot sed -i "s:overlayroot=".*":overlayroot=\"device\:dev=\/dev\/loop0,recurse=0\":" ${OVERLAYROOT_CONF} 46 | 47 | # 判断前前台进程是否还存在(防止被强行退出) 48 | killall -e -0 test-installer 49 | if [ $? -ne 0 ]; then 50 | reboot 51 | fi 52 | 53 | exit 0 54 | -------------------------------------------------------------------------------- /server/scripts/empty.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "" 4 | -------------------------------------------------------------------------------- /server/scripts/gltest-set-success.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . /usr/lib/deepin-graphics-driver-manager/common.sh 4 | 5 | modify_config "gltest-success" "true" 6 | -------------------------------------------------------------------------------- /server/scripts/intel/install_glamor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/lib/deepin-graphics-driver-manager/intel/install_intel_opensource.sh 0 4 | -------------------------------------------------------------------------------- /server/scripts/intel/install_intel_opensource.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(id -u)" -ne "0" ];then 4 | echo "Need root privileges." 5 | exit 1 6 | fi 7 | 8 | . /usr/lib/deepin-graphics-driver-manager/common.sh 9 | 10 | # 0 ------ default is glamor 11 | # 1 ------ use SNA accel method 12 | # 2 ------ use UXA accel method 13 | 14 | export INTEL_XORG_CONF="/etc/X11/xorg.conf.d/20-intel.conf" 15 | 16 | set_intel_accel_sna() { 17 | echo 'Section "Device" 18 | Identifier "Intel Graphics" 19 | Driver "intel" 20 | Option "AccelMethod" "sna" 21 | #Option "PageFlip" "False" 22 | #Option "TearFree" "True" 23 | EndSection' | tee $INTEL_XORG_CONF 24 | } 25 | 26 | set_intel_accel_uxa() { 27 | echo 'Section "Device" 28 | Identifier "Intel Graphics" 29 | Driver "intel" 30 | Option "AccelMethod" "uxa" 31 | #Option "PageFlip" "False" 32 | #Option "TearFree" "True" 33 | EndSection' | tee $INTEL_XORG_CONF 34 | } 35 | 36 | packages=( 37 | "xserver-xorg-core" 38 | "xserver-xorg-input-all" 39 | "xserver-xorg-video-intel" 40 | ) 41 | 42 | package_install "${packages[*]}" "${#packages[*]}" 43 | 44 | #根据需求调整显卡的加速方式,从而达到最优化 45 | case $1 in 46 | 0) 47 | # it is glamor mode after config files and drivers of other modes has been removed 48 | echo "Using default glamor accel method overlay" 49 | ;; 50 | 1) 51 | set_intel_accel_uxa 52 | ;; 53 | 2) 54 | set_intel_accel_sna 55 | ;; 56 | *) 57 | rm /etc/X11/xorg.conf.d/20-intel.conf 58 | [ -f /etc/X11/xorg.conf ] && rm /etc/X11/xorg.conf 59 | echo "You need to set an accel method,default glamor (overlay)" 60 | ;; 61 | esac 62 | -------------------------------------------------------------------------------- /server/scripts/intel/install_sna.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/lib/deepin-graphics-driver-manager/intel/install_intel_opensource.sh 2 4 | -------------------------------------------------------------------------------- /server/scripts/intel/install_uxa.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/lib/deepin-graphics-driver-manager/intel/install_intel_opensource.sh 1 4 | -------------------------------------------------------------------------------- /server/scripts/intel/intel_stat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 0 ------ default is glamor 4 | # 1 ------ use SNA accel method 5 | # 2 ------ use UXA accel method 6 | 7 | intel_accel_method_sna=`cat /var/log/Xorg.0.log | grep SNA` 8 | intel_accel_method_uxa=`cat /var/log/Xorg.0.log | grep UXA` 9 | 10 | if [ -n "$intel_accel_method_sna" ];then 11 | echo "now intel accel mode is : SNA" 12 | exit 2 13 | elif [ -n "$intel_accel_method_uxa" ];then 14 | echo "now intel accel mode is : UXA" 15 | exit 1 16 | else 17 | echo "now intel accel mode is : glamor(default)" 18 | exit 0 19 | fi 20 | -------------------------------------------------------------------------------- /server/scripts/intel/remove_glamor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/lib/deepin-graphics-driver-manager/intel/remove_intel_opensource.sh 0 4 | -------------------------------------------------------------------------------- /server/scripts/intel/remove_intel_opensource.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(id -u)" -ne "0" ];then 4 | echo "Need root privileges." 5 | exit 1 6 | fi 7 | 8 | . /usr/lib/deepin-graphics-driver-manager/common.sh 9 | 10 | 11 | # 0 ------ default is glamor 12 | # 1 ------ use SNA accel method 13 | # 2 ------ use UXA accel method 14 | 15 | 16 | packages=( 17 | "xserver-xorg-video-intel" 18 | ) 19 | 20 | remove_config_driver_overlay() { 21 | rm /etc/X11/xorg.conf.d/20-intel.conf 22 | package_remove "${packages[*]}" "${#packages[*]}" 23 | } 24 | 25 | case $1 in 26 | 0) 27 | echo "Nothing to remove..." 28 | ;; 29 | 1|2) 30 | remove_config_driver_overlay 31 | ;; 32 | *) 33 | echo "You need to set an accel method to remove, do nothing..." 34 | ;; 35 | esac 36 | -------------------------------------------------------------------------------- /server/scripts/intel/remove_sna.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/lib/deepin-graphics-driver-manager/intel/remove_intel_opensource.sh 2 4 | -------------------------------------------------------------------------------- /server/scripts/intel/remove_uxa.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/lib/deepin-graphics-driver-manager/intel/remove_intel_opensource.sh 1 4 | -------------------------------------------------------------------------------- /server/scripts/nvidia/install_nouveau.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(id -u)" -ne "0" ];then 4 | echo "Need root privileges." 5 | exit 1 6 | fi 7 | 8 | . /usr/lib/deepin-graphics-driver-manager/common.sh 9 | 10 | packages=( 11 | "xserver-xorg-input-all" 12 | "xserver-xorg-core" 13 | "xserver-xorg-video-nouveau" 14 | "nvidia-installer-cleanup" 15 | "update-glx" 16 | "glx-alternative-mesa" 17 | "libgl1-mesa-glx" 18 | "libgl1-mesa-glx:i386" 19 | "libglx-mesa0" 20 | "libglx-mesa0:i386" 21 | "glx-diversions" 22 | ) 23 | 24 | package_install "${packages[*]}" "${#packages[*]}" 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /server/scripts/nvidia/install_nvidia_closesource.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(id -u)" -ne "0" ];then 4 | echo "Need root privileges." 5 | exit 1 6 | fi 7 | 8 | . /usr/lib/deepin-graphics-driver-manager/common.sh 9 | 10 | remove_nvidia 11 | 12 | packages=( 13 | "nvidia-driver" 14 | "xserver-xorg-core" 15 | "xserver-xorg-input-all" 16 | ) 17 | 18 | package_install "${packages[*]}" "${#packages[*]}" 19 | 20 | modinfo intelgpu >/dev/null 2>&1 21 | if [[ $? -eq 0 ]]; then 22 | echo "blacklist intelgpu" >> /etc/modprobe.d/nvidia-blacklists-nouveau.conf 23 | update-initramfs -u 24 | fi 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /server/scripts/nvidia/remove_nouveau.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(id -u)" -ne "0" ];then 4 | echo "Need root privileges." 5 | exit 1 6 | fi 7 | 8 | . /usr/lib/deepin-graphics-driver-manager/common.sh 9 | 10 | packages=( 11 | "xserver-xorg-video-nouveau" 12 | ) 13 | 14 | package_remove "${packages[*]}" "${#packages[*]}" 15 | 16 | -------------------------------------------------------------------------------- /server/scripts/nvidia/remove_nvidia_closesource.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(id -u)" -ne "0" ];then 4 | echo "Need root privileges." 5 | exit 1 6 | fi 7 | 8 | . /usr/lib/deepin-graphics-driver-manager/common.sh 9 | 10 | packages=( 11 | "glx-alternative-nvidia" 12 | "nvidia-alternative" 13 | ) 14 | 15 | package_remove "${packages[*]}" "${#packages[*]}" 16 | 17 | remove_nvidia 18 | 19 | exit 0 20 | -------------------------------------------------------------------------------- /server/scripts/nvidia/status_nvidia.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # exit 0 ------ use open nouveau driver 4 | # exit 1 ------ use private nvidia driver 5 | 6 | nouveau_mod=`lsmod | grep nouveau` 7 | nvidia_mod=`lsmod | grep nvidia` 8 | 9 | if [ -n "$nouveau_mod" ]; then 10 | echo "Had already used opensource nouveau driver" 11 | exit 0 12 | fi 13 | 14 | 15 | if [ -n "$nvidia_mod" ]; then 16 | echo "Had already used private nvidia driver " 17 | exit 1 18 | fi 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /server/scripts/nvidia_intel/install_nvidia_intel_bumblebee.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(id -u)" -ne "0" ];then 4 | echo "Need root privileges." 5 | exit 1 6 | fi 7 | 8 | . /usr/lib/deepin-graphics-driver-manager/common.sh 9 | 10 | remove_nvidia 11 | 12 | packages=( 13 | "nvidia-driver" 14 | "bumblebee-nvidia" 15 | "primus" 16 | "primus-libs" 17 | ) 18 | 19 | package_install "${packages[*]}" "${#packages[*]}" 20 | 21 | modinfo intelgpu >/dev/null 2>&1 22 | if [[ $? -eq 0 ]]; then 23 | echo "blacklist intelgpu" >> /etc/modprobe.d/nvidia-blacklists-nouveau.conf 24 | update-initramfs -u 25 | fi 26 | 27 | 28 | systemctl enable bumblebeed.service -------------------------------------------------------------------------------- /server/scripts/nvidia_intel/install_nvidia_intel_prime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /usr/lib/deepin-graphics-driver-manager/nvidia/install_nvidia_closesource.sh || exit 1 4 | 5 | modinfo intelgpu >/dev/null 2>&1 6 | if [[ $? -eq 0 ]]; then 7 | echo "blacklist intelgpu" >> /etc/modprobe.d/nvidia-blacklists-nouveau.conf 8 | update-initramfs -u 9 | fi 10 | 11 | cat > /etc/X11/xorg.conf.d/70-nvidia.conf < /etc/lightdm/display_setup.sh < ${PRIME_GLTEST_G} </dev/null | grep "Status: install ok installed"` 10 | #prime_exist=`dpkg -s deepin-nvidia-prime 2>/dev/null | grep "Status: install ok installed"` 11 | intel_accel_method_sna=`cat /var/log/Xorg.0.log | grep SNA` 12 | intel_accel_method_uxa=`cat /var/log/Xorg.0.log | grep UXA` 13 | 14 | if [ -f "/etc/X11/xorg.conf.d/70-nvidia.conf" ]; then 15 | echo "Prime Mode" 16 | exit 4 17 | elif [ -n "$bumblebee_exist" ]; then 18 | echo "Bumblebee Mode" 19 | exit 3 20 | elif [ -n "$intel_accel_method_sna" ];then 21 | echo "Intel Sna Accel Mode" 22 | exit 2 23 | elif [ -n "$intel_accel_method_uxa" ];then 24 | echo "Intel Uxa Accel Mode" 25 | exit 1 26 | else 27 | echo "Intel Glamor Accel Mode" 28 | exit 0 29 | fi -------------------------------------------------------------------------------- /server/scripts/tools/overlayroot-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -z "$1" ]; then 3 | echo "A parameter is required.(eg: enable|disable|save)" 4 | exit 0 5 | fi 6 | . /usr/lib/deepin-graphics-driver-manager/common.sh 7 | case $1 in 8 | "enable") 9 | overlayroot_enable 10 | ;; 11 | "disable") 12 | overlayroot_disable 13 | ;; 14 | "save") 15 | overlayroot_save 16 | ;; 17 | *) 18 | echo "paramers error!!!" 19 | exit 1 20 | ;; 21 | esac 22 | 23 | exit 0 -------------------------------------------------------------------------------- /test_installer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(BIN_NAME test-installer) 3 | 4 | if (CMAKE_BUILD_TYPE MATCHES Debug) 5 | add_definitions("-DTRANSLATIONS_DIR=\"${CMAKE_BINARY_DIR}/translations/\"") 6 | add_definitions("-DRESOURCES_DIR=\"${CMAKE_SOURCE_DIR}/test-installer/resources\"") 7 | else() 8 | add_definitions("-DTRANSLATIONS_DIR=\"${CMAKE_INSTALL_PREFIX}/share/deepin-graphics-driver-manager/translations/\"") 9 | add_definitions("-DRESOURCES_DIR=\"${CMAKE_INSTALL_PREFIX}/share/deepin-graphics-driver-manager/test-installer/\"") 10 | endif() 11 | 12 | 13 | find_package(PkgConfig REQUIRED) 14 | find_package(Qt5Widgets REQUIRED) 15 | find_package(Qt5DBus REQUIRED) 16 | find_package(DtkCMake REQUIRED) 17 | find_package(DtkWidget REQUIRED) 18 | 19 | 20 | file(GLOB SRCS "*.h" "*.cpp") 21 | 22 | include_directories(${CMAKE_SOURCE_DIR}/utils/) 23 | add_executable(${BIN_NAME} ${SRCS} ${UTILS_FILES} resources.qrc) 24 | 25 | target_include_directories(${BIN_NAME} PUBLIC 26 | ${DtkWidget_INCLUDE_DIRS} 27 | ${Qt5DBus_INCLUDE_DIRS}) 28 | 29 | target_link_libraries(${BIN_NAME} 30 | ${Qt5DBus_LIBRARIES} 31 | ${Qt5Widgets_LIBRARIES} 32 | ${DtkWidget_LIBRARIES} 33 | ) 34 | 35 | install(TARGETS ${BIN_NAME} DESTINATION lib/deepin-graphics-driver-manager) 36 | install(FILES deepin-gradvrmgr-test-installer.desktop DESTINATION lib/deepin-graphics-driver-manager) 37 | 38 | 39 | -------------------------------------------------------------------------------- /test_installer/closeButton.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "closeButton.h" 6 | 7 | #include 8 | 9 | 10 | CloseButton::CloseButton(QWidget *parent) : 11 | QWidget(parent) 12 | { 13 | 14 | setObjectName("closeButton"); 15 | m_label = new QLabel; 16 | m_label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); 17 | m_label->setText("×"); 18 | m_label->setObjectName("label"); 19 | 20 | m_mainWidget = new QWidget; 21 | auto *mainLayout = new QVBoxLayout; 22 | m_mainWidget->setObjectName("mainWidget"); 23 | m_mainWidget->setLayout(mainLayout); 24 | mainLayout->addWidget(m_label); 25 | mainLayout->setAlignment(m_label, Qt::AlignHCenter); 26 | 27 | 28 | auto *centralLayout = new QVBoxLayout; 29 | centralLayout->addWidget(m_mainWidget); 30 | centralLayout->setContentsMargins(0, 0, 0, 0); 31 | this->setLayout(centralLayout); 32 | 33 | onThemeChanged(Dtk::Gui::DGuiApplicationHelper::instance()->themeType()); 34 | connect(Dtk::Gui::DGuiApplicationHelper::instance(), &Dtk::Gui::DGuiApplicationHelper::themeTypeChanged, this, &CloseButton::onThemeChanged); 35 | } 36 | 37 | CloseButton::~CloseButton() 38 | { 39 | 40 | } 41 | 42 | void CloseButton::mousePressEvent(QMouseEvent *event) 43 | { 44 | Q_EMIT clicked(); 45 | } 46 | 47 | void CloseButton::onThemeChanged(Dtk::Gui::DGuiApplicationHelper::ColorType type) 48 | { 49 | if (type == Dtk::Gui::DGuiApplicationHelper::ColorType::LightType) { 50 | 51 | m_mainWidget->setStyleSheet("QWidget#mainWidget{" 52 | "background-color: rgba(255, 255, 255, 0.8);" 53 | "}""QWidget#mainWidget:hover{background-color: rgba(255, 255, 255, 0.01)}"); 54 | 55 | m_label->setStyleSheet("QLabel {" 56 | "font-size: 18px;" 57 | "font-weight: 100;" 58 | "color: #626e88;" 59 | "}""QLabel#label:disabled{color: #aaa5a5}"); 60 | 61 | 62 | } else if (type == Dtk::Gui::DGuiApplicationHelper::ColorType::DarkType) { 63 | 64 | m_mainWidget->setStyleSheet("QWidget#mainWidget{" 65 | "background-color: rgba(100, 100, 100, 0.05);" 66 | "}""QWidget#mainWidget:hover{background-color: rgba(100, 100, 100, 0.2)}"); 67 | 68 | m_label->setStyleSheet("QLabel {" 69 | "font-size: 18px;" 70 | "font-weight: 100;" 71 | "color: #c0c6d4;" 72 | "}""QLabel#label:disabled{color: #454343}"); 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /test_installer/closeButton.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef DEEPIN_GRAPHICS_DRIVER_MANAGER_CLOSEBUTTON_H 6 | #define DEEPIN_GRAPHICS_DRIVER_MANAGER_CLOSEBUTTON_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | class CloseButton : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit CloseButton(QWidget *parent = nullptr); 18 | 19 | ~CloseButton() override; 20 | Q_SIGNALS: 21 | void clicked(); 22 | 23 | protected: 24 | virtual void mousePressEvent(QMouseEvent *event); 25 | virtual void onThemeChanged(Dtk::Gui::DGuiApplicationHelper::ColorType type); 26 | 27 | private: 28 | QLabel *m_label = nullptr; 29 | bool m_enable = true; 30 | QWidget *m_mainWidget = nullptr; 31 | }; 32 | 33 | #endif //DEEPIN_GRAPHICS_DRIVER_MANAGER_CLOSEBUTTON_H 34 | -------------------------------------------------------------------------------- /test_installer/deepin-gradvrmgr-test-installer.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=System; 3 | Comment=Deepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool. 4 | Exec=/usr/lib/deepin-graphics-driver-manager/test-installer 5 | GenericName=Graphics Driver Manager 6 | Icon=deepin-graphics-driver-manager 7 | Name=Deepin Graphics Driver Manager 8 | StartupNotify=true 9 | Terminal=false 10 | Type=Application 11 | X-Deepin-Vendor=deepin 12 | 13 | # Translations: 14 | # Do not manually modify! 15 | 16 | GenericName[ar]=مدير تعريف الرسوميات 17 | GenericName[ast]=Xestor de controladores gráficos 18 | GenericName[az]=Qrafik Sürücü İdarəetməsi 19 | GenericName[bg]=Диспечер на графичен драйвер 20 | GenericName[bo]=མངོན་ཁཱའི་སྐུལ་འདེད་དོ་དམ་ཆས། 21 | GenericName[ca]=Gestor de controladors gràfics 22 | GenericName[cs]=Správa ovladačů grafických čipů 23 | GenericName[da]=Grafikdriver-håndtering 24 | GenericName[de]=Grafiktreiberverwaltung 25 | GenericName[es]=Gestor de controladores gráficos 26 | GenericName[es_419]=Gestor de controladores gráficos 27 | GenericName[et]=Videokaardi draiverite haldamine 28 | GenericName[fa]=مدیر درایور گرافیک 29 | GenericName[fi]=Grafiikkaohjaimet 30 | GenericName[fr]=Gestionnaire de pilotes graphiques 31 | GenericName[gl_ES]=Xestor de Controladores Gráficos 32 | GenericName[hr]=Upravitelj grafičkim upravljačkim programom 33 | GenericName[hu]=Grafikus Illesztőprogram Kezelő 34 | GenericName[id]=Manajer Driver Grafis 35 | GenericName[it]=Gestore driver grafici 36 | GenericName[ko]=그래픽 드라이버 관리도구 37 | GenericName[lt]=Grafikos tvarkyklių tvarkytuvė 38 | GenericName[ms]=Pengurus Pemacu Grafik 39 | GenericName[ne]=ग्राफिक्स ड्राइभर प्रबन्धक 40 | GenericName[nl]=Grafisch Stuurprogrammabeheer 41 | GenericName[pl]=Zarządzanie sterownikami graficznymi 42 | GenericName[pt]=Gestor de Controlador Gráfico 43 | GenericName[pt_BR]=Gerenciador de Drivers Gráficos 44 | GenericName[ro]=Manager Driver Video 45 | GenericName[ru]=Менеджер Графических Драйверов 46 | GenericName[sk]=Manažér grafického ovládača 47 | GenericName[sl]=Upravitelj grafičnih gonilnikov 48 | GenericName[sq]=Përgjegjës Përudhësish Grafikë 49 | GenericName[sr]=Управник Графичких Управљача 50 | GenericName[tr]=Görüntü Aygıtı Sürücüsü Yöneticisi 51 | GenericName[ug]=گىرافىك قوزغاتقۇچ باشقۇرغۇچى 52 | GenericName[uk]=Керування драйверами графіки 53 | GenericName[zh_CN]=显卡驱动管理器 54 | GenericName[zh_HK]=顯卡驅動管理器 55 | GenericName[zh_TW]=顯示卡管理器 56 | Name[ar]=مدير تعريف رسوميات ديبن 57 | Name[ast]=Deepin Graphics Driver Manager 58 | Name[az]=Deepin Qrafik Sürücü İdarəetməsi 59 | Name[bg]=Deepin диспечер на графичен драйвер 60 | Name[bo]=གཏིང་ཚད་མངོན་ཁཱ་སྐུལ་འདེད་དོ་དམ་ཆས། 61 | Name[ca]=Gestor de controladors gràfics del Deepin 62 | Name[cs]=Správa ovladačů grafických čipů v Deepin 63 | Name[da]=Deepin grafikdriver-håndtering 64 | Name[de]=Deepin Grafiktreiberverwaltung 65 | Name[es]=Gestor de controladores gráficos Deepin 66 | Name[es_419]=Gestor de controladores gráficos Deepin 67 | Name[fa]=مدیر درایور گرافیک دیپین 68 | Name[fi]=Deepin grafiikkaohjaimen hallinta 69 | Name[fr]=Gestionnaire de pilotes graphiques Deepin 70 | Name[gl_ES]=Xestor de Controladores Gráficos do Deepin 71 | Name[hr]=Deepin upravitelj grafičkim upravljačkim programom 72 | Name[hu]=Deepin® Grafikus Illesztőprogram Kezelő 73 | Name[id]=Manajer Driver Graphis Deepin 74 | Name[it]=Gestore driver grafici di Deepin 75 | Name[ko]=Deepin 그래픽 드라이버 관리도구 76 | Name[lt]=Deepin grafikos tvarkyklių tvarkytuvė 77 | Name[ms]=Pengurus Pemacu Grafik Deepin 78 | Name[ne]=डिपिन ग्राफिक्स ड्राइभर प्रबन्धक 79 | Name[nl]=Deepin Grafisch Stuurprogrammabeheer 80 | Name[pl]=Zarządzanie sterownikami graficznymi Deepin 81 | Name[pt]=Gestor de Controlador Gráfico Deepin 82 | Name[pt_BR]=deepin Gerenciador de Drivers Gráficos 83 | Name[ro]=Manager Driver Video Deepin 84 | Name[ru]=Менеджер Графических Драйверов Deepin 85 | Name[sk]=Deepin Manažér grafického ovládača 86 | Name[sl]=Deepin upravitelj grafičnih gonilnikov 87 | Name[sq]=Përgjegjës Deepin Përudhësish Grafikë 88 | Name[sr]=Управник Графичких Управљача 89 | Name[tr]=Deepin Görüntü Aygıtı Sürücüsü Yöneticisi 90 | Name[ug]=Deepin گىرافىك قوزغاتقۇچ باشقۇرغۇچى 91 | Name[uk]=Керування драйверами графіки Deepin 92 | Name[zh_CN]=深度显卡驱动管理器 93 | Name[zh_HK]=Deepin 顯卡驅動管理器 94 | Name[zh_TW]=Deepin 顯示卡管理器 95 | -------------------------------------------------------------------------------- /test_installer/main.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "mainwindow.h" 6 | //#include "../utils/environments.h" 7 | #include "environments.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | DCORE_USE_NAMESPACE 16 | 17 | QString getUserName() 18 | { 19 | QString userPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); 20 | return userPath.section("/", -1, -1); 21 | } 22 | 23 | int main(int argc, char* argv[]) 24 | { 25 | DApplication app(argc, argv); 26 | app.loadTranslator(); 27 | QString loc = QLocale::system().name(); 28 | 29 | QString loc_tr_file = QString(TRANSLATIONS_DIR"/deepin-graphics-driver-manager_%1.qm"); 30 | 31 | QTranslator trans; 32 | trans.load(loc_tr_file.arg(loc)); 33 | app.installTranslator(&trans); 34 | 35 | app.setAttribute(Qt::AA_UseHighDpiPixmaps); 36 | app.setAttribute(Qt::AA_EnableHighDpiScaling); 37 | app.setOrganizationName("deepin"); 38 | app.setApplicationName("dgradvrmgr"); 39 | app.setApplicationVersion(VERSION); 40 | app.setApplicationAcknowledgementPage("https://www.deepin.org/acknowledgments/deepin-graphics-driver-manager/"); 41 | app.setProductIcon(QIcon(":/resources/icons/deepin-graphics-driver-manager-64px.svg")); 42 | app.setProductName(QApplication::translate("main", "Graphics Driver Manager")); 43 | app.setAutoActivateWindows(true); 44 | app.setApplicationDescription(QApplication::translate("main", "Graphics Driver Manager is a compact and easy to use graphics driver management tool. It includes graphics card hardware detection, graphics driver installation, graphics driver solution switching, graphics driver automatic recovery and other functions.")); 45 | DApplicationSettings as; 46 | 47 | if (!app.setSingleInstance("dgradvrmgr")) 48 | return -1; 49 | //设置日志 50 | const QString logFormat = "%{time}{yyyyMMdd.HH:mm:ss.zzz}[%{type:1}][%{function:-40} %{line:-4} %{threadid:-8} ] %{message}\n"; 51 | 52 | QString log_file(QString("/home/%1/.cache/deepin/deepin-graphics-driver-manager/").arg(getUserName())); 53 | QDir dir(log_file); 54 | if (!dir.exists()) { 55 | dir.mkpath(log_file); 56 | } 57 | log_file += "test-installer.log"; 58 | ConsoleAppender *consoleAppender = new ConsoleAppender; 59 | consoleAppender->setFormat(logFormat); 60 | RollingFileAppender *rollingFileAppender = new RollingFileAppender(log_file); 61 | rollingFileAppender->setFormat(logFormat); 62 | rollingFileAppender->setLogFilesLimit(5); 63 | rollingFileAppender->setDatePattern(RollingFileAppender::DailyRollover); 64 | 65 | logger->registerAppender(consoleAppender); 66 | logger->registerAppender(rollingFileAppender); 67 | MainWindow w; 68 | w.show(); 69 | 70 | return app.exec(); 71 | } 72 | -------------------------------------------------------------------------------- /test_installer/mainwindow.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef MAINWINDOW_H 6 | #define MAINWINDOW_H 7 | 8 | #include "graphicsdriverproxy.h" 9 | #include "closeButton.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | 24 | DWIDGET_USE_NAMESPACE 25 | 26 | class QLabel; 27 | class MainWindow : public DMainWindow 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit MainWindow(QWidget *parent = nullptr); 32 | ~MainWindow() override; 33 | private: 34 | void closeEvent(QCloseEvent *event) override; 35 | void updateProgress(); 36 | void updateInstallState(bool success); 37 | void reboot(); 38 | private Q_SLOTS: 39 | void onCancelBtnClicked(); 40 | void onInstall(); 41 | void onThemeChanged(DGuiApplicationHelper::ColorType type); 42 | 43 | private: 44 | QWidget *m_centerWidget; 45 | QLabel *m_installStateIcon; 46 | QLabel *m_installState; 47 | QLabel *m_warningTips; 48 | DWaterProgress *m_waterProgress; 49 | QPushButton *m_cancelButton; 50 | DSuggestButton *m_rebootButton; 51 | QTimer m_timer; 52 | int m_rebootDelay; 53 | int m_process; 54 | CloseButton *m_closeButton; 55 | ComDeepinDaemonGraphicsDriverInterface *m_graphicsDriver = nullptr; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /test_installer/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | resources/icons/AMD.svg 4 | resources/icons/Intel-NVIDIA.svg 5 | resources/icons/Intel.svg 6 | resources/icons/NVIDIA.svg 7 | resources/icons/success.svg 8 | resources/icons/select.svg 9 | resources/icons/select_dark.svg 10 | resources/icons/fail.svg 11 | resources/icons/close_normal.svg 12 | resources/icons/deepin-graphics-driver-manager-64px.svg 13 | resources/theme/light/light.qss 14 | resources/theme/dark/dark.qss 15 | 16 | 17 | -------------------------------------------------------------------------------- /test_installer/resources/icons/AMD.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AMD 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test_installer/resources/icons/NVIDIA.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NVIDIA 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test_installer/resources/icons/close_normal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | titlebutton/close_normal 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test_installer/resources/icons/fail.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon/fail 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test_installer/resources/icons/select.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | select 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test_installer/resources/icons/select_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | select_dark 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test_installer/resources/icons/success.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon/success 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test_installer/resources/theme/dark/dark.qss: -------------------------------------------------------------------------------- 1 | QLabel #TopTips { 2 | font-size: 16pt; 3 | } 4 | 5 | QLabel #BottomTips { 6 | margin-top: 35px; 7 | } 8 | 9 | QWidget #ResolutionsWidget { 10 | background-color: #242424; 11 | border: 1px solid #2D2D2D; 12 | border-radius: 3px; 13 | } 14 | -------------------------------------------------------------------------------- /test_installer/resources/theme/light/light.qss: -------------------------------------------------------------------------------- 1 | QLabel #TopTips { 2 | font-size: 16pt; 3 | } 4 | 5 | QLabel #BottomTips { 6 | margin-top: 35px; 7 | } 8 | 9 | QWidget #ResolutionsWidget { 10 | border: 1px solid #eee; 11 | border-radius: 3px; 12 | } 13 | -------------------------------------------------------------------------------- /translations/desktop/desktop.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin Graphics Driver ManagerDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Graphics Driver ManagerGraphics Driver Manager -------------------------------------------------------------------------------- /translations/desktop/desktop_ar.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver Managerمدير تعريف رسوميات ديبنDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.مدير تعريف رسوميات ديبن هى أداة مدمجة و سهلة الإستخدام لإدارة تعريف الرسومات.Graphics Driver Managerمدير تعريف الرسوميات -------------------------------------------------------------------------------- /translations/desktop/desktop_ast.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin Graphics Driver ManagerDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin Graphics Driver Manager ye una ferramienta de xestión de controladores gráficos cenciella d'uasr y compautaGraphics Driver ManagerXestor de controladores gráficos -------------------------------------------------------------------------------- /translations/desktop/desktop_az.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin Qrafik Sürücü İdarəetməsiDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin Qrafik Sürücü İdarəetməsi qrafik sürücüləri idarə etmək üçün yığcam və rahat alətdir.Graphics Driver ManagerQrafik Sürücü İdarəetməsi -------------------------------------------------------------------------------- /translations/desktop/desktop_bg.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin диспечер на графичен драйверDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin диспечер на графичен драйвер е компактен и лесен за използване инструмент за управление на графични драйвери.Graphics Driver ManagerДиспечер на графичен драйвер -------------------------------------------------------------------------------- /translations/desktop/desktop_bo.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver Managerགཏིང་ཚད་མངོན་ཁཱ་སྐུལ་འདེད་དོ་དམ་ཆས།Deepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.གཏིང་ཚད་མངོན་ཁཱ་སྐུལ་འདེད་དོ་དམ་ཆས་ནི་སྟབས་བདེ་ཞིང་སྤྱོད་བདེ་བའི་མངོན་ཁཱའི་སྐུལ་འདེད་དོ་དམ་ཡོ་བྱད་ཅིག་ཡིན།Graphics Driver Managerམངོན་ཁཱའི་སྐུལ་འདེད་དོ་དམ་ཆས། -------------------------------------------------------------------------------- /translations/desktop/desktop_ca.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerGestor de controladors gràfics del DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.El Gestor de controladors gràfics del Deepin és una eina de gestió de controladors gràfics compacta i fàcil d'usar.Graphics Driver ManagerGestor de controladors gràfics -------------------------------------------------------------------------------- /translations/desktop/desktop_cs.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerSpráva ovladačů grafických čipů v DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Správa ovladačů grafických čipů je kompaktní a snadno použitelný nástroj pro správu ovladačů grafického hardware.Graphics Driver ManagerSpráva ovladačů grafických čipů -------------------------------------------------------------------------------- /translations/desktop/desktop_da.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin grafikdriver-håndteringDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin grafikdriver-håndtering er et kompakt og letanvendeligt grafikdriver-håndteringsværktøj.Graphics Driver ManagerGrafikdriver-håndtering -------------------------------------------------------------------------------- /translations/desktop/desktop_de.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin GrafiktreiberverwaltungDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Die Deepin Grafiktreiberverwaltung hilft, um sehr einfach die Grafiktreiber zu konfigurieren.Graphics Driver ManagerGrafiktreiberverwaltung -------------------------------------------------------------------------------- /translations/desktop/desktop_es.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerGestor de controladores gráficos DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Gestor de controladores gráficos Deepin es un compacta e intuitiva herramienta para gestionar controladores gráficos.Graphics Driver ManagerGestor de controladores gráficos -------------------------------------------------------------------------------- /translations/desktop/desktop_es_419.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerGestor de controladores gráficos DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Gestor de controladores gráficos Deepin es una herramienta de gestión de controladores de gráficos compacta y fácil de usar.Graphics Driver ManagerGestor de controladores gráficos -------------------------------------------------------------------------------- /translations/desktop/desktop_et.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Graphics Driver ManagerVideokaardi draiverite haldamine -------------------------------------------------------------------------------- /translations/desktop/desktop_fa.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver Managerمدیر درایور گرافیک دیپینDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.مدیر درایور گرافیک دیپین ابزاری برای مدیریت درایور گرافیکی به صورت جمع وجور و آسان برای استفاده است.Graphics Driver Managerمدیر درایور گرافیک -------------------------------------------------------------------------------- /translations/desktop/desktop_fi.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin grafiikkaohjaimen hallintaDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin grafiikkaohjaimen hallinta on pienikokoinen ja helppokäyttöinen näytönohjaimien hallintatyökalu.Graphics Driver ManagerGrafiikkaohjaimet -------------------------------------------------------------------------------- /translations/desktop/desktop_fr.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerGestionnaire de pilotes graphiques DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Gestionnaire de pilotes graphiques Deepin est un outil de gestion des pilotes graphiques léger et facile à utiliser.Graphics Driver ManagerGestionnaire de pilotes graphiques -------------------------------------------------------------------------------- /translations/desktop/desktop_gl_ES.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerXestor de Controladores Gráficos do DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.O Xestor de Controladores Gráficos do Deepin é unha ferramenta de xestión de controladores compacta e uso doado.Graphics Driver ManagerXestor de Controladores Gráficos -------------------------------------------------------------------------------- /translations/desktop/desktop_hr.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin upravitelj grafičkim upravljačkim programomDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin upravitelj grafičkim upravljačkim programom je kompaktan i lagan za korištenje alat za upravljanje grafičkim upravljačkim programom.Graphics Driver ManagerUpravitelj grafičkim upravljačkim programom -------------------------------------------------------------------------------- /translations/desktop/desktop_hu.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin® Grafikus Illesztőprogram KezelőDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.A Deepin® Grafikus Illesztőprogram Kezelő egy kompakt és könnyen használható meghajtókezelő eszköz.Graphics Driver ManagerGrafikus Illesztőprogram Kezelő -------------------------------------------------------------------------------- /translations/desktop/desktop_id.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerManajer Driver Graphis DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Manajer Driver Grafis Deepin adalah alat yang mengatur grafis yang kompak dan mudah digunakanGraphics Driver ManagerManajer Driver Grafis -------------------------------------------------------------------------------- /translations/desktop/desktop_it.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerGestore driver grafici di DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Il Gestore driver grafici di Deepin è uno strumento di gestione dei driver video. 2 | Localizzazione italiana a cura di Massimo A. Carofano.Graphics Driver ManagerGestore driver grafici -------------------------------------------------------------------------------- /translations/desktop/desktop_ko.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin 그래픽 드라이버 관리도구Deepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin 그래픽 드라이버 관리도구는 작고 사용하기 쉬운 그래픽 드라이버 관리 도구입니다.Graphics Driver Manager그래픽 드라이버 관리도구 -------------------------------------------------------------------------------- /translations/desktop/desktop_lt.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin grafikos tvarkyklių tvarkytuvėDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin grafikos tvarkyklių tvarkytuvė yra kompaktiškas ir lengvas naudoti grafikos tvarkyklių valdymo įrankis.Graphics Driver ManagerGrafikos tvarkyklių tvarkytuvė -------------------------------------------------------------------------------- /translations/desktop/desktop_ms.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerPengurus Pemacu Grafik DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Pengurus Pemacu Grafik Deepin ialah alat pengurusan pemacu grafik yang ringkas dan mudah digunakan.Graphics Driver ManagerPengurus Pemacu Grafik -------------------------------------------------------------------------------- /translations/desktop/desktop_ne.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver Managerडिपिन ग्राफिक्स ड्राइभर प्रबन्धकDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.ग्राफिक्स ड्राइभर प्रबन्धक एक कम्पैक्ट तथा ग्राफिक्स ड्राइभर उपकरण हो येसलाई प्रयोग गर्न सजिलो छGraphics Driver Managerग्राफिक्स ड्राइभर प्रबन्धक -------------------------------------------------------------------------------- /translations/desktop/desktop_nl.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin Grafisch StuurprogrammabeheerDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin Grafisch Stuurprogrammabeheer is een klein, eenvoudig hulpmiddel om stuurprogramma's van grafische kaarten te beheren.Graphics Driver ManagerGrafisch Stuurprogrammabeheer -------------------------------------------------------------------------------- /translations/desktop/desktop_pl.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerZarządzanie sterownikami graficznymi DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Zarządzanie sterownikami graficznymi Deepin to kompaktowe i proste w obsłudze narzędzie zarządzania sterownikami graficznymi.Graphics Driver ManagerZarządzanie sterownikami graficznymi -------------------------------------------------------------------------------- /translations/desktop/desktop_pt.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerGestor de Controlador Gráfico DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.O Gestor de Controlador Gráfico Deepin é um gestor de controladores gráficos fácil e compacto.Graphics Driver ManagerGestor de Controlador Gráfico -------------------------------------------------------------------------------- /translations/desktop/desktop_pt_BR.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver Managerdeepin Gerenciador de Drivers GráficosDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.O Gerenciador de Drivers Gráficos é uma ferramenta compacta e fácil de utilizar.Graphics Driver ManagerGerenciador de Drivers Gráficos -------------------------------------------------------------------------------- /translations/desktop/desktop_ro.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerManager Driver Video DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Manager Driver Vide Deepin este un instrument de gestionare a driverului grafic compact și ușor de utilizat.Graphics Driver ManagerManager Driver Video -------------------------------------------------------------------------------- /translations/desktop/desktop_ru.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerМенеджер Графических Драйверов DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin Graphics Driver Manager - это компактный и простой в использовании инструмент управления графическим драйвером.Graphics Driver ManagerМенеджер Графических Драйверов -------------------------------------------------------------------------------- /translations/desktop/desktop_sk.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin Manažér grafického ovládačaDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin Manažér grafického ovládača je kompaktný a ľahko použiteľný nástroj pre správu grafického ovládača.Graphics Driver ManagerManažér grafického ovládača -------------------------------------------------------------------------------- /translations/desktop/desktop_sl.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin upravitelj grafičnih gonilnikovDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin upravitelj grafičnih gonilnikov je kompaktno in enostavno orodje za upravljanje grafičnih gonilnikov.Graphics Driver ManagerUpravitelj grafičnih gonilnikov -------------------------------------------------------------------------------- /translations/desktop/desktop_sq.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerPërgjegjës Deepin Përudhësish GrafikëDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Përgjegjësi Deepin i Përudhësve Grafikë është një mjet kompakt dhe i lehtë për t’u përdorur administrimi përudhësish grafikëGraphics Driver ManagerPërgjegjës Përudhësish Grafikë -------------------------------------------------------------------------------- /translations/desktop/desktop_sr.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerУправник Графичких УправљачаDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Дипин Управник Графичких Управљача је компактан и лак за коришћење алат за управљање управљачим програмима.Graphics Driver ManagerУправник Графичких Управљача -------------------------------------------------------------------------------- /translations/desktop/desktop_tr.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin Görüntü Aygıtı Sürücüsü YöneticisiDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin Görüntü Aygıtı Sürücüsü Yöneticisi küçük ve basit bir görüntü aygıtı sürücüsü yönetimi aracıdır.Graphics Driver ManagerGörüntü Aygıtı Sürücüsü Yöneticisi -------------------------------------------------------------------------------- /translations/desktop/desktop_ug.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin گىرافىك قوزغاتقۇچ باشقۇرغۇچىDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin گرافىك قوزغاتقۇچ باشقۇرغۇچى گرافىك قوزغاتقۇچ باشقۇرۇش قورالى ئىخچام ۋە ئىشلىتىشكە قۇلايلىق.Graphics Driver Managerگىرافىك قوزغاتقۇچ باشقۇرغۇچى -------------------------------------------------------------------------------- /translations/desktop/desktop_uk.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerКерування драйверами графіки DeepinDeepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Керування графічними картками Deepin — компактний і простий у користуванні засіб для керування драйверами до графічних карток.Graphics Driver ManagerКерування драйверами графіки -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_CN.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver Manager深度显卡驱动管理器Deepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.深度显卡驱动管理器是一款小巧易用的显卡驱动管理工具。Graphics Driver Manager显卡驱动管理器 -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_HK.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin 顯卡驅動管理器Deepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin 顯卡驅動管理器是一款小巧易用的顯卡驅動管理工具。Graphics Driver Manager顯卡驅動管理器 -------------------------------------------------------------------------------- /translations/desktop/desktop_zh_TW.ts: -------------------------------------------------------------------------------- 1 | desktopDeepin Graphics Driver ManagerDeepin 顯示卡管理器Deepin Graphics Driver Manager is a compact and easy to use graphics driver managing tool.Deepin 顯示卡管理器是個嚴謹且易用的顯卡驅動管理程序。Graphics Driver Manager顯示卡管理器 -------------------------------------------------------------------------------- /translations/update_ts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd. 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | 19 | 20 | import json 21 | import os 22 | import sys 23 | 24 | def get_language_list(): 25 | """Parse language list and returns locale list.""" 26 | path = "resources/languages.json" 27 | with open(path) as fh: 28 | obj = json.load(fh) 29 | if obj: 30 | return [lang["locale"] for lang in obj] 31 | else: 32 | return [] 33 | 34 | def generate_ts(ts_path): 35 | """Generate new ts file. 36 | 37 | Scan source files in `ui` module recursively. 38 | And save result to |ts_path|. 39 | """ 40 | 41 | paths = ( 42 | "prepare", 43 | "server", 44 | "installer", 45 | "gltest", 46 | "test_installer" 47 | ) 48 | 49 | # Add -I. option to solve namespace error 50 | cmd = " ".join(( 51 | "lupdate -recursive -I.", 52 | " ".join(paths), 53 | "-ts", ts_path, 54 | )) 55 | os.system(cmd) 56 | 57 | def main(): 58 | # Make sure that PWD is root of source repo. 59 | if not os.path.isdir("translations"): 60 | print("Run script in parent folder of `translations`") 61 | sys.exit(1) 62 | 63 | default_ts = "translations/deepin-graphics-driver-manager.ts" 64 | generate_ts(default_ts) 65 | 66 | if __name__ == "__main__": 67 | main() 68 | -------------------------------------------------------------------------------- /utils/environments.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __ENVIRONMENTS_H_ 2 | #define __ENVIRONMENTS_H_ 3 | 4 | #define VERSION "@VERSION@" 5 | 6 | #endif // __ENVIRONMENTS_H_ 7 | -------------------------------------------------------------------------------- /utils/graphicsdriverproxy.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include "graphicsdriverproxy.h" 6 | 7 | /* 8 | * Implementation of interface class ComDeepinDaemonGraphicsDriverInterface 9 | */ 10 | 11 | ComDeepinDaemonGraphicsDriverInterface::ComDeepinDaemonGraphicsDriverInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) 12 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) 13 | { 14 | } 15 | 16 | ComDeepinDaemonGraphicsDriverInterface::~ComDeepinDaemonGraphicsDriverInterface() 17 | { 18 | } 19 | 20 | -------------------------------------------------------------------------------- /utils/graphicsdriverproxy.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef GRAPHICSDRIVERPROXY_H 6 | #define GRAPHICSDRIVERPROXY_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | /* 18 | * Proxy class for interface com.deepin.daemon.GraphicsDriver 19 | */ 20 | class ComDeepinDaemonGraphicsDriverInterface: public QDBusAbstractInterface 21 | { 22 | Q_OBJECT 23 | public: 24 | static inline const char *staticInterfaceName() 25 | { return "com.deepin.daemon.GraphicsDriver"; } 26 | 27 | public: 28 | ComDeepinDaemonGraphicsDriverInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); 29 | 30 | ~ComDeepinDaemonGraphicsDriverInterface(); 31 | 32 | public Q_SLOTS: // METHODS 33 | inline QDBusPendingReply<> CancelInstall() 34 | { 35 | QList argumentList; 36 | return asyncCallWithArgumentList(QStringLiteral("CancelInstall"), argumentList); 37 | } 38 | 39 | inline QDBusPendingReply GetCurrDriverName() 40 | { 41 | QList argumentList; 42 | return asyncCallWithArgumentList(QStringLiteral("GetCurrDriverName"), argumentList); 43 | } 44 | 45 | inline QDBusPendingReply GetDevice() 46 | { 47 | QList argumentList; 48 | return asyncCallWithArgumentList(QStringLiteral("GetDevice"), argumentList); 49 | } 50 | 51 | inline QDBusPendingReply GetNewDriverName() 52 | { 53 | QList argumentList; 54 | return asyncCallWithArgumentList(QStringLiteral("GetNewDriverName"), argumentList); 55 | } 56 | 57 | inline QDBusPendingReply GetOldDriverName() 58 | { 59 | QList argumentList; 60 | return asyncCallWithArgumentList(QStringLiteral("GetOldDriverName"), argumentList); 61 | } 62 | 63 | inline QDBusPendingReply GetResolutionTitle() 64 | { 65 | QList argumentList; 66 | return asyncCallWithArgumentList(QStringLiteral("GetResolutionTitle"), argumentList); 67 | } 68 | 69 | inline QDBusPendingReply IsTestSuccess() 70 | { 71 | QList argumentList; 72 | return asyncCallWithArgumentList(QStringLiteral("IsTestSuccess"), argumentList); 73 | } 74 | 75 | inline QDBusPendingReply<> PrepareInstall(const QString &name, const QString &language) 76 | { 77 | QList argumentList; 78 | argumentList << QVariant::fromValue(name) << QVariant::fromValue(language); 79 | return asyncCallWithArgumentList(QStringLiteral("PrepareInstall"), argumentList); 80 | } 81 | 82 | inline QDBusPendingReply<> RealInstall() 83 | { 84 | QList argumentList; 85 | return asyncCallWithArgumentList(QStringLiteral("RealInstall"), argumentList); 86 | } 87 | 88 | inline QDBusPendingReply<> TestInstall() 89 | { 90 | QList argumentList; 91 | return asyncCallWithArgumentList(QStringLiteral("TestInstall"), argumentList); 92 | } 93 | 94 | inline QDBusPendingReply<> TestSuccess() 95 | { 96 | QList argumentList; 97 | return asyncCallWithArgumentList(QStringLiteral("TestSuccess"), argumentList); 98 | } 99 | 100 | Q_SIGNALS: // SIGNALS 101 | void Cancel(); 102 | void ReportProgress(const QString &ratio); 103 | }; 104 | 105 | namespace com { 106 | namespace deepin { 107 | namespace daemon { 108 | typedef ::ComDeepinDaemonGraphicsDriverInterface GraphicsDriver; 109 | } 110 | } 111 | } 112 | #endif 113 | -------------------------------------------------------------------------------- /utils/utils.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include 6 | #include "utils.h" 7 | #include 8 | 9 | 10 | namespace Utils { 11 | 12 | QPixmap renderSVG(const QString &path, const QSize &size) 13 | { 14 | QImageReader reader; 15 | QPixmap pixmap; 16 | reader.setFileName(path); 17 | if (reader.canRead()) { 18 | const qreal ratio = qApp->devicePixelRatio(); 19 | reader.setScaledSize(size * ratio); 20 | pixmap = QPixmap::fromImage(reader.read()); 21 | pixmap.setDevicePixelRatio(ratio); 22 | } 23 | else { 24 | pixmap.load(path); 25 | } 26 | return pixmap; 27 | } 28 | 29 | 30 | QJsonObject QStringToJson(QString &jsonString) 31 | { 32 | QJsonObject jsonObject; 33 | QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonString.toLocal8Bit().data()); 34 | if(jsonDocument.isNull()) { 35 | return jsonObject; 36 | } 37 | jsonObject = jsonDocument.object(); 38 | return jsonObject; 39 | 40 | } 41 | 42 | QString JsonToQString(QJsonObject &jsonObject) 43 | { 44 | return QString(QJsonDocument(jsonObject).toJson()); 45 | } 46 | 47 | const QPixmap hidpiPixmap(const QString &path, const QSize &sz) 48 | { 49 | const auto ratio = qApp->devicePixelRatio(); 50 | QPixmap iconPix = Utils::renderSVG(path, sz); 51 | iconPix.setDevicePixelRatio(ratio); 52 | 53 | return iconPix; 54 | } 55 | 56 | bool setDisablePluginList() 57 | { 58 | QProcess process; 59 | process.setProgram("gsettings"); 60 | process.setArguments(QStringList() << "get" << "com.deepin.dde.dock.disableplugins" << "disable-plugins-list"); 61 | process.start(); 62 | // Wait for process to finish without timeout. 63 | process.waitForFinished(-1); 64 | QString output = process.readAllStandardOutput(); 65 | QString err = process.readAllStandardError(); 66 | 67 | if (process.exitStatus() != QProcess::NormalExit && process.exitCode() == 0) { 68 | qCritical() << "gsettings get failed: " << err; 69 | return false; 70 | } 71 | 72 | output.remove("\'"); 73 | int startPos = output.indexOf("["); 74 | int endPos = output.indexOf("]"); 75 | 76 | if (endPos > startPos + 1) { 77 | QStringList list = output.mid(startPos + 1, endPos - startPos - 1).split(','); 78 | if (!list.contains("liboverlay-warning.so")) { 79 | list.append("liboverlay-warning.so"); 80 | 81 | for (int i = 0; i < list.size(); i++) { 82 | list[i] = QString("\"%1\"").arg(list[i].trimmed()); 83 | } 84 | 85 | QString disable_plugins_list = QString("[%1]").arg(list.join(',')); 86 | disable_plugins_list = disable_plugins_list.trimmed(); 87 | process.setArguments( 88 | QStringList() << "set" << "com.deepin.dde.dock.disableplugins" << "disable-plugins-list" << disable_plugins_list); 89 | process.start(); 90 | process.waitForFinished(-1); 91 | err = process.readAllStandardError(); 92 | if (process.exitStatus() != QProcess::NormalExit && process.exitCode() == 0) { 93 | qWarning() << "gsettings set failed" << err; 94 | return false; 95 | } 96 | } 97 | } else if (endPos == startPos + 1){ 98 | process.setArguments( 99 | QStringList() << "set" << "com.deepin.dde.dock.disableplugins" << "disable-plugins-list" << QString("[\"%1\"]").arg("liboverlay-warning.so")); 100 | process.start(); 101 | process.waitForFinished(-1); 102 | err = process.readAllStandardError(); 103 | if (process.exitStatus() != QProcess::NormalExit && process.exitCode() == 0) { 104 | qWarning() << "gsettings set failed" << err; 105 | return false; 106 | } 107 | } 108 | return true; 109 | } 110 | 111 | bool resetDisablePluginList() 112 | { 113 | QProcess process; 114 | process.setProgram("gsettings"); 115 | process.setArguments(QStringList() << "reset" << "com.deepin.dde.dock.disableplugins" << "disable-plugins-list"); 116 | process.start(); 117 | // Wait for process to finish without timeout. 118 | process.waitForFinished(-1); 119 | QString output = process.readAllStandardOutput(); 120 | QString err = process.readAllStandardError(); 121 | 122 | if (process.exitStatus() != QProcess::NormalExit && process.exitCode() == 0) { 123 | qCritical() << "gsettings get failed: " << err; 124 | return false; 125 | } 126 | return true; 127 | } 128 | 129 | } 130 | -------------------------------------------------------------------------------- /utils/utils.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef UTILS_H 6 | #define UTILS_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Utils { 15 | 16 | QPixmap renderSVG(const QString &path, const QSize &size); 17 | 18 | QJsonObject QStringToJson(QString &jsonString); 19 | 20 | QString JsonToQString(QJsonObject &jsonObject); 21 | 22 | const QPixmap hidpiPixmap(const QString &path, const QSize &sz); 23 | 24 | bool setDisablePluginList(); 25 | 26 | bool resetDisablePluginList(); 27 | 28 | } 29 | 30 | 31 | #endif 32 | --------------------------------------------------------------------------------