From 39e75a269416eb341cecc5c12728aa577eece1b6 Mon Sep 17 00:00:00 2001 From: Boyuan Yang Date: Tue, 5 May 2020 09:47:10 -0400 Subject: [PATCH] New upstream version 5.2.0 --- .gitlab-ci.yml | 5 + .qmake.conf | 2 +- CHANGELOG.md | 1 - LICENSE | 828 +++---------- README.md | 2 +- cmake/DtkCMake/DtkCMakeConfig.cmake | 6 + cmake/DtkTools/DtkSettingsToolsMacros.cmake | 53 + cmake/DtkTools/DtkToolsConfig.cmake | 9 + debian/changelog | 12 + debian/control | 10 +- debian/copyright | 12 +- debian/libdtkcore2.install | 1 - debian/libdtkcore2.symbols | 655 ----------- ...re-bin.install => libdtkcore5-bin.install} | 0 debian/libdtkcore5.install | 2 + dtk_build_config.prf | 4 +- examples/examples.pro | 2 + examples/expintf-example/expintf-example.pro | 16 + examples/expintf-example/main.cpp | 72 ++ src/DDesktopEntry | 1 + src/DSecureString | 1 + src/base/base.pri | 1 + src/base/dobject.cpp | 4 +- src/base/dobject.h | 4 +- src/base/dsingleton.h | 4 +- src/base/private/dobject_p.h | 4 +- src/com.deepin.dtk.gschema.xml | 16 + src/ddesktopentry.cpp | 1043 +++++++++++++++++ src/ddesktopentry.h | 113 ++ src/dsecurestring.cpp | 36 + src/dsecurestring.h | 36 + src/dsysinfo.cpp | 259 +++- src/dsysinfo.h | 37 +- src/dtk_module.prf | 4 +- src/dtk_qmake.prf | 9 +- src/dtkcore_global.h | 4 +- src/filesystem/DTrashManager | 1 + src/filesystem/dbasefilewatcher.cpp | 4 +- src/filesystem/dbasefilewatcher.h | 4 +- src/filesystem/dfilesystemwatcher.h | 4 +- src/filesystem/dfilesystemwatcher_dummy.cpp | 4 +- src/filesystem/dfilesystemwatcher_linux.cpp | 271 +++-- src/filesystem/dfilesystemwatcher_win.cpp | 4 +- src/filesystem/dfilewatcher.cpp | 4 +- src/filesystem/dfilewatcher.h | 4 +- src/filesystem/dfilewatchermanager.cpp | 4 +- src/filesystem/dfilewatchermanager.h | 4 +- src/filesystem/dpathbuf.h | 4 +- src/filesystem/dstandardpaths.cpp | 4 +- src/filesystem/dstandardpaths.h | 4 +- src/filesystem/dtrashmanager.h | 47 + src/filesystem/dtrashmanager_dummy.cpp | 156 +++ src/filesystem/dtrashmanager_linux.cpp | 260 ++++ src/filesystem/filesystem.pri | 15 +- src/filesystem/private/dbasefilewatcher_p.h | 4 +- .../private/dfilesystemwatcher_dummy_p.h | 4 +- .../private/dfilesystemwatcher_linux_p.h | 5 +- .../private/dfilesystemwatcher_win_p.h | 4 +- src/log/AbstractAppender.cpp | 4 +- src/log/CuteLogger_global.h | 4 +- src/log/LogManager.cpp | 4 +- src/log/LogManager.h | 4 +- src/log/RollingFileAppender.cpp | 4 +- src/log/RollingFileAppender.h | 4 +- src/settings/backend/qsettingbackend.cpp | 4 +- src/settings/backend/qsettingbackend.h | 4 +- src/settings/dsettings.cpp | 25 +- src/settings/dsettings.h | 4 +- src/settings/dsettingsbackend.h | 4 +- src/settings/dsettingsgroup.cpp | 4 +- src/settings/dsettingsgroup.h | 4 +- src/settings/dsettingsoption.cpp | 7 +- src/settings/dsettingsoption.h | 4 +- src/src.pro | 17 +- src/util/DExportedInterface | 1 + src/util/DFileServices | 1 + src/util/DVtableHook | 1 + src/util/dabstractunitformatter.cpp | 4 +- src/util/dabstractunitformatter.h | 4 +- src/util/ddisksizeformatter.cpp | 4 +- src/util/ddisksizeformatter.h | 4 +- src/util/dexportedinterface.cpp | 151 +++ src/util/dexportedinterface.h | 52 + src/util/dfileservices.h | 55 + src/util/dfileservices_dummy.cpp | 162 +++ src/util/dfileservices_linux.cpp | 151 +++ src/util/dnotifysender.cpp | 4 +- src/util/dpinyin.cpp | 79 ++ src/util/dpinyin.h | 57 +- src/util/drecentmanager.cpp | 4 +- src/util/drecentmanager.h | 4 +- src/util/dtimeunitformatter.cpp | 4 +- src/util/dtimeunitformatter.h | 4 +- src/util/dutil.h | 18 +- src/util/dvtablehook.cpp | 320 +++++ src/util/dvtablehook.h | 306 +++++ src/util/util.pri | 25 +- src/version.pri | 32 - tests/ddesktopentry/CMakeLists.txt | 8 + tests/ddesktopentry/ddesktopentry.pro | 27 + tests/ddesktopentry/tst_ddesktopentrytest.cpp | 123 ++ tests/{ => dutils}/data.qrc | 0 tests/{ => dutils}/data/dt-settings.json | 0 tests/dutils/dutils.pro | 29 + tests/{ => dutils}/dutiltester.cpp | 9 +- tests/{ => dutils}/dutiltester.h | 4 +- tests/{ => dutils}/main.cpp | 4 +- tests/{ => dutils}/singletontester.cpp | 4 +- tests/{ => dutils}/singletontester.h | 4 +- tests/dvtablehook/dvtablehook.pro | 25 + tests/dvtablehook/tst_dvtablehook.cpp | 115 ++ tests/tests.pro | 34 +- tools/deepin-os-release/deepin-os-release.pro | 6 +- tools/deepin-os-release/main.cpp | 35 +- tools/settings/main.cpp | 4 +- 115 files changed, 4329 insertions(+), 1733 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 cmake/DtkTools/DtkSettingsToolsMacros.cmake create mode 100644 cmake/DtkTools/DtkToolsConfig.cmake delete mode 100644 debian/libdtkcore2.install delete mode 100644 debian/libdtkcore2.symbols rename debian/{libdtkcore-bin.install => libdtkcore5-bin.install} (100%) create mode 100644 debian/libdtkcore5.install create mode 100644 examples/examples.pro create mode 100644 examples/expintf-example/expintf-example.pro create mode 100644 examples/expintf-example/main.cpp create mode 100644 src/DDesktopEntry create mode 100644 src/DSecureString create mode 100644 src/com.deepin.dtk.gschema.xml create mode 100644 src/ddesktopentry.cpp create mode 100644 src/ddesktopentry.h create mode 100644 src/dsecurestring.cpp create mode 100644 src/dsecurestring.h create mode 100644 src/filesystem/DTrashManager create mode 100644 src/filesystem/dtrashmanager.h create mode 100644 src/filesystem/dtrashmanager_dummy.cpp create mode 100644 src/filesystem/dtrashmanager_linux.cpp create mode 100644 src/util/DExportedInterface create mode 100644 src/util/DFileServices create mode 100644 src/util/DVtableHook create mode 100644 src/util/dexportedinterface.cpp create mode 100644 src/util/dexportedinterface.h create mode 100644 src/util/dfileservices.h create mode 100644 src/util/dfileservices_dummy.cpp create mode 100644 src/util/dfileservices_linux.cpp create mode 100644 src/util/dpinyin.cpp create mode 100644 src/util/dvtablehook.cpp create mode 100644 src/util/dvtablehook.h delete mode 100644 src/version.pri create mode 100644 tests/ddesktopentry/CMakeLists.txt create mode 100644 tests/ddesktopentry/ddesktopentry.pro create mode 100644 tests/ddesktopentry/tst_ddesktopentrytest.cpp rename tests/{ => dutils}/data.qrc (100%) rename tests/{ => dutils}/data/dt-settings.json (100%) create mode 100644 tests/dutils/dutils.pro rename tests/{ => dutils}/dutiltester.cpp (96%) rename tests/{ => dutils}/dutiltester.h (85%) rename tests/{ => dutils}/main.cpp (80%) rename tests/{ => dutils}/singletontester.cpp (86%) rename tests/{ => dutils}/singletontester.h (86%) create mode 100644 tests/dvtablehook/dvtablehook.pro create mode 100644 tests/dvtablehook/tst_dvtablehook.cpp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6da6602 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,5 @@ +include: + - remote: 'https://gitlab.deepin.io/dev-tools/letmeci/raw/master/gitlab-ci/dde.yml' +variables: + CPPCHECK: "true" + CODESPELL: "true" diff --git a/.qmake.conf b/.qmake.conf index 924d996..ee2de90 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,2 +1,2 @@ -isEmpty(DTK_VERSION):DTK_VERSION=2.0.6 +isEmpty(DTK_VERSION):DTK_VERSION=5.0.0 DTK_MODULE_NAME=dtkcore diff --git a/CHANGELOG.md b/CHANGELOG.md index 729a6b0..15fbd7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,6 @@ ## 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)) diff --git a/LICENSE b/LICENSE index 10926e8..0a04128 100644 --- a/LICENSE +++ b/LICENSE @@ -1,675 +1,165 @@ - GNU GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. + 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. diff --git a/README.md b/README.md index dde05d6..150a69d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Deepin Tool Kit Core {#mainpage} +## Deepin Tool Kit Core {#mainpage} Deepint Tool Kit (Dtk) is the base development tool of all C++/Qt Developer work on Deepin. diff --git a/cmake/DtkCMake/DtkCMakeConfig.cmake b/cmake/DtkCMake/DtkCMakeConfig.cmake index 9700246..f8d62f1 100644 --- a/cmake/DtkCMake/DtkCMakeConfig.cmake +++ b/cmake/DtkCMake/DtkCMakeConfig.cmake @@ -47,6 +47,12 @@ else() 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 "") diff --git a/cmake/DtkTools/DtkSettingsToolsMacros.cmake b/cmake/DtkTools/DtkSettingsToolsMacros.cmake new file mode 100644 index 0000000..da1cd10 --- /dev/null +++ b/cmake/DtkTools/DtkSettingsToolsMacros.cmake @@ -0,0 +1,53 @@ +#============================================================================= +# 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() diff --git a/cmake/DtkTools/DtkToolsConfig.cmake b/cmake/DtkTools/DtkToolsConfig.cmake new file mode 100644 index 0000000..02ec88e --- /dev/null +++ b/cmake/DtkTools/DtkToolsConfig.cmake @@ -0,0 +1,9 @@ +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") \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index e2cb49a..63463dc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +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 diff --git a/debian/control b/debian/control index 5bbd5a0..0a5dde2 100644 --- a/debian/control +++ b/debian/control @@ -7,19 +7,19 @@ Build-Depends: debhelper (>= 9), pkg-config, libgsettings-qt-dev Standards-Version: 3.9.8 -Package: libdtkcore2 +Package: libdtkcore5 Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, lshw 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: libdtkcore-bin +Package: libdtkcore5-bin Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, - libdtkcore2( =${binary:Version}), deepin-desktop-base + libdtkcore5( =${binary:Version}) Description: Deepin Tool Kit Core Utilities DtkCore is base devel library of Deepin Qt/C++ applications. . @@ -27,7 +27,7 @@ Description: Deepin Tool Kit Core Utilities Package: libdtkcore-dev Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkcore2( =${binary:Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, libdtkcore5( =${binary:Version}) Description: Deepin Tool Kit Core Devel library DtkCore is base devel library of Deepin Qt/C++ applications. . diff --git a/debian/copyright b/debian/copyright index 893626e..7a0c37f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,19 +4,19 @@ Source: https://github.com/linuxdeepin/dtkcore Files: * Copyright: 2017 Deepin Technology Co., Ltd. -License: GPL-3+ +License: LGPL-3+ This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by + 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 General Public License for more details. + GNU Lesser General Public License for more details. . - You should have received a copy of the GNU General Public License + 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 General - Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + 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". diff --git a/debian/libdtkcore2.install b/debian/libdtkcore2.install deleted file mode 100644 index 3ddde58..0000000 --- a/debian/libdtkcore2.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/lib*.so.* diff --git a/debian/libdtkcore2.symbols b/debian/libdtkcore2.symbols deleted file mode 100644 index d366820..0000000 --- a/debian/libdtkcore2.symbols +++ /dev/null @@ -1,655 +0,0 @@ -# SymbolsHelper-Confirmed: 2.0.11 amd64 -libdtkcore.so.2 libdtkcore2 #MINVER# - _Z19qInitResources_utilv@Base 2.0.11 - _Z22qCleanupResources_utilv@Base 2.0.11 - _ZGVZN3Dtk4Core11DLogManager8instanceEvE8instance@Base 2.0.11 - _ZN10QByteArrayD1Ev@Base 2.0.11 - _ZN10QByteArrayD2Ev@Base 2.0.11 - (optional=templinst)_ZN11DDBusCaller3argI7QStringEES_RKT_@Base 2.0.11 - _ZN11DDBusCaller4callEv@Base 2.0.11 - _ZN11DDBusCallerC1ERK7QStringSt10shared_ptrI9DDBusDataE@Base 2.0.11 - _ZN11DDBusCallerC2ERK7QStringSt10shared_ptrI9DDBusDataE@Base 2.0.11 - _ZN11DDBusCallerD1Ev@Base 2.0.11 - _ZN11DDBusCallerD2Ev@Base 2.0.11 - _ZN11DDBusSender4pathERK7QString@Base 2.0.11 - _ZN11DDBusSender4typeEN15QDBusConnection7BusTypeE@Base 2.0.11 - _ZN11DDBusSender6methodERK7QString@Base 2.0.11 - _ZN11DDBusSender7serviceERK7QString@Base 2.0.11 - _ZN11DDBusSender8propertyERK7QString@Base 2.0.11 - _ZN11DDBusSender9interfaceERK7QString@Base 2.0.11 - _ZN11DDBusSenderC1Ev@Base 2.0.11 - _ZN11DDBusSenderC2Ev@Base 2.0.11 - (optional=templinst)_ZN12QWeakPointerI7QObjectED1Ev@Base 2.0.11 - (optional=templinst)_ZN12QWeakPointerI7QObjectED2Ev@Base 2.0.11 - _ZN13DDBusProperty3getEv@Base 2.0.11 - _ZN13DDBusPropertyC1ERK7QStringSt10shared_ptrI9DDBusDataE@Base 2.0.11 - _ZN13DDBusPropertyC2ERK7QStringSt10shared_ptrI9DDBusDataE@Base 2.0.11 - (optional=templinst)_ZN14QScopedPointerIN3Dtk4Core23GSettingsBackendPrivateE21QScopedPointerDeleterIS2_EED1Ev@Base 2.0.11 - (optional=templinst)_ZN14QScopedPointerIN3Dtk4Core23GSettingsBackendPrivateE21QScopedPointerDeleterIS2_EED2Ev@Base 2.0.11 - (optional=templinst)_ZN15QVarLengthArrayIcLi4096EEC1Ei@Base 2.0.11 - (optional=templinst)_ZN15QVarLengthArrayIcLi4096EEC2Ei@Base 2.0.11 - _ZN3Dtk4Core11DLogManager12setLogFormatERK7QString@Base 2.0.11 - _ZN3Dtk4Core11DLogManager14getlogFilePathEv@Base 2.0.11 - _ZN3Dtk4Core11DLogManager14setlogFilePathERK7QString@Base 2.0.11 - _ZN3Dtk4Core11DLogManager19initConsoleAppenderEv@Base 2.0.11 - _ZN3Dtk4Core11DLogManager20registerFileAppenderEv@Base 2.0.11 - _ZN3Dtk4Core11DLogManager23initRollingFileAppenderEv@Base 2.0.11 - _ZN3Dtk4Core11DLogManager23registerConsoleAppenderEv@Base 2.0.11 - _ZN3Dtk4Core11DLogManager8joinPathERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core11DLogManagerC1Ev@Base 2.0.11 - _ZN3Dtk4Core11DLogManagerC2Ev@Base 2.0.11 - _ZN3Dtk4Core11DLogManagerD1Ev@Base 2.0.11 - _ZN3Dtk4Core11DLogManagerD2Ev@Base 2.0.11 - _ZN3Dtk4Core11unqtifyNameERK7QString@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher11onFileMovedERK7QStringS4_S4_S4_@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher12onFileClosedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher13onFileCreatedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher13onFileDeletedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher14onFileModifiedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcher22onFileAttributeChangedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcherC1ERK7QStringP7QObject@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcherC2ERK7QStringP7QObject@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcherD0Ev@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcherD1Ev@Base 2.0.11 - _ZN3Dtk4Core12DFileWatcherD2Ev@Base 2.0.11 - _ZN3Dtk4Core12FileAppender11setFileNameERK7QString@Base 2.0.11 - _ZN3Dtk4Core12FileAppender6appendERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 2.0.11 - _ZN3Dtk4Core12FileAppender8openFileEv@Base 2.0.11 - _ZN3Dtk4Core12FileAppender9closeFileEv@Base 2.0.11 - _ZN3Dtk4Core12FileAppenderC1ERK7QString@Base 2.0.11 - _ZN3Dtk4Core12FileAppenderC2ERK7QString@Base 2.0.11 - _ZN3Dtk4Core12FileAppenderD0Ev@Base 2.0.11 - _ZN3Dtk4Core12FileAppenderD1Ev@Base 2.0.11 - _ZN3Dtk4Core12FileAppenderD2Ev@Base 2.0.11 - _ZN3Dtk4Core13LoggerPrivate14globalInstanceE@Base 2.0.11 - _ZN3Dtk4Core13LoggerPrivate18globalInstanceLockE@Base 2.0.11 - _ZN3Dtk4Core14DObjectPrivateC1EPNS0_7DObjectE@Base 2.0.11 - _ZN3Dtk4Core14DObjectPrivateC2EPNS0_7DObjectE@Base 2.0.11 - _ZN3Dtk4Core14DObjectPrivateD0Ev@Base 2.0.11 - _ZN3Dtk4Core14DObjectPrivateD1Ev@Base 2.0.11 - _ZN3Dtk4Core14DObjectPrivateD2Ev@Base 2.0.11 - _ZN3Dtk4Core14DRecentManager10removeItemERK7QString@Base 2.0.11 - _ZN3Dtk4Core14DRecentManager11removeItemsERK11QStringList@Base 2.0.11 - _ZN3Dtk4Core14DRecentManager7addItemERK7QStringRNS0_11DRecentDataE@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroup11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroup11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroup14setParentGroupE8QPointerIS1_E@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroup16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroup8fromJsonERK7QStringRK11QJsonObject@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroup9parseJsonERK7QStringRK11QJsonObject@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroupC1EP7QObject@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroupC2EP7QObject@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroupD0Ev@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroupD1Ev@Base 2.0.11 - _ZN3Dtk4Core14DSettingsGroupD2Ev@Base 2.0.11 - _ZN3Dtk4Core14DStandardPaths14findExecutableERK7QStringRK11QStringList@Base 2.0.11 - _ZN3Dtk4Core14DStandardPaths16writableLocationEN14QStandardPaths16StandardLocationE@Base 2.0.11 - _ZN3Dtk4Core14DStandardPaths17standardLocationsEN14QStandardPaths16StandardLocationE@Base 2.0.11 - _ZN3Dtk4Core14DStandardPaths6locateEN14QStandardPaths16StandardLocationERK7QString6QFlagsINS2_12LocateOptionEE@Base 2.0.11 - _ZN3Dtk4Core14DStandardPaths7setModeENS1_4ModeE@Base 2.0.11 - _ZN3Dtk4Core14DStandardPaths9locateAllEN14QStandardPaths16StandardLocationERK7QString6QFlagsINS2_12LocateOptionEE@Base 2.0.11 - _ZN3Dtk4Core14loggerInstanceEv@Base 2.0.11 - _ZN3Dtk4Core14parentPathListERK7QString@Base 2.0.11 - _ZN3Dtk4Core15ConsoleAppender24ignoreEnvironmentPatternEb@Base 2.0.11 - _ZN3Dtk4Core15ConsoleAppender6appendERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 2.0.11 - _ZN3Dtk4Core15ConsoleAppenderC1Ev@Base 2.0.11 - _ZN3Dtk4Core15ConsoleAppenderC2Ev@Base 2.0.11 - _ZN3Dtk4Core15ConsoleAppenderD0Ev@Base 2.0.11 - _ZN3Dtk4Core15ConsoleAppenderD1Ev@Base 2.0.11 - _ZN3Dtk4Core15ConsoleAppenderD2Ev@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption11dataChangedERK7QString8QVariant@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption12valueChangedE8QVariant@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption14setParentGroupE8QPointerINS0_14DSettingsGroupEE@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption7setDataERK7QString8QVariant@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption8fromJsonERK7QStringRK11QJsonObject@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption8setValueE8QVariant@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOption9parseJsonERK7QStringRK11QJsonObject@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOptionC1EP7QObject@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOptionC2EP7QObject@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOptionD0Ev@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOptionD1Ev@Base 2.0.11 - _ZN3Dtk4Core15DSettingsOptionD2Ev@Base 2.0.11 - _ZN3Dtk4Core15DSysInfoPrivate16ensureDeepinInfoEv@Base 2.0.11 - _ZN3Dtk4Core15DSysInfoPrivate17ensureReleaseInfoEv@Base 2.0.11 - _ZN3Dtk4Core15DSysInfoPrivate18ensureComputerInfoEv@Base 2.0.11 - _ZN3Dtk4Core15DSysInfoPrivateC1Ev@Base 2.0.11 - _ZN3Dtk4Core15DSysInfoPrivateC2Ev@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackend11doSetOptionERK7QStringRK8QVariant@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackend11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackend11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackend16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackend6doSyncEv@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackendC1ERK7QStringP7QObject@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackendC2ERK7QStringP7QObject@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackendD0Ev@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackendD1Ev@Base 2.0.11 - _ZN3Dtk4Core15QSettingBackendD2Ev@Base 2.0.11 - _ZN3Dtk4Core16AbstractAppender15setDetailsLevelENS0_6Logger8LogLevelE@Base 2.0.11 - _ZN3Dtk4Core16AbstractAppender15setDetailsLevelERK7QString@Base 2.0.11 - _ZN3Dtk4Core16AbstractAppender5writeERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 2.0.11 - _ZN3Dtk4Core16AbstractAppenderC1Ev@Base 2.0.11 - _ZN3Dtk4Core16AbstractAppenderC2Ev@Base 2.0.11 - _ZN3Dtk4Core16AbstractAppenderD0Ev@Base 2.0.11 - _ZN3Dtk4Core16AbstractAppenderD1Ev@Base 2.0.11 - _ZN3Dtk4Core16AbstractAppenderD2Ev@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher10fileClosedERK4QUrl@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher11fileDeletedERK4QUrl@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher11ghostSignalERK4QUrlMS1_FvS4_ES4_@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher11ghostSignalERK4QUrlMS1_FvS4_S4_ES4_S4_@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher11stopWatcherEv@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher12fileModifiedERK4QUrl@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher12startWatcherEv@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher14restartWatcherEv@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher14subfileCreatedERK4QUrl@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher20fileAttributeChangedERK4QUrl@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher24setEnabledSubfileWatcherERK4QUrlb@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcher9fileMovedERK4QUrlS4_@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcherC1ERNS0_23DBaseFileWatcherPrivateERK4QUrlP7QObject@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcherC2ERNS0_23DBaseFileWatcherPrivateERK4QUrlP7QObject@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcherD0Ev@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcherD1Ev@Base 2.0.11 - _ZN3Dtk4Core16DBaseFileWatcherD2Ev@Base 2.0.11 - _ZN3Dtk4Core16DSettingsBackend11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core16DSettingsBackend11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core16DSettingsBackend13optionChangedERK7QStringRK8QVariant@Base 2.0.11 - _ZN3Dtk4Core16DSettingsBackend16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core16DSettingsBackend4syncEv@Base 2.0.11 - _ZN3Dtk4Core16DSettingsBackend9setOptionERK7QStringRK8QVariant@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackend11doSetOptionERK7QStringRK8QVariant@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackend11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackend11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackend16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackend6doSyncEv@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackendC1EPNS0_9DSettingsEP7QObject@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackendC2EPNS0_9DSettingsEP7QObject@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackendD0Ev@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackendD1Ev@Base 2.0.11 - _ZN3Dtk4Core16GSettingsBackendD2Ev@Base 2.0.11 - _ZN3Dtk4Core18DDiskSizeFormatter4rateEi@Base 2.0.11 - _ZN3Dtk4Core18DDiskSizeFormatterC1Ev@Base 2.0.11 - _ZN3Dtk4Core18DDiskSizeFormatterC2Ev@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher10fileClosedERK7QStringS4_NS1_14QPrivateSignalE@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher10removePathERK7QString@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher11fileCreatedERK7QStringS4_NS1_14QPrivateSignalE@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher11fileDeletedERK7QStringS4_NS1_14QPrivateSignalE@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher11removePathsERK11QStringList@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher12fileModifiedERK7QStringS4_NS1_14QPrivateSignalE@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher20fileAttributeChangedERK7QStringS4_NS1_14QPrivateSignalE@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher7addPathERK7QString@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher8addPathsERK11QStringList@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcher9fileMovedERK7QStringS4_S4_S4_NS1_14QPrivateSignalE@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcherC1EP7QObject@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcherC1ERK11QStringListP7QObject@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcherC2EP7QObject@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcherC2ERK11QStringListP7QObject@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcherD0Ev@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcherD1Ev@Base 2.0.11 - _ZN3Dtk4Core18DFileSystemWatcherD2Ev@Base 2.0.11 - _ZN3Dtk4Core18DTimeUnitFormatterC1Ev@Base 2.0.11 - _ZN3Dtk4Core18DTimeUnitFormatterC2Ev@Base 2.0.11 - _ZN3Dtk4Core18LoggerTimingHelper5startEPKcz@Base 2.0.11 - _ZN3Dtk4Core18LoggerTimingHelper5startERK7QString@Base 2.0.11 - _ZN3Dtk4Core18LoggerTimingHelperD1Ev@Base 2.0.11 - _ZN3Dtk4Core18LoggerTimingHelperD2Ev@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager10fileClosedERK7QString@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager11fileDeletedERK7QString@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager12fileModifiedERK7QString@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager14subfileCreatedERK7QString@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager20fileAttributeChangedERK7QString@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager3addERK7QString@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager6removeERK7QString@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManager9fileMovedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManagerC1EP7QObject@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManagerC2EP7QObject@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManagerD0Ev@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManagerD1Ev@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherManagerD2Ev@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate10formatPathERK7QString@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate18_q_handleFileCloseERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate18_q_handleFileMovedERK7QStringS4_S4_S4_@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate20_q_handleFileCreatedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate20_q_handleFileDeletedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate21_q_handleFileModifiedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate22filePathToWatcherCountE@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate29_q_handleFileAttributeChangedERK7QStringS4_@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate4stopEv@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivate5startEv@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivateD0Ev@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivateD1Ev@Base 2.0.11 - _ZN3Dtk4Core19DFileWatcherPrivateD2Ev@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender14removeOldFilesEv@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender14setDatePatternENS1_11DatePatternE@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender14setDatePatternERK7QString@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender16computeFrequencyEv@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender16setLogFilesLimitEi@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender19computeRollOverTimeEv@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender20setDatePatternStringERK7QString@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender6appendERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppender8rollOverEv@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppenderC1ERK7QString@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppenderC2ERK7QString@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppenderD0Ev@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppenderD1Ev@Base 2.0.11 - _ZN3Dtk4Core19RollingFileAppenderD2Ev@Base 2.0.11 - _ZN3Dtk4Core21DSettingsGroupPrivate9parseJsonERK7QStringRK11QJsonObject@Base 2.0.11 - _ZN3Dtk4Core22AbstractStringAppender16qCleanupFuncinfoEPKc@Base 2.0.11 - _ZN3Dtk4Core22AbstractStringAppender17stripFunctionNameEPKc@Base 2.0.11 - _ZN3Dtk4Core22AbstractStringAppender9setFormatERK7QString@Base 2.0.11 - _ZN3Dtk4Core22AbstractStringAppenderC1Ev@Base 2.0.11 - _ZN3Dtk4Core22AbstractStringAppenderC2Ev@Base 2.0.11 - _ZN3Dtk4Core22AbstractStringAppenderD0Ev@Base 2.0.11 - _ZN3Dtk4Core22AbstractStringAppenderD1Ev@Base 2.0.11 - _ZN3Dtk4Core22AbstractStringAppenderD2Ev@Base 2.0.11 - _ZN3Dtk4Core22DAbstractUnitFormatterC1Ev@Base 2.0.11 - _ZN3Dtk4Core22DAbstractUnitFormatterC2Ev@Base 2.0.11 - _ZN3Dtk4Core22DAbstractUnitFormatterD1Ev@Base 2.0.11 - _ZN3Dtk4Core22DAbstractUnitFormatterD2Ev@Base 2.0.11 - _ZN3Dtk4Core22DSettingsOptionPrivate9parseJsonERK7QStringRK11QJsonObject@Base 2.0.11 - _ZN3Dtk4Core23DBaseFileWatcherPrivate11watcherListE@Base 2.0.11 - _ZN3Dtk4Core23DBaseFileWatcherPrivateC1EPNS0_16DBaseFileWatcherE@Base 2.0.11 - _ZN3Dtk4Core23DBaseFileWatcherPrivateC2EPNS0_16DBaseFileWatcherE@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivate11removePathsERK11QStringListPS2_S5_@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivate13onFileChangedERK7QStringb@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivate18_q_readFromInotifyEv@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivate18onDirectoryChangedERK7QStringb@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivate8addPathsERK11QStringListPS2_S5_@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivateC1EiPNS0_18DFileSystemWatcherE@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivateC2EiPNS0_18DFileSystemWatcherE@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivateD0Ev@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivateD1Ev@Base 2.0.11 - _ZN3Dtk4Core25DFileSystemWatcherPrivateD2Ev@Base 2.0.11 - _ZN3Dtk4Core26DFileWatcherManagerPrivateC1EPNS0_19DFileWatcherManagerE@Base 2.0.11 - _ZN3Dtk4Core26DFileWatcherManagerPrivateC2EPNS0_19DFileWatcherManagerE@Base 2.0.11 - _ZN3Dtk4Core26DFileWatcherManagerPrivateD0Ev@Base 2.0.11 - _ZN3Dtk4Core26DFileWatcherManagerPrivateD1Ev@Base 2.0.11 - _ZN3Dtk4Core26DFileWatcherManagerPrivateD2Ev@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySender4callEv@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySender5hintsERK4QMapI7QString8QVariantE@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySender7actionsERK11QStringList@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySender7appBodyERK7QString@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySender7appIconERK7QString@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySender7appNameERK7QString@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySender7timeOutEi@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySender9replaceIdEj@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySenderC1ERK7QString@Base 2.0.11 - _ZN3Dtk4Core5DUtil13DNotifySenderC2ERK7QString@Base 2.0.11 - _ZN3Dtk4Core6Logger11writeAssertEPKciS3_S3_@Base 2.0.11 - _ZN3Dtk4Core6Logger13levelToStringENS1_8LogLevelE@Base 2.0.11 - _ZN3Dtk4Core6Logger14globalInstanceEv@Base 2.0.11 - _ZN3Dtk4Core6Logger15levelFromStringERK7QString@Base 2.0.11 - _ZN3Dtk4Core6Logger16registerAppenderEPNS0_16AbstractAppenderE@Base 2.0.11 - _ZN3Dtk4Core6Logger18setDefaultCategoryERK7QString@Base 2.0.11 - _ZN3Dtk4Core6Logger19logToGlobalInstanceERK7QStringb@Base 2.0.11 - _ZN3Dtk4Core6Logger24registerCategoryAppenderERK7QStringPNS0_16AbstractAppenderE@Base 2.0.11 - _ZN3Dtk4Core6Logger5writeENS1_8LogLevelEPKciS4_S4_@Base 2.0.11 - _ZN3Dtk4Core6Logger5writeENS1_8LogLevelEPKciS4_S4_RK7QString@Base 2.0.11 - _ZN3Dtk4Core6Logger5writeERK9QDateTimeNS1_8LogLevelEPKciS7_S7_RK7QString@Base 2.0.11 - _ZN3Dtk4Core6Logger5writeERK9QDateTimeNS1_8LogLevelEPKciS7_S7_RK7QStringb@Base 2.0.11 - _ZN3Dtk4Core6LoggerC1ERK7QString@Base 2.0.11 - _ZN3Dtk4Core6LoggerC1Ev@Base 2.0.11 - _ZN3Dtk4Core6LoggerC2ERK7QString@Base 2.0.11 - _ZN3Dtk4Core6LoggerC2Ev@Base 2.0.11 - _ZN3Dtk4Core6LoggerD1Ev@Base 2.0.11 - _ZN3Dtk4Core6LoggerD2Ev@Base 2.0.11 - _ZN3Dtk4Core7DObjectC1EPS1_@Base 2.0.11 - _ZN3Dtk4Core7DObjectC1ERNS0_14DObjectPrivateEPS1_@Base 2.0.11 - _ZN3Dtk4Core7DObjectC2EPS1_@Base 2.0.11 - _ZN3Dtk4Core7DObjectC2ERNS0_14DObjectPrivateEPS1_@Base 2.0.11 - _ZN3Dtk4Core7DObjectD0Ev@Base 2.0.11 - _ZN3Dtk4Core7DObjectD1Ev@Base 2.0.11 - _ZN3Dtk4Core7DObjectD2Ev@Base 2.0.11 - _ZN3Dtk4Core8DPathBufC1ERK7QString@Base 2.0.11 - _ZN3Dtk4Core8DPathBufC1Ev@Base 2.0.11 - _ZN3Dtk4Core8DPathBufC2ERK7QString@Base 2.0.11 - _ZN3Dtk4Core8DPathBufC2Ev@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo10deepinTypeEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo11productTypeEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo12computerNameEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo12cpuModelNameEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo13deepinEditionEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo13deepinVersionEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo14productVersionEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo14systemDiskSizeEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo15deepinCopyrightEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo15memoryTotalSizeEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo17productTypeStringEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo19operatingSystemNameEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo21deepinTypeDisplayNameERK7QLocale@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo5isDDEEv@Base 2.0.11 - _ZN3Dtk4Core8DSysInfo8isDeepinEv@Base 2.0.11 - _ZN3Dtk4Core9DSettings10setBackendEPNS0_16DSettingsBackendE@Base 2.0.11 - _ZN3Dtk4Core9DSettings11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.11 - _ZN3Dtk4Core9DSettings11qt_metacastEPKc@Base 2.0.11 - _ZN3Dtk4Core9DSettings12fromJsonFileERK7QString@Base 2.0.11 - _ZN3Dtk4Core9DSettings12valueChangedERK7QStringRK8QVariant@Base 2.0.11 - _ZN3Dtk4Core9DSettings16staticMetaObjectE@Base 2.0.11 - _ZN3Dtk4Core9DSettings4syncEv@Base 2.0.11 - _ZN3Dtk4Core9DSettings5resetEv@Base 2.0.11 - _ZN3Dtk4Core9DSettings8fromJsonERK10QByteArray@Base 2.0.11 - _ZN3Dtk4Core9DSettings9loadValueEv@Base 2.0.11 - _ZN3Dtk4Core9DSettings9parseJsonERK10QByteArray@Base 2.0.11 - _ZN3Dtk4Core9DSettings9setOptionERK7QStringRK8QVariant@Base 2.0.11 - _ZN3Dtk4Core9DSettingsC1EP7QObject@Base 2.0.11 - _ZN3Dtk4Core9DSettingsC2EP7QObject@Base 2.0.11 - _ZN3Dtk4Core9DSettingsD0Ev@Base 2.0.11 - _ZN3Dtk4Core9DSettingsD1Ev@Base 2.0.11 - _ZN3Dtk4Core9DSettingsD2Ev@Base 2.0.11 - _ZN3Dtk4Core9LogDevice8readDataEPcx@Base 2.0.11 - _ZN3Dtk4Core9LogDevice9writeDataEPKcx@Base 2.0.11 - _ZN3Dtk4Core9LogDeviceD0Ev@Base 2.0.11 - _ZN3Dtk4Core9LogDeviceD1Ev@Base 2.0.11 - _ZN3Dtk4Core9LogDeviceD2Ev@Base 2.0.11 - _ZN3Dtk4Core9qtifyNameERK7QString@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QString5QPairIS0_yEE13detach_helperEv@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QString5QPairIS0_yEED1Ev@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QString5QPairIS0_yEED2Ev@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE13detach_helperEv@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QString8QVariantEC1ERKS2_@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QString8QVariantEC2ERKS2_@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QStringPN3Dtk4Core12DFileWatcherEE13detach_helperEv@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QStringS0_E13detach_helperEv@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QStringiE13detach_helperEv@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QStringiED1Ev@Base 2.0.11 - (optional=templinst)_ZN4QMapI7QStringiED2Ev@Base 2.0.11 - (optional=templinst)_ZN4QMapI9QDateTime7QStringED1Ev@Base 2.0.11 - (optional=templinst)_ZN4QMapI9QDateTime7QStringED2Ev@Base 2.0.11 - (optional=templinst)_ZN4QMapIi7QStringED1Ev@Base 2.0.11 - (optional=templinst)_ZN4QMapIi7QStringED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QHashI7QStringiE11deleteNode2EPN9QHashData4NodeE@Base 2.0.11 - (optional=templinst)_ZN5QHashI7QStringiE13duplicateNodeEPN9QHashData4NodeEPv@Base 2.0.11 - (optional=templinst)_ZN5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueE11deleteNode2EPN9QHashData4NodeE@Base 2.0.11 - (optional=templinst)_ZN5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueE13duplicateNodeEPN9QHashData4NodeEPv@Base 2.0.11 - (optional=templinst)_ZN5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QHashIPN3Dtk4Core16AbstractAppenderE15QHashDummyValueED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QHashIi15QHashDummyValueE11deleteNode2EPN9QHashData4NodeE@Base 2.0.11 - (optional=templinst)_ZN5QHashIi15QHashDummyValueE13duplicateNodeEPN9QHashData4NodeEPv@Base 2.0.11 - (optional=templinst)_ZN5QHashIi7QStringE11deleteNode2EPN9QHashData4NodeE@Base 2.0.11 - (optional=templinst)_ZN5QHashIi7QStringE13duplicateNodeEPN9QHashData4NodeEPv@Base 2.0.11 - (optional=templinst)_ZN5QHashIi7QStringED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QHashIi7QStringED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI10QByteArrayED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI10QByteArrayED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI5QPairIdiEE18detach_helper_growEii@Base 2.0.11 - (optional=templinst)_ZN5QListI5QPairIdiEE6appendERKS1_@Base 2.0.11 - (optional=templinst)_ZN5QListI5QPairIdiEED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI5QPairIdiEED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI7QStringE13detach_helperEi@Base 2.0.11 - (optional=templinst)_ZN5QListI7QStringE18detach_helper_growEii@Base 2.0.11 - (optional=templinst)_ZN5QListI7QStringE6appendERKS0_@Base 2.0.11 - (optional=templinst)_ZN5QListI7QStringE9removeAllERKS0_@Base 2.0.11 - (optional=templinst)_ZN5QListI7QStringEC1ERKS1_@Base 2.0.11 - (optional=templinst)_ZN5QListI7QStringEC2ERKS1_@Base 2.0.11 - (optional=templinst)_ZN5QListI7QStringED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI7QStringED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI8QPointerIN3Dtk4Core14DSettingsGroupEEE13detach_helperEi@Base 2.0.11 - (optional=templinst)_ZN5QListI8QPointerIN3Dtk4Core14DSettingsGroupEEE18detach_helper_growEii@Base 2.0.11 - (optional=templinst)_ZN5QListI8QPointerIN3Dtk4Core14DSettingsGroupEEE6appendERKS4_@Base 2.0.11 - (optional=templinst)_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEE13detach_helperEi@Base 2.0.11 - (optional=templinst)_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEE18detach_helper_growEii@Base 2.0.11 - (optional=templinst)_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEE6appendERKS4_@Base 2.0.11 - (optional=templinst)_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI8QPointerIN3Dtk4Core15DSettingsOptionEEED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI8QVariantE13detach_helperEi@Base 2.0.11 - (optional=templinst)_ZN5QListI8QVariantE18detach_helper_growEii@Base 2.0.11 - (optional=templinst)_ZN5QListI8QVariantE6appendERKS0_@Base 2.0.11 - (optional=templinst)_ZN5QListI8QVariantEC1ERKS1_@Base 2.0.11 - (optional=templinst)_ZN5QListI8QVariantEC2ERKS1_@Base 2.0.11 - (optional=templinst)_ZN5QListI8QVariantED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI8QVariantED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI9QFileInfoE13detach_helperEi@Base 2.0.11 - (optional=templinst)_ZN5QListI9QFileInfoED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListI9QFileInfoED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListIP13inotify_eventE18detach_helper_growEii@Base 2.0.11 - (optional=templinst)_ZN5QListIP13inotify_eventE6appendERKS1_@Base 2.0.11 - (optional=templinst)_ZN5QListIP13inotify_eventED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListIP13inotify_eventED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16AbstractAppenderEE18detach_helper_growEii@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16AbstractAppenderEE6appendERKS3_@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16AbstractAppenderEEC1ERKS4_@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16AbstractAppenderEEC2ERKS4_@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16AbstractAppenderEED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16AbstractAppenderEED2Ev@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEE13detach_helperEi@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEE18detach_helper_growEii@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEE6appendERKS3_@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEE9removeOneERKS3_@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEED1Ev@Base 2.0.11 - (optional=templinst)_ZN5QListIPN3Dtk4Core16DBaseFileWatcherEED2Ev@Base 2.0.11 - _ZN7QStringD1Ev@Base 2.0.11 - _ZN7QStringD2Ev@Base 2.0.11 - (optional=templinst)_ZN8QMapDataI7QStringPN3Dtk4Core12DFileWatcherEE7destroyEv@Base 2.0.11 - (optional=templinst)_ZN8QMapDataI7QStringPN3Dtk4Core16AbstractAppenderEE7destroyEv@Base 2.0.11 - (optional=templinst)_ZN8QMapDataI7QStringbE7destroyEv@Base 2.0.11 - (optional=templinst)_ZN8QMapDataI7QStringiE7destroyEv@Base 2.0.11 - (optional=templinst)_ZN8QMapDataIi7QStringE7destroyEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QString5QPairIS0_yEE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QString8QPointerIN3Dtk4Core14DSettingsGroupEEE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QString8QVariantE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QStringPN3Dtk4Core12DFileWatcherEE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QStringPN3Dtk4Core16AbstractAppenderEE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QStringS0_E14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QStringbE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI7QStringiE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeI9QDateTime7QStringE14destroySubTreeEv@Base 2.0.11 - (optional=templinst)_ZN8QMapNodeIi7QStringE14destroySubTreeEv@Base 2.0.11 - _ZN9DDBusDataC1Ev@Base 2.0.11 - _ZN9DDBusDataC2Ev@Base 2.0.11 - (optional=templinst)_ZN9QtPrivate11QSlotObjectIMN3Dtk4Core12DFileWatcherEFvRK7QStringS6_ENS_4ListIJS6_S6_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 2.0.11 - (optional=templinst)_ZN9QtPrivate11QSlotObjectIMN3Dtk4Core12DFileWatcherEFvRK7QStringS6_S6_S6_ENS_4ListIJS6_S6_S6_S6_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 2.0.11 - (optional=templinst)_ZN9QtPrivate11QSlotObjectIMN3Dtk4Core16DSettingsBackendEFvRK7QStringRK8QVariantENS_4ListIJS6_S9_EEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 2.0.11 - (optional=templinst)_ZN9QtPrivate11QSlotObjectIMN3Dtk4Core16DSettingsBackendEFvvENS_4ListIJEEEvE4implEiPNS_15QSlotObjectBaseEP7QObjectPPvPb@Base 2.0.11 - _ZNK3Dtk4Core12DFileWatcher10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core12FileAppender4sizeEv@Base 2.0.11 - _ZNK3Dtk4Core12FileAppender8fileNameEv@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup10childGroupERK7QString@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup11childGroupsEv@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup11parentGroupEv@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup12childOptionsEv@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup3keyEv@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup4nameEv@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup6optionERK7QString@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup7optionsEv@Base 2.0.11 - _ZNK3Dtk4Core14DSettingsGroup8isHiddenEv@Base 2.0.11 - _ZNK3Dtk4Core15ConsoleAppender6formatEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption11parentGroupEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption12defaultValueEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption3keyEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption4dataERK7QString@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption4nameEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption5valueEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption8canResetEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption8isHiddenEv@Base 2.0.11 - _ZNK3Dtk4Core15DSettingsOption8viewTypeEv@Base 2.0.11 - _ZNK3Dtk4Core15QSettingBackend10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core15QSettingBackend4keysEv@Base 2.0.11 - _ZNK3Dtk4Core15QSettingBackend9getOptionERK7QString@Base 2.0.11 - _ZNK3Dtk4Core16AbstractAppender12detailsLevelEv@Base 2.0.11 - _ZNK3Dtk4Core16DBaseFileWatcher10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core16DBaseFileWatcher7fileUrlEv@Base 2.0.11 - _ZNK3Dtk4Core16DSettingsBackend10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core16GSettingsBackend10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core16GSettingsBackend4keysEv@Base 2.0.11 - _ZNK3Dtk4Core16GSettingsBackend9getOptionERK7QString@Base 2.0.11 - _ZNK3Dtk4Core17CuteMessageLogger5writeEPKcz@Base 2.0.11 - _ZNK3Dtk4Core17CuteMessageLogger5writeERK7QString@Base 2.0.11 - _ZNK3Dtk4Core17CuteMessageLogger5writeEv@Base 2.0.11 - _ZNK3Dtk4Core18DDiskSizeFormatter15unitConvertRateEi@Base 2.0.11 - _ZNK3Dtk4Core18DDiskSizeFormatter7unitMaxEv@Base 2.0.11 - _ZNK3Dtk4Core18DDiskSizeFormatter7unitMinEv@Base 2.0.11 - _ZNK3Dtk4Core18DDiskSizeFormatter7unitStrEi@Base 2.0.11 - _ZNK3Dtk4Core18DFileSystemWatcher10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core18DFileSystemWatcher11directoriesEv@Base 2.0.11 - _ZNK3Dtk4Core18DFileSystemWatcher5filesEv@Base 2.0.11 - _ZNK3Dtk4Core18DTimeUnitFormatter15unitConvertRateEi@Base 2.0.11 - _ZNK3Dtk4Core18DTimeUnitFormatter7unitMaxEv@Base 2.0.11 - _ZNK3Dtk4Core18DTimeUnitFormatter7unitMinEv@Base 2.0.11 - _ZNK3Dtk4Core18DTimeUnitFormatter7unitStrEi@Base 2.0.11 - _ZNK3Dtk4Core19DFileWatcherManager10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core19RollingFileAppender11datePatternEv@Base 2.0.11 - _ZNK3Dtk4Core19RollingFileAppender13logFilesLimitEv@Base 2.0.11 - _ZNK3Dtk4Core19RollingFileAppender17datePatternStringEv@Base 2.0.11 - _ZNK3Dtk4Core22AbstractStringAppender15formattedStringERK9QDateTimeNS0_6Logger8LogLevelEPKciS8_RK7QStringSB_@Base 2.0.11 - _ZNK3Dtk4Core22AbstractStringAppender6formatEv@Base 2.0.11 - _ZNK3Dtk4Core22DAbstractUnitFormatter12unitValueMaxEi@Base 2.0.11 - _ZNK3Dtk4Core22DAbstractUnitFormatter12unitValueMinEi@Base 2.0.11 - _ZNK3Dtk4Core22DAbstractUnitFormatter16formatAsUnitListEdi@Base 2.0.11 - _ZNK3Dtk4Core22DAbstractUnitFormatter6formatEdi@Base 2.0.11 - _ZNK3Dtk4Core22DAbstractUnitFormatter8formatAsEdii@Base 2.0.11 - _ZNK3Dtk4Core25DFileSystemWatcherPrivate13getPathFromIDEi@Base 2.0.11 - _ZNK3Dtk4Core6Logger15defaultCategoryEv@Base 2.0.11 - _ZNK3Dtk4Core9DSettings10metaObjectEv@Base 2.0.11 - _ZNK3Dtk4Core9DSettings4keysEv@Base 2.0.11 - _ZNK3Dtk4Core9DSettings4metaEv@Base 2.0.11 - _ZNK3Dtk4Core9DSettings5groupERK7QString@Base 2.0.11 - _ZNK3Dtk4Core9DSettings5valueERK7QString@Base 2.0.11 - _ZNK3Dtk4Core9DSettings6groupsEv@Base 2.0.11 - _ZNK3Dtk4Core9DSettings6optionERK7QString@Base 2.0.11 - _ZNK3Dtk4Core9DSettings7optionsEv@Base 2.0.11 - _ZNK3Dtk4Core9DSettings9getOptionERK7QString@Base 2.0.11 - _ZNK3Dtk4Core9DSettings9groupKeysEv@Base 2.0.11 - (optional=templinst)_ZNK4QMapI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE6valuesEv@Base 2.0.11 - (optional=templinst)_ZNK5QHashI7QStringiE8findNodeERKS0_Pj@Base 2.0.11 - (optional=templinst)_ZNK5QHashI7QStringiE8findNodeERKS0_j@Base 2.0.11 - (optional=templinst)_ZNK5QHashIi15QHashDummyValueE8findNodeERKiPj@Base 2.0.11 - (optional=templinst)_ZNK5QHashIi7QStringE8findNodeERKiPj@Base 2.0.11 - (optional=templinst)_ZNK5QListIPN3Dtk4Core16AbstractAppenderEE5toSetEv@Base 2.0.11 - (optional=templinst)_ZNK8QMapDataI7QString8QVariantE8findNodeERKS0_@Base 2.0.11 - (optional=templinst)_ZNK8QMapDataI7QStringPN3Dtk4Core12DFileWatcherEE8findNodeERKS0_@Base 2.0.11 - (optional=templinst)_ZNK8QMapDataI7QStringPN3Dtk4Core16AbstractAppenderEE8findNodeERKS0_@Base 2.0.11 - (optional=templinst)_ZNK8QMapDataI7QStringS0_E8findNodeERKS0_@Base 2.0.11 - (optional=templinst)_ZNK8QMapDataI7QStringiE8findNodeERKS0_@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QString5QPairIS0_yEE4copyEP8QMapDataIS0_S2_E@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QString8QPointerIN3Dtk4Core14DSettingsGroupEEE4copyEP8QMapDataIS0_S5_E@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QString8QPointerIN3Dtk4Core15DSettingsOptionEEE4copyEP8QMapDataIS0_S5_E@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QString8QVariantE4copyEP8QMapDataIS0_S1_E@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QStringPN3Dtk4Core12DFileWatcherEE4copyEP8QMapDataIS0_S4_E@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QStringPN3Dtk4Core16AbstractAppenderEE4copyEP8QMapDataIS0_S4_E@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QStringS0_E4copyEP8QMapDataIS0_S0_E@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QStringbE4copyEP8QMapDataIS0_bE@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI7QStringiE4copyEP8QMapDataIS0_iE@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeI9QDateTime7QStringE4copyEP8QMapDataIS0_S1_E@Base 2.0.11 - (optional=templinst)_ZNK8QMapNodeIi7QStringE4copyEP8QMapDataIiS0_E@Base 2.0.11 - (optional=templinst)_ZNKSt5ctypeIcE8do_widenEc@Base 2.0.11 - (optional=templinst)_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE10_M_destroyEv@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EED0Ev@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EED1Ev@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EED2Ev@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE10_M_destroyEv@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE14_M_get_deleterERKSt9type_info@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EED0Ev@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EED1Ev@Base 2.0.11 - (optional=templinst)_ZNSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EED2Ev@Base 2.0.11 - _ZTIN3Dtk4Core12DFileWatcherE@Base 2.0.11 - _ZTIN3Dtk4Core12FileAppenderE@Base 2.0.11 - _ZTIN3Dtk4Core14DObjectPrivateE@Base 2.0.11 - _ZTIN3Dtk4Core14DSettingsGroupE@Base 2.0.11 - _ZTIN3Dtk4Core15ConsoleAppenderE@Base 2.0.11 - _ZTIN3Dtk4Core15DSettingsOptionE@Base 2.0.11 - _ZTIN3Dtk4Core15QSettingBackendE@Base 2.0.11 - _ZTIN3Dtk4Core16AbstractAppenderE@Base 2.0.11 - _ZTIN3Dtk4Core16DBaseFileWatcherE@Base 2.0.11 - _ZTIN3Dtk4Core16DSettingsBackendE@Base 2.0.11 - _ZTIN3Dtk4Core16GSettingsBackendE@Base 2.0.11 - _ZTIN3Dtk4Core18DDiskSizeFormatterE@Base 2.0.11 - _ZTIN3Dtk4Core18DFileSystemWatcherE@Base 2.0.11 - _ZTIN3Dtk4Core18DTimeUnitFormatterE@Base 2.0.11 - _ZTIN3Dtk4Core19DFileWatcherManagerE@Base 2.0.11 - _ZTIN3Dtk4Core19DFileWatcherPrivateE@Base 2.0.11 - _ZTIN3Dtk4Core19RollingFileAppenderE@Base 2.0.11 - _ZTIN3Dtk4Core22AbstractStringAppenderE@Base 2.0.11 - _ZTIN3Dtk4Core22DAbstractUnitFormatterE@Base 2.0.11 - _ZTIN3Dtk4Core23DBaseFileWatcherPrivateE@Base 2.0.11 - _ZTIN3Dtk4Core25DFileSystemWatcherPrivateE@Base 2.0.11 - _ZTIN3Dtk4Core26DFileWatcherManagerPrivateE@Base 2.0.11 - _ZTIN3Dtk4Core7DObjectE@Base 2.0.11 - _ZTIN3Dtk4Core9DSettingsE@Base 2.0.11 - _ZTIN3Dtk4Core9LogDeviceE@Base 2.0.11 - _ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTISt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTISt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTSN3Dtk4Core12DFileWatcherE@Base 2.0.11 - _ZTSN3Dtk4Core12FileAppenderE@Base 2.0.11 - _ZTSN3Dtk4Core14DObjectPrivateE@Base 2.0.11 - _ZTSN3Dtk4Core14DSettingsGroupE@Base 2.0.11 - _ZTSN3Dtk4Core15ConsoleAppenderE@Base 2.0.11 - _ZTSN3Dtk4Core15DSettingsOptionE@Base 2.0.11 - _ZTSN3Dtk4Core15QSettingBackendE@Base 2.0.11 - _ZTSN3Dtk4Core16AbstractAppenderE@Base 2.0.11 - _ZTSN3Dtk4Core16DBaseFileWatcherE@Base 2.0.11 - _ZTSN3Dtk4Core16DSettingsBackendE@Base 2.0.11 - _ZTSN3Dtk4Core16GSettingsBackendE@Base 2.0.11 - _ZTSN3Dtk4Core18DDiskSizeFormatterE@Base 2.0.11 - _ZTSN3Dtk4Core18DFileSystemWatcherE@Base 2.0.11 - _ZTSN3Dtk4Core18DTimeUnitFormatterE@Base 2.0.11 - _ZTSN3Dtk4Core19DFileWatcherManagerE@Base 2.0.11 - _ZTSN3Dtk4Core19DFileWatcherPrivateE@Base 2.0.11 - _ZTSN3Dtk4Core19RollingFileAppenderE@Base 2.0.11 - _ZTSN3Dtk4Core22AbstractStringAppenderE@Base 2.0.11 - _ZTSN3Dtk4Core22DAbstractUnitFormatterE@Base 2.0.11 - _ZTSN3Dtk4Core23DBaseFileWatcherPrivateE@Base 2.0.11 - _ZTSN3Dtk4Core25DFileSystemWatcherPrivateE@Base 2.0.11 - _ZTSN3Dtk4Core26DFileWatcherManagerPrivateE@Base 2.0.11 - _ZTSN3Dtk4Core7DObjectE@Base 2.0.11 - _ZTSN3Dtk4Core9DSettingsE@Base 2.0.11 - _ZTSN3Dtk4Core9LogDeviceE@Base 2.0.11 - _ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTSSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTSSt19_Sp_make_shared_tag@Base 2.0.11 - _ZTSSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTSSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTVN3Dtk4Core12DFileWatcherE@Base 2.0.11 - _ZTVN3Dtk4Core12FileAppenderE@Base 2.0.11 - _ZTVN3Dtk4Core14DObjectPrivateE@Base 2.0.11 - _ZTVN3Dtk4Core14DSettingsGroupE@Base 2.0.11 - _ZTVN3Dtk4Core15ConsoleAppenderE@Base 2.0.11 - _ZTVN3Dtk4Core15DSettingsOptionE@Base 2.0.11 - _ZTVN3Dtk4Core15QSettingBackendE@Base 2.0.11 - _ZTVN3Dtk4Core16AbstractAppenderE@Base 2.0.11 - _ZTVN3Dtk4Core16DBaseFileWatcherE@Base 2.0.11 - _ZTVN3Dtk4Core16DSettingsBackendE@Base 2.0.11 - _ZTVN3Dtk4Core16GSettingsBackendE@Base 2.0.11 - _ZTVN3Dtk4Core18DDiskSizeFormatterE@Base 2.0.11 - _ZTVN3Dtk4Core18DFileSystemWatcherE@Base 2.0.11 - _ZTVN3Dtk4Core18DTimeUnitFormatterE@Base 2.0.11 - _ZTVN3Dtk4Core19DFileWatcherManagerE@Base 2.0.11 - _ZTVN3Dtk4Core19DFileWatcherPrivateE@Base 2.0.11 - _ZTVN3Dtk4Core19RollingFileAppenderE@Base 2.0.11 - _ZTVN3Dtk4Core22AbstractStringAppenderE@Base 2.0.11 - _ZTVN3Dtk4Core22DAbstractUnitFormatterE@Base 2.0.11 - _ZTVN3Dtk4Core23DBaseFileWatcherPrivateE@Base 2.0.11 - _ZTVN3Dtk4Core25DFileSystemWatcherPrivateE@Base 2.0.11 - _ZTVN3Dtk4Core26DFileWatcherManagerPrivateE@Base 2.0.11 - _ZTVN3Dtk4Core7DObjectE@Base 2.0.11 - _ZTVN3Dtk4Core9DSettingsE@Base 2.0.11 - _ZTVN3Dtk4Core9LogDeviceE@Base 2.0.11 - _ZTVSt23_Sp_counted_ptr_inplaceI9DDBusDataSaIS0_ELN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZTVSt23_Sp_counted_ptr_inplaceIN3Dtk4Core5DUtil11DNotifyDataESaIS3_ELN9__gnu_cxx12_Lock_policyE2EE@Base 2.0.11 - _ZZN3Dtk4Core11DLogManager8instanceEvE8instance@Base 2.0.11 - (optional=templinst)_ZZN9QtPrivate15ConnectionTypesINS_4ListIJRK7QStringRK8QVariantEEELb1EE5typesEvE1t@Base 2.0.11 - (c++)"non-virtual thunk to Dtk::Core::DBaseFileWatcher::~DBaseFileWatcher()@Base" 2.0.11 - (c++)"non-virtual thunk to Dtk::Core::DFileSystemWatcher::~DFileSystemWatcher()@Base" 2.0.11 - (c++)"non-virtual thunk to Dtk::Core::DFileWatcher::~DFileWatcher()@Base" 2.0.11 - (c++)"non-virtual thunk to Dtk::Core::DFileWatcherManager::~DFileWatcherManager()@Base" 2.0.11 diff --git a/debian/libdtkcore-bin.install b/debian/libdtkcore5-bin.install similarity index 100% rename from debian/libdtkcore-bin.install rename to debian/libdtkcore5-bin.install diff --git a/debian/libdtkcore5.install b/debian/libdtkcore5.install new file mode 100644 index 0000000..751f0dc --- /dev/null +++ b/debian/libdtkcore5.install @@ -0,0 +1,2 @@ +usr/lib/*/lib*.so.* +usr/share/glib-2.0/schemas diff --git a/dtk_build_config.prf b/dtk_build_config.prf index 6610cd5..dd6a1ac 100644 --- a/dtk_build_config.prf +++ b/dtk_build_config.prf @@ -12,7 +12,7 @@ defineReplace(capitalizingString) { defineTest(checkDtkVersion) { isEmpty(VERSION) { - !isEqual(TARGET, dtkcore) { + !isEqual(DTK_MODULE_NAME, dtkcore) { VERSION = $${QT.dtkcore.VERSION} } @@ -53,7 +53,7 @@ isEmpty(PREFIX){ } isEmpty(LIB_INSTALL_DIR) { - isEqual(TARGET, dtkcore) { + isEqual(DTK_MODULE_NAME, dtkcore) { LIB_INSTALL_DIR=$$PREFIX/lib } else { LIB_INSTALL_DIR=$${QT.dtkcore.libs} diff --git a/examples/examples.pro b/examples/examples.pro new file mode 100644 index 0000000..984ab9d --- /dev/null +++ b/examples/examples.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += expintf-example diff --git a/examples/expintf-example/expintf-example.pro b/examples/expintf-example/expintf-example.pro new file mode 100644 index 0000000..5663a98 --- /dev/null +++ b/examples/expintf-example/expintf-example.pro @@ -0,0 +1,16 @@ +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 +} diff --git a/examples/expintf-example/main.cpp b/examples/expintf-example/main.cpp new file mode 100644 index 0000000..5af9bb6 --- /dev/null +++ b/examples/expintf-example/main.cpp @@ -0,0 +1,72 @@ +/* + * 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(); +} diff --git a/src/DDesktopEntry b/src/DDesktopEntry new file mode 100644 index 0000000..847127a --- /dev/null +++ b/src/DDesktopEntry @@ -0,0 +1 @@ +#include "ddesktopentry.h" diff --git a/src/DSecureString b/src/DSecureString new file mode 100644 index 0000000..83f6c1a --- /dev/null +++ b/src/DSecureString @@ -0,0 +1 @@ +#include "dsecurestring.h" diff --git a/src/base/base.pri b/src/base/base.pri index 773c9ea..fb8de9e 100644 --- a/src/base/base.pri +++ b/src/base/base.pri @@ -1,6 +1,7 @@ include($$PWD/private/private.pri) INCLUDEPATH += $$PWD/base +INCLUDEPATH += $$PWD/private HEADERS += \ $$PWD/dobject.h \ diff --git a/src/base/dobject.cpp b/src/base/dobject.cpp index ac93d73..778457d 100644 --- a/src/base/dobject.cpp +++ b/src/base/dobject.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/base/dobject.h b/src/base/dobject.h index a06e071..d981d40 100644 --- a/src/base/dobject.h +++ b/src/base/dobject.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/base/dsingleton.h b/src/base/dsingleton.h index f404da2..fcb016c 100644 --- a/src/base/dsingleton.h +++ b/src/base/dsingleton.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/base/private/dobject_p.h b/src/base/private/dobject_p.h index f6b209e..30bdee5 100644 --- a/src/base/private/dobject_p.h +++ b/src/base/private/dobject_p.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/com.deepin.dtk.gschema.xml b/src/com.deepin.dtk.gschema.xml new file mode 100644 index 0000000..3010ad8 --- /dev/null +++ b/src/com.deepin.dtk.gschema.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + 'UnknownType' + application palette type + Palette type of the application. SystemTheme=0 LightTheme=1 DarkTheme=2 + + + diff --git a/src/ddesktopentry.cpp b/src/ddesktopentry.cpp new file mode 100644 index 0000000..247078a --- /dev/null +++ b/src/ddesktopentry.cpp @@ -0,0 +1,1043 @@ +/* + * 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 DDesktopEntry + * \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 + * + * 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"). + * + * \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. + * + * \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". + * + * \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"). + * + * \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 default-constructed value. + * + * \sa setRawValue(), 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 default-constructed value. + * + * \sa setStringValue(), 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 default-constructed value. + * + * \sa setLocalizedValue(), 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; + + if (!localeKey.isEmpty()) { + if (localeKey == "empty") { + possibleKeys << key; + } else if (localeKey == "default") { + possibleKeys << QString("%1[%2]").arg(key, QLocale().name()); + } else if (localeKey == "system") { + possibleKeys << QString("%1[%2]").arg(key, QLocale::system().name()); + } 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. + * + * \sa setLocalizedValue(), 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. + * + * \sa setRawValue(), 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 diff --git a/src/ddesktopentry.h b/src/ddesktopentry.h new file mode 100644 index 0000000..5b3554a --- /dev/null +++ b/src/ddesktopentry.h @@ -0,0 +1,113 @@ +/* + * 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 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 diff --git a/src/dsecurestring.cpp b/src/dsecurestring.cpp new file mode 100644 index 0000000..cc5965a --- /dev/null +++ b/src/dsecurestring.cpp @@ -0,0 +1,36 @@ +/* + * 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 diff --git a/src/dsecurestring.h b/src/dsecurestring.h new file mode 100644 index 0000000..d94922b --- /dev/null +++ b/src/dsecurestring.h @@ -0,0 +1,36 @@ +/* + * 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 DSecureString : public QString +{ +public: + using QString::QString; + DSecureString(const QString &other) noexcept; + ~DSecureString(); +}; + +DCORE_END_NAMESPACE diff --git a/src/dsysinfo.cpp b/src/dsysinfo.cpp index 9429114..030ddb9 100644 --- a/src/dsysinfo.cpp +++ b/src/dsysinfo.cpp @@ -6,7 +6,7 @@ * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * 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. * @@ -15,10 +15,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * 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 @@ -28,6 +29,8 @@ #include #include #include +#include +#include #ifdef Q_OS_LINUX #include @@ -47,6 +50,7 @@ public: #endif void ensureReleaseInfo(); void ensureComputerInfo(); + QMap parseInfoFile(QFile &file); #ifdef Q_OS_LINUX DSysInfo::DeepinType deepinType = DSysInfo::DeepinType(-1); @@ -56,6 +60,8 @@ public: QString deepinCopyright; #endif + QScopedPointer distributionInfo; + DSysInfo::ProductType productType = DSysInfo::ProductType(-1); QString prettyName; QString productTypeString; @@ -63,7 +69,8 @@ public: QString computerName; QString cpuModelName; - qint64 memoryTotalSize = -1; + qint64 memoryAvailableSize = -1; + qint64 memoryInstalledSize = -1; qint64 diskSize = 0; }; @@ -137,9 +144,18 @@ void DSysInfoPrivate::ensureDeepinInfo() 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; } + + const QString distributionInfoFile(DSysInfo::distributionInfoPath()); + // Generic DDE distribution info + distributionInfo.reset(new DDesktopEntry(distributionInfoFile)); + QSettings distributionInfo(distributionInfoFile, QSettings::IniFormat); // TODO: treat as `.desktop` format instead of `.ini` } static QString unquote(const QByteArray &value) @@ -272,8 +288,11 @@ void DSysInfoPrivate::ensureReleaseInfo() break; case 'u': case 'U': - if (productTypeString.compare("ubuntu", Qt::CaseInsensitive) == 0) + if (productTypeString.compare("ubuntu", Qt::CaseInsensitive) == 0) { productType = DSysInfo::Ubuntu; + } else if (productTypeString.compare("uos", Qt::CaseInsensitive) == 0) { + productType = DSysInfo::Uos; + } break; default: productType = DSysInfo::UnknownType; @@ -285,7 +304,7 @@ void DSysInfoPrivate::ensureReleaseInfo() void DSysInfoPrivate::ensureComputerInfo() { - if (memoryTotalSize >= 0) + if (memoryAvailableSize >= 0) return; #ifdef Q_OS_LINUX @@ -296,27 +315,43 @@ void DSysInfoPrivate::ensureComputerInfo() QFile file("/proc/cpuinfo"); if (file.open(QFile::ReadOnly)) { - char buf[1024]; - qint64 lineLength = 0; + QMap map = parseInfoFile(file); + if (map.contains("Processor")) { + // arm-cpuinfo hw_kirin-cpuinfo + cpuModelName = map.value("Processor"); + } else if (map.contains("model name")) { + // cpuinfo + cpuModelName = map.value("model name"); + } else if (map.contains("cpu model")) { + // loonson3-cpuinfo sw-cpuinfo + cpuModelName = map.value("cpu model"); + } + + file.close(); + } - do { - lineLength = file.readLine(buf, sizeof(buf)); + memoryAvailableSize = get_phys_pages() * sysconf(_SC_PAGESIZE); - const QByteArray line(buf, lineLength); + // Getting Memory Installed Size + // TODO: way to not dept on lshw? + if (!QStandardPaths::findExecutable("lshw").isEmpty()) { + QProcess lshw; - if (line.startsWith("model name")) { - if (int index = line.indexOf(':', 10)) { - if (index > 0) - cpuModelName = QString::fromLatin1(line.mid(index + 1).trimmed()); - } - break; - } - } while (lineLength >= 0); + lshw.start("lshw", {"-c", "memory", "-json", "-sanitize"}, QIODevice::ReadOnly); - file.close(); - } + if (!lshw.waitForFinished()) { + return; + } - memoryTotalSize = get_phys_pages() * sysconf(_SC_PAGESIZE); + 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"); + memoryInstalledSize = memoryHwInfo.toObject().value("size").toDouble(); // TODO: check "units" is "bytes" ? + } + } // Getting Disk Size const QString &deviceName = QStorageInfo::root().device(); @@ -337,7 +372,7 @@ void DSysInfoPrivate::ensureComputerInfo() QJsonArray diskStatusArray = diskStatusJsonValue.toArray(); QString keyName; - for (const QJsonValue &oneValue : diskStatusArray) { + 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(); @@ -359,6 +394,24 @@ void DSysInfoPrivate::ensureComputerInfo() #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() @@ -369,11 +422,15 @@ QString DSysInfo::operatingSystemName() } #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; + return productType() == Deepin || productType() == Uos; } bool DSysInfo::isDDE() @@ -419,6 +476,115 @@ QString DSysInfo::deepinCopyright() } #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 \l 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->ensureDeepinInfo(); +#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 \l 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->ensureDeepinInfo(); +#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 \l fallback one if there are no such logo. + * + * use \l 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(); @@ -440,6 +606,38 @@ QString DSysInfo::productVersion() 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() { siGlobal->ensureComputerInfo(); @@ -454,11 +652,24 @@ QString DSysInfo::cpuModelName() return siGlobal->cpuModelName; } +/*! + * \return the installed memory size + */ +qint64 DSysInfo::memoryInstalledSize() +{ + siGlobal->ensureComputerInfo(); + + return siGlobal->memoryInstalledSize; +} + +/*! + * \return the total available to use memory size + */ qint64 DSysInfo::memoryTotalSize() { siGlobal->ensureComputerInfo(); - return siGlobal->memoryTotalSize; + return siGlobal->memoryAvailableSize; } qint64 DSysInfo::systemDiskSize() diff --git a/src/dsysinfo.h b/src/dsysinfo.h index 4283502..4fd17a1 100644 --- a/src/dsysinfo.h +++ b/src/dsysinfo.h @@ -6,7 +6,7 @@ * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * 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. * @@ -15,7 +15,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef DSYSINFO_H @@ -42,13 +42,29 @@ public: Manjaro, openSUSE, SailfishOS, - Ubuntu + Ubuntu, + Uos }; enum DeepinType { UnknownDeepin = 0, DeepinDesktop, - DeepinProfessional + 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 }; #ifdef Q_OS_LINUX @@ -61,13 +77,26 @@ public: static QString deepinCopyright(); #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(); }; diff --git a/src/dtk_module.prf b/src/dtk_module.prf index 1774a4b..800e28c 100644 --- a/src/dtk_module.prf +++ b/src/dtk_module.prf @@ -120,8 +120,8 @@ PKG_MODULE_DEPENDS = $$unique(PKG_MODULE_DEPENDS) # Config pkg-config QMAKE_PKGCONFIG_VERSION = $$VERSION QMAKE_PKGCONFIG_DESTDIR = pkgconfig -QMAKE_PKGCONFIG_NAME = DTK_$$upper($$MODULE_ID) +QMAKE_PKGCONFIG_NAME = $$upper($$MODULE_ID) QMAKE_PKGCONFIG_DESCRIPTION = Deepin Tool Kit $$MODULE_ID header files -QMAKE_PKGCONFIG_REQUIRES += $$PKG_MODULE_DEPENDS +QMAKE_PKGCONFIG_REQUIRES += $$join(PKG_MODULE_DEPENDS, ", ") QMAKE_PKGCONFIG_INCDIR = $$includes.path QMAKE_PKGCONFIG_LIBDIR = $$target.path diff --git a/src/dtk_qmake.prf b/src/dtk_qmake.prf index 872ed86..38a3835 100644 --- a/src/dtk_qmake.prf +++ b/src/dtk_qmake.prf @@ -88,11 +88,18 @@ else { QMAKE_PLATFORM += $$lower($$DISTRIB_ID) - !isEmpty(DISTRIB_ID): DEFINES += Q_OS_$$upper($$DISTRIB_ID) + DISTRIB_ID = $$upper($$DISTRIB_ID) + !isEmpty(DISTRIB_ID): DEFINES += Q_OS_$$DISTRIB_ID CONFIG *= $$QMAKE_PLATFORM DISTRIB_RELEASE = $$formatString($$DISTRIB_RELEASE) DEFINES += Q_OS_VERSION=\\\"$$DISTRIB_RELEASE\\\" + + #uos base with deepin + isEqual(DISTRIB_ID, UOS) { + QMAKE_PLATFORM += deepin + DEFINES += Q_OS_DEEPIN + } } isEmpty(DEEPIN_OS_TYPE): warning(No value of the "--deepin-type" in the process "$$DEEPIN_OS_RELEASE_TOOL") diff --git a/src/dtkcore_global.h b/src/dtkcore_global.h index 927acd0..2b749da 100644 --- a/src/dtkcore_global.h +++ b/src/dtkcore_global.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/DTrashManager b/src/filesystem/DTrashManager new file mode 100644 index 0000000..e763093 --- /dev/null +++ b/src/filesystem/DTrashManager @@ -0,0 +1 @@ +#include "dtrashmanager.h" diff --git a/src/filesystem/dbasefilewatcher.cpp b/src/filesystem/dbasefilewatcher.cpp index 8c1ddfa..393c27e 100644 --- a/src/filesystem/dbasefilewatcher.cpp +++ b/src/filesystem/dbasefilewatcher.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dbasefilewatcher.h b/src/filesystem/dbasefilewatcher.h index bbd2aa9..e011bd5 100644 --- a/src/filesystem/dbasefilewatcher.h +++ b/src/filesystem/dbasefilewatcher.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dfilesystemwatcher.h b/src/filesystem/dfilesystemwatcher.h index a224b2d..a8be007 100644 --- a/src/filesystem/dfilesystemwatcher.h +++ b/src/filesystem/dfilesystemwatcher.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dfilesystemwatcher_dummy.cpp b/src/filesystem/dfilesystemwatcher_dummy.cpp index 022c42e..bb2cf51 100644 --- a/src/filesystem/dfilesystemwatcher_dummy.cpp +++ b/src/filesystem/dfilesystemwatcher_dummy.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dfilesystemwatcher_linux.cpp b/src/filesystem/dfilesystemwatcher_linux.cpp index 4be4b4f..bfddfd3 100644 --- a/src/filesystem/dfilesystemwatcher_linux.cpp +++ b/src/filesystem/dfilesystemwatcher_linux.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ @@ -112,16 +112,20 @@ QStringList DFileSystemWatcherPrivate::removePaths(const QStringList &paths, QSt while (it.hasNext()) { QString path = it.next(); int id = pathToID.take(path); - QString x = idToPath.take(id); + for (auto hit = idToPath.find(id); hit != idToPath.end() && hit.key() == id; ++hit) { + if (hit.value() == path) { + idToPath.erase(hit); + break; + } + } it.remove(); - if (x.isEmpty() || x != path) - continue; - - int wd = id < 0 ? -id : id; - // qDebug() << "removing watch for path" << path << "wd" << wd; - inotify_rm_watch(inotifyFd, wd); + 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); @@ -146,34 +150,60 @@ void DFileSystemWatcherPrivate::_q_readFromInotify() char * const end = at + buffSize; QList eventList; - QHash pathForId; + QMultiHash batch_pathmap; /// only save event: IN_MOVE_TO - QMap cookieToFilePath; - QMap cookieToFileName; + QMultiMap cookieToFilePath; + QMultiMap cookieToFileName; QSet hasMoveFromByCookie; +#ifdef QT_DEBUG + int exist_count = 0; +#endif while (at < end) { inotify_event *event = reinterpret_cast(at); - QString path; + QStringList paths; at += sizeof(inotify_event) + event->len; int id = event->wd; - path = getPathFromID(id); - if (path.isEmpty()) { + paths = idToPath.values(id); + if (paths.empty()) { // perhaps a directory? id = -id; - path = getPathFromID(id); - if (path.isEmpty()) + paths = idToPath.values(id); + if (paths.empty()) continue; } if (!(event->mask & IN_MOVED_TO) || !hasMoveFromByCookie.contains(event->cookie)) { - eventList.append(event); - pathForId.insert(id, path); + 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) { - cookieToFilePath.insert(event->cookie, path); + for (auto &path : paths) { + cookieToFilePath.insert(event->cookie, path); + } cookieToFileName.insert(event->cookie, QString::fromUtf8(event->name)); } @@ -191,147 +221,142 @@ void DFileSystemWatcherPrivate::_q_readFromInotify() // qDebug() << "inotify event, wd" << event.wd << "cookie" << event.cookie << "mask" << hex << event.mask; int id = event.wd; - QString path = pathForId.value(id); + QStringList paths = batch_pathmap.values(id); - if (path.isEmpty()) { + if (paths.empty()) { id = -id; - path = pathForId.value(id); + paths = batch_pathmap.values(id); - if (path.isEmpty()) + if (paths.empty()) continue; } const QString &name = QString::fromUtf8(event.name); -// qDebug() << "event for path" << path; + 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); +// /// 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(); + 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; + bool isMove = false; - while (iterator != cookieToFilePath.constEnd()) { - const QString &_path = iterator.value(); - const QString &_name = cookieToFileName.value(iterator.key()); + 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; + if (QFileInfo(_path + QDir::separator() + _name) == QFileInfo(path)) { + isMove = true; + break; + } + + ++iterator; } - ++iterator; + if (isMove) + break; } - 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); - } + /// 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; + QString filePath = path; - if (id < 0) { - if (path.endsWith(QDir::separator())) - filePath = path + name; - else - filePath = path + QDir::separator() + name; - } + 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 (event.mask & IN_CREATE) { +// qDebug() << "IN_CREATE" << filePath << name; - if (name.isEmpty()) { - if (pathToID.contains(path)) { - q->removePath(path); - q->addPath(path); + if (name.isEmpty()) { + if (pathToID.contains(path)) { + q->removePath(path); + q->addPath(path); + } + } else if (pathToID.contains(filePath)) { + q->removePath(filePath); + q->addPath(filePath); } - } else if (pathToID.contains(filePath)) { - q->removePath(filePath); - q->addPath(filePath); - } - Q_EMIT q->fileCreated(path, name, DFileSystemWatcher::QPrivateSignal()); - } + Q_EMIT q->fileCreated(path, name, DFileSystemWatcher::QPrivateSignal()); + } - if (event.mask & IN_DELETE) { -// qDebug() << "IN_DELETE" << filePath; + if (event.mask & IN_DELETE) { +// qDebug() << "IN_DELETE" << filePath; - Q_EMIT q->fileDeleted(path, name, DFileSystemWatcher::QPrivateSignal()); - } + Q_EMIT q->fileDeleted(path, name, DFileSystemWatcher::QPrivateSignal()); + } - if (event.mask & IN_MOVED_FROM) { - const QString &toPath = cookieToFilePath.value(event.cookie); - const QString toName = cookieToFileName.value(event.cookie); + if (event.mask & IN_MOVED_FROM) { + const QString toName = cookieToFileName.value(event.cookie); -// qDebug() << "IN_MOVED_FROM" << filePath << "to path:" << toPath << "to name:" << toName; + 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()); - } + Q_EMIT q->fileMoved(path, name, toPath, toName, DFileSystemWatcher::QPrivateSignal()); + } + } + } - if (event.mask & IN_MOVED_TO) { -// qDebug() << "IN_MOVED_TO" << filePath; + 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 (!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; + if (event.mask & IN_ATTRIB) { +// qDebug() << "IN_ATTRIB" << event.mask << filePath; - Q_EMIT q->fileAttributeChanged(path, name, DFileSystemWatcher::QPrivateSignal()); - } + 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; + /*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()); - } + Q_EMIT q->fileClosed(path, id < 0 ? name : QString(), DFileSystemWatcher::QPrivateSignal()); + } - if (event.mask & IN_MODIFY) { -// qDebug() << "IN_MODIFY" << event.mask << filePath << name; + if (event.mask & IN_MODIFY) { +// qDebug() << "IN_MODIFY" << event.mask << filePath << name; - Q_EMIT q->fileModified(path, name, DFileSystemWatcher::QPrivateSignal()); - } - } -} - -QString DFileSystemWatcherPrivate::getPathFromID(int id) const -{ - QHash::const_iterator i = idToPath.find(id); - while (i != idToPath.constEnd() && i.key() == id) { - if ((i + 1) == idToPath.constEnd() || (i + 1).key() != id) { - return i.value(); + Q_EMIT q->fileModified(path, name, DFileSystemWatcher::QPrivateSignal()); + } } - ++i; } - return QString(); } void DFileSystemWatcherPrivate::onFileChanged(const QString &path, bool removed) diff --git a/src/filesystem/dfilesystemwatcher_win.cpp b/src/filesystem/dfilesystemwatcher_win.cpp index e1e5fc5..826ad25 100644 --- a/src/filesystem/dfilesystemwatcher_win.cpp +++ b/src/filesystem/dfilesystemwatcher_win.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dfilewatcher.cpp b/src/filesystem/dfilewatcher.cpp index 118426e..fb06711 100644 --- a/src/filesystem/dfilewatcher.cpp +++ b/src/filesystem/dfilewatcher.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dfilewatcher.h b/src/filesystem/dfilewatcher.h index 9ac77d7..ba893a3 100644 --- a/src/filesystem/dfilewatcher.h +++ b/src/filesystem/dfilewatcher.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dfilewatchermanager.cpp b/src/filesystem/dfilewatchermanager.cpp index 30bd822..128a40f 100644 --- a/src/filesystem/dfilewatchermanager.cpp +++ b/src/filesystem/dfilewatchermanager.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dfilewatchermanager.h b/src/filesystem/dfilewatchermanager.h index e41582b..4021495 100644 --- a/src/filesystem/dfilewatchermanager.h +++ b/src/filesystem/dfilewatchermanager.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dpathbuf.h b/src/filesystem/dpathbuf.h index bceb389..23a8697 100644 --- a/src/filesystem/dpathbuf.h +++ b/src/filesystem/dpathbuf.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dstandardpaths.cpp b/src/filesystem/dstandardpaths.cpp index bf4080e..4177a9e 100644 --- a/src/filesystem/dstandardpaths.cpp +++ b/src/filesystem/dstandardpaths.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dstandardpaths.h b/src/filesystem/dstandardpaths.h index 491b31f..5323fe4 100644 --- a/src/filesystem/dstandardpaths.h +++ b/src/filesystem/dstandardpaths.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/dtrashmanager.h b/src/filesystem/dtrashmanager.h new file mode 100644 index 0000000..f192a4e --- /dev/null +++ b/src/filesystem/dtrashmanager.h @@ -0,0 +1,47 @@ +/* + * 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 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 diff --git a/src/filesystem/dtrashmanager_dummy.cpp b/src/filesystem/dtrashmanager_dummy.cpp new file mode 100644 index 0000000..054b7d7 --- /dev/null +++ b/src/filesystem/dtrashmanager_dummy.cpp @@ -0,0 +1,156 @@ +/* + * 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 diff --git a/src/filesystem/dtrashmanager_linux.cpp b/src/filesystem/dtrashmanager_linux.cpp new file mode 100644 index 0000000..38446a5 --- /dev/null +++ b/src/filesystem/dtrashmanager_linux.cpp @@ -0,0 +1,260 @@ +/* + * 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 diff --git a/src/filesystem/filesystem.pri b/src/filesystem/filesystem.pri index c8d81a0..d97756d 100644 --- a/src/filesystem/filesystem.pri +++ b/src/filesystem/filesystem.pri @@ -8,7 +8,8 @@ HEADERS += \ $$PWD/dfilewatcher.h \ $$PWD/dfilewatchermanager.h \ $$PWD/dpathbuf.h \ - $$PWD/dstandardpaths.h + $$PWD/dstandardpaths.h \ + $$PWD/dtrashmanager.h SOURCES += \ $$PWD/dbasefilewatcher.cpp \ @@ -19,13 +20,16 @@ SOURCES += \ linux { SOURCES += \ - $$PWD/dfilesystemwatcher_linux.cpp + $$PWD/dfilesystemwatcher_linux.cpp \ + $$PWD/dtrashmanager_linux.cpp } else:win* { SOURCES += \ - $$PWD/dfilesystemwatcher_win.cpp + $$PWD/dfilesystemwatcher_win.cpp \ + $$PWD/dtrashmanager_dummy.cpp } else { SOURCES += \ - $$PWD/dfilesystemwatcher_dummy.cpp + $$PWD/dfilesystemwatcher_dummy.cpp \ + $$PWD/dtrashmanager_dummy.cpp } includes.files += $$PWD/*.h @@ -35,4 +39,5 @@ includes.files += \ $$PWD/DFileSystemWatcher \ $$PWD/DFileWatcherManager \ $$PWD/DPathBuf \ - $$PWD/DStandardPaths + $$PWD/DStandardPaths \ + $$PWD/DTrashManager diff --git a/src/filesystem/private/dbasefilewatcher_p.h b/src/filesystem/private/dbasefilewatcher_p.h index 3eaae3e..f200e94 100644 --- a/src/filesystem/private/dbasefilewatcher_p.h +++ b/src/filesystem/private/dbasefilewatcher_p.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/private/dfilesystemwatcher_dummy_p.h b/src/filesystem/private/dfilesystemwatcher_dummy_p.h index 67311b6..ed97dd6 100644 --- a/src/filesystem/private/dfilesystemwatcher_dummy_p.h +++ b/src/filesystem/private/dfilesystemwatcher_dummy_p.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/filesystem/private/dfilesystemwatcher_linux_p.h b/src/filesystem/private/dfilesystemwatcher_linux_p.h index a880a8a..103c307 100644 --- a/src/filesystem/private/dfilesystemwatcher_linux_p.h +++ b/src/filesystem/private/dfilesystemwatcher_linux_p.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ @@ -48,7 +48,6 @@ public: void _q_readFromInotify(); private: - QString getPathFromID(int id) const; void onFileChanged(const QString &path, bool removed); void onDirectoryChanged(const QString &path, bool removed); }; diff --git a/src/filesystem/private/dfilesystemwatcher_win_p.h b/src/filesystem/private/dfilesystemwatcher_win_p.h index 67311b6..ed97dd6 100644 --- a/src/filesystem/private/dfilesystemwatcher_win_p.h +++ b/src/filesystem/private/dfilesystemwatcher_win_p.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/log/AbstractAppender.cpp b/src/log/AbstractAppender.cpp index 0498695..2d01cf7 100644 --- a/src/log/AbstractAppender.cpp +++ b/src/log/AbstractAppender.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/log/CuteLogger_global.h b/src/log/CuteLogger_global.h index ffa2ad8..aefc915 100644 --- a/src/log/CuteLogger_global.h +++ b/src/log/CuteLogger_global.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/log/LogManager.cpp b/src/log/LogManager.cpp index 55a9e4c..5f8781c 100644 --- a/src/log/LogManager.cpp +++ b/src/log/LogManager.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/log/LogManager.h b/src/log/LogManager.h index 689cb23..5f54903 100644 --- a/src/log/LogManager.h +++ b/src/log/LogManager.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/log/RollingFileAppender.cpp b/src/log/RollingFileAppender.cpp index ce1a65b..abea39a 100644 --- a/src/log/RollingFileAppender.cpp +++ b/src/log/RollingFileAppender.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/log/RollingFileAppender.h b/src/log/RollingFileAppender.h index a93ded2..c01c605 100644 --- a/src/log/RollingFileAppender.h +++ b/src/log/RollingFileAppender.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/settings/backend/qsettingbackend.cpp b/src/settings/backend/qsettingbackend.cpp index ec30198..e37823b 100644 --- a/src/settings/backend/qsettingbackend.cpp +++ b/src/settings/backend/qsettingbackend.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/settings/backend/qsettingbackend.h b/src/settings/backend/qsettingbackend.h index 1388d90..5cfa8da 100644 --- a/src/settings/backend/qsettingbackend.h +++ b/src/settings/backend/qsettingbackend.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/settings/dsettings.cpp b/src/settings/dsettings.cpp index d70dfc5..1d73d09 100644 --- a/src/settings/dsettings.cpp +++ b/src/settings/dsettings.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ @@ -403,6 +403,11 @@ void DSettings::setOption(const QString &key, const QVariant &value) void DSettings::sync() { Q_D(DSettings); + if (!d->backend) { + qWarning() << "backend was not setted..!"; + return; + } + d->backend->doSync(); } @@ -415,6 +420,12 @@ void DSettings::reset() setOption(option->key(), option->defaultValue()); } } + + if (!d->backend) { + qWarning() << "backend was not setted..!"; + return; + } + d->backend->sync(); } @@ -438,7 +449,11 @@ void DSettings::parseJson(const QByteArray &json) d->options.insert(option->key(), option); connect(option.data(), &DSettingsOption::valueChanged, this, [ = ](QVariant value) { - Q_EMIT d->backend->setOption(option->key(), value); + if (d->backend) { + Q_EMIT d->backend->setOption(option->key(), value); + } else { + qWarning() << "backend was not setted..!"; + } Q_EMIT valueChanged(option->key(), value); }); } @@ -447,6 +462,10 @@ void DSettings::parseJson(const QByteArray &json) void DSettings::loadValue() { Q_D(DSettings); + if (!d->backend) { + qWarning() << "backend was not setted..!"; + return; + } for (auto key : d->backend->keys()) { auto value = d->backend->getOption(key); diff --git a/src/settings/dsettings.h b/src/settings/dsettings.h index e955444..5a1e828 100644 --- a/src/settings/dsettings.h +++ b/src/settings/dsettings.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/settings/dsettingsbackend.h b/src/settings/dsettingsbackend.h index 45e49ae..d66dc96 100644 --- a/src/settings/dsettingsbackend.h +++ b/src/settings/dsettingsbackend.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/settings/dsettingsgroup.cpp b/src/settings/dsettingsgroup.cpp index 5bfbfbe..65d12e7 100644 --- a/src/settings/dsettingsgroup.cpp +++ b/src/settings/dsettingsgroup.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/settings/dsettingsgroup.h b/src/settings/dsettingsgroup.h index ab09a81..8397aef 100644 --- a/src/settings/dsettingsgroup.h +++ b/src/settings/dsettingsgroup.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/settings/dsettingsoption.cpp b/src/settings/dsettingsoption.cpp index 1a6cd69..4f23a9f 100644 --- a/src/settings/dsettingsoption.cpp +++ b/src/settings/dsettingsoption.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ @@ -266,7 +266,8 @@ void DSettingsOption::setValue(QVariant value) { Q_D(DSettingsOption); - if (d->value == value) { + // 默认没有设置value时比较默认值。防止reset时出现所有的option都发射valueChanged + if (this->value() == value) { return; } diff --git a/src/settings/dsettingsoption.h b/src/settings/dsettingsoption.h index 72448df..f8d6a34 100644 --- a/src/settings/dsettingsoption.h +++ b/src/settings/dsettingsoption.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/src.pro b/src/src.pro index 00e8fbd..f7feea3 100644 --- a/src/src.pro +++ b/src/src.pro @@ -6,10 +6,14 @@ TARGET = dtkcore INCLUDEPATH += $$PWD HEADERS += $$PWD/dtkcore_global.h \ - dsysinfo.h + dsysinfo.h \ + dsecurestring.h \ + ddesktopentry.h SOURCES += \ - dsysinfo.cpp + dsysinfo.cpp \ + dsecurestring.cpp \ + ddesktopentry.cpp include($$PWD/base/base.pri) include($$PWD/util/util.pri) @@ -26,7 +30,9 @@ includes.files += \ $$PWD/*.h \ $$PWD/dtkcore_config.h \ $$PWD/DtkCores \ - $$PWD/DSysInfo + $$PWD/DSysInfo \ + $$PWD/DSecureString \ + $$PWD/DDesktopEntry INSTALLS += includes target @@ -53,4 +59,7 @@ prf.path = $${MKSPECS_INSTALL_DIR}/features prf.files-=$$PWD/dtk_qmake.prf } -INSTALLS += prf +gsettings.files += $$PWD/com.deepin.dtk.gschema.xml +gsettings.path = $${PREFIX}/share/glib-2.0/schemas + +INSTALLS += prf gsettings diff --git a/src/util/DExportedInterface b/src/util/DExportedInterface new file mode 100644 index 0000000..eea6f16 --- /dev/null +++ b/src/util/DExportedInterface @@ -0,0 +1 @@ +#include "dexportedinterface.h" diff --git a/src/util/DFileServices b/src/util/DFileServices new file mode 100644 index 0000000..77b70de --- /dev/null +++ b/src/util/DFileServices @@ -0,0 +1 @@ +#include "dfileservices.h" diff --git a/src/util/DVtableHook b/src/util/DVtableHook new file mode 100644 index 0000000..37dffef --- /dev/null +++ b/src/util/DVtableHook @@ -0,0 +1 @@ +#include "dvtablehook.h" diff --git a/src/util/dabstractunitformatter.cpp b/src/util/dabstractunitformatter.cpp index 6522d8d..8c6bded 100644 --- a/src/util/dabstractunitformatter.cpp +++ b/src/util/dabstractunitformatter.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/dabstractunitformatter.h b/src/util/dabstractunitformatter.h index 30c6e2e..98bc4d6 100644 --- a/src/util/dabstractunitformatter.h +++ b/src/util/dabstractunitformatter.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/ddisksizeformatter.cpp b/src/util/ddisksizeformatter.cpp index f5c408f..95c660b 100644 --- a/src/util/ddisksizeformatter.cpp +++ b/src/util/ddisksizeformatter.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/ddisksizeformatter.h b/src/util/ddisksizeformatter.h index 6ff5121..96574cc 100644 --- a/src/util/ddisksizeformatter.h +++ b/src/util/ddisksizeformatter.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/dexportedinterface.cpp b/src/util/dexportedinterface.cpp new file mode 100644 index 0000000..f8175d2 --- /dev/null +++ b/src/util/dexportedinterface.cpp @@ -0,0 +1,151 @@ +/* + * 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 "dexportedinterface.h" +#include "private/dobject_p.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +DCORE_BEGIN_NAMESPACE +namespace DUtil { + +class DExportedInterfacePrivate; +class DExportedInterfaceDBusInterface : public QObject, protected QDBusContext +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.deepin.ExportedInterface") + +public: + DExportedInterfaceDBusInterface(DExportedInterfacePrivate *priv); + +public Q_SLOTS: + QStringList list(); + QString help(const QString &action); + QDBusVariant invoke(QString action, QString parameters); + +private: + DExportedInterfacePrivate *p; +}; + +class DExportedInterfacePrivate : public DObjectPrivate +{ +public: + DExportedInterfacePrivate(DExportedInterface *q); + +private: + QStringList actionHelp(QString action, int indent); + + QHash, QString>> actions; + QScopedPointer dbusif; + D_DECLARE_PUBLIC(DExportedInterface) + + friend class DExportedInterfaceDBusInterface; +}; + +DExportedInterface::DExportedInterface(QObject *parent) + : QObject(parent), + DObject(*new DExportedInterfacePrivate(this)) +{ + D_D(DExportedInterface); + QDBusConnection::sessionBus().registerObject("/", d->dbusif.data(), QDBusConnection::RegisterOption::ExportAllSlots); +} + +DExportedInterface::~DExportedInterface() +{ + QDBusConnection::sessionBus().unregisterObject("/"); +} + +void DExportedInterface::registerAction(const QString &action, const QString &description, const std::function handler) +{ + D_D(DExportedInterface); + d->actions[action] = {handler, description}; +} + +QVariant DExportedInterface::invoke(const QString &action, const QString ¶meters) const +{ + D_DC(DExportedInterface); + if (auto func = d->actions.value(action).first) { + return func(parameters); + } + return QVariant(); +} + +DExportedInterfacePrivate::DExportedInterfacePrivate(DExportedInterface *q) + : DObjectPrivate(q) + , dbusif(new DExportedInterfaceDBusInterface(this)) +{} + +QStringList DExportedInterfacePrivate::actionHelp(QString action, int indent) +{ + QStringList ret; + if (actions.contains(action)) { + ret << QString(indent * 2, ' ') + QString("%1: %2").arg(action).arg(actions[action].second); + } + return ret; +} + +DExportedInterfaceDBusInterface::DExportedInterfaceDBusInterface(DExportedInterfacePrivate *priv) + : QObject(nullptr) + , p(priv) +{} + +QStringList DExportedInterfaceDBusInterface::list() +{ + return p->actions.keys(); +} + +QString DExportedInterfaceDBusInterface::help(const QString &action) +{ + if (action.length()) { + return p->actionHelp(action, 0).join('\n'); + } else { + QString ret = "Available actions:"; + QStringList actions = p->actions.keys(); + actions.sort(); + for (auto action : actions) { + ret += QString("\n\n") + p->actionHelp(action, 1).join('\n'); + } + return ret; + } +} + +QDBusVariant DExportedInterfaceDBusInterface::invoke(QString action, QString parameters) +{ + QDBusVariant ret; + if (!p->actions.contains(action)) { + sendErrorReply(QDBusError::ErrorType::InvalidArgs, QString("Action \"%1\" is not registered").arg(action)); + } else { + ret.setVariant(p->q_func()->invoke(action, parameters)); + } + return ret; +} + +} +DCORE_END_NAMESPACE + +#include "dexportedinterface.moc" diff --git a/src/util/dexportedinterface.h b/src/util/dexportedinterface.h new file mode 100644 index 0000000..b8c77fc --- /dev/null +++ b/src/util/dexportedinterface.h @@ -0,0 +1,52 @@ +/* + * 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 . + */ + +#ifndef DEXPORTEDINTERFACE_H +#define DEXPORTEDINTERFACE_H + +#include +#include + +#include + +#include + +DCORE_BEGIN_NAMESPACE + +namespace DUtil { +class DExportedInterfacePrivate; +class LIBDTKCORESHARED_EXPORT DExportedInterface : public QObject, public DObject +{ + Q_OBJECT +public: + explicit DExportedInterface(QObject *parent = nullptr); + ~DExportedInterface(); + + void registerAction(const QString &action, const QString &description, const std::function handler = nullptr); + virtual QVariant invoke(const QString &action, const QString ¶meters) const; +private: + D_DECLARE_PRIVATE(DExportedInterface) +}; +} + +DCORE_END_NAMESPACE + +#endif diff --git a/src/util/dfileservices.h b/src/util/dfileservices.h new file mode 100644 index 0000000..7f64292 --- /dev/null +++ b/src/util/dfileservices.h @@ -0,0 +1,55 @@ +/* + * 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 DFILESERVICES_H +#define DFILESERVICES_H + +#include + +#include + +DCORE_BEGIN_NAMESPACE + +class DFileServices +{ +public: + static bool showFolder(QString localFilePath, const QString &startupId = QString()); + static bool showFolders(const QList localFilePaths, const QString &startupId = QString()); + static bool showFolder(QUrl url, const QString &startupId = QString()); + static bool showFolders(const QList urls, const QString &startupId = QString()); + + static bool showFileItemPropertie(QString localFilePath, const QString &startupId = QString()); + static bool showFileItemProperties(const QList localFilePaths, const QString &startupId = QString()); + static bool showFileItemPropertie(QUrl url, const QString &startupId = QString()); + static bool showFileItemProperties(const QList urls, const QString &startupId = QString()); + + static bool showFileItem(QString localFilePath, const QString &startupId = QString()); + static bool showFileItems(const QList localFilePaths, const QString &startupId = QString()); + static bool showFileItem(QUrl url, const QString &startupId = QString()); + static bool showFileItems(const QList urls, const QString &startupId = QString()); + + static bool trash(QString localFilePath); + static bool trash(const QList localFilePaths); + static bool trash(QUrl urlstartupId); + static bool trash(const QList urls); + + static QString errorMessage(); +}; + +DCORE_END_NAMESPACE + +#endif // DFILESERVICES_H diff --git a/src/util/dfileservices_dummy.cpp b/src/util/dfileservices_dummy.cpp new file mode 100644 index 0000000..24efc48 --- /dev/null +++ b/src/util/dfileservices_dummy.cpp @@ -0,0 +1,162 @@ +/* + * 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 "dfileservices.h" + +DCORE_BEGIN_NAMESPACE + +static QStringList urls2uris(const QList &urls) +{ + QStringList list; + + list.reserve(urls.size()); + + for (const QUrl url : urls) { + list << url.toString(); + } + + return list; +} + +static QList path2urls(const QList &paths) +{ + QList list; + + list.reserve(paths.size()); + + for (const QString &path : paths) { + list << QUrl::fromLocalFile(path); + } + + return list; +} + +bool DFileServices::showFolder(QString localFilePath, const QString &startupId) +{ + Q_UNUSED(localFilePath); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFolders(const QList localFilePaths, const QString &startupId) +{ + Q_UNUSED(localFilePaths); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFolder(QUrl url, const QString &startupId) +{ + Q_UNUSED(url); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFolders(const QList urls, const QString &startupId) +{ + Q_UNUSED(urls); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFileItemPropertie(QString localFilePath, const QString &startupId) +{ + Q_UNUSED(localFilePath); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFileItemProperties(const QList localFilePaths, const QString &startupId) +{ + Q_UNUSED(localFilePaths); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFileItemPropertie(QUrl url, const QString &startupId) +{ + Q_UNUSED(url); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFileItemProperties(const QList urls, const QString &startupId) +{ + Q_UNUSED(urls); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFileItem(QString localFilePath, const QString &startupId) +{ + Q_UNUSED(localFilePath); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFileItems(const QList localFilePaths, const QString &startupId) +{ + Q_UNUSED(localFilePaths); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFileItem(QUrl url, const QString &startupId) +{ + Q_UNUSED(url); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::showFileItems(const QList urls, const QString &startupId) +{ + Q_UNUSED(urls); + Q_UNUSED(startupId); + return false; +} + +bool DFileServices::trash(QString localFilePath) +{ + Q_UNUSED(localFilePath); + return false; +} + +bool DFileServices::trash(const QList localFilePaths) +{ + Q_UNUSED(localFilePaths); + return false; +} + +bool DFileServices::trash(QUrl url) +{ + Q_UNUSED(url); + return false; +} + +bool DFileServices::trash(const QList urls) +{ + Q_UNUSED(urls); + return false; +} + + +QString DFileServices::errorMessage() +{ + return QString(); +} + +DCORE_END_NAMESPACE diff --git a/src/util/dfileservices_linux.cpp b/src/util/dfileservices_linux.cpp new file mode 100644 index 0000000..ad43e0e --- /dev/null +++ b/src/util/dfileservices_linux.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include + +#include "dfileservices.h" + +DCORE_BEGIN_NAMESPACE + +#define EASY_CALL_DBUS(name)\ + QDBusInterface *interface = fileManager1DBusInterface();\ + return interface && interface->call(#name, urls2uris(urls), startupId).type() != QDBusMessage::ErrorMessage; + +static QDBusInterface *fileManager1DBusInterface() +{ + static QDBusInterface interface(QStringLiteral("org.freedesktop.FileManager1"), + QStringLiteral("/org/freedesktop/FileManager1"), + QStringLiteral("org.freedesktop.FileManager1")); + return &interface; +} + +static QStringList urls2uris(const QList &urls) +{ + QStringList list; + + list.reserve(urls.size()); + + for (const QUrl &url : urls) { + list << url.toString(); + } + + return list; +} + +static QList path2urls(const QList &paths) +{ + QList list; + + list.reserve(paths.size()); + + for (const QString &path : paths) { + list << QUrl::fromLocalFile(path); + } + + return list; +} + +bool DFileServices::showFolder(QString localFilePath, const QString &startupId) +{ + return showFolder(QUrl::fromLocalFile(localFilePath), startupId); +} + +bool DFileServices::showFolders(const QList localFilePaths, const QString &startupId) +{ + return showFolders(path2urls(localFilePaths), startupId); +} + +bool DFileServices::showFolder(QUrl url, const QString &startupId) +{ + return showFolders(QList() << url, startupId); +} + +bool DFileServices::showFolders(const QList urls, const QString &startupId) +{ + EASY_CALL_DBUS(ShowFolders) +} + +bool DFileServices::showFileItemPropertie(QString localFilePath, const QString &startupId) +{ + return showFileItemPropertie(QUrl::fromLocalFile(localFilePath), startupId); +} + +bool DFileServices::showFileItemProperties(const QList localFilePaths, const QString &startupId) +{ + return showFileItemProperties(path2urls(localFilePaths), startupId); +} + +bool DFileServices::showFileItemPropertie(QUrl url, const QString &startupId) +{ + return showFileItemProperties(QList() << url, startupId); +} + +bool DFileServices::showFileItemProperties(const QList urls, const QString &startupId) +{ + EASY_CALL_DBUS(ShowItemProperties) +} + +bool DFileServices::showFileItem(QString localFilePath, const QString &startupId) +{ + return showFileItem(QUrl::fromLocalFile(localFilePath), startupId); +} + +bool DFileServices::showFileItems(const QList localFilePaths, const QString &startupId) +{ + return showFileItems(path2urls(localFilePaths), startupId); +} + +bool DFileServices::showFileItem(QUrl url, const QString &startupId) +{ + return showFileItems(QList() << url, startupId); +} + +bool DFileServices::showFileItems(const QList urls, const QString &startupId) +{ + EASY_CALL_DBUS(ShowItems) +} + +bool DFileServices::trash(QString localFilePath) +{ + return trash(QUrl::fromLocalFile(localFilePath)); +} + +bool DFileServices::trash(const QList localFilePaths) +{ + return trash(path2urls(localFilePaths)); +} + +bool DFileServices::trash(QUrl url) +{ + return trash(QList() << url); +} + +bool DFileServices::trash(const QList urls) +{ + QDBusInterface *interface = fileManager1DBusInterface(); + return interface && interface->call("Trash", urls2uris(urls)).type() != QDBusMessage::ErrorMessage; +} + +QString DFileServices::errorMessage() +{ + return fileManager1DBusInterface()->lastError().message(); +} + +DCORE_END_NAMESPACE diff --git a/src/util/dnotifysender.cpp b/src/util/dnotifysender.cpp index caf1bc7..5f4419f 100644 --- a/src/util/dnotifysender.cpp +++ b/src/util/dnotifysender.cpp @@ -6,7 +6,7 @@ * Maintainer: justforlxz * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * 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. * @@ -15,7 +15,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/dpinyin.cpp b/src/util/dpinyin.cpp new file mode 100644 index 0000000..30cf1b2 --- /dev/null +++ b/src/util/dpinyin.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. + * + * Author: zccrs + * + * Maintainer: zccrs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +#include "dpinyin.h" + +#include +#include + +DCORE_BEGIN_NAMESPACE + +static QHash dict = {}; +const char kDictFile[] = ":/dpinyin/resources/dpinyin.dict"; + +static void InitDict() { + if (!dict.isEmpty()) { + return; + } + + dict.reserve(25333); + + QFile file(kDictFile); + + if (!file.open(QIODevice::ReadOnly)) + return; + + QByteArray content = file.readAll(); + + file.close(); + + QTextStream stream(&content, QIODevice::ReadOnly); + + while (!stream.atEnd()) { + const QString line = stream.readLine(); + const QStringList items = line.split(QChar(':')); + + if (items.size() == 2) { + dict.insert(items[0].toInt(nullptr, 16), items[1]); + } + } +} + +QString Chinese2Pinyin(const QString &words) +{ + InitDict(); + + QString result; + + for (int i = 0; i < words.length(); ++i) { + const uint key = words.at(i).unicode(); + auto find_result = dict.find(key); + + if (find_result != dict.end()) { + result.append(find_result.value()); + } else { + result.append(words.at(i)); + } + } + + return result; +} + +DCORE_END_NAMESPACE diff --git a/src/util/dpinyin.h b/src/util/dpinyin.h index 1cd5c7a..317e45c 100644 --- a/src/util/dpinyin.h +++ b/src/util/dpinyin.h @@ -3,7 +3,7 @@ * * Author: kirigaya * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * 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. * @@ -12,7 +12,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * pinyin.dict from https://github.com/flyerhzm/chinese_pinyin @@ -21,62 +21,13 @@ #ifndef DPINYIN_H #define DPINYIN_H -#include "dtkcore_global.h" +#include #include DCORE_BEGIN_NAMESPACE -static QHash dict = {}; - -const char kDictFile[] = ":/dpinyin/resources/dpinyin.dict"; - -void InitDict() { - if (!dict.isEmpty()) { - return; - } - - dict.reserve(25333); - - QFile file(kDictFile); - - if (!file.open(QIODevice::ReadOnly)) - return; - - QByteArray content = file.readAll(); - - file.close(); - - QTextStream stream(&content, QIODevice::ReadOnly); - - while (!stream.atEnd()) { - const QString line = stream.readLine(); - const QStringList items = line.split(QChar(':')); - - if (items.size() == 2) { - dict.insert(items[0].toInt(nullptr, 16), items[1]); - } - } -} - -QString Chinese2Pinyin(const QString& words) { - InitDict(); - - QString result; - - for (int i = 0; i < words.length(); ++i) { - const uint key = words.at(i).unicode(); - auto find_result = dict.find(key); - - if (find_result != dict.end()) { - result.append(find_result.value()); - } else { - result.append(words.at(i)); - } - } - - return result; -} +QString Chinese2Pinyin(const QString& words); DCORE_END_NAMESPACE diff --git a/src/util/drecentmanager.cpp b/src/util/drecentmanager.cpp index aeb760e..21ae2e2 100644 --- a/src/util/drecentmanager.cpp +++ b/src/util/drecentmanager.cpp @@ -6,7 +6,7 @@ * Maintainer: rekols * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * 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. * @@ -15,7 +15,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/drecentmanager.h b/src/util/drecentmanager.h index 003929a..c035ad4 100644 --- a/src/util/drecentmanager.h +++ b/src/util/drecentmanager.h @@ -6,7 +6,7 @@ * Maintainer: rekols * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * 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. * @@ -15,7 +15,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/dtimeunitformatter.cpp b/src/util/dtimeunitformatter.cpp index 508e6db..1da5325 100644 --- a/src/util/dtimeunitformatter.cpp +++ b/src/util/dtimeunitformatter.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/dtimeunitformatter.h b/src/util/dtimeunitformatter.h index 9039848..78bd336 100644 --- a/src/util/dtimeunitformatter.h +++ b/src/util/dtimeunitformatter.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/src/util/dutil.h b/src/util/dutil.h index f1ca0cb..d8bcd87 100644 --- a/src/util/dutil.h +++ b/src/util/dutil.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ @@ -42,5 +42,19 @@ inline void TimerSingleShot(int msec, Func1 slot) #endif } +template +void SecureErase(T *p, size_t size) +{ + memset(p, 0, size); +} + +template +void SecureErase(T &obj) +{ + for (typename T::iterator i = obj.begin(); i != obj.end(); ++i) { + *i = 0; + } + obj.clear(); +} } diff --git a/src/util/dvtablehook.cpp b/src/util/dvtablehook.cpp new file mode 100644 index 0000000..24db396 --- /dev/null +++ b/src/util/dvtablehook.cpp @@ -0,0 +1,320 @@ +/* + * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. + * + * Author: zccrs + * + * Maintainer: zccrs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +#include "dvtablehook.h" + +#include +#ifdef Q_OS_LINUX +#include +#include + +QT_BEGIN_NAMESPACE +QFunctionPointer qt_linux_find_symbol_sys(const char *symbol); +QT_END_NAMESPACE + +#endif + +DCORE_BEGIN_NAMESPACE + +QMap DVtableHook::objToOriginalVfptr; +QMap DVtableHook::objToGhostVfptr; +QMap DVtableHook::objDestructFun; + +bool DVtableHook::copyVtable(quintptr **obj) +{ + int vtable_size = getVtableSize(obj); + + if (vtable_size == 0) + return false; + + // 多开辟一个元素, 新的虚表结构如下: + // 假设obj对象原虚表长度为2, 表结构为: + // ┏━━┳━━┳━━┓其中v1 v2为虚函数地址, 0为数组结尾 + // ┃v1┃v2┃\0┃ + // ┗━━┻━━┻━━┛ + // 则新的表结构为: + // ┏━━┳━━┳━━┳━━┓其中前三个元素为原虚表的复制, sv为原虚表入口地址 + // ┃v1┃v2┃\0┃sv┃ + // ┗━━┻━━┻━━┻━━┛ + vtable_size += 2; + + quintptr *new_vtable = new quintptr[vtable_size]; + + memcpy(new_vtable, *obj, (vtable_size - 1) * sizeof(quintptr)); + + //! save original vfptr + objToOriginalVfptr[obj] = *obj; + // 存储对象原虚表入口地址 + new_vtable[vtable_size - 1] = quintptr(*obj); + + *obj = new_vtable; + //! save ghost vfptr + objToGhostVfptr[obj] = new_vtable; + + return true; +} + +bool DVtableHook::clearGhostVtable(const void *obj) +{ + objToOriginalVfptr.remove((quintptr**)obj); + objDestructFun.remove(obj); + + quintptr *vtable = objToGhostVfptr.take(obj); + + if (vtable) { + delete[] vtable; + + return true; + } + + return false; +} + +/*! + * \brief 通过遍历尝试找到析构函数在虚表中的位置 + * \param obj + * \param destoryObjFun + * \return + */ +int DVtableHook::getDestructFunIndex(quintptr **obj, std::function destoryObjFun) +{ + class _DestoryProbe + { + public: + static quintptr probe(quintptr obj) { + static quintptr _obj = 0; + + if (obj == 0) { + obj = _obj; + _obj = 0; + } else { + _obj = obj; + } + + return obj; + } + + static void nothing() { + + } + }; + + quintptr *vtable = *obj; + int vtable_size = getVtableSize(obj); + + if (vtable_size == 0) + return -1; + + quintptr *new_vtable = new quintptr[vtable_size]; + std::fill(new_vtable, new_vtable + vtable_size, quintptr(&_DestoryProbe::nothing)); + + // 给对象设置新的虚表 + *obj = new_vtable; + + int index = -1; + + for (int i = 0; i < vtable_size; ++i) { + new_vtable[i] = quintptr(&_DestoryProbe::probe); + + // 尝试销毁此对象, 且观察_DestoryProbe::probe是否被调用 + // 如果被调用, 则证明覆盖此虚函数能达到监控对象被销毁的目的 + destoryObjFun(); + + if (_DestoryProbe::probe(0) == quintptr(obj)) { + index = i; + break; + } + } + + // 恢复旧的虚表 + *obj = vtable; + // 销毁临时虚表 + delete[] new_vtable; + + return index; +} + +void DVtableHook::autoCleanVtable(const void *obj) +{ + quintptr fun = objDestructFun.value(obj); + + if (!fun) + return; + + typedef void(*Destruct)(const void*); + Destruct destruct = *reinterpret_cast(&fun); + // call origin destruct function + destruct(obj); + + if (hasVtable(obj)) {// 需要判断一下,有可能在执行析构函数时虚表已经被删除 + // clean + clearGhostVtable(obj); + } +} + +bool DVtableHook::ensureVtable(const void *obj, std::function destoryObjFun) +{ + quintptr **_obj = (quintptr**)(obj); + + if (objToOriginalVfptr.contains(_obj)) { + // 不知道什么原因, 此时obj对象的虚表已经被还原 + if (objToGhostVfptr.value((void*)obj) != *_obj) { + clearGhostVtable((void*)obj); + } else { + return true; + } + } + + if (!copyVtable(_obj)) + return false; + + // 查找对象的析构函数 + int index = getDestructFunIndex(_obj, destoryObjFun); + + // 虚析构函数查找失败 + if (index < 0) { + qWarning("Failed do override destruct function"); + qDebug() << "object:" << obj; + abort(); + } + + quintptr *new_vtable = *_obj; + // 保存对象真实的析构函数 + objDestructFun[(void*)obj] = new_vtable[index]; + + // 覆盖析构函数, 用于在对象析构时自动清理虚表 + new_vtable[index] = reinterpret_cast(&autoCleanVtable); + + return true; +} + +/*! + * \brief DVtableHook::hasVtable 对象的虚表已经被覆盖时返回true,否则返回false + * \param obj + * \return + */ +bool DVtableHook::hasVtable(const void *obj) +{ + quintptr **_obj = (quintptr**)(obj); + + return objToGhostVfptr.contains(_obj); +} + +void DVtableHook::resetVtable(const void *obj) +{ + quintptr **_obj = (quintptr**)obj; + int vtable_size = getVtableSize(_obj); + // 获取obj对象原本虚表的入口 + quintptr *vfptr_t2 = (quintptr*)(*_obj)[vtable_size + 1]; + + if (!vfptr_t2) + return; + + if (!clearGhostVtable(obj)) + return; + + // 还原虚表 + *_obj = vfptr_t2; +} + +/*! + * \brief 将偏移量为functionOffset的虚函数还原到原本的实现 + * \param obj + * \param functionIndex + * \return 如果成功, 返回还原之前obj对象虚表中存储的函数指针, 否则返回0 + */ +quintptr DVtableHook::resetVfptrFun(const void *obj, quintptr functionOffset) +{ + quintptr *vfptr_t1 = *(quintptr**)obj; + quintptr current_fun = *(vfptr_t1 + functionOffset / sizeof(quintptr)); + quintptr origin_fun = originalFun(obj, functionOffset); + + if (!origin_fun) { + return 0; + } + + // reset to original fun + *(vfptr_t1 + functionOffset / sizeof(quintptr)) = origin_fun; + + return current_fun; +} + +/*! + * \brief 获取obj对象偏移量为functionOffset的虚函数原本的函数指针 + * \param obj + * \param functionOffset + * \return 如果obj对象虚表没有被覆盖, 或者函数偏移量正确, 将返回0 + */ +quintptr DVtableHook::originalFun(const void *obj, quintptr functionOffset) +{ + quintptr **_obj = (quintptr**)obj; + int vtable_size = getVtableSize(_obj); + // 获取obj对象原本虚表的入口 + quintptr *vfptr_t2 = (quintptr*)(*_obj)[vtable_size + 1]; + + if (!vfptr_t2) { + qWarning() << "Not override the object virtual table" << obj; + + return 0; + } + + if (functionOffset > UINT_LEAST16_MAX) { + qWarning() << "Is not a virtual function, function address: 0x" << hex << functionOffset; + + return 0; + } + + return *(vfptr_t2 + functionOffset / sizeof(quintptr)); +} + +bool DVtableHook::forceWriteMemory(void *adr, const void *data, size_t length) +{ +#ifdef Q_OS_LINUX + int page_size = sysconf(_SC_PAGESIZE); + quintptr x = reinterpret_cast(adr); + void *new_adr = reinterpret_cast((x - page_size - 1) & ~(page_size -1)); + size_t override_data_length = length + x - reinterpret_cast(new_adr); + + // 失败时直接放弃 + if (mprotect(new_adr, override_data_length, PROT_READ | PROT_WRITE)) { + return false; + } +#endif + // 复制数据 + memcpy(adr, data, length); +#ifdef Q_OS_LINUX + // 恢复内存标志位 + mprotect(new_adr, override_data_length, PROT_READ); +#endif + + return true; +} + +QFunctionPointer DVtableHook::resolve(const char *symbol) +{ +#ifdef Q_OS_LINUX + return QT_PREPEND_NAMESPACE(qt_linux_find_symbol_sys)(symbol); +#else + // TODO + return nullptr; +#endif +} + +DCORE_END_NAMESPACE diff --git a/src/util/dvtablehook.h b/src/util/dvtablehook.h new file mode 100644 index 0000000..2f3491e --- /dev/null +++ b/src/util/dvtablehook.h @@ -0,0 +1,306 @@ +/* + * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. + * + * Author: zccrs + * + * Maintainer: zccrs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +#ifndef DVTABLEHOOK_H +#define DVTABLEHOOK_H + +#include + +#include +#include +#include + +#include + +DCORE_BEGIN_NAMESPACE + +class DVtableHook +{ +public: + static inline quintptr toQuintptr(const void *ptr) + { + return *(quintptr*)ptr; + } + + static inline int getVtableSize(quintptr **obj) + { + quintptr *begin = *obj; + while(*begin) ++begin; + return begin - *obj; + } + + static inline quintptr *getVtableOfObject(const void *obj) + { + return *(quintptr**)obj; + } + + template + static quintptr *getVtableOfClass() + { + QByteArray vtable_symbol(typeid(T).name()); + vtable_symbol.prepend("_ZTV"); + + quintptr *vfptr_t1 = reinterpret_cast(resolve(vtable_symbol.constData())); + + if (!vfptr_t1) + return nullptr; + + // symbol address + 2 * sizeof(quintptr) = virtal table start address + return vfptr_t1 + 2; + } + + static int getDestructFunIndex(quintptr **obj, std::function destoryObjFun); + static constexpr const QObject *getQObject(...) { return nullptr;} + static constexpr const QObject *getQObject(const QObject *obj) { return obj;} + static void autoCleanVtable(const void *obj); + static bool ensureVtable(const void *obj, std::function destoryObjFun); + static bool hasVtable(const void *obj); + static void resetVtable(const void *obj); + static quintptr resetVfptrFun(const void *obj, quintptr functionOffset); + static quintptr originalFun(const void *obj, quintptr functionOffset); + static bool forceWriteMemory(void *adr, const void *data, size_t length); + static QFunctionPointer resolve(const char *symbol); + + template class OverrideDestruct : public T { ~OverrideDestruct() override;}; + template struct CheckCompatibleArguments { enum { value = false }; }; + template struct CheckCompatibleArguments { enum { value = true }; }; + + template + static bool overrideVfptrFun(quintptr *vfptr_t1, Fun1 fun1, quintptr *vfptr_t2, Fun2 fun2, bool forceWrite) + { + typedef QtPrivate::FunctionPointer FunInfo1; + typedef QtPrivate::FunctionPointer FunInfo2; + + //compilation error if the arguments does not match. + Q_STATIC_ASSERT_X((CheckCompatibleArguments::value), + "Function1 and Function2 arguments are not compatible."); + Q_STATIC_ASSERT_X((CheckCompatibleArguments, QtPrivate::List>::value), + "Function1 and Function2 return type are not compatible.."); + + //! ({code}) in the form of a code is to eliminate - Wstrict - aliasing build warnings + quintptr fun1_offset = toQuintptr(&fun1); + quintptr fun2_offset = toQuintptr(&fun2); + + if (fun1_offset < 0 || fun1_offset > UINT_LEAST16_MAX) + return false; + + quintptr *vfun = vfptr_t1 + fun1_offset / sizeof(quintptr); + + // if the fun2 is not virtual function + if (fun2_offset <= UINT_LEAST16_MAX) { + fun2_offset = *(vfptr_t2 + fun2_offset / sizeof(quintptr)); + } + + if (forceWrite) + return forceWriteMemory(vfun, &fun2_offset, sizeof(fun2_offset)); + + *vfun = fun2_offset; + + return true; + } + + template + static bool overrideVfptrFun(const typename QtPrivate::FunctionPointer::Object *t1, Fun1 fun1, + const typename QtPrivate::FunctionPointer::Object *t2, Fun2 fun2) + { + typedef QtPrivate::FunctionPointer FunInfo1; + // 检查析构函数是否为虚 + class OverrideDestruct : public FunInfo1::Object { ~OverrideDestruct() override;}; + + if (!ensureVtable((void*)t1, std::bind(&_destory_helper, t1))) { + return false; + } + + quintptr *vfptr_t1 = getVtableOfObject(t1); + quintptr *vfptr_t2 = getVtableOfObject(t2); + + bool ok = overrideVfptrFun(vfptr_t1, fun1, vfptr_t2, fun2, false); + + if (!ok) { + // 恢复旧环境 + resetVtable(t1); + } + + return ok; + } + + template + static bool overrideVfptrFun(Fun1 fun1, const typename QtPrivate::FunctionPointer::Object *t2, Fun2 fun2) + { + quintptr *vfptr_t1 = getVtableOfClass(); + + if (!vfptr_t1) { + abort(); + } + + quintptr *vfptr_t2 = getVtableOfObject(t2); + + return overrideVfptrFun(vfptr_t1, fun1, vfptr_t2, fun2, true); + } + + template + static bool overrideVfptrFun(Fun1 fun1, const typename QtPrivate::FunctionPointer::Object *t2, Fun2 fun2) + { + typedef QtPrivate::FunctionPointer FunInfo1; + return overrideVfptrFun(fun1, t2, fun2); + } + + template struct FunctionPointer { }; + template struct FunctionPointer + { + typedef QtPrivate::List Arguments; + }; + template struct FunctionPointer + { + typedef QtPrivate::List Arguments; + }; + template + static bool overrideVfptrFun(quintptr *vfptr_t1, Fun1 fun1, Fun2 fun2, bool forceWrite) + { + typedef QtPrivate::FunctionPointer FunInfo1; + typedef QtPrivate::FunctionPointer FunInfo2; + + Q_STATIC_ASSERT(!FunInfo2::IsPointerToMemberFunction); + //compilation error if the arguments does not match. + Q_STATIC_ASSERT_X((CheckCompatibleArguments::Arguments, typename FunInfo2::Arguments>::value), + "Function1 and Function2 arguments are not compatible."); + Q_STATIC_ASSERT_X((CheckCompatibleArguments, QtPrivate::List>::value), + "Function1 and Function2 return type are not compatible.."); + + //! ({code}) in the form of a code is to eliminate - Wstrict - aliasing build warnings + quintptr fun1_offset = toQuintptr(&fun1); + quintptr fun2_offset = toQuintptr(&fun2); + + if (fun1_offset < 0 || fun1_offset > UINT_LEAST16_MAX) + return false; + + quintptr *vfun = vfptr_t1 + fun1_offset / sizeof(quintptr); + + if (forceWrite) + return forceWriteMemory(vfun, &fun2_offset, sizeof(fun2_offset)); + + *vfun = fun2_offset; + + return true; + } + + template + static bool overrideVfptrFun(const typename QtPrivate::FunctionPointer::Object *t1, Fun1 fun1, Fun2 fun2) + { + typedef QtPrivate::FunctionPointer FunInfo1; + // 检查析构函数是否为虚 + class OverrideDestruct : public FunInfo1::Object { ~OverrideDestruct() override;}; + + if (!ensureVtable((void*)t1, std::bind(&_destory_helper, t1))) { + return false; + } + + bool ok = overrideVfptrFun(getVtableOfObject(t1), fun1, fun2, false); + + if (!ok) { + // 恢复旧环境 + resetVtable(t1); + } + + return true; + } + + template + static bool overrideVfptrFun(Fun1 fun1, Fun2 fun2) + { + quintptr *vfptr_t1 = getVtableOfClass(); + + if (!vfptr_t1) { + abort(); + } + + return overrideVfptrFun(vfptr_t1, fun1, fun2, true); + } + + template + static bool overrideVfptrFun(Fun1 fun1, Fun2 fun2) + { + typedef QtPrivate::FunctionPointer FunInfo1; + return overrideVfptrFun(fun1, fun2); + } + + template + static bool resetVfptrFun(const typename QtPrivate::FunctionPointer::Object *obj, Fun1 fun) + { + return resetVfptrFun((void*)obj, toQuintptr(&fun)) > 0; + } + + template + static Fun originalFun(const typename QtPrivate::FunctionPointer::Object *obj, Fun fun) + { + quintptr o_fun = originalFun((void*)obj, toQuintptr(&fun)); + + return *reinterpret_cast(o_fun); + } + + template + static typename QtPrivate::FunctionPointer::ReturnType + callOriginalFun(typename QtPrivate::FunctionPointer::Object *obj, Fun fun, Args&&... args) + { + quintptr fun_offset = toQuintptr(&fun); + + class _ResetVFun + { + public: + ~_ResetVFun() { + *(vfptr + offset / sizeof(quintptr)) = oldFun; + } + quintptr *vfptr = nullptr; + quint16 offset = 0; + quintptr oldFun = 0; + }; + + _ResetVFun rvf; + + rvf.vfptr = *(quintptr**)(obj); + rvf.offset = fun_offset; + rvf.oldFun = DVtableHook::resetVfptrFun((void*)obj, fun_offset); + + if (!rvf.oldFun) { + qWarning() << "Reset the function failed, object:" << obj; + abort(); + } + + // call + return (obj->*fun)(std::forward(args)...); + } + +private: + static bool copyVtable(quintptr **obj); + static bool clearGhostVtable(const void *obj); + + template + static void _destory_helper(const T *obj) { + delete obj; + } + + static QMap objToOriginalVfptr; + static QMap objToGhostVfptr; + static QMap objDestructFun; +}; + +DCORE_END_NAMESPACE + +#endif // DVTABLEHOOK_H diff --git a/src/util/util.pri b/src/util/util.pri index f48c43d..a45dea8 100644 --- a/src/util/util.pri +++ b/src/util/util.pri @@ -6,7 +6,10 @@ HEADERS += \ $$PWD/ddisksizeformatter.h \ $$PWD/ddbussender.h \ $$PWD/drecentmanager.h \ - $$PWD/dnotifysender.h + $$PWD/dnotifysender.h \ + $$PWD/dexportedinterface.h \ + $$PWD/dvtablehook.h \ + $$PWD/dfileservices.h INCLUDEPATH += $$PWD @@ -16,7 +19,10 @@ includes.files += \ $$PWD/DPinyin \ $$PWD/DDBusSender \ $$PWD/DRecentManager \ - $$PWD/DNotifySender + $$PWD/DNotifySender \ + $$PWD/DExportedInterface \ + $$PWD/DVtableHook \ + $$PWD/DFileServices RESOURCES += \ $$PWD/util.qrc @@ -27,4 +33,17 @@ SOURCES += \ $$PWD/ddisksizeformatter.cpp \ $$PWD/ddbussender.cpp \ $$PWD/drecentmanager.cpp \ - $$PWD/dnotifysender.cpp + $$PWD/dnotifysender.cpp \ + $$PWD/dpinyin.cpp \ + $$PWD/dexportedinterface.cpp \ + $$PWD/dvtablehook.cpp + +linux { + QT += dbus + + SOURCES += \ + $$PWD/dfileservices_linux.cpp +} else { + SOURCES += \ + $$PWD/dfileservices_dummy.cpp +} diff --git a/src/version.pri b/src/version.pri deleted file mode 100644 index 30097ba..0000000 --- a/src/version.pri +++ /dev/null @@ -1,32 +0,0 @@ -isEmpty(VERSION) { - !isEqual(TARGET, dtkcore) { - PKG_CONFIG = $$pkgConfigExecutable() - !isEmpty(PKG_CONFIG): VERSION = $$system($$PKG_CONFIG --modversion dtkcore) - } - - isEmpty(VERSION): VERSION = $$system(git -C $$_PRO_FILE_PWD_ describe --tags --abbrev=0) - isEmpty(VERSION): VERSION = $$DTK_VERSION - isEmpty(VERSION): error(VERSION is empty) - VERSION = $$replace(VERSION, [^0-9.],) -} - -ver_list = $$split(VERSION, .) - -isEmpty(VER_MAJ) { - VER_MAJ = $$first(ver_list) -} - -isEmpty(VER_MIN) { - VER_MIN = $$member(ver_list, 1, 1) - isEmpty(VER_MIN):VER_MIN = 0 -} - -isEmpty(VER_PAT) { - VER_PAT = $$member(ver_list, 2, 2) - isEmpty(VER_PAT):VER_PAT = 0 -} - -isEmpty(VER_BUI) { - VER_BUI = $$member(ver_list, 3, 3) - isEmpty(VER_BUI):VER_BUI = 0 -} diff --git a/tests/ddesktopentry/CMakeLists.txt b/tests/ddesktopentry/CMakeLists.txt new file mode 100644 index 0000000..7cfc54e --- /dev/null +++ b/tests/ddesktopentry/CMakeLists.txt @@ -0,0 +1,8 @@ +# run test with verbose log: `ctest --verbose` + +# QXdgDesktopEntryTest +add_executable (DDesktopEntryTest + tst_ddesktopentrytest.cpp +) +add_test (NAME DDesktopEntryTest COMMAND DDesktopEntryTest ) +target_link_libraries (DDesktopEntryTest ${DtkCore_LIBRARIES} Qt5::Test) diff --git a/tests/ddesktopentry/ddesktopentry.pro b/tests/ddesktopentry/ddesktopentry.pro new file mode 100644 index 0000000..accb339 --- /dev/null +++ b/tests/ddesktopentry/ddesktopentry.pro @@ -0,0 +1,27 @@ +QT += testlib +QT -= gui + +TARGET = tst_ddesktopentrytest +TEMPLATE = app +CONFIG += c++11 +CONFIG -= app_bundle + +!isEmpty(DTK_STATIC_LIB){ + DEFINES += DTK_STATIC_LIB +} + +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 +DEPENDPATH += $$PWD/../../src + +CONFIG(debug, debug|release) { + unix:QMAKE_RPATHDIR += $$OUT_PWD/../../src +} + +QMAKE_LFLAGS += -Wl,--export-dynamic + +SOURCES += \ + tst_ddesktopentrytest.cpp diff --git a/tests/ddesktopentry/tst_ddesktopentrytest.cpp b/tests/ddesktopentry/tst_ddesktopentrytest.cpp new file mode 100644 index 0000000..c01faaf --- /dev/null +++ b/tests/ddesktopentry/tst_ddesktopentrytest.cpp @@ -0,0 +1,123 @@ +/* + * 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 +#include +#include + +DCORE_USE_NAMESPACE + +class DDesktopEntryTest : public QObject +{ + Q_OBJECT + +public: + DDesktopEntryTest(); + +private Q_SLOTS: + void testCase_ParseFile(); +}; + +DDesktopEntryTest::DDesktopEntryTest() +{ + // +} + +const QString testFileContent = { QStringLiteral(R"desktop(# A. Example Desktop Entry File +[Desktop Entry] +Version=1.0 +Type=Application +Name=Foo Viewer +Name[zh_CN]=福查看器 +Comment=The best viewer for Foo objects available! +# Next line have an extra " character +Comment[zh_CN]=最棒的 "福 查看器! +TryExec=fooview +Exec=fooview %F +Icon=fooview +MimeType=image/x-foo; +Actions=Gallery;Create; + +[Desktop Action Gallery] +Exec=fooview --gallery +Name=Browse Gallery + +[Desktop Action Create] +Exec=fooview --create-new +Name=Create a new Foo! +Icon=fooview-new +)desktop") }; + +void DDesktopEntryTest::testCase_ParseFile() +{ + QTemporaryFile file("testReadXXXXXX.desktop"); + QVERIFY(file.open()); + const QString fileName = file.fileName(); + QTextStream ts(&file); + ts << testFileContent; + file.close(); + QVERIFY(QFile::exists(fileName)); + + DDesktopEntry *desktopFile = new DDesktopEntry(fileName); + QStringList allGroups = desktopFile->allGroups(); + QCOMPARE(allGroups.count(), 3); + QVERIFY(allGroups.contains("Desktop Entry") && + allGroups.contains("Desktop Action Gallery") && + allGroups.contains("Desktop Action Create")); + QCOMPARE(desktopFile->allGroups(true)[0], QStringLiteral("Desktop Entry")); + QCOMPARE(desktopFile->localizedValue("Name", "zh_CN"), QStringLiteral("福查看器")); + QCOMPARE(desktopFile->localizedValue("Name", "empty"), QStringLiteral("Foo Viewer")); + QCOMPARE(desktopFile->keys(QStringLiteral("Desktop Entry")), + QStringList({"Actions", "Comment", "Comment[zh_CN]", "Exec", "Icon", "MimeType", "Name", "Name[zh_CN]", "TryExec", "Type", "Version"})); + + { + struct RestoreLocale { + ~RestoreLocale() { QLocale::setDefault(QLocale::system()); } + } restoreLocale; + Q_UNUSED(restoreLocale); + + QLocale::setDefault(QLocale("zh_CN")); + QCOMPARE(desktopFile->localizedValue("Name"), QStringLiteral("福查看器")); + + QLocale::setDefault(QLocale::c()); + QCOMPARE(desktopFile->localizedValue("Name"), QStringLiteral("Foo Viewer")); + } + + QCOMPARE(desktopFile->stringValue("Name"), QStringLiteral("Foo Viewer")); + QCOMPARE(desktopFile->setRawValue("Bar Viewer", "Name"), true); + QCOMPARE(desktopFile->stringValue("Name"), QStringLiteral("Bar Viewer")); + QCOMPARE(desktopFile->setLocalizedValue("霸查看器", "zh_CN", "Name"), true); + QCOMPARE(desktopFile->localizedValue("Name", "zh_CN"), QStringLiteral("霸查看器")); + QCOMPARE(desktopFile->contains("Semicolon"), false); + QCOMPARE(desktopFile->setRawValue(";grp\\;2;grp3;", "Semicolon"), true); + QCOMPARE(desktopFile->stringListValue("Semicolon"), QStringList({"", "grp;2", "grp3"})); + QCOMPARE(desktopFile->contains("Semicolon"), true); + QCOMPARE(desktopFile->removeEntry("Semicolon"), true); + QCOMPARE(desktopFile->contains("Semicolon"), false); + + qDebug() << desktopFile->save(); + qDebug() << fileName; +} + +QTEST_APPLESS_MAIN(DDesktopEntryTest) + +#include "tst_ddesktopentrytest.moc" diff --git a/tests/data.qrc b/tests/dutils/data.qrc similarity index 100% rename from tests/data.qrc rename to tests/dutils/data.qrc diff --git a/tests/data/dt-settings.json b/tests/dutils/data/dt-settings.json similarity index 100% rename from tests/data/dt-settings.json rename to tests/dutils/data/dt-settings.json diff --git a/tests/dutils/dutils.pro b/tests/dutils/dutils.pro new file mode 100644 index 0000000..1370c0a --- /dev/null +++ b/tests/dutils/dutils.pro @@ -0,0 +1,29 @@ +QT += testlib dbus +QT -= gui + +TEMPLATE = app +CONFIG += c++11 + +!isEmpty(DTK_STATIC_LIB){ + DEFINES += DTK_STATIC_LIB +} + +SOURCES += \ + main.cpp \ + dutiltester.cpp \ + singletontester.cpp + +HEADERS += \ + dutiltester.h \ + singletontester.h + +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 +DEPENDPATH += $$PWD/../../src +QMAKE_RPATHDIR += $$PWD/../../src + +RESOURCES += \ + data.qrc diff --git a/tests/dutiltester.cpp b/tests/dutils/dutiltester.cpp similarity index 96% rename from tests/dutiltester.cpp rename to tests/dutils/dutiltester.cpp index 9ccd992..b50ca9a 100644 --- a/tests/dutiltester.cpp +++ b/tests/dutils/dutiltester.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ @@ -42,7 +42,12 @@ void TestDUtil::testLogPath() qApp->setApplicationName("deepin-test-dtk"); DPathBuf logPath(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first()); + +#ifdef Q_OS_OSX + logPath = logPath / "Library" / "Caches" / "deepin" / "deepin-test-dtk" / "deepin-test-dtk.log"; +#else logPath = logPath / ".cache" / "deepin" / "deepin-test-dtk" / "deepin-test-dtk.log"; +#endif QCOMPARE(DLogManager::getlogFilePath(), logPath.toString()); } diff --git a/tests/dutiltester.h b/tests/dutils/dutiltester.h similarity index 85% rename from tests/dutiltester.h rename to tests/dutils/dutiltester.h index 4cc5a5f..be9beac 100644 --- a/tests/dutiltester.h +++ b/tests/dutils/dutiltester.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/tests/main.cpp b/tests/dutils/main.cpp similarity index 80% rename from tests/main.cpp rename to tests/dutils/main.cpp index 0c1f4c2..9f73be8 100644 --- a/tests/main.cpp +++ b/tests/dutils/main.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/tests/singletontester.cpp b/tests/dutils/singletontester.cpp similarity index 86% rename from tests/singletontester.cpp rename to tests/dutils/singletontester.cpp index 87c17cb..326b2df 100644 --- a/tests/singletontester.cpp +++ b/tests/dutils/singletontester.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/tests/singletontester.h b/tests/dutils/singletontester.h similarity index 86% rename from tests/singletontester.h rename to tests/dutils/singletontester.h index 3463bfe..003fbc3 100644 --- a/tests/singletontester.h +++ b/tests/dutils/singletontester.h @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ diff --git a/tests/dvtablehook/dvtablehook.pro b/tests/dvtablehook/dvtablehook.pro new file mode 100644 index 0000000..e8d1e77 --- /dev/null +++ b/tests/dvtablehook/dvtablehook.pro @@ -0,0 +1,25 @@ +QT += testlib +QT -= gui + +TEMPLATE = app +CONFIG += c++11 + +!isEmpty(DTK_STATIC_LIB){ + DEFINES += DTK_STATIC_LIB +} + +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 +DEPENDPATH += $$PWD/../../src + +CONFIG(debug, debug|release) { + unix:QMAKE_RPATHDIR += $$OUT_PWD/../../src +} + +QMAKE_LFLAGS += -Wl,--export-dynamic + +SOURCES += \ + tst_dvtablehook.cpp diff --git a/tests/dvtablehook/tst_dvtablehook.cpp b/tests/dvtablehook/tst_dvtablehook.cpp new file mode 100644 index 0000000..9f45c2c --- /dev/null +++ b/tests/dvtablehook/tst_dvtablehook.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd. + * + * Author: zccrs + * + * Maintainer: zccrs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +#include +#include +#include + +#include + +DCORE_USE_NAMESPACE + +class tst_DVtableHook : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void objectFun2ObjectFun(); + void objectFun2Fun(); + + void fun2ObjectFun(); + void fun2Fun(); +}; + +namespace TestClass { +class A { +public: + virtual bool test(int v) { + qDebug() << Q_FUNC_INFO << this << v; + + return false; + } + + virtual ~A() { + + } +}; + +class B { +public: + bool test(int v) { + qDebug() << Q_FUNC_INFO << v; + + return true; + } +}; +} + +using namespace TestClass; + +void tst_DVtableHook::objectFun2ObjectFun() +{ + A *a = new A(); + B *b = new B(); + + QVERIFY(DVtableHook::overrideVfptrFun(a, &A::test, b, &B::test)); + QVERIFY(DVtableHook::hasVtable(a)); + QVERIFY(a->test(0)); + DVtableHook::resetVfptrFun(a, &A::test); + QVERIFY(!a->test(0)); + delete a; + QVERIFY(!DVtableHook::hasVtable(a)); +} + +static bool test(A *obj, int v) +{ + qDebug() << Q_FUNC_INFO << obj << v; + return true; +} + +void tst_DVtableHook::objectFun2Fun() +{ + A *a = new A(); + QVERIFY(DVtableHook::overrideVfptrFun(a, &A::test, &test)); + QVERIFY(a->test(1)); + DVtableHook::resetVtable(a); + QVERIFY(!DVtableHook::hasVtable(a)); +} + +void tst_DVtableHook::fun2ObjectFun() +{ + B *b = new B(); + QVERIFY(DVtableHook::overrideVfptrFun(&A::test, b, &B::test)); + A *a = new A(); + QVERIFY(DVtableHook::getVtableOfObject(a) == DVtableHook::getVtableOfClass()); + QVERIFY(a->test(2)); +} + +void tst_DVtableHook::fun2Fun() +{ + QVERIFY(DVtableHook::overrideVfptrFun(&A::test, &test)); + A *a = new A(); + QVERIFY(a->test(3)); +} + +QTEST_MAIN(tst_DVtableHook) + +#include "tst_dvtablehook.moc" diff --git a/tests/tests.pro b/tests/tests.pro index a632c0d..d37cc25 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,29 +1,5 @@ -QT += testlib dbus -QT -= gui - -TEMPLATE = app -CONFIG += c++11 - -!isEmpty(DTK_STATIC_LIB){ - DEFINES += DTK_STATIC_LIB -} - -SOURCES += \ - main.cpp \ - dutiltester.cpp \ - singletontester.cpp - -HEADERS += \ - dutiltester.h \ - singletontester.h - -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 -DEPENDPATH += $$PWD/../src -QMAKE_RPATHDIR += $$PWD/../src - -RESOURCES += \ - data.qrc +TEMPLATE = subdirs +SUBDIRS += \ + dutils \ + dvtablehook \ + ddesktopentry diff --git a/tools/deepin-os-release/deepin-os-release.pro b/tools/deepin-os-release/deepin-os-release.pro index ba7d1d3..e11edb3 100644 --- a/tools/deepin-os-release/deepin-os-release.pro +++ b/tools/deepin-os-release/deepin-os-release.pro @@ -2,11 +2,13 @@ QT -= gui TEMPLATE = app CONFIG += qt -HEADERS += ../../src/dsysinfo.h +HEADERS += ../../src/dsysinfo.h \ + ../../src/ddesktopentry.h SOURCES += \ main.cpp \ - ../../src/dsysinfo.cpp + ../../src/dsysinfo.cpp \ + ../../src/ddesktopentry.cpp INCLUDEPATH += ../../src DESTDIR = $$_PRO_FILE_PWD_/../../bin diff --git a/tools/deepin-os-release/main.cpp b/tools/deepin-os-release/main.cpp index 529df2f..cdd5ec6 100644 --- a/tools/deepin-os-release/main.cpp +++ b/tools/deepin-os-release/main.cpp @@ -6,7 +6,7 @@ * Maintainer: zccrs * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * 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. * @@ -15,7 +15,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "dsysinfo.h" @@ -24,11 +24,23 @@ #include #include #include +#include #include DCORE_USE_NAMESPACE +bool distributionInfoValid() { + return QFile::exists(DSysInfo::distributionInfoPath()); +} + +void printDistributionOrgInfo(DSysInfo::OrgType type) { + QString sectionName = DSysInfo::distributionInfoSectionName(type); + printf("%s Name: %s\n", qPrintable(sectionName), qPrintable(DSysInfo::distributionOrgName(type))); + printf("%s Logo (Normal size): %s\n", qPrintable(sectionName), qPrintable(DSysInfo::distributionOrgLogo(type))); + printf("%s Website: %s\n", qPrintable(sectionName), qPrintable(DSysInfo::distributionOrgWebsite(type).second)); +} + int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); @@ -44,12 +56,16 @@ int main(int argc, char *argv[]) QCommandLineOption option_product_version("product-version", " "); QCommandLineOption option_computer_name("computer-name", "Computer Name"); QCommandLineOption option_cpu_model("cpu-model", "CPU Model"); + QCommandLineOption option_installed_memory_size("installed-memory-size", "Installed Memory Size (GiB)"); QCommandLineOption option_memory_size("memory-size", "Memory Size (GiB)"); QCommandLineOption option_disk_size("disk-size", "Disk Size (GiB)"); + QCommandLineOption option_distribution_info("distribution-info", "Distribution information"); + QCommandLineOption option_distributer_info("distributer-info", "Distributer information"); parser.addOptions({option_all, option_deepin_type, option_deepin_version, option_deepin_edition, option_deepin_copyright, option_product_type, option_product_version, - option_computer_name, option_cpu_model, option_memory_size, option_disk_size}); + option_computer_name, option_cpu_model, option_installed_memory_size, option_memory_size, + option_disk_size, option_distribution_info, option_distributer_info}); parser.addHelpOption(); parser.addVersionOption(); parser.process(app); @@ -57,6 +73,7 @@ int main(int argc, char *argv[]) if (parser.isSet(option_all)) { printf("Computer Name: %s\n", qPrintable(DSysInfo::computerName())); printf("CPU Model: %s x %d\n", qPrintable(DSysInfo::cpuModelName()), QThread::idealThreadCount()); + printf("Installed Memory Size: %f GiB\n", DSysInfo::memoryInstalledSize() / 1024.0 / 1024 / 1024); printf("Memory Size: %f GiB\n", DSysInfo::memoryTotalSize() / 1024.0 / 1024 / 1024); printf("Disk Size: %f GiB\n", DSysInfo::systemDiskSize() / 1024.0 / 1024 / 1024); @@ -74,6 +91,11 @@ int main(int argc, char *argv[]) printf("Operating System Name: %s\n", qPrintable(DSysInfo::operatingSystemName())); printf("Product Type: %s\n", qPrintable(DSysInfo::productTypeString())); printf("Product Version: %s\n", qPrintable(DSysInfo::productVersion())); + + if (distributionInfoValid()) { + printDistributionOrgInfo(DSysInfo::Distribution); + printDistributionOrgInfo(DSysInfo::Distributor); + } } else { if (parser.isSet(option_deepin_type)) printf("%s", qPrintable(DSysInfo::deepinTypeDisplayName(QLocale::c()))); @@ -91,10 +113,17 @@ int main(int argc, char *argv[]) printf("%s x %d", qPrintable(DSysInfo::cpuModelName()), QThread::idealThreadCount()); else if (parser.isSet(option_computer_name)) printf("%s", qPrintable(DSysInfo::computerName())); + else if (parser.isSet(option_installed_memory_size)) + printf("%f", DSysInfo::memoryInstalledSize() / 1024.0 / 1024 / 1024); else if (parser.isSet(option_memory_size)) printf("%f", DSysInfo::memoryTotalSize() / 1024.0 / 1024 / 1024); else if (parser.isSet(option_disk_size)) printf("%f", DSysInfo::systemDiskSize() / 1024.0 / 1024 / 1024); + else if (parser.isSet(option_distribution_info)) { + printDistributionOrgInfo(DSysInfo::Distribution); + } else if (parser.isSet(option_distributer_info)) { + printDistributionOrgInfo(DSysInfo::Distributor); + } } return 0; diff --git a/tools/settings/main.cpp b/tools/settings/main.cpp index 52970c7..1ce0dc7 100644 --- a/tools/settings/main.cpp +++ b/tools/settings/main.cpp @@ -2,7 +2,7 @@ * 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 General Public License as published by + * 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. * @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -- 2.30.2