pax_global_header 0000666 0000000 0000000 00000000064 14154026022 0014506 g ustar 00root root 0000000 0000000 52 comment=cb7c91dfd57eae61331871ed49d0296e2fee193a
dtkcore-5.5.23/ 0000775 0000000 0000000 00000000000 14154026022 0013235 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/.clog.toml 0000664 0000000 0000000 00000000160 14154026022 0015131 0 ustar 00root root 0000000 0000000 [clog]
repository = "https://github.com/linuxdeepin/dtkcore"
from-latest-tag = true
changelog = "CHANGELOG.md"
dtkcore-5.5.23/.gitignore 0000664 0000000 0000000 00000000466 14154026022 0015233 0 ustar 00root root 0000000 0000000 # Compiled Object files
*.slo
*.lo
*.o
# Compiled Dynamic libraries
*.so
*.dylib
# Compiled Static libraries
*.lai
*.la
*.a
build*/
*.pro.user*
*.DS_Store
# executeable files
*.qm
src/DtkCores
src/dtkcore_config.h
cmake/DtkCore/DtkCoreConfig.cmake
src/qt_lib_d*.pri
bin/
.qmake*
Makefile
cmake/DtkCore*
dtkcore-5.5.23/.gitlab-ci.yml 0000664 0000000 0000000 00000000227 14154026022 0015672 0 ustar 00root root 0000000 0000000 include:
- remote: 'https://gitlab.deepin.io/dev-tools/letmeci/raw/master/gitlab-ci/dde.yml'
variables:
CPPCHECK: "true"
CODESPELL: "true"
dtkcore-5.5.23/.packit.yaml 0000664 0000000 0000000 00000000724 14154026022 0015455 0 ustar 00root root 0000000 0000000 # See the documentation for more information:
# https://packit.dev/docs/configuration/
specfile_path: rpm/dtkcore.spec
# add or remove files that should be synced
synced_files:
- rpm/dtkcore.spec
- .packit.yaml
upstream_package_name: dtkcore
# downstream (Fedora) RPM package name
downstream_package_name: dtkcore
actions:
fix-spec-file: |
bash -c "sed -i -r \"0,/Version:/ s/Version:(\s*)\S*/Version:\1${PACKIT_PROJECT_VERSION}/\" rpm/dtkcore.spec"
dtkcore-5.5.23/.project.json 0000664 0000000 0000000 00000000242 14154026022 0015652 0 ustar 00root root 0000000 0000000 {
"Type": "homebrew",
"3rdparty": ["tools/qdbusxml2cpp"],
"ignore": ["src/translations","src/widgets/assets","doc",".tx"],
"license": ["GPLv3"]
}
dtkcore-5.5.23/.qmake.conf 0000664 0000000 0000000 00000000015 14154026022 0015254 0 ustar 00root root 0000000 0000000 DTK_VERSION=
dtkcore-5.5.23/.release.json 0000664 0000000 0000000 00000001045 14154026022 0015626 0 ustar 00root root 0000000 0000000 {
"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"
}
}
dtkcore-5.5.23/CHANGELOG.md 0000664 0000000 0000000 00000022120 14154026022 0015043 0 ustar 00root root 0000000 0000000
## 2.0.14 (2019-05-23)
#### Bug Fixes
* **DSettings:** crash when calling getOption() if option doesn't exist ([90ac734b](https://github.com/linuxdeepin/dtkcore/commit/90ac734b872203ea698808a7197aa7a9c7e2b5bd))
## 2.0.12 (2019-04-18)
## 2.0.11 (2019-04-17)
#### Bug Fixes
* Cross-builds incorrectly, built packages contain paths from build architecture ([8d32577a](https://github.com/linuxdeepin/dtkcore/commit/8d32577a89e54b5c9c834caae83d98e50f59df77))
* https://github.com/linuxdeepin/dtkcore/issues/10 ([3f99873a](https://github.com/linuxdeepin/dtkcore/commit/3f99873a786f6830688ecd0d8d2e2bf8dfb63ce0))
## 2.0.10 (2019-03-27)
#### Bug Fixes
* crash at application ([d852a218](https://github.com/linuxdeepin/dtkcore/commit/d852a21811f9f86e04274fc9f732d7c7a210ef3f))
#### Features
* add DNotifySender ([89bbcd7c](https://github.com/linuxdeepin/dtkcore/commit/89bbcd7c3821985bb2bca51247394fd4a65b25bf))
## 2.0.9.17 (2019-02-26)
## 2.0.9.16 (2019-02-26)
#### Bug Fixes
* deepin-os-release support cpu model and other info query ([cbeb47c9](https://github.com/linuxdeepin/dtkcore/commit/cbeb47c97e31d2b5dd3c198c60ee74332fecb293))
## 2.0.9.15 (2019-01-25)
#### Bug Fixes
* failed build the deepin-os-release on Qt 5.7.1 ([8bae8654](https://github.com/linuxdeepin/dtkcore/commit/8bae8654bdb20a7f773130d22b9db139460ba575))
* use main project c/cxx/ld flags on build deepin-os-release ([86dbd507](https://github.com/linuxdeepin/dtkcore/commit/86dbd507c1b3b101c1816f091782430ec1ce20ce))
## 2.0.9.14 (2019-01-02)
## 2.0.9.13 (2018-12-28)
## 2.0.9.12 (2018-12-24)
#### Bug Fixes
* **DPathBuf:** missing default constructor ([74374cb4](https://github.com/linuxdeepin/dtkcore/commit/74374cb4cf0245ab1fe73f62fe0d13566f945db3))
#### Features
* support connan build ([ba2d213f](https://github.com/linuxdeepin/dtkcore/commit/ba2d213fd6c7e36e118288305e5892c339250623))
## 2.0.9.11 (2018-12-14)
## 2.0.9.10 (2018-12-05)
#### Bug Fixes
* include unistd.h instead of sys/unistd.h ([39c50a13](https://github.com/linuxdeepin/dtkcore/commit/39c50a1398c34123e3806a3060a4c64e7f45ed68))
* url encoding ([4a6b7b61](https://github.com/linuxdeepin/dtkcore/commit/4a6b7b61bb3ad9ab417eda69249b5e9aced0aa97))
## 2.0.9.9 (2018-11-19)
#### Features
* add DRecentManager class. ([a2defafd](https://github.com/linuxdeepin/dtkcore/commit/a2defafdcf57078461221c665e322287a43d24a8))
#### Bug Fixes
* compatibility with Qt 5.6 ([0ec7f3ce](https://github.com/linuxdeepin/dtkcore/commit/0ec7f3ce389b323ecb2b103801c1cd1d55f100fa))
* **drecentmanager:**
* xbel file does not exist. ([c57ffe71](https://github.com/linuxdeepin/dtkcore/commit/c57ffe714f26b1a8a8859e2ffbeeed3d75ee11a1))
* uniform url format. ([413a8988](https://github.com/linuxdeepin/dtkcore/commit/413a8988116708ab8bcf9efbb9bc8f52e048efa5))
* url encoded. ([e234a8cc](https://github.com/linuxdeepin/dtkcore/commit/e234a8cc5ad9d2c14a16950838115c4f2f27c605))
* **recent:** chinese doc ([fb256461](https://github.com/linuxdeepin/dtkcore/commit/fb256461d1bdb0862b1a3a129978fc3932a6bcab))
## 2.0.9.8 (2018-11-09)
#### Bug Fixes
* can't get correct disk size in some case ([20a12b62](https://github.com/linuxdeepin/dtkcore/commit/20a12b622ea7b01f0616c15a8af85e31fc2d36cb))
## 2.0.9.5 (2018-10-26)
#### Features
* update version number for expermimental ([02b5d5c1](https://github.com/linuxdeepin/dtkcore/commit/02b5d5c1e01a05f57651b774b02cae31ef9a549f))
## 2.0.9 (2018-07-20)
#### Bug Fixes
* remove qt symbols ([57ec78ba](https://github.com/linuxdeepin/dtkcore/commit/57ec78ba685a53692b0260d3d558d8b0915fc3e4))
* non array type value is wrong on parse josn file ([9f138664](https://github.com/linuxdeepin/dtkcore/commit/9f13866439d8d650893434594da023e7d331d866))
### 2.0.8.1 (2018-05-14)
#### Bug Fixes
* update symbols ([f6c53cc4](https://github.com/linuxdeepin/dtkcore/commit/f6c53cc493c1bcf55dca54dbf500e2e484af73c9))
* add LIBDTKCORESHARED_EXPORT for windows ([6fb1096f](https://github.com/linuxdeepin/dtkcore/commit/6fb1096f6d0784937cf84f0e4ae1f5f7587085e5))
* **changelog:** update email format ([cb09a0ca](https://github.com/linuxdeepin/dtkcore/commit/cb09a0cadcf2fa0ba271b1d98d3b96a993eb892b))
## 2.0.8 (2018-05-02)
#### Features
* add symbols ([048de455](https://github.com/linuxdeepin/dtkcore/commit/048de4551bdd770aca5e9c12798362f913061654))
## 2.0.7 (2018-03-01)
#### Bug Fixes
* cmake link depends ([cdfcff9e](https://github.com/linuxdeepin/dtkcore/commit/cdfcff9e2f3e92bc6dbb45644d2714d6c4dbdda0))
* better static lib support ([99886406](https://github.com/linuxdeepin/dtkcore/commit/99886406a0cae849fad23286fdf64bb399e37da0))
* read settings value failed ([cf1c7698](https://github.com/linuxdeepin/dtkcore/commit/cf1c769893773794dff5a67c235c5d1f3234541a))
* set default should not use ([146529f6](https://github.com/linuxdeepin/dtkcore/commit/146529f6887e798606f2bf763ab8a760969bff26))
* fix dtk-settings install path ([1893cff3](https://github.com/linuxdeepin/dtkcore/commit/1893cff301dacb546a246a4f824dab68eac51351))
* develop package no install the "version.pri" file ([5667b562](https://github.com/linuxdeepin/dtkcore/commit/5667b562630565fca5abed690f3d3478dd3c7603))
* awk script failed ([524a3fa6](https://github.com/linuxdeepin/dtkcore/commit/524a3fa6021ee54db416503520aea65ef0e2c3a0))
* set default build version for debian changelog ([ec6e2a83](https://github.com/linuxdeepin/dtkcore/commit/ec6e2a8376c7aca7162b4fbb782b998c9a6ab630))
* set its value only if VERSION is empty ([1836000c](https://github.com/linuxdeepin/dtkcore/commit/1836000c49eb149a6495322c4cbb1474d5d48204))
#### Features
* add hide support for group ([e7e4fb66](https://github.com/linuxdeepin/dtkcore/commit/e7e4fb669276fbce61c6378e74ae82573e7c0313))
* add get option interface ([d8682485](https://github.com/linuxdeepin/dtkcore/commit/d8682485a6737da83fb28f22335f1da1afb8956c))
* add group interface for DSettingsGroup ([c876180f](https://github.com/linuxdeepin/dtkcore/commit/c876180f535e3027dce63628f31379ef874367ed))
* support generate cmake with qt function ([524b0559](https://github.com/linuxdeepin/dtkcore/commit/524b055929b7be84375a45f9d10cbc3a0ecac6de))
* config pkg config with dtk_module ([137b9138](https://github.com/linuxdeepin/dtkcore/commit/137b91388d9b9db24c8136dd4e2c6e690a5712c5))
* support qt module ([17ca0de9](https://github.com/linuxdeepin/dtkcore/commit/17ca0de9156a320cea32208dcff2f8cdf7d6a237))
* add the "version.pri" file ([07aab9fd](https://github.com/linuxdeepin/dtkcore/commit/07aab9fd6478c83c7bae1062f64b4bd20b21869c))
* remove build version from install path ([3bf0bfb5](https://github.com/linuxdeepin/dtkcore/commit/3bf0bfb5f49c3e83d4c36cc33f219150bf3731d8))
* make version parser easier ([6d3b4ead](https://github.com/linuxdeepin/dtkcore/commit/6d3b4ead7080158d1d8977bf7cf99ae842e574ec))
* set verion when build ([9083dbd3](https://github.com/linuxdeepin/dtkcore/commit/9083dbd3e29bf9d06b1032901ba13848fa964f4c))
* add .qmake.conf file ([2890f643](https://github.com/linuxdeepin/dtkcore/commit/2890f643a57c3532ab623410f7c6c6dbfdd6788d))
* add DtkCore and dtkcore_config.h headers ([308a0cc4](https://github.com/linuxdeepin/dtkcore/commit/308a0cc41101499c04308b4ef3bb2fff4ab8d783))
* **DSettings:** support set default value ([5fe9bfd0](https://github.com/linuxdeepin/dtkcore/commit/5fe9bfd0a5e20cef7393639712302825b803db29))
## 2.0.6 (2018-01-15)
## 2.0.5.3 (2017-12-27)
#### Bug Fixes
* Adapt lintian ([27df15df](https://github.com/linuxdeepin/dtkcore/commit/27df15df32788002491a24f06f098a5f849a4988))
* break forever loop for syncing backend data ([f70e500e](https://github.com/linuxdeepin/dtkcore/commit/f70e500ec2fd5c751e40833bdc4df586614bcff2))
#### Features
* **util:** add dpinyin ([128d7d67](https://github.com/linuxdeepin/dtkcore/commit/128d7d678e921bc580dd732b14a454973397899c))
## 2.0.5.2 (2017-11-28)
#### Bug Fixes
* make macosx build success ([af04bbe1](https://github.com/linuxdeepin/dtkcore/commit/af04bbe193a4b4251908f830d927ebdc8f4459e7))
* windows build failed ([66c4c812](https://github.com/linuxdeepin/dtkcore/commit/66c4c812eb29634710642f4e9d6b3d69cc692cb2))
#### Features
* add macro D_DECL_DEPRECATED ([89e49868](https://github.com/linuxdeepin/dtkcore/commit/89e49868f113ef01c03bcf5b6846eec95c428382))
## 2.0.5 (2017-11-06)
#### Bug Fixes
* build failed on used dbasefilewatcher.h project ([34fbe4b3](34fbe4b3))
* add miss libgsettings-qt-dev ([f61c1b54](f61c1b54))
* not select python version ([7e7e8832](7e7e8832))
#### Features
* support gsettingsbackend, remove dsettings-key ([26a29800](26a29800))
* create gsettingsbackend ([b94b97b1](b94b97b1))
dtkcore-5.5.23/LICENSE 0000664 0000000 0000000 00000016744 14154026022 0014256 0 ustar 00root root 0000000 0000000 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.
dtkcore-5.5.23/README.md 0000664 0000000 0000000 00000002167 14154026022 0014522 0 ustar 00root root 0000000 0000000 ## Deepin Tool Kit Core {#mainpage}
Deepint Tool Kit (Dtk) is the base development tool of all C++/Qt Developer work on Deepin.
You should read the [Deepin Application Specification](\ref doc/Specification) firstly.
## Dependencies
### Build dependencies
* Qt >= 5.6
## Installation
### Build from source code
1. Make sure you have installed all dependencies.
2. Build:
````
$ mkdir build
$ cd build
$ qmake ..
$ make
````
3. Install:
````
$ sudo make install
````
## Getting help
Any usage issues can ask for help via
* [Gitter](https://gitter.im/orgs/linuxdeepin/rooms)
* [IRC channel](https://webchat.freenode.net/?channels=deepin)
* [Forum](https://bbs.deepin.org)
* [WiKi](https://wiki.deepin.org/)
## Getting involved
We encourage you to report issues and contribute changes
* [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). (English)
* [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) (中文)
## License
deepin-tool-kit is licensed under [GPLv3](LICENSE).
dtkcore-5.5.23/cmake/ 0000775 0000000 0000000 00000000000 14154026022 0014315 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/cmake/DtkCMake/ 0000775 0000000 0000000 00000000000 14154026022 0015740 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/cmake/DtkCMake/DtkCMakeConfig.cmake 0000664 0000000 0000000 00000005046 14154026022 0021520 0 ustar 00root root 0000000 0000000 function(addDefinitions macro)
string(TOUPPER ${macro} macro)
add_definitions(-D${macro})
endfunction()
add_definitions(-DQ_HOST_NAME=\"${CMAKE_HOST_SYSTEM_PROCESSOR}\")
addDefinitions(Q_HOST_${CMAKE_HOST_SYSTEM_PROCESSOR})
find_package(DtkCore REQUIRED)
set(DEEPIN_OS_RELEASE_TOOL_PATH ${DTKCORE_TOOL_DIR})
set(DEEPIN_OS_RELEASE_TOOL ${DEEPIN_OS_RELEASE_TOOL_PATH}/deepin-os-release)
if(NOT EXISTS "${DEEPIN_OS_RELEASE_TOOL}")
message(FATAL_ERROR "\"${DEEPIN_OS_RELEASE_TOOL}\" is not exists. Install \"dtkcore-bin\" first")
endif()
function(formatString string)
string(REGEX REPLACE "\\s+" "_" string ${string})
endfunction()
macro(execDeepinOsRelease args output)
exec_program(${DEEPIN_OS_RELEASE_TOOL} ARGS ${args} OUTPUT_VARIABLE ${output} RETURN_VALUE exitCode)
if(NOT ${exitCode} EQUAL 0)
message(FATAL_ERROR "exec deepin-os-release failed, with args: ${args}, error message: ${output}")
endif()
endmacro()
execDeepinOsRelease(--deepin-type DEEPIN_OS_TYPE)
execDeepinOsRelease(--deepin-version DEEPIN_OS_VERSION)
execDeepinOsRelease(--product-type CMAKE_PLATFORM_ID)
execDeepinOsRelease(--product-version CMAKE_PLATFORM_VERSION)
if("${CMAKE_PLATFORM_ID}" STREQUAL "")
message(WARNING "No value of the \"--product-type\" in the process \"${DEEPIN_OS_RELEASE_TOOL}\"")
else()
formatString(CMAKE_PLATFORM_ID)
message("OS: ${CMAKE_PLATFORM_ID}, Version: ${CMAKE_PLATFORM_VERSION}")
if(NOT "${CMAKE_PLATFORM_ID}" STREQUAL "")
addDefinitions(Q_OS_${CMAKE_PLATFORM_ID})
string(TOUPPER ${CMAKE_PLATFORM_ID} CMAKE_PLATFORM_ID)
set(OS_${CMAKE_PLATFORM_ID} TRUE)
endif()
formatString(CMAKE_PLATFORM_VERSION)
add_definitions(-DQ_OS_VERSION=\"${CMAKE_PLATFORM_VERSION}\")
#uos base with deepin
if("${CMAKE_PLATFORM_ID}" STREQUAL "UOS")
addDefinitions(Q_OS_DEEPIN)
set(OS_DEEPIN TRUE)
endif()
endif()
if("${DEEPIN_OS_TYPE}" STREQUAL "")
message(WARNING "No value of the \"--deepin-type\" in the process \"${DEEPIN_OS_RELEASE_TOOL}\"")
else()
formatString(DEEPIN_OS_TYPE)
message("Deepin OS Type: ${DEEPIN_OS_TYPE}")
message("Deepin OS Version: ${DEEPIN_OS_VERSION}")
if(NOT "${DEEPIN_OS_TYPE}" STREQUAL "")
addDefinitions(Q_OS_DEEPIN_${DEEPIN_OS_TYPE})
addDefinitions(DEEPIN_DDE)
string(TOUPPER ${DEEPIN_OS_TYPE} DEEPIN_OS_TYPE)
set(OS_DEEPIN_${DEEPIN_OS_TYPE} TRUE)
set(DEEPIN_DDE TRUE)
endif()
formatString(DEEPIN_OS_VERSION)
add_definitions(-DQ_OS_DEEPIN_VERSION=\"${DEEPIN_OS_VERSION}\")
endif()
dtkcore-5.5.23/cmake/DtkTools/ 0000775 0000000 0000000 00000000000 14154026022 0016060 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/cmake/DtkTools/DtkSettingsToolsMacros.cmake 0000664 0000000 0000000 00000005362 14154026022 0023521 0 ustar 00root root 0000000 0000000 #=============================================================================
# Copyright 2019 Deepin Technology Co., Ltd.
# Copyright 2019 Gary Wang
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of authors nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
function(DTK_CREATE_I18N_FROM_JSON _generated_file_list _input_json_file _output_cpp_file_name)
set (generated_file_list) # 0(failed) or 1(successed) files in the list.
get_filename_component(_input_json_abs_path ${_input_json_file} ABSOLUTE)
get_filename_component(_input_json_abs_dir ${_input_json_abs_path} DIRECTORY)
set (_output_cpp_abs_path ${_input_json_abs_dir}/${_output_cpp_file_name})
if (DTK_SETTINGS_TOOLS_FOUND)
add_custom_command(OUTPUT ${_output_cpp_abs_path}
COMMAND ${DTK_SETTINGS_TOOLS_EXECUTABLE}
ARGS ${_input_json_abs_path} -o ${_output_cpp_abs_path}
DEPENDS ${_input_json_abs_path} VERBATIM)
list(APPEND generated_file_list ${_output_cpp_abs_path})
else ()
message (WARNING "The dtk-settings tools could not be found at ${DTK_SETTINGS_TOOLS_EXECUTABLE}")
message (WARNING "Package distributor may create a seprated package for tools like `libdtkcore-bin`.")
endif ()
set(${_generated_file_list} ${generated_file_list} PARENT_SCOPE)
endfunction()
dtkcore-5.5.23/cmake/DtkTools/DtkToolsConfig.cmake 0000664 0000000 0000000 00000000405 14154026022 0021752 0 ustar 00root root 0000000 0000000 find_package(DtkCore REQUIRED)
set (DTK_SETTINGS_TOOLS_EXECUTABLE ${DTKCORE_TOOL_DIR}/dtk-settings)
if (EXISTS ${DTK_SETTINGS_TOOLS_EXECUTABLE})
set(DTK_SETTINGS_TOOLS_FOUND TRUE)
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/DtkSettingsToolsMacros.cmake") dtkcore-5.5.23/conanfile.py 0000664 0000000 0000000 00000006430 14154026022 0015550 0 ustar 00root root 0000000 0000000 from conans import ConanFile, tools
class DtkcoreConan(ConanFile):
name = 'dtkcore'
version = '2.0.9'
license = 'GPL'
author = 'Iceyer me@iceyer.net'
url = 'https://github.com/linuxdeepin/dtkcore'
description = 'cross platform ui library'
topics = ('qt', 'dtk')
settings = 'os', 'compiler', 'build_type', 'arch'
options = {'shared': [True, False]}
default_options = 'shared=False'
generators = 'qmake'
exports_sources = '*'
requires = 'jom_installer/1.1.2@bincrafters/stable', 'qt/5.6.3@iceyer/stable'
def extend_include_path(self):
return '%s/include/libdtk-%s/DCore' % (self.package_folder, self.version)
# def source(self):
# self.run('git clone https://github.com/linuxdeepin/dtkcore.git source')
# self.run('cd source && git checkout 2.0.9.9')
def build(self):
outdir = self.build_folder
# includedir = outdir + '/include'
mkspecsdir = outdir + '/mkspecs'
# libdir = outdir + '/lib'
env_vars = tools.vcvars_dict(self.settings)
env_vars['_CL_'] = '/utf-8'
with tools.environment_append(env_vars):
command = 'qmake -r'
command += ' VERSION=%s' % self.version
# command += ' CONFIG-=debug_and_release'
# command += ' CONFIG-=debug_and_release_target'
command += ' CONFIG+=release'
command += ' PREFIX=%s' % outdir
command += ' MKSPECS_INSTALL_DIR=%s' % mkspecsdir
command += ' DTK_STATIC_LIB=YES'
command += ' DTK_STATIC_TRANSLATION=YES'
command += ' DTK_NO_MULTIMEDIA=YES'
command += ' %s' % self.source_folder
self.run(command)
self.run('jom clean')
self.run('jom')
self.run('jom install')
def package(self):
self.deploy()
outdir = self.build_folder
self.copy('*', dst='include', src=outdir+'/include')
self.copy('*.lib', dst='lib', src=outdir+'/lib')
self.copy('*', dst='mkspecs', src=outdir+'/mkspecs')
def package_info(self):
self.cpp_info.libs = ['dtkcore']
self.cpp_info.includedirs.append(self.extend_include_path())
self.env_info.QMAKEPATH = self.cpp_info.rootpath
self.env_info.QMAKEFEATURES = self.cpp_info.rootpath + '/mkspecs/features'
def deploy(self):
try:
content = []
module_pri = self.build_folder + '/mkspecs/modules/qt_lib_dtkcore.pri'
s = open(module_pri)
for line in s.readlines():
if line.startswith('QT.dtkcore.tools'):
line = 'QT.dtkcore.tools = %s\n' % (
self.package_folder + '/bin')
elif line.startswith('QT.dtkcore.libs'):
line = 'QT.dtkcore.libs = %s\n' % (
self.package_folder + '/lib')
elif line.startswith('QT.dtkcore.includes'):
line = 'QT.dtkcore.includes = %s\n' % (
self.extend_include_path())
content.append(line)
s.close()
# print('create module file', content)
s = open(module_pri, 'w')
s.writelines(content)
except FileNotFoundError:
print('skip update qt module file')
dtkcore-5.5.23/debian/ 0000775 0000000 0000000 00000000000 14154026022 0014457 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/debian/changelog 0000664 0000000 0000000 00000001102 14154026022 0016323 0 ustar 00root root 0000000 0000000 dtkcore (5.0.3) unstable; urgency=medium
* Release 5.0.3
-- Deepin Packages Builder Tue, 21 Sep 2019 13:31:03 +0800
dtkcore (5.0.0) unstable; urgency=medium
* Release 5.0.0
-- Deepin Packages Builder Tue, 03 Sep 2019 08:47:03 +0800
dtkcore (2.0.8) unstable; urgency=medium
* Release 2.0.8
-- Deepin Packages Builder Wed, 02 May 2018 10:52:03 +0800
dtkcore (0.3.3-1) unstable; urgency=medium
* Initial release
-- Deepin Packages Builder Mon, 10 Oct 2016 16:58:07 +0800
dtkcore-5.5.23/debian/compat 0000664 0000000 0000000 00000000002 14154026022 0015655 0 ustar 00root root 0000000 0000000 9
dtkcore-5.5.23/debian/control 0000664 0000000 0000000 00000002173 14154026022 0016065 0 ustar 00root root 0000000 0000000 Source: dtkcore
Section: libdevel
Priority: optional
Maintainer: Deepin Packages Builder
Build-Depends: debhelper (>= 9), pkg-config,
qttools5-dev-tools, qtbase5-private-dev,
libgsettings-qt-dev, libgtest-dev, libdtkcommon-dev
Standards-Version: 3.9.8
Package: libdtkcore5
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, lshw, libdtkcommon
Multi-Arch: same
Description: Deepin Tool Kit Core library
DtkCore is base library of Deepin Qt/C++ applications.
.
This package contains the shared libraries.
Package: libdtkcore5-bin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
libdtkcore5( =${binary:Version})
Description: Deepin Tool Kit Core Utilities
DtkCore is base devel library of Deepin Qt/C++ applications.
.
This package contains the utilities of DtkCore
Package: libdtkcore-dev
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkcore5( =${binary:Version}), libdtkcommon-dev
Description: Deepin Tool Kit Core Devel library
DtkCore is base devel library of Deepin Qt/C++ applications.
.
This package contains the header files and static libraries of DtkCore
dtkcore-5.5.23/debian/copyright 0000664 0000000 0000000 00000001760 14154026022 0016416 0 ustar 00root root 0000000 0000000 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: dtkcore
Source: https://github.com/linuxdeepin/dtkcore
Files: *
Copyright: 2017 Deepin Technology Co., Ltd.
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".
dtkcore-5.5.23/debian/libdtkcore-dev.install 0000664 0000000 0000000 00000000141 14154026022 0020741 0 ustar 00root root 0000000 0000000 usr/lib/*/lib*.so
usr/include
usr/lib/*/pkgconfig/*.pc
usr/lib/*/cmake/*/*.cmake
usr/lib/*/qt5/*
dtkcore-5.5.23/debian/libdtkcore5-bin.install 0000664 0000000 0000000 00000000041 14154026022 0021017 0 ustar 00root root 0000000 0000000 usr/lib/*/*/DCore/bin/*
usr/bin/* dtkcore-5.5.23/debian/libdtkcore5.install 0000664 0000000 0000000 00000000024 14154026022 0020252 0 ustar 00root root 0000000 0000000 usr/lib/*/lib*.so.*
dtkcore-5.5.23/debian/rules 0000775 0000000 0000000 00000001412 14154026022 0015535 0 ustar 00root root 0000000 0000000 #!/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)
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
%:
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 "libdtkcore5 (>= $(shell echo $(VERSION) | cut -d '.' -f 1,2))"
dtkcore-5.5.23/debian/source/ 0000775 0000000 0000000 00000000000 14154026022 0015757 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/debian/source/format 0000664 0000000 0000000 00000000015 14154026022 0017166 0 ustar 00root root 0000000 0000000 3.0 (native)
dtkcore-5.5.23/debian/symbols.amd64 0000664 0000000 0000000 00000153242 14154026022 0017013 0 ustar 00root root 0000000 0000000 libdtkcore.so.5 libdtkcore5 #MINVER#
_Z19qInitResources_utilv@Base 5.0.3
_Z22qCleanupResources_utilv@Base 5.0.3
_ZGVZN3Dtk4Core11DLogManager8instanceEvE8instance@Base 5.0.3
_ZN10QByteArrayD1Ev@Base 5.0.3
_ZN10QByteArrayD2Ev@Base 5.0.3
_ZN11DDBusCaller3argI7QStringEES_RKT_@Base 5.0.3
_ZN11DDBusCaller4callEv@Base 5.0.3
_ZN11DDBusCallerC1ERK7QStringSt10shared_ptrI9DDBusDataE@Base 5.0.3
_ZN11DDBusCallerC2ERK7QStringSt10shared_ptrI9DDBusDataE@Base 5.0.3
_ZN11DDBusCallerD1Ev@Base 5.0.3
_ZN11DDBusCallerD2Ev@Base 5.0.3
_ZN11DDBusSender4pathERK7QString@Base 5.0.3
_ZN11DDBusSender4typeEN15QDBusConnection7BusTypeE@Base 5.0.3
_ZN11DDBusSender6methodERK7QString@Base 5.0.3
_ZN11DDBusSender7serviceERK7QString@Base 5.0.3
_ZN11DDBusSender8propertyERK7QString@Base 5.0.3
_ZN11DDBusSender9interfaceERK7QString@Base 5.0.3
_ZN11DDBusSenderC1Ev@Base 5.0.3
_ZN11DDBusSenderC2Ev@Base 5.0.3
_ZN12QWeakPointerI7QObjectED1Ev@Base 5.0.3
_ZN12QWeakPointerI7QObjectED2Ev@Base 5.0.3
_ZN13DDBusProperty3getEv@Base 5.0.3
_ZN13DDBusPropertyC1ERK7QStringSt10shared_ptrI9DDBusDataE@Base 5.0.3
_ZN13DDBusPropertyC2ERK7QStringSt10shared_ptrI9DDBusDataE@Base 5.0.3
_ZN14QScopedPointerIN3Dtk4Core23GSettingsBackendPrivateE21QScopedPointerDeleterIS2_EED1Ev@Base 5.0.3
_ZN14QScopedPointerIN3Dtk4Core23GSettingsBackendPrivateE21QScopedPointerDeleterIS2_EED2Ev@Base 5.0.3
_ZN15QVarLengthArrayIcLi4096EEC1Ei@Base 5.0.3
_ZN15QVarLengthArrayIcLi4096EEC2Ei@Base 5.0.3
_ZN3Dtk4Core10doUnescapeER7QStringRK5QHashI5QCharS4_E@Base 5.0.3
_ZN3Dtk4Core11DLogManager12setLogFormatERK7QString@Base 5.0.3
_ZN3Dtk4Core11DLogManager14getlogFilePathEv@Base 5.0.3
_ZN3Dtk4Core11DLogManager14setlogFilePathERK7QString@Base 5.0.3
_ZN3Dtk4Core11DLogManager19initConsoleAppenderEv@Base 5.0.3
_ZN3Dtk4Core11DLogManager20registerFileAppenderEv@Base 5.0.3
_ZN3Dtk4Core11DLogManager23initRollingFileAppenderEv@Base 5.0.3
_ZN3Dtk4Core11DLogManager23registerConsoleAppenderEv@Base 5.0.3
_ZN3Dtk4Core11DLogManager8joinPathERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core11DLogManagerC1Ev@Base 5.0.3
_ZN3Dtk4Core11DLogManagerC2Ev@Base 5.0.3
_ZN3Dtk4Core11DLogManagerD1Ev@Base 5.0.3
_ZN3Dtk4Core11DLogManagerD2Ev@Base 5.0.3
_ZN3Dtk4Core11DVtableHook10copyVtableEPPy@Base 5.0.3
_ZN3Dtk4Core11DVtableHook11originalFunEPKvy@Base 5.0.3
_ZN3Dtk4Core11DVtableHook11resetVtableEPKv@Base 5.0.3
_ZN3Dtk4Core11DVtableHook12ensureVtableEPKvSt8functionIFvvEE@Base 5.0.3
_ZN3Dtk4Core11DVtableHook13resetVfptrFunEPKvy@Base 5.0.3
_ZN3Dtk4Core11DVtableHook14objDestructFunE@Base 5.0.3
_ZN3Dtk4Core11DVtableHook15autoCleanVtableEPKv@Base 5.0.3
_ZN3Dtk4Core11DVtableHook15objToGhostVfptrE@Base 5.0.3
_ZN3Dtk4Core11DVtableHook16clearGhostVtableEPKv@Base 5.0.3
_ZN3Dtk4Core11DVtableHook16forceWriteMemoryEPvPKvm@Base 5.0.3
_ZN3Dtk4Core11DVtableHook18objToOriginalVfptrE@Base 5.0.3
_ZN3Dtk4Core11DVtableHook19getDestructFunIndexEPPySt8functionIFvvEE@Base 5.0.3
_ZN3Dtk4Core11DVtableHook7resolveEPKc@Base 5.0.3
_ZN3Dtk4Core11DVtableHook9hasVtableEPKv@Base 5.0.3
_ZN3Dtk4Core11unqtifyNameERK7QString@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher11onFileMovedERK7QStringS4_S4_S4_@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher12onFileClosedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher13onFileCreatedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher13onFileDeletedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher14onFileModifiedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core12DFileWatcher22onFileAttributeChangedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core12DFileWatcherC1ERK7QStringP7QObject@Base 5.0.3
_ZN3Dtk4Core12DFileWatcherC2ERK7QStringP7QObject@Base 5.0.3
_ZN3Dtk4Core12DFileWatcherD0Ev@Base 5.0.3
_ZN3Dtk4Core12DFileWatcherD1Ev@Base 5.0.3
_ZN3Dtk4Core12DFileWatcherD2Ev@Base 5.0.3
_ZN3Dtk4Core12FileAppender11setFileNameERK7QString@Base 5.0.3
_ZN3Dtk4Core12FileAppender6appendERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 5.0.3
_ZN3Dtk4Core12FileAppender8openFileEv@Base 5.0.3
_ZN3Dtk4Core12FileAppender9closeFileEv@Base 5.0.3
_ZN3Dtk4Core12FileAppenderC1ERK7QString@Base 5.0.3
_ZN3Dtk4Core12FileAppenderC2ERK7QString@Base 5.0.3
_ZN3Dtk4Core12FileAppenderD0Ev@Base 5.0.3
_ZN3Dtk4Core12FileAppenderD1Ev@Base 5.0.3
_ZN3Dtk4Core12FileAppenderD2Ev@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry10escapeExecER7QString@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry11removeEntryERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry11setRawValueERK7QStringS4_S4_@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry12unescapeExecER7QString@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry14setStringValueERK7QStringS4_S4_@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry17setLocalizedValueERK7QStringS4_S4_S4_@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry6escapeER7QString@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry8unescapeER7QStringb@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntry9setStatusERKNS1_6StatusE@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntryC1ERK7QString@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntryC2ERK7QString@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntryD1Ev@Base 5.0.3
_ZN3Dtk4Core13DDesktopEntryD2Ev@Base 5.0.3
_ZN3Dtk4Core13DFileServices10showFolderE4QUrlRK7QString@Base 5.0.3
_ZN3Dtk4Core13DFileServices10showFolderE7QStringRKS2_@Base 5.0.3
_ZN3Dtk4Core13DFileServices11showFoldersE5QListI4QUrlERK7QString@Base 5.0.3
_ZN3Dtk4Core13DFileServices11showFoldersE5QListI7QStringERKS3_@Base 5.0.3
_ZN3Dtk4Core13DFileServices12errorMessageEv@Base 5.0.3
_ZN3Dtk4Core13DFileServices12showFileItemE4QUrlRK7QString@Base 5.0.3
_ZN3Dtk4Core13DFileServices12showFileItemE7QStringRKS2_@Base 5.0.3
_ZN3Dtk4Core13DFileServices13showFileItemsE5QListI4QUrlERK7QString@Base 5.0.3
_ZN3Dtk4Core13DFileServices13showFileItemsE5QListI7QStringERKS3_@Base 5.0.3
_ZN3Dtk4Core13DFileServices21showFileItemPropertieE4QUrlRK7QString@Base 5.0.3
_ZN3Dtk4Core13DFileServices21showFileItemPropertieE7QStringRKS2_@Base 5.0.3
_ZN3Dtk4Core13DFileServices22showFileItemPropertiesE5QListI4QUrlERK7QString@Base 5.0.3
_ZN3Dtk4Core13DFileServices22showFileItemPropertiesE5QListI7QStringERKS3_@Base 5.0.3
_ZN3Dtk4Core13DFileServices5trashE4QUrl@Base 5.0.3
_ZN3Dtk4Core13DFileServices5trashE5QListI4QUrlE@Base 5.0.3
_ZN3Dtk4Core13DFileServices5trashE5QListI7QStringE@Base 5.0.3
_ZN3Dtk4Core13DFileServices5trashE7QString@Base 5.0.3
_ZN3Dtk4Core13DSecureStringC1ERK7QString@Base 5.0.3
_ZN3Dtk4Core13DSecureStringC2ERK7QString@Base 5.0.3
_ZN3Dtk4Core13DSecureStringD1Ev@Base 5.0.3
_ZN3Dtk4Core13DSecureStringD2Ev@Base 5.0.3
_ZN3Dtk4Core13DTrashManager10cleanTrashEv@Base 5.0.3
_ZN3Dtk4Core13DTrashManager11moveToTrashERK7QStringb@Base 5.0.3
_ZN3Dtk4Core13DTrashManager8instanceEv@Base 5.0.3
_ZN3Dtk4Core13DTrashManagerC1Ev@Base 5.0.3
_ZN3Dtk4Core13DTrashManagerC2Ev@Base 5.0.3
_ZN3Dtk4Core13DTrashManagerD0Ev@Base 5.0.3
_ZN3Dtk4Core13DTrashManagerD1Ev@Base 5.0.3
_ZN3Dtk4Core13DTrashManagerD2Ev@Base 5.0.3
_ZN3Dtk4Core13LoggerPrivate14globalInstanceE@Base 5.0.3
_ZN3Dtk4Core13LoggerPrivate18globalInstanceLockE@Base 5.0.3
_ZN3Dtk4Core14Chinese2PinyinERK7QString@Base 5.0.3
_ZN3Dtk4Core14DObjectPrivateC1EPNS0_7DObjectE@Base 5.0.3
_ZN3Dtk4Core14DObjectPrivateC2EPNS0_7DObjectE@Base 5.0.3
_ZN3Dtk4Core14DObjectPrivateD0Ev@Base 5.0.3
_ZN3Dtk4Core14DObjectPrivateD1Ev@Base 5.0.3
_ZN3Dtk4Core14DObjectPrivateD2Ev@Base 5.0.3
_ZN3Dtk4Core14DRecentManager10removeItemERK7QString@Base 5.0.3
_ZN3Dtk4Core14DRecentManager11removeItemsERK11QStringList@Base 5.0.3
_ZN3Dtk4Core14DRecentManager7addItemERK7QStringRNS0_11DRecentDataE@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroup11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroup11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroup14setParentGroupE8QPointerIS1_E@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroup16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroup8fromJsonERK7QStringRK11QJsonObject@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroup9parseJsonERK7QStringRK11QJsonObject@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroupC1EP7QObject@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroupC2EP7QObject@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroupD0Ev@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroupD1Ev@Base 5.0.3
_ZN3Dtk4Core14DSettingsGroupD2Ev@Base 5.0.3
_ZN3Dtk4Core14DStandardPaths14findExecutableERK7QStringRK11QStringList@Base 5.0.3
_ZN3Dtk4Core14DStandardPaths16writableLocationEN14QStandardPaths16StandardLocationE@Base 5.0.3
_ZN3Dtk4Core14DStandardPaths17standardLocationsEN14QStandardPaths16StandardLocationE@Base 5.0.3
_ZN3Dtk4Core14DStandardPaths6locateEN14QStandardPaths16StandardLocationERK7QString6QFlagsINS2_12LocateOptionEE@Base 5.0.3
_ZN3Dtk4Core14DStandardPaths7setModeENS1_4ModeE@Base 5.0.3
_ZN3Dtk4Core14DStandardPaths9locateAllEN14QStandardPaths16StandardLocationERK7QString6QFlagsINS2_12LocateOptionEE@Base 5.0.3
_ZN3Dtk4Core14DTrashManager_D0Ev@Base 5.0.3
_ZN3Dtk4Core14DTrashManager_D1Ev@Base 5.0.3
_ZN3Dtk4Core14DTrashManager_D2Ev@Base 5.0.3
_ZN3Dtk4Core14loggerInstanceEv@Base 5.0.3
_ZN3Dtk4Core14parentPathListERK7QString@Base 5.0.3
_ZN3Dtk4Core15ConsoleAppender24ignoreEnvironmentPatternEb@Base 5.0.3
_ZN3Dtk4Core15ConsoleAppender6appendERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 5.0.3
_ZN3Dtk4Core15ConsoleAppenderC1Ev@Base 5.0.3
_ZN3Dtk4Core15ConsoleAppenderC2Ev@Base 5.0.3
_ZN3Dtk4Core15ConsoleAppenderD0Ev@Base 5.0.3
_ZN3Dtk4Core15ConsoleAppenderD1Ev@Base 5.0.3
_ZN3Dtk4Core15ConsoleAppenderD2Ev@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption11dataChangedERK7QString8QVariant@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption12valueChangedE8QVariant@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption14setParentGroupE8QPointerINS0_14DSettingsGroupEE@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption7setDataERK7QString8QVariant@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption8fromJsonERK7QStringRK11QJsonObject@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption8setValueE8QVariant@Base 5.0.3
_ZN3Dtk4Core15DSettingsOption9parseJsonERK7QStringRK11QJsonObject@Base 5.0.3
_ZN3Dtk4Core15DSettingsOptionC1EP7QObject@Base 5.0.3
_ZN3Dtk4Core15DSettingsOptionC2EP7QObject@Base 5.0.3
_ZN3Dtk4Core15DSettingsOptionD0Ev@Base 5.0.3
_ZN3Dtk4Core15DSettingsOptionD1Ev@Base 5.0.3
_ZN3Dtk4Core15DSettingsOptionD2Ev@Base 5.0.3
_ZN3Dtk4Core15DSysInfoPrivate13parseInfoFileER5QFile@Base 5.0.3
_ZN3Dtk4Core15DSysInfoPrivate16ensureDeepinInfoEv@Base 5.0.3
_ZN3Dtk4Core15DSysInfoPrivate17ensureReleaseInfoEv@Base 5.0.3
_ZN3Dtk4Core15DSysInfoPrivate18ensureComputerInfoEv@Base 5.0.3
_ZN3Dtk4Core15DSysInfoPrivateC1Ev@Base 5.0.3
_ZN3Dtk4Core15DSysInfoPrivateC2Ev@Base 5.0.3
_ZN3Dtk4Core15QSettingBackend11doSetOptionERK7QStringRK8QVariant@Base 5.0.3
_ZN3Dtk4Core15QSettingBackend11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core15QSettingBackend11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core15QSettingBackend16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core15QSettingBackend6doSyncEv@Base 5.0.3
_ZN3Dtk4Core15QSettingBackendC1ERK7QStringP7QObject@Base 5.0.3
_ZN3Dtk4Core15QSettingBackendC2ERK7QStringP7QObject@Base 5.0.3
_ZN3Dtk4Core15QSettingBackendD0Ev@Base 5.0.3
_ZN3Dtk4Core15QSettingBackendD1Ev@Base 5.0.3
_ZN3Dtk4Core15QSettingBackendD2Ev@Base 5.0.3
_ZN3Dtk4Core16AbstractAppender15setDetailsLevelENS0_6Logger8LogLevelE@Base 5.0.3
_ZN3Dtk4Core16AbstractAppender15setDetailsLevelERK7QString@Base 5.0.3
_ZN3Dtk4Core16AbstractAppender5writeERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 5.0.3
_ZN3Dtk4Core16AbstractAppenderC1Ev@Base 5.0.3
_ZN3Dtk4Core16AbstractAppenderC2Ev@Base 5.0.3
_ZN3Dtk4Core16AbstractAppenderD0Ev@Base 5.0.3
_ZN3Dtk4Core16AbstractAppenderD1Ev@Base 5.0.3
_ZN3Dtk4Core16AbstractAppenderD2Ev@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher10fileClosedERK4QUrl@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher11fileDeletedERK4QUrl@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher11ghostSignalERK4QUrlMS1_FvS4_ES4_@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher11ghostSignalERK4QUrlMS1_FvS4_S4_ES4_S4_@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher11stopWatcherEv@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher12fileModifiedERK4QUrl@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher12startWatcherEv@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher14restartWatcherEv@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher14subfileCreatedERK4QUrl@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher20fileAttributeChangedERK4QUrl@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher24setEnabledSubfileWatcherERK4QUrlb@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcher9fileMovedERK4QUrlS4_@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcherC1ERNS0_23DBaseFileWatcherPrivateERK4QUrlP7QObject@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcherC2ERNS0_23DBaseFileWatcherPrivateERK4QUrlP7QObject@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcherD0Ev@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcherD1Ev@Base 5.0.3
_ZN3Dtk4Core16DBaseFileWatcherD2Ev@Base 5.0.3
_ZN3Dtk4Core16DSettingsBackend11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core16DSettingsBackend11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core16DSettingsBackend13optionChangedERK7QStringRK8QVariant@Base 5.0.3
_ZN3Dtk4Core16DSettingsBackend16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core16DSettingsBackend4syncEv@Base 5.0.3
_ZN3Dtk4Core16DSettingsBackend9setOptionERK7QStringRK8QVariant@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackend11doSetOptionERK7QStringRK8QVariant@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackend11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackend11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackend16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackend6doSyncEv@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackendC1EPNS0_9DSettingsEP7QObject@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackendC2EPNS0_9DSettingsEP7QObject@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackendD0Ev@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackendD1Ev@Base 5.0.3
_ZN3Dtk4Core16GSettingsBackendD2Ev@Base 5.0.3
_ZN3Dtk4Core16readLineFromDataERK10QByteArrayRiS4_S4_S4_@Base 5.0.3
_ZN3Dtk4Core18DDiskSizeFormatter4rateEi@Base 5.0.3
_ZN3Dtk4Core18DDiskSizeFormatterC1Ev@Base 5.0.3
_ZN3Dtk4Core18DDiskSizeFormatterC2Ev@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher10fileClosedERK7QStringS4_NS1_14QPrivateSignalE@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher10removePathERK7QString@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher11fileCreatedERK7QStringS4_NS1_14QPrivateSignalE@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher11fileDeletedERK7QStringS4_NS1_14QPrivateSignalE@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher11removePathsERK11QStringList@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher12fileModifiedERK7QStringS4_NS1_14QPrivateSignalE@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher20fileAttributeChangedERK7QStringS4_NS1_14QPrivateSignalE@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher7addPathERK7QString@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher8addPathsERK11QStringList@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcher9fileMovedERK7QStringS4_S4_S4_NS1_14QPrivateSignalE@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcherC1EP7QObject@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcherC1ERK11QStringListP7QObject@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcherC2EP7QObject@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcherC2ERK11QStringListP7QObject@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcherD0Ev@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcherD1Ev@Base 5.0.3
_ZN3Dtk4Core18DFileSystemWatcherD2Ev@Base 5.0.3
_ZN3Dtk4Core18DTimeUnitFormatterC1Ev@Base 5.0.3
_ZN3Dtk4Core18DTimeUnitFormatterC2Ev@Base 5.0.3
_ZN3Dtk4Core18LoggerTimingHelper5startEPKcz@Base 5.0.3
_ZN3Dtk4Core18LoggerTimingHelper5startERK7QString@Base 5.0.3
_ZN3Dtk4Core18LoggerTimingHelperD1Ev@Base 5.0.3
_ZN3Dtk4Core18LoggerTimingHelperD2Ev@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager10fileClosedERK7QString@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager11fileDeletedERK7QString@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager12fileModifiedERK7QString@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager14subfileCreatedERK7QString@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager20fileAttributeChangedERK7QString@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager3addERK7QString@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager6removeERK7QString@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManager9fileMovedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManagerC1EP7QObject@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManagerC2EP7QObject@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManagerD0Ev@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManagerD1Ev@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherManagerD2Ev@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate10formatPathERK7QString@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate18_q_handleFileCloseERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate18_q_handleFileMovedERK7QStringS4_S4_S4_@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate20_q_handleFileCreatedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate20_q_handleFileDeletedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate21_q_handleFileModifiedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate22filePathToWatcherCountE@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate29_q_handleFileAttributeChangedERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate4stopEv@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivate5startEv@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivateD0Ev@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivateD1Ev@Base 5.0.3
_ZN3Dtk4Core19DFileWatcherPrivateD2Ev@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender14removeOldFilesEv@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender14setDatePatternENS1_11DatePatternE@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender14setDatePatternERK7QString@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender16computeFrequencyEv@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender16setLogFilesLimitEi@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender19computeRollOverTimeEv@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender20setDatePatternStringERK7QString@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender6appendERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppender8rollOverEv@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppenderC1ERK7QString@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppenderC2ERK7QString@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppenderD0Ev@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppenderD1Ev@Base 5.0.3
_ZN3Dtk4Core19RollingFileAppenderD2Ev@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivate20initSectionsFromDataERK10QByteArray@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivate3getERK7QStringS4_PS2_@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivate3setERK7QStringS4_S4_@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivate6removeERK7QStringS4_@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivate9fuzzyLoadEv@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivateC1ERK7QStringPNS0_13DDesktopEntryE@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivateC2ERK7QStringPNS0_13DDesktopEntryE@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivateD1Ev@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntryPrivateD2Ev@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntrySection23ensureSectionDataParsedEv@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntrySectionD1Ev@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntrySectionD2Ev@Base 5.0.3
_ZN3Dtk4Core20DDesktopEntrySectionaSERKS1_@Base 5.0.3
_ZN3Dtk4Core20DTrashManagerPrivate15removeFileOrDirERK7QString@Base 5.0.3
_ZN3Dtk4Core20DTrashManagerPrivate18removeFromIteratorER12QDirIterator@Base 5.0.3
_ZN3Dtk4Core20DTrashManagerPrivateD0Ev@Base 5.0.3
_ZN3Dtk4Core20DTrashManagerPrivateD1Ev@Base 5.0.3
_ZN3Dtk4Core20DTrashManagerPrivateD2Ev@Base 5.0.3
_ZN3Dtk4Core21DSettingsGroupPrivate9parseJsonERK7QStringRK11QJsonObject@Base 5.0.3
_ZN3Dtk4Core22AbstractStringAppender16qCleanupFuncinfoEPKc@Base 5.0.3
_ZN3Dtk4Core22AbstractStringAppender17stripFunctionNameEPKc@Base 5.0.3
_ZN3Dtk4Core22AbstractStringAppender9setFormatERK7QString@Base 5.0.3
_ZN3Dtk4Core22AbstractStringAppenderC1Ev@Base 5.0.3
_ZN3Dtk4Core22AbstractStringAppenderC2Ev@Base 5.0.3
_ZN3Dtk4Core22AbstractStringAppenderD0Ev@Base 5.0.3
_ZN3Dtk4Core22AbstractStringAppenderD1Ev@Base 5.0.3
_ZN3Dtk4Core22AbstractStringAppenderD2Ev@Base 5.0.3
_ZN3Dtk4Core22DAbstractUnitFormatterC1Ev@Base 5.0.3
_ZN3Dtk4Core22DAbstractUnitFormatterC2Ev@Base 5.0.3
_ZN3Dtk4Core22DAbstractUnitFormatterD1Ev@Base 5.0.3
_ZN3Dtk4Core22DAbstractUnitFormatterD2Ev@Base 5.0.3
_ZN3Dtk4Core22DSettingsOptionPrivate9parseJsonERK7QStringRK11QJsonObject@Base 5.0.3
_ZN3Dtk4Core23DBaseFileWatcherPrivate11watcherListE@Base 5.0.3
_ZN3Dtk4Core23DBaseFileWatcherPrivateC1EPNS0_16DBaseFileWatcherE@Base 5.0.3
_ZN3Dtk4Core23DBaseFileWatcherPrivateC2EPNS0_16DBaseFileWatcherE@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivate11removePathsERK11QStringListPS2_S5_@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivate13onFileChangedERK7QStringb@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivate18_q_readFromInotifyEv@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivate18onDirectoryChangedERK7QStringb@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivate8addPathsERK11QStringListPS2_S5_@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivateC1EiPNS0_18DFileSystemWatcherE@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivateC2EiPNS0_18DFileSystemWatcherE@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivateD0Ev@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivateD1Ev@Base 5.0.3
_ZN3Dtk4Core25DFileSystemWatcherPrivateD2Ev@Base 5.0.3
_ZN3Dtk4Core26DFileWatcherManagerPrivateC1EPNS0_19DFileWatcherManagerE@Base 5.0.3
_ZN3Dtk4Core26DFileWatcherManagerPrivateC2EPNS0_19DFileWatcherManagerE@Base 5.0.3
_ZN3Dtk4Core26DFileWatcherManagerPrivateD0Ev@Base 5.0.3
_ZN3Dtk4Core26DFileWatcherManagerPrivateD1Ev@Base 5.0.3
_ZN3Dtk4Core26DFileWatcherManagerPrivateD2Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySender4callEv@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySender5hintsERK4QMapI7QString8QVariantE@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySender7actionsERK11QStringList@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySender7appBodyERK7QString@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySender7appIconERK7QString@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySender7appNameERK7QString@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySender7timeOutEi@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySender9replaceIdEj@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySenderC1ERK7QString@Base 5.0.3
_ZN3Dtk4Core5DUtil13DNotifySenderC2ERK7QString@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterface11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterface11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterface14registerActionERK7QStringS5_St8functionIF8QVariantS3_EE@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterface16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterfaceC1EP7QObject@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterfaceC2EP7QObject@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterfaceD0Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterfaceD1Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil18DExportedInterfaceD2Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil25DExportedInterfacePrivate10actionHelpE7QStringi@Base 5.0.3
_ZN3Dtk4Core5DUtil25DExportedInterfacePrivateC1EPNS1_18DExportedInterfaceE@Base 5.0.3
_ZN3Dtk4Core5DUtil25DExportedInterfacePrivateC2EPNS1_18DExportedInterfaceE@Base 5.0.3
_ZN3Dtk4Core5DUtil25DExportedInterfacePrivateD0Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil25DExportedInterfacePrivateD1Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil25DExportedInterfacePrivateD2Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterface11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterface11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterface16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterface4helpERK7QString@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterface4listEv@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterface6invokeE7QStringS3_@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterfaceC1EPNS1_25DExportedInterfacePrivateE@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterfaceC2EPNS1_25DExportedInterfacePrivateE@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterfaceD0Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterfaceD1Ev@Base 5.0.3
_ZN3Dtk4Core5DUtil31DExportedInterfaceDBusInterfaceD2Ev@Base 5.0.3
_ZN3Dtk4Core6Logger11writeAssertEPKciS3_S3_@Base 5.0.3
_ZN3Dtk4Core6Logger13levelToStringENS1_8LogLevelE@Base 5.0.3
_ZN3Dtk4Core6Logger14globalInstanceEv@Base 5.0.3
_ZN3Dtk4Core6Logger15levelFromStringERK7QString@Base 5.0.3
_ZN3Dtk4Core6Logger16registerAppenderEPNS0_16AbstractAppenderE@Base 5.0.3
_ZN3Dtk4Core6Logger18setDefaultCategoryERK7QString@Base 5.0.3
_ZN3Dtk4Core6Logger19logToGlobalInstanceERK7QStringb@Base 5.0.3
_ZN3Dtk4Core6Logger24registerCategoryAppenderERK7QStringPNS0_16AbstractAppenderE@Base 5.0.3
_ZN3Dtk4Core6Logger5writeENS1_8LogLevelEPKciS4_S4_@Base 5.0.3
_ZN3Dtk4Core6Logger5writeENS1_8LogLevelEPKciS4_S4_RK7QString@Base 5.0.3
_ZN3Dtk4Core6Logger5writeERK9QDateTimeNS1_8LogLevelEPKciS7_S7_RK7QString@Base 5.0.3
_ZN3Dtk4Core6Logger5writeERK9QDateTimeNS1_8LogLevelEPKciS7_S7_RK7QStringb@Base 5.0.3
_ZN3Dtk4Core6LoggerC1ERK7QString@Base 5.0.3
_ZN3Dtk4Core6LoggerC1Ev@Base 5.0.3
_ZN3Dtk4Core6LoggerC2ERK7QString@Base 5.0.3
_ZN3Dtk4Core6LoggerC2Ev@Base 5.0.3
_ZN3Dtk4Core6LoggerD1Ev@Base 5.0.3
_ZN3Dtk4Core6LoggerD2Ev@Base 5.0.3
_ZN3Dtk4Core7DObjectC1EPS1_@Base 5.0.3
_ZN3Dtk4Core7DObjectC1ERNS0_14DObjectPrivateEPS1_@Base 5.0.3
_ZN3Dtk4Core7DObjectC2EPS1_@Base 5.0.3
_ZN3Dtk4Core7DObjectC2ERNS0_14DObjectPrivateEPS1_@Base 5.0.3
_ZN3Dtk4Core7DObjectD0Ev@Base 5.0.3
_ZN3Dtk4Core7DObjectD1Ev@Base 5.0.3
_ZN3Dtk4Core7DObjectD2Ev@Base 5.0.3
_ZN3Dtk4Core8DPathBufC1ERK7QString@Base 5.0.3
_ZN3Dtk4Core8DPathBufC1Ev@Base 5.0.3
_ZN3Dtk4Core8DPathBufC2ERK7QString@Base 5.0.3
_ZN3Dtk4Core8DPathBufC2Ev@Base 5.0.3
_ZN3Dtk4Core8DSysInfo10deepinTypeEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo11productTypeEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo12computerNameEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo12cpuModelNameEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo13deepinEditionEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo13deepinVersionEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo14productVersionEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo14systemDiskSizeEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo15deepinCopyrightEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo15memoryTotalSizeEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo17productTypeStringEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo18isCommunityEditionEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo19distributionOrgLogoENS1_7OrgTypeENS1_8LogoTypeERK7QString@Base 5.0.3
_ZN3Dtk4Core8DSysInfo19distributionOrgNameENS1_7OrgTypeERK7QLocale@Base 5.0.3
_ZN3Dtk4Core8DSysInfo19memoryInstalledSizeEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo19operatingSystemNameEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo20distributionInfoPathEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo21deepinDistributorLogoENS1_8LogoTypeERK7QString@Base 5.0.3
_ZN3Dtk4Core8DSysInfo21deepinDistributorNameEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo21deepinTypeDisplayNameERK7QLocale@Base 5.0.3
_ZN3Dtk4Core8DSysInfo22distributionOrgWebsiteENS1_7OrgTypeE@Base 5.0.3
_ZN3Dtk4Core8DSysInfo24deepinDistributorWebsiteEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo26deepinDistributionInfoPathEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo27distributionInfoSectionNameENS1_7OrgTypeE@Base 5.0.3
_ZN3Dtk4Core8DSysInfo5isDDEEv@Base 5.0.3
_ZN3Dtk4Core8DSysInfo8isDeepinEv@Base 5.0.3
_ZN3Dtk4Core8doEscapeER7QStringRK5QHashI5QCharS4_E@Base 5.0.3
_ZN3Dtk4Core9DSettings10setBackendEPNS0_16DSettingsBackendE@Base 5.0.3
_ZN3Dtk4Core9DSettings11qt_metacallEN11QMetaObject4CallEiPPv@Base 5.0.3
_ZN3Dtk4Core9DSettings11qt_metacastEPKc@Base 5.0.3
_ZN3Dtk4Core9DSettings12fromJsonFileERK7QString@Base 5.0.3
_ZN3Dtk4Core9DSettings12valueChangedERK7QStringRK8QVariant@Base 5.0.3
_ZN3Dtk4Core9DSettings16staticMetaObjectE@Base 5.0.3
_ZN3Dtk4Core9DSettings4syncEv@Base 5.0.3
_ZN3Dtk4Core9DSettings5resetEv@Base 5.0.3
_ZN3Dtk4Core9DSettings8fromJsonERK10QByteArray@Base 5.0.3
_ZN3Dtk4Core9DSettings9loadValueEv@Base 5.0.3
_ZN3Dtk4Core9DSettings9parseJsonERK10QByteArray@Base 5.0.3
_ZN3Dtk4Core9DSettings9setOptionERK7QStringRK8QVariant@Base 5.0.3
_ZN3Dtk4Core9DSettingsC1EP7QObject@Base 5.0.3
_ZN3Dtk4Core9DSettingsC2EP7QObject@Base 5.0.3
_ZN3Dtk4Core9DSettingsD0Ev@Base 5.0.3
_ZN3Dtk4Core9DSettingsD1Ev@Base 5.0.3
_ZN3Dtk4Core9DSettingsD2Ev@Base 5.0.3
_ZN3Dtk4Core9LogDevice8readDataEPcx@Base 5.0.3
_ZN3Dtk4Core9LogDevice9writeDataEPKcx@Base 5.0.3
_ZN3Dtk4Core9LogDeviceD0Ev@Base 5.0.3
_ZN3Dtk4Core9LogDeviceD1Ev@Base 5.0.3
_ZN3Dtk4Core9LogDeviceD2Ev@Base 5.0.3
_ZN3Dtk4Core9qtifyNameERK7QString@Base 5.0.3
_ZN4QMapI7QString5QPairIS0_yEE13detach_helperEv@Base 5.0.3
_ZN4QMapI7QString5QPairIS0_yEED1Ev@Base 5.0.3
_ZN4QMapI7QString5QPairIS0_yEED2Ev@Base 5.0.3
_ZN4QMapI7QString5QPairIS0_yEEixERKS0_@Base 5.0.3
_ZN4QMapI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE13detach_helperEv@Base 5.0.3
_ZN4QMapI7QString8QVariantE6insertERKS0_RKS1_@Base 5.0.3
_ZN4QMapI7QString8QVariantEC1ERKS2_@Base 5.0.3
_ZN4QMapI7QString8QVariantEC2ERKS2_@Base 5.0.3
_ZN4QMapI7QStringN3Dtk4Core20DDesktopEntrySectionEE13detach_helperEv@Base 5.0.3
_ZN4QMapI7QStringN3Dtk4Core20DDesktopEntrySectionEED1Ev@Base 5.0.3
_ZN4QMapI7QStringN3Dtk4Core20DDesktopEntrySectionEED2Ev@Base 5.0.3
_ZN4QMapI7QStringN3Dtk4Core20DDesktopEntrySectionEEixERKS0_@Base 5.0.3
_ZN4QMapI7QStringPN3Dtk4Core12DFileWatcherEE13detach_helperEv@Base 5.0.3
_ZN4QMapI7QStringS0_E13detach_helperEv@Base 5.0.3
_ZN4QMapI7QStringS0_E6removeERKS0_@Base 5.0.3
_ZN4QMapI7QStringS0_EC1ERKS1_@Base 5.0.3
_ZN4QMapI7QStringS0_EC2ERKS1_@Base 5.0.3
_ZN4QMapI7QStringS0_ED1Ev@Base 5.0.3
_ZN4QMapI7QStringS0_ED2Ev@Base 5.0.3
_ZN4QMapI7QStringS0_EixERKS0_@Base 5.0.3
_ZN4QMapI7QStringiE13detach_helperEv@Base 5.0.3
_ZN4QMapI7QStringiED1Ev@Base 5.0.3
_ZN4QMapI7QStringiED2Ev@Base 5.0.3
_ZN4QMapI9QDateTime7QStringED1Ev@Base 5.0.3
_ZN4QMapI9QDateTime7QStringED2Ev@Base 5.0.3
_ZN4QMapIPKvPyE13detach_helperEv@Base 5.0.3
_ZN4QMapIPKvPyED1Ev@Base 5.0.3
_ZN4QMapIPKvPyED2Ev@Base 5.0.3
_ZN4QMapIPKvyE13detach_helperEv@Base 5.0.3
_ZN4QMapIPKvyED1Ev@Base 5.0.3
_ZN4QMapIPKvyED2Ev@Base 5.0.3
_ZN4QMapIPPyS0_E13detach_helperEv@Base 5.0.3
_ZN4QMapIPPyS0_ED1Ev@Base 5.0.3
_ZN4QMapIPPyS0_ED2Ev@Base 5.0.3
_ZN4QMapIi7QStringED1Ev@Base 5.0.3
_ZN4QMapIi7QStringED2Ev@Base 5.0.3
_ZN5QHashI5QCharS0_E11deleteNode2EPN9QHashData4NodeE@Base 5.0.3
_ZN5QHashI5QCharS0_E13duplicateNodeEPN9QHashData4NodeEPv@Base 5.0.3
_ZN5QHashI5QCharS0_E6insertERKS0_S3_@Base 5.0.3
_ZN5QHashI5QCharS0_ED1Ev@Base 5.0.3
_ZN5QHashI5QCharS0_ED2Ev@Base 5.0.3
_ZN5QHashI7QString5QPairISt8functionIF8QVariantS0_EES0_EE11deleteNode2EPN9QHashData4NodeE@Base 5.0.3
_ZN5QHashI7QString5QPairISt8functionIF8QVariantS0_EES0_EE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.0.3
_ZN5QHashI7QStringiE11deleteNode2EPN9QHashData4NodeE@Base 5.0.3
_ZN5QHashI7QStringiE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.0.3
_ZN5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueE11deleteNode2EPN9QHashData4NodeE@Base 5.0.3
_ZN5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.0.3
_ZN5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueED1Ev@Base 5.0.3
_ZN5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueED2Ev@Base 5.0.3
_ZN5QHashIi15QHashDummyValueE11deleteNode2EPN9QHashData4NodeE@Base 5.0.3
_ZN5QHashIi15QHashDummyValueE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.0.3
_ZN5QHashIi7QStringE11deleteNode2EPN9QHashData4NodeE@Base 5.0.3
_ZN5QHashIi7QStringE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.0.3
_ZN5QHashIi7QStringE5eraseENS1_14const_iteratorE@Base 5.0.3
_ZN5QHashIi7QStringED1Ev@Base 5.0.3
_ZN5QHashIi7QStringED2Ev@Base 5.0.3
_ZN5QHashIj7QStringE11deleteNode2EPN9QHashData4NodeE@Base 5.0.3
_ZN5QHashIj7QStringE13duplicateNodeEPN9QHashData4NodeEPv@Base 5.0.3
_ZN5QHashIj7QStringED1Ev@Base 5.0.3
_ZN5QHashIj7QStringED2Ev@Base 5.0.3
_ZN5QListI10QByteArrayED1Ev@Base 5.0.3
_ZN5QListI10QByteArrayED2Ev@Base 5.0.3
_ZN5QListI4QUrlE13detach_helperEi@Base 5.0.3
_ZN5QListI4QUrlE18detach_helper_growEii@Base 5.0.3
_ZN5QListI4QUrlE6appendERKS0_@Base 5.0.3
_ZN5QListI4QUrlEC1ERKS1_@Base 5.0.3
_ZN5QListI4QUrlEC2ERKS1_@Base 5.0.3
_ZN5QListI4QUrlED1Ev@Base 5.0.3
_ZN5QListI4QUrlED2Ev@Base 5.0.3
_ZN5QListI5QPairI7QStringiEE13detach_helperEi@Base 5.0.3
_ZN5QListI5QPairI7QStringiEE18detach_helper_growEii@Base 5.0.3
_ZN5QListI5QPairI7QStringiEE6appendERKS2_@Base 5.0.3
_ZN5QListI5QPairI7QStringiEED1Ev@Base 5.0.3
_ZN5QListI5QPairI7QStringiEED2Ev@Base 5.0.3
_ZN5QListI5QPairIdiEE18detach_helper_growEii@Base 5.0.3
_ZN5QListI5QPairIdiEE6appendERKS1_@Base 5.0.3
_ZN5QListI5QPairIdiEED1Ev@Base 5.0.3
_ZN5QListI5QPairIdiEED2Ev@Base 5.0.3
_ZN5QListI7QStringE13detach_helperEi@Base 5.0.3
_ZN5QListI7QStringE18detach_helper_growEii@Base 5.0.3
_ZN5QListI7QStringE6appendERKS0_@Base 5.0.3
_ZN5QListI7QStringE7reserveEi@Base 5.0.3
_ZN5QListI7QStringE9removeAllERKS0_@Base 5.0.3
_ZN5QListI7QStringEC1ERKS1_@Base 5.0.3
_ZN5QListI7QStringEC2ERKS1_@Base 5.0.3
_ZN5QListI7QStringED1Ev@Base 5.0.3
_ZN5QListI7QStringED2Ev@Base 5.0.3
_ZN5QListI8QPointerIN3Dtk4Core14DSettingsGroupEEE13detach_helperEi@Base 5.0.3
_ZN5QListI8QPointerIN3Dtk4Core14DSettingsGroupEEE18detach_helper_growEii@Base 5.0.3
_ZN5QListI8QPointerIN3Dtk4Core14DSettingsGroupEEE6appendERKS4_@Base 5.0.3
_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEE13detach_helperEi@Base 5.0.3
_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEE18detach_helper_growEii@Base 5.0.3
_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEE6appendERKS4_@Base 5.0.3
_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEED1Ev@Base 5.0.3
_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEED2Ev@Base 5.0.3
_ZN5QListI8QVariantE13detach_helperEi@Base 5.0.3
_ZN5QListI8QVariantE18detach_helper_growEii@Base 5.0.3
_ZN5QListI8QVariantE6appendERKS0_@Base 5.0.3
_ZN5QListI8QVariantEC1ERKS1_@Base 5.0.3
_ZN5QListI8QVariantEC2ERKS1_@Base 5.0.3
_ZN5QListI8QVariantED1Ev@Base 5.0.3
_ZN5QListI8QVariantED2Ev@Base 5.0.3
_ZN5QListI9QFileInfoE13detach_helperEi@Base 5.0.3
_ZN5QListI9QFileInfoED1Ev@Base 5.0.3
_ZN5QListI9QFileInfoED2Ev@Base 5.0.3
_ZN5QListIN3Dtk4Core8DSysInfo10DeepinTypeEE13detach_helperEi@Base 5.0.3
_ZN5QListIN3Dtk4Core8DSysInfo10DeepinTypeEE18detach_helper_growEii@Base 5.0.3
_ZN5QListIN3Dtk4Core8DSysInfo10DeepinTypeEE6appendERKS3_@Base 5.0.3
_ZN5QListIN3Dtk4Core8DSysInfo10DeepinTypeEED1Ev@Base 5.0.3
_ZN5QListIN3Dtk4Core8DSysInfo10DeepinTypeEED2Ev@Base 5.0.3
_ZN5QListIP13inotify_eventE13detach_helperEi@Base 5.0.3
_ZN5QListIP13inotify_eventE18detach_helper_growEii@Base 5.0.3
_ZN5QListIP13inotify_eventE6appendERKS1_@Base 5.0.3
_ZN5QListIP13inotify_eventED1Ev@Base 5.0.3
_ZN5QListIP13inotify_eventED2Ev@Base 5.0.3
_ZN5QListIPN3Dtk4Core16AbstractAppenderEE18detach_helper_growEii@Base 5.0.3
_ZN5QListIPN3Dtk4Core16AbstractAppenderEE6appendERKS3_@Base 5.0.3
_ZN5QListIPN3Dtk4Core16AbstractAppenderEEC1ERKS4_@Base 5.0.3
_ZN5QListIPN3Dtk4Core16AbstractAppenderEEC2ERKS4_@Base 5.0.3
_ZN5QListIPN3Dtk4Core16AbstractAppenderEED1Ev@Base 5.0.3
_ZN5QListIPN3Dtk4Core16AbstractAppenderEED2Ev@Base 5.0.3
_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEE13detach_helperEi@Base 5.0.3
_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEE18detach_helper_growEii@Base 5.0.3
_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEE6appendERKS3_@Base 5.0.3
_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEE9removeOneERKS3_@Base 5.0.3
_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEED1Ev@Base 5.0.3
_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEED2Ev@Base 5.0.3
_ZN5QPairISt8functionIF8QVariant7QStringEES2_ED1Ev@Base 5.0.3
_ZN5QPairISt8functionIF8QVariant7QStringEES2_ED2Ev@Base 5.0.3
_ZN7QStringC1EPKc@Base 5.0.3
_ZN7QStringC2EPKc@Base 5.0.3
_ZN7QStringD1Ev@Base 5.0.3
_ZN7QStringD2Ev@Base 5.0.3
_ZN8QMapDataI7QStringN3Dtk4Core20DDesktopEntrySectionEE10createNodeERKS0_RKS3_P8QMapNodeIS0_S3_Eb@Base 5.0.3
_ZN8QMapDataI7QStringPN3Dtk4Core12DFileWatcherEE7destroyEv@Base 5.0.3
_ZN8QMapDataI7QStringPN3Dtk4Core16AbstractAppenderEE7destroyEv@Base 5.0.3
_ZN8QMapDataI7QStringbE7destroyEv@Base 5.0.3
_ZN8QMapDataI7QStringiE7destroyEv@Base 5.0.3
_ZN8QMapDataI9QDateTime7QStringE7destroyEv@Base 5.0.3
_ZN8QMapDataIi7QStringE7destroyEv@Base 5.0.3
_ZN8QMapNodeI7QString5QPairIS0_yEE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QString8QPointerIN3Dtk4Core14DSettingsGroupEEE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QString8QVariantE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QStringN3Dtk4Core20DDesktopEntrySectionEE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QStringPN3Dtk4Core12DFileWatcherEE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QStringPN3Dtk4Core16AbstractAppenderEE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QStringS0_E14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QStringbE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI7QStringiE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeI9QDateTime7QStringE14destroySubTreeEv@Base 5.0.3
_ZN8QMapNodeIi7QStringE14destroySubTreeEv@Base 5.0.3
_ZN9DDBusDataC1Ev@Base 5.0.3
_ZN9DDBusDataC2Ev@Base 5.0.3
_ZN9QtPrivate11QSlotObjectIMN3Dtk4Core12DFileWatcherEFvRK7QStringS6_ENS_4ListIJS6_S6_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.0.3
_ZN9QtPrivate11QSlotObjectIMN3Dtk4Core12DFileWatcherEFvRK7QStringS6_S6_S6_ENS_4ListIJS6_S6_S6_S6_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.0.3
_ZN9QtPrivate11QSlotObjectIMN3Dtk4Core16DSettingsBackendEFvRK7QStringRK8QVariantENS_4ListIJS6_S9_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.0.3
_ZN9QtPrivate11QSlotObjectIMN3Dtk4Core16DSettingsBackendEFvvENS_4ListIJEEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 5.0.3
_ZN9QtPrivate8RefCount3refEv@Base 5.0.3
_ZNK3Dtk4Core12DFileWatcher10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core12FileAppender4sizeEv@Base 5.0.3
_ZNK3Dtk4Core12FileAppender8fileNameEv@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry11genericNameEv@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry11stringValueERK7QStringS4_S4_@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry14ddeDisplayNameEv@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry14localizedValueERK7QStringRK7QLocaleS4_S4_@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry14localizedValueERK7QStringS4_S4_S4_@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry15stringListValueERK7QStringS4_@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry4keysERK7QString@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry4nameEv@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry4saveEv@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry6statusEv@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry7commentEv@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry8containsERK7QStringS4_@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry8rawValueERK7QStringS4_S4_@Base 5.0.3
_ZNK3Dtk4Core13DDesktopEntry9allGroupsEb@Base 5.0.3
_ZNK3Dtk4Core13DTrashManager12trashIsEmptyEv@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup10childGroupERK7QString@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup11childGroupsEv@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup11parentGroupEv@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup12childOptionsEv@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup3keyEv@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup4nameEv@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup6optionERK7QString@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup7optionsEv@Base 5.0.3
_ZNK3Dtk4Core14DSettingsGroup8isHiddenEv@Base 5.0.3
_ZNK3Dtk4Core15ConsoleAppender6formatEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption11parentGroupEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption12defaultValueEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption3keyEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption4dataERK7QString@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption4nameEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption5valueEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption8canResetEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption8isHiddenEv@Base 5.0.3
_ZNK3Dtk4Core15DSettingsOption8viewTypeEv@Base 5.0.3
_ZNK3Dtk4Core15QSettingBackend10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core15QSettingBackend4keysEv@Base 5.0.3
_ZNK3Dtk4Core15QSettingBackend9getOptionERK7QString@Base 5.0.3
_ZNK3Dtk4Core16AbstractAppender12detailsLevelEv@Base 5.0.3
_ZNK3Dtk4Core16DBaseFileWatcher10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core16DBaseFileWatcher7fileUrlEv@Base 5.0.3
_ZNK3Dtk4Core16DSettingsBackend10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core16GSettingsBackend10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core16GSettingsBackend4keysEv@Base 5.0.3
_ZNK3Dtk4Core16GSettingsBackend9getOptionERK7QString@Base 5.0.3
_ZNK3Dtk4Core17CuteMessageLogger5writeEPKcz@Base 5.0.3
_ZNK3Dtk4Core17CuteMessageLogger5writeERK7QString@Base 5.0.3
_ZNK3Dtk4Core17CuteMessageLogger5writeEv@Base 5.0.3
_ZNK3Dtk4Core18DDiskSizeFormatter15unitConvertRateEi@Base 5.0.3
_ZNK3Dtk4Core18DDiskSizeFormatter7unitMaxEv@Base 5.0.3
_ZNK3Dtk4Core18DDiskSizeFormatter7unitMinEv@Base 5.0.3
_ZNK3Dtk4Core18DDiskSizeFormatter7unitStrEi@Base 5.0.3
_ZNK3Dtk4Core18DFileSystemWatcher10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core18DFileSystemWatcher11directoriesEv@Base 5.0.3
_ZNK3Dtk4Core18DFileSystemWatcher5filesEv@Base 5.0.3
_ZNK3Dtk4Core18DTimeUnitFormatter15unitConvertRateEi@Base 5.0.3
_ZNK3Dtk4Core18DTimeUnitFormatter7unitMaxEv@Base 5.0.3
_ZNK3Dtk4Core18DTimeUnitFormatter7unitMinEv@Base 5.0.3
_ZNK3Dtk4Core18DTimeUnitFormatter7unitStrEi@Base 5.0.3
_ZNK3Dtk4Core19DFileWatcherManager10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core19RollingFileAppender11datePatternEv@Base 5.0.3
_ZNK3Dtk4Core19RollingFileAppender13logFilesLimitEv@Base 5.0.3
_ZNK3Dtk4Core19RollingFileAppender17datePatternStringEv@Base 5.0.3
_ZNK3Dtk4Core20DDesktopEntryPrivate10isWritableEv@Base 5.0.3
_ZNK3Dtk4Core20DDesktopEntryPrivate10sectionPosERK7QString@Base 5.0.3
_ZNK3Dtk4Core20DDesktopEntryPrivate4keysERK7QString@Base 5.0.3
_ZNK3Dtk4Core20DDesktopEntryPrivate5writeER9QIODevice@Base 5.0.3
_ZNK3Dtk4Core20DDesktopEntryPrivate8containsERK7QStringS4_@Base 5.0.3
_ZNK3Dtk4Core20DDesktopEntryPrivate9setStatusERKNS0_13DDesktopEntry6StatusE@Base 5.0.3
_ZNK3Dtk4Core22AbstractStringAppender15formattedStringERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 5.0.3
_ZNK3Dtk4Core22AbstractStringAppender6formatEv@Base 5.0.3
_ZNK3Dtk4Core22DAbstractUnitFormatter12unitValueMaxEi@Base 5.0.3
_ZNK3Dtk4Core22DAbstractUnitFormatter12unitValueMinEi@Base 5.0.3
_ZNK3Dtk4Core22DAbstractUnitFormatter16formatAsUnitListEdi@Base 5.0.3
_ZNK3Dtk4Core22DAbstractUnitFormatter6formatEdi@Base 5.0.3
_ZNK3Dtk4Core22DAbstractUnitFormatter8formatAsEdii@Base 5.0.3
_ZNK3Dtk4Core5DUtil18DExportedInterface10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core5DUtil18DExportedInterface6invokeERK7QStringS5_@Base 5.0.3
_ZNK3Dtk4Core5DUtil31DExportedInterfaceDBusInterface10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core6Logger15defaultCategoryEv@Base 5.0.3
_ZNK3Dtk4Core9DSettings10metaObjectEv@Base 5.0.3
_ZNK3Dtk4Core9DSettings4keysEv@Base 5.0.3
_ZNK3Dtk4Core9DSettings4metaEv@Base 5.0.3
_ZNK3Dtk4Core9DSettings5groupERK7QString@Base 5.0.3
_ZNK3Dtk4Core9DSettings5valueERK7QString@Base 5.0.3
_ZNK3Dtk4Core9DSettings6groupsEv@Base 5.0.3
_ZNK3Dtk4Core9DSettings6optionERK7QString@Base 5.0.3
_ZNK3Dtk4Core9DSettings7optionsEv@Base 5.0.3
_ZNK3Dtk4Core9DSettings9getOptionERK7QString@Base 5.0.3
_ZNK3Dtk4Core9DSettings9groupKeysEv@Base 5.0.3
_ZNK4QMapI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE6valuesEv@Base 5.0.3
_ZNK4QMapI7QStringN3Dtk4Core20DDesktopEntrySectionEE4keysEv@Base 5.0.3
_ZNK4QMapIi7QStringE6valuesERKi@Base 5.0.3
_ZNK5QHashI5QCharS0_E8findNodeERKS0_Pj@Base 5.0.3
_ZNK5QHashI7QString5QPairISt8functionIF8QVariantS0_EES0_EE4keysEv@Base 5.0.3
_ZNK5QHashI7QString5QPairISt8functionIF8QVariantS0_EES0_EE8findNodeERKS0_Pj@Base 5.0.3
_ZNK5QHashI7QString5QPairISt8functionIF8QVariantS0_EES0_EE8findNodeERKS0_j@Base 5.0.3
_ZNK5QHashI7QStringiE8findNodeERKS0_Pj@Base 5.0.3
_ZNK5QHashI7QStringiE8findNodeERKS0_j@Base 5.0.3
_ZNK5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueE8findNodeERKS3_Pj@Base 5.0.3
_ZNK5QHashIi15QHashDummyValueE8findNodeERKiPj@Base 5.0.3
_ZNK5QHashIi7QStringE6valuesERKi@Base 5.0.3
_ZNK5QHashIi7QStringE8findNodeERKiPj@Base 5.0.3
_ZNK5QHashIj7QStringE8findNodeERKjPj@Base 5.0.3
_ZNK5QListIPN3Dtk4Core16AbstractAppenderEE5toSetEv@Base 5.0.3
_ZNK8QMapDataI7QString8QPointerIN3Dtk4Core14DSettingsGroupEEE8findNodeERKS0_@Base 5.0.3
_ZNK8QMapDataI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE8findNodeERKS0_@Base 5.0.3
_ZNK8QMapDataI7QString8QVariantE8findNodeERKS0_@Base 5.0.3
_ZNK8QMapDataI7QStringN3Dtk4Core20DDesktopEntrySectionEE8findNodeERKS0_@Base 5.0.3
_ZNK8QMapDataI7QStringPN3Dtk4Core12DFileWatcherEE8findNodeERKS0_@Base 5.0.3
_ZNK8QMapDataI7QStringPN3Dtk4Core16AbstractAppenderEE8findNodeERKS0_@Base 5.0.3
_ZNK8QMapDataI7QStringS0_E8findNodeERKS0_@Base 5.0.3
_ZNK8QMapDataI7QStringiE8findNodeERKS0_@Base 5.0.3
_ZNK8QMapDataIPKvPyE8findNodeERKS1_@Base 5.0.3
_ZNK8QMapDataIPKvyE8findNodeERKS1_@Base 5.0.3
_ZNK8QMapNodeI7QString5QPairIS0_yEE4copyEP8QMapDataIS0_S2_E@Base 5.0.3
_ZNK8QMapNodeI7QString8QPointerIN3Dtk4Core14DSettingsGroupEEE4copyEP8QMapDataIS0_S5_E@Base 5.0.3
_ZNK8QMapNodeI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE4copyEP8QMapDataIS0_S5_E@Base 5.0.3
_ZNK8QMapNodeI7QString8QVariantE4copyEP8QMapDataIS0_S1_E@Base 5.0.3
_ZNK8QMapNodeI7QStringN3Dtk4Core20DDesktopEntrySectionEE4copyEP8QMapDataIS0_S3_E@Base 5.0.3
_ZNK8QMapNodeI7QStringPN3Dtk4Core12DFileWatcherEE4copyEP8QMapDataIS0_S4_E@Base 5.0.3
_ZNK8QMapNodeI7QStringPN3Dtk4Core16AbstractAppenderEE4copyEP8QMapDataIS0_S4_E@Base 5.0.3
_ZNK8QMapNodeI7QStringS0_E4copyEP8QMapDataIS0_S0_E@Base 5.0.3
_ZNK8QMapNodeI7QStringbE4copyEP8QMapDataIS0_bE@Base 5.0.3
_ZNK8QMapNodeI7QStringiE4copyEP8QMapDataIS0_iE@Base 5.0.3
_ZNK8QMapNodeI9QDateTime7QStringE4copyEP8QMapDataIS0_S1_E@Base 5.0.3
_ZNK8QMapNodeIPKvPyE4copyEP8QMapDataIS1_S2_E@Base 5.0.3
_ZNK8QMapNodeIPKvyE4copyEP8QMapDataIS1_yE@Base 5.0.3
_ZNK8QMapNodeIPPyS0_E4copyEP8QMapDataIS1_S0_E@Base 5.0.3
_ZNK8QMapNodeIi7QStringE4copyEP8QMapDataIiS0_E@Base 5.0.3
_ZNKSt5ctypeIcE8do_widenEc@Base 5.0.3
_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE10_M_destroyEv@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EED0Ev@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EED1Ev@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EED2Ev@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE10_M_destroyEv@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EED0Ev@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EED1Ev@Base 5.0.3
_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EED2Ev@Base 5.0.3
_ZNSt8functionIF8QVariant7QStringEEC1ERKS3_@Base 5.0.3
_ZNSt8functionIF8QVariant7QStringEEC2ERKS3_@Base 5.0.3
_ZSt9__find_ifIPK7QStringN9__gnu_cxx5__ops16_Iter_equals_valIS1_EEET_S7_S7_T0_St26random_access_iterator_tag@Base 5.0.3
_ZTI12QDBusContext@Base 5.0.3
_ZTIN3Dtk4Core12DFileWatcherE@Base 5.0.3
_ZTIN3Dtk4Core12FileAppenderE@Base 5.0.3
_ZTIN3Dtk4Core13DTrashManagerE@Base 5.0.3
_ZTIN3Dtk4Core14DObjectPrivateE@Base 5.0.3
_ZTIN3Dtk4Core14DSettingsGroupE@Base 5.0.3
_ZTIN3Dtk4Core14DTrashManager_E@Base 5.0.3
_ZTIN3Dtk4Core15ConsoleAppenderE@Base 5.0.3
_ZTIN3Dtk4Core15DSettingsOptionE@Base 5.0.3
_ZTIN3Dtk4Core15QSettingBackendE@Base 5.0.3
_ZTIN3Dtk4Core16AbstractAppenderE@Base 5.0.3
_ZTIN3Dtk4Core16DBaseFileWatcherE@Base 5.0.3
_ZTIN3Dtk4Core16DSettingsBackendE@Base 5.0.3
_ZTIN3Dtk4Core16GSettingsBackendE@Base 5.0.3
_ZTIN3Dtk4Core18DDiskSizeFormatterE@Base 5.0.3
_ZTIN3Dtk4Core18DFileSystemWatcherE@Base 5.0.3
_ZTIN3Dtk4Core18DTimeUnitFormatterE@Base 5.0.3
_ZTIN3Dtk4Core19DFileWatcherManagerE@Base 5.0.3
_ZTIN3Dtk4Core19DFileWatcherPrivateE@Base 5.0.3
_ZTIN3Dtk4Core19RollingFileAppenderE@Base 5.0.3
_ZTIN3Dtk4Core20DTrashManagerPrivateE@Base 5.0.3
_ZTIN3Dtk4Core22AbstractStringAppenderE@Base 5.0.3
_ZTIN3Dtk4Core22DAbstractUnitFormatterE@Base 5.0.3
_ZTIN3Dtk4Core23DBaseFileWatcherPrivateE@Base 5.0.3
_ZTIN3Dtk4Core25DFileSystemWatcherPrivateE@Base 5.0.3
_ZTIN3Dtk4Core26DFileWatcherManagerPrivateE@Base 5.0.3
_ZTIN3Dtk4Core5DUtil18DExportedInterfaceE@Base 5.0.3
_ZTIN3Dtk4Core5DUtil25DExportedInterfacePrivateE@Base 5.0.3
_ZTIN3Dtk4Core5DUtil31DExportedInterfaceDBusInterfaceE@Base 5.0.3
_ZTIN3Dtk4Core7DObjectE@Base 5.0.3
_ZTIN3Dtk4Core9DSettingsE@Base 5.0.3
_ZTIN3Dtk4Core9LogDeviceE@Base 5.0.3
_ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTISt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTISt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTS12QDBusContext@Base 5.0.3
_ZTSN3Dtk4Core12DFileWatcherE@Base 5.0.3
_ZTSN3Dtk4Core12FileAppenderE@Base 5.0.3
_ZTSN3Dtk4Core13DTrashManagerE@Base 5.0.3
_ZTSN3Dtk4Core14DObjectPrivateE@Base 5.0.3
_ZTSN3Dtk4Core14DSettingsGroupE@Base 5.0.3
_ZTSN3Dtk4Core14DTrashManager_E@Base 5.0.3
_ZTSN3Dtk4Core15ConsoleAppenderE@Base 5.0.3
_ZTSN3Dtk4Core15DSettingsOptionE@Base 5.0.3
_ZTSN3Dtk4Core15QSettingBackendE@Base 5.0.3
_ZTSN3Dtk4Core16AbstractAppenderE@Base 5.0.3
_ZTSN3Dtk4Core16DBaseFileWatcherE@Base 5.0.3
_ZTSN3Dtk4Core16DSettingsBackendE@Base 5.0.3
_ZTSN3Dtk4Core16GSettingsBackendE@Base 5.0.3
_ZTSN3Dtk4Core18DDiskSizeFormatterE@Base 5.0.3
_ZTSN3Dtk4Core18DFileSystemWatcherE@Base 5.0.3
_ZTSN3Dtk4Core18DTimeUnitFormatterE@Base 5.0.3
_ZTSN3Dtk4Core19DFileWatcherManagerE@Base 5.0.3
_ZTSN3Dtk4Core19DFileWatcherPrivateE@Base 5.0.3
_ZTSN3Dtk4Core19RollingFileAppenderE@Base 5.0.3
_ZTSN3Dtk4Core20DTrashManagerPrivateE@Base 5.0.3
_ZTSN3Dtk4Core22AbstractStringAppenderE@Base 5.0.3
_ZTSN3Dtk4Core22DAbstractUnitFormatterE@Base 5.0.3
_ZTSN3Dtk4Core23DBaseFileWatcherPrivateE@Base 5.0.3
_ZTSN3Dtk4Core25DFileSystemWatcherPrivateE@Base 5.0.3
_ZTSN3Dtk4Core26DFileWatcherManagerPrivateE@Base 5.0.3
_ZTSN3Dtk4Core5DUtil18DExportedInterfaceE@Base 5.0.3
_ZTSN3Dtk4Core5DUtil25DExportedInterfacePrivateE@Base 5.0.3
_ZTSN3Dtk4Core5DUtil31DExportedInterfaceDBusInterfaceE@Base 5.0.3
_ZTSN3Dtk4Core7DObjectE@Base 5.0.3
_ZTSN3Dtk4Core9DSettingsE@Base 5.0.3
_ZTSN3Dtk4Core9LogDeviceE@Base 5.0.3
_ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTSSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTSSt19_Sp_make_shared_tag@Base 5.0.3
_ZTSSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTSSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTVN3Dtk4Core12DFileWatcherE@Base 5.0.3
_ZTVN3Dtk4Core12FileAppenderE@Base 5.0.3
_ZTVN3Dtk4Core13DTrashManagerE@Base 5.0.3
_ZTVN3Dtk4Core14DObjectPrivateE@Base 5.0.3
_ZTVN3Dtk4Core14DSettingsGroupE@Base 5.0.3
_ZTVN3Dtk4Core14DTrashManager_E@Base 5.0.3
_ZTVN3Dtk4Core15ConsoleAppenderE@Base 5.0.3
_ZTVN3Dtk4Core15DSettingsOptionE@Base 5.0.3
_ZTVN3Dtk4Core15QSettingBackendE@Base 5.0.3
_ZTVN3Dtk4Core16AbstractAppenderE@Base 5.0.3
_ZTVN3Dtk4Core16DBaseFileWatcherE@Base 5.0.3
_ZTVN3Dtk4Core16DSettingsBackendE@Base 5.0.3
_ZTVN3Dtk4Core16GSettingsBackendE@Base 5.0.3
_ZTVN3Dtk4Core18DDiskSizeFormatterE@Base 5.0.3
_ZTVN3Dtk4Core18DFileSystemWatcherE@Base 5.0.3
_ZTVN3Dtk4Core18DTimeUnitFormatterE@Base 5.0.3
_ZTVN3Dtk4Core19DFileWatcherManagerE@Base 5.0.3
_ZTVN3Dtk4Core19DFileWatcherPrivateE@Base 5.0.3
_ZTVN3Dtk4Core19RollingFileAppenderE@Base 5.0.3
_ZTVN3Dtk4Core20DTrashManagerPrivateE@Base 5.0.3
_ZTVN3Dtk4Core22AbstractStringAppenderE@Base 5.0.3
_ZTVN3Dtk4Core22DAbstractUnitFormatterE@Base 5.0.3
_ZTVN3Dtk4Core23DBaseFileWatcherPrivateE@Base 5.0.3
_ZTVN3Dtk4Core25DFileSystemWatcherPrivateE@Base 5.0.3
_ZTVN3Dtk4Core26DFileWatcherManagerPrivateE@Base 5.0.3
_ZTVN3Dtk4Core5DUtil18DExportedInterfaceE@Base 5.0.3
_ZTVN3Dtk4Core5DUtil25DExportedInterfacePrivateE@Base 5.0.3
_ZTVN3Dtk4Core5DUtil31DExportedInterfaceDBusInterfaceE@Base 5.0.3
_ZTVN3Dtk4Core7DObjectE@Base 5.0.3
_ZTVN3Dtk4Core9DSettingsE@Base 5.0.3
_ZTVN3Dtk4Core9LogDeviceE@Base 5.0.3
_ZTVSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZTVSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE@Base 5.0.3
_ZThn16_N3Dtk4Core12DFileWatcherD0Ev@Base 5.0.3
_ZThn16_N3Dtk4Core12DFileWatcherD1Ev@Base 5.0.3
_ZThn16_N3Dtk4Core13DTrashManagerD0Ev@Base 5.0.3
_ZThn16_N3Dtk4Core13DTrashManagerD1Ev@Base 5.0.3
_ZThn16_N3Dtk4Core14DTrashManager_D0Ev@Base 5.0.3
_ZThn16_N3Dtk4Core14DTrashManager_D1Ev@Base 5.0.3
_ZThn16_N3Dtk4Core16DBaseFileWatcherD0Ev@Base 5.0.3
_ZThn16_N3Dtk4Core16DBaseFileWatcherD1Ev@Base 5.0.3
_ZThn16_N3Dtk4Core18DFileSystemWatcherD0Ev@Base 5.0.3
_ZThn16_N3Dtk4Core18DFileSystemWatcherD1Ev@Base 5.0.3
_ZThn16_N3Dtk4Core19DFileWatcherManagerD0Ev@Base 5.0.3
_ZThn16_N3Dtk4Core19DFileWatcherManagerD1Ev@Base 5.0.3
_ZThn16_N3Dtk4Core5DUtil18DExportedInterfaceD0Ev@Base 5.0.3
_ZThn16_N3Dtk4Core5DUtil18DExportedInterfaceD1Ev@Base 5.0.3
_ZZN3Dtk4Core11DLogManager8instanceEvE8instance@Base 5.0.3
_ZZN9QtPrivate15ConnectionTypesINS_4ListIJRK7QStringRK8QVariantEEELb1EE5typesEvE1t@Base 5.0.3
_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag@Base 5.0.3
dtkcore-5.5.23/doc/ 0000775 0000000 0000000 00000000000 14154026022 0014002 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/doc/Specification.md 0000664 0000000 0000000 00000004641 14154026022 0017111 0 ustar 00root root 0000000 0000000 # Deepin Application Specification {#Specification}
Every application should keep the rule in this document.
## 1. Application Information
Application should set the property Organization-name and Application-name.
Organization/Application name can contains alphabet, number and other visible ASCII code, BUT space MUST NOT appear in the name. And we do not approve
of no-ASCII code character in the Organization/Application name
Application can stay Organization-name empty, but it should always set an Application-name.
## 2. Standard Path
The log, configure and runtime cache of Application should store in specific path.
**If Organization-name is empty, "{Organization-name}/" would not appear in path.**
### 2.1 User Application Standard Path
As an application run for user session, the Standard path should be:
````bash
XGD_LOG_HOME_DEEPIN:
Where deepin-user-specific log should be written.
XGD_USER_HOME/.log
DAPP_CONFIG_HOME:
Where application-specific configurations should be written.
XDG_CONFIG_HOME/{Organization-name}/{Application-name}
DAPP_LOG_HOME:
Where application-specific log should be written.
XGD_LOG_HOME_DEEPIN/{Organization-name}/{Application-name}
DAPP_CACHE_HOME:
Where application-specific cache files should be written.
XGD_CACHE_HOME/{Organization-name}/{Application-name}
DAPP_DATA_HOME:
Where application-specific data files should be written.
$XDG_DATA_HOME/{Organization-name}/{Application-name}
````
Simple example:
The dde-dock is offcial application of deepin and the standard path will be:
````bash
DAPP_CONFIG_HOME: $HOME/.config/deepin/dde-dock
DAPP_LOG_HOME: $HOME/.log/deepin/dde-dock
DAPP_CACHE_HOME: $HOME/.cache/deepin/dde-dock
DAPP_DATA_HOME: $HOME/.local/share/deepin/dde-dock
````
### 2.2 System Application Standard Path
Application run as system daemon, or with user with no home directory should place it's file in this standard path:
````bash
DAPP_CONFIG_SYS:
/etc/{Organization-name}/{Application-name}
DAPP_LOG_SYS:
/var/log/{Organization-name}/{Application-name}
DAPP_DATA_SYS:
/usr/share/{Organization-name}/{Application-name}
DAPP_CACHE_SYS:
/var/cache/{Organization-name}/{Application-name}
````
Refs:
[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.8.html)
[XDG Base Directory support](https://wiki.archlinux.org/index.php/XDG_Base_Directory_support)
dtkcore-5.5.23/doc/src/ 0000775 0000000 0000000 00000000000 14154026022 0014571 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/doc/src/dtkcore-index.qdoc 0000664 0000000 0000000 00000002165 14154026022 0020205 0 ustar 00root root 0000000 0000000 /*
* 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 dtkcore-index.html
\keyword DTK Core Reference Documentation
\title DTK Core Docs
Deepint Tool Kit (Dtk) is the base development tool of all C++/Qt Developer work on Deepin.
\list
\li \l {DTK Gui Docs}
\li \l {DTK Gui 模块}
\li \l {DTK Core 模块}
\li \l {DTK Widget Docs}
\li \l {DTK Widget 模块}
\endlist
*/
dtkcore-5.5.23/doc/src/dtkcore.qdoc 0000664 0000000 0000000 00000001725 14154026022 0017101 0 ustar 00root root 0000000 0000000 /*
* 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 dtkcore
\title DTK Core 模块
\brief Deepin Tool Kit Core Devel library.
DtkCore is base devel library of Deepin Qt/C++ applications.
*/
dtkcore-5.5.23/dtkcore.pro 0000664 0000000 0000000 00000000016 14154026022 0015407 0 ustar 00root root 0000000 0000000 load(dtk_lib)
dtkcore-5.5.23/examples/ 0000775 0000000 0000000 00000000000 14154026022 0015053 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/examples/dasync-example/ 0000775 0000000 0000000 00000000000 14154026022 0017765 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/examples/dasync-example/dasync-example.pro 0000664 0000000 0000000 00000003341 14154026022 0023422 0 ustar 00root root 0000000 0000000 ######################################################################
# Automatically generated by qmake (3.1) Thu Aug 19 09:48:31 2021
######################################################################
TEMPLATE = app
TARGET = thread_util
INCLUDEPATH += .
QT+= core widgets testlib
CONFIG += c++11
# The following define makes your compiler warn you if you use any
# feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
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
}
LIBS += -pthread
QMAKE_CXXFLAGS += -pthread
#QMAKE_CXXFLAGS_RELEASE += -fvisibility=hidden
#DEFINES += LIBDTKCORE_LIBRARY
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
INCLUDEPATH += $$PWD/../../src
INCLUDEPATH += $$PWD/../../src/base
INCLUDEPATH += $$PWD/../../src/util
# Input
HEADERS += \
$${PWD}/../../src/dtkcore_global.h \
$${PWD}/../../src/util/dasync.h \
$${PWD}/../../src/util/dthreadutils.h
SOURCES += \
$${PWD}/../../src/util/dthreadutils.cpp \
main.cpp
dtkcore-5.5.23/examples/dasync-example/main.cpp 0000664 0000000 0000000 00000024517 14154026022 0021426 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2021 ~ 2021 UnionTech Technology Co., Ltd.
*
* Author: Wang Peng <993381@qq.com>
*
* Maintainer: Wang Peng
*
* 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 "util/dasync.h"
#include "util/dthreadutils.h"
#ifdef QT_DEBUG
#include
#endif
DCORE_USE_NAMESPACE
#define XLog() qDebug() << __LINE__ << " "
#define RUN_IN_SUB_THREAD 1
#define THREAD_BEGIN std::thread thread([&]{
#define THREAD_END }); thread.detach();
#if RUN_IN_SUB_THREAD
# define OPT_THREAD_BEGIN THREAD_BEGIN
# define OPT_THREAD_END THREAD_END
#else
# define OPT_THREAD_BEGIN
# define OPT_THREAD_END
#endif
#define TIMED_EXIT(second, loop) QTimer::singleShot(second * 1000, [&]{ loop.exit(); })
struct Configure
{
QObject *o = nullptr;
QWidget *w = nullptr;
} conf;
static Configure *config = &conf;
int main1(int argc, char *argv[]);
int main2(int argc, char *argv[]);
int main3(int argc, char *argv[]);
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
// 将以下所有新建的对象都托管给 w、o
config->w = new QWidget;
config->o = new QObject;
config->w->show();
main1(argc, argv);
main2(argc, argv);
main3(argc, argv);
QTimer::singleShot(1 * 1000, [&]{
config->w->deleteLater();
config->o->deleteLater();
});
QTimer::singleShot(2 * 1000, [&]{
qApp->exit(0);
});
qDebug() << "finished xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
return app.exec();
}
#pragma mark main1 ------------------------------------------------------------
// 这是一个最基础的示例程序
DAsync *testTask() {
auto task = new DAsync(config->o);
int i = 0;
while (i < 100) {
task->postData(i++);
}
task->post([](int arg) {
Q_ASSERT(!D_THREAD_IN_MAIN());
XLog() << "run in child thread: " << arg;
return arg * 2;
})->then([&](int arg) {
Q_ASSERT(D_THREAD_IN_MAIN());
XLog() << "run in main thread:" << arg;
})->start();
task->postData(i++);
return task;
}
void runTest()
{
OPT_THREAD_BEGIN
auto task = testTask();
// 删除前应该先等待所有的任务执行完或取消未执行的任务
// 主线程中只能用 isFinished 查询状态,用 cancelAll 取消之后的任务队列
// 其它子线程中(非 post、非 then 函数)中可以直接 waitForFinished 然后删除
// 也可以使用 task->setParent 去托管,自动释放
if (!D_THREAD_IN_MAIN()) {
task->waitForFinished(false);
// task->deleteLater();
}
OPT_THREAD_END
}
int main1(int argc, char *argv[]) {
QEventLoop loop;
TIMED_EXIT(3, loop);
XLog() << "in main thread: " << pthread_self();
// DAsync 依赖事件循环,不能被阻塞,比如 thread.join 就不行
// 运行在主线程中和运行在子线程中应该有一样的结果才对
OPT_THREAD_BEGIN
runTest();
OPT_THREAD_END
return loop.exec();
}
#pragma mark main2 ------------------------------------------------------------
int main2(int argc, char *argv[]) {
QEventLoop loop;
TIMED_EXIT(3, loop);
OPT_THREAD_BEGIN
QWidget *w = DThreadUtil::runInMainThread([&](){
QWidget *w = new QWidget(config->w);
w->setBackgroundRole(QPalette::HighlightedText);
w->show();
return w;
});
// w->show();
OPT_THREAD_END
return loop.exec();
}
#pragma mark main3 ------------------------------------------------------------
int test1();
int test2();
int test3();
int test4();
int test5();
int test6();
int test7();
int test8();
int main3(int argc, char *argv[]) {
std::clog << "in main thread: " << pthread_self() << std::endl;
// 示例 1,输入输出都是基本类型
test1();
// 示例 2,输入基本类型,输出复合类型
test2();
// 示例 3,输入输出都是复合类型
test3();
// 示例 4,输入输出都是自定义类型的指针
test4();
// 示例 5, 异步执行一个输入复合类型、没有输出的一次性任务,执行结束后通知主线程
// 间歇性输入数据,要保证生产者消费者模型的正确性。
test5();
// 示例 6, 异步执行一个没有输入、输出参数的一次性任务,执行结束后通知在主线
test6();
// 示例 7, 异步运行一个没有输入参数的一次性任务,执行后在主线程处理结果
test7();
// 示例 8, 在子线程中异步创建一个 widget 并显示出来:
test8();
// std::thread thread([&]{ test8(); });
// thread.detach();
return 0;
}
int test1() {
QEventLoop loop;
TIMED_EXIT(2, loop);
// 加 static 防止函数执行结束后线程中继续 postData 访问已经释放的栈上变量
static auto task1 = new DAsync(config->o);
static int i = 0;
while (i < 100) {
task1->postData(i++);
}
task1->post([](int arg) {
XLog() << "async task: " << arg;
return arg * 2;
})->then([](int arg) {
XLog() << "get result: " << arg;
})->start();
return loop.exec();
}
int test2() {
QEventLoop loop;
static auto task2 = new DAsync(config->o);
static int i = 0;
static bool stopFlag = false;
// TIMED_EXIT(3, loop);
QTimer::singleShot(3 * 1000, [&]{
stopFlag = true;
loop.exit();
});
while(i < 100) {
task2->postData(i++);
}
task2->post([](int arg) -> QString {
XLog() << "async task: " << arg;
return QString::number(arg);
})->then([](QString arg) {
XLog() << "get result: " << arg;
})->start();
THREAD_BEGIN
while (!stopFlag && i < 220) {
XLog() << "post data: " << i;
task2->postData(i++);
usleep(200 * 1000);
}
THREAD_END
// task2->waitForFinished();
// task2->deleteLater();
return loop.exec();
}
int test3() {
QEventLoop loop;
TIMED_EXIT(3, loop);
static auto task3 = new DAsync(config->o);
static int i = 0;
while (i < 100) {
task3->postData(QString::number(i++));
}
task3->post([](QString arg) -> QString {
XLog() << "async task: " << arg;
return arg;
})->then([](QString arg) {
XLog() << "get result " << arg;
})->start();
// task3->waitForFinished();
// task3->deleteLater();
return loop.exec();
}
int test4() {
QEventLoop loop;
TIMED_EXIT(3, loop);
class Test : public QObject {
public:
Test(int in, QObject *parent = nullptr)
: QObject (parent)
, count (in)
{
}
int count = 0;
};
static auto task4 = new DAsync(config->o);
static int i = 0;
while (i < 100) {
task4->postData(new Test(i++, config->o));
}
task4->post([](Test *arg) -> Test * {
XLog() << "async task: " << arg->count;
return arg;
})->then([](Test *arg) {
XLog() << "get result " << arg->count;
})->start();
return loop.exec();
}
int test5() {
QEventLoop loop;
// TIMED_EXIT(3, loop);
static bool stopFlag = false;
QTimer::singleShot(3 * 1000, [&]{
stopFlag = true;
loop.exit();
});
static auto task5 = new DAsync(config->o);
static int i = 0;
while (i < 100) {
task5->postData(QString::number(i++));
}
task5->post([](QString arg) {
XLog() << "async task." << arg;
})->then([]() {
XLog() << "get void";
})->start();
OPT_THREAD_BEGIN
while (!stopFlag) {
usleep(200 * 1000);
task5->postData(QString::number(i++));
}
OPT_THREAD_END
return loop.exec();
}
int test6() {
QEventLoop loop;
TIMED_EXIT(1, loop);
static auto task6 = new DAsync(config->o);
task6->post([]() {
XLog() << "async task.";
})->then([]() {
XLog() << "get result.";
})->start();
// 如果只想在子线程执行一个任务,不需要主线程的任何处理,按照以下方式,
// 其实也只是只设置一个函数就可以了:
// task6->post([]() { XLog() << "async task."; });
// task6->startUp();
return loop.exec();
}
int test7() {
QEventLoop loop;
TIMED_EXIT(1, loop);
static auto task7 = new DAsync(config->o);
static int i = 0;
task7->post([&]() {
XLog() << "async task.";
return QString("%1").arg(i++);
})->then([](QString arg) {
XLog() << "get result " << arg;
})->start();
return loop.exec();
}
int test8() {
QEventLoop loop;
TIMED_EXIT(1, loop);
static auto task8 = new DAsync(config->o);
// 注意,任务是异步执行的,传进去的一定不能是栈区变量!
static int i = 0;
task8->post([&]() -> QString {
Q_ASSERT(!D_THREAD_IN_MAIN());
QWidget *w = DThreadUtil::runInMainThread([](){
Q_ASSERT(D_THREAD_IN_MAIN());
QWidget *w = new QWidget(config->w);
w->setBackgroundRole(QPalette::Text);
w->show();
return w;
});
// 在外面调用并不合适,虽然也能显示出来。比如 mac 上这么用就显示不出来
// w->setBackgroundRole(QPalette::Text);
// w->show();
XLog() << "async task." << QString("%1").arg(i++);
return QString("%1").arg(i++);
})->then([](QString str) {
XLog() << "get result " << str;
})->start();
return loop.exec();
}
dtkcore-5.5.23/examples/examples.pro 0000664 0000000 0000000 00000000111 14154026022 0017404 0 ustar 00root root 0000000 0000000 TEMPLATE = subdirs
SUBDIRS += expintf-example
SUBDIRS += dasync-example
dtkcore-5.5.23/examples/expintf-example/ 0000775 0000000 0000000 00000000000 14154026022 0020161 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/examples/expintf-example/expintf-example.pro 0000664 0000000 0000000 00000000661 14154026022 0024014 0 ustar 00root root 0000000 0000000 TEMPLATE = app
QT += dbus
SOURCES += \
$$PWD/main.cpp
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../src/release -ldtkcore
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../src/debug -ldtkcore
else:unix: LIBS += -L$$OUT_PWD/../../src -ldtkcore
INCLUDEPATH += $$PWD/../../src
INCLUDEPATH += $$PWD/../../src/base
CONFIG(debug, debug|release) {
unix:QMAKE_RPATHDIR += $$OUT_PWD/../../src
}
dtkcore-5.5.23/examples/expintf-example/main.cpp 0000664 0000000 0000000 00000004416 14154026022 0021616 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2017 ~ 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 "util/dexportedinterface.h"
#include
#include
#include
#include
#include
//#define ALTERNATE_USAGE
DCORE_USE_NAMESPACE
class CustomInterface : public DUtil::DExportedInterface
{
QVariant invoke(const QString &action, const QString ¶meters) const
{
QJsonDocument d = QJsonDocument::fromJson(parameters.toUtf8());
if (action == "pow") {
return QVariant(pow(d["a"].toDouble(), d["b"].toDouble()));
}
return QVariant();
}
};
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QDBusConnection::sessionBus().registerService("com.deepin.ExpIntfTest");
#ifndef ALTERNATE_USAGE
DUtil::DExportedInterface *ei = new DUtil::DExportedInterface();
ei->registerAction("quit", "quit the application", [&app](QString)->QVariant {
app.quit();
return QVariant();
});
ei->registerAction("answer", "answer to the ultimate question of life, the universe, and everything",
[](QString)->QVariant {return QVariant(42);});
ei->registerAction("sum", "returns the sum of two integers", [](QString p)->QVariant {
QJsonDocument d = QJsonDocument::fromJson(p.toUtf8());
return QVariant(d["a"].toInt() + d["b"].toInt());
});
#else
CustomInterface *cei = new CustomInterface();
cei->registerAction("pow", "raise a number to a power");
#endif
return app.exec();
}
dtkcore-5.5.23/rpm/ 0000775 0000000 0000000 00000000000 14154026022 0014033 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/rpm/dtkcore.spec 0000664 0000000 0000000 00000003711 14154026022 0016344 0 ustar 00root root 0000000 0000000 Name: dtkcore
Version: 5.5.18
Release: 1%{?dist}
Summary: Deepin tool kit core modules
License: LGPLv3+
URL: https://github.com/linuxdeepin/dtkcore
%if 0%{?fedora}
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
%else
Source0: %{name}-%{version}.orig.tar.xz
%endif
BuildRequires: dtkcommon-devel
BuildRequires: gcc-c++
BuildRequires: annobin
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(gsettings-qt)
BuildRequires: gtest-devel
# since f30
Obsoletes: deepin-tool-kit <= 0.3.3
Obsoletes: deepin-tool-kit-devel <= 0.3.3
Obsoletes: dtksettings <= 0.1.7
Obsoletes: dtksettings-devel <= 0.1.7
%description
Deepin tool kit core modules.
%package devel
Summary: Development package for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: dtkcommon-devel
Requires: qt5-qtbase-devel%{?_isa}
%description devel
Header files and libraries for %{name}.
%prep
%autosetup -p1
%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*
%dir %{_libexecdir}/dtk5/
%{_libexecdir}/dtk5/dtk-settings
%{_libexecdir}/dtk5/dtk-license.py
%{_libexecdir}/dtk5/dtk-translate.py
%{_libexecdir}/dtk5/deepin-os-release
%{_prefix}/bin/qdbusxml2cpp-fix
%files devel
%doc doc/Specification.md
%{_includedir}/libdtk-*/
%{_qt5_archdatadir}/mkspecs/modules/*.pri
%{_libdir}/cmake/DtkCore/
%{_libdir}/cmake/DtkCMake/
%{_libdir}/cmake/DtkTools/
%{_libdir}/pkgconfig/dtkcore.pc
%{_libdir}/lib%{name}.so
%changelog
* Thu Jun 11 2020 uoser - 5.2.2.3
- Update to 5.2.2.3
dtkcore-5.5.23/src/ 0000775 0000000 0000000 00000000000 14154026022 0014024 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/src/DConfig 0000664 0000000 0000000 00000000025 14154026022 0015255 0 ustar 00root root 0000000 0000000 #include "dconfig.h"
dtkcore-5.5.23/src/DConfigFile 0000664 0000000 0000000 00000000031 14154026022 0016052 0 ustar 00root root 0000000 0000000 #include "dconfigfile.h"
dtkcore-5.5.23/src/DDesktopEntry 0000664 0000000 0000000 00000000033 14154026022 0016502 0 ustar 00root root 0000000 0000000 #include "ddesktopentry.h"
dtkcore-5.5.23/src/DSecureString 0000664 0000000 0000000 00000000033 14154026022 0016464 0 ustar 00root root 0000000 0000000 #include "dsecurestring.h"
dtkcore-5.5.23/src/DSysInfo 0000664 0000000 0000000 00000000026 14154026022 0015443 0 ustar 00root root 0000000 0000000 #include "dsysinfo.h"
dtkcore-5.5.23/src/base/ 0000775 0000000 0000000 00000000000 14154026022 0014736 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/src/base/DObject 0000664 0000000 0000000 00000000025 14154026022 0016170 0 ustar 00root root 0000000 0000000 #include "dobject.h"
dtkcore-5.5.23/src/base/DObjectPrivate 0000664 0000000 0000000 00000000027 14154026022 0017525 0 ustar 00root root 0000000 0000000 #include "dobject_p.h"
dtkcore-5.5.23/src/base/DSingleton 0000664 0000000 0000000 00000000030 14154026022 0016720 0 ustar 00root root 0000000 0000000 #include "dsingleton.h"
dtkcore-5.5.23/src/base/base.pri 0000664 0000000 0000000 00000000523 14154026022 0016364 0 ustar 00root root 0000000 0000000 include($$PWD/private/private.pri)
INCLUDEPATH += $$PWD/base
INCLUDEPATH += $$PWD/private
HEADERS += \
$$PWD/dobject.h \
$$PWD/dsingleton.h
SOURCES += \
$$PWD/dobject.cpp
includes.files += $$PWD/*.h
includes.files += $$PWD/private/*.h
includes.files += \
$$PWD/DObject \
$$PWD/DObjectPrivate \
$$PWD/DSingleton
dtkcore-5.5.23/src/base/dobject.cpp 0000664 0000000 0000000 00000013772 14154026022 0017066 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2015 ~ 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 "dobject.h"
#include "private/dobject_p.h"
DCORE_BEGIN_NAMESPACE
DObjectPrivate::DObjectPrivate(DObject *qq)
: q_ptr(qq)
{
}
DObjectPrivate::~DObjectPrivate()
{
}
/*!
\headerfile
\inmodule dtkcore
\brief 一些宏的定义.
*/
/*!
\class Dtk::Core::DObject
\inmodule dtkcore
\brief deepin-tool-kit 中所有公开类的祖先类.
通过和 D_DECLARE_PRIVATE 、D_DECLARE_PUBLIC
等宏的配合方便派生类中实现 D-Point 结构。虽然 QObject 中已经有了这样的实现结构,但是没有
办法在不使用 Qt 私有模块的情况下,在 DTK 库中达到同样的目的。D-Point 结构由“公共接口类”
和“私有数据类”两部分组成,在 DTK 中,DObjectPrivate 是所有数据类的祖先类。在这种结构下,
只有 DObject 这个基类中定了一个指向于私有数据类的对象指针,派生类中不会也不应该再定义任何
成员变量,派生类中需要添加数据成员时,可以继承 DObjectPrivate,将新的成员变量放到私有类中
例子:
a.h
\code
class APrivate;
class A : public DObject
{
D_DECLARE_PRIVATE(A)
public:
A();
int test() const;
protected:
A(APrivate &dd, DObject *parent = nullptr);
};
\endcode
a.cpp
\code
class APrivate : public DObjectPrivate
{
public:
APrivate(A *qq)
: DObjectPrivate(qq)
{
}
D_DECLARE_PUBLIC(A)
// 此处添加数据成员
int data;
};
A::A()
: DObject(*new APrivate(this))
{
}
int test() const
{
D_D(A);
return d->data;
}
A::A(APrivate &dd, DObject *parent)
: DObject(dd, parent)
{
}
\endcode
一般来讲,DObject 只会用在 DTK 库中定义的类,对于使用 DTK 库的应用程序来说不用关心它的存在
\sa {https://wiki.qt.io/D-Pointer/zh}{类的 D-Point 结构}
*/
/*!
\brief 只有在不需要数据成员的派生类中才会使用
\a parent 父类指针
*/
DObject::DObject(DObject * /*parent = nullptr*/)
{
}
/*!
\brief 在派生类中比较常用的构造函数
\a dd 私有类对象
*/
DObject::DObject(DObjectPrivate &dd, DObject * /*parent = nullptr*/):
d_d_ptr(&dd)
{
}
DObject::~DObject()
{
}
/*!
\macro D_DECLARE_PRIVATE(Class)
\relates Dtk::Core::DObject
\brief 这个宏一定要放到类的私有区域,它定义了 d_func() 这个函数用于返回私有类的对象,
这个对象只应该在类的内部使用,另外将私有类声明为公开类的友元类。
\a Class 公开类的类名
\sa D_DECLARE_PUBLIC D_D D_DC
*/
/*!
\macro D_DECLARE_PUBLIC(Class)
\relates Dtk::Core::DObject
\brief 这个宏用于私有类中,它定义了 q_func() 这个函数用于返回公开类的对象,另外将公开类
声明为私有类的友元类。
\a Class 公开类的类名
\sa D_DECLARE_PRIVATE D_Q D_QC
*/
/*!
\macro D_D(Class)
\relates Dtk::Core::DObject
\brief 这个宏用于公开类中,它定义了一个名字为 d 的变量存储 d_func() 的返回值。用于在公开
类中需要访问私有类的数据成员的函数中。
\a Class 公开类的类名
\sa D_DECLARE_PRIVATE D_DC
*/
/*!
\macro D_DC(Class)
\relates Dtk::Core::DObject
\brief 同 D_D,用在公开类加了 const 修饰符的成员函数中。
\a Class 公开类的类名
\sa D_DECLARE_PRIVATE D_D
*/
/*!
\macro D_Q(Class)
\relates Dtk::Core::DObject
\brief 这个宏用于私有类中,它定义了一个名字为 q 的变量存储 q_func() 的返回值。用于在私有
类中需要调用公开类的成员函数时。
\a Class 公开类的类名
\sa D_DECLARE_PUBLIC D_QC
*/
/*!
\macro D_QC(Class)
\relates Dtk::Core::DObject
\brief 同 D_Q,用在私有类加了 const 修饰符的成员函数中。
\a Class 公开类的类名
\sa D_DECLARE_PUBLIC D_Q
*/
/*!
\macro D_PRIVATE_SLOT(Func)
\relates Dtk::Core::DObject
\brief 同 Q_PRIVATE_SLOT,用在继承了 QObject 的公开类中,在公开类中定一个槽函数,且函数
必须在私有类中有实现。用这个方式定义的槽函数无法被直接调用,只能用于 QObject::connect
使用 SIGNAL 和 SLOT 的方式连接信号,或者使用 QMetaObject::invokeMethod 调用。
一般来讲,这个槽函数应该只在类内部使用,外界不应该通过任何方式来调用它。
例子:
a.h
\code
class APrivate;
class A : public DObject
{
D_DECLARE_PRIVATE(A)
public:
A();
protected:
A(APrivate &dd, DObject *parent = nullptr);
private:
D_PRIVATE_SLOT(void _q_testSlot() const)
};
\endcode
a.cpp
\code
class APrivate : public DObjectPrivate
{
public:
D_DECLARE_PUBLIC(A)
APrivate(A *qq)
: DObjectPrivate(qq)
{
QTimer *timer = new QTimer();
QObject::connect(timer, SIGNAL(timeout()), qq, SLOT(_q_testSlot()));
timer->start(1000);
}
void _q_testSlot() const
{
qDebug() << "slot";
}
};
A::A()
: DObject(*new APrivate(this))
{
}
A::A(APrivate &dd, DObject *parent)
: DObject(dd, parent)
{
}
#include "moc_a.cpp"
\endcode
\a Func 槽函数的完整签名
\note 添加或更新私有槽之后需要重新手动调用 qmake
\sa D_DECLARE_PUBLIC D_Q
*/
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/base/dobject.h 0000664 0000000 0000000 00000002747 14154026022 0016533 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2015 ~ 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 DOBJECT_H
#define DOBJECT_H
#include
#include "dtkcore_global.h"
DCORE_BEGIN_NAMESPACE
#define D_DECLARE_PRIVATE(Class) Q_DECLARE_PRIVATE_D(qGetPtrHelper(d_d_ptr),Class)
#define D_DECLARE_PUBLIC(Class) Q_DECLARE_PUBLIC(Class)
#define D_D(Class) Q_D(Class)
#define D_Q(Class) Q_Q(Class)
#define D_DC(Class) Q_D(const Class)
#define D_QC(Class) Q_Q(const Class)
#define D_PRIVATE_SLOT(Func) Q_PRIVATE_SLOT(d_func(), Func)
class DObjectPrivate;
class LIBDTKCORESHARED_EXPORT DObject
{
protected:
DObject(DObject *parent = nullptr);
DObject(DObjectPrivate &dd, DObject *parent = nullptr);
virtual ~DObject();
QScopedPointer d_d_ptr;
Q_DISABLE_COPY(DObject)
D_DECLARE_PRIVATE(DObject)
};
DCORE_END_NAMESPACE
#endif // DOBJECT_H
dtkcore-5.5.23/src/base/dsingleton.h 0000664 0000000 0000000 00000003510 14154026022 0017254 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2016 ~ 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 DSINGLETON_H
#define DSINGLETON_H
#include "dtkcore_global.h"
DCORE_BEGIN_NAMESPACE
/*!
a simple singleton template for std c++ 11 or later.
example:
\code
class ExampleSingleton : public QObject, public Dtk::DSingleton
{
Q_OBJECT
friend class DSingleton;
};
\endcode
\note: for Qt, "public DSingleton" must be after QObject.
*/
/*!
通过c++11的特性实现的单例模板
使用示例:
```
class ExampleSingleton : public QObject, public Dtk::DSingleton
{
Q_OBJECT
friend class DSingleton;
};
```
\note 对于Qt程序 public DSingleton" 必须在卸载QObject后面出现。
*/
template
class LIBDTKCORESHARED_EXPORT DSingleton
{
public:
static inline T *instance()
{
static T *_instance = new T;
return _instance;
}
protected:
DSingleton(void) {}
~DSingleton(void) {}
DSingleton(const DSingleton &) {}
DSingleton &operator= (const DSingleton &) {}
};
DCORE_END_NAMESPACE
#endif // DSINGLETON_H
dtkcore-5.5.23/src/base/private/ 0000775 0000000 0000000 00000000000 14154026022 0016410 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/src/base/private/dobject_p.h 0000664 0000000 0000000 00000002032 14154026022 0020507 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2015 ~ 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 DOBJECT_P_H
#define DOBJECT_P_H
#include "dtkcore_global.h"
DCORE_BEGIN_NAMESPACE
class DObject;
class LIBDTKCORESHARED_EXPORT DObjectPrivate
{
public:
virtual ~DObjectPrivate();
protected:
DObjectPrivate(DObject *qq);
DObject *q_ptr;
Q_DECLARE_PUBLIC(DObject)
};
DCORE_END_NAMESPACE
#endif // DOBJECT_P_H
dtkcore-5.5.23/src/base/private/private.pri 0000664 0000000 0000000 00000000043 14154026022 0020573 0 ustar 00root root 0000000 0000000 HEADERS += \
$$PWD/dobject_p.h
dtkcore-5.5.23/src/dbus/ 0000775 0000000 0000000 00000000000 14154026022 0014761 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/src/dbus/org.desktopspec.ConfigManager.Manager.xml 0000664 0000000 0000000 00000002527 14154026022 0024673 0 ustar 00root root 0000000 0000000
'
dtkcore-5.5.23/src/dbus/org.desktopspec.ConfigManager.xml 0000664 0000000 0000000 00000000752 14154026022 0023320 0 ustar 00root root 0000000 0000000
dtkcore-5.5.23/src/dconfig.cpp 0000664 0000000 0000000 00000033134 14154026022 0016145 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 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 "dconfig.h"
#ifndef D_DISABLE_DCONFIG
#include "dconfigfile.h"
#ifndef D_DISABLE_DBUS_CONFIG
#include "configmanager_interface.h"
#include "manager_interface.h"
#endif
#else
#include
#endif
#include "dobject_p.h"
#include
#include
#include
// https://gitlabwh.uniontech.com/wuhan/se/deepin-specifications/-/issues/3
DCORE_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(cfLog)
inline static QString getAppId() {
// TODO: 应该使用更可靠的接口获取 appid
return QCoreApplication::applicationName();
}
/*!
\class DTK::Core::DConfigBackend
\inmodule dtkcore
\brief 配置后端的抽象接口.
所有DConfig使用的配置后端都继承此类,用户可以继承此类实现自己的配置后端.
*/
/*!
\fn bool load(const QString &/appid/) = 0
\brief 初始化后端
\a appid 管理的配置信息key值,默认为应用程序名称
*/
/*!
\fn bool isValid() const = 0
\sa DConfig::isValid().
*/
/*!
\fn QStringList keyList() const = 0
\sa DConfig::keyList()
*/
/*!
\fn QVariant value(const QString &key, const QVariant &fallback = QVariant()) const = 0
\sa DConfig::value()
*/
/*!
\fn void setValue(const QString &key, const QVariant &value) = 0
\sa DConfig::setValue()
*/
/*!
\fn QString name() const = 0
\breaf 后端配置的唯一标识
*/
DConfigBackend::~DConfigBackend()
{
}
class Q_DECL_HIDDEN DConfigPrivate : public DObjectPrivate
{
public:
explicit DConfigPrivate(DConfig *qq)
: DObjectPrivate(qq)
{
}
virtual ~DConfigPrivate() override;
DConfigBackend *getOrCreateBackend();
DConfigBackend *createBackendByEnv();
QString name;
QString subpath;
QScopedPointer backend;
D_DECLARE_PUBLIC(DConfig)
};
namespace {
#ifndef D_DISABLE_DCONFIG
class Q_DECL_HIDDEN FileBackend : public DConfigBackend
{
public:
explicit FileBackend(DConfigPrivate *o)
: owner(o)
{
}
virtual ~FileBackend() override;
virtual bool isValid() const override
{
return configFile && configFile->isValid();
}
virtual bool load(const QString &appid) override
{
if (configFile)
return true;
configFile.reset(new DConfigFile(appid,owner->name, owner->subpath));
configCache.reset(configFile->createUserCache(getuid()));
const QString &prefix = localPrefix();
return configFile->load(prefix) &&
configCache->load(prefix);
}
virtual QStringList keyList() const override
{
return configFile->meta()->keyList();
}
virtual QVariant value(const QString &key, const QVariant &fallback) const override
{
const QVariant &v = configFile->value(key, configCache.get());
return v.isValid() ? v : fallback;
}
virtual void setValue(const QString &key, const QVariant &value) override
{
if (configFile->setValue(key, value, getAppId(), configCache.get())) {
Q_EMIT owner->q_func()->valueChanged(key);
}
}
virtual QString name() const override
{
return QString("FileBackend");
}
private:
QString localPrefix() const
{
if (!envLocalPrefix.isEmpty()) {
return QString::fromLocal8Bit(envLocalPrefix);
}
return QString();
}
private:
QScopedPointer configFile;
QScopedPointer configCache;
DConfigPrivate* owner;
const QByteArray envLocalPrefix = qgetenv("DSG_DCONFIG_FILE_BACKEND_LOCAL_PREFIX");
};
FileBackend::~FileBackend()
{
const QString &prefix = localPrefix();
if (configCache) {
configCache->save(prefix);
configCache.reset();
}
if (configFile) {
configFile->save(prefix);
configFile.reset();
}
}
#ifndef D_DISABLE_DBUS_CONFIG
#define DSG_CONFIG "org.desktopspec.ConfigManager"
#define DSG_CONFIG_MANAGER "org.desktopspec.ConfigManager"
class Q_DECL_HIDDEN DBusBackend : public DConfigBackend
{
public:
explicit DBusBackend(DConfigPrivate* o):
owner(o)
{
}
virtual ~DBusBackend() override;
static bool isServiceRegistered()
{
return QDBusConnection::systemBus().interface()->isServiceRegistered(DSG_CONFIG);
}
virtual bool isValid() const override
{
return config && config->isValid();
}
/*!
\internal
初始化DBus连接,会先调用acquireManager动态获取一个配置连接,
再通过这个配置连接进行配置文件的访问.
*/
virtual bool load(const QString &appid) override
{
if (config)
return true;
qCDebug(cfLog, "Try acquire config manager object form DBus");
DSGConfig dsg_config(DSG_CONFIG, "/", QDBusConnection::systemBus());
QDBusPendingReply dbus_reply = dsg_config.acquireManager(appid, owner->name, owner->subpath);
const QDBusObjectPath dbus_path = dbus_reply.value();
if (dbus_reply.isError() || dbus_path.path().isEmpty()) {
qCWarning(cfLog, "Can't acquire config manager. error:\"%s\"", qPrintable(dbus_reply.error().message()));
return false;
} else {
qCWarning(cfLog(), "dbus path=\"%s\"", qPrintable(dbus_path.path()));
config.reset(new DSGConfigManager(DSG_CONFIG_MANAGER, dbus_path.path(),
QDBusConnection::systemBus(), owner->q_func()));
if (!config->isValid()) {
qCWarning(cfLog(), "Can't acquire config path=\"%s\"", qPrintable(dbus_path.path()));
config.reset();
return false;
} else {
QObject::connect(config.data(), &DSGConfigManager::valueChanged, owner->q_func(), &DConfig::valueChanged);
}
}
return true;
}
virtual QStringList keyList() const override
{
return config->keyList();
}
virtual QVariant value(const QString &key, const QVariant &fallback) const override
{
const QDBusVariant &dv = config->value(key);
const QVariant &v = dv.variant();
return v.isValid() ? v : fallback;
}
virtual void setValue(const QString &key, const QVariant &value) override
{
config->setValue(key, QDBusVariant(value));
}
virtual QString name() const override
{
return QString("DBusBackend");
}
private:
QScopedPointer config;
DConfigPrivate* owner;
};
DBusBackend::~DBusBackend()
{
if (config) {
config->release();
}
}
#endif //D_DISABLE_DBUS_CONFIG
#else
class Q_DECL_HIDDEN QSettingBackend : public DConfigBackend
{
public:
explicit QSettingBackend(DConfigPrivate* o):
owner(o)
{
}
virtual ~QSettingBackend() override;
virtual bool isValid() const override
{
return settings;
}
virtual bool load(const QString &appid) override
{
Q_UNUSED(appid);
if (settings)
return true;
settings = new QSettings(owner->name, QSettings::IniFormat, owner->q_func());
settings->beginGroup(owner->subpath);
return true;
}
virtual QStringList keyList() const override
{
return settings->childKeys();
}
virtual QVariant value(const QString &key, const QVariant &fallback) const override
{
return settings->value(key, fallback);
}
virtual void setValue(const QString &key, const QVariant &value) override
{
settings->setValue(key, value);
}
virtual QString name() const override
{
return QString("QSettingBackend");
}
private:
QSettings *settings = nullptr;
DConfigPrivate* owner;
};
QSettingBackend::~QSettingBackend()
{
}
#endif //D_DISABLE_DCONFIG
}
DConfigPrivate::~DConfigPrivate()
{
backend.reset();
}
/*!
\internal
\brief 创建一个配置后端
默认使用的配置后端会优先根据环境变量来选择配置中心的D-Bus接口还是文件配置后端接口。
若没有配置此环境变量,则根据是否有配置中心提供D-Bus服务来选择配置中心服务还是文件配置后端接口.
*/
DConfigBackend *DConfigPrivate::getOrCreateBackend()
{
if (backend) {
return backend.data();
}
if (auto backendEnv = createBackendByEnv()) {
backend.reset(backendEnv);
return backend.data();
}
#ifndef D_DISABLE_DCONFIG
#ifndef D_DISABLE_DBUS_CONFIG
if (DBusBackend::isServiceRegistered()) {
qCDebug(cfLog, "Fallback to DBus mode");
backend.reset(new DBusBackend(this));
} else {
qCDebug(cfLog, "Can't use DBus config service, fallback to DConfigFile mode");
backend.reset(new FileBackend(this));
}
#else
backend.reset(new FileBackend(this));
#endif //D_DISABLE_DBUS_CONFIG
#else
qCDebug(cfLog, "Fallback to QSettings mode");
backend.reset(new QSettingBackend(this));
#endif //D_DISABLE_DCONFIG
return backend.data();
}
/*!
\internal
\brief 创建一个配置后端
尝试根据环境变量来选择配置中心的D-Bus接口还是文件配置后端接口。
*/
DConfigBackend *DConfigPrivate::createBackendByEnv()
{
const QByteArray &envBackend = qgetenv("DSG_DCONFIG_BACKEND_TYPE");
if (!envBackend.isEmpty()) {
if (envBackend == "DBusBackend") {
#ifndef D_DISABLE_DCONFIG
#ifndef D_DISABLE_DBUS_CONFIG
if (DBusBackend::isServiceRegistered()) {
qCDebug(cfLog, "Fallback to DBus mode");
return new DBusBackend(this);
}
#endif //D_DISABLE_DBUS_CONFIG
#endif //D_DISABLE_DCONFIG
} else if (envBackend == "FileBackend") {
#ifndef D_DISABLE_DCONFIG
qCDebug(cfLog, "Fallback to DConfigFile mode");
return new FileBackend(this);
#endif //D_DISABLE_DCONFIG
} else {
#ifndef D_DISABLE_DCONFIG
#else
qCDebug(cfLog, "Fallback to QSettings mode");
return new QSettingBackend(this);
#endif //D_DISABLE_DCONFIG
}
}
return nullptr;
}
/*!
\class DTK::Core::DConfig
\inmodule dtkcore
\brief 配置策略提供的接口类
此接口规范定义了开发库所提供的关于配置文件读写的相关接口,
如果应用程序所使用的开发库实现了此规范,则程序应当优先使用开发库提供的接口。
*/
/*!
* \brief 构造配置策略提供的对象
* \a name 配置文件名
* \a subpath 配置文件对应的子目录
* \a parent 父对象
*/
DConfig::DConfig(const QString &name, const QString &subpath, QObject *parent)
: DConfig(nullptr, name, subpath, parent)
{
}
/*!
* \brief 使用自定义的配置策略后端构造对象
* \a name 配置文件名
* \a backend 调用者继承于DConfigBackend的配置策略后端
* \a subpath 配置文件对应的子目录
* \a parent 父对象
* \note 调用者只构造backend,由DConfig释放。
*/
DConfig::DConfig(DConfigBackend *backend, const QString &name, const QString &subpath, QObject *parent)
: QObject(parent)
, DObject(*new DConfigPrivate(this))
{
D_D(DConfig);
d->name = name;
d->subpath = subpath;
const auto &appid = getAppId();
Q_ASSERT(!appid.isEmpty());
qCDebug(cfLog, "Load config of appid=%s name=%s, subpath=%s",
qPrintable(appid), qPrintable(d->name), qPrintable(d->subpath));
if (backend) {
d->backend.reset(backend);
}
if (auto backend = d->getOrCreateBackend()) {
backend->load(appid);
}
}
/*!
* \brief DConfig::backendName
* \return 配置策略后端名称
* \note 调用者只能用DConfig访问DConfigBackend对象,所以不返回DConfigBackend对象。
*/
QString DConfig::backendName() const
{
D_DC(DConfig);
return d->backend->name();
}
/*!
* \brief 获得所有可用的配置项名称
* \return 配置项名称集合
*/
QStringList DConfig::keyList() const
{
D_DC(DConfig);
return d->backend->keyList();
}
/*!
* \brief 判断此后端是否可用
* \return
*/
bool DConfig::isValid() const
{
D_DC(DConfig);
return d->backend->isValid();
}
/*!
* \brief 根据配置项名称获得对应值
* \param key 配置项名称
* \param fallback 没有获取到配置项值后提供的默认值
* \return
*/
QVariant DConfig::value(const QString &key, const QVariant &fallback) const
{
D_DC(DConfig);
return d->backend->value(key, fallback);
}
/*!
* \brief 根据配置项名称设置其值
* \param 配置项名称
* \param 需要更新的值
*/
void DConfig::setValue(const QString &key, const QVariant &value)
{
D_D(DConfig);
d->backend->setValue(key, value);
}
/*!
* \brief 返回配置文件名称
* \return
*/
QString DConfig::name() const
{
D_DC(DConfig);
return d->name;
}
/*!
* \brief 返回配置文件对应的子目录
* \return
*/
QString DConfig::subpath() const
{
D_DC(DConfig);
return d->subpath;
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/dconfig.h 0000664 0000000 0000000 00000004321 14154026022 0015606 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 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 .
*/
#ifndef DCONFIG_H
#define DCONFIG_H
#include
#include
#include
#include
DCORE_BEGIN_NAMESPACE
class DConfigBackend {
public:
virtual ~DConfigBackend();
virtual bool isValid() const = 0;
virtual bool load(const QString &/*appid*/) = 0;
virtual QStringList keyList() const = 0;
virtual QVariant value(const QString &/*key*/, const QVariant &/*fallback*/) const = 0;
virtual void setValue(const QString &/*key*/, const QVariant &/*value*/) = 0;
virtual QString name() const {return QString("");}
};
class DConfigPrivate;
class LIBDTKCORESHARED_EXPORT DConfig : public QObject, public DObject
{
Q_OBJECT
D_DECLARE_PRIVATE(DConfig)
Q_PROPERTY(QStringList keyList READ keyList FINAL)
public:
explicit DConfig(const QString &name, const QString &subpath = QString(),
QObject *parent = nullptr);
explicit DConfig(DConfigBackend *backend, const QString &name, const QString &subpath = QString(),
QObject *parent = nullptr);
QString backendName() const;
QStringList keyList() const;
bool isValid() const;
QVariant value(const QString &key, const QVariant &fallback = QVariant()) const;
void setValue(const QString &key, const QVariant &value);
QString name() const;
QString subpath() const;
Q_SIGNALS:
void valueChanged(const QString &key);
};
DCORE_END_NAMESPACE
#endif // DCONFIG_H
dtkcore-5.5.23/src/dconfigfile.cpp 0000664 0000000 0000000 00000113457 14154026022 0017014 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 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 "dconfigfile.h"
#include "dobject_p.h"
#include "filesystem/dstandardpaths.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// https://gitlabwh.uniontech.com/wuhan/se/deepin-specifications/-/issues/3
DCORE_BEGIN_NAMESPACE
#ifndef QT_DEBUG
Q_LOGGING_CATEGORY(cfLog, "dtk.dsg.config" , QtInfoMsg);
#else
Q_LOGGING_CATEGORY(cfLog, "dtk.dsg.config");
#endif
#define FILE_SUFFIX QLatin1String(".json")
/*!
\internal
\brief 按子目录查找机制查找配置文件
在\a baseDir目录下,查找名称为\a name的文件,
若存在 \a subpath,则从\a subpath叶子目录逐级向上查找名称为\a name的文件,
若不存在此文件,则返回无效路径.
*/
inline QString getFile(const QString &baseDir, const QString &subpath, const QString &name,
bool canFallbackUp = true) {
qCDebug(cfLog, "load json file from base dir:\"%s\", subpath = \"%s\", file name =\"%s\".",
qPrintable(baseDir), qPrintable(subpath), qPrintable(name));
const QDir base_dir(baseDir);
QDir target_dir = base_dir;
if (!subpath.isEmpty())
target_dir.cd(subpath.mid(1));
do {
qCDebug(cfLog, "load json file from: \"%s\"", qPrintable(target_dir.path()));
if (QFile::exists(target_dir.filePath(name))) {
return target_dir.filePath(name);
}
if (base_dir == target_dir)
break;
} while (canFallbackUp && target_dir.cdUp());
return QString();
}
inline QFile *loadFile(const QString &baseDir, const QString &subpath, const QString &name,
bool canFallbackUp = true)
{
QString path = getFile(baseDir, subpath, name, canFallbackUp);
if (!path.isEmpty()) {
return new QFile(path);
}
return nullptr;
}
static QJsonDocument loadJsonFile(QIODevice *data)
{
if (!data->open(QIODevice::ReadOnly)) {
if (auto file = qobject_cast(data)) {
qCDebug(cfLog, "Falied on open file: \"%s\", error message: \"%s\"",
qPrintable(file->fileName()), qPrintable(file->errorString()));
}
return QJsonDocument();
}
QJsonParseError error;
auto document = QJsonDocument::fromJson(data->readAll(), &error);
data->close();
if (error.error != QJsonParseError::NoError) {
qCWarning(cfLog, "%s", qPrintable(error.errorString()));
return QJsonDocument();
}
return document;
}
static DConfigFile::Version parseVersion(const QJsonObject &obj) {
DConfigFile::Version version {0, 0};
const QString &verStr = obj[QLatin1String("version")].toString();
if (verStr.isEmpty()) {
return version;
}
const QStringList &items = verStr.split(QLatin1Char('.'));
if (items.size() != 2)
return version;
bool ok = false;
quint16 major = items.first().toUShort(&ok);
if (!ok)
return version;
quint16 minor = items.last().toUShort(&ok);
if (!ok)
return version;
version.major = major;
version.minor = minor;
return version;
}
#define MAGIC_META QLatin1String("dsg.config.meta")
#define MAGIC_OVERRIDE QLatin1String("dsg.config.override")
#define MAGIC_CACHE QLatin1String("dsg.config.cache")
static const uint GlobalUID = 0xFFFF;
inline static bool checkMagic(const QJsonObject &obj, QLatin1String request) {
return obj[QLatin1String("magic")].toString() == request;
}
inline static bool versionIsValid(const DConfigFile::Version &v) {
return v.major > 0 || v.minor > 0;
}
inline static bool checkVersion(const QJsonObject &obj, const DConfigFile::Version &request) {
const DConfigFile::Version &v = parseVersion(obj);
return versionIsValid(v) && v.major == request.major;
}
inline void overrideValue(QLatin1String subkey, const QJsonValue &from, QVariantHash &target) {
const QJsonValue &v = from[subkey];
if (!v.isUndefined())
target[subkey] = v.toVariant();
}
inline static QString getUserName(const uint uid) {
passwd *pw = getpwuid(uid);
return pw ? QString::fromLocal8Bit(pw->pw_name) : QString();
}
/*!
\enum DConfigFile::Flag
\inmodule dtkcore
\value NoOverride 存在此标记时,将表明则此配置项不可被覆盖(详见下述 override 机制)。
反之,不存在此标记时表明此配置项允许被覆盖,对于此类配置项,
如若其有界面设置入口,则当此项不可写时,应当隐藏或禁用界面的设置入口.
\value Global 当读写此类配置时,将忽略用户身份,无论程序使用哪个用户身份执行,读操作都将获取到同样的数据,
写操作将对所有用户都生效。但是,如果对应的配置存储目录不存在或无权限写入,则忽略此标志.
*/
/*!
\enum DConfigFile::Permissions
\inmodule dtkcore
\value ReadOnly 将配置项覆盖为只读,
\value ReadWrite 将配置项覆盖为可读可写.
*/
/*!
\enum DConfigFile::Visibility
\inmodule dtkcore
\value Private 仅限程序内部使用,
对外不可见。此类配置项完全由程序自己读写,可随意增删改写其含义,无需做兼容性考虑,
\value Public 外部程序可使用。
此类配置项一旦发布,在兼容性版本的升级中,要保障此配置项向下兼容,
简而言之,只允许在程序/库的大版本升级时才允许删除或修改此类配置项,
当配置项的 permissions、visibility、flags 任意一个属性被修改则认为此配置项被修改,
除此之外修改 value、name、description 属性时则不需要考虑兼容性.
*/
/*!
\class DConfigFile::Version
\inmodule dtkcore
\brief 版本信息
此文件的内容格式的版本。版本号使用两位数字描述,
首位数字不同的描述文件相互之间不兼容,第二位数字不同的描述文件需满足向下兼容。
读取此描述文件的程序要根据版本进行内容分析,当遇到不兼容的版本时,需要立即终止解析,忽略此文件,
并在程序日志中写入警告信息,如 “1.0” 和 “2.0” 版本之间不兼容,
如果解析程序最高只支持 1.0 版本,则遇到 2.0 版本的描述文件时应该终止解析,
但是如果遇到 1.1 版本,则可以继续执行。
写入此描述文件时,遇到不兼容的版本时,需要先清空当前内容再写入,每次写入皆需更新此字段。
*/
DConfigMeta::~DConfigMeta() {}
Dtk::Core::DConfigCache::~DConfigCache() {}
struct DConfigKey {
DConfigKey(const QString &aappId, const QString &afileName, const QString &asubpath)
: appId(aappId),
fileName(afileName),
subpath(asubpath)
{
}
explicit DConfigKey(const DConfigKey &src)
: DConfigKey(src.appId, src.fileName, src.subpath)
{
}
DConfigKey &operator = (const DConfigKey &src)
{
this->appId = src.appId;
this->fileName = src.fileName;
this->subpath = src.subpath;
return *this;
}
QString appId;
QString fileName;
QString subpath;
};
class Q_DECL_HIDDEN DConfigInfo {
public:
DConfigInfo()
{
}
DConfigInfo(const DConfigInfo &other)
{
this->values = other.values;
}
DConfigInfo operator = (const DConfigInfo &other)
{
this->values = other.values;
return *this;
}
inline static bool checkSerial(const int metaSerial, const int cacheSerial)
{
if (cacheSerial < 0)
return true;
if (metaSerial >= 0 && metaSerial == cacheSerial)
return true;
return false;
}
DConfigFile::Visibility visibility(const QString &key) const
{
DConfigFile::Visibility p = DConfigFile::Private;
const auto &tmp = values[key][QLatin1String("visibility")].toString();
if (tmp == QLatin1String("public"))
p = DConfigFile::Public;
return p;
}
DConfigFile::Permissions permissions(const QString &key) const
{
DConfigFile::Permissions p = DConfigFile::ReadOnly;
const auto &tmp = values[key][QLatin1String("permissions")].toString();
if (tmp == QLatin1String("readwrite"))
p = DConfigFile::ReadWrite;
return p;
}
DConfigFile::Flags flags(const QString &key) const
{
DConfigFile::Flags flags = {};
const auto &tmp = values[key][QLatin1String("flags")];
Q_FOREACH(const QString &flag, tmp.toStringList()) {
if (flag == QLatin1String("nooverride")) {
flags |= DConfigFile::NoOverride;
} else if (flag == QLatin1String("global")) {
flags |= DConfigFile::Global;
}
}
return flags;
}
QString displayName(const QString &key, const QLocale &locale) const
{
if (locale == QLocale::AnyLanguage)
return values[key][QLatin1String("name")].toString();
return values[key].value(QString("name[%1]")
.arg(locale.name())).toString();
}
QString description(const QString &key, const QLocale &locale) const
{
if (locale == QLocale::AnyLanguage)
return values[key][QLatin1String("description")].toString();
return values[key].value(QString("description[%1]")
.arg(locale.name())).toString();
}
inline QVariant value(const QString &key) const
{
return values[key][QLatin1String("value")];
}
inline int serial(const QString &key) const
{
bool status = false;
const int tmp = values[key][QLatin1String("serial")].toInt(&status);
if (status) {
return tmp;
}
return -1;
}
inline void setValue(const QString &key, const QVariant &value)
{
values[key]["value"] = value;
}
inline void setSerial(const QString &key, const int &value)
{
values[key]["serial"] = value;
}
inline void setTime(const QString &key, const QString &value)
{
values[key]["time"] = value;
}
inline void setUser(const QString &key, const uint &value)
{
values[key]["user"] = getUserName(value);
}
inline void setAppId(const QString &key, const QString &value)
{
values[key]["appid"] = value;
}
inline QStringList keyList() const
{
return values.keys();
}
inline void remove(const QString &key)
{
values.remove(key);
}
inline void update(const QString &key, const QVariantHash &value)
{
values[key] = value;
}
inline void updateValue(const QString &key, const QJsonValue &value)
{
overrideValue(key, "value", value);
}
inline void updateSerial(const QString &key, const QJsonValue &value)
{
overrideValue(key, "serial", value);
}
inline void updatePermissions(const QString &key, const QJsonValue &value)
{
overrideValue(key, "permissions", value);
}
QJsonObject content() const
{
QJsonObject contents;
for (auto i = values.constBegin(); i != values.constEnd(); ++i) {
contents[i.key()] = QJsonObject::fromVariantHash(i.value());
}
return contents;
}
private:
void overrideValue(const QString &key, const QString &subkey, const QJsonValue &from) {
const QJsonValue &v = from[subkey];
if (!v.isUndefined())
values[key][subkey] = v.toVariant();
}
QHash values;
};
/*!
\class DConfigMeta
\inmodule dtkcore
\brief 提供配置文件的原型和覆盖机制的访问接口
*/
/*!
\fn DConfigFile::Version DConfigMeta::version() const = 0;
\breaf 返回配置版本信息
\return
*/
/*!
\fn void DConfigMeta::setVersion(quint16 major, quint16 minor) = 0;
\brief 设置配置版本信息
\a major 主板本号
\a minor 次版本号
*/
/*!
\fn bool DConfigMeta::load(const QString &localPrefix = QString()) = 0;
\breaf 解析配置文件
\a localPrefix 为目录前缀
\return
*/
/*!
\fn bool DConfigMeta::load(QIODevice *meta, const QList &overrides) = 0;
\breaf 解析配置文件流
\a meta 为原型流
\a overrides 为覆盖机制查找的文件流
\return
*/
/*!
\fn QStringList DConfigMeta::keyList() const = 0;
\breaf 返回配置内容的所有配置项
\return
*/
/*!
\fn DConfigFile::Flags DConfigMeta::flags(const QString &key) const = 0;
\breaf 返回指定配置项的特性
\a key 配置项名称, NoOverride为此配置项不可被覆盖, Global为忽略用户身份
\return
*/
/*!
\fn DConfigFile::Permissions DConfigMeta::permissions(const QString &key) const = 0;
\breaf 返回指定配置项的权限
\a key 配置项名称
\return
*/
/*!
\fn DConfigFile::Visibility DConfigMeta::visibility(const QString &key) const = 0;
\breaf 返回指定配置项的可见性
\a key 配置项名称
\return
*/
/*!
\fn int DConfigMeta::serial(const QString &key) const = 0;
\breaf 返回配置项的单调递增值
\a key 配置项名称
\return -1为无效值,表明没有配置此项
*/
/*!
\fn QString DConfigMeta::displayName(const QString &key, const QLocale &locale) = 0;
\breaf 返回指定配置项的显示名
\a key 配置项名称
\a locale 为语言版本
\return
*/
/*!
\fn QString DConfigMeta::description(const QString &key, const QLocale &locale) = 0;
\breaf 返回指定配置项的描述信息
\a key 配置项名称
\a locale 为语言版本
\return
*/
/*!
\fn QString DConfigMeta::metaPath(const QString &localPrefix = QString(), bool *useAppId = nullptr) const = 0;
\breaf 返回描述文件的路径
\a localPrefix 目录的所有需要查找的覆盖机制目录
\return
*/
/*!
\fn QStringList DConfigMeta::allOverrideDirs(const bool useAppId, const QString &prefix = QString()) const = 0;
\breaf 获得前缀为\a prefix目录的所有需要查找的覆盖机制目录
\a userAppId 是否不使用通用目录
\return
*/
/*!
\fn QVariant DConfigMeta::value(const QString &key) const = 0;
\breaf meta初始值经过覆盖机制覆盖后的原始值
\a key 配置项名称
\return
*/
class Q_DECL_HIDDEN DConfigMetaImpl : public DConfigMeta {
// DConfigMeta interface
public:
explicit DConfigMetaImpl(const DConfigKey &configKey);
virtual ~DConfigMetaImpl() override;
inline virtual QStringList keyList() const override
{
return values.keyList();
}
inline virtual DConfigFile::Flags flags(const QString &key) const override
{
return values.flags(key);
}
inline virtual DConfigFile::Permissions permissions(const QString &key) const override
{
return values.permissions(key);
}
inline virtual DConfigFile::Visibility visibility(const QString &key) const override
{
return values.visibility(key);
}
inline virtual int serial(const QString &key) const override
{
return values.serial(key);
}
inline virtual QString description(const QString &key, const QLocale &locale) override
{
return values.description(key, locale);
}
virtual DConfigFile::Version version() const override
{
return m_version;
}
inline virtual void setVersion(quint16 major, quint16 minor) override
{
m_version.major = major;
m_version.minor = minor;
}
inline virtual QString displayName(const QString &key, const QLocale &locale) override
{
return values.displayName(key, locale);
}
inline virtual QVariant value(const QString &key) const override
{
return values.value(key);
}
inline QString applicationMetaDir(const QString &prefix, const bool useOptDir = false) const
{
if (useOptDir)
return QString("%1/opt/apps/%2/files/schemas/configs").arg(prefix, configKey.appId);
return QString("%1/usr/share/dsg/apps/%2/configs").arg(prefix, configKey.appId);
}
inline static QString genericMetaDir(const QString &prefix) {
return prefix + DStandardPaths::filePath(DStandardPaths::DSG::DataDir,
QString("configs"));
}
QString metaPath(const QString &localPrefix, bool *useAppId) const override
{
bool useAppIdForOverride = true;
QString path = getFile(applicationMetaDir(localPrefix), configKey.subpath, configKey.fileName + FILE_SUFFIX);
if (path.isEmpty())
path = getFile(applicationMetaDir(localPrefix, true), configKey.subpath, configKey.fileName + FILE_SUFFIX);
if (path.isEmpty()) {
useAppIdForOverride = false;
path = getFile(genericMetaDir(localPrefix), configKey.subpath, configKey.fileName + FILE_SUFFIX);
}
if (useAppId) {
*useAppId = useAppIdForOverride;
}
return path;
}
bool load(const QString &localPrefix) override
{
bool useAppIdForOverride = true;
QString path = metaPath(localPrefix, &useAppIdForOverride);
if (path.isEmpty()) {
qCWarning(cfLog, "Can't load meta file from local prefix: \"%s\"", qPrintable(localPrefix));
return false;
}
QScopedPointer meta(new QFile(path));
struct _ScopedPointer {
explicit _ScopedPointer(const QList &list)
: m_list(list) {}
~_ScopedPointer() {qDeleteAll(m_list);}
QList m_list;
};
_ScopedPointer overrides(loadOverrides(localPrefix, useAppIdForOverride));
return load(meta.data(), overrides.m_list);
}
bool load(QIODevice *meta, const QList &overrides) override
{
{
const QJsonDocument &doc = loadJsonFile(meta);
if (!doc.isObject())
return false;
// 检查标识
const QJsonObject &root = doc.object();
if (!checkMagic(root, MAGIC_META)) {
qCWarning(cfLog, "The meta magic does not match");
return false;
}
// 检查版本兼容性
const auto &v = parseVersion(root);
if (!versionIsValid(v) || v.major > DConfigFile::supportedVersion().major) {
qCWarning(cfLog, "The meta version number does not match, "
"the file major version=%i, supported major version<=%i",
v.major, DConfigFile::supportedVersion().major);
return false;
}
m_version = v;
const auto &contents = root[QLatin1String("contents")].toObject();
auto i = contents.constBegin();
// 初始化原始值
for (; i != contents.constEnd(); ++i) {
values.update(i.key(), i.value().toObject().toVariantHash());
}
}
// for override
Q_FOREACH(auto override, overrides) {
const QJsonDocument &doc = loadJsonFile(override);
if (doc.isObject()) {
const QJsonObject &root = doc.object();
if (!checkMagic(root, MAGIC_OVERRIDE)) {
if (auto file = static_cast(override)) {
qCWarning(cfLog, "The override magic does not match, file: \"%s\", error message: \"%s\"",
qPrintable(file->fileName()), qPrintable(file->errorString()));
} else {
qCWarning(cfLog, "The override magic does not match");
}
break; //TODO don't continue parse?
}
if (!checkVersion(root, m_version)) {
qCWarning(cfLog, "The override version number does not match");
break;
}
if (auto file = static_cast(override)) {
qCDebug(cfLog, "The override will be applied, file: \"%s\"", qPrintable(file->fileName()));
}
const auto &contents = root[QLatin1String("contents")].toObject();
auto i = contents.constBegin();
for (; i != contents.constEnd(); ++i) {
// 检查是否允许 override
if (values.flags(i.key()) & DConfigFile::NoOverride)
continue;
values.updateValue(i.key(), i.value());
values.updateSerial(i.key(), i.value());
values.updatePermissions(i.key(), i.value());
}
}
}
return true;
}
/*!
\internal
\brief 获得前缀为\a prefix目录的应用或公共库的所有覆盖机制目录,越后优先级越高
*/
inline QStringList overrideDirs(const QString & prefix, bool useAppId) const {
const QString &path2 = QString("%1/etc/dsg/configs/overrides/%2/%3")
.arg(prefix, useAppId ? configKey.appId : QString(), configKey.fileName);
const QString &path1 = QString("%1%2/configs/overrides/%3/%4")
.arg(prefix, DStandardPaths::path(DStandardPaths::DSG::DataDir),
useAppId ? configKey.appId : QString(), configKey.fileName);
// 在后面的优先级更高
return {path1, path2};
}
inline QStringList allOverrideDirs(const bool useAppId, const QString &prefix) const override
{
QStringList dirs;
// 只有当允许不使用 appid 时才能回退到通用目录
if (!useAppId) {
dirs << overrideDirs(prefix, false);
}
// 无论如何都先从带 appid 的目录下加载override文件
// 在列表后面的更优先
dirs << overrideDirs(prefix, true);
return dirs;
}
/*!
\internal
\brief 获得所有遵守覆盖机制的文件流
在override文件放置路径下按优先级查找覆盖文件,支持子目录查找机制,
使用自然排序(如“a2”在“a11”之前)规则按文件名进行排序
*/
QList loadOverrides(const QString &prefix, bool useAppId) const
{
auto filters = QDir::Files | QDir::NoDotAndDotDot | QDir::Readable;
const QStringList nameFilters {"*" + FILE_SUFFIX};
QStringList dirs = allOverrideDirs(useAppId, prefix);
QList list;
list.reserve(50);
QCollator collator(QLocale::English);
collator.setNumericMode(true);
collator.setIgnorePunctuation(true);
Q_FOREACH(const auto &dir, dirs) {
const QDir base_dir(QDir::cleanPath(dir));
if (!base_dir.exists())
continue;
QDir target_dir = base_dir;
target_dir.setFilter(filters);
target_dir.setNameFilters(nameFilters);
if (!configKey.subpath.isEmpty())
target_dir.cd(configKey.subpath.mid(1));
do {
qCDebug(cfLog, "load override file from: \"%s\"", qPrintable(target_dir.path()));
QDirIterator iterator(target_dir);
QList sublist;
sublist.reserve(50);
while(iterator.hasNext()) {
sublist.append(new QFile(iterator.next()));
}
// 从小到大排序
std::sort(sublist.begin(), sublist.end(), [&collator](QIODevice *f1, QIODevice *f2){
if (collator.compare(static_cast(f1)->fileName(),
static_cast(f2)->fileName()) < 0)
return true;
return false;
});
list = sublist + list;
if (base_dir.path() == target_dir.path())
break;
} while (target_dir.cdUp());
}
return list;
}
DConfigKey configKey;
DConfigInfo values;
DConfigFile::Version m_version = {0, 0};
char padding [4] = {};
};
DConfigMetaImpl::DConfigMetaImpl(const DConfigKey &configKey)
: DConfigMeta (),
configKey(configKey)
{
}
DConfigMetaImpl::~DConfigMetaImpl()
{
}
/*!
\class DConfigCache
\inmodule dtkcore
\brief 提供配置文件的用户和全局运行缓存访问接口
*/
/*
\fn bool DConfigCache::load(const QString &localPrefix = QString()) = 0;
\breaf 解析缓存配置文件
\return
*/
/*
\fn bool DConfigCache::save(const QString &localPrefix = QString(), QJsonDocument::JsonFormat format = QJsonDocument::Indented, bool sync = false) = 0;
\breaf 保存缓存的值到磁盘中
\a localPrefix 为目录前缀
\a format 保存格式
\a sync 是否立即刷新
\return
*/
/*
\fn bool DConfigCache::isGlobal() const = 0;
\brief 是否是全局缓存
\return
*/
/*
\fn void DConfigCache::resetMeta(DConfigMeta *meta) = 0;
\breaf 重置配置描述对象
\a meta 描述对象
\return
*/
/*
\fn void DConfigCache::remove(const QString &key) = 0;
\breaf 删除缓存中的配置项
\a key 配置项名称
\return
*/
/*
\fn QStringList DConfigCache::keyList() const = 0;
\breaf 返回配置内容的所有配置项
\return
*/
/*
\fn bool DConfigCache::setValue(const QString &key, const QVariant &value, const uint uid, const QString &appid) = 0;
\breaf 设置缓存中的值
\a key 配置项名称
\a value 需要设置的值
\a uid 设置时的用户id
\a appid 设置时的应用id
\return 为true时表示重新设置了新值,false表示没有设置
*/
/*
\fn QVariant DConfigCache::value(const QString &key) = 0;
\breaf 获取缓存中的值
\a key 配置项名称
\return
*/
/*
\fn int DConfigCache::serial(const QString &key) const = 0;
\breaf 返回配置项的单调递增值
\a key 配置项名称
\return -1为无效值,表明没有配置此项
*/
/*
\fn uint DConfigCache::uid() const = 0;
\breaf 用户标识,为全局缓存时,uid为非用户标识的特定值
\return
*/
class Q_DECL_HIDDEN DConfigCacheImpl : public DConfigCache {
public:
DConfigCacheImpl(const DConfigKey &configKey, const uint uid, bool global);
virtual ~DConfigCacheImpl() override;
// DConfigCache interface
public:
inline virtual int serial(const QString &key) const override
{
return values.serial(key);
}
inline virtual uint uid() const override
{
return userid;
}
inline virtual QStringList keyList() const override
{
return values.keyList();
}
inline QString applicationCacheDir(const QString &prefix) const {
const QString &homePath = DStandardPaths::homePath(userid);
if (homePath.isEmpty()) {
return QString();
}
const QString userHomeConfigDir = homePath + QStringLiteral("/.config");
return prefix + userHomeConfigDir + "/" + configKey.appId;
}
inline QString cacheDir(const QString &basePath) {
QDir dir(basePath + configKey.subpath);
return dir.filePath(configKey.fileName + FILE_SUFFIX);
}
inline QString globalCacheDir(const QString &prefix) const {
// TODO `DSG_APP_DATA` is not set and `appid` is not captured in `DStandardPaths::path`.
if (DStandardPaths::path(DStandardPaths::DSG::AppData).isEmpty())
return prefix + QString("/var/dsg/appdata/%1/configs").arg(configKey.appId);
return prefix + DStandardPaths::filePath(DStandardPaths::DSG::AppData,
QString("configs"));
}
QString getCacheDir(const QString &localPrefix = QString())
{
if (isGlobal()) {
return globalCacheDir(localPrefix);
} else {
return applicationCacheDir(localPrefix);
}
}
bool load(const QString &localPrefix = QString()) override;
bool isGlobal() const override
{
return global;
}
inline void remove(const QString &key) override
{
values.remove(key);
}
bool setValue(const QString &key, const QVariant &value, const int serial, const uint uid, const QString &appid) override
{
if (values.value(key) == value) {
return false;
}
values.setValue(key, value);
values.setSerial(key, serial);
values.setTime(key, QDateTime::currentDateTime().toString(Qt::ISODate));
values.setUser(key, uid);
values.setAppId(key, appid.isEmpty() ? configKey.appId : appid);
return true;
}
inline QVariant value(const QString &key) const override
{
return values.value(key);
}
bool save(const QString &localPrefix, QJsonDocument::JsonFormat format, bool sync) override;
DConfigKey configKey;
DConfigInfo values;
uint userid;
bool global;
char padding [3] = {};
};
DConfigCacheImpl::DConfigCacheImpl(const DConfigKey &configKey, const uint uid, bool global)
: DConfigCache(),
configKey(configKey),
userid(uid),
global(global)
{
}
DConfigCacheImpl::~DConfigCacheImpl()
{
}
bool DConfigCacheImpl::load(const QString &localPrefix)
{
// cache 文件要严格匹配 subpath
const QString &dir = getCacheDir(localPrefix);
if (dir.isEmpty()) {
return true;
}
QScopedPointer cache(loadFile(dir,
configKey.subpath,
configKey.fileName + FILE_SUFFIX,
false));
if (!cache) {
return true;
}
const QJsonDocument &doc = loadJsonFile(cache.data());
if (doc.isObject()) {
const QJsonObject &root = doc.object();
if (!checkMagic(root, MAGIC_CACHE))
return false;
if (!checkVersion(root, DConfigFile::supportedVersion()))
return false;
auto &&contents = root[QLatin1String("contents")].toObject();
auto i = contents.constBegin();
// 原样保存原始数据
for (; i != contents.constEnd(); ++i) {
values.update(i.key(), i.value().toObject().toVariantHash());
}
}
return true;
}
bool DConfigCacheImpl::save(const QString &localPrefix, QJsonDocument::JsonFormat format, bool sync)
{
const QString &dir = getCacheDir(localPrefix);
if (dir.isEmpty()) {
qCWarning(cfLog, "save Falied because home directory is not exist for the user[%d].", userid);
return false;
}
QString path = cacheDir(dir);
QFile cache(path);
if (!QFile::exists(QFileInfo(cache.fileName()).path())) {
QDir().mkpath(QFileInfo(cache.fileName()).path());
}
if (!cache.open(QIODevice::WriteOnly)) {
qCWarning(cfLog, "save Falied on open file: \"%s\", error message: \"%s\"",
qPrintable(cache.fileName()), qPrintable(cache.errorString()));
return false;
}
qCDebug(cfLog, "Save cache file \"%s\".", qPrintable(cache.fileName()));
QJsonObject root;
root[QLatin1String("magic")] = MAGIC_CACHE;
const DConfigFile::Version version = DConfigFile::supportedVersion();
root[QLatin1String("version")] = QString("%1.%2").arg(version.major)
.arg(version.minor);
root[QLatin1String("contents")] = values.content();
QJsonDocument doc;
doc.setObject(root);
const QByteArray &json = doc.toJson(format);
bool status = cache.write(json) == json.size();
if (status && sync) {
cache.flush();
}
return status;
}
class Q_DECL_HIDDEN DConfigFilePrivate : public DObjectPrivate {
public:
DConfigFilePrivate(DConfigFile *qq, const QString &appId,
const QString &name, const QString &subpath)
: DObjectPrivate(qq),
configKey(appId, name ,subpath),
configMeta(new DConfigMetaImpl(configKey))
{
}
DConfigFilePrivate(DConfigFile *qq, const DConfigKey &configKey)
: DObjectPrivate(qq),
configKey(configKey),
configMeta(new DConfigMetaImpl(configKey))
{
}
~DConfigFilePrivate() override;
bool load(const QString &localPrefix)
{
bool status = configMeta->load(localPrefix);
if (status) {
// for cache
status &= globalCache->load(localPrefix);
}
return status;
}
bool setValue(const QString &key, const QVariant &value,
DConfigCache *userCache, const QString &appid)
{
// 此处不要检查权限,在获取 value 时会检查
if (auto cache = getCache(key, userCache)) {
if (!value.isValid()) {
cache->remove(key);
return true;
} else {
return cache->setValue(key, value, configMeta->serial(key), cache->uid(), appid);
}
}
return false;
}
DConfigCache* getCache(const QString &key, DConfigCache *userCache) const
{
if(configMeta->flags(key).testFlag(DConfigFile::Global)) {
return globalCache;
}
return userCache;
}
QVariant value(const QString &key, DConfigCache *userCache) const
{
// 检查权限
if (configMeta->permissions(key) != DConfigFile::ReadOnly) {
if (auto cache = getCache(key, userCache)) {
if (DConfigInfo::checkSerial(configMeta->serial(key), cache->serial(key))) {
const QVariant &tmp = cache->value(key);
if (tmp.isValid())
return tmp;
}
}
}
return configMeta->value(key);
}
D_DECLARE_PUBLIC(DConfigFile)
private:
DConfigCacheImpl* globalCache;
DConfigKey configKey;
DConfigMeta *configMeta;
};
DConfigFilePrivate::~DConfigFilePrivate()
{
if (globalCache) {
delete globalCache;
globalCache = nullptr;
}
if (configMeta) {
delete configMeta;
configMeta = nullptr;
}
}
/*!
\class DTK::Core::DConfigFile
\inmodule dtkcore
\brief 规范配置文件读写的相关接口的配置文件实现
*/
/*!
\brief 支持的版本
\return
*/
constexpr DConfigFile::Version DConfigFile::supportedVersion()
{
return DConfigFile::Version{1, 0};
}
/*!
\brief 构造配置文件管理对象
\a appId 应用程序唯一标识
\a name 配置文件名
\a subpath 子目录
*/
DConfigFile::DConfigFile(const QString &appId, const QString &name, const QString &subpath)
: DObject(*new DConfigFilePrivate(this, appId, name, subpath))
{
Q_ASSERT(!name.isEmpty());
D_D(DConfigFile);
d->globalCache = new DConfigCacheImpl(d->configKey, GlobalUID, true);
}
DConfigFile::DConfigFile(const DConfigFile &other)
: DObject(*new DConfigFilePrivate(this, other.d_func()->configKey))
{
D_D(DConfigFile);
auto cache = new DConfigCacheImpl(d->configKey, GlobalUID, true);
cache->values = other.d_func()->globalCache->values;
d->globalCache = cache;
}
/*
\breaf 解析配置文件
\a localPrefix 为目录前缀
\return
*/
bool DConfigFile::load(const QString &localPrefix)
{
D_D(DConfigFile);
return d->load(localPrefix);
}
/*
\breaf 解析配置文件流
\a meta 为原型流
\a overrides 为覆盖机制查找的文件流
\return
*/
bool DConfigFile::load(QIODevice *meta, const QList &overrides)
{
return this->meta()->load(meta, overrides);
}
/*
\breaf 保存缓存的值到磁盘中
\a format 保存格式
\a sync 是否立即刷新
\return
*/
bool DConfigFile::save(const QString &localPrefix, QJsonDocument::JsonFormat format, bool sync) const
{
D_DC(DConfigFile);
bool ok = d->globalCache->save(localPrefix, format, sync);
return ok;
}
/*!
* \brief DConfigFile::value
* \param key 配置项名称
* \param uid 用户id,当key为全局项时,uid无效
* \return
*/
QVariant DConfigFile::value(const QString &key, DConfigCache *userCache) const
{
D_DC(DConfigFile);
return d->value(key, userCache);
}
/*!
\breaf 设置缓存中的值
\a key 配置项名称
\a value 需要设置的值
\a uid 设置时的用户id
\a appid 设置时的应用id
\return 为true时表示重新设置了新值,false表示没有设置
*/
bool DConfigFile::setValue(const QString &key, const QVariant &value, const QString &callerAppid, DConfigCache *userCache)
{
D_D(DConfigFile);
return d->setValue(key, value, userCache, callerAppid);
}
DConfigCache *DConfigFile::createUserCache(const uint uid)
{
D_D(DConfigFile);
return new DConfigCacheImpl(d->configKey, uid, false);
}
/*!
\brief 返回全局缓存
\return
*/
DConfigCache *DConfigFile::globalCache() const
{
D_DC(DConfigFile);
return d->globalCache;
}
/*!
\brief 返回原型对象
\return
*/
DConfigMeta *DConfigFile::meta()
{
D_D(DConfigFile);
return d->configMeta;
}
/*!
\brief 检测配置文件是否有效
\return
*/
bool DConfigFile::isValid() const
{
D_DC(DConfigFile);
return versionIsValid(d->configMeta->version());
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/dconfigfile.h 0000664 0000000 0000000 00000010761 14154026022 0016453 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 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 .
*/
#ifndef DCONFIGFILE_H
#define DCONFIGFILE_H
#include
#include
#include
#include
#include
#include
#include
#include
QT_BEGIN_NAMESPACE
class QIODevice;
QT_END_NAMESPACE
DCORE_BEGIN_NAMESPACE
class DConfigMeta;
class DConfigCache;
class DConfigFilePrivate;
class LIBDTKCORESHARED_EXPORT DConfigFile : public DObject{
D_DECLARE_PRIVATE(DConfigFile)
public:
enum Flag {
NoOverride = 1 << 0,
Global = 1 << 1
};
Q_DECLARE_FLAGS(Flags, Flag)
enum Permissions {
ReadOnly,
ReadWrite
};
enum Visibility {
Private,
Public
};
struct Version {
quint16 major;
quint16 minor;
};
static constexpr Version supportedVersion();
explicit DConfigFile(const QString &appId, const QString &name,
const QString &subpath = QString());
explicit DConfigFile(const DConfigFile &other);
bool load(const QString &localPrefix = QString());
bool load(QIODevice *meta, const QList &overrides);
bool save(const QString &localPrefix = QString(), QJsonDocument::JsonFormat format = QJsonDocument::Indented,
bool sync = false) const;
bool isValid() const;
QVariant value(const QString &key, DConfigCache *userCache = nullptr) const;
bool setValue(const QString &key, const QVariant &value, const QString &callerAppid,
DConfigCache *userCache = nullptr);
DConfigCache *createUserCache(const uint uid);
DConfigCache *globalCache() const;
DConfigMeta *meta();
protected:
friend QDebug operator<<(QDebug, const DConfigFile &);
};
class LIBDTKCORESHARED_EXPORT DConfigMeta {
public:
virtual ~DConfigMeta();
virtual DConfigFile::Version version() const = 0;
virtual void setVersion(quint16 major, quint16 minor) = 0;
virtual bool load(const QString &localPrefix = QString()) = 0;
virtual bool load(QIODevice *meta, const QList &overrides) = 0;
virtual QStringList keyList() const = 0;
virtual DConfigFile::Flags flags(const QString &key) const = 0;
virtual DConfigFile::Permissions permissions(const QString &key) const = 0;
virtual DConfigFile::Visibility visibility(const QString &key) const = 0;
virtual int serial(const QString &key) const = 0;
virtual QString displayName(const QString &key, const QLocale &locale) = 0;
virtual QString description(const QString &key, const QLocale &locale) = 0;
virtual QString metaPath(const QString &localPrefix = QString(), bool *useAppId = nullptr) const = 0;
virtual QStringList allOverrideDirs(const bool useAppId, const QString &prefix = QString()) const = 0;
virtual QVariant value(const QString &key) const = 0;
};
class LIBDTKCORESHARED_EXPORT DConfigCache {
public:
virtual ~DConfigCache();
virtual bool load(const QString &localPrefix = QString()) = 0;
virtual bool save(const QString &localPrefix = QString(),
QJsonDocument::JsonFormat format = QJsonDocument::Indented, bool sync = false) = 0;
virtual bool isGlobal() const = 0;
virtual void remove(const QString &key) = 0;
virtual QStringList keyList() const = 0;
virtual bool setValue(const QString &key, const QVariant &value, const int serial,
const uint uid, const QString &callerAppid) = 0;
virtual QVariant value(const QString &key) const = 0;
virtual int serial(const QString &key) const = 0;
virtual uint uid() const = 0;
};
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug, const DConfigFile &);
#endif
Q_DECLARE_OPERATORS_FOR_FLAGS(DConfigFile::Flags)
DCORE_END_NAMESPACE
#endif // DCONFIGFILE_H
dtkcore-5.5.23/src/ddesktopentry.cpp 0000664 0000000 0000000 00000102320 14154026022 0017425 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2019 Deepin Technology Co., Ltd.
* 2019 Gary Wang
*
* Author: Gary Wang
*
* Maintainer: Gary Wang
*
* 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 "ddesktopentry.h"
#include
#include
#include
#include
#include
#include
DCORE_BEGIN_NAMESPACE
enum { Space = 0x1, Special = 0x2 };
static const char charTraits[256] = {
// Space: '\t', '\n', '\r', ' '
// Special: '\n', '\r', ';', '=', '\\', '#'
// Please note that '"' is NOT a special character
0, 0, 0, 0, 0, 0, 0, 0, 0, Space, Space | Special, 0, 0, Space | Special, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Space, 0, 0, Special, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Special, 0, Special, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Special, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
bool readLineFromData(const QByteArray &data, int &dataPos, int &lineStart, int &lineLen, int &equalsPos)
{
int dataLen = data.length();
equalsPos = -1;
lineStart = dataPos;
while (lineStart < dataLen && (charTraits[uint(uchar(data.at(lineStart)))] & Space))
++lineStart;
int i = lineStart;
while (i < dataLen) {
while (!(charTraits[uint(uchar(data.at(i)))] & Special)) {
if (++i == dataLen)
goto break_out_of_outer_loop;
}
char ch = data.at(i++);
if (ch == '=') {
if (equalsPos == -1)
equalsPos = i - 1;
} else if (ch == '\n' || ch == '\r') {
if (i == lineStart + 1) {
++lineStart;
} else {
--i;
goto break_out_of_outer_loop;
}
} else if (ch == '\\') {
if (i < dataLen) {
char ch = data.at(i++);
if (i < dataLen) {
char ch2 = data.at(i);
// \n, \r, \r\n, and \n\r are legitimate line terminators in INI files
if ((ch == '\n' && ch2 == '\r') || (ch == '\r' && ch2 == '\n'))
++i;
}
}
} else if (ch == ';') {
// The multiple values should be separated by a semicolon and the value of the key
// may be optionally terminated by a semicolon. Trailing empty strings must always
// be terminated with a semicolon. Semicolons in these values need to be escaped
// using \; .
// Don't need to do anything here.
} else {
Q_ASSERT(ch == '#');
if (i == lineStart + 1) {
char ch;
while (i < dataLen && (((ch = data.at(i)) != '\n') && ch != '\r'))
++i;
lineStart = i;
}
}
}
break_out_of_outer_loop:
dataPos = i;
lineLen = i - lineStart;
return lineLen > 0;
}
QString &doEscape(QString& str, const QHash &repl)
{
// First we replace slash.
str.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
QHashIterator i(repl);
while (i.hasNext()) {
i.next();
if (i.key() != QLatin1Char('\\'))
str.replace(i.key(), QString::fromLatin1("\\\\%1").arg(i.value()));
}
return str;
}
QString &doUnescape(QString& str, const QHash &repl)
{
int n = 0;
while (1) {
n=str.indexOf(QLatin1String("\\"), n);
if (n < 0 || n > str.length() - 2)
break;
if (repl.contains(str.at(n+1))) {
str.replace(n, 2, repl.value(str.at(n+1)));
}
n++;
}
return str;
}
/*! \internal */
class DDesktopEntrySection
{
public:
DDesktopEntrySection() {}
QString name;
QMap valuesMap;
QByteArray unparsedDatas;
int sectionPos = 99;
inline operator QString() const {
return QLatin1String("DDesktopEntrySection(") + name + QLatin1String(")");
}
QByteArray sectionData() const {
if (unparsedDatas.isEmpty()) {
// construct data and return
QByteArray data;
data.append(QString("[%1]\n").arg(name));
QMap::const_iterator i;
for (i = valuesMap.begin(); i != valuesMap.end(); i++) {
data.append(QString("%1=%2\n").arg(i.key(), i.value()));
}
return data;
} else {
return unparsedDatas;
}
}
bool ensureSectionDataParsed() {
if (unparsedDatas.isEmpty()) return true;
valuesMap.clear();
// for readLineFromFileData()
int dataPos = 0;
int lineStart;
int lineLen;
int equalsPos;
while(readLineFromData(unparsedDatas, dataPos, lineStart, lineLen, equalsPos)) {
if (unparsedDatas.at(lineStart) == '[') continue; // section name already parsed
if (equalsPos != -1) {
QString key = unparsedDatas.mid(lineStart, equalsPos - lineStart).trimmed();
QString rawValue = unparsedDatas.mid(equalsPos + 1, lineStart + lineLen - equalsPos - 1).trimmed();
valuesMap[key] = rawValue;
}
}
unparsedDatas.clear();
return true;
}
bool contains(const QString &key) const {
const_cast(this)->ensureSectionDataParsed();
return valuesMap.contains(key);
}
QStringList allKeys() const {
const_cast(this)->ensureSectionDataParsed();
return valuesMap.keys();
}
QString get(const QString &key, QString &defaultValue) {
if (this->contains(key)) {
return valuesMap[key];
} else {
return defaultValue;
}
}
bool set(const QString &key, const QString &value) {
if (this->contains(key)) {
valuesMap.remove(key);
}
valuesMap[key] = value;
return true;
}
bool remove(const QString &key) {
if (this->contains(key)) {
valuesMap.remove(key);
return true;
}
return false;
}
};
typedef QMap SectionMap;
class DDesktopEntryPrivate
{
public:
DDesktopEntryPrivate(const QString &filePath, DDesktopEntry *qq);
~DDesktopEntryPrivate();
bool isWritable() const;
bool fuzzyLoad();
bool initSectionsFromData(const QByteArray &data);
void setStatus(const DDesktopEntry::Status &newStatus) const;
bool write(QIODevice &device) const;
int sectionPos(const QString §ionName) const;
bool contains(const QString §ionName, const QString &key) const;
QStringList keys(const QString §ionName) const;
bool get(const QString §ionName, const QString &key, QString *value);
bool set(const QString §ionName, const QString &key, const QString &value);
bool remove(const QString §ionName, const QString &key);
protected:
QString filePath;
QMutex fileMutex;
SectionMap sectionsMap;
mutable DDesktopEntry::Status status;
private:
bool __padding[4];
DDesktopEntry *q_ptr = nullptr;
Q_DECLARE_PUBLIC(DDesktopEntry)
};
DDesktopEntryPrivate::DDesktopEntryPrivate(const QString &filePath, DDesktopEntry *qq)
: filePath(filePath), q_ptr(qq)
{
fuzzyLoad();
}
DDesktopEntryPrivate::~DDesktopEntryPrivate()
{
}
bool DDesktopEntryPrivate::isWritable() const
{
QFileInfo fileInfo(filePath);
#ifndef QT_NO_TEMPORARYFILE
if (fileInfo.exists()) {
#endif
QFile file(filePath);
return file.open(QFile::ReadWrite);
#ifndef QT_NO_TEMPORARYFILE
} else {
// Create the directories to the file.
QDir dir(fileInfo.absolutePath());
if (!dir.exists()) {
if (!dir.mkpath(dir.absolutePath()))
return false;
}
// we use a temporary file to avoid race conditions
QTemporaryFile file(filePath);
return file.open();
}
#endif
}
bool DDesktopEntryPrivate::fuzzyLoad()
{
QFile file(filePath);
QFileInfo fileInfo(filePath);
if (fileInfo.exists() && !file.open(QFile::ReadOnly)) {
setStatus(DDesktopEntry::AccessError);
return false;
}
if (file.isReadable() && file.size() != 0) {
bool ok = false;
QByteArray data = file.readAll();
ok = initSectionsFromData(data);
if (!ok) {
setStatus(DDesktopEntry::FormatError);
return false;
}
}
return true;
}
bool DDesktopEntryPrivate::initSectionsFromData(const QByteArray &data)
{
sectionsMap.clear();
QString lastSectionName;
int lastSectionStart = 0;
bool formatOk = true;
int sectionIdx = 0;
// for readLineFromFileData()
int dataPos = 0;
int lineStart;
int lineLen;
int equalsPos;
auto commitSection = [=](const QString &name, int sectionStartPos, int sectionLength, int sectionIndex) {
DDesktopEntrySection lastSection;
lastSection.name = name;
lastSection.unparsedDatas = data.mid(sectionStartPos, sectionLength);
lastSection.sectionPos = sectionIndex;
sectionsMap[name] = lastSection;
};
// TODO: here we only need to find the section start, so things like equalsPos are useless here.
// maybe we can do some optimization here via adding extra argument to readLineFromData().
while(readLineFromData(data, dataPos, lineStart, lineLen, equalsPos)) {
// qDebug() << "CurrentLine:" << data.mid(lineStart, lineLen);
if (data.at(lineStart) == '[') {
// commit the last section we've ever read before we read the new one.
if (!lastSectionName.isEmpty()) {
commitSection(lastSectionName, lastSectionStart, lineStart - lastSectionStart, sectionIdx);
sectionIdx++;
}
// process section name line
QByteArray sectionName;
int idx = data.indexOf(']', lineStart);
if (idx == -1 || idx >= lineStart + lineLen) {
qWarning() << "Bad desktop file format while reading line:" << data.mid(lineStart, lineLen);
formatOk = false;
sectionName = data.mid(lineStart + 1, lineLen - 1).trimmed();
} else {
sectionName = data.mid(lineStart + 1, idx - lineStart - 1).trimmed();
}
lastSectionName = sectionName;
lastSectionStart = lineStart;
}
}
Q_ASSERT(lineStart == data.length());
if (!lastSectionName.isEmpty()) {
commitSection(lastSectionName, lastSectionStart, lineStart - lastSectionStart, sectionIdx);
}
return formatOk;
}
// Always keep the first meet error status. and allowed clear the status.
void DDesktopEntryPrivate::setStatus(const DDesktopEntry::Status &newStatus) const
{
if (newStatus == DDesktopEntry::NoError || this->status == DDesktopEntry::NoError) {
this->status = newStatus;
}
}
bool DDesktopEntryPrivate::write(QIODevice &device) const
{
Q_Q(const DDesktopEntry);
QStringList sortedKeys = q->allGroups(true);
for (const QString &key : sortedKeys) {
qint64 ret = device.write(sectionsMap[key].sectionData());
if (ret == -1) return false;
}
return true;
}
int DDesktopEntryPrivate::sectionPos(const QString §ionName) const
{
if (sectionsMap.contains(sectionName)) {
return sectionsMap[sectionName].sectionPos;
}
return -1;
}
bool DDesktopEntryPrivate::contains(const QString §ionName, const QString &key) const
{
if (sectionName.isNull() || key.isNull()) {
return false;
}
if (sectionsMap.contains(sectionName)) {
return sectionsMap[sectionName].contains(key);
}
return false;
}
QStringList DDesktopEntryPrivate::keys(const QString §ionName) const
{
if (sectionName.isNull()) {
return {};
}
if (sectionsMap.contains(sectionName)) {
return sectionsMap[sectionName].allKeys();
}
return {};
}
// return true if we found the value, and set the value to *value
bool DDesktopEntryPrivate::get(const QString §ionName, const QString &key, QString *value)
{
if (!this->contains(sectionName, key)) {
return false;
}
if (sectionsMap.contains(sectionName)) {
QString &&result = sectionsMap[sectionName].get(key, *value);
*value = result;
return true;
}
return false;
}
bool DDesktopEntryPrivate::set(const QString §ionName, const QString &key, const QString &value)
{
if (sectionsMap.contains(sectionName)) {
bool result = sectionsMap[sectionName].set(key, value);
return result;
} else {
// create new section.
DDesktopEntrySection newSection;
newSection.name = sectionName;
newSection.set(key, value);
sectionsMap[sectionName] = newSection;
return true;
}
return false;
}
bool DDesktopEntryPrivate::remove(const QString §ionName, const QString &key)
{
if (this->contains(sectionName, key)) {
return sectionsMap[sectionName].remove(key);
}
return false;
}
/*!
\class Dtk::Core::DDesktopEntry
\inmodule dtkcore
\brief Handling desktop entry files.
DDesktopEntry provide method for handling XDG desktop entry read and write. The interface
of this class is similar to QSettings.
For more details about the spec itself, please refer to:
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
*/
DDesktopEntry::DDesktopEntry(const QString &filePath) noexcept
: d_ptr(new DDesktopEntryPrivate(filePath, this))
{
}
DDesktopEntry::~DDesktopEntry()
{
}
/*!
\brief Write back data to the desktop entry file.
\return true if write success; otherwise returns false.
*/
bool DDesktopEntry::save() const
{
Q_D(const DDesktopEntry);
// write to file.
if (d->isWritable()) {
bool ok = false;
bool createFile = false;
QFileInfo fileInfo(d->filePath);
#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(temporaryfile)
QSaveFile sf(d->filePath);
sf.setDirectWriteFallback(true);
#else
QFile sf(d->filePath);
#endif
if (!sf.open(QIODevice::WriteOnly)) {
d->setStatus(DDesktopEntry::AccessError);
return false;
}
ok = d->write(sf);
#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(temporaryfile)
if (ok) {
ok = sf.commit();
}
#endif
if (ok) {
// If we have created the file, apply the file perms
if (createFile) {
QFile::Permissions perms = fileInfo.permissions() | QFile::ReadOwner | QFile::WriteOwner
| QFile::ReadGroup | QFile::ReadOther;
QFile(d->filePath).setPermissions(perms);
}
return true;
} else {
d->setStatus(DDesktopEntry::AccessError);
return false;
}
}
return false;
}
/*!
\brief Get data parse status
\return Returns a status code indicating the first error that was met by DDesktopEntry, or QSettings::NoError if no error occurred.
Be aware that DDesktopEntry delays performing some operations.
*/
DDesktopEntry::Status DDesktopEntry::status() const
{
Q_D(const DDesktopEntry);
return d->status;
}
/*!
\brief Get a list of all section keys inside the given \a section.
\return all available section keys.
*/
QStringList DDesktopEntry::keys(const QString §ion) const
{
Q_D(const DDesktopEntry);
if (section.isEmpty()) {
qWarning("DDesktopEntry::keys: Empty section name passed");
return {};
}
return d->keys(section);
}
/*!
\brief Get a list of all section groups inside the desktop entry.
If \a sorted is set to true, the returned result will keep the order as-is when reading the entry file.
\return all available section groups.
*/
QStringList DDesktopEntry::allGroups(bool sorted) const
{
Q_D(const DDesktopEntry);
if (!sorted) {
return d->sectionsMap.keys();
} else {
using StrIntPair = QPair;
QStringList keys = d->sectionsMap.keys();
QList result;
for (const QString & key : keys) {
result << StrIntPair(key, d->sectionPos(key));
}
std::sort(result.begin(), result.end(), [](const StrIntPair& a, const StrIntPair& b) -> bool {
return a.second < b.second;
});
keys.clear();
for (const StrIntPair& pair : result) {
keys << pair.first;
}
return keys;
}
}
/*!
\brief Check if the desktop entry file have the given \a section contains the given \a key
\return true if the desktop entry contains the \a key in \a section; otherwise returns false.
*/
bool DDesktopEntry::contains(const QString &key, const QString §ion) const
{
Q_D(const DDesktopEntry);
if (key.isEmpty() || section.isEmpty()) {
qWarning("DDesktopEntry::contains: Empty key or section passed");
return false;
}
return d->contains(section, key);
}
/*!
\brief Returns the localized string value of the "Name" key under "Desktop Entry" section.
It's equivalent to calling localizedValue("Name").
\return Returns the localized string value of the "Name" key under "Desktop Entry" section.
\sa localizedValue(), genericName(), ddeDisplayName()
*/
QString DDesktopEntry::name() const
{
return localizedValue(QStringLiteral("Name"));
}
/*!
\brief Returns the localized string value of the "GenericName" key under "Desktop Entry" section.
It's equivalent to calling localizedValue("GenericName"). It will NOT fallback to "Name" if "GenericName"
is not existed.
\return Returns the localized string value of the "GenericName" key under "Desktop Entry" section.
\sa localizedValue(), name(), ddeDisplayName()
*/
QString DDesktopEntry::genericName() const
{
return localizedValue(QStringLiteral("GenericName"));
}
/*!
\brief Display name specially for DDE applications.
This will check "X-Deepin-Vendor" and will return the localized string value of "GenericName" if
"X-Deepin-Vendor" is "deepin", or it will return the localized string value of "Name".
\return Returns the display name specially for DDE applications.
\sa localizedValue(), name(), genericName()
*/
QString DDesktopEntry::ddeDisplayName() const
{
QString deepinVendor = stringValue("X-Deepin-Vendor");
QString genericNameStr = genericName();
if (deepinVendor == QStringLiteral("deepin") && !genericNameStr.isEmpty()) {
return genericNameStr;
}
return name();
}
/*!
\brief Returns the localized string value of the "Comment" key under "Desktop Entry" section.
It's equivalent to calling localizedValue("Comment").
\return Returns the localized string value of the "Comment" key under "Desktop Entry" section.
\sa localizedValue()
*/
QString DDesktopEntry::comment() const
{
return localizedValue(QStringLiteral("Comment"));
}
/*!
\brief Returns the raw string value associated with the given \a key in \a section.
If the entry contains no item with the key, the function returns a constructed \a defaultValue.
\return Returns the raw string value associated with the given \a key in \a section.
\sa stringValue() localizedValue() stringListValue()
*/
QString DDesktopEntry::rawValue(const QString &key, const QString §ion, const QString &defaultValue) const
{
Q_D(const DDesktopEntry);
QString result = defaultValue;
if (key.isEmpty() || section.isEmpty()) {
qWarning("DDesktopEntry::value: Empty key or section passed");
return result;
}
const_cast(d)->get(section, key, &result); // FIXME: better way than const_cast?
return result;
}
/*!
\brief Returns the unescaped string value associated with the given \a key in \a section.
If the entry contains no item with the key, the function returns a constructed \a defaultValue.
\return Returns the unescaped string value associated with the given \a key in \a section.
\sa rawValue() localizedValue() stringListValue()
*/
QString DDesktopEntry::stringValue(const QString &key, const QString §ion, const QString &defaultValue) const
{
QString rawResult = rawValue(key, section, defaultValue);
rawResult = DDesktopEntry::unescape(rawResult);
return rawResult;
}
/*!
\brief Returns the localized string value associated with the given \a key and \a localeKey in \a section.
If the given \a localeKey can't be found, it will fallback to "C", if still cannot found, will fallback to the
key without localeKey.
If the entry contains no item with the key, the function returns a constructed \a defaultValue.
\return Returns the localized string value associated with the given \a key and \a localeKey in \a section.
\sa rawValue() stringValue() stringListValue()
*/
QString DDesktopEntry::localizedValue(const QString &key, const QString &localeKey, const QString §ion, const QString &defaultValue) const
{
Q_D(const DDesktopEntry);
QString result = defaultValue;
QString actualLocaleKey = QLatin1String("C");
if (key.isEmpty() || section.isEmpty()) {
qWarning("DDesktopEntry::localizedValue: Empty key or section passed");
return result;
}
QStringList possibleKeys;
// 此处添加 bcp47Name() 是为了兼容 desktop 文件中的语言长短名解析。
// 比如芬兰语,有 [fi] 和 [fi_FI] 两种情况,QLocale::name() 对应 fi_FI,QLocale::bcp47Name() 对应 fi。
if (!localeKey.isEmpty()) {
if (localeKey == "empty") {
possibleKeys << key;
} else if (localeKey == "default") {
possibleKeys << QString("%1[%2]").arg(key, QLocale().name());
possibleKeys << QString("%1[%2]").arg(key, QLocale().bcp47Name());
} else if (localeKey == "system") {
possibleKeys << QString("%1[%2]").arg(key, QLocale::system().name());
possibleKeys << QString("%1[%2]").arg(key, QLocale::system().bcp47Name());
} else {
possibleKeys << QString("%1[%2]").arg(key, localeKey);
}
}
if (!actualLocaleKey.isEmpty()) {
possibleKeys << QString("%1[%2]").arg(key, actualLocaleKey);
}
possibleKeys << QString("%1[%2]").arg(key, "C");
possibleKeys << key;
for (const QString &oneKey : possibleKeys) {
if (d->contains(section, oneKey)) {
const_cast(d)->get(section, oneKey, &result);
break;
}
}
return result;
}
/*!
\brief Returns the localized string value associated with the given \a key and \a locale in \a section.
If the given \a locale can't be found, it will fallback to "C", if still cannot found, will fallback to the
key without a locale key.
If the entry contains no item with the key, the function returns a default-constructed value.
\return Returns the localized string value associated with the given \a key and \a locale in \a section.
\sa rawValue() stringValue() stringListValue()
*/
QString DDesktopEntry::localizedValue(const QString &key, const QLocale &locale, const QString §ion, const QString &defaultValue) const
{
return localizedValue(key, locale.name(), section, defaultValue);
}
/*!
\brief Returns a list of strings associated with the given \a key in the given \a section.
If the entry contains no item with the key, the function returns a empty string list.
\return Returns a list of strings associated with the given \a key in the given \a section.
\sa rawValue() stringValue() localizedValue()
*/
QStringList DDesktopEntry::stringListValue(const QString &key, const QString §ion) const
{
Q_D(const DDesktopEntry);
QString value;
const_cast(d)->get(section, key, &value);
if (value.endsWith(';')) {
value = value.left(value.length() - 1);
}
QStringList&& strings = value.split(';');
QString combine;
QStringList result;
for (QString oneStr : strings) {
if (oneStr.endsWith('\\')) {
combine = combine + oneStr + ';';
continue;
}
if (!combine.isEmpty()) {
oneStr = combine + oneStr;
combine.clear();
}
result << DDesktopEntry::unescape(oneStr, true);
}
return result;
}
bool DDesktopEntry::setRawValue(const QString &value, const QString &key, const QString §ion)
{
Q_D(DDesktopEntry);
if (key.isEmpty() || section.isEmpty()) {
qWarning("DDesktopEntry::setRawValue: Empty key or section passed");
return false;
}
bool result = d->set(section, key, value);
return result;
}
bool DDesktopEntry::setStringValue(const QString &value, const QString &key, const QString §ion)
{
QString escapedValue = value;
DDesktopEntry::escape(escapedValue);
bool result = setRawValue(escapedValue, key, section);
return result;
}
bool DDesktopEntry::setLocalizedValue(const QString &value, const QString &localeKey, const QString &key, const QString §ion)
{
Q_D(DDesktopEntry);
if (key.isEmpty() || section.isEmpty()) {
qWarning("DDesktopEntry::setLocalizedValue: Empty key or section passed");
return false;
}
QString actualKey = localeKey.isEmpty() ? key : QString("%1[%2]").arg(key, localeKey);
bool result = d->set(section, actualKey, value);
return result;
}
bool DDesktopEntry::removeEntry(const QString &key, const QString §ion)
{
Q_D(DDesktopEntry);
if (key.isEmpty() || section.isEmpty()) {
qWarning("DDesktopEntry::setLocalizedValue: Empty key or section passed");
return false;
}
bool result = d->remove(section, key);
return result;
}
/************************************************
The escape sequences \s, \n, \t, \r, and \\ are supported for values
of type string and localestring, meaning ASCII space, newline, tab,
carriage return, and backslash, respectively.
************************************************/
QString &DDesktopEntry::escape(QString &str)
{
QHash repl;
repl.insert(QLatin1Char('\n'), QLatin1Char('n'));
repl.insert(QLatin1Char('\t'), QLatin1Char('t'));
repl.insert(QLatin1Char('\r'), QLatin1Char('r'));
return doEscape(str, repl);
}
/************************************************
Quoting must be done by enclosing the argument between double quotes and
escaping the
double quote character,
backtick character ("`"),
dollar sign ("$") and
backslash character ("\")
by preceding it with an additional backslash character.
Implementations must undo quoting before expanding field codes and before
passing the argument to the executable program.
Note that the general escape rule for values of type string states that the
backslash character can be escaped as ("\\") as well and that this escape
rule is applied before the quoting rule. As such, to unambiguously represent a
literal backslash character in a quoted argument in a desktop entry file
requires the use of four successive backslash characters ("\\\\").
Likewise, a literal dollar sign in a quoted argument in a desktop entry file
is unambiguously represented with ("\\$").
************************************************/
QString &DDesktopEntry::escapeExec(QString &str)
{
QHash repl;
// The parseCombinedArgString() splits the string by the space symbols,
// we temporarily replace them on the special characters.
// Replacement will reverse after the splitting.
repl.insert(QLatin1Char('"'), QLatin1Char('"')); // double quote,
repl.insert(QLatin1Char('\''), QLatin1Char('\'')); // single quote ("'"),
repl.insert(QLatin1Char('\\'), QLatin1Char('\\')); // backslash character ("\"),
repl.insert(QLatin1Char('$'), QLatin1Char('$')); // dollar sign ("$"),
return doEscape(str, repl);
}
/*
The escape sequences \s, \n, \t, \r, and \\ are supported for values of type string and localestring,
meaning ASCII space, newline, tab, carriage return, and backslash, respectively.
Some keys can have multiple values. In such a case, the value of the key is specified as a plural: for
example, string(s). The multiple values should be separated by a semicolon and the value of the key may
be optionally terminated by a semicolon. Trailing empty strings must always be terminated with a semicolon.
Semicolons in these values need to be escaped using \;.
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#value-types
*/
QString &DDesktopEntry::unescape(QString &str, bool unescapeSemicolons)
{
QHash repl;
repl.insert(QLatin1Char('\\'), QLatin1Char('\\'));
repl.insert(QLatin1Char('s'), QLatin1Char(' '));
repl.insert(QLatin1Char('n'), QLatin1Char('\n'));
repl.insert(QLatin1Char('t'), QLatin1Char('\t'));
repl.insert(QLatin1Char('r'), QLatin1Char('\r'));
if (unescapeSemicolons) {
repl.insert(QLatin1Char(';'), QLatin1Char(';'));
}
return doUnescape(str, repl);
}
/************************************************
Quoting must be done by enclosing the argument between double quotes and
escaping the
double quote character,
backtick character ("`"),
dollar sign ("$") and
backslash character ("\")
by preceding it with an additional backslash character.
Implementations must undo quoting before expanding field codes and before
passing the argument to the executable program.
Reserved characters are
space (" "),
tab,
newline,
double quote,
single quote ("'"),
backslash character ("\"),
greater-than sign (">"),
less-than sign ("<"),
tilde ("~"),
vertical bar ("|"),
ampersand ("&"),
semicolon (";"),
dollar sign ("$"),
asterisk ("*"),
question mark ("?"),
hash mark ("#"),
parenthesis ("(") and (")")
backtick character ("`").
Note that the general escape rule for values of type string states that the
backslash character can be escaped as ("\\") as well and that this escape
rule is applied before the quoting rule. As such, to unambiguously represent a
literal backslash character in a quoted argument in a desktop entry file
requires the use of four successive backslash characters ("\\\\").
Likewise, a literal dollar sign in a quoted argument in a desktop entry file
is unambiguously represented with ("\\$").
************************************************/
QString &DDesktopEntry::unescapeExec(QString &str)
{
unescape(str);
QHash repl;
// The parseCombinedArgString() splits the string by the space symbols,
// we temporarily replace them on the special characters.
// Replacement will reverse after the splitting.
repl.insert(QLatin1Char(' '), 01); // space
repl.insert(QLatin1Char('\t'), 02); // tab
repl.insert(QLatin1Char('\n'), 03); // newline,
repl.insert(QLatin1Char('"'), QLatin1Char('"')); // double quote,
repl.insert(QLatin1Char('\''), QLatin1Char('\'')); // single quote ("'"),
repl.insert(QLatin1Char('\\'), QLatin1Char('\\')); // backslash character ("\"),
repl.insert(QLatin1Char('>'), QLatin1Char('>')); // greater-than sign (">"),
repl.insert(QLatin1Char('<'), QLatin1Char('<')); // less-than sign ("<"),
repl.insert(QLatin1Char('~'), QLatin1Char('~')); // tilde ("~"),
repl.insert(QLatin1Char('|'), QLatin1Char('|')); // vertical bar ("|"),
repl.insert(QLatin1Char('&'), QLatin1Char('&')); // ampersand ("&"),
repl.insert(QLatin1Char(';'), QLatin1Char(';')); // semicolon (";"),
repl.insert(QLatin1Char('$'), QLatin1Char('$')); // dollar sign ("$"),
repl.insert(QLatin1Char('*'), QLatin1Char('*')); // asterisk ("*"),
repl.insert(QLatin1Char('?'), QLatin1Char('?')); // question mark ("?"),
repl.insert(QLatin1Char('#'), QLatin1Char('#')); // hash mark ("#"),
repl.insert(QLatin1Char('('), QLatin1Char('(')); // parenthesis ("(")
repl.insert(QLatin1Char(')'), QLatin1Char(')')); // parenthesis (")")
repl.insert(QLatin1Char('`'), QLatin1Char('`')); // backtick character ("`").
return doUnescape(str, repl);
}
bool DDesktopEntry::setStatus(const DDesktopEntry::Status &status)
{
Q_D(DDesktopEntry);
d->setStatus(status);
return true;
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/ddesktopentry.h 0000664 0000000 0000000 00000010213 14154026022 0017071 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2019 Deepin Technology Co., Ltd.
* 2019 Gary Wang
*
* Author: Gary Wang
*
* Maintainer: Gary Wang
*
* 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 .
*/
#pragma once
#include
#include
#include
#include
DCORE_BEGIN_NAMESPACE
class DDesktopEntryPrivate;
class LIBDTKCORESHARED_EXPORT DDesktopEntry
{
Q_GADGET
public:
enum EntryType {
Unknown = 0, //!< Unknown desktop file type. Maybe is invalid.
Application, //!< The file describes application.
Link, //!< The file describes URL.
Directory, //!< The file describes directory settings.
ServiceType, //!< KDE specific type. mentioned in the spec, so listed here too.
Service, //!< KDE specific type. mentioned in the spec, so listed here too.
FSDevice //!< KDE specific type. mentioned in the spec, so listed here too.
};
Q_ENUM(EntryType)
enum ValueType {
Unparsed = 0, // Maybe useless, consider remove it?
String,
Strings,
Boolean,
Numeric,
NotExisted = 99
};
Q_ENUM(ValueType)
enum Status {
NoError = 0, //!< No error occurred.
AccessError, //!< An access error occurred (e.g. trying to write to a read-only file).
FormatError //!< A format error occurred (e.g. loading a malformed desktop entry file).
};
Q_ENUM(Status)
explicit DDesktopEntry(const QString &filePath) noexcept;
~DDesktopEntry();
bool save() const;
Status status() const;
QStringList keys(const QString §ion = "Desktop Entry") const;
QStringList allGroups(bool sorted = false) const;
bool contains(const QString &key, const QString §ion = "Desktop Entry") const;
QString name() const;
QString genericName() const;
QString ddeDisplayName() const;
QString comment() const;
QString rawValue(const QString &key, const QString §ion = "Desktop Entry",
const QString &defaultValue = QString()) const;
QString stringValue(const QString &key, const QString §ion = "Desktop Entry",
const QString &defaultValue = QString()) const;
QString localizedValue(const QString &key, const QString &localeKey = "default",
const QString §ion = "Desktop Entry", const QString& defaultValue = QString()) const;
QString localizedValue(const QString &key, const QLocale &locale,
const QString §ion = "Desktop Entry", const QString& defaultValue = QString()) const;
QStringList stringListValue(const QString &key, const QString §ion = "Desktop Entry") const;
bool setRawValue(const QString &value, const QString &key, const QString& section = "Desktop Entry");
bool setStringValue(const QString &value, const QString &key, const QString& section = "Desktop Entry");
bool setLocalizedValue(const QString &value, const QString& localeKey,
const QString &key, const QString& section = "Desktop Entry");
bool removeEntry(const QString &key, const QString §ion = "Desktop Entry");
static QString &escape(QString &str);
static QString &escapeExec(QString &str);
static QString &unescape(QString &str, bool unescapeSemicolons = false);
static QString &unescapeExec(QString &str);
protected:
bool setStatus(const Status &status);
private:
QScopedPointer d_ptr;
Q_DECLARE_PRIVATE(DDesktopEntry)
};
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/dsecurestring.cpp 0000664 0000000 0000000 00000002035 14154026022 0017411 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2019 Deepin Technology Co., Ltd.
*
* Author: Gary Wang
*
* Maintainer: Gary Wang
*
* 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 "dsecurestring.h"
#include "dutil.h"
DCORE_BEGIN_NAMESPACE
DSecureString::DSecureString(const QString &other) noexcept
: QString(other)
{
}
DSecureString::~DSecureString()
{
DUtil::SecureErase(*this);
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/dsecurestring.h 0000664 0000000 0000000 00000002101 14154026022 0017050 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2019 Deepin Technology Co., Ltd.
*
* Author: Gary Wang
*
* Maintainer: Gary Wang
*
* 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 .
*/
#pragma once
#include
#include
DCORE_BEGIN_NAMESPACE
class LIBDTKCORESHARED_EXPORT DSecureString : public QString
{
public:
using QString::QString;
DSecureString(const QString &other) noexcept;
~DSecureString();
};
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/dsysinfo.cpp 0000664 0000000 0000000 00000073551 14154026022 0016401 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2017 ~ 2018 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 "dsysinfo.h"
#include "ddesktopentry.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef Q_OS_LINUX
#include
#include
#include
#endif
#ifndef OS_VERSION_TEST_FILE
#define OS_VERSION_FILE "/etc/os-version"
#else
#define OS_VERSION_FILE OS_VERSION_TEST_FILE
#endif
DCORE_BEGIN_NAMESPACE
class Q_DECL_HIDDEN DSysInfoPrivate
{
public:
DSysInfoPrivate();
#ifdef Q_OS_LINUX
void ensureDeepinInfo();
bool ensureOsVersion();
void ensureDistributionInfo();
bool splitA_BC_DMode();
#endif
void ensureReleaseInfo();
void ensureComputerInfo();
QMap parseInfoFile(QFile &file);
#ifdef Q_OS_LINUX
DSysInfo::DeepinType deepinType = DSysInfo::DeepinType(-1);
QMap deepinTypeMap; //Type Name with Language
QString deepinVersion;
QString deepinEdition;
QString deepinCopyright;
QString majorVersion;
QString minorVersion;
struct MinVersion {
enum Type {
A_BC_D, // 专业版
X_Y_Z, // 家庭版
A_B_C // 社区版
};
MinVersion()
: A(0)
, B(0)
, BC(0)
, C(0)
, D(0)
, X(0)
, Y(0)
, Z(0)
{
}
uint A, B, BC, C, D; // A-BC-D
uint X, Y, Z;
Type type;
};
struct OSBuild {
OSBuild():A(0), B(0), C(0), D(0), xyz(100){
}
uint A, B, C, D, E, xyz; // ABCDE.xyz
};
MinVersion minVersion;
OSBuild osBuild;
#endif
QScopedPointer distributionInfo;
DSysInfo::ProductType productType = DSysInfo::ProductType(-1);
QString prettyName;
QString productTypeString;
QString productVersion;
QString computerName;
QString cpuModelName;
qint64 memoryAvailableSize = -1;
qint64 memoryInstalledSize = -1;
qint64 diskSize = 0;
};
DSysInfoPrivate::DSysInfoPrivate()
{
}
#ifdef Q_OS_LINUX
void DSysInfoPrivate::ensureDistributionInfo()
{
if (distributionInfo)
return;
const QString distributionInfoFile(DSysInfo::distributionInfoPath());
// Generic DDE distribution info
distributionInfo.reset(new DDesktopEntry(distributionInfoFile));
}
bool DSysInfoPrivate::splitA_BC_DMode()
{
// A-BC-D
bool ok = false;
uint minv = minorVersion.toUInt(&ok);
if (ok) {
minVersion.D = minv % 10;
} else if (minorVersion.length() > 0) {
const QString D = minorVersion.right(1);
if (D.contains(QRegExp("[0-9A-Z]"))) {
// 0-9...A-Z
minVersion.D = 10 + static_cast(D.data()->toLatin1() - 'A');
} else {
qWarning() << "invalid minorVersion";
minVersion.D = 0;
}
}
uint minVer = minorVersion.left(3).toUInt();
minVersion.BC = minVer % 100;
minVer /= 100;
minVersion.A = minVer % 10;
minVersion.type = MinVersion::A_BC_D;
return ok;
}
void DSysInfoPrivate::ensureDeepinInfo()
{
if (static_cast(deepinType) >= 0)
return;
QFile file("/etc/deepin-version");
if (!file.open(QFile::ReadOnly)) {
deepinType = DSysInfo::UnknownDeepin;
return;
}
char buf[1024];
int buf_length = 0;
Q_FOREVER {
buf_length = file.readLine(buf, sizeof(buf));
if (buf_length < 0)
break;
const QByteArray line(buf, buf_length);
const QByteArrayList &list = line.split('=');
if (list.count() != 2) {
continue;
}
const auto key_value = qMakePair(list.first().trimmed(), list.last().trimmed());
if (key_value.first == "Version") {
deepinVersion = key_value.second;
} else if (line.startsWith("Type")) {
if (key_value.first == "Type") {
deepinTypeMap[QString()] = QString::fromLatin1(key_value.second);
} else if (key_value.first.at(4) == '[' && key_value.first.at(key_value.first.size() - 1) == ']') {
const QByteArray &language = key_value.first.mid(5, key_value.first.size() - 6);
if (!language.isEmpty()) {
deepinTypeMap[QString::fromLatin1(language)] = QString::fromUtf8(key_value.second);
}
}
} else if (key_value.first == "Edition") {
deepinEdition = QString::fromUtf8(key_value.second);
} else if (key_value.first == "Copyright") {
deepinCopyright = QString::fromUtf8(key_value.second);
}
if (!deepinTypeMap.isEmpty() && !deepinEdition.isEmpty() && !deepinCopyright.isEmpty()) {
break;
}
}
file.close();
const QString &deepin_type = deepinTypeMap[QString()];
if (deepin_type.isEmpty()) {
deepinType = DSysInfo::UnknownDeepin;
} else if (deepin_type == "Desktop") {
deepinType = DSysInfo::DeepinDesktop;
} else if (deepin_type == "Professional") {
deepinType = DSysInfo::DeepinProfessional;
} else if (deepin_type == "Server") {
deepinType = DSysInfo::DeepinServer;
} else if (deepin_type == "Personal") {
deepinType = DSysInfo::DeepinPersonal;
} else {
deepinType = DSysInfo::UnknownDeepin;
}
}
bool DSysInfoPrivate::ensureOsVersion()
{
#ifndef OS_VERSION_TEST_FILE // 测试时总是重新读取文件
if (osBuild.A > 0)
return true;
#endif
DDesktopEntry entry(OS_VERSION_FILE);
bool ok = false;
// 先获取版本信息
// ABCDE.xyz
QString osb = entry.stringValue("OsBuild", "Version");
QStringList osbs = osb.split(".");
Q_ASSERT(osbs.size() == 2 && osbs.value(0).size() == 5);
uint left = osbs.value(0).trimmed().toUInt(&ok);
Q_ASSERT(ok);
if (ok) {
osBuild.E = left % 10;
left /= 10;
osBuild.D = left % 10;
left /= 10;
osBuild.C = left % 10; // default C is 0
left /= 10;
osBuild.B = left % 10;
left /= 10;
osBuild.A = left % 10;
}
// xyz
osBuild.xyz = osbs.value(1).trimmed().toUInt(&ok);
majorVersion = entry.stringValue("MajorVersion", "Version");
minorVersion = entry.stringValue("MinorVersion", "Version");
switch (osBuild.D) {
case 7: {
// 家庭版使用“完整版本号编码-X.Y.Z”的形式
const QStringList &versionList = minorVersion.split('.');
if (versionList.isEmpty()) {
// 如果读取失败直接返回为空
qWarning() << "no minorVersion";
return false;
} else if (versionList.length() == 2) {
// Z为0
minVersion.X = versionList.first().toUInt();
minVersion.Y = versionList.last().toUInt();
minVersion.Z = 0;
} else if (versionList.length() == 3) {
// X.Y.Z都存在
minVersion.X = versionList.at(0).toUInt();
minVersion.Y = versionList.at(1).toUInt();
minVersion.Z = versionList.at(2).toUInt();
}
minVersion.type = MinVersion::X_Y_Z;
} break;
case 3: {
// 社区版使用“完整版本号编码-A.B.C”的形式
bool a_bc_dMode = false;
const QStringList &versionList = minorVersion.split('.');
if (versionList.isEmpty()) {
// 如果读取失败直接返回为空
qWarning() << "no minorVersion";
return false;
} else if (versionList.length() == 1) {
QString modeVersion = versionList.first();
if (modeVersion.length() == 2) {
//A.B.C模式且B C 为0
minVersion.A = modeVersion.toUInt();
minVersion.B = 0;
minVersion.C = 0;
} else {
// A_BC_D模式
splitA_BC_DMode();
a_bc_dMode = true;
}
} else if (versionList.length() == 2) {
// C为0
minVersion.A = versionList.first().toUInt();
minVersion.B = versionList.last().toUInt();
minVersion.C = 0;
} else if (versionList.length() == 3) {
// A.B.C都存在
minVersion.A = versionList.at(0).toUInt();
minVersion.B = versionList.at(1).toUInt();
minVersion.C = versionList.at(2).toUInt();
}
if (!a_bc_dMode)
minVersion.type = MinVersion::A_B_C;
} break;
default: {
// A-BC-D
ok = splitA_BC_DMode();
} break;
}
return ok;
}
static QString unquote(const QByteArray &value)
{
if (value.at(0) == '"' || value.at(0) == '\'') {
return QString::fromLatin1(value.mid(1, value.size() - 2));
}
return QString::fromLatin1(value);
}
static bool readEtcFile(DSysInfoPrivate *info, const char *filename,
const QByteArray &idKey, const QByteArray &versionKey, const QByteArray &prettyNameKey)
{
QFile file(QString::fromLatin1(filename));
if (!file.open(QIODevice::ReadOnly)) {
return false;
}
quint8 valid_data_count = 0;
char buf[1024];
while (valid_data_count < 3) {
int buf_length = file.readLine(buf, sizeof(buf));
if (buf_length < 0)
break;
const QByteArray line(buf, buf_length - 1);
if (info->productTypeString.isEmpty() && line.startsWith(idKey)) {
const QByteArray value(line.constData() + idKey.size());
info->productTypeString = unquote(value);
++valid_data_count;
continue;
}
if (info->prettyName.isEmpty() && line.startsWith(prettyNameKey)) {
const QByteArray value(line.constData() + prettyNameKey.size());
info->prettyName = unquote(value);
++valid_data_count;
continue;
}
if (info->productVersion.isEmpty() && line.startsWith(versionKey)) {
const QByteArray value(line.constData() + versionKey.size());
info->productVersion = unquote(value);
++valid_data_count;
continue;
}
}
file.close();
return valid_data_count != 0;
}
static bool readOsRelease(DSysInfoPrivate *info)
{
if (!readEtcFile(info, "/etc/os-release", "ID=", "VERSION_ID=", "PRETTY_NAME="))
return readEtcFile(info, "/usr/lib/os-release", "ID=", "VERSION_ID=", "PRETTY_NAME=");
return true;
}
static bool readLsbRelease(DSysInfoPrivate *info)
{
return readEtcFile(info, "/etc/lsb-release", "DISTRIB_ID=", "DISTRIB_RELEASE=", "DISTRIB_DESCRIPTION=");
}
#endif
void DSysInfoPrivate::ensureReleaseInfo()
{
if (productType >= 0) {
return;
}
#ifdef Q_OS_LINUX
readOsRelease(this);
readLsbRelease(this);
if (productTypeString.isEmpty()) {
productType = DSysInfo::UnknownType;
} else {
switch (productTypeString.at(0).unicode()) {
case 'd':
case 'D':
if (productTypeString.compare("deepin", Qt::CaseInsensitive) == 0) {
productType = DSysInfo::Deepin;
} else if (productTypeString.compare("debian", Qt::CaseInsensitive) == 0) {
productType = DSysInfo::Debian;
}
break;
case 'a':
case 'A':
if (productTypeString.compare("arch", Qt::CaseInsensitive) == 0)
productType = DSysInfo::ArchLinux;
break;
case 'c':
case 'C':
if (productTypeString.compare("centos", Qt::CaseInsensitive) == 0)
productType = DSysInfo::CentOS;
break;
case 'f':
case 'F':
if (productTypeString.compare("fedora", Qt::CaseInsensitive) == 0)
productType = DSysInfo::Fedora;
break;
case 'l':
case 'L':
if (productTypeString.compare("linuxmint", Qt::CaseInsensitive) == 0)
productType = DSysInfo::LinuxMint;
break;
case 'm':
case 'M':
if (productTypeString.compare("manjaro", Qt::CaseInsensitive) == 0)
productType = DSysInfo::Manjaro;
break;
case 'o':
case 'O':
if (productTypeString.compare("opensuse", Qt::CaseInsensitive) == 0)
productType = DSysInfo::openSUSE;
break;
case 's':
case 'S':
if (productTypeString.compare("sailfishos", Qt::CaseInsensitive) == 0)
productType = DSysInfo::SailfishOS;
break;
case 'u':
case 'U':
if (productTypeString.compare("ubuntu", Qt::CaseInsensitive) == 0) {
productType = DSysInfo::Ubuntu;
} else if (productTypeString.compare("uos", Qt::CaseInsensitive) == 0 || productTypeString.compare("UnionTech OS", Qt::CaseInsensitive) == 0) {
productType = DSysInfo::Uos;
}
break;
default:
productType = DSysInfo::UnknownType;
break;
}
}
#endif
}
void DSysInfoPrivate::ensureComputerInfo()
{
#ifdef Q_OS_LINUX
#endif
}
QMap DSysInfoPrivate::parseInfoFile(QFile &file)
{
char buf[1024];
qint64 lineLength = 0;
QMap map;
do {
lineLength = file.readLine(buf, sizeof(buf));
QString s(buf);
if (s.contains(':')) {
QStringList list = s.split(':');
if (list.size() == 2) {
map.insert(list.first().trimmed(), list.back().trimmed());
}
}
} while (lineLength >= 0);
return map;
}
Q_GLOBAL_STATIC(DSysInfoPrivate, siGlobal)
QString DSysInfo::operatingSystemName()
{
siGlobal->ensureReleaseInfo();
return siGlobal->prettyName;
}
#ifdef Q_OS_LINUX
/*!
\brief Check current distro is Deepin or not.
\note Uos will also return true.
*/
bool DSysInfo::isDeepin()
{
siGlobal->ensureReleaseInfo();
return productType() == Deepin || productType() == Uos;
}
bool DSysInfo::isDDE()
{
siGlobal->ensureDeepinInfo();
return siGlobal->deepinType != UnknownDeepin;
}
DSysInfo::DeepinType DSysInfo::deepinType()
{
siGlobal->ensureDeepinInfo();
return siGlobal->deepinType;
}
QString DSysInfo::deepinTypeDisplayName(const QLocale &locale)
{
siGlobal->ensureDeepinInfo();
return siGlobal->deepinTypeMap.value(locale.name(), siGlobal->deepinTypeMap.value(QString()));
}
QString DSysInfo::deepinVersion()
{
siGlobal->ensureDeepinInfo();
return siGlobal->deepinVersion;
}
QString DSysInfo::deepinEdition()
{
siGlobal->ensureDeepinInfo();
return siGlobal->deepinEdition;
}
QString DSysInfo::deepinCopyright()
{
siGlobal->ensureDeepinInfo();
return siGlobal->deepinCopyright;
}
/*!
\brief DSysInfo::osType 系统类型
显示系统类型【1:桌面】【2:服务器】【3:专用设备】
\note 根据 osBuild.B 判断
*/
DSysInfo::UosType DSysInfo::uosType()
{
siGlobal->ensureOsVersion();
UosType ost = UosTypeUnknown;
if ((siGlobal->osBuild.B > UosTypeUnknown && siGlobal->osBuild.B < UosTypeCount)) {
ost = static_cast(siGlobal->osBuild.B);
}
return ost;
}
/*!
\brief DSysInfo::osEditionType 版本类型
显示版本类型 专业版/个人版/社区版...
\note 根据 osBuild.B && osBuild.D
*/
DSysInfo::UosEdition DSysInfo::uosEditionType()
{
siGlobal->ensureOsVersion();
UosEdition ospt = UosEditionUnknown;
if (siGlobal->osBuild.B == UosDesktop) {
switch (siGlobal->osBuild.D) {
case 1:
return UosProfessional;
case 2:
case 7:
// 新版本家庭版(7)与旧版本个人版(2)同为Home 不修改旧有逻辑的情况下新增7保证对旧版的适配
return UosHome;
case 3:
return UosCommunity;
case 4:
return UosMilitary;
case 5:
return UosDeviceEdition;
case 6:
return UosEducation;
default:
break;
}
} else if (siGlobal->osBuild.B == UosServer) {
switch (siGlobal->osBuild.D) {
case 1:
return UosEnterprise;
case 2:
return UosEnterpriseC;
case 3:
return UosEuler;
case 4:
return UosMilitaryS;
case 5:
return UosDeviceEdition;
default:
break;
}
} else if (siGlobal->osBuild.B == UosDevice){
ospt = UosEnterprise; // os-version 1.4 if B==Device then et=Enterprise
}
return ospt;
}
/*!
\brief DSysInfo::osArch 架构信息(使用一个字节的二进制位,从低位到高位)
【0x8 sw64】【0x4 mips64】【0x2 arm64】【0x1 amd64】
*/
DSysInfo::UosArch DSysInfo::uosArch()
{
siGlobal->ensureOsVersion();
return static_cast(siGlobal->osBuild.E);
}
static QString getUosVersionValue(const QString &key, const QLocale &locale)
{
DDesktopEntry entry(OS_VERSION_FILE);
QString localKey = QString("%1[%2]").arg(key, locale.name());
return entry.stringValue(localKey, "Version", entry.stringValue(key, "Version"));
}
/*!
\brief DSysInfo::osProductTypeName 版本名称
ProductType[xx] 项对应的值, 如果找不到对应语言的默认使用 ProductType的值(Desktop/Server/Device)
\a locale 当前系统语言
*/
QString DSysInfo::uosProductTypeName(const QLocale &locale)
{
return getUosVersionValue("ProductType", locale);
}
/*!
\brief DSysInfo::osSystemName 版本名称
SystemName[xx] 项对应的值, 如果找不到对应语言的默认使用 SystemName 的值 Uniontech OS
\a locale 当前系统语言
*/
QString DSysInfo::uosSystemName(const QLocale &locale)
{
return getUosVersionValue("SystemName", locale);
}
/*!
\brief DSysInfo::osEditionName 版本名称
EditionName[xx] 项对应的值, 如果找不到对应语言的默认使用 EditionName 的值(Professional/Home/Community...)
\a locale 当前系统语言
*/
QString DSysInfo::uosEditionName(const QLocale &locale)
{
return getUosVersionValue("EditionName", locale);
}
/*!
\brief DSysInfo::spVersion 阶段版本名称
小版本号 A-BC-D 中 BC、 A.B.C 中的 B
返回 SP1-SPxx, 如果正式版返回空
X.Y.Z模式下暂不支持返回此版本号
\note minVersion.BC == 00:正式版本 minVersion.BC | minVersion.B == 01-99:SP1….SP99
*/
QString DSysInfo::spVersion()
{
siGlobal->ensureOsVersion();
switch (siGlobal->minVersion.type) {
case DSysInfoPrivate::MinVersion::A_BC_D: {
if (siGlobal->minVersion.BC > 0) {
return QString("SP%1").arg(siGlobal->minVersion.BC);
} else {
return QString(); // 00 正式版
}
}
case DSysInfoPrivate::MinVersion::A_B_C: {
if (siGlobal->minVersion.B > 0) {
return QStringLiteral("SP%1").arg(siGlobal->minVersion.B);
} else {
return {};
}
}
case DSysInfoPrivate::MinVersion::X_Y_Z:
qWarning() << "Getting the SP version in this mode is not supported.";
return {};
}
return QString();
}
/*!
\brief DSysInfo::udpateVersion 更新版本名称
小版本号 A-BC-D 中 D、A.B.C 模式中的 C
返回 update1… update9, 如果正式版返回空
X.Y.Z模式下暂不支持返回此版本号
\note minVersion.D == 0:正式版本 minVersion.D | minVersion.C == 1-9:update1… update9,updateA...updateZ
*/
QString DSysInfo::udpateVersion()
{
siGlobal->ensureOsVersion();
switch (siGlobal->minVersion.type) {
case DSysInfoPrivate::MinVersion::A_BC_D: {
if (siGlobal->minVersion.D > 0) {
uint uv = siGlobal->minVersion.D;
if (uv < 10) {
return QString("update%1").arg(uv);
} else if (uv < 36) {
return QString("update").append(QChar(uv - 10 + 'A'));
} else {
qWarning() << "invalid update versoin";
break;
}
} else {
break; // 0 正式版
}
}
case DSysInfoPrivate::MinVersion::A_B_C: {
if (siGlobal->minVersion.C > 0) {
return QStringLiteral("update%1").arg(siGlobal->minVersion.C);
} else {
break;
}
}
case DSysInfoPrivate::MinVersion::X_Y_Z:
qWarning() << "Getting the update version in this mode is not supported.";
break;
}
return {};
}
/*!
\brief DSysInfo::majorVersion 主版本号
主版本号 【20】【23】【25】【26】【29】【30】
\note 返回 MajorVersion 的值
*/
QString DSysInfo::majorVersion()
{
siGlobal->ensureOsVersion();
return siGlobal->majorVersion;
}
/*!
\brief DSysInfo::minorVersion 小版本号
*【ABCD】 ·[0-9]{4}
*【A.B.C】 或者【X.Y.Z】
\note 返回 MinorVersion 的值
*/
QString DSysInfo::minorVersion()
{
siGlobal->ensureOsVersion();
return siGlobal->minorVersion;
}
/*!
\brief DSysInfo::buildVersion 小版本号
系统镜像批次号,按时间顺序(不可回退)从100-999递增
\note 返回 osBuild.xyz 的值
*/
QString DSysInfo::buildVersion()
{
siGlobal->ensureOsVersion();
return QString::number(siGlobal->osBuild.xyz);
}
#endif
QString DSysInfo::deepinDistributionInfoPath()
{
return distributionInfoPath();
}
QString DSysInfo::distributionInfoPath()
{
#ifdef Q_OS_LINUX
return "/usr/share/deepin/distribution.info";
#else
return QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)).filePath("deepin-distribution.info");
#endif // Q_OS_LINUX
}
QString DSysInfo::distributionInfoSectionName(DSysInfo::OrgType type)
{
switch (type) {
case Distribution:
return "Distribution";
case Distributor:
return "Distributor";
case Manufacturer:
return "Manufacturer";
}
return QString();
}
/*!
\return the organization name.
use \a type as Distribution to get the name of current deepin distribution itself.
\sa deepinDistributionInfoPath()
*/
QString DSysInfo::distributionOrgName(DSysInfo::OrgType type, const QLocale &locale)
{
#ifdef Q_OS_LINUX
siGlobal->ensureDistributionInfo();
#endif
QString fallback = type == Distribution ? QStringLiteral("Deepin") : QString();
return siGlobal->distributionInfo->localizedValue("Name", locale, distributionInfoSectionName(type), fallback);
}
QString DSysInfo::deepinDistributorName()
{
return distributionOrgName(Distributor);
}
/*!
\return the organization website name and url.
use \a type as Distribution to get the name of current deepin distribution itself.
\sa deepinDistributionInfoPath()
*/
QPair DSysInfo::distributionOrgWebsite(DSysInfo::OrgType type)
{
#ifdef Q_OS_LINUX
siGlobal->ensureDistributionInfo();
#endif
QString fallbackSiteName = type == Distribution ? QStringLiteral("www.deepin.org") : QString();
QString fallbackSiteUrl = type == Distribution ? QStringLiteral("https://www.deepin.org") : QString();
return {
siGlobal->distributionInfo->stringValue("WebsiteName", distributionInfoSectionName(type), fallbackSiteName),
siGlobal->distributionInfo->stringValue("Website", distributionInfoSectionName(type), fallbackSiteUrl),
};
}
QPair DSysInfo::deepinDistributorWebsite()
{
return distributionOrgWebsite(Distributor);
}
/*!
\return the obtained organization logo path, or the given \a fallback one if there are no such logo.
use \a type as Distribution to get the logo of current deepin distribution itself.
\sa deepinDistributionInfoPath()
*/
QString DSysInfo::distributionOrgLogo(DSysInfo::OrgType orgType, DSysInfo::LogoType type, const QString &fallback)
{
DDesktopEntry distributionInfo(distributionInfoPath());
QString orgSectionName = distributionInfoSectionName(orgType);
switch (type) {
case Normal:
return distributionInfo.stringValue("Logo", orgSectionName, fallback);
case Light:
return distributionInfo.stringValue("LogoLight", orgSectionName, fallback);
case Symbolic:
return distributionInfo.stringValue("LogoSymbolic", orgSectionName, fallback);
case Transparent:
return distributionInfo.stringValue("LogoTransparent", orgSectionName, fallback);
}
return QString();
}
QString DSysInfo::deepinDistributorLogo(DSysInfo::LogoType type, const QString &fallback)
{
return distributionOrgLogo(Distributor, type, fallback);
}
DSysInfo::ProductType DSysInfo::productType()
{
siGlobal->ensureReleaseInfo();
return siGlobal->productType;
}
QString DSysInfo::productTypeString()
{
siGlobal->ensureReleaseInfo();
return siGlobal->productTypeString;
}
QString DSysInfo::productVersion()
{
siGlobal->ensureReleaseInfo();
return siGlobal->productVersion;
}
/*!
\brief Check if current edition is a community edition
Developer can use this way to check if we need enable or disable features
for community or enterprise edition.
Current rule:
- Professional, Server, Personal edition (DeepinType) will be treat as Enterprise edition.
- Uos (ProductType) will be treat as Enterprise edition.
\return true if it's on a community edition distro/installation
*/
bool DSysInfo::isCommunityEdition()
{
#ifdef Q_OS_LINUX
DeepinType type = deepinType();
QList enterpriseTypes {
DeepinProfessional, DeepinServer, DeepinPersonal
};
if (enterpriseTypes.contains(type)) {
return false;
}
if (productType() == Uos) {
return false;
}
#endif // Q_OS_LINUX
return true;
}
QString DSysInfo::computerName()
{
#ifdef Q_OS_LINUX
struct utsname u;
if (uname(&u) == 0)
siGlobal->computerName = QString::fromLatin1(u.nodename);
return siGlobal->computerName;
#endif
return QString();
}
QString DSysInfo::cpuModelName()
{
#ifdef Q_OS_LINUX
static QFile file("/proc/cpuinfo");
if (file.open(QFile::ReadOnly)) {
QMap map = siGlobal->parseInfoFile(file);
if (map.contains("Processor")) {
// arm-cpuinfo hw_kirin-cpuinfo
siGlobal->cpuModelName = map.value("Processor");
} else if (map.contains("model name")) {
// cpuinfo
siGlobal->cpuModelName = map.value("model name");
} else if (map.contains("cpu model")) {
// loonson3-cpuinfo sw-cpuinfo
siGlobal->cpuModelName = map.value("cpu model");
}
file.close();
}
return siGlobal->cpuModelName;
#endif
return QString();
}
/*!
\return the installed memory size
*/
qint64 DSysInfo::memoryInstalledSize()
{
#ifdef Q_OS_LINUX
// Getting Memory Installed Size
// TODO: way to not dept on lshw?
if (!QStandardPaths::findExecutable("lshw").isEmpty()) {
QProcess lshw;
lshw.start("lshw", {"-c", "memory", "-json", "-sanitize"}, QIODevice::ReadOnly);
if (!lshw.waitForFinished()) {
return -1;
}
const QByteArray &lshwInfoJson = lshw.readAllStandardOutput();
QJsonArray lshwResultArray = QJsonDocument::fromJson(lshwInfoJson).array();
if (!lshwResultArray.isEmpty()) {
QJsonValue memoryHwInfo = lshwResultArray.first();
QString id = memoryHwInfo.toObject().value("id").toString();
Q_ASSERT(id == "memory");
siGlobal->memoryInstalledSize = memoryHwInfo.toObject().value("size").toDouble(); // TODO: check "units" is "bytes" ?
}
}
return siGlobal->memoryInstalledSize;
#endif
return -1;
}
/*!
\return the total available to use memory size
*/
qint64 DSysInfo::memoryTotalSize()
{
#ifdef Q_OS_LINUX
siGlobal->memoryAvailableSize = get_phys_pages() * sysconf(_SC_PAGESIZE);
return siGlobal->memoryAvailableSize;
#endif
return -1;
}
qint64 DSysInfo::systemDiskSize()
{
#ifdef Q_OS_LINUX
// Getting Disk Size
const QString &deviceName = QStorageInfo::root().device();
QProcess lsblk;
lsblk.start("lsblk", {"-Jlpb", "-oNAME,KNAME,PKNAME,SIZE"}, QIODevice::ReadOnly);
if (!lsblk.waitForFinished()) {
return -1;
}
const QByteArray &diskStatusJson = lsblk.readAllStandardOutput();
QJsonDocument diskStatus = QJsonDocument::fromJson(diskStatusJson);
QJsonValue diskStatusJsonValue = diskStatus.object().value("blockdevices");
QMap> deviceParentAndSizeMap;
if (!diskStatusJsonValue.isUndefined()) {
QJsonArray diskStatusArray = diskStatusJsonValue.toArray();
QString keyName;
for (const QJsonValue oneValue : diskStatusArray) {
QString name = oneValue.toObject().value("name").toString();
QString kname = oneValue.toObject().value("kname").toString();
QString pkname = oneValue.toObject().value("pkname").toString();
qulonglong size = oneValue.toObject().value("size").toVariant().toULongLong();
if (keyName.isNull() && deviceName == name) {
keyName = kname;
}
deviceParentAndSizeMap[kname] = QPair(pkname, size);
}
while (!deviceParentAndSizeMap[keyName].first.isNull()) {
keyName = deviceParentAndSizeMap[keyName].first;
}
siGlobal->diskSize = deviceParentAndSizeMap[keyName].second;
}
return siGlobal->diskSize;
#endif
return -1;
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/dsysinfo.h 0000664 0000000 0000000 00000011147 14154026022 0016037 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2017 ~ 2018 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 DSYSINFO_H
#define DSYSINFO_H
#include
#include
DCORE_BEGIN_NAMESPACE
class DSysInfoPrivate;
class LIBDTKCORESHARED_EXPORT DSysInfo
{
public:
enum ProductType {
UnknownType = 0,
Deepin,
ArchLinux,
CentOS,
Debian,
Fedora,
LinuxMint,
Manjaro,
openSUSE,
SailfishOS,
Ubuntu,
Uos
};
enum DeepinType {
UnknownDeepin = 0,
DeepinDesktop,
DeepinProfessional,
DeepinServer,
DeepinPersonal
};
enum LogoType {
Normal = 0,
Light,
Symbolic,
Transparent
};
enum OrgType {
Distribution, //!< distribution itself
Distributor, //!< distributer of the current distribution
Manufacturer //!< manufacturer of the current distribution or device
};
enum UosType {
UosTypeUnknown,
UosDesktop,
UosServer,
UosDevice,
UosTypeCount // must at last
};
enum UosEdition {
UosEditionUnknown,
UosProfessional,
UosHome,
UosCommunity,
UosMilitary,
UosEnterprise,
UosEnterpriseC,
UosEuler,
UosMilitaryS, // for Server
UosDeviceEdition,
UosEducation,
UosEditionCount // must at last
};
// 注意:此处架构是从OsBuild获取的系统版本的Arch信息,并不是指硬件的Arch信息
enum UosArch {
UosArchUnknown,
UosAMD64 = 1 << 0,
UosARM64 = 1 << 1,
UosMIPS64 = 1 << 2,
UosSW64 = 1 << 3
};
#ifdef Q_OS_LINUX
static bool isDeepin();
static bool isDDE();
static DeepinType deepinType();
static QString deepinTypeDisplayName(const QLocale &locale = QLocale::system());
static QString deepinVersion();
static QString deepinEdition();
static QString deepinCopyright();
// uos version interface
static UosType uosType();
static UosEdition uosEditionType();
static UosArch uosArch();
static QString uosProductTypeName(const QLocale &locale = QLocale::system());
static QString uosSystemName(const QLocale &locale = QLocale::system());
static QString uosEditionName(const QLocale &locale = QLocale::system());
static QString spVersion(); // SP1...SP99
static QString udpateVersion(); // update1...update9
static QString majorVersion();
static QString minorVersion();
static QString buildVersion(); // xyzs
#endif
Q_DECL_DEPRECATED_X("Use distributionInfoPath() instead") static QString deepinDistributionInfoPath();
static QString distributionInfoPath();
static QString distributionInfoSectionName(OrgType type);
static QString distributionOrgName(OrgType type = Distribution, const QLocale &locale = QLocale::system());
Q_DECL_DEPRECATED_X("Use deepinDistributionOrgName() instead") static QString deepinDistributorName();
static QPair distributionOrgWebsite(OrgType type = Distribution);
Q_DECL_DEPRECATED_X("Use deepinDistributionOrgWebsite() instead") static QPair deepinDistributorWebsite();
static QString distributionOrgLogo(OrgType orgType = Distribution, LogoType type = Normal, const QString & fallback = QString());
Q_DECL_DEPRECATED_X("Use deepinDistributionOrgLogo() instead") static QString deepinDistributorLogo(LogoType type = Normal, const QString & fallback = QString());
static QString operatingSystemName();
static ProductType productType();
static QString productTypeString();
static QString productVersion();
static bool isCommunityEdition();
static QString computerName();
static QString cpuModelName();
static qint64 memoryInstalledSize();
static qint64 memoryTotalSize();
static qint64 systemDiskSize();
};
DCORE_END_NAMESPACE
#endif // DSYSINFO_H
dtkcore-5.5.23/src/dtkcore_global.cpp 0000664 0000000 0000000 00000002747 14154026022 0017515 0 ustar 00root root 0000000 0000000 #include "dtkcore_global.h"
#include
#include
#if (!defined DTK_VERSION) || (!defined DTK_VERSION_STR)
#error "DTK_VERSION or DTK_VERSION_STR not defined!"
#endif
void doubleLoadCheck()
{
QFile f("/proc/self/maps");
if (!f.open(QIODevice::ReadOnly))
qFatal("%s", f.errorString().toLocal8Bit().data());
const QByteArray &data = f.readAll();
QTextStream ts(data);
QString modulePath;
while (Q_UNLIKELY(!ts.atEnd())) {
const QString line = ts.readLine();
const QStringList &maps = line.split(' ', QString::SplitBehavior::SkipEmptyParts);
if (Q_UNLIKELY(maps.size() < 6))
continue;
QFileInfo info(maps.value(5));
const QString &infoAbPath = info.absoluteFilePath();
if (modulePath == infoAbPath || !info.fileName().contains("dtkcore") || info.fileName().contains("dtkcore.so.2"))
continue;
if (modulePath.isEmpty()) {
modulePath = infoAbPath;
} else {
// modulePath != infoAbPath
QByteArray msg;
msg += modulePath + " and " + info.absoluteFilePath() + " both loaded";
qFatal("%s", msg.data());
}
}
}
// 在库被加载时就执行此函数
__attribute__((constructor)) void init()
{
doubleLoadCheck();
}
int dtkVersion()
{
return DTK_VERSION;
}
const char *dtkVersionString()
{
#ifdef QT_DEBUG
qWarning() << "Use DTK_VERSION_STR instead.";
#endif
return "";//DTK_VERSION_STR;
}
dtkcore-5.5.23/src/dtkcore_global.h 0000664 0000000 0000000 00000004332 14154026022 0017152 0 ustar 00root root 0000000 0000000 /*
* 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 .
*/
#pragma once
#include
#include
#define DTK_NAMESPACE Dtk
#if !defined(DTK_NAMESPACE)
# define DTK_BEGIN_NAMESPACE
# define DTK_END_NAMESPACE
# define DTK_USE_NAMESPACE
#else
# define DTK_BEGIN_NAMESPACE namespace DTK_NAMESPACE {
# define DTK_END_NAMESPACE }
# define DTK_USE_NAMESPACE using namespace DTK_NAMESPACE;
#endif
#define DCORE_NAMESPACE Core
#define DTK_CORE_NAMESPACE DTK_NAMESPACE::DCORE_NAMESPACE
#if !defined(DCORE_NAMESPACE)
# define DCORE_BEGIN_NAMESPACE
# define DCORE_END_NAMESPACE
# define DCORE_USE_NAMESPACE
#else
# define DCORE_BEGIN_NAMESPACE namespace DTK_NAMESPACE { namespace DCORE_NAMESPACE {
# define DCORE_END_NAMESPACE }}
# define DCORE_USE_NAMESPACE using namespace DTK_CORE_NAMESPACE;
#endif
#if defined(DTK_STATIC_LIB)
# define LIBDTKCORESHARED_EXPORT
#else
#if defined(LIBDTKCORE_LIBRARY)
# define LIBDTKCORESHARED_EXPORT Q_DECL_EXPORT
#else
# define LIBDTKCORESHARED_EXPORT Q_DECL_IMPORT
#endif
#endif
#ifdef D_DEPRECATED_CHECK
#define D_DECL_DEPRECATED_X(text) Q_DECL_HIDDEN
#define D_DECL_DEPRECATED Q_DECL_HIDDEN
#else
#define D_DECL_DEPRECATED Q_DECL_DEPRECATED
#define D_DECL_DEPRECATED_X Q_DECL_DEPRECATED_X
#endif
#define DTK_VERSION_CHECK(major, minor, patch, build) ((major<<24)|(minor<<16)|(patch<<8)|build)
#define DTK_VERSION DTK_VERSION_CHECK(DTK_VERSION_MAJOR, DTK_VERSION_MINOR, DTK_VERSION_PATCH, DTK_VERSION_BUILD)
extern "C" {
int LIBDTKCORESHARED_EXPORT dtkVersion();
const LIBDTKCORESHARED_EXPORT char *dtkVersionString();
}
dtkcore-5.5.23/src/filesystem/ 0000775 0000000 0000000 00000000000 14154026022 0016210 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/src/filesystem/DBaseFileWatcher 0000664 0000000 0000000 00000000036 14154026022 0021226 0 ustar 00root root 0000000 0000000 #include "dbasefilewatcher.h"
dtkcore-5.5.23/src/filesystem/DFileSystemWatcher 0000664 0000000 0000000 00000000040 14154026022 0021633 0 ustar 00root root 0000000 0000000 #include "dfilesystemwatcher.h"
dtkcore-5.5.23/src/filesystem/DFileWatcher 0000664 0000000 0000000 00000000032 14154026022 0020427 0 ustar 00root root 0000000 0000000 #include "dfilewatcher.h"
dtkcore-5.5.23/src/filesystem/DFileWatcherManager 0000664 0000000 0000000 00000000041 14154026022 0021722 0 ustar 00root root 0000000 0000000 #include "dfilewatchermanager.h"
dtkcore-5.5.23/src/filesystem/DPathBuf 0000664 0000000 0000000 00000000026 14154026022 0017566 0 ustar 00root root 0000000 0000000 #include "dpathbuf.h"
dtkcore-5.5.23/src/filesystem/DStandardPaths 0000664 0000000 0000000 00000000034 14154026022 0020774 0 ustar 00root root 0000000 0000000 #include "dstandardpaths.h"
dtkcore-5.5.23/src/filesystem/DTrashManager 0000664 0000000 0000000 00000000033 14154026022 0020607 0 ustar 00root root 0000000 0000000 #include "dtrashmanager.h"
dtkcore-5.5.23/src/filesystem/dbasefilewatcher.cpp 0000664 0000000 0000000 00000011743 14154026022 0022216 0 ustar 00root root 0000000 0000000 /*
* 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 "dbasefilewatcher.h"
#include "private/dbasefilewatcher_p.h"
#include
#include
DCORE_BEGIN_NAMESPACE
QList DBaseFileWatcherPrivate::watcherList;
DBaseFileWatcherPrivate::DBaseFileWatcherPrivate(DBaseFileWatcher *qq)
: DObjectPrivate(qq)
{
}
/*!
\class Dtk::Core::DBaseFileWatcher
\inmodule dtkcore
\brief The DBaseFileWatcher class provides an interface for monitoring files and directories for modifications.
\brief DBaseFileWatcher 类提供了一系列接口可供监视文件和目录的变动。
*/
DBaseFileWatcher::~DBaseFileWatcher()
{
stopWatcher();
DBaseFileWatcherPrivate::watcherList.removeOne(this);
}
QUrl DBaseFileWatcher::fileUrl() const
{
Q_D(const DBaseFileWatcher);
return d->url;
}
/*!
\brief 开始文件变动监视
\brief Let file watcher start watching file changes.
\return 成功开始返回 true ,否则返回 false.
\sa stopWatcher(), restartWatcher()
*/
bool DBaseFileWatcher::startWatcher()
{
Q_D(DBaseFileWatcher);
if (d->started)
return true;
if (d->start()) {
d->started = true;
return true;
}
return false;
}
/*!
\brief 停止文件变动监视.
\brief Stop watching file changes.
\return 成功停止返回 true ,否则返回 false.
\sa startWatcher(), restartWatcher()
*/
bool DBaseFileWatcher::stopWatcher()
{
Q_D(DBaseFileWatcher);
if (!d->started)
return false;
if (d->stop()) {
d->started = false;
return true;
}
return false;
}
/*!
\brief 重新开始文件变动监视.
\brief Stop file watcher and then restart it to watching file changes.
\return 成功开启返回 true,否则返回 false.
\sa startWatcher(), stopWatcher()
*/
bool DBaseFileWatcher::restartWatcher()
{
bool ok = stopWatcher();
return ok && startWatcher();
}
/*!
\brief 设置是否对 \a subfileUrl 目录启用文件监视
\brief Set enable file watcher for \a subfileUrl or not
\a subfileUrl 设置所针对的 Url
\a subfileUrl The given url
\a enabled 是否启用文件变动监视
\a enabled Enable file change watching or not.
*/
void DBaseFileWatcher::setEnabledSubfileWatcher(const QUrl &subfileUrl, bool enabled)
{
Q_UNUSED(subfileUrl)
Q_UNUSED(enabled)
}
/*!
\brief 发送一个信号表示目标目录 \a targetUrl 得到了一个 \a signal 信号,包含参数 \a arg1 。
\brief Emit a signal about \a targetUrl got a \a signal with \a arg1
示例用法:
Example usage:
\code
DBaseFileWatcher::ghostSignal(QUrl("bookmark:///"), &DBaseFileWatcher::fileDeleted, QUrl("bookmark:///bookmarkFile1"));
\endcode
\return 成功发送返回 true,否则返回 false.
*/
bool DBaseFileWatcher::ghostSignal(const QUrl &targetUrl, DBaseFileWatcher::SignalType1 signal, const QUrl &arg1)
{
if (!signal)
return false;
bool ok = false;
for (DBaseFileWatcher *watcher : DBaseFileWatcherPrivate::watcherList) {
if (watcher->fileUrl() == targetUrl) {
ok = true;
(watcher->*signal)(arg1);
}
}
return ok;
}
/*!
\brief 发送一个信号表示目标目录 \a targetUrl 得到了一个 \a signal 信号,包含参数 \a arg1 和 arg2。
\brief Emit a signal about \a targetUrl got a \a signal with \a arg1 and \a arg2
示例用法:
Example usage:
\code
DBaseFileWatcher::ghostSignal(QUrl("bookmark:///"), &DBaseFileWatcher::fileMoved, QUrl("bookmark:///bookmarkFile1"), QUrl("bookmark:///NewNameFile1"));
\endcode
*/
bool DBaseFileWatcher::ghostSignal(const QUrl &targetUrl, DBaseFileWatcher::SignalType2 signal, const QUrl &arg1, const QUrl &arg2)
{
if (!signal)
return false;
bool ok = false;
for (DBaseFileWatcher *watcher : DBaseFileWatcherPrivate::watcherList) {
if (watcher->fileUrl() == targetUrl) {
ok = true;
(watcher->*signal)(arg1, arg2);
}
}
return ok;
}
DBaseFileWatcher::DBaseFileWatcher(DBaseFileWatcherPrivate &dd,
const QUrl &url, QObject *parent)
: QObject(parent)
, DObject(dd)
{
Q_ASSERT(url.isValid());
d_func()->url = url;
DBaseFileWatcherPrivate::watcherList << this;
}
DCORE_END_NAMESPACE
#include "moc_dbasefilewatcher.cpp"
dtkcore-5.5.23/src/filesystem/dbasefilewatcher.h 0000664 0000000 0000000 00000004045 14154026022 0021660 0 ustar 00root root 0000000 0000000 /*
* 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 DBASEFILEWATCHER_H
#define DBASEFILEWATCHER_H
#include "dtkcore_global.h"
#include "dobject.h"
#include
DCORE_BEGIN_NAMESPACE
class DBaseFileWatcherPrivate;
class LIBDTKCORESHARED_EXPORT DBaseFileWatcher : public QObject, public DObject
{
Q_OBJECT
public:
~DBaseFileWatcher();
QUrl fileUrl() const;
bool startWatcher();
bool stopWatcher();
bool restartWatcher();
virtual void setEnabledSubfileWatcher(const QUrl &subfileUrl, bool enabled = true);
using SignalType1 = void(DBaseFileWatcher::*)(const QUrl &);
using SignalType2 = void(DBaseFileWatcher::*)(const QUrl &, const QUrl &);
static bool ghostSignal(const QUrl &targetUrl, SignalType1 signal, const QUrl &arg1);
static bool ghostSignal(const QUrl &targetUrl, SignalType2 signal, const QUrl &arg1, const QUrl &arg2);
Q_SIGNALS:
void fileDeleted(const QUrl &url);
void fileAttributeChanged(const QUrl &url);
void fileMoved(const QUrl &fromUrl, const QUrl &toUrl);
void subfileCreated(const QUrl &url);
void fileModified(const QUrl &url);
void fileClosed(const QUrl &url);
protected:
explicit DBaseFileWatcher(DBaseFileWatcherPrivate &dd, const QUrl &url, QObject *parent = 0);
private:
Q_DISABLE_COPY(DBaseFileWatcher)
D_DECLARE_PRIVATE(DBaseFileWatcher)
};
DCORE_END_NAMESPACE
#endif // DBASEFILEWATCHER_H
dtkcore-5.5.23/src/filesystem/dfilesystemwatcher.h 0000664 0000000 0000000 00000004153 14154026022 0022272 0 ustar 00root root 0000000 0000000 /*
* 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 DFILESYSTEMWATCHER_H
#define DFILESYSTEMWATCHER_H
#include "dtkcore_global.h"
#include "dobject.h"
#include
DCORE_BEGIN_NAMESPACE
class DFileSystemWatcherPrivate;
class LIBDTKCORESHARED_EXPORT DFileSystemWatcher : public QObject, public DObject
{
Q_OBJECT
D_DECLARE_PRIVATE(DFileSystemWatcher)
public:
DFileSystemWatcher(QObject *parent = Q_NULLPTR);
DFileSystemWatcher(const QStringList &paths, QObject *parent = Q_NULLPTR);
~DFileSystemWatcher();
bool addPath(const QString &file);
QStringList addPaths(const QStringList &files);
bool removePath(const QString &file);
QStringList removePaths(const QStringList &files);
QStringList files() const;
QStringList directories() const;
Q_SIGNALS:
void fileDeleted(const QString &path, const QString &name, QPrivateSignal);
void fileAttributeChanged(const QString &path, const QString &name, QPrivateSignal);
void fileClosed(const QString &path, const QString &name, QPrivateSignal);
void fileMoved(const QString &fromPath, const QString &fromName,
const QString &toPath, const QString &toName, QPrivateSignal);
void fileCreated(const QString &path, const QString &name, QPrivateSignal);
void fileModified(const QString &path, const QString &name, QPrivateSignal);
private:
Q_PRIVATE_SLOT(d_func(), void _q_readFromInotify())
};
DCORE_END_NAMESPACE
#endif // DFILESYSTEMWATCHER_H
dtkcore-5.5.23/src/filesystem/dfilesystemwatcher_dummy.cpp 0000664 0000000 0000000 00000017256 14154026022 0024050 0 ustar 00root root 0000000 0000000 /*
* 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 "dfilesystemwatcher.h"
#include "private/dfilesystemwatcher_dummy_p.h"
DCORE_BEGIN_NAMESPACE
DFileSystemWatcherPrivate::DFileSystemWatcherPrivate(int fd, DFileSystemWatcher *qq)
: DObjectPrivate(qq)
{
}
DFileSystemWatcherPrivate::~DFileSystemWatcherPrivate()
{
}
/*!
\class Dtk::Core::DFileSystemWatcher
\inmodule dtkcore
\brief The DFileSystemWatcher class provides an interface for monitoring files and directories for modifications.
DFileSystemWatcher monitors the file system for changes to files
and directories by watching a list of specified paths.
Call addPath() to watch a particular file or directory. Multiple
paths can be added using the addPaths() function. Existing paths can
be removed by using the removePath() and removePaths() functions.
DFileSystemWatcher examines each path added to it. Files that have
been added to the DFileSystemWatcher can be accessed using the
files() function, and directories using the directories() function.
The fileChanged() signal is emitted when a file has been modified,
renamed or removed from disk. Similarly, the directoryChanged()
signal is emitted when a directory or its contents is modified or
removed. Note that DFileSystemWatcher stops monitoring files once
they have been renamed or removed from disk, and directories once
they have been removed from disk.
\note On systems running a Linux kernel without inotify support,
file systems that contain watched paths cannot be unmounted.
\note Windows CE does not support directory monitoring by
default as this depends on the file system driver installed.
\note The act of monitoring files and directories for
modifications consumes system resources. This implies there is a
limit to the number of files and directories your process can
monitor simultaneously. On all BSD variants, for
example, an open file descriptor is required for each monitored
file. Some system limits the number of open file descriptors to 256
by default. This means that addPath() and addPaths() will fail if
your process tries to add more than 256 files or directories to
the file system monitor. Also note that your process may have
other file descriptors open in addition to the ones for files
being monitored, and these other open descriptors also count in
the total. OS X uses a different backend and does not
suffer from this issue.
*/
/*!
Constructs a new file system watcher object with the given \a parent.
*/
DFileSystemWatcher::DFileSystemWatcher(QObject *parent)
: QObject(parent)
, DObject()
{
}
/*!
Constructs a new file system watcher object with the given \a parent
which monitors the specified \a paths list.
*/
DFileSystemWatcher::DFileSystemWatcher(const QStringList &paths, QObject *parent)
: DFileSystemWatcher(parent)
{
addPaths(paths);
}
/*!
Destroys the file system watcher.
*/
DFileSystemWatcher::~DFileSystemWatcher()
{ }
/*!
Adds \a path to the file system watcher if \a path exists. The
path is not added if it does not exist, or if it is already being
monitored by the file system watcher.
If \a path specifies a directory, the directoryChanged() signal
will be emitted when \a path is modified or removed from disk;
otherwise the fileChanged() signal is emitted when \a path is
modified, renamed or removed.
If the watch was successful, true is returned.
Reasons for a watch failure are generally system-dependent, but
may include the resource not existing, access failures, or the
total watch count limit, if the platform has one.
\note There may be a system dependent limit to the number of
files and directories that can be monitored simultaneously.
If this limit is been reached, \a path will not be monitored,
and false is returned.
\sa addPaths(), removePath()
*/
bool DFileSystemWatcher::addPath(const QString &path)
{
return false;
}
/*!
Adds each path in \a paths to the file system watcher. Paths are
not added if they not exist, or if they are already being
monitored by the file system watcher.
If a path specifies a directory, the directoryChanged() signal
will be emitted when the path is modified or removed from disk;
otherwise the fileChanged() signal is emitted when the path is
modified, renamed, or removed.
The return value is a list of paths that could not be watched.
Reasons for a watch failure are generally system-dependent, but
may include the resource not existing, access failures, or the
total watch count limit, if the platform has one.
\note There may be a system dependent limit to the number of
files and directories that can be monitored simultaneously.
If this limit has been reached, the excess \a paths will not
be monitored, and they will be added to the returned QStringList.
\sa addPath(), removePaths()
*/
QStringList DFileSystemWatcher::addPaths(const QStringList &paths)
{
return QStringList();
}
/*!
Removes the specified \a path from the file system watcher.
If the watch is successfully removed, true is returned.
Reasons for watch removal failing are generally system-dependent,
but may be due to the path having already been deleted, for example.
\sa removePaths(), addPath()
*/
bool DFileSystemWatcher::removePath(const QString &path)
{
return false;
}
/*!
Removes the specified \a paths from the file system watcher.
The return value is a list of paths which were not able to be
unwatched successfully.
Reasons for watch removal failing are generally system-dependent,
but may be due to the path having already been deleted, for example.
\sa removePath(), addPaths()
*/
QStringList DFileSystemWatcher::removePaths(const QStringList &paths)
{
return QStringList();
}
/*!
\fn void DFileSystemWatcher::fileChanged(const QString &path)
This signal is emitted when the file at the specified \a path is
modified, renamed or removed from disk.
\sa directoryChanged()
*/
/*!
\fn void DFileSystemWatcher::directoryChanged(const QString &path)
This signal is emitted when the directory at a specified \a path
is modified (e.g., when a file is added or deleted) or removed
from disk. Note that if there are several changes during a short
period of time, some of the changes might not Q_EMIT this signal.
However, the last change in the sequence of changes will always
generate this signal.
\sa fileChanged()
*/
/*!
\fn QStringList DFileSystemWatcher::directories() const
Returns a list of paths to directories that are being watched.
\sa files()
*/
/*!
\fn QStringList DFileSystemWatcher::files() const
Returns a list of paths to files that are being watched.
\sa directories()
*/
QStringList DFileSystemWatcher::directories() const
{
return QStringList();
}
QStringList DFileSystemWatcher::files() const
{
return QStringList();
}
DCORE_END_NAMESPACE
#include "moc_dfilesystemwatcher.cpp"
dtkcore-5.5.23/src/filesystem/dfilesystemwatcher_linux.cpp 0000664 0000000 0000000 00000050207 14154026022 0024045 0 ustar 00root root 0000000 0000000 /*
* 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 "dfilesystemwatcher.h"
#include "private/dfilesystemwatcher_linux_p.h"
#include
#include
#include
#include
#include
#include
#include
#include
DCORE_BEGIN_NAMESPACE
DFileSystemWatcherPrivate::DFileSystemWatcherPrivate(int fd, DFileSystemWatcher *qq)
: DObjectPrivate(qq)
, inotifyFd(fd)
, notifier(fd, QSocketNotifier::Read, qq)
{
fcntl(inotifyFd, F_SETFD, FD_CLOEXEC);
qq->connect(¬ifier, SIGNAL(activated(int)), qq, SLOT(_q_readFromInotify()));
}
DFileSystemWatcherPrivate::~DFileSystemWatcherPrivate()
{
notifier.setEnabled(false);
Q_FOREACH (int id, pathToID)
inotify_rm_watch(inotifyFd, id < 0 ? -id : id);
::close(inotifyFd);
}
QStringList DFileSystemWatcherPrivate::addPaths(const QStringList &paths, QStringList *files, QStringList *directories)
{
QStringList p = paths;
QMutableListIterator it(p);
while (it.hasNext()) {
QString path = it.next();
QFileInfo fi(path);
bool isDir = fi.isDir();
if (isDir) {
if (directories->contains(path))
continue;
} else {
if (files->contains(path))
continue;
}
int wd = inotify_add_watch(inotifyFd,
QFile::encodeName(path),
(isDir
? (0
| IN_ATTRIB
| IN_MOVE
| IN_MOVE_SELF
| IN_CREATE
| IN_DELETE
| IN_DELETE_SELF
| IN_MODIFY
)
: (0
| IN_ATTRIB
| IN_CLOSE_WRITE
| IN_MODIFY
| IN_MOVE
| IN_MOVE_SELF
| IN_DELETE_SELF
)));
if (wd < 0) {
perror("DFileSystemWatcherPrivate::addPaths: inotify_add_watch failed");
continue;
}
it.remove();
int id = isDir ? -wd : wd;
if (id < 0) {
directories->append(path);
} else {
files->append(path);
}
pathToID.insert(path, id);
idToPath.insert(id, path);
}
return p;
}
QStringList DFileSystemWatcherPrivate::removePaths(const QStringList &paths, QStringList *files, QStringList *directories)
{
QStringList p = paths;
QMutableListIterator it(p);
while (it.hasNext()) {
QString path = it.next();
int id = pathToID.take(path);
for (auto hit = idToPath.find(id); hit != idToPath.end() && hit.key() == id; ++hit) {
if (hit.value() == path) {
idToPath.erase(hit);
break;
}
}
it.remove();
if (!idToPath.contains(id)) {
int wd = id < 0 ? -id : id;
//qDebug() << "removing watch for path" << path << "wd" << wd;
inotify_rm_watch(inotifyFd, wd);
}
if (id < 0) {
directories->removeAll(path);
} else {
files->removeAll(path);
}
}
return p;
}
void DFileSystemWatcherPrivate::_q_readFromInotify()
{
Q_Q(DFileSystemWatcher);
// qDebug() << "QInotifyFileSystemWatcherEngine::readFromInotify";
int buffSize = 0;
ioctl(inotifyFd, FIONREAD, (char *) &buffSize);
QVarLengthArray buffer(buffSize);
buffSize = read(inotifyFd, buffer.data(), buffSize);
char *at = buffer.data();
char * const end = at + buffSize;
QList eventList;
QMultiHash batch_pathmap;
/// only save event: IN_MOVE_TO
QMultiMap cookieToFilePath;
QMultiMap cookieToFileName;
QSet hasMoveFromByCookie;
#ifdef QT_DEBUG
int exist_count = 0;
#endif
while (at < end) {
inotify_event *event = reinterpret_cast(at);
QStringList paths;
at += sizeof(inotify_event) + event->len;
int id = event->wd;
paths = idToPath.values(id);
if (paths.empty()) {
// perhaps a directory?
id = -id;
paths = idToPath.values(id);
if (paths.empty())
continue;
}
if (!(event->mask & IN_MOVED_TO) || !hasMoveFromByCookie.contains(event->cookie)) {
auto it = std::find_if(eventList.begin(), eventList.end(), [event](inotify_event *e){
return event->wd == e->wd && event->mask == e->mask &&
event->cookie == e->cookie &&
event->len == e->len &&
!strcmp(event->name, e->name);
});
if (it==eventList.end()) {
eventList.append(event);
}
#ifdef QT_DEBUG
else {
qDebug() << "exist event:" << "event->wd" << event->wd <<
"event->mask" << event->mask <<
"event->cookie" << event->cookie << "exist counts " << ++exist_count;
}
#endif
const QList bps = batch_pathmap.values(id);
for (auto &path : paths) {
if (!bps.contains(path)) {
batch_pathmap.insert(id, path);
}
}
}
if (event->mask & IN_MOVED_TO) {
for (auto &path : paths) {
cookieToFilePath.insert(event->cookie, path);
}
cookieToFileName.insert(event->cookie, QString::fromUtf8(event->name));
}
if (event->mask & IN_MOVED_FROM)
hasMoveFromByCookie << event->cookie;
}
// qDebug() << "event count:" << eventList.count();
QList::const_iterator it = eventList.constBegin();
while (it != eventList.constEnd()) {
const inotify_event &event = **it;
++it;
// qDebug() << "inotify event, wd" << event.wd << "cookie" << event.cookie << "mask" << hex << event.mask;
int id = event.wd;
QStringList paths = batch_pathmap.values(id);
if (paths.empty()) {
id = -id;
paths = batch_pathmap.values(id);
if (paths.empty())
continue;
}
const QString &name = QString::fromUtf8(event.name);
for (auto &path : paths) {
// qDebug() << "event for path" << path;
// /// TODO: Existence of invalid utf8 characters QFile can not read the file information
// if (event.name != QString::fromLocal8Bit(event.name).toLocal8Bit()) {
// if (event.mask & (IN_CREATE | IN_MOVED_TO)) {
// DFMGlobal::fileNameCorrection(path);
// }
// }
if ((event.mask & (IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT)) != 0) {
do {
if (event.mask & IN_MOVE_SELF) {
QMap::const_iterator iterator = cookieToFilePath.constBegin();
bool isMove = false;
while (iterator != cookieToFilePath.constEnd()) {
const QString &_path = iterator.value();
const QString &_name = cookieToFileName.value(iterator.key());
if (QFileInfo(_path + QDir::separator() + _name) == QFileInfo(path)) {
isMove = true;
break;
}
++iterator;
}
if (isMove)
break;
}
/// Keep watcher
// pathToID.remove(path);
// idToPath.remove(id, getPathFromID(id));
// if (!idToPath.contains(id))
// inotify_rm_watch(inotifyFd, event.wd);
// if (id < 0)
// onDirectoryChanged(path, true);
// else
// onFileChanged(path, true);
Q_EMIT q->fileDeleted(path, QString(), DFileSystemWatcher::QPrivateSignal());
} while (false);
} else {
if (id < 0)
onDirectoryChanged(path, false);
else
onFileChanged(path, false);
}
QString filePath = path;
if (id < 0) {
if (path.endsWith(QDir::separator()))
filePath = path + name;
else
filePath = path + QDir::separator() + name;
}
if (event.mask & IN_CREATE) {
// qDebug() << "IN_CREATE" << filePath << name;
if (name.isEmpty()) {
if (pathToID.contains(path)) {
q->removePath(path);
q->addPath(path);
}
} else if (pathToID.contains(filePath)) {
q->removePath(filePath);
q->addPath(filePath);
}
Q_EMIT q->fileCreated(path, name, DFileSystemWatcher::QPrivateSignal());
}
if (event.mask & IN_DELETE) {
// qDebug() << "IN_DELETE" << filePath;
Q_EMIT q->fileDeleted(path, name, DFileSystemWatcher::QPrivateSignal());
}
if (event.mask & IN_MOVED_FROM) {
const QString toName = cookieToFileName.value(event.cookie);
if (cookieToFilePath.values(event.cookie).empty()) {
Q_EMIT q->fileMoved(path, name, QString(), QString(), DFileSystemWatcher::QPrivateSignal());
} else {
for (QString &toPath : cookieToFilePath.values(event.cookie)) {
// qDebug() << "IN_MOVED_FROM" << filePath << "to path:" << toPath << "to name:" << toName;
Q_EMIT q->fileMoved(path, name, toPath, toName, DFileSystemWatcher::QPrivateSignal());
}
}
}
if (event.mask & IN_MOVED_TO) {
// qDebug() << "IN_MOVED_TO" << filePath;
if (!hasMoveFromByCookie.contains(event.cookie))
Q_EMIT q->fileMoved(QString(), QString(), path, name, DFileSystemWatcher::QPrivateSignal());
}
if (event.mask & IN_ATTRIB) {
// qDebug() << "IN_ATTRIB" << event.mask << filePath;
Q_EMIT q->fileAttributeChanged(path, name, DFileSystemWatcher::QPrivateSignal());
}
/*only monitor file close event which is opend by write mode*/
if (event.mask & IN_CLOSE_WRITE) {
// qDebug() << "IN_CLOSE_WRITE" << event.mask << filePath;
Q_EMIT q->fileClosed(path, id < 0 ? name : QString(), DFileSystemWatcher::QPrivateSignal());
}
if (event.mask & IN_MODIFY) {
// qDebug() << "IN_MODIFY" << event.mask << filePath << name;
Q_EMIT q->fileModified(path, name, DFileSystemWatcher::QPrivateSignal());
}
}
}
}
void DFileSystemWatcherPrivate::onFileChanged(const QString &path, bool removed)
{
Q_Q(DFileSystemWatcher);
if (!files.contains(path)) {
// the path was removed after a change was detected, but before we delivered the signal
return;
}
if (removed) {
files.removeAll(path);
}
// Q_EMIT q->fileChanged(path, DFileSystemWatcher::QPrivateSignal());
}
void DFileSystemWatcherPrivate::onDirectoryChanged(const QString &path, bool removed)
{
Q_Q(DFileSystemWatcher);
if (!directories.contains(path)) {
// perhaps the path was removed after a change was detected, but before we delivered the signal
return;
}
if (removed) {
directories.removeAll(path);
}
// Q_EMIT q->directoryChanged(path, DFileSystemWatcher::QPrivateSignal());
}
/*!
\class Dtk::Core::DFileSystemWatcher
\inmodule dtkcore
\brief The DFileSystemWatcher class provides an interface for monitoring files and directories for modifications.
DFileSystemWatcher monitors the file system for changes to files
and directories by watching a list of specified paths.
Call addPath() to watch a particular file or directory. Multiple
paths can be added using the addPaths() function. Existing paths can
be removed by using the removePath() and removePaths() functions.
DFileSystemWatcher examines each path added to it. Files that have
been added to the DFileSystemWatcher can be accessed using the
files() function, and directories using the directories() function.
\note On systems running a Linux kernel without inotify support,
file systems that contain watched paths cannot be unmounted.
\note Windows CE does not support directory monitoring by
default as this depends on the file system driver installed.
\note The act of monitoring files and directories for
modifications consumes system resources. This implies there is a
limit to the number of files and directories your process can
monitor simultaneously. On all BSD variants, for
example, an open file descriptor is required for each monitored
file. Some system limits the number of open file descriptors to 256
by default. This means that addPath() and addPaths() will fail if
your process tries to add more than 256 files or directories to
the file system monitor. Also note that your process may have
other file descriptors open in addition to the ones for files
being monitored, and these other open descriptors also count in
the total. OS X uses a different backend and does not
suffer from this issue.
*/
/*!
Constructs a new file system watcher object with the given \a parent.
*/
DFileSystemWatcher::DFileSystemWatcher(QObject *parent)
: QObject(parent)
, DObject()
{
int fd = -1;
#ifdef IN_CLOEXEC
fd = inotify_init1(IN_CLOEXEC | O_NONBLOCK);
#endif
if (fd == -1) {
fd = inotify_init1(O_NONBLOCK);
}
if (fd != -1)
d_d_ptr.reset(new DFileSystemWatcherPrivate(fd, this));
}
/*!
Constructs a new file system watcher object with the given \a parent
which monitors the specified \a paths list.
*/
DFileSystemWatcher::DFileSystemWatcher(const QStringList &paths, QObject *parent)
: DFileSystemWatcher(parent)
{
addPaths(paths);
}
/*!
Destroys the file system watcher.
*/
DFileSystemWatcher::~DFileSystemWatcher()
{ }
/*!
Adds \a path to the file system watcher if \a path exists. The
path is not added if it does not exist, or if it is already being
monitored by the file system watcher.
If \a path specifies a directory, the directoryChanged() signal
will be emitted when \a path is modified or removed from disk;
otherwise the fileChanged() signal is emitted when \a path is
modified, renamed or removed.
If the watch was successful, true is returned.
Reasons for a watch failure are generally system-dependent, but
may include the resource not existing, access failures, or the
total watch count limit, if the platform has one.
\note There may be a system dependent limit to the number of
files and directories that can be monitored simultaneously.
If this limit is been reached, \a path will not be monitored,
and false is returned.
\sa addPaths(), removePath()
*/
bool DFileSystemWatcher::addPath(const QString &path)
{
if (path.isEmpty()) {
qWarning("DFileSystemWatcher::addPath: path is empty");
return true;
}
QStringList paths = addPaths(QStringList(path));
return paths.isEmpty();
}
/*!
Adds each path in \a paths to the file system watcher. Paths are
not added if they not exist, or if they are already being
monitored by the file system watcher.
If a path specifies a directory, the directoryChanged() signal
will be emitted when the path is modified or removed from disk;
otherwise the fileChanged() signal is emitted when the path is
modified, renamed, or removed.
The return value is a list of paths that could not be watched.
Reasons for a watch failure are generally system-dependent, but
may include the resource not existing, access failures, or the
total watch count limit, if the platform has one.
\note There may be a system dependent limit to the number of
files and directories that can be monitored simultaneously.
If this limit has been reached, the excess \a paths will not
be monitored, and they will be added to the returned QStringList.
\sa addPath(), removePaths()
*/
QStringList DFileSystemWatcher::addPaths(const QStringList &paths)
{
Q_D(DFileSystemWatcher);
QStringList p = paths;
QMutableListIterator it(p);
while (it.hasNext()) {
const QString &path = it.next();
if (path.isEmpty())
it.remove();
}
if (p.isEmpty()) {
qWarning("DFileSystemWatcher::addPaths: list is empty");
return QStringList();
}
if (d)
p = d->addPaths(p, &d->files, &d->directories);
return p;
}
/*!
Removes the specified \a path from the file system watcher.
If the watch is successfully removed, true is returned.
Reasons for watch removal failing are generally system-dependent,
but may be due to the path having already been deleted, for example.
\sa removePaths(), addPath()
*/
bool DFileSystemWatcher::removePath(const QString &path)
{
if (path.isEmpty()) {
qWarning("DFileSystemWatcher::removePath: path is empty");
return true;
}
QStringList paths = removePaths(QStringList(path));
return paths.isEmpty();
}
/*!
Removes the specified \a paths from the file system watcher.
The return value is a list of paths which were not able to be
unwatched successfully.
Reasons for watch removal failing are generally system-dependent,
but may be due to the path having already been deleted, for example.
\sa removePath(), addPaths()
*/
QStringList DFileSystemWatcher::removePaths(const QStringList &paths)
{
Q_D(DFileSystemWatcher);
QStringList p = paths;
QMutableListIterator it(p);
while (it.hasNext()) {
const QString &path = it.next();
if (path.isEmpty())
it.remove();
}
if (p.isEmpty()) {
qWarning("DFileSystemWatcher::removePaths: list is empty");
return QStringList();
}
if (d)
p = d->removePaths(p, &d->files, &d->directories);
return p;
}
/*!
\fn QStringList DFileSystemWatcher::directories() const
Returns a list of paths to directories that are being watched.
\sa files()
*/
/*!
\fn QStringList DFileSystemWatcher::files() const
Returns a list of paths to files that are being watched.
\sa directories()
*/
QStringList DFileSystemWatcher::directories() const
{
Q_D(const DFileSystemWatcher);
if (!d)
return QStringList();
return d->directories;
}
QStringList DFileSystemWatcher::files() const
{
Q_D(const DFileSystemWatcher);
if (!d)
return QStringList();
return d->files;
}
DCORE_END_NAMESPACE
#include "moc_dfilesystemwatcher.cpp"
dtkcore-5.5.23/src/filesystem/dfilesystemwatcher_win.cpp 0000664 0000000 0000000 00000017302 14154026022 0023502 0 ustar 00root root 0000000 0000000 /*
* 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 "dfilesystemwatcher.h"
#include "private/dfilesystemwatcher_win_p.h"
DCORE_BEGIN_NAMESPACE
DFileSystemWatcherPrivate::DFileSystemWatcherPrivate(int fd, DFileSystemWatcher *qq)
: DObjectPrivate(qq)
{
}
DFileSystemWatcherPrivate::~DFileSystemWatcherPrivate()
{
}
/*!
\class Dtk::Core::DFileSystemWatcher
\inmodule dtkcore
\brief The DFileSystemWatcher class provides an interface for monitoring files and directories for modifications.
DFileSystemWatcher monitors the file system for changes to files
and directories by watching a list of specified paths.
Call addPath() to watch a particular file or directory. Multiple
paths can be added using the addPaths() function. Existing paths can
be removed by using the removePath() and removePaths() functions.
DFileSystemWatcher examines each path added to it. Files that have
been added to the DFileSystemWatcher can be accessed using the
files() function, and directories using the directories() function.
The fileChanged() signal is emitted when a file has been modified,
renamed or removed from disk. Similarly, the directoryChanged()
signal is emitted when a directory or its contents is modified or
removed. Note that DFileSystemWatcher stops monitoring files once
they have been renamed or removed from disk, and directories once
they have been removed from disk.
\note On systems running a Linux kernel without inotify support,
file systems that contain watched paths cannot be unmounted.
\note Windows CE does not support directory monitoring by
default as this depends on the file system driver installed.
\note The act of monitoring files and directories for
modifications consumes system resources. This implies there is a
limit to the number of files and directories your process can
monitor simultaneously. On all BSD variants, for
example, an open file descriptor is required for each monitored
file. Some system limits the number of open file descriptors to 256
by default. This means that addPath() and addPaths() will fail if
your process tries to add more than 256 files or directories to
the file system monitor. Also note that your process may have
other file descriptors open in addition to the ones for files
being monitored, and these other open descriptors also count in
the total. OS X uses a different backend and does not
suffer from this issue.
\sa QFile, QDir
*/
/*!
Constructs a new file system watcher object with the given \a parent.
*/
DFileSystemWatcher::DFileSystemWatcher(QObject *parent)
: QObject(parent)
, DObject()
{
}
/*!
Constructs a new file system watcher object with the given \a parent
which monitors the specified \a paths list.
*/
DFileSystemWatcher::DFileSystemWatcher(const QStringList &paths, QObject *parent)
: DFileSystemWatcher(parent)
{
addPaths(paths);
}
/*!
Destroys the file system watcher.
*/
DFileSystemWatcher::~DFileSystemWatcher()
{ }
/*!
Adds \a path to the file system watcher if \a path exists. The
path is not added if it does not exist, or if it is already being
monitored by the file system watcher.
If \a path specifies a directory, the directoryChanged() signal
will be emitted when \a path is modified or removed from disk;
otherwise the fileChanged() signal is emitted when \a path is
modified, renamed or removed.
If the watch was successful, true is returned.
Reasons for a watch failure are generally system-dependent, but
may include the resource not existing, access failures, or the
total watch count limit, if the platform has one.
\note There may be a system dependent limit to the number of
files and directories that can be monitored simultaneously.
If this limit is been reached, \a path will not be monitored,
and false is returned.
\sa addPaths(), removePath()
*/
bool DFileSystemWatcher::addPath(const QString &path)
{
return false;
}
/*!
Adds each path in \a paths to the file system watcher. Paths are
not added if they not exist, or if they are already being
monitored by the file system watcher.
If a path specifies a directory, the directoryChanged() signal
will be emitted when the path is modified or removed from disk;
otherwise the fileChanged() signal is emitted when the path is
modified, renamed, or removed.
The return value is a list of paths that could not be watched.
Reasons for a watch failure are generally system-dependent, but
may include the resource not existing, access failures, or the
total watch count limit, if the platform has one.
\note There may be a system dependent limit to the number of
files and directories that can be monitored simultaneously.
If this limit has been reached, the excess \a paths will not
be monitored, and they will be added to the returned QStringList.
\sa addPath(), removePaths()
*/
QStringList DFileSystemWatcher::addPaths(const QStringList &paths)
{
return QStringList();
}
/*!
Removes the specified \a path from the file system watcher.
If the watch is successfully removed, true is returned.
Reasons for watch removal failing are generally system-dependent,
but may be due to the path having already been deleted, for example.
\sa removePaths(), addPath()
*/
bool DFileSystemWatcher::removePath(const QString &path)
{
return false;
}
/*!
Removes the specified \a paths from the file system watcher.
The return value is a list of paths which were not able to be
unwatched successfully.
Reasons for watch removal failing are generally system-dependent,
but may be due to the path having already been deleted, for example.
\sa removePath(), addPaths()
*/
QStringList DFileSystemWatcher::removePaths(const QStringList &paths)
{
return QStringList();
}
/*!
\fn void DFileSystemWatcher::fileChanged(const QString &path)
This signal is emitted when the file at the specified \a path is
modified, renamed or removed from disk.
\sa directoryChanged()
*/
/*!
\fn void DFileSystemWatcher::directoryChanged(const QString &path)
This signal is emitted when the directory at a specified \a path
is modified (e.g., when a file is added or deleted) or removed
from disk. Note that if there are several changes during a short
period of time, some of the changes might not Q_EMIT this signal.
However, the last change in the sequence of changes will always
generate this signal.
\sa fileChanged()
*/
/*!
\fn QStringList DFileSystemWatcher::directories() const
Returns a list of paths to directories that are being watched.
\sa files()
*/
/*!
\fn QStringList DFileSystemWatcher::files() const
Returns a list of paths to files that are being watched.
\sa directories()
*/
QStringList DFileSystemWatcher::directories() const
{
return QStringList();
}
QStringList DFileSystemWatcher::files() const
{
return QStringList();
}
DCORE_END_NAMESPACE
#include "moc_dfilesystemwatcher.cpp"
dtkcore-5.5.23/src/filesystem/dfilewatcher.cpp 0000664 0000000 0000000 00000020707 14154026022 0021363 0 ustar 00root root 0000000 0000000 /*
* 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 "dfilewatcher.h"
#include "private/dbasefilewatcher_p.h"
#include "dfilesystemwatcher.h"
#include
#include
DCORE_BEGIN_NAMESPACE
static QString joinFilePath(const QString &path, const QString &name)
{
if (path.endsWith(QDir::separator()))
return path + name;
return path + QDir::separator() + name;
}
class DFileWatcherPrivate : DBaseFileWatcherPrivate
{
public:
DFileWatcherPrivate(DFileWatcher *qq)
: DBaseFileWatcherPrivate(qq) {}
bool start() Q_DECL_OVERRIDE;
bool stop() Q_DECL_OVERRIDE;
void _q_handleFileDeleted(const QString &path, const QString &parentPath);
void _q_handleFileAttributeChanged(const QString &path, const QString &parentPath);
void _q_handleFileMoved(const QString &from, const QString &fromParent, const QString &to, const QString &toParent);
void _q_handleFileCreated(const QString &path, const QString &parentPath);
void _q_handleFileModified(const QString &path, const QString &parentPath);
void _q_handleFileClose(const QString &path, const QString &parentPath);
static QString formatPath(const QString &path);
QString path;
QStringList watchFileList;
static QMap filePathToWatcherCount;
Q_DECLARE_PUBLIC(DFileWatcher)
};
QMap DFileWatcherPrivate::filePathToWatcherCount;
Q_GLOBAL_STATIC(DFileSystemWatcher, watcher_file_private)
QStringList parentPathList(const QString &path)
{
QStringList list;
QDir dir(path);
list << path;
while (dir.cdUp()) {
list << dir.absolutePath();
}
return list;
}
bool DFileWatcherPrivate::start()
{
Q_Q(DFileWatcher);
started = true;
Q_FOREACH (const QString &path, parentPathList(this->path)) {
if (watchFileList.contains(path))
continue;
if (filePathToWatcherCount.value(path, -1) <= 0) {
if (!watcher_file_private->addPath(path)) {
qWarning() << Q_FUNC_INFO << "start watch failed, file path =" << path;
q->stopWatcher();
started = false;
return false;
}
}
watchFileList << path;
filePathToWatcherCount[path] = filePathToWatcherCount.value(path, 0) + 1;
}
q->connect(watcher_file_private, &DFileSystemWatcher::fileDeleted,
q, &DFileWatcher::onFileDeleted);
q->connect(watcher_file_private, &DFileSystemWatcher::fileAttributeChanged,
q, &DFileWatcher::onFileAttributeChanged);
q->connect(watcher_file_private, &DFileSystemWatcher::fileMoved,
q, &DFileWatcher::onFileMoved);
q->connect(watcher_file_private, &DFileSystemWatcher::fileCreated,
q, &DFileWatcher::onFileCreated);
q->connect(watcher_file_private, &DFileSystemWatcher::fileModified,
q, &DFileWatcher::onFileModified);
q->connect(watcher_file_private, &DFileSystemWatcher::fileClosed,
q, &DFileWatcher::onFileClosed);
return true;
}
bool DFileWatcherPrivate::stop()
{
Q_Q(DFileWatcher);
q->disconnect(watcher_file_private, 0, q, 0);
bool ok = true;
Q_FOREACH (const QString &path, watchFileList) {
int count = filePathToWatcherCount.value(path, 0);
--count;
if (count <= 0) {
filePathToWatcherCount.remove(path);
watchFileList.removeOne(path);
ok = ok && watcher_file_private->removePath(path);
} else {
filePathToWatcherCount[path] = count;
}
}
return ok;
}
void DFileWatcherPrivate::_q_handleFileDeleted(const QString &path, const QString &parentPath)
{
if (path != this->path && parentPath != this->path)
return;
Q_Q(DFileWatcher);
Q_EMIT q->fileDeleted(QUrl::fromLocalFile(path));
}
void DFileWatcherPrivate::_q_handleFileAttributeChanged(const QString &path, const QString &parentPath)
{
if (path != this->path && parentPath != this->path)
return;
Q_Q(DFileWatcher);
Q_EMIT q->fileAttributeChanged(QUrl::fromLocalFile(path));
}
void DFileWatcherPrivate::_q_handleFileMoved(const QString &from, const QString &fromParent, const QString &to, const QString &toParent)
{
Q_Q(DFileWatcher);
if ((fromParent == this->path && toParent == this->path) || from == this->path) {
Q_EMIT q->fileMoved(QUrl::fromLocalFile(from), QUrl::fromLocalFile(to));
} else if (fromParent == this->path) {
Q_EMIT q->fileDeleted(QUrl::fromLocalFile(from));
} else if (watchFileList.contains(from)) {
Q_EMIT q->fileDeleted(url);
} else if (toParent == this->path) {
Q_EMIT q->subfileCreated(QUrl::fromLocalFile(to));
}
}
void DFileWatcherPrivate::_q_handleFileCreated(const QString &path, const QString &parentPath)
{
if (path != this->path && parentPath != this->path)
return;
Q_Q(DFileWatcher);
Q_EMIT q->subfileCreated(QUrl::fromLocalFile(path));
}
void DFileWatcherPrivate::_q_handleFileModified(const QString &path, const QString &parentPath)
{
if (path != this->path && parentPath != this->path)
return;
Q_Q(DFileWatcher);
Q_EMIT q->fileModified(QUrl::fromLocalFile(path));
}
void DFileWatcherPrivate::_q_handleFileClose(const QString &path, const QString &parentPath)
{
if (path != this->path && parentPath != this->path)
return;
Q_Q(DFileWatcher);
Q_EMIT q->fileClosed(QUrl::fromLocalFile(path));
}
QString DFileWatcherPrivate::formatPath(const QString &path)
{
QString p = QFileInfo(path).absoluteFilePath();
if (p.endsWith(QDir::separator()))
p.chop(1);
return p.isEmpty() ? path : p;
}
/*!
\class Dtk::Core::DFileWatcher
\inmodule dtkcore
\brief The DFileWatcher class provides an implemention of DBaseFileWatcher for monitoring files and directories for modifications.
\brief DFileWatcher 类提供了对 DBaseFileWatcher 接口的实现,可供监视文件和目录的变动。
*/
DFileWatcher::DFileWatcher(const QString &filePath, QObject *parent)
: DBaseFileWatcher(*new DFileWatcherPrivate(this), QUrl::fromLocalFile(filePath), parent)
{
d_func()->path = DFileWatcherPrivate::formatPath(filePath);
}
void DFileWatcher::onFileDeleted(const QString &path, const QString &name)
{
if (name.isEmpty())
d_func()->_q_handleFileDeleted(path, QString());
else
d_func()->_q_handleFileDeleted(joinFilePath(path, name), path);
}
void DFileWatcher::onFileAttributeChanged(const QString &path, const QString &name)
{
if (name.isEmpty())
d_func()->_q_handleFileAttributeChanged(path, QString());
else
d_func()->_q_handleFileAttributeChanged(joinFilePath(path, name), path);
}
void DFileWatcher::onFileMoved(const QString &from, const QString &fname, const QString &to, const QString &tname)
{
QString fromPath, fpPath;
QString toPath, tpPath;
if (fname.isEmpty()) {
fromPath = from;
} else {
fromPath = joinFilePath(from, fname);
fpPath = from;
}
if (tname.isEmpty()) {
toPath = to;
} else {
toPath = joinFilePath(to, tname);
tpPath = to;
}
d_func()->_q_handleFileMoved(fromPath, fpPath, toPath, tpPath);
}
void DFileWatcher::onFileCreated(const QString &path, const QString &name)
{
d_func()->_q_handleFileCreated(joinFilePath(path, name), path);
}
void DFileWatcher::onFileModified(const QString &path, const QString &name)
{
if (name.isEmpty())
d_func()->_q_handleFileModified(path, QString());
else
d_func()->_q_handleFileModified(joinFilePath(path, name), path);
}
void DFileWatcher::onFileClosed(const QString &path, const QString &name)
{
if (name.isEmpty())
d_func()->_q_handleFileClose(path, QString());
else
d_func()->_q_handleFileClose(joinFilePath(path, name), path);
}
DCORE_END_NAMESPACE
#include "moc_dfilewatcher.cpp"
dtkcore-5.5.23/src/filesystem/dfilewatcher.h 0000664 0000000 0000000 00000003075 14154026022 0021027 0 ustar 00root root 0000000 0000000 /*
* 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 DFILEWATCHER_H
#define DFILEWATCHER_H
#include "dbasefilewatcher.h"
DCORE_BEGIN_NAMESPACE
class DFileWatcherPrivate;
class LIBDTKCORESHARED_EXPORT DFileWatcher : public DBaseFileWatcher
{
Q_OBJECT
public:
explicit DFileWatcher(const QString &filePath, QObject *parent = 0);
private Q_SLOTS:
void onFileDeleted(const QString &path, const QString &name);
void onFileAttributeChanged(const QString &path, const QString &name);
void onFileMoved(const QString &fromPath, const QString &fromName,
const QString &toPath, const QString &toName);
void onFileCreated(const QString &path, const QString &name);
void onFileModified(const QString &path, const QString &name);
void onFileClosed(const QString &path, const QString &name);
private:
D_DECLARE_PRIVATE(DFileWatcher)
};
DCORE_END_NAMESPACE
#endif // DFILEWATCHER_H
dtkcore-5.5.23/src/filesystem/dfilewatchermanager.cpp 0000664 0000000 0000000 00000007133 14154026022 0022714 0 ustar 00root root 0000000 0000000 /*
* 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 "dfilewatchermanager.h"
#include "dfilewatcher.h"
#include "base/private/dobject_p.h"
#include
#include
DCORE_BEGIN_NAMESPACE
class DFileWatcherManagerPrivate : public DObjectPrivate
{
public:
DFileWatcherManagerPrivate(DFileWatcherManager *qq);
QMap watchersMap;
D_DECLARE_PUBLIC(DFileWatcherManager)
};
DFileWatcherManagerPrivate::DFileWatcherManagerPrivate(DFileWatcherManager *qq)
: DObjectPrivate(qq)
{
}
/*!
\class Dtk::Core::DFileWatcherManager
\inmodule dtkcore
\brief The DFileWatcherManager class can help you manage file watchers and get signal when file got changed.
\brief DFileWatcherManager 类可以帮助管理一系列 DFileWatcher 文件监视器,并在文件变动时发送信号通知.
*/
DFileWatcherManager::DFileWatcherManager(QObject *parent)
: QObject(parent)
, DObject(*new DFileWatcherManagerPrivate(this))
{
}
DFileWatcherManager::~DFileWatcherManager()
{
}
/*!
\brief 为路径 \a filePath 创建 DFileWatcher 并将其添加到 DFileWatcherManager 中.
\brief Add file watcher for \a filePath to the file watcher manager.
\return 被创建并添加到 DFileWatcherManager 的 DFileWatcher
\return The file watcher which got created and added into the file watcher manager.
*/
DFileWatcher *DFileWatcherManager::add(const QString &filePath)
{
Q_D(DFileWatcherManager);
DFileWatcher *watcher = d->watchersMap.value(filePath);
if (watcher) {
return watcher;
}
watcher = new DFileWatcher(filePath, this);
connect(watcher, &DFileWatcher::fileAttributeChanged, this, [this](const QUrl & url) {
Q_EMIT fileAttributeChanged(url.toLocalFile());
});
connect(watcher, &DFileWatcher::fileClosed, this, [this](const QUrl & url) {
Q_EMIT fileClosed(url.toLocalFile());
});
connect(watcher, &DFileWatcher::fileDeleted, this, [this](const QUrl & url) {
Q_EMIT fileDeleted(url.toLocalFile());
});
connect(watcher, &DFileWatcher::fileModified, this, [this](const QUrl & url) {
Q_EMIT fileModified(url.toLocalFile());
});
connect(watcher, &DFileWatcher::fileMoved, this, [this](const QUrl & fromUrl, const QUrl & toUrl) {
Q_EMIT fileMoved(fromUrl.toLocalFile(), toUrl.toLocalFile());
});
connect(watcher, &DFileWatcher::subfileCreated, this, [this](const QUrl & url) {
Q_EMIT subfileCreated(url.toLocalFile());
});
d->watchersMap[filePath] = watcher;
watcher->startWatcher();
return watcher;
}
/*!
\brief 从当前 DFileWatcherManager 中移除监视 \a filePath 的 DFileWatcher.
\brief Remove file watcher for \a filePath from the file watcher manager.
*/
void DFileWatcherManager::remove(const QString &filePath)
{
Q_D(DFileWatcherManager);
DFileWatcher *watcher = d->watchersMap.take(filePath);
if (watcher) {
watcher->deleteLater();
}
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/filesystem/dfilewatchermanager.h 0000664 0000000 0000000 00000003315 14154026022 0022357 0 ustar 00root root 0000000 0000000 /*
* 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 DFILEWATCHERMANAGER_H
#define DFILEWATCHERMANAGER_H
#include "dtkcore_global.h"
#include "dobject.h"
#include
DCORE_BEGIN_NAMESPACE
class DFileWatcher;
class DFileWatcherManagerPrivate;
class LIBDTKCORESHARED_EXPORT DFileWatcherManager : public QObject, public DObject
{
Q_OBJECT
public:
explicit DFileWatcherManager(QObject *parent = 0);
~DFileWatcherManager();
DFileWatcher *add(const QString &filePath);
void remove(const QString &filePath);
Q_SIGNALS:
void fileDeleted(const QString &filePath);
void fileAttributeChanged(const QString &filePath);
void fileMoved(const QString &fromFilePath, const QString &toFilePath);
void subfileCreated(const QString &filePath);
void fileModified(const QString &filePath);
void fileClosed(const QString &filePath);
private:
QScopedPointer d_ptr;
D_DECLARE_PRIVATE(DFileWatcherManager)
Q_DISABLE_COPY(DFileWatcherManager)
};
DCORE_END_NAMESPACE
#endif // DFILEWATCHERMANAGER_H
dtkcore-5.5.23/src/filesystem/dpathbuf.cpp 0000664 0000000 0000000 00000003354 14154026022 0020516 0 ustar 00root root 0000000 0000000 #include "dpathbuf.h"
/*!
\class Dtk::Core::DPathBuf
\inmodule dtkcore
\brief Dtk::Core::DPathBuf cat path friendly and supoort multiplatform.
\brief Dtk::Core::DPathBuf是一个用于跨平台拼接路径的辅助类.
它能够方便的写出链式结构的路径拼接代码。
\code
DPathBuf logPath(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first());
logPath = logPath / ".cache" / "deepin" / "deepin-test-dtk" / "deepin-test-dtk.log";
\endcode
*/
DCORE_BEGIN_NAMESPACE
/*!
\fn DPathBuf DPathBuf::operator/(const QString &p) const
\brief join path with operator /
\a p is subpath
\return a new DPathBuf with subpath p
*/
/*!
\fn DPathBuf &DPathBuf::operator/=(const QString &p)
\brief join path to self with operator /=
\a p is subpath to join
\return self object
*/
/*!
\fn DPathBuf DPathBuf::operator/(const char *p) const
\brief join path with operator /
\a p is subpath
\return a new DPathBuf with subpath p
\sa Dtk::Core::DPathBuf::operator/(const QString &p)
*/
/*!
\fn DPathBuf &DPathBuf::operator/=(const char *p)
\brief join path to self with operator /=
\a p is subpath to join
\return self object
\sa operator/=(const QString &p)
*/
/*!
\fn DPathBuf &DPathBuf::join(const QString &p)
\brief join add subpath p to self
\a p is subpath to join
\return slef object with subpath joined
*/
/*!
\fn QString DPathBuf::toString() const
\brief toString export native separators format string.
\return string with native separators
*/
/*!
\brief Create Dtk::Core::DPathBuf from string.
\a path
*/
DPathBuf::DPathBuf(const QString &path)
{
m_path = QDir(path).absolutePath();
}
DPathBuf::DPathBuf()
: DPathBuf(QString())
{
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/filesystem/dpathbuf.h 0000664 0000000 0000000 00000003024 14154026022 0020155 0 ustar 00root root 0000000 0000000 /*
* 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 .
*/
#pragma once
#include
#include "dtkcore_global.h"
DCORE_BEGIN_NAMESPACE
class LIBDTKCORESHARED_EXPORT DPathBuf
{
public:
DPathBuf();
DPathBuf(const QString &path);
DPathBuf operator/(const QString &p) const
{
return DPathBuf(m_path + "/" + p);
}
DPathBuf &operator/=(const QString &p)
{
return join(p);
}
DPathBuf operator/(const char *p) const
{
return operator /(QString(p));
}
DPathBuf &operator/=(const char *p)
{
return operator /=(QString(p));
}
DPathBuf &join(const QString &p)
{
m_path += "/" + p;
m_path = QDir(m_path).absolutePath();
return *this;
}
QString toString() const
{
return QDir::toNativeSeparators(m_path);
}
private:
QString m_path;
};
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/filesystem/dstandardpaths.cpp 0000664 0000000 0000000 00000014443 14154026022 0021726 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2017 ~ 2021 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 "dstandardpaths.h"
#include
#include
#include
DCORE_BEGIN_NAMESPACE
class DSnapStandardPathsPrivate
{
public:
inline static QString writableLocation(QStandardPaths::StandardLocation /*type*/)
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
return env.value("SNAP_USER_COMMON");
}
inline static QStringList standardLocations(QStandardPaths::StandardLocation type)
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
switch (type) {
case QStandardPaths::GenericDataLocation: {
QString snapRoot = env.value("SNAP");
QString genericDataDir = snapRoot + "/usr/share/";
return QStringList() << genericDataDir;
}
default:
break;
}
return QStringList() << env.value("SNAP_USER_COMMON");
}
private:
DSnapStandardPathsPrivate();
~DSnapStandardPathsPrivate();
Q_DISABLE_COPY(DSnapStandardPathsPrivate)
};
/*!
\class Dtk::Core::DStandardPaths
\inmodule dtkcore
\brief DStandardPaths提供兼容Snap/Dtk标准的路径模式。DStandardPaths实现了Qt的QStandardPaths主要接口.
\sa QStandardPaths
*/
/*!
\enum Dtk::Core::DStandardPaths::Mode
\brief DStandardPaths支持的路径产生模式。
\value Auto
\brief 和Qt标准的行为表现一致。
\value Snap
\brief 读取SNAP相关的环境变量,支持将配置存储在SNAP对应目录。
\value Test
\brief 和Qt标准的行为表现一致,但是会开启测试模式,参考QStandardPaths::setTestModeEnabled。
*/
static DStandardPaths::Mode s_mode = DStandardPaths::Auto;
QString DStandardPaths::writableLocation(QStandardPaths::StandardLocation type)
{
switch (s_mode) {
case Auto:
case Test:
return QStandardPaths::writableLocation(type);
case Snap:
return DSnapStandardPathsPrivate::writableLocation(type);
}
return QStandardPaths::writableLocation(type);
}
QStringList DStandardPaths::standardLocations(QStandardPaths::StandardLocation type)
{
switch (s_mode) {
case Auto:
case Test:
return QStandardPaths::standardLocations(type);
case Snap:
return DSnapStandardPathsPrivate::standardLocations(type);
}
return QStandardPaths::standardLocations(type);
}
QString DStandardPaths::locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
{
return QStandardPaths::locate(type, fileName, options);
}
QStringList DStandardPaths::locateAll(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
{
return QStandardPaths::locateAll(type, fileName, options);
}
QString DStandardPaths::findExecutable(const QString &executableName, const QStringList &paths)
{
return QStandardPaths::findExecutable(executableName, paths);
}
void DStandardPaths::setMode(DStandardPaths::Mode mode)
{
s_mode = mode;
QStandardPaths::setTestModeEnabled(mode == Test);
}
// https://gitlabwh.uniontech.com/wuhan/se/deepin-specifications/-/issues/21
QString DStandardPaths::homePath()
{
const QByteArray &home = qgetenv("HOME");
if (!home.isEmpty())
return QString::fromLocal8Bit(home);
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
return QString::fromLocal8Bit(homedir);
}
QString DStandardPaths::path(DStandardPaths::XDG type)
{
switch (type) {
case XDG::DataHome: {
const QByteArray &path = qgetenv("XDG_DATA_HOME");
if (!path.isEmpty())
return QString::fromLocal8Bit(path);
return homePath() + QStringLiteral("/.local/share");
}
case XDG::CacheHome: {
const QByteArray &path = qgetenv("XDG_CACHE_HOME");
if (!path.isEmpty())
return QString::fromLocal8Bit(path);
return homePath() + QStringLiteral("/.cache");
}
case XDG::ConfigHome: {
const QByteArray &path = qgetenv("XDG_CONFIG_HOME");
if (!path.isEmpty())
return QString::fromLocal8Bit(path);
return homePath() + QStringLiteral("/.config");
}
case XDG::RuntimeTime: {
const QByteArray &path = qgetenv("XDG_RUNTIME_DIR");
if (!path.isEmpty())
return QString::fromLocal8Bit(path);
return QStringLiteral("/run/user/") + QString::number(getuid());
}
}
return QString();
}
QString DStandardPaths::path(DStandardPaths::DSG type)
{
switch (type) {
case DSG::AppData: {
const QByteArray &path = qgetenv("DSG_APP_DATA");
//TODO 应用数据目录规范:`/deepin/appdata/{appid}`, now `appid` is not captured.
return QString::fromLocal8Bit(path);
}
case DSG::DataDir: {
const QByteArray &path = qgetenv("DSG_DATA_DIR");
if (!path.isEmpty())
return QString::fromLocal8Bit(path);
return QStringLiteral("/usr/share/dsg");
}
}
return QString();
}
QString DStandardPaths::filePath(DStandardPaths::XDG type, QString fileName)
{
const QString &dir = path(type);
if (dir.isEmpty())
return QString();
return dir + QLatin1Char('/') + fileName;
}
QString DStandardPaths::filePath(DStandardPaths::DSG type, const QString fileName)
{
const QString &dir = path(type);
if (dir.isEmpty())
return QString();
return dir + QLatin1Char('/') + fileName;
}
QString DStandardPaths::homePath(const uint uid)
{
struct passwd *pw = getpwuid(uid);
if (!pw)
return QString();
const char *homedir = pw->pw_dir;
return QString::fromLocal8Bit(homedir);
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/filesystem/dstandardpaths.h 0000664 0000000 0000000 00000004311 14154026022 0021364 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2017 ~ 2021 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 DTK_CORE_FILESYSTEM_DSTANDARDPATHS_H
#define DTK_CORE_FILESYSTEM_DSTANDARDPATHS_H
#include
#include "dtkcore_global.h"
DCORE_BEGIN_NAMESPACE
class DStandardPathsPrivate;
class LIBDTKCORESHARED_EXPORT DStandardPaths
{
public:
enum Mode {
Auto,
Snap,
Test,
};
static QString writableLocation(QStandardPaths::StandardLocation type);
static QStringList standardLocations(QStandardPaths::StandardLocation type);
static QString locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options = QStandardPaths::LocateFile);
static QStringList locateAll(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options = QStandardPaths::LocateFile);
static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList());
static void setMode(Mode mode);
enum class XDG {
DataHome,
ConfigHome,
CacheHome,
RuntimeTime
};
enum class DSG {
AppData,
DataDir
};
static QString homePath();
static QString homePath(const uint uid);
static QString path(XDG type);
static QString path(DSG type);
static QString filePath(XDG type, QString fileName);
static QString filePath(DSG type, QString fileName);
private:
DStandardPaths();
~DStandardPaths();
Q_DISABLE_COPY(DStandardPaths)
};
DCORE_END_NAMESPACE
#endif // DTK_CORE_FILESYSTEM_DSTANDARDPATHS_H
dtkcore-5.5.23/src/filesystem/dtrashmanager.h 0000664 0000000 0000000 00000002361 14154026022 0021203 0 ustar 00root root 0000000 0000000 /*
* 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 DTRASHMANAGER_H
#define DTRASHMANAGER_H
#include
#include
#include
DCORE_BEGIN_NAMESPACE
class DTrashManagerPrivate;
class LIBDTKCORESHARED_EXPORT DTrashManager : public QObject, public DObject
{
public:
static DTrashManager *instance();
bool trashIsEmpty() const;
bool cleanTrash();
bool moveToTrash(const QString &filePath, bool followSymlink = false);
protected:
DTrashManager();
private:
D_DECLARE_PRIVATE(DTrashManager)
};
DCORE_END_NAMESPACE
#endif // DTRASHMANAGER_H
dtkcore-5.5.23/src/filesystem/dtrashmanager_dummy.cpp 0000664 0000000 0000000 00000007210 14154026022 0022747 0 ustar 00root root 0000000 0000000 /*
* 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 "dtrashmanager.h"
#include "DObjectPrivate"
#include
#include
#include
#include
#include
DCORE_BEGIN_NAMESPACE
class DTrashManager_ : public DTrashManager {};
Q_GLOBAL_STATIC(DTrashManager_, globalTrashManager)
static QString getNotExistsFileName(const QString &fileName, const QString &targetPath)
{
QByteArray name = fileName.toUtf8();
int index = name.lastIndexOf('.');
QByteArray suffix;
if (index >= 0)
{
suffix = name.mid(index);
}
if (suffix.size() > 200)
{
suffix = suffix.left(200);
}
name.chop(suffix.size());
name = name.left(200 - suffix.size());
while (QFile::exists(targetPath + "/" + name + suffix))
{
name = QCryptographicHash::hash(name, QCryptographicHash::Md5).toHex();
}
return QString::fromUtf8(name + suffix);
}
static bool renameFile(const QFileInfo &fileInfo, const QString &target, QString *errorString = NULL)
{
if (fileInfo.isFile() || fileInfo.isSymLink())
{
QFile file(fileInfo.filePath());
if (!file.rename(target))
{
if (errorString)
{
*errorString = file.errorString();
}
return false;
}
return true;
}
else
{
QDirIterator iterator(fileInfo.filePath(),
QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
while (iterator.hasNext())
{
iterator.next();
const QString newFile = iterator.filePath().replace(0, fileInfo.filePath().length(), target);
if (!QDir().mkpath(QFileInfo(newFile).path()))
{
if (errorString)
{
*errorString = QString("Make the %1 path is failed").arg(QFileInfo(newFile).path());
}
return false;
}
if (!renameFile(iterator.fileInfo(), newFile, errorString))
{
return false;
}
}
if (!QDir().rmdir(fileInfo.filePath()))
{
if (errorString)
{
*errorString = QString("Cannot remove the %1 dir").arg(fileInfo.filePath());
}
return false;
}
}
return true;
}
class DTrashManagerPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate
{
public:
DTrashManagerPrivate(DTrashManager *q_ptr)
: DObjectPrivate(q_ptr) {}
D_DECLARE_PUBLIC(DTrashManager)
};
DTrashManager *DTrashManager::instance()
{
return globalTrashManager;
}
bool DTrashManager::trashIsEmpty() const
{
return false;
}
bool DTrashManager::cleanTrash()
{
return false;
}
bool DTrashManager::moveToTrash(const QString &filePath, bool followSymlink)
{
return false;
}
DTrashManager::DTrashManager()
: QObject()
, DObject(*new DTrashManagerPrivate(this))
{
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/filesystem/dtrashmanager_linux.cpp 0000664 0000000 0000000 00000015763 14154026022 0022767 0 ustar 00root root 0000000 0000000 /*
* 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 "dtrashmanager.h"
#include "dstandardpaths.h"
#include "private/dobject_p.h"
#include
#include
#include
#include
#include
#define TRASH_PATH \
DStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/Trash"
#define TRASH_INFO_PATH TRASH_PATH"/info"
#define TRASH_FILES_PATH TRASH_PATH"/files"
DCORE_BEGIN_NAMESPACE
class DTrashManager_ : public DTrashManager {};
Q_GLOBAL_STATIC(DTrashManager_, globalTrashManager)
static QString getNotExistsFileName(const QString &fileName, const QString &targetPath)
{
QByteArray name = fileName.toUtf8();
int index = name.lastIndexOf('.');
QByteArray suffix;
if (index >= 0) {
suffix = name.mid(index);
}
if (suffix.size() > 200) {
suffix = suffix.left(200);
}
name.chop(suffix.size());
name = name.left(200 - suffix.size());
while (QFile::exists(targetPath + "/" + name + suffix)) {
name = QCryptographicHash::hash(name, QCryptographicHash::Md5).toHex();
}
return QString::fromUtf8(name + suffix);
}
static bool writeTrashInfo(const QString &fileBaseName, const QString &sourceFilePath, const QDateTime &datetime, QString *errorString = NULL)
{
QFile metadata(TRASH_INFO_PATH"/" + fileBaseName + ".trashinfo");
if (metadata.exists()) {
if (errorString) {
*errorString = QString("The %1 file is exists").arg(metadata.fileName());
}
return false;
}
if (!metadata.open(QIODevice::WriteOnly)) {
if (errorString) {
*errorString = metadata.errorString();
}
return false;
}
QByteArray data;
data.append("[Trash Info]\n");
data.append("Path=").append(sourceFilePath.toUtf8().toPercentEncoding("/")).append("\n");
data.append("DeletionDate=").append(datetime.toString(Qt::ISODate)).append("\n");
qint64 size = metadata.write(data);
metadata.close();
if (size <= 0) {
if (errorString) {
*errorString = metadata.errorString();
}
return false;
}
return true;
}
static bool renameFile(const QFileInfo &fileInfo, const QString &target, QString *errorString = NULL)
{
if (fileInfo.isFile() || fileInfo.isSymLink()) {
QFile file(fileInfo.filePath());
if (!file.rename(target)) {
if (errorString) {
*errorString = file.errorString();
}
return false;
}
return true;
} else {
QDirIterator iterator(fileInfo.filePath(),
QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
while (iterator.hasNext()) {
iterator.next();
const QString newFile = iterator.filePath().replace(0, fileInfo.filePath().length(), target);
if (!QDir().mkpath(QFileInfo(newFile).path())) {
if (errorString) {
*errorString = QString("Make the %1 path is failed").arg(QFileInfo(newFile).path());
}
return false;
}
if (!renameFile(iterator.fileInfo(), newFile, errorString)) {
return false;
}
}
if (!QDir().rmdir(fileInfo.filePath())) {
if (errorString) {
*errorString = QString("Cannot remove the %1 dir").arg(fileInfo.filePath());
}
return false;
}
}
return true;
}
class DTrashManagerPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate
{
public:
DTrashManagerPrivate(DTrashManager *q_ptr)
: DObjectPrivate(q_ptr) {}
static bool removeFileOrDir(const QString &path);
static bool removeFromIterator(QDirIterator &iter);
D_DECLARE_PUBLIC(DTrashManager)
};
DTrashManager *DTrashManager::instance()
{
return globalTrashManager;
}
bool DTrashManager::trashIsEmpty() const
{
QDirIterator iterator(TRASH_INFO_PATH,
// QStringList() << "*.trashinfo",
QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden);
return !iterator.hasNext();
}
bool DTrashManager::cleanTrash()
{
QDirIterator iterator_info(TRASH_INFO_PATH,
QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden);
QDirIterator iterator_files(TRASH_FILES_PATH,
QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System,
QDirIterator::Subdirectories);
return DTrashManagerPrivate::removeFromIterator(iterator_info) &&
DTrashManagerPrivate::removeFromIterator(iterator_files);
}
bool DTrashManager::moveToTrash(const QString &filePath, bool followSymlink)
{
QFileInfo fileInfo(filePath);
if (!fileInfo.exists() && (followSymlink || !fileInfo.isSymLink())) {
return false;
}
QDir trashDir(TRASH_FILES_PATH);
QStorageInfo storageInfo(fileInfo.filePath());
QStorageInfo trashStorageInfo(trashDir);
if (storageInfo != trashStorageInfo) {
return false;
}
if (!trashDir.mkpath(TRASH_INFO_PATH)) {
return false;
}
if (!trashDir.mkpath(TRASH_FILES_PATH)) {
return false;
}
if (followSymlink && fileInfo.isSymLink()) {
fileInfo.setFile(fileInfo.symLinkTarget());
}
const QString &fileName = getNotExistsFileName(fileInfo.fileName(), TRASH_FILES_PATH);
if (!writeTrashInfo(fileName, fileInfo.filePath(), QDateTime::currentDateTime())) {
return false;
}
const QString &newFilePath = TRASH_FILES_PATH"/" + fileName;
return renameFile(fileInfo, newFilePath);
}
DTrashManager::DTrashManager()
: QObject()
, DObject(*new DTrashManagerPrivate(this))
{
}
bool DTrashManagerPrivate::removeFileOrDir(const QString &path)
{
QFileInfo fileInfo(path);
if (fileInfo.isDir() && !fileInfo.isSymLink()) {
QDir dir(path);
return dir.removeRecursively();
} else {
return QFile::remove(path);
}
}
bool DTrashManagerPrivate::removeFromIterator(QDirIterator &iter)
{
bool ok = true;
while (iter.hasNext()) {
QString nextPath = iter.next();
// qDebug() << iter.fileName() << iterator_info.filePath();
if (!DTrashManagerPrivate::removeFileOrDir(nextPath)) {
ok = false;
}
}
return ok;
}
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/filesystem/filesystem.pri 0000664 0000000 0000000 00000001772 14154026022 0021117 0 ustar 00root root 0000000 0000000 include($$PWD/private/private.pri)
INCLUDEPATH += $$PWD/../base
HEADERS += \
$$PWD/dbasefilewatcher.h \
$$PWD/dfilesystemwatcher.h \
$$PWD/dfilewatcher.h \
$$PWD/dfilewatchermanager.h \
$$PWD/dpathbuf.h \
$$PWD/dstandardpaths.h \
$$PWD/dtrashmanager.h
SOURCES += \
$$PWD/dbasefilewatcher.cpp \
$$PWD/dfilewatcher.cpp \
$$PWD/dfilewatchermanager.cpp \
$$PWD/dstandardpaths.cpp \
$$PWD/dpathbuf.cpp
linux {
SOURCES += \
$$PWD/dfilesystemwatcher_linux.cpp \
$$PWD/dtrashmanager_linux.cpp
} else:win* {
SOURCES += \
$$PWD/dfilesystemwatcher_win.cpp \
$$PWD/dtrashmanager_dummy.cpp
} else {
SOURCES += \
$$PWD/dfilesystemwatcher_dummy.cpp \
$$PWD/dtrashmanager_dummy.cpp
}
includes.files += $$PWD/*.h
includes.files += \
$$PWD/DFileWatcher \
$$PWD/DBaseFileWatcher \
$$PWD/DFileSystemWatcher \
$$PWD/DFileWatcherManager \
$$PWD/DPathBuf \
$$PWD/DStandardPaths \
$$PWD/DTrashManager
dtkcore-5.5.23/src/filesystem/private/ 0000775 0000000 0000000 00000000000 14154026022 0017662 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/src/filesystem/private/dbasefilewatcher_p.h 0000664 0000000 0000000 00000002321 14154026022 0023644 0 ustar 00root root 0000000 0000000 /*
* 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 DBASEFILEWATCHER_P_H
#define DBASEFILEWATCHER_P_H
#include "base/private/dobject_p.h"
#include
DCORE_BEGIN_NAMESPACE
class DBaseFileWatcher;
class DBaseFileWatcherPrivate : public DObjectPrivate
{
public:
DBaseFileWatcherPrivate(DBaseFileWatcher *qq);
virtual bool start() = 0;
virtual bool stop() = 0;
QUrl url;
bool started = false;
static QList watcherList;
D_DECLARE_PUBLIC(DBaseFileWatcher)
};
DCORE_END_NAMESPACE
#endif // DBASEFILEWATCHER_P_H
dtkcore-5.5.23/src/filesystem/private/dfilesystemwatcher_dummy_p.h 0000664 0000000 0000000 00000002337 14154026022 0025500 0 ustar 00root root 0000000 0000000 /*
* 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 DFILESYSTEMWATCHER_WIN_P_H
#define DFILESYSTEMWATCHER_WIN_P_H
#include "base/private/dobject_p.h"
DCORE_BEGIN_NAMESPACE
class DFileSystemWatcher;
class DFileSystemWatcherPrivate : public DObjectPrivate
{
Q_DECLARE_PUBLIC(DFileSystemWatcher)
public:
DFileSystemWatcherPrivate(int fd, DFileSystemWatcher *qq);
~DFileSystemWatcherPrivate();
// private slots
void _q_readFromInotify();
};
void DFileSystemWatcherPrivate::_q_readFromInotify()
{
}
DCORE_END_NAMESPACE
#endif // DFILESYSTEMWATCHER_WIN_P_H
dtkcore-5.5.23/src/filesystem/private/dfilesystemwatcher_linux_p.h 0000664 0000000 0000000 00000003301 14154026022 0025474 0 ustar 00root root 0000000 0000000 /*
* 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 DFILESYSTEMWATCHER_P_H
#define DFILESYSTEMWATCHER_P_H
#include "base/private/dobject_p.h"
#include
#include
#include
DCORE_BEGIN_NAMESPACE
class DFileSystemWatcher;
class DFileSystemWatcherPrivate : public DObjectPrivate
{
Q_DECLARE_PUBLIC(DFileSystemWatcher)
public:
DFileSystemWatcherPrivate(int fd, DFileSystemWatcher *qq);
~DFileSystemWatcherPrivate();
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList files, directories;
int inotifyFd;
QHash pathToID;
QMultiHash idToPath;
QSocketNotifier notifier;
// private slots
void _q_readFromInotify();
private:
void onFileChanged(const QString &path, bool removed);
void onDirectoryChanged(const QString &path, bool removed);
};
DCORE_END_NAMESPACE
#endif // DFILESYSTEMWATCHER_P_H
dtkcore-5.5.23/src/filesystem/private/dfilesystemwatcher_win_p.h 0000664 0000000 0000000 00000002337 14154026022 0025142 0 ustar 00root root 0000000 0000000 /*
* 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 DFILESYSTEMWATCHER_WIN_P_H
#define DFILESYSTEMWATCHER_WIN_P_H
#include "base/private/dobject_p.h"
DCORE_BEGIN_NAMESPACE
class DFileSystemWatcher;
class DFileSystemWatcherPrivate : public DObjectPrivate
{
Q_DECLARE_PUBLIC(DFileSystemWatcher)
public:
DFileSystemWatcherPrivate(int fd, DFileSystemWatcher *qq);
~DFileSystemWatcherPrivate();
// private slots
void _q_readFromInotify();
};
void DFileSystemWatcherPrivate::_q_readFromInotify()
{
}
DCORE_END_NAMESPACE
#endif // DFILESYSTEMWATCHER_WIN_P_H
dtkcore-5.5.23/src/filesystem/private/private.pri 0000664 0000000 0000000 00000000273 14154026022 0022052 0 ustar 00root root 0000000 0000000 HEADERS += \
$$PWD/dbasefilewatcher_p.h
linux {
HEADERS += \
$$PWD/dfilesystemwatcher_linux_p.h
} else:win* {
HEADERS += \
$$PWD/dfilesystemwatcher_win_p.h
}
dtkcore-5.5.23/src/log/ 0000775 0000000 0000000 00000000000 14154026022 0014605 5 ustar 00root root 0000000 0000000 dtkcore-5.5.23/src/log/AbstractAppender.cpp 0000664 0000000 0000000 00000013624 14154026022 0020541 0 ustar 00root root 0000000 0000000 /*
* 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 .
*/
// Local
#include "AbstractAppender.h"
// Qt
#include
DCORE_BEGIN_NAMESPACE
/*!
\class Dtk::Core::AbstractAppender
\inmodule dtkcore
\brief The AbstractAppender class provides an abstract base class for writing a log entries.
The AbstractAppender class is the base interface class for all log appenders that could be used with Logger.
AbstractAppender provides a common implementation for the thread safe, mutex-protected logging of application
messages, such as ConsoleAppender, FileAppender or something else. AbstractAppender is abstract and can not be
instantiated, but you can use any of its subclasses or create a custom log appender at your choice.
Appenders are the logical devices that is aimed to be attached to Logger object by calling
Logger::registerAppender(). On each log record call from the application Logger object sequentially calls write()
function on all the appenders registered in it.
You can subclass AbstractAppender to implement a logging target of any kind you like. It may be the external logging
subsystem (for example, syslog in *nix), XML file, SQL database entries, D-Bus messages or anything else you can
imagine.
For the simple non-structured plain text logging (for example, to a plain text file or to the console output) you may
like to subclass the AbstractStringAppender instead of AbstractAppender, which will give you a more convenient way to
control the format of the log output.
\sa AbstractStringAppender
\sa Logger::registerAppender()
*/
/*!
\brief Constructs a AbstractAppender object.
*/
AbstractAppender::AbstractAppender()
: m_detailsLevel(Logger::Debug)
{}
/*!
\brief Destructs the AbstractAppender object.
*/
AbstractAppender::~AbstractAppender()
{}
/*!
\brief Returns the current details level of appender.
Log records with a log level lower than a current detailsLevel() will be silently ignored by appender and would not
be sent to its append() function.
It provides additional logging flexibility, allowing you to set the different severity levels for different types
of logs.
\note This function is thread safe.
\return The log level.
\sa setDetailsLevel()
\sa Logger::LogLevel
*/
Logger::LogLevel AbstractAppender::detailsLevel() const
{
QMutexLocker locker(&m_detailsLevelMutex);
return m_detailsLevel;
}
/*!
\brief Sets the current details level of appender.
Default details \a level is Logger::Debug
\note This function is thread safe.
\sa detailsLevel()
\sa Logger::LogLevel
*/
void AbstractAppender::setDetailsLevel(Logger::LogLevel level)
{
QMutexLocker locker(&m_detailsLevelMutex);
m_detailsLevel = level;
}
/*!
\brief Sets the current details \a level of appender.
This function is provided for convenience, it behaves like an above function.
\sa detailsLevel()
\sa Logger::LogLevel
*/
void AbstractAppender::setDetailsLevel(const QString& level)
{
setDetailsLevel(Logger::levelFromString(level));
}
/*!
\brief Tries to write the log record to this logger.
This is the function called by Logger object to write a log \a message to the appender.
The \a timeStamp parameter indicates the time stamp.
The \a logLevel parameter describes the LogLevel.
The \a file parameter is the current file name.
The \a line parameter indicates the number of lines to output.
The \a function parameter indicates the function name to output.
The \a category parameter indicates the log category.
The \a message parameter indicates the output message.
\note This function is thread safe.
\sa Logger::write()
\sa detailsLevel()
*/
void AbstractAppender::write(const QDateTime& timeStamp, Logger::LogLevel logLevel, const char* file, int line,
const char* function, const QString& category, const QString& message)
{
if (logLevel >= detailsLevel())
{
QMutexLocker locker(&m_writeMutex);
append(timeStamp, logLevel, file, line, function, category, message);
}
}
/*!
\fn virtual void AbstractAppender::append(const QDateTime &timeStamp, Logger::LogLevel logLevel, const char *file, int line,
const char *function, const QString &category, const QString &message) = 0
\brief Writes the log record to the logger instance
This function is called every time when user tries to write a message to this AbstractAppender instance using
the write() function. Write function works as proxy and transfers only the messages with log level more or equal
to the current logLevel().
Overload this function when you are implementing a custom appender.
The \a timeStamp parameter indicates the time stamp.
The \a logLevel parameter describes the LogLevel.
The \a file parameter is the current file name.
The \a line parameter indicates the number of lines to output.
The \a function parameter indicates the function name to output.
The \a category parameter indicates the log category.
The \a message parameter indicates the output message.
\note This function is not needed to be thread safe because it is never called directly by Logger object. The
write() function works as a proxy and protects this function from concurrent access.
\sa Logger::write()
*/
DCORE_END_NAMESPACE
dtkcore-5.5.23/src/log/AbstractAppender.h 0000664 0000000 0000000 00000003062 14154026022 0020201 0 ustar 00root root 0000000 0000000 /*
Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 2.1
as published by the Free Software Foundation and appearing in the file
LICENSE.LGPL included in the packaging of this file.
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 Lesser General Public License for more details.
*/
#ifndef ABSTRACTAPPENDER_H
#define ABSTRACTAPPENDER_H
// Local
#include "CuteLogger_global.h"
#include
// Qt
#include
DCORE_BEGIN_NAMESPACE
class CUTELOGGERSHARED_EXPORT AbstractAppender
{
public:
AbstractAppender();
virtual ~AbstractAppender();
Logger::LogLevel detailsLevel() const;
void setDetailsLevel(Logger::LogLevel level);
void setDetailsLevel(const QString &level);
void write(const QDateTime &timeStamp, Logger::LogLevel logLevel, const char *file, int line, const char *function,
const QString &category, const QString &message);
protected:
virtual void append(const QDateTime &timeStamp, Logger::LogLevel logLevel, const char *file, int line,
const char *function, const QString &category, const QString &message) = 0;
private:
QMutex m_writeMutex;
Logger::LogLevel m_detailsLevel;
mutable QMutex m_detailsLevelMutex;
};
DCORE_END_NAMESPACE
#endif // ABSTRACTAPPENDER_H
dtkcore-5.5.23/src/log/AbstractStringAppender.cpp 0000664 0000000 0000000 00000035676 14154026022 0021743 0 ustar 00root root 0000000 0000000 /*
Copyright (c) 2010 Boris Moiseev (cyberbobs at gmail dot com) Nikolay Matyunin (matyunin.n at gmail dot com)
Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 2.1
as published by the Free Software Foundation and appearing in the file
LICENSE.LGPL included in the packaging of this file.
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 Lesser General Public License for more details.
*/
// Local
#include "AbstractStringAppender.h"
// Qt
#include
#include
#include
#include
#include
#include