pax_global_header00006660000000000000000000000064142655035320014517gustar00rootroot0000000000000052 comment=bd9fe15bb46637208cd62b91ebde3b5badd65d54 dtkgui-5.5.25/000077500000000000000000000000001426550353200131045ustar00rootroot00000000000000dtkgui-5.5.25/.github/000077500000000000000000000000001426550353200144445ustar00rootroot00000000000000dtkgui-5.5.25/.github/workflows/000077500000000000000000000000001426550353200165015ustar00rootroot00000000000000dtkgui-5.5.25/.github/workflows/backup-to-gitlab.yml000066400000000000000000000040441426550353200223530ustar00rootroot00000000000000name: backup to gitlab on: [push] concurrency: group: ${{ github.workflow }} cancel-in-progress: true jobs: backup-to-gitlab: if: github.repository_owner == 'linuxdeepin' name: backup-to-gitlab runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: repository: "linuxdeepin/jenkins-bridge-client" path: jenkins-bridge-client - name: Install Client run: | cd $GITHUB_WORKSPACE/jenkins-bridge-client go build . sudo install -Dvm755 jenkins-bridge-client -t /usr/bin/ - name: Trigger sync id: generate-runid run: | echo "::set-output name=RUN_ID::$(jenkins-bridge-client -triggerSync -token '${{ secrets.BRIDGETOKEN }}')" - name: Print log run: | jenkins-bridge-client -printlog -token "${{ secrets.BRIDGETOKEN }}" -runid "${{ steps.generate-runid.outputs.RUN_ID }}" backup-to-gitee: if: github.repository_owner == 'linuxdeepin' runs-on: ubuntu-latest steps: - name: create-repo run: | repo=${{ github.event.repository.name }} homepage="https://github.com/linuxdeepin/${repo}" description="mirror of ${homepage}" # remove '.' prefix repo=${repo#"."} curl -X POST --header 'Content-Type: application/json;charset=UTF-8' 'https://gitee.com/api/v5/enterprises/linuxdeepin/repos' -d '{"private": 1,"access_token":"${{ secrets.GITEE_SYNC_TOKEN }}","name":"'"$repo"'","description":"'"$description"'","homepage":"'"$homepage"'","has_issues":"false","has_wiki":"false","can_comment":"false"}' || true - name: push run: | git clone --bare https://github.com/linuxdeepin/${{ github.event.repository.name }}.git .git repo=${{ github.event.repository.name }} # remove '.' prefix repo=${repo#"."} git remote set-url origin https://myml:${{ secrets.GITEE_SYNC_TOKEN }}@gitee.com/linuxdeepin/${repo}.git git push -f --all --prune origin git push --tags origin dtkgui-5.5.25/.github/workflows/call-build-deb.yml000066400000000000000000000005361426550353200217700ustar00rootroot00000000000000name: Call build-deb on: pull_request_target: paths-ignore: - ".github/workflows/**" concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: check_job: uses: linuxdeepin/.github/.github/workflows/build-deb.yml@master secrets: BridgeToken: ${{ secrets.BridgeToken }} dtkgui-5.5.25/.github/workflows/call-build-distribution.yml000066400000000000000000000007661426550353200237620ustar00rootroot00000000000000name: Call build-distribution on: push: paths-ignore: - ".github/workflows/**" pull_request_target: paths-ignore: - ".github/workflows/**" jobs: check_job: uses: linuxdeepin/.github/.github/workflows/build-distribution.yml@master secrets: BUILD_GPG_PRIVATE_KEY: ${{ secrets.BUILD_GPG_PRIVATE_KEY }} BUILD_SSH_PRIVATE_KEY: ${{ secrets.BUILD_SSH_PRIVATE_KEY }} WEBDAV_PASSWD: ${{ secrets.WEBDAV_PASSWD }} WEBDAV_USER: ${{ secrets.WEBDAV_USER }} dtkgui-5.5.25/.github/workflows/call-chatOps.yml000066400000000000000000000003201426550353200215310ustar00rootroot00000000000000name: chatOps on: issue_comment: types: [created] jobs: chatopt: uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master secrets: APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} dtkgui-5.5.25/.github/workflows/call-clacheck.yml000066400000000000000000000006031426550353200216710ustar00rootroot00000000000000name: Call CLA check on: issue_comment: types: [created] pull_request_target: types: [opened, closed, synchronize] concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: clacheck: uses: linuxdeepin/.github/.github/workflows/cla-check.yml@master secrets: APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} dtkgui-5.5.25/.github/workflows/call-commitlint.yml000066400000000000000000000003641426550353200223170ustar00rootroot00000000000000name: Call commitlint on: pull_request_target: concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: check_job: uses: linuxdeepin/.github/.github/workflows/commitlint.yml@master dtkgui-5.5.25/.github/workflows/cppcheck.yml000066400000000000000000000012651426550353200210100ustar00rootroot00000000000000name: cppcheck on: pull_request_target: paths-ignore: - ".github/workflows/**" concurrency: group: ${{ github.workflow }}-pull/${{ github.event.number }} cancel-in-progress: true jobs: cppchceck: name: cppcheck runs-on: ubuntu-latest steps: - run: export - uses: actions/checkout@v2 with: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false - uses: linuxdeepin/action-cppcheck@main with: github_token: ${{ secrets.GITHUB_TOKEN }} repository: ${{ github.repository }} pull_request_id: ${{ github.event.pull_request.number }} allow_approve: false dtkgui-5.5.25/.gitignore000066400000000000000000000007671426550353200151060ustar00rootroot00000000000000# C++ objects and libs *.slo *.lo *.o *.a *.la *.lai *.so *.dll *.dylib # Qt-es object_script.*.Release object_script.*.Debug *_plugin_import.cpp /.qmake.cache /.qmake.stash *.pro.user *.pro.user.* *.qbs.user *.qbs.user.* *.moc moc_*.cpp moc_*.h qrc_*.cpp ui_*.h *.qmlc *.jsc Makefile* *build-* # Qt unit tests target_wrapper.* # QtCreator *.autosave # QtCreator Qml *.qmlproject.user *.qmlproject.user.* # QtCreator CMake CMakeLists.txt.user* bin cmake DtkGuis dtkgui_config.h qt_lib_dtkgui*.pri dtkgui-5.5.25/.gitlab-ci.yml000066400000000000000000000002271426550353200155410ustar00rootroot00000000000000include: - remote: 'https://gitlab.deepin.io/dev-tools/letmeci/raw/master/gitlab-ci/dde.yml' variables: CPPCHECK: "true" CODESPELL: "true" dtkgui-5.5.25/.packit.yaml000066400000000000000000000007021426550353200153200ustar00rootroot00000000000000# See the documentation for more information: # https://packit.dev/docs/configuration/ specfile_path: rpm/dtkgui.spec # add or remove files that should be synced synced_files: - rpm/dtkgui.spec - .packit.yaml upstream_package_name: dtkgui # downstream (Fedora) RPM package name downstream_package_name: dtkgui actions: fix-spec-file: | bash -c "sed -i -r \"s/Version:(\s*)\S*/Version:\1${PACKIT_PROJECT_VERSION}/\" rpm/dtkgui.spec" dtkgui-5.5.25/.release.json000066400000000000000000000010451426550353200154750ustar00rootroot00000000000000{ "commit": { "quilt": false, "pkgver": "echo $(git tag | sort -V | tail -n1)'+r'$(git log $(git describe --abbrev=0 --tags)..HEAD --oneline|wc -l)'+g'$(git rev-parse --short HEAD);", "dist": "experimental" }, "release": { "quilt": true, "pkgver": "git describe --abbrev=0 --tags %(ref)s", "dist": "unstable" }, "release-candidate": { "quilt": true, "dist": "unstable" } } dtkgui-5.5.25/LICENSE000066400000000000000000000167441426550353200141250ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. dtkgui-5.5.25/README.md000066400000000000000000000000761426550353200143660ustar00rootroot00000000000000### dtkgui Deepin Toolkit, gui module for DDE look and feel dtkgui-5.5.25/archlinux/000077500000000000000000000000001426550353200151015ustar00rootroot00000000000000dtkgui-5.5.25/archlinux/PKGBUILD000066400000000000000000000013511426550353200162250ustar00rootroot00000000000000# Maintainer: justforlxz pkgname=dtkgui-git pkgver=5.5.22.r8.g6ef1509 pkgrel=1 pkgdesc='Deepin Toolkit, gui module for DDE look and feel' arch=('x86_64' 'aarch64') url="https://github.com/linuxdeepin/dtkgui" license=('LGPL3') depends=('dtkcore-git' 'librsvg' 'qt5-x11extras') makedepends=('git' 'qt5-tools' 'dtkcommon-git' 'dtkcore-git' 'librsvg' 'qt5-x11extras' 'gtest' 'gmock') conflicts=('dtkgui') provides=('dtkgui') groups=('deepin-git') source=('source.tar.gz') sha512sums=('SKIP') prepare() { cd $deepin_source_name } build() { cd $deepin_source_name qmake-qt5 PREFIX=/usr DTK_VERSION=$pkgver LIB_INSTALL_DIR=/usr/lib make } package() { cd $deepin_source_name make INSTALL_ROOT="$pkgdir" install } dtkgui-5.5.25/debian/000077500000000000000000000000001426550353200143265ustar00rootroot00000000000000dtkgui-5.5.25/debian/changelog000066400000000000000000000004441426550353200162020ustar00rootroot00000000000000dtkgui (5.0.0) unstable; urgency=medium * Release 5.0.0 -- Deepin Packages Builder Tue, 03 Sep 2019 08:59:03 +0800 dtkgui (1.0.0-1) unstable; urgency=medium * Initial release -- Deepin Packages Builder Mon, 29 Jul 2019 16:58:07 +0800 dtkgui-5.5.25/debian/compat000066400000000000000000000000021426550353200155240ustar00rootroot000000000000009 dtkgui-5.5.25/debian/control000066400000000000000000000021321426550353200157270ustar00rootroot00000000000000Source: dtkgui Section: libdevel Priority: optional Maintainer: Deepin Packages Builder Build-Depends: debhelper (>= 9), pkg-config, qtbase5-private-dev, qtbase5-dev-tools, libdtkcore-dev, librsvg2-dev, libgtest-dev, libgmock-dev Standards-Version: 3.9.8 Package: libdtkgui5 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkcommon Multi-Arch: same Description: Deepin Tool Kit Gui library DtkGui is base library of Deepin Qt/C++ applications. . This package contains the shared libraries. Package: libdtkgui5-bin Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkgui5( =${binary:Version}) Description: Deepin Tool Kit Gui Utilities DtkGui is base devel library of Deepin Qt/C++ applications. . This package contains the utilities of DtkGui Package: libdtkgui-dev Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkgui5( =${binary:Version}) Description: Deepin Tool Kit Gui Devel library DtkGui is base devel library of Deepin Qt/C++ applications. . This package contains the header files and static libraries of DtkGui dtkgui-5.5.25/debian/copyright000066400000000000000000000016711426550353200162660ustar00rootroot00000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: dtkgui Source: https://github.com/linuxdeepin/dtkgui License: LGPL-3+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU Lesser General Public License version 3 can be found in "/usr/share/common-licenses/LGPL-3". dtkgui-5.5.25/debian/libdtkgui-dev.install000066400000000000000000000001411426550353200204440ustar00rootroot00000000000000usr/lib/*/lib*.so usr/include usr/lib/*/pkgconfig/*.pc usr/lib/*/cmake/*/*.cmake usr/lib/*/qt5/* dtkgui-5.5.25/debian/libdtkgui5-bin.install000066400000000000000000000000271426550353200205260ustar00rootroot00000000000000usr/lib/*/*/DGui/bin/* dtkgui-5.5.25/debian/libdtkgui5.install000066400000000000000000000000241426550353200177550ustar00rootroot00000000000000usr/lib/*/lib*.so.* dtkgui-5.5.25/debian/rules000077500000000000000000000015071426550353200154110ustar00rootroot00000000000000#!/usr/bin/make -f DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/default.mk export QT_SELECT = qt5 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) ifneq (,$(wildcard .git/config)) CONFIG_VERSION= else VERSION = $(DEB_VERSION_UPSTREAM) _PACK_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$1}') _BUILD_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$2}' | sed 's/[^0-9]//g') ifeq ($(_BUILD_VER),) CONFIG_VERSION = $(_PACK_VER) else CONFIG_VERSION = $(_PACK_VER).$(_BUILD_VER) endif endif %: dh $@ --parallel override_dh_auto_configure: dh_auto_configure -- LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) VERSION=$(CONFIG_VERSION) #override_dh_auto_test: # echo "skip auto test" override_dh_makeshlibs: dh_makeshlibs -V "libdtkgui5 (>= $(shell echo $(VERSION) | cut -d '.' -f 1,2))" dtkgui-5.5.25/debian/source/000077500000000000000000000000001426550353200156265ustar00rootroot00000000000000dtkgui-5.5.25/debian/source/format000066400000000000000000000000141426550353200170340ustar00rootroot000000000000003.0 (quilt) dtkgui-5.5.25/debian/symbols.amd64000066400000000000000000001751301426550353200166620ustar00rootroot00000000000000libdtkgui.so.5 libdtkgui5 #MINVER# _Z27qRegisterNormalizedMetaTypeI5QListI12QPainterPathEEiRK10QByteArrayPT_N9QtPrivate21MetaTypeDefinedHelperIS6_Xaasr12QMetaTypeId2IS6_E7DefinedntsrSB_9IsBuiltInEE11DefinedTypeE@Base 5.2.2-1 _Z27qRegisterNormalizedMetaTypeI5QListI5QRectEEiRK10QByteArrayPT_N9QtPrivate21MetaTypeDefinedHelperIS6_Xaasr12QMetaTypeId2IS6_E7DefinedntsrSB_9IsBuiltInEE11DefinedTypeE@Base 5.2.2-1 _Z27qRegisterNormalizedMetaTypeI7QVectorIjEEiRK10QByteArrayPT_N9QtPrivate21MetaTypeDefinedHelperIS5_Xaasr12QMetaTypeId2IS5_E7DefinedntsrSA_9IsBuiltInEE11DefinedTypeE@Base 5.2.2-1 _ZGVZN9QtPrivate19ValueTypeIsMetaTypeI5QListI12QPainterPathELb1EE17registerConverterEiE1f@Base 5.2.2-1 _ZGVZN9QtPrivate19ValueTypeIsMetaTypeI5QListI5QRectELb1EE17registerConverterEiE1f@Base 5.2.2-1 _ZGVZN9QtPrivate19ValueTypeIsMetaTypeI7QVectorIjELb1EE17registerConverterEiE1f@Base 5.2.2-1 _ZN10QByteArrayD1Ev@Base 5.2.2-1 _ZN10QByteArrayD2Ev@Base 5.2.2-1 _ZN12QWeakPointerI14QDBusInterfaceED1Ev@Base 5.2.2-1 _ZN12QWeakPointerI14QDBusInterfaceED2Ev@Base 5.2.2-1 _ZN12QWeakPointerI7QObjectED1Ev@Base 5.2.2-1 _ZN12QWeakPointerI7QObjectED2Ev@Base 5.2.2-1 _ZN12QWeakPointerIN3Dtk3Gui19DDndSourceInterfaceEED1Ev@Base 5.2.2-1 _ZN12QWeakPointerIN3Dtk3Gui19DDndSourceInterfaceEED2Ev@Base 5.2.2-1 _ZN12QWeakPointerIN3Dtk3Gui21DDndClientSignalRelayEED1Ev@Base 5.2.2-1 _ZN12QWeakPointerIN3Dtk3Gui21DDndClientSignalRelayEED2Ev@Base 5.2.2-1 _ZN15QtSharedPointer33ExternalRefCountWithCustomDeleterIN3Dtk3Gui21DDndClientSignalRelayENS_13NormalDeleterEE7deleterEPNS_20ExternalRefCountDataE@Base 5.2.2-1 _ZN17QtMetaTypePrivate13IteratorOwnerIPKjE5equalEPKPvS6_@Base 5.2.2-1 _ZN17QtMetaTypePrivate13IteratorOwnerIPKjE6assignEPPvPKS4_@Base 5.2.2-1 _ZN17QtMetaTypePrivate13IteratorOwnerIPKjE7advanceEPPvi@Base 5.2.2-1 _ZN17QtMetaTypePrivate13IteratorOwnerIPKjE7destroyEPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate19IteratorOwnerCommonIN5QListI12QPainterPathE14const_iteratorEE5equalEPKPvS8_@Base 5.2.2-1 _ZN17QtMetaTypePrivate19IteratorOwnerCommonIN5QListI12QPainterPathE14const_iteratorEE6assignEPPvPKS6_@Base 5.2.2-1 _ZN17QtMetaTypePrivate19IteratorOwnerCommonIN5QListI12QPainterPathE14const_iteratorEE7advanceEPPvi@Base 5.2.2-1 _ZN17QtMetaTypePrivate19IteratorOwnerCommonIN5QListI12QPainterPathE14const_iteratorEE7destroyEPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate19IteratorOwnerCommonIN5QListI5QRectE14const_iteratorEE5equalEPKPvS8_@Base 5.2.2-1 _ZN17QtMetaTypePrivate19IteratorOwnerCommonIN5QListI5QRectE14const_iteratorEE6assignEPPvPKS6_@Base 5.2.2-1 _ZN17QtMetaTypePrivate19IteratorOwnerCommonIN5QListI5QRectE14const_iteratorEE7advanceEPPvi@Base 5.2.2-1 _ZN17QtMetaTypePrivate19IteratorOwnerCommonIN5QListI5QRectE14const_iteratorEE7destroyEPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI12QPainterPathLb1EE8DestructEPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI12QPainterPathLb1EE9ConstructEPvPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI13QDBusArgumentLb1EE8DestructEPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI13QDBusArgumentLb1EE9ConstructEPvPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI5QListI12QPainterPathELb1EE8DestructEPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI5QListI12QPainterPathELb1EE9ConstructEPvPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI5QListI5QRectELb1EE8DestructEPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI5QListI5QRectELb1EE9ConstructEPvPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI7QVectorIjELb1EE8DestructEPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI7QVectorIjELb1EE9ConstructEPvPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI8QMarginsLb1EE8DestructEPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI8QMarginsLb1EE9ConstructEPvPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperINS_23QSequentialIterableImplELb1EE8DestructEPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperINS_23QSequentialIterableImplELb1EE9ConstructEPvPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperIPN3Dtk3Gui14DPlatformThemeELb1EE8DestructEPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperIPN3Dtk3Gui14DPlatformThemeELb1EE9ConstructEPvPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl13moveToEndImplI5QListI12QPainterPathEEEvPKvPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl13moveToEndImplI5QListI5QRectEEEvPKvPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl13moveToEndImplI7QVectorIjEEEvPKvPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl15moveToBeginImplI5QListI12QPainterPathEEEvPKvPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl15moveToBeginImplI5QListI5QRectEEEvPKvPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl15moveToBeginImplI7QVectorIjEEEvPKvPPv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl6atImplI5QListI12QPainterPathEEEPKvS6_i@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl6atImplI5QListI5QRectEEEPKvS6_i@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl6atImplI7QVectorIjEEEPKvS5_i@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl7getImplI5QListI12QPainterPathEEENS_11VariantDataEPKPvij@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl7getImplI5QListI5QRectEEENS_11VariantDataEPKPvij@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl7getImplI7QVectorIjEEENS_11VariantDataEPKPvij@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl8sizeImplI5QListI12QPainterPathEEEiPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl8sizeImplI5QListI5QRectEEEiPKv@Base 5.2.2-1 _ZN17QtMetaTypePrivate23QSequentialIterableImpl8sizeImplI7QVectorIjEEEiPKv@Base 5.2.2-1 _ZN18QSharedDataPointerIN3Dtk3Gui12DPaletteDataEE13detach_helperEv@Base 5.2.2-1 _ZN18QSharedDataPointerIN3Dtk3Gui12DPaletteDataEED1Ev@Base 5.2.2-1 _ZN18QSharedDataPointerIN3Dtk3Gui12DPaletteDataEED2Ev@Base 5.2.2-1 _ZN29QWindowSystemInterfacePrivate16ThemeChangeEventD0Ev@Base 5.2.2-1 _ZN29QWindowSystemInterfacePrivate16ThemeChangeEventD1Ev@Base 5.2.2-1 _ZN29QWindowSystemInterfacePrivate16ThemeChangeEventD2Ev@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface10CursorIntoEiiRK7QString@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface10CursorMoveEiiRK7QString@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface10KeyReleaseERK7QStringiiS2_@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface11ButtonPressEiiiRK7QString@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface11qt_metacastEPKc@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface13ButtonReleaseEiiiRK7QString@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface13CancelAllAreaEv@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface16staticMetaObjectE@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface8KeyPressERK7QStringiiS2_@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterface9CursorOutEiiRK7QString@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterfaceC1ERK7QStringS2_RK15QDBusConnectionP7QObject@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterfaceC2ERK7QStringS2_RK15QDBusConnectionP7QObject@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterfaceD0Ev@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterfaceD1Ev@Base 5.2.2-1 _ZN34ComDeepinApiXEventMonitorInterfaceD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRenderer10setViewBoxERK5QRect@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRenderer10setViewBoxERK6QRectF@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRenderer4loadERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRenderer4loadERK7QString@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRenderer6renderEP8QPainter@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRenderer6renderEP8QPainterRK6QRectF@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRenderer6renderEP8QPainterRK7QStringRK6QRectF@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererC1EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererC1ERK10QByteArrayP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererC1ERK7QStringP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererC2EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererC2ERK10QByteArrayP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererC2ERK7QStringP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui12DSvgRendererD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindow10pidChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindow11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindow11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindow14wmClassChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindow16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindow5eventEP6QEvent@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindow9fromWinIdEy@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindowC1EP7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindowC2EP7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindowD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindowD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DForeignWindowD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme10midChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme10setPaletteERKNS0_8DPaletteE@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11baseChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11darkChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11linkChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11setFontNameERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11setMidlightERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11setTextTipsERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme11textChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme12lightChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme12setHighlightERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme12setTextTitleERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme12setThemeNameERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme13buttonChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme13setBrightTextERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme13setButtonTextERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme13setDarkLivelyERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme13setTextLivelyERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme13setWindowTextERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme13shadowChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme13windowChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14paletteChangedENS0_8DPaletteE@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setActiveColorE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setCursorBlinkEb@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setDotsPerInchERK7QStringi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setFrameBorderERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setGtkFontNameERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setLightLivelyERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setLinkVisitedERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setTextWarningERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setToolTipBaseERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme14setToolTipTextERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme15fontNameChangedE10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme15midlightChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme15setMonoFontNameERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme15textTipsChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme16highlightChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme16setAlternateBaseERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme16setFontPointSizeEd@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme16setIconThemeNameERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme16textTitleChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme16themeNameChangedE10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme17brightTextChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme17buttonTextChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme17darkLivelyChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme17setItemBackgroundERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme17setSoundThemeNameERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme17textLivelyChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme17windowTextChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18activeColorChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18cursorBlinkChangedEb@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18dotsPerInchChangedERK7QStringi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18frameBorderChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18gtkFontNameChangedE10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18lightLivelyChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18linkVisitedChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18setCursorBlinkTimeEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18setDoubleClickTimeEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18setHighlightedTextERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18textWarningChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18toolTipBaseChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme18toolTipTextChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme19monoFontNameChangedE10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme19setDndDragThresholdEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme19setFallbackPropertyEb@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme20alternateBaseChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme20fontPointSizeChangedEd@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme20iconThemeNameChangedE10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme21itemBackgroundChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme21setCursorBlinkTimeoutEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme21soundThemeNameChangedE10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme22cursorBlinkTimeChangedEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme22doubleClickTimeChangedEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme22highlightedTextChangedE6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme22setDoubleClickDistanceEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme23dndDragThresholdChangedEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme25cursorBlinkTimeoutChangedEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme26doubleClickDistanceChangedEi@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme6setMidERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme7setBaseERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme7setDarkERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme7setLinkERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme7setTextERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme8setLightERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme9setButtonERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme9setShadowERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformTheme9setWindowERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformThemeC1EjP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformThemeC1EjPS1_@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformThemeC2EjP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformThemeC2EjPS1_@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformThemeD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformThemeD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DPlatformThemeD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitor11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitor11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitor14registerRegionEv@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitor16setWatchedRegionERK7QRegion@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitor16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitor16unregisterRegionEv@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitor17setCoordinateTypeENS1_14CoordinateTypeE@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitorC1EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitorC2EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitorD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitorD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui14DRegionMonitorD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient12setTargetUrlEPK9QMimeData4QUrl@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient12stateChangedENS0_14DFileDragStateE@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient13checkMimeDataEPK9QMimeData@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient13setTargetDataEPK9QMimeData7QString8QVariant@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient15progressChangedEi@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient15serverDestroyedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClient16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClientC1EPK9QMimeDataP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClientC2EPK9QMimeDataP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClientD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClientD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragClientD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServer11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServer11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServer11setProgressEi@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServer16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServer17targetDataChangedERK7QString@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServer8setStateENS0_14DFileDragStateE@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServerC1EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServerC2EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServerD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServerD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DFileDragServerD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettings10setSettingERK10QByteArrayRK8QVariant@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettings11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettings11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettings12__setAllKeysERK5QListI10QByteArrayE@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettings14allKeysChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettings15propertyChangedERK10QByteArrayRK8QVariant@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettings16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettings4initEPK11QMetaObjectj@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsC1EPK11QMetaObjectjRK10QByteArrayP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsC1ERNS0_22DNativeSettingsPrivateEPK11QMetaObjectjP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsC1EjRK10QByteArrayP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsC2EPK11QMetaObjectjRK10QByteArrayP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsC2ERNS0_22DNativeSettingsPrivateEPK11QMetaObjectjP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsC2EjRK10QByteArrayP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DNativeSettingsD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle11eventFilterEP7QObjectP6QEvent@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle11setClipPathERK12QPainterPath@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle12setFrameMaskERK7QRegion@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle12windowLeaderEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle13isEnabledDXcbEPK7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle13pluginVersionEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle14isDXcbPlatformEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle14setBorderColorERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle14setBorderWidthEi@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle14setShadowColorERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle15clipPathChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle15setShadowOffsetERK6QPoint@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle15setShadowRadiusEi@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle15setWindowRadiusEi@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle16frameMaskChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle18borderColorChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle18borderWidthChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle18shadowColorChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19enableDXcbForWindowEP7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19enableDXcbForWindowEP7QWindowb@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19frameMarginsChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19isEnabledNoTitlebarEPK7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19setEnableBlurWindowEb@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19setEnableSystemMoveEb@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19shadowOffsetChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19shadowRadiusChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle19windowRadiusChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle21setEnableSystemResizeEb@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle21setWindowBlurAreaByWMEP7QWindowRK5QListI12QPainterPathE@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle21setWindowBlurAreaByWMEP7QWindowRK7QVectorINS1_10WMBlurAreaEE@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle21setWindowBlurAreaByWMERK5QListI12QPainterPathE@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle21setWindowBlurAreaByWMERK7QVectorINS1_10WMBlurAreaEE@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle23enableBlurWindowChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle23enableSystemMoveChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle24setTranslucentBackgroundEb@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle25enableSystemResizeChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle26setAutoInputMaskByClipPathEb@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle27connectHasBlurWindowChangedEP7QObjectSt8functionIFvvEE@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle28translucentBackgroundChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle29setEnabledNoTitlebarForWindowEP7QWindowb@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle30autoInputMaskByClipPathChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle30setDisableWindowOverrideCursorEP7QWindowb@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandle33connectWindowManagerChangedSignalEP7QObjectSt8functionIFvvEE@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandleC1EP7QWindowP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandleC2EP7QWindowP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandleD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandleD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DPlatformHandleD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl10setCounterEbi@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl10setUrgencyEb@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl11sendMessageERK4QMapI7QString8QVariantE@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl11setProgressEbd@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl14counterChangedEi@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl15progressChangedEd@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl17setCounterVisibleEb@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl21counterVisibleChangedEb@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControl22progressVisibleChangedEb@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControlC1EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControlC2EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControlD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControlD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui15DTaskbarControlD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui16DFileDragPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui16DFileDragPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui16DFileDragPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider12setSizeLimitERK9QMimeTypex@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider15createThumbnailERK9QFileInfoNS1_4SizeE@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider19setDefaultSizeLimitEx@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider20appendToProduceQueueERK9QFileInfoNS1_4SizeESt8functionIFvRK7QStringEE@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider20removeInProduceQueueERK9QFileInfoNS1_4SizeE@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider3runEv@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProvider8instanceEv@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProviderC1EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProviderC2EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProviderD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProviderD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui18DThumbnailProviderD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui18DWindowGroupLeader12removeWindowEP7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui18DWindowGroupLeader9addWindowEP7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui18DWindowGroupLeaderC1Ej@Base 5.2.2-1 _ZN3Dtk3Gui18DWindowGroupLeaderC2Ej@Base 5.2.2-1 _ZN3Dtk3Gui18DWindowGroupLeaderD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui18DWindowGroupLeaderD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterface11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterface11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterface12stateChangedE7QStringi@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterface15progressChangedE7QStringi@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterface15serverDestroyedE7QString@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterface16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterfaceD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterfaceD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui19DDndSourceInterfaceD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui19DSvgRendererPrivateC1EPNS_4Core7DObjectE@Base 5.2.2-1 _ZN3Dtk3Gui19DSvgRendererPrivateC2EPNS_4Core7DObjectE@Base 5.2.2-1 _ZN3Dtk3Gui19DSvgRendererPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui19DSvgRendererPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui19DSvgRendererPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper17getMotifFunctionsEPK7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper17setMotifFunctionsEPK7QWindow6QFlagsINS1_13MotifFunctionEE@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper17setMotifFunctionsEPK7QWindow6QFlagsINS1_13MotifFunctionEEb@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper17windowListChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper19getMotifDecorationsEPK7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper19hasCompositeChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper19setMotifDecorationsEPK7QWindow6QFlagsINS1_15MotifDecorationEE@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper19setMotifDecorationsEPK7QWindow6QFlagsINS1_15MotifDecorationEEb@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper20hasBlurWindowChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper20hasNoTitlebarChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper20windowManagerChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper21popupSystemWindowMenuEPK7QWindow@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper25windowMotifWMHintsChangedEj@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelper8instanceEv@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelperC1EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelperC2EP7QObject@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelperD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelperD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui20DWindowManagerHelperD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelay11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelay11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelay12stateChangedE7QStringi@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelay15progressChangedE7QStringi@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelay15serverDestroyedE7QString@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelay16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelay8relayrefE@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelayD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelayD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DDndClientSignalRelayD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DForeignWindowPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DForeignWindowPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DForeignWindowPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper10blendColorERK6QColorS4_@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper10initializeEv@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper11adjustColorERK6QColoraaaaaaa@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper11toColorTypeERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper11toColorTypeERK8QPalette@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper12fetchPaletteEPKNS0_14DPlatformThemeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper12setThemeTypeENS1_9ColorTypeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper14setPaletteTypeENS1_9ColorTypeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper15generatePaletteERNS0_8DPaletteENS1_9ColorTypeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper15standardPaletteENS1_9ColorTypeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper16themeTypeChangedENS1_9ColorTypeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper17isXWindowPlatformEv@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper17setSingleInstanceERK7QStringNS1_11SingleScopeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper18newProcessInstanceExRK11QStringList@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper18paletteTypeChangedENS1_9ColorTypeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper20generatePaletteColorERNS0_8DPaletteEN8QPalette9ColorRoleENS1_9ColorTypeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper20generatePaletteColorERNS0_8DPaletteENS2_9ColorTypeENS1_9ColorTypeE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper21setApplicationPaletteERKNS0_8DPaletteE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper23registerInstanceCreatorEPFPS1_vE@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper24setUseInactiveColorGroupEb@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper25setSingelInstanceIntervalEi@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper25setSingleInstanceIntervalEi@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper26setColorCompositingEnabledEb@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelper8instanceEv@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelperC1Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelperC2Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelperD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelperD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DGuiApplicationHelperD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivate16onQtColorChangedEN8QPalette9ColorRoleERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivate17onDtkColorChangedENS0_8DPalette9ColorTypeERK6QColor@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivate20notifyPaletteChangedEv@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivate25_q_onThemePropertyChangedERK10QByteArrayRK8QVariant@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivateC1EPNS0_14DPlatformThemeE@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivateC2EPNS0_14DPlatformThemeE@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DPlatformThemePrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivate11_q_KeyPressERK7QStringiiS4_@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivate13_q_CursorMoveEiiRK7QString@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivate13_q_KeyReleaseERK7QStringiiS4_@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivate14_q_ButtonPressEiiiRK7QString@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivate16_q_ButtonReleaseEiiiRK7QString@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivate21registerMonitorRegionEv@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivate23unregisterMonitorRegionEv@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivate4initEv@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivateC1EPNS0_14DRegionMonitorE@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivateC2EPNS0_14DRegionMonitorE@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DRegionMonitorPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DWindowManagerHelper_D0Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DWindowManagerHelper_D1Ev@Base 5.2.2-1 _ZN3Dtk3Gui21DWindowManagerHelper_D2Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragClientPrivate13connectionmapE@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragClientPrivate8ifacemapE@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragClientPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragClientPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragClientPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragServerPrivate10dbusifinstE@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragServerPrivate13writeMimeDataEP9QMimeData@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragServerPrivate9servermapE@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragServerPrivateC1EPNS0_15DFileDragServerE@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragServerPrivateC2EPNS0_15DFileDragServerE@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragServerPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragServerPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DFileDragServerPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DNativeSettingsPrivate4initEPK11QMetaObjectj@Base 5.2.2-1 _ZN3Dtk3Gui22DNativeSettingsPrivateC1EPNS0_15DNativeSettingsERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui22DNativeSettingsPrivateC2EPNS0_15DNativeSettingsERK10QByteArray@Base 5.2.2-1 _ZN3Dtk3Gui22DNativeSettingsPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DNativeSettingsPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DNativeSettingsPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DTaskbarControlPrivateC1EPNS0_15DTaskbarControlE@Base 5.2.2-1 _ZN3Dtk3Gui22DTaskbarControlPrivateC2EPNS0_15DTaskbarControlE@Base 5.2.2-1 _ZN3Dtk3Gui22DTaskbarControlPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DTaskbarControlPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui22DTaskbarControlPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui22_DGuiApplicationHelper14defaultCreatorEv@Base 5.2.2-1 _ZN3Dtk3Gui22_DGuiApplicationHelper7creatorE@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivate11ProduceInfoD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivate11ProduceInfoD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivate20hasThumbnailMimeHashE@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivate4initEv@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivateC1EPNS0_18DThumbnailProviderE@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivateC2EPNS0_18DThumbnailProviderE@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui25DThumbnailProviderPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui25DWindowGroupLeaderPrivate17ensureGroupLeaderEv@Base 5.2.2-1 _ZN3Dtk3Gui25DWindowGroupLeaderPrivate20setWindowGroupLeaderEjj@Base 5.2.2-1 _ZN3Dtk3Gui27DWindowManagerHelperPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui27DWindowManagerHelperPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui27DWindowManagerHelperPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivate15initApplicationEP15QGuiApplication@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivate16compositingColorE@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivate16useInactiveColorE@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivate21notifyAppThemeChangedEP15QGuiApplicationb@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivate21staticInitApplicationEv@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivate23_q_initApplicationThemeEb@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivate4initEv@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivate8waitTimeE@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivateC1EPNS0_21DGuiApplicationHelperE@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivateC2EPNS0_21DGuiApplicationHelperE@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui28DGuiApplicationHelperPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui29DFileThumbnailProviderPrivateD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui29DFileThumbnailProviderPrivateD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui29DFileThumbnailProviderPrivateD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui8DPalette8setBrushEN8QPalette10ColorGroupENS1_9ColorTypeERK6QBrush@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteC1ERK8QPalette@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteC1ERKS1_@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteC1Ev@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteC2ERK8QPalette@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteC2ERKS1_@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteC2Ev@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteD2Ev@Base 5.2.2-1 _ZN3Dtk3Gui8DPaletteaSERKS1_@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDrag11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDrag11qt_metacastEPKc@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDrag11setMimeDataEP9QMimeData@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDrag16staticMetaObjectE@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDrag16targetUrlChangedE4QUrl@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDrag9targetUrlEv@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDragC1EP7QObjectPNS0_15DFileDragServerE@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDragC2EP7QObjectPNS0_15DFileDragServerE@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDragD0Ev@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDragD1Ev@Base 5.2.2-1 _ZN3Dtk3Gui9DFileDragD2Ev@Base 5.2.2-1 _ZN4QMapI7QString8QVariantE13detach_helperEv@Base 5.2.2-1 _ZN4QMapI7QString8QVariantE6insertERKS0_RKS1_@Base 5.2.2-1 _ZN4QMapI7QString8QVariantED1Ev@Base 5.2.2-1 _ZN4QMapI7QString8QVariantED2Ev@Base 5.2.2-1 _ZN4QSetI7QStringED1Ev@Base 5.2.2-1 _ZN4QSetI7QStringED2Ev@Base 5.2.2-1 _ZN5QHashI5QPairI7QStringN3Dtk3Gui18DThumbnailProvider4SizeEE15QHashDummyValueE11deleteNode2EPN9QHashData4NodeE@Base 5.2.2-1 _ZN5QHashI5QPairI7QStringN3Dtk3Gui18DThumbnailProvider4SizeEE15QHashDummyValueE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.2.2-1 _ZN5QHashI5QPairI7QStringN3Dtk3Gui18DThumbnailProvider4SizeEE15QHashDummyValueE6removeERKS6_@Base 5.2.2-1 _ZN5QHashI7QString12QWeakPointerI14QDBusInterfaceEE11deleteNode2EPN9QHashData4NodeE@Base 5.2.2-1 _ZN5QHashI7QString12QWeakPointerI14QDBusInterfaceEE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.2.2-1 _ZN5QHashI7QString12QWeakPointerI14QDBusInterfaceEE6removeERKS0_@Base 5.2.2-1 _ZN5QHashI7QString12QWeakPointerI14QDBusInterfaceEED1Ev@Base 5.2.2-1 _ZN5QHashI7QString12QWeakPointerI14QDBusInterfaceEED2Ev@Base 5.2.2-1 _ZN5QHashI7QString15QHashDummyValueE11deleteNode2EPN9QHashData4NodeE@Base 5.2.2-1 _ZN5QHashI7QString15QHashDummyValueE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragClientEE11deleteNode2EPN9QHashData4NodeE@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragClientEE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragClientEE6removeERKS0_@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragClientEED1Ev@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragClientEED2Ev@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragServerEE11deleteNode2EPN9QHashData4NodeE@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragServerEE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragServerEE6removeERKS0_@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragServerEED1Ev@Base 5.2.2-1 _ZN5QHashI7QStringPN3Dtk3Gui15DFileDragServerEED2Ev@Base 5.2.2-1 _ZN5QHashI7QStringiE11deleteNode2EPN9QHashData4NodeE@Base 5.2.2-1 _ZN5QHashI7QStringiE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.2.2-1 _ZN5QHashI9QMimeTypexE11deleteNode2EPN9QHashData4NodeE@Base 5.2.2-1 _ZN5QHashI9QMimeTypexE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.2.2-1 _ZN5QListI10QByteArrayEC1ERKS1_@Base 5.2.2-1 _ZN5QListI10QByteArrayEC2ERKS1_@Base 5.2.2-1 _ZN5QListI10QByteArrayED1Ev@Base 5.2.2-1 _ZN5QListI10QByteArrayED2Ev@Base 5.2.2-1 _ZN5QListI12QPainterPathE13detach_helperEi@Base 5.2.2-1 _ZN5QListI12QPainterPathE18detach_helper_growEii@Base 5.2.2-1 _ZN5QListI12QPainterPathE6appendERKS0_@Base 5.2.2-1 _ZN5QListI12QPainterPathEC1ERKS1_@Base 5.2.2-1 _ZN5QListI12QPainterPathEC2ERKS1_@Base 5.2.2-1 _ZN5QListI12QPainterPathED1Ev@Base 5.2.2-1 _ZN5QListI12QPainterPathED2Ev@Base 5.2.2-1 _ZN5QListI5QRectEC1ERKS1_@Base 5.2.2-1 _ZN5QListI5QRectEC2ERKS1_@Base 5.2.2-1 _ZN5QListI5QRectED1Ev@Base 5.2.2-1 _ZN5QListI5QRectED2Ev@Base 5.2.2-1 _ZN5QListI7QStringE18detach_helper_growEii@Base 5.2.2-1 _ZN5QListI7QStringE5clearEv@Base 5.2.2-1 _ZN5QListI7QStringE6appendERKS0_@Base 5.2.2-1 _ZN5QListI7QStringED1Ev@Base 5.2.2-1 _ZN5QListI7QStringED2Ev@Base 5.2.2-1 _ZN5QListI8QPointerI7QWindowEE13detach_helperEi@Base 5.2.2-1 _ZN5QListI8QPointerI7QWindowEE18detach_helper_growEii@Base 5.2.2-1 _ZN5QListI8QPointerI7QWindowEE6appendERKS2_@Base 5.2.2-1 _ZN5QListI8QPointerI7QWindowEED1Ev@Base 5.2.2-1 _ZN5QListI8QPointerI7QWindowEED2Ev@Base 5.2.2-1 _ZN5QListI8QVariantE18detach_helper_growEii@Base 5.2.2-1 _ZN5QListI8QVariantE6appendERKS0_@Base 5.2.2-1 _ZN5QListI8QVariantED1Ev@Base 5.2.2-1 _ZN5QListI8QVariantED2Ev@Base 5.2.2-1 _ZN5QListIN3Dtk3Gui25DThumbnailProviderPrivate11ProduceInfoEE13detach_helperEi@Base 5.2.2-1 _ZN5QListIN3Dtk3Gui25DThumbnailProviderPrivate11ProduceInfoEE18detach_helper_growEii@Base 5.2.2-1 _ZN5QListIN3Dtk3Gui25DThumbnailProviderPrivate11ProduceInfoEE6appendERKS3_@Base 5.2.2-1 _ZN5QListIN3Dtk3Gui25DThumbnailProviderPrivate11ProduceInfoEED1Ev@Base 5.2.2-1 _ZN5QListIN3Dtk3Gui25DThumbnailProviderPrivate11ProduceInfoEED2Ev@Base 5.2.2-1 _ZN5QListIP7QScreenE13detach_helperEi@Base 5.2.2-1 _ZN5QListIP7QScreenED1Ev@Base 5.2.2-1 _ZN5QListIP7QScreenED2Ev@Base 5.2.2-1 _ZN5QListIP7QWindowED1Ev@Base 5.2.2-1 _ZN5QListIP7QWindowED2Ev@Base 5.2.2-1 _ZN5QListIPN3Dtk3Gui14DForeignWindowEE13detach_helperEi@Base 5.2.2-1 _ZN5QListIPN3Dtk3Gui14DForeignWindowEE18detach_helper_growEii@Base 5.2.2-1 _ZN5QListIPN3Dtk3Gui14DForeignWindowEE6appendERKS3_@Base 5.2.2-1 _ZN5QListIPN3Dtk3Gui14DForeignWindowEEC1ERKS4_@Base 5.2.2-1 _ZN5QListIPN3Dtk3Gui14DForeignWindowEEC2ERKS4_@Base 5.2.2-1 _ZN5QListIPN3Dtk3Gui14DForeignWindowEED1Ev@Base 5.2.2-1 _ZN5QListIPN3Dtk3Gui14DForeignWindowEED2Ev@Base 5.2.2-1 _ZN5QListIyE18detach_helper_growEii@Base 5.2.2-1 _ZN5QListIyE6appendERKy@Base 5.2.2-1 _ZN5QListIyED1Ev@Base 5.2.2-1 _ZN5QListIyED2Ev@Base 5.2.2-1 _ZN6QColorC1EPKc@Base 5.2.2-1 _ZN6QColorC2EPKc@Base 5.2.2-1 _ZN7QStringD1Ev@Base 5.2.2-1 _ZN7QStringD2Ev@Base 5.2.2-1 _ZN7QVectorIN3Dtk3Gui15DPlatformHandle10WMBlurAreaEE11reallocDataEii6QFlagsIN10QArrayData16AllocationOptionEE@Base 5.2.2-1 _ZN7QVectorIN3Dtk3Gui15DPlatformHandle10WMBlurAreaEE6appendEOS3_@Base 5.2.2-1 _ZN7QVectorIjE11reallocDataEii6QFlagsIN10QArrayData16AllocationOptionEE@Base 5.2.2-1 _ZN7QVectorIjEC1ERKS0_@Base 5.2.2-1 _ZN7QVectorIjEC2ERKS0_@Base 5.2.2-1 _ZN8QMapNodeI7QString8QVariantE14destroySubTreeEv@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI5QListI12QPainterPathEN17QtMetaTypePrivate23QSequentialIterableImplENS4_33QSequentialIterableConvertFunctorIS3_EEE7convertEPKNS_25AbstractConverterFunctionEPKvPv@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI5QListI12QPainterPathEN17QtMetaTypePrivate23QSequentialIterableImplENS4_33QSequentialIterableConvertFunctorIS3_EEED1Ev@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI5QListI12QPainterPathEN17QtMetaTypePrivate23QSequentialIterableImplENS4_33QSequentialIterableConvertFunctorIS3_EEED2Ev@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI5QListI5QRectEN17QtMetaTypePrivate23QSequentialIterableImplENS4_33QSequentialIterableConvertFunctorIS3_EEE7convertEPKNS_25AbstractConverterFunctionEPKvPv@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI5QListI5QRectEN17QtMetaTypePrivate23QSequentialIterableImplENS4_33QSequentialIterableConvertFunctorIS3_EEED1Ev@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI5QListI5QRectEN17QtMetaTypePrivate23QSequentialIterableImplENS4_33QSequentialIterableConvertFunctorIS3_EEED2Ev@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI7QVectorIjEN17QtMetaTypePrivate23QSequentialIterableImplENS3_33QSequentialIterableConvertFunctorIS2_EEE7convertEPKNS_25AbstractConverterFunctionEPKvPv@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI7QVectorIjEN17QtMetaTypePrivate23QSequentialIterableImplENS3_33QSequentialIterableConvertFunctorIS2_EEED1Ev@Base 5.2.2-1 _ZN9QtPrivate16ConverterFunctorI7QVectorIjEN17QtMetaTypePrivate23QSequentialIterableImplENS3_33QSequentialIterableConvertFunctorIS2_EEED2Ev@Base 5.2.2-1 _ZN9QtPrivate16StreamStateSaverD1Ev@Base 5.2.2-1 _ZN9QtPrivate16StreamStateSaverD2Ev@Base 5.2.2-1 _ZN9QtPrivate18QFunctorSlotObjectISt5_BindIFMN3Dtk3Gui21DPlatformThemePrivateEFvN8QPalette9ColorRoleERK6QColorEPS4_S6_St12_PlaceholderILi1EEEELi1ENS_4ListIJS7_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.2.2-1 _ZN9QtPrivate18QFunctorSlotObjectISt5_BindIFMN3Dtk3Gui21DPlatformThemePrivateEFvNS3_8DPalette9ColorTypeERK6QColorEPS4_S6_St12_PlaceholderILi1EEEELi1ENS_4ListIJS7_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.2.2-1 _ZN9QtPrivate18QFunctorSlotObjectISt5_BindIFMN3Dtk3Gui28DGuiApplicationHelperPrivateEFvP15QGuiApplicationbEPS4_S6_bEELi1ENS_4ListIJ10QByteArrayEEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.2.2-1 _ZN9QtPrivate18QFunctorSlotObjectISt5_BindIFMN3Dtk3Gui28DGuiApplicationHelperPrivateEFvP15QGuiApplicationbEPS4_S6_bEELi1ENS_4ListIJ6QColorEEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.2.2-1 _ZN9QtPrivate18QFunctorSlotObjectISt5_BindIFMN3Dtk3Gui28DGuiApplicationHelperPrivateEFvP15QGuiApplicationbEPS4_S6_bEELi1ENS_4ListIJNS3_8DPaletteEEEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.2.2-1 _ZN9QtPrivate18QFunctorSlotObjectISt8functionIFvvEELi0ENS_4ListIJEEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.2.2-1 _ZN9QtPrivate23readArrayBasedContainerI5QListI7QStringEEER11QDataStreamS5_RT_@Base 5.2.2-1 _ZN9QtPrivate24writeSequentialContainerI5QListI7QStringEEER11QDataStreamS5_RKT_@Base 5.2.2-1 _ZN9QtPrivate8RefCount3refEv@Base 5.2.2-1 _ZNK34ComDeepinApiXEventMonitorInterface10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui12DSvgRenderer11defaultSizeEv@Base 5.2.2-1 _ZNK3Dtk3Gui12DSvgRenderer13elementExistsERK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui12DSvgRenderer15boundsOnElementERK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui12DSvgRenderer7isValidEv@Base 5.2.2-1 _ZNK3Dtk3Gui12DSvgRenderer7toImageE5QSizeRK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui12DSvgRenderer7viewBoxEv@Base 5.2.2-1 _ZNK3Dtk3Gui12DSvgRenderer8viewBoxFEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DForeignWindow10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DForeignWindow3pidEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DForeignWindow7wmClassEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme10brightTextEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme10buttonTextEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme10darkLivelyEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme10textLivelyEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme10windowTextEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11activeColorEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11cursorBlinkEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11dotsPerInchERK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11frameBorderEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11gtkFontNameEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11lightLivelyEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11linkVisitedEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11parentThemeEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11textWarningEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11toolTipBaseEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme11toolTipTextEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme12fetchPaletteERKNS0_8DPaletteEPb@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme12monoFontNameEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme13alternateBaseEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme13fontPointSizeEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme13iconThemeNameEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme14isValidPaletteEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme14itemBackgroundEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme14soundThemeNameEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme15cursorBlinkTimeEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme15doubleClickTimeEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme15highlightedTextEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme16dndDragThresholdEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme18cursorBlinkTimeoutEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme19doubleClickDistanceEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme3midEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme4baseEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme4darkEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme4linkEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme4textEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme5lightEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme6buttonEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme6shadowEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme6windowEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme7isValidEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme7paletteEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme8fontNameEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme8midlightEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme8textTipsEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme9highlightEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme9textTitleEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DPlatformTheme9themeNameEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor10cursorMoveERK6QPoint@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor10keyReleaseERK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor10registeredEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor11buttonPressERK6QPointi@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor13buttonReleaseERK6QPointi@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor13watchedRegionEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor14coordinateTypeEv@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor21coordinateTypeChangedENS1_14CoordinateTypeE@Base 5.2.2-1 _ZNK3Dtk3Gui14DRegionMonitor8keyPressERK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui15DFileDragClient10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DFileDragClient5stateEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DFileDragClient8progressEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DFileDragServer10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DFileDragServer10targetDataERK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui15DNativeSettings10getSettingERK10QByteArray@Base 5.2.2-1 _ZNK3Dtk3Gui15DNativeSettings10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DNativeSettings7allKeysEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DNativeSettings7isValidEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle11borderColorEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle11borderWidthEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle11shadowColorEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle12frameMarginsEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle12realWindowIdEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle12shadowOffsetEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle12shadowRadiusEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle12windowRadiusEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle16enableBlurWindowEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle16enableSystemMoveEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle18enableSystemResizeEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle21translucentBackgroundEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle23autoInputMaskByClipPathEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle8clipPathEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DPlatformHandle9frameMaskEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DTaskbarControl10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DTaskbarControl14counterVisibleEv@Base 5.2.2-1 _ZNK3Dtk3Gui15DTaskbarControl7counterEv@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider11errorStringEv@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider12hasThumbnailERK9QFileInfo@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider12hasThumbnailERK9QMimeType@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider16defaultSizeLimitEv@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider16thumbnailChangedERK7QStringS4_@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider17thumbnailFilePathERK9QFileInfoNS1_4SizeE@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider21createThumbnailFailedERK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider23createThumbnailFinishedERK7QStringS4_@Base 5.2.2-1 _ZNK3Dtk3Gui18DThumbnailProvider9sizeLimitERK9QMimeType@Base 5.2.2-1 _ZNK3Dtk3Gui18DWindowGroupLeader13groupLeaderIdEv@Base 5.2.2-1 _ZNK3Dtk3Gui18DWindowGroupLeader14clientLeaderIdEv@Base 5.2.2-1 _ZNK3Dtk3Gui19DDndSourceInterface10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui19DSvgRendererPrivate8getImageERK5QSizeRK7QString@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper12hasCompositeEv@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper13hasBlurWindowEv@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper13hasNoTitlebarEv@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper15allWindowIdListEv@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper17windowManagerNameEv@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper23currentWorkspaceWindowsEv@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper23windowManagerNameStringEv@Base 5.2.2-1 _ZNK3Dtk3Gui20DWindowManagerHelper28currentWorkspaceWindowIdListEv@Base 5.2.2-1 _ZNK3Dtk3Gui21DDndClientSignalRelay10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui21DGuiApplicationHelper10metaObjectEv@Base 5.2.2-1 _ZNK3Dtk3Gui21DGuiApplicationHelper11paletteTypeEv@Base 5.2.2-1 _ZNK3Dtk3Gui21DGuiApplicationHelper11systemThemeEv@Base 5.2.2-1 _ZNK3Dtk3Gui21DGuiApplicationHelper11windowThemeEP7QWindow@Base 5.2.2-1 _ZNK3Dtk3Gui21DGuiApplicationHelper13windowPaletteEP7QWindow@Base 5.2.2-1 _ZNK3Dtk3Gui21DGuiApplicationHelper16applicationThemeEv@Base 5.2.2-1 _ZNK3Dtk3Gui21DGuiApplicationHelper18applicationPaletteEv@Base 5.2.2-1 _ZNK3Dtk3Gui21DGuiApplicationHelper9themeTypeEv@Base 5.2.2-1 _ZNK3Dtk3Gui21DRegionMonitorPrivate22deviceScaledCoordinateERK6QPointd@Base 5.2.2-1 _ZNK3Dtk3Gui25DThumbnailProviderPrivate14sizeToFilePathENS0_18DThumbnailProvider4SizeE@Base 5.2.2-1 _ZNK3Dtk3Gui28DGuiApplicationHelperPrivate10initWindowEP7QWindow@Base 5.2.2-1 _ZNK3Dtk3Gui8DPalette5brushEN8QPalette10ColorGroupENS1_9ColorTypeE@Base 5.2.2-1 _ZNK3Dtk3Gui9DFileDrag10metaObjectEv@Base 5.2.2-1 _ZNK5QHashI5QPairI7QStringN3Dtk3Gui18DThumbnailProvider4SizeEE15QHashDummyValueE8findNodeERKS6_Pj@Base 5.2.2-1 _ZNK5QHashI5QPairI7QStringN3Dtk3Gui18DThumbnailProvider4SizeEE15QHashDummyValueE8findNodeERKS6_j@Base 5.2.2-1 _ZNK5QHashI7QString12QWeakPointerI14QDBusInterfaceEE8findNodeERKS0_Pj@Base 5.2.2-1 _ZNK5QHashI7QString12QWeakPointerI14QDBusInterfaceEE8findNodeERKS0_j@Base 5.2.2-1 _ZNK5QHashI7QString15QHashDummyValueE8findNodeERKS0_j@Base 5.2.2-1 _ZNK5QHashI7QStringPN3Dtk3Gui15DFileDragClientEE8findNodeERKS0_Pj@Base 5.2.2-1 _ZNK5QHashI7QStringPN3Dtk3Gui15DFileDragClientEE8findNodeERKS0_j@Base 5.2.2-1 _ZNK5QHashI7QStringPN3Dtk3Gui15DFileDragServerEE8findNodeERKS0_Pj@Base 5.2.2-1 _ZNK5QHashI7QStringPN3Dtk3Gui15DFileDragServerEE8findNodeERKS0_j@Base 5.2.2-1 _ZNK5QHashI7QStringiE8findNodeERKS0_j@Base 5.2.2-1 _ZNK5QHashI9QMimeTypexE8findNodeERKS0_j@Base 5.2.2-1 _ZNK7QWindow4sizeEv@Base 5.2.2-1 _ZNK8QMapDataI7QString8QVariantE8findNodeERKS0_@Base 5.2.2-1 _ZNK8QMapNodeI7QString8QVariantE4copyEP8QMapDataIS0_S1_E@Base 5.2.2-1 _ZNSt8functionIFvRK7QStringEEC1ERKS4_@Base 5.2.2-1 _ZNSt8functionIFvRK7QStringEEC2ERKS4_@Base 5.2.2-1 _ZNSt8functionIFvvEEC1ERKS1_@Base 5.2.2-1 _ZNSt8functionIFvvEEC2ERKS1_@Base 5.2.2-1 _ZTI34ComDeepinApiXEventMonitorInterface@Base 5.2.2-1 _ZTIN29QWindowSystemInterfacePrivate16ThemeChangeEventE@Base 5.2.2-1 _ZTIN29QWindowSystemInterfacePrivate17WindowSystemEventE@Base 5.2.2-1 _ZTIN3Dtk3Gui12DSvgRendererE@Base 5.2.2-1 _ZTIN3Dtk3Gui14DForeignWindowE@Base 5.2.2-1 _ZTIN3Dtk3Gui14DPlatformThemeE@Base 5.2.2-1 _ZTIN3Dtk3Gui14DRegionMonitorE@Base 5.2.2-1 _ZTIN3Dtk3Gui15DFileDragClientE@Base 5.2.2-1 _ZTIN3Dtk3Gui15DFileDragServerE@Base 5.2.2-1 _ZTIN3Dtk3Gui15DNativeSettingsE@Base 5.2.2-1 _ZTIN3Dtk3Gui15DPlatformHandleE@Base 5.2.2-1 _ZTIN3Dtk3Gui15DTaskbarControlE@Base 5.2.2-1 _ZTIN3Dtk3Gui16DFileDragPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui18DThumbnailProviderE@Base 5.2.2-1 _ZTIN3Dtk3Gui19DDndSourceInterfaceE@Base 5.2.2-1 _ZTIN3Dtk3Gui19DSvgRendererPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui20DWindowManagerHelperE@Base 5.2.2-1 _ZTIN3Dtk3Gui21DDndClientSignalRelayE@Base 5.2.2-1 _ZTIN3Dtk3Gui21DForeignWindowPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui21DGuiApplicationHelperE@Base 5.2.2-1 _ZTIN3Dtk3Gui21DPlatformThemePrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui21DRegionMonitorPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui21DWindowManagerHelper_E@Base 5.2.2-1 _ZTIN3Dtk3Gui22DFileDragClientPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui22DFileDragServerPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui22DNativeSettingsPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui22DTaskbarControlPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui25DThumbnailProviderPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui27DWindowManagerHelperPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui28DGuiApplicationHelperPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui29DFileThumbnailProviderPrivateE@Base 5.2.2-1 _ZTIN3Dtk3Gui9DFileDragE@Base 5.2.2-1 _ZTS34ComDeepinApiXEventMonitorInterface@Base 5.2.2-1 _ZTSN29QWindowSystemInterfacePrivate16ThemeChangeEventE@Base 5.2.2-1 _ZTSN29QWindowSystemInterfacePrivate17WindowSystemEventE@Base 5.2.2-1 _ZTSN3Dtk3Gui12DSvgRendererE@Base 5.2.2-1 _ZTSN3Dtk3Gui14DForeignWindowE@Base 5.2.2-1 _ZTSN3Dtk3Gui14DPlatformThemeE@Base 5.2.2-1 _ZTSN3Dtk3Gui14DRegionMonitorE@Base 5.2.2-1 _ZTSN3Dtk3Gui15DFileDragClientE@Base 5.2.2-1 _ZTSN3Dtk3Gui15DFileDragServerE@Base 5.2.2-1 _ZTSN3Dtk3Gui15DNativeSettingsE@Base 5.2.2-1 _ZTSN3Dtk3Gui15DPlatformHandleE@Base 5.2.2-1 _ZTSN3Dtk3Gui15DTaskbarControlE@Base 5.2.2-1 _ZTSN3Dtk3Gui16DFileDragPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui18DThumbnailProviderE@Base 5.2.2-1 _ZTSN3Dtk3Gui19DDndSourceInterfaceE@Base 5.2.2-1 _ZTSN3Dtk3Gui19DSvgRendererPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui20DWindowManagerHelperE@Base 5.2.2-1 _ZTSN3Dtk3Gui21DDndClientSignalRelayE@Base 5.2.2-1 _ZTSN3Dtk3Gui21DForeignWindowPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui21DGuiApplicationHelperE@Base 5.2.2-1 _ZTSN3Dtk3Gui21DPlatformThemePrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui21DRegionMonitorPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui21DWindowManagerHelper_E@Base 5.2.2-1 _ZTSN3Dtk3Gui22DFileDragClientPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui22DFileDragServerPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui22DNativeSettingsPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui22DTaskbarControlPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui25DThumbnailProviderPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui27DWindowManagerHelperPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui28DGuiApplicationHelperPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui29DFileThumbnailProviderPrivateE@Base 5.2.2-1 _ZTSN3Dtk3Gui9DFileDragE@Base 5.2.2-1 _ZTV34ComDeepinApiXEventMonitorInterface@Base 5.2.2-1 _ZTVN29QWindowSystemInterfacePrivate16ThemeChangeEventE@Base 5.2.2-1 _ZTVN3Dtk3Gui12DSvgRendererE@Base 5.2.2-1 _ZTVN3Dtk3Gui14DForeignWindowE@Base 5.2.2-1 _ZTVN3Dtk3Gui14DPlatformThemeE@Base 5.2.2-1 _ZTVN3Dtk3Gui14DRegionMonitorE@Base 5.2.2-1 _ZTVN3Dtk3Gui15DFileDragClientE@Base 5.2.2-1 _ZTVN3Dtk3Gui15DFileDragServerE@Base 5.2.2-1 _ZTVN3Dtk3Gui15DNativeSettingsE@Base 5.2.2-1 _ZTVN3Dtk3Gui15DPlatformHandleE@Base 5.2.2-1 _ZTVN3Dtk3Gui15DTaskbarControlE@Base 5.2.2-1 _ZTVN3Dtk3Gui16DFileDragPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui18DThumbnailProviderE@Base 5.2.2-1 _ZTVN3Dtk3Gui19DDndSourceInterfaceE@Base 5.2.2-1 _ZTVN3Dtk3Gui19DSvgRendererPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui20DWindowManagerHelperE@Base 5.2.2-1 _ZTVN3Dtk3Gui21DDndClientSignalRelayE@Base 5.2.2-1 _ZTVN3Dtk3Gui21DForeignWindowPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui21DGuiApplicationHelperE@Base 5.2.2-1 _ZTVN3Dtk3Gui21DPlatformThemePrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui21DRegionMonitorPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui21DWindowManagerHelper_E@Base 5.2.2-1 _ZTVN3Dtk3Gui22DFileDragClientPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui22DFileDragServerPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui22DNativeSettingsPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui22DTaskbarControlPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui25DThumbnailProviderPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui27DWindowManagerHelperPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui28DGuiApplicationHelperPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui29DFileThumbnailProviderPrivateE@Base 5.2.2-1 _ZTVN3Dtk3Gui9DFileDragE@Base 5.2.2-1 _ZThn16_N3Dtk3Gui12DSvgRendererD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui12DSvgRendererD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui14DForeignWindowD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui14DForeignWindowD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui14DPlatformThemeD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui14DPlatformThemeD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui14DRegionMonitorD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui14DRegionMonitorD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui15DFileDragClientD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui15DFileDragClientD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui15DFileDragServerD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui15DFileDragServerD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui15DNativeSettingsD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui15DNativeSettingsD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui15DTaskbarControlD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui15DTaskbarControlD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui18DThumbnailProviderD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui18DThumbnailProviderD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui20DWindowManagerHelperD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui20DWindowManagerHelperD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui21DGuiApplicationHelperD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui21DGuiApplicationHelperD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui21DWindowManagerHelper_D0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui21DWindowManagerHelper_D1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui29DFileThumbnailProviderPrivateD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui29DFileThumbnailProviderPrivateD1Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui9DFileDragD0Ev@Base 5.2.2-1 _ZThn16_N3Dtk3Gui9DFileDragD1Ev@Base 5.2.2-1 _ZThn16_NK7QWindow4sizeEv@Base 5.2.2-1 _ZThn40_N3Dtk3Gui14DForeignWindowD0Ev@Base 5.2.2-1 _ZThn40_N3Dtk3Gui14DForeignWindowD1Ev@Base 5.2.2-1 _ZZN11QMetaTypeIdI12QPainterPathE14qt_metatype_idEvE11metatype_id@Base 5.2.2-1 _ZZN11QMetaTypeIdI13QDBusArgumentE14qt_metatype_idEvE11metatype_id@Base 5.2.2-1 _ZZN11QMetaTypeIdI5QListI12QPainterPathEE14qt_metatype_idEvE11metatype_id@Base 5.2.2-1 _ZZN11QMetaTypeIdI5QListI5QRectEE14qt_metatype_idEvE11metatype_id@Base 5.2.2-1 _ZZN11QMetaTypeIdI7QVectorIjEE14qt_metatype_idEvE11metatype_id@Base 5.2.2-1 _ZZN11QMetaTypeIdI8QMarginsE14qt_metatype_idEvE11metatype_id@Base 5.2.2-1 _ZZN11QMetaTypeIdIN17QtMetaTypePrivate23QSequentialIterableImplEE14qt_metatype_idEvE11metatype_id@Base 5.2.2-1 _ZZN18QMetaTypeIdQObjectIPN3Dtk3Gui14DPlatformThemeELi8EE14qt_metatype_idEvE11metatype_id@Base 5.2.2-1 _ZZN9QtPrivate19ValueTypeIsMetaTypeI5QListI12QPainterPathELb1EE17registerConverterEiE1f@Base 5.2.2-1 _ZZN9QtPrivate19ValueTypeIsMetaTypeI5QListI5QRectELb1EE17registerConverterEiE1f@Base 5.2.2-1 _ZZN9QtPrivate19ValueTypeIsMetaTypeI7QVectorIjELb1EE17registerConverterEiE1f@Base 5.2.2-1 _ZZZN34ComDeepinApiXEventMonitorInterface12RegisterAreaEiiiiiENKUlvE_clEvE15qstring_literal@Base 5.2.2-1 _ZZZN34ComDeepinApiXEventMonitorInterface13RegisterAreasE5QListI5QRectEiENKUlvE_clEvE15qstring_literal@Base 5.2.2-1 _ZZZN34ComDeepinApiXEventMonitorInterface14UnregisterAreaERK7QStringENKUlvE_clEvE15qstring_literal@Base 5.2.2-1 _ZZZN34ComDeepinApiXEventMonitorInterface18RegisterFullScreenEvENKUlvE_clEvE15qstring_literal@Base 5.2.2-1 _Zls6QDebugRKN3Dtk3Gui15DNativeSettingsE@Base 5.2.2-1 _Zls6QDebugRKN3Dtk3Gui15DPlatformHandle10WMBlurAreaE@Base 5.2.2-1 _ZlsR11QDataStreamRKN3Dtk3Gui8DPaletteE@Base 5.2.2-1 _ZrsR11QDataStreamRN3Dtk3Gui8DPaletteE@Base 5.2.2-1 dtkgui-5.5.25/doc/000077500000000000000000000000001426550353200136515ustar00rootroot00000000000000dtkgui-5.5.25/doc/src/000077500000000000000000000000001426550353200144405ustar00rootroot00000000000000dtkgui-5.5.25/doc/src/dtkgui-index.qdoc000066400000000000000000000021221426550353200177010ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ /*! \page dtkgui-index.html \keyword DTK Gui Reference Documentation \title DTK Gui Docs DtkGui is base devel library of Deepin Qt/C++ applications. \list \li \l {DTK Gui 模块} \li \l {DTK Core Docs} \li \l {DTK Core 模块} \li \l {DTK Widget Docs} \li \l {DTK Widget 模块} \endlist */ dtkgui-5.5.25/doc/src/dtkgui.qdoc000066400000000000000000000016221426550353200166000ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ /*! \module dtkgui \title DTK Gui 模块 \brief Provides core non-GUI functionality. */ dtkgui-5.5.25/dtkgui.pro000066400000000000000000000000161426550353200151120ustar00rootroot00000000000000load(dtk_lib) dtkgui-5.5.25/examples/000077500000000000000000000000001426550353200147225ustar00rootroot00000000000000dtkgui-5.5.25/examples/dnd-example/000077500000000000000000000000001426550353200171205ustar00rootroot00000000000000dtkgui-5.5.25/examples/dnd-example/dnd-example.pro000066400000000000000000000001051426550353200220340ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS = dnd-test-server.pro dnd-test-client.pro dtkgui-5.5.25/examples/dnd-example/dnd-test-client.cpp000066400000000000000000000046551426550353200226340ustar00rootroot00000000000000#include "dfiledragclient.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include DGUI_USE_NAMESPACE static DFileDragClient *c; static QProgressBar *p; class DropArea : public QFrame { Q_OBJECT public: explicit DropArea(QString s) : lb(new QLabel(s, this)) , le(new QLineEdit(this)) { setLayout(new QVBoxLayout); setFrameShape(Shape::Box); layout()->addWidget(lb); layout()->addWidget(le); lb->setAlignment(Qt::AlignmentFlag::AlignCenter); le->setText("/tmp"); le->setPlaceholderText(QString("do not accept drop when edit is empty")); setAcceptDrops(true); } protected: void dragEnterEvent(QDragEnterEvent *e) { if (DFileDragClient::checkMimeData(e->mimeData())) { if (le->text().isEmpty()) e->ignore(); // or e->setDropAction(Qt::IgnoreAction); else e->acceptProposedAction(); DFileDragClient::setTargetUrl(e->mimeData(), QUrl(le->text())); } } void dragMoveEvent(QDragMoveEvent *e) { if (DFileDragClient::checkMimeData(e->mimeData())) { e->acceptProposedAction(); DFileDragClient::setTargetUrl(e->mimeData(), QUrl(le->text())); } } void dropEvent(QDropEvent *e) { if (DFileDragClient::checkMimeData(e->mimeData())) { e->acceptProposedAction(); DFileDragClient::setTargetUrl(e->mimeData(), QUrl(le->text())); c = new DFileDragClient(e->mimeData()); connect(c, &DFileDragClient::progressChanged, p, &QProgressBar::setValue); } } private: QLabel *lb; QLineEdit *le; }; int main(int argc, char **argv) { QApplication a(argc, argv); QDialog d; d.show(); QHBoxLayout *lo = new QHBoxLayout(); lo->addWidget(new DropArea("area 51")); lo->addWidget(new DropArea("area 61")); QScopedPointer pp (new QProgressBar()); p = pp.data(); p->setMinimum(0); p->setMaximum(100); QVBoxLayout *hlo = new QVBoxLayout(); d.setLayout(hlo); hlo->addLayout(lo); hlo->addWidget(p); a.exec(); } #include "dnd-test-client.moc" dtkgui-5.5.25/examples/dnd-example/dnd-test-client.pro000066400000000000000000000011241426550353200226360ustar00rootroot00000000000000TEMPLATE = app QT += dtkcore widgets SOURCES += \ $$PWD/dnd-test-client.cpp DESTDIR = $$_PRO_FILE_PWD_/../../bin win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../src/release -ldtkgui else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../src/debug -ldtkgui else:unix: LIBS += -L$$OUT_PWD/../../src -ldtkgui INCLUDEPATH += $$PWD/../../src \ $$PWD/../../src/filedrag CONFIG(debug, debug|release) { unix:QMAKE_RPATHDIR += $$OUT_PWD/../../src } DTK_MODULE_NAME=dtkgui load(dtk_build_config) target.path = $$TOOL_INSTALL_DIR INSTALLS += target dtkgui-5.5.25/examples/dnd-example/dnd-test-server.cpp000066400000000000000000000045751426550353200226650ustar00rootroot00000000000000#include "dfiledragserver.h" #include "dfiledrag.h" #include #include #include #include #include #include #include #include #include DGUI_USE_NAMESPACE static int p; static DFileDragServer *s = nullptr; static QLabel *lbr = nullptr; class DraggableLabel : public QLabel { Q_OBJECT public: using QLabel::QLabel; Q_SIGNALS: void dragFinished(); protected: void mousePressEvent(QMouseEvent *e) { if (e->button() == Qt::MouseButton::LeftButton) { dragpos = e->pos(); } } void mouseMoveEvent(QMouseEvent *e) { if (!(e->buttons() & Qt::MouseButton::LeftButton) || s) { return; } if ((e->pos() - dragpos).manhattanLength() < QApplication::startDragDistance()) { return; } s = new DFileDragServer(); DFileDrag *drag = new DFileDrag(this, s); QMimeData *m = new QMimeData(); m->setText("your stuff here"); drag->setMimeData(m); connect(drag, &DFileDrag::targetUrlChanged, [drag] { lbr->setText(drag->targetUrl().toString()); }); Qt::DropAction res = drag->exec(Qt::MoveAction); if (res!= Qt::IgnoreAction) Q_EMIT dragFinished(); else { s->deleteLater(); s = nullptr; } } private: QPoint dragpos; }; int main(int argc, char **argv) { QApplication a(argc, argv); QDialog d; d.show(); DraggableLabel l("Drag me", &d); l.setAlignment(Qt::AlignCenter); QTimer t; t.setInterval(50); t.setSingleShot(false); QProgressBar pg; pg.setMinimum(0); pg.setMaximum(100); QLabel lb; lbr = &lb; lb.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QObject::connect(&l, &DraggableLabel::dragFinished, [&t] { p = -1; t.start(); }); QObject::connect(&t, &QTimer::timeout, [&t, &pg] { if (qrand() & 1) { s->setProgress(++p); pg.setValue(p); if(p == 100) { t.stop(); s->deleteLater(); s = nullptr; } } }); QVBoxLayout lo; lo.addWidget(&l); lo.addWidget(&pg); lo.addWidget(&lb); d.setLayout(&lo); a.exec(); } #include "dnd-test-server.moc" dtkgui-5.5.25/examples/dnd-example/dnd-test-server.pro000066400000000000000000000011241426550353200226660ustar00rootroot00000000000000TEMPLATE = app QT += dtkcore widgets SOURCES += \ $$PWD/dnd-test-server.cpp DESTDIR = $$_PRO_FILE_PWD_/../../bin win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../src/release -ldtkgui else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../src/debug -ldtkgui else:unix: LIBS += -L$$OUT_PWD/../../src -ldtkgui INCLUDEPATH += $$PWD/../../src \ $$PWD/../../src/filedrag CONFIG(debug, debug|release) { unix:QMAKE_RPATHDIR += $$OUT_PWD/../../src } DTK_MODULE_NAME=dtkgui load(dtk_build_config) target.path = $$TOOL_INSTALL_DIR INSTALLS += target dtkgui-5.5.25/examples/examples.pro000066400000000000000000000001041426550353200172550ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += dnd-example #SUBDIRS += test-taskbar dtkgui-5.5.25/examples/test-taskbar/000077500000000000000000000000001426550353200173265ustar00rootroot00000000000000dtkgui-5.5.25/examples/test-taskbar/main.cpp000066400000000000000000000027001426550353200207550ustar00rootroot00000000000000#include #include #include #include #include "testtaskbarwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); auto name = QUuid::createUuid().toString() + QStringLiteral(".desktop"); a.setDesktopFileName(name); QDir appDir = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation); QFile desktopFile(appDir.absoluteFilePath(name)); if(!desktopFile.exists()) { desktopFile.open(QIODevice::WriteOnly); desktopFile.write("[Desktop Entry]\n"); desktopFile.write("Type=Application\n"); desktopFile.write("Version=1.1\n"); desktopFile.write("Name=" + QApplication::applicationDisplayName().toUtf8() + "\n"); desktopFile.write("Exec=" + QApplication::applicationFilePath().toUtf8() + "\n"); desktopFile.close(); } TestTaskbarWindow *pTaskbarWindow = new TestTaskbarWindow; pTaskbarWindow->showMaximized(); //这里删除用于测试的desktop文件 QObject::connect(pTaskbarWindow, &TestTaskbarWindow::closeWindow, [&desktopFile] { QFile::remove(desktopFile.fileName()); }); //控制中心修改字体大小可以看到打印输出 QObject::connect(DGuiApplicationHelper::instance()->fontManager(), &DFontManager::fontChanged, [] { qDebug() << DGuiApplicationHelper::instance()->fontManager()->baseFont(); }); return a.exec(); } dtkgui-5.5.25/examples/test-taskbar/taskbar.pro000066400000000000000000000013101426550353200214720ustar00rootroot00000000000000QT += dtkcore gui widgets TARGET = taskbar TEMPLATE = app CONFIG += c++11 SOURCES += \ main.cpp \ testtaskbarwindow.cpp HEADERS += \ testtaskbarwindow.h DESTDIR = $$_PRO_FILE_PWD_/../../bin win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../src/release -ldtkgui else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../src/debug -ldtkgui else:unix: LIBS += -L$$OUT_PWD/../../src -ldtkgui INCLUDEPATH += \ $$PWD/../../src \ $$PWD/../../src/kernel \ $$PWD/../../src/util CONFIG(debug, debug|release) { unix:QMAKE_RPATHDIR += $$OUT_PWD/../../src } DTK_MODULE_NAME=dtkgui load(dtk_build_config) target.path = $$TOOL_INSTALL_DIR INSTALLS += target dtkgui-5.5.25/examples/test-taskbar/test-taskbar.pro000066400000000000000000000000521426550353200224510ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS = taskbar.pro dtkgui-5.5.25/examples/test-taskbar/testtaskbarwindow.cpp000066400000000000000000000063161426550353200236170ustar00rootroot00000000000000/* * Copyright (C) 2019~ 2020 Deepin Technology Co., Ltd. * * Author: sunkang * * Maintainer: sunkang * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "testtaskbarwindow.h" #include #include #include TestTaskbarWindow::TestTaskbarWindow(QWidget *parent) : QWidget(parent) { QHBoxLayout *pHBoxLayout_1 = new QHBoxLayout; m_pProgressBox = new QCheckBox("progress"); m_pProgress = new QSlider(Qt::Horizontal); m_pProgress->setRange(0, 100); m_pProgress->setMinimumWidth(300); pHBoxLayout_1->addWidget(m_pProgressBox); pHBoxLayout_1->addWidget(m_pProgress); QHBoxLayout *pHBoxLayout_2 = new QHBoxLayout; m_pCounterBox = new QCheckBox("counter"); m_pNumEdit = new QLineEdit; m_pNumEdit->setMinimumWidth(300); m_pNumEdit->setValidator(new QIntValidator); pHBoxLayout_2->addWidget(m_pCounterBox); pHBoxLayout_2->addWidget(m_pNumEdit); m_pUrgencyBox= new QCheckBox("test urgency"); QHBoxLayout *pHBoxLayout_3 = new QHBoxLayout; pHBoxLayout_3->addWidget(m_pUrgencyBox); QVBoxLayout *pVBoxLayout = new QVBoxLayout; setLayout(pVBoxLayout); pVBoxLayout->addStretch(); pVBoxLayout->addLayout(pHBoxLayout_1); pVBoxLayout->addSpacing(30); pVBoxLayout->addLayout(pHBoxLayout_2); pVBoxLayout->addSpacing(50); pVBoxLayout->addLayout(pHBoxLayout_3); pVBoxLayout->addStretch(); m_pTaskbarControl = new DTaskbarControl(this); m_pTaskbarControl->setProgress(false, 0); m_pTaskbarControl->setCounter(false, 0); connect(m_pProgressBox, &QCheckBox::stateChanged, this, [this] (int state) { m_pTaskbarControl->setProgress(state == Qt::Checked, static_cast(m_pProgress->value()) / 100); }); connect(m_pCounterBox, &QCheckBox::stateChanged, this, [this] (int state) { m_pTaskbarControl->setCounterVisible(state == Qt::Checked); }); connect(m_pProgress, &QSlider::valueChanged, this, [this] (int value) { m_pTaskbarControl->setProgress(m_pProgressBox->checkState() == Qt::Checked, static_cast(value) / 100); }); connect(m_pNumEdit, &QLineEdit::textChanged, [this] (const QString &str) { m_pTaskbarControl->setCounter(m_pCounterBox->checkState() == Qt::Checked, str.toInt()); }); connect(m_pUrgencyBox, &QCheckBox::stateChanged, this, [this] (int state) { m_pTaskbarControl->setUrgency(state == Qt::Checked); }); } TestTaskbarWindow::~TestTaskbarWindow() { } void TestTaskbarWindow::closeEvent(QCloseEvent *event) { Q_EMIT closeWindow(); event->accept(); } dtkgui-5.5.25/examples/test-taskbar/testtaskbarwindow.h000066400000000000000000000031661426550353200232640ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. * * Author: sunkang * * Maintainer: sunkang * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef TESTTASKBARWINDOW_H #define TESTTASKBARWINDOW_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include "dtaskbarcontrol.h" DGUI_USE_NAMESPACE class TestTaskbarWindow : public QWidget { Q_OBJECT public: explicit TestTaskbarWindow(QWidget *parent = nullptr); ~TestTaskbarWindow(); protected: void closeEvent(QCloseEvent *event); Q_SIGNALS: void closeWindow(); private: DTaskbarControl *m_pTaskbarControl; QCheckBox *m_pProgressBox; QCheckBox *m_pCounterBox; QLineEdit *m_pNumEdit; QSlider *m_pProgress; QCheckBox *m_pUrgencyBox; }; #endif // TESTTASKBARWINDOW_H dtkgui-5.5.25/rpm/000077500000000000000000000000001426550353200137025ustar00rootroot00000000000000dtkgui-5.5.25/rpm/dtkgui.spec000066400000000000000000000035261426550353200160530ustar00rootroot00000000000000Name: dtkgui Version: 5.5.17 Release: 1%{?dist} Summary: Deepin dtkgui License: LGPLv3+ URL: https://github.com/linuxdeepin/dtkgui %if 0%{?fedora} Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz %else Source0: %{name}-%{version}.orig.tar.xz %endif BuildRequires: qt5-qtx11extras-devel BuildRequires: dtkcommon-devel BuildRequires: dtkcore-devel BuildRequires: librsvg2-devel BuildRequires: gtest-devel BuildRequires: gcc-c++ BuildRequires: annobin BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(gsettings-qt) BuildRequires: pkgconfig(gmock) %if 0%{?fedora} BuildRequires: qt5-qtbase-private-devel %{?_qt5:Requires: %{_qt5}%{?_isa} = %{_qt5_version}} %endif BuildRequires: make %description Dtkgui is the GUI module for DDE look and feel. %package devel Summary: Development package for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: dtkcore-devel%{?_isa} %description devel Header files and libraries for %{name}. %prep %autosetup %build # help find (and prefer) qt5 utilities, e.g. qmake, lrelease export PATH=%{_qt5_bindir}:$PATH %qmake_qt5 PREFIX=%{_prefix} \ DTK_VERSION=%{version} \ LIB_INSTALL_DIR=%{_libdir} \ BIN_INSTALL_DIR=%{_libexecdir}/dtk5 \ TOOL_INSTALL_DIR=%{_libexecdir}/dtk5 %make_build %install %make_install INSTALL_ROOT=%{buildroot} %files %doc README.md %license LICENSE %{_libdir}/lib%{name}.so.5* %{_libexecdir}/dtk5/deepin-gui-settings %{_libexecdir}/dtk5/taskbar %{_libexecdir}/dtk5/dde-kwin-debug %files devel %{_includedir}/libdtk-*/ %{_libdir}/pkgconfig/dtkgui.pc %{_qt5_archdatadir}/mkspecs/modules/qt_lib_dtkgui.pri %{_libdir}/cmake/DtkGui/ %{_libdir}/lib%{name}.so %changelog * Thu Jun 09 2020 uoser - 5.2.2.1-1 - Update to 5.2.2.1 dtkgui-5.5.25/src/000077500000000000000000000000001426550353200136735ustar00rootroot00000000000000dtkgui-5.5.25/src/dbus/000077500000000000000000000000001426550353200146305ustar00rootroot00000000000000dtkgui-5.5.25/src/dbus/arealist.h000066400000000000000000000021771426550353200166140ustar00rootroot00000000000000/* * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. * * Author: sbw * kirigaya * Hualet * * Maintainer: sbw * kirigaya * Hualet * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef AREALIST_H #define AREALIST_H #include #include #include typedef QList AreaList; void registerAreaListMetaType(); #endif // AREALIST_H dtkgui-5.5.25/src/dbus/com.deepin.api.XEventMonitor.xml000066400000000000000000000030421426550353200227220ustar00rootroot00000000000000 dtkgui-5.5.25/src/dtkgui_global.h000066400000000000000000000022141426550353200166520ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DTKGUI_GLOBAL_H #define DTKGUI_GLOBAL_H #pragma once #include #define DGUI_NAMESPACE Gui #define DTK_GUI_NAMESPACE DTK_NAMESPACE::Gui #define DGUI_BEGIN_NAMESPACE namespace DTK_NAMESPACE { namespace DGUI_NAMESPACE { #define DGUI_END_NAMESPACE }} #define DGUI_USE_NAMESPACE using namespace DTK_GUI_NAMESPACE; #endif // DTKGUI_GLOBAL_H dtkgui-5.5.25/src/filedrag/000077500000000000000000000000001426550353200154505ustar00rootroot00000000000000dtkgui-5.5.25/src/filedrag/DFileDrag000066400000000000000000000000271426550353200171530ustar00rootroot00000000000000#include "dfiledrag.h" dtkgui-5.5.25/src/filedrag/DFileDragClient000066400000000000000000000000351426550353200203110ustar00rootroot00000000000000#include "dfiledragclient.h" dtkgui-5.5.25/src/filedrag/DFileDragServer000066400000000000000000000000351426550353200203410ustar00rootroot00000000000000#include "dfiledragserver.h" dtkgui-5.5.25/src/filedrag/dfiledrag.cpp000066400000000000000000000050401426550353200200740ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: Chris Xiong * * Maintainer: Chris Xiong * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dfiledrag.h" #include "dfiledragserver.h" #include "private/dfiledragcommon_p.h" #include "private/dfiledragserver_p.h" #include #include DGUI_BEGIN_NAMESPACE class DFileDragPrivate : DCORE_NAMESPACE::DObjectPrivate { DFileDragPrivate(DFileDrag *q, DFileDragServer *_srv) : DObjectPrivate(q) , srv(_srv) {} DFileDragServer *srv; D_DECLARE_PUBLIC(DFileDrag) }; /*! \class Dtk::Gui::DFileDrag \inmodule dtkgui \brief 继承自QDrag,一般在文件拖拽发送方 mouseMoveEvent 中发起拖拽,设置发送数据 和 DFileDragServer 配合使用. \sa Dtk::Gui::DFileDragServer */ /*! \fn void DFileDrag::targetUrlChanged(QUrl url) \brief 信号会在接收方调用 setTargetUrl 时被发送. 可以用于获取被拖拽至的目标目录 \a url 发生改变的目标链接. */ DFileDrag::DFileDrag(QObject *source, DFileDragServer *server) : QDrag(source) , DObject(*new DFileDragPrivate(this, server)) { Q_D(DFileDrag); connect(d->srv, &DFileDragServer::targetDataChanged, this, [this, d](const QString &key) { if (key == DND_TARGET_URL_KEY) { Q_EMIT this->targetUrlChanged(QUrl(d->srv->targetData(key).value())); } }); } /*! \brief DFileDrag::targetUrl \return 返回拖拽文件接收方设置的接收路径 */ QUrl DFileDrag::targetUrl() { Q_D(DFileDrag); return QUrl(d->srv->targetData(DND_TARGET_URL_KEY).value()); } /*! \brief DFileDrag::setMimeData \a data \brief 发起拖拽文件前设置发送数据接口 */ void DFileDrag::setMimeData(QMimeData *data) { Q_D(DFileDrag); d->srv->d_func()->writeMimeData(data); QDrag::setMimeData(data); } DGUI_END_NAMESPACE dtkgui-5.5.25/src/filedrag/dfiledrag.h000066400000000000000000000025251426550353200175460ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: Chris Xiong * * Maintainer: Chris Xiong * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DFILEDRAG_H #define DFILEDRAG_H #include #include #include #include DGUI_BEGIN_NAMESPACE class DFileDragServer; class DFileDragPrivate; class DFileDrag : public QDrag, public DCORE_NAMESPACE::DObject { Q_OBJECT public: explicit DFileDrag(QObject *source, DFileDragServer *server); QUrl targetUrl(); void setMimeData(QMimeData *data); Q_SIGNALS: void targetUrlChanged(QUrl url); private: D_DECLARE_PRIVATE(DFileDrag) }; DGUI_END_NAMESPACE #endif // DFILEDRAG_H dtkgui-5.5.25/src/filedrag/dfiledragclient.cpp000066400000000000000000000171631426550353200213040ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: Chris Xiong * * Maintainer: Chris Xiong * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dfiledragclient.h" #include "private/dfiledragcommon_p.h" #include #include #include #include #include #include #include #include #include DGUI_BEGIN_NAMESPACE class DDndClientSignalRelay : public QObject { Q_OBJECT public Q_SLOTS: void progressChanged(QString uuid, int progress); void stateChanged(QString uuid, int state); void serverDestroyed(QString uuid); private: static QWeakPointer relayref; friend class DFileDragClient; }; class DFileDragClientPrivate : DCORE_NAMESPACE::DObjectPrivate { explicit DFileDragClientPrivate(DFileDragClient *q) : DCORE_NAMESPACE::DObjectPrivate(q) {} QUuid uuid; QString service; QSharedPointer iface; QSharedPointer relay; static QHash connectionmap; static QHash> ifacemap; D_DECLARE_PUBLIC(DFileDragClient) friend class DDndClientSignalRelay; }; QHash DFileDragClientPrivate::connectionmap; QHash> DFileDragClientPrivate::ifacemap; QWeakPointer DDndClientSignalRelay::relayref; void DDndClientSignalRelay::progressChanged(QString uuid, int progress) { if (DFileDragClientPrivate::connectionmap.contains(uuid)) { Q_EMIT DFileDragClientPrivate::connectionmap[uuid]->progressChanged(progress); } } void DDndClientSignalRelay::stateChanged(QString uuid, int state) { if (DFileDragClientPrivate::connectionmap.contains(uuid)) { Q_EMIT DFileDragClientPrivate::connectionmap[uuid]->stateChanged(static_cast(state)); } } void DDndClientSignalRelay::serverDestroyed(QString uuid) { if (DFileDragClientPrivate::connectionmap.contains(uuid)) { DFileDragClientPrivate::connectionmap[uuid]->deleteLater(); DFileDragClientPrivate::connectionmap.remove(uuid); } } /*! \class Dtk::Gui::DFileDragClient \inmodule dtkgui \brief 提供拖拽文件时与文件发送方交互的接口. */ /*! \fn void DFileDragClient::progressChanged(int progress) \a progress 当前进度 \brief 信号会在当前进度变化时被发送. */ /*! \fn void DFileDragClient::stateChanged(DFileDragState state) \a state 改变后的新状态 \brief 信号会在当前状态变化时被发送. */ /*! \fn void DFileDragClient::serverDestroyed() \brief 信号会在发送方析构销毁前被发送. \note DFileDragClient 收到后会自删除(deletelater),因此不用去管理 new 出来的 DFileDragClient */ DFileDragClient::DFileDragClient(const QMimeData *data, QObject *parent) : QObject(parent) , DCORE_NAMESPACE::DObject(*new DFileDragClientPrivate(this)) { D_D(DFileDragClient); Q_ASSERT(checkMimeData(data)); d->service = data->data(DND_MIME_SERVICE); d->uuid = QUuid(data->data(DND_MIME_UUID)); d->connectionmap[d->uuid.toString()] = this; if (DDndClientSignalRelay::relayref.isNull()) { d->relay = QSharedPointer(new DDndClientSignalRelay); DDndClientSignalRelay::relayref = d->relay.toWeakRef(); } else { d->relay = DDndClientSignalRelay::relayref.toStrongRef(); } if (!DFileDragClientPrivate::ifacemap.contains(d->service)) { QDBusConnection sessionBus(QDBusConnection::sessionBus()); d->iface = QSharedPointer(new QDBusInterface(d->service, DND_OBJPATH, DND_INTERFACE, sessionBus), [d](QDBusInterface* intf){ QDBusConnection sessionBus(QDBusConnection::sessionBus()); sessionBus.disconnect(d->service, DND_OBJPATH, DND_INTERFACE, "progressChanged", "si", d->relay.data(), SLOT(progressChanged(QString, int))); sessionBus.disconnect(d->service, DND_OBJPATH, DND_INTERFACE, "stateChanged", "si", d->relay.data(), SLOT(stateChanged(QString, int))); sessionBus.disconnect(d->service, DND_OBJPATH, DND_INTERFACE, "serverDestroyed", "s", d->relay.data(), SLOT(serverDestroyed(QString))); intf->deleteLater(); DFileDragClientPrivate::ifacemap.remove(d->service); }); DFileDragClientPrivate::ifacemap[d->service] = d->iface.toWeakRef(); sessionBus.connect(d->service, DND_OBJPATH, DND_INTERFACE, "progressChanged", "si", d->relay.data(), SLOT(progressChanged(QString, int))); sessionBus.connect(d->service, DND_OBJPATH, DND_INTERFACE, "stateChanged", "si", d->relay.data(), SLOT(stateChanged(QString, int))); sessionBus.connect(d->service, DND_OBJPATH, DND_INTERFACE, "serverDestroyed", "s", d->relay.data(), SLOT(serverDestroyed(QString))); } else { d->iface = DFileDragClientPrivate::ifacemap[d->service].toStrongRef(); } } /*! \brief DFileDragClient::progress \return 返回当前拖拽的进度 */ int DFileDragClient::progress() const { D_D(const DFileDragClient); return QDBusReply(d->iface->call("progress", d->uuid.toString())).value(); } /*! \brief DFileDragClient::state \return 返回当前状态,见 DFileDragState */ DFileDragState DFileDragClient::state() const { D_D(const DFileDragClient); return static_cast(QDBusReply(d->iface->call("state", d->uuid.toString())).value()); } /*! \brief DFileDragClient::checkMimeData \a data \return 包含 DND_MIME_PID 格式的数据时返回 true,否则返回 false \note 通常在接收拖放数据的应用的dropEvent(QDropEvent *event)函数中检测当前 event->mimeData() 是否是 DFileDrag */ bool DFileDragClient::checkMimeData(const QMimeData *data) { return data->hasFormat(DND_MIME_SERVICE) && data->hasFormat(DND_MIME_PID); } /*! \brief DFileDragClient::setTargetData \a data 拖放时传入的data,用于获取和发送数据的应用dbus通讯需要的一些信息 \a key \a value \note 向文件发送方设置自定义数据 */ void DFileDragClient::setTargetData(const QMimeData *data, QString key, QVariant value) { Q_ASSERT(checkMimeData(data)); QString service(data->data(DND_MIME_SERVICE)); QString uuid(data->data(DND_MIME_UUID)); QDBusInterface iface(service, DND_OBJPATH, DND_INTERFACE, QDBusConnection::sessionBus()); QDBusReply pid = QDBusConnection::sessionBus().interface()->servicePid(service); if (QString::number(pid).toUtf8() != data->data(DND_MIME_PID)) { return; } iface.call("setData", uuid, key, value.toString()); } /*! \brief DFileDragClient::setTargetUrl \a data \a url \note 告知文件发送方拖拽目标路径 */ void DFileDragClient::setTargetUrl(const QMimeData *data, QUrl url) { setTargetData(data, DND_TARGET_URL_KEY, QVariant::fromValue(url.toString())); } DGUI_END_NAMESPACE #include "dfiledragclient.moc" dtkgui-5.5.25/src/filedrag/dfiledragclient.h000066400000000000000000000032551426550353200207460ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: Chris Xiong * * Maintainer: Chris Xiong * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DFILEDRAGCLIENT_H #define DFILEDRAGCLIENT_H #include "dfiledragcommon.h" #include #include #include class QMimeData; DGUI_BEGIN_NAMESPACE class DFileDragClientPrivate; class DFileDragClient : public QObject, public DCORE_NAMESPACE::DObject { Q_OBJECT public: explicit DFileDragClient(const QMimeData *data, QObject *parent = nullptr); int progress() const; DFileDragState state() const; Q_SIGNALS: void progressChanged(int progress); void stateChanged(DFileDragState state); void serverDestroyed(); public: static bool checkMimeData(const QMimeData *data); static void setTargetData(const QMimeData *data, QString key, QVariant value); static void setTargetUrl(const QMimeData *data, QUrl url); private: D_DECLARE_PRIVATE(DFileDragClient) }; DGUI_END_NAMESPACE #endif // DFILEDRAGCLIENT_H dtkgui-5.5.25/src/filedrag/dfiledragcommon.h000066400000000000000000000004161426550353200207540ustar00rootroot00000000000000#ifndef DFILEDRAGCOMMON_H #define DFILEDRAGCOMMON_H #include DGUI_BEGIN_NAMESPACE enum DFileDragState { Failed = -1, Stalled, Paused, Running, Finished, CustomState = 0x100 }; DGUI_END_NAMESPACE #endif // DFILEDRAGCOMMON_H dtkgui-5.5.25/src/filedrag/dfiledragserver.cpp000066400000000000000000000131021426550353200213210ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: Chris Xiong * * Maintainer: Chris Xiong * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dfiledragserver.h" #include "private/dfiledragcommon_p.h" #include #include #include #include #include #include #include #include #include DGUI_BEGIN_NAMESPACE class DDndSourceInterface; class DFileDragServerPrivate : public DCORE_NAMESPACE::DObjectPrivate { QMap data; QUuid uuid; explicit DFileDragServerPrivate(DFileDragServer *q); ~DFileDragServerPrivate(); void writeMimeData(QMimeData *dest); QSharedPointer dbusif; static QHash servermap; static QWeakPointer dbusifinst; D_DECLARE_PUBLIC(DFileDragServer) friend class DDndSourceInterface; }; QWeakPointer DFileDragServerPrivate::dbusifinst; QHash DFileDragServerPrivate::servermap; class DDndSourceInterface : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", DND_INTERFACE) public: explicit DDndSourceInterface(QObject *parent = nullptr) : QObject(parent) {} Q_SIGNALS: void serverDestroyed(QString uuid); void stateChanged(QString uuid, int state); void progressChanged(QString uuid, int progress); public Q_SLOTS: void setData(QString uuid, QString key, QString value) { DFileDragServer *srv = DFileDragServerPrivate::servermap.value(uuid); Q_ASSERT(srv); DFileDragServerPrivate *d = srv->d_func(); if (d->data.value(key) != value) { d->data[key] = value; Q_EMIT srv->targetDataChanged(key); } } int state(QString uuid) const {return m_statemap.value(uuid);} int progress(QString uuid) const {return m_progressmap.value(uuid);} private: QHash m_statemap; QHash m_progressmap; friend class DFileDragServer; }; /*! \class Dtk::Gui::DFileDragServer \inmodule dtkgui \brief 提供拖拽文件时与文件接收方交互的接口. */ /*! \fn void DFileDragServer::targetDataChanged(const QString &key) \brief 信号会在接收方调用 setData 变化时被发送, \a key 为改变的键值. */ DFileDragServer::DFileDragServer(QObject *parent) : QObject(parent) , DCORE_NAMESPACE::DObject(*new DFileDragServerPrivate(this)) { D_D(DFileDragServer); DFileDragServerPrivate::servermap[d->uuid.toString()] = this; } DFileDragServer::~DFileDragServer() { D_D(DFileDragServer); DFileDragServerPrivate::servermap.remove(d->uuid.toString()); } /*! \brief DFileDragServer::targetData. \a key \return 返回文件接收方设置数据 \a key 对应的 value */ QVariant DFileDragServer::targetData(const QString &key) const { D_D(const DFileDragServer); return d->data.value(key); } /*! \brief DFileDragServer::setProgress. \a progress 当前进度 \brief 拖拽进度更新,接收方会受到 progressChanged 信号. */ void DFileDragServer::setProgress(int progress) { D_D(DFileDragServer); if (d->dbusif && progress != d->dbusif->m_progressmap.value(d->uuid.toString())) { d->dbusif->m_progressmap[d->uuid.toString()] = progress; Q_EMIT d->dbusif->progressChanged(d->uuid.toString(), progress); } } /*! \brief DFileDragServer::setState. \a state \brief 改变状态,接收方会受到 stateChanged 信号. */ void DFileDragServer::setState(DFileDragState state) { D_D(DFileDragServer); if (d->dbusif && state != d->dbusif->m_statemap.value(d->uuid.toString())) { d->dbusif->m_statemap[d->uuid.toString()] = state; Q_EMIT d->dbusif->stateChanged(d->uuid.toString(), state); } } DFileDragServerPrivate::DFileDragServerPrivate(DFileDragServer *q) : DCORE_NAMESPACE::DObjectPrivate(q) , uuid(QUuid::createUuid()) { if (dbusifinst.isNull()) { dbusif = QSharedPointer(new DDndSourceInterface(), [](DDndSourceInterface *intf){ QDBusConnection::sessionBus().unregisterObject(DND_OBJPATH); intf->deleteLater(); }); dbusifinst = dbusif.toWeakRef(); QDBusConnection::sessionBus().registerObject(DND_OBJPATH, DND_INTERFACE, dbusif.data(), QDBusConnection::RegisterOption::ExportAllContents); } else { dbusif = dbusifinst.toStrongRef(); } } DFileDragServerPrivate::~DFileDragServerPrivate() { Q_EMIT dbusif->serverDestroyed(uuid.toString()); } void DFileDragServerPrivate::writeMimeData(QMimeData *dest) { dest->setData(DND_MIME_SERVICE, QDBusConnection::sessionBus().baseService().toUtf8()); dest->setData(DND_MIME_PID, QString::number(QCoreApplication::applicationPid()).toUtf8()); dest->setData(DND_MIME_UUID, uuid.toString().toUtf8()); } DGUI_END_NAMESPACE #include "dfiledragserver.moc" dtkgui-5.5.25/src/filedrag/dfiledragserver.h000066400000000000000000000030641426550353200207740ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: Chris Xiong * * Maintainer: Chris Xiong * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DFILEDRAGSERVER_H #define DFILEDRAGSERVER_H #include "dfiledragcommon.h" #include #include #include class QMimeData; DGUI_BEGIN_NAMESPACE class DFileDragServerPrivate; class DFileDragServer : public QObject, public DCORE_NAMESPACE::DObject { Q_OBJECT public: explicit DFileDragServer(QObject *parent = nullptr); ~DFileDragServer(); QVariant targetData(const QString &key) const; public Q_SLOTS: void setProgress(int progress); void setState(DFileDragState state); Q_SIGNALS: void targetDataChanged(const QString &key); private: D_DECLARE_PRIVATE(DFileDragServer) friend class DDndSourceInterface; friend class DFileDrag; }; DGUI_END_NAMESPACE #endif // DFILEDRAGSERVER_H dtkgui-5.5.25/src/filedrag/filedrag.pri000066400000000000000000000003441426550353200177420ustar00rootroot00000000000000 HEADERS += \ $$PWD/dfiledrag.h \ $$PWD/dfiledragclient.h \ $$PWD/dfiledragcommon.h \ $$PWD/dfiledragserver.h SOURCES += \ $$PWD/dfiledrag.cpp \ $$PWD/dfiledragclient.cpp \ $$PWD/dfiledragserver.cpp dtkgui-5.5.25/src/kernel/000077500000000000000000000000001426550353200151535ustar00rootroot00000000000000dtkgui-5.5.25/src/kernel/DForeignWindow000066400000000000000000000000341426550353200177600ustar00rootroot00000000000000#include "dforeignwindow.h" dtkgui-5.5.25/src/kernel/DGuiApplicationHelper000066400000000000000000000000431426550353200212470ustar00rootroot00000000000000#include "dguiapplicationhelper.h" dtkgui-5.5.25/src/kernel/DNativeSettings000066400000000000000000000000351426550353200201470ustar00rootroot00000000000000#include "dnativesettings.h" dtkgui-5.5.25/src/kernel/DPalette000066400000000000000000000000261426550353200165760ustar00rootroot00000000000000#include "dpalette.h" dtkgui-5.5.25/src/kernel/DPlatformHandle000066400000000000000000000000351426550353200201000ustar00rootroot00000000000000#include "dplatformhandle.h" dtkgui-5.5.25/src/kernel/DPlatformTheme000066400000000000000000000000341426550353200177460ustar00rootroot00000000000000#include "dplatformtheme.h" dtkgui-5.5.25/src/kernel/DRegionMonitor000066400000000000000000000000341426550353200177720ustar00rootroot00000000000000#include "dregionmonitor.h" dtkgui-5.5.25/src/kernel/DWindowGroupLeader000066400000000000000000000000401426550353200205750ustar00rootroot00000000000000#include "dwindowgroupleader.h" dtkgui-5.5.25/src/kernel/DWindowManagerHelper000066400000000000000000000000421426550353200211000ustar00rootroot00000000000000#include "dwindowmanagerhelper.h" dtkgui-5.5.25/src/kernel/dforeignwindow.cpp000066400000000000000000000127251426550353200207130ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dforeignwindow.h" #include #include #include #include #include #include DGUI_BEGIN_NAMESPACE #define DEFINE_CONST_CHAR(Name) const char _##Name[] = "_d_" #Name // propertys DEFINE_CONST_CHAR(WmClass); DEFINE_CONST_CHAR(ProcessId); class DForeignWindowPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate { public: explicit DForeignWindowPrivate(DForeignWindow *qq) : DObjectPrivate(qq) {} }; /*! \class Dtk::Gui::DForeignWindow \inmodule dtkgui \brief 一个用于获取本地窗口信息的类. 继承于 QWindow,支持 QWindow::geometry QWindow::x QWindow::y QWindow::width QWindow::height QWindow::title QWindow::flags QWindow::visibility QWindow::type QWindow::windowStates QWindow::windowState 等接口的使用,另外扩展 增加了一部分接口,方面更加详细的获取窗口信息。依赖于 dxcb 插件,在未加载 dxcb 插件的应用中使用时结果未知 \sa DWindowManagerHelper::currentWorkspaceWindows \sa Dtk::Widget::DApplication::loadDXcbPlugin \sa Dtk::Widget::DApplication::isDXcbPlatform */ /*! \property DForeignWindow::wmClass \brief 窗口 WM_CLASS 的值 \note 只读 \l {https://tronche.com/gui/x/icccm/sec-4.html#WM_CLASS}{WM_CLASS} */ /*! \property DForeignWindow::pid \brief 窗口所属进程的 pid \note 只读 \l {https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html}{_NET_WM_PID} */ /*! \fn void DForeignWindow::wmClassChanged() \brief 信号会在 wmClass 属性改变时被发送. \sa DForeignWindow::wmClass */ /*! \fn void DForeignWindow::pidChanged() \brief 信号会在 pid 属性的值改变时被发送. \sa DForeignWindow::pid */ /*! \brief 直接构造一个 DForeignWindow 对象和使用 QWindow 对象没有区别. \a parent \sa DForeignWindow::fromWinId */ DForeignWindow::DForeignWindow(QWindow *parent) : QWindow(parent) , DObject(*new DForeignWindowPrivate(this)) { } /*! \brief DForeignWindow::fromWinId. 使用这个窗口id创建一个 DForeignWindow 对象,此对象不会被加到 QGuiApplication::allWindows 中。一般应用在需要获取一个本地窗口信息的场景。示例: \code // a.cpp int main(int argc, char *argv[]) { DApplication a(argc, argv); QWidget w; w.setWindowTitle("deepin"); w.show(); QFile app_win_id("/tmp/window_id.txt"); if (app_win_id.open(QFile::WriteOnly)) { app_win_id.write(QByteArray::number(w.winId())); app_win_id.close(); } return a.exec(); } \endcode \code // b.cpp int main(int argc, char *argv[]) { DApplication::loadDXcbPlugin(); DApplication a(argc, argv); DForeignWindow *fw = nullptr; QFile app_win_id("/tmp/window_id.txt"); if (app_win_id.open(QFile::ReadOnly)) { fw = DForeignWindow::fromWinId(app_win_id.readAll().toInt()); } if (fw) { qDebug() << fw->title(); fw->connect(fw, &DForeignWindow::widthChanged, [&] { qDebug() << fw->width(); }); } return a.exec(); } \endcode 先启动应用 a 再启动应用 b 在应用 b 启动后将看到如下输出: \code "deepin" \endcode 当改变应用 a 中的窗口宽度时,在应用 b 中会看到宽度的输出 \a id \return \warning 不要尝试对由本应用创建的窗口调用此接口,可能会导致窗口行为发生不可逆转的变化 */ DForeignWindow *DForeignWindow::fromWinId(WId id) { if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ForeignWindows)) { qWarning() << "DForeignWindow::fromWinId(): platform plugin does not support foreign windows."; return 0; } DForeignWindow *window = new DForeignWindow; window->setFlags(Qt::ForeignWindow); window->setProperty("_q_foreignWinId", QVariant::fromValue(id)); window->create(); return window; } QString DForeignWindow::wmClass() const { return property(_WmClass).toString(); } quint32 DForeignWindow::pid() const { return qvariant_cast(property(_ProcessId)); } bool DForeignWindow::event(QEvent *e) { if (e->type() == QEvent::DynamicPropertyChange) { QDynamicPropertyChangeEvent *event = static_cast(e); if (event->propertyName() == _WmClass) { Q_EMIT wmClassChanged(); return true; } else if (event->propertyName() == _ProcessId) { Q_EMIT pidChanged(); return true; } } return false; } DGUI_END_NAMESPACE dtkgui-5.5.25/src/kernel/dforeignwindow.h000066400000000000000000000030231426550353200203470ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DFOREIGNWINDOW_H #define DFOREIGNWINDOW_H #include #include #include DGUI_BEGIN_NAMESPACE class DForeignWindowPrivate; class DForeignWindow : public QWindow, public DTK_CORE_NAMESPACE::DObject { Q_OBJECT Q_PROPERTY(QString wmClass READ wmClass NOTIFY wmClassChanged) Q_PROPERTY(quint32 pid READ pid NOTIFY pidChanged) public: explicit DForeignWindow(QWindow *parent = 0); static DForeignWindow *fromWinId(WId id); QString wmClass() const; quint32 pid() const; Q_SIGNALS: void wmClassChanged(); void pidChanged(); protected: bool event(QEvent *) Q_DECL_OVERRIDE; private: D_DECLARE_PRIVATE(DForeignWindow) }; DGUI_END_NAMESPACE #endif // DFOREIGNWINDOW_H dtkgui-5.5.25/src/kernel/dguiapplicationhelper.cpp000066400000000000000000001317001426550353200222350ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dguiapplicationhelper.h" #include "private/dguiapplicationhelper_p.h" #include "dplatformhandle.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_LINUX #include #endif DGUI_BEGIN_NAMESPACE #ifdef QT_DEBUG Q_LOGGING_CATEGORY(dgAppHelper, "dtk.dguihelper") #else Q_LOGGING_CATEGORY(dgAppHelper, "dtk.dguihelper", QtInfoMsg) #endif Q_GLOBAL_STATIC(QLocalServer, _d_singleServer) static quint8 _d_singleServerVersion = 1; Q_GLOBAL_STATIC(DFontManager, _globalFM) #define WINDOW_THEME_KEY "_d_platform_theme" class _DGuiApplicationHelper { public: #define INVALID_HELPER reinterpret_cast(1) inline DGuiApplicationHelper *helper() { // 临时存储一个无效的指针值, 用于此处条件变量的竞争 if (m_helper.testAndSetRelaxed(nullptr, INVALID_HELPER)) { m_helper.store(creator()); m_helper.load()->initialize(); } return m_helper.load(); } inline void clear() { if (m_helper != INVALID_HELPER) delete m_helper.fetchAndStoreRelaxed(nullptr); } static DGuiApplicationHelper *defaultCreator() { return new DGuiApplicationHelper(); } QAtomicPointer m_helper; static DGuiApplicationHelper::HelperCreator creator; }; DGuiApplicationHelper::HelperCreator _DGuiApplicationHelper::creator = _DGuiApplicationHelper::defaultCreator; Q_GLOBAL_STATIC(_DGuiApplicationHelper, _globalHelper) int DGuiApplicationHelperPrivate::waitTime = 3000; DGuiApplicationHelper::Attributes DGuiApplicationHelperPrivate::attributes = DGuiApplicationHelper::UseInactiveColorGroup; DGuiApplicationHelperPrivate::DGuiApplicationHelperPrivate(DGuiApplicationHelper *qq) : DObjectPrivate(qq) { } void DGuiApplicationHelperPrivate::init() { D_Q(DGuiApplicationHelper); systemTheme = new DPlatformTheme(0, q); // 直接对应到系统级别的主题, 不再对外提供为某个单独程序设置主题的接口. // 程序设置自身主题相关的东西皆可通过 setPaletteType 和 setApplicationPalette 实现. appTheme = systemTheme; if (qGuiApp) { initApplication(qGuiApp); } else { // 确保qAddPreRoutine只会被调用一次 static auto _ = [] {qAddPreRoutine(staticInitApplication); return true;}(); Q_UNUSED(_) } } void DGuiApplicationHelperPrivate::initApplication(QGuiApplication *app) { D_Q(DGuiApplicationHelper); // 跟随application销毁 qAddPostRoutine(staticCleanApplication); q->connect(app, &QGuiApplication::paletteChanged, q, [q, this, app] { // 如果用户没有自定义颜色类型, 则应该通知程序的颜色类型发送变化 if (Q_LIKELY(!isCustomPalette())) { Q_EMIT q->themeTypeChanged(q->toColorType(app->palette())); Q_EMIT q->applicationPaletteChanged(); } else { qWarning() << "DGuiApplicationHelper: Don't use QGuiApplication::setPalette on DTK application."; } }); // 转发程序自己变化的信号 q->connect(app, &QGuiApplication::fontChanged, q, &DGuiApplicationHelper::fontChanged); if (Q_UNLIKELY(!appTheme)) { // 此时说明appTheme可能已经被初始化为了systemtheme if (QGuiApplicationPrivate::is_app_running) { _q_initApplicationTheme(); } else { // 延后初始化数据,因为在调用 clientLeader 前必须要保证QGuiApplication已经完全构造完成 q->metaObject()->invokeMethod(q, "_q_initApplicationTheme", Qt::QueuedConnection, Q_ARG(bool, true)); } } else if (appTheme == systemTheme) { // 此时appTheme等价于systemTheme, 可以直接信号链接 _q_initApplicationTheme(); } } void DGuiApplicationHelperPrivate::staticInitApplication() { if (!_globalHelper.exists()) return; if (DGuiApplicationHelper *helper = _globalHelper->m_helper.load()) { // systemTheme未创建时说明DGuiApplicationHelper还未初始化 if (helper->d_func()->systemTheme) helper->d_func()->initApplication(qGuiApp); } } void DGuiApplicationHelperPrivate::staticCleanApplication() { if (_globalHelper.exists()) _globalHelper->clear(); } DPlatformTheme *DGuiApplicationHelperPrivate::initWindow(QWindow *window) const { DPlatformTheme *theme = new DPlatformTheme(window->winId(), q_func()->applicationTheme()); window->setProperty(WINDOW_THEME_KEY, QVariant::fromValue(theme)); theme->setParent(window); // 跟随窗口销毁 auto onWindowThemeChanged = [window, theme, this] { // 如果程序自定义了调色板, 则没有必要再关心窗口自身平台主题的变化 // 需要注意的是, 这里的信号和事件可能会与 notifyAppThemeChanged 中的重复 // 但是不能因此而移除这里的通知, 当窗口自身所对应的平台主题发生变化时, 这里 // 的通知机制就有了用武之地. if (Q_LIKELY(!isCustomPalette())) { qGuiApp->postEvent(window, new QEvent(QEvent::ThemeChange)); } }; window->connect(theme, &DPlatformTheme::themeNameChanged, window, onWindowThemeChanged); window->connect(theme, &DPlatformTheme::activeColorChanged, window, onWindowThemeChanged); window->connect(theme, &DPlatformTheme::paletteChanged, window, onWindowThemeChanged); return theme; } void DGuiApplicationHelperPrivate::_q_initApplicationTheme(bool notifyChange) { if (!appTheme) { // DPlatfromHandle::windowLeader依赖platformIntegration Q_ASSERT(QGuiApplicationPrivate::platformIntegration()); appTheme = new DPlatformTheme(DPlatformHandle::windowLeader(), systemTheme); } QGuiApplication *app = qGuiApp; auto onAppThemeChanged = [this] { // 只有当程序未自定义调色板时才需要关心DPlatformTheme中themeName和palette的改变 if (!isCustomPalette()) notifyAppThemeChanged(); }; // 监听与程序主题相关的改变 QObject::connect(appTheme, &DPlatformTheme::themeNameChanged, app, onAppThemeChanged); QObject::connect(appTheme, &DPlatformTheme::paletteChanged, app, onAppThemeChanged); QObject::connect(appTheme, &DPlatformTheme::activeColorChanged, app, [this] { if (!appPalette) notifyAppThemeChanged(); }); // appTheme在此之前可能由systemTheme所代替被使用,此时在创建appTheme // 并初始化之后,应当发送信号通知程序主题的改变 if (notifyChange && appTheme->isValid()) { notifyAppThemeChanged(); } } void DGuiApplicationHelperPrivate::notifyAppThemeChanged() { D_Q(DGuiApplicationHelper); QWindowSystemInterfacePrivate::ThemeChangeEvent event(nullptr); // 此事件会促使QGuiApplication重新从QPlatformTheme中获取系统级别的QPalette. // 而在deepin平台下, 系统级别的QPalette来源自 \a applicationPalette() QGuiApplicationPrivate::processThemeChanged(&event); // 通知主题类型发生变化, 此处可能存在误报的行为, 不过不应该对此做额外的约束 // 此信号的行为应当等价于 applicationPaletteChanged Q_EMIT q->themeTypeChanged(q->themeType()); // 通知调色板对象的改变 Q_EMIT q->applicationPaletteChanged(); } bool DGuiApplicationHelperPrivate::isCustomPalette() const { return appPalette || paletteType != DGuiApplicationHelper::UnknownType; } /*! \class Dtk::Gui::DGuiApplicationHelper \inmodule dtkgui \brief DGuiApplicationHelper 应用程序的 GUI ,如主题、调色板等. */ /*! \enum Dtk::Gui::DGuiApplicationHelper::ColorType DGuiApplicationHelper::ColorType 定义了主题类型. \value UnknownType 未知主题(浅色主题或深色主题) \value LightType 浅色主题 \value DarkType 深色主题 */ /*! \enum Dtk::Gui::DGuiApplicationHelper::Attribute DGuiApplicationHelper::Attribute 定义了功能属性 \value UseInactiveColorGroup 如果开启,当窗口处于Inactive状态时就会使用QPalette::Inactive的颜色,否则窗口将没有任何颜色变化。 \value ColorCompositing 是否采用半透明样式的调色板。 \value ReadOnlyLimit 区分只读枚举。 \value IsDeepinPlatformTheme 获取当前是否使用deepin的platformtheme插件,platformtheme插件可以为Qt程序提供特定的控件样式,默认使用chameleon主题。 \value IsDXcbPlatform 获取当前使用的是不是dtk的xcb窗口插件,dxcb插件提供了窗口圆角和阴影功能。 \value IsXWindowPlatform 获取当前是否运行在X11环境中。 \value IsTableEnvironment 获取当前是否运行在deepin平板环境中,检测XDG_CURRENT_DESKTOP环境变量是不是tablet结尾。 \value IsDeepinEnvironment 获取当前是否运行在deepin桌面环境中,检测XDG_CURRENT_DESKTOP环境变量是不是deepin。 */ DGuiApplicationHelper::DGuiApplicationHelper() : QObject(nullptr) , DObject(*new DGuiApplicationHelperPrivate(this)) { } void DGuiApplicationHelper::initialize() { D_D(DGuiApplicationHelper); d->init(); } /*! \brief 创建 DGuiApplicationHelper 对象. \a creator 函数指针 \note 一定要先调用此函数,再使用 DGuiApplicationHelper::instance() */ void DGuiApplicationHelper::registerInstanceCreator(DGuiApplicationHelper::HelperCreator creator) { if (creator == _DGuiApplicationHelper::creator) return; _DGuiApplicationHelper::creator = creator; if (_globalHelper.exists()) { _globalHelper->clear(); } } inline static int adjustColorValue(int base, qint8 increment, int max = 255) { return increment > 0 ? (max - base) * increment / 100.0 + base : base * (1 + increment / 100.0); } /*! \brief DGuiApplicationHelper::instance返回 DGuiApplicationHelper 对象 \return DGuiApplicationHelper对象 */ DGuiApplicationHelper *DGuiApplicationHelper::instance() { return _globalHelper->helper(); } DGuiApplicationHelper::~DGuiApplicationHelper() { _globalHelper->m_helper = nullptr; } /*! \brief 调整颜色. \note 取值范围均为 -100 ~ 100 ,当三原色参数为-100时,颜色为黑色,参数为100时,颜色为白色. 以透明度( alphaFloat )为例,当参数为负数时基础色的 alphaFloat 值减少,现象偏向透明, 参数为正数alphaFloat 值增加,现象偏不透明 \a base 基础色 \a hueFloat 色调 \a saturationFloat 饱和度 \a lightnessFloat 亮度 \a redFloat 红色 \a greenFloat 绿色 \a blueFloat 蓝色 \a alphaFloat Alpha通道(透明度) \return 经过调整的颜色 */ QColor DGuiApplicationHelper::adjustColor(const QColor &base, qint8 hueFloat, qint8 saturationFloat, qint8 lightnessFloat, qint8 redFloat, qint8 greenFloat, qint8 blueFloat, qint8 alphaFloat) { // 按HSL格式调整 int H, S, L, A; base.getHsl(&H, &S, &L, &A); H = H > 0 ? adjustColorValue(H, hueFloat, 359) : H; S = adjustColorValue(S, saturationFloat); L = adjustColorValue(L, lightnessFloat); A = adjustColorValue(A, alphaFloat); QColor new_color = QColor::fromHsl(H, S, L, A); // 按RGB格式调整 int R, G, B; new_color.getRgb(&R, &G, &B); R = adjustColorValue(R, redFloat); G = adjustColorValue(G, greenFloat); B = adjustColorValue(B, blueFloat); new_color.setRgb(R, G, B, A); return new_color; } /*! \brief 将两种颜色混合,合成新的颜色. \a substrate 底层颜色 \a superstratum 上层颜色 \return 混合颜色 */ QColor DGuiApplicationHelper::blendColor(const QColor &substrate, const QColor &superstratum) { QColor c2 = superstratum.toRgb(); if (c2.alpha() >= 255) return c2; QColor c1 = substrate.toRgb(); qreal c1_weight = 1 - c2.alphaF(); int r = c1_weight * c1.red() + c2.alphaF() * c2.red(); int g = c1_weight * c1.green() + c2.alphaF() * c2.green(); int b = c1_weight * c1.blue() + c2.alphaF() * c2.blue(); return QColor(r, g, b, c1.alpha()); } static QColor light_qpalette[QPalette::NColorRoles] { QColor("#414d68"), //WindowText QColor("#e5e5e5"), //Button QColor("#e6e6e6"), //Light QColor("#e5e5e5"), //Midlight QColor("#e3e3e3"), //Dark QColor("#e4e4e4"), //Mid QColor("#414d68"), //Text Qt::black, //BrightText QColor("#414d68"), //ButtonText Qt::white, //Base QColor("#f8f8f8"), //Window QColor(0, 0, 0, 0.05 * 255), //Shadow QColor("#0081ff"), //Highlight Qt::white, //HighlightedText QColor("#0082fa"), //Link QColor("#ad4579"), //LinkVisited QColor(0, 0, 0, 0.03 * 255), //AlternateBase Qt::white, //NoRole QColor(255, 255, 255, 0.8 * 255), //ToolTipBase Qt::black //ToolTipText }; static QColor dark_qpalette[QPalette::NColorRoles] { QColor("#c0c6d4"), //WindowText QColor("#444444"), //Button QColor("#484848"), //Light QColor("#474747"), //Midlight QColor("#414141"), //Dark QColor("#434343"), //Mid QColor("#c0c6d4"), //Text Qt::white, //BrightText QColor("#c0c6d4"), //ButtonText QColor("#282828"), //Base QColor("#252525"), //Window QColor(0, 0, 0, 0.05 * 255), //Shadow QColor("#0081ff"), //Highlight QColor("#F1F6FF"), //HighlightedText QColor("#0082fa"), //Link QColor("#ad4579"), //LinkVisited QColor(0, 0, 0, 0.05 * 255), //AlternateBase Qt::black, //NoRole QColor(45, 45, 45, 0.8 * 255), //ToolTipBase QColor("#c0c6d4") //ToolTipText }; static QColor light_dpalette[DPalette::NColorTypes] { QColor(), //NoType QColor(0, 0, 0, 255 * 0.03), //ItemBackground QColor("#001A2E"), //TextTitle QColor("#526A7F"), //TextTips QColor("#FF5736"), //TextWarning Qt::white, //TextLively QColor("#0081FF"), //LightLively QColor("#0081FF"), //DarkLively QColor(0, 0, 0, 0.05 * 255), //FrameBorder QColor(85, 85, 85, 0.4 * 255), //PlaceholderText QColor(0, 0, 0, 0.1 * 255), //FrameShadowBorder QColor(0, 0, 0, 0.1 * 255) //ObviousBackground }; static QColor dark_dpalette[DPalette::NColorTypes] { QColor(), //NoType QColor(255, 255, 255, 255 * 0.05), //ItemBackground QColor("#C0C6D4"), //TextTitle QColor("#6D7C88"), //TextTips QColor("#E43F2E"), //TextWarning Qt::white, //TextLively QColor("#0059d2"), //LightLively QColor("#0059d2"), //DarkLively QColor(255, 255, 255, 0.1 * 255), //FrameBorder QColor(192, 198, 212, 0.4 * 255), //PlaceholderText QColor(0, 0, 0, 0.8 * 255), //FrameShadowBorder QColor(255, 255, 255, 0.1 * 255) //ObviousBackground }; /*! \brief 根据主题获取标准调色板. \a type 主题枚举值 \return 调色板 */ DPalette DGuiApplicationHelper::standardPalette(DGuiApplicationHelper::ColorType type) { static const DPalette *light_palette = nullptr, *dark_palette = nullptr; static const DPalette *alpha_light_palette = nullptr, *alpha_dark_palette = nullptr; const bool allowCompositingColor = DGuiApplicationHelper::testAttribute(ColorCompositing); if (type == LightType) { if (Q_UNLIKELY(allowCompositingColor)) { if (Q_LIKELY(alpha_light_palette)) { return *alpha_light_palette; } } if (Q_LIKELY(light_palette)) { return *light_palette; } } else if (type == DarkType) { if (Q_UNLIKELY(allowCompositingColor)) { if (Q_LIKELY(alpha_dark_palette)) { return *alpha_dark_palette; } } if (Q_LIKELY(dark_palette)) { return *dark_palette; } } else { return DPalette(); } DPalette *pa; const QColor *qcolor_list, *dcolor_list; if (type == DarkType) { pa = new DPalette(); if (allowCompositingColor) alpha_dark_palette = pa; else dark_palette = pa; qcolor_list = dark_qpalette; dcolor_list = dark_dpalette; } else { pa = new DPalette(); if (allowCompositingColor) alpha_light_palette = pa; else light_palette = pa; qcolor_list = light_qpalette; dcolor_list = light_dpalette; } for (int i = 0; i < DPalette::NColorRoles; ++i) { QPalette::ColorRole role = static_cast(i); QColor color = qcolor_list[i]; #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) if (role == QPalette::PlaceholderText) { // 5.15新添加此颜色 这里使用5.11的颜色保证效果与5.11对齐 color = dcolor_list[DPalette::PlaceholderText]; continue; } #endif // 处理半透明色 if (allowCompositingColor) { switch (role) { case QPalette::Window: color = type == LightType ? adjustColor(color, 0, 0, 0, 0, 0, 0, -20) : adjustColor(color, 0, 0, -10, 0, 0, 0, -20); break; case QPalette::Base: color = adjustColor(color, 0, 0, 0, 0, 0, 0, -20); break; case QPalette::WindowText: case QPalette::Text: color = adjustColor(color, 0, 0, type == LightType ? -20 : +20, 0, 0, 0, -20); break; case QPalette::ButtonText: color = type == LightType ? adjustColor(color, 0, 0, -20, 0, 0, 0, -20) : adjustColor(color, 0, 0, +20, 0, 0, 0, 0); break; case QPalette::Button: case QPalette::Light: case QPalette::Mid: case QPalette::Midlight: case QPalette::Dark: color = adjustColor(color, 0, 0, -20, 0, 0, 0, -40); break; default: break; } } pa->setColor(DPalette::Active, role, color); generatePaletteColor(*pa, role, type); } for (int i = 0; i < DPalette::NColorTypes; ++i) { DPalette::ColorType role = static_cast(i); QColor color = dcolor_list[i]; // 处理半透明色 if (allowCompositingColor) { switch (role) { case DPalette::ItemBackground: color = adjustColor(color, 0, 0, 100, 0, 0, 0, type == LightType ? -80 : -90); break; case DPalette::TextTitle: color = adjustColor(color, 0, 0, -20, 0, 0, 0, -20); break; case DPalette::TextTips: color = type == LightType ? adjustColor(color, 0, 0, -40, 0, 0, 0, -40) : adjustColor(color, 0, 0, +40, 0, 0, 0, -50); break; default: break; } } pa->setColor(DPalette::Active, role, color); generatePaletteColor(*pa, role, type); } return *const_cast(pa); } template static void generatePaletteColor_helper(DPalette &base, M role, DGuiApplicationHelper::ColorType type) { if (type == DGuiApplicationHelper::UnknownType) { type = DGuiApplicationHelper::toColorType(base); } QColor disable_mask_color, inactive_mask_color; if (type == DGuiApplicationHelper::DarkType) { disable_mask_color = dark_qpalette[QPalette::Window]; inactive_mask_color = dark_qpalette[QPalette::Window]; disable_mask_color.setAlphaF(0.7); inactive_mask_color.setAlphaF(0.6); } else { disable_mask_color = light_qpalette[QPalette::Window]; inactive_mask_color = light_qpalette[QPalette::Window]; disable_mask_color.setAlphaF(0.6); inactive_mask_color.setAlphaF(0.4); } const QColor &color = base.color(QPalette::Normal, role); base.setColor(QPalette::Disabled, role, DGuiApplicationHelper::blendColor(color, disable_mask_color)); QPalette::ColorRole qr = static_cast(role); if (qr == QPalette::Text) { // disable text color olny -60% alpha base.setColor(QPalette::Disabled, role, DGuiApplicationHelper::adjustColor(color, 0, 0, 0, 0, 0, 0, -60)); } if (DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::Attribute::UseInactiveColorGroup)) base.setColor(QPalette::Inactive, role, DGuiApplicationHelper::blendColor(color, inactive_mask_color)); else base.setColor(QPalette::Inactive, role, color); } /*! \brief 获取调色板颜色. \a base 调色板 \a role 色码 \a type 主题枚举值 \sa QPalette::ColorRole */ void DGuiApplicationHelper::generatePaletteColor(DPalette &base, QPalette::ColorRole role, DGuiApplicationHelper::ColorType type) { if (role == QPalette::Window) { const QBrush &window = base.brush(QPalette::Normal, role); base.setBrush(QPalette::Disabled, role, window); base.setBrush(QPalette::Inactive, role, window); return; } else if (role == QPalette::Highlight && toColorType(base) == DarkType) { // 暗色模式下的高亮色亮度要降低10%,避免太突兀 QColor highlight = base.highlight().color(); if (highlight.isValid()) { base.setColor(QPalette::Highlight, adjustColor(highlight, 0, 0, -20, 0, 0, 0, 0)); } } generatePaletteColor_helper(base, role, type); } /*! \brief 加工调色板的颜色. \overload 一般我们只会为调色板的 QPalette::Normal 组设置颜色值, 但是 控件中也需要使用其他组的颜色, 此函数使用一些固定规则为 \a base 填充 QPalette::Disabled 和 QPalette::Inactive 分组的颜色. 不同的颜色类型会使用不同的加工规则, 如果为 LightType 类型, 则将颜色的alpha通道调整为 0.6 后作为 QPalette::Disabled 类的颜色使用, 调整为 0.4 后 作为 QPalette::Inactive 类的颜色使用. 如果为 DarkType 类型, 则将颜色的alpha通道调整为 0.7 后作为 QPalette::Disabled 类的颜色使用, 调整为 0.6 后作为 QPalette::Inactive 类的颜色使用. \a base 被加工的调色板 \a role 加工的项 \a type 加工时所使用的颜色类型, 如果值为 UnknownType 将使用 toColorType 获取颜色类型 */ void DGuiApplicationHelper::generatePaletteColor(DPalette &base, DPalette::ColorType role, DGuiApplicationHelper::ColorType type) { generatePaletteColor_helper(base, role, type); } /*! \brief 加工调色板的颜色. \overload 同 generatePaletteColor, 将直接调用 generatePaletteColor 加工 所有类型的调色板颜色. \a base 被加工的调色板 \a type 加工时所使用的颜色类型, 如果值为 UnknownType 将使用 toColorType 获取颜色类型 */ void DGuiApplicationHelper::generatePalette(DPalette &base, ColorType type) { // 先判断调色板的色调 if (type == UnknownType) { type = toColorType(base); } for (int i = 0; i < QPalette::NColorRoles; ++i) { QPalette::ColorRole role = static_cast(i); generatePaletteColor(base, role, type); } for (int i = 0; i < QPalette::NColorRoles; ++i) { DPalette::ColorType role = static_cast(i); generatePaletteColor(base, role, type); } } /*! \brief 获取调色板数据. 首先根据 DPlatformTheme::themeName 获取主题的颜色类型, 如果名称以 "dark" 结尾则认为其颜色类型为 DarkType, 否则为 LightType. 如果主题名称为空, 将使用其父主题的名称( DPlatformTheme::fallbackProperty ). 根据颜色类型将使用 standardPalette 获取基础调色板数据, 在此基础上 从 DPlatformTheme::fetchPalette 获取最终的调色板. \a theme 平台主题对象 \return 调色板数据 */ DPalette DGuiApplicationHelper::fetchPalette(const DPlatformTheme *theme) { DPalette base_palette; const QByteArray theme_name = theme->themeName(); ColorType type = LightType; // 深色主题 if (theme_name.endsWith("dark")) { type = DarkType; } bool ok = false; base_palette = theme->fetchPalette(standardPalette(type), &ok); const QColor &active_color = theme->activeColor(); if (active_color.isValid()) { base_palette.setColor(QPalette::Normal, QPalette::Highlight, active_color); // ok为true时会整体处理palette的所有颜色 if (!ok) { generatePaletteColor(base_palette, QPalette::Highlight, type); } } if (ok) { generatePalette(base_palette, type); } return base_palette; } /*! \brief 设置是否将调色板的颜色改为半透明模式. 一般用在主窗口背景为透明、模糊的程序中 \a on 是否开启 */ void DGuiApplicationHelper::setUseInactiveColorGroup(bool on) { DGuiApplicationHelper::setAttribute(Attribute::UseInactiveColorGroup, on); } /*! \brief 设置是否开启混合颜色. \a on 是否开启 */ void DGuiApplicationHelper::setColorCompositingEnabled(bool on) { DGuiApplicationHelper::setAttribute(Attribute::ColorCompositing, on); } bool DGuiApplicationHelper::isXWindowPlatform() { return DGuiApplicationHelper::testAttribute(Attribute::IsXWindowPlatform); } /*! \brief 用于判断当前桌面环境是否是平板电脑环境. \return true 是平板电脑环境 false不是平板电脑环境 */ bool DGuiApplicationHelper::isTabletEnvironment() { return DGuiApplicationHelper::testAttribute(Attribute::IsTableEnvironment); } /*! \brief isAnimationEnvironment 用于判断当前桌面环境是否是开启了动画等特效的环境 \return true开启了 false没有开启 */ bool DGuiApplicationHelper::isSpecialEffectsEnvironment() { return DGuiApplicationHelper::testAttribute(Attribute::IsSpecialEffectsEnvironment); } /*! \brief DGuiApplicationHelper::systemTheme. 返回系统级别的主题, 优先级低于 applicationTheme \return 平台主题对象 \sa applicationTheme \sa windowTheme */ DPlatformTheme *DGuiApplicationHelper::systemTheme() const { D_DC(DGuiApplicationHelper); return d->systemTheme; } /*! \brief DGuiApplicationHelper::applicationTheme. 同 systemTheme \return 平台主题对象 \sa systemTheme \sa windowTheme */ DPlatformTheme *DGuiApplicationHelper::applicationTheme() const { D_DC(DGuiApplicationHelper); // 如果appTheme还未初始化,应当先初始化appTheme if (Q_UNLIKELY(!d->appTheme)) { // 初始程序级别的主题对象 const_cast(d)->_q_initApplicationTheme(false); } return d->appTheme; } /*! \brief 返回窗口级别的主题, 优先级高于 windowTheme 和 systemTheme. \a window 主题对象对应的窗口 \return 平台主题对象 \sa applicationTheme() \warning 已废弃, 不再对外暴露为特定窗口设置主题的接口 */ DPlatformTheme *DGuiApplicationHelper::windowTheme(QWindow *window) const { DPlatformTheme *theme = qvariant_cast(window->property(WINDOW_THEME_KEY)); if (theme) { return theme; } D_DC(DGuiApplicationHelper); theme = d->initWindow(window); return theme; } /*! \brief 返回应用程序调色板. 如果使用 setApplicationPalette 设置过一个有效的调色板, 将直接返回保存的调色板. 否则 先计算调色板的ColorType, 再使用这个颜色类型通过 standardPalette 获取标准调色板. 计算 ColorType的数据来源按优先级从高到低排列有以下几种方式: 1. 如果使用 setThemeType 设置过一个有效的颜色类型, 将直接使用 themeType 的值. 2. 如果为QGuiApplication设置过调色板(表现为 QGuiApplication::testAttribute(Qt::AA_SetPalette) 为true), 则将使用 QGuiApplication::palette 通过 toColorType 获取颜色类型. 3. 将根据 applicationTheme 的 DPlatformTheme::themeName 计算颜色类型. 如果ColorType来源自第2种方式, 则会直接使用 QGuiApplication::palette 覆盖标准调色板中的 QPalette 部分, 且程序不会再跟随系统的活动色自动更新调色板. \warning 不应该在DTK程序中使用QGuiApplication/QApplication::setPalette \return 应用程序调色板 */ DPalette DGuiApplicationHelper::applicationPalette() const { D_DC(DGuiApplicationHelper); if (d->appPalette) { return *d->appPalette; } ColorType type = d->paletteType; bool aa_setPalette = qGuiApp && qGuiApp->testAttribute(Qt::AA_SetPalette); // 此时appTheme可能还未初始化, 因此先使用systemTheme, 待appTheme初始化之后会 // 通知程序调色板发生改变 auto theme = Q_LIKELY(d->appTheme) ? d->appTheme : d->systemTheme; if (type == UnknownType) { if (aa_setPalette) { type = toColorType(qGuiApp->palette()); } else { // 如果程序未自定义调色板, 则直接从平台主题中获取调色板数据 return fetchPalette(theme); } } // 如果程序自定义了palette的类型,将忽略 appTheme 中设置的调色板数据. DPalette pa = standardPalette(type); if (aa_setPalette) { // 如果程序通过QGuiApplication::setPalette自定义了调色板, 则应当尊重程序的选择 // 覆盖DPalette中的的QPalette数据 pa.QPalette::operator =(qGuiApp->palette()); } else { const QColor &active_color = theme->activeColor(); if (active_color.isValid()) { // 应用Active Color pa.setColor(QPalette::Normal, QPalette::Highlight, active_color); generatePaletteColor(pa, QPalette::Highlight, type); } } return pa; } /*! \brief DGuiApplicationHelper::setApplicationPalette. 自定义应用程序调色板, 如果没有为 QGuiApplication 设置过 QPalette, 则 将触发 QGuiApplication::palette 的更新. 如果仅需要控制程序使用亮色还是暗色的 调色板, 请使用 setThemeType. \note 主动设置调色板的操作会导致程序不再使用 DPlatformTheme 中调色板相关的数据, 也 包括窗口级别的 windowTheme 所对应的 DPlatformTheme, 届时设置 DPlatformTheme 的 themeName 和所有与 \a palette 相关的属性都不再生效. \warning 使用此方式设置的调色板将不会自动跟随活动色的变化 \warning 如果使用过QGuiApplication::setPalette, 此方式可能不会生效 \a palette 要设置的调色板 */ void DGuiApplicationHelper::setApplicationPalette(const DPalette &palette) { D_D(DGuiApplicationHelper); if (qGuiApp && qGuiApp->testAttribute(Qt::AA_SetPalette)) { qWarning() << "DGuiApplicationHelper: Plase check 'QGuiApplication::setPalette', Don't use it on DTK application."; } if (d->appPalette) { if (palette.resolve()) { *d->appPalette = palette; } else { d->appPalette.reset(); } } else if (palette.resolve()) { d->appPalette.reset(new DPalette(palette)); } else { return; } // 通知QGuiApplication更新自身的palette和font d->notifyAppThemeChanged(); } /*! \brief DGuiApplicationHelper::windowPalette. 返回窗口所对应的调色板数据, 同 applicationPalette, 如果程序中自定义了 调色板, 则直接使用 applicationPalette. 自定义调色板的三种方式如下: 1. 通过 setApplicationPalette 固定调色板 2. 通过 setThemeType 固定调色板的类型 3. 通过 QGuiApplication::setPalette 固定调色板, 需要注意此方法不可逆. 否则将基于窗口所对应的 DPlatformTheme 获取调色板( fetchPalette). \a window \return 调色板 \sa windowTheme \sa fetchPalette \sa standardPalette \sa generatePalette \sa applicationPalette \warning 使用时要同时关注 paletteChanged, 收到此信号后可能需要重新获取窗口的调色板 \warning 已废弃, 不再对外暴露控制窗口级别调色板的接口 */ DPalette DGuiApplicationHelper::windowPalette(QWindow *window) const { D_DC(DGuiApplicationHelper); // 如果程序自定义了调色版, 则不再关心窗口对应的平台主题上的设置 if (Q_UNLIKELY(d->isCustomPalette())) { return applicationPalette(); } DPlatformTheme *theme = windowTheme(window); if (Q_UNLIKELY(!theme)) { return applicationPalette(); } return fetchPalette(theme); } /*! \brief DGuiApplicationHelper::fontManager. 程序中唯一的DFontManager对象, 会根据程序的fontChanged信号 更新 DFontManager::baseFontPixelSize \warning 请不要尝试更改它的 baseFontPixelSize 属性 */ const DFontManager *DGuiApplicationHelper::fontManager() const { // 为对象初始化信号链接 if (!_globalFM.exists()) { connect(this, &DGuiApplicationHelper::fontChanged, _globalFM, &DFontManager::setBaseFont); } return _globalFM; } /*! \brief 获取颜色的明亮度,将其转换为主题类型的枚举值. 转换的策略为:先将颜色转换为rgb格式,再根据 Y = 0.299R + 0.587G + 0.114B 的公式 计算出颜色的亮度,亮度大于 191 时认为其为浅色,否则认为其为深色。 \a color 需要转换为主题的类型的颜色 \return 颜色类型的枚举值 */ DGuiApplicationHelper::ColorType DGuiApplicationHelper::toColorType(const QColor &color) { if (!color.isValid()) return UnknownType; QColor rgb_color = color.toRgb(); // 获取rgb颜色的亮度(转换为YUV格式) float luminance = 0.299 * rgb_color.redF() + 0.587 * rgb_color.greenF() + 0.114 * rgb_color.blueF(); if (qRound(luminance * 255) > 191) { return LightType; } return DarkType; } /*! \brief 将调色板 \a palette 转换为主题类型的枚举. \overload 使用 QPalette::background 获取颜色的明亮度,将其转换为主题类型的枚举值。 返回调色板的颜色类型 \a palette 调色板 \return 颜色类型的枚举值 */ DGuiApplicationHelper::ColorType DGuiApplicationHelper::toColorType(const QPalette &palette) { return toColorType(palette.background().color()); } /*! \brief 返回程序的主题类型. 当themeType为UnknownType时, 将自动根据 GuiApplication::palette的QPalette::background颜色计算主题 类型, 否则与 paletteType 的值一致. 程序中应当使用此值作为 暗色/亮色主题类型的判断. \return 主题的颜色类型. \sa toColorType */ DGuiApplicationHelper::ColorType DGuiApplicationHelper::themeType() const { D_DC(DGuiApplicationHelper); if (d->paletteType != UnknownType) { return d->paletteType; } return toColorType(qGuiApp->palette()); } /*! \brief 返回当前已设置的调色板类型. 如果未调用过 setPaletteType, 默认为 UnknownType. \return 返回当前已设置的调色板类型. \warning 与 themetype 不同,此值与程序当前的 QPalette 没有关系。 \sa DGuiApplicationHelper::themeType */ DGuiApplicationHelper::ColorType DGuiApplicationHelper::paletteType() const { D_DC(DGuiApplicationHelper); return d->paletteType; } /*! \brief 设置DGuiApplicationHelper实例. \a key 实例关键字 \a singleScope 实例使用范围 \return 设置是否成功 \note 此处所用到DGuiApplicationHelperPrivate::waitTime默认值为3000ms,可通过 \note DGuiApplicationHelper::setSingleInstanceInterval设置 */ bool DGuiApplicationHelper::setSingleInstance(const QString &key, DGuiApplicationHelper::SingleScope singleScope) { bool new_server = !_d_singleServer.exists(); if (_d_singleServer->isListening()) { _d_singleServer->close(); } QString socket_key = "_d_dtk_single_instance_"; switch (singleScope) { case GroupScope: _d_singleServer->setSocketOptions(QLocalServer::GroupAccessOption); #ifdef Q_OS_LINUX socket_key += QString("%1_").arg(getgid()); #endif break; case WorldScope: _d_singleServer->setSocketOptions(QLocalServer::WorldAccessOption); break; default: _d_singleServer->setSocketOptions(QLocalServer::UserAccessOption); #ifdef Q_OS_LINUX socket_key += QString("%1_").arg(getuid()); #endif break; } socket_key += key; QString lockfile = socket_key; if (!lockfile.startsWith(QLatin1Char('/'))) { lockfile = QDir::cleanPath(QDir::tempPath()); lockfile += QLatin1Char('/') + socket_key; } lockfile += QStringLiteral(".lock"); static QScopedPointer lock(new QLockFile(lockfile)); // 同一个进程多次调用本接口使用最后一次设置的 key // FIX dcc 使用不同的 key 两次调用 setSingleInstance 后无法启动的问题 qint64 pid = -1; QString hostname, appname; if (lock->isLocked() && lock->getLockInfo(&pid, &hostname, &appname) && pid == getpid()) { qCWarning(dgAppHelper) << "call setSingleInstance again within the same process"; lock->unlock(); lock.reset(new QLockFile(lockfile)); } if (!lock->tryLock()) { qCDebug(dgAppHelper) << "===> new client <===" << getpid(); // 通知别的实例 QLocalSocket socket; socket.connectToServer(socket_key); // 等待到有效数据时认为server实例有效 if (socket.waitForConnected(DGuiApplicationHelperPrivate::waitTime) && socket.waitForReadyRead(DGuiApplicationHelperPrivate::waitTime)) { // 读取数据 qint8 version; qint64 pid; QStringList arguments; QDataStream ds(&socket); ds >> version >> pid >> arguments; qCInfo(dgAppHelper) << "Process is started: pid=" << pid << "arguments=" << arguments; // 把自己的信息告诉第一个实例 ds << _d_singleServerVersion << qApp->applicationPid() << qApp->arguments(); socket.flush(); } return false; } if (!_d_singleServer->listen(socket_key)) { qCWarning(dgAppHelper) << "listen failed:" << _d_singleServer->errorString(); return false; } else { qCDebug(dgAppHelper) << "===> listen <===" << _d_singleServer->serverName() << getpid(); } if (new_server) { QObject::connect(_d_singleServer, &QLocalServer::newConnection, qApp, [] { QLocalSocket *instance = _d_singleServer->nextPendingConnection(); // 先发送数据告诉新的实例自己收到了它的请求 QDataStream ds(instance); ds << _d_singleServerVersion // 协议版本 << qApp->applicationPid() // 进程id << qApp->arguments(); // 启动时的参数 QObject::connect(instance, &QLocalSocket::readyRead, qApp, [instance] { // 读取数据 QDataStream ds(instance); qint8 version; qint64 pid; QStringList arguments; ds >> version >> pid >> arguments; instance->close(); qCInfo(dgAppHelper) << "New instance: pid=" << pid << "arguments=" << arguments; // 通知新进程的信息 if (_globalHelper.exists() && _globalHelper->m_helper.load()) Q_EMIT _globalHelper->m_helper.load()->newProcessInstance(pid, arguments); }); instance->flush(); //发送数据给新的实例 }); } return true; } /*! \brief 设置从QLocalServer获取消息的等待时间. 用于在重新创建DGuiApplicationHelper单例时,检测DGuiApplicationHelper单例是否存在且有响应 \a interval 等待时间,如 \a interval 为 -1 则没有超时一直等待,默认和 QLocalSocket 一致 3000ms \note 需要在 DGuiApplicationHelper::setSingleInstance 之前调用否则无效。 */ void DGuiApplicationHelper::setSingleInstanceInterval(int interval) { Q_ASSERT_X(!_d_singleServer->isListening(), "DGuiApplicationHelper::setSingleInstanceInterval","Must call before setSingleInstance"); DGuiApplicationHelperPrivate::waitTime = interval; } /*! \brief 设置从QLocalServer获取消息的等待时间. \a interval 等待时间,typo 请使用 DGuiApplicationHelper::setSingleInstanceInterval */ void DGuiApplicationHelper::setSingelInstanceInterval(int interval) { DGuiApplicationHelperPrivate::waitTime = interval; } void DGuiApplicationHelper::setAttribute(DGuiApplicationHelper::Attribute attribute, bool enable) { if (attribute < Attribute::ReadOnlyLimit) { DGuiApplicationHelperPrivate::attributes.setFlag(attribute, enable); } else { qWarning() << "You are setting for the read-only option."; return; } } bool DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::Attribute attribute) { switch (attribute) { case IsXWindowPlatform: return qGuiApp->platformName() == QByteArrayLiteral("xcb") || qGuiApp->platformName() == QByteArrayLiteral("dxcb"); case IsDXcbPlatform: return DPlatformHandle::isDXcbPlatform(); case IsTableEnvironment: return QGuiApplicationPrivate::instance()->platformIntegration()->services()->desktopEnvironment().toLower().endsWith("tablet"); case IsDeepinPlatformTheme: if (!QGuiApplicationPrivate::platform_name) { return false; } return QString(typeid(*QGuiApplicationPrivate::platform_theme).name()).contains("QDeepinTheme"); case IsDeepinEnvironment: return QGuiApplicationPrivate::instance()->platformIntegration()->services()->desktopEnvironment().toLower().contains("deepin"); case IsSpecialEffectsEnvironment: { return qgetenv("DTK_DISABLED_SPECIAL_EFFECTS").toInt() != 1; } default: return DGuiApplicationHelperPrivate::attributes.testFlag(attribute); } } /*! \brief DGuiApplicationHelper::setThemeType. \obsolete 同 setPaletteType, 已废弃,请不要再使用。 \a themeType 主题类型. */ void DGuiApplicationHelper::setThemeType(DGuiApplicationHelper::ColorType themeType) { setPaletteType(themeType); } /*! \brief 设置程序所应用的调色板类型. 将固定程序的调色板类型, 此行为可能导致 applicationPalette 变化, 前提是未使用 setApplicationPalette 固定过程序的调色板, 此方法不影响程序的调色板跟随 活动色改变, 可用于控制程序使用亮色还是暗色调色板. \note 主动设置调色板颜色类型的操作会导致程序不再使用 DPlatformTheme 中调色板相关的数据, 也 包括窗口级别的 windowTheme 所对应的 DPlatformTheme, 届时设置 DPlatformTheme 的 themeName 和所有与 palette 相关的属性都不再生效. \a paletteType 主题类型的枚举值 */ void DGuiApplicationHelper::setPaletteType(DGuiApplicationHelper::ColorType paletteType) { D_D(DGuiApplicationHelper); if (d->paletteType == paletteType) return; if (qGuiApp && qGuiApp->testAttribute(Qt::AA_SetPalette)) { qWarning() << "DGuiApplicationHelper: Plase check 'QGuiApplication::setPalette', Don't use it on DTK application."; } d->paletteType = paletteType; // 如果未固定调色板, 则paletteType的变化可能会导致调色板改变, 应当通知程序更新数据 if (!d->appPalette) d->notifyAppThemeChanged(); Q_EMIT paletteTypeChanged(paletteType); } DGUI_END_NAMESPACE #include "moc_dguiapplicationhelper.cpp" dtkgui-5.5.25/src/kernel/dguiapplicationhelper.h000066400000000000000000000116711426550353200217060ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DGUIAPPLICATIONHELPER_H #define DGUIAPPLICATIONHELPER_H #include #include #include #include #include DGUI_BEGIN_NAMESPACE class DPlatformTheme; class DFontManager; class DGuiApplicationHelperPrivate; class DGuiApplicationHelper : public QObject, public DCORE_NAMESPACE::DObject { Q_OBJECT D_DECLARE_PRIVATE(DGuiApplicationHelper) Q_PROPERTY(ColorType themeType READ themeType NOTIFY themeTypeChanged) Q_PROPERTY(ColorType paletteType READ paletteType WRITE setPaletteType NOTIFY paletteTypeChanged) public: enum ColorType { UnknownType, LightType, DarkType }; Q_ENUM(ColorType) enum SingleScope { UserScope, GroupScope, WorldScope }; Q_ENUM(SingleScope) enum Attribute { UseInactiveColorGroup = 1 << 0, ColorCompositing = 1 << 1, /* readonly flag */ ReadOnlyLimit = 1 << 22, IsDeepinPlatformTheme = ReadOnlyLimit << 0, IsDXcbPlatform = ReadOnlyLimit << 1, IsXWindowPlatform = ReadOnlyLimit << 2, IsTableEnvironment = ReadOnlyLimit << 3, IsDeepinEnvironment = ReadOnlyLimit << 4, IsSpecialEffectsEnvironment = ReadOnlyLimit << 5 }; Q_ENUM(Attribute) Q_DECLARE_FLAGS(Attributes, Attribute) typedef DGuiApplicationHelper *(*HelperCreator)(); D_DECL_DEPRECATED static void registerInstanceCreator(HelperCreator creator); static DGuiApplicationHelper *instance(); ~DGuiApplicationHelper(); static QColor adjustColor(const QColor &base, qint8 hueFloat, qint8 saturationFloat, qint8 lightnessFloat, qint8 redFloat, qint8 greenFloat, qint8 blueFloat, qint8 alphaFloat); static QColor blendColor(const QColor &substrate, const QColor &superstratum); static DPalette standardPalette(ColorType type); static void generatePaletteColor(DPalette &base, QPalette::ColorRole role, ColorType type); static void generatePaletteColor(DPalette &base, DPalette::ColorType role, ColorType type); static void generatePalette(DPalette &base, ColorType type = UnknownType); static DPalette fetchPalette(const DPlatformTheme *theme); Q_DECL_DEPRECATED_X("Use UseInactiveColorGroup enum with setAttribute.") static void setUseInactiveColorGroup(bool on); Q_DECL_DEPRECATED_X("Use ColorCompositing enum with setAttribute.") static void setColorCompositingEnabled(bool on); static bool isXWindowPlatform(); static bool isTabletEnvironment(); static bool isSpecialEffectsEnvironment(); static void setAttribute(Attribute attribute, bool enable); static bool testAttribute(Attribute attribute); DPlatformTheme *systemTheme() const; DPlatformTheme *applicationTheme() const; D_DECL_DEPRECATED DPlatformTheme *windowTheme(QWindow *window) const; DPalette applicationPalette() const; void setApplicationPalette(const DPalette &palette); D_DECL_DEPRECATED DPalette windowPalette(QWindow *window) const; const DFontManager *fontManager() const; static ColorType toColorType(const QColor &color); static ColorType toColorType(const QPalette &palette); ColorType themeType() const; ColorType paletteType() const; static bool setSingleInstance(const QString &key, SingleScope singleScope = UserScope); static void setSingleInstanceInterval(int interval = 3000); D_DECL_DEPRECATED static void setSingelInstanceInterval(int interval = 3000); public Q_SLOTS: D_DECL_DEPRECATED_X("Plase use setPaletteType") void setThemeType(ColorType themeType); void setPaletteType(ColorType paletteType); Q_SIGNALS: void themeTypeChanged(ColorType themeType); void paletteTypeChanged(ColorType paletteType); void newProcessInstance(qint64 pid, const QStringList &arguments); void fontChanged(const QFont &font); void applicationPaletteChanged(); protected: explicit DGuiApplicationHelper(); virtual void initialize(); private: D_PRIVATE_SLOT(void _q_initApplicationTheme(bool)) friend class _DGuiApplicationHelper; }; DGUI_END_NAMESPACE #endif // DGUIAPPLICATIONHELPER_H dtkgui-5.5.25/src/kernel/dnativesettings.cpp000066400000000000000000000071521426550353200210770ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dnativesettings.h" #include "private/dnativesettings_p.h" #include #include #include #include DGUI_BEGIN_NAMESPACE DNativeSettingsPrivate::DNativeSettingsPrivate(DNativeSettings *qq, const QByteArray &domain) : DObjectPrivate(qq) , domain(domain) { } DNativeSettingsPrivate::~DNativeSettingsPrivate() { } bool DNativeSettingsPrivate::init(const QMetaObject *mo, quint32 window) { QFunctionPointer native_build_setting_fun = qGuiApp->platformFunction("_d_buildNativeSettings"); if (!native_build_setting_fun) return false; D_Q(DNativeSettings); if (!domain.isEmpty()) { q->setProperty("_d_domain", domain); } q->setProperty("_d_metaObject", reinterpret_cast(mo)); return reinterpret_cast(native_build_setting_fun)(q, window); } /*! \class Dtk::Gui::DNativeSettings \inmodule dtkgui \brief 一个用于本地设置的类. */ DNativeSettings::DNativeSettings(quint32 window, const QByteArray &domain, QObject *parent) : DNativeSettings(&DNativeSettings::staticMetaObject, window, domain, parent) { } bool DNativeSettings::isValid() const { D_DC(DNativeSettings); return d->valid; } QByteArrayList DNativeSettings::allKeys() const { D_DC(DNativeSettings); return d->allKeys; } QVariant DNativeSettings::getSetting(const QByteArray &name) const { D_DC(DNativeSettings); // 避免进入死循环 if (!d->valid) return QVariant(); return property(name.constData()); } void DNativeSettings::setSetting(const QByteArray &name, const QVariant &value) { D_D(DNativeSettings); // 避免进入死循环 if (!d->valid) return; setProperty(name.constData(), value); } DNativeSettings::DNativeSettings(DNativeSettingsPrivate &dd, const QMetaObject *metaObject, quint32 window, QObject *parent) : QObject(parent) , DObject(dd) { d_func()->valid = init(metaObject, window); } DNativeSettings::DNativeSettings(const QMetaObject *metaObject, quint32 window, const QByteArray &domain, QObject *parent) : DNativeSettings(*new DNativeSettingsPrivate(this, domain), metaObject, window, parent) { } bool DNativeSettings::init(const QMetaObject *metaObject, quint32 window) { D_D(DNativeSettings); return d->init(metaObject, window); } void DNativeSettings::__setAllKeys(const QByteArrayList &keys) { D_D(DNativeSettings); d->allKeys = keys; Q_EMIT allKeysChanged(); } DGUI_END_NAMESPACE QT_BEGIN_NAMESPACE QDebug operator<<(QDebug debug, const DTK_GUI_NAMESPACE::DNativeSettings &settings) { const QByteArrayList &keys = settings.allKeys(); for (const QByteArray &key : keys) { debug << key << settings.getSetting(key) << endl; } return debug; } QT_END_NAMESPACE dtkgui-5.5.25/src/kernel/dnativesettings.h000066400000000000000000000042121426550353200205360ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DNATIVESETTINGS_H #define DNATIVESETTINGS_H #include #include #include DGUI_BEGIN_NAMESPACE class DNativeSettingsPrivate; class DNativeSettings : public QObject, public DCORE_NAMESPACE::DObject { Q_OBJECT D_DECLARE_PRIVATE(DNativeSettings) Q_PROPERTY(QByteArrayList allKeys READ allKeys WRITE __setAllKeys NOTIFY allKeysChanged) public: explicit DNativeSettings(quint32 window, const QByteArray &domain = QByteArray(), QObject *parent = nullptr); bool isValid() const; QByteArrayList allKeys() const; QVariant getSetting(const QByteArray &name) const; void setSetting(const QByteArray &name, const QVariant &value); Q_SIGNALS: void allKeysChanged(); void propertyChanged(const QByteArray &name, const QVariant &value); protected: DNativeSettings(DNativeSettingsPrivate &dd, const QMetaObject *metaObject, quint32 window, QObject *parent); DNativeSettings(const QMetaObject *metaObject, quint32 window, const QByteArray &domain, QObject *parent); bool init(const QMetaObject *metaObject, quint32 window); private: void __setAllKeys(const QByteArrayList &keys); friend class DNativeSettingsPrivate; }; DGUI_END_NAMESPACE QT_BEGIN_NAMESPACE QDebug operator<<(QDebug debug, const DTK_GUI_NAMESPACE::DNativeSettings &settings); QT_END_NAMESPACE #endif // DNATIVESETTINGS_H dtkgui-5.5.25/src/kernel/dpalette.cpp000066400000000000000000000142131426550353200174620ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dpalette.h" DGUI_BEGIN_NAMESPACE struct DPaletteData : public QSharedData { QBrush br[DPalette::NColorGroups][DPalette::NColorTypes]; }; class DPalettePrivate { public: explicit DPalettePrivate(const QSharedDataPointer &d) : data(d) { } QSharedDataPointer data; }; /*! \class Dtk::Gui::DPalette \inmodule dtkgui \brief DPalette提供了修改的 QPalette 类. DPalette添加了新的颜色类型 */ /*! \enum Dtk::Gui::DPalette::ColorType DPalette::ColorType 定义了 DPalette 颜色类型 \value NoType 无类型 \value ItemBackground 列表项的背景色 \value TextTitle 标题型文本的颜色 \value TextTips 提示性文本的颜色 \value TextWarning 警告类型的文本颜色 \value TextLively 活跃式文本颜色(不受活动色影响) \value LightLively 活跃式按钮(recommend button)背景色中的亮色(不受活跃色影响) \value DarkLively 活跃式按钮(recommend button)背景色中的暗色,会从亮色渐变到暗色(不受活跃色影响) \value FrameBorder 控件边框颜色 \value PlaceholderText 占位类型的文本颜色,可用于输入框占位内容等提示性文字 \value FrameShadowBorder 用于跟阴影叠加的边框颜色 \value ObviousBackground 明显的背景色 \value NColorTypes 无颜色类型 */ /*! \brief DPalette::DPalette构造函数 */ DPalette::DPalette() : d(new DPalettePrivate(QSharedDataPointer(new DPaletteData()))) { } /*! \brief DPalette::DPalette构造函数 \a palette 参数被发送到 QPalette 构造函数 */ DPalette::DPalette(const QPalette &palette) : QPalette(palette) , d(new DPalettePrivate(QSharedDataPointer(new DPaletteData()))) { } /*! \brief DPalette::DPalette构造函数 \a palette 参数被发送到 QPalette 构造函数 */ DPalette::DPalette(const DPalette &palette) : QPalette(palette) , d(new DPalettePrivate(palette.d->data)) { } DPalette::~DPalette() { } DPalette &DPalette::operator=(const DPalette &palette) { QPalette::operator =(palette); d->data = palette.d->data; return *this; } /*! \brief DPalette::brush \a cg \a cr \sa QPalette::brush() */ const QBrush &DPalette::brush(QPalette::ColorGroup cg, DPalette::ColorType cr) const { if (cr >= NColorTypes) { return QPalette::brush(cg, QPalette::NoRole); } if (cg == Current) { cg = currentColorGroup(); } else if (cg >= NColorGroups) { cg = Active; } return d->data->br[cg][cr]; } /*! \brief DPalette::setBrush设置画刷 \a cg \a cr \a brush \sa QPalette::setBrush() */ void DPalette::setBrush(QPalette::ColorGroup cg, DPalette::ColorType cr, const QBrush &brush) { if (cg == All) { for (uint i = 0; i < NColorGroups; i++) setBrush(ColorGroup(i), cr, brush); return; } if (cr >= NColorTypes) { return QPalette::setBrush(cg, QPalette::NoRole, brush); } if (cg == Current) { cg = currentColorGroup(); } else if (cg >= NColorGroups) { cg = Active; } d->data->br[cg][cr] = brush; } DGUI_END_NAMESPACE DGUI_USE_NAMESPACE QT_BEGIN_NAMESPACE QDataStream &operator<<(QDataStream &ds, const DPalette &p) { ds << static_cast(p); for (int i = 0; i < DPalette::NColorGroups; ++i) { for (int j = 0; j < DPalette::NColorTypes; ++j) { ds << p.brush(DPalette::ColorGroup(i), DPalette::ColorType(j)); } } return ds; } QDataStream &operator>>(QDataStream &ds, DPalette &p) { ds >> static_cast(p); for (int i = 0; i < DPalette::NColorGroups; ++i) { for (int j = 0; j < DPalette::NColorTypes; ++j) { QBrush brush; ds >> brush; p.setBrush(DPalette::ColorGroup(i), DPalette::ColorType(j), brush); } } return ds; } QDebug operator<<(QDebug dbg, const DPalette &p) { const char *colorGroupNames[] = {"Active", "Disabled", "Inactive", "NColorGroups", "Current", "All", "Normal"}; const char *colorTypeNames[] = {"NoType", "ItemBackground", //列表项的背景色 "TextTitle", //标题型文本的颜色 "TextTips", //提示性文本的颜色 "TextWarning", //警告类型的文本颜色 "TextLively", //活跃式文本颜色(不受活动色影响) "LightLively", //活跃式按钮(recommend button)背景色中的亮色(不受活跃色影响) "DarkLively", //活跃式按钮(recommend button)背景色中的暗色,会从亮色渐变到暗色(不受活跃色影响) "FrameBorder", //控件边框颜色 "PlaceholderText", //占位类型的文本颜色,可用于输入框占位内容等提示性文字 "FrameShadowBorder", //用于跟阴影叠加的边框颜色 "ObviousBackground", //明显的背景色 "NColorTypes"}; QDebugStateSaver saver(dbg); dbg << "\r\nDPalette: \r\n"; for (int i = 0; i < DPalette::NColorGroups; ++i) { for (int j = DPalette::NoType + 1; j < DPalette::NColorTypes; ++j) { dbg << colorGroupNames[DPalette::ColorGroup(i)] << colorTypeNames[DPalette::ColorType(j)]; dbg << p.brush(DPalette::ColorGroup(i), DPalette::ColorType(j)) << "\r\n"; } } return dbg; } QT_END_NAMESPACE dtkgui-5.5.25/src/kernel/dpalette.h000066400000000000000000000105051426550353200171270ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DPALETTE_H #define DPALETTE_H #include #include #include DGUI_BEGIN_NAMESPACE class DPalettePrivate; class DPalette : public QPalette { Q_GADGET public: enum ColorType { NoType, ItemBackground, //列表项的背景色 TextTitle, //标题型文本的颜色 TextTips, //提示性文本的颜色 TextWarning, //警告类型的文本颜色 TextLively, //活跃式文本颜色(不受活动色影响) LightLively, //活跃式按钮(recommend button)背景色中的亮色(不受活跃色影响) DarkLively, //活跃式按钮(recommend button)背景色中的暗色,会从亮色渐变到暗色(不受活跃色影响) FrameBorder, //控件边框颜色 PlaceholderText, //占位类型的文本颜色,可用于输入框占位内容等提示性文字 FrameShadowBorder, //用于跟阴影叠加的边框颜色 ObviousBackground, //明显的背景色 NColorTypes }; Q_ENUM(ColorType) DPalette(); DPalette(const QPalette &palette); DPalette(const DPalette &palette); ~DPalette(); DPalette &operator=(const DPalette &palette); inline const QColor &color(ColorGroup cg, ColorType ct) const { return brush(cg, ct).color(); } const QBrush &brush(ColorGroup cg, ColorType ct) const; inline void setColor(ColorGroup cg, ColorType ct, const QColor &color) { setBrush(cg, ct, color); } inline void setColor(ColorType ct, const QColor &color) { setColor(All, ct, color); } inline void setBrush(ColorType ct, const QBrush &brush) { setBrush(All, ct, brush); } void setBrush(ColorGroup cg, ColorType ct, const QBrush &brush); inline const QColor &color(ColorType ct) const { return color(Current, ct); } inline const QBrush &brush(ColorType ct) const { return brush(Current, ct); } inline const QBrush &itemBackground() const { return brush(ItemBackground); } inline const QBrush &textTiele() const { return brush(TextTitle); } inline const QBrush &textTips() const { return brush(TextTips); } inline const QBrush &textWarning() const { return brush(TextWarning); } inline const QBrush &textLively() const { return brush(TextLively); } inline const QBrush &lightLively() const { return brush(LightLively); } inline const QBrush &darkLively() const { return brush(DarkLively); } inline const QBrush &frameBorder() const { return brush(FrameBorder); } inline const QBrush &placeholderText() const { return brush(PlaceholderText); } inline const QBrush &frameShadowBorder() const { return brush(FrameShadowBorder); } using QPalette::color; using QPalette::brush; using QPalette::setBrush; using QPalette::setColor; protected: QScopedPointer d; friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &s, const DPalette &p); }; DGUI_END_NAMESPACE QT_BEGIN_NAMESPACE /***************************************************************************** DPalette stream functions *****************************************************************************/ #ifndef QT_NO_DATASTREAM Q_GUI_EXPORT QDataStream &operator<<(QDataStream &ds, const DTK_GUI_NAMESPACE::DPalette &p); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &ds, DTK_GUI_NAMESPACE::DPalette &p); #endif // QT_NO_DATASTREAM #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const DTK_GUI_NAMESPACE::DPalette &); #endif QT_END_NAMESPACE #endif // DPALETTE_H dtkgui-5.5.25/src/kernel/dplatformhandle.cpp000066400000000000000000001241231426550353200210260ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dguiapplicationhelper.h" #include "dplatformhandle.h" #include "dplatformtheme.h" #include "dwindowmanagerhelper.h" #include #include #include #include DGUI_BEGIN_NAMESPACE #define DXCB_PLUGIN_KEY "dxcb" #define DXCB_PLUGIN_SYMBOLIC_PROPERTY "_d_isDxcb" #define DEFINE_CONST_CHAR(Name) const char _##Name[] = "_d_" #Name DEFINE_CONST_CHAR(useDxcb); DEFINE_CONST_CHAR(redirectContent); DEFINE_CONST_CHAR(netWmStates); DEFINE_CONST_CHAR(windowRadius); DEFINE_CONST_CHAR(borderWidth); DEFINE_CONST_CHAR(borderColor); DEFINE_CONST_CHAR(shadowRadius); DEFINE_CONST_CHAR(shadowOffset); DEFINE_CONST_CHAR(shadowColor); DEFINE_CONST_CHAR(clipPath); DEFINE_CONST_CHAR(frameMask); DEFINE_CONST_CHAR(frameMargins); DEFINE_CONST_CHAR(translucentBackground); DEFINE_CONST_CHAR(enableSystemResize); DEFINE_CONST_CHAR(enableSystemMove); DEFINE_CONST_CHAR(enableBlurWindow); DEFINE_CONST_CHAR(windowBlurAreas); DEFINE_CONST_CHAR(windowBlurPaths); DEFINE_CONST_CHAR(windowWallpaperParas); DEFINE_CONST_CHAR(autoInputMaskByClipPath); DEFINE_CONST_CHAR(resolve_mask); enum PropRole { WindowRadius, // TO BE CONTINUE }; // functions DEFINE_CONST_CHAR(setWmBlurWindowBackgroundArea); DEFINE_CONST_CHAR(setWmBlurWindowBackgroundPathList); DEFINE_CONST_CHAR(setWmBlurWindowBackgroundMaskImage); DEFINE_CONST_CHAR(setWmWallpaperParameter); DEFINE_CONST_CHAR(setWindowProperty); DEFINE_CONST_CHAR(pluginVersion); DEFINE_CONST_CHAR(disableOverrideCursor); DEFINE_CONST_CHAR(enableDxcb); DEFINE_CONST_CHAR(isEnableDxcb); DEFINE_CONST_CHAR(setEnableNoTitlebar); DEFINE_CONST_CHAR(isEnableNoTitlebar); DEFINE_CONST_CHAR(clientLeader); static void resolve(QObject *obj, PropRole role) { int mask = obj->property(_resolve_mask).toInt(); obj->setProperty(_resolve_mask, (mask |= 1 << role)); } static bool resolved(QObject *obj, PropRole role) { int mask = obj->property(_resolve_mask).toInt(); return mask & (1 << role); } static void setWindowProperty(QWindow *window, const char *name, const QVariant &value) { if (!window) return; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) static QFunctionPointer setWindowProperty = qApp->platformFunction(_setWindowProperty); #else constexpr QFunctionPointer setWindowProperty = nullptr; #endif if (!setWindowProperty) { window->setProperty(name, value); return; } reinterpret_cast(setWindowProperty)(window, name, value); } /*! \class Dtk::Gui::DPlatformHandle \inmodule dtkgui \brief 一个和Qt dxcb平台插件交互的工具类. 实质性的功能皆在dxcb插件中实现,此插件目前只 支持X11平台,在其它平台上使用这个类不会有任何效果。关于dxcb:它介于Qt应用和Qt xcb平台 插件之间,通过覆写xcb插件中某些对象的虚函数来改变它的一些行为,本质上来讲是Qt xcb插件的 扩展,在X11平台上为DTK应用提供了一些改变窗口效果的功能(比如自定义窗口的边框)、其它和平 台密切相关的实现(比如修复Qt应用在X11平台的一些bug),不能脱离Qt xcb插件独立运行。dxcb 通过重载 QPlatformNativeInterface 提供接口,DPlatformHandle 中使用 QGuiApplication::platformFunction 调用这些接口。Application、dxcb、qt xcb 之间 的关系: \raw HTML
        ┏━━━━━━━━━━━━━━━━┓
        ┃   Application  ┃
        ┗━━━━━━━━━━━━━━━━┛
                ⇅
      ┏━━━━━━━━━━━━━━━━━━━━┓
      ┃     dxcb plugin    ┃
      ┗━━━━━━━━━━━━━━━━━━━━┛
                ⇅
   ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
   ┃      qt xcb platform      ┃
   ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
  
\endraw \l {http://doc.qt.io/qt-5/qpa.html}{QPA} \l {https://github.com/linuxdeepin/qt5dxcb-plugin/}{dxcb插件} \sa Dtk::Gui::DPlatformHandle::isDXcbPlatform \sa QGuiApplication::platformNativeInterface \sa Dtk::Widget::DMainWindow \sa DWindowManagerHelper \warning 使用此工具前要确保应用加载了dxcb插件 \warning 因为 QGuiApplication::platformFunction 是在 Qt 5.4.0 版本引入的新接口, 所以 DPlatformHandle 不支持 Qt 5.4.0 以下版本。 */ /*! \property DPlatformHandle::windowRadius \brief 窗口的圆角半径。默认情况下,窗口管理器支持混成时,圆角半径为4,否则为0,并且 会随着窗口管理器开启/关闭混成效果而变化 \note 可读可写 \note 窗口为半屏、全屏或最大化状态时此值不生效 \warning 手动设置值后将无法再随着窗口管理器是否支持混成而自动更新边框宽度 \sa DWindowManagerHelper::hasComposite */ /*! \property DPlatformHandle::borderWidth \brief 窗口的外边框宽度。默认情况下,窗口管理器支持混成时,边框宽度为1,否则对于可以 改变大小的窗口其值为2,否则为1,并且会随着窗口管理器开启/关闭混成效果而变化 \note 可读可写 \warning 手动设置值后将无法再随着窗口管理器是否支持混成而自动更新边框宽度 \sa DWindowManagerHelper::hasComposite */ /*! \property DPlatformHandle::borderColor \brief 窗口外边框的颜色。默认情况下,窗口管理器支持混成时,颜色为 QColor(0, 0, 0, 255 * 0.15), 否则为边框颜色和 #e0e0e0 的混合,并且会随着窗口管理器开启/关闭混成效果而变化 \note 可读可写 \sa DWindowManagerHelper::hasComposite */ /*! \property DPlatformHandle::shadowRadius \brief 窗口的阴影半径。默认为 60 \note 可读可写 \note 窗口管理器不支持混成时此值无效 \sa DWindowManagerHelper::hasComposite */ /*! \property DPlatformHandle::shadowOffset \brief 窗口阴影的偏移量。默认为 QPoint(0,16) \note 可读可写 \note 窗口管理器不支持混成时此值无效 \sa DWindowManagerHelper::hasComposite */ /*! \property DPlatformHandle::shadowColor \brief 窗口阴影的颜色。默认为 QColor(0, 0, 0, 255 * 0.6) \note 可读可写 \note 窗口管理器不支持混成时此值无效 \sa DWindowManagerHelper::hasComposite */ /*! \property DPlatformHandle::clipPath \brief 窗口的裁剪区域。处于路径内部的区域为窗口有效区域,非有效区域内的窗口内容 将无法显示,并且无法收到鼠标和触摸事件。示例: \code QWidget w; QPainterPath path; QFont font; font.setPixelSize(100); path.addText(0, 150, font, "deepin"); DPlatformHandle handle(&w); handle.setClipPath(path); w.resize(400, 200); w.show(); \endcode \image clip_window_demo.gif \note 可读可写 \note 窗口的阴影和外边框绘制和其有效区域密切相关 \warning 设置此属性后将导致 DPlatformHandle::windowRadius 失效 */ /*! \property DPlatformHandle::frameMask \brief 设置 Frame Window 的遮罩,和 \a clipPath 不同的是,它的裁剪包括阴影 部分。示例: \code QWidget w; DPlatformHandle handle(&w); // 为何更好的观察效果,此处将阴影改为蓝色 handle.setShadowColor(Qt::blue); w.resize(400, 200); w.show(); QRect frame_rect = w.rect() + handle.frameMargins(); frame_rect.moveTopLeft(QPoint(0, 0)); handle.setFrameMask(QRegion(frame_rect, QRegion::Ellipse)); \endcode \image frame_mask_demo.png \note 可读可写 \note 由于实现机制限制,使用此属性裁剪 Frame Window 时,无法去除边缘产生的锯齿 */ /*! \property DPlatformHandle::frameMargins \brief Sub Window 相对于 Frame Window 的边距 \image frame_margins.png \note 只读 \warning 在窗口隐藏时不保证此值的正确性 */ /*! \property DPlatformHandle::translucentBackground \brief 如果此属性值为 true,则在更新窗口绘制内容之前会先清空要更新区域内的图像, 否则不清空,默认为 false \note 可读可写 */ /*! \property DPlatformHandle::enableSystemResize \brief 如果此属性值为 true,则允许外界改变窗口的大小(如使用鼠标拖拽窗口边框), 否则不允许。默认为 true \note 无论属性值是多少,Qt::Popup 和 Qt::BypassWindowManagerHint 类型的 窗口都不允许改变大小 \note 可读可写 \note 此属性仅仅控制 dxcb 中的行为,不会影响窗口管理器的行为 \sa QWidget::setFixedSize \sa QWindow::setMinimumSize \sa QWindow::setMaximumSize \sa DWindowManagerHelper::FUNC_RESIZE */ /*! \property DPlatformHandle::enableSystemMove \brief 如果此属性值为 ture,则允许外界移动窗口的位置(如使用鼠标拖拽移动窗口), 否则不允许。默认为 true \note 无论属性值是多少,Qt::Popup 和 Qt::BypassWindowManagerHint 类型的 窗口都不允许改变大小 \note 可读可写 \note 此属性仅仅控制 dxcb 中的行为,不会影响窗口管理器的行为 \sa DWindowManagerHelper::FUNC_MOVE */ /*! \property DPlatformHandle::enableBlurWindow \brief 如果此属性为 true,则窗口有效区域内的背景将呈现出模糊效果,否则无特效。 默认为 false \note 可读可写 \sa DPlatformHandle::setWindowBlurAreaByWM */ /*! \property DPlatformHandle::autoInputMaskByClipPath \brief 如果此属性值为 true,则窗口可输入区域跟随其 \a clipPath 属性,否则不 跟随。默认为 true \note 可输入区域指可接收鼠标或触摸事件的区域 \note 可读可写 */ /*! \property DPlatformHandle::realWindowId \brief Sub Window 的窗口 id,直接使用 QWindow::winId 或 QWidget::winId 获取到的是 Frame Window 的窗口 id \note 只读 */ /*! \fn void DPlatformHandle::frameMarginsChanged() \brief 信号会在 frameMargins 属性的值改变时被发送. */ /*! \fn void DPlatformHandle::windowRadiusChanged() \brief 信号会在 windowRadius 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::borderWidthChanged() \brief 信号会在 borderWidth 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::borderColorChanged() \brief 信号会在 borderColor 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::shadowRadiusChanged() \brief 信号会在 shadowRadius 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::shadowOffsetChanged() \brief 信号会在 shadowOffset 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::shadowColorChanged() \brief 信号会在 shadowColor 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::clipPathChanged() \brief 信号会在 clipPath 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::frameMaskChanged() \brief 信号会在 frameMask 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::translucentBackgroundChanged() \brief 信号会在 translucentBackground 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::enableSystemResizeChanged() \brief 信号会在 enableSystemResize 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::enableSystemMoveChanged() \brief 信号会在 enableSystemMove 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::enableBlurWindowChanged() \brief 信号会在 enableBlurWindow 属性的值改变时被发送 */ /*! \fn void DPlatformHandle::autoInputMaskByClipPathChanged() \brief 信号会在 autoInputMaskByClipPath 属性的值改变时被发送 */ /*! \class Dtk::Gui::DPlatformHandle::WMBlurArea \inmodule dtkgui \brief 描述窗口背景模糊区域的数据结构,包含位置、大小、圆角半径等信息. \value x 水平方向的坐标 \value y 竖直方向的坐标 \value width 区域的宽度 \value height 区域的高度 \value xRadius 水平方向的圆角半径 \value yRaduis 竖直方向的圆角半径 */ /*! \brief DPlatformHandle::DPlatformHandle 将 \a window 对象传递给 enableDXcbForWindow \a window 要开启DTK风格的主窗口 \a parent DPlatformHandle 对象的父对象 \sa DPlatformHandle::enableDXcbForWindow(QWindow *) */ DPlatformHandle::DPlatformHandle(QWindow *window, QObject *parent) : QObject(parent) , m_window(window) { enableDXcbForWindow(window); window->installEventFilter(this); } /*! \brief DPlatformHandle::pluginVersion \return 返回dxcb插件的版本 \note 在旧版dxcb插件中未实现获取版本的接口,将会返回一个空的 QString 对象 */ QString DPlatformHandle::pluginVersion() { QFunctionPointer pv = 0; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) pv = qApp->platformFunction(_pluginVersion); #endif if (Q_UNLIKELY(!pv)) return QString(); return reinterpret_cast(pv)(); } /*! \brief DPlatformHandle::isDXcbPlatform 检查当前程序是否使用了dxcb平台插件。 \return 正在使用返回 true,否则返回 false。 */ bool DPlatformHandle::isDXcbPlatform() { if (!qApp) return false; static bool _is_dxcb = qApp->platformName() == DXCB_PLUGIN_KEY || qApp->property(DXCB_PLUGIN_SYMBOLIC_PROPERTY).toBool(); return _is_dxcb; } /*! \brief DPlatformHandle::enableDXcbForWindow 将 QWindow 的窗口装饰设置为 DTK 风格,这将使用 Qt::FramelessWindowHint 去除本地窗口管理器 给窗口附加的边框修饰以及窗口阴影效果,并且,会创建一个对应的本地窗口(在X11平台就是指X Window) 作为此窗口的父窗口,父窗口(Frame Window)中将根据子窗口(Sub Window)的有效区域绘制阴影和边 框等效果,默认情况下,子窗口的有效区域为一个圆角矩形,结构如下: \raw HTML
  ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
  ┃    Frame Window             ┃
  ┃                             ┃
  ┃                             ┃
  ┃     ╭┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅╮     ┃
  ┃     ┋    Sub Window   ┋     ┃
  ┃     ┋                 ┋     ┃
  ┃     ┋                 ┋     ┃
  ┃     ┋                 ┋     ┃
  ┃     ┋                 ┋     ┃
  ┃     ┋                 ┋     ┃
  ┃     ┋                 ┋     ┃
  ┃     ┋                 ┋     ┃
  ┃     ┋                 ┋     ┃
  ┃     ╰┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅╯     ┃
  ┃                             ┃
  ┃                             ┃
  ┃                             ┃
  ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
  
\endraw 但是,如果窗口管理器自身支持隐藏窗口标题栏,则此方法将优先调用 enableNoTitlebarForWindow 实现同样的效果。 例子: \code QWidget w1; w1.setWindowTitle("使用系统边框的窗口"); w1.show(); DMainWindow w2; QWidget w3; w2.titlebar()->setTitle("使用DTK风格边框带标题栏的窗口"); w3.setWindowTitle("使用DTK风格边框没有标题栏的窗口"); w2.show(); DPlatformHandle::enableDXcbForWindow(&w3); w3.show(); // 因为这个窗口没有标题栏,所以不会显示窗口标题 \endcode \image dtk_and_system_window.jpeg 开启了dxcb的窗口,在窗口外边缘10像素的范围按下鼠标左键可以触发改变窗口大小的行为, 而且会自动将鼠标吸附到对应的窗口边缘,增强了拖拽改变窗口大小的体验。效果: \image dtk_window_cursor_effect.gif 另外,所有到达主窗口的鼠标移动事件如果没有调用 QEvent::accepted ,则会触发主窗 口的移动效果,默认情况下,一个没有子控件的DTK窗口,如果没有重写 QWidget::mouseMoveEvent , 则使用鼠标左键在窗口的任意地方按住并移动都会触发移动窗口的动作。如: \code class Window : public QWidget { public: explicit Window() { } protected: void mouseMoveEvent(QMouseEvent *event) override { event->accept(); } }; \endcode \code Window w; DPlatformHandle::enableDXcbForWindow(&w); w.show(); \endcode 将无法使用鼠标移动窗口w 窗口管理器(如X11平台上的Window Manager)是否支持混成会影响dxcb插件对窗口添加的默认装饰。 \note 在 Deepin 桌面环境中,打开窗口特效则支持混成,关闭窗口特效则不支持混成 支持混成: \image enable_composite.png 不支持混成: \image disable_composite.png 并且,在不支持混成的窗口管理器中,上述“窗口边缘的鼠标吸附”效果也会被禁用。可以使用 DWindowManagerHelper::hasComposite 或 QX11Info::isCompositingManagerRunning 判断当前运行的窗口管理器是否支持混成。 \a window \sa Dtk::Gui::DPlatformHandle::setEnabledNoTitlebarForWindow() */ void DPlatformHandle::enableDXcbForWindow(QWindow *window) { // 优先使用窗口管理器中实现的no titlebar接口实现自定义窗口修饰器的效果 if (setEnabledNoTitlebarForWindow(window, true)) { return; } if (!isDXcbPlatform()) return; QFunctionPointer enable_dxcb = nullptr; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) enable_dxcb = qApp->platformFunction(_enableDxcb); #endif if (enable_dxcb) { (*reinterpret_cast(enable_dxcb))(window); } else if (window->handle()) { Q_ASSERT_X(window->property(_useDxcb).toBool(), "DPlatformHandler:", "Must be called before window handle has been created. See also QWindow::handle()"); } else { window->setProperty(_useDxcb, true); } } /*! \brief DPlatformHandle::enableDXcbForWindow 功能上和 DPlatformHandle::enableDXcbForWindow(QWindow *) 一致. \a window \a redirectContent 如果值为 true,Sub Window 将不可见,且它的绘制内容会 被合成到外层的 Frame Window(它的父窗口),否则 Sub Window 和 Frame Window 会分开绘制和显示。默认情况下只需要使用 DPlatformHandle::enableDXcbForWindow(QWindow *), dxcb插件中会自动根据窗口渲染类型选择使用更合适的实现方式,使用 OpenGL 渲染的窗口将开启 redirectContent 模式。 \note 如果窗口内嵌入了其它的本地窗口(如X11平台的X Window),默认情况下,这个窗口 绘制的内容不受dxcb插件的控制,它的绘制内容可能会超过 Sub Window 的有效区域,这种 情况下,应该使用此接口,并将 redirectContent 指定为 true。 \l {https://www.x.org/releases/X11R7.5/doc/damageproto/damageproto.txt}{X11 Damage} */ void DPlatformHandle::enableDXcbForWindow(QWindow *window, bool redirectContent) { window->setProperty(_redirectContent, redirectContent); enableDXcbForWindow(window); } /*! \brief DPlatformHandle::isEnabledDXcb. \return 如果窗口 \a window 开启了DTK风格的窗口修饰则返回 true,否则返回 false \sa DPlatformHandle::isEnabledNoTitlebar() */ bool DPlatformHandle::isEnabledDXcb(const QWindow *window) { if (isEnabledNoTitlebar(window)) return true; QFunctionPointer is_enable_dxcb = nullptr; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) is_enable_dxcb = qApp->platformFunction(_isEnableDxcb); #endif if (is_enable_dxcb) { return (*reinterpret_cast(is_enable_dxcb))(window); } return window->property(_useDxcb).toBool(); } static void initWindowRadius(QWindow *window) { if (window->property(_windowRadius).isValid()) return; auto theme = DGuiApplicationHelper::instance()->windowTheme(window); int radius = theme->windowRadius(18); //###(zccrs): 暂时在此处给窗口默认设置为18px的圆角 setWindowProperty(window, _windowRadius, radius); window->connect(theme, &DPlatformTheme::windowRadiusChanged, window, [=] (int radius) { if (!resolved(window, PropRole::WindowRadius)) setWindowProperty(window, _windowRadius, radius); }, Qt::UniqueConnection); } class Q_DECL_HIDDEN CreatorWindowEventFile : public QObject { public: CreatorWindowEventFile(QObject *par= nullptr): QObject(par){} public: bool eventFilter(QObject *watched, QEvent *event) override { if (event->type() == QEvent::PlatformSurface) { QPlatformSurfaceEvent *se = static_cast(event); if (se->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) { // 若收到此信号, 则 WinID 已被创建 initWindowRadius(qobject_cast(watched)); deleteLater(); } } return QObject::eventFilter(watched, event); } }; /*! \brief DPlatformHandle::setEnabledNoTitlebarForWindow. 使用窗口管理器提供的方式隐藏窗口的标题栏,目前已适配 DDE KWin 窗管,在窗口管理器支持的前提下, 此方法将通过设置窗口属性 _DEEPIN_SCISSOR_WINDOW 的值为 1 来开启无标题栏效果。 \a window 被设置的 QWindow 实例. \a enable 是否开启无标题属性. \return 设置成功返回 true,否则返回false. \sa DPlatformHandle::enableDXcbForWindow() \sa DWindowManagerHelper::hasNoTitlebar() */ bool DPlatformHandle::setEnabledNoTitlebarForWindow(QWindow *window, bool enable) { auto isDWaylandPlatform = [] { return qApp->platformName() == "dwayland" || qApp->property("_d_isDwayland").toBool(); }; if (!(isDXcbPlatform() || isDWaylandPlatform())) return false; QFunctionPointer enable_no_titlear = nullptr; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) enable_no_titlear = qApp->platformFunction(_setEnableNoTitlebar); #endif if (enable_no_titlear) { bool ok = (*reinterpret_cast(enable_no_titlear))(window, enable); if (ok) { if (window->handle()) { initWindowRadius(window); } else { window->installEventFilter(new CreatorWindowEventFile(window)); } } return ok; } return false; } /*! \brief DPlatformHandle::isEnableNoTitlebar \a window \return 如果窗口使用窗管提供的方式隐藏了标题栏则返回 true,否则返回 false \sa DPlatformHandle::isEnabledDXcb */ bool DPlatformHandle::isEnabledNoTitlebar(const QWindow *window) { QFunctionPointer is_enable_no_titlebar = nullptr; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) is_enable_no_titlebar = qApp->platformFunction(_isEnableNoTitlebar); #endif if (is_enable_no_titlebar) { return (*reinterpret_cast(is_enable_no_titlebar))(window); } return false; } inline DPlatformHandle::WMBlurArea operator *(const DPlatformHandle::WMBlurArea &area, qreal scale) { if (qFuzzyCompare(scale, 1.0)) return area; DPlatformHandle::WMBlurArea new_area; new_area.x = qRound64(area.x * scale); new_area.y = qRound64(area.y * scale); new_area.width = qRound64(area.width * scale); new_area.height = qRound64(area.height * scale); new_area.xRadius = qRound64(area.xRadius * scale); new_area.yRaduis = qRound64(area.yRaduis * scale); return new_area; } /*! \brief DPlatformHandle::setWindowBlurAreaByWM 设置窗口背景的模糊区域,示例: \code QWindow w; QVector area_list; DPlatformHandle::WMBlurArea area; area.x = 50; area.y = 50; area.width = 200; area.height = 200; area.xRadius = 10; area.yRaduis = 10; area_list.append(area); DPlatformHandle::setWindowBlurAreaByWM(&w, area_list); QSurfaceFormat format = w.format(); format.setAlphaBufferSize(8); w.setFormat(format); w.resize(300, 300); w.show(); \endcode \image blur_window_demo1.png \a window 目标窗口对象 \a area 模糊区域,此区域范围内的窗口背景将填充为窗口后面内容模糊之后的图像 \return 如果设置成功则返回 true,否则返回 false \note 对于需要显示模糊背景的窗口,需要将其 QSurfaceFormat 的 alpha 通道设置为8 \note 调用此接口设置窗口背景模糊区域后将覆盖之前所设置的区域,包括调用 setWindowBlurAreaByWM(QWindow *, const QList &) 所设置的区域 \note 建议使用 DBlurEffectWidget 实现窗口背景模糊效果 \note 此功能依赖于窗口管理器的实现,目前仅支持 deepin-wm 和 kwin 这两个窗口管理器 \sa Dtk::Widget::DBlurEffectWidget \sa QSurfaceFormat::setAlphaBufferSize \sa QWindow::setFormat \sa DWindowManagerHelper::hasBlurWindow \sa DPlatformHandle::setWindowBlurAreaByWM(QWindow *, const QList &) */ bool DPlatformHandle::setWindowBlurAreaByWM(QWindow *window, const QVector &area) { if (!window) { return false; } if (isEnabledDXcb(window)) { setWindowProperty(window, _windowBlurAreas, QVariant::fromValue(*(reinterpret_cast*>(&area)))); return true; } QFunctionPointer setWmBlurWindowBackgroundArea = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) setWmBlurWindowBackgroundArea = qApp->platformFunction(_setWmBlurWindowBackgroundArea); #endif if (!setWmBlurWindowBackgroundArea) { qWarning("setWindowBlurAreaByWM is not support"); return false; } QSurfaceFormat format = window->format(); format.setAlphaBufferSize(8); window->setFormat(format); const qreal device_ratio = window->devicePixelRatio(); if (qFuzzyCompare(device_ratio, 1.0)) { return reinterpret_cast&)>(setWmBlurWindowBackgroundArea)(window->winId(), area); } QVector new_areas; new_areas.reserve(area.size()); for (const WMBlurArea &a : area) { new_areas.append(a * device_ratio); } return reinterpret_cast&)>(setWmBlurWindowBackgroundArea)(window->winId(), new_areas); } inline QPainterPath operator *(const QPainterPath &path, qreal scale) { if (qFuzzyCompare(1.0, scale)) return path; QPainterPath new_path = path; for (int i = 0; i < path.elementCount(); ++i) { const QPainterPath::Element &e = path.elementAt(i); new_path.setElementPositionAt(i, qRound(e.x * scale), qRound(e.y * scale)); } return new_path; } /*! \brief DPlatformHandle::setWindowBlurAreaByWM 设置窗口背景的模糊区域,使用 QPainterPath 描述模糊区域,使用起来更加的灵活,可以 实现任何形状,但是性能要低于使用 QVector 描述模糊区域。示例: \code QWindow w; QList path_list; QPainterPath path; QFont font; font.setPixelSize(100); font.setBold(true); path.addText(0, 150, font, "deepin"); path_list.append(path); DPlatformHandle::setWindowBlurAreaByWM(&w, path_list); QSurfaceFormat format = w.format(); format.setAlphaBufferSize(8); w.setFormat(format); w.resize(300, 300); w.show(); \endcode \image blur_window_demo2.png \a window 目标窗口对象 \a paths 模糊区域,此区域范围内的窗口背景将填充为窗口后面内容模糊之后的图像 \return 如果设置成功则返回 true,否则返回 false \note 调用此接口设置窗口背景模糊区域后将覆盖之前所设置的区域,包括调用 setWindowBlurAreaByWM(QWindow *, QVector &) 设置的窗口背景模糊路径 \note 对于需要显示模糊背景的窗口,需要将其 QSurfaceFormat 的 alpha 通道设置为8 \note 建议使用 DBlurEffectWidget 实现窗口背景模糊效果 \note 此功能依赖于窗口管理器的实现,目前仅支持 deepin-wm 和 kwin 这两个窗口管理器 \warning setWindowBlurAreaByWM(QWindow *, QVector &) 能满足需求请不要使用此接口 \sa Dtk::Widget::DBlurEffectWidget \sa QSurfaceFormat::setAlphaBufferSize \sa QWindow::setFormat \sa DWindowManagerHelper::hasBlurWindow \sa DPlatformHandle::setWindowBlurAreaByWM() */ bool DPlatformHandle::setWindowBlurAreaByWM(QWindow *window, const QList &paths) { if (!window) { return false; } if (isEnabledDXcb(window)) { setWindowProperty(window, _windowBlurPaths, QVariant::fromValue(paths)); return true; } QFunctionPointer setWmBlurWindowBackgroundPathList = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) setWmBlurWindowBackgroundPathList = qApp->platformFunction(_setWmBlurWindowBackgroundPathList); #endif if (!setWmBlurWindowBackgroundPathList) { qWarning("setWindowBlurAreaByWM is not support"); return false; } QSurfaceFormat format = window->format(); format.setAlphaBufferSize(8); window->setFormat(format); const qreal device_ratio = window->devicePixelRatio(); if (qFuzzyCompare(device_ratio, 1.0)) { return reinterpret_cast&)>(setWmBlurWindowBackgroundPathList)(window->winId(), paths); } QList new_paths; new_paths.reserve(paths.size()); for (const QPainterPath &p : paths) { new_paths.append(p * device_ratio); } return reinterpret_cast&)>(setWmBlurWindowBackgroundPathList)(window->winId(), new_paths); } /*! \brief DPlatformHandle::setWindowWallpaperParaByWM 设置窗口背景壁纸,示例: \code QWindow w; QRect area; WallpaperScaleMode sMode WallpaperFillMode fMode area.setRect(50, 50, 200, 200); bMode = WallpaperScaleFlag::FollowWindow | WallpaperFillFlag::PreserveAspectCrop; DPlatformHandle::setWindowWallpaperParaByWM(&w, area, bMode); QSurfaceFormat format = w.format(); format.setAlphaBufferSize(8); w.setFormat(format); w.resize(300, 300); w.show(); \endcode \a window 目标窗口对象 \a area 壁纸区域,此区域范围内的窗口背景将填充为用户设置的当前工作区窗口壁纸 \~Chinese \a sMode 控制壁纸缩放是随屏幕还是随窗口 \~Chinese \a fMode 控制壁纸是缩放还是裁剪 \return 如果设置成功则返回 true,否则返回 false \note 对于需要显示opengl壁纸特效的窗口,需要将其 QSurfaceFormat 的 alpha 通道设置为8 \note 需要在window handle有效之后调用否则3d下失效 \note 调用此接口设置窗口背景壁纸区域后将覆盖之前所设置的区域 \note 此功能依赖于窗口管理器的实现,目前仅支持 kwin 窗口管理器 \sa Dtk::Widget::DBlurEffectWidget \sa QSurfaceFormat::setAlphaBufferSize \sa QWindow::setFormat \sa DWindowManagerHelper::hasBlurWindow \sa DPlatformHandle::setWindowBlurAreaByWM(QWindow *, const QList &) */ bool DPlatformHandle::setWindowWallpaperParaByWM(QWindow *window, const QRect &area, WallpaperScaleMode sMode, WallpaperFillMode fMode) { if (!window) { return false; } QFunctionPointer setWmWallpaperParameter = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) setWmWallpaperParameter = qApp->platformFunction(_setWmWallpaperParameter); #endif if (!setWmWallpaperParameter) { qWarning("setWindowWallpaperParaByWM is not support"); return false; } QSurfaceFormat format = window->format(); format.setAlphaBufferSize(8); window->setFormat(format); quint32 bMode = sMode | fMode; // 激活 backing store window->setProperty("_d_dxcb_wallpaper", QVariant::fromValue(QPair(area, bMode))); if (!window->handle()) { return true; } else { qWarning() << "because the window handle has been created, so 2D mode will have no effect"; } const qreal device_ratio = window->devicePixelRatio(); if (qFuzzyCompare(device_ratio, 1.0) || !area.isValid()) { return reinterpret_cast(setWmWallpaperParameter)(window->winId(), area, bMode); } QRect new_area(area.x() * device_ratio, area.y() * device_ratio, area.width() * device_ratio, area.height() * device_ratio); return reinterpret_cast(setWmWallpaperParameter)(window->winId(), new_area, bMode); } /*! \brief DPlatformHandle::connectWindowManagerChangedSignal 将窗口管理器变化的信号链接到 \a object 对象的 \a slot 槽,建议使用 DWindowManager::windowManagerChanged \a object \a slot \return 如果链接成功则返回 true,否则返回 false \sa DWindowManagerHelper::windowManagerChanged() */ bool DPlatformHandle::connectWindowManagerChangedSignal(QObject *object, std::function slot) { if (object) { return QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::windowManagerChanged, object, slot); } return QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::windowManagerChanged, slot); } /*! \brief DPlatformHandle::connectHasBlurWindowChanged 将窗口管理器是否支持背景模糊的信号链接到 object 对象的 slot 槽,建议使用 DWindowManager::hasBlurWindowChanged \a object \a slot \return 如果链接成功则返回 true,否则返回 false \sa DWindowManagerHelper::hasBlurWindowChanged */ bool DPlatformHandle::connectHasBlurWindowChanged(QObject *object, std::function slot) { if (object) { return QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasBlurWindowChanged, object, slot); } return QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasBlurWindowChanged, slot); } /*! \brief DPlatformHandle::setWindowBlurAreaByWM 这只是一个重载的函数,将调用 setWindowBlurAreaByWM(const QList &paths) 并将构造对象时传递的主窗口当做第一个参数 \a area \return \sa DPlatformHandle::setWindowBlurAreaByWM(const QList &paths) */ bool DPlatformHandle::setWindowBlurAreaByWM(const QVector &area) { return setWindowBlurAreaByWM(m_window, area); } /*! \brief DPlatformHandle::setWindowBlurAreaByWM 这只是一个重载的函数,将调用 setWindowBlurAreaByWM(const QVector &area) 并将构造对象时传递的主窗口当做第一个参数 \a paths \return \sa DPlatformHandle::setWindowBlurAreaByWM() */ bool DPlatformHandle::setWindowBlurAreaByWM(const QList &paths) { return setWindowBlurAreaByWM(m_window, paths); } /*! \brief DPlatformHandle::setDisableWindowOverrideCursor 如果 \a disable 为 true,则禁止窗口 \a window 改变光标样式,否则允许改变光标样式。 窗口被禁止改变光标样式后,使用 QWindow::setCursor 将不会产生任何效果。 \a window \a disable */ void DPlatformHandle::setDisableWindowOverrideCursor(QWindow *window, bool disable) { window->setProperty(_disableOverrideCursor, disable); } int DPlatformHandle::windowRadius() const { return m_window->property(_windowRadius).toInt(); } int DPlatformHandle::borderWidth() const { return m_window->property(_borderWidth).toInt(); } QColor DPlatformHandle::borderColor() const { return qvariant_cast(m_window->property(_borderColor)); } int DPlatformHandle::shadowRadius() const { return m_window->property(_shadowRadius).toInt(); } QPoint DPlatformHandle::shadowOffset() const { return m_window->property(_shadowOffset).toPoint(); } QColor DPlatformHandle::shadowColor() const { return qvariant_cast(m_window->property(_shadowColor)); } QPainterPath DPlatformHandle::clipPath() const { return qvariant_cast(m_window->property(_clipPath)); } QRegion DPlatformHandle::frameMask() const { return qvariant_cast(m_window->property(_frameMask)); } QMargins DPlatformHandle::frameMargins() const { return qvariant_cast(m_window->property(_frameMargins)); } bool DPlatformHandle::translucentBackground() const { return m_window->property(_translucentBackground).toBool(); } bool DPlatformHandle::enableSystemResize() const { return m_window->property(_enableSystemResize).toBool(); } bool DPlatformHandle::enableSystemMove() const { return m_window->property(_enableSystemMove).toBool(); } bool DPlatformHandle::enableBlurWindow() const { return m_window->property(_enableBlurWindow).toBool(); } bool DPlatformHandle::autoInputMaskByClipPath() const { return m_window->property(_autoInputMaskByClipPath).toBool(); } WId DPlatformHandle::realWindowId() const { return qvariant_cast(m_window->property("_d_real_content_window")); } WId DPlatformHandle::windowLeader() { QFunctionPointer clientLeader = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) clientLeader = qApp->platformFunction(_clientLeader); #endif if (!clientLeader) { return 0; } return reinterpret_cast(clientLeader)(); } void DPlatformHandle::setWindowRadius(int windowRadius) { setWindowProperty(m_window, _windowRadius, windowRadius); resolve(m_window, PropRole::WindowRadius); } void DPlatformHandle::setBorderWidth(int borderWidth) { setWindowProperty(m_window, _borderWidth, borderWidth); } void DPlatformHandle::setBorderColor(const QColor &borderColor) { setWindowProperty(m_window, _borderColor, QVariant::fromValue(borderColor)); } void DPlatformHandle::setShadowRadius(int shadowRadius) { setWindowProperty(m_window, _shadowRadius, shadowRadius); } void DPlatformHandle::setShadowOffset(const QPoint &shadowOffset) { setWindowProperty(m_window, _shadowOffset, shadowOffset); } void DPlatformHandle::setShadowColor(const QColor &shadowColor) { setWindowProperty(m_window, _shadowColor, QVariant::fromValue(shadowColor)); } void DPlatformHandle::setClipPath(const QPainterPath &clipPath) { setWindowProperty(m_window, _clipPath, QVariant::fromValue(clipPath)); } void DPlatformHandle::setFrameMask(const QRegion &frameMask) { setWindowProperty(m_window, _frameMask, QVariant::fromValue(frameMask)); } void DPlatformHandle::setTranslucentBackground(bool translucentBackground) { setWindowProperty(m_window, _translucentBackground, translucentBackground); } void DPlatformHandle::setEnableSystemResize(bool enableSystemResize) { setWindowProperty(m_window, _enableSystemResize, enableSystemResize); } void DPlatformHandle::setEnableSystemMove(bool enableSystemMove) { setWindowProperty(m_window, _enableSystemMove, enableSystemMove); } void DPlatformHandle::setEnableBlurWindow(bool enableBlurWindow) { setWindowProperty(m_window, _enableBlurWindow, enableBlurWindow); } void DPlatformHandle::setAutoInputMaskByClipPath(bool autoInputMaskByClipPath) { setWindowProperty(m_window, _autoInputMaskByClipPath, autoInputMaskByClipPath); } bool DPlatformHandle::eventFilter(QObject *obj, QEvent *event) { if (obj == m_window) { if (event->type() == QEvent::DynamicPropertyChange) { QDynamicPropertyChangeEvent *e = static_cast(event); if (e->propertyName() == _windowRadius) { Q_EMIT windowRadiusChanged(); } else if (e->propertyName() == _borderWidth) { Q_EMIT borderWidthChanged(); } else if (e->propertyName() == _borderColor) { Q_EMIT borderColorChanged(); } else if (e->propertyName() == _shadowRadius) { Q_EMIT shadowRadiusChanged(); } else if (e->propertyName() == _shadowOffset) { Q_EMIT shadowOffsetChanged(); } else if (e->propertyName() == _shadowColor) { Q_EMIT shadowColorChanged(); } else if (e->propertyName() == _clipPath) { Q_EMIT clipPathChanged(); } else if (e->propertyName() == _frameMask) { Q_EMIT frameMaskChanged(); } else if (e->propertyName() == _frameMargins) { Q_EMIT frameMarginsChanged(); } else if (e->propertyName() == _translucentBackground) { Q_EMIT translucentBackgroundChanged(); } else if (e->propertyName() == _enableSystemResize) { Q_EMIT enableSystemResizeChanged(); } else if (e->propertyName() == _enableSystemMove) { Q_EMIT enableSystemMoveChanged(); } else if (e->propertyName() == _enableBlurWindow) { Q_EMIT enableBlurWindowChanged(); } else if (e->propertyName() == _autoInputMaskByClipPath) { Q_EMIT autoInputMaskByClipPathChanged(); } } } return false; } DGUI_END_NAMESPACE QT_BEGIN_NAMESPACE QDebug operator<<(QDebug deg, const DPlatformHandle::WMBlurArea &area) { QDebugStateSaver saver(deg); Q_UNUSED(saver) deg.setAutoInsertSpaces(true); deg << "x:" << area.x << "y:" << area.y << "width:" << area.width << "height:" << area.height << "xRadius:" << area.xRadius << "yRadius:" << area.yRaduis; return deg; } QT_END_NAMESPACE dtkgui-5.5.25/src/kernel/dplatformhandle.h000066400000000000000000000150351426550353200204740ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DPLATFORMHANDLE_H #define DPLATFORMHANDLE_H #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QWindow; QT_END_NAMESPACE DGUI_BEGIN_NAMESPACE class DPlatformHandle : public QObject { Q_OBJECT Q_PROPERTY(int windowRadius READ windowRadius WRITE setWindowRadius NOTIFY windowRadiusChanged) Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) Q_PROPERTY(int shadowRadius READ shadowRadius WRITE setShadowRadius NOTIFY shadowRadiusChanged) Q_PROPERTY(QPoint shadowOffset READ shadowOffset WRITE setShadowOffset NOTIFY shadowOffsetChanged) Q_PROPERTY(QColor shadowColor READ shadowColor WRITE setShadowColor NOTIFY shadowColorChanged) Q_PROPERTY(QPainterPath clipPath READ clipPath WRITE setClipPath NOTIFY clipPathChanged) Q_PROPERTY(QRegion frameMask READ frameMask WRITE setFrameMask NOTIFY frameMaskChanged) Q_PROPERTY(QMargins frameMargins READ frameMargins NOTIFY frameMarginsChanged) Q_PROPERTY(bool translucentBackground READ translucentBackground WRITE setTranslucentBackground NOTIFY translucentBackgroundChanged) Q_PROPERTY(bool enableSystemResize READ enableSystemResize WRITE setEnableSystemResize NOTIFY enableSystemResizeChanged) Q_PROPERTY(bool enableSystemMove READ enableSystemMove WRITE setEnableSystemMove NOTIFY enableSystemMoveChanged) Q_PROPERTY(bool enableBlurWindow READ enableBlurWindow WRITE setEnableBlurWindow NOTIFY enableBlurWindowChanged) Q_PROPERTY(bool autoInputMaskByClipPath READ autoInputMaskByClipPath WRITE setAutoInputMaskByClipPath NOTIFY autoInputMaskByClipPathChanged) Q_PROPERTY(WId realWindowId READ realWindowId CONSTANT) public: explicit DPlatformHandle(QWindow *window, QObject *parent = 0); static QString pluginVersion(); static bool isDXcbPlatform(); static void enableDXcbForWindow(QWindow *window); static void enableDXcbForWindow(QWindow *window, bool redirectContent); static bool isEnabledDXcb(const QWindow *window); static bool setEnabledNoTitlebarForWindow(QWindow *window, bool enable); static bool isEnabledNoTitlebar(const QWindow *window); struct WMBlurArea { qint32 x = 0; qint32 y = 0; qint32 width = 0; qint32 height = 0; qint32 xRadius = 0; qint32 yRaduis = 0; }; enum WallpaperScaleMode { FollowScreen = 0x00000000, FollowWindow = 0x00010000 }; enum WallpaperFillMode { PreserveAspectCrop = 0x00000000, PreserveAspectFit = 0x00000001 }; static bool setWindowBlurAreaByWM(QWindow *window, const QVector &area); static bool setWindowBlurAreaByWM(QWindow *window, const QList &paths); static bool setWindowWallpaperParaByWM(QWindow *window, const QRect &area, WallpaperScaleMode sMode, WallpaperFillMode fMode); static bool connectWindowManagerChangedSignal(QObject *object, std::function slot); static bool connectHasBlurWindowChanged(QObject *object, std::function slot); bool setWindowBlurAreaByWM(const QVector &area); bool setWindowBlurAreaByWM(const QList &paths); static void setDisableWindowOverrideCursor(QWindow *window, bool disable); int windowRadius() const; int borderWidth() const; QColor borderColor() const; int shadowRadius() const; QPoint shadowOffset() const; QColor shadowColor() const; QPainterPath clipPath() const; QRegion frameMask() const; QMargins frameMargins() const; bool translucentBackground() const; bool enableSystemResize() const; bool enableSystemMove() const; bool enableBlurWindow() const; bool autoInputMaskByClipPath() const; WId realWindowId() const; static WId windowLeader(); public Q_SLOTS: void setWindowRadius(int windowRadius); void setBorderWidth(int borderWidth); void setBorderColor(const QColor &borderColor); void setShadowRadius(int shadowRadius); void setShadowOffset(const QPoint &shadowOffset); void setShadowColor(const QColor &shadowColor); void setClipPath(const QPainterPath &clipPath); void setFrameMask(const QRegion &frameMask); void setTranslucentBackground(bool translucentBackground); void setEnableSystemResize(bool enableSystemResize); void setEnableSystemMove(bool enableSystemMove); void setEnableBlurWindow(bool enableBlurWindow); void setAutoInputMaskByClipPath(bool autoInputMaskByClipPath); Q_SIGNALS: void frameMarginsChanged(); void windowRadiusChanged(); void borderWidthChanged(); void borderColorChanged(); void shadowRadiusChanged(); void shadowOffsetChanged(); void shadowColorChanged(); void clipPathChanged(); void frameMaskChanged(); void translucentBackgroundChanged(); void enableSystemResizeChanged(); void enableSystemMoveChanged(); void enableBlurWindowChanged(); void autoInputMaskByClipPathChanged(); protected: bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; private: QWindow *m_window; }; inline DPlatformHandle::WMBlurArea dMakeWMBlurArea(quint32 x, quint32 y, quint32 width, quint32 height, quint32 xr = 0, quint32 yr = 0) { DPlatformHandle::WMBlurArea a; a.x = x; a.y = y; a.width = width; a.height = height; a.xRadius = xr; a.yRaduis = yr; return a; } DGUI_END_NAMESPACE QT_BEGIN_NAMESPACE DGUI_USE_NAMESPACE QDebug operator<<(QDebug deg, const DPlatformHandle::WMBlurArea &area); QT_END_NAMESPACE Q_DECLARE_METATYPE(QPainterPath) Q_DECLARE_METATYPE(QRegion) Q_DECLARE_METATYPE(QMargins) #endif // DPLATFORMHANDLE_H dtkgui-5.5.25/src/kernel/dplatformtheme.cpp000066400000000000000000000571001426550353200206750ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dplatformtheme.h" #include "private/dplatformtheme_p.h" #include #include #include #include #include DGUI_BEGIN_NAMESPACE // "/deepin/palette" 为调色板属性的存储位置 // 在x11平台下,将使用_DEEPIN_PALETTE作为存储调色板数据的窗口属性 DPlatformThemePrivate::DPlatformThemePrivate(Dtk::Gui::DPlatformTheme *qq) : DNativeSettingsPrivate(qq, QByteArrayLiteral("/deepin/palette")) { } void DPlatformThemePrivate::_q_onThemePropertyChanged(const QByteArray &name, const QVariant &value) { D_Q(DPlatformTheme); // 转发属性变化的信号,此信号来源可能为parent theme或“非调色板”的属性变化。 // 使用队列的形式转发,避免多次发出同样的信号 q->staticMetaObject.invokeMethod(q, "propertyChanged", Qt::QueuedConnection, Q_ARG(const QByteArray&, name), Q_ARG(const QVariant&, value)); if (QByteArrayLiteral("Gtk/FontName") == name) { Q_EMIT q->gtkFontNameChanged(value.toByteArray()); return; } if (name.startsWith("Qt/DPI/")) { const QString &screen_name = QString::fromLocal8Bit(name.mid(7)); if (!screen_name.isEmpty()) { bool ok = false; int dpi = value.toInt(&ok); Q_EMIT q->dotsPerInchChanged(screen_name, ok ? dpi : -1); } return; } if (QByteArrayLiteral("Xft/DPI") == name) { bool ok = false; int dpi = value.toInt(&ok); Q_EMIT q->dotsPerInchChanged(QString(), ok ? dpi : -1); } const QByteArrayList &list = name.split('/'); if (list.count() != 2) return; QByteArray pn = list.last(); if (pn.isEmpty()) return; // 转换首字母为小写 pn[0] = QChar(pn.at(0)).toLower().toLatin1(); // 直接使用静态的meta object,防止通过metaObject函数调用到dynamic metaobject const QMetaObject *mo = &DPlatformTheme::staticMetaObject; int index = mo->indexOfProperty(pn.constData()); if (index < 0) return; const QMetaProperty &p = mo->property(index); bool is_parent_signal = q->sender() != theme; // 当自己的属性有效时应该忽略父主题的属性变化信号,优先以自身的属性值为准。 if (is_parent_signal && p.read(q).isValid()) { return; } if (p.hasNotifySignal()) { p.notifySignal().invoke(q, QGenericArgument(value.typeName(), value.constData())); } } void DPlatformThemePrivate::onQtColorChanged(QPalette::ColorRole role, const QColor &color) { if (!palette) { palette = new DPalette(); } palette->setColor(QPalette::Normal, role, color); notifyPaletteChanged(); } void DPlatformThemePrivate::onDtkColorChanged(DPalette::ColorType type, const QColor &color) { if (!palette) { palette = new DPalette(); } palette->setColor(QPalette::Normal, type, color); notifyPaletteChanged(); } void DPlatformThemePrivate::notifyPaletteChanged() { if (notifyPaletteChangeTimer && notifyPaletteChangeTimer->isActive()) return; D_Q(DPlatformTheme); if (!notifyPaletteChangeTimer) { notifyPaletteChangeTimer = new QTimer(q); q->connect(notifyPaletteChangeTimer, &QTimer::timeout, q, [q, this] { Q_EMIT q->paletteChanged(*palette); }); } notifyPaletteChangeTimer->start(300); } /*! \class Dtk::Gui::DPlatformTheme \inmodule dtkgui \brief 一个提供窗口主题的类. */ DPlatformTheme::DPlatformTheme(quint32 window, QObject *parent) : DNativeSettings(*new DPlatformThemePrivate(this), &DPlatformTheme::staticMetaObject, window, parent) { D_D(DPlatformTheme); d->theme = new DNativeSettings(window, QByteArray(), this); connect(this, &DPlatformTheme::windowChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Window, std::placeholders::_1)); connect(this, &DPlatformTheme::windowTextChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::WindowText, std::placeholders::_1)); connect(this, &DPlatformTheme::baseChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Base, std::placeholders::_1)); connect(this, &DPlatformTheme::alternateBaseChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::AlternateBase, std::placeholders::_1)); connect(this, &DPlatformTheme::toolTipBaseChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::ToolTipBase, std::placeholders::_1)); connect(this, &DPlatformTheme::toolTipTextChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::ToolTipText, std::placeholders::_1)); connect(this, &DPlatformTheme::textChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Text, std::placeholders::_1)); connect(this, &DPlatformTheme::buttonChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Button, std::placeholders::_1)); connect(this, &DPlatformTheme::buttonTextChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::ButtonText, std::placeholders::_1)); connect(this, &DPlatformTheme::brightTextChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::BrightText, std::placeholders::_1)); connect(this, &DPlatformTheme::lightChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Light, std::placeholders::_1)); connect(this, &DPlatformTheme::midlightChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Midlight, std::placeholders::_1)); connect(this, &DPlatformTheme::darkChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Dark, std::placeholders::_1)); connect(this, &DPlatformTheme::midChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Mid, std::placeholders::_1)); connect(this, &DPlatformTheme::shadowChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Shadow, std::placeholders::_1)); connect(this, &DPlatformTheme::highlightChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Highlight, std::placeholders::_1)); connect(this, &DPlatformTheme::highlightedTextChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::HighlightedText, std::placeholders::_1)); connect(this, &DPlatformTheme::linkChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::Link, std::placeholders::_1)); connect(this, &DPlatformTheme::linkVisitedChanged, std::bind(&DPlatformThemePrivate::onQtColorChanged, d, QPalette::LinkVisited, std::placeholders::_1)); connect(this, &DPlatformTheme::itemBackgroundChanged, std::bind(&DPlatformThemePrivate::onDtkColorChanged, d, DPalette::ItemBackground, std::placeholders::_1)); connect(this, &DPlatformTheme::textTitleChanged, std::bind(&DPlatformThemePrivate::onDtkColorChanged, d, DPalette::TextTitle, std::placeholders::_1)); connect(this, &DPlatformTheme::textTipsChanged, std::bind(&DPlatformThemePrivate::onDtkColorChanged, d, DPalette::TextTips, std::placeholders::_1)); connect(this, &DPlatformTheme::textWarningChanged, std::bind(&DPlatformThemePrivate::onDtkColorChanged, d, DPalette::TextWarning, std::placeholders::_1)); connect(this, &DPlatformTheme::textLivelyChanged, std::bind(&DPlatformThemePrivate::onDtkColorChanged, d, DPalette::TextLively, std::placeholders::_1)); connect(this, &DPlatformTheme::lightLivelyChanged, std::bind(&DPlatformThemePrivate::onDtkColorChanged, d, DPalette::LightLively, std::placeholders::_1)); connect(this, &DPlatformTheme::darkLivelyChanged, std::bind(&DPlatformThemePrivate::onDtkColorChanged, d, DPalette::DarkLively, std::placeholders::_1)); connect(this, &DPlatformTheme::frameBorderChanged, std::bind(&DPlatformThemePrivate::onDtkColorChanged, d, DPalette::FrameBorder, std::placeholders::_1)); connect(d->theme, SIGNAL(propertyChanged(const QByteArray &, const QVariant &)), this, SLOT(_q_onThemePropertyChanged(const QByteArray &, const QVariant &))); } DPlatformTheme::DPlatformTheme(quint32 window, DPlatformTheme *parent) : DPlatformTheme(window, static_cast(parent)) { d_func()->parent = parent; // 将主题相关的属性改变信号从父主题中继承 // 假设 A 被 B 继承,B 被 C 继承,当 A 中出发属性变化时,不仅要能通知到B,还要能通知到C connect(parent->d_func()->theme, SIGNAL(propertyChanged(const QByteArray &, const QVariant &)), d_func()->theme, SIGNAL(propertyChanged(const QByteArray &, const QVariant &))); } DPlatformTheme::~DPlatformTheme() { D_D(DPlatformTheme); if (d->palette) { delete d->palette; } } bool DPlatformTheme::isValid() const { return !themeName().isEmpty() || isValidPalette() || activeColor().isValid(); } DPlatformTheme *DPlatformTheme::parentTheme() const { D_DC(DPlatformTheme); return d->parent; } void DPlatformTheme::setFallbackProperty(bool fallback) { D_D(DPlatformTheme); d->fallbackProperty = fallback; } DPalette DPlatformTheme::palette() const { D_DC(DPlatformTheme); if (!d->palette) { if (!isValid()) return DPalette(); DPalette *pa = new DPalette(); const_cast(d)->palette = pa; #define SET_PALETTE_COLOR(Role) \ pa->setColor(DPalette::Role, qvariant_cast(getSetting(QByteArrayLiteral(#Role)))) SET_PALETTE_COLOR(Window); SET_PALETTE_COLOR(WindowText); SET_PALETTE_COLOR(Base); SET_PALETTE_COLOR(AlternateBase); SET_PALETTE_COLOR(ToolTipBase); SET_PALETTE_COLOR(ToolTipText); SET_PALETTE_COLOR(Text); SET_PALETTE_COLOR(Button); SET_PALETTE_COLOR(ButtonText); SET_PALETTE_COLOR(BrightText); SET_PALETTE_COLOR(Light); SET_PALETTE_COLOR(Midlight); SET_PALETTE_COLOR(Dark); SET_PALETTE_COLOR(Mid); SET_PALETTE_COLOR(Shadow); SET_PALETTE_COLOR(Highlight); SET_PALETTE_COLOR(HighlightedText); SET_PALETTE_COLOR(Link); SET_PALETTE_COLOR(LinkVisited); SET_PALETTE_COLOR(ItemBackground); SET_PALETTE_COLOR(TextTitle); SET_PALETTE_COLOR(TextTips); SET_PALETTE_COLOR(TextWarning); SET_PALETTE_COLOR(TextLively); SET_PALETTE_COLOR(LightLively); SET_PALETTE_COLOR(DarkLively); SET_PALETTE_COLOR(FrameBorder); } return *d->palette; } DPalette DPlatformTheme::fetchPalette(const DPalette &base, bool *ok) const { D_DC(DPlatformTheme); DPalette palette = base; if (isValidPalette()) { if (ok) { *ok = true; } const DPalette *pa = d->palette; for (int i = 0; i < QPalette::NColorRoles; ++i) { const QColor &color = pa->color(QPalette::Normal, static_cast(i)); if (color.isValid()) { palette.setColor(QPalette::Normal, static_cast(i), color); } } for (int i = 0; i < DPalette::NColorTypes; ++i) { const QColor &color = pa->color(QPalette::Normal, static_cast(i)); if (color.isValid()) { palette.setColor(QPalette::Normal, static_cast(i), color); } } return d->parent ? d->parent->fetchPalette(palette, nullptr) : palette; } return d->parent ? d->parent->fetchPalette(palette, ok) : palette; } void DPlatformTheme::setPalette(const DPalette &palette) { #define SET_PALETTE(Role) \ set##Role(palette.color(QPalette::Normal, DPalette::Role)) SET_PALETTE(Window); SET_PALETTE(WindowText); SET_PALETTE(Base); SET_PALETTE(AlternateBase); SET_PALETTE(ToolTipBase); SET_PALETTE(ToolTipText); SET_PALETTE(Text); SET_PALETTE(Button); SET_PALETTE(ButtonText); SET_PALETTE(BrightText); SET_PALETTE(Light); SET_PALETTE(Midlight); SET_PALETTE(Dark); SET_PALETTE(Mid); SET_PALETTE(Shadow); SET_PALETTE(Highlight); SET_PALETTE(HighlightedText); SET_PALETTE(Link); SET_PALETTE(LinkVisited); SET_PALETTE(ItemBackground); SET_PALETTE(TextTitle); SET_PALETTE(TextTips); SET_PALETTE(TextWarning); SET_PALETTE(TextLively); SET_PALETTE(LightLively); SET_PALETTE(DarkLively); SET_PALETTE(FrameBorder); } #define FETCH_PROPERTY(Name, Function) \ D_DC(DPlatformTheme); \ QVariant value = d->theme->getSetting(QByteArrayLiteral(Name)); \ if (d->fallbackProperty && !value.isValid() && d->parent) \ return d->parent->Function(); \ #define FETCH_PROPERTY_WITH_ARGS(Name, Function, Args) \ D_DC(DPlatformTheme); \ QVariant value = d->theme->getSetting(Name); \ if (d->fallbackProperty && !value.isValid() && d->parent) \ return d->parent->Function(Args); \ int DPlatformTheme::cursorBlinkTime() const { FETCH_PROPERTY("Net/CursorBlinkTime", cursorBlinkTime) return value.toInt(); } int DPlatformTheme::cursorBlinkTimeout() const { FETCH_PROPERTY("Net/CursorBlinkTimeout", cursorBlinkTimeout) return value.toInt(); } bool DPlatformTheme::cursorBlink() const { FETCH_PROPERTY("Net/CursorBlink", cursorBlink) return value.toInt(); } int DPlatformTheme::doubleClickDistance() const { FETCH_PROPERTY("Net/DoubleClickDistance", doubleClickDistance) return value.toInt(); } int DPlatformTheme::doubleClickTime() const { FETCH_PROPERTY("Net/DoubleClickTime", doubleClickTime) return value.toInt(); } int DPlatformTheme::dndDragThreshold() const { FETCH_PROPERTY("Net/DndDragThreshold", dndDragThreshold) return value.toInt(); } int DPlatformTheme::windowRadius() const { return windowRadius(-1); } int DPlatformTheme::windowRadius(int defaultValue) const { Q_D(const DPlatformTheme); QVariant value = d->theme->getSetting(QByteArrayLiteral("DTK/WindowRadius")); bool ok = false; if (d->fallbackProperty && !value.isValid() && d->parent) return d->parent->windowRadius(defaultValue); int radius = value.toInt(&ok); return ok ? radius : defaultValue; } QByteArray DPlatformTheme::themeName() const { FETCH_PROPERTY("Net/ThemeName", themeName) return value.toByteArray(); } QByteArray DPlatformTheme::iconThemeName() const { FETCH_PROPERTY("Net/IconThemeName", iconThemeName) return value.toByteArray(); } QByteArray DPlatformTheme::soundThemeName() const { FETCH_PROPERTY("Net/SoundThemeName", soundThemeName) return value.toByteArray(); } QByteArray DPlatformTheme::fontName() const { FETCH_PROPERTY("Qt/FontName", fontName) return value.toByteArray(); } QByteArray DPlatformTheme::monoFontName() const { FETCH_PROPERTY("Qt/MonoFontName", monoFontName) return value.toByteArray(); } qreal DPlatformTheme::fontPointSize() const { FETCH_PROPERTY("Qt/FontPointSize", fontPointSize) return value.toDouble(); } QByteArray DPlatformTheme::gtkFontName() const { FETCH_PROPERTY("Gtk/FontName", gtkFontName) return value.toByteArray(); } QColor DPlatformTheme::activeColor() const { FETCH_PROPERTY("Qt/ActiveColor", activeColor) return qvariant_cast(value); } bool DPlatformTheme::isValidPalette() const { return !allKeys().isEmpty(); } #define GET_COLOR(Role) qvariant_cast(getSetting(QByteArrayLiteral(#Role))) QColor DPlatformTheme::window() const { return GET_COLOR(window); } QColor DPlatformTheme::windowText() const { return GET_COLOR(windowText); } QColor DPlatformTheme::base() const { return GET_COLOR(base); } QColor DPlatformTheme::alternateBase() const { return GET_COLOR(alternateBase); } QColor DPlatformTheme::toolTipBase() const { return GET_COLOR(toolTipBase); } QColor DPlatformTheme::toolTipText() const { return GET_COLOR(toolTipText); } QColor DPlatformTheme::text() const { return GET_COLOR(text); } QColor DPlatformTheme::button() const { return GET_COLOR(button); } QColor DPlatformTheme::buttonText() const { return GET_COLOR(buttonText); } QColor DPlatformTheme::brightText() const { return GET_COLOR(brightText); } QColor DPlatformTheme::light() const { return GET_COLOR(light); } QColor DPlatformTheme::midlight() const { return GET_COLOR(midlight); } QColor DPlatformTheme::dark() const { return GET_COLOR(dark); } QColor DPlatformTheme::mid() const { return GET_COLOR(mid); } QColor DPlatformTheme::shadow() const { return GET_COLOR(shadow); } QColor DPlatformTheme::highlight() const { return GET_COLOR(highlight); } QColor DPlatformTheme::highlightedText() const { return GET_COLOR(highlightedText); } QColor DPlatformTheme::link() const { return GET_COLOR(link); } QColor DPlatformTheme::linkVisited() const { return GET_COLOR(linkVisited); } QColor DPlatformTheme::itemBackground() const { return GET_COLOR(itemBackground); } QColor DPlatformTheme::textTitle() const { return GET_COLOR(textTitle); } QColor DPlatformTheme::textTips() const { return GET_COLOR(textTips); } QColor DPlatformTheme::textWarning() const { return GET_COLOR(textWarning); } QColor DPlatformTheme::textLively() const { return GET_COLOR(textLively); } QColor DPlatformTheme::lightLively() const { return GET_COLOR(lightLively); } QColor DPlatformTheme::darkLively() const { return GET_COLOR(darkLively); } QColor DPlatformTheme::frameBorder() const { return GET_COLOR(frameBorder); } int DPlatformTheme::dotsPerInch(const QString &screenName) const { bool ok = false; if (!screenName.isEmpty()) { FETCH_PROPERTY_WITH_ARGS("Qt/DPI/" + screenName.toLocal8Bit(), dotsPerInch, screenName); int dpi = value.toInt(&ok); if (ok) return dpi; } FETCH_PROPERTY_WITH_ARGS("Xft/DPI", dotsPerInch, screenName); int dpi = value.toInt(&ok); return ok ? dpi : -1; } void DPlatformTheme::setCursorBlinkTime(int cursorBlinkTime) { D_D(DPlatformTheme); d->theme->setSetting("Net/CursorBlinkTime", cursorBlinkTime); } void DPlatformTheme::setCursorBlinkTimeout(int cursorBlinkTimeout) { D_D(DPlatformTheme); d->theme->setSetting("Net/CursorBlinkTimeout", cursorBlinkTimeout); } void DPlatformTheme::setCursorBlink(bool cursorBlink) { D_D(DPlatformTheme); d->theme->setSetting("Net/CursorBlink", cursorBlink); } void DPlatformTheme::setDoubleClickDistance(int doubleClickDistance) { D_D(DPlatformTheme); d->theme->setSetting("Net/DoubleClickDistance", doubleClickDistance); } void DPlatformTheme::setDoubleClickTime(int doubleClickTime) { D_D(DPlatformTheme); d->theme->setSetting("Net/DoubleClickTime", doubleClickTime); } void DPlatformTheme::setDndDragThreshold(int dndDragThreshold) { D_D(DPlatformTheme); d->theme->setSetting("Net/DndDragThreshold", dndDragThreshold); } void DPlatformTheme::setThemeName(const QByteArray &themeName) { D_D(DPlatformTheme); d->theme->setSetting("Net/ThemeName", themeName); } void DPlatformTheme::setIconThemeName(const QByteArray &iconThemeName) { D_D(DPlatformTheme); d->theme->setSetting("Net/IconThemeName", iconThemeName); } void DPlatformTheme::setSoundThemeName(const QByteArray &soundThemeName) { D_D(DPlatformTheme); d->theme->setSetting("Net/SoundThemeName", soundThemeName); } void DPlatformTheme::setFontName(const QByteArray &fontName) { D_D(DPlatformTheme); d->theme->setSetting("Qt/FontName", fontName); } void DPlatformTheme::setMonoFontName(const QByteArray &monoFontName) { D_D(DPlatformTheme); d->theme->setSetting("Qt/MonoFontName", monoFontName); } void DPlatformTheme::setFontPointSize(qreal fontPointSize) { D_D(DPlatformTheme); d->theme->setSetting("Qt/FontPointSize", fontPointSize); } void DPlatformTheme::setGtkFontName(const QByteArray &fontName) { D_D(DPlatformTheme); d->theme->setSetting("Gtk/FontName", fontName); } void DPlatformTheme::setActiveColor(const QColor activeColor) { D_D(DPlatformTheme); d->theme->setSetting("Qt/ActiveColor", activeColor); } #define SET_COLOR(Role) setSetting(QByteArrayLiteral(#Role), Role) void DPlatformTheme::setWindow(const QColor &window) { SET_COLOR(window); } void DPlatformTheme::setWindowText(const QColor &windowText) { SET_COLOR(windowText); } void DPlatformTheme::setBase(const QColor &base) { SET_COLOR(base); } void DPlatformTheme::setAlternateBase(const QColor &alternateBase) { SET_COLOR(alternateBase); } void DPlatformTheme::setToolTipBase(const QColor &toolTipBase) { SET_COLOR(toolTipBase); } void DPlatformTheme::setToolTipText(const QColor &toolTipText) { SET_COLOR(toolTipText); } void DPlatformTheme::setText(const QColor &text) { SET_COLOR(text); } void DPlatformTheme::setButton(const QColor &button) { SET_COLOR(button); } void DPlatformTheme::setButtonText(const QColor &buttonText) { SET_COLOR(buttonText); } void DPlatformTheme::setBrightText(const QColor &brightText) { SET_COLOR(brightText); } void DPlatformTheme::setLight(const QColor &light) { SET_COLOR(light); } void DPlatformTheme::setMidlight(const QColor &midlight) { SET_COLOR(midlight); } void DPlatformTheme::setDark(const QColor &dark) { SET_COLOR(dark); } void DPlatformTheme::setMid(const QColor &mid) { SET_COLOR(mid); } void DPlatformTheme::setShadow(const QColor &shadow) { SET_COLOR(shadow); } void DPlatformTheme::setHighlight(const QColor &highlight) { SET_COLOR(highlight); } void DPlatformTheme::setHighlightedText(const QColor &highlightText) { SET_COLOR(highlightText); } void DPlatformTheme::setLink(const QColor &link) { SET_COLOR(link); } void DPlatformTheme::setLinkVisited(const QColor &linkVisited) { SET_COLOR(linkVisited); } void DPlatformTheme::setItemBackground(const QColor &itemBackground) { SET_COLOR(itemBackground); } void DPlatformTheme::setTextTitle(const QColor &textTitle) { SET_COLOR(textTitle); } void DPlatformTheme::setTextTips(const QColor &textTips) { SET_COLOR(textTips); } void DPlatformTheme::setTextWarning(const QColor &textWarning) { SET_COLOR(textWarning); } void DPlatformTheme::setTextLively(const QColor &textLively) { SET_COLOR(textLively); } void DPlatformTheme::setLightLively(const QColor &lightLively) { SET_COLOR(lightLively); } void DPlatformTheme::setDarkLively(const QColor &darkLively) { SET_COLOR(darkLively); } void DPlatformTheme::setFrameBorder(const QColor &frameBorder) { SET_COLOR(frameBorder); } void DPlatformTheme::setDotsPerInch(const QString &screenName, int dpi) { D_D(DPlatformTheme); if (screenName.isEmpty()) { d->theme->setSetting("Xft/DPI", dpi); } else { d->theme->setSetting("Qt/DPI/" + screenName.toLocal8Bit(), dpi); } } void DPlatformTheme::setWindowRadius(int windowRadius) { D_D(DPlatformTheme); d->theme->setSetting("DTK/WindowRadius", windowRadius); } DGUI_END_NAMESPACE #include "moc_dplatformtheme.cpp" dtkgui-5.5.25/src/kernel/dplatformtheme.h000066400000000000000000000263541426550353200203510ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DPLATFORMTHEME_H #define DPLATFORMTHEME_H #include #include #include DGUI_BEGIN_NAMESPACE class DPlatformThemePrivate; class DPlatformTheme : public DNativeSettings { Q_OBJECT D_DECLARE_PRIVATE(DPlatformTheme) Q_PROPERTY(int cursorBlinkTime READ cursorBlinkTime WRITE setCursorBlinkTime NOTIFY cursorBlinkTimeChanged) Q_PROPERTY(int cursorBlinkTimeout READ cursorBlinkTimeout WRITE setCursorBlinkTimeout NOTIFY cursorBlinkTimeoutChanged) Q_PROPERTY(bool cursorBlink READ cursorBlink WRITE setCursorBlink NOTIFY cursorBlinkChanged) Q_PROPERTY(int doubleClickDistance READ doubleClickDistance WRITE setDoubleClickDistance NOTIFY doubleClickDistanceChanged) Q_PROPERTY(int doubleClickTime READ doubleClickTime WRITE setDoubleClickTime NOTIFY doubleClickTimeChanged) Q_PROPERTY(int dndDragThreshold READ dndDragThreshold WRITE setDndDragThreshold NOTIFY dndDragThresholdChanged) Q_PROPERTY(int windowRadius READ windowRadius WRITE setWindowRadius NOTIFY windowRadiusChanged) Q_PROPERTY(QByteArray themeName READ themeName WRITE setThemeName NOTIFY themeNameChanged) Q_PROPERTY(QByteArray iconThemeName READ iconThemeName WRITE setIconThemeName NOTIFY iconThemeNameChanged) Q_PROPERTY(QByteArray soundThemeName READ soundThemeName WRITE setSoundThemeName NOTIFY soundThemeNameChanged) // Font Q_PROPERTY(QByteArray fontName READ fontName WRITE setFontName NOTIFY fontNameChanged) Q_PROPERTY(QByteArray monoFontName READ monoFontName WRITE setMonoFontName NOTIFY monoFontNameChanged) Q_PROPERTY(qreal fontPointSize READ fontPointSize WRITE setFontPointSize NOTIFY fontPointSizeChanged) Q_PROPERTY(QByteArray gtkFontName READ gtkFontName WRITE setGtkFontName NOTIFY gtkFontNameChanged) Q_PROPERTY(QColor activeColor READ activeColor WRITE setActiveColor NOTIFY activeColorChanged) // QPalette Q_PROPERTY(QColor window READ window WRITE setWindow NOTIFY windowChanged) Q_PROPERTY(QColor windowText READ windowText WRITE setWindowText NOTIFY windowTextChanged) Q_PROPERTY(QColor base READ base WRITE setBase NOTIFY baseChanged) Q_PROPERTY(QColor alternateBase READ alternateBase WRITE setAlternateBase NOTIFY alternateBaseChanged) Q_PROPERTY(QColor toolTipBase READ toolTipBase WRITE setToolTipBase NOTIFY toolTipBaseChanged) Q_PROPERTY(QColor toolTipText READ toolTipText WRITE setToolTipText NOTIFY toolTipTextChanged) Q_PROPERTY(QColor text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QColor button READ button WRITE setButton NOTIFY buttonChanged) Q_PROPERTY(QColor buttonText READ buttonText WRITE setButtonText NOTIFY buttonTextChanged) Q_PROPERTY(QColor brightText READ brightText WRITE setBrightText NOTIFY brightTextChanged) Q_PROPERTY(QColor light READ light WRITE setLight NOTIFY lightChanged) Q_PROPERTY(QColor midlight READ midlight WRITE setMidlight NOTIFY midlightChanged) Q_PROPERTY(QColor dark READ dark WRITE setDark NOTIFY darkChanged) Q_PROPERTY(QColor mid READ mid WRITE setMid NOTIFY midChanged) Q_PROPERTY(QColor shadow READ shadow WRITE setShadow NOTIFY shadowChanged) Q_PROPERTY(QColor highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) Q_PROPERTY(QColor highlightedText READ highlightedText WRITE setHighlightedText NOTIFY highlightedTextChanged) Q_PROPERTY(QColor link READ link WRITE setLink NOTIFY linkChanged) Q_PROPERTY(QColor linkVisited READ linkVisited WRITE setLinkVisited NOTIFY linkVisitedChanged) // DPalette Q_PROPERTY(QColor itemBackground READ itemBackground WRITE setItemBackground NOTIFY itemBackgroundChanged) Q_PROPERTY(QColor textTitle READ textTitle WRITE setTextTitle NOTIFY textTitleChanged) Q_PROPERTY(QColor textTips READ textTips WRITE setTextTips NOTIFY textTipsChanged) Q_PROPERTY(QColor textWarning READ textWarning WRITE setTextWarning NOTIFY textWarningChanged) Q_PROPERTY(QColor textLively READ textLively WRITE setTextLively NOTIFY textLivelyChanged) Q_PROPERTY(QColor lightLively READ lightLively WRITE setLightLively NOTIFY lightLivelyChanged) Q_PROPERTY(QColor darkLively READ darkLively WRITE setDarkLively NOTIFY darkLivelyChanged) Q_PROPERTY(QColor frameBorder READ frameBorder WRITE setFrameBorder NOTIFY frameBorderChanged) public: explicit DPlatformTheme(quint32 window, QObject *parent = nullptr); DPlatformTheme(quint32 window, DPlatformTheme *parent); ~DPlatformTheme(); bool isValid() const; DPlatformTheme *parentTheme() const; void setFallbackProperty(bool fallback); DPalette palette() const; DPalette fetchPalette(const DPalette &base, bool *ok = nullptr) const; void setPalette(const DPalette &palette); int cursorBlinkTime() const; int cursorBlinkTimeout() const; bool cursorBlink() const; int doubleClickDistance() const; int doubleClickTime() const; int dndDragThreshold() const; int windowRadius() const; int windowRadius(int defaultValue) const; QByteArray themeName() const; QByteArray iconThemeName() const; QByteArray soundThemeName() const; QByteArray fontName() const; QByteArray monoFontName() const; qreal fontPointSize() const; QByteArray gtkFontName() const; QColor activeColor() const; bool isValidPalette() const; QColor window() const; QColor windowText() const; QColor base() const; QColor alternateBase() const; QColor toolTipBase() const; QColor toolTipText() const; QColor text() const; QColor button() const; QColor buttonText() const; QColor brightText() const; QColor light() const; QColor midlight() const; QColor dark() const; QColor mid() const; QColor shadow() const; QColor highlight() const; QColor highlightedText() const; QColor link() const; QColor linkVisited() const; QColor itemBackground() const; QColor textTitle() const; QColor textTips() const; QColor textWarning() const; QColor textLively() const; QColor lightLively() const; QColor darkLively() const; QColor frameBorder() const; int dotsPerInch(const QString &screenName = QString()) const; public Q_SLOTS: void setCursorBlinkTime(int cursorBlinkTime); void setCursorBlinkTimeout(int cursorBlinkTimeout); void setCursorBlink(bool cursorBlink); void setDoubleClickDistance(int doubleClickDistance); void setDoubleClickTime(int doubleClickTime); void setDndDragThreshold(int dndDragThreshold); void setThemeName(const QByteArray &themeName); void setIconThemeName(const QByteArray &iconThemeName); void setSoundThemeName(const QByteArray &soundThemeName); void setFontName(const QByteArray &fontName); void setMonoFontName(const QByteArray &monoFontName); void setFontPointSize(qreal fontPointSize); void setGtkFontName(const QByteArray &fontName); void setActiveColor(const QColor activeColor); void setWindow(const QColor &window); void setWindowText(const QColor &windowText); void setBase(const QColor &base); void setAlternateBase(const QColor &alternateBase); void setToolTipBase(const QColor &toolTipBase); void setToolTipText(const QColor &toolTipText); void setText(const QColor &text); void setButton(const QColor &button); void setButtonText(const QColor &buttonText); void setBrightText(const QColor &brightText); void setLight(const QColor &light); void setMidlight(const QColor &midlight); void setDark(const QColor &dark); void setMid(const QColor &mid); void setShadow(const QColor &shadow); void setHighlight(const QColor &highlight); void setHighlightedText(const QColor &highlightedText); void setLink(const QColor &link); void setLinkVisited(const QColor &linkVisited); void setItemBackground(const QColor &itemBackground); void setTextTitle(const QColor &textTitle); void setTextTips(const QColor &textTips); void setTextWarning(const QColor &textWarning); void setTextLively(const QColor &textLively); void setLightLively(const QColor &lightLively); void setDarkLively(const QColor &darkLively); void setFrameBorder(const QColor &frameBorder); void setDotsPerInch(const QString &screenName, int dpi); void setWindowRadius(int windowRadius); Q_SIGNALS: void cursorBlinkTimeChanged(int cursorBlinkTime); void cursorBlinkTimeoutChanged(int cursorBlinkTimeout); void cursorBlinkChanged(bool cursorBlink); void doubleClickDistanceChanged(int doubleClickDistance); void doubleClickTimeChanged(int doubleClickTime); void dndDragThresholdChanged(int dndDragThreshold); void themeNameChanged(QByteArray themeName); void iconThemeNameChanged(QByteArray iconThemeName); void soundThemeNameChanged(QByteArray soundThemeName); void fontNameChanged(QByteArray fontName); void monoFontNameChanged(QByteArray monoFontName); void fontPointSizeChanged(qreal fontPointSize); void gtkFontNameChanged(QByteArray fontName); void activeColorChanged(QColor activeColor); void paletteChanged(DPalette palette); void windowChanged(QColor window); void windowTextChanged(QColor windowText); void baseChanged(QColor base); void alternateBaseChanged(QColor alternateBase); void toolTipBaseChanged(QColor toolTipBase); void toolTipTextChanged(QColor toolTipText); void textChanged(QColor text); void buttonChanged(QColor button); void buttonTextChanged(QColor buttonText); void brightTextChanged(QColor brightText); void lightChanged(QColor light); void midlightChanged(QColor midlight); void darkChanged(QColor dark); void midChanged(QColor mid); void shadowChanged(QColor shadow); void highlightChanged(QColor highlight); void highlightedTextChanged(QColor highlightedText); void linkChanged(QColor link); void linkVisitedChanged(QColor linkVisited); void itemBackgroundChanged(QColor itemBackground); void textTitleChanged(QColor textTitle); void textTipsChanged(QColor textTips); void textWarningChanged(QColor textWarning); void textLivelyChanged(QColor textLively); void lightLivelyChanged(QColor lightLively); void darkLivelyChanged(QColor darkLively); void frameBorderChanged(QColor frameBorder); void dotsPerInchChanged(const QString &screen, int dpi); void windowRadiusChanged(int r); private: friend class DPlatformThemePrivate; private: D_PRIVATE_SLOT(void _q_onThemePropertyChanged(const QByteArray &name, const QVariant &value)) }; DGUI_END_NAMESPACE #endif // DPLATFORMTHEME_H dtkgui-5.5.25/src/kernel/dregionmonitor.cpp000066400000000000000000000156061426550353200207260ustar00rootroot00000000000000#include "dregionmonitor.h" #include "private/dregionmonitor_p.h" #include #include #include DGUI_BEGIN_NAMESPACE /*! \class Dtk::Gui::DRegionMonitor \inmodule dtkgui \brief 一个在指定区域内监视鼠标键盘动作的类. */ /*! \enum DRegionMonitor::RegisterdFlag DRegionMonitor::RegisterdFlag 定义了 DRegionMonitor 监听标志。 \value Motion 代表监听鼠标移动。 \value Button 代表监听鼠标按键。 \value Key 代表监听键盘按键。 */ DRegionMonitor::DRegionMonitor(QObject *parent) : QObject(parent), DObject(*new DRegionMonitorPrivate(this)) { D_D(DRegionMonitor); d->init(); } bool DRegionMonitor::registered() const { D_DC(DRegionMonitor); return !d->registerKey.isEmpty(); } QRegion DRegionMonitor::watchedRegion() const { D_DC(DRegionMonitor); return d->watchedRegion; } DRegionMonitor::RegisterdFlags DRegionMonitor::registerFlags() const { D_DC(DRegionMonitor); return d->registerdFlags; } DRegionMonitor::CoordinateType DRegionMonitor::coordinateType() const { D_DC(DRegionMonitor); return d->type; } void DRegionMonitor::registerRegion() { if (registered()) { qWarning() << "region already registered!"; return; } D_D(DRegionMonitor); d->registerMonitorRegion(); } void DRegionMonitor::unregisterRegion() { D_D(DRegionMonitor); d->unregisterMonitorRegion(); } void DRegionMonitor::setWatchedRegion(const QRegion ®ion) { D_D(DRegionMonitor); d->watchedRegion = region; if (registered()) d->registerMonitorRegion(); } /*! \property DRegionMonitor::registerdFlags \brief 监听模式属性. \brief 监听模式,需要注意 DRegionMonitor::Motion 监听鼠标移动会影响性能,默认包含,如果 需要可通过此函数去掉 DRegionMonitor::Motion . registerdFlagChanged 信号会在监听标志 registerdFlags 被改变的时候被触发. \a flags 监听模式. */ void DRegionMonitor::setRegisterFlags(RegisterdFlags flags) { D_D(DRegionMonitor); if (d->registerdFlags == flags) return; d->registerdFlags = flags; if (registered()) d->registerMonitorRegion(); Q_EMIT registerdFlagsChanged(flags); } void DRegionMonitor::setCoordinateType(DRegionMonitor::CoordinateType type) { D_D(DRegionMonitor); d->type = type; } DRegionMonitorPrivate::DRegionMonitorPrivate(DRegionMonitor *q) : DObjectPrivate(q) , eventInter(new XEventMonitor("com.deepin.api.XEventMonitor", "/com/deepin/api/XEventMonitor", QDBusConnection::sessionBus())) { } DRegionMonitorPrivate::~DRegionMonitorPrivate() { if (registered()) unregisterMonitorRegion(); eventInter->deleteLater(); } void DRegionMonitorPrivate::init() { D_Q(DRegionMonitor); QObject::connect(eventInter, SIGNAL(ButtonPress(int,int,int,QString)), q, SLOT(_q_ButtonPress(const int, const int, const int, const QString&))); QObject::connect(eventInter, SIGNAL(ButtonRelease(int,int,int,QString)), q, SLOT(_q_ButtonRelease(const int, const int, const int, const QString&))); QObject::connect(eventInter, SIGNAL(CursorMove(int,int,QString)), q, SLOT(_q_CursorMove(const int, const int, const QString&))); QObject::connect(eventInter, SIGNAL(CursorInto(int,int,QString)), q, SLOT(_q_CursorEnter(const int, const int, const QString&))); QObject::connect(eventInter, SIGNAL(CursorOut(int,int,QString)), q, SLOT(_q_CursorLeave(const int, const int, const QString&))); QObject::connect(eventInter, SIGNAL(KeyPress(QString,int,int,QString)), q, SLOT(_q_KeyPress(const QString&, const int, const int, const QString&))); QObject::connect(eventInter, SIGNAL(KeyRelease(QString,int,int,QString)), q, SLOT(_q_KeyRelease(const QString&, const int, const int, const QString&))); } void DRegionMonitorPrivate::registerMonitorRegion() { if (registered()) unregisterMonitorRegion(); if (watchedRegion.isEmpty()) { // 将监听区域设置为最大 registerKey = eventInter->RegisterArea(INT_MIN, INT_MIN, INT_MAX, INT_MAX, registerdFlags); } else { const QRect rect = watchedRegion.boundingRect(); const int x1 = rect.x(); const int y1 = rect.y(); const int x2 = x1 + rect.width(); const int y2 = y1 + rect.height(); registerKey = eventInter->RegisterArea(x1, y1, x2, y2, registerdFlags); } } void DRegionMonitorPrivate::unregisterMonitorRegion() { if (registerKey.isEmpty()) return; eventInter->UnregisterArea(registerKey); registerKey.clear(); } void DRegionMonitorPrivate::_q_ButtonPress(const int flag, const int x, const int y, const QString &key) { if (registerKey != key) return; D_Q(DRegionMonitor); Q_EMIT q->buttonPress(deviceScaledCoordinate(QPoint(x, y), qApp->devicePixelRatio()), flag); } void DRegionMonitorPrivate::_q_ButtonRelease(const int flag, const int x, const int y, const QString &key) { if (registerKey != key) return; D_Q(DRegionMonitor); Q_EMIT q->buttonRelease(deviceScaledCoordinate(QPoint(x, y), qApp->devicePixelRatio()), flag); } void DRegionMonitorPrivate::_q_CursorMove(const int x, const int y, const QString &key) { if (registerKey != key) return; D_Q(DRegionMonitor); Q_EMIT q->cursorMove(deviceScaledCoordinate(QPoint(x, y), qApp->devicePixelRatio())); } void DRegionMonitorPrivate::_q_CursorEnter(const int x, const int y, const QString &key) { if (registerKey != key) return; D_Q(DRegionMonitor); Q_EMIT q->cursorEnter(deviceScaledCoordinate(QPoint(x, y), qApp->devicePixelRatio())); } void DRegionMonitorPrivate::_q_CursorLeave(const int x, const int y, const QString &key) { if (registerKey != key) return; D_Q(DRegionMonitor); Q_EMIT q->cursorLeave(deviceScaledCoordinate(QPoint(x, y), qApp->devicePixelRatio())); } void DRegionMonitorPrivate::_q_KeyPress(const QString &keyname, const int x, const int y, const QString &key) { if (registerKey != key) return; Q_UNUSED(x); Q_UNUSED(y); D_Q(DRegionMonitor); Q_EMIT q->keyPress(keyname); } void DRegionMonitorPrivate::_q_KeyRelease(const QString &keyname, const int x, const int y, const QString &key) { if (registerKey != key) return; Q_UNUSED(x); Q_UNUSED(y); D_Q(DRegionMonitor); Q_EMIT q->keyRelease(keyname); } const QPoint DRegionMonitorPrivate::deviceScaledCoordinate(const QPoint &p, const double ratio) const { D_QC(DRegionMonitor); if (type == q->Original) { return p; } for (const auto *s : qApp->screens()) { const QRect &g(s->geometry()); const QRect realRect(g.topLeft(), g.size() * ratio); if (realRect.contains(p)) return QPoint(realRect.topLeft() + (p - realRect.topLeft()) / ratio); } return p / ratio; } DGUI_END_NAMESPACE #include "moc_dregionmonitor.cpp" dtkgui-5.5.25/src/kernel/dregionmonitor.h000066400000000000000000000053461426550353200203730ustar00rootroot00000000000000#ifndef DREGIONMONITOR_H #define DREGIONMONITOR_H #include #include #include DGUI_BEGIN_NAMESPACE class DRegionMonitorPrivate; class DRegionMonitor : public QObject, public DTK_CORE_NAMESPACE::DObject { Q_OBJECT D_DECLARE_PRIVATE(DRegionMonitor) Q_DISABLE_COPY(DRegionMonitor) Q_PROPERTY(CoordinateType coordinateType READ coordinateType WRITE setCoordinateType NOTIFY coordinateTypeChanged) Q_PROPERTY(RegisterdFlags registerdFlags READ registerFlags WRITE setRegisterFlags NOTIFY registerdFlagsChanged) public: explicit DRegionMonitor(QObject *parent = nullptr); enum RegisterdFlag { Motion = 1 << 0, Button = 1 << 1, Key = 1 << 2 }; Q_DECLARE_FLAGS(RegisterdFlags, RegisterdFlag) enum WatchedFlags { Button_Left = 1, Button_Middle, Button_Right, Wheel_Up, Wheel_Down }; enum CoordinateType { ScaleRatio, Original }; Q_ENUM(CoordinateType) bool registered() const; QRegion watchedRegion() const; RegisterdFlags registerFlags() const; CoordinateType coordinateType() const; Q_SIGNALS: void buttonPress(const QPoint &p, const int flag) const; void buttonRelease(const QPoint &p, const int flag) const; void cursorMove(const QPoint &p) const; void cursorEnter(const QPoint &p) const; void cursorLeave(const QPoint &p) const; void keyPress(const QString &keyname) const; void keyRelease(const QString &keyname) const; void registerdFlagsChanged(RegisterdFlags flags) const; void coordinateTypeChanged(CoordinateType type) const; public Q_SLOTS: void registerRegion(); inline void registerRegion(const QRegion ®ion) { setWatchedRegion(region); registerRegion(); } void unregisterRegion(); void setWatchedRegion(const QRegion ®ion); void setRegisterFlags(RegisterdFlags flags); void setCoordinateType(CoordinateType type); private: Q_PRIVATE_SLOT(d_func(), void _q_ButtonPress(const int, const int, const int, const QString&)) Q_PRIVATE_SLOT(d_func(), void _q_ButtonRelease(const int, const int, const int, const QString&)) Q_PRIVATE_SLOT(d_func(), void _q_CursorMove(const int, const int, const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_CursorEnter(const int, const int, const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_CursorLeave(const int, const int, const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_KeyPress(const QString &, const int, const int, const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_KeyRelease(const QString &, const int, const int, const QString &)) }; Q_DECLARE_OPERATORS_FOR_FLAGS (DRegionMonitor::RegisterdFlags); DGUI_END_NAMESPACE #endif // DREGIONMONITOR_H dtkgui-5.5.25/src/kernel/dwindowgroupleader.cpp000066400000000000000000000146321426550353200215720ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dwindowgroupleader.h" #include #include #include DGUI_BEGIN_NAMESPACE #define DEFINE_CONST_CHAR(Name) const char _##Name[] = "_d_" #Name DEFINE_CONST_CHAR(groupLeader); DEFINE_CONST_CHAR(createGroupWindow); DEFINE_CONST_CHAR(destoryGroupWindow); DEFINE_CONST_CHAR(setWindowGroup); DEFINE_CONST_CHAR(clientLeader); class DWindowGroupLeaderPrivate { public: explicit DWindowGroupLeaderPrivate(quint32 groupLeader) : groupLeader(groupLeader) { QFunctionPointer clientLeaderFun = qApp->platformFunction(_clientLeader); if (clientLeaderFun) { clientLeader = reinterpret_cast(clientLeaderFun)(); } } quint32 groupLeader; quint32 clientLeader = 0; bool groupLeaderFromUser = false; QList> windowList; void ensureGroupLeader(); bool setWindowGroupLeader(quint32 window, quint32 groupLeader); }; void DWindowGroupLeaderPrivate::ensureGroupLeader() { if (groupLeader != 0) return; QFunctionPointer createGroupWindow = qApp->platformFunction(_createGroupWindow); if (!createGroupWindow) return; groupLeader = reinterpret_cast(createGroupWindow)(); } bool DWindowGroupLeaderPrivate::setWindowGroupLeader(quint32 window, quint32 groupLeader) { QFunctionPointer setWindowGroup = qApp->platformFunction(_setWindowGroup); if (!setWindowGroup) { return false; } reinterpret_cast(setWindowGroup)(window, groupLeader); return true; } /*! \class Dtk::Gui::DWindowGroupLeader \inmodule dtkgui \brief DWindowGroupLeader 用于设置窗口所在的组,可以把多个窗口加到同一个组. 在dxcb平台上,所有未指定组的窗口都会被分配到 DWindowGroupLeader::clientLeaderId 这个组,且在窗口对应的本地窗口被创建时,会对 Qt::Dialog、Qt::Sheet、Qt::Tool、 Qt::SplashScreen、Qt::ToolTip、Qt::Drawer、Qt::Popup 类型的窗口设置 WM_TRANSIENT_FOR 属性,对于此类型的窗口,如果没有手动调用 QWindow::setTransientParent , 则会将其 WM_TRANSIENT_FOR 属性设置为所在组id,得到的效果就是:会保证此窗口显示到这个组所有其它窗口 之上。例子: \code DWindowGroupLeader leader; QWindow wa, wb; QWindow topWindow; leader.addWindow(&wa); leader.addWindow(&wb); leader.addWindow(&topWindow); wa.setTitle("窗口wa"); wa.resize(300, 100); wa.show(); wb.setTitle("窗口wb"); wb.resize(300, 100); wb.show(); topWindow.setTitle("窗口topWindow"); topWindow.setFlag(Qt::Dialog); topWindow.resize(300, 300); topWindow.show(); \endcode 窗口topWindow一直处于窗口wa和wb上层 \image wa_wb_topWindow.gif 如果一个组内同时存在多个未设置过 QWindow::setTransientParent 的 Qt::Dialog(其它会自动设置 WM_TRANSIENT_FOR 属性的窗口也成立)类型的窗口,这些窗口之间不会互相影响显示顺序,具体的规则和 X11 ICCCM 标准一致。 \l {https://tronche.com/gui/x/icccm/sec-4.html#WM_TRANSIENT_FOR} \sa DWindowGroupLeader::clientLeaderId \sa Dtk::Widget::DApplication::loadDXcbPlugin */ /*! \brief DWindowGroupLeader::DWindowGroupLeader \a groupId 为0时会在需要时自动创建一个有效的 groupLeaderId \sa DWindowGroupLeader::groupLeaderId */ DWindowGroupLeader::DWindowGroupLeader(quint32 groupId) : d_ptr(new DWindowGroupLeaderPrivate(groupId)) { if (groupId != 0) d_ptr->groupLeaderFromUser = true; } /*! \brief DWindowGroupLeader::~DWindowGroupLeader 对象销毁时会释放由自己自动创建的 groupLeaderId \sa DWindowGroupLeader::groupLeaderId */ DWindowGroupLeader::~DWindowGroupLeader() { Q_D(DWindowGroupLeader); for (auto window : d->windowList) removeWindow(window); if (!d->groupLeaderFromUser) { QFunctionPointer destoryGroupWindow = qApp->platformFunction(_destoryGroupWindow); if (!destoryGroupWindow) return; reinterpret_cast(destoryGroupWindow)(d->groupLeader); } } /*! \brief DWindowGroupLeader::groupLeaderId \return 返回组的id,类似于 QWindow::winId \warning 如果没有一个有效的id,则会先创建一个新的组id */ quint32 DWindowGroupLeader::groupLeaderId() const { Q_D(const DWindowGroupLeader); const_cast(d)->ensureGroupLeader(); return d->groupLeader; } /*! \brief DWindowGroupLeader::clientLeaderId \return 返回应用程序默认的组id */ quint32 DWindowGroupLeader::clientLeaderId() const { Q_D(const DWindowGroupLeader); return d->clientLeader; } /*! \brief DWindowGroupLeader::addWindow 将窗口添加到这个组 \a window \warning 每个窗口只能有一个组,添加到新的组时,将不再受旧的组所带来的任何影响 */ void DWindowGroupLeader::addWindow(QWindow *window) { Q_ASSERT(window); Q_D(DWindowGroupLeader); d->ensureGroupLeader(); window->setProperty(_groupLeader, d->groupLeader); if (window->handle()) { d->setWindowGroupLeader(window->winId(), d->groupLeader); } d->windowList << window; } /*! \brief DWindowGroupLeader::removeWindow 将窗口从这个组中移除 \a window \warning 窗口被移除后将不再受此组带来的任何影响 */ void DWindowGroupLeader::removeWindow(QWindow *window) { if (!window) return; window->setProperty(_groupLeader, QVariant()); Q_D(DWindowGroupLeader); if (window->handle()) { d->setWindowGroupLeader(window->winId(), d->clientLeader); } } DGUI_END_NAMESPACE dtkgui-5.5.25/src/kernel/dwindowgroupleader.h000066400000000000000000000026471426550353200212420ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DWINDOWGROUPLEADER_H #define DWINDOWGROUPLEADER_H #include #include QT_BEGIN_NAMESPACE class QWindow; QT_END_NAMESPACE DGUI_BEGIN_NAMESPACE class DWindowGroupLeaderPrivate; class DWindowGroupLeader { public: explicit DWindowGroupLeader(quint32 groupId = 0); ~DWindowGroupLeader(); quint32 groupLeaderId() const; quint32 clientLeaderId() const; void addWindow(QWindow *window); void removeWindow(QWindow *window); private: QScopedPointer d_ptr; Q_DECLARE_PRIVATE(DWindowGroupLeader) }; DGUI_END_NAMESPACE #endif // DWINDOWGROUPLEADER_H dtkgui-5.5.25/src/kernel/dwindowmanagerhelper.cpp000066400000000000000000000660531426550353200220770ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dwindowmanagerhelper.h" #include "dforeignwindow.h" #include #include #include #include #include #include #include DGUI_BEGIN_NAMESPACE #define DEFINE_CONST_CHAR(Name) const char _##Name[] = "_d_" #Name #define MWM_FUNC_ALL (1L << 0) #define MWM_DECOR_ALL (1L << 0) // functions DEFINE_CONST_CHAR(hasBlurWindow); DEFINE_CONST_CHAR(hasComposite); DEFINE_CONST_CHAR(hasNoTitlebar); DEFINE_CONST_CHAR(hasWallpaperEffect); DEFINE_CONST_CHAR(windowManagerName); DEFINE_CONST_CHAR(connectWindowManagerChangedSignal); DEFINE_CONST_CHAR(connectHasBlurWindowChanged); DEFINE_CONST_CHAR(connectHasCompositeChanged); DEFINE_CONST_CHAR(connectHasNoTitlebarChanged); DEFINE_CONST_CHAR(connectHasWallpaperEffectChanged); DEFINE_CONST_CHAR(getCurrentWorkspaceWindows); DEFINE_CONST_CHAR(getWindows); DEFINE_CONST_CHAR(windowFromPoint); DEFINE_CONST_CHAR(connectWindowListChanged); DEFINE_CONST_CHAR(setMWMFunctions); DEFINE_CONST_CHAR(getMWMFunctions); DEFINE_CONST_CHAR(setMWMDecorations); DEFINE_CONST_CHAR(getMWMDecorations); DEFINE_CONST_CHAR(connectWindowMotifWMHintsChanged); DEFINE_CONST_CHAR(popupSystemWindowMenu); DEFINE_CONST_CHAR(setWMClassName); static bool connectWindowManagerChangedSignal(QObject *object, std::function slot) { QFunctionPointer connectWindowManagerChangedSignal = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) connectWindowManagerChangedSignal = qApp->platformFunction(_connectWindowManagerChangedSignal); #endif return connectWindowManagerChangedSignal && reinterpret_cast)>(connectWindowManagerChangedSignal)(object, slot); } static bool connectHasBlurWindowChanged(QObject *object, std::function slot) { QFunctionPointer connectHasBlurWindowChanged = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) connectHasBlurWindowChanged = qApp->platformFunction(_connectHasBlurWindowChanged); #endif return connectHasBlurWindowChanged && reinterpret_cast)>(connectHasBlurWindowChanged)(object, slot); } static bool connectHasCompositeChanged(QObject *object, std::function slot) { QFunctionPointer connectHasCompositeChanged = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) connectHasCompositeChanged = qApp->platformFunction(_connectHasCompositeChanged); #endif return connectHasCompositeChanged && reinterpret_cast)>(connectHasCompositeChanged)(object, slot); } static bool connectHasNoTitlebarChanged(QObject *object, std::function slot) { QFunctionPointer connectHasNoTitlebarChanged = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) connectHasNoTitlebarChanged = qApp->platformFunction(_connectHasNoTitlebarChanged); #endif return connectHasNoTitlebarChanged && reinterpret_cast)>(connectHasNoTitlebarChanged)(object, slot); } static bool connectHasWallpaperEffectChanged(QObject *object, std::function slot) { QFunctionPointer connectHasWallpaperEffectChanged = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) connectHasWallpaperEffectChanged = qApp->platformFunction(_connectHasWallpaperEffectChanged); #endif return connectHasWallpaperEffectChanged && reinterpret_cast)>(connectHasWallpaperEffectChanged)(object, slot); } static bool connectWindowListChanged(QObject *object, std::function slot) { QFunctionPointer connectWindowListChanged = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) connectWindowListChanged = qApp->platformFunction(_connectWindowListChanged); #endif return connectWindowListChanged && reinterpret_cast)>(connectWindowListChanged)(object, slot); } static bool connectWindowMotifWMHintsChanged(QObject *object, std::function slot) { QFunctionPointer connectWindowMotifWMHintsChanged = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) connectWindowMotifWMHintsChanged = qApp->platformFunction(_connectWindowMotifWMHintsChanged); #endif return connectWindowMotifWMHintsChanged && reinterpret_cast)>(connectWindowMotifWMHintsChanged)(object, slot); } class DWindowManagerHelperPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate { public: explicit DWindowManagerHelperPrivate(DWindowManagerHelper *qq) : DObjectPrivate(qq) {} mutable QList windowList; }; class DWindowManagerHelper_ : public DWindowManagerHelper {}; Q_GLOBAL_STATIC(DWindowManagerHelper_, wmhGlobal) /*! \class Dtk::Gui::DWindowManagerHelper \inmodule dtkgui \brief 提供与窗口管理器交互的接口,同 \a DPlatformWindowHandle 依赖 dxcb 插件. dxcb 插件抽象出所有需要和X11平台交互的接口以供上层调用,DTK 使用插件中提供的接口再 次封装提供给应用程序使用,从设计角度讲,DTK库中不应该直接使用任何跟平台相关的接口 (如:X11、Wayland、Windows),在这样的结构支撑下,在一个新的平台上,只需要提供和 dxcb 同样的接口,DTK应用即可无缝迁移。 \sa {https://github.com/linuxdeepin/qt5dxcb-plugin/}{dxcb插件} \sa Dtk::Widget::DApplication::loadDXcbPlugin \sa Dtk::Widget::DApplication::isDXcbPlatform \sa Dtk::Widget::DPlatformWindowHandle */ /*! \property DWindowManagerHelper::hasBlurWindow \brief 窗口管理器是否支持窗口背景模糊特效 \note 在 dxcb 插件中目前只支持 deepin-wm 和 kwin 这两种窗管的模糊特效 \note 只读 */ /*! \property DWindowManagerHelper::hasComposite \brief 窗口管理器是否支持混成效果。如果不支持混成,则表示所有窗口的背景都不能透明, 随之而来也不会有窗口阴影等效果,不规则窗口的边缘也会存在锯齿。 \note 只读 */ /*! \property DWindowManagerHelper::hasNoTitlebar \brief 窗口管理器是否支持隐藏窗口标题栏。如果支持,则 DPlatformWindowHandle::enableDXcbForWindow 会优先使用此方法支持自定义窗口标题栏。 \note 只读 \sa Dtk::Gui::DPlatformHandle::setEnabledNoTitlebarForWindow */ /*! \property DWindowManagerHelper::hasWallpaperEffect \brief 窗口管理器是否支持窗口背景特效绘制。如果支持,则 绘制背景到透明窗口 会使用此方法开启特效窗口壁纸背景绘制。 \note 只读 \sa hasWallpaperEffectChanged() */ /*! \enum Dtk::Gui::DWindowManagerHelper::MotifFunction MotifFunction::MotifFunction 窗口管理器对窗口所能控制的行为 \value FUNC_RESIZE 控制窗口大小。如果存在此标志,则窗口管理器可以改变窗口大小(如使用鼠标拖拽窗口边缘), 否则无法通过外部行为调整窗口大小。 \code DMainWindow w; w.resize(400, 200); w.show(); DWindowManagerHelper::setMotifFunctions(w.windowHandle(), DWindowManagerHelper::FUNC_RESIZE, false); \endcode \image disable_resize_function.gif \note 普通窗口默认存在此标志,对于 Qt::Popup 和 Qt::BypassWindowManagerHint 类型的窗口,不受此标志位影响 \note 设置此标志后也会影响窗口标题栏对应功能入口的状态 \note 对于使用系统标题栏的窗口,此功能和具体窗口管理器实现相关,deepin-wm 中设置 此标志无效。 \sa Dtk::Gui::DPlatformHandle::enableDXcbForWindow \sa Dtk::Gui::DPlatformHandle::isEnabledDXcb \value FUNC_MOVE 控制窗口位置。如果存在此标志,则窗口管理器可以移动窗口(如使用鼠标拖动标题栏),否则 无法通过外部行为移动窗口位置。 \code DWindowManagerHelper::setMotifFunctions(w.windowHandle(), DWindowManagerHelper::FUNC_MOVE, false); \endcode \image disable_move_function.gif \value FUNC_MINIMIZE 最小化窗口。如果存在此标志,则窗口可以被最小化(如点击标题栏的最小化按钮),否则无法 通过外部行为最小化窗口。 \code DWindowManagerHelper::setMotifFunctions(w.windowHandle(), DWindowManagerHelper::FUNC_MINIMIZE, false); \endcode \note 设置此标志后也会影响窗口标题栏对应功能入口的状态 \value FUNC_MAXIMIZE 最大化窗口。如果存在此标志,则窗口可以被最大化(如点击标题栏的最大化按钮),否则无法 通过外部行为最大化窗口。 \code DWindowManagerHelper::setMotifFunctions(w.windowHandle(), DWindowManagerHelper::FUNC_MAXIMIZE, false); \endcode \note 设置此标志后也会影响窗口标题栏对应功能入口的状态 \value FUNC_CLOSE 关闭窗口。如果存在此标志,则窗口可以被关闭(如点击标题栏的关闭按钮或使用Alt+F4快捷键), 否则无法通过外部行为关闭窗口。 \code DWindowManagerHelper::setMotifFunctions(w.windowHandle(), DWindowManagerHelper::FUNC_CLOSE, false); \endcode \note 设置此标志后也会影响窗口标题栏对应功能入口的状态 \value FUNC_ALL 所有功能性行为 */ /*! \enum Dtk::Gui::DWindowManagerHelper::MotifDecoration MotifFunction::MotifDecoration 窗口管理器对窗口添加的修饰。只影响窗口上对应功能 的入口,不影响实际的功能,比如:禁用掉 FUNC_MAXIMIZE 后,还可以使用快捷键最大化窗口 \value DECOR_BORDER 窗口描边。如果存在此标志,则窗口管理器会为窗口绘制描边,否则窗口没有描边。 否则无法通过外部行为调整窗口大小。 \note 只支持使用系统标题栏的窗口,此功能和具体窗口管理器实现相关,deepin-wm 中设置 此标志无效。 \value DECOR_RESIZEH 改变窗口大小。如果存在此标志,则窗口管理器会在窗口的修饰上显示一个更改窗口大小的控件, 否则无此控件。 \note 只支持使用系统标题栏的窗口,此功能和具体窗口管理器实现相关,deepin-wm 中设置 此标志无效。 \value DECOR_TITLE 窗口标题。如果存在此标志,则窗口管理器会在窗口的修饰上显示窗口标题,否则不显示。 \note 只支持使用系统标题栏的窗口,此功能和具体窗口管理器实现相关,deepin-wm 中设置 此标志无效。 \value DECOR_MENU 窗口菜单。如果存在此标志,则窗口管理器会在窗口的修饰上显示一个窗口菜单控件,否则不显示。 \note 只支持使用系统标题栏的窗口,此功能和具体窗口管理器实现相关,deepin-wm 中设置 此标志无效。 \value DECOR_MINIMIZE 窗口最小化。如果存在此标志,则窗口管理器会在窗口的修饰上显示一个最小化窗口控件,否则不显示。 \note 只支持使用系统标题栏的窗口,此功能和具体窗口管理器实现相关,deepin-wm 中设置 此标志无效。 \sa Qt::WindowMinimizeButtonHint \value DECOR_MAXIMIZE 窗口最大化。如果存在此标志,则窗口管理器会在窗口的修饰上显示一个最大化窗口控件,否则不显示。 \note 只支持使用系统标题栏的窗口,此功能和具体窗口管理器实现相关,deepin-wm 中设置 此标志无效。 \sa Qt::WindowMaximizeButtonHint \value DECOR_ALL 所有窗口修饰。 */ /*! \enum Dtk::Gui::DWindowManagerHelper::WMName DWindowManagerHelper::WMName 窗口管理器类型 \value DeepinWM 深度系统桌面环境窗口管理器 \value KWinWM KDE系统桌面环境窗口管理器 \value OtherWM 其它窗口管理器 */ /*! \fn void DWindowManagerHelper::windowManagerChanged() \brief 信号会在当前环境窗口管理器变化时被发送. */ /*! \fn void DWindowManagerHelper::hasBlurWindowChanged() \brief 信号会在 hasBlurWindow 属性的值改变时被发送. */ /*! \fn void DWindowManagerHelper::hasCompositeChanged() \brief 信号会在 hasComposite 属性的值改变时被发送. */ /*! \fn void DWindowManagerHelper::hasNoTitlebarChanged() \brief 信号会在 hasNoTitlebar 属性的值改变时被发送. */ /*! \fn void DWindowManagerHelper::hasWallpaperEffectChanged() \brief 信号会在 hasWallpaperEffect 属性的值改变时被发送. */ /*! \fn void DWindowManagerHelper::windowListChanged() \brief 信号会在当前环境本地窗口列表变化时被发送。包含打开新窗口、关闭窗口、改变窗口的 层叠顺序. */ /*! \fn void DWindowManagerHelper::windowMotifWMHintsChanged(quint32 winId) \brief 信号会在窗口功能或修饰标志改变时被发送. \a winId 窗口id \note 只对当前应用程序中的窗口有效 */ DWindowManagerHelper::~DWindowManagerHelper() { D_DC(DWindowManagerHelper); for (QWindow *w : d->windowList) { w->deleteLater(); } } /*! \brief DWindowManagerHelper::instance DWindowManagerHelper 的单例对象,使用 Q_GLOBAL_STATIC 定义,在第一次调用时实例化。 \return */ DWindowManagerHelper *DWindowManagerHelper::instance() { return wmhGlobal; } /*! \brief DWindowManagerHelper::setMotifFunctions 设置窗口的功能性标志,会覆盖之前的设置 \a window \a hints */ void DWindowManagerHelper::setMotifFunctions(const QWindow *window, MotifFunctions hints) { QFunctionPointer setMWMFunctions = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) setMWMFunctions = qApp->platformFunction(_setMWMFunctions); #endif if (setMWMFunctions && window->handle()) { /* fix bug: 18775, 3391 当所有function标志都设置时,用MWM_FUNC_ALL代替会导致窗管无法正确处理 dock栏发送的关闭消息.所以取消此设置 if (hints == FUNC_ALL) hints = (MotifFunction)MWM_FUNC_ALL; */ reinterpret_cast(setMWMFunctions)(window->handle()->winId(), (quint32)hints); } } /*! \brief DWindowManagerHelper::setMotifFunctions 设置窗口某些标志位的开启状态,不影响其它标志位 \a window \a hints 要设置的标志位 \a on 如果值为 true 则开启标志,否则关闭 \return 返回设置后的窗口标志 */ DWindowManagerHelper::MotifFunctions DWindowManagerHelper::setMotifFunctions(const QWindow *window, MotifFunctions hints, bool on) { MotifFunctions old_hints = getMotifFunctions(window); if (on) hints |= old_hints; else hints = old_hints & ~hints; setMotifFunctions(window, hints); return hints; } /*! \brief DWindowManagerHelper::getMotifFunctions \a window \return 返回窗口当前的功能标志 */ DWindowManagerHelper::MotifFunctions DWindowManagerHelper::getMotifFunctions(const QWindow *window) { QFunctionPointer getMWMFunctions = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) getMWMFunctions = qApp->platformFunction(_getMWMFunctions); #endif if (getMWMFunctions && window->handle()) { quint32 hints = reinterpret_cast(getMWMFunctions)(window->handle()->winId()); if (!(hints & MWM_FUNC_ALL)) return (MotifFunctions)hints; } return FUNC_ALL; } /*! \brief DWindowManagerHelper::setMotifDecorations 设置窗口的修饰性标志,会覆盖之前的设置 \a window \a hints */ void DWindowManagerHelper::setMotifDecorations(const QWindow *window, MotifDecorations hints) { QFunctionPointer setMWMDecorations = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) setMWMDecorations = qApp->platformFunction(_setMWMDecorations); #endif if (setMWMDecorations && window->handle()) { if (hints == DECOR_ALL) hints = (MotifDecoration)MWM_DECOR_ALL; reinterpret_cast(setMWMDecorations)(window->handle()->winId(), (quint32)hints); } } /*! \brief DWindowManagerHelper::setMotifFunctions 设置窗口某些标志位的开启状态,不影响其它标志位 \a window \a hints 要设置的标志位 \a on 如果值为 true 则开启标志,否则关闭 \return 返回设置后的窗口标志 */ DWindowManagerHelper::MotifDecorations DWindowManagerHelper::setMotifDecorations(const QWindow *window, MotifDecorations hints, bool on) { MotifDecorations old_hints = getMotifDecorations(window); if (on) hints |= old_hints; else hints = old_hints & ~hints; setMotifDecorations(window, hints); return hints; } /*! \brief DWindowManagerHelper::getMotifFunctions \a window \return 返回窗口当前的修饰标志 */ DWindowManagerHelper::MotifDecorations DWindowManagerHelper::getMotifDecorations(const QWindow *window) { QFunctionPointer getMWMDecorations = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) getMWMDecorations = qApp->platformFunction(_getMWMDecorations); #endif if (getMWMDecorations && window->handle()) { quint32 hints = reinterpret_cast(getMWMDecorations)(window->handle()->winId()); if (!(hints & MWM_DECOR_ALL)) return (MotifDecorations)hints; } return DECOR_ALL; } /*! \brief DWindowManagerHelper::setWmWindowTypes 直接设置窗口管理器层级提供的窗口类型,如DesktopType和DockType类型也被 桌面环境需要,但是Qt自身并没有提供对应的设置接口 \a window \a types */ void DWindowManagerHelper::setWmWindowTypes(QWindow *window, WmWindowTypes types) { const int _types = static_cast(types); QXcbWindowFunctions::setWmWindowType(window, static_cast(_types)); } /*! \brief DWindowManagerHelper::setWmClassName 设置x11环境上默认使用的wm class name,主要是在窗口创建时用于设置WM_CLASS窗口属性 \a name \note 如果值为空,Qt将在下次使用此值时根据程序名称再次初始化此值 \sa QCoreApplication::applicationName */ void DWindowManagerHelper::setWmClassName(const QByteArray &name) { typedef void (*SetWmNameType)(const QByteArray&); return QPlatformHeaderHelper::callPlatformFunction(_setWMClassName, name); } /*! \brief DWindowManagerHelper::popupSystemWindowMenu 显示窗口管理器对窗口的菜单,和有边框的窗口在标题栏上点击鼠标右键弹出的菜单内容一致。 在 DMainWindow 的标题栏上点击鼠标右键会调用此函数打开系统菜单: \image window_system_menu.gif \a window */ void DWindowManagerHelper::popupSystemWindowMenu(const QWindow *window) { QFunctionPointer popupSystemWindowMenu = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) popupSystemWindowMenu = qApp->platformFunction(_popupSystemWindowMenu); #endif if (popupSystemWindowMenu && window->handle()) { reinterpret_cast(popupSystemWindowMenu)(window->handle()->winId()); } } /*! \brief DWindowManagerHelper::hasBlurWindow \return 如果当前窗口管理器支持窗口背景模糊特效则返回 true,否则返回 false */ bool DWindowManagerHelper::hasBlurWindow() const { QFunctionPointer wmHasBlurWindow = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) wmHasBlurWindow = qApp->platformFunction(_hasBlurWindow); #endif return wmHasBlurWindow && reinterpret_cast(wmHasBlurWindow)(); } /*! \brief DWindowManagerHelper::hasComposite \return 如果当前窗口管理器支持混成则返回 true,否则返回 false */ bool DWindowManagerHelper::hasComposite() const { QFunctionPointer hasComposite = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) hasComposite = qApp->platformFunction(_hasComposite); #endif if (!hasComposite) { #ifdef Q_OS_LINUX if (DGuiApplicationHelper::isXWindowPlatform()) { QPlatformNativeInterface *native = qApp->platformNativeInterface(); if (Q_LIKELY(native)) { QScreen *scr = QGuiApplication::primaryScreen(); return native->nativeResourceForScreen(QByteArray("compositingEnabled"), scr); } } #endif // 在其它平台上默认认为混成是开启的 return true; } return reinterpret_cast(hasComposite)(); } /*! \brief DWindowManagerHelper::hasNoTitlebar \return 如果窗口管理器当前支持设置隐藏窗口标题栏则返回 true,否则返回 false */ bool DWindowManagerHelper::hasNoTitlebar() const { QFunctionPointer hasNoTitlebar = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) hasNoTitlebar = qApp->platformFunction(_hasNoTitlebar); #endif return hasNoTitlebar && reinterpret_cast(hasNoTitlebar)(); } /*! \brief DWindowManagerHelper::hasWallpaperEffect \return 如果窗口管理器当前支持背景图片特效绘制返回 true,否则返回 false */ bool DWindowManagerHelper::hasWallpaperEffect() const { QFunctionPointer hasWallpaperEffect = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) hasWallpaperEffect = qApp->platformFunction(_hasWallpaperEffect); #endif return hasWallpaperEffect && reinterpret_cast(hasWallpaperEffect)(); } /*! \brief DWindowManagerHelper::windowManagerNameString \return 返回窗口管理器名称。在X11平台上,此值为窗口管理器对应窗口的 _NET_WM_NAME 的值 \l {https://specifications.freedesktop.org/wm-spec/1.3/ar01s03.html}{_NET_SUPPORTING_WM_CHECK} \l {https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html}{_NET_WM_NAME} */ QString DWindowManagerHelper::windowManagerNameString() const { QFunctionPointer windowManagerName = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) windowManagerName = qApp->platformFunction(_windowManagerName); #endif return windowManagerName ? reinterpret_cast(windowManagerName)() : QString(); } /*! \brief DWindowManagerHelper::windowManagerName \return 返回当前窗口管理器类型 \sa DWindowManagerHelper::windowManagerNameString */ DWindowManagerHelper::WMName DWindowManagerHelper::windowManagerName() const { const QString &wmName = windowManagerNameString(); if (wmName == QStringLiteral("Mutter(DeepinGala)")) { return DeepinWM; } if (wmName == QStringLiteral("KWin")) { return KWinWM; } return OtherWM; } /*! \brief DWindowManagerHelper::allWindowIdList \return 返回当前环境所有本地窗口的窗口id列表 \note 顺序和窗口层叠顺序相关,显示越靠下层的窗口在列表中顺序越靠前 \sa DWindowManagerHelper::currentWorkspaceWindowIdList */ QVector DWindowManagerHelper::allWindowIdList() const { QFunctionPointer wmClientList = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) wmClientList = qApp->platformFunction(_getWindows); #endif if (!wmClientList) return QVector(); return reinterpret_cast(*)()>(wmClientList)(); } /*! \brief DWindowManagerHelper::currentWorkspaceWindowIdList \return 返回当前工作区所有本地窗口的窗口id列表 \note 顺序和窗口层叠顺序相关,显示越靠下层的窗口在列表中顺序越靠前 \sa DWindowManagerHelper::allWindowIdList */ QVector DWindowManagerHelper::currentWorkspaceWindowIdList() const { QFunctionPointer wmClientList = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) wmClientList = qApp->platformFunction(_getCurrentWorkspaceWindows); #endif if (!wmClientList) return QVector(); return reinterpret_cast(*)()>(wmClientList)(); } /*! \brief DWindowManagerHelper::currentWorkspaceWindowIdList \return 返回当前工作区所有本地窗口对象列表。和 currentWorkspaceWindowIdList 类似,只不过自动通过窗口id创建了 DForeignWindow 对象 \note 顺序和窗口层叠顺序相关,显示越靠下层的窗口在列表中顺序越靠前 \note 列表中对象的生命周期由 DForeignWindow 负责 \warning 此列表中不包含由当前应用创建的窗口 \sa DWindowManagerHelper::currentWorkspaceWindowIdList \sa DForeignWindow::fromWinId */ QList DWindowManagerHelper::currentWorkspaceWindows() const { D_DC(DWindowManagerHelper); for (QWindow *w : d->windowList) { w->deleteLater(); } d->windowList.clear(); QList currentApplicationWindowList; const QWindowList &list = qApp->allWindows(); currentApplicationWindowList.reserve(list.size()); for (auto window : list) { if (window->property("_q_foreignWinId").isValid()) continue; currentApplicationWindowList.append(window->winId()); } QVector wmClientList = currentWorkspaceWindowIdList(); for (WId wid : wmClientList) { if (currentApplicationWindowList.contains(wid)) continue; if (DForeignWindow *w = DForeignWindow::fromWinId(wid)) { d->windowList << w; } } return d->windowList; } /*! \brief DWindowManagerHelper::windowFromPoint \return 返回 \a p 位置的窗口 Id,如果出错返回 0 \note 可以通过 DForeignWindow::fromWinId 创建窗口对象 */ quint32 DWindowManagerHelper::windowFromPoint(const QPoint &p) { QFunctionPointer winFromPoint = Q_NULLPTR; #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) winFromPoint = qApp->platformFunction(_windowFromPoint); #endif if (!winFromPoint) return 0; return reinterpret_cast(winFromPoint)(p); } /*! \brief DWindowManagerHelper::DWindowManagerHelper 不允许直接实例化此对象 \a parent \sa DWindowManagerHelper::instance */ DWindowManagerHelper::DWindowManagerHelper(QObject *parent) : QObject(parent) , DObject(*new DWindowManagerHelperPrivate(this)) { connectWindowManagerChangedSignal(this, [this] { Q_EMIT windowManagerChanged(); }); connectHasBlurWindowChanged(this, [this] { Q_EMIT hasBlurWindowChanged(); }); connectHasCompositeChanged(this, [this] { Q_EMIT hasCompositeChanged(); }); connectHasNoTitlebarChanged(this, [this] { Q_EMIT hasNoTitlebarChanged(); }); connectHasWallpaperEffectChanged(this, [this] { Q_EMIT hasWallpaperEffectChanged(); }); connectWindowListChanged(this, [this] { Q_EMIT windowListChanged(); }); connectWindowMotifWMHintsChanged(this, [this] (quint32 winId) { Q_EMIT windowMotifWMHintsChanged(winId); }); } DGUI_END_NAMESPACE dtkgui-5.5.25/src/kernel/dwindowmanagerhelper.h000066400000000000000000000115271426550353200215400ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DWINDOWMANAGERHELPER_H #define DWINDOWMANAGERHELPER_H #include #include #include DGUI_BEGIN_NAMESPACE class DForeignWindow; class DWindowManagerHelperPrivate; class DWindowManagerHelper : public QObject, public DTK_CORE_NAMESPACE::DObject { Q_OBJECT Q_PROPERTY(bool hasBlurWindow READ hasBlurWindow NOTIFY hasBlurWindowChanged) Q_PROPERTY(bool hasComposite READ hasComposite NOTIFY hasCompositeChanged) Q_PROPERTY(bool hasNoTitlebar READ hasNoTitlebar NOTIFY hasNoTitlebarChanged) Q_PROPERTY(bool hasWallpaperEffect READ hasWallpaperEffect NOTIFY hasWallpaperEffectChanged) public: enum MotifFunction { FUNC_RESIZE = (1L << 1), FUNC_MOVE = (1L << 2), FUNC_MINIMIZE = (1L << 3), FUNC_MAXIMIZE = (1L << 4), FUNC_CLOSE = (1L << 5), FUNC_ALL = FUNC_RESIZE | FUNC_MOVE | FUNC_MINIMIZE | FUNC_MAXIMIZE | FUNC_CLOSE }; Q_DECLARE_FLAGS(MotifFunctions, MotifFunction) enum MotifDecoration { DECOR_BORDER = (1L << 1), DECOR_RESIZEH = (1L << 2), DECOR_TITLE = (1L << 3), DECOR_MENU = (1L << 4), DECOR_MINIMIZE = (1L << 5), DECOR_MAXIMIZE = (1L << 6), DECOR_ALL = DECOR_BORDER | DECOR_RESIZEH | DECOR_TITLE | DECOR_MENU | DECOR_MINIMIZE | DECOR_MAXIMIZE }; Q_DECLARE_FLAGS(MotifDecorations, MotifDecoration) enum WMName { OtherWM, DeepinWM, KWinWM }; Q_ENUM(WMName) enum WmWindowType { UnknowWindowType = 0x000000, NormalType = 0x000001, DesktopType = 0x000002, DockType = 0x000004, ToolbarType = 0x000008, MenuType = 0x000010, UtilityType = 0x000020, SplashType = 0x000040, DialogType = 0x000080, DropDownMenuType = 0x000100, PopupMenuType = 0x000200, TooltipType = 0x000400, NotificationType = 0x000800, ComboType = 0x001000, DndType = 0x002000, KdeOverrideType = 0x004000 }; Q_ENUM(WmWindowType) Q_DECLARE_FLAGS(WmWindowTypes, WmWindowType) Q_FLAG(WmWindowTypes) ~DWindowManagerHelper(); static DWindowManagerHelper *instance(); static void setMotifFunctions(const QWindow *window, MotifFunctions hints); static MotifFunctions setMotifFunctions(const QWindow *window, MotifFunctions hints, bool on); static MotifFunctions getMotifFunctions(const QWindow *window); static void setMotifDecorations(const QWindow *window, MotifDecorations hints); static MotifDecorations setMotifDecorations(const QWindow *window, MotifDecorations hints, bool on); static MotifDecorations getMotifDecorations(const QWindow *window); static void setWmWindowTypes(QWindow *window, WmWindowTypes types); static void setWmClassName(const QByteArray &name); static void popupSystemWindowMenu(const QWindow *window); bool hasBlurWindow() const; bool hasComposite() const; bool hasNoTitlebar() const; bool hasWallpaperEffect() const; QString windowManagerNameString() const; WMName windowManagerName() const; QVector allWindowIdList() const; QVector currentWorkspaceWindowIdList() const; QList currentWorkspaceWindows() const; quint32 windowFromPoint(const QPoint &p); Q_SIGNALS: void windowManagerChanged(); void hasBlurWindowChanged(); void hasCompositeChanged(); void hasNoTitlebarChanged(); void hasWallpaperEffectChanged(); void windowListChanged(); void windowMotifWMHintsChanged(quint32 winId); protected: explicit DWindowManagerHelper(QObject *parent = 0); private: D_DECLARE_PRIVATE(DWindowManagerHelper) }; DGUI_END_NAMESPACE Q_DECLARE_OPERATORS_FOR_FLAGS(DTK_GUI_NAMESPACE::DWindowManagerHelper::MotifFunctions) Q_DECLARE_OPERATORS_FOR_FLAGS(DTK_GUI_NAMESPACE::DWindowManagerHelper::MotifDecorations) Q_DECLARE_OPERATORS_FOR_FLAGS(DTK_GUI_NAMESPACE::DWindowManagerHelper::WmWindowTypes) #endif // DWINDOWMANAGERHELPER_H dtkgui-5.5.25/src/kernel/kernel.pri000066400000000000000000000011161426550353200171460ustar00rootroot00000000000000 HEADERS += \ $$PWD/dforeignwindow.h \ $$PWD/dguiapplicationhelper.h \ $$PWD/dnativesettings.h \ $$PWD/dpalette.h \ $$PWD/dplatformhandle.h \ $$PWD/dplatformtheme.h \ $$PWD/dregionmonitor.h \ $$PWD/dwindowgroupleader.h \ $$PWD/dwindowmanagerhelper.h SOURCES += \ $$PWD/dforeignwindow.cpp \ $$PWD/dguiapplicationhelper.cpp \ $$PWD/dnativesettings.cpp \ $$PWD/dpalette.cpp \ $$PWD/dplatformhandle.cpp \ $$PWD/dplatformtheme.cpp \ $$PWD/dregionmonitor.cpp \ $$PWD/dwindowgroupleader.cpp \ $$PWD/dwindowmanagerhelper.cpp dtkgui-5.5.25/src/private/000077500000000000000000000000001426550353200153455ustar00rootroot00000000000000dtkgui-5.5.25/src/private/dfiledragcommon_p.h000066400000000000000000000021641426550353200211720ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: Chris Xiong * * Maintainer: Chris Xiong * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DDNDCOMMON_H #define DDNDCOMMON_H #define DND_INTERFACE "com.deepin.dtk.FileDrag" #define DND_OBJPATH "/Ddnd" #define DND_MIME_SERVICE "x-dtk-file-drag/service" #define DND_MIME_PID "x-dtk-file-drag/pid" #define DND_MIME_UUID "x-dtk-file-drag/uuid" #define DND_TARGET_URL_KEY "targetUrl" #endif // DDNDCOMMON_H dtkgui-5.5.25/src/private/dfiledragserver_p.h000066400000000000000000000013461426550353200212110ustar00rootroot00000000000000#ifndef DFILEDRAGSERVER_P_H #define DFILEDRAGSERVER_P_H #include "dfiledragserver.h" #include #include #include DGUI_BEGIN_NAMESPACE class DDndSourceInterface; class DFileDragServer; class DFileDragServerPrivate : public DCORE_NAMESPACE::DObjectPrivate { QMap data; QUuid uuid; DFileDragServerPrivate(DFileDragServer *q); ~DFileDragServerPrivate(); void writeMimeData(QMimeData *dest); static DDndSourceInterface *dbusif; static int refcnt; static QHash servermap; D_DECLARE_PUBLIC(DFileDragServer) friend class DDndSourceInterface; friend class DFileDrag; }; DGUI_END_NAMESPACE #endif // DFILEDRAGSERVER_P_H dtkgui-5.5.25/src/private/dfontmanager_p.h000066400000000000000000000024241426550353200205040ustar00rootroot00000000000000/* * Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DFONTSIZEMANAGER_P_H #define DFONTSIZEMANAGER_P_H #include #include #include "dfontmanager.h" DGUI_BEGIN_NAMESPACE class DFontManagerPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate { public: DFontManagerPrivate(DFontManager *qq); int fontPixelSize[DFontManager::NSizeTypes] = {40, 30, 24, 20, 17, 14, 13, 12, 11, 10}; int baseFontSizeType = DFontManager::T6; // 字号的差值 int fontPixelSizeDiff = 0; QFont baseFont; private: D_DECLARE_PUBLIC(DFontManager) }; DGUI_END_NAMESPACE #endif // DFONTSIZEMANAGER_P_H dtkgui-5.5.25/src/private/dguiapplicationhelper_p.h000066400000000000000000000041551426550353200224160ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DGUIAPPLICATIONHELPER_P_H #define DGUIAPPLICATIONHELPER_P_H #include "dguiapplicationhelper.h" #include "dplatformtheme.h" #include QT_BEGIN_NAMESPACE class QLocalServer; QT_END_NAMESPACE DGUI_BEGIN_NAMESPACE class DGuiApplicationHelperPrivate : public DCORE_NAMESPACE::DObjectPrivate { public: D_DECLARE_PUBLIC(DGuiApplicationHelper) DGuiApplicationHelperPrivate(DGuiApplicationHelper *qq); void init(); void initApplication(QGuiApplication *app); static void staticInitApplication(); static void staticCleanApplication(); DPlatformTheme *initWindow(QWindow *window) const; void _q_initApplicationTheme(bool notifyChange = false); void notifyAppThemeChanged(); // 返回程序是否自定义了调色板 inline bool isCustomPalette() const; DGuiApplicationHelper::ColorType paletteType = DGuiApplicationHelper::UnknownType; // 系统级别的主题设置 DPlatformTheme *systemTheme; QScopedPointer appPalette; // 获取QLocalSever消息的等待时间 static int waitTime; static DGuiApplicationHelper::Attributes attributes; private: // 应用程序级别的主题设置 DPlatformTheme *appTheme = nullptr; }; Q_DECLARE_OPERATORS_FOR_FLAGS(DGuiApplicationHelper::Attributes) DGUI_END_NAMESPACE #endif // DGUIAPPLICATIONHELPER_P_H dtkgui-5.5.25/src/private/dnativesettings_p.h000066400000000000000000000025361426550353200212560ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DNATIVESETTINGS_P_H #define DNATIVESETTINGS_P_H #include #include #include DGUI_BEGIN_NAMESPACE class DNativeSettingsPrivate : public DCORE_NAMESPACE::DObjectPrivate { D_DECLARE_PUBLIC(DNativeSettings) public: DNativeSettingsPrivate(DNativeSettings *qq, const QByteArray &domain); ~DNativeSettingsPrivate(); bool init(const QMetaObject *mo, quint32 window); public: QByteArray domain; bool valid = false; QByteArrayList allKeys; }; DGUI_END_NAMESPACE #endif // DNATIVESETTINGS_P_H dtkgui-5.5.25/src/private/dplatformtheme_p.h000066400000000000000000000041241426550353200210510ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DPLATFORMTHEME_P_H #define DPLATFORMTHEME_P_H #include "dplatformtheme.h" #include "dnativesettings_p.h" DGUI_BEGIN_NAMESPACE class DPlatformThemePrivate : public DNativeSettingsPrivate { public: D_DECLARE_PUBLIC(DPlatformTheme) DPlatformThemePrivate(DPlatformTheme *qq); // 接收parent主题或非调色板DNativeSettings对象(theme对象)的属性变化通知 // 调色板相关的属性变化与此无关 void _q_onThemePropertyChanged(const QByteArray &name, const QVariant &value); void onQtColorChanged(QPalette::ColorRole role, const QColor &color); void onDtkColorChanged(DPalette::ColorType type, const QColor &color); void notifyPaletteChanged(); // 父主题,可以从其继承除调色板之外的所有窗口设置 DPlatformTheme *parent = nullptr; // 用于控制是否fallback到父主题中获取属性 bool fallbackProperty = true; // 默认时,DPlatformTheme会从/deepin/palette域下获取调色板相关的属性值 // 此处的DNativeSettings用于获取除调色板之外的属性设置 DNativeSettings *theme; // 缓存的调色板数据 DPalette *palette = nullptr; // 减少调色板changed信号的通知频率 QTimer *notifyPaletteChangeTimer = nullptr; }; DGUI_END_NAMESPACE #endif // DPLATFORMTHEME_P_H dtkgui-5.5.25/src/private/dregionmonitor_p.h000066400000000000000000000031401426550353200210720ustar00rootroot00000000000000#ifndef DREGIONMONITOR_P_H #define DREGIONMONITOR_P_H #include "dregionmonitor.h" #include "xeventmonitor_interface.h" #include #include #include #include DCORE_USE_NAMESPACE DGUI_BEGIN_NAMESPACE using XEventMonitor = ::com::deepin::api::XEventMonitor; class DRegionMonitorPrivate : public DObjectPrivate { D_DECLARE_PUBLIC(DRegionMonitor) public: DRegionMonitorPrivate(DRegionMonitor *q); ~DRegionMonitorPrivate(); bool registered() const { return !registerKey.isEmpty(); } void init(); void registerMonitorRegion(); void unregisterMonitorRegion(); void _q_ButtonPress(const int flag, const int x, const int y, const QString &key); void _q_ButtonRelease(const int flag, const int x, const int y, const QString &key); void _q_CursorMove(const int x, const int y, const QString &key); void _q_CursorEnter(const int x, const int y, const QString &key); void _q_CursorLeave(const int x, const int y, const QString &key); void _q_KeyPress(const QString &keyname, const int x, const int y, const QString &key); void _q_KeyRelease(const QString &keyname, const int x, const int y, const QString &key); const QPoint deviceScaledCoordinate(const QPoint &p, const double ratio) const; XEventMonitor *eventInter; QRegion watchedRegion; QString registerKey; DRegionMonitor::CoordinateType type = DRegionMonitor::ScaleRatio; DRegionMonitor::RegisterdFlags registerdFlags = DRegionMonitor::Motion | DRegionMonitor::Button | DRegionMonitor::Key; }; DGUI_END_NAMESPACE #endif // DREGIONMONITOR_P_H dtkgui-5.5.25/src/private/dtaskbarcontrol_p.h000066400000000000000000000025021426550353200212300ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. * * Author: sunkang * * Maintainer: sunkang * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DTASKBARCONTROL_P_H #define DTASKBARCONTROL_P_H #include #include #include #include "dtaskbarcontrol.h" DCORE_USE_NAMESPACE DGUI_BEGIN_NAMESPACE class DTaskbarControlPrivate : public DObjectPrivate { D_DECLARE_PUBLIC(DTaskbarControl) public: DTaskbarControlPrivate(DTaskbarControl *q); ~DTaskbarControlPrivate(); int m_counter; bool m_counterVisible; double m_progress; bool m_progressVisible; }; DGUI_END_NAMESPACE #endif // DTASKBARCONTROL_P_H dtkgui-5.5.25/src/private/private.pri000066400000000000000000000004141426550353200175320ustar00rootroot00000000000000HEADERS += \ $$PWD/dnativesettings_p.h \ $$PWD/dguiapplicationhelper_p.h \ $$PWD/dplatformtheme_p.h \ $$PWD/dfiledragcommon_p.h \ $$PWD/dfiledragserver_p.h \ $$PWD/dregionmonitor_p.h \ $$PWD/dtaskbarcontrol_p.h \ $$PWD/dfontmanager_p.h dtkgui-5.5.25/src/src.pro000066400000000000000000000034041426550353200152050ustar00rootroot00000000000000TARGET = dtkgui TEMPLATE = lib QT += dtkcore gui gui-private dbus network CONFIG += internal_module # 龙芯架构上没有默认添加PT_GNU_STACK-section,所以此处手动指定一下 contains(QMAKE_HOST.arch, mips.*): QMAKE_LFLAGS_SHLIB += "-Wl,-z,noexecstack" # don't link library QMAKE_CXXFLAGS += $$system($$pkgConfigExecutable() --cflags-only-I librsvg-2.0) INCLUDEPATH += \ $$PWD/filedrag \ $$PWD/kernel \ $$PWD/util \ $$PWD/private include(filedrag/filedrag.pri) include(kernel/kernel.pri) include(util/util.pri) include(private/private.pri) includes.files += \ $$PWD/*.h \ $$PWD/DtkGuis \ $$PWD/dtkgui_config.h \ $$PWD/kernel/*.h \ $$PWD/kernel/DForeignWindow \ $$PWD/kernel/DGuiApplicationHelper \ $$PWD/kernel/DNativeSettings \ $$PWD/kernel/DPalette \ $$PWD/kernel/DPlatformHandle \ $$PWD/kernel/DPlatformTheme \ $$PWD/kernel/DRegionMonitor \ $$PWD/kernel/DWindowGroupLeader \ $$PWD/kernel/DWindowManagerHelper \ $$PWD/filedrag/*.h \ $$PWD/filedrag/DFileDrag \ $$PWD/filedrag/DFileDragClient \ $$PWD/filedrag/DFileDragServer \ $$PWD/util/*.h \ $$PWD/util/DFontManager \ $$PWD/util/DSvgRenderer \ $$PWD/util/DTaskbarControl \ $$PWD/util/DThumbnailProvider dbus_monitor.files += $$PWD/dbus/com.deepin.api.XEventMonitor.xml dbus_monitor.header_flags += -i dbus/arealist.h DBUS_INTERFACES += dbus_monitor DTK_MODULE_NAME=$$TARGET load(dtk_build) INSTALLS += includes target load(dtk_cmake) load(dtk_module) !isEmpty(DTK_MULTI_VERSION) { # 支持上游一包多依赖 load(dtk_multiversion) # 5.5 5.6可通过重复调用此函数,来增加对更多版本的支持 dtkBuildMultiVersion(5.5) # INSTALL变量增加多版本下的配置文件 load(dtk_install_multiversion) } dtkgui-5.5.25/src/util/000077500000000000000000000000001426550353200146505ustar00rootroot00000000000000dtkgui-5.5.25/src/util/DFontManager000066400000000000000000000000321426550353200170730ustar00rootroot00000000000000#include "dfontmanager.h" dtkgui-5.5.25/src/util/DSvgRenderer000066400000000000000000000000321426550353200171200ustar00rootroot00000000000000#include "dsvgrenderer.h" dtkgui-5.5.25/src/util/DTaskbarControl000066400000000000000000000000351426550353200176250ustar00rootroot00000000000000#include "dtaskbarcontrol.h" dtkgui-5.5.25/src/util/DThumbnailProvider000066400000000000000000000000401426550353200203270ustar00rootroot00000000000000#include "dthumbnailprovider.h" dtkgui-5.5.25/src/util/dfontmanager.cpp000066400000000000000000000077051426550353200200320ustar00rootroot00000000000000/* * Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #define private public #include #undef private #include "dfontmanager.h" #include "dfontmanager_p.h" #include #include DGUI_BEGIN_NAMESPACE DFontManagerPrivate::DFontManagerPrivate(DFontManager *qq) : DTK_CORE_NAMESPACE::DObjectPrivate(qq) { baseFont.setPixelSize(fontPixelSize[baseFontSizeType]); } /*! \class Dtk::Gui::DFontManager \inmodule dtkgui \brief 字体大小设置的一个类,系统默认只设置T6. */ DFontManager::DFontManager(QObject *parent) : QObject(parent) , DTK_CORE_NAMESPACE::DObject(*new DFontManagerPrivate(this)) { } DFontManager::~DFontManager() { } /*! \enum Dtk::Gui::DFontManager::SizeType DFontManager::SizeType 定义了 DFontManager 的系统字体的定义的大小; 而系统只会设置 T6 为系统默认的字体 \value T1 系统级别为 T1 的字体大小, 默认是40 px \value T2 系统级别为 T2 的字体大小, 默认是30 px \value T3 系统级别为 T3 的字体大小, 默认是24 px \value T4 系统级别为 T4 的字体大小, 默认是20 px \value T5 系统级别为 T5 的字体大小, 默认是17 px \value T6 系统级别为 T6 的字体大小, 默认是14 px \value T7 系统级别为 T7 的字体大小, 默认是13 px \value T8 系统级别为 T8 的字体大小, 默认是12 px \value T9 系统级别为 T9 的字体大小, 默认是11 px \value T10 系统级别为 T10 的字体大小, 默认是10 px \omitvalue NSizeTypes */ /*! \brief 获取字体像素的大小. \a type 字体枚举类型 \return 返回字体像素的大小 */ int DFontManager::fontPixelSize(DFontManager::SizeType type) const { D_DC(DFontManager); if (type >= NSizeTypes) { return 0; } return d->fontPixelSize[type] + d->fontPixelSizeDiff; } /*! \brief 设置字体像素大小. \a type 字体枚举类型 \a size 字体大小 */ void DFontManager::setFontPixelSize(DFontManager::SizeType type, int size) { D_D(DFontManager); if (type >= NSizeTypes) { return; } if (d->fontPixelSize[type] == size) { return; } d->fontPixelSize[type] = size; } /*! \brief 设置字体的通用像素大小. \a font 预设计的字体像素的大小 */ void DFontManager::setBaseFont(const QFont &font) { D_D(DFontManager); if (d->baseFont == font) return; d->baseFont = font; d->fontPixelSizeDiff = fontPixelSize(font) - d->fontPixelSize[d->baseFontSizeType]; Q_EMIT fontChanged(); } QFont DFontManager::baseFont() const { D_DC(DFontManager); return d->baseFont; } void DFontManager::resetBaseFont() { D_DC(DFontManager); QFont font; font.setPixelSize(d->fontPixelSize[d->baseFontSizeType]); setBaseFont(font); } /*! \brief 获取字体. \a pixelSize 字体的像素大小 \a base 要基于的字体 \return 返回设置字体大小后的字体 */ QFont DFontManager::get(int pixelSize, const QFont &base) { QFont font = base; font.setPixelSize(pixelSize); return font; } int DFontManager::fontPixelSize(const QFont &font) { int px = font.pixelSize(); if (px == -1) { px = qRound(std::floor(((font.pointSizeF() * font.d->dpi) / 72) * 100 + 0.5) / 100); } return px; } DGUI_END_NAMESPACE dtkgui-5.5.25/src/util/dfontmanager.h000066400000000000000000000063211426550353200174700ustar00rootroot00000000000000/* * Copyright (C) 2020 ~ 2020 Deepin Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DFONTSIZEMANAGER_H #define DFONTSIZEMANAGER_H #include #include #include DGUI_BEGIN_NAMESPACE class DFontManagerPrivate; class DFontManager : public QObject , public DTK_CORE_NAMESPACE::DObject { Q_OBJECT Q_PROPERTY(QFont t1 READ t1 NOTIFY fontChanged) Q_PROPERTY(QFont t2 READ t2 NOTIFY fontChanged) Q_PROPERTY(QFont t3 READ t3 NOTIFY fontChanged) Q_PROPERTY(QFont t4 READ t4 NOTIFY fontChanged) Q_PROPERTY(QFont t5 READ t5 NOTIFY fontChanged) Q_PROPERTY(QFont t6 READ t6 NOTIFY fontChanged) Q_PROPERTY(QFont t7 READ t7 NOTIFY fontChanged) Q_PROPERTY(QFont t8 READ t8 NOTIFY fontChanged) Q_PROPERTY(QFont t9 READ t9 NOTIFY fontChanged) Q_PROPERTY(QFont t10 READ t10 NOTIFY fontChanged) Q_PROPERTY(QFont baseFont READ baseFont WRITE setBaseFont RESET resetBaseFont NOTIFY fontChanged) public: enum SizeType { T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NSizeTypes }; Q_ENUM(SizeType) DFontManager(QObject *parent = nullptr); ~DFontManager() override; Q_INVOKABLE int fontPixelSize(SizeType type) const; Q_INVOKABLE void setFontPixelSize(SizeType type, int size); Q_INVOKABLE static int fontPixelSize(const QFont &font); Q_INVOKABLE static QFont get(int pixelSize, const QFont &base); inline const QFont get(SizeType type, const QFont &base) const { return get(fontPixelSize(type), base); } inline const QFont get(SizeType type) const { return get(type, baseFont()); } QFont baseFont() const; void setBaseFont(const QFont &font); void resetBaseFont(); inline const QFont t1() const { return get(T1); } inline const QFont t2() const { return get(T2); } inline const QFont t3() const { return get(T3); } inline const QFont t4() const { return get(T4); } inline const QFont t5() const { return get(T5); } inline const QFont t6() const { return get(T6); } inline const QFont t7() const { return get(T7); } inline const QFont t8() const { return get(T8); } inline const QFont t9() const { return get(T9); } inline const QFont t10() const { return get(T10); } Q_SIGNALS: void fontChanged(); private: D_DECLARE_PRIVATE(DFontManager) }; DGUI_END_NAMESPACE #endif // DFONTSIZEMANAGER_H dtkgui-5.5.25/src/util/dsvgrenderer.cpp000066400000000000000000000216551426550353200200570ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include "dsvgrenderer.h" #include "dobject_p.h" #include #include #include #include #include DCORE_USE_NAMESPACE DGUI_BEGIN_NAMESPACE class RSvg { public: RSvg() { // fix found lib was librsvg2-dev without version number rsvg = new QLibrary("rsvg-2", "2"); if (!rsvg->load()) { delete rsvg; rsvg = nullptr; return; } #define INIT_FUNCTION(Name) Name = reinterpret_cast(rsvg->resolve(#Name)); Q_ASSERT(Name) INIT_FUNCTION(cairo_image_surface_create_for_data); INIT_FUNCTION(cairo_create); INIT_FUNCTION(cairo_scale); INIT_FUNCTION(cairo_translate); INIT_FUNCTION(cairo_destroy); INIT_FUNCTION(cairo_surface_destroy); INIT_FUNCTION(g_object_unref); INIT_FUNCTION(rsvg_handle_render_cairo); INIT_FUNCTION(rsvg_handle_render_cairo_sub); INIT_FUNCTION(rsvg_handle_get_dimensions_sub); INIT_FUNCTION(rsvg_handle_get_position_sub); INIT_FUNCTION(rsvg_handle_has_sub); INIT_FUNCTION(rsvg_handle_new_from_data); INIT_FUNCTION(rsvg_handle_get_dimensions); } static RSvg *instance() { static RSvg *global = new RSvg(); return global; } bool isValid() const { return rsvg; } ~RSvg() { if (rsvg) delete rsvg; } cairo_surface_t *(*cairo_image_surface_create_for_data)(unsigned char *data, cairo_format_t format, int width, int height, int stride); cairo_t *(*cairo_create)(cairo_surface_t *target); void (*cairo_scale)(cairo_t *cr, double sx, double sy); void (*cairo_translate)(cairo_t *cr, double tx, double ty); void (*cairo_destroy)(cairo_t *cr); void (*cairo_surface_destroy)(cairo_surface_t *surface); void (*g_object_unref)(gpointer object); gboolean (*rsvg_handle_render_cairo)(RsvgHandle *handle, cairo_t *cr); gboolean (*rsvg_handle_render_cairo_sub)(RsvgHandle *handle, cairo_t *cr, const char *id); gboolean (*rsvg_handle_get_dimensions_sub)(RsvgHandle *handle, RsvgDimensionData *dimension_data, const char *id); gboolean (*rsvg_handle_get_position_sub)(RsvgHandle *handle, RsvgPositionData *position_data, const char *id); gboolean (*rsvg_handle_has_sub)(RsvgHandle *handle, const char *id); RsvgHandle *(*rsvg_handle_new_from_data)(const guint8 *data, gsize data_len, GError **error); void (*rsvg_handle_get_dimensions)(RsvgHandle *handle, RsvgDimensionData *dimension_data); private: QLibrary *rsvg = nullptr; }; class DSvgRendererPrivate : public DObjectPrivate { public: explicit DSvgRendererPrivate(DObject *qq); QImage getImage(const QSize &size, const QString &elementId) const; RsvgHandle *handle = nullptr; QSize defaultSize; mutable QRectF viewBox; }; DSvgRendererPrivate::DSvgRendererPrivate(DObject *qq) : DObjectPrivate(qq) { } QImage DSvgRendererPrivate::getImage(const QSize &size, const QString &elementId) const { if (!RSvg::instance()->isValid()) return QImage(); QImage image(size, QImage::Format_ARGB32_Premultiplied); image.fill(Qt::transparent); cairo_surface_t *surface = RSvg::instance()->cairo_image_surface_create_for_data(image.bits(), CAIRO_FORMAT_ARGB32, image.width(), image.height(), image.bytesPerLine()); cairo_t *cairo = RSvg::instance()->cairo_create(surface); RSvg::instance()->cairo_scale(cairo, image.width() / viewBox.width(), image.height() / viewBox.height()); RSvg::instance()->cairo_translate(cairo, -viewBox.x(), -viewBox.y()); if (elementId.isEmpty()) RSvg::instance()->rsvg_handle_render_cairo(handle, cairo); else RSvg::instance()->rsvg_handle_render_cairo_sub(handle, cairo, elementId.toUtf8().constData()); RSvg::instance()->cairo_destroy(cairo); RSvg::instance()->cairo_surface_destroy(surface); return image; } /*! \class Dtk::Gui::DSvgRenderer \inmodule dtkgui \brief 提供了将SVG文件的内容绘制到绘制设备上的方法. SVG图形可以在构造 DSvgRenderer 时加载,也可以稍后使用load()函数加载。 因为渲染是使用 QPainter 执行的,所以可以在 QPaintDevice 的任何子类上渲染SVG图形。 如果加载了有效文件,则无论是在构造时还是以后某个时间,isValid()都将返回true;否则将返回false。 DSvgRenderer提供render()插槽,用于使用给定的 QPainter 渲染当前文档或动画文档的当前帧 \note 使用 DSvgRenderer 需要 librsvg库 */ DSvgRenderer::DSvgRenderer(QObject *parent) : QObject(parent) , DObject(*new DSvgRendererPrivate(this)) { } DSvgRenderer::DSvgRenderer(const QString &filename, QObject *parent) : DSvgRenderer(parent) { load(filename); } DSvgRenderer::DSvgRenderer(const QByteArray &contents, QObject *parent) : DSvgRenderer(parent) { load(contents); } DSvgRenderer::~DSvgRenderer() { D_D(DSvgRenderer); if (d->handle) { Q_ASSERT(RSvg::instance()->isValid()); RSvg::instance()->g_object_unref(d->handle); } } bool DSvgRenderer::isValid() const { D_DC(DSvgRenderer); return d->handle; } QSize DSvgRenderer::defaultSize() const { D_DC(DSvgRenderer); return d->defaultSize; } QRect DSvgRenderer::viewBox() const { D_DC(DSvgRenderer); return d->handle ? d->viewBox.toRect() : QRect(); } QRectF DSvgRenderer::viewBoxF() const { D_DC(DSvgRenderer); return d->handle ? d->viewBox : QRectF(); } void DSvgRenderer::setViewBox(const QRect &viewbox) { setViewBox(QRectF(viewbox)); } void DSvgRenderer::setViewBox(const QRectF &viewbox) { D_D(DSvgRenderer); if (d->handle) d->viewBox = viewbox; } QRectF DSvgRenderer::boundsOnElement(const QString &id) const { D_DC(DSvgRenderer); if (!d->handle) return QRectF(); const QByteArray &id_data = id.toUtf8(); RsvgDimensionData dimension_data; if (!RSvg::instance()->rsvg_handle_get_dimensions_sub(d->handle, &dimension_data, id_data.constData())) return QRectF(); RsvgPositionData pos_data; if (!RSvg::instance()->rsvg_handle_get_position_sub(d->handle, &pos_data, id_data.constData())) return QRectF(); return QRectF(pos_data.x, pos_data.y, dimension_data.width, dimension_data.height); } bool DSvgRenderer::elementExists(const QString &id) const { D_DC(DSvgRenderer); if (!d->handle) return false; return RSvg::instance()->rsvg_handle_has_sub(d->handle, id.toUtf8().constData()); } QImage DSvgRenderer::toImage(const QSize sz, const QString &elementId) const { Q_D(const DSvgRenderer); return d->getImage(sz, elementId); } bool DSvgRenderer::load(const QString &filename) { QFile file(filename); if (file.open(QIODevice::ReadOnly)) { return load(file.readAll()); } return false; } bool DSvgRenderer::load(const QByteArray &contents) { D_D(DSvgRenderer); if (!RSvg::instance()->isValid()) return false; if (d->handle) { RSvg::instance()->g_object_unref(d->handle); d->handle = nullptr; } GError *error = nullptr; d->handle = RSvg::instance()->rsvg_handle_new_from_data((const guint8*)contents.constData(), contents.length(), &error); if (error) { qWarning("DSvgRenderer::load: %s", error->message); g_error_free(error); return false; } RsvgDimensionData rsvg_data; RSvg::instance()->rsvg_handle_get_dimensions(d->handle, &rsvg_data); d->defaultSize.setWidth(rsvg_data.width); d->defaultSize.setHeight(rsvg_data.height); d->viewBox = QRectF(QPointF(0, 0), d->defaultSize); return true; } void DSvgRenderer::render(QPainter *p) { render(p, QString(), QRectF()); } void DSvgRenderer::render(QPainter *p, const QRectF &bounds) { render(p, QString(), bounds); } void DSvgRenderer::render(QPainter *p, const QString &elementId, const QRectF &bounds) { D_D(DSvgRenderer); if (!d->handle) return; p->save(); const QImage image = d->getImage(QSize(p->device()->width(), p->device()->height()), elementId); if (bounds.isEmpty()) p->drawImage(0, 0, image); else p->drawImage(bounds, image); p->restore(); } DGUI_END_NAMESPACE dtkgui-5.5.25/src/util/dsvgrenderer.h000066400000000000000000000042461426550353200175210ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DSVGRENDERER_H #define DSVGRENDERER_H #include #include #include #include QT_BEGIN_NAMESPACE class QPainter; QT_END_NAMESPACE #ifdef Q_OS_LINUX DGUI_BEGIN_NAMESPACE class DSvgRendererPrivate; class DSvgRenderer : public QObject, public DTK_CORE_NAMESPACE::DObject { Q_PROPERTY(QRectF viewBox READ viewBoxF WRITE setViewBox) public: explicit DSvgRenderer(QObject *parent = Q_NULLPTR); DSvgRenderer(const QString &filename, QObject *parent = Q_NULLPTR); DSvgRenderer(const QByteArray &contents, QObject *parent = Q_NULLPTR); ~DSvgRenderer(); bool isValid() const; QSize defaultSize() const; QRect viewBox() const; QRectF viewBoxF() const; void setViewBox(const QRect &viewbox); void setViewBox(const QRectF &viewbox); QRectF boundsOnElement(const QString &id) const; bool elementExists(const QString &id) const; QImage toImage(const QSize sz, const QString &elementId = QString()) const; public Q_SLOTS: bool load(const QString &filename); bool load(const QByteArray &contents); void render(QPainter *p); void render(QPainter *p, const QRectF &bounds); void render(QPainter *p, const QString &elementId, const QRectF &bounds = QRectF()); private: D_DECLARE_PRIVATE(DSvgRenderer) }; DGUI_END_NAMESPACE #else #include DGUI_BEGIN_NAMESPACE typedef QSvgRenderer DSvgRenderer; DGUI_END_NAMESPACE #endif #endif // DSVGRENDERER_H dtkgui-5.5.25/src/util/dtaskbarcontrol.cpp000066400000000000000000000116721426550353200205570ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. * * Author: sunkang * * Maintainer: sunkang * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dtaskbarcontrol.h" #include #include #include #include #include #include "private/dtaskbarcontrol_p.h" DCORE_USE_NAMESPACE DGUI_BEGIN_NAMESPACE DTaskbarControlPrivate::DTaskbarControlPrivate(DTaskbarControl *q) : DObjectPrivate(q) , m_counter(0) , m_counterVisible(true) , m_progress(0) , m_progressVisible(true) { } DTaskbarControlPrivate::~DTaskbarControlPrivate() { } /*! \class Dtk::Gui::DTaskbarControl \inmodule dtkgui \brief DTaskbarControl提供了一个Launcher API接口,用于方便应用程序控制taskbar进度条,设置当前任务数量. 如果想隐藏或者不使用进度条和任务数的显示,可以使用setProgress,setCounter 传递false隐藏相关显示. */ DTaskbarControl::DTaskbarControl(QObject *parent) : QObject(parent) , DObject(*new DTaskbarControlPrivate(this)) { } DTaskbarControl::~DTaskbarControl() { } /*! \brief DTaskbarControl::setProgress 设置当前进度和进度条是否可见 \a progressVisible true可见 false不可见 \a progress 当前进度值 0-1(换算成百分比) */ void DTaskbarControl::setProgress(bool progressVisible, double progress) { if (!qFuzzyCompare(d_func()->m_progress, progress)) { d_func()->m_progress = progress; Q_EMIT progressChanged(progress); } if (d_func()->m_progressVisible != progressVisible) { d_func()->m_progressVisible = progressVisible; Q_EMIT progressVisibleChanged(progressVisible); } QVariantMap properties; properties.insert("progress-visible", progressVisible); properties.insert("progress", progress); sendMessage(properties); } /*! \brief DTaskbarControl::setCounter 设置当前任务数量 \a counterVisible true任务数可见 false任务数不可见 \a counter */ void DTaskbarControl::setCounter(bool counterVisible, int counter) { if (counter != d_func()->m_counter) { d_func()->m_counter = counter; Q_EMIT counterChanged(counter); } if (d_func()->m_counterVisible != counterVisible) { d_func()->m_counterVisible = counterVisible; Q_EMIT counterVisibleChanged(counterVisible); } QVariantMap properties; properties.insert("count-visible", counterVisible); properties.insert("count", counter); sendMessage(properties); } /*! brief DTaskbarControl::counter 获取当前任务数 return 任务数量 */ int DTaskbarControl::counter() const { return d_func()->m_counter; } /*! \brief DTaskbarControl::setCounterVisible 设置任务数是否可见 \a counterVisible true可见 false不可见 如果需要隐藏,建议设置counter的值为0并且设置为false,只设置false,有可能会显示 */ void DTaskbarControl::setCounterVisible(bool counterVisible) { if (d_func()->m_counterVisible != counterVisible) { d_func()->m_counterVisible = counterVisible; Q_EMIT counterVisibleChanged(counterVisible); } QVariantMap properties; properties.insert("count-visible", counterVisible); sendMessage(properties); } /*! \brief DTaskbarControl::counterVisible 返回任务数是否可见 \return true可见 false不可见 */ bool DTaskbarControl::counterVisible() const { return d_func()->m_counterVisible; } /*! \brief DTaskbarControl::setUrgency 设置任务的紧急程度 \a val true 任务紧急 false普通任务 */ void DTaskbarControl::setUrgency(bool val) { QVariantMap properties; properties.insert("urgent", val); sendMessage(properties); } void DTaskbarControl::sendMessage(const QVariantMap ¶ms) { if (QGuiApplication::desktopFileName().isEmpty()) { qWarning() << "You need to set the desktop file name before you can use DTaskbarControl!"; return; } auto message = QDBusMessage::createSignal("/com/deepin/dtkgui/DTaskbarControl", "com.canonical.Unity.LauncherEntry", "Update"); message << "application://" + QGuiApplication::desktopFileName() << params; QDBusConnection::sessionBus().send(message); } DGUI_END_NAMESPACE dtkgui-5.5.25/src/util/dtaskbarcontrol.h000066400000000000000000000034031426550353200202150ustar00rootroot00000000000000/* * Copyright (C) 2019 ~ 2020 Deepin Technology Co., Ltd. * * Author: sunkang * * Maintainer: sunkang * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DTASKBARCONTROL_H #define DTASKBARCONTROL_H #include #include #include #include DGUI_BEGIN_NAMESPACE class DTaskbarControlPrivate; class DTaskbarControl : public QObject, public DTK_CORE_NAMESPACE::DObject { Q_OBJECT public: explicit DTaskbarControl(QObject *parent = nullptr); ~DTaskbarControl(); void setProgress(bool progressVisible, double progress); void setCounter(bool counterVisible, int counter); int counter() const; void setCounterVisible(bool counterVisible); bool counterVisible() const; void setUrgency(bool val); Q_SIGNALS: void counterChanged(int counter); void counterVisibleChanged(bool visible); void progressChanged(double progress); void progressVisibleChanged(bool visible); protected: virtual void sendMessage(const QVariantMap ¶ms); private: D_DECLARE_PRIVATE(DTaskbarControl) }; DGUI_END_NAMESPACE #endif // DTASKBARCONTROL_H dtkgui-5.5.25/src/util/dthumbnailprovider.cpp000066400000000000000000000316271426550353200212670ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dthumbnailprovider.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include DGUI_BEGIN_NAMESPACE #define FORMAT ".png" #define THUMBNAIL_PATH \ DCORE_NAMESPACE::DStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/thumbnails" #define THUMBNAIL_FAIL_PATH THUMBNAIL_PATH"/fail" #define THUMBNAIL_LARGE_PATH THUMBNAIL_PATH"/large" #define THUMBNAIL_NORMAL_PATH THUMBNAIL_PATH"/normal" #define THUMBNAIL_SMALL_PATH THUMBNAIL_PATH"/small" inline QByteArray dataToMd5Hex(const QByteArray &data) { return QCryptographicHash::hash(data, QCryptographicHash::Md5).toHex(); } #ifndef UT_DThumbnailProviderPrivate class DThumbnailProviderPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate { public: explicit DThumbnailProviderPrivate(DThumbnailProvider *qq); void init(); QString sizeToFilePath(DThumbnailProvider::Size size) const; QString errorString; // MAX qint64 defaultSizeLimit = INT64_MAX; QHash sizeLimitHash; QMimeDatabase mimeDatabase; static QSet hasThumbnailMimeHash; struct ProduceInfo { QFileInfo fileInfo; DThumbnailProvider::Size size; DThumbnailProvider::CallBack callback; }; QQueue produceQueue; QSet> discardedProduceInfos; bool running = true; QWaitCondition waitCondition; QReadWriteLock dataReadWriteLock; D_DECLARE_PUBLIC(DThumbnailProvider) }; #endif QSet DThumbnailProviderPrivate::hasThumbnailMimeHash; DThumbnailProviderPrivate::DThumbnailProviderPrivate(DThumbnailProvider *qq) : DObjectPrivate(qq) { } void DThumbnailProviderPrivate::init() { } QString DThumbnailProviderPrivate::sizeToFilePath(DThumbnailProvider::Size size) const { switch (size) { case DThumbnailProvider::Small: return THUMBNAIL_SMALL_PATH; case DThumbnailProvider::Normal: return THUMBNAIL_NORMAL_PATH; case DThumbnailProvider::Large: return THUMBNAIL_LARGE_PATH; } return QString(); } class DFileThumbnailProviderPrivate : public DThumbnailProvider {}; Q_GLOBAL_STATIC(DFileThumbnailProviderPrivate, ftpGlobal) DThumbnailProvider *DThumbnailProvider::instance() { return ftpGlobal; } /*! \brief DThumbnailProvider::hasThumbnail缩略图是否存在 \a info 文件信息 \return true 存在 false 不存在 */ bool DThumbnailProvider::hasThumbnail(const QFileInfo &info) const { Q_D(const DThumbnailProvider); if (!info.isReadable() || !info.isFile()) { return false; } qint64 fileSize = info.size(); if (fileSize <= 0) { return false; } const QMimeType &mime = d->mimeDatabase.mimeTypeForFile(info); if (fileSize > sizeLimit(mime)) { return false; } return hasThumbnail(mime); } bool DThumbnailProvider::hasThumbnail(const QMimeType &mimeType) const { const QString &mime = mimeType.name(); if (DThumbnailProviderPrivate::hasThumbnailMimeHash.isEmpty()) { const QList &mimeTypes = QImageReader::supportedMimeTypes(); if (mimeTypes.isEmpty()) { DThumbnailProviderPrivate::hasThumbnailMimeHash.insert(""); return false; } DThumbnailProviderPrivate::hasThumbnailMimeHash.reserve(mimeTypes.size()); for (const QByteArray &t : mimeTypes) { DThumbnailProviderPrivate::hasThumbnailMimeHash.insert(QString::fromLocal8Bit(t)); } } return DThumbnailProviderPrivate::hasThumbnailMimeHash.contains(mime); } /*! \brief DThumbnailProvider::thumbnailFilePath返回文件缩略图文件路径 \a info 文件信息 \a size 图片大小 \return 路径信息 */ QString DThumbnailProvider::thumbnailFilePath(const QFileInfo &info, Size size) const { Q_D(const DThumbnailProvider); const QString &absolutePath = info.absolutePath(); const QString &absoluteFilePath = info.absoluteFilePath(); if (absolutePath == d->sizeToFilePath(Small) || absolutePath == d->sizeToFilePath(Normal) || absolutePath == d->sizeToFilePath(Large) || absolutePath == THUMBNAIL_FAIL_PATH) { return absoluteFilePath; } const QString thumbnailName = dataToMd5Hex(QUrl::fromLocalFile(absoluteFilePath).toString(QUrl::FullyEncoded).toLocal8Bit()) + FORMAT; QString thumbnail = d->sizeToFilePath(size) + QDir::separator() + thumbnailName; if (!QFile::exists(thumbnail)) { return QString(); } QImage image(thumbnail); if (image.text(QT_STRINGIFY(Thumb::MTime)).toInt() != (int)info.lastModified().toTime_t()) { QFile::remove(thumbnail); Q_EMIT thumbnailChanged(absoluteFilePath, QString()); return QString(); } return thumbnail; } /*! \brief DThumbnailProvider::createThumbnail创建缩略图 \a info 文件信息 \a size 图片大小 \return 成功返回绝对路径信息,失败则返回空 */ QString DThumbnailProvider::createThumbnail(const QFileInfo &info, DThumbnailProvider::Size size) { Q_D(DThumbnailProvider); d->errorString.clear(); const QString &absolutePath = info.absolutePath(); const QString &absoluteFilePath = info.absoluteFilePath(); if (absolutePath == d->sizeToFilePath(Small) || absolutePath == d->sizeToFilePath(Normal) || absolutePath == d->sizeToFilePath(Large) || absolutePath == THUMBNAIL_FAIL_PATH) { return absoluteFilePath; } if (!hasThumbnail(info)) { d->errorString = QStringLiteral("This file has not support thumbnail: ") + absoluteFilePath; //!Warnning: Do not store thumbnails to the fail path return QString(); } const QString fileUrl = QUrl::fromLocalFile(absoluteFilePath).toString(QUrl::FullyEncoded); const QString thumbnailName = dataToMd5Hex(fileUrl.toLocal8Bit()) + FORMAT; // the file is in fail path QString thumbnail = THUMBNAIL_FAIL_PATH + QDir::separator() + thumbnailName; if (QFile::exists(thumbnail)) { QImage image(thumbnail); if (image.text(QT_STRINGIFY(Thumb::MTime)).toInt() != (int)info.lastModified().toTime_t()) { QFile::remove(thumbnail); } else { return QString(); } }// end QScopedPointer image(new QImage(QSize(size, size), QImage::Format_ARGB32_Premultiplied)); QImageReader reader(absoluteFilePath); if (!reader.canRead()) { reader.setFormat(d->mimeDatabase.mimeTypeForFile(info).name().toLocal8Bit()); if (!reader.canRead()) { d->errorString = reader.errorString(); } } if (d->errorString.isEmpty()) { const QSize &imageSize = reader.size(); if (imageSize.isValid()) { if (imageSize.width() >= size || imageSize.height() >= size) { reader.setScaledSize(reader.size().scaled(size, size, Qt::KeepAspectRatio)); } if (!reader.read(image.data())) { d->errorString = reader.errorString(); } } else { d->errorString = "Fail to read image file attribute data:" + info.absoluteFilePath(); } } // successful if (d->errorString.isEmpty()) { thumbnail = d->sizeToFilePath(size) + QDir::separator() + thumbnailName; } else { //fail image.reset(new QImage(1, 1, QImage::Format_Mono)); } image->setText(QT_STRINGIFY(Thumb::URL), fileUrl); image->setText(QT_STRINGIFY(Thumb::MTime), QString::number(info.lastModified().toTime_t())); // create path QFileInfo(thumbnail).absoluteDir().mkpath("."); if (!image->save(thumbnail, Q_NULLPTR, 80)) { d->errorString = QStringLiteral("Can not save image to ") + thumbnail; } if (d->errorString.isEmpty()) { Q_EMIT createThumbnailFinished(absoluteFilePath, thumbnail); Q_EMIT thumbnailChanged(absoluteFilePath, thumbnail); return thumbnail; } // fail Q_EMIT createThumbnailFailed(absoluteFilePath); return QString(); } void DThumbnailProvider::appendToProduceQueue(const QFileInfo &info, DThumbnailProvider::Size size, DThumbnailProvider::CallBack callback) { DThumbnailProviderPrivate::ProduceInfo produceInfo; produceInfo.fileInfo = info; produceInfo.size = size; produceInfo.callback = callback; Q_D(DThumbnailProvider); if (isRunning()) { QWriteLocker locker(&d->dataReadWriteLock); d->produceQueue.append(std::move(produceInfo)); locker.unlock(); d->waitCondition.wakeAll(); } else { d->produceQueue.append(std::move(produceInfo)); start(); } } /*! \brief DThumbnailProvider::removeInProduceQueue将缩略图从列表中删除 \a info 缩略图文件 \a size 缩略图大小 */ void DThumbnailProvider::removeInProduceQueue(const QFileInfo &info, DThumbnailProvider::Size size) { Q_D(DThumbnailProvider); if (isRunning()) { QWriteLocker locker(&d->dataReadWriteLock); Q_UNUSED(locker) } d->discardedProduceInfos.insert(qMakePair(info.absoluteFilePath(), size)); } /*! \brief DThumbnailProvider::errorString返回错误信息 \return 错误信息 */ QString DThumbnailProvider::errorString() const { Q_D(const DThumbnailProvider); return d->errorString; } /*! \brief DThumbnailProvider::defaultSizeLimit返回缩略图默认大小 \return 默认的大小 */ qint64 DThumbnailProvider::defaultSizeLimit() const { Q_D(const DThumbnailProvider); return d->defaultSizeLimit; } /*! \brief DThumbnailProvider::setDefaultSizeLimit设置缩略图的默认大小 \a size 大小 */ void DThumbnailProvider::setDefaultSizeLimit(qint64 size) { Q_D(DThumbnailProvider); d->defaultSizeLimit = size; } /*! \brief DThumbnailProvider::sizeLimit 返回文件大小 \a mimeType 由MIME类型字符串表示的文件或数据类型 \return */ qint64 DThumbnailProvider::sizeLimit(const QMimeType &mimeType) const { Q_D(const DThumbnailProvider); return d->sizeLimitHash.value(mimeType, d->defaultSizeLimit); } /*! \brief DThumbnailProvider::setSizeLimit 设置文件的大小 \a mimeType 由MIME类型字符串表示的文件或数据类型 \a size 范围 */ void DThumbnailProvider::setSizeLimit(const QMimeType &mimeType, qint64 size) { Q_D(DThumbnailProvider); d->sizeLimitHash[mimeType] = size; } /*! \class Dtk::Gui::DThumbnailProvider \inmodule dtkgui \brief 缩略图生成类.  \note 缩略图创建失败 该文件格式未知,无法由程序加载。 文件格式是已知的,但是文件已被损坏,因此无法读取。 由于文件很大,缩略图的生成将花费很长时间 */ DThumbnailProvider::DThumbnailProvider(QObject *parent) : QThread(parent) , DObject(*new DThumbnailProviderPrivate(this)) { d_func()->init(); } DThumbnailProvider::~DThumbnailProvider() { Q_D(DThumbnailProvider); d->running = false; d->waitCondition.wakeAll(); wait(); } void DThumbnailProvider::run() { Q_D(DThumbnailProvider); Q_FOREVER { QWriteLocker locker(&d->dataReadWriteLock); if (d->produceQueue.isEmpty()) { d->waitCondition.wait(&d->dataReadWriteLock); } if (!d->running) { return; } const DThumbnailProviderPrivate::ProduceInfo &task = d->produceQueue.dequeue(); const QPair &tmpKey = qMakePair(task.fileInfo.absoluteFilePath(), task.size); if (d->discardedProduceInfos.contains(tmpKey)) { d->discardedProduceInfos.remove(tmpKey); locker.unlock(); continue; } locker.unlock(); const QString &thumbnail = createThumbnail(task.fileInfo, task.size); if (task.callback) { task.callback(thumbnail); } } } DGUI_END_NAMESPACE dtkgui-5.5.25/src/util/dthumbnailprovider.h000066400000000000000000000046021426550353200207250ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DFILETHUMBNAILPROVIDER_H #define DFILETHUMBNAILPROVIDER_H #include #include #include #include #include QT_BEGIN_NAMESPACE class QMimeType; QT_END_NAMESPACE DGUI_BEGIN_NAMESPACE class DThumbnailProviderPrivate; class DThumbnailProvider : public QThread, public DTK_CORE_NAMESPACE::DObject { Q_OBJECT public: enum Size { Small = 64, Normal = 128, Large = 256, }; static DThumbnailProvider *instance(); bool hasThumbnail(const QFileInfo &info) const; bool hasThumbnail(const QMimeType &mimeType) const; QString thumbnailFilePath(const QFileInfo &info, Size size) const; QString createThumbnail(const QFileInfo &info, Size size); typedef std::function CallBack; void appendToProduceQueue(const QFileInfo &info, Size size, CallBack callback = 0); void removeInProduceQueue(const QFileInfo &info, Size size); QString errorString() const; qint64 defaultSizeLimit() const; void setDefaultSizeLimit(qint64 size); qint64 sizeLimit(const QMimeType &mimeType) const; void setSizeLimit(const QMimeType &mimeType, qint64 size); Q_SIGNALS: void thumbnailChanged(const QString &sourceFilePath, const QString &thumbnailPath) const; void createThumbnailFinished(const QString &sourceFilePath, const QString &thumbnailPath) const; void createThumbnailFailed(const QString &sourceFilePath) const; protected: explicit DThumbnailProvider(QObject *parent = 0); ~DThumbnailProvider(); void run() Q_DECL_OVERRIDE; private: D_DECLARE_PRIVATE(DThumbnailProvider) }; DGUI_END_NAMESPACE #endif // DFILETHUMBNAILPROVIDER_H dtkgui-5.5.25/src/util/util.pri000066400000000000000000000004121426550353200163360ustar00rootroot00000000000000 HEADERS += \ $$PWD/dfontmanager.h \ $$PWD/dsvgrenderer.h \ $$PWD/dtaskbarcontrol.h \ $$PWD/dthumbnailprovider.h SOURCES += \ $$PWD/dfontmanager.cpp \ $$PWD/dsvgrenderer.cpp \ $$PWD/dtaskbarcontrol.cpp \ $$PWD/dthumbnailprovider.cpp dtkgui-5.5.25/tests/000077500000000000000000000000001426550353200142465ustar00rootroot00000000000000dtkgui-5.5.25/tests/images/000077500000000000000000000000001426550353200155135ustar00rootroot00000000000000dtkgui-5.5.25/tests/images/logo_icon.svg000066400000000000000000000040421426550353200202040ustar00rootroot00000000000000 logo icon dtkgui-5.5.25/tests/main.cpp000066400000000000000000000024721426550353200157030ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include #include #ifdef QT_DEBUG #include #endif int main(int argc, char *argv[]) { // gerrit编译时没有显示器,需要指定环境变量 if (!qEnvironmentVariableIsSet("DISPLAY")) qputenv("QT_QPA_PLATFORM", "offscreen"); QApplication app(argc, argv); ::testing::InitGoogleTest(&argc, argv); int ret = RUN_ALL_TESTS(); #ifdef QT_DEBUG __sanitizer_set_report_path("asan.log"); #endif return ret; } dtkgui-5.5.25/tests/res.qrc000066400000000000000000000001431426550353200155440ustar00rootroot00000000000000 images/logo_icon.svg dtkgui-5.5.25/tests/src/000077500000000000000000000000001426550353200150355ustar00rootroot00000000000000dtkgui-5.5.25/tests/src/ut_dfontmanager.cpp000066400000000000000000000062211426550353200207170ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include "dfontmanager.h" #include DGUI_USE_NAMESPACE TEST(ut_DFontManager, StaticFunction) { enum { FontSize = 18 }; QFont tF = DFontManager::get(FontSize, qApp->font()); ASSERT_EQ(tF.pixelSize(), FontSize); ASSERT_EQ(DFontManager::fontPixelSize(tF), FontSize); tF.setPointSizeF(FontSize); ASSERT_TRUE(DFontManager::fontPixelSize(tF) > 0); } class TDFontManager : public DTestWithParam { protected: void SetUp(); void TearDown(); DFontManager *manager; }; INSTANTIATE_TEST_CASE_P(DFontManager, TDFontManager, testing::Range(int(DFontManager::T1), int(DFontManager::NSizeTypes))); void TDFontManager::SetUp() { manager = new DFontManager; } void TDFontManager::TearDown() { delete manager; } TEST_P(TDFontManager, testGetFont) { int param = GetParam(); QFont font = manager->get(DFontManager::SizeType(param), qApp->font()); ASSERT_EQ(font.pixelSize(), manager->fontPixelSize(DFontManager::SizeType(param))); manager->setBaseFont(qApp->font()); ASSERT_EQ(manager->baseFont(), qApp->font()); font = manager->get(DFontManager::SizeType(param)); ASSERT_EQ(font.pixelSize(), manager->fontPixelSize(DFontManager::SizeType(param))); manager->resetBaseFont(); ASSERT_NE(manager->baseFont(), qApp->font()); manager->setFontPixelSize(DFontManager::SizeType(param), param); ASSERT_EQ(manager->fontPixelSize(DFontManager::SizeType(param)), param); } TEST_F(TDFontManager, testFontSize) { manager->setBaseFont(qApp->font()); ASSERT_EQ(manager->t1().pixelSize(), manager->fontPixelSize(DFontManager::T1)); ASSERT_EQ(manager->t2().pixelSize(), manager->fontPixelSize(DFontManager::T2)); ASSERT_EQ(manager->t3().pixelSize(), manager->fontPixelSize(DFontManager::T3)); ASSERT_EQ(manager->t4().pixelSize(), manager->fontPixelSize(DFontManager::T4)); ASSERT_EQ(manager->t5().pixelSize(), manager->fontPixelSize(DFontManager::T5)); ASSERT_EQ(manager->t6().pixelSize(), manager->fontPixelSize(DFontManager::T6)); ASSERT_EQ(manager->t7().pixelSize(), manager->fontPixelSize(DFontManager::T7)); ASSERT_EQ(manager->t8().pixelSize(), manager->fontPixelSize(DFontManager::T8)); ASSERT_EQ(manager->t9().pixelSize(), manager->fontPixelSize(DFontManager::T9)); ASSERT_EQ(manager->t10().pixelSize(), manager->fontPixelSize(DFontManager::T10)); } dtkgui-5.5.25/tests/src/ut_dforeignwindow.cpp000066400000000000000000000045051426550353200213020ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include "dforeignwindow.h" #include #include #include DGUI_BEGIN_NAMESPACE #define WmClass "_d_WmClass" #define ProcessId "_d_ProcessId" class TDForeignWindow : public DTest { protected: virtual void SetUp() { const QVector ¤tIdList = DWindowManagerHelper::instance()->currentWorkspaceWindowIdList(); foreignWindows.clear(); for (quint32 currentId : qAsConst(currentIdList)) { foreignWindows.append(DForeignWindow::fromWinId(currentId)); } } virtual void TearDown() { qDeleteAll(foreignWindows); foreignWindows.clear(); } QList foreignWindows; }; TEST_F(TDForeignWindow, wmClass) { for (auto foreignWindow : qAsConst(foreignWindows)) ASSERT_NE(foreignWindow->wmClass(), QString()); } TEST_F(TDForeignWindow, pid) { for (auto foreignWindow : qAsConst(foreignWindows)) ASSERT_NE(foreignWindow->pid(), 0); } TEST_F(TDForeignWindow, event) { QDynamicPropertyChangeEvent wmevent(WmClass); QDynamicPropertyChangeEvent pidevent(ProcessId); for (auto foreignWindow : qAsConst(foreignWindows)) { QSignalSpy wmspy(foreignWindow, SIGNAL(wmClassChanged())); ASSERT_TRUE(foreignWindow->event(&wmevent)); ASSERT_EQ(wmspy.count(), 1); QSignalSpy pidspy(foreignWindow, SIGNAL(pidChanged())); ASSERT_TRUE(foreignWindow->event(&pidevent)); ASSERT_EQ(pidspy.count(), 1); } } DGUI_END_NAMESPACE dtkgui-5.5.25/tests/src/ut_dguiapplicationhelper.cpp000066400000000000000000000115171426550353200226320ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include "dguiapplicationhelper.h" #include "dguiapplicationhelper_p.h" #include DGUI_BEGIN_NAMESPACE class TDGuiApplicationHelper : public DTest { protected: virtual void SetUp() { helper = DGuiApplicationHelper::instance(); helper_d = helper->d_func(); /* read write */ readWriteDatas << DGuiApplicationHelper::Attribute::UseInactiveColorGroup << DGuiApplicationHelper::Attribute::ColorCompositing; /* read only */ readOnlyDatas << DGuiApplicationHelper::Attribute::IsDeepinPlatformTheme << DGuiApplicationHelper::Attribute::IsDXcbPlatform << DGuiApplicationHelper::Attribute::IsXWindowPlatform << DGuiApplicationHelper::Attribute::IsTableEnvironment << DGuiApplicationHelper::Attribute::IsDeepinEnvironment; } DGuiApplicationHelper *helper = nullptr; DGuiApplicationHelperPrivate *helper_d = nullptr; QList readWriteDatas; QList readOnlyDatas; }; TEST_F(TDGuiApplicationHelper, testFunction) { QColor testColor(Qt::red); QColor adjustedColor = helper->adjustColor(testColor, 0, 0, 0, 0, 0, 0, -20); ASSERT_NE(testColor, adjustedColor); ASSERT_TRUE(adjustedColor.isValid()); QColor disBlendColor = Qt::black; QColor blendedColor = helper->blendColor(testColor, disBlendColor); ASSERT_NE(testColor, blendedColor); ASSERT_TRUE(blendedColor.isValid()); DPalette tPalette; helper->generatePaletteColor(tPalette, QPalette::Window, DGuiApplicationHelper::ColorType::LightType); ASSERT_EQ(tPalette.brush(QPalette::Disabled, QPalette::Window), tPalette.brush(QPalette::Normal, QPalette::Window)); tPalette.setColor(DPalette::Background, Qt::black); helper->generatePaletteColor(tPalette, QPalette::Highlight, DGuiApplicationHelper::ColorType::DarkType); ASSERT_TRUE(tPalette.highlight().color().isValid()); // 初始化调色板为默认值 helper->generatePalette(tPalette); ASSERT_EQ(helper->isXWindowPlatform(), DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsXWindowPlatform)); ASSERT_EQ(helper->isTabletEnvironment(), DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsTableEnvironment)); ASSERT_TRUE(helper->applicationTheme()); ASSERT_TRUE(helper->systemTheme()); ASSERT_NE(helper->applicationPalette(), tPalette); qGuiApp->setAttribute(Qt::AA_SetPalette, false); helper->setPaletteType(DGuiApplicationHelper::DarkType); ASSERT_NE(helper->applicationPalette(), tPalette); helper->setApplicationPalette(tPalette); ASSERT_EQ(helper->applicationPalette(), tPalette); ASSERT_TRUE(helper->fontManager()); ASSERT_EQ(helper->toColorType(QColor(Qt::white)), DGuiApplicationHelper::LightType); ASSERT_EQ(helper->toColorType(QColor(Qt::black)), DGuiApplicationHelper::DarkType); ASSERT_EQ(helper->themeType(), DGuiApplicationHelper::DarkType); ASSERT_EQ(helper->paletteType(), DGuiApplicationHelper::DarkType); } TEST_F(TDGuiApplicationHelper, AttributeReadWrite) { QMap oldData; for (const DGuiApplicationHelper::Attribute attribute : readWriteDatas) { oldData[attribute] = helper->testAttribute(attribute); } for (const DGuiApplicationHelper::Attribute attribute : readWriteDatas) { helper->setAttribute(attribute, !oldData[attribute]); EXPECT_EQ(helper->testAttribute(attribute), !oldData[attribute]); } } TEST_F(TDGuiApplicationHelper, AttributeReadOnly) { QMap oldData; for (const DGuiApplicationHelper::Attribute attribute : readOnlyDatas) { oldData[attribute] = helper->testAttribute(attribute); } for (const DGuiApplicationHelper::Attribute attribute : readOnlyDatas) { helper->setAttribute(attribute, !oldData[attribute]); EXPECT_EQ(helper->testAttribute(attribute), oldData[attribute]); } } DGUI_END_NAMESPACE dtkgui-5.5.25/tests/src/ut_dpalette.cpp000066400000000000000000000105761426550353200200640ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include "test.h" #include "dpalette.h" DGUI_USE_NAMESPACE class TDPalette : public DTestWithParam { protected: void SetUp(); void testAttribute(int cgCount, int ctCount); DPalette palette; }; INSTANTIATE_TEST_CASE_P(DPalette, TDPalette, ::testing::Range(0, 12)); void TDPalette::SetUp() { DGuiApplicationHelper::instance()->generatePalette(palette, DGuiApplicationHelper::LightType); } TEST_P(TDPalette, testFunction) { // 测试属性设置和属性获取函数能够正常调用且返回正确数值 enum {ColorGroupCount = 6}; int ctGroup = GetParam(); for (int i = 0; i < ColorGroupCount; ++i) { QColor color = palette.color(DPalette::ColorGroup(i), DPalette::ColorType(ctGroup)); ASSERT_TRUE(color.isValid()); QBrush brush = palette.brush(DPalette::ColorGroup(i), DPalette::ColorType(ctGroup)); ASSERT_TRUE(brush.color().isValid()); color = palette.color(DPalette::ColorType(ctGroup)); ASSERT_TRUE(color.isValid()); palette.setColor(DPalette::ColorGroup(i), DPalette::ColorType(ctGroup), Qt::black); color = palette.color(DPalette::ColorGroup(i), DPalette::ColorType(ctGroup)); ASSERT_EQ(color, Qt::black); palette.setBrush(DPalette::ColorGroup(i), DPalette::ColorType(ctGroup), QBrush(Qt::blue)); brush = palette.brush(DPalette::ColorGroup(i), DPalette::ColorType(ctGroup)); ASSERT_EQ(brush.color(), Qt::blue); } palette.setColor(DPalette::ColorType(ctGroup), Qt::white); QColor color = palette.color(DPalette::ColorType(ctGroup)); ASSERT_EQ(color, Qt::white); palette.setBrush(DPalette::ColorType(ctGroup), QBrush(Qt::blue)); QBrush brush = palette.brush(DPalette::ColorType(ctGroup)); ASSERT_EQ(brush.color(), Qt::blue); } TEST_F(TDPalette, testColorFunction) { // 测试默认的调色板颜色有效 QBrush brush = palette.itemBackground(); ASSERT_TRUE(brush.color().isValid()); brush = palette.textTiele(); ASSERT_TRUE(brush.color().isValid()); brush = palette.textTips(); ASSERT_TRUE(brush.color().isValid()); brush = palette.textWarning(); ASSERT_TRUE(brush.color().isValid()); brush = palette.textLively(); ASSERT_TRUE(brush.color().isValid()); brush = palette.lightLively(); ASSERT_TRUE(brush.color().isValid()); brush = palette.darkLively(); ASSERT_TRUE(brush.color().isValid()); brush = palette.frameBorder(); ASSERT_TRUE(brush.color().isValid()); brush = palette.placeholderText(); ASSERT_TRUE(brush.color().isValid()); brush = palette.frameShadowBorder(); ASSERT_TRUE(brush.color().isValid()); #ifndef QT_NO_DATASTREAM QByteArray inArray; QDataStream in(&inArray, QIODevice::WriteOnly); // in.setVersion(QDataStream::Qt_5_11); // 直接调用左移运算符会出现二异性 先直接执行一次生成结果 in << static_cast(palette); for (int i = 0; i < DPalette::NColorGroups; ++i) { for (int j = 0; j < DPalette::NColorTypes; ++j) { in << palette.brush(DPalette::ColorGroup(i), DPalette::ColorType(j)); } } ASSERT_FALSE(inArray.isEmpty()); DPalette tp; QDataStream out(&inArray, QIODevice::ReadOnly); out >> tp; ASSERT_EQ(palette, tp); #endif #ifndef QT_NO_DEBUG_STREAM QByteArray debugData; QBuffer debugBuffer(&debugData); ASSERT_TRUE(debugBuffer.open(QIODevice::WriteOnly)); QDebug(&debugBuffer) << palette; debugBuffer.close(); EXPECT_FALSE(debugData.isEmpty()); #endif } dtkgui-5.5.25/tests/src/ut_dplatformhandle.cpp000066400000000000000000000241171426550353200214220ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include "dplatformhandle.h" #include "dwindowmanagerhelper.h" #define DXCB_PLUGIN_KEY "dxcb" #define DXCB_PLUGIN_SYMBOLIC_PROPERTY "_d_isDxcb" #define SETWMWALLPAPERPARAMETER "_d_setWmWallpaperParameter" #define CLIENTLEADER "_d_clientLeader" #define WINDOWRADIUS "_d_windowRadius" #define BORDERWIDTH "_d_borderWidth" #define BORDRCOLOR "_d_borderColor" #define SHADOWRADIUS "_d_shadowRadius" #define SHADOWOFFSET "_d_shadowOffset" #define SHADOWCOLOR "_d_shadowColor" #define CLIPPATH "_d_clipPath" #define FRAMEMASK "_d_frameMask" #define FRAMEMARGINS "_d_frameMargins" #define TRANSLUCENTBACKGROUND "_d_translucentBackground" #define ENABLESYSTEMRESIZE "_d_enableSystemResize" #define ENABLESYSTEMMOVE "_d_enableSystemMove" #define ENABLEBLURWINDOW "_d_enableBlurWindow" #define AUTOINPUTMASKBYCLIPPATH "_d_autoINPUTMASKBYCLIPPATH" #define REALWINDOWID "_d_real_content_window" DGUI_USE_NAMESPACE class TDPlatformHandle : public testing::Test { protected: void SetUp(); void TearDown(); QWindow *window; DPlatformHandle *pHandle; }; void TDPlatformHandle::SetUp() { window = new QWindow; window->create(); pHandle = new DPlatformHandle(window); ASSERT_TRUE(pHandle); } void TDPlatformHandle::TearDown() { delete window; delete pHandle; } TEST_F(TDPlatformHandle, testFunction) { if (!pHandle || qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; qDebug() << "pluginVersion is " << DPlatformHandle::pluginVersion(); EXPECT_EQ(DPlatformHandle::isDXcbPlatform(), (qApp->platformName() == DXCB_PLUGIN_KEY || qApp->property(DXCB_PLUGIN_SYMBOLIC_PROPERTY).toBool())); (DPlatformHandle::enableDXcbForWindow(window)); (DPlatformHandle::enableDXcbForWindow(window, true)); qInfo() << "TDPlatformHandle(isEnabledDXcb):" << DPlatformHandle::isEnabledDXcb(window); if (DPlatformHandle::isEnabledDXcb(window)) { EXPECT_TRUE(DPlatformHandle::setEnabledNoTitlebarForWindow(window, true)); EXPECT_TRUE(DPlatformHandle::setEnabledNoTitlebarForWindow(window, false)); } QVector wmAreaVector; wmAreaVector << dMakeWMBlurArea(0, 0, 20, 20, 4, 4); if (DWindowManagerHelper::instance()->hasBlurWindow()) { EXPECT_TRUE(pHandle->setWindowBlurAreaByWM(window, wmAreaVector)); QPainterPath pPath; pPath.addRect({0, 0, 20, 20}); EXPECT_TRUE(pHandle->setWindowBlurAreaByWM(window, {pPath})); EXPECT_TRUE(pHandle->setWindowBlurAreaByWM(wmAreaVector)); EXPECT_TRUE(pHandle->setWindowBlurAreaByWM({pPath})); } if (qApp->platformFunction(SETWMWALLPAPERPARAMETER)) { EXPECT_TRUE(pHandle->setWindowWallpaperParaByWM(window, {0, 0, 20, 20}, DPlatformHandle::FollowScreen, DPlatformHandle::PreserveAspectFit)); } else { EXPECT_FALSE(pHandle->setWindowWallpaperParaByWM(window, {0, 0, 20, 20}, DPlatformHandle::FollowScreen, DPlatformHandle::PreserveAspectFit)); } if (qApp->platformFunction(CLIENTLEADER)) { ASSERT_TRUE(DPlatformHandle::windowLeader()); } else { ASSERT_FALSE(DPlatformHandle::windowLeader()); } DPlatformHandle::setDisableWindowOverrideCursor(window, true); QVariant windowRadius = window->property(WINDOWRADIUS); if (windowRadius.isValid() && windowRadius.canConvert(QVariant::Int)) { ASSERT_EQ(pHandle->windowRadius(), windowRadius.toInt()); } QVariant borderWidth = window->property(BORDERWIDTH); if (borderWidth.isValid() && borderWidth.canConvert(QVariant::Int)) { ASSERT_EQ(pHandle->borderWidth(), borderWidth.toInt()); } else { ASSERT_EQ(pHandle->borderWidth(), 0); } QVariant borderColor = window->property(BORDRCOLOR); if (borderColor.isValid() && borderColor.canConvert(QVariant::Color)) { ASSERT_EQ(pHandle->borderColor(), borderColor.value()); } else { ASSERT_FALSE(pHandle->borderColor().isValid()); } QVariant shadowRadius = window->property(SHADOWRADIUS); if (shadowRadius.isValid() && shadowRadius.canConvert(QVariant::Int)) { ASSERT_EQ(pHandle->shadowRadius(), shadowRadius.toInt()); } else { ASSERT_FALSE(pHandle->borderColor().isValid()); } QVariant shadowOffset = window->property(SHADOWOFFSET); if (shadowOffset.isValid() && shadowOffset.canConvert(QVariant::Point)) { ASSERT_EQ(pHandle->shadowOffset(), shadowOffset.value()); } else { ASSERT_TRUE(pHandle->shadowOffset().isNull()); } QVariant shadowColor = window->property(SHADOWCOLOR); if (shadowColor.isValid() && shadowColor.canConvert(QVariant::Color)) { ASSERT_EQ(pHandle->shadowColor(), shadowColor.value()); } else { ASSERT_FALSE(pHandle->shadowColor().isValid()); } QVariant clipPath = window->property(CLIPPATH); if (clipPath.isValid() && !clipPath.value().isEmpty()) { ASSERT_EQ(pHandle->clipPath(), clipPath.value()); } else { ASSERT_TRUE(pHandle->clipPath().isEmpty()); } QVariant frameMask = window->property(FRAMEMASK); if (frameMask.isValid() && frameMask.canConvert(QVariant::Region)) { ASSERT_EQ(pHandle->frameMask(), frameMask.value()); } else { ASSERT_TRUE(pHandle->frameMask().isEmpty()); } QVariant frameMargins = window->property(FRAMEMARGINS); if (frameMargins.isValid() && !frameMargins.value().isNull()) { ASSERT_EQ(pHandle->frameMargins(), frameMargins.value()); } else { ASSERT_TRUE(pHandle->frameMargins().isNull()); } QVariant translucentBackground = window->property(TRANSLUCENTBACKGROUND); if (translucentBackground.isValid() && translucentBackground.canConvert(QVariant::Bool)) { ASSERT_EQ(pHandle->translucentBackground(), translucentBackground.toBool()); } else { ASSERT_FALSE(pHandle->translucentBackground()); } QVariant enableSystemResize = window->property(ENABLESYSTEMRESIZE); if (enableSystemResize.isValid() && enableSystemResize.canConvert(QVariant::Bool)) { ASSERT_EQ(pHandle->enableSystemResize(), enableSystemResize.toBool()); } else { ASSERT_FALSE(pHandle->enableSystemResize()); } QVariant enableSystemMove = window->property(ENABLESYSTEMMOVE); if (enableSystemMove.isValid() && enableSystemMove.canConvert(QVariant::Bool)) { ASSERT_EQ(pHandle->enableSystemMove(), enableSystemMove.toBool()); } else { ASSERT_FALSE(pHandle->enableSystemMove()); } QVariant enableBlurWindow = window->property(ENABLEBLURWINDOW); if (enableBlurWindow.isValid() && enableBlurWindow.canConvert(QVariant::Bool)) { ASSERT_EQ(pHandle->enableBlurWindow(), enableBlurWindow.toBool()); } else { ASSERT_FALSE(pHandle->enableBlurWindow()); } QVariant autoInputMaskByClipPath = window->property(AUTOINPUTMASKBYCLIPPATH); if (autoInputMaskByClipPath.isValid() && autoInputMaskByClipPath.canConvert(QVariant::Bool)) { ASSERT_EQ(pHandle->autoInputMaskByClipPath(), autoInputMaskByClipPath.toBool()); } else { ASSERT_FALSE(pHandle->autoInputMaskByClipPath()); } QVariant realWindowId = window->property(REALWINDOWID); if (enableBlurWindow.isValid() && enableBlurWindow.value() != 0) { ASSERT_EQ(pHandle->realWindowId(), enableBlurWindow.value()); } else { ASSERT_FALSE(pHandle->realWindowId()); } } TEST_F(TDPlatformHandle, testSlots) { enum { TESTBORDERWIDTH = 4, TESTOFFSET = 6, TESTRADIUS = 8 }; if (pHandle) { pHandle->setWindowRadius(TESTRADIUS); ASSERT_EQ(pHandle->windowRadius(), TESTRADIUS); pHandle->setBorderWidth(TESTBORDERWIDTH); ASSERT_EQ(pHandle->borderWidth(), TESTBORDERWIDTH); pHandle->setBorderColor(Qt::black); ASSERT_EQ(pHandle->borderColor(), Qt::black); pHandle->setShadowRadius(TESTRADIUS); ASSERT_EQ(pHandle->shadowRadius(), TESTRADIUS); pHandle->setShadowOffset({TESTOFFSET, TESTOFFSET}); ASSERT_EQ(pHandle->shadowOffset(), QPoint(TESTOFFSET, TESTOFFSET)); pHandle->setShadowColor(Qt::blue); ASSERT_EQ(pHandle->shadowColor(), Qt::blue); QPainterPath pPath; pPath.addRect({0, 0, 20, 20}); pHandle->setClipPath(pPath); ASSERT_EQ(pHandle->clipPath(), pPath); pHandle->setFrameMask(QRegion(0, 0, 10, 10)); ASSERT_EQ(pHandle->frameMask(), QRegion(0, 0, 10, 10)); pHandle->setTranslucentBackground(true); ASSERT_TRUE(pHandle->translucentBackground()); pHandle->setEnableSystemResize(true); ASSERT_TRUE(pHandle->enableSystemResize()); pHandle->setEnableSystemMove(true); ASSERT_TRUE(pHandle->enableSystemMove()); pHandle->setEnableBlurWindow(true); ASSERT_TRUE(pHandle->enableBlurWindow()); pHandle->setAutoInputMaskByClipPath(true); ASSERT_TRUE(pHandle->autoInputMaskByClipPath()); } } TEST_F(TDPlatformHandle, wmAreaDebug) { DPlatformHandle::WMBlurArea area = dMakeWMBlurArea(0, 0, 20, 20); QByteArray data; QBuffer buf(&data); ASSERT_TRUE(buf.open(QIODevice::WriteOnly)); QDebug tDebug(&buf); tDebug << area; buf.close(); ASSERT_FALSE(data.isEmpty()); } dtkgui-5.5.25/tests/src/ut_dplatformtheme.cpp000066400000000000000000000116331426550353200212700ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include "dguiapplicationhelper.h" #include "dplatformtheme.h" #include "dplatformtheme_p.h" DGUI_USE_NAMESPACE class TDPlatformTheme : public testing::Test { protected: void SetUp(); void TearDown(); QWidget *widget; DPlatformTheme *theme; DPlatformThemePrivate *theme_d; }; void TDPlatformTheme::SetUp() { widget = new QWidget; widget->show(); ASSERT_TRUE(QTest::qWaitForWindowExposed(widget)); theme = new DPlatformTheme(widget->windowHandle()->winId(), widget); theme_d = theme->d_func(); } void TDPlatformTheme::TearDown() { delete widget; } TEST_F(TDPlatformTheme, testFunction) { ASSERT_TRUE(theme_d->theme); ASSERT_EQ(theme->parentTheme(), theme_d->parent); ASSERT_FALSE(theme->isValid()); DPalette tPalette = theme->palette(); ASSERT_EQ(theme->fetchPalette(tPalette), tPalette); } #define TEST_THEME_NAME(TYPE) \ QByteArrayLiteral("Test_Name_About_").append(TYPE) #define ASSERT_EQ_BY_VALUE(SetFunc,Func,Param) \ theme->SetFunc(Param); \ ASSERT_EQ(theme->Func(),Param); \ #define ASSERT_EQ_COLOR(SetFunc,Func,Param) \ ASSERT_EQ_BY_VALUE(SetFunc,Func,Param); \ #define ASSERT_EQ_BY_NAME(SetFunc,Func,Param) \ theme->SetFunc(TEST_THEME_NAME(Param)); \ ASSERT_EQ(theme->Func(),TEST_THEME_NAME(Param)); TEST_F(TDPlatformTheme, testSetFunction) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; if (!theme->isValid()) { qDebug() << "PlatformTheme is not valid"; return; } enum { TEST_COLOR = Qt::blue, TEST_DATA = 50 }; ASSERT_EQ_BY_VALUE(setCursorBlinkTime, cursorBlinkTime, TEST_DATA); ASSERT_EQ_BY_VALUE(setCursorBlinkTimeout, cursorBlinkTimeout, TEST_DATA); ASSERT_EQ_BY_VALUE(setCursorBlink, cursorBlink, true) ASSERT_EQ_BY_VALUE(setDoubleClickDistance, doubleClickDistance, TEST_DATA); ASSERT_EQ_BY_VALUE(setDoubleClickTime, doubleClickTime, TEST_DATA) ASSERT_EQ_BY_VALUE(setDndDragThreshold, dndDragThreshold, TEST_DATA); ASSERT_EQ_BY_NAME(setThemeName, themeName, "Theme"); ASSERT_EQ_BY_NAME(setIconThemeName, iconThemeName, "Icon"); ASSERT_EQ_BY_NAME(setSoundThemeName, soundThemeName, "Sound"); ASSERT_EQ_BY_NAME(setFontName, fontName, "Font"); ASSERT_EQ_BY_NAME(setMonoFontName, monoFontName, "MonoFont"); ASSERT_EQ_BY_NAME(setGtkFontName, gtkFontName, "GtkFont"); ASSERT_EQ_BY_VALUE(setFontPointSize, fontPointSize, TEST_DATA); ASSERT_EQ_BY_VALUE(setActiveColor, activeColor, TEST_COLOR); ASSERT_EQ_COLOR(setWindow, window, TEST_COLOR); ASSERT_EQ_BY_VALUE(setWindowText, windowText, TEST_COLOR); ASSERT_EQ_BY_VALUE(setBase, base, TEST_COLOR); ASSERT_EQ_BY_VALUE(setAlternateBase, alternateBase, TEST_COLOR); ASSERT_EQ_BY_VALUE(setToolTipBase, toolTipBase, TEST_COLOR); ASSERT_EQ_BY_VALUE(setToolTipText, toolTipText, TEST_COLOR); ASSERT_EQ_BY_VALUE(setText, text, TEST_COLOR); ASSERT_EQ_BY_VALUE(setButton, button, TEST_COLOR); ASSERT_EQ_BY_VALUE(setButtonText, buttonText, TEST_COLOR); ASSERT_EQ_BY_VALUE(setBrightText, brightText, TEST_COLOR); ASSERT_EQ_BY_VALUE(setLight, light, TEST_COLOR); ASSERT_EQ_BY_VALUE(setMidlight, midlight, TEST_COLOR); ASSERT_EQ_BY_VALUE(setDark, dark, TEST_COLOR); ASSERT_EQ_BY_VALUE(setMid, mid, TEST_COLOR); ASSERT_EQ_BY_VALUE(setShadow, shadow, TEST_COLOR); ASSERT_EQ_BY_VALUE(setHighlight, highlight, TEST_COLOR); ASSERT_EQ_BY_VALUE(setLink, link, TEST_COLOR); ASSERT_EQ_BY_VALUE(setLinkVisited, linkVisited, TEST_COLOR); ASSERT_EQ_BY_VALUE(setItemBackground, itemBackground, TEST_COLOR); ASSERT_EQ_BY_VALUE(setTextTitle, textTitle, TEST_COLOR); ASSERT_EQ_BY_VALUE(setTextTips, textTips, TEST_COLOR); ASSERT_EQ_BY_VALUE(setTextWarning, textWarning, TEST_COLOR); ASSERT_EQ_BY_VALUE(setTextLively, textLively, TEST_COLOR); ASSERT_EQ_BY_VALUE(setLightLively, lightLively, TEST_COLOR); ASSERT_EQ_BY_VALUE(setDarkLively, darkLively, TEST_COLOR); ASSERT_EQ_BY_VALUE(setFrameBorder, frameBorder, TEST_COLOR); ASSERT_EQ_BY_VALUE(setWindowRadius, windowRadius, TEST_DATA / 10); } dtkgui-5.5.25/tests/src/ut_dregionmonitor.cpp000066400000000000000000000154071426550353200213170ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include "dregionmonitor.h" #include "private/dregionmonitor_p.h" #include #include #include DGUI_BEGIN_NAMESPACE class TDRegionMonitor : public DTest { protected: virtual void SetUp() { regionMonitor = new DRegionMonitor(nullptr); } virtual void TearDown() { delete regionMonitor; } DRegionMonitor *regionMonitor = nullptr; }; TEST_F(TDRegionMonitor, registerRegion) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; regionMonitor->registerRegion(); ASSERT_TRUE(regionMonitor->registered()); } TEST_F(TDRegionMonitor, registered) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; ASSERT_FALSE(regionMonitor->registered()); } TEST_F(TDRegionMonitor, watchedRegion) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; ASSERT_EQ(regionMonitor->watchedRegion(), QRegion()); } TEST_F(TDRegionMonitor, coordinateType) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; ASSERT_EQ(regionMonitor->coordinateType(), DRegionMonitor::ScaleRatio); } TEST_F(TDRegionMonitor, registerRegionArg) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; ASSERT_EQ(regionMonitor->watchedRegion(), QRegion()); QRegion r(0, 0, 600, 400); regionMonitor->registerRegion(r); ASSERT_EQ(regionMonitor->watchedRegion(), r); } TEST_F(TDRegionMonitor, unregisterRegion) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; regionMonitor->registerRegion(); ASSERT_TRUE(regionMonitor->registered()); regionMonitor->unregisterRegion(); ASSERT_FALSE(regionMonitor->registered()); } TEST_F(TDRegionMonitor, setWatchedRegion) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; ASSERT_EQ(regionMonitor->watchedRegion(), QRegion()); QRegion r(0, 0, 600, 400); regionMonitor->setWatchedRegion(r); ASSERT_EQ(regionMonitor->watchedRegion(), r); } TEST_F(TDRegionMonitor, setCoordinateType) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; ASSERT_EQ(regionMonitor->coordinateType(), DRegionMonitor::ScaleRatio); regionMonitor->setCoordinateType(DRegionMonitor::Original); ASSERT_EQ(regionMonitor->coordinateType(), DRegionMonitor::Original); } TEST_F(TDRegionMonitor, registerFlags) { #ifndef QT_NO_DEBUG_STREAM enum { TestRegionFlag = (DRegionMonitor::Motion | DRegionMonitor::Button) }; regionMonitor->setRegisterFlags(DRegionMonitor::RegisterdFlag(TestRegionFlag)); ASSERT_EQ(regionMonitor->registerFlags(), TestRegionFlag); #endif } TEST_F(TDRegionMonitor, privateFunctions) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; DRegionMonitorPrivate *region_d = regionMonitor->d_func(); ASSERT_TRUE(region_d); regionMonitor->registerRegion(); ASSERT_TRUE(region_d->registered()); region_d->registerMonitorRegion(); ASSERT_FALSE(region_d->registerKey.isEmpty()); region_d->watchedRegion = {0, 0, 30, 30}; region_d->registerMonitorRegion(); ASSERT_FALSE(region_d->registerKey.isEmpty()); region_d->unregisterMonitorRegion(); ASSERT_TRUE(region_d->registerKey.isEmpty()); enum { TestFlag = 1 | 2, TestPos = 20 }; const QString testKey = "Key_Enter"; QSignalSpy btnPressSpy(regionMonitor, SIGNAL(buttonPress(const QPoint &, const int))); region_d->_q_ButtonPress(TestFlag, TestPos, TestPos, region_d->registerKey); ASSERT_EQ(btnPressSpy.count(), 1); auto pressArguments = btnPressSpy.takeFirst(); ASSERT_EQ(pressArguments.at(0).toPoint(), region_d->deviceScaledCoordinate({TestPos, TestPos}, qApp->devicePixelRatio())); ASSERT_EQ(pressArguments.at(1).toInt(), TestFlag); QSignalSpy btnreleaseSpy(regionMonitor, SIGNAL(buttonRelease(const QPoint &, const int))); region_d->_q_ButtonRelease(TestFlag, TestPos, TestPos, region_d->registerKey); ASSERT_EQ(btnreleaseSpy.count(), 1); auto releaseArguments = btnreleaseSpy.takeFirst(); ASSERT_EQ(releaseArguments.at(0).toPoint(), region_d->deviceScaledCoordinate({TestPos, TestPos}, qApp->devicePixelRatio())); ASSERT_EQ(releaseArguments.at(1).toInt(), TestFlag); QSignalSpy cursorMoveSpy(regionMonitor, SIGNAL(cursorMove(const QPoint &))); region_d->_q_CursorMove(TestPos, TestPos, region_d->registerKey); ASSERT_EQ(cursorMoveSpy.count(), 1); auto curMoveArguments = cursorMoveSpy.takeFirst(); ASSERT_EQ(curMoveArguments.at(0).toPoint(), region_d->deviceScaledCoordinate({TestPos, TestPos}, qApp->devicePixelRatio())); QSignalSpy cursorEnterSpy(regionMonitor, SIGNAL(cursorEnter(const QPoint &))); region_d->_q_CursorEnter(TestPos, TestPos, region_d->registerKey); ASSERT_EQ(cursorEnterSpy.count(), 1); auto curEnterArguments = cursorEnterSpy.takeFirst(); ASSERT_EQ(curEnterArguments.at(0).toPoint(), region_d->deviceScaledCoordinate({TestPos, TestPos}, qApp->devicePixelRatio())); QSignalSpy cursorLeaveSpy(regionMonitor, SIGNAL(cursorLeave(const QPoint &))); region_d->_q_CursorLeave(TestPos, TestPos, region_d->registerKey); ASSERT_EQ(cursorLeaveSpy.count(), 1); auto curLeaveArguments = cursorLeaveSpy.takeFirst(); ASSERT_EQ(curLeaveArguments.at(0).toPoint(), region_d->deviceScaledCoordinate({TestPos, TestPos}, qApp->devicePixelRatio())); QSignalSpy keyPressSpy(regionMonitor, SIGNAL(keyPress(const QString &))); region_d->_q_KeyPress(testKey, TestPos, TestPos, region_d->registerKey); ASSERT_EQ(keyPressSpy.count(), 1); auto keyPressArguments = keyPressSpy.takeFirst(); ASSERT_EQ(keyPressArguments.at(0).toString(), testKey); QSignalSpy keyReleaseSpy(regionMonitor, SIGNAL(keyRelease(const QString &))); region_d->_q_KeyRelease(testKey, TestPos, TestPos, region_d->registerKey); ASSERT_EQ(keyReleaseSpy.count(), 1); auto keyReleaseArguments = keyReleaseSpy.takeFirst(); ASSERT_EQ(keyReleaseArguments.at(0).toString(), testKey); } DGUI_END_NAMESPACE dtkgui-5.5.25/tests/src/ut_dsvgrenderer.cpp000066400000000000000000000074441426550353200207540ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dsvgrenderer.h" #include "test.h" #include #include #include #include #include DGUI_USE_NAMESPACE TEST(ut_DSvgRenderer, testInit) { DSvgRenderer svg_1; DSvgRenderer svg_2(QStringLiteral(":/images/logo_icon.svg")); ASSERT_FALSE(svg_1.isValid()); ASSERT_TRUE(svg_2.isValid()); QFile file(":/images/logo_icon.svg"); if (!file.open(QFile::ReadOnly)) return; QByteArray data = file.readAll(); DSvgRenderer svg_3(data); ASSERT_TRUE(svg_3.isValid()); } class TDSvgRenderer : public DTest { protected: void SetUp(); void TearDown(); DSvgRenderer *renderer; bool canLoad; }; void TDSvgRenderer::SetUp() { QLibrary rsvg("rsvg-2", "2"); if (!rsvg.isLoaded()) { canLoad = rsvg.load(); if (canLoad) { rsvg.unload(); } } renderer = new DSvgRenderer; } void TDSvgRenderer::TearDown() { delete renderer; } TEST_F(TDSvgRenderer, testLoad) { if (!canLoad) return; ASSERT_TRUE(renderer->load(QStringLiteral(":/images/logo_icon.svg"))); ASSERT_TRUE(renderer->isValid()); ASSERT_FALSE(renderer->defaultSize().isEmpty()); ASSERT_FALSE(renderer->viewBox().isEmpty()); ASSERT_FALSE(renderer->viewBoxF().isEmpty()); } static bool testPixmapHasData(const QPixmap &pixmap) { QImage image = pixmap.toImage(); image.reinterpretAsFormat(QImage::Format_RGB32); const QRgb *bits = reinterpret_cast(image.constBits()); const QRgb *end = bits + image.byteCount() / sizeof(QRgb); return !std::all_of(bits, end, [](QRgb r) { return r == QColor(Qt::green).rgb(); }); } #define TestRenderID QStringLiteral("#tittlebar") #define TestRenderID_NotExist QStringLiteral("#TestRsvg_notexist") TEST_F(TDSvgRenderer, testRender) { if (!canLoad) return; enum { TestPixmapSize = 16 }; ASSERT_TRUE(renderer->load(QString(":/images/logo_icon.svg"))); QPixmap tPixmap(QSize(TestPixmapSize, TestPixmapSize)); tPixmap.fill(Qt::green); QPainter tPainter(&tPixmap); renderer->render(&tPainter); ASSERT_TRUE(testPixmapHasData(tPixmap)); tPixmap.fill(Qt::green); ASSERT_FALSE(testPixmapHasData(tPixmap)); renderer->render(&tPainter, TestRenderID); ASSERT_TRUE(testPixmapHasData(tPixmap)); tPixmap.fill(Qt::green); ASSERT_FALSE(testPixmapHasData(tPixmap)); ASSERT_TRUE(renderer->elementExists(TestRenderID)); ASSERT_FALSE(renderer->elementExists(TestRenderID_NotExist)); ASSERT_FALSE(renderer->boundsOnElement(TestRenderID).isEmpty()); ASSERT_TRUE(renderer->boundsOnElement(TestRenderID_NotExist).isEmpty()); renderer->render(&tPainter, {0, 0, TestPixmapSize, TestPixmapSize}); ASSERT_TRUE(testPixmapHasData(tPixmap)); tPixmap.fill(Qt::green); ASSERT_FALSE(testPixmapHasData(tPixmap)); ASSERT_FALSE(renderer->toImage({TestPixmapSize, TestPixmapSize}).isNull()); ASSERT_FALSE(renderer->toImage({TestPixmapSize, TestPixmapSize}, TestRenderID).isNull()); } dtkgui-5.5.25/tests/src/ut_dtaskbarcontrol.cpp000066400000000000000000000045231426550353200214510ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include "dtaskbarcontrol.h" #include #include DGUI_USE_NAMESPACE // 由于需要发送dbus接口 使用打桩类进行 class MockDTaskbarControl : public DTaskbarControl { public: using DTaskbarControl::DTaskbarControl; MOCK_METHOD1(sendMessage, void(const QVariantMap &)); }; class TDTaskbarControl : public DTest { protected: void SetUp(); void TearDown(); MockDTaskbarControl *control; }; void TDTaskbarControl::SetUp() { control = new MockDTaskbarControl; } void TDTaskbarControl::TearDown() { delete control; } TEST_F(TDTaskbarControl, testFunction) { enum { ProgressTestValue = 1 }; EXPECT_CALL(*control, sendMessage(testing::_)).Times(testing::AtLeast(1)); QSignalSpy valueChangedSpy(control, SIGNAL(progressChanged(double))); control->setProgress(true, ProgressTestValue); ASSERT_EQ(valueChangedSpy.count(), 1); QSignalSpy visibleChangedSpy(control, SIGNAL(progressVisibleChanged(bool))); control->setProgress(false, ProgressTestValue); ASSERT_EQ(visibleChangedSpy.count(), 1); QSignalSpy counterChangedSpy(control, SIGNAL(counterChanged(int))); control->setCounter(true, 1); ASSERT_EQ(control->counter(), 1); ASSERT_EQ(counterChangedSpy.count(), 1); QSignalSpy counterVisibleSpy(control, SIGNAL(counterVisibleChanged(bool))); control->setCounter(false, 1); ASSERT_EQ(counterVisibleSpy.count(), 1); control->setUrgency(true); control->setCounterVisible(true); ASSERT_EQ(control->counterVisible(), true); } dtkgui-5.5.25/tests/src/ut_dthumbnailprovider.cpp000066400000000000000000000111071426550353200221530ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include "dthumbnailprovider.h" #include #include #include #include #include #include #include #include #include DGUI_BEGIN_NAMESPACE #ifndef UT_DThumbnailProviderPrivate #define UT_DThumbnailProviderPrivate class DThumbnailProviderPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate { public: DThumbnailProviderPrivate(DThumbnailProvider *qq); void init(); QString sizeToFilePath(DThumbnailProvider::Size size) const; QString errorString; // MAX qint64 defaultSizeLimit = INT64_MAX; QHash sizeLimitHash; QMimeDatabase mimeDatabase; static QSet hasThumbnailMimeHash; struct ProduceInfo { QFileInfo fileInfo; DThumbnailProvider::Size size; DThumbnailProvider::CallBack callback; }; QQueue produceQueue; QSet> discardedProduceInfos; bool running = true; QWaitCondition waitCondition; QReadWriteLock dataReadWriteLock; D_DECLARE_PUBLIC(DThumbnailProvider) }; #endif DGUI_END_NAMESPACE DGUI_USE_NAMESPACE class TDThumbnailProvider : public DTest { protected: void SetUp(); void TearDown(); DThumbnailProvider *provider; DThumbnailProviderPrivate *provider_d; }; void TDThumbnailProvider::SetUp() { provider = DThumbnailProvider::instance(); provider_d = provider->d_func(); } void TDThumbnailProvider::TearDown() { // gtest会释放静态部分数据 导致双重释放程序崩溃这里手动将数据清空防止崩溃事情发生 provider_d->hasThumbnailMimeHash.clear(); } #define TESTRES_PATH ":/images/logo_icon.svg" #define TESTRES_PATH_1 "no_exist" TEST_F(TDThumbnailProvider, TestCreate) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; QFileInfo fi(TESTRES_PATH); QSignalSpy finishedSpy(provider, SIGNAL(createThumbnailFinished(const QString &, const QString &))); QString ret = provider->createThumbnail(fi, DThumbnailProvider::Normal); ASSERT_FALSE(ret.isEmpty()); ASSERT_EQ(finishedSpy.count(), 1); ASSERT_FALSE(provider->thumbnailFilePath(fi, DThumbnailProvider::Normal).isEmpty()); QFileInfo fi_notexisted(TESTRES_PATH_1); QSignalSpy failedSpy(provider, SIGNAL(createThumbnailFailed(const QString &))); ret = provider->createThumbnail(fi_notexisted, DThumbnailProvider::Normal); ASSERT_TRUE(ret.isEmpty()); ASSERT_EQ(finishedSpy.count(), 1); ASSERT_FALSE(provider->errorString().isEmpty()); ASSERT_TRUE(provider->thumbnailFilePath(fi_notexisted, DThumbnailProvider::Normal).isEmpty()); } TEST_F(TDThumbnailProvider, testAttribute) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; ASSERT_TRUE(provider->hasThumbnail(QFileInfo(TESTRES_PATH))); enum { TEST_DEFALUTSIZELIMIT = 25 }; provider->setDefaultSizeLimit(TEST_DEFALUTSIZELIMIT); ASSERT_EQ(provider->defaultSizeLimit(), TEST_DEFALUTSIZELIMIT); QMimeDatabase base; auto type = base.mimeTypeForFile(TESTRES_PATH); provider->setSizeLimit(type, TEST_DEFALUTSIZELIMIT); ASSERT_EQ(provider->sizeLimit(type), TEST_DEFALUTSIZELIMIT); } void testCallBack(const QString &) { return; } TEST_F(TDThumbnailProvider, TestProducrQueue) { provider_d->running = true; provider->appendToProduceQueue(QFileInfo(TESTRES_PATH), DThumbnailProvider::Small); provider->appendToProduceQueue(QFileInfo(TESTRES_PATH), DThumbnailProvider::Large, &testCallBack); ASSERT_FALSE(provider_d->produceQueue.isEmpty()); provider->removeInProduceQueue(QFileInfo(TESTRES_PATH), DThumbnailProvider::Small); ASSERT_FALSE(provider_d->discardedProduceInfos.isEmpty()); provider_d->running = false; } dtkgui-5.5.25/tests/src/ut_dwindowgroupleader.cpp000066400000000000000000000043011426550353200221540ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include "dwindowgroupleader.h" #include #include #include DGUI_USE_NAMESPACE class TDWindowGroupLeader : public DTest { protected: void SetUp(); void TearDown(); DWindowGroupLeader *groupLeader; QWindow *window1; QWindow *window2; }; void TDWindowGroupLeader::SetUp() { groupLeader = new DWindowGroupLeader; window1 = new QWindow; window2 = new QWindow; window1->create(); window2->create(); } void TDWindowGroupLeader::TearDown() { delete groupLeader; delete window1; delete window2; } TEST_F(TDWindowGroupLeader, testFunctions) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; // 测试多种情况添加window时数据是否正常 groupLeader->addWindow(window1); groupLeader->addWindow(window2); qDebug() << "addWindow 1 & 2"; qDebug() << "groupLeaderId" << groupLeader->groupLeaderId(); qDebug() << "groupLeaderId" << groupLeader->clientLeaderId(); groupLeader->removeWindow(window1); qDebug() << "removeWindow 1"; qDebug() << "groupLeaderId" << groupLeader->groupLeaderId(); qDebug() << "groupLeaderId" << groupLeader->clientLeaderId(); groupLeader->removeWindow(window2); qDebug() << "removeWindow 2"; qDebug() << "groupLeaderId" << groupLeader->groupLeaderId(); qDebug() << "groupLeaderId" << groupLeader->clientLeaderId(); } dtkgui-5.5.25/tests/src/ut_dwindowmanagerhelper.cpp000066400000000000000000000117441426550353200224660ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "test.h" #include #include "dwindowmanagerhelper.h" #include "dforeignwindow.h" DGUI_USE_NAMESPACE class TDWindowMangerHelper : public DTest { protected: void SetUp(); DWindowManagerHelper *wm_helper; }; void TDWindowMangerHelper::SetUp() { wm_helper = DWindowManagerHelper::instance(); } TEST_F(TDWindowMangerHelper, testStaticFunction) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; QWidget *w = new QWidget; w->show(); ASSERT_TRUE(QTest::qWaitForWindowExposed(w)); enum { TestMotifFunction = DWindowManagerHelper::FUNC_RESIZE | DWindowManagerHelper::FUNC_MOVE, TestAllMotifFunction = DWindowManagerHelper::FUNC_ALL}; enum { TestDecorations = DWindowManagerHelper::DECOR_BORDER | DWindowManagerHelper::DECOR_RESIZEH, TestAllDecorations = DWindowManagerHelper::DECOR_ALL }; // 测试静态函数测试是否正常 DWindowManagerHelper::setMotifFunctions(w->windowHandle(), DWindowManagerHelper::MotifFunctions(TestMotifFunction)); DWindowManagerHelper::MotifFunctions mFuncs = DWindowManagerHelper::getMotifFunctions(w->windowHandle()); if (wm_helper->windowManagerName() == DWindowManagerHelper::KWinWM) { ASSERT_EQ(mFuncs, TestMotifFunction); } else { qDebug() << "not support other wm"; } mFuncs = DWindowManagerHelper::setMotifFunctions(w->windowHandle(), DWindowManagerHelper::MotifFunctions(TestAllMotifFunction), true); ASSERT_EQ(mFuncs, TestAllMotifFunction); DWindowManagerHelper::setMotifDecorations(w->windowHandle(), DWindowManagerHelper::MotifDecorations(TestDecorations)); DWindowManagerHelper::MotifDecorations mDecos = DWindowManagerHelper::getMotifDecorations(w->windowHandle()); if (wm_helper->windowManagerName() == DWindowManagerHelper::KWinWM) ASSERT_EQ(mDecos, TestDecorations); mDecos = DWindowManagerHelper::setMotifDecorations(w->windowHandle(), DWindowManagerHelper::MotifDecorations(TestAllDecorations), true); if (wm_helper->windowManagerName() == DWindowManagerHelper::KWinWM) ASSERT_EQ(mDecos, TestAllDecorations); // 没有崩溃则测试成功 enum { TestWindowType = DWindowManagerHelper::DesktopType | DWindowManagerHelper::MenuType }; DWindowManagerHelper::setWmWindowTypes(w->windowHandle(), DWindowManagerHelper::WmWindowTypes(TestWindowType)); DWindowManagerHelper::setWmClassName(QByteArrayLiteral("TestWmClass")); DWindowManagerHelper::popupSystemWindowMenu(w->windowHandle()); delete w; } TEST_F(TDWindowMangerHelper, testFunctions) { if (qgetenv("QT_QPA_PLATFORM").contains("offscreen")) return; qDebug() << wm_helper->windowManagerNameString() << "\nhas blur window:" << wm_helper->hasBlurWindow() << "\nhas composite:" << wm_helper->hasComposite() << "\nhas not titlebar:" << wm_helper->hasNoTitlebar(); // ASSERT_TRUE(wm_helper->hasWallpaperEffect()); // ASSERT_FALSE(wm_helper->windowManagerNameString().isEmpty()); if (wm_helper->windowManagerNameString().contains(QStringLiteral("DeepinGala"))) { ASSERT_EQ(wm_helper->windowManagerName(), DWindowManagerHelper::DeepinWM); } else if (wm_helper->windowManagerNameString().contains(QStringLiteral("KWin"))) { ASSERT_EQ(wm_helper->windowManagerName(), DWindowManagerHelper::KWinWM); } else { ASSERT_EQ(wm_helper->windowManagerName(), DWindowManagerHelper::OtherWM); } if (wm_helper->windowManagerName() == DWindowManagerHelper::KWinWM) { ASSERT_FALSE(wm_helper->allWindowIdList().isEmpty()); ASSERT_FALSE(wm_helper->currentWorkspaceWindowIdList().isEmpty()); ASSERT_FALSE(wm_helper->currentWorkspaceWindows().isEmpty()); ASSERT_TRUE(wm_helper->windowFromPoint(wm_helper->currentWorkspaceWindows().first()->position())); } else { qDebug() << "allWindowIdList count:" << wm_helper->allWindowIdList().count() << "\ncurrentWorkspaceWindowIdList count:" << wm_helper->currentWorkspaceWindowIdList().count() << "\ncurrentWorkspaceWindows count:" << wm_helper->currentWorkspaceWindows().count() << "\nwindowFromPoint:" << wm_helper->windowFromPoint(QPoint()); } } dtkgui-5.5.25/tests/test-recoverage.sh000077500000000000000000000016111426550353200177030ustar00rootroot00000000000000#!/bin/bash BUILD_DIR=`pwd`/../build-ut HTML_DIR=${BUILD_DIR}/html XML_DIR=${BUILD_DIR}/report cd ../ rm -rf $BUILD_DIR mkdir $BUILD_DIR cd $BUILD_DIR qmake .. CONFIG+=debug make -j$(nproc) cd ../tests/ rm -rf $BUILD_DIR mkdir $BUILD_DIR cd $BUILD_DIR qmake .. CONFIG+=debug export ASAN_OPTIONS=halt_on_error=0 TESTARGS="--gtest_output=xml:${XML_DIR}/report_dtkgui.xml" make check -j$(nproc) lcov -d ./ -c -o coverage_all.info #lcov --extract coverage_all.info $EXTRACT_ARGS --output-file coverage.info lcov --remove coverage_all.info "*/tests/*" "*/usr/include*" "*build-ut/src*" --output-file coverage.info cd .. genhtml -o $HTML_DIR $BUILD_DIR/coverage.info && mv ${BUILD_DIR}/html/index.html ${BUILD_DIR}/html/cov_dtkgui.html test -e ${BUILD_DIR}/asan.log* && mv ${BUILD_DIR}/asan.log* ${BUILD_DIR}/asan_dtkgui.log || touch ${BUILD_DIR}/asan_dtkgui.log #rm -rf $BUILD_DIR #rm -rf ../$BUILD_DIR dtkgui-5.5.25/tests/test.h000066400000000000000000000017651426550353200154070ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Deepin Technology Co., Ltd. * * Author: Chen Bin * * Maintainer: Chen Bin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef TEST_H #define TEST_H #include class DTest : public ::testing::Test { }; template class DTestWithParam : public ::testing::TestWithParam { }; #endif // TEST_H dtkgui-5.5.25/tests/tests.pro000066400000000000000000000034141426550353200161340ustar00rootroot00000000000000TEMPLATE = app QT += dtkcore gui gui-private dbus network testlib widgets CONFIG += thread CONFIG -= app_bundle load(dtk_testcase) LIBS += -lgmock INCLUDEPATH += \ $$PWD/../src/ \ $$PWD/../src/filedrag \ $$PWD/../src/kernel \ $$PWD/../src/util \ $$OUT_PWD/../src \ $$PWD/../src/private QMAKE_CXXFLAGS += -fno-access-control QMAKE_LFLAGS += -fno-access-control CONFIG(debug, debug|release) { LIBS += -lgtest -lgmock QMAKE_CXXFLAGS += -g -Wall -fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize-recover=address -O2 QMAKE_LFLAGS += -g -Wall -fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize-recover=address -O2 QMAKE_CXX += -g -fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize-recover=address -O2 } # 指定moc文件生成目录和src一样 MOC_DIR=$$OUT_PWD/../src DEPENDPATH += $$PWD/../src unix:QMAKE_RPATHDIR += $$OUT_PWD/../src unix:LIBS += -lgtest -lglib-2.0 include($$PWD/../src/filedrag/filedrag.pri) include($$PWD/../src/kernel/kernel.pri) include($$PWD/../src/util/util.pri) linux* { # don't link library QMAKE_CXXFLAGS += $$system(pkg-config --cflags-only-I librsvg-2.0) dbus_monitor.files += $$PWD/../src/dbus/com.deepin.api.XEventMonitor.xml dbus_monitor.header_flags += -i ../src/dbus/arealist.h DBUS_INTERFACES += dbus_monitor } HEADERS += \ test.h SOURCES += \ main.cpp \ src/ut_dguiapplicationhelper.cpp \ src/ut_dregionmonitor.cpp \ src/ut_dforeignwindow.cpp \ src/ut_dpalette.cpp \ src/ut_dplatformhandle.cpp \ src/ut_dplatformtheme.cpp \ src/ut_dwindowmanagerhelper.cpp \ src/ut_dwindowgroupleader.cpp \ src/ut_dfontmanager.cpp \ src/ut_dsvgrenderer.cpp \ src/ut_dtaskbarcontrol.cpp \ src/ut_dthumbnailprovider.cpp RESOURCES += \ res.qrc dtkgui-5.5.25/tools/000077500000000000000000000000001426550353200142445ustar00rootroot00000000000000dtkgui-5.5.25/tools/dde-kwin-debug/000077500000000000000000000000001426550353200170325ustar00rootroot00000000000000dtkgui-5.5.25/tools/dde-kwin-debug/dde-kwin-debug.pro000066400000000000000000000003271426550353200223440ustar00rootroot00000000000000TEMPLATE = app QT += dtkcore CONFIG += X11 SOURCES += \ $$PWD/main.cpp DESTDIR = $$_PRO_FILE_PWD_/../../bin DTK_MODULE_NAME=dtkgui load(dtk_build_config) target.path = $$TOOL_INSTALL_DIR INSTALLS += target dtkgui-5.5.25/tools/dde-kwin-debug/main.cpp000066400000000000000000000315421426550353200204670ustar00rootroot00000000000000/* * Copyright (C) 2021 ~ 2021 Uniontech Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include // 记录日志打印的格式 char *outputFormat = nullptr; // 完成启动参数测试后是否自动推出进程 bool killWindow = false; // 监听所有窗口 bool watchAll = false; bool noCache = false; int repeatTime = 1; // 启动时间的偏移值 int time_offset = 0; const std::string timer_interval_env = "_D_CHECKER_TIMER_INTERVAL"; const std::string ping_time_env = "_D_CHECKER_PING_TIME"; const std::string valid_count_env = "_D_CHECKER_VALID_COUNT"; const std::string damage_count_env = "_D_CHECKER_DAMAGE_COUNT"; std::map checkArgMap { {"--ci", ""}, {"--cpt", ""}, {"--cvc", ""}, {"--cdc", ""} }; std::map checkEnvMap { {"--cil", timer_interval_env}, {"--cpt", ping_time_env}, {"--cvc", valid_count_env}, {"--cdc", damage_count_env} }; uint64_t timeSinceEpochMillisec() { using namespace std::chrono; return duration_cast(system_clock::now().time_since_epoch()).count(); } bool checkCommand(int argc, char *argv[], const char *arg) { for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], arg) == 0) return true; } return false; } int xerrorHandler(Display* /* display */, XErrorEvent* /* error_event */) { return 0; } int exec(const char *process) { // 准备环境变量 char env[100] = {}; auto time = timeSinceEpochMillisec(); sprintf(env, "D_KWIN_DEBUG_APP_START_TIME=%lu", time); putenv(env); char *displayname = getenv("DISPLAY"); Display *dpy = XOpenDisplay(displayname); if (dpy) { XSetErrorHandler(xerrorHandler); } // deepin-trubo 启动的程序无法对外暴露环境变量,因此通过root窗口设置启动时间 XChangeProperty(dpy, XDefaultRootWindow(dpy), XInternAtom(dpy, "D_KWIN_DEBUG_APP_START_TIME", false), XA_CARDINAL, 32, PropModeReplace, reinterpret_cast(&time), 2); XFlush(dpy); for (auto it = checkArgMap.cbegin(); it != checkArgMap.cend(); ++it) { if (!it->second.empty()) { setenv(checkEnvMap[it->first].data(), it->second.data(), 0); } } if (noCache) { std::string clearCache = "sync && sudo bash -c \"echo 3 > /proc/sys/vm/drop_caches\""; system(clearCache.c_str()); } // 启动进程,并等待其退出 int code = system(process); // 清理窗口属性 XDeleteProperty(dpy, XDefaultRootWindow(dpy), XInternAtom(dpy, "D_KWIN_DEBUG_APP_START_TIME", true)); XFlush(dpy); XFree(dpy); return code; } // 检测这个进程是不是自己的子进程 bool checkPid(__pid_t pid) { auto self = getpid(); while (true) { char status[100] = {0}; sprintf(status, "/proc/%d/exe", pid); // 检测是不是deepin-turbo-booster进程 char exe_path[100]; readlink(status, exe_path, 100); // 对于deepin-turbo的进程无法检测是否为子进程,因此默认认为是被dde-kwin-debug启动的 if (strstr(exe_path, "/usr/lib/deepin-turbo") == exe_path) return true; __pid_t ppid = 1; sprintf(status, "/proc/%d/status", pid); auto file = fopen(status, "ro"); if (!file) return false; char data[1024] = {}; fread(data, sizeof(char), 1024, file); // 查找父进程id if (const char *i = strstr(data, "\nPPid:")) { i += 6; // 移除空白 while (i[0] == ' ' || i[0] == '\t') { ++i; } const char *ppid_begin = i; char ppid_string[100] = {}; // 查找ppid的结尾 while (i[0] <= '9' && i[0] >= '0') { ppid_string[i - ppid_begin] = i[0]; ++i; } ppid = atoi(ppid_string); } fclose(file); if (ppid == self) return true; // 继续向上查找 pid = ppid; if (ppid == 1) break; } return false; } __pid_t getWindowPid(Display *dpy, Window window) { Atom actual_type; int actual_format; unsigned long nitems; unsigned long bytes_after; static unsigned char *prop = NULL; int status; status = XGetWindowProperty(dpy, window, XInternAtom(dpy, "_NET_WM_PID", false), 0, 1024, false, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop); if (status == Success && prop) { // 获取pid return *(uint32_t*)(prop); } return 0; } bool event_queue_done = false; Display *dpy = nullptr; void processXEvent() { if (!dpy) { char *displayname = getenv("DISPLAY"); dpy = XOpenDisplay(displayname); if (!dpy) { fprintf(stderr, "%s: unable to open display '%s'\n", "dde-kwin-startup-debug", XDisplayName (displayname)); exit(1); } } int screen = DefaultScreen(dpy); Window root = RootWindow(dpy, screen); XSelectInput(dpy, root, SubstructureNotifyMask); // 事件队列 for (; !event_queue_done; ) { XEvent event; XNextEvent(dpy, &event); switch (event.type) { case PropertyNotify: { XPropertyEvent *pe = (XPropertyEvent*)&event; static Atom atom_D_APP_STARTUP_TIME = XInternAtom(dpy, "_D_APP_STARTUP_TIME", false); if (pe->atom == atom_D_APP_STARTUP_TIME) { auto pid = getWindowPid(dpy, pe->window); // 检测这个窗口是否属于我们启动的应用程序 if (!watchAll) { // 不是监听的窗口则退出 if (!pid || !checkPid(pid)) break; } Atom actual_type; int actual_format; unsigned long nitems; unsigned long bytes_after; static unsigned char *prop = NULL; int status; status = XGetWindowProperty(dpy, pe->window, atom_D_APP_STARTUP_TIME, 0, 1024, false, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop); if (status == Success && prop) { uint32_t time = *(uint32_t*)prop - time_offset; // 打印数据 if (!outputFormat) { std::cout << time << std::endl; } else { int count = strlen(outputFormat); for (int i = 0; i < count; ++i) { if (outputFormat[i] == '%') { switch (outputFormat[i + 1]) { case 'p': std::cout << pid; break; case 't': std::cout << time; break; case 'n': { char command[100] = {}; sprintf(command, "/proc/%u/cmdline", pid); auto file = fopen(command, "ro"); if (file) { char data[1024] = {}; if (fread(data, sizeof(char), 1024, file)) std::cout << data; } break; } default: break; } ++i; } else { std::cout << outputFormat[i]; } } std::cout << std::endl; } if (killWindow) { // 退出对应的程序 char command[100]; sprintf(command, "xkill -id %lu > /dev/null", pe->window); system(command); } } } break; } case CreateNotify: { XCreateWindowEvent *e = (XCreateWindowEvent*)&event; Window new_window = e->window; // 监听这个窗口的属性变化事件 XSelectInput(dpy, new_window, PropertyChangeMask); } default: break; } } XCloseDisplay(dpy); } void signal_handle(int sig) { (void)sig; exit(0); } int main(int argc, char *argv[]) { if (argc ==1 || checkCommand(argc, argv, "--help")) { auto help_message = R"help( Eg: dde-kwin-debug -k --format "%p %t %n" qtcreator --help Show the help message. -k Auto kill the application on test finished. -L Disable outputs of applications. (redirect standard outputs to /dev/null) -a Watch all windows. --format Log formats: %p: application pid %t: startup time(unit: ms) %n: application name -no--cache Disable cache --r Repeat time --ci Set check interval, default 100 ms --cpt Set window ping reply time, default 50 ms --cvc Set check valid count, default 10 --cdc Set check damage count, default 20 Arguments: The applications. Eg: dde-kwin-debug -k --format "%t %n" "app1" "app2" "app3" )help"; std::cout << help_message << std::endl; return 0; } // 初始化环境 killWindow = checkCommand(argc, argv, "-k"); watchAll = checkCommand(argc, argv, "-a"); noCache = checkCommand(argc, argv, "-no-cache"); for (int i = 1; i < argc; ++i) { const std::string currentArg = argv[i]; if (currentArg == "--r") { repeatTime = atoi(argv[++i]); continue; } if (currentArg == "--format") { outputFormat = argv[++i]; continue; } if (checkArgMap.count(currentArg) > 0) { checkArgMap[currentArg] = argv[++i]; continue; } } signal(SIGINT, signal_handle); signal(SIGABRT, signal_handle); signal(SIGTERM, signal_handle); signal(SIGHUP, signal_handle); signal(SIGQUIT, signal_handle); signal(SIGKILL, signal_handle); signal(SIGBUS, signal_handle); signal(SIGSYS, signal_handle); signal(SIGPIPE, signal_handle); signal(SIGKILL, signal_handle); // 获取全局启动时间的环境变量 auto time_env = getenv("D_KWIN_DEBUG_APP_START_TIME"); int64_t kwin_start_time = 0; if (time_env && strlen(time_env)) sscanf(time_env, "%ld", &kwin_start_time); if (kwin_start_time) { struct timeval time; gettimeofday(&time, nullptr); time_offset = time.tv_sec * 1000 + (1.0 * time.tv_usec) / 1000 - kwin_start_time; } // 监听X11事件 std::thread x11_thread(processXEvent); x11_thread.detach(); bool disable_outpus = checkCommand(argc, argv, "-L"); for (int i = 1; i < argc; ++i) { const char *arg = argv[i]; if (arg[0] == '-') { if (arg[1] == '-') ++i; // 跳过参数携带的值 continue; } for (int i = 0; i < repeatTime; ++i) { // 不以'-'开头的参数认为三要启动的应用程序名称 if (disable_outpus) { char command[1024] = {}; sprintf(command, "%s 2>/dev/null 1> /dev/null", arg); exec(command); } else { exec(arg); } } } if (watchAll) { sleep(INT32_MAX); } event_queue_done = false; return 0; } dtkgui-5.5.25/tools/deepin-gui-settings/000077500000000000000000000000001426550353200201305ustar00rootroot00000000000000dtkgui-5.5.25/tools/deepin-gui-settings/deepin-gui-settings.pro000066400000000000000000000011241426550353200245340ustar00rootroot00000000000000TEMPLATE = app QT += dtkcore SOURCES += \ $$PWD/main.cpp DESTDIR = $$_PRO_FILE_PWD_/../../bin win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../src/release -ldtkgui else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../src/debug -ldtkgui else:unix: LIBS += -L$$OUT_PWD/../../src -ldtkgui INCLUDEPATH += \ $$PWD/../../src \ $$PWD/../../private \ $$PWD/../../src/kernel CONFIG(debug, debug|release) { unix:QMAKE_RPATHDIR += $$OUT_PWD/../../src } DTK_MODULE_NAME=dtkgui load(dtk_build_config) target.path = $$TOOL_INSTALL_DIR INSTALLS += target dtkgui-5.5.25/tools/deepin-gui-settings/main.cpp000066400000000000000000000151671426550353200215720ustar00rootroot00000000000000/* * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd. * * Author: zccrs * * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include DGUI_USE_NAMESPACE int main(int argc, char *argv[]) { // 禁用输入法,防止输入法插件乱输出内容 qunsetenv("QT_IM_MODULE"); qputenv("QT_QPA_PLATFORM", "dxcb"); QGuiApplication app(argc, argv); qunsetenv("QT_QPA_PLATFORM"); QCommandLineParser parser; QCommandLineOption option_window({"w", "window"}, "resource id of window to examine"); QCommandLineOption option_window_leader("window-leader", "use leader window of the window"); QCommandLineOption option_select_window("select", "auto select a window on screen"); QCommandLineOption option_domain({"p", "domain"}, "domain of settings property"); QCommandLineOption option_set("set", "set a settings item to a given value. Can only and must specify a value(eg: [-s|-i|-c])"); QCommandLineOption option_string({"s", "string"}, "set a string value of a settings item"); QCommandLineOption option_int({"i", "int"}, "set a int value of a settings item"); QCommandLineOption option_color({"c", "color"}, "set a color value of a settings item"); QCommandLineOption option_remove({"r", "remove"}, "remove a settings item"); option_window.setValueName("id"); option_window.setDefaultValue("0"); option_domain.setValueName("domain"); option_domain.setDefaultValue(QString()); option_set.setValueName("key"); option_string.setValueName("value"); option_int.setValueName("value"); option_color.setValueName("value"); option_remove.setValueName("key"); parser.addOption(option_window); parser.addOption(option_window_leader); parser.addOption(option_select_window); parser.addOption(option_domain); parser.addOption(option_set); parser.addOption(option_string); parser.addOption(option_int); parser.addOption(option_color); parser.addOption(option_remove); parser.addPositionalArgument("keys", "key of get settings value", "[keys...]"); parser.addHelpOption(); parser.addVersionOption(); parser.process(app); quint32 window_id = 0; if (parser.isSet(option_select_window)) { QProcess xdotool; xdotool.start("xdotool", {"selectwindow"}, QIODevice::ReadOnly); if (!xdotool.waitForFinished()) { parser.showHelp(1); } bool ok = false; window_id = xdotool.readAllStandardOutput().trimmed().toInt(&ok); if (!ok) { parser.showHelp(1); } } else { const QString &window_id_value = parser.value(option_window); bool ok = false; if (window_id_value.startsWith("0x")) { window_id = window_id_value.toInt(&ok, 16); } else { window_id = window_id_value.toInt(&ok); } if (!ok) { parser.showHelp(-1); } } if (parser.isSet(option_window_leader)) { QProcess xprop; xprop.start("xprop", {"-id", QString::number(window_id), "WM_CLIENT_LEADER"}, QIODevice::ReadOnly); if (!xprop.waitForFinished()) { qFatal("%s\n", xprop.errorString().toLocal8Bit().constData()); return -1; } const QByteArrayList &list = xprop.readAllStandardOutput().split(' '); bool ok = false; if (!list.isEmpty()) { quint32 id = list.last().trimmed().toInt(&ok, 16); if (ok) { window_id = id; } } if (!ok) { qFatal("%s\n", "not found WM_CLIENT_LEADER"); return -1; } } DNativeSettings settings(window_id, parser.value(option_domain).toLatin1()); if (!settings.isValid()) { qWarning() << "Settings is invalid, platform plugin is:" << qApp->platformName(); return -1; } if (parser.isSet(option_set)) { QVariant value; if (parser.isSet(option_string)) { // string if (parser.isSet(option_int) || parser.isSet(option_color)) { parser.showHelp(-1); } value = parser.value(option_string).toLocal8Bit(); } else if (parser.isSet(option_int)) { // int if (parser.isSet(option_string) || parser.isSet(option_color)) { parser.showHelp(-1); } bool ok = false; int integer = parser.value(option_int).toInt(&ok); if (!ok) { parser.showHelp(-1); } value = QVariant(integer); } else if (parser.isSet(option_color)) { // color if (parser.isSet(option_string) || parser.isSet(option_int)) { parser.showHelp(-1); } QColor color(parser.value(option_color)); if (!color.isValid()) { parser.showHelp(-1); } value = QVariant(color); } else { parser.showHelp(-1); } // 设置一个属性的值 const QByteArray &name = parser.value(option_set).toLatin1(); if (name.isEmpty()) { parser.showHelp(-1); } settings.setSetting(name, value); qDebug() << name << settings.getSetting(name); } else if (parser.isSet(option_remove)) { const QByteArray &name = parser.value(option_remove).toLatin1(); if (name.isEmpty()) { parser.showHelp(-1); } settings.setSetting(name, QVariant()); qDebug() << name << settings.getSetting(name); } else { const QStringList &keys = parser.positionalArguments(); if (keys.isEmpty()) { // 打印所有设置项 qDebug() << settings; } else { for (const QString &key : keys) { qDebug() << key << settings.getSetting(key.toLatin1()); } } } return 0; } dtkgui-5.5.25/tools/tools.pro000066400000000000000000000001161426550353200161240ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += deepin-gui-settings \ dde-kwin-debug