Import Upstream version 3.3.0.1.0519.1

This commit is contained in:
谢炜 2022-06-02 16:27:58 +08:00
commit 0a48dbecf9
170 changed files with 18172 additions and 0 deletions

90
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,90 @@
name: Check build
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '0 0 * * *'
jobs:
archlinux:
name: on Archlinux
runs-on: ubuntu-20.04
container: docker.io/library/archlinux:latest
steps:
- name: Checkout ukui-sidebar source code
uses: actions/checkout@v2
- name: Refresh pacman repository
run: pacman -Sy
- name: Install build dependencies
run: pacman -S --noconfirm base-devel qt5-base qt5-multimedia qt5-svg qt5-tools gsettings-qt dconf glib2 kwindowsystem glibc ruby-pkg-config libxrandr libxinerama libxcursor libxtst libx11 qt5-x11extras icu
- name: QMake configure & Make
run: |
mkdir build;
cd build;
qmake-qt5 ..;
make -j$(nproc);
debian:
name: on Debian Sid
runs-on: ubuntu-20.04
container: docker.io/library/debian:sid
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Checkout ukui-sidebar source code
uses: actions/checkout@v2
- name: Update apt repository
run: apt-get update -y
- name: Install build dependcies
run: apt-get install -y build-essential qttools5-dev-tools qtmultimedia5-dev libglib2.0-dev qtbase5-dev libqt5svg5-dev qttools5-dev-tools libgsettings-qt-dev libdconf-dev libkf5windowsystem-dev libburner-media3-1 gstreamer1.0-plugins-good gstreamer1.0-pulseaudio libqt5x11extras5-dev pkg-config libxrandr-dev libxinerama-dev libxcursor-dev libburner-media3-1 libxtst-dev
- name: QMake configure & Make
run: |
mkdir build;
cd build;
qmake ..;
make -j$(nproc);
fedora:
name: on Fedora 32
runs-on: ubuntu-20.04
container: docker.io/library/fedora:32
steps:
- name: Checkout ukui-sidebar source code
uses: actions/checkout@v2
- name: Install curl and patch
run: dnf install --refresh -y curl patch
- name: Install build dependencies
run: dnf install -y which gcc gcc-c++ make cmake cmake-rpm-macros autoconf automake intltool rpm-build qt5-rpm-macros qt5-qtbase-devel qt5-qttools-devel glib2-devel qt5-qtbase-devel qt5-qtsvg-devel dconf-devel gsettings-qt-devel qt5-qtmultimedia-devel kf5-kwindowsystem-devel libXtst-devel qt5-qtx11extras-devel pkgconf-pkg-config libXrandr-devel libXinerama-devel libXcursor-devel gstreamer1-plugins-good-qt
- name: QMake configure & Make
run: |
mkdir build;
cd build;
qmake-qt5 ..;
make -j$(nproc);
ubuntu:
name: on Ubuntu 20.04
runs-on: ubuntu-20.04
container: docker.io/library/ubuntu:focal
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Checkout ukui-sidebar source code
uses: actions/checkout@v2
- name: Update apt repository
run: apt-get update -y
- name: Install build dependcies
run: apt-get install -y build-essential qt5-default qttools5-dev-tools qtmultimedia5-dev libglib2.0-dev qtbase5-dev libqt5svg5-dev qttools5-dev-tools libgsettings-qt-dev libdconf-dev libkf5windowsystem-dev libburner-media3-1 gstreamer1.0-plugins-good gstreamer1.0-pulseaudio libqt5x11extras5-dev pkg-config libxrandr-dev libxinerama-dev libxcursor-dev libxtst-dev libburner-media3-1
- name: QMake configure & Make
run: |
mkdir build;
cd build;
qmake ..;
make -j$(nproc);

7
AUTHORS Normal file
View File

@ -0,0 +1,7 @@
ukui-sidebar authors
------------------
chenchunan <chenchunan@kylinos.cn>
liushanwen <liushanwen@Kylinos.cn>

674
COPYING Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://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>.

48
README.md Normal file
View File

@ -0,0 +1,48 @@
# ukui-sidebar
![build](https://github.com/ukui/ukui-sidebar/workflows/Check%20build/badge.svg?branch=master)
The sidebar mainly consists of two parts: notification center and cutting board. It starts from the start-up and is placed in the tray bar in the form of a tray. After clicking, it can pop up dynamically from the right side of the screen.
+ The notification center can display the pop-up messages sent by each application to mate notification teamon in a list form. Unimportant information can be stored in the storage box for viewing. At the same time, it can call the control panel directly.
+ The main function of the clipboard is to save the latest cutting information, and display it under the sidebar in the form of a list. At the same time, it can also put the previous cutting information at the top, so that it can be pasted directly. In addition, it can record the cut text information as well as the URL.
The ukui-sidebar is a shortcut tool on the right side of the screen for UKUI.
# How to test notification-center
`notify-send -a wechat -i "/home/ccn/heart.png" Summary Body`
# How to report bugs
Bugs should be reported to the UKUI bug tracking system:
https://github.com/ukui/ukui-sidebar/issues
You will need to create an account for yourself.
Please read the HACKING file for information on where to send changes or
bugfixes for this package.
# How to build
## Preparation
You can build pre-depends with such command:
`sudo apt install libglib2.0-dev qtbase5-dev libqt5svg5-dev qttools5-dev-tools`
Note: build-depends references the paragraph in debian/control.
## Build from source and test
> git clone https://github.com/ukui/ukui-sidebar
> cd ukui-sidebar && mkdir build && cd build
> qmake .. && make
> sudo make install
Note: If you want to run ukui-sidebar, you need to make some changes in the code after build.
+ Find `libnotification_plugin.so` in your build path like `/home/XX/ukui-sidebar/build/src/plugins/notification_plugins`. Then set this path as pluginDir in file widget.cpp fuction `bool Widget::loadNotificationPlugin()`.
+ Find `libclipboardPlugin.so` in your build path like `/home/XX/ukui-sidebar/build/src/plugins/sidebar_pushbutton_plugins`. Then set this path as pluginDir in file pluginmanage.cpp fuction `PluginManager::PluginManager(QObject *parent) : QObject(parent)`.

22
man/ukui-sidebar.1 Normal file
View File

@ -0,0 +1,22 @@
.\" Man Page for ukui-sidebar
.TH UKUI-SIDEBAR 1 "2020-02-03" "UKUI Desktop Environment"
.\" Please adjust this date when revising the manpage.
.\"
.SH "NAME"
\fBukui-sidebar\fR \- SOME UKUI SHORTCUT OPERATION
.SH "SYNOPSIS"
.B ukui-sidebar [OPTIONS]
.SH "DESCRIPTION"
some shortcut operation in the right of screen for UKUI.
.SH "OPTIONS"
.TP
\fB\-v, \-\-version\fR
Output version information and exit.
.SH "BUGS"
.SS Should you encounter any bugs, they may be reported at:
http://github.com/ukui-desktop/ukui-sidebar/issues
.SH "AUTHORS"
.SS This Manual Page has been written for the UKUI Desktop Environment by:
Adam Erdman <hekel@archlinux.info> (2014)
.SH "SEE ALSO"
.SS Further information may also be available at: http://wiki.ukui-desktop.org/docs

257
src/customstyle.cpp Normal file
View File

@ -0,0 +1,257 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "customstyle.h"
#include <QStyle>
#include <QProxyStyle>
#include <QStyleFactory>
#include <QWidget>
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include <QVariant>
#include <QStyleOptionSlider>
#include <QPainter>
#include <QDebug>
CustomStyle::CustomStyle(const QString &proxyStyleName, QObject *parent) : QProxyStyle (proxyStyleName)
{
}
void CustomStyle::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
switch (control) {
case CC_ToolButton:
{
if (const QStyleOptionToolButton *toolbutton
= qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
QRect button, menuarea,rect;
button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget);
menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
rect = proxy()->subControlRect(CC_ToolButton,toolbutton,SC_None,widget);
State bflags = toolbutton->state & ~State_Sunken;
if (bflags & State_AutoRaise) {
if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) {
bflags &= ~State_Raised;
}
}
State mflags = bflags;
if (toolbutton->state & State_Sunken) {
if (toolbutton->activeSubControls & SC_ToolButton)
bflags |= State_Sunken;
mflags |= State_Sunken;
}
QStyleOption tool = *toolbutton;
tool.state = bflags;
if(mflags & (State_Sunken | State_MouseOver))
{
tool.state = mflags;
}
tool.rect = rect;
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
if (toolbutton->state & State_HasFocus) {
QStyleOptionFocusRect fr;
fr.QStyleOption::operator=(*toolbutton);
fr.rect.adjust(3, 3, -3, -3);
if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
toolbutton, widget), 0);
proxy()->drawPrimitive(PE_FrameFocusRect, &fr, painter, widget);
}
QStyleOptionToolButton label = *toolbutton;
label.state = bflags;
label.rect = button;
proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget);
if (toolbutton->subControls & SC_ToolButtonMenu) {
tool.rect = menuarea;
tool.state = mflags;
proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
}
}
break;
}
default:break;
}
return QProxyStyle::drawComplexControl(control, option, painter, widget);
}
void CustomStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case QStyle::CE_PushButton: {
QStyleOptionButton button = *qstyleoption_cast<const QStyleOptionButton *>(option);
button.palette.setColor(QPalette::HighlightedText, button.palette.buttonText().color());
return QProxyStyle::drawControl(element, option, painter, widget);
break;
}
case CE_ToolButtonLabel:{
QStyleOptionToolButton toolButton = *qstyleoption_cast<const QStyleOptionToolButton *>(option);
toolButton.palette.setColor(QPalette::HighlightedText, toolButton.palette.windowText().color());
return QProxyStyle::drawControl(element, &toolButton, painter, widget);
break;
}
default:
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
//UKUI ToolBar item style
void CustomStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
}
void CustomStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
{
return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
}
void CustomStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element)
{
case PE_PanelButtonTool:
{
if(!(option->state & State_Enabled)) {
painter->save();
painter->setPen(Qt::NoPen);
painter->setBrush(option->palette.color(QPalette::Disabled,QPalette::Button));
painter->setRenderHint(QPainter::Antialiasing,true);
painter->drawRoundedRect(option->rect,4,4);
painter->restore();
return;
}
painter->save();
painter->setPen(Qt::NoPen);
painter->setBrush(option->palette.color(QPalette::WindowText));
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setOpacity(0.04);
if (option->state & (State_Sunken | State_On)) {
painter->setOpacity(0.08);
}
else if(option->state & State_MouseOver) {
painter->setOpacity(0.12);
}
painter->drawRoundedRect(option->rect,4,4);
painter->restore();
return;
}
default:
break;
}
return QProxyStyle::drawPrimitive(element, option, painter, widget);
}
QPixmap CustomStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
{
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
}
QStyle::SubControl CustomStyle::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
{
return QProxyStyle::hitTestComplexControl(control, option, position, widget);
}
QRect CustomStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
}
QRect CustomStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
{
return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
}
int CustomStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::pixelMetric(metric, option, widget);
}
void CustomStyle::polish(QWidget *widget)
{
return QProxyStyle::polish(widget);
}
void CustomStyle::polish(QApplication *application)
{
return QProxyStyle::polish(application);
}
void CustomStyle::polish(QPalette &palette)
{
return QProxyStyle::polish(palette);
}
void CustomStyle::unpolish(QWidget *widget)
{
return QProxyStyle::unpolish(widget);
}
void CustomStyle::unpolish(QApplication *application)
{
return QProxyStyle::unpolish(application);
}
QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
{
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
}
QIcon CustomStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
QPalette CustomStyle::standardPalette() const
{
return QProxyStyle::standardPalette();
}
int CustomStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
QRect CustomStyle::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
{
return QProxyStyle::subControlRect(control, option, subControl, widget);
}
QRect CustomStyle::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::subElementRect(element, option, widget);
}

150
src/customstyle.h Normal file
View File

@ -0,0 +1,150 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CUSTOMSTYLE_H
#define CUSTOMSTYLE_H
#include <QProxyStyle>
// * \brief The CustomStyle class
// * \details
// * 自定义QStyle
// * 基于QProxyStyle默认使用QProxyStyle的实例绘制控件你需要针对某一个控件重新实现若干对应的接口。
// * QProxyStyle可以从现有的qt style实例化我们只需要知道这个style的名字即可。
// * 这种做法带来了不错的扩展性和自由度因为我们不需要将某个style的代码直接引入我们的项目中
// * 也能够“继承”这个style类进行二次开发。
// *
// * 下面的方法展现了QStyle的所有的接口使用QStyle进行控件的绘制使得qt应用能够进行风格的切换
// * 从而达到不修改项目源码却对应用外观产生巨大影响的效果。
// *
// * \note
// * 需要注意QStyle与QSS并不兼容因为QSS本身其实上也是QStyle的一种实现对一个控件而言本身理论上只能
// * 在同一时间调用唯一一个QStyle进行绘制。
class CustomStyle : public QProxyStyle
{
Q_OBJECT
public:
explicit CustomStyle(const QString &proxyStyleName = "windows", QObject *parent = nullptr);
// * \brief drawComplexControl
// * \param control 比如ScrollBar对应CC枚举类型
// * \param option
// * \param painter
// * \param widget
// * \details
// * drawComplexControl用于绘制具有子控件的复杂控件它本身一般不直接绘制控件
// * 而是通过QStyle的其它方法将复杂控件分解成子控件再调用其它的draw方法绘制。
// * 如果你需要重新实现一个复杂控件的绘制方法,首先考虑的应该是在不改变它原有的绘制流程的情况下,
// * 对它调用到的其它方法进行重写。
// *
// * 如果你不想使用原有的绘制流程,那你需要重写这个接口,然后自己实现一切,
// * 包括背景的绘制,子控件的位置和状态计算,子控件的绘制等。
// * 所以,你需要对这个控件有足够的了解之后再尝试直接重写这个接口。
virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const;
// * \brief drawControl
// * \param element 比如按钮对应CE枚举类型
// * \param option
// * \param painter
// * \param widget
// * \details
// * drawControl用于绘制基本控件元素它本身一般只负责绘制控件的一部分或者一层。
// * 如果你想要知道控件具体如何绘制你需要同时研究这个控件的源码和QStyle中的源码
// * 因为它们都有可能改变控件的绘制流程。
// *
// * QStyle一般会遵循QCommonStyle的绘制流程QCommenStyle是大部分主流style的最基类
// * 它本身不能完全称之为一个主题,如果你直接使用它,你的控件将不能被正常绘制,因为它有可能只是
// * 在特定的时候执行了特定却未实现的绘制方法,它更像一个框架或者规范。
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
// * \brief drawPrimitive
// * \param element 背景绘制对应PE枚举类型
// * \param option
// * \param painter
// * \param widget
// * \details
// * drawPrimitive用于绘制控件背景比如按钮和菜单的背景
// * 我们一般需要判断控件的状态来绘制不同的背景,
// * 比如按钮的hover和点击效果。
virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const;
virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const;
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const;
virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const;
// * \brief polish
// * \param widget
// * \details
// * polish用于对widget进行预处理一般我们可以在polish中修改其属性
// * 另外polish是对动画和特效实现而言十分重要的一个方法
// * 通过polish我们能够使widget和特效和动画形成对应关系。
virtual void polish(QWidget *widget);
virtual void polish(QApplication *application);
virtual void polish(QPalette &palette);
virtual void unpolish(QWidget *widget);
virtual void unpolish(QApplication *application);
virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const;
virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
virtual QPalette standardPalette() const;
// * \brief styleHint
// * \param hint 对应的枚举是SH
// * \param option
// * \param widget
// * \param returnData
// * \return
// * \details
// * styleHint比较特殊通过它我们能够改变一些控件的绘制流程或者方式比如说QMenu是否可以滚动。
virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const;
// * \brief subControlRect
// * \param control
// * \param option
// * \param subControl
// * \param widget
// * \return
// * \details
// * subControlRect返回子控件的位置和大小信息这个方法一般在内置流程中调用
// * 如果我们要重写某个绘制方法,可能需要用到它
virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const;
// * \brief subElementRect
// * \param element
// * \param option
// * \param widget
// * \return
// * \details
// * 与subControlRect类似
virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const;
};
#endif // CUSTOMSTYLE_H

View File

