--- /dev/null
+include:
+ - remote: 'https://gitlab.deepin.io/dev-tools/letmeci/raw/master/gitlab-ci/dde.yml'
+variables:
+ CPPCHECK: "true"
+ CODESPELL: "true"
-isEmpty(DTK_VERSION):DTK_VERSION=2.0.6
+isEmpty(DTK_VERSION):DTK_VERSION=5.0.0
DTK_MODULE_NAME=dtkcore
<a name="2.0.14"></a>
## 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))
- GNU GENERAL PUBLIC LICENSE
+ GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
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.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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 <http://www.gnu.org/licenses/>.
-
-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:
-
- <program> Copyright (C) <year> <name of author>
- 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
-<http://www.gnu.org/licenses/>.
-
- 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
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+ 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.
-# 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.
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 "")
--- /dev/null
+#=============================================================================
+# 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()
--- /dev/null
+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
+dtkcore (5.0.3) unstable; urgency=medium
+
+ * Release 5.0.3
+
+ -- Deepin Packages Builder <packages@deepin.com> Tue, 21 Sep 2019 13:31:03 +0800
+
+dtkcore (5.0.0) unstable; urgency=medium
+
+ * Release 5.0.0
+
+ -- Deepin Packages Builder <packages@deepin.com> Tue, 03 Sep 2019 08:47:03 +0800
+
dtkcore (2.0.8) unstable; urgency=medium
* Release 2.0.8
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.
.
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.
.
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 <https://www.gnu.org/licenses/>
.
- 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".
+++ /dev/null
-usr/lib/*/*/DCore/bin/*
+++ /dev/null
-usr/lib/*/lib*.so.*
+++ /dev/null
-# 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
--- /dev/null
+usr/lib/*/*/DCore/bin/*
--- /dev/null
+usr/lib/*/lib*.so.*
+usr/share/glib-2.0/schemas
defineTest(checkDtkVersion) {
isEmpty(VERSION) {
- !isEqual(TARGET, dtkcore) {
+ !isEqual(DTK_MODULE_NAME, dtkcore) {
VERSION = $${QT.dtkcore.VERSION}
}
}
isEmpty(LIB_INSTALL_DIR) {
- isEqual(TARGET, dtkcore) {
+ isEqual(DTK_MODULE_NAME, dtkcore) {
LIB_INSTALL_DIR=$$PREFIX/lib
} else {
LIB_INSTALL_DIR=$${QT.dtkcore.libs}
--- /dev/null
+TEMPLATE = subdirs
+SUBDIRS += expintf-example
--- /dev/null
+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
+}
--- /dev/null
+/*
+ * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: Chris Xiong <chirs241097@gmail.com>
+ *
+ * Maintainer: Chris Xiong <chirs241097@gmail.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "util/dexportedinterface.h"
+
+#include <QCoreApplication>
+#include <QDBusConnection>
+#include <QJsonDocument>
+#include <QJsonValue>
+
+#include <cmath>
+
+//#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();
+}
--- /dev/null
+#include "ddesktopentry.h"
--- /dev/null
+#include "dsecurestring.h"
include($$PWD/private/private.pri)
INCLUDEPATH += $$PWD/base
+INCLUDEPATH += $$PWD/private
HEADERS += \
$$PWD/dobject.h \
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+ <enum id="com.deepin.dtk.ColorType">
+ <value nick="UnknownType" value="0" />
+ <value nick="LightType" value="1" />
+ <value nick="DarkType" value="2" />
+ </enum>
+
+ <schema id="com.deepin.dtk">
+ <key enum="com.deepin.dtk.ColorType" name="palette-type">
+ <default>'UnknownType'</default>
+ <summary>application palette type</summary>
+ <description>Palette type of the application. SystemTheme=0 LightTheme=1 DarkTheme=2</description>
+ </key>
+ </schema>
+</schemalist>
--- /dev/null
+/*
+ * Copyright (C) 2019 Deepin Technology Co., Ltd.
+ * 2019 Gary Wang
+ *
+ * Author: Gary Wang <wzc782970009@gmail.com>
+ *
+ * Maintainer: Gary Wang <wzc782970009@gmail.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "ddesktopentry.h"
+
+#include <QDir>
+#include <QFileInfo>
+#include <QMutex>
+#include <QTemporaryFile>
+#include <QDebug>
+#include <QSaveFile>
+
+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<QChar,QChar> &repl)
+{
+ // First we replace slash.
+ str.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
+
+ QHashIterator<QChar,QChar> 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<QChar,QChar> &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<QString, QString> 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<QString, QString>::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<DDesktopEntrySection*>(this)->ensureSectionDataParsed();
+ return valuesMap.contains(key);
+ }
+
+ QStringList allKeys() const {
+ const_cast<DDesktopEntrySection*>(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<QString, DDesktopEntrySection> 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<QString, int>;
+
+ QStringList keys = d->sectionsMap.keys();
+ QList<StrIntPair> 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<DDesktopEntryPrivate *>(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<DDesktopEntryPrivate *>(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<DDesktopEntryPrivate *>(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<QChar,QChar> 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<QChar,QChar> 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<QChar,QChar> 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<QChar,QChar> 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
--- /dev/null
+/*
+ * Copyright (C) 2019 Deepin Technology Co., Ltd.
+ * 2019 Gary Wang
+ *
+ * Author: Gary Wang <wzc782970009@gmail.com>
+ *
+ * Maintainer: Gary Wang <wzc782970009@gmail.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <dtkcore_global.h>
+
+#include <QIODevice>
+#include <QObject>
+#include <QVariant>
+
+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<DDesktopEntryPrivate> d_ptr;
+
+ Q_DECLARE_PRIVATE(DDesktopEntry)
+};
+
+DCORE_END_NAMESPACE
--- /dev/null
+/*
+ * Copyright (C) 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: Gary Wang <wzc782970009@gmail.com>
+ *
+ * Maintainer: Gary Wang <wangzichong@deepin.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+#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
--- /dev/null
+/*
+ * Copyright (C) 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: Gary Wang <wzc782970009@gmail.com>
+ *
+ * Maintainer: Gary Wang <wangzichong@deepin.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#include <dtkcore_global.h>
+#include <QString>
+
+DCORE_BEGIN_NAMESPACE
+
+class DSecureString : public QString
+{
+public:
+ using QString::QString;
+ DSecureString(const QString &other) noexcept;
+ ~DSecureString();
+};
+
+DCORE_END_NAMESPACE
* Maintainer: zccrs <zhangjide@deepin.com>
*
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "dsysinfo.h"
+#include "ddesktopentry.h"
#include <QFile>
#include <QLocale>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonArray>
+#include <QSettings>
+#include <QStandardPaths>
#ifdef Q_OS_LINUX
#include <sys/sysinfo.h>
#endif
void ensureReleaseInfo();
void ensureComputerInfo();
+ QMap<QString, QString> parseInfoFile(QFile &file);
#ifdef Q_OS_LINUX
DSysInfo::DeepinType deepinType = DSysInfo::DeepinType(-1);
QString deepinCopyright;
#endif
+ QScopedPointer<DDesktopEntry> distributionInfo;
+
DSysInfo::ProductType productType = DSysInfo::ProductType(-1);
QString prettyName;
QString productTypeString;
QString computerName;
QString cpuModelName;
- qint64 memoryTotalSize = -1;
+ qint64 memoryAvailableSize = -1;
+ qint64 memoryInstalledSize = -1;
qint64 diskSize = 0;
};
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)
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;
void DSysInfoPrivate::ensureComputerInfo()
{
- if (memoryTotalSize >= 0)
+ if (memoryAvailableSize >= 0)
return;
#ifdef Q_OS_LINUX
QFile file("/proc/cpuinfo");
if (file.open(QFile::ReadOnly)) {
- char buf[1024];
- qint64 lineLength = 0;
+ QMap<QString, QString> 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();
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();
#endif
}
+QMap<QString, QString> DSysInfoPrivate::parseInfoFile(QFile &file)
+{
+ char buf[1024];
+ qint64 lineLength = 0;
+ QMap<QString, QString> 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()
}
#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()
}
#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<QString, QString> 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<QString, QString> 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();
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<DeepinType> 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();
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()
* Maintainer: zccrs <zhangjide@deepin.com>
*
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef DSYSINFO_H
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
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<QString, QString> distributionOrgWebsite(OrgType type = Distribution);
+ Q_DECL_DEPRECATED_X("Use deepinDistributionOrgWebsite() instead") static QPair<QString, QString> 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();
};
# 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
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")
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
--- /dev/null
+#include "dtrashmanager.h"
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
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);
char * const end = at + buffSize;
QList<inotify_event *> eventList;
- QHash<int, QString> pathForId;
+ QMultiHash<int, QString> batch_pathmap;
/// only save event: IN_MOVE_TO
- QMap<int, QString> cookieToFilePath;
- QMap<int, QString> cookieToFileName;
+ QMultiMap<int, QString> cookieToFilePath;
+ QMultiMap<int, QString> cookieToFileName;
QSet<int> hasMoveFromByCookie;
+#ifdef QT_DEBUG
+ int exist_count = 0;
+#endif
while (at < end) {
inotify_event *event = reinterpret_cast<inotify_event *>(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<QString> 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));
}
// 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<int, QString>::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<int, QString>::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<int, QString>::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)
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DTRASHMANAGER_H
+#define DTRASHMANAGER_H
+
+#include <dtkcore_global.h>
+#include <DObject>
+
+#include <QObject>
+
+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
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "dtrashmanager.h"
+
+#include "DObjectPrivate"
+
+#include <QDirIterator>
+#include <QStorageInfo>
+#include <QCryptographicHash>
+#include <QDateTime>
+#include <QDebug>
+
+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
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "dtrashmanager.h"
+#include "dstandardpaths.h"
+#include "private/dobject_p.h"
+
+#include <QDirIterator>
+#include <QStorageInfo>
+#include <QCryptographicHash>
+#include <QDateTime>
+#include <QDebug>
+
+#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
$$PWD/dfilewatcher.h \
$$PWD/dfilewatchermanager.h \
$$PWD/dpathbuf.h \
- $$PWD/dstandardpaths.h
+ $$PWD/dstandardpaths.h \
+ $$PWD/dtrashmanager.h
SOURCES += \
$$PWD/dbasefilewatcher.cpp \
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
$$PWD/DFileSystemWatcher \
$$PWD/DFileWatcherManager \
$$PWD/DPathBuf \
- $$PWD/DStandardPaths
+ $$PWD/DStandardPaths \
+ $$PWD/DTrashManager
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
void _q_readFromInotify();
private:
- QString getPathFromID(int id) const;
void onFileChanged(const QString &path, bool removed);
void onDirectoryChanged(const QString &path, bool removed);
};
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
void DSettings::sync()
{
Q_D(DSettings);
+ if (!d->backend) {
+ qWarning() << "backend was not setted..!";
+ return;
+ }
+
d->backend->doSync();
}
setOption(option->key(), option->defaultValue());
}
}
+
+ if (!d->backend) {
+ qWarning() << "backend was not setted..!";
+ return;
+ }
+
d->backend->sync();
}
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);
});
}
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);
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
{
Q_D(DSettingsOption);
- if (d->value == value) {
+ // 默认没有设置value时比较默认值。防止reset时出现所有的option都发射valueChanged
+ if (this->value() == value) {
return;
}
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
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)
$$PWD/*.h \
$$PWD/dtkcore_config.h \
$$PWD/DtkCores \
- $$PWD/DSysInfo
+ $$PWD/DSysInfo \
+ $$PWD/DSecureString \
+ $$PWD/DDesktopEntry
INSTALLS += includes target
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
--- /dev/null
+#include "dexportedinterface.h"
--- /dev/null
+#include "dfileservices.h"
--- /dev/null
+#include "dvtablehook.h"
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
--- /dev/null
+/*
+ * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: Chris Xiong <chirs241097@gmail.com>
+ *
+ * Maintainer: Chris Xiong <chirs241097@gmail.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "dexportedinterface.h"
+#include "private/dobject_p.h"
+
+#include <QHash>
+#include <QPair>
+#include <QVector>
+#include <QVariant>
+#include <QDBusConnection>
+#include <QDBusVariant>
+#include <QDBusContext>
+#include <QDBusMessage>
+
+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, QPair<std::function<QVariant(QString)>, QString>> actions;
+ QScopedPointer<DExportedInterfaceDBusInterface> 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<QVariant (QString)> 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"
--- /dev/null
+/*
+ * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: Chris Xiong <chirs241097@gmail.com>
+ *
+ * Maintainer: Chris Xiong <chirs241097@gmail.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DEXPORTEDINTERFACE_H
+#define DEXPORTEDINTERFACE_H
+
+#include <dtkcore_global.h>
+#include <dobject.h>
+
+#include <QObject>
+
+#include <functional>
+
+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<QVariant(QString)> handler = nullptr);
+ virtual QVariant invoke(const QString &action, const QString ¶meters) const;
+private:
+ D_DECLARE_PRIVATE(DExportedInterface)
+};
+}
+
+DCORE_END_NAMESPACE
+
+#endif
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DFILESERVICES_H
+#define DFILESERVICES_H
+
+#include <dtkcore_global.h>
+
+#include <QUrl>
+
+DCORE_BEGIN_NAMESPACE
+
+class DFileServices
+{
+public:
+ static bool showFolder(QString localFilePath, const QString &startupId = QString());
+ static bool showFolders(const QList<QString> localFilePaths, const QString &startupId = QString());
+ static bool showFolder(QUrl url, const QString &startupId = QString());
+ static bool showFolders(const QList<QUrl> urls, const QString &startupId = QString());
+
+ static bool showFileItemPropertie(QString localFilePath, const QString &startupId = QString());
+ static bool showFileItemProperties(const QList<QString> localFilePaths, const QString &startupId = QString());
+ static bool showFileItemPropertie(QUrl url, const QString &startupId = QString());
+ static bool showFileItemProperties(const QList<QUrl> urls, const QString &startupId = QString());
+
+ static bool showFileItem(QString localFilePath, const QString &startupId = QString());
+ static bool showFileItems(const QList<QString> localFilePaths, const QString &startupId = QString());
+ static bool showFileItem(QUrl url, const QString &startupId = QString());
+ static bool showFileItems(const QList<QUrl> urls, const QString &startupId = QString());
+
+ static bool trash(QString localFilePath);
+ static bool trash(const QList<QString> localFilePaths);
+ static bool trash(QUrl urlstartupId);
+ static bool trash(const QList<QUrl> urls);
+
+ static QString errorMessage();
+};
+
+DCORE_END_NAMESPACE
+
+#endif // DFILESERVICES_H
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "dfileservices.h"
+
+DCORE_BEGIN_NAMESPACE
+
+static QStringList urls2uris(const QList<QUrl> &urls)
+{
+ QStringList list;
+
+ list.reserve(urls.size());
+
+ for (const QUrl url : urls) {
+ list << url.toString();
+ }
+
+ return list;
+}
+
+static QList<QUrl> path2urls(const QList<QString> &paths)
+{
+ QList<QUrl> 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<QString> 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<QUrl> 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<QString> 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<QUrl> 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<QString> 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<QUrl> 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<QString> localFilePaths)
+{
+ Q_UNUSED(localFilePaths);
+ return false;
+}
+
+bool DFileServices::trash(QUrl url)
+{
+ Q_UNUSED(url);
+ return false;
+}
+
+bool DFileServices::trash(const QList<QUrl> urls)
+{
+ Q_UNUSED(urls);
+ return false;
+}
+
+
+QString DFileServices::errorMessage()
+{
+ return QString();
+}
+
+DCORE_END_NAMESPACE
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <QDBusInterface>
+#include <QDBusPendingCall>
+#include <QDebug>
+#include <QFile>
+
+#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<QUrl> &urls)
+{
+ QStringList list;
+
+ list.reserve(urls.size());
+
+ for (const QUrl &url : urls) {
+ list << url.toString();
+ }
+
+ return list;
+}
+
+static QList<QUrl> path2urls(const QList<QString> &paths)
+{
+ QList<QUrl> 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<QString> localFilePaths, const QString &startupId)
+{
+ return showFolders(path2urls(localFilePaths), startupId);
+}
+
+bool DFileServices::showFolder(QUrl url, const QString &startupId)
+{
+ return showFolders(QList<QUrl>() << url, startupId);
+}
+
+bool DFileServices::showFolders(const QList<QUrl> 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<QString> localFilePaths, const QString &startupId)
+{
+ return showFileItemProperties(path2urls(localFilePaths), startupId);
+}
+
+bool DFileServices::showFileItemPropertie(QUrl url, const QString &startupId)
+{
+ return showFileItemProperties(QList<QUrl>() << url, startupId);
+}
+
+bool DFileServices::showFileItemProperties(const QList<QUrl> 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<QString> localFilePaths, const QString &startupId)
+{
+ return showFileItems(path2urls(localFilePaths), startupId);
+}
+
+bool DFileServices::showFileItem(QUrl url, const QString &startupId)
+{
+ return showFileItems(QList<QUrl>() << url, startupId);
+}
+
+bool DFileServices::showFileItems(const QList<QUrl> urls, const QString &startupId)
+{
+ EASY_CALL_DBUS(ShowItems)
+}
+
+bool DFileServices::trash(QString localFilePath)
+{
+ return trash(QUrl::fromLocalFile(localFilePath));
+}
+
+bool DFileServices::trash(const QList<QString> localFilePaths)
+{
+ return trash(path2urls(localFilePaths));
+}
+
+bool DFileServices::trash(QUrl url)
+{
+ return trash(QList<QUrl>() << url);
+}
+
+bool DFileServices::trash(const QList<QUrl> urls)
+{
+ QDBusInterface *interface = fileManager1DBusInterface();
+ return interface && interface->call("Trash", urls2uris(urls)).type() != QDBusMessage::ErrorMessage;
+}
+
+QString DFileServices::errorMessage()
+{
+ return fileManager1DBusInterface()->lastError().message();
+}
+
+DCORE_END_NAMESPACE
* Maintainer: justforlxz <zhangdingyuan@deepin.com>
*
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
--- /dev/null
+/*
+ * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: zccrs <zccrs@live.com>
+ *
+ * Maintainer: zccrs <zhangjide@deepin.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+#include "dpinyin.h"
+
+#include <QFile>
+#include <QTextStream>
+
+DCORE_BEGIN_NAMESPACE
+
+static QHash<uint, QString> 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
*
* Author: kirigaya <kirigaya@mkacg.com>
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*
* pinyin.dict from https://github.com/flyerhzm/chinese_pinyin
#ifndef DPINYIN_H
#define DPINYIN_H
-#include "dtkcore_global.h"
+#include <dtkcore_global.h>
#include <QHash>
DCORE_BEGIN_NAMESPACE
-static QHash<uint, QString> 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
* Maintainer: rekols <rekols@foxmail.com>
*
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* Maintainer: rekols <rekols@foxmail.com>
*
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#endif
}
+template <class T>
+void SecureErase(T *p, size_t size)
+{
+ memset(p, 0, size);
+}
+
+template <class T>
+void SecureErase(T &obj)
+{
+ for (typename T::iterator i = obj.begin(); i != obj.end(); ++i) {
+ *i = 0;
+ }
+ obj.clear();
+}
}
--- /dev/null
+/*
+ * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: zccrs <zccrs@live.com>
+ *
+ * Maintainer: zccrs <zhangjide@deepin.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+#include "dvtablehook.h"
+
+#include <algorithm>
+#ifdef Q_OS_LINUX
+#include <sys/mman.h>
+#include <unistd.h>
+
+QT_BEGIN_NAMESPACE
+QFunctionPointer qt_linux_find_symbol_sys(const char *symbol);
+QT_END_NAMESPACE
+
+#endif
+
+DCORE_BEGIN_NAMESPACE
+
+QMap<quintptr**, quintptr*> DVtableHook::objToOriginalVfptr;
+QMap<const void*, quintptr*> DVtableHook::objToGhostVfptr;
+QMap<const void*, quintptr> 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<void(void)> 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<Destruct*>(&fun);
+ // call origin destruct function
+ destruct(obj);
+
+ if (hasVtable(obj)) {// 需要判断一下,有可能在执行析构函数时虚表已经被删除
+ // clean
+ clearGhostVtable(obj);
+ }
+}
+
+bool DVtableHook::ensureVtable(const void *obj, std::function<void ()> 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<quintptr>(&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<quintptr>(adr);
+ void *new_adr = reinterpret_cast<void*>((x - page_size - 1) & ~(page_size -1));
+ size_t override_data_length = length + x - reinterpret_cast<quintptr>(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
--- /dev/null
+/*
+ * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: zccrs <zccrs@live.com>
+ *
+ * Maintainer: zccrs <zhangjide@deepin.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+#ifndef DVTABLEHOOK_H
+#define DVTABLEHOOK_H
+
+#include <dtkcore_global.h>
+
+#include <QObject>
+#include <QSet>
+#include <QDebug>
+
+#include <functional>
+
+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 <typename T>
+ static quintptr *getVtableOfClass()
+ {
+ QByteArray vtable_symbol(typeid(T).name());
+ vtable_symbol.prepend("_ZTV");
+
+ quintptr *vfptr_t1 = reinterpret_cast<quintptr*>(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<void(void)> 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<void(void)> 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 <typename T> class OverrideDestruct : public T { ~OverrideDestruct() override;};
+ template <typename List1, typename List2> struct CheckCompatibleArguments { enum { value = false }; };
+ template <typename List> struct CheckCompatibleArguments<List, List> { enum { value = true }; };
+
+ template<typename Fun1, typename Fun2>
+ static bool overrideVfptrFun(quintptr *vfptr_t1, Fun1 fun1, quintptr *vfptr_t2, Fun2 fun2, bool forceWrite)
+ {
+ typedef QtPrivate::FunctionPointer<Fun1> FunInfo1;
+ typedef QtPrivate::FunctionPointer<Fun2> FunInfo2;
+
+ //compilation error if the arguments does not match.
+ Q_STATIC_ASSERT_X((CheckCompatibleArguments<typename FunInfo1::Arguments, typename FunInfo2::Arguments>::value),
+ "Function1 and Function2 arguments are not compatible.");
+ Q_STATIC_ASSERT_X((CheckCompatibleArguments<QtPrivate::List<typename FunInfo1::ReturnType>, QtPrivate::List<typename FunInfo2::ReturnType>>::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<typename Fun1, typename Fun2>
+ static bool overrideVfptrFun(const typename QtPrivate::FunctionPointer<Fun1>::Object *t1, Fun1 fun1,
+ const typename QtPrivate::FunctionPointer<Fun2>::Object *t2, Fun2 fun2)
+ {
+ typedef QtPrivate::FunctionPointer<Fun1> FunInfo1;
+ // 检查析构函数是否为虚
+ class OverrideDestruct : public FunInfo1::Object { ~OverrideDestruct() override;};
+
+ if (!ensureVtable((void*)t1, std::bind(&_destory_helper<typename FunInfo1::Object>, 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<typename Class, typename Fun1, typename Fun2>
+ static bool overrideVfptrFun(Fun1 fun1, const typename QtPrivate::FunctionPointer<Fun2>::Object *t2, Fun2 fun2)
+ {
+ quintptr *vfptr_t1 = getVtableOfClass<Class>();
+
+ if (!vfptr_t1) {
+ abort();
+ }
+
+ quintptr *vfptr_t2 = getVtableOfObject(t2);
+
+ return overrideVfptrFun(vfptr_t1, fun1, vfptr_t2, fun2, true);
+ }
+
+ template<typename Fun1, typename Fun2>
+ static bool overrideVfptrFun(Fun1 fun1, const typename QtPrivate::FunctionPointer<Fun2>::Object *t2, Fun2 fun2)
+ {
+ typedef QtPrivate::FunctionPointer<Fun1> FunInfo1;
+ return overrideVfptrFun<typename FunInfo1::Object>(fun1, t2, fun2);
+ }
+
+ template<typename Func> struct FunctionPointer { };
+ template<class Obj, typename Ret, typename... Args> struct FunctionPointer<Ret (Obj::*) (Args...)>
+ {
+ typedef QtPrivate::List<Obj*, Args...> Arguments;
+ };
+ template<class Obj, typename Ret, typename... Args> struct FunctionPointer<Ret (Obj::*) (Args...) const>
+ {
+ typedef QtPrivate::List<Obj*, Args...> Arguments;
+ };
+ template<typename Fun1, typename Fun2>
+ static bool overrideVfptrFun(quintptr *vfptr_t1, Fun1 fun1, Fun2 fun2, bool forceWrite)
+ {
+ typedef QtPrivate::FunctionPointer<Fun1> FunInfo1;
+ typedef QtPrivate::FunctionPointer<Fun2> FunInfo2;
+
+ Q_STATIC_ASSERT(!FunInfo2::IsPointerToMemberFunction);
+ //compilation error if the arguments does not match.
+ Q_STATIC_ASSERT_X((CheckCompatibleArguments<typename FunctionPointer<Fun1>::Arguments, typename FunInfo2::Arguments>::value),
+ "Function1 and Function2 arguments are not compatible.");
+ Q_STATIC_ASSERT_X((CheckCompatibleArguments<QtPrivate::List<typename FunInfo1::ReturnType>, QtPrivate::List<typename FunInfo2::ReturnType>>::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<typename Fun1, typename Fun2>
+ static bool overrideVfptrFun(const typename QtPrivate::FunctionPointer<Fun1>::Object *t1, Fun1 fun1, Fun2 fun2)
+ {
+ typedef QtPrivate::FunctionPointer<Fun1> FunInfo1;
+ // 检查析构函数是否为虚
+ class OverrideDestruct : public FunInfo1::Object { ~OverrideDestruct() override;};
+
+ if (!ensureVtable((void*)t1, std::bind(&_destory_helper<typename FunInfo1::Object>, t1))) {
+ return false;
+ }
+
+ bool ok = overrideVfptrFun(getVtableOfObject(t1), fun1, fun2, false);
+
+ if (!ok) {
+ // 恢复旧环境
+ resetVtable(t1);
+ }
+
+ return true;
+ }
+
+ template<typename Class, typename Fun1, typename Fun2>
+ static bool overrideVfptrFun(Fun1 fun1, Fun2 fun2)
+ {
+ quintptr *vfptr_t1 = getVtableOfClass<Class>();
+
+ if (!vfptr_t1) {
+ abort();
+ }
+
+ return overrideVfptrFun(vfptr_t1, fun1, fun2, true);
+ }
+
+ template<typename Fun1, typename Fun2>
+ static bool overrideVfptrFun(Fun1 fun1, Fun2 fun2)
+ {
+ typedef QtPrivate::FunctionPointer<Fun1> FunInfo1;
+ return overrideVfptrFun<typename FunInfo1::Object>(fun1, fun2);
+ }
+
+ template<typename Fun1>
+ static bool resetVfptrFun(const typename QtPrivate::FunctionPointer<Fun1>::Object *obj, Fun1 fun)
+ {
+ return resetVfptrFun((void*)obj, toQuintptr(&fun)) > 0;
+ }
+
+ template<typename Fun>
+ static Fun originalFun(const typename QtPrivate::FunctionPointer<Fun>::Object *obj, Fun fun)
+ {
+ quintptr o_fun = originalFun((void*)obj, toQuintptr(&fun));
+
+ return *reinterpret_cast<Fun*>(o_fun);
+ }
+
+ template<typename Fun, typename... Args>
+ static typename QtPrivate::FunctionPointer<Fun>::ReturnType
+ callOriginalFun(typename QtPrivate::FunctionPointer<Fun>::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>(args)...);
+ }
+
+private:
+ static bool copyVtable(quintptr **obj);
+ static bool clearGhostVtable(const void *obj);
+
+ template<typename T>
+ static void _destory_helper(const T *obj) {
+ delete obj;
+ }
+
+ static QMap<quintptr**, quintptr*> objToOriginalVfptr;
+ static QMap<const void*, quintptr*> objToGhostVfptr;
+ static QMap<const void*, quintptr> objDestructFun;
+};
+
+DCORE_END_NAMESPACE
+
+#endif // DVTABLEHOOK_H
$$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
$$PWD/DPinyin \
$$PWD/DDBusSender \
$$PWD/DRecentManager \
- $$PWD/DNotifySender
+ $$PWD/DNotifySender \
+ $$PWD/DExportedInterface \
+ $$PWD/DVtableHook \
+ $$PWD/DFileServices
RESOURCES += \
$$PWD/util.qrc
$$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
+}
+++ /dev/null
-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
-}
+++ /dev/null
-<RCC>
- <qresource prefix="/">
- <file>data/dt-settings.json</file>
- </qresource>
-</RCC>
+++ /dev/null
-{
- "groups": [
- {
- "key": "base",
- "name": "Basic settings",
- "groups": [
- {
- "key": "theme",
- "name": "Theme",
- "options": [
- {
- "key": "theme",
- "type": "checkpicture",
- "default": 0
- },
- {
- "key": "opticy",
- "name": "Opticy",
- "type": "slider",
- "max": 100,
- "min": 0,
- "default": 90
- }
- ]
- },
- {
- "key": "font",
- "name": "Font Style",
- "options": [
- {
- "key": "family",
- "name": "Font",
- "type": "combobox",
- "default": ""
- },
- {
- "key": "size",
- "name": "Font Size",
- "type": "spinbutton",
- "default": 12
- },
- {
- "key": "style",
- "name": "Font Style",
- "type": "buttongroup",
- "items": ["B","/"],
- "default": 0
- }
- ]
- }
- ]
- },
- {
- "key": "shortcuts",
- "name": "Shortcuts",
- "groups": [
- {
- "key": "ternimal",
- "name": "Ternimal",
- "options": [
- {
- "key": "copy",
- "name": "Copy",
- "type": "shortcut",
- "default": "Ctrl+Alt+C"
- },
- {
- "key": "paste",
- "name": "Paste",
- "type": "shortcut",
- "default": "Ctrl+Alt+V"
- },
- {
- "key": "scroll_up",
- "name": "Scroll Up",
- "type": "shortcut",
- "default": "Alt+."
- },
- {
- "key": "scroll_down",
- "name": "Scroll down",
- "type": "shortcut",
- "default": "Alt+,"
- }
- ]
- },
- {
- "key": "workspace",
- "name": "Workspace",
- "options": [
- {
- "key": "new_window",
- "name": "New Window",
- "type": "shortcut",
- "default": "Ctrl+Shitf+<"
- },
- {
- "key": "next_tab",
- "name": "Next Tab",
- "type": "shortcut",
- "default": "Ctrl+N"
- },
- {
- "key": "prev_up",
- "name": "Previous Tab",
- "type": "shortcut",
- "default": "Ctrl+Shitf+>"
- },
- {
- "key": "close_tab",
- "name": "Close Tab",
- "type": "shortcut",
- "default": "Ctrl+W"
- }
- ]
- }
- ]
- },
- {
- "key": "advance",
- "name": "Advance",
- "groups": [
- {
- "key": "cursor",
- "name": "Cursor",
- "options": [
- {
- "key": "shrap",
- "name": "Cursor Shrap",
- "type": "buttongroup",
- "items": ["█","_","|"],
- "default": 0
- },
- {
- "key": "blink",
- "type": "checkbox",
- "text": "Cursor blink",
- "default": true
- },
- {
- "key": "radiogroup",
- "name": " ",
- "type": "radiogroup",
- "items": ["Minimize to tray","Exit Deepin Music"],
- "default": 0
- }
- ]
- },
- {
- "key": "encoding",
- "name": "Default encoding",
- "options": [
- {
- "key": "encoding",
- "name": "Encoding",
- "type": "combobox",
- "default": "utf-8"
- }
- ]
- },
- {
- "key": "coustom",
- "name": "Coustom",
- "options": [
- {
- "key": "coustom_command",
- "name": "Coustom Command",
- "type": "lineedit",
- "default": ""
- },
- {
- "key": "coustom_directory",
- "name": "Coustom Directory",
- "type": "lineedit",
- "default": ""
- }
- ]
- },
- {
- "key": "scroll",
- "name": "Scroll",
- "options": [
- {
- "key": "scroll_bottom",
- "text": "Scroll Bottom",
- "type": "checkbox",
- "default": ""
- },
- {
- "key": "scroll_line_count",
- "name": "Scroll line count",
- "type": "spinbutton",
- "default": 10
- }
- ]
- },
- {
- "key": "compatibility",
- "name": "Compatibility",
- "options": [
- {
- "key": "breakspce_action",
- "name": "Breakspce Action",
- "type": "combobox",
- "default": ""
- },
- {
- "key": "delete_action",
- "name": "Delete Action",
- "type": "combobox",
- "default": ""
- }
- ]
- }
- ]
- }
- ]
-}
--- /dev/null
+# 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)
--- /dev/null
+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
--- /dev/null
+/*
+ * Copyright (C) 2019 Deepin Technology Co., Ltd.
+ * 2019 Gary Wang
+ *
+ * Author: Gary Wang <wzc782970009@gmail.com>
+ *
+ * Maintainer: Gary Wang <wangzichong@deepin.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <QString>
+#include <QtTest>
+#include <DDesktopEntry>
+
+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"
--- /dev/null
+<RCC>
+ <qresource prefix="/">
+ <file>data/dt-settings.json</file>
+ </qresource>
+</RCC>
--- /dev/null
+{
+ "groups": [
+ {
+ "key": "base",
+ "name": "Basic settings",
+ "groups": [
+ {
+ "key": "theme",
+ "name": "Theme",
+ "options": [
+ {
+ "key": "theme",
+ "type": "checkpicture",
+ "default": 0
+ },
+ {
+ "key": "opticy",
+ "name": "Opticy",
+ "type": "slider",
+ "max": 100,
+ "min": 0,
+ "default": 90
+ }
+ ]
+ },
+ {
+ "key": "font",
+ "name": "Font Style",
+ "options": [
+ {
+ "key": "family",
+ "name": "Font",
+ "type": "combobox",
+ "default": ""
+ },
+ {
+ "key": "size",
+ "name": "Font Size",
+ "type": "spinbutton",
+ "default": 12
+ },
+ {
+ "key": "style",
+ "name": "Font Style",
+ "type": "buttongroup",
+ "items": ["B","/"],
+ "default": 0
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "key": "shortcuts",
+ "name": "Shortcuts",
+ "groups": [
+ {
+ "key": "ternimal",
+ "name": "Ternimal",
+ "options": [
+ {
+ "key": "copy",
+ "name": "Copy",
+ "type": "shortcut",
+ "default": "Ctrl+Alt+C"
+ },
+ {
+ "key": "paste",
+ "name": "Paste",
+ "type": "shortcut",
+ "default": "Ctrl+Alt+V"
+ },
+ {
+ "key": "scroll_up",
+ "name": "Scroll Up",
+ "type": "shortcut",
+ "default": "Alt+."
+ },
+ {
+ "key": "scroll_down",
+ "name": "Scroll down",
+ "type": "shortcut",
+ "default": "Alt+,"
+ }
+ ]
+ },
+ {
+ "key": "workspace",
+ "name": "Workspace",
+ "options": [
+ {
+ "key": "new_window",
+ "name": "New Window",
+ "type": "shortcut",
+ "default": "Ctrl+Shitf+<"
+ },
+ {
+ "key": "next_tab",
+ "name": "Next Tab",
+ "type": "shortcut",
+ "default": "Ctrl+N"
+ },
+ {
+ "key": "prev_up",
+ "name": "Previous Tab",
+ "type": "shortcut",
+ "default": "Ctrl+Shitf+>"
+ },
+ {
+ "key": "close_tab",
+ "name": "Close Tab",
+ "type": "shortcut",
+ "default": "Ctrl+W"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "key": "advance",
+ "name": "Advance",
+ "groups": [
+ {
+ "key": "cursor",
+ "name": "Cursor",
+ "options": [
+ {
+ "key": "shrap",
+ "name": "Cursor Shrap",
+ "type": "buttongroup",
+ "items": ["█","_","|"],
+ "default": 0
+ },
+ {
+ "key": "blink",
+ "type": "checkbox",
+ "text": "Cursor blink",
+ "default": true
+ },
+ {
+ "key": "radiogroup",
+ "name": " ",
+ "type": "radiogroup",
+ "items": ["Minimize to tray","Exit Deepin Music"],
+ "default": 0
+ }
+ ]
+ },
+ {
+ "key": "encoding",
+ "name": "Default encoding",
+ "options": [
+ {
+ "key": "encoding",
+ "name": "Encoding",
+ "type": "combobox",
+ "default": "utf-8"
+ }
+ ]
+ },
+ {
+ "key": "coustom",
+ "name": "Coustom",
+ "options": [
+ {
+ "key": "coustom_command",
+ "name": "Coustom Command",
+ "type": "lineedit",
+ "default": ""
+ },
+ {
+ "key": "coustom_directory",
+ "name": "Coustom Directory",
+ "type": "lineedit",
+ "default": ""
+ }
+ ]
+ },
+ {
+ "key": "scroll",
+ "name": "Scroll",
+ "options": [
+ {
+ "key": "scroll_bottom",
+ "text": "Scroll Bottom",
+ "type": "checkbox",
+ "default": ""
+ },
+ {
+ "key": "scroll_line_count",
+ "name": "Scroll line count",
+ "type": "spinbutton",
+ "default": 10
+ }
+ ]
+ },
+ {
+ "key": "compatibility",
+ "name": "Compatibility",
+ "options": [
+ {
+ "key": "breakspce_action",
+ "name": "Breakspce Action",
+ "type": "combobox",
+ "default": ""
+ },
+ {
+ "key": "delete_action",
+ "name": "Delete Action",
+ "type": "combobox",
+ "default": ""
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
--- /dev/null
+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
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "dutiltester.h"
+
+#include <QCoreApplication>
+#include <QtTest/QtTest>
+#include <QStandardPaths>
+#include <QThread>
+#include <QDBusPendingCall>
+#include <QDBusReply>
+
+#include "log/LogManager.h"
+#include "filesystem/dpathbuf.h"
+#include "singletontester.h"
+#include "util/dtimeunitformatter.h"
+#include "util/ddisksizeformatter.h"
+#include "util/ddbussender.h"
+#include "settings/dsettings.h"
+#include "settings/dsettingsgroup.h"
+#include "settings/dsettingsoption.h"
+
+DCORE_USE_NAMESPACE
+
+void TestDUtil::testLogPath()
+{
+ qApp->setOrganizationName("deepin");
+ 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());
+}
+
+void TestDUtil::testPathChange()
+{
+ DPathBuf root("/");
+
+ auto usr = root / "./usr";
+ QCOMPARE(QDir(usr.toString()).absolutePath(), QDir::toNativeSeparators("/usr"));
+
+ root /= "root";
+ QCOMPARE(root.toString(), QDir::toNativeSeparators("/root"));
+
+ root /= "../usr";
+ QCOMPARE(root.toString(), usr.toString());
+}
+
+void TestDUtil::testDSingleton()
+{
+ auto threadA = new QThread;
+ auto testerA = new MultiSingletonTester;
+ connect(threadA, &QThread::started, testerA, &MultiSingletonTester::run);
+ testerA->moveToThread(threadA);
+
+ auto threadB = new QThread;
+ auto testerB = new MultiSingletonTester;
+ testerB->moveToThread(threadB);
+ connect(threadB, &QThread::started, testerB, &MultiSingletonTester::run);
+
+ threadA->start();
+ threadB->start();
+
+ QThread::sleep(5);
+}
+
+void TestDUtil::testTimeFormatter()
+{
+ const DTimeUnitFormatter timeFormatter;
+
+ // 3600 seconds == 1 hour
+ const auto r0 = timeFormatter.format(3600, DTimeUnitFormatter::Seconds);
+ Q_ASSERT(r0.first == 1 && r0.second == DTimeUnitFormatter::Hour);
+
+ // 86400 seconds == 1 day
+ const auto r1 = timeFormatter.format(86400, DTimeUnitFormatter::Seconds);
+ Q_ASSERT(r1.first == 1 && r1.second == DTimeUnitFormatter::Day);
+
+ // 129600 seconds == 1.5 day
+ const auto r3 = timeFormatter.format(129600, DTimeUnitFormatter::Seconds);
+ Q_ASSERT(qFuzzyCompare(1.5, r3.first) && r3.second == DTimeUnitFormatter::Day);
+
+ // 1.5 day == 36 hours
+ const auto r4 = timeFormatter.formatAs(1.5, DTimeUnitFormatter::Day, DTimeUnitFormatter::Hour);
+ Q_ASSERT(r4 == 36);
+}
+
+void TestDUtil::testTimeFormatterList()
+{
+ const DTimeUnitFormatter timeFormatter;
+
+ // 135120.5 Minutes == 93 days + 20 hours + 30 seconds
+ const auto r = timeFormatter.formatAsUnitList(135120.5, DTimeUnitFormatter::Minute);
+ Q_ASSERT(r[0].first == 93 && r[0].second == DTimeUnitFormatter::Day);
+ Q_ASSERT(r[1].first == 20 && r[1].second == DTimeUnitFormatter::Hour);
+ Q_ASSERT(r[2].first == 30 && r[2].second == DTimeUnitFormatter::Seconds);
+}
+
+void TestDUtil::testDiskFormatter()
+{
+ const DDiskSizeFormatter diskFormatter1000 = DDiskSizeFormatter();
+
+ // 1000 K == 1 M
+ const auto i0 = diskFormatter1000.format(1000, DDiskSizeFormatter::K);
+ Q_ASSERT(i0.first == 1 && i0.second == DDiskSizeFormatter::M);
+
+ // 1000 K == 1000000 B
+ const auto i1 = diskFormatter1000.formatAs(1000, DDiskSizeFormatter::K, DDiskSizeFormatter::B);
+ Q_ASSERT(i1 == 1000000);
+}
+
+void TestDUtil::testDiskFormatterList()
+{
+ const DDiskSizeFormatter diskFormatter = DDiskSizeFormatter();
+
+ // 1351223412.1234 KB == 1 TB + 351 GB + 223 MB + 412 KB + 123.4 B
+ const auto r = diskFormatter.formatAsUnitList(1351223412.1234, DDiskSizeFormatter::K);
+ Q_ASSERT(r[0].first == 1 && r[0].second == DDiskSizeFormatter::T);
+ Q_ASSERT(r[1].first == 351 && r[1].second == DDiskSizeFormatter::G);
+ Q_ASSERT(r[2].first == 223 && r[2].second == DDiskSizeFormatter::M);
+ Q_ASSERT(r[3].first == 412 && r[3].second == DDiskSizeFormatter::K);
+
+ // TODO: test failed
+// Q_ASSERT(r[4].first == 123.4 && r[4].second == DiskSizeFormatter::B);
+}
+
+void TestDUtil::testDiskFormatter1024()
+{
+ const DDiskSizeFormatter diskFormatter = DDiskSizeFormatter().rate(1024);
+
+ // 1024 K == 1 M
+ const auto d0 = diskFormatter.format(1024, DDiskSizeFormatter::K);
+ Q_ASSERT(d0.first == 1 && d0.second == DDiskSizeFormatter::M);
+
+ // 100000000000 B == 93.13225746154785 G
+ const auto d1 = diskFormatter.format(100000000000, DDiskSizeFormatter::B);
+ Q_ASSERT(qFuzzyCompare(93.13225746154785, d1.first) && d1.second == DDiskSizeFormatter::G);
+
+ // 100000000000 B == 0.09094947017729282 T
+ const auto d2 = diskFormatter.formatAs(100000000000, DDiskSizeFormatter::B, DDiskSizeFormatter::T);
+ Q_ASSERT(qFuzzyCompare(0.09094947017729282, d2));
+}
+
+void TestDUtil::testDBusSender()
+{
+ // basic method call
+ DDBusSender()
+ .service("com.deepin.dde.ControlCenter")
+ .interface("com.deepin.dde.ControlCenter")
+ .path("/com/deepin/dde/ControlCenter")
+ .method("ShowPage")
+ .arg(QString("update"))
+ .arg(QString("available-updates"))
+ .call();
+
+ // property set
+ QDBusPendingReply<> r1 = DDBusSender()
+ .service("com.deepin.dde.daemon.Dock")
+ .interface("com.deepin.dde.daemon.Dock")
+ .path("/com/deepin/dde/daemon/Dock")
+ .property("DisplayMode")
+ .set(1); // set to efficient mode
+
+ // property get
+ QDBusPendingReply<QVariant> r2 = DDBusSender()
+ .service("com.deepin.dde.daemon.Dock")
+ .interface("com.deepin.dde.daemon.Dock")
+ .path("/com/deepin/dde/daemon/Dock")
+ .property("DisplayMode")
+ .get(); // read mode
+
+ if (!r2.isError() && !r1.isError()) {
+ Q_ASSERT(r2.value().toInt() == 1);
+ }
+
+ // complex type property get
+ QDBusPendingReply<QVariant> r3 = DDBusSender()
+ .service("com.deepin.dde.ControlCenter")
+ .interface("com.deepin.dde.ControlCenter")
+ .path("/com/deepin/dde/ControlCenter")
+ .property("Rect")
+ .get();
+
+ QVariant variant = r3.value();
+ const QDBusArgument v = variant.value<QDBusArgument>();
+
+ int x, y, w, h;
+ v.beginStructure();
+ v >> x >> y >> w >> h;
+ v.endStructure();
+
+ qDebug() << x << y << w << h;
+}
+
+void TestDUtil::testGroups()
+{
+ auto path = ":/data/dt-settings.json";
+ auto settings = DSettings::fromJsonFile(path);
+
+ qDebug() << settings->groupKeys();
+ qDebug() << settings->group("shortcuts");
+ for (auto cg : settings->group("shortcuts")->childGroups()) {
+ qDebug() << cg->key();
+ }
+ qDebug() << settings->group("shortcuts.ternimal");
+ qDebug() << settings->group("shortcuts.ternimal")->options();
+}
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <QObject>
+
+class TestDUtil: public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void testLogPath();
+ void testPathChange();
+ void testDSingleton();
+ void testTimeFormatter();
+ void testTimeFormatterList();
+ void testDiskFormatter();
+ void testDiskFormatterList();
+ void testDiskFormatter1024();
+ void testDBusSender();
+
+ void testGroups();
+};
+
+
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <QtTest/QtTest>
+
+#include "dutiltester.h"
+
+QTEST_MAIN(TestDUtil);
--- /dev/null
+/*
+ * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "singletontester.h"
+
+#include <QDebug>
+#include <QThread>
+
+Singleton::Singleton(QObject *parent) : QObject(parent)
+{
+ qDebug() << "Singleton Init Begin" << this;
+ QThread::sleep(3);
+ qDebug() << "Singleton Init End" << this;
+}
+
+void Singleton::test()
+{
+ qDebug() << "test" << this;
+}
+
+MultiSingletonTester::MultiSingletonTester(QObject *parent) : QObject(parent)
+{
+}
+
+void MultiSingletonTester::run()
+{
+ Singleton::instance()->test();
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <QObject>
+
+#include "base/dsingleton.h"
+
+class Singleton : public QObject, public Dtk::Core::DSingleton<Singleton>
+{
+ Q_OBJECT
+ friend class Dtk::Core::DSingleton<Singleton>;
+public:
+ explicit Singleton(QObject *parent = nullptr);
+
+ void test();
+};
+
+class MultiSingletonTester : public QObject
+{
+ Q_OBJECT
+public:
+ explicit MultiSingletonTester(QObject *parent = nullptr);
+
+ void run();
+};
+
+
+++ /dev/null
-/*
- * 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
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "dutiltester.h"
-
-#include <QCoreApplication>
-#include <QtTest/QtTest>
-#include <QStandardPaths>
-#include <QThread>
-#include <QDBusPendingCall>
-#include <QDBusReply>
-
-#include "log/LogManager.h"
-#include "filesystem/dpathbuf.h"
-#include "singletontester.h"
-#include "util/dtimeunitformatter.h"
-#include "util/ddisksizeformatter.h"
-#include "util/ddbussender.h"
-#include "settings/dsettings.h"
-#include "settings/dsettingsgroup.h"
-#include "settings/dsettingsoption.h"
-
-DCORE_USE_NAMESPACE
-
-void TestDUtil::testLogPath()
-{
- qApp->setOrganizationName("deepin");
- qApp->setApplicationName("deepin-test-dtk");
-
- DPathBuf logPath(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first());
- logPath = logPath / ".cache" / "deepin" / "deepin-test-dtk" / "deepin-test-dtk.log";
-
- QCOMPARE(DLogManager::getlogFilePath(), logPath.toString());
-}
-
-void TestDUtil::testPathChange()
-{
- DPathBuf root("/");
-
- auto usr = root / "./usr";
- QCOMPARE(QDir(usr.toString()).absolutePath(), QDir::toNativeSeparators("/usr"));
-
- root /= "root";
- QCOMPARE(root.toString(), QDir::toNativeSeparators("/root"));
-
- root /= "../usr";
- QCOMPARE(root.toString(), usr.toString());
-}
-
-void TestDUtil::testDSingleton()
-{
- auto threadA = new QThread;
- auto testerA = new MultiSingletonTester;
- connect(threadA, &QThread::started, testerA, &MultiSingletonTester::run);
- testerA->moveToThread(threadA);
-
- auto threadB = new QThread;
- auto testerB = new MultiSingletonTester;
- testerB->moveToThread(threadB);
- connect(threadB, &QThread::started, testerB, &MultiSingletonTester::run);
-
- threadA->start();
- threadB->start();
-
- QThread::sleep(5);
-}
-
-void TestDUtil::testTimeFormatter()
-{
- const DTimeUnitFormatter timeFormatter;
-
- // 3600 seconds == 1 hour
- const auto r0 = timeFormatter.format(3600, DTimeUnitFormatter::Seconds);
- Q_ASSERT(r0.first == 1 && r0.second == DTimeUnitFormatter::Hour);
-
- // 86400 seconds == 1 day
- const auto r1 = timeFormatter.format(86400, DTimeUnitFormatter::Seconds);
- Q_ASSERT(r1.first == 1 && r1.second == DTimeUnitFormatter::Day);
-
- // 129600 seconds == 1.5 day
- const auto r3 = timeFormatter.format(129600, DTimeUnitFormatter::Seconds);
- Q_ASSERT(qFuzzyCompare(1.5, r3.first) && r3.second == DTimeUnitFormatter::Day);
-
- // 1.5 day == 36 hours
- const auto r4 = timeFormatter.formatAs(1.5, DTimeUnitFormatter::Day, DTimeUnitFormatter::Hour);
- Q_ASSERT(r4 == 36);
-}
-
-void TestDUtil::testTimeFormatterList()
-{
- const DTimeUnitFormatter timeFormatter;
-
- // 135120.5 Minutes == 93 days + 20 hours + 30 seconds
- const auto r = timeFormatter.formatAsUnitList(135120.5, DTimeUnitFormatter::Minute);
- Q_ASSERT(r[0].first == 93 && r[0].second == DTimeUnitFormatter::Day);
- Q_ASSERT(r[1].first == 20 && r[1].second == DTimeUnitFormatter::Hour);
- Q_ASSERT(r[2].first == 30 && r[2].second == DTimeUnitFormatter::Seconds);
-}
-
-void TestDUtil::testDiskFormatter()
-{
- const DDiskSizeFormatter diskFormatter1000 = DDiskSizeFormatter();
-
- // 1000 K == 1 M
- const auto i0 = diskFormatter1000.format(1000, DDiskSizeFormatter::K);
- Q_ASSERT(i0.first == 1 && i0.second == DDiskSizeFormatter::M);
-
- // 1000 K == 1000000 B
- const auto i1 = diskFormatter1000.formatAs(1000, DDiskSizeFormatter::K, DDiskSizeFormatter::B);
- Q_ASSERT(i1 == 1000000);
-}
-
-void TestDUtil::testDiskFormatterList()
-{
- const DDiskSizeFormatter diskFormatter = DDiskSizeFormatter();
-
- // 1351223412.1234 KB == 1 TB + 351 GB + 223 MB + 412 KB + 123.4 B
- const auto r = diskFormatter.formatAsUnitList(1351223412.1234, DDiskSizeFormatter::K);
- Q_ASSERT(r[0].first == 1 && r[0].second == DDiskSizeFormatter::T);
- Q_ASSERT(r[1].first == 351 && r[1].second == DDiskSizeFormatter::G);
- Q_ASSERT(r[2].first == 223 && r[2].second == DDiskSizeFormatter::M);
- Q_ASSERT(r[3].first == 412 && r[3].second == DDiskSizeFormatter::K);
-
- // TODO: test failed
-// Q_ASSERT(r[4].first == 123.4 && r[4].second == DiskSizeFormatter::B);
-}
-
-void TestDUtil::testDiskFormatter1024()
-{
- const DDiskSizeFormatter diskFormatter = DDiskSizeFormatter().rate(1024);
-
- // 1024 K == 1 M
- const auto d0 = diskFormatter.format(1024, DDiskSizeFormatter::K);
- Q_ASSERT(d0.first == 1 && d0.second == DDiskSizeFormatter::M);
-
- // 100000000000 B == 93.13225746154785 G
- const auto d1 = diskFormatter.format(100000000000, DDiskSizeFormatter::B);
- Q_ASSERT(qFuzzyCompare(93.13225746154785, d1.first) && d1.second == DDiskSizeFormatter::G);
-
- // 100000000000 B == 0.09094947017729282 T
- const auto d2 = diskFormatter.formatAs(100000000000, DDiskSizeFormatter::B, DDiskSizeFormatter::T);
- Q_ASSERT(qFuzzyCompare(0.09094947017729282, d2));
-}
-
-void TestDUtil::testDBusSender()
-{
- // basic method call
- DDBusSender()
- .service("com.deepin.dde.ControlCenter")
- .interface("com.deepin.dde.ControlCenter")
- .path("/com/deepin/dde/ControlCenter")
- .method("ShowPage")
- .arg(QString("update"))
- .arg(QString("available-updates"))
- .call();
-
- // property set
- QDBusPendingReply<> r1 = DDBusSender()
- .service("com.deepin.dde.daemon.Dock")
- .interface("com.deepin.dde.daemon.Dock")
- .path("/com/deepin/dde/daemon/Dock")
- .property("DisplayMode")
- .set(1); // set to efficient mode
-
- // property get
- QDBusPendingReply<QVariant> r2 = DDBusSender()
- .service("com.deepin.dde.daemon.Dock")
- .interface("com.deepin.dde.daemon.Dock")
- .path("/com/deepin/dde/daemon/Dock")
- .property("DisplayMode")
- .get(); // read mode
-
- if (!r2.isError() && !r1.isError()) {
- Q_ASSERT(r2.value().toInt() == 1);
- }
-
- // complex type property get
- QDBusPendingReply<QVariant> r3 = DDBusSender()
- .service("com.deepin.dde.ControlCenter")
- .interface("com.deepin.dde.ControlCenter")
- .path("/com/deepin/dde/ControlCenter")
- .property("Rect")
- .get();
-
- QVariant variant = r3.value();
- const QDBusArgument v = variant.value<QDBusArgument>();
-
- int x, y, w, h;
- v.beginStructure();
- v >> x >> y >> w >> h;
- v.endStructure();
-
- qDebug() << x << y << w << h;
-}
-
-void TestDUtil::testGroups()
-{
- auto path = ":/data/dt-settings.json";
- auto settings = DSettings::fromJsonFile(path);
-
- qDebug() << settings->groupKeys();
- qDebug() << settings->group("shortcuts");
- for (auto cg : settings->group("shortcuts")->childGroups()) {
- qDebug() << cg->key();
- }
- qDebug() << settings->group("shortcuts.ternimal");
- qDebug() << settings->group("shortcuts.ternimal")->options();
-}
+++ /dev/null
-/*
- * 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
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <QObject>
-
-class TestDUtil: public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void testLogPath();
- void testPathChange();
- void testDSingleton();
- void testTimeFormatter();
- void testTimeFormatterList();
- void testDiskFormatter();
- void testDiskFormatterList();
- void testDiskFormatter1024();
- void testDBusSender();
-
- void testGroups();
-};
-
-
--- /dev/null
+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
--- /dev/null
+/*
+ * Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
+ *
+ * Author: zccrs <zccrs@live.com>
+ *
+ * Maintainer: zccrs <zhangjide@deepin.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <QObject>
+#include <QTest>
+#include <QDebug>
+
+#include <util/DVtableHook>
+
+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<A>());
+ 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"
+++ /dev/null
-/*
- * 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
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <QtTest/QtTest>
-
-#include "dutiltester.h"
-
-QTEST_MAIN(TestDUtil);
+++ /dev/null
-/*
- * 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
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "singletontester.h"
-
-#include <QDebug>
-#include <QThread>
-
-Singleton::Singleton(QObject *parent) : QObject(parent)
-{
- qDebug() << "Singleton Init Begin" << this;
- QThread::sleep(3);
- qDebug() << "Singleton Init End" << this;
-}
-
-void Singleton::test()
-{
- qDebug() << "test" << this;
-}
-
-MultiSingletonTester::MultiSingletonTester(QObject *parent) : QObject(parent)
-{
-}
-
-void MultiSingletonTester::run()
-{
- Singleton::instance()->test();
-}
+++ /dev/null
-/*
- * 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
- * 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 General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <QObject>
-
-#include "base/dsingleton.h"
-
-class Singleton : public QObject, public Dtk::Core::DSingleton<Singleton>
-{
- Q_OBJECT
- friend class Dtk::Core::DSingleton<Singleton>;
-public:
- explicit Singleton(QObject *parent = nullptr);
-
- void test();
-};
-
-class MultiSingletonTester : public QObject
-{
- Q_OBJECT
-public:
- explicit MultiSingletonTester(QObject *parent = nullptr);
-
- void run();
-};
-
-
-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
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
* Maintainer: zccrs <zhangjide@deepin.com>
*
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "dsysinfo.h"
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QThread>
+#include <QFile>
#include <stdio.h>
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);
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);
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);
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())));
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;
* 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.
*
* 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 <http://www.gnu.org/licenses/>.
*/