@ -0,0 +1,187 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "customstyleCleanPushbutton.h"
#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QDebug>
customstyle_clean_pushbutton::customstyle_clean_pushbutton(const QString &proxyStyleName, QObject *parent) : QProxyStyle (proxyStyleName)
{
Q_UNUSED(parent);
}
void customstyle_clean_pushbutton::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
return QProxyStyle::drawComplexControl(control, option, painter, widget);
}
void customstyle_clean_pushbutton::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case QStyle::CE_PushButton: {
QStyleOptionButton button = *qstyleoption_cast<const QStyleOptionButton *>(option);
button.palette.setColor(QPalette::HighlightedText, button.palette.buttonText().color());
return QProxyStyle::drawControl(element, &button, painter, widget);
break;
}
default:
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
void customstyle_clean_pushbutton::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
}
void customstyle_clean_pushbutton::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
{
return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
}
/// 我们重写button的绘制方法通过state和当前动画的状态以及value值改变相关的绘制条件
/// 这里通过判断hover与否动态的调整painter的透明度然后绘制背景
/// 需要注意的是,默认控件的绘制流程只会触发一次,而动画需要我们在一段时间内不停绘制才行,
/// 要使得动画能够持续我们需要使用QWidget::update()在动画未完成时,
/// 手动更新一次这样button将在一段时间后再次调用draw方法从而达到更新动画的效果
///
/// 需要注意绘制背景的流程会因主题不同而产生差异,所以这一部分代码在一些主题中未必正常,
/// 如果你需要自己实现一个主题,这同样是你需要注意和考虑的点
void customstyle_clean_pushbutton::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
if (element == PE_PanelButtonCommand) {
if (widget) {
if (option->state & State_MouseOver) {
if (option->state & State_Sunken) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,21);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,0);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,0);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
return;
}
}
return QProxyStyle::drawPrimitive(element, option, painter, widget);
}
QPixmap customstyle_clean_pushbutton::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
{
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
}
QStyle::SubControl customstyle_clean_pushbutton::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
{
return QProxyStyle::hitTestComplexControl(control, option, position, widget);
}
QRect customstyle_clean_pushbutton::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
}
QRect customstyle_clean_pushbutton::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
{
return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
}
int customstyle_clean_pushbutton::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::pixelMetric(metric, option, widget);
}
/// 我们需要将动画与widget一一对应起来
/// 在一个style的生命周期里widget只会进行polish和unpolish各一次
/// 所以我们可以在polish时将widget与一个新的动画绑定并且对应的在unpolish中解绑定
void customstyle_clean_pushbutton::polish(QWidget *widget)
{
return QProxyStyle::polish(widget);
}
void customstyle_clean_pushbutton::polish(QApplication *application)
{
return QProxyStyle::polish(application);
}
void customstyle_clean_pushbutton::polish(QPalette &palette)
{
return QProxyStyle::polish(palette);
}
void customstyle_clean_pushbutton::unpolish(QWidget *widget)
{
return QProxyStyle::unpolish(widget);
}
void customstyle_clean_pushbutton::unpolish(QApplication *application)
{
return QProxyStyle::unpolish(application);
}
QSize customstyle_clean_pushbutton::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
{
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
}
QIcon customstyle_clean_pushbutton::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
QPalette customstyle_clean_pushbutton::standardPalette() const
{
return QProxyStyle::standardPalette();
}
int customstyle_clean_pushbutton::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
QRect customstyle_clean_pushbutton::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
{
return QProxyStyle::subControlRect(control, option, subControl, widget);
}
QRect customstyle_clean_pushbutton::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::subElementRect(element, option, widget);
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CUSTOMSTYLE_CLEAN_PUSHBUTTON_H
#define CUSTOMSTYLE_CLEAN_PUSHBUTTON_H
#include <QProxyStyle>
class customstyle_clean_pushbutton : public QProxyStyle
{
Q_OBJECT
public:
explicit customstyle_clean_pushbutton(const QString &proxyStyleName = "windows", QObject *parent = nullptr);
virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
/*!
* \brief drawPrimitive
* \param element PE枚举类型
* \param option
* \param painter
* \param widget
* \details
* drawPrimitive用于绘制控件背景
*
* hover和点击效果
*/
virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const;
virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const;
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const;
//virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget);
virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const;
virtual void polish(QWidget *widget);
virtual void polish(QApplication *application);
virtual void polish(QPalette &palette);
virtual void unpolish(QWidget *widget);
virtual void unpolish(QApplication *application);
virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const;
virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
virtual QPalette standardPalette() const;
virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const;
virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const;
virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const;
signals:
public slots:
private:
};
#endif // CUSTOMSTYLE_CLEAN_PUSHBUTTON_H

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="设置" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">
<style type="text/css">
.st0{fill:#808080;}
</style>
<g id="_16">
<g id="_16-2">
<g>
<path class="st0" d="M7,5c1.1,0,2,0.9,2,2S8.1,9,7,9S5,8.1,5,7S5.9,5,7,5 M7,4C5.3,4,4,5.3,4,7s1.3,3,3,3s3-1.3,3-3S8.7,4,7,4
L7,4z"/>
</g>
<g>
<path class="st0" d="M9,1.2l0.9,0.3v1.8v1h1l1.9,0.1L13,5.1l-1.5,1.4l-0.8,0.8L11.5,8l1.3,1.1l-0.3,0.7h-1.8h-1v1v1.8l-0.6,0.2
l-1.5-1.4l-0.7-0.7l-0.7,0.7l-1.3,1.3l-0.4-0.1v-1.9v-1h-1l-2-0.1L1.2,9.1l1.3-1.5l0.7-0.7L2.5,6.3L1.2,5l0.3-0.8l1.8,0.3
l1.2,0.2V3.5l-0.1-2l0.5-0.3l1.3,1.3l0.7,0.7l0.7-0.7L9,1.2 M8.8,0L6.9,1.9L5.1,0L3.4,0.9l0.1,2.6L0.9,3.1L0,5.3L1.8,7L0,9
l0.9,1.7l2.6,0.1v2.6L5.2,14l1.7-1.8l2,1.8l1.8-0.7v-2.5h2.5l0.8-2l-1.9-1.6L14,5.4l-0.5-2l-2.6-0.1V0.8L8.8,0L8.8,0z"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="&#x56FE;&#x5C42;_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" viewBox="0 0 256 256" style="enable-background:new 0 0 256 256;" xml:space="preserve">
<title>画板 18</title>
<g id="&#x63A7;&#x5236;&#x9762;&#x677F;">
<g id="&#x65F6;&#x95F4;">
<g id="_256">
<g id="&#x65F6;&#x949F;">
<path style="opacity:0.08;enable-background:new ;" d="M130,254C61.517,254,6,198.483,6,130S61.517,6,130,6
s124,55.517,124,124C253.923,198.451,198.451,253.923,130,254z"/>
<path style="opacity:0.1;enable-background:new ;" d="M130,252C62.621,252,8,197.379,8,130S62.621,8,130,8
s122,54.621,122,122C251.923,197.347,197.347,251.923,130,252z"/>
<path style="opacity:0.2;enable-background:new ;" d="M128,250C60.621,250,6,195.379,6,128S60.621,6,128,6
s122,54.621,122,122C249.923,195.347,195.347,249.923,128,250z"/>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="128" y1="90" x2="128" y2="-150" gradientTransform="matrix(1 0 0 1 0 158)">
<stop offset="0" style="stop-color:#CFD8DC"/>
<stop offset="1" style="stop-color:#FFFFFF"/>
</linearGradient>
<circle style="fill:url(#SVGID_1_);" cx="128" cy="128" r="120"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="128" y1="-150" x2="128" y2="90" gradientTransform="matrix(1 0 0 1 0 158)">
<stop offset="0" style="stop-color:#4DD0E1"/>
<stop offset="1" style="stop-color:#0097A7"/>
</linearGradient>
<path style="fill:url(#SVGID_2_);" d="M128,18c60.751,0.002,109.998,49.252,109.997,110.003
c-0.001,29.172-11.589,57.148-32.217,77.777c-43.245,42.669-112.891,42.202-155.56-1.043
C7.955,161.902,7.955,93.055,50.22,50.22C70.803,29.523,98.811,17.921,128,18 M128,8C61.726,8,8,61.726,8,128
s53.726,120,120,120s120-53.726,120-120S194.274,8,128,8z"/>
<circle style="fill:#4D5D6A;" cx="128" cy="128" r="10.53"/>
<line style="fill:none;stroke:#4D5D6A;stroke-width:8;stroke-miterlimit:10;" x1="142.32" y1="115.58" x2="84.32" y2="165.89"/>
<line style="fill:none;stroke:#4D5D6A;stroke-width:6;stroke-miterlimit:10;" x1="137.07" y1="143.8" x2="98.7" y2="47.57"/>
<line style="fill:none;stroke:#E67A70;stroke-width:3;stroke-miterlimit:10;" x1="117.47" y1="116.93" x2="182.21" y2="183.26"/>
<path style="fill:#455A64;" d="M128,133.66c-3.126,0-5.66-2.534-5.66-5.66l0,0c0.131-3.123,2.77-5.548,5.893-5.417
c2.939,0.124,5.293,2.478,5.417,5.417C133.65,131.122,131.122,133.654,128,133.66z"/>
<path style="fill:#E67A70;" d="M128,123.84c2.212,0.195,3.965,1.948,4.16,4.16c-0.113,2.295-2.064,4.064-4.359,3.951
c-2.137-0.105-3.846-1.814-3.951-3.951c0.195-2.212,1.948-3.965,4.16-4.16 M128.01,120.84c-3.871,0.195-6.965,3.289-7.16,7.16
c0.148,3.952,3.471,7.035,7.423,6.887c3.744-0.14,6.747-3.143,6.887-6.887c-0.191-3.873-3.287-6.969-7.16-7.16H128.01z"/>
<circle style="fill:#455A64;" cx="128" cy="35.65" r="8.05"/>
<circle style="fill:#455A64;" cx="128" cy="221.4" r="8.05"/>
<circle style="fill:#455A64;" cx="35.13" cy="128.53" r="8.05"/>
<circle style="fill:#455A64;" cx="220.87" cy="128.53" r="8.05"/>
<path style="fill:#4D5D6A;" d="M171.65,210l5.58-3.22l-9.79-17c-1.81,1.16-3.65,2.25-5.56,3.24L171.65,210z"/>
<path style="fill:#4D5D6A;" d="M84.35,45.95l-5.58,3.22l9.79,17c1.81-1.16,3.65-2.25,5.56-3.25L84.35,45.95z"/>
<path style="fill:#4D5D6A;" d="M49.18,78.76L46,84.34l16.93,9.78c1-1.91,2.09-3.76,3.24-5.56L49.18,78.76z"/>
<path style="fill:#4D5D6A;" d="M206.82,177.22l3.22-5.58l-16.93-9.78c-1,1.91-2.09,3.76-3.24,5.56L206.82,177.22z"/>
<path style="fill:#4D5D6A;" d="M46,171.64l3.22,5.58l17-9.79c-1.16-1.81-2.25-3.66-3.24-5.57L46,171.64z"/>
<path style="fill:#4D5D6A;" d="M210,84.34l-3.22-5.58l-17,9.79c1.16,1.81,2.25,3.66,3.24,5.57L210,84.34z"/>
<path style="fill:#4D5D6A;" d="M177.23,49.17l-5.58-3.22l-9.77,16.93c1.91,1,3.76,2.09,5.56,3.25L177.23,49.17z"/>
<path style="fill:#4D5D6A;" d="M78.77,206.81l5.58,3.19l9.78-16.93c-1.91-1-3.76-2.09-5.56-3.24L78.77,206.81z"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.2;fill:#5B2D0E;enable-background:new ;}
.st1{fill:url(#SVGID_1_);}
.st2{opacity:0.6;fill:url(#SVGID_2_);enable-background:new ;}
.st3{opacity:0.4;}
.st4{opacity:0.5;fill:#595959;enable-background:new ;}
.st5{opacity:0.7;fill:#FFFFFF;enable-background:new ;}
.st6{opacity:0.9;fill:#1F1F28;enable-background:new ;}
.st7{fill:url(#SVGID_3_);}
.st8{fill:url(#SVGID_4_);}
.st9{fill:url(#SVGID_5_);}
</style>
<g>
<path class="st0" d="M111.2,5H16.8C10.3,5,5,10.3,5,16.8v94.4c0,6.5,5.3,11.8,11.8,11.8h94.4c6.5,0,11.8-5.3,11.8-11.8V16.8
C123,10.3,117.7,5,111.2,5z"/>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="63.9509" y1="8.1" x2="63.9509" y2="120" gradientTransform="matrix(1 0 0 -1 0 128)">
<stop offset="0" style="stop-color:#F5F5F5"/>
<stop offset="1" style="stop-color:#DCDCDC"/>
</linearGradient>
<path class="st1" d="M110.7,8H17.3C12.2,8,8,12.2,8,17.3v93.3c0,5.1,4.2,9.3,9.3,9.3h93.3c5.1,0,9.3-4.2,9.3-9.3V17.3
C120,12.2,115.8,8,110.7,8z"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="64.1" y1="120" x2="64.1" y2="8.9" gradientTransform="matrix(1 0 0 -1 0 128)">
<stop offset="0" style="stop-color:#FFFFFF"/>
<stop offset="1" style="stop-color:#FFFFFF;stop-opacity:0"/>
</linearGradient>
<path class="st2" d="M110.7,8H17.3C12.2,8,8,12.2,8,17.3v93.3c0,3.7,2.2,7,5.4,8.4c-0.5-1.2-0.7-2.4-0.7-3.8V22
c0-5.1,3.8-9.3,8.6-9.3h85.6c4.7,0,8.6,4.2,8.6,9.3v93.3c0,1.3-0.3,2.6-0.7,3.8c3.2-1.5,5.4-4.7,5.4-8.4V17.3
C120,12.2,115.8,8,110.7,8z"/>
<g class="st3">
<rect x="26" y="31" class="st4" width="80" height="5"/>
<rect x="26" y="54" class="st4" width="80" height="5"/>
<rect x="26" y="78" class="st4" width="80" height="5"/>
</g>
<g>
<path class="st5" d="M42.7,112.7c-0.2-0.5-0.3-0.9-0.3-1.2c0-0.3,0.2-0.7,0.5-1.3c0.3-0.6,0.8-1,1.4-1.2c0.6-0.2,0.8,0,0.7,0.8
s0,1.4,0.3,2c0.3,0.5,0.8,0.8,1.5,0.7c0.7-0.1,1.3-0.4,1.8-1.1s1-1.6,1.6-2.7s1.1-2.4,1.5-3.9s0.7-2.9,0.8-4.2
c0.1-1.3,0.2-2.5,0.1-3.6c-0.1-1.1-0.3-2-0.6-2.9s-1-1.5-2-1.9s-1.6-0.9-1.9-1.4c-0.3-0.5-0.3-1.1,0.1-1.9c1.1-0.6,2-0.6,2.7-0.2
s1.5,0.9,2.1,1.3c0.7,0.5,1.3,1,1.9,1.6c0.6,0.6,1.2,1,1.7,1.5c0.6,0.4,1,0.9,1.5,1.4c0.4,0.5,1,1,1.6,1.6
c0.6,0.5,1.2,1.1,1.8,1.7s0.9,0.5,1-0.4s0.3-2.1,0.8-3.6c0.4-1.5,0.8-2.8,1.1-3.8c0.3-1.1,0.8-2.2,1.3-3.3
c0.5-1.1,1.1-2.2,1.7-3.2s1.3-2,2.2-3c0.9-1,1.7-1.7,2.6-2.2c0.9-0.4,1.7-0.7,2.6-0.9c0.9-0.1,1.7-0.2,2.3-0.1
c0.7,0.1,1.3,0.3,1.8,0.6c0.6,0.3,1.2,1.1,1.9,2.4c0,0.7-0.1,1-0.5,1.2c-0.4,0.1-0.7-0.1-1.2-0.8c-0.4-0.7-1-1.1-1.7-1.3
c-0.7-0.2-1.3-0.3-1.9-0.3s-1.3,0.2-2.1,0.5c-0.8,0.3-1.5,0.7-2.1,1.3c-0.6,0.6-1.2,1.4-1.8,2.4c-0.6,1-1.2,2.1-1.9,3.5
c-0.7,1.4-1.3,2.8-1.8,4.5c-0.5,1.6-0.8,3.1-1,4.4s-0.3,2.5-0.4,3.6s0,2.2,0.3,3.3c0.3,1.1,0.4,2.2,0.5,3.2c0.1,1.1,0,2-0.3,2.7
c-0.9,0.3-1.5,0.3-1.7-0.1s-0.4-0.9-0.3-1.5c0-0.6-0.1-1.4-0.3-2.2c-0.2-0.8-0.5-1.7-0.9-2.5s-0.9-1.6-1.6-2.3
c-0.7-0.7-1.3-1.3-1.9-1.7c-0.5-0.4-1.1-0.8-1.5-1c-0.5-0.2-0.8-0.1-0.9,0.5c-0.1,0.6-0.3,1.4-0.5,2.5s-0.5,2.4-1,3.7
c-0.4,1.4-1.1,3-2,4.9s-1.8,3.4-2.8,4.4s-1.9,1.6-2.8,1.8c-0.9,0.2-1.6,0.1-2.1-0.3C44,114.5,43.4,113.8,42.7,112.7 M71.7,100.3
c0.4,0.2,0.9,0.3,1.2,0.1c0.4-0.2,0.7-0.5,0.9-0.9c0.2-0.4,0.5-0.8,0.8-1.2c0.3-0.4,0.7-0.9,0.9-1.4c0.3-0.5,0.3-1,0.1-1.4
c-0.2-0.4-0.6-0.7-1-0.8c-0.5-0.1-0.8-0.3-0.9-0.7c-0.1-0.4-0.1-0.8,0.1-1c0.2-0.3,0.7-0.6,1.3-1c0.8-0.2,1.4-0.1,1.8,0.4
c0.5,0.5,0.7,1,0.8,1.6c0.1,0.6,0.5,0.9,1.4,1c0.8,0.1,1.5-0.1,1.9-0.5s0.8-0.4,1.1,0c0.2,0.5,0.2,0.9,0.1,1
c-0.1,0.2-0.5,0.5-1,0.8c-0.5,0.4-1.3,0.5-2.2,0.5c-1,0-1.6,0.2-1.8,0.6c-0.2,0.4-0.5,1-1,1.7c-0.4,0.7-0.9,1.4-1.4,2
s-1.2,1.1-2,1.5c-0.9,0.1-1.6,0-2.2-0.3s-1-0.9-1.4-1.5c-0.2-0.5-0.1-1.1,0.2-2c0.3-0.8,0.6-1.5,1-2.2c0.3-0.6,0.7-1.2,1.2-1.6
s0.9-0.6,1.2-0.5c0.3,0.1,0.6,0.3,0.9,0.5c0.2,0.3,0.3,0.5,0.3,0.8s-0.2,0.5-0.4,0.7c-0.2,0.2-0.5,0.5-0.9,0.8s-0.8,0.8-1.1,1.5
S71.2,100.1,71.7,100.3 M81.6,94.7c-0.1-0.5-0.1-1.1-0.1-1.7s0.3-1.6,0.8-3s0.8-2.6,0.9-3.5c-0.7,0.5-1.1,0.8-1.4,0.9
c-0.2,0.1-0.5,0.1-0.7-0.2c-0.2-0.3-0.2-0.5-0.1-0.8c0.1-0.2,0.4-0.5,0.9-0.9s1-0.7,1.6-1.2c0.5-1.5,1-2.8,1.3-3.7
c0.4-0.9,0.7-2,1.1-3c0.4-1.1,0.8-2,1.3-2.9c0.4-0.8,0.9-1.4,1.4-1.6c0.5,0.2,0.5,1,0.1,2.2c-0.5,1.2-0.8,2.2-1,2.9
c-0.2,0.8-0.5,1.5-0.7,2.2s-0.5,1.5-0.7,2.5c0.7-0.5,1.8-1.2,3.2-2.2c1.4-1,2.9-1.9,4.4-2.9s3.1-1.9,4.6-2.9
c1.6-1,3.1-1.9,4.7-2.7c1.5-0.8,3.2-1.7,4.9-2.5c1.7-0.8,3.1-1.5,4.2-1.9s2.1-0.6,3-0.3c-0.5,0.5-1.1,0.9-1.7,1.1
s-1.2,0.5-1.8,0.7c-0.6,0.3-1.4,0.7-2.2,1.1c-0.8,0.5-1.9,1-3.1,1.7s-2.5,1.4-3.8,2.1c-1.4,0.7-2.7,1.5-4.1,2.4s-2.6,1.7-3.8,2.5
c-1.2,0.8-2.5,1.6-3.8,2.4s-2.3,1.4-2.8,1.8c-0.6,0.3-1,0.6-1.4,0.9c-0.4,0.2-0.6,0.5-0.8,0.7c-0.2,0.2-0.3,0.6-0.5,0.9
c-0.2,0.4-0.3,0.9-0.5,1.5s-0.4,1.4-0.6,2.4s-0.4,1.8-0.6,2.5s-0.3,1.3-0.2,1.8c0,0.5,0.2,0.9,0.5,1.1s0.7,0.3,1.1,0.2
c0.4-0.1,1.1-0.7,2-1.6c0.9-1,1.5-1.7,1.8-2.3c0.3-0.5,0.6-0.9,0.8-1.1c0.2-0.2,0.4-0.3,0.6-0.1c0.2,0.1,0.2,0.5-0.1,1.2
c-0.3,0.7-0.6,1.3-0.9,1.7c-0.3,0.4-0.6,0.9-1.1,1.4c-0.4,0.5-0.9,0.9-1.5,1.4c-0.4,0.3-0.8,0.5-1.1,0.7
c-0.2,0.1-0.5,0.2-0.7,0.3c-0.6,0.2-1.2,0.4-1.6,0.3c-0.4,0-0.8-0.2-1.1-0.5c-0.3-0.2-0.5-0.5-0.6-0.7c0,0,0,0,0-0.1
C81.7,95.6,81.6,95.2,81.6,94.7 M91.4,88.1c0.8-0.8,1.3-1.4,1.4-1.9c0.2-0.4,0.2-0.8,0-1s-0.4-0.1-0.8,0.4s-0.6,0.9-0.6,1.3
S91.4,87.7,91.4,88.1 M90.2,90.7c-0.4-0.8-0.6-1.5-0.7-2c0-0.5,0.1-1.2,0.3-1.9c0.2-0.7,0.5-1.4,0.7-1.9c0.3-0.6,0.6-1.1,1.1-1.4
l0.5-0.3c0.5-0.2,1-0.3,1.5-0.3c0.5,0.1,0.9,0.4,1.1,1.1c0.3,0.7,0.2,1.4-0.1,2.1c-0.3,0.8-0.8,1.4-1.4,2s-0.9,1-0.9,1.2
s0.2,0.3,0.6,0.4c0.4,0,1.1-0.2,2.1-0.6c1-0.5,1.8-1,2.4-1.5s1-0.9,1.3-1.3s0.5-0.7,0.7-0.9c0.2-0.2,0.4-0.2,0.7,0.1
c-0.1,0.8-0.3,1.5-0.7,2c-0.3,0.5-0.8,1.1-1.4,1.7s-1.4,1.2-2.5,1.8l-0.6,0.3c-1.2,0.5-2.1,0.7-2.6,0.7s-0.9-0.1-1.3-0.2
C90.9,91.5,90.5,91.2,90.2,90.7 M100.9,85.4c0.4,0.4,0.8,0.4,1.2,0.1c0.4-0.3,0.7-0.7,1-1.1c0.2-0.4,0.4-1,0.6-1.7
c0.1-0.7,0.1-1.1,0-1.2c-0.6,1.2-1.1,2-1.5,2.5C101.8,84.4,101.4,84.9,100.9,85.4 M98,85.6c-0.2-0.5-0.4-0.9-0.4-1.2
s0-0.6,0.2-0.8c0.2-0.2,0.4-0.4,0.7-0.5c0.3-0.1,0.8,0.3,1.5,1.2c0.6-0.5,1.1-0.9,1.4-1.4c0.4-0.5,0.7-1,1-1.4
c0.3-0.5,0.7-1,1.1-1.5c0.4-0.6,0.8-1.1,1.2-1.7c0.3-0.6,0.6-1.1,0.7-1.5s0.1-0.8,0.1-1.2c0-0.4,0.1-0.7,0.3-0.9
c0.4-0.2,0.7-0.2,0.9-0.2c0.2,0,0.5,0.3,0.8,0.8c0.1,0.2,0.2,0.5,0.2,0.7c0,0.3-0.1,0.6-0.2,1.1c-0.2,0.5-0.4,0.9-0.6,1.2
c-0.3,0.4-0.5,0.8-0.8,1.3s-0.5,1.1-0.7,1.7c-0.2,0.7-0.3,1.3-0.3,1.8s0,1,0,1.4s-0.2,0.9-0.5,1.3s-0.9,0.9-1.7,1.4
c-0.6,0.3-1.1,0.4-1.5,0.5c-0.4,0-0.9-0.2-1.7-0.6C98.9,86.7,98.4,86.2,98,85.6"/>
<path class="st6" d="M42.1,110.7c-0.2-0.5-0.3-0.9-0.3-1.2c0-0.3,0.2-0.7,0.5-1.3c0.3-0.6,0.8-1,1.4-1.2c0.6-0.2,0.8,0,0.7,0.8
s0,1.4,0.3,2c0.3,0.5,0.8,0.8,1.5,0.7c0.7-0.1,1.3-0.4,1.8-1.1s1-1.6,1.6-2.7s1.1-2.4,1.5-3.9s0.7-2.9,0.8-4.2
c0.1-1.3,0.2-2.5,0.1-3.6c-0.1-1.1-0.3-2-0.6-2.9s-1-1.5-2-1.9s-1.6-0.9-1.9-1.4c-0.3-0.5-0.3-1.1,0.1-1.9c1.1-0.6,2-0.6,2.7-0.2
s1.5,0.9,2.1,1.3c0.7,0.5,1.3,1,1.9,1.6c0.6,0.6,1.2,1,1.7,1.5c0.6,0.4,1,0.9,1.5,1.4c0.4,0.5,1,1,1.6,1.6
c0.6,0.5,1.2,1.1,1.8,1.7s0.9,0.5,1-0.4s0.3-2.1,0.8-3.6c0.4-1.5,0.8-2.8,1.1-3.8c0.3-1.1,0.8-2.2,1.3-3.3
c0.5-1.1,1.1-2.2,1.7-3.2s1.3-2,2.2-3c0.9-1,1.7-1.7,2.6-2.2c0.9-0.4,1.7-0.7,2.6-0.9c0.9-0.1,1.7-0.2,2.3-0.1
c0.7,0.1,1.3,0.3,1.8,0.6c0.6,0.3,1.2,1.1,1.9,2.4c0,0.7-0.1,1-0.5,1.2c-0.4,0.1-0.7-0.1-1.2-0.8c-0.4-0.7-1-1.1-1.7-1.3
c-0.7-0.2-1.3-0.3-1.9-0.3s-1.3,0.2-2.1,0.5c-0.8,0.3-1.5,0.7-2.1,1.3c-0.6,0.6-1.2,1.4-1.8,2.4c-0.6,1-1.2,2.1-1.9,3.5
c-0.7,1.4-1.3,2.8-1.8,4.5c-0.5,1.6-0.8,3.1-1,4.4c-0.2,1.3-0.3,2.5-0.4,3.6c-0.1,1.1,0,2.2,0.3,3.3c0.3,1.1,0.4,2.2,0.5,3.2
c0.1,1.1,0,2-0.3,2.7c-0.9,0.3-1.5,0.3-1.7-0.1s-0.4-0.9-0.3-1.5c0-0.6-0.1-1.4-0.3-2.2c-0.2-0.8-0.5-1.7-0.9-2.5
s-0.9-1.6-1.6-2.3c-0.7-0.7-1.3-1.3-1.9-1.7c-0.5-0.4-1.1-0.8-1.5-1c-0.5-0.2-0.8-0.1-0.9,0.5c-0.1,0.6-0.3,1.4-0.5,2.5
s-0.5,2.4-1,3.7c-0.4,1.4-1.1,3-2,4.9s-1.8,3.4-2.8,4.4s-1.9,1.6-2.8,1.8c-0.9,0.2-1.6,0.1-2.1-0.3
C43.4,112.5,42.8,111.7,42.1,110.7 M71.1,98.3c0.4,0.2,0.9,0.3,1.2,0.1c0.4-0.2,0.7-0.5,0.9-0.9c0.2-0.4,0.5-0.8,0.8-1.2
c0.3-0.4,0.7-0.9,0.9-1.4c0.3-0.5,0.3-1,0.1-1.4c-0.2-0.4-0.6-0.7-1-0.8c-0.5-0.1-0.8-0.3-0.9-0.7c-0.1-0.4-0.1-0.8,0.1-1
c0.2-0.3,0.7-0.6,1.3-1c0.8-0.2,1.4-0.1,1.8,0.4c0.5,0.5,0.7,1,0.8,1.6c0.1,0.6,0.5,0.9,1.4,1c0.8,0.1,1.5-0.1,1.9-0.5
s0.8-0.4,1.1,0c0.2,0.5,0.2,0.9,0.1,1c-0.1,0.2-0.5,0.5-1,0.8c-0.5,0.4-1.3,0.5-2.2,0.5c-1,0-1.6,0.2-1.8,0.6
c-0.2,0.4-0.5,1-1,1.7c-0.4,0.7-0.9,1.4-1.4,2s-1.2,1.1-2,1.5c-0.9,0.1-1.6,0-2.2-0.3s-1-0.9-1.4-1.5c-0.2-0.5-0.1-1.1,0.2-2
c0.3-0.8,0.6-1.5,1-2.2c0.3-0.6,0.7-1.2,1.2-1.6s0.9-0.6,1.2-0.5c0.3,0.1,0.6,0.3,0.9,0.5c0.2,0.3,0.3,0.5,0.3,0.8
s-0.2,0.5-0.4,0.7c-0.2,0.2-0.5,0.5-0.9,0.8s-0.8,0.8-1.1,1.5C70.6,97.6,70.6,98,71.1,98.3 M81,92.7c-0.1-0.5-0.1-1.1-0.1-1.7
s0.3-1.6,0.8-3s0.8-2.6,0.9-3.5c-0.7,0.5-1.1,0.8-1.4,0.9c-0.2,0.1-0.5,0.1-0.7-0.2c-0.2-0.3-0.2-0.5-0.1-0.8
c0.1-0.2,0.4-0.5,0.9-0.9s1-0.7,1.6-1.2c0.5-1.5,1-2.8,1.3-3.7c0.4-0.9,0.7-2,1.1-3c0.4-1.1,0.8-2,1.3-2.9
c0.4-0.8,0.9-1.4,1.4-1.6c0.5,0.2,0.5,1,0.1,2.2c-0.5,1.2-0.8,2.2-1,2.9c-0.2,0.8-0.5,1.5-0.7,2.2s-0.5,1.5-0.7,2.5
c0.7-0.5,1.8-1.2,3.2-2.2c1.4-1,2.9-1.9,4.4-2.9s3.1-1.9,4.6-2.9c1.6-1,3.1-1.9,4.7-2.7c1.5-0.8,3.2-1.7,4.9-2.5
c1.7-0.8,3.1-1.5,4.2-1.9s2.1-0.6,3-0.3c-0.5,0.5-1.1,0.9-1.7,1.1s-1.2,0.5-1.8,0.7c-0.6,0.3-1.4,0.7-2.2,1.1
c-0.8,0.5-1.9,1-3.1,1.7s-2.5,1.4-3.8,2.1c-1.4,0.7-2.7,1.5-4.1,2.4s-2.6,1.7-3.8,2.5c-1.2,0.8-2.5,1.6-3.8,2.4s-2.3,1.4-2.8,1.8
c-0.6,0.3-1,0.6-1.4,0.9c-0.4,0.2-0.6,0.5-0.8,0.7c-0.2,0.2-0.3,0.6-0.5,0.9c-0.2,0.4-0.3,0.9-0.5,1.5s-0.4,1.4-0.6,2.4
s-0.4,1.8-0.6,2.5S82.9,91.5,83,92c0,0.5,0.2,0.9,0.5,1.1s0.7,0.3,1.1,0.2c0.4-0.1,1.1-0.7,2-1.6c0.9-1,1.5-1.7,1.8-2.3
c0.3-0.5,0.6-0.9,0.8-1.1c0.2-0.2,0.4-0.3,0.6-0.1c0.2,0.1,0.2,0.5-0.1,1.2c-0.3,0.7-0.6,1.3-0.9,1.7c-0.3,0.4-0.6,0.9-1.1,1.4
c-0.4,0.5-0.9,0.9-1.5,1.4c-0.4,0.3-0.8,0.5-1.1,0.7c-0.2,0.1-0.5,0.2-0.7,0.3c-0.6,0.2-1.2,0.4-1.6,0.3c-0.4,0-0.8-0.2-1.1-0.5
c-0.3-0.2-0.5-0.5-0.6-0.7c0,0,0,0,0-0.1C81.2,93.6,81.1,93.2,81,92.7 M90.8,86c0.8-0.8,1.3-1.4,1.4-1.9c0.2-0.4,0.2-0.8,0-1
s-0.4-0.1-0.8,0.4s-0.6,0.9-0.6,1.3C90.9,85.2,90.8,85.6,90.8,86 M89.6,88.7c-0.4-0.8-0.6-1.5-0.7-2c0-0.5,0.1-1.2,0.3-1.9
c0.2-0.7,0.5-1.4,0.7-1.9c0.3-0.6,0.6-1.1,1.1-1.4l0.5-0.3c0.5-0.2,1-0.3,1.5-0.3c0.5,0.1,0.9,0.4,1.1,1.1
c0.3,0.7,0.2,1.4-0.1,2.1c-0.3,0.8-0.8,1.4-1.4,2s-0.9,1-0.9,1.2s0.2,0.3,0.6,0.4c0.4,0,1.1-0.2,2.1-0.6c1-0.5,1.8-1,2.4-1.5
s1-0.9,1.3-1.3s0.5-0.7,0.7-0.9c0.2-0.2,0.4-0.2,0.7,0.1c-0.1,0.8-0.3,1.5-0.7,2c-0.3,0.5-0.8,1.1-1.4,1.7S96,88.4,94.9,89
l-0.6,0.3c-1.2,0.5-2.1,0.7-2.6,0.7s-0.9-0.1-1.3-0.2C90.3,89.5,89.9,89.2,89.6,88.7 M100.3,83.3c0.4,0.4,0.8,0.4,1.2,0.1
c0.4-0.3,0.7-0.7,1-1.1c0.2-0.4,0.4-1,0.6-1.7c0.1-0.7,0.1-1.1,0-1.2c-0.6,1.2-1.1,2-1.5,2.5C101.2,82.4,100.8,82.9,100.3,83.3
M97.4,83.5C97.2,83,97,82.6,97,82.3c-0.1-0.3,0-0.6,0.2-0.8c0.2-0.2,0.4-0.4,0.7-0.5c0.3-0.1,0.8,0.3,1.5,1.2
c0.6-0.5,1.1-0.9,1.4-1.4c0.4-0.5,0.7-1,1-1.4c0.3-0.5,0.7-1,1.1-1.5c0.4-0.6,0.8-1.1,1.2-1.7c0.3-0.6,0.6-1.1,0.7-1.5
s0.1-0.8,0.1-1.2c0-0.4,0.1-0.7,0.3-0.9c0.4-0.2,0.7-0.2,0.9-0.2c0.2,0,0.5,0.3,0.8,0.8c0.1,0.2,0.2,0.5,0.2,0.7
c0,0.3-0.1,0.6-0.2,1.1c-0.2,0.5-0.4,0.9-0.6,1.2c-0.3,0.4-0.5,0.8-0.8,1.3s-0.5,1.1-0.7,1.7c-0.2,0.7-0.3,1.3-0.3,1.8s0,1,0,1.4
s-0.2,0.9-0.5,1.3s-0.9,0.9-1.7,1.4c-0.6,0.3-1.1,0.4-1.5,0.5s-0.9-0.2-1.7-0.6C98.4,84.7,97.8,84.1,97.4,83.5"/>
</g>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="27" y1="87" x2="27" y2="101" gradientTransform="matrix(1 0 0 -1 0 128)">
<stop offset="0" style="stop-color:#108EE9"/>
<stop offset="1" style="stop-color:#69BFFF"/>
</linearGradient>
<circle class="st7" cx="27" cy="34" r="7"/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="27" y1="40" x2="27" y2="54" gradientTransform="matrix(1 0 0 -1 0 128)">
<stop offset="0" style="stop-color:#FFA437"/>
<stop offset="1" style="stop-color:#FFB65F"/>
</linearGradient>
<circle class="st8" cx="27" cy="81" r="7"/>
<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="27" y1="64" x2="27" y2="78" gradientTransform="matrix(1 0 0 -1 0 128)">
<stop offset="0" style="stop-color:#F04134"/>
<stop offset="1" style="stop-color:#FF9377"/>
</linearGradient>
<circle class="st9" cx="27" cy="57" r="7"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1 @@
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#ff1a00;}</style></defs><title>通知中心-新消息</title><path class="cls-1" d="M14,6.45V11a1,1,0,0,1-1,1H2a1,1,0,0,1-1-1V4A1,1,0,0,1,2,3H9.55a4.23,4.23,0,0,1-.05-.5A4.23,4.23,0,0,1,9.55,2H2A2,2,0,0,0,0,4v7a2,2,0,0,0,2,2H3v2.5a.25.25,0,0,0,.4.2L6.67,13H13a2,2,0,0,0,2-2V6.2A3.67,3.67,0,0,1,14,6.45Z"/><circle class="cls-2" cx="13.5" cy="2.5" r="2.5"/></svg>

After

Width:  |  Height:  |  Size: 499 B

View File

@ -0,0 +1 @@
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:#fff;}</style></defs><title>通知中心-普通</title><path class="cls-1" d="M13,2H2A2,2,0,0,0,0,4v7a2,2,0,0,0,2,2H3v2.5a.25.25,0,0,0,.4.2L6.67,13H13a2,2,0,0,0,2-2V4A2,2,0,0,0,13,2Zm1,9a1,1,0,0,1-1,1H2a1,1,0,0,1-1-1V4A1,1,0,0,1,2,3H13a1,1,0,0,1,1,1Z"/></svg>

After

Width:  |  Height:  |  Size: 379 B

View File

@ -0,0 +1,39 @@
<schemalist gettext-domain="ukui-log4qt-ukui-sidebar">
<schema id="org.ukui.ukui-log4qt-ukui-sidebar" path="/org/ukui/ukui-log4qt-ukui-sidebar/">
<key type="s" name="log4j-handleqtmessages">
<default>"true"</default>
<summary>hook qt messages</summary>
<description>Control if hook qt messages</description>
</key>
<key type="s" name="log4j-rootlogger">
<default>"DEBUG,console,daily"</default>
<summary>config rootLogger's level and appenders</summary>
<description>config rootLogger's level and appenders:"level,appender"</description>
</key>
<key type="s" name="log4j-appender-daily-datepattern">
<default>".yyyy-MM-dd"</default>
<summary>daily log file pattern</summary>
<description>set daily log file pattern format:one day</description>
</key>
<key type="s" name="log4j-appender-daily-layout-conversionpattern">
<default>"%d{yyyy-MM-dd HH:mm:ss,zzz}(%-4r)[%t]|%-5p| - %m%n"</default>
<summary>set log message's format</summary>
<description>set log message's format</description>
</key>
<key type="i" name="delaytime">
<default>3600</default>
<summary>set check log files delay time</summary>
<description>set check log files delay time</description>
</key>
<key type="i" name="maxfilecount">
<default>7</default>
<summary>set log files count</summary>
<description>set log files count,unit s</description>
</key>
<key type="i" name="maxfilesize">
<default>512</default>
<summary>set log files total size</summary>
<description>set log files total size, unit M</description>
</key>
</schema>
</schemalist>

View File

@ -0,0 +1,10 @@
<schemalist gettext-domain="ukui-sidebar">
<schema id="org.ukui.sidebar" path="/org/ukui/sidebar/">
<key name="promptboxbool" type="b">
<default>false</default>
<summary>remind</summary>
<description>remind</description>
</key>
</schema>
</schemalist>

View File

@ -0,0 +1,41 @@
QPushButton#SidebarPluginButton:hover{
width:90px;
height:34px;
background:rgba(61,107,229,0);
border-radius:4px;
}
QPushButton#SidebarPluginButton:pressed {
background-color:rgba(255,255,255,0.08); /*改变背景色*/
opacity:0.08;
border: 0px solid rgba(255,0,0,1);
}
QPushButton#ClipboardButton:hover{
width:90px;
height:34px;
background:rgba(61,107,229,0);
border-radius:4px;
}
QPushButton#ClipboardButton:pressed{
width:90px;
height:34px;
background:rgba(61,107,229,0);
border-radius:4px;
}
QPushButton#BlueBackgroundButton{
width:90px;
height:34px;
background:rgba(61,107,229,1);
border-radius:4px;
}
QToolButton{
font-size:14px;
font-family:Noto Sans CJK SC;
font-weight:400;
color:rgba(255,255,255,1);
line-height:34px;
}

632
src/data/qss/psblack.css Normal file
View File

@ -0,0 +1,632 @@
QPalette{background:#444444;}*{outline:0px;color:#DCDCDC;}
QWidget[form="true"],QLabel[frameShape="1"]{
border:1px solid #242424;
border-radius:0px;
}
QWidget[form="bottom"]{
background:#484848;
}
QWidget[form="bottom"] .QFrame{
border:1px solid #DCDCDC;
}
QWidget[form="bottom"] QLabel,QWidget[form="title"] QLabel{
border-radius:0px;
color:#DCDCDC;
background:none;
border-style:none;
}
QWidget[form="title"],QWidget[nav="left"],QWidget[nav="top"] QAbstractButton{
border-style:none;
border-radius:0px;
padding:5px;
color:#DCDCDC;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
}
QWidget[nav="top"] QAbstractButton:hover,QWidget[nav="top"] QAbstractButton:pressed,QWidget[nav="top"] QAbstractButton:checked{
border-style:solid;
border-width:0px 0px 2px 0px;
padding:4px 4px 2px 4px;
border-color:#00BB9E;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
}
QWidget[nav="left"] QAbstractButton{
border-radius:0px;
color:#DCDCDC;
background:none;
border-style:none;
}
QWidget[nav="left"] QAbstractButton:hover{
color:#FFFFFF;
background-color:#00BB9E;
}
QWidget[nav="left"] QAbstractButton:checked,QWidget[nav="left"] QAbstractButton:pressed{
color:#DCDCDC;
border-style:solid;
border-width:0px 0px 0px 2px;
padding:4px 4px 4px 2px;
border-color:#00BB9E;
background-color:#444444;
}
QWidget[video="true"] QLabel{
color:#DCDCDC;
border:1px solid #242424;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
}
QWidget[video="true"] QLabel:focus{
border:1px solid #00BB9E;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
}
QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{
border:1px solid #242424;
border-radius:3px;
padding:2px;
background:none;
selection-background-color:#484848;
selection-color:#DCDCDC;
}
QLineEdit:focus,QTextEdit:focus,QPlainTextEdit:focus,QSpinBox:focus,QDoubleSpinBox:focus,QComboBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus,QLineEdit:hover,QTextEdit:hover,QPlainTextEdit:hover,QSpinBox:hover,QDoubleSpinBox:hover,QComboBox:hover,QDateEdit:hover,QTimeEdit:hover,QDateTimeEdit:hover{
border:1px solid #242424;
}
QLineEdit[echoMode="2"]{
lineedit-password-character:9679;
}
.QFrame{
border:1px solid #242424;
border-radius:3px;
}
.QGroupBox{
border:1px solid #242424;
border-radius:5px;
margin-top:3ex;
}
.QGroupBox::title{
subcontrol-origin:margin;
position:relative;
left:10px;
}
.QPushButton,.QToolButton{
border-style:none;
border:1px solid #242424;
color:#DCDCDC;
padding:5px;
min-height:15px;
border-radius:5px;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
}
.QPushButton:hover,.QToolButton:hover{
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
}
.QPushButton:pressed,.QToolButton:pressed{
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
}
.QToolButton::menu-indicator{
image:None;
}
QToolButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
border-radius:3px;
color:#DCDCDC;
padding:3px;
margin:0px;
background:none;
border-style:none;
}
QToolButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
color:#FFFFFF;
margin:1px 1px 2px 1px;
background-color:rgba(51,127,209,230);
}
QPushButton#btnMenu_Close:hover{
color:#FFFFFF;
margin:1px 1px 2px 1px;
background-color:rgba(238,0,0,128);
}
QRadioButton::indicator{
width:15px;
height:15px;
}
QRadioButton::indicator::unchecked{
image:url(:/qss/psblack/radiobutton_unchecked.png);
}
QRadioButton::indicator::unchecked:disabled{
image:url(:/qss/psblack/radiobutton_unchecked_disable.png);
}
QRadioButton::indicator::checked{
image:url(:/qss/psblack/radiobutton_checked.png);
}
QRadioButton::indicator::checked:disabled{
image:url(:/qss/psblack/radiobutton_checked_disable.png);
}
QGroupBox::indicator,QTreeWidget::indicator,QListWidget::indicator{
padding:0px -3px 0px 3px;
}
QCheckBox::indicator,QGroupBox::indicator,QTreeWidget::indicator,QListWidget::indicator{
width:13px;
height:13px;
}
QCheckBox::indicator:unchecked,QGroupBox::indicator:unchecked,QTreeWidget::indicator:unchecked,QListWidget::indicator:unchecked{
image:url(:/qss/psblack/checkbox_unchecked.png);
}
QCheckBox::indicator:unchecked:disabled,QGroupBox::indicator:unchecked:disabled,QTreeWidget::indicator:unchecked:disabled,QListWidget::indicator:disabled{
image:url(:/qss/psblack/checkbox_unchecked_disable.png);
}
QCheckBox::indicator:checked,QGroupBox::indicator:checked,QTreeWidget::indicator:checked,QListWidget::indicator:checked{
image:url(:/qss/psblack/checkbox_checked.png);
}
QCheckBox::indicator:checked:disabled,QGroupBox::indicator:checked:disabled,QTreeWidget::indicator:checked:disabled,QListWidget::indicator:checked:disabled{
image:url(:/qss/psblack/checkbox_checked_disable.png);
}
QCheckBox::indicator:indeterminate,QGroupBox::indicator:indeterminate,QTreeWidget::indicator:indeterminate,QListWidget::indicator:indeterminate{
image:url(:/qss/psblack/checkbox_parcial.png);
}
QCheckBox::indicator:indeterminate:disabled,QGroupBox::indicator:indeterminate:disabled,QTreeWidget::indicator:indeterminate:disabled,QListWidget::indicator:indeterminate:disabled{
image:url(:/qss/psblack/checkbox_parcial_disable.png);
}
QTimeEdit::up-button,QDateEdit::up-button,QDateTimeEdit::up-button,QDoubleSpinBox::up-button,QSpinBox::up-button{
image:url(:/qss/psblack/add_top.png);
width:10px;
height:10px;
padding:2px 5px 0px 0px;
}
QTimeEdit::down-button,QDateEdit::down-button,QDateTimeEdit::down-button,QDoubleSpinBox::down-button,QSpinBox::down-button{
image:url(:/qss/psblack/add_bottom.png);
width:10px;
height:10px;
padding:0px 5px 2px 0px;
}
QTimeEdit::up-button:pressed,QDateEdit::up-button:pressed,QDateTimeEdit::up-button:pressed,QDoubleSpinBox::up-button:pressed,QSpinBox::up-button:pressed{
top:-2px;
}
QTimeEdit::down-button:pressed,QDateEdit::down-button:pressed,QDateTimeEdit::down-button:pressed,QDoubleSpinBox::down-button:pressed,QSpinBox::down-button:pressed,QSpinBox::down-button:pressed{
bottom:-2px;
}
QComboBox::down-arrow,QDateEdit[calendarPopup="true"]::down-arrow,QTimeEdit[calendarPopup="true"]::down-arrow,QDateTimeEdit[calendarPopup="true"]::down-arrow{
image:url(:/qss/psblack/add_bottom.png);
width:10px;
height:10px;
right:2px;
}
QComboBox::drop-down,QDateEdit::drop-down,QTimeEdit::drop-down,QDateTimeEdit::drop-down{
subcontrol-origin:padding;
subcontrol-position:top right;
width:15px;
border-left-width:0px;
border-left-style:solid;
border-top-right-radius:3px;
border-bottom-right-radius:3px;
border-left-color:#242424;
}
QComboBox::drop-down:on{
top:1px;
}
QMenuBar::item{
color:#DCDCDC;
background-color:#484848;
margin:0px;
padding:3px 10px;
}
QMenu,QMenuBar,QMenu:disabled,QMenuBar:disabled{
color:#DCDCDC;
background-color:#484848;
border:1px solid #242424;
margin:0px;
}
QMenu::item{
padding:3px 20px;
}
QMenu::indicator{
width:13px;
height:13px;
}
QMenu::item:selected,QMenuBar::item:selected{
color:#DCDCDC;
border:0px solid #242424;
background:#646464;
}
QMenu::separator{
height:1px;
background:#242424;
}
QProgressBar{
min-height:10px;
background:#484848;
border-radius:5px;
text-align:center;
border:1px solid #484848;
}
QProgressBar:chunk{
border-radius:5px;
background-color:#242424;
}
QSlider::groove:horizontal{
background:#484848;
height:8px;
border-radius:4px;
}
QSlider::add-page:horizontal{
background:#484848;
height:8px;
border-radius:4px;
}
QSlider::sub-page:horizontal{
background:#242424;
height:8px;
border-radius:4px;
}
QSlider::handle:horizontal{
width:13px;
margin-top:-3px;
margin-bottom:-3px;
border-radius:6px;
background:qradialgradient(spread:pad,cx:0.5,cy:0.5,radius:0.5,fx:0.5,fy:0.5,stop:0.6 #444444,stop:0.8 #242424);
}
QSlider::groove:vertical{
width:8px;
border-radius:4px;
background:#484848;
}
QSlider::add-page:vertical{
width:8px;
border-radius:4px;
background:#484848;
}
QSlider::sub-page:vertical{
width:8px;
border-radius:4px;
background:#242424;
}
QSlider::handle:vertical{
height:14px;
margin-left:-3px;
margin-right:-3px;
border-radius:6px;
background:qradialgradient(spread:pad,cx:0.5,cy:0.5,radius:0.5,fx:0.5,fy:0.5,stop:0.6 #444444,stop:0.8 #242424);
}
QScrollBar:horizontal{
background:#484848;
padding:0px;
border-radius:6px;
max-height:12px;
}
QScrollBar::handle:horizontal{
background:#242424;
min-width:50px;
border-radius:6px;
}
QScrollBar::handle:horizontal:hover{
background:#00BB9E;
}
QScrollBar::handle:horizontal:pressed{
background:#00BB9E;
}
QScrollBar::add-page:horizontal{
background:none;
}
QScrollBar::sub-page:horizontal{
background:none;
}
QScrollBar::add-line:horizontal{
background:none;
}
QScrollBar::sub-line:horizontal{
background:none;
}
QScrollBar:vertical{
background:#484848;
padding:0px;
border-radius:6px;
max-width:12px;
}
QScrollBar::handle:vertical{
background:#242424;
min-height:50px;
border-radius:6px;
}
QScrollBar::handle:vertical:hover{
background:#00BB9E;
}
QScrollBar::handle:vertical:pressed{
background:#00BB9E;
}
QScrollBar::add-page:vertical{
background:none;
}
QScrollBar::sub-page:vertical{
background:none;
}
QScrollBar::add-line:vertical{
background:none;
}
QScrollBar::sub-line:vertical{
background:none;
}
QScrollArea{
border:0px;
}
QTreeView,QListView,QTableView,QTabWidget::pane{
border:1px solid #242424;
selection-background-color:#646464;
selection-color:#DCDCDC;
alternate-background-color:#525252;
gridline-color:#242424;
}
QTreeView::branch:closed:has-children{
margin:4px;
border-image:url(:/qss/psblack/branch_open.png);
}
QTreeView::branch:open:has-children{
margin:4px;
border-image:url(:/qss/psblack/branch_close.png);
}
QTreeView,QListView,QTableView,QSplitter::handle,QTreeView::branch{
background:#444444;
}
QTableView::item:selected,QListView::item:selected,QTreeView::item:selected{
color:#DCDCDC;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
}
QTableView::item:hover,QListView::item:hover,QTreeView::item:hover{
color:#DCDCDC;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
}
QTableView::item,QListView::item,QTreeView::item{
padding:1px;
margin:0px;
}
QHeaderView::section,QTableCornerButton:section{
padding:3px;
margin:0px;
color:#DCDCDC;
border:1px solid #242424;
border-left-width:0px;
border-right-width:1px;
border-top-width:0px;
border-bottom-width:1px;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
}
QTabBar::tab{
border:1px solid #242424;
color:#DCDCDC;
margin:0px;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
}
QTabBar::tab:selected,QTabBar::tab:hover{
border-style:solid;
border-color:#00BB9E;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
}
QTabBar::tab:top,QTabBar::tab:bottom{
padding:3px 8px 3px 8px;
}
QTabBar::tab:left,QTabBar::tab:right{
padding:8px 3px 8px 3px;
}
QTabBar::tab:top:selected,QTabBar::tab:top:hover{
border-width:2px 0px 0px 0px;
}
QTabBar::tab:right:selected,QTabBar::tab:right:hover{
border-width:0px 0px 0px 2px;
}
QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{
border-width:0px 0px 2px 0px;
}
QTabBar::tab:left:selected,QTabBar::tab:left:hover{
border-width:0px 2px 0px 0px;
}
QTabBar::tab:first:top:selected,QTabBar::tab:first:top:hover,QTabBar::tab:first:bottom:selected,QTabBar::tab:first:bottom:hover{
border-left-width:1px;
border-left-color:#242424;
}
QTabBar::tab:first:left:selected,QTabBar::tab:first:left:hover,QTabBar::tab:first:right:selected,QTabBar::tab:first:right:hover{
border-top-width:1px;
border-top-color:#242424;
}
QTabBar::tab:last:top:selected,QTabBar::tab:last:top:hover,QTabBar::tab:last:bottom:selected,QTabBar::tab:last:bottom:hover{
border-right-width:1px;
border-right-color:#242424;
}
QTabBar::tab:last:left:selected,QTabBar::tab:last:left:hover,QTabBar::tab:last:right:selected,QTabBar::tab:last:right:hover{
border-bottom-width:1px;
border-bottom-color:#242424;
}
QStatusBar::item{
border:0px solid #484848;
border-radius:3px;
}
QPrintPreviewDialog QToolButton{
border:0px solid #DCDCDC;
border-radius:0px;
margin:0px;
padding:3px;
background:none;
}
QToolBox::tab,QGroupBox#gboxDevicePanel,QGroupBox#gboxDeviceTitle,QFrame#gboxDevicePanel,QFrame#gboxDeviceTitle{
padding:3px;
border-radius:5px;
color:#DCDCDC;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
}
QColorDialog QPushButton,QFileDialog QPushButton{
min-width:80px;
}
QToolButton#qt_calendar_prevmonth{
icon-size:0px;
min-width:20px;
image:url(:/qss/psblack/calendar_prevmonth.png);
}
QToolButton#qt_calendar_nextmonth{
icon-size:0px;
min-width:20px;
image:url(:/qss/psblack/calendar_nextmonth.png);
}
QToolButton#qt_calendar_prevmonth,QToolButton#qt_calendar_nextmonth,QToolButton#qt_calendar_monthbutton,QToolButton#qt_calendar_yearbutton{
border:0px solid #DCDCDC;
border-radius:3px;
margin:3px 3px 3px 3px;
padding:3px;
background:none;
}
QToolButton#qt_calendar_prevmonth:hover,QToolButton#qt_calendar_nextmonth:hover,QToolButton#qt_calendar_monthbutton:hover,QToolButton#qt_calendar_yearbutton:hover,QToolButton#qt_calendar_prevmonth:pressed,QToolButton#qt_calendar_nextmonth:pressed,QToolButton#qt_calendar_monthbutton:pressed,QToolButton#qt_calendar_yearbutton:pressed{
border:1px solid #242424;
}
QCalendarWidget QSpinBox#qt_calendar_yearedit{
margin:2px;
}
QCalendarWidget QToolButton::menu-indicator{
image:None;
}
QCalendarWidget QTableView{
border-width:0px;
}
QCalendarWidget QWidget#qt_calendar_navigationbar{
border:1px solid #242424;
border-width:1px 1px 0px 1px;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
}
QComboBox QAbstractItemView::item{
min-height:20px;
min-width:10px;
}
QTableView[model="true"]::item{
padding:0px;
margin:0px;
}
QTableView QLineEdit,QTableView QComboBox,QTableView QSpinBox,QTableView QDoubleSpinBox,QTableView QDateEdit,QTableView QTimeEdit,QTableView QDateTimeEdit{
border-width:0px;
border-radius:0px;
}
QTableView QLineEdit:focus,QTableView QComboBox:focus,QTableView QSpinBox:focus,QTableView QDoubleSpinBox:focus,QTableView QDateEdit:focus,QTableView QTimeEdit:focus,QTableView QDateTimeEdit:focus{
border-width:0px;
border-radius:0px;
}
QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{
background:#444444;
}
*:disabled{
background:#444444;
border-color:#484848;
color:#242424;
}
/*TextColor:#DCDCDC*/
/*PanelColor:#444444*/
/*BorderColor:#242424*/
/*NormalColorStart:#484848*/
/*NormalColorEnd:#383838*/
/*DarkColorStart:#646464*/
/*DarkColorEnd:#525252*/
/*HighColor:#00BB9E*/

View File

@ -0,0 +1,22 @@
[Desktop Entry]
Name=ukui-sidebar
Name[zh_CN]=侧边栏
Comment=ukui-sidebar
Exec=ukui-sidebar
Terminal=false
Type=Application
#Categories=
Keywords=UKUI;
NoDisplay=true
OnlyShowIn=UKUI;
X-UKUI-Autostart-Phase=Application
X-UKUI-Bugzilla-Bugzilla=UKUI
X-UKUI-Bugzilla-Product=ukui-media
X-UKUI-Bugzilla-Component=ukui-sidebar
X-MATE-Autostart-Phase=Applications
X-KDE-autostart-after=panel
X-UKUI-Autostart-Notify=true
X-UKUI-Autostart-Delay=3
X-UKUI-AutoRestart=true

1
src/env.pri Normal file
View File

@ -0,0 +1 @@
PLUGIN_INSTALL_DIRS = $$[QT_INSTALL_LIBS]/ukui-sidebar

130
src/main.cpp Normal file
View File

@ -0,0 +1,130 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "widget.h"
#include "pluginmanage.h"
#include "sidebarAppLog.h"
#include <ukui-log4qt.h>
#include <stdio.h>
#include <sys/file.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <syslog.h>
#include <QGuiApplication>
#include <QMessageLogContext>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <X11/Xlib.h>
//#include <KWindowEffects>
#include "sidebarpluginswidgets.h"
#include "smallpluginsmanage.h"
#include "mostgrandwidget.h"
#include "qtsingleapplication.h"
int getScreenWidth() {
Display *disp = XOpenDisplay(NULL);
Screen *scrn = DefaultScreenOfDisplay(disp);
if (NULL == scrn) {
return 0;
}
int width = scrn->width;
if (NULL != disp) {
XCloseDisplay(disp);
}
return width;
}
int main(int argc, char *argv[])
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
initUkuiLog4qt("ukui-sidebar");
/* 如果系统中有实例在运行则退出 */
QString id = QString("ukui-sidebar-" + QLatin1String(getenv("DISPLAY")));
QtSingleApplication a(id, argc, argv);
if (a.isRunning()) {
a.sendMessage(QApplication::arguments().length() > 1 ? QApplication::arguments().at(1) : a.applicationFilePath());
qDebug() << QObject::tr("ukui-sidebar is already running!");
return EXIT_SUCCESS;
} else {
QCommandLineParser parser;
QCommandLineOption debugOption({"d", "debug"}, QObject::tr("Display debug information"));
QCommandLineOption sidebarState({"s", "state"}, QObject::tr("show or hide sidebar widget"));
QCommandLineOption showSidebar({"s", "show"}, QObject::tr("show sidebar widget"));
QCommandLineOption hideSidebar({"h", "hide"}, QObject::tr("hide sidebar widget"));
parser.addOptions({debugOption, sidebarState,showSidebar,hideSidebar});
parser.process(a);
if (parser.isSet(debugOption)) { /* 根据命令行设定日志等级 */
setLogLevel(QtDebugMsg);
setLogPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + LOG_FILE_NAME); /* 绑定打印日志文件路径 */
qInstallMessageHandler(customLogMessageHandler);
} else {
setLogLevel(QtWarningMsg);
}
QApplication::setQuitOnLastWindowClosed(false);
SmallPluginsManage::SmallPluginsManageInit(); /* 初始化侧边栏小插件管理容器 */
PluginManager::init(); /* 初始化插件管理器 */
mostGrandWidget::mostGrandWidgetInit(); /* 初始化最里层Widget空白界面 */
bool startOrNot = false;
Widget *w = new Widget;
w->setObjectName("SidebarWidget");
w->setAttribute(Qt::WA_TranslucentBackground);
mostGrandWidget::getInstance()->m_pmostGrandWidgetVLaout->addWidget(w);
mostGrandWidget::getInstance()->LaoutSidebarWidget();
mostGrandWidget::getInstance()->setMostGrandwidgetCoordinates(-500, 0);
mostGrandWidget::getInstance()->setProperty("useSystemStyleBlur", true);
mostGrandWidget::getInstance()->hide();
QTimer *startTimer = new QTimer;
startTimer->setSingleShot(true);
QObject::connect(w,&Widget::startRun,[=](QSystemTrayIcon::ActivationReason reason){
qDebug()<<"主动启动";
startTimer->stop();
w->startBackgroundFunction();
QTimer *startTimer = new QTimer;
startTimer->setSingleShot(true);
QObject::connect(startTimer,&QTimer::timeout,[=](){
w->iconActivated(reason); //设定延时,防止消息界面未完全显示就展示
});
startTimer->start(1);
});
QObject::connect(startTimer,&QTimer::timeout,[=](){
qDebug()<<"自发启动";
w->startBackgroundFunction();
w->oneShotBool=true;
});
startTimer->start(5000);
QObject::connect(&a, SIGNAL(messageReceived(const QString&)),w, SLOT(bootOptionsFilter(const QString&)));
return a.exec();
}
}

67
src/mostgrandwidget.cpp Normal file
View File

@ -0,0 +1,67 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "mostgrandwidget.h"
static mostGrandWidget* global_Most_Grand_Widgets_instance = nullptr;
mostGrandWidget::mostGrandWidget(QWidget *parent)
{
Q_UNUSED(parent)
this->setContentsMargins(0,0,0,0);
m_pmostGrandWidgetVLaout = new QVBoxLayout();
m_pmostGrandWidgetVLaout->setContentsMargins(0,0,0,0);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
}
mostGrandWidget::~mostGrandWidget()
{
}
void mostGrandWidget::mostGrandWidgetInit()
{
mostGrandWidget::getInstance();
return;
}
mostGrandWidget* mostGrandWidget::getInstance()
{
if (global_Most_Grand_Widgets_instance == nullptr)
global_Most_Grand_Widgets_instance = new mostGrandWidget();
return global_Most_Grand_Widgets_instance;
}
/* last Laout MostGrand Widget */
void mostGrandWidget::LaoutSidebarWidget()
{
this->setLayout(m_pmostGrandWidgetVLaout);
return;
}
void mostGrandWidget::setMostGrandwidgetSize(int w, int h)
{
this->setFixedSize(w,h);
return;
}
void mostGrandWidget::setMostGrandwidgetCoordinates(int x, int y)
{
this->move(x, y);
return;
}

41
src/mostgrandwidget.h Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef MOSTGRANDWIDGET_H
#define MOSTGRANDWIDGET_H
#include <QtWidgets>
#include <QWidget>
#include <QVBoxLayout>
#include <QObject>
class mostGrandWidget : public QWidget
{
Q_OBJECT
public:
mostGrandWidget(QWidget *parent = nullptr);
~mostGrandWidget();
static void mostGrandWidgetInit();
static mostGrandWidget* getInstance();
void LaoutSidebarWidget();
void setMostGrandwidgetSize(int w, int h);
void setMostGrandwidgetCoordinates(int x, int y);
QVBoxLayout *m_pmostGrandWidgetVLaout;
};
#endif // MOSTGRANDWIDGET_H

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CLIPBOARDPLUGINIFACE_H
#define CLIPBOARDPLUGINIFACE_H
#include <QObject>
#include <QListWidget>
#include <QGroupBox>
#include "plugin-iface.h"
#include "sidebarclipboardsignal.h"
class ClipboardInterface : public PluginInterface
{
public:
virtual ~ClipboardInterface() {}
virtual QListWidget* getClipbaordListWidget() = 0;
virtual SidebarClipBoardSignal* createClipSignal() = 0;
virtual QWidget* getClipbaordGroupBox() = 0;
};
#define ClipboardInterface_iid "org.ukui.sidebar-qt.plugin-iface.ClipboardInterface"
Q_DECLARE_INTERFACE(ClipboardInterface, ClipboardInterface_iid)
#endif // CLIPBOARDPLUGINIFACE_H

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef NOTIFICATION_INTERFACE_H
#define NOTIFICATION_INTERFACE_H
#include <QWidget>
//定义接口
class NotificationInterface
{
public:
virtual ~NotificationInterface() {}
//返回一个Widget设置到centerwidget中进行显示
virtual QWidget* centerWidget() = 0;
//当侧边栏展开时给通知中心一个通知
virtual void showNotification() = 0;
//当侧边栏隐藏时给通知中心一个通知
virtual void hideNotification() = 0;
//virtual void Notify(QString strAppName, QString strIconPath, QString strSummary, QString strTime, QString strBody) = 0;
};
//声明接口
#define NotificationInterface_iid "org.qt-project.Qt.QGenericPluginFactoryInterface"
Q_DECLARE_INTERFACE(NotificationInterface, NotificationInterface_iid)
#endif // NOTIFICATION_INTERFACE_H

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef PLUGINIFACE_H
#define PLUGINIFACE_H
#include <QString>
#include <QIcon>
class PluginInterface
{
public:
enum PluginType
{
PushBtton1 = 1,
PushBtton2,
PushBtton3,
SmallPlugin,
ClipBoard,
Other
};
virtual ~PluginInterface() {}
virtual PluginType pluginType() = 0;
virtual const QString name() = 0;
virtual const QString description() = 0;
virtual const QIcon icon() = 0;
virtual void setEnable(bool enable) = 0;
virtual bool isEnable() = 0;
};
//#define PluginInterface_iid "org.ukui.peony-qt.plugin-iface.PluginInterface"
//Q_DECLARE_INTERFACE(PluginInterface, PluginInterface_iid)
#endif // PLUGINIFACE_H

View File

@ -0,0 +1,8 @@
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/plugin-iface.h \
$$PWD/clipboardpluginiface.h \
$$PWD/notification_interface.h \
$$PWD/sidebarSmallPluginInterface.h

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef SIDEBARSMALLPLUGININTERFACE_H
#define SIDEBARSMALLPLUGININTERFACE_H
#include "plugin-iface.h"
class SidebarSmallPluginInterface :public PluginInterface
{
public:
virtual ~SidebarSmallPluginInterface() {}
virtual int PluginButtonLocation_X() = 0;
virtual int PluginButtonLocation_Y() = 0;
virtual QString PluginButtonName() = 0;
virtual int pluginsLoadingSequence() = 0;
virtual QString PluginIconName() = 0;
virtual int PluginIconSize_W() = 0;
virtual int PluginIconSize_H() = 0;
virtual void PluginsShowInterface() = 0;
};
#define SidebarSmallPluginInterface_iid "org.ukui.sidebar-qt.plugin-iface.SmallPluginInterface"
Q_DECLARE_INTERFACE(SidebarSmallPluginInterface, SidebarSmallPluginInterface_iid)
#endif // SIDEBARSMALLPLUGININTERFACE_H

View File

@ -0,0 +1,7 @@
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/sidebarclipboardsignal.h
SOURCES += \

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef SIDEBARCLIPBOARDSIGNAL_H
#define SIDEBARCLIPBOARDSIGNAL_H
#include <QObject>
class SidebarClipBoardSignal : public QObject
{
Q_OBJECT
public:
explicit SidebarClipBoardSignal() {}
signals:
void finishSignal();
void removeSignal();
void popSignal();
void ClipboardHideSignal();
void CLipBoardEditConfirmButtonSignal();
void ClipBoardWidgetEntryEditButtonSignal();
void ClipboardPreviewSignal(int width, int height, int x, int y, int taskHeight);
public slots:
};
#endif // SIDEBARCLIPBOARDSIGNAL_H

98
src/pluginmanage.cpp Normal file
View File

@ -0,0 +1,98 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "pluginmanage.h"
#include "clipboardpluginiface.h"
#include "widget.h"
#include "smallpluginsmanage.h"
#include <QDebug>
#include <QDir>
#include <QPluginLoader>
#include <QApplication>
static PluginManager *global_instance = nullptr;
PluginManager::PluginManager(QObject *parent) : QObject(parent)
{
QString plugins_path(PLUGIN_INSTALL_DIRS);
QDir pluginsDir(plugins_path + "/sidebarSmallPlugins");
pluginsDir.setFilter(QDir::Files);
qDebug()<<pluginsDir.entryList().count();
Q_FOREACH(QString strPluginName, pluginsDir.entryList(QDir::Files)) {
qDebug()<<strPluginName;
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(strPluginName));
qDebug() << pluginLoader.fileName();
qDebug() << pluginLoader.metaData();
qDebug() << pluginLoader.load();
qDebug() << pluginLoader.errorString();
QObject *pPlugin = pluginLoader.instance();
if (!pPlugin)
continue;
PluginInterface *pPluginInterface = dynamic_cast<PluginInterface*>(pPlugin);
if (!pPluginInterface)
continue;
qDebug()<<pPluginInterface->name();
m_PluginInterfaceHash.insert(pPluginInterface->name(), pPluginInterface);
switch (pPluginInterface->pluginType()) {
case PluginInterface::SmallPlugin: {
/* Plugins Num++, add Hash SmallPlugins pPluginInterface-->SmallPluginsInterface */
SidebarSmallPluginInterface *p_SmallPluginsInterface = dynamic_cast<SidebarSmallPluginInterface*>(pPluginInterface);
SmallPluginsManage::getInstance()->registerSmallplugin(pPluginInterface, p_SmallPluginsInterface);
break;
}
case PluginInterface::ClipBoard: {
break;
}
case PluginInterface::PushBtton3: {
break;
}
default:
break;
}
}
}
PluginManager::~PluginManager()
{
m_PluginInterfaceHash.clear();
}
PluginManager *PluginManager::getInstance()
{
if (!global_instance)
global_instance = new PluginManager;
return global_instance;
}
void PluginManager::setPluginEnableByName(const QString &name, bool enable)
{
m_PluginInterfaceHash.value(name)->setEnable(enable);
}
void PluginManager::close()
{
if (global_instance)
global_instance->deleteLater();
}
void PluginManager::init()
{
PluginManager::getInstance();
}

50
src/pluginmanage.h Normal file
View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef PLUGINMANAGE_H
#define PLUGINMANAGE_H
#include <QObject>
#include "plugin-iface.h"
#include "sidebarSmallPluginInterface.h"
class PluginManager : public QObject
{
Q_OBJECT
public:
static void init();
static PluginManager *getInstance();
void close();
QHash<QString, PluginInterface*> m_PluginInterfaceHash;
Q_SIGNALS:
void pluginStateChanged(const QString &pluginName, bool enable);
private:
explicit PluginManager(QObject *parent = nullptr);
~PluginManager();
public Q_SLOTS:
void setPluginEnableByName(const QString &pluginName, bool enable);
};
#endif // PLUGINMANAGE_H

View File

@ -0,0 +1,199 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "cleanpromptbox.h"
#include "customstyle.h"
#include "customstylePushbutton2.h"
#include <QDebug>
CleanPromptBox::CleanPromptBox()
{
this->setFixedSize(400, 218);
this->setObjectName("CleanPromptBoxWidget");
this->setProperty("useSystemStyleBlur", true);
m_pHintInformationWidget = new QWidget();
m_pCheckBoxWidget = new QWidget();
m_pButtonWidget = new QWidget();
m_pButtonWidget->setObjectName("ButtonWidget");
m_pHintInformationWidget->setContentsMargins(0, 0, 0, 0);
m_pCheckBoxWidget->setContentsMargins(0, 0, 0, 0);
m_pButtonWidget->setContentsMargins(0, 0, 0, 0);
initGsettingTransparency(); // 初始化获取透明度的gsetting值
creatorHintInfomationWidget(); // 创建提示信息
creatorCheckBoxWidget(); // 创建checkBox
creatorButtonWidget(); // 创建QPushbutton
creatorCleanPromptBoxWidget();
this->setLayout(m_pHintWidgetVLaout);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
this->setAttribute(Qt::WA_TranslucentBackground);
return;
}
void CleanPromptBox::initGsettingTransparency()
{
if (QGSettings::isSchemaInstalled(UKUI_TRANSPARENCY_SETTING)) {
// qDebug() << "分配gsetting值";
m_pTransparency = new QGSettings(UKUI_TRANSPARENCY_SETTING);
m_dTranSparency = m_pTransparency->get("transparency").toDouble();
connect(m_pTransparency, &QGSettings::changed, this, [=](QString value) {
if (value == "transparency") {
m_dTranSparency = m_pTransparency->get("transparency").toDouble();
this->update();
}
});
}
}
void CleanPromptBox::creatorHintInfomationWidget()
{
m_pIconLableHLaout = new QHBoxLayout;
m_pIconLableHLaout->setContentsMargins(0, 0, 0, 0);
QIcon tipIcon = QIcon::fromTheme("user-trash", QIcon(CLEAN_PNG_PATH));
m_pIconButton = new QPushButton();
m_pIconButton->setObjectName("IconButton");
/* 设置按钮背景颜色 */
QPalette palette = m_pIconButton->palette();
QColor ColorPlaceholderText(255,255,255,0);
QBrush brush;
brush.setColor(ColorPlaceholderText);
palette.setBrush(QPalette::Button, brush);
palette.setBrush(QPalette::ButtonText, brush);
palette.setColor(QPalette::Highlight, Qt::transparent); /* 取消按钮高亮 */
m_pIconButton->setPalette(palette);
m_pIconButton->setFixedSize(48, 48);
m_pIconButton->setIcon(tipIcon);
m_pIconButton->setIconSize(QSize(48,48));
m_pHintInformation = new QLabel(QObject::tr("Are you sure empty your clipboard history?"));
m_pHintInformation->setToolTip(m_pHintInformation->text());
QFont Informationfont;
m_pHintInformation->setFont(Informationfont);
QFontMetrics fontMetrics1(m_pHintInformation->font());
QString formatAppName = fontMetrics1.elidedText(m_pHintInformation->text(), Qt::ElideRight, m_pHintInformation->width()/3);
m_pHintInformation->setText(formatAppName);
m_pHintInformation->setFixedHeight(Informationfont.pointSize()*4);
m_pHintInformation->setGeometry(QRect(328, 240, 329, 27*4)); //四倍行距
m_pHintInformation->setWordWrap(true);
m_pHintInformation->setAlignment(Qt::AlignVCenter);
// m_pHintInformation->setFixedSize(250, 100);
m_pIconLableHLaout->addItem(new QSpacerItem(31,20));
m_pIconLableHLaout->addWidget(m_pIconButton);
m_pIconLableHLaout->addItem(new QSpacerItem(16, 20));
m_pIconLableHLaout->addWidget(m_pHintInformation);
m_pIconLableHLaout->addItem(new QSpacerItem(55, 20));
m_pIconLableHLaout->setSpacing(0);
m_pHintInformationWidget->setLayout(m_pIconLableHLaout);
m_pHintInformationWidget->setFixedHeight(m_pHintInformation->height());
return;
}
void CleanPromptBox::creatorCheckBoxWidget()
{
m_pCheckBoxNoHint = new QCheckBox;
m_pCheckBoxNoHint->setText(QObject::tr("Don't ask"));
m_pCheckBoxNoHint->setFixedHeight(30);
m_pCheckBoxNoHint->setFixedWidth(150);
m_pChechBoxHLaout = new QHBoxLayout;
m_pChechBoxHLaout->setContentsMargins(0,0,0,0);
m_pChechBoxHLaout->setSpacing(0);
m_pChechBoxHLaout->addItem(new QSpacerItem(95, 20));
m_pChechBoxHLaout->addWidget(m_pCheckBoxNoHint);
m_pChechBoxHLaout->addItem(new QSpacerItem(220, 20, QSizePolicy::Expanding));
m_pCheckBoxWidget->setLayout(m_pChechBoxHLaout);
return;
}
void CleanPromptBox::creatorButtonWidget()
{
m_pConfirmButton = new QPushButton(QObject::tr("Confirm"));
m_pConfirmButton->setObjectName("ConfirmButton");
m_pCancelButton = new QPushButton(QObject::tr("Cancel"));
m_pCancelButton->setObjectName("CancelButton");
connect(m_pConfirmButton, &QPushButton::clicked, globalClipboardSignal, &ClipboardSignal::CLipBoardEditConfirmButtonSignal);
connect(m_pCancelButton, &QPushButton::clicked, globalClipboardSignal, &ClipboardSignal::CLipBoardEditConfirmButtonSignal);
connect(m_pConfirmButton, &QPushButton::clicked, this, &CleanPromptBox::ConfirmButtonSlots);
connect(m_pConfirmButton, &QPushButton::clicked, this, &CleanPromptBox::accept);
connect(m_pCancelButton, &QPushButton::clicked, this, &CleanPromptBox::reject);
/* 设置按钮字体\背景颜色 */
m_pCancelButton->setStyle(new CustomStyle_pushbutton_2("ukui-default"));
/* 设置按钮字体\背景颜色 */
m_pConfirmButton->setStyle(new CustomStyle("ukui-default"));
m_pConfirmButton->setFixedSize(120, 34);
m_pCancelButton->setFixedSize(120, 34);
m_pButtonHLaout = new QHBoxLayout;
m_pButtonHLaout->setContentsMargins(0, 0, 0, 0);
m_pButtonHLaout->setSpacing(0);
m_pButtonHLaout->addItem(new QSpacerItem(124, 20));
m_pButtonHLaout->addWidget(m_pCancelButton);
m_pButtonHLaout->addItem(new QSpacerItem(16, 20));
m_pButtonHLaout->addWidget(m_pConfirmButton);
m_pButtonHLaout->addItem(new QSpacerItem(20, 10));
m_pButtonWidget->setLayout(m_pButtonHLaout);
return;
}
void CleanPromptBox::creatorCleanPromptBoxWidget()
{
m_pHintWidgetVLaout = new QVBoxLayout;
m_pHintWidgetVLaout->setContentsMargins(0, 0, 0, 0);
m_pHintWidgetVLaout->setSpacing(0);
m_pHintWidgetVLaout->addItem(new QSpacerItem(20, 48));
m_pHintWidgetVLaout->addWidget(m_pHintInformationWidget);
m_pHintWidgetVLaout->addItem(new QSpacerItem(15, 10));
m_pHintWidgetVLaout->addWidget(m_pCheckBoxWidget);
m_pHintWidgetVLaout->addItem(new QSpacerItem(10, 41));
m_pHintWidgetVLaout->addWidget(m_pButtonWidget);
m_pHintWidgetVLaout->addItem(new QSpacerItem(10, 18));
return;
}
void CleanPromptBox::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
// p.setBrush(QBrush(QColor("#131314")));
p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(m_dTranSparency);
p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.drawRoundedRect(opt.rect,6,6);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
return;
}
void CleanPromptBox::ConfirmButtonSlots()
{
if (m_pCheckBoxNoHint->isChecked()) {
emit ClipBoardInternalSignal::getGlobalInternalSignal()->CheckBoxSelectedSignal();
qDebug() << "是选中状态";
}
return;
}

View File

@ -0,0 +1,75 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CLEANPROMPTBOX_H
#define CLEANPROMPTBOX_H
#include <QWidget>
#include <QDialog>
#include <QPushButton>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QCheckBox>
#include <QStyle>
#include <QStyleOption>
#include <QPainter>
#include <QFile>
#include <QRadioButton>
#include <QGSettings>
#include "clipboardsignal.h"
#include "clipBoardInternalSignal.h"
#define CLEAN_PNG_PATH ":/image/user-trash.png"
#define SIDEBAR_HINT_QSS_PATH ":/qss/HintBoxWidget.css"
#define UKUI_TRANSPARENCY_SETTING "org.ukui.control-center.personalise"
extern ClipboardSignal *globalClipboardSignal;
class CleanPromptBox : public QDialog
{
public:
CleanPromptBox();
QWidget *m_pHintInformationWidget;
QWidget *m_pCheckBoxWidget;
QWidget *m_pButtonWidget;
QPushButton *m_pConfirmButton;
QPushButton *m_pCancelButton;
QPushButton *m_pIconButton;
QLabel *m_pHintInformation;
QLabel *m_PIconLabel;
QCheckBox *m_pCheckBoxNoHint;
QVBoxLayout *m_pHintWidgetVLaout;
QHBoxLayout *m_pIconLableHLaout;
QHBoxLayout *m_pButtonHLaout;
QHBoxLayout *m_pChechBoxHLaout;
QGSettings *m_pTransparency;
double m_dTranSparency = 0.7;
void initGsettingTransparency();
void creatorHintInfomationWidget();
void creatorCheckBoxWidget();
void creatorButtonWidget();
void creatorCleanPromptBoxWidget();
protected:
void paintEvent(QPaintEvent *);
private slots:
void ConfirmButtonSlots();
};
#endif // CLEANPROMPTBOX_H

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "clipBoardInternalSignal.h"
static ClipBoardInternalSignal* Global_internal_signal = nullptr;
void ClipBoardInternalSignal::initInternalSignal()
{
ClipBoardInternalSignal::getGlobalInternalSignal();
return;
}
ClipBoardInternalSignal* ClipBoardInternalSignal::getGlobalInternalSignal()
{
if (Global_internal_signal == nullptr)
Global_internal_signal = new ClipBoardInternalSignal();
return Global_internal_signal;
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CLIPBOARDINTERNALSIGNAL_H
#define CLIPBOARDINTERNALSIGNAL_H
#include <QObject>
class ClipBoardInternalSignal : public QObject
{
Q_OBJECT
public:
explicit ClipBoardInternalSignal() {}
static void initInternalSignal();
static ClipBoardInternalSignal* getGlobalInternalSignal();
signals:
void CheckBoxSelectedSignal();
public slots:
};
#endif // CLIPBOARDINTERNALSIGNAL_H

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CLIPBAORDSTRUCTORIGINALDATA_H
#define CLIPBAORDSTRUCTORIGINALDATA_H
#include <QMimeData>
#include "clipboardwidgetentry.h"
enum DataType {
Unknown,
Text,
Image,
File
};
typedef struct clipboardOriginalDataHash {
ClipboardWidgetEntry* WidgetEntry;
const QMimeData* MimeData;
QPixmap *p_pixmap;
QString text;
QString Clipbaordformat;
QList<QUrl> urls;
int Sequence;
} OriginalDataHashValue;
#endif // CLIPBAORDSTRUCTORIGINALDATA_H

View File

@ -0,0 +1,3 @@
{
"Keys" : [ ]
}

View File

@ -0,0 +1,19 @@
<RCC>
<qresource prefix="/">
<file>image/editor.svg</file>
<file>image/copy.svg</file>
<file>image/delete.svg</file>
<file>image/button-close-hover-click-two.svg</file>
<file>image/button-close-hover-click-add-background-one.svg</file>
<file>image/button-close-default-add-background-three.svg</file>
<file>image/user-trash.png</file>
<file>qss/sidebarClipboard.css</file>
<file>qss/sideBarEditArea.css</file>
<file>qss/sideBarSearchArea.css</file>
<file>image/kylin-feedback.png</file>
<file>image/kylin-alarm-clock.svg</file>
<file>image/lock.png</file>
<file>image/cancel-lock.png</file>
<file>fileIcon.json</file>
</qresource>
</RCC>

View File

@ -0,0 +1,119 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "clipboarddb.h"
clipboardDb::clipboardDb(QObject *parent)
{
Q_UNUSED(parent);
QString url_filepath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) +"/.config/Clipboard.db";
//链接数据库
if (!connectClipboardDb(url_filepath))
return;
creatClipboardDbTable(url_filepath); //创建表格
}
/* 链接数据库 */
bool clipboardDb::connectClipboardDb(QString DbName)
{
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", DbName);
db.setDatabaseName(DbName);
if (!db.open()) {
qDebug() << "打开数据失败,返回false";
return false;
}
return true;
}
/* 创建数据 */
bool clipboardDb::creatClipboardDbTable(QString DbName)
{
QSqlQuery query(QSqlDatabase::database(DbName));
QString creatorSqlState = "CREATE TABLE Clipboard_table ("
"id INTEGER PRIMARY KEY AUTOINCREMENT,"
"content TEXT UNIQUE NOT NULL,"
"format TEXT NOT NULL,"
"Sequence INTEGER NOT NULL"
");";
query.exec(creatorSqlState);
qDebug()<<"------------------creatorSqlState-------------------";
return true;
}
/* 增 */
void clipboardDb::insertSqlClipbarodDb(QString content, QString format, int Sequence)
{
QString url_filepath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) +"/.config/Clipboard.db";
QSqlQuery query(QSqlDatabase::database(url_filepath));
QString insertSql = QStringLiteral("INSERT INTO Clipboard_table (content, format, Sequence) VALUES ('%1','%2',%3)").arg(content).arg(format).arg(Sequence);
if (!query.exec(insertSql)) {
qDebug() << "数据插入错误";
return;
}
query.finish();
return;
}
/* 删 */
void clipboardDb::deleteSqlClipboardDb(QString content)
{
QString url_filepath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) +"/.config/Clipboard.db";
QSqlQuery query(QSqlDatabase::database(url_filepath));
QString deleteSql = QStringLiteral("DELETE FROM Clipboard_table WHERE content='%1'").arg(content);
if (!query.exec(deleteSql)) {
qDebug() << "删除操作失败";
return;
}
query.finish();
return;
}
/* 改 */
void clipboardDb::updateSqlClipboardDb(QString content, QString format, int Sequence, QString oldcontent)
{
QString url_filepath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) +"/.config/Clipboard.db";
QSqlQuery query(QSqlDatabase::database(url_filepath));
QString updateSql = QStringLiteral("UPDATE Clipboard_table SET content='%1',format='%2',Sequence=%3 WHERE content='%4'")
.arg(content)
.arg(format)
.arg(Sequence)
.arg(oldcontent);
if(!query.exec(updateSql)) {
qDebug() << "更新操作失败";
return;
}
query.finish();
return;
}
/* 查Id */
int clipboardDb::SelectSqlClipbaordDbId()
{
QString url_filepath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) +"/.config/Clipboard.db";
QSqlQuery query(QSqlDatabase::database(url_filepath));
QString SelectSql = QStringLiteral("SELECT MAX(ID) from Clipboard_table");
if (!query.exec(SelectSql)) {
qWarning() << "查询操作失败";
return -1;
}
int seq;
while (query.next())
seq = query.value(0).toDouble();
return seq;
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CLIPBOARDDB_H
#define CLIPBOARDDB_H
#include <QObject>
#include <QtSql/QSqlDatabase>
#include <QSqlQuery>
#include <QDebug>
#include <QStandardPaths>
class clipboardDb : public QObject
{
public:
clipboardDb(QObject *parent = nullptr);
bool connectClipboardDb(QString DbName);
bool creatClipboardDbTable(QString DbName);
void insertSqlClipbarodDb(QString content, QString format, int Sequence);
void deleteSqlClipboardDb(QString content);
void updateSqlClipboardDb(QString content, QString format, int Sequence, QString oldcontent);
int SelectSqlClipbaordDbId();
};
#endif // CLIPBOARDDB_H

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "clipboardlisetwidget.h"
#include "sidebarclipboardplugin.h"
#include <QMouseEvent>
#include <QDebug>
ClipBoardLisetWidget::ClipBoardLisetWidget()
{
installEventFilter(this);
}
void ClipBoardLisetWidget::mousePressEvent(QMouseEvent *event)
{
// if (event->buttons() == Qt::LeftButton) {
// auto pos = event->pos();
// if (!this->indexAt(pos).isValid())
// //发送信号
// emit globalClipboardSignal->ClipboardHideSignal();
// }
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CLIPBOARDLISETWIDGET_H
#define CLIPBOARDLISETWIDGET_H
#include <QListWidget>
#include <QMouseEvent>
#include "clipboardsignal.h"
extern ClipboardSignal *globalClipboardSignal;
class ClipBoardLisetWidget :public QListWidget
{
public:
ClipBoardLisetWidget();
protected:
void mousePressEvent(QMouseEvent *event);
};
#endif // CLIPBOARDLISETWIDGET_H

View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CLIPBOARDSIGNAL_H
#define CLIPBOARDSIGNAL_H
#include "sidebarclipboardsignal.h"
class ClipboardSignal : public SidebarClipBoardSignal
{
Q_OBJECT
public:
explicit ClipboardSignal() {}
signals:
public slots:
};
#endif // CLIPBOARDSIGNAL_H

View File

@ -0,0 +1,330 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "clipboardwidgetentry.h"
#include "customstyleCleanPushbutton.h"
#include <QTimer>
#include <QStyleOption>
#include <QPainter>
#include <QPalette>
#include <QEvent>
ClipboardWidgetEntry::ClipboardWidgetEntry(QString dataFormat, QWidget *parent)
{
Q_UNUSED(parent);
m_dataFormat = dataFormat;
status=NORMAL;
this->setObjectName("WidgetEntry");
this->setContentsMargins(0,0,0,0);
/* 初始化三个按钮 */
initPushbutton();
/* 初始化Lable */
initLable();
if (dataFormat == ENTRYURL || dataFormat == ENTRYTEXT) {
m_pCopyDataLabal->setFixedSize(386, 34);
} else if (dataFormat == ENTRYIMAGE) {
m_pCopyDataLabal->setFixedSize(110, 75);
}
m_pHLayout = new QHBoxLayout();
m_pHLayout->setContentsMargins(0,0,0,0);
m_pHLayout->addItem(new QSpacerItem(10,20));
if (dataFormat == ENTRYURL) {
m_pCopyFileIcon = new pixmapLabel(); //用来放置文件的图标
m_pCopyFileIcon->setContentsMargins(0, 0, 0, 0);
m_pCopyFileIcon->setFixedSize(25, 25);
m_pCopyDataLabal->setFixedSize(380, 34);
m_pHLayout->addWidget(m_pCopyFileIcon);
}
m_pHLayout->addWidget(m_pCopyDataLabal);
if (dataFormat == ENTRYIMAGE)
m_pHLayout->addItem(new QSpacerItem(276, 34));
m_pHLayout->addWidget(m_pPopButton);
m_pHLayout->addWidget(m_pCancelLockButton);
m_pCancelLockButton->setVisible(false);
if (!(m_dataFormat == ENTRYURL
|| m_dataFormat == ENTRYIMAGE))
m_pHLayout->addWidget(m_pEditButon);
m_pHLayout->addWidget(m_pRemoveButton);
m_pHLayout->addItem(new QSpacerItem(15,20));
m_pHLayout->setSpacing(5);
m_pPopButton->setVisible(false);
m_pEditButon->setVisible(false);
m_pRemoveButton->setVisible(false);
this->setLayout(m_pHLayout);
}
void ClipboardWidgetEntry::initPushbutton()
{
QIcon EditIcon;
EditIcon.addFile(EDIT_SVG_PATH);
QIcon PopIcon;
PopIcon.addFile(LOCK_SVG_PATH);
QIcon RemoveIcon;
RemoveIcon.addFile(REMOVE_SVG_PATH);
QIcon CancelIcon;
CancelIcon.addFile(CANCEL_LOCK_PNG_PATH);
m_pPopButton = new QPushButton();
m_pPopButton->setStyle(new customstyle_clean_pushbutton("ukui-default"));
m_pPopButton->setToolTip(QObject::tr("Pop"));
m_pPopButton->setFixedSize(34, 34);
m_pPopButton->setIcon(PopIcon);
m_pPopButton->setObjectName("PopButton");
m_pEditButon = new QPushButton();
m_pEditButon->setStyle(new customstyle_clean_pushbutton("ukui-default"));
connect(m_pEditButon, &QPushButton::clicked, globalClipboardSignal, &ClipboardSignal::ClipBoardWidgetEntryEditButtonSignal);
m_pEditButon->setToolTip(QObject::tr("EditButton"));
m_pEditButon->setFixedSize(34, 34);
m_pEditButon->setIcon(EditIcon);
m_pEditButon->setObjectName("EditButon");
m_pRemoveButton = new QPushButton();
m_pRemoveButton->setStyle(new customstyle_clean_pushbutton("ukui-default"));
m_pRemoveButton->setToolTip(QObject::tr("Remove"));
m_pRemoveButton->setFixedSize(34, 34);
m_pRemoveButton->setIcon(RemoveIcon);
m_pRemoveButton->setObjectName("RemoveButton");
m_pCancelLockButton = new QPushButton();
m_pCancelLockButton->setStyle(new customstyle_clean_pushbutton("ukui-default"));
m_pCancelLockButton->setToolTip(QObject::tr("Cancel the fixed"));
m_pCancelLockButton->setFixedSize(34,34);
m_pCancelLockButton->setIcon(CancelIcon);
m_pCancelLockButton->setObjectName("cancel fixed the button");
return;
}
void ClipboardWidgetEntry::initLable()
{
m_pCopyDataLabal = new QLabel();
QTimer::singleShot(1, m_pCopyDataLabal, [=](){
QFont font = m_pCopyDataLabal->font();
// font.setPixelSize(14);
// font.setFamily("Noto Sans CJK SC");
m_pCopyDataLabal->setFont(font);
});
m_pCopyDataLabal->setObjectName("EntryLable");
if (m_dataFormat == ENTRYTEXT || m_dataFormat == ENTRYIMAGE) {
m_pCopyDataLabal->setContentsMargins(3, 0, 0, 0);
} else {
m_pCopyDataLabal->setContentsMargins(0, 0, 0, 0);
}
}
void ClipboardWidgetEntry::enterEvent(QEvent *e)
{
if(e == nullptr) {
return;
}
status=HOVER;
repaint();
m_pCopyDataLabal->setFixedSize(260, 34);
if (m_dataFormat == ENTRYURL) {
m_pCopyDataLabal->setFixedSize(278, 34);
} else if (m_dataFormat == ENTRYIMAGE) {
m_pCopyDataLabal->setFixedSize(110, 75);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
// emit previewShowImage(this);//发送预览信号
#endif
} else {
m_pCopyDataLabal->setFixedSize(260, 34);
m_pEditButon->setVisible(true);
}
if (m_bWhetherFix) {
m_pCancelLockButton->setVisible(true);
} else {
m_pPopButton->setVisible(true);
}
m_pRemoveButton->setVisible(true);
m_ptext = this->m_pCopyDataLabal->text();
QString format;
if (m_dataFormat == ENTRYURL) {
format = setMiddleFormatBody(m_ptext);
} else {
format = SetFormatBody(m_ptext);
}
m_pCopyDataLabal->setText(format);
this->update();
}
void ClipboardWidgetEntry::leaveEvent(QEvent *e)
{
if (e == nullptr)
return;
status=NORMAL;
if (m_bWhetherFix) {
m_pCancelLockButton->setVisible(false);
} else {
m_pPopButton->setVisible(false);
}
m_pEditButon->setVisible(false);
m_pRemoveButton->setVisible(false);
if (m_dataFormat == ENTRYURL || m_dataFormat == ENTRYTEXT) {
m_pCopyDataLabal->setFixedSize(386, 34);
} else if (m_dataFormat == ENTRYIMAGE) {
m_pCopyDataLabal->setFixedSize(110, 75);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
// emit previewHideImage(this);//发送退出预览信号
#endif
this->update();
}
if (m_ptext == "") {
this->update();
return;
} else {
this->m_pCopyDataLabal->setText(m_ptext);
}
this->update();
return;
}
void ClipboardWidgetEntry::mousePressEvent(QMouseEvent *event)
{
m_ptext = this->m_pCopyDataLabal->text();
if (event->button() == Qt::LeftButton) {
emit doubleClicksignals(this);
return;
}
return;
}
void ClipboardWidgetEntry::mouseDoubleClickEvent(QMouseEvent *event)
{
}
QString ClipboardWidgetEntry::SetFormatBody(QString text)
{
QFontMetrics fontMetrics(this->m_pCopyDataLabal->font());
int LableWidth = this->m_pCopyDataLabal->width();
int fontSize = fontMetrics.width(text);
QString formatBody = text;
if(fontSize > (LableWidth - 10)) {
QStringList list = formatBody.split("\n");
if (list.size() >= 2) {
//当有几行时,只需要截取第一行就行,在第一行后面加...
/* 判断第一行是否是空行 */
formatBody = judgeBlankLine(list);
formatBody = formatBody + "aa";
int oneFontSize = fontMetrics.width(formatBody);
if (oneFontSize > (LableWidth - 10)) {
formatBody = fontMetrics.elidedText(formatBody, Qt::ElideRight, LableWidth - 10);
return formatBody;
} else {
if (!substringSposition(formatBody, list)) {
int oneFontSize = fontMetrics.width(formatBody);
formatBody = fontMetrics.elidedText(formatBody, Qt::ElideRight, oneFontSize - 1);
return formatBody;
}
}
} else {
//说明只存在一行,在最后面加...就行
formatBody = fontMetrics.elidedText(formatBody, Qt::ElideRight, LableWidth - 10);
return formatBody;
}
} else {
QStringList list = formatBody.split("\n");
if (list.size() >= 2) {
//取得当前的有字符串的子串
formatBody = judgeBlankLine(list);
formatBody = formatBody + "aa";
if (!substringSposition(formatBody, list)) {
int oneFontSize = fontMetrics.width(formatBody);
formatBody = fontMetrics.elidedText(formatBody, Qt::ElideRight, oneFontSize - 1);
}
}
}
return formatBody;
}
QString ClipboardWidgetEntry::setMiddleFormatBody(QString text)
{
QFontMetrics fontMetrics(m_pCopyDataLabal->font());
int LableWidth = m_pCopyDataLabal->width();
int fontSize = fontMetrics.width(text);
QString formatBody = text;
if (fontSize > (LableWidth - 20)) {
formatBody = fontMetrics.elidedText(formatBody, Qt::ElideMiddle, LableWidth - 20);
return formatBody;
}
return formatBody;
}
/* 去除掉空行,显示有字体的行 */
QString ClipboardWidgetEntry::judgeBlankLine(QStringList list)
{
int tmp = list.count();
for (int i = 0; i < tmp; i++) {
QString dest = list.at(i);
dest = dest.trimmed();
if (dest.size() != 0)
return list.at(i);
}
return list.at(0);
}
/* 判断当前子串位置,后面是否还有子串 */
bool ClipboardWidgetEntry::substringSposition(QString formatBody, QStringList list)
{
int tmp = list.count();
for (int i = 0; i < tmp; i++) {
QString dest = list.at(i);
if (dest == formatBody && i == tmp - 1)
return true;
}
return false;
}
void ClipboardWidgetEntry::paintEvent(QPaintEvent *e)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
switch (status) {
case NORMAL: {
p.setBrush(QBrush(QColor(255, 255, 255, 0)));
p.setPen(Qt::NoPen);
break;
}
case HOVER: {
QColor color(opt.palette.color(QPalette::WindowText));
p.setBrush(QBrush(color));
p.setOpacity(0.08);
p.setPen(Qt::NoPen);
break;
}
case PRESS: {
break;
}
}
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.drawRoundedRect(opt.rect,0,0);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

View File

@ -0,0 +1,91 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CLIPBOARDWIDGETENTRY_H
#define CLIPBOARDWIDGETENTRY_H
#include <QObject>
#include <QWidget>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QHBoxLayout>
#include <QIcon>
#include <QLine>
#include <QGroupBox>
#include <QEvent>
#include <QDebug>
#include <QSpacerItem>
#include <QMouseEvent>
#include "clipboardsignal.h"
#include "clipBoardInternalSignal.h"
#include "pixmaplabel.h"
#define EDIT_SVG_PATH ":/image/editor.svg"
#define COPY_SVG_PATH ":/image/copy.svg"
#define REMOVE_SVG_PATH ":/image/delete.svg"
#define SEARCH_SVG_CLEAN ":/image/button-close-hover-click-two.svg"
#define SEARCH_SVG_CLEAN_BACK ":/image/button-close-hover-click-add-background-one.svg"
#define LOCK_SVG_PATH ":/image/lock.png"
#define CANCEL_LOCK_PNG_PATH ":/image/cancel-lock.png"
#define ENTRYURL "Url"
#define ENTRYIMAGE "Image"
#define ENTRYTEXT "Text"
extern ClipboardSignal *globalClipboardSignal;
class ClipboardWidgetEntry : public QWidget
{
Q_OBJECT
public:
ClipboardWidgetEntry(QString dataFormat, QWidget *parent = nullptr);
QPushButton *m_pPopButton;
QPushButton *m_pEditButon;
QPushButton *m_pRemoveButton;
QPushButton *m_pCancelLockButton;
QLabel *m_pCopyDataLabal = nullptr;
pixmapLabel *m_pCopyFileIcon;
QHBoxLayout *m_pHLayout;
QString m_ptext;
QString m_dataFormat;
bool m_bWhetherFix = false;
QString SetFormatBody(QString text);
QString setMiddleFormatBody(QString text);
QString judgeBlankLine(QStringList list); /* 去除掉空行,显示有字体的行 */
void initPushbutton(); /* 初始化三个按钮 */
void initLable(); /* 初始化Lable */
bool substringSposition(QString formatBody, QStringList list); /* 判断后面是否还有子串 */
enum TaskWidgetStatus{NORMAL, HOVER, PRESS};
TaskWidgetStatus status;
protected:
void enterEvent(QEvent *); //进入QWidget瞬间事件
void leaveEvent(QEvent *); //离开QWidget瞬间事件
void mouseDoubleClickEvent(QMouseEvent *event); //双击事件
void mousePressEvent(QMouseEvent *event); //单击事件
void paintEvent(QPaintEvent *e); //重绘事件
signals:
void doubleClicksignals(QWidget *w);
void previewShowImage(QWidget *w);
void previewHideImage(QWidget *w);
};
#endif // CLIPBOARDWIDGETENTRY_H

View File

@ -0,0 +1,219 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "customstyle.h"
#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QDebug>
CustomStyle::CustomStyle(const QString &proxyStyleName, QObject *parent) : QProxyStyle (proxyStyleName)
{
Q_UNUSED(parent);
}
void CustomStyle::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
return QProxyStyle::drawComplexControl(control, option, painter, widget);
}
void CustomStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case QStyle::CE_PushButton: {
QStyleOptionButton button = *qstyleoption_cast<const QStyleOptionButton *>(option);
button.palette.setColor(QPalette::HighlightedText, button.palette.buttonText().color());
return QProxyStyle::drawControl(element, &button, painter, widget);
break;
}
default:
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
void CustomStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
}
void CustomStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
{
return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
}
/// 我们重写button的绘制方法通过state和当前动画的状态以及value值改变相关的绘制条件
/// 这里通过判断hover与否动态的调整painter的透明度然后绘制背景
/// 需要注意的是,默认控件的绘制流程只会触发一次,而动画需要我们在一段时间内不停绘制才行,
/// 要使得动画能够持续我们需要使用QWidget::update()在动画未完成时,
/// 手动更新一次这样button将在一段时间后再次调用draw方法从而达到更新动画的效果
///
/// 需要注意绘制背景的流程会因主题不同而产生差异,所以这一部分代码在一些主题中未必正常,
/// 如果你需要自己实现一个主题,这同样是你需要注意和考虑的点
void CustomStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case PE_PanelButtonCommand: {
if (option->state & State_MouseOver) {
if (option->state & State_Sunken) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(50,87,202,255);
painter->setBrush(color);
painter->drawRoundedRect(option->rect,4,4);
painter->restore();
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(107,142,235,255);
painter->setBrush(color);
painter->drawRoundedRect(option->rect,4, 4);
painter->restore();
}
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(61, 107, 229, 255);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
return;
} break;
case PE_PanelLineEdit://UKUI Line edit style
{
// Conflict with qspinbox and so on, The widget text cannot use this style
painter->save();
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
painter->setRenderHint(QPainter::Antialiasing,true);
//Setpen is set to avoid a bug that collides with a white background
painter->setPen(Qt::NoPen);
QColor color(0,0,0,51);
painter->setBrush(color);
QFont font;
font.setFamily("Noto Sans CJK SC");
font.setPixelSize(14);
font.setWeight(400);
painter->setFont(font);
if (widget->isEnabled()) {
if (option->state &State_MouseOver) {
QColor ColotPen(61,107,229,255);
painter->setPen(ColotPen);
painter->setBrush(color);
}
if(option->state &State_HasFocus) {
QColor ColotPen(28, 47, 146, 255);
painter->setPen(ColotPen);
painter->setBrush(color);
}
}
painter->drawRoundedRect(panel->rect,4,4);
}
painter->restore();
return;
}break;
}
return QProxyStyle::drawPrimitive(element, option, painter, widget);
}
QPixmap CustomStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
{
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
}
QStyle::SubControl CustomStyle::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
{
return QProxyStyle::hitTestComplexControl(control, option, position, widget);
}
QRect CustomStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
}
QRect CustomStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
{
return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
}
int CustomStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::pixelMetric(metric, option, widget);
}
/// 我们需要将动画与widget一一对应起来
/// 在一个style的生命周期里widget只会进行polish和unpolish各一次
/// 所以我们可以在polish时将widget与一个新的动画绑定并且对应的在unpolish中解绑定
void CustomStyle::polish(QWidget *widget)
{
return QProxyStyle::polish(widget);
}
void CustomStyle::polish(QApplication *application)
{
return QProxyStyle::polish(application);
}
void CustomStyle::polish(QPalette &palette)
{
return QProxyStyle::polish(palette);
}
void CustomStyle::unpolish(QWidget *widget)
{
return QProxyStyle::unpolish(widget);
}
void CustomStyle::unpolish(QApplication *application)
{
return QProxyStyle::unpolish(application);
}
QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
{
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
}
QIcon CustomStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
QPalette CustomStyle::standardPalette() const
{
return QProxyStyle::standardPalette();
}
int CustomStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
QRect CustomStyle::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
{
return QProxyStyle::subControlRect(control, option, subControl, widget);
}
QRect CustomStyle::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::subElementRect(element, option, widget);
}

View File

@ -0,0 +1,74 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CUSTOMSTYLE_H
#define CUSTOMSTYLE_H
#include <QProxyStyle>
class CustomStyle : public QProxyStyle
{
Q_OBJECT
public:
explicit CustomStyle(const QString &proxyStyleName = "windows", QObject *parent = nullptr);
virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
/*!
* \brief drawPrimitive
* \param element PE枚举类型
* \param option
* \param painter
* \param widget
* \details
* drawPrimitive用于绘制控件背景
*
* hover和点击效果
*/
virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const;
virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const;
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const;
//virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget);
virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const;
virtual void polish(QWidget *widget);
virtual void polish(QApplication *application);
virtual void polish(QPalette &palette);
virtual void unpolish(QWidget *widget);
virtual void unpolish(QApplication *application);
virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const;
virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
virtual QPalette standardPalette() const;
virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const;
virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const;
virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const;
signals:
public slots:
private:
};
#endif // CUSTOMSTYLE_H

View File

@ -0,0 +1,193 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "customstyleCleanPushbutton.h"
#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QDebug>
customstyle_clean_pushbutton::customstyle_clean_pushbutton(const QString &proxyStyleName, QObject *parent) : QProxyStyle (proxyStyleName)
{
Q_UNUSED(parent);
}
void customstyle_clean_pushbutton::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
return QProxyStyle::drawComplexControl(control, option, painter, widget);
}
void customstyle_clean_pushbutton::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case QStyle::CE_PushButton: {
QStyleOptionButton button = *qstyleoption_cast<const QStyleOptionButton *>(option);
button.palette.setColor(QPalette::HighlightedText, button.palette.buttonText().color());
return QProxyStyle::drawControl(element, &button, painter, widget);
break;
}
default:
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
void customstyle_clean_pushbutton::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
}
void customstyle_clean_pushbutton::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
{
return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
}
/// 我们重写button的绘制方法通过state和当前动画的状态以及value值改变相关的绘制条件
/// 这里通过判断hover与否动态的调整painter的透明度然后绘制背景
/// 需要注意的是,默认控件的绘制流程只会触发一次,而动画需要我们在一段时间内不停绘制才行,
/// 要使得动画能够持续我们需要使用QWidget::update()在动画未完成时,
/// 手动更新一次这样button将在一段时间后再次调用draw方法从而达到更新动画的效果
///
/// 需要注意绘制背景的流程会因主题不同而产生差异,所以这一部分代码在一些主题中未必正常,
/// 如果你需要自己实现一个主题,这同样是你需要注意和考虑的点
void customstyle_clean_pushbutton::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
if (element == PE_PanelButtonCommand) {
if (widget) {
if (option->state & State_MouseOver) {
if (option->state & State_Sunken) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
// QColor color(255,255,255,21);
// painter->setBrush(color);
painter->setBrush(option->palette.color(QPalette::WindowText));
painter->setOpacity(0.08);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
// QColor color(255,255,255,51);
// painter->setBrush(color);
painter->setBrush(option->palette.color(QPalette::WindowText));
painter->setOpacity(0.2);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
// QColor color(255,255,255,31);
// painter->setBrush(color);
painter->setBrush(option->palette.color(QPalette::WindowText));
painter->setOpacity(0.12);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
return;
}
}
return QProxyStyle::drawPrimitive(element, option, painter, widget);
}
QPixmap customstyle_clean_pushbutton::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
{
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
}
QStyle::SubControl customstyle_clean_pushbutton::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
{
return QProxyStyle::hitTestComplexControl(control, option, position, widget);
}
QRect customstyle_clean_pushbutton::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
}
QRect customstyle_clean_pushbutton::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
{
return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
}
int customstyle_clean_pushbutton::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::pixelMetric(metric, option, widget);
}
/// 我们需要将动画与widget一一对应起来
/// 在一个style的生命周期里widget只会进行polish和unpolish各一次
/// 所以我们可以在polish时将widget与一个新的动画绑定并且对应的在unpolish中解绑定
void customstyle_clean_pushbutton::polish(QWidget *widget)
{
return QProxyStyle::polish(widget);
}
void customstyle_clean_pushbutton::polish(QApplication *application)
{
return QProxyStyle::polish(application);
}
void customstyle_clean_pushbutton::polish(QPalette &palette)
{
return QProxyStyle::polish(palette);
}
void customstyle_clean_pushbutton::unpolish(QWidget *widget)
{
return QProxyStyle::unpolish(widget);
}
void customstyle_clean_pushbutton::unpolish(QApplication *application)
{
return QProxyStyle::unpolish(application);
}
QSize customstyle_clean_pushbutton::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
{
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
}
QIcon customstyle_clean_pushbutton::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
QPalette customstyle_clean_pushbutton::standardPalette() const
{
return QProxyStyle::standardPalette();
}
int customstyle_clean_pushbutton::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
QRect customstyle_clean_pushbutton::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
{
return QProxyStyle::subControlRect(control, option, subControl, widget);
}
QRect customstyle_clean_pushbutton::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::subElementRect(element, option, widget);
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CUSTOMSTYLE_CLEAN_PUSHBUTTON_H
#define CUSTOMSTYLE_CLEAN_PUSHBUTTON_H
#include <QProxyStyle>
class customstyle_clean_pushbutton : public QProxyStyle
{
Q_OBJECT
public:
explicit customstyle_clean_pushbutton(const QString &proxyStyleName = "windows", QObject *parent = nullptr);
virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
/*!
* \brief drawPrimitive
* \param element PE枚举类型
* \param option
* \param painter
* \param widget
* \details
* drawPrimitive用于绘制控件背景
*
* hover和点击效果
*/
virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const;
virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const;
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const;
//virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget);
virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const;
virtual void polish(QWidget *widget);
virtual void polish(QApplication *application);
virtual void polish(QPalette &palette);
virtual void unpolish(QWidget *widget);
virtual void unpolish(QApplication *application);
virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const;
virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
virtual QPalette standardPalette() const;
virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const;
virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const;
virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const;
signals:
public slots:
private:
};
#endif // CUSTOMSTYLE_CLEAN_PUSHBUTTON_H

View File

@ -0,0 +1,218 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "customstylePushbutton2.h"
#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QDebug>
CustomStyle_pushbutton_2::CustomStyle_pushbutton_2(const QString &proxyStyleName, QObject *parent) : QProxyStyle (proxyStyleName)
{
Q_UNUSED(parent);
}
void CustomStyle_pushbutton_2::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
return QProxyStyle::drawComplexControl(control, option, painter, widget);
}
void CustomStyle_pushbutton_2::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case QStyle::CE_PushButton: {
QStyleOptionButton button = *qstyleoption_cast<const QStyleOptionButton *>(option);
button.palette.setColor(QPalette::HighlightedText, button.palette.buttonText().color());
return QProxyStyle::drawControl(element, &button, painter, widget);
break;
}
default:
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
void CustomStyle_pushbutton_2::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
}
void CustomStyle_pushbutton_2::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
{
return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
}
/// 我们重写button的绘制方法通过state和当前动画的状态以及value值改变相关的绘制条件
/// 这里通过判断hover与否动态的调整painter的透明度然后绘制背景
/// 需要注意的是,默认控件的绘制流程只会触发一次,而动画需要我们在一段时间内不停绘制才行,
/// 要使得动画能够持续我们需要使用QWidget::update()在动画未完成时,
/// 手动更新一次这样button将在一段时间后再次调用draw方法从而达到更新动画的效果
///
/// 需要注意绘制背景的流程会因主题不同而产生差异,所以这一部分代码在一些主题中未必正常,
/// 如果你需要自己实现一个主题,这同样是你需要注意和考虑的点
void CustomStyle_pushbutton_2::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
// if (element == PE_PanelButtonCommand) {
// qDebug()<<"draw pe button";
// if (widget) {
// bool isPressed = false;
// bool isHover = false;
// if (!option->state.testFlag(State_Sunken)) {
// if (option->state.testFlag(State_MouseOver)) {
// isHover = true;
// }
// } else {
// isPressed = true;
// }
// QStyleOption opt = *option;
// if (isHover) {
// QColor color(255,255,255,51);
// opt.palette.setColor(QPalette::Highlight, color);
// }
// if (isPressed) {
// QColor color(255,255,255,21);
// opt.palette.setColor(QPalette::Highlight, color);
// }
// if (!isHover && !isPressed) {
// QColor color(255,255,255,31);
// opt.palette.setColor(QPalette::Button,color);
// }
// return QProxyStyle::drawPrimitive(element, &opt, painter, widget);
// }
// }
// return QProxyStyle::drawPrimitive(element, option, painter, widget);
if (element == PE_PanelButtonCommand) {
if (widget) {
if (option->state & State_MouseOver) {
if (option->state & State_Sunken) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,21);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,51);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,31);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
return;
}
}
return QProxyStyle::drawPrimitive(element, option, painter, widget);
}
QPixmap CustomStyle_pushbutton_2::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
{
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
}
QStyle::SubControl CustomStyle_pushbutton_2::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
{
return QProxyStyle::hitTestComplexControl(control, option, position, widget);
}
QRect CustomStyle_pushbutton_2::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
}
QRect CustomStyle_pushbutton_2::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
{
return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
}
int CustomStyle_pushbutton_2::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::pixelMetric(metric, option, widget);
}
/// 我们需要将动画与widget一一对应起来
/// 在一个style的生命周期里widget只会进行polish和unpolish各一次
/// 所以我们可以在polish时将widget与一个新的动画绑定并且对应的在unpolish中解绑定
void CustomStyle_pushbutton_2::polish(QWidget *widget)
{
return QProxyStyle::polish(widget);
}
void CustomStyle_pushbutton_2::polish(QApplication *application)
{
return QProxyStyle::polish(application);
}
void CustomStyle_pushbutton_2::polish(QPalette &palette)
{
return QProxyStyle::polish(palette);
}
void CustomStyle_pushbutton_2::unpolish(QWidget *widget)
{
return QProxyStyle::unpolish(widget);
}
void CustomStyle_pushbutton_2::unpolish(QApplication *application)
{
return QProxyStyle::unpolish(application);
}
QSize CustomStyle_pushbutton_2::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
{
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
}
QIcon CustomStyle_pushbutton_2::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
QPalette CustomStyle_pushbutton_2::standardPalette() const
{
return QProxyStyle::standardPalette();
}
int CustomStyle_pushbutton_2::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
QRect CustomStyle_pushbutton_2::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
{
return QProxyStyle::subControlRect(control, option, subControl, widget);
}
QRect CustomStyle_pushbutton_2::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::subElementRect(element, option, widget);
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CUSTOMSTYLE_PUSHBUTTON_2_H
#define CUSTOMSTYLE_PUSHBUTTON_2_H
#include <QProxyStyle>
class CustomStyle_pushbutton_2 : public QProxyStyle
{
Q_OBJECT
public:
explicit CustomStyle_pushbutton_2(const QString &proxyStyleName = "windows", QObject *parent = nullptr);
virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
/*!
* \brief drawPrimitive
* \param element PE枚举类型
* \param option
* \param painter
* \param widget
* \details
* drawPrimitive用于绘制控件背景
*
* hover和点击效果
*/
virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const;
virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const;
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const;
//virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget);
virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const;
virtual void polish(QWidget *widget);
virtual void polish(QApplication *application);
virtual void polish(QPalette &palette);
virtual void unpolish(QWidget *widget);
virtual void unpolish(QApplication *application);
virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const;
virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
virtual QPalette standardPalette() const;
virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const;
virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const;
virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const;
signals:
public slots:
private:
};
#endif // CUSTOMSTYLE_PUSHBUTTON_2_H

View File

@ -0,0 +1,187 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "customstyleSearchPushbutton.h"
#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QDebug>
customstyle_search_pushbutton::customstyle_search_pushbutton(const QString &proxyStyleName, QObject *parent) : QProxyStyle (proxyStyleName)
{
Q_UNUSED(parent);
}
void customstyle_search_pushbutton::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
return QProxyStyle::drawComplexControl(control, option, painter, widget);
}
void customstyle_search_pushbutton::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case QStyle::CE_PushButton: {
QStyleOptionButton button = *qstyleoption_cast<const QStyleOptionButton *>(option);
button.palette.setColor(QPalette::HighlightedText, button.palette.buttonText().color());
return QProxyStyle::drawControl(element, &button, painter, widget);
break;
}
default:
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
void customstyle_search_pushbutton::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
}
void customstyle_search_pushbutton::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
{
return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
}
/// 我们重写button的绘制方法通过state和当前动画的状态以及value值改变相关的绘制条件
/// 这里通过判断hover与否动态的调整painter的透明度然后绘制背景
/// 需要注意的是,默认控件的绘制流程只会触发一次,而动画需要我们在一段时间内不停绘制才行,
/// 要使得动画能够持续我们需要使用QWidget::update()在动画未完成时,
/// 手动更新一次这样button将在一段时间后再次调用draw方法从而达到更新动画的效果
///
/// 需要注意绘制背景的流程会因主题不同而产生差异,所以这一部分代码在一些主题中未必正常,
/// 如果你需要自己实现一个主题,这同样是你需要注意和考虑的点
void customstyle_search_pushbutton::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
if (element == PE_PanelButtonCommand) {
if (widget) {
if (option->state & State_MouseOver) {
if (option->state & State_Sunken) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,21);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,31);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(19,19,20,0);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
return;
}
}
return QProxyStyle::drawPrimitive(element, option, painter, widget);
}
QPixmap customstyle_search_pushbutton::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
{
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
}
QStyle::SubControl customstyle_search_pushbutton::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
{
return QProxyStyle::hitTestComplexControl(control, option, position, widget);
}
QRect customstyle_search_pushbutton::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
}
QRect customstyle_search_pushbutton::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
{
return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
}
int customstyle_search_pushbutton::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::pixelMetric(metric, option, widget);
}
/// 我们需要将动画与widget一一对应起来
/// 在一个style的生命周期里widget只会进行polish和unpolish各一次
/// 所以我们可以在polish时将widget与一个新的动画绑定并且对应的在unpolish中解绑定
void customstyle_search_pushbutton::polish(QWidget *widget)
{
return QProxyStyle::polish(widget);
}
void customstyle_search_pushbutton::polish(QApplication *application)
{
return QProxyStyle::polish(application);
}
void customstyle_search_pushbutton::polish(QPalette &palette)
{
return QProxyStyle::polish(palette);
}
void customstyle_search_pushbutton::unpolish(QWidget *widget)
{
return QProxyStyle::unpolish(widget);
}
void customstyle_search_pushbutton::unpolish(QApplication *application)
{
return QProxyStyle::unpolish(application);
}
QSize customstyle_search_pushbutton::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
{
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
}
QIcon customstyle_search_pushbutton::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
QPalette customstyle_search_pushbutton::standardPalette() const
{
return QProxyStyle::standardPalette();
}
int customstyle_search_pushbutton::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
QRect customstyle_search_pushbutton::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
{
return QProxyStyle::subControlRect(control, option, subControl, widget);
}
QRect customstyle_search_pushbutton::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::subElementRect(element, option, widget);
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CUSTOMSTYLE_SEARCH_PUSHBUTTON_H
#define CUSTOMSTYLE_SEARCH_PUSHBUTTON_H
#include <QProxyStyle>
class customstyle_search_pushbutton : public QProxyStyle
{
Q_OBJECT
public:
explicit customstyle_search_pushbutton(const QString &proxyStyleName = "windows", QObject *parent = nullptr);
virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
/*!
* \brief drawPrimitive
* \param element PE枚举类型
* \param option
* \param painter
* \param widget
* \details
* drawPrimitive用于绘制控件背景
*
* hover和点击效果
*/
virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const;
virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const;
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const;
//virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget);
virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const;
virtual void polish(QWidget *widget);
virtual void polish(QApplication *application);
virtual void polish(QPalette &palette);
virtual void unpolish(QWidget *widget);
virtual void unpolish(QApplication *application);
virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const;
virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
virtual QPalette standardPalette() const;
virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const;
virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const;
virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const;
signals:
public slots:
private:
};
#endif // CUSTOMSTYLE_SEARCH_PUSHBUTTON_H

View File

@ -0,0 +1,176 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "editorwidget.h"
#include <QFile>
#include <QTextFrameFormat>
#include <QTimer>
EditorWidget::EditorWidget()
{
if (QGSettings::isSchemaInstalled("org.ukui.control-center.personalise")) {
m_pTransparency = new QGSettings("org.ukui.control-center.personalise");
m_tranSparency = m_pTransparency->get("transparency").toDouble();
connect(m_pTransparency, &QGSettings::changed, this, [=](QString value) {
if (value == "transparency") {
m_tranSparency = m_pTransparency->get("transparency").toDouble();
this->update();
}
});
}
if (QGSettings::isSchemaInstalled("org.ukui.style")) {
m_pFont = new QGSettings("org.ukui.style");
m_Fontsize = m_pFont->get("system-font-size").toInt();
connect(m_pFont, &QGSettings::changed, this, [=](QString value) {
m_Fontsize = m_pFont->get("system-font-size").toInt();
QFont font = m_ptileLable->font();
font.setPixelSize(9 + m_Fontsize);
font.setFamily("Noto Sans CJK SC");
m_ptileLable->setFont(font);
this->update();
});
}
installEventFilter(this);
this->setFixedSize(400, 338);
this->setContentsMargins(0, 0, 0, 0);
this->setWindowTitle(QObject::tr("edit box"));
this->setWindowIcon(QIcon::fromTheme("kylin-clipboard"));
this->setWindowModality(Qt::NonModal);
this->setProperty("useSystemStyleBlur", true);
m_pMainQVBoxLayout = new QVBoxLayout();
m_pMainQVBoxLayout->setContentsMargins(0, 0, 0, 0);
editBox();
operationBox();
m_pConfirmButton->setObjectName("ConfirmButton");
m_pCancelButton->setObjectName("CancelButton");
connect(m_pConfirmButton, &QPushButton::clicked, this, &EditorWidget::accept);
connect(m_pCancelButton, &QPushButton::clicked, this, &EditorWidget::reject);
connect(m_pConfirmButton, &QPushButton::clicked, globalClipboardSignal, &ClipboardSignal::CLipBoardEditConfirmButtonSignal);
connect(m_pCancelButton, &QPushButton::clicked, globalClipboardSignal, &ClipboardSignal::CLipBoardEditConfirmButtonSignal);
m_pEditingArea->setObjectName("EditingArea");
m_pEditingArea->setAcceptRichText(false);
m_pEditWidget->setObjectName("EditBox");
m_pOperationWidget->setObjectName("OperationBox");
this->setObjectName("EditorWidget");
m_pMainQVBoxLayout->setContentsMargins(18, 0, 0, 0);
m_pMainQVBoxLayout->addItem(new QSpacerItem(20, 24));
m_pMainQVBoxLayout->addWidget(m_pEditWidget);
m_pMainQVBoxLayout->addItem(new QSpacerItem(20, 15));
m_pMainQVBoxLayout->addWidget(m_pOperationWidget);
m_pMainQVBoxLayout->addItem(new QSpacerItem(20, 18));
m_pMainQVBoxLayout->setSpacing(0);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
QScreen* pScreen = QGuiApplication::primaryScreen();
QRect ScreenSize = pScreen->availableGeometry();
int m_nScreenWidth = ScreenSize.width(); //屏幕分辨率的宽
int m_nScreenHeight = ScreenSize.height(); //屏幕分辨率的高
move(m_nScreenWidth/2-130, m_nScreenHeight/2-180);
setLayout(m_pMainQVBoxLayout);
setAttribute(Qt::WA_TranslucentBackground);
}
/* 标题和编辑框界面 */
void EditorWidget::editBox()
{
m_pEditingArea = new QTextEdit();
m_pEditingArea->setFixedSize(362, 200);
m_pEditingArea->setFrameShape(QFrame::NoFrame);
QColor color(255,255,255,16);
QPalette paletteTextEdit = m_pEditingArea->palette();
paletteTextEdit.setBrush(QPalette::Base, color);
m_pEditingArea->setPalette(paletteTextEdit);
m_ptileLable = new QLabel(QObject::tr("Edit"));
m_ptileLable->setFixedHeight(25);
QTimer::singleShot(1, m_ptileLable, [=](){
QFont font = m_ptileLable->font();
font.setPixelSize(9 + m_Fontsize);
font.setFamily("Noto Sans CJK SC");
m_ptileLable->setFont(font);
});
m_pEditLaout = new QVBoxLayout;
m_pEditLaout->addWidget(m_ptileLable);
m_pEditLaout->addItem(new QSpacerItem(12, 22));
m_pEditLaout->addWidget(m_pEditingArea);
m_pEditLaout->setSpacing(0);
m_pEditWidget = new QWidget();
m_pEditWidget->setAttribute(Qt::WA_TranslucentBackground);
m_pEditWidget->setLayout(m_pEditLaout);
m_pEditLaout->setContentsMargins(0, 0, 0, 0);
return;
}
/* 确认和取消按钮 */
void EditorWidget::operationBox()
{
m_pConfirmButton = new QPushButton(QObject::tr("Confirm"));
m_pConfirmButton->setFixedSize(120, 34);
m_pConfirmButton->setStyle(new CustomStyle("ukui-default"));
m_pCancelButton = new QPushButton(QObject::tr("Cancel"));
m_pCancelButton->setFixedSize(120, 34);
m_pCancelButton->setStyle(new CustomStyle_pushbutton_2("ukui-default") );
m_pOperationLayout = new QHBoxLayout;
m_pOperationLayout->setContentsMargins(0, 0, 0, 0);
m_pOperationLayout->addItem(new QSpacerItem(106, 20, QSizePolicy::Expanding));
m_pOperationLayout->addWidget(m_pCancelButton);
m_pOperationLayout->addItem(new QSpacerItem(16, 20));
m_pOperationLayout->addWidget(m_pConfirmButton);
m_pOperationLayout->addItem(new QSpacerItem(20, 20));
m_pOperationLayout->setSpacing(0);
m_pOperationWidget = new QWidget();
m_pOperationWidget->setContentsMargins(0, 0, 0, 0);
m_pOperationWidget->setLayout(m_pOperationLayout);
return;
}
/* 重绘时间 */
void EditorWidget::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
p.setBrush(opt.palette.color(QPalette::Base));
p.setOpacity(m_tranSparency);
p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.drawRoundedRect(opt.rect,6,6);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
void EditorWidget::enterEvent(QEvent *event)
{
Q_UNUSED(event);
if (!isActiveWindow()) {
activateWindow();
}
}
void EditorWidget::closeEvent(QCloseEvent *event)
{
Q_UNUSED(event);
}

View File

@ -0,0 +1,77 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef EDITORWIDGET_H
#define EDITORWIDGET_H
#include <QWidget>
#include <QObject>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QTextEdit>
#include <QGroupBox>
#include <QLabel>
#include <QFont>
#include <QGuiApplication>
#include <QScreen>
#include <QRect>
#include <QDebug>
#include <QStyleOption>
#include <QPainter>
#include <QDialog>
#include <QGSettings>
#include "customstyle.h"
#include "customstylePushbutton2.h"
#include "clipboardsignal.h"
#define SIDEBAR_EDITAREA_QSS_PATH ":/qss/sideBarEditArea.css"
extern ClipboardSignal *globalClipboardSignal;
class EditorWidget :public QDialog
{
public:
explicit EditorWidget();
QPushButton *m_pConfirmButton;
QPushButton *m_pCancelButton;
QTextEdit *m_pEditingArea;
QLabel *m_ptileLable;
QGroupBox *m_pEditBox;
QWidget *m_pEditWidget;
QGroupBox *m_pOperationBox;
QWidget *m_pOperationWidget;
QVBoxLayout *m_pMainQVBoxLayout; //主界面垂直布局器
QHBoxLayout *m_ptileLayout;
QVBoxLayout *m_pEditLaout;
QHBoxLayout *m_pOperationLayout;
QGSettings *m_pTransparency; // 插件的界面的透明度
QGSettings *m_pFont; // 插件的界面的透明度
double m_tranSparency = 1.0;
int m_Fontsize;
void titleBox();
void editBox();
void operationBox();
protected:
void paintEvent(QPaintEvent *);
void enterEvent(QEvent *event);
void closeEvent(QCloseEvent *event);
};
#endif // EDITORWIDGET_H

View File

@ -0,0 +1,25 @@
{
"txt": "text-x-generic",
"svg": "image-svg+xml",
"png": "image-x-generic",
"jpg": "image-x-generic",
"jpeg": "image-x-generic",
"bmp": "image-x-generic",
"gif": "image-x-generic",
"psd": "image-x-generic",
"xml": "text-xml",
"docx": "document",
"pptx": "application-mspowerpoint",
"xlsx": "application-msexcel",
"pdf": "application-pdf",
"zip": "application-zip",
"tar": "application-x-compressed-tar",
"7z": "application-x-compressed-tar",
"bz": "application-x-compressed-tar",
"car": "application-x-compressed-tar",
"cpgz": "application-x-compressed-tar",
"hbc": "application-x-compressed-tar",
"gz": "application-x-compressed-tar",
"xz": "application-x-compressed-tar"
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<polygon class="st0" points="15,6.8 14.2,6 10.5,9.8 6.7,6 6,6.7 9.8,10.5 6,14.3 6.7,15 10.5,11.2 14.2,15 15,14.2 11.2,10.5 "/>
</svg>

After

Width:  |  Height:  |  Size: 543 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.12;fill:#FFFFFF;}
.st1{fill:#FFFFFF;}
</style>
<circle class="st0" cx="10.5" cy="10.5" r="10.5"/>
<polygon class="st1" points="15,6.8 14.2,6 10.5,9.8 6.7,6 6,6.7 9.8,10.5 6,14.3 6.7,15 10.5,11.2 14.2,15 15,14.2 11.2,10.5 "/>
</svg>

After

Width:  |  Height:  |  Size: 630 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 9 9" style="enable-background:new 0 0 9 9;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;enable-background:new ;}
</style>
<polygon class="st0" points="9,0.8 8.2,0 4.5,3.8 0.7,0 0,0.7 3.8,4.5 0,8.3 0.7,9 4.5,5.2 8.2,9 9,8.2 5.2,4.5 "/>
</svg>

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="文档" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g>
<path class="st0" d="M12,2L12,2c0-1.1-0.9-2-2-2L3,0C1.9,0,1,0.9,1,2v10c0,1.1,0.9,2,2,2h1v0c0,1.1,0.9,2,2,2h4.7l4.3-4.3V4
c0-1.1-0.9-2-2-2H12z M2,12V2c0-0.6,0.4-1,1-1h7c0.6,0,1,0.4,1,1H6C4.9,2,4,2.9,4,4v9H3C2.4,13,2,12.6,2,12z M5,14V4
c0-0.6,0.4-1,1-1h7c0.6,0,1,0.4,1,1v7h-4v4H6C5.4,15,5,14.6,5,14z M13.3,12L11,14.3V12H13.3z"/>
<rect x="6" y="5" class="st0" width="7" height="1"/>
<rect x="6" y="7" class="st0" width="7" height="1"/>
<rect x="6" y="9" class="st0" width="3" height="1"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 924 B

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g>
<path class="st0" d="M6,5L6,5c0.6,0,1,0.4,1,1v5c0,0.6-0.4,1-1,1l0,0c-0.6,0-1-0.4-1-1V6C5,5.4,5.4,5,6,5z"/>
<path class="st0" d="M10,5L10,5c0.6,0,1,0.4,1,1v5c0,0.6-0.4,1-1,1l0,0c-0.6,0-1-0.4-1-1V6C9,5.4,9.4,5,10,5z"/>
<path class="st0" d="M16,2h-5V1c0-0.6-0.4-1-1-1H6C5.4,0,5,0.4,5,1v1H0v1h2v10c0,1.1,0.9,2,2,2h8c1.1,0,2-0.9,2-2V3h2V2z M6,1h4v1
H6V1z M12,14H4c-0.6,0-1-0.4-1-1V3h10v10C13,13.6,12.6,14,12,14z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 845 B

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="svg7384" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g>
<rect x="12" y="9" class="st0" width="3" height="1"/>
<rect x="10" y="11" class="st0" width="5" height="1"/>
<rect x="8" y="13" class="st0" width="7" height="1"/>
<path class="st0" d="M13.6,2.4c-0.8-0.8-2-0.7-2.7,0l-7.9,8.1c-0.1,0.1-0.3,0.4-0.6,1.1c-0.3,0.6-0.7,1.5-1,2.5L1,15l0.9-0.3
c0.9-0.3,1.7-0.6,2.5-1c0.6-0.3,1-0.5,1.1-0.6l8.1-7.9C14.4,4.4,14.4,3.2,13.6,2.4L13.6,2.4z M4.8,12.2C4.8,12.2,4.8,12.2,4.8,12.2
l-1.1-1.1c0,0,0,0,0,0L11.6,3c0.3-0.3,0.8-0.3,1.2,0l0,0c0.4,0.4,0.4,1,0,1.4L4.8,12.2z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 939 B

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="&#x56FE;&#x5C42;_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" viewBox="0 0 256 256" style="enable-background:new 0 0 256 256;" xml:space="preserve">
<title>画板 18</title>
<g id="&#x63A7;&#x5236;&#x9762;&#x677F;">
<g id="&#x65F6;&#x95F4;">
<g id="_256">
<g id="&#x65F6;&#x949F;">
<path style="opacity:0.08;enable-background:new ;" d="M130,254C61.517,254,6,198.483,6,130S61.517,6,130,6
s124,55.517,124,124C253.923,198.451,198.451,253.923,130,254z"/>
<path style="opacity:0.1;enable-background:new ;" d="M130,252C62.621,252,8,197.379,8,130S62.621,8,130,8
s122,54.621,122,122C251.923,197.347,197.347,251.923,130,252z"/>
<path style="opacity:0.2;enable-background:new ;" d="M128,250C60.621,250,6,195.379,6,128S60.621,6,128,6
s122,54.621,122,122C249.923,195.347,195.347,249.923,128,250z"/>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="128" y1="90" x2="128" y2="-150" gradientTransform="matrix(1 0 0 1 0 158)">
<stop offset="0" style="stop-color:#CFD8DC"/>
<stop offset="1" style="stop-color:#FFFFFF"/>
</linearGradient>
<circle style="fill:url(#SVGID_1_);" cx="128" cy="128" r="120"/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="128" y1="-150" x2="128" y2="90" gradientTransform="matrix(1 0 0 1 0 158)">
<stop offset="0" style="stop-color:#4DD0E1"/>
<stop offset="1" style="stop-color:#0097A7"/>
</linearGradient>
<path style="fill:url(#SVGID_2_);" d="M128,18c60.751,0.002,109.998,49.252,109.997,110.003
c-0.001,29.172-11.589,57.148-32.217,77.777c-43.245,42.669-112.891,42.202-155.56-1.043
C7.955,161.902,7.955,93.055,50.22,50.22C70.803,29.523,98.811,17.921,128,18 M128,8C61.726,8,8,61.726,8,128
s53.726,120,120,120s120-53.726,120-120S194.274,8,128,8z"/>
<circle style="fill:#4D5D6A;" cx="128" cy="128" r="10.53"/>
<line style="fill:none;stroke:#4D5D6A;stroke-width:8;stroke-miterlimit:10;" x1="142.32" y1="115.58" x2="84.32" y2="165.89"/>
<line style="fill:none;stroke:#4D5D6A;stroke-width:6;stroke-miterlimit:10;" x1="137.07" y1="143.8" x2="98.7" y2="47.57"/>
<line style="fill:none;stroke:#E67A70;stroke-width:3;stroke-miterlimit:10;" x1="117.47" y1="116.93" x2="182.21" y2="183.26"/>
<path style="fill:#455A64;" d="M128,133.66c-3.126,0-5.66-2.534-5.66-5.66l0,0c0.131-3.123,2.77-5.548,5.893-5.417
c2.939,0.124,5.293,2.478,5.417,5.417C133.65,131.122,131.122,133.654,128,133.66z"/>
<path style="fill:#E67A70;" d="M128,123.84c2.212,0.195,3.965,1.948,4.16,4.16c-0.113,2.295-2.064,4.064-4.359,3.951
c-2.137-0.105-3.846-1.814-3.951-3.951c0.195-2.212,1.948-3.965,4.16-4.16 M128.01,120.84c-3.871,0.195-6.965,3.289-7.16,7.16
c0.148,3.952,3.471,7.035,7.423,6.887c3.744-0.14,6.747-3.143,6.887-6.887c-0.191-3.873-3.287-6.969-7.16-7.16H128.01z"/>
<circle style="fill:#455A64;" cx="128" cy="35.65" r="8.05"/>
<circle style="fill:#455A64;" cx="128" cy="221.4" r="8.05"/>
<circle style="fill:#455A64;" cx="35.13" cy="128.53" r="8.05"/>
<circle style="fill:#455A64;" cx="220.87" cy="128.53" r="8.05"/>
<path style="fill:#4D5D6A;" d="M171.65,210l5.58-3.22l-9.79-17c-1.81,1.16-3.65,2.25-5.56,3.24L171.65,210z"/>
<path style="fill:#4D5D6A;" d="M84.35,45.95l-5.58,3.22l9.79,17c1.81-1.16,3.65-2.25,5.56-3.25L84.35,45.95z"/>
<path style="fill:#4D5D6A;" d="M49.18,78.76L46,84.34l16.93,9.78c1-1.91,2.09-3.76,3.24-5.56L49.18,78.76z"/>
<path style="fill:#4D5D6A;" d="M206.82,177.22l3.22-5.58l-16.93-9.78c-1,1.91-2.09,3.76-3.24,5.56L206.82,177.22z"/>
<path style="fill:#4D5D6A;" d="M46,171.64l3.22,5.58l17-9.79c-1.16-1.81-2.25-3.66-3.24-5.57L46,171.64z"/>
<path style="fill:#4D5D6A;" d="M210,84.34l-3.22-5.58l-17,9.79c1.16,1.81,2.25,3.66,3.24,5.57L210,84.34z"/>
<path style="fill:#4D5D6A;" d="M177.23,49.17l-5.58-3.22l-9.77,16.93c1.91,1,3.76,2.09,5.56,3.25L177.23,49.17z"/>
<path style="fill:#4D5D6A;" d="M78.77,206.81l5.58,3.19l9.78-16.93c-1.91-1-3.76-2.09-5.56-3.24L78.77,206.81z"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,65 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "pixmaplabel.h"
pixmapLabel::pixmapLabel()
{
}
void pixmapLabel::setPixmapList(const QList<QPixmap> &list)
{
m_pixmapList = list;
update();
}
void pixmapLabel::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(Qt::transparent);
QStyle *style = QWidget::style();
QStyleOption opt;
opt.initFrom(this);
int x = 4;
int y = 4;
//drawPixmaps
if (m_pixmapList.size() == 1) {
QPixmap pix = m_pixmapList[0];
if (!isEnabled())
pix = style->generatedIconPixmap(QIcon::Disabled, pix, &opt);
QPixmap newPix = pix.scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
style->drawItemPixmap(&painter, QRect(QPoint(4, 4), newPix.size()), Qt::AlignCenter, newPix);
} else {
for (int i = 0 ; i < m_pixmapList.size(); ++i) {
QPixmap pix = m_pixmapList[m_pixmapList.size() - i - 1];
if (pix.size() == QSize(0, 0))
continue;
if (!isEnabled())
pix = style->generatedIconPixmap(QIcon::Disabled, pix, &opt);
QPixmap newPix = pix.scaled(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
style->drawItemPixmap(&painter, QRect(QPoint(x, y), newPix.size()), Qt::AlignCenter, newPix);
x += 2;
y += 2;
}
}
return;
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef PIXMAPLABEL_H
#define PIXMAPLABEL_H
#include <QObject>
#include <QWidget>
#include <QLabel>
#include <QPainter>
#include <QStyle>
#include <QStyleOption>
class pixmapLabel : public QLabel
{
Q_OBJECT
public:
pixmapLabel();
QList<QPixmap> m_pixmapList;
void setPixmapList(const QList<QPixmap> &list);
protected:
void paintEvent(QPaintEvent *event);
};
#endif // PIXMAPLABEL_H

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "previewimagewidget.h"
previewImageWidget::previewImageWidget(QPixmap *pixmap, QWidget *parent)
{
Q_UNUSED(parent);
m_pLabel = new QLabel();
m_pLabel->setFixedSize(260, 130);
int width = m_pLabel->width();
int height = m_pLabel->height();
QPixmap fitpixmap = (*pixmap).scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); // 饱满填充
m_pLabel->setPixmap(fitpixmap);
m_pVlaout = new QVBoxLayout();
this->setContentsMargins(0, 0, 0, 0);
m_pVlaout->setContentsMargins(0, 0, 0, 0);
m_pVlaout->addWidget(m_pLabel);
this->setLayout(m_pVlaout);
this->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef PREVIEWIMAGEWIDGET_H
#define PREVIEWIMAGEWIDGET_H
#include <QObject>
#include <QWidget>
#include <QLabel>
#include <QVBoxLayout>
#include <QPixmap>
class previewImageWidget : public QWidget
{
Q_OBJECT
public:
previewImageWidget(QPixmap *pixmap, QWidget *parent = nullptr);
QLabel *m_pLabel;
QVBoxLayout *m_pVlaout;
};
#endif // PREVIEWIMAGEWIDGET_H

View File

@ -0,0 +1,55 @@
/* 编辑区域 */
QGroupBox#EditBox {
width:362px;
height:200px;
margin-right: 20px;
margin-bottom: 5px;
margin-left: 3px;
margin-top: 45px;
padding-top:0px;
padding-bottom:0px;
padding-left:0px;
padding-right:0px;
background:rgba(255,255,255,0.06);
opacity:0.06;
border-radius:3px;
border: 0px solid rgba(255,255,0,1);
font-size:20px;
font-family:Noto Sans CJK SC;
font-weight:400;
color:rgba(255,255,255,1);
line-height:40px;
opacity:0.91;
}
/* 操作区域,确认取消 */
QGroupBox#OperationBox {
width:362px;
height:40px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 20px;
margin-top: 0px;
border-radius:0px;
padding-top:0px;
padding-bottom:0px;
color:rgba(255,255,255,1);
border: 0px;
}
/* 编辑WIdget的编辑区域 */
QGroupBox#EditBox>QTextEdit#EditingArea {
font-size:14px;
font-weight:400;
font-family:Noto Sans CJK SC;
color:rgba(255,255,255,1);
width:340px;
height:180px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-top: 0px;
background-color:rgba(255,255,255,0.01);
border: 0px solid rgba(255,0,0,1);
}

View File

@ -0,0 +1,58 @@
/* 搜索栏的Widget */
QWidget#SearhWidget{
width:380px;
height:40;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom:0px;
padding-left:0px;
background:rgba(19, 19, 20, 1);
opacity:0;
border: 0px solid rgba(255,255,0,1);
}
/* 清空所有的WidgetItem按扭 */
QWidget#SearhWidget>QPushButton#CleanList {
width:80px;
height:34px;
margin-top:0px;
margin-left:5px;
margin-bottom:0px;
margin-right:10px;
font-size:11px;
font-family:Noto Sans CJK SC;
font-weight:400;
color:rgba(255,255,255,1);
line-height:24px;
opacity:0.91;
border:0px solid rgba(255,0,0,1);
}
/* 清空所有的WidgetItem按扭悬浮时的效果 */
QWidget#SearhWidget>QPushButton#CleanList:hover{
background-color:rgba(255,255,255,36); /*改变背景色*/
border-style:inset; /*改变边框风格*/
border: 0px solid rgba(255,0,0,1);
}
/* 清空所有的WidgetItem按扭按下时的效果 */
QWidget#SearhWidget>QPushButton#CleanList:pressed{
background-color:rgba(255,255,255,25); /*改变背景色*/
border-style:inset;/*改变边框风格*/
border: 0px solid rgba(255,0,0,1);
}
/* 清空所有的QlineEdit按扭 */
QLineEdit#SearchLabel>QPushButton#ClearTextButton {
width:9px;
height:9px;
border-radius:9px;
border:0px solid rgba(255,255,0,1);
}

View File

@ -0,0 +1,315 @@
QPalette{background:#131314;}
/* 搜索栏的Widget */
/*QWidget#SearhWidget {
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom:0px;
padding-left:0px;
width:380px;
height:40;
background:rgba(19, 19, 20, 0);
opacity:0;
border: 1px solid rgba(255,255,0,1);
}*/
/* listWidget的中的widgetitem */
QWidget#WidgetEntry {
width:400px;
height:42px;
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom:0px;
padding-left:0px;
background:rgba(255, 255, 255, 0);
border: 0px solid rgba(255,0,0,1);
opacity:0.08;
border-bottom: 1px solid rgba(255,255,255,0.08);
}
/* 设置listWidget的中的widgetitem悬乎状态 */
/*QWidget#WidgetEntry:hover {
background:rgba(255, 255, 255, 0.08);
}*/
/* 显示内容条目Widget中的置顶按钮 */
/*QWidget#WidgetEntry>QPushButton#PopButton {
width:34px;
height:34px;
margin-bottom: 0px;
margin-top: 0px;
margin-right: 0px;
margin-left: 0px;
border: 0px solid rgba(255,0,0,1);
background:rgba(255,255,255,30);
opacity:0.12;
border-radius:3px;
}
QWidget#WidgetEntry>QPushButton#PopButton:hover {
background-color:rgba(255,255,255,36);
opacity:0.2;
border: 0px solid rgba(255,0,0,1);
}
QWidget#WidgetEntry>QPushButton#PopButton:pressed {
background-color:rgba(255,255,255,0.08);
opacity:0.08;
border: 0px solid rgba(255,0,0,1);
}*/
/* 显示内容条目Widget中的编辑按钮 */
/*QWidget#WidgetEntry>QPushButton#EditButon {
width:34px;
height:34px;
margin-bottom: 0px;
margin-top: 0px;
margin-right: 0px;
margin-left: 0px;
border: 0px solid rgba(255,0,0,1);
background:rgba(255,255,255,30);
opacity:0.12;
border-radius:3px;
}*/
/* 显示内容条目Widget中的置编辑钮悬乎 */
/*QWidget#WidgetEntry>QPushButton#EditButon:hover {
background-color:rgba(255,255,255,36);
border-radius:3px;
opacity:0.2;
border: 0px solid rgba(255,0,0,1);
}*/
/* 显示内容条目Widget中的编辑按钮按下 */
/*QWidget#WidgetEntry>QPushButton#EditButon:pressed {
background-color:rgba(255,255,255,25);
border-radius:3px;
opacity:0.08;
border: 0px solid rgba(255,0,0,1);
}*/
/* 显示内容条目Widget中的删除按钮 */
/*QWidget#WidgetEntry>QPushButton#RemoveButton {
width: 34px;
height: 34px;
margin-bottom: 0px;
margin-top: 0px;
margin-right: 0px;
margin-left: 0px;
border: 0px solid rgba(255,0,0,1);
background:rgba(255,255,255,30);
opacity: 0.12;
border-radius: 3px;
}*/
/* 显示内容条目Widget中的删除按钮悬乎 */
/*QWidget#WidgetEntry>QPushButton#RemoveButton:hover {
background-color:rgba(255,255,255,36);
opacity:0.2;
border-radius:3px;
border: 0px solid rgba(255,0,0,1);
}*/
/* 显示内容条目Widget中的删除按钮按下 */
/*QWidget#WidgetEntry>QPushButton#RemoveButton:pressed {
background-color:rgba(255,255,255,0.08);
opacity:0.08;
border: 0px solid rgba(255,0,0,1);
}*/
/* 清空所有的WidgetItem按扭 */
/*QWidget#SearhWidget>QPushButton#CleanList {
width:80px;
height:34px;
margin-top:0px;
margin-left:0px;
margin-bottom:0px;
margin-right:0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom:0px;
padding-left:0px;
border-radius:4px;
font-size:14px;
font-family:Noto Sans CJK SC;
font-weight:400;
color:rgba(255,255,255,1);
line-height:24px;
opacity:0.91;
border:0px solid rgba(255,0,0,1);
}*/
/* 清空所有的WidgetItem按扭悬浮时的效果 */
/*QWidget#SearhWidget>QPushButton#CleanList:hover{
background-color:rgba(255,255,255,36);
border-style:inset;
border: 0px solid rgba(255,0,0,1);
}*/
/* 清空所有的WidgetItem按扭按下时的效果 */
/*QWidget#SearhWidget>QPushButton#CleanList:pressed{
background-color:rgba(255,255,255,25);
border-style:inset;
border: 0px solid rgba(255,0,0,1);
}*/
/* 清空所有的QlineEdit按扭 */
QLineEdit#SearchLabel>QPushButton#ClearTextButton {
margin-top:0px;
margin-left:0px;
margin-bottom:2px;
margin-right:0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom:0px;
padding-left:0px;
border-radius:0.5px;
border:0px solid rgba(255,255,0,1);
}
/* 查找栏的Lable */
/*QWidget#SearhWidget>QLineEdit#SearchLabel {
width:280px;
height:30px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom:0px;
padding-left:3px;
background:rgba(0,0,0,0.2);
border:0px solid rgba(61,107,229,1);
border-radius:4px;
font-size:14px;
font-family:Noto Sans CJK SC;
font-weight:400;
color:rgba(255,255,255,1);
line-height:24px;
opacity:0.91;
}*/
/* 查找栏的Lable悬乎状态 */
/*QWidget#SearhWidget>QLineEdit#SearchLabel:hover {
border-style:inset;
border: 1px solid rgba(61,107,229,1);
border-radius:4px;
}*/
/* 查找栏的Lable焦点状态 */
/*QWidget#SearhWidget>QLineEdit#SearchLabel:focus {
border-style:inset;
border: 1px solid rgba(28, 47, 146, 1);
border-radius:4px;
}*/
/* 显示所有剪贴内容的WidgetList大小 */
QListWidget#ShortcutOperationList {
width:400px;
height:760px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-top: 0px;
padding-top:0px;
padding-bottom:0px;
padding-left:0px;
padding-right:0px;
background:rgba(19, 19, 20, 0);
opacity:0;
border:0px;
}
QListWidget#SearchWidgetListWidget {
width:400px;
height:34px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-top: 2px;
padding-top:0px;
padding-bottom:0px;
padding-left:0px;
padding-right:0px;
background:rgba(19, 19, 20, 0);
opacity:0;
border: 0px solid rgba(255,0,255,0);
border:0px;
}
/* widget条目的Lable */
/*QWidget#WidgetEntry>QLabel#EntryLable {
width:200px;
height:34px;
font-size:15px;
font-weight:400;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom:0px;
padding-left:3px;
font-size:14px;
font-family:Noto Sans CJK SC;
font-weight:400;
color:rgba(255,255,255,1);
line-height:40px;
opacity:0.91;
}*/
QListWidget:Item{
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom:0px;
padding-left:0px;
background:rgba(19, 19, 20, 0);
border: 0px solid rgba(255,255,0,1);
}
/* 无剪贴板内容字样 */
/*QLabel#SideBarClipboardLable{
width:70px;
height:14px;
margin-top:50px;
margin-left:165px;
margin-bottom:100px;
margin-right:132px;
font-size:14px;
font-family:Noto Sans CJK SC;
font-weight:400;
color:rgba(255,255,255,1);
line-height:28px;
opacity:0.57;
}*/

View File

@ -0,0 +1,99 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "searchwidgetitemcontent.h"
#include <QApplication>
#include <QStyle>
#include <QFile>
SearchWidgetItemContent::SearchWidgetItemContent(QWidget *parent)
{
Q_UNUSED(parent);
this->setObjectName("SearhWidget");
this->setContentsMargins(0,0,0,0);
m_pClearListWidgetButton = new QPushButton(tr("Clear"));
m_pClearListWidgetButton->setFixedSize(80, 34);
m_pClearListWidgetButton->setStyle(new customstyle_search_pushbutton("ukui-default"));
m_pClearListWidgetButton->setObjectName("CleanList");
m_pClearTextButton = new QPushButton;
m_pClearTextButton->setFixedSize(19, 21);
m_pClearTextButton->setIconSize(QSize(9, 9));
m_pClearTextButton->setObjectName("ClearTextButton");
m_pClearTextButton->setStyleSheet("QPushButton:pressed{border-image:url(:/image/button-close-hover-click-add-background-one.svg)}");
m_pClearTextButton->setStyleSheet("QPushButton:hover{border-image:url(:/image/button-close-hover-click-add-background-one.svg)}");
QIcon ClearTextEditIcon;
ClearTextEditIcon.addFile(SEARCH_SVG_CLEAN);
m_pClearTextButton->setIcon(ClearTextEditIcon);
m_pClearTextButton->setCursor(Qt::ArrowCursor);
m_pHBoxLayout = new QHBoxLayout;
m_pHBoxLayout->setContentsMargins(0,0,0,0);
m_pLineEditArea = new QLineEdit;
m_pLineEditArea->setAttribute(Qt::WA_Hover, true);
m_pLineEditArea->setStyle(new CustomStyle(""));
m_pLineEditArea->setFixedSize(264, 40);
m_pLineEditArea->setObjectName("SearchLabel");
m_pLineEditArea->setTextMargins(8, 0, 0, 0);
m_pLineEditArea->setPlaceholderText(tr("search..."));
connect(m_pLineEditArea, &QLineEdit::textChanged, this, &SearchWidgetItemContent::textChageSlots);
/* Sets the font color of the placeholder */
QFont SearchLine;
SearchLine = m_pLineEditArea->font();
SearchLine.setPixelSize(14);
// SearchLine.setFamily("Noto Sans CJK SC");
m_pLineEditArea->setFont(SearchLine);
#if QT_VERSION >= 0x050c00
QBrush LineEditBrush;
QPalette paletteLineEdit;
QColor ColorPlaceholderText(255,255,255,89);
LineEditBrush = paletteLineEdit.placeholderText();
LineEditBrush.setColor(ColorPlaceholderText);
paletteLineEdit.setBrush(QPalette::PlaceholderText, LineEditBrush);
m_pLineEditArea->setPalette(paletteLineEdit);
#endif
QWidgetAction* action = new QWidgetAction(m_pLineEditArea);
action->setDefaultWidget(m_pClearTextButton);
m_pLineEditArea->addAction(action, QLineEdit::TrailingPosition);
m_pClearTextButton->setVisible(false);
connect(m_pClearTextButton, &QPushButton::clicked, this, [=](){
m_pLineEditArea->setText("");
});
m_pHBoxLayout->addItem(new QSpacerItem(10,20));
m_pHBoxLayout->addWidget(m_pLineEditArea);
m_pHBoxLayout->addItem(new QSpacerItem(36,20));
m_pHBoxLayout->addWidget(m_pClearListWidgetButton);
m_pHBoxLayout->addItem(new QSpacerItem(10,20));
m_pHBoxLayout->setSpacing(0);
this->setLayout(m_pHBoxLayout);
}
void SearchWidgetItemContent::textChageSlots(const QString &text)
{
if (text != "") {
m_pClearTextButton->setVisible(true);
} else {
m_pClearTextButton->setVisible(false);
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef SEARCHWIDGETITEMCONTENT_H
#define SEARCHWIDGETITEMCONTENT_H
#include <QObject>
#include <QWidget>
#include <QPushButton>
#include <QLineEdit>
#include <QHBoxLayout>
#include <QAction>
#include <QWidgetAction>
#include <QTranslator>
#include "customstyle.h"
#include "customstyleSearchPushbutton.h"
#include "clipboardwidgetentry.h"
#include "clipboardsignal.h"
extern ClipboardSignal *globalClipboardSignal;
#define SIDEBAR_SEARCH_QSS_PATH ":/qss/sideBarSearchArea.css"
class SearchWidgetItemContent:public QWidget
{
Q_OBJECT
public:
SearchWidgetItemContent(QWidget *parent = nullptr);
QPushButton *m_pClearTextButton;
QPushButton *m_pClearListWidgetButton;
QLineEdit *m_pLineEditArea;
QHBoxLayout *m_pHBoxLayout;
QTranslator *translator;
private slots:
void textChageSlots(const QString &text);
};
#endif // SEARCHWIDGETITEMCONTENT_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,205 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef SIDEBARCLIPBOARDPLUGIN_H
#define SIDEBARCLIPBOARDPLUGIN_H
#include <QGenericPlugin>
#include <QObject>
#include <QHash>
#include <QDebug>
#include <QListWidgetItem>
#include <QListWidget>
#include <QMouseEvent>
#include <QClipboard>
#include <QMimeData>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QStaticText>
#include <QColor>
#include <QLabel>
#include <QByteArray>
#include <QBitmap>
#include <QFileInfo>
#include <QThread>
#include <QProcess>
#include <QScrollBar>
#include <unistd.h>
#include "clipboardpluginiface.h"
#include "clipboardwidgetentry.h"
#include "sidebarclipboardsignal.h"
#include "searchwidgetitemcontent.h"
#include "editorwidget.h"
#include "clipboardsignal.h"
#include "clipboardlisetwidget.h"
#include "cleanpromptbox.h"
#include "clipBoardInternalSignal.h"
#include "clipboarddb.h"
#include "previewimagewidget.h"
#include <QJsonParseError>
#include <QJsonDocument>
#include <QJsonObject>
//#include "clipbaordstructoriginaldata.h"
#define WIDGET_ENTRY_COUNT 10
#define SIDEBAR_CLIPBOARD_QSS_PATH ":/qss/sidebarClipboard.css"
#define TEXT "Text"
#define URL "Url"
#define IMAGE "Image"
#define DBDATA "Dbdata"
#define CLIPBOARD_HEIGHT 385
typedef struct clipboardOriginalDataHash {
ClipboardWidgetEntry* WidgetEntry;
const QMimeData* MimeData;
QPixmap *p_pixmap;
QString text;
QString Clipbaordformat;
QList<QUrl> urls;
int Sequence;
QString associatedDb;
} OriginalDataHashValue;
//static SidebarClipboardPlugin *global_instance = nullptr;
class SidebarClipboardPlugin:public QObject, public ClipboardInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.ukui.sidebar-qt.plugin-iface.ClipboardInterface" FILE "clipboardPlugin.json")
Q_INTERFACES(ClipboardInterface)
public:
SidebarClipboardPlugin(QObject *parent = 0);
//plugin implement 统一接口
const QString name() override {return QObject::tr("ClipBoard");}
PluginType pluginType() override {return PluginType::ClipBoard;}
const QString description() override {return QObject::tr("Show the folder children as icons.");}
const QIcon icon() override {return QIcon::fromTheme("view-grid-symbolic", QIcon::fromTheme("folder"));}
void setEnable(bool enable) override {Q_UNUSED(enable)}
bool isEnable() override {return true;}
/* 剪贴板接口 */
virtual QListWidget* getClipbaordListWidget() override;
virtual SidebarClipBoardSignal* createClipSignal() override;
virtual QWidget* getClipbaordGroupBox() override;
// static SidebarClipboardPlugin *getInstance();
/* 剪贴板成员和成员函数 */
QHash<QListWidgetItem*, OriginalDataHashValue*> m_pClipboardDataHash;
QList<OriginalDataHashValue*> m_ListClipboardData;
QListWidget *m_pShortcutOperationListWidget;
QListWidget *m_pSearchWidgetListWidget;
QGroupBox *m_pSidebarClipboardBox;
QWidget *m_pSidebarClipboardWidget;
QLabel *m_pSideBarClipboardLable;
bool m_bPromptBoxBool;
bool m_bsortEntryBool = true;
QVBoxLayout *m_pClipboardLaout;
QClipboard *m_pSidebarClipboard;
ClipboardSignal *m_pClipSignal;
SearchWidgetItemContent *m_pSearchArea;
QMimeData mineData;
QTranslator *translator;
clipboardDb *m_pClipboardDb;
QThread *m_pThread;
previewImageWidget *m_pPreviewImage = nullptr;
int m_nScreenWidth;
int m_nScreenHeight;
int m_nclipboardsite_x = 1200;
int m_nclipboardsite_y = 0;
int m_taskHeight = 46;
/* 注册Widget界面和Item/lable/剪贴板数据/的关系 */
void registerWidgetOriginalDataHash(QListWidgetItem *key, OriginalDataHashValue *value);
OriginalDataHashValue *GetOriginalDataValue(QListWidgetItem *key);
void removeOriginalDataHash(QListWidgetItem *key);
void sortingEntrySequence();
/* 对m_ListClipboardData链表的操作 */
void inserOriginalDataList(OriginalDataHashValue *value);
void removeOriginalDataList(OriginalDataHashValue *value);
int ItertionOriginalDataList(OriginalDataHashValue *value);
void moveOriginalDataFirstList(OriginalDataHashValue *value);
//void FixOriginalDataFirstList(OriginalDataHashValue *value, QString text, const QMimeData mimedata);
void initFileIconJson();
void removeLastWidgetItem(); /* 限制复制条数 */
bool booleanExistWidgetItem(QString Text); /* 判断在ListWidget是否存在如果不存在则返回fasle创建返回true不创建 */
void createFindClipboardWidgetItem(); /* 创建查找条目 */
void WhetherTopFirst(); /* 设置新置顶的条目写入到剪贴版中去 */
void connectWidgetEntryButton(ClipboardWidgetEntry * w); /* 连接WIdgetEntry条目中三个按钮的槽函数 */
void createTipLable(); /* 创建无剪贴板板字样 */
void createWidget(); /* 创建剪贴板主Widget和搜索栏与条目的ListWidget界面 */
void sortingEntryShow(); /* 將條目有序的展現出來 */
bool booleanExistWidgetImagin(QPixmap Pixmap); /* 判断图片是否在hash表中如果存在则删除然后将图片重新写入到剪贴板中去 */
void creatLoadClipboardDbData(OriginalDataHashValue *value); /* 加载从数据库中拿到的数据,加入到剪贴板 */
bool judgeFileExit(QString fullFilePath); /* 判断此路径下该文件是否存在 */
OriginalDataHashValue *saveOriginalData(OriginalDataHashValue *value); /* 保存OriginalData数据 */
void setOriginalDataSequence(OriginalDataHashValue *value); /* 设置条目的sequence */
void popCreatorDbHaveDate(OriginalDataHashValue *value); /* 加入关联数据库的置顶条目 */
QIcon fileSuffixGetsIcon(QString Url); /* 判断Url中当前后缀名根据后缀名读取图标 */
QIcon fileSuffixeMatchIcon(QString cnt); /* 根据文件名后缀匹配对应的图标 */
void getPixmapListFileIcon(QString UrlText, pixmapLabel *pixmapListclass); /* 多文件时,将图标加入到链表中 */
QString SetFormatBody(QString text, ClipboardWidgetEntry *w); /* 设置... */
QString setMiddleFormatBody(QString text, ClipboardWidgetEntry *w); /* 从文本中间设置... */
QString setSpecificString(QString text); /* 复制多文件时,设置特殊的字符串 */
QString catUrlFileName(QString Url); /* 截取Url中的文件名 */
QString judgeBlankLine(QStringList list); /* 去除掉空行,显示有字体的行 */
bool substringSposition(QString formatBody, QStringList list); /* 判断后面是否还有子串 */
QListWidgetItem* iterationClipboardDataHash(ClipboardWidgetEntry *w); /* 迭代Hash表m_pClipboardDataHash */
int iterationDataHashSearchSequence(int Index); /* 迭代Hash表查找其中的当前下标是否存在 */
int setClipBoardWidgetScaleFactor(); /* 设置剪贴板的高度,用来作为预览窗体的显示位置 */
QMimeData *copyMinedata(const QMimeData* mimeReference); /* 拷贝QMimeData拷贝数据类型 */
QMimeData *structureQmimeDate(OriginalDataHashValue *value); /* 构造一个QMimeDate类型数据 */
void AddWidgetEntry(OriginalDataHashValue *s_pDataHashValue, ClipboardWidgetEntry *w, QString text); /* 将信息写入到WidgetEntry条目中去 */
void setEntryItemSize(OriginalDataHashValue* value, ClipboardWidgetEntry *w, QListWidgetItem *item); /* 设置条目大小 */
void resetWidgetLabelText();
QJsonParseError m_pErr_rpt;
QJsonDocument m_pDocument;
QJsonObject m_pJsonObject;
signals:
void Itemchange();
void EditConfirmButtonSignal(ClipboardWidgetEntry *, EditorWidget*);
public slots:
void createWidgetEntry();
void popButtonSlots(QWidget *w); /* 置顶槽函数 */
void editButtonSlots(ClipboardWidgetEntry *w); /* 编辑槽函数 */
void removeButtonSlots(ClipboardWidgetEntry *w); /* 编辑槽函数 */
void fixedWidgetEntrySlots(ClipboardWidgetEntry *w); /* 固定槽函数 */
void cancelFixedWidgetEntrySLots(ClipboardWidgetEntry *w); /* 取消固定槽函数 */
void removeAllWidgetItem(); /* 移除所有条目槽函数 */
void searchClipboardLableTextSlots(QString Text); /* 查找槽函数 */
void ItemNumchagedSlots(); /* Item条目发生改变槽函数 */
void loadClipboardDb(); /* 加载数据Text线程槽函数 */
void previewShowImageSlots(QWidget *w); /* 加载预览图片窗口槽函数 */
void previewHideImageSlots(QWidget *w); /* 退出预览图片窗口槽函数 */
};
#endif // SIDEBARCLIPBOARDPLUGIN_H

View File

@ -0,0 +1,71 @@
#-------------------------------------------------
#
# Project created by QtCreator 2020-01-08T10:30:22
#
#-------------------------------------------------
QT += core gui sql
QT += widgets
TARGET = clipboardPlugin
TEMPLATE = lib
CONFIG += plugin c++11 link_pkgconfig
PKGCONFIG += gsettings-qt
include(../../env.pri)
QMAKE_CFLAGS += -D_FORTIFY_SOURCE=2 -O2
DEFINES += QT_DEPRECATED_WARNINGS
RESOURCES += clipboardPlugin.qrc
SOURCES += \
cleanpromptbox.cpp \
clipBoardInternalSignal.cpp \
customstyle.cpp \
customstyleCleanPushbutton.cpp \
customstylePushbutton2.cpp \
customstyleSearchPushbutton.cpp \
pixmaplabel.cpp \
sidebarclipboardplugin.cpp \
clipboardwidgetentry.cpp \
editorwidget.cpp \
searchwidgetitemcontent.cpp \
clipboardlisetwidget.cpp \
clipboarddb.cpp \
previewimagewidget.cpp
INCLUDEPATH += ../../plugin-interface ../../plugin-signals
HEADERS += \
cleanpromptbox.h \
clipBoardInternalSignal.h \
customstyle.h \
customstyleCleanPushbutton.h \
customstylePushbutton2.h \
customstyleSearchPushbutton.h \
pixmaplabel.h \
sidebarclipboardplugin.h \
clipboardwidgetentry.h \
clipboardsignal.h \
editorwidget.h \
searchwidgetitemcontent.h \
../../plugin-signals/sidebarclipboardsignal.h \
clipboardlisetwidget.h \
clipbaordstructoriginaldata.h \
clipboarddb.h \
previewimagewidget.h
DISTFILES += clipboardPlugin.json
TRANSLATIONS += ../../../translations/ukui-sidebar-clipboard/ukui-sidebar-clipboard_zh_CN.ts \
../../../translations/ukui-sidebar-clipboard/ukui-sidebar-clipboard_bo.ts \
../../../translations/ukui-sidebar-clipboard/ukui-sidebar-clipboard_bo_CN.ts \
../../../translations/ukui-sidebar-clipboard/ukui-sidebar-clipboard_tr.ts
unix {
translation.path = /usr/share/ukui-sidebar/ukui-sidebar-clipboard
translation.files += ../../../translations/ukui-sidebar-clipboard/*.qm
INSTALLS += translation
target.path = $${PLUGIN_INSTALL_DIRS}
INSTALLS += target
}

View File

@ -0,0 +1,733 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "appmsg.h"
#include "notificationPlugin.h"
#include "singlemsg.h"
#include "monitorthread.h"
#include "customstylePushbutton2.h"
AppMsg::AppMsg(NotificationPlugin *parent, QString strAppName, bool bTakeInFlag)
{
m_bFold = true;
m_bTakeInFlag = bTakeInFlag;
m_strAppName = strAppName;
this->setFixedWidth(380);
m_nMaxCount = 3;
//-->
//折叠按钮和删除按钮部分
m_pFoldBtnWid = new QWidget(this);
QHBoxLayout *m_pFoldBtnHLaout = new QHBoxLayout();
m_pFoldBtnHLaout->setContentsMargins(0,0,0,0);
m_foldBtn = new QPushButton(m_pFoldBtnWid);
m_foldBtn->setStyleSheet("QPushButton{background:rgba(255,255,255,31); border:0px; border-radius:6px;}"
"QPushButton:hover{background:rgba(255,255,255,71); border:0px; border-radius:6px;}"
"QPushButton:pressed{background:rgba(255,255,255,41); border:0px; border-radius:6px;}");
QPainter p(m_foldBtn);
QRect rect = m_foldBtn->rect();
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(QBrush(QColor(0, 0, 255, 255)));
p.setPen(Qt::transparent);
p.drawRoundedRect(rect,6,6);
m_foldBtn->setObjectName("fold");
m_foldBtn->setLayoutDirection(Qt::LeftToRight);
m_foldBtn->setIcon(QIcon::fromTheme("kylin-fold-hover").pixmap(17,17));
m_foldBtn->setText(QObject::tr(" fold"));
m_foldBtn->setFixedSize(88,36);
connect(m_foldBtn,&QPushButton::clicked,this,&AppMsg::onFoldAppWidget);
m_delBtn = new QPushButton();
m_delBtn->setStyleSheet("QPushButton{background:rgba(255,255,255,31); border:0px; border-radius:12px;}"
"QPushButton:hover{background:rgba(255,255,255,71); border:0px; border-radius:12px;}"
"QPushButton:pressed{background:rgba(255,255,255,41); border:0px; border-radius:12px;}");
m_delBtn->setIcon(QIcon(":/images/hover.svg"));
m_delBtn->setIcon(QIcon::fromTheme("edit-clear-symbolic").pixmap(12,12));
m_delBtn->setFixedSize(24,24);
connect(m_delBtn,&QPushButton::clicked,this,&AppMsg::onDelAppMsg);
m_pFoldBtnHLaout->addWidget(m_foldBtn);
m_pFoldBtnHLaout->addItem(new QSpacerItem(256, 10, QSizePolicy::Expanding));
m_pFoldBtnHLaout->addWidget(m_delBtn);
m_pFoldBtnHLaout->addItem(new QSpacerItem(6, 10, QSizePolicy::Fixed));
QVBoxLayout *m_pFoldBtnVLaout = new QVBoxLayout();
m_pFoldBtnVLaout->setContentsMargins(0,0,0,0);
m_pFoldBtnVLaout->addLayout(m_pFoldBtnHLaout);
m_pFoldBtnVLaout->addItem(new QSpacerItem(10, 6, QSizePolicy::Fixed));
m_pFoldBtnWid->setContentsMargins(0,0,0,0);
m_pFoldBtnWid->setLayout(m_pFoldBtnVLaout);
m_pFoldBtnWid->setFixedSize(380,42);
//当消息小于等于1时隐藏
if(m_bFold || (m_listSingleMsg.count()<=1))
m_pFoldBtnWid->setVisible(false);
else
m_pFoldBtnWid->setVisible(true);
//--<
//App信息中的总的垂直布局器
m_pMainVLaout = new QVBoxLayout();
m_pMainVLaout->setContentsMargins(0,0,0,0);
m_pMainVLaout->setSpacing(6);
//如果只有m_pMainVLaout一个管理所有消息列表当应用消息动态展开时0号消息会出现闪屏的情况
//为了规避上述情况m_pMainVLaout中只防止0号消息1号消息起全部放置m_pIndexFromOneVLaout中
m_pIndexFromOneVLaout = new QVBoxLayout();
m_pIndexFromOneVLaout->setContentsMargins(0,0,0,0);
m_pIndexFromOneVLaout->setSpacing(6);
m_pMainVLaout->addLayout(m_pIndexFromOneVLaout);
//当出现多条消息时,增加底图
m_pAppBaseMapWidget = new QWidget;
QVBoxLayout* pBaseMapVLaout = new QVBoxLayout();
pBaseMapVLaout->setContentsMargins(0,0,0,0);
pBaseMapVLaout->setSpacing(0);
m_pBaseMapWidget = new QWidget;
m_pBaseMapWidget->setObjectName("BaseMap");
m_pBaseMapWidget->setFixedWidth(360);
m_pBaseMapWidget->setFixedHeight(0);
m_pAppBaseMapWidget->setAttribute(Qt::WA_TranslucentBackground);
m_pAppBaseMapWidget->setLayout(pBaseMapVLaout);
m_pMainVLaout->addWidget(m_pAppBaseMapWidget, 0 , Qt::AlignHCenter);
m_pAppBaseMapWidget->setVisible(false);
m_pMainWid = new QWidget(this);
m_pMainWid->setContentsMargins(0,0,0,0);
m_pMainWid->setLayout(m_pMainVLaout);
m_pMainBaseVLaout = new QVBoxLayout();
m_pMainBaseVLaout->setContentsMargins(0,0,0,0);
//m_pMainBaseVLaout->addWidget(m_pFoldBtnWid);
m_pMainBaseVLaout->addWidget(m_pMainWid);
this->setLayout(m_pMainBaseVLaout);
//发个信号通知插件删除该通知应用消息
connect(this, SIGNAL(Sig_onDeleteAppMsg(AppMsg*)), parent, SLOT(onClearAppMsg(AppMsg*)));
//发个信号通知插件删除该收纳应用消息
connect(this, SIGNAL(Sig_onDeleteTakeInAppMsg(AppMsg*)), parent, SLOT(onClearTakeInAppMsg(AppMsg*)));
//发个信号通知插件收纳单条应用消息
connect(this, SIGNAL(Sig_SendTakeInSingleMsg(QString, QString, QString, QString, QString, QString, QDateTime,int, bool)),
parent, SLOT(onTakeInSingleNotify(QString, QString, QString, QString, QString, QString, QDateTime,int, bool)));
//发个信号通知插件恢复单条应用消息
connect(this, SIGNAL(Sig_SendAddSingleMsg(QString, QString, QString, QString, QString, QString, QDateTime, int, bool)),
parent, SLOT(onAddSingleNotify(QString, QString, QString, QString, QString, QString, QDateTime, int, bool)));
//发个统计收纳数更新信号
connect(this, SIGNAL(Sig_countTakeInBitAndUpate()), parent, SLOT(onCountTakeInBitAndUpate()));
return;
}
void AppMsg::paintEvent(QPaintEvent *)
{
QPainter p(this);
QRect rect = this->rect();
if(!m_pFoldBtnWid->isVisible()){
rect.setWidth(rect.width() - 1);
rect.setHeight(rect.height() - 1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(QBrush(QColor(255, 255, 255, 10)));
p.setPen(Qt::transparent);
p.drawRoundedRect(rect,6,6);
}else{
rect.setY(rect.y() + 50);
rect.setWidth(rect.width() - 1);
rect.setHeight(rect.height() - 1);
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
p.setBrush(QBrush(QColor(255, 255, 255, 10)));
p.setPen(Qt::transparent);
p.drawRoundedRect(rect,6,6);
}
return;
}
//统计应用剩余显示条数
void AppMsg::statisticLeftItem()
{
//小于1时,表示列表为空,直接返回
if(m_listSingleMsg.count() < 1)
{
return;
}
int nShowLeftCount = m_listSingleMsg.count() - 1;
//当应用处于折叠状态且剩余条数大于0时,应用底图部件显示
if ((true == m_bFold) && (nShowLeftCount > 0)) {
m_pAppBaseMapWidget->setVisible(true);
} else {
m_pAppBaseMapWidget->setVisible(false);
}
SingleMsg* pTopSingleMsg = m_listSingleMsg.at(0);
pTopSingleMsg->setLeftItem(nShowLeftCount);
return;
}
//当显示的最大消息大于设置的消息数目时删除最早的消息
void AppMsg::deleteExceedingMsg()
{
int nIndex = -1;
while (m_listSingleMsg.count() > m_nMaxCount)
{
nIndex = m_listSingleMsg.count() - 1;
if (-1 == nIndex)
{
return;
}
SingleMsg* pSingleMsg = m_listSingleMsg.at(nIndex);
onDeleSingleMsg(pSingleMsg);
}
}
//新增单条消息至通知列表崭新消息需要new然后添加至列表最上面
void AppMsg::addSingleMsg(QString strIconPath, QString strSummary, QDateTime dateTime, QString strBody, QString strUrl, QString strAction)
{
SingleMsg* pSingleMsg = new SingleMsg(this, strIconPath, m_strAppName, strSummary, dateTime, strBody, strUrl, strAction, m_bTakeInFlag);
pSingleMsg->setAppFold(m_bFold);
int uIndex = m_listSingleMsg.count();
for(int i = m_listSingleMsg.count() - 1; i >= 0; i--)
{
SingleMsg* pTmpSingleMsg = m_listSingleMsg.at(i);
if(pSingleMsg->getPushTime() < pTmpSingleMsg->getPushTime())
{
break;
}
uIndex = i;
}
//当新增的消息将插入最顶部时,将已有列表最顶部的老主消息正文设置一行缩略显示
if((0 == uIndex) && (m_listSingleMsg.count() > 0))
{
SingleMsg* pFirstMsg = m_listSingleMsg.at(0);
pFirstMsg->setMainFlag(false);
pFirstMsg->setShowLeftItemFlag(false);
//只有已经折叠的才需要将现有的正文设置为缩略显示
if(true == m_bFold)
{
pFirstMsg-> setBodyLabelWordWrap(false);
pFirstMsg->setVisible(false);
//将SingleMsg底部设置0px空隙,当其展开时让他完全从0展开
pFirstMsg->setSingleMsgContentsMargins(0, 0, 0, 0);
}
//如果新增的消息将插入最顶部则将老的顶部消息先从m_pMainVLaout移除再插入m_pIndexFromOneVLaout顶部
m_pMainVLaout->removeWidget(pFirstMsg);
m_pIndexFromOneVLaout->insertWidget(0, pFirstMsg);
}
//如果插入第0条,并且已展开,则将新增消息设置自动换行,并且折叠标志设为false
if((0 == uIndex) && (false == m_bFold))
{
pSingleMsg->setBodyLabelWordWrap(true);
pSingleMsg->setFoldFlag(m_bFold);
}
//如果插入的不是第0条,则自己不能为主
if(0 != uIndex)
{
pSingleMsg->setMainFlag(false);
//并且已经折叠的自己不可见
if(true == m_bFold)
{
pSingleMsg->setVisible(false);
}
}
m_listSingleMsg.insert(uIndex, pSingleMsg);
if(0 != uIndex)
{
//假如新增消息不是插入最顶部则直接插入m_pIndexFromOneVLaout中的uIndex - 1
m_pIndexFromOneVLaout->insertWidget(uIndex - 1, pSingleMsg);
}
else
{
//假如新增的消息将插入最顶部由于上面已把老的顶部消息插入m_pIndexFromOneVLaout的顶部所以此时直接插入m_pMainVLaout顶部
m_pMainVLaout->insertWidget(0, pSingleMsg);
}
//当单个应用的消息达到设置的最大数目时,删除最早的消息并统计数目
deleteExceedingMsg();
//将该应用中最顶上的一条消息的时间赋给应用
SingleMsg* pTopSingleMsg = m_listSingleMsg.at(0);
m_uNotifyTime = pTopSingleMsg->getPushTime();
m_dateTime = pTopSingleMsg->getPushDateTime();
//统计应用剩余显示条数
statisticLeftItem();
return;
}
void AppMsg::updateAppPushTime()
{
for(int i = 0; i < m_listSingleMsg.count(); i++)
{
SingleMsg* pTmpSingleMsg = m_listSingleMsg.at(i);
pTmpSingleMsg->updatePushTime();
}
return;
}
int AppMsg::getSingleMsgCount()
{
return m_listSingleMsg.count();
}
void AppMsg::onDeleteAppMsg()
{
if(false == m_bTakeInFlag)
{
emit Sig_onDeleteAppMsg(this); //是通知应用就通知插件删该通知应用
}
else
{
emit Sig_onDeleteTakeInAppMsg(this); //是收纳应用就通知插件删该收纳应用
}
return;
}
void AppMsg::onTakeinWholeApp()
{
while(m_listSingleMsg.count() > 0)
{
SingleMsg* pSingleMsg = m_listSingleMsg.at(0);
m_listSingleMsg.removeAt(0);
m_pMainVLaout->removeWidget(pSingleMsg);
if(m_listSingleMsg.count() > 0)
{
SingleMsg* pTopSingleMsg = m_listSingleMsg.at(0);
m_pIndexFromOneVLaout->removeWidget(pTopSingleMsg);
m_pMainVLaout->insertWidget(0, pTopSingleMsg);
}
emit Sig_SendTakeInSingleMsg(m_strAppName, pSingleMsg->getIcon(), pSingleMsg->getSummary(),
pSingleMsg->getBody(), pSingleMsg->getUrl(), pSingleMsg->getAction(),
pSingleMsg->getPushDateTime(), 20, false);
}
emit Sig_onDeleteAppMsg(this);
return;
}
void AppMsg::onRecoverWholeApp()
{
while(m_listSingleMsg.count() > 0)
{
SingleMsg* pSingleMsg = m_listSingleMsg.at(0);
m_listSingleMsg.removeAt(0);
m_pMainVLaout->removeWidget(pSingleMsg);
if(m_listSingleMsg.count() > 0)
{
SingleMsg* pTopSingleMsg = m_listSingleMsg.at(0);
m_pIndexFromOneVLaout->removeWidget(pTopSingleMsg);
m_pMainVLaout->insertWidget(0, pTopSingleMsg);
}
emit Sig_SendAddSingleMsg(m_strAppName, pSingleMsg->getIcon(), pSingleMsg->getSummary(),
pSingleMsg->getBody(), pSingleMsg->getUrl(), pSingleMsg->getAction(),
pSingleMsg->getPushDateTime(), 20, false);
}
emit Sig_onDeleteTakeInAppMsg(this);
return;
}
void AppMsg::onDeleSingleMsg(SingleMsg* pSingleMsg)
{
int nIndex = m_listSingleMsg.indexOf(pSingleMsg);
if(-1 == nIndex)
{
qDebug()<<"AppMsg::onDeleSingleMsg 在通知链表中未找到pSingleMsg指针";
return;
}
m_listSingleMsg.removeAt(nIndex);
if(0 == nIndex)
{
m_pMainVLaout->removeWidget(pSingleMsg);
if(m_listSingleMsg.count() > 0)
{
SingleMsg* pTopSingleMsg = m_listSingleMsg.at(0);
m_pIndexFromOneVLaout->removeWidget(pTopSingleMsg);
m_pMainVLaout->insertWidget(0, pTopSingleMsg);
}
}
else
{
m_pIndexFromOneVLaout->removeWidget(pSingleMsg);
}
pSingleMsg->deleteLater();
//当本次删除为应用首条时,且该应用不止一条,则需将新的首条设置为顶部消息状态
if(0 == nIndex)
{
setTopWithSecondItem();
}
//统计剩余显示条数,看情况显示
statisticLeftItem();
//当删除一条消息后,如果应用列表为空
if(0 == m_listSingleMsg.count())
{
if(false == m_bTakeInFlag)
{
emit Sig_onDeleteAppMsg(this); //是通知应用就通知插件删该通知应用
}
else
{
emit Sig_onDeleteTakeInAppMsg(this); //是收纳应用就通知插件删该收纳应用
}
}
//只有当该应用属于收纳应用对象时,每删除一条都要更新收纳计数
if(true == m_bTakeInFlag)
{
emit Sig_countTakeInBitAndUpate();
}
return;
}
//当应用最顶条被删除后,将第二条置顶
void AppMsg::setTopWithSecondItem()
{
if(m_listSingleMsg.count() > 0)
{
SingleMsg* pFirstMsg = m_listSingleMsg.at(0);
pFirstMsg->setMainFlag(true);
pFirstMsg->setFoldFlag(m_bFold);
//都是在删除单挑、收纳单挑和恢复单挑的情况下调用的setTopWithSecondItem此时App应该都是展开状态
pFirstMsg->setBodyLabelWordWrap(true);
pFirstMsg->setVisible(true);
}
return;
}
//来自SingleMsg下的事件,处理收纳事件
void AppMsg::onTakeInSingleMsg(SingleMsg* pSingleMsg)
{
int nIndex = m_listSingleMsg.indexOf(pSingleMsg);
if(-1 == nIndex)
{
qDebug()<<"AppMsg::onTakeInSingleMsg 在通知链表中未找到pSingleMsg指针";
return;
}
m_listSingleMsg.removeAt(nIndex);
if(0 == nIndex)
{
m_pMainVLaout->removeWidget(pSingleMsg);
if(m_listSingleMsg.count() > 0)
{
SingleMsg* pTopSingleMsg = m_listSingleMsg.at(0);
m_pIndexFromOneVLaout->removeWidget(pTopSingleMsg);
m_pMainVLaout->insertWidget(0, pTopSingleMsg);
}
}
else
{
m_pIndexFromOneVLaout->removeWidget(pSingleMsg);
}
emit Sig_SendTakeInSingleMsg(m_strAppName, pSingleMsg->getIcon(), pSingleMsg->getSummary(),
pSingleMsg->getBody(), pSingleMsg->getUrl(), pSingleMsg->getAction(),
pSingleMsg->getPushDateTime(), 20, false);
pSingleMsg->deleteLater();
//当本次收纳为应用首条时,且该应用不止一条,考虑将新的首条设置为顶部消息状态
if(0 == nIndex)
{
setTopWithSecondItem();
}
//统计剩余显示条数,看情况显示
statisticLeftItem();
if(0 == m_listSingleMsg.count())
{
emit Sig_onDeleteAppMsg(this);
}
}
//来自SingleMsg下的事件,处理恢复事件
void AppMsg::onRecoverSingleMsg(SingleMsg* pSingleMsg)
{
int nIndex = m_listSingleMsg.indexOf(pSingleMsg);
if(-1 == nIndex)
{
qDebug()<<"AppMsg::onTakeInSingleMsg 在通知链表中未找到pSingleMsg指针";
return;
}
m_listSingleMsg.removeAt(nIndex);
if(0 == nIndex)
{
m_pMainVLaout->removeWidget(pSingleMsg);
if(m_listSingleMsg.count() > 0)
{
SingleMsg* pTopSingleMsg = m_listSingleMsg.at(0);
m_pIndexFromOneVLaout->removeWidget(pTopSingleMsg);
m_pMainVLaout->insertWidget(0, pTopSingleMsg);
}
}
else
{
m_pIndexFromOneVLaout->removeWidget(pSingleMsg);
}
emit Sig_SendAddSingleMsg(m_strAppName, pSingleMsg->getIcon(), pSingleMsg->getSummary(),
pSingleMsg->getBody(), pSingleMsg->getUrl(), pSingleMsg->getAction(),
pSingleMsg->getPushDateTime(), 20, false);
pSingleMsg->deleteLater();
//当本次收纳为应用首条时,且该应用不止一条,考虑将新的首条设置为顶部消息状态
if(0 == nIndex)
{
setTopWithSecondItem();
}
//统计剩余显示条数,看情况显示
statisticLeftItem();
if(0 == m_listSingleMsg.count())
{
emit Sig_onDeleteTakeInAppMsg(this);
}
//只有当该应用属于收纳应用对象时,每恢复一条都要更新收纳计数
if(true == m_bTakeInFlag)
{
emit Sig_countTakeInBitAndUpate();
}
}
void AppMsg::setAppFoldFlag(bool bFlag)
{
m_bFold = bFlag;
//当应用处于展开状态或者总条数小于等于1时,应用底图部件隐藏
if((false == m_bFold) || (m_listSingleMsg.count() <= 1))
{
m_pAppBaseMapWidget->setVisible(false);
}
if(m_listSingleMsg.count() <= 1)
{
return;
}
//false表示应用展开
if(false == m_bFold)
{
//-->
//折叠按钮显示动画App消息窗口下移折叠按钮窗口下移
if(m_listSingleMsg.count()>1)
m_pFoldBtnWid->setVisible(true);
int widthFoldWid = m_pFoldBtnWid->width();
int heightFoldWid = m_pFoldBtnWid->height();
QPropertyAnimation* pAnimation2 = new QPropertyAnimation(this, "geometryFold");
connect(pAnimation2, &QPropertyAnimation::valueChanged, this, [=](const QVariant &value){
QRect Rect = value.value<QRect>();
int x1, y1, x2, y2;
Rect.getRect(&x1, &y1, &x2, &y2);
m_pFoldBtnWid->setGeometry(x1, y1, x2, y2);
});
connect(pAnimation2, &QPropertyAnimation::finished, this,[=](){
m_pMainBaseVLaout->insertWidget(0,m_pFoldBtnWid);
});
pAnimation2->setDuration(30);
pAnimation2->setStartValue(QRect(0, heightFoldWid, widthFoldWid, heightFoldWid));
pAnimation2->setEndValue(QRect(0, 0, widthFoldWid, heightFoldWid));
pAnimation2->start(QAbstractAnimation::DeleteWhenStopped);
int widthAppWid = m_pMainWid->width();
int heightAppWid = m_pMainWid->height();
QPropertyAnimation* pAnimation1 = new QPropertyAnimation(this, "geometryMain");
connect(pAnimation1, &QPropertyAnimation::valueChanged, this, [=](const QVariant &value){
QRect Rect = value.value<QRect>();
int x1, y1, x2, y2;
Rect.getRect(&x1, &y1, &x2, &y2);
m_pMainWid->setGeometry(x1, y1, x2, y2);
});
connect(pAnimation1, &QPropertyAnimation::finished, this,[=](){
//多条消息展开动画:展开时,索引从第1条开始,消息全部可见
SingleMsg* pFristSingleMsg = m_listSingleMsg.at(0); //展开第一条消息的正文内容
pFristSingleMsg->setBodyLabelWordWrap(true);
pFristSingleMsg->setAppFold(false);
for(int i = 1; i < m_listSingleMsg.count(); i++)
{
SingleMsg* pTmpSingleMsg = m_listSingleMsg.at(i);
pTmpSingleMsg->setBodyLabelWordWrap(true);
pTmpSingleMsg->setFoldFlag(false);
pTmpSingleMsg->setAppFold(false);
pTmpSingleMsg->startAnimationUnfold();
}
});
pAnimation1->setDuration(30);
pAnimation1->setStartValue(QRect(0, 0, widthAppWid, heightAppWid));
pAnimation1->setEndValue(QRect(0, m_pFoldBtnWid->height(), widthAppWid, heightAppWid));
pAnimation1->start(QAbstractAnimation::DeleteWhenStopped);
//--<
}
else
{
//折叠时,索引从第1条开始,消息全部不可见
for(int i = 1; i < m_listSingleMsg.count(); i++)
{
SingleMsg* pTmpSingleMsg = m_listSingleMsg.at(i);
pTmpSingleMsg->startAnimationFold();
}
m_pMainBaseVLaout->removeWidget(m_pFoldBtnWid);
m_pFoldBtnWid->setVisible(false);
}
}
//折叠整个应用的消息
void AppMsg::onFoldAppWidget()
{
//折叠按钮显示动画:折叠按钮窗口上移,App消息窗口上移
m_bFold = true;
int widthFoldWid = m_pFoldBtnWid->width();
int heightFoldWid = m_pFoldBtnWid->height();
QPropertyAnimation* pAnimation2 = new QPropertyAnimation(this, "btnWidFold");
connect(pAnimation2, &QPropertyAnimation::valueChanged, this, [=](const QVariant &value){
QRect Rect = value.value<QRect>();
int x1, y1, x2, y2;
Rect.getRect(&x1, &y1, &x2, &y2);
m_pFoldBtnWid->setGeometry(x1, y1, x2, y2);
});
connect(pAnimation2, &QPropertyAnimation::finished, this,[=](){
m_pFoldBtnWid->setVisible(false);
m_pMainBaseVLaout->removeWidget(m_pFoldBtnWid);
emit Sig_foldAnimationFinish();
});
pAnimation2->setDuration(30);
pAnimation2->setStartValue(QRect(0, 0, widthFoldWid, heightFoldWid));
pAnimation2->setEndValue(QRect(0, 0-heightFoldWid, widthFoldWid, heightFoldWid));
pAnimation2->start(QAbstractAnimation::DeleteWhenStopped);
int widthAppWid = m_pMainWid->width();
int heightAppWid = m_pMainWid->height();
QPropertyAnimation* pAnimation1 = new QPropertyAnimation(this, "appMainFold");
connect(pAnimation1, &QPropertyAnimation::valueChanged, this, [=](const QVariant &value){
QRect Rect = value.value<QRect>();
int x1, y1, x2, y2;
Rect.getRect(&x1, &y1, &x2, &y2);
m_pMainWid->setGeometry(x1, y1, x2, y2);
});
connect(pAnimation1, &QPropertyAnimation::finished, this,[=](){
//折叠时,索引从第1条开始,消息全部不可见
SingleMsg* pFristSingleMsg = m_listSingleMsg.at(0); //折叠第一条消息的正文内容
pFristSingleMsg->setBodyLabelWordWrap(false);
pFristSingleMsg->setAppFold(true);
pFristSingleMsg->setFoldFlag(true);
for(int i = 1; i < m_listSingleMsg.count(); i++)
{
SingleMsg* pTmpSingleMsg = m_listSingleMsg.at(i);
pTmpSingleMsg->setBodyLabelWordWrap(false);
pTmpSingleMsg->setAppFold(true);
pTmpSingleMsg->setFoldFlag(true);
pTmpSingleMsg->startAnimationFold();
}
m_pMainBaseVLaout->removeWidget(m_pFoldBtnWid);
m_pFoldBtnWid->setVisible(false);
});
pAnimation1->setDuration(30);
pAnimation1->setStartValue(QRect(0, m_pFoldBtnWid->height(), widthAppWid, heightAppWid));
pAnimation1->setEndValue(QRect(0, 0, widthAppWid, heightAppWid));
pAnimation1->start(QAbstractAnimation::DeleteWhenStopped);
//--<
}
void AppMsg::onDelAppMsg()
{
//删除整个应用消息动画:先折叠,再左移动画,最后上移动画
SingleMsg* pFristSingleMsg = m_listSingleMsg.at(0);
connect(this,&AppMsg::Sig_foldAnimationFinish,this,[=](){
QTimer *timer = new QTimer();
timer->setSingleShot(true); //设置一个单次定时器,只为延迟200毫秒,等待折叠动画完成
connect(timer, &QTimer::timeout, this, [=](){
pFristSingleMsg->onDele(); //开启左移动画,上移动画
});
timer->start(200);
});
onFoldAppWidget();
}
//当app展开时将app设置折叠
void AppMsg::setAppFold()
{
if(false == m_bFold)
{
//假如应用展开,则将应用主消息设置折叠
SingleMsg* pFirstSingleMsg = m_listSingleMsg.at(0);
pFirstSingleMsg->mainMsgSetFold();
}
m_pFoldBtnWid->setVisible(false); //单条消息不显示折叠按钮
}
//应用主消息进入
void AppMsg::onMainMsgEnter()
{
//m_pBaseMapWidget->setStyleSheet("QWidget{background:rgba(255,255,255,0.1);border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;}");
}
//应用主消息离开
void AppMsg::onMainMsgLeave()
{
//m_pBaseMapWidget->setStyleSheet("QWidget{background:rgba(255,255,255,0.04);border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;}");
}
void AppMsg::onShowBaseMap()
{
//当应用处于折叠状态且总条数大于1时,应用底图部件显示
if((true == m_bFold) && (m_listSingleMsg.count() > 1))
{
SingleMsg* pTmpSingleMsg = m_listSingleMsg.at(0);
pTmpSingleMsg->setSingleMsgContentsMargins(0, 0, 0, 0); //假如折叠剩余条目显示将可见则SingleMsg的内容均无空隙
pTmpSingleMsg->setShowLeftItemFlag(true);
m_pAppBaseMapWidget->setVisible(true);
}
}
//隐藏底图部件
void AppMsg::onHideBaseMap()
{
m_pAppBaseMapWidget->setVisible(false);
}

View File

@ -0,0 +1,103 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef APPMSG_H
#define APPMSG_H
#include <QObject>
#include <QWidget>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QSpacerItem>
#include <QPushButton>
#include <QToolButton>
#include <QDateTime>
class NotificationPlugin;
class SingleMsg;
class AppMsg : public QWidget
{
Q_OBJECT
public:
AppMsg(NotificationPlugin *parent, QString strAppName, bool bTakeInFlag = false);
uint getAppPushTime() {return m_uNotifyTime;}
QString getAppName() {return m_strAppName;}
void addSingleMsg(QString strIconPath, QString strSummary, QDateTime dateTime, QString strBody, QString strUrl, QString strAction);
void deleteExceedingMsg(); //删除超出最大数的消息
void updateAppPushTime(); //更新应用最新的推送时间
int getSingleMsgCount(); //获取应用消息数
void statisticLeftItem(); //统计应用剩余显示条数
void setTopWithSecondItem(); //当应用最顶条被删除后,将第二条置顶
void setAppFold(); //当app展开时将app设置折叠
void setMaxNumMsg(int nMaxNum) {m_nMaxCount = nMaxNum;}
bool getFoldFlag() {return m_bFold;}
void setFoldFlag(bool bFlag) {m_bFold = bFlag;}
void paintEvent(QPaintEvent *); //重绘事件
private:
QVBoxLayout* m_pMainBaseVLaout; //APP信息中的整体布局
QWidget* m_pMainWid; //App信息中的总窗口
QVBoxLayout* m_pMainVLaout; //App信息中的总的垂直布局器
QWidget* m_pFoldBtnWid; //折叠按钮和删除按钮窗口
QVBoxLayout* m_pIndexFromOneVLaout;
QWidget* m_pAppBaseMapWidget; //多条消息时底图部件包括底部6个px的空白
QWidget* m_pBaseMapWidget; //多条消息时底图部件不包括底部6个px的空白
QList<SingleMsg*> m_listSingleMsg; //对于SingleMsg类对象用list表记录
QString m_strAppName; //保存发送方的应用名
QDateTime m_dateTime; //保存推送时间
uint m_uNotifyTime; //保存推送时间的绝对时间
bool m_bTakeInFlag; //转变为收纳消息吗默认为false
bool m_bFold; //折叠标志
int m_nMaxCount; //应用消息最大收录数
QPushButton* m_foldBtn; //折叠按钮
QPushButton* m_delBtn; //清除按钮
signals:
void Sig_onDeleteAppMsg(AppMsg* p); //该对象属于通知应用,发出删除应用的信号
void Sig_onDeleteTakeInAppMsg(AppMsg* p); //当该对象属于收纳应用时,发出删除收纳应用的信号
void Sig_countTakeInBitAndUpate(); //发个统计收纳数信号
void Sig_SendTakeInSingleMsg(QString strAppName, QString strIcon, QString strSummary, QString strBody, QString urlStr, QString actions, QDateTime dateTime, int maxNum, bool bNewTakeinFlag);
void Sig_SendAddSingleMsg(QString strAppName, QString strIcon, QString strSummary, QString strBody, QString urlStr, QString actions, QDateTime dateTime, int maxNum, bool bNewNotificationFlag);
void Sig_foldAnimationFinish(); //折叠按钮窗口的消失动画完成信号
public slots:
void onDeleteAppMsg(); //删除一个应用消息
void onTakeinWholeApp(); //收纳整个应用消息
void onRecoverWholeApp(); //恢复整个应用消息
void onDeleSingleMsg(SingleMsg* pSingleMsg); //删除单条消息
void onTakeInSingleMsg(SingleMsg* pSingleMsg); //收纳单条消息
void onRecoverSingleMsg(SingleMsg* pSingleMsg); //恢复单条消息
void setAppFoldFlag(bool bFlag); //设置应用折叠标志
void onFoldAppWidget(); //折叠整个应用消息
void onDelAppMsg(); //删除整个应用的消息
void onMainMsgEnter(); //应用主消息进入
void onMainMsgLeave(); //应用主消息离开
void onShowBaseMap(); //显示应用底图
void onHideBaseMap(); //隐藏底图部件
};
#endif // APPMSG_H

View File

@ -0,0 +1,109 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "buttonwidget.h"
#include <QMouseEvent>
#include <QSvgRenderer>
#include <QPixmap>
#include <QPainter>
#include <QVBoxLayout>
#include <QSvgWidget>
#include <QDebug>
ButtonWidget::ButtonWidget(QString strIcon, QString strHoverIcon, QString strPressIcon,QSize normalIconSize,QSize pressIconSize)
{
m_strIcon = strIcon;
m_strHoverIcon = strHoverIcon;
m_strPressIcon = strPressIcon;
this->setFixedWidth(24);
this->setFixedHeight(24);
QVBoxLayout* pVBoxLayout = new QVBoxLayout;
pVBoxLayout->setContentsMargins(0,0,0,0);
pVBoxLayout->setSpacing(0);
m_ToolButton = new QLabel;
m_pTakeinSvgRender = new QSvgRenderer(m_ToolButton);
m_pTakeinSvgRender->load(m_strIcon);
m_ToolButton->setAttribute(Qt::WA_TranslucentBackground);
m_pTakeinPixmap = new QPixmap(normalIconSize);
m_pTakeinPressPixmap = new QPixmap(pressIconSize);
m_pTakeinPixmap->fill(Qt::transparent);
QPainter takeinPainter(m_pTakeinPixmap);
m_pTakeinSvgRender->render(&takeinPainter);
m_ToolButton->setPixmap(*m_pTakeinPixmap);
pVBoxLayout->addWidget(m_ToolButton, 0, Qt::AlignHCenter | Qt::AlignVCenter);
this->setLayout(pVBoxLayout);
return;
}
void ButtonWidget::enterEvent(QEvent *event)
{
Q_UNUSED(event);
m_pTakeinSvgRender->load(m_strHoverIcon);
m_pTakeinPixmap->fill(Qt::transparent);
QPainter takeinPainter(m_pTakeinPixmap);
m_pTakeinSvgRender->render(&takeinPainter);
m_ToolButton->setPixmap(*m_pTakeinPixmap);
return;
}
void ButtonWidget::leaveEvent(QEvent *event)
{
Q_UNUSED(event);
m_pTakeinSvgRender->load(m_strIcon);
m_pTakeinPixmap->fill(Qt::transparent);
QPainter takeinPainter(m_pTakeinPixmap);
m_pTakeinSvgRender->render(&takeinPainter);
m_ToolButton->setPixmap(*m_pTakeinPixmap);
return;
}
//鼠标点击事件
void ButtonWidget::mousePressEvent(QMouseEvent *event)
{
if (event->buttons() == Qt::LeftButton)
{
m_pTakeinSvgRender->load(m_strPressIcon);
m_pTakeinPressPixmap->fill(Qt::transparent);
QPainter takeinPainter(m_pTakeinPressPixmap);
m_pTakeinSvgRender->render(&takeinPainter);
m_ToolButton->setPixmap(*m_pTakeinPressPixmap);
}
return;
}
void ButtonWidget::mouseReleaseEvent(QMouseEvent *event)
{
int x = event->x();
int y = event->y();
qDebug()<<"ButtonWidget::mouseReleaseEvent" <<x << y;
//假如在QRect(0, 0, 24, 24));这个区域里,就发出信号
if (x >= 0 && x <= 24 && y >= 0 && y<=24)
{
emit Sig_clicked();
}
return;
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef BUTTONWIDGET_H
#define BUTTONWIDGET_H
#include <QWidget>
#include <QLabel>
class QSvgRenderer;
class ButtonWidget : public QWidget
{
Q_OBJECT
public:
explicit ButtonWidget(QString strIcon, QString strHoverIcon, QString strPressIcon,QSize nomalIconSize,QSize pressIconSize);
protected:
virtual void enterEvent(QEvent *event) override;
virtual void leaveEvent(QEvent *event) override;
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override;
private:
QLabel* m_ToolButton;
QSvgRenderer* m_pTakeinSvgRender;
QPixmap* m_pTakeinPixmap; //收纳默认或悬停时的像素
QPixmap* m_pTakeinPressPixmap; //收纳点击时的像素
bool m_bTakeInFlag;
QString m_strIcon;
QString m_strHoverIcon;
QString m_strPressIcon;
signals:
void Sig_clicked();
public slots:
};
#endif // BUTTONWIDGET_H

View File

@ -0,0 +1,218 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#include "customstylePushbutton2.h"
#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QDebug>
CustomStyle_pushbutton_2::CustomStyle_pushbutton_2(const QString &proxyStyleName, QObject *parent) : QProxyStyle (proxyStyleName)
{
Q_UNUSED(parent);
}
void CustomStyle_pushbutton_2::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
return QProxyStyle::drawComplexControl(control, option, painter, widget);
}
void CustomStyle_pushbutton_2::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case QStyle::CE_PushButton: {
QStyleOptionButton button = *qstyleoption_cast<const QStyleOptionButton *>(option);
button.palette.setColor(QPalette::HighlightedText, button.palette.buttonText().color());
return QProxyStyle::drawControl(element, &button, painter, widget);
break;
}
default:
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
void CustomStyle_pushbutton_2::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
}
void CustomStyle_pushbutton_2::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
{
return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
}
/// 我们重写button的绘制方法通过state和当前动画的状态以及value值改变相关的绘制条件
/// 这里通过判断hover与否动态的调整painter的透明度然后绘制背景
/// 需要注意的是,默认控件的绘制流程只会触发一次,而动画需要我们在一段时间内不停绘制才行,
/// 要使得动画能够持续我们需要使用QWidget::update()在动画未完成时,
/// 手动更新一次这样button将在一段时间后再次调用draw方法从而达到更新动画的效果
///
/// 需要注意绘制背景的流程会因主题不同而产生差异,所以这一部分代码在一些主题中未必正常,
/// 如果你需要自己实现一个主题,这同样是你需要注意和考虑的点
void CustomStyle_pushbutton_2::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
// if (element == PE_PanelButtonCommand) {
// qDebug()<<"draw pe button";
// if (widget) {
// bool isPressed = false;
// bool isHover = false;
// if (!option->state.testFlag(State_Sunken)) {
// if (option->state.testFlag(State_MouseOver)) {
// isHover = true;
// }
// } else {
// isPressed = true;
// }
// QStyleOption opt = *option;
// if (isHover) {
// QColor color(255,255,255,51);
// opt.palette.setColor(QPalette::Highlight, color);
// }
// if (isPressed) {
// QColor color(255,255,255,21);
// opt.palette.setColor(QPalette::Highlight, color);
// }
// if (!isHover && !isPressed) {
// QColor color(255,255,255,31);
// opt.palette.setColor(QPalette::Button,color);
// }
// return QProxyStyle::drawPrimitive(element, &opt, painter, widget);
// }
// }
// return QProxyStyle::drawPrimitive(element, option, painter, widget);
if (element == PE_PanelButtonCommand) {
if (widget) {
if (option->state & State_MouseOver) {
if (option->state & State_Sunken) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,21);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,51);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
} else {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
QColor color(255,255,255,0);
painter->setBrush(color);
painter->drawRoundedRect(option->rect, 4, 4);
painter->restore();
}
return;
}
}
return QProxyStyle::drawPrimitive(element, option, painter, widget);
}
QPixmap CustomStyle_pushbutton_2::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
{
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
}
QStyle::SubControl CustomStyle_pushbutton_2::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
{
return QProxyStyle::hitTestComplexControl(control, option, position, widget);
}
QRect CustomStyle_pushbutton_2::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
}
QRect CustomStyle_pushbutton_2::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
{
return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
}
int CustomStyle_pushbutton_2::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::pixelMetric(metric, option, widget);
}
/// 我们需要将动画与widget一一对应起来
/// 在一个style的生命周期里widget只会进行polish和unpolish各一次
/// 所以我们可以在polish时将widget与一个新的动画绑定并且对应的在unpolish中解绑定
void CustomStyle_pushbutton_2::polish(QWidget *widget)
{
return QProxyStyle::polish(widget);
}
void CustomStyle_pushbutton_2::polish(QApplication *application)
{
return QProxyStyle::polish(application);
}
void CustomStyle_pushbutton_2::polish(QPalette &palette)
{
return QProxyStyle::polish(palette);
}
void CustomStyle_pushbutton_2::unpolish(QWidget *widget)
{
return QProxyStyle::unpolish(widget);
}
void CustomStyle_pushbutton_2::unpolish(QApplication *application)
{
return QProxyStyle::unpolish(application);
}
QSize CustomStyle_pushbutton_2::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
{
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
}
QIcon CustomStyle_pushbutton_2::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
QPalette CustomStyle_pushbutton_2::standardPalette() const
{
return QProxyStyle::standardPalette();
}
int CustomStyle_pushbutton_2::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
QRect CustomStyle_pushbutton_2::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
{
return QProxyStyle::subControlRect(control, option, subControl, widget);
}
QRect CustomStyle_pushbutton_2::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::subElementRect(element, option, widget);
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information 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, 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/&gt;.
*
*/
#ifndef CUSTOMSTYLE_PUSHBUTTON_2_H
#define CUSTOMSTYLE_PUSHBUTTON_2_H
#include <QProxyStyle>
class CustomStyle_pushbutton_2 : public QProxyStyle
{
Q_OBJECT
public:
explicit CustomStyle_pushbutton_2(const QString &proxyStyleName = "windows", QObject *parent = nullptr);
virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual void drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
/*!
* \brief drawPrimitive
* \param element PE枚举类型
* \param option
* \param painter
* \param widget
* \details
* drawPrimitive用于绘制控件背景
*
* hover和点击效果
*/
virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const;
virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget = nullptr) const;
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const;
virtual QRect itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const;
//virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget);
virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const;
virtual void polish(QWidget *widget);
virtual void polish(QApplication *application);
virtual void polish(QPalette &palette);
virtual void unpolish(QWidget *widget);
virtual void unpolish(QApplication *application);
virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const;
virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
virtual QPalette standardPalette() const;
virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const;
virtual QRect subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget = nullptr) const;
virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget = nullptr) const;
signals:
public slots:
private:
};
#endif // CUSTOMSTYLE_PUSHBUTTON_2_H

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.5;fill:#FFFFFF;}
</style>
<path class="st0" d="M10.5,1h-7L0,6v4.4C0,11.8,1.2,13,2.6,13h8.8c1.4,0,2.6-1.2,2.6-2.6V6L10.5,1z M10,6v1.7C10,8.4,9.4,9,8.7,9
H5.3C4.6,9,4,8.4,4,7.7V6H1l2.9-4h6.3L13,6H10z"/>
</svg>

After

Width:  |  Height:  |  Size: 605 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.5;fill:#FFFFFF;}
</style>
<path class="st0" d="M12,1H4L0,7v5c0,1.6,1.4,3,3,3h10c1.6,0,3-1.4,3-3V7L12,1z M11,7v1.5c0,0.8-0.7,1.5-1.5,1.5h-3
C5.7,10,5,9.3,5,8.5V7H1.2l3.2-5h7.2l3.2,5H11z"/>
</svg>

After

Width:  |  Height:  |  Size: 592 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M12,1H4L0,7v5c0,1.6,1.4,3,3,3h10c1.6,0,3-1.4,3-3V7L12,1z M11,7v1.5c0,0.8-0.7,1.5-1.5,1.5h-3
C5.7,10,5,9.3,5,8.5V7H1.2l3.2-5h7.2l3.2,5H11z"/>
</svg>

After

Width:  |  Height:  |  Size: 580 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.57;fill:#FFFFFF;enable-background:new ;}
</style>
<path class="st0" d="M17,3H7l-5,9v7c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2v-7L17,3z M14,12v2c0,0.6-0.4,1-1,1h-2c-0.6,0-1-0.4-1-1v-2
H3.1l4.5-8h8.8l4.5,8H14z"/>
</svg>

After

Width:  |  Height:  |  Size: 613 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.91;fill:#FFFFFF;}
</style>
<path class="st0" d="M18,1H6L0,12v9c0,1.1,0.9,2,2,2h20c1.1,0,2-0.9,2-2v-9L18,1z M15,12v2c0,0.6-0.4,1-1,1h-4c-0.6,0-1-0.4-1-1v-2
H1.1L6.6,2h10.8l5.5,10H15z"/>
</svg>

After

Width:  |  Height:  |  Size: 589 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.57;fill:#FFFFFF;}
</style>
<path class="st0" d="M18,1H6L0,12v9c0,1.1,0.9,2,2,2h20c1.1,0,2-0.9,2-2v-9L18,1z M15,12v2c0,0.6-0.4,1-1,1h-4c-0.6,0-1-0.4-1-1v-2
H1.1L6.6,2h10.8l5.5,10H15z"/>
</svg>

After

Width:  |  Height:  |  Size: 589 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.5;fill:#FFFFFF;}
</style>
<polygon class="st0" points="10,5 7,1 4,5 6,5 6,8 8,8 8,5 "/>
<path class="st0" d="M10.5,1H9.6v1h0.5L13,6h-3v1.7C10,8.4,9.4,9,8.7,9H5.3C4.6,9,4,8.4,4,7.7V6H1l2.9-4h0.5V1H3.5L0,6v4.4
C0,11.8,1.2,13,2.6,13h8.8c1.4,0,2.6-1.2,2.6-2.6V6L10.5,1z"/>
</svg>

After

Width:  |  Height:  |  Size: 674 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.5;fill:#FFFFFF;}
</style>
<polygon class="st0" points="12,5 8,0 4,5 7,5 7,9 9,9 9,5 "/>
<path class="st0" d="M12,1h-1v1h0.6l3.2,5H11v1.5c0,0.8-0.7,1.5-1.5,1.5h-3C5.7,10,5,9.3,5,8.5V7H1.2l3.2-5H5V1H4L0,7v5
c0,1.7,1.3,3,3,3h10c1.7,0,3-1.3,3-3V7L12,1z"/>
</svg>

After

Width:  |  Height:  |  Size: 657 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<polygon class="st0" points="12,5 8,0 4,5 7,5 7,9 9,9 9,5 "/>
<path class="st0" d="M12,1h-1v1h0.6l3.2,5H11v1.5c0,0.8-0.7,1.5-1.5,1.5h-3C5.7,10,5,9.3,5,8.5V7H1.2l3.2-5H5V1H4L0,7v5
c0,1.7,1.3,3,3,3h10c1.7,0,3-1.3,3-3V7L12,1z"/>
</svg>

After

Width:  |  Height:  |  Size: 645 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.57;fill:#FFFFFF;enable-background:new ;}
</style>
<polygon class="st0" points="15,6 12,2 9,6 11,6 11,9 13,9 13,6 "/>
<path class="st0" d="M17,3h-2v1h1.4l4.5,8H14v2c0,0.6-0.4,1-1,1h-2c-0.6,0-1-0.4-1-1v-2H3.1l4.5-8H9V3H7l-5,9v7c0,1.1,0.9,2,2,2h16
c1.1,0,2-0.9,2-2v-7L17,3z"/>
</svg>

After

Width:  |  Height:  |  Size: 682 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.91;fill:#FFFFFF;}
</style>
<polygon class="st0" points="16,5 12,0 8,5 11,5 11,9 13,9 13,5 "/>
<path class="st0" d="M18,1h-2v1h1.4l5.5,10H15v2c0,0.6-0.4,1-1,1h-4c-0.6,0-1-0.4-1-1v-2H1.1L6.6,2H8V1H6L0,12v9c0,1.1,0.9,2,2,2h20
c1.1,0,2-0.9,2-2v-9L18,1z"/>
</svg>

After

Width:  |  Height:  |  Size: 657 B

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.57;fill:#FFFFFF;}
</style>
<polygon class="st0" points="16,5 12,0 8,5 11,5 11,9 13,9 13,5 "/>
<path class="st0" d="M18,1h-2v1h1.4l5.5,10H15v2c0,0.6-0.4,1-1,1h-4c-0.6,0-1-0.4-1-1v-2H1.1L6.6,2H8V1H6L0,12v9c0,1.1,0.9,2,2,2h20
c1.1,0,2-0.9,2-2v-9L18,1z"/>
</svg>

After

Width:  |  Height:  |  Size: 657 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 9 9" style="enable-background:new 0 0 9 9;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.5;fill:#FFFFFF;}
</style>
<polygon class="st0" points="9,0.8 8.2,0 4.5,3.8 0.7,0 0,0.7 3.8,4.5 0,8.3 0.7,9 4.5,5.2 8.2,9 9,8.2 5.2,4.5 "/>
</svg>

After

Width:  |  Height:  |  Size: 537 B

Some files were not shown because too many files have changed in this diff Show More