Showing preview only (460K chars total). Download the full file or copy to clipboard to get everything.
Repository: bigtreetech/OctoBTT
Branch: master
Commit: cee483835601
Files: 56
Total size: 436.3 KB
Directory structure:
gitextract_r06cqxp9/
├── .gitattributes
├── .gitignore
├── LICENSE
├── OctoBTT.pro
├── OctoBTT.sudoers.d
├── OctoBTT_zh_CN.ts
├── README.md
├── StyleSheet/
│ └── globalStyleSheet.qss
├── accesscontrol.cpp
├── accesscontrol.h
├── assets.qrc
├── cameradialog.cpp
├── cameradialog.h
├── cameradialog.ui
├── config.conf
├── configuration.cpp
├── configuration.h
├── configuration.ui
├── controlpanel.cpp
├── controlpanel.h
├── controlpanel.ui
├── customdialog.cpp
├── customdialog.h
├── filedialog.cpp
├── filedialog.h
├── filedialog.ui
├── gcodedialog.cpp
├── gcodedialog.h
├── gcodedialog.ui
├── inputdialog.cpp
├── inputdialog.h
├── inputdialog.ui
├── install.sh
├── liblog.cpp
├── liblog.h
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── materialctrlpanel.cpp
├── materialctrlpanel.h
├── materialctrlpanel.ui
├── mylineedit.cpp
├── mylineedit.h
├── octonetwork.cpp
├── octonetwork.h
├── start.sh
├── startup.sh
├── terminaldialog.cpp
├── terminaldialog.h
├── terminaldialog.ui
├── update.sh
├── upgrade.sh
├── wlanconfig.cpp
├── wlanconfig.h
└── wlanconfig.ui
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto
================================================
FILE: .gitignore
================================================
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
# OS-specific files
.DS_Store
*.DS_Store
# Custom
.DS_Store
assets/.DS_Store
assets/icon/.DS_Store
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are 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.
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.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
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 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 work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
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 AGPL, see
<https://www.gnu.org/licenses/>.
================================================
FILE: OctoBTT.pro
================================================
QT += core gui svg
#QT += multimedia
#QT += multimediawidgets
QT += network websockets
#QT += multimedia
#QT += script
#QT += webenginewidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
CONFIG += lang-zh_CN
CONFIG += console
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
VERSION = 2.0.0
QMAKE_TARGET_COMPANY = BigtreeTech
QMAKE_TARGET_PRODUCT = OctoBTT
QMAKE_TARGET_COPYRIGHT = Copyright(C) 2020 By BigtreeTech
QMAKE_TARGET_DESCRIPTION = First suggested for OctoPi
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
accesscontrol.cpp \
cameradialog.cpp \
configuration.cpp \
controlpanel.cpp \
customdialog.cpp \
filedialog.cpp \
gcodedialog.cpp \
inputdialog.cpp \
liblog.cpp \
main.cpp \
mainwindow.cpp \
materialctrlpanel.cpp \
mylineedit.cpp \
octonetwork.cpp \
terminaldialog.cpp \
# webdialog.cpp \
wlanconfig.cpp
HEADERS += \
accesscontrol.h \
cameradialog.h \
configuration.h \
controlpanel.h \
customdialog.h \
filedialog.h \
gcodedialog.h \
inputdialog.h \
liblog.h \
mainwindow.h \
materialctrlpanel.h \
mylineedit.h \
octonetwork.h \
terminaldialog.h \
# webdialog.h \
wlanconfig.h
FORMS += \
cameradialog.ui \
configuration.ui \
controlpanel.ui \
filedialog.ui \
gcodedialog.ui \
inputdialog.ui \
mainwindow.ui \
materialctrlpanel.ui \
terminaldialog.ui \
# webdialog.ui \
wlanconfig.ui
TRANSLATIONS += \
OctoBTT_zh_CN.ts
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
assets.qrc
DISTFILES += \
start.sh \
wav/KBClick.wav
================================================
FILE: OctoBTT.sudoers.d
================================================
pi ALL=(ALL) NOPASSWD: /sbin/iwlist, /sbin/wpa_cli, /sbin/iwconfig, /sbins/ifconfig
================================================
FILE: OctoBTT_zh_CN.ts
================================================
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="OctoBTT_zh_CN"></TS>
================================================
FILE: README.md
================================================
# OctoBTT

## Introduce
* A UI that matches OctoPrint printer
## Software architecture
* Client and server architecture solution
* OctoPi -> OctoPrint service -> Printer
## Install the tutorial
### One-click installation based on image mode
### [OctoPi-0.17.0 with OctoBTT](https://drive.google.com/file/d/1pR2fpxu22XdM08EMIsEXZj7D5zPRO70z/view?usp=sharing)
### Manual installation based on source code
> (The update and upgrade operations are not redundant)
### 1. Install OctoPrint(direct use of OctoPi is recommended , Up to [Octopi 0.17](https://drive.google.com/file/d/1F3xRiC6GXkHNvPAKEho4P9ylevF9G_HR/view?usp=sharing) is supported, and you need to go to OctoprInt's Web page to complete the initialization, need to be disable access control)-- (install under directory)
### [OctoPi-0.17.0](https://drive.google.com/file/d/1F3xRiC6GXkHNvPAKEho4P9ylevF9G_HR/view?usp=sharing)

* You can create a WPA profile in the boot directory **boot/wpa_supplicant.txt** to add WiFi connections

* If you are a BX machine model user, you will need to add the following fragment lines to the RaspberryPi **boot/config.txt** file to display them correctly on screen:
> * max_usb_current=1
> * hdmi_group=2
> * hdmi_mode=87
> * hdmi_cvt 1024 600 60
> * hdmi_drive=1

* SSH your PI on your computer for further action
> After Pi boot you can get the IP address of Pi from the screen

> If you connect with console


> If you connect with terminal


### 2. Install OctoBTT :
> Run Command (Installation):
* rm -f startup.sh ; wget --no-check-certificate https://raw.githubusercontent.com/bigtreetech/OctoBTT/master/startup.sh && sudo /bin/sh startup.sh
<!-- > Run Command (Upgrade):
* rm -f upgrade.sh ; wget --no-check-certificate https://raw.githubusercontent.com/bigtreetech/OctoBTT/master/upgrade.sh && sudo /bin/sh upgrade.sh -->
<!-- > Contact Email: developer01@biqu3d.com -->

### 3. OctoBTT is entered automatically after you wait for the auto setup to complete and then restart

## Instructions for use
> 1. Used with OctoPrint

## Notes
> 1. Because the serial port delay is long, the background has blocked the serial port connection, we only use the USB automatic connection
> 2. It is recommended to run with Marlin firmware. Currently there may be some unknown problems due to non-marlin firmware
> 3. If you want to use octoprint online , you can use the network cable to connect to the router.
## Contribute
> 1. Fork the repository
> 2. New Feat_ XXX branch
> 3. Submit code
> 4. New Pull Request
================================================
FILE: StyleSheet/globalStyleSheet.qss
================================================
/*1.0.0*/
/*
=================================
上述为版本号,如您自己更换了新的样式表,
请将版本号首位改为0,例如:0.5.6
=================================
*/
/*
============================================
The above is the version number.
If you change the new style sheet yourself,
change the first part of the version
number to 0, for example: 0.5.6
============================================
*/
QWidget
{
background-color:rgb(25, 25, 25);
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet"]
{
padding: 10px;
border-style: solid;
border-width: 5px;
border-radius: 20px;
border-color: rgb(255, 0, 0);
color: rgb(245, 246, 250);
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet"]
{
padding: 10px;
border-style: solid;
border-width: 5px;
border-radius: 20px;
border-color: rgb(0, 255, 0);
background-color: rgba(128, 128, 128, 25%);
color: rgb(245, 246, 250);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet"]
{
padding: 10px;
border-style: solid;
border-width: 5px;
border-radius: 20px;
border-color: rgb(0, 255, 0);
background-color: rgba(128, 128, 128, 25%);
color: rgb(245, 246, 250);
padding-right:4px;
padding-bottom:4px;
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet1"]
{
padding: 10px;
border-style: solid;
border-width: 5px;
border-radius: 20px;
color: rgb(245, 246, 255);
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet1"]
{
padding: 10px;
border-style: solid;
border-width: 5px;
border-radius: 20px;
background-color:rgb(128, 128, 128, 25%);
color: rgb(245, 246, 255);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet1"]
{
padding: 10px;
border-style: solid;
border-width: 5px;
border-radius: 20px;
background-color:rgba(128, 128, 128, 25%);
color: rgb(245, 246, 255);
padding-right:4px;
padding-bottom:4px;
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet2"]
{
border:none;
color: rgb(245, 246, 255);
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet2"]
{
border:none;
background-color:rgba(128, 128, 128, 25%);
color: rgb(245, 246, 255);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet2"]
{
border:none;
background-color:rgba(128, 128, 128, 25%);
padding-left:4px; padding-top:4px;
color: rgb(245, 246, 255);
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet3"]
{
border:none;
font: 75 30pt Gill Sans MT;
color: rgb(245, 246, 255);
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet3"]
{
border:none;
background-color: rgba(128, 128, 128, 25%);
font: 75 30pt Gill Sans MT;
color: rgb(245, 246, 255);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet3"]
{
border:none;
background-color: rgba(128, 128, 128, 25%);
font: 75 30pt Gill Sans MT;
color: rgb(245, 246, 255);
padding-left:4px;
padding-top:4px;
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet4"]
{
border:none;
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet4"]
{
border:none;
background-color: rgba(128, 128, 128, 25%);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet4"]
{
border:none;
background-color: rgba(128, 128, 128, 25%);
padding-left:4px;
padding-top:4px;
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet5"]
{
color: rgb(245, 246, 255);
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet5"]
{
background-color:rgba(128, 128, 128, 25%);
color: rgb(245, 246, 255);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet5"]
{
background-color:rgba(128, 128, 128, 25%);
padding-left:4px; padding-top:4px;
color: rgb(245, 246, 255);
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet6"]
{
padding: 10px;
border-style: solid;
border-width: 1px;border-radius: 20px;
border-color: rgb(245, 246, 255);
color: rgb(245, 246, 255);
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet6"]
{
padding: 10px;
border-style: solid;
border-width: 1px;
border-radius: 20px;border-color: rgb(245,246,255);
background-color:rgba(128, 128, 128, 25%);
color: rgb(245, 246, 255);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet6"]
{
padding: 10px;
border-style: solid;
border-width: 1px;border-radius: 20px;
border-color: rgb(245,246,255);
background-color:rgb(128, 128, 128, 25%);
color: rgb(245, 246, 255);padding-right:4px;
padding-bottom:4px;
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet7"]
{
background-color: rgb(0, 0, 0);
color: rgb(255, 255, 10);
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet7"]
{
color: rgb(255, 255, 10);
background-color: rgba(128, 128, 128, 25%);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet7"]
{
color: rgb(255, 255, 10);
background-color: rgba(128, 128, 128, 25%);
padding-left:4px;padding-top:4px;
}
/*按钮静止无操作样式*/
QToolButton[whatsThis="BTStyleSheet8"]
{
padding: 10px;
border-style: solid;
border-width: 2px;border-radius: 20px;
border-color: rgb(245, 246, 255);
color: rgb(245, 246, 255);
}
/*鼠标悬停在按钮样式*/
QToolButton:hover[whatsThis="BTStyleSheet8"]
{
padding: 10px;
border-style: solid;
border-width: 2px;border-radius: 20px;
background-color:rgba(128, 128, 128, 25%);
color: rgb(245, 246, 255);
}
/*鼠标按下按钮样式*/
QToolButton:pressed[whatsThis="BTStyleSheet8"]
{
padding: 10px;
border-style: solid;
border-width: 2px;
border-radius: 20px;
background-color:rgba(128, 128, 128, 25%);
color: rgb(245, 246, 255);
padding-right:4px;
padding-bottom:4px;
}
/*按钮静止无操作样式*/
QToolButton[whatsThis="BTStyleSheet9"]
{
border:none;
font: 20pt "Gill Sans Ultra Bold Condensed";
color: rgb(245, 246, 250);
}
/*鼠标悬停在按钮样式*/
QToolButton:hover[whatsThis="BTStyleSheet9"]
{
border:none;
background-color: rgba(128, 128, 128, 25%);
font: 20pt "Gill Sans Ultra Bold Condensed";
color: rgb(245, 246, 250);
}
/*鼠标按下按钮样式*/
QToolButton:pressed[whatsThis="BTStyleSheet9"]
{
border:none;
background-color: rgba(128, 128, 128, 25%);
padding-left:4px;
padding-top:4px;
font: 20pt "Gill Sans Ultra Bold Condensed";
color: rgb(245, 246, 250);
}
/*按钮静止无操作样式*/
QPushButton[whatsThis="BTStyleSheet10"]
{
padding: 10px;
border-style: solid;
border-width: 2px;
border-radius: 20px;
border: rgba(60, 255, 138, 25%);
}
/*鼠标悬停在按钮样式*/
QPushButton:hover[whatsThis="BTStyleSheet10"]
{
padding: 10px;
border-style: solid;
border-width: 2px;
border-radius: 20px;
border: rgba(60, 255, 138, 25%);
background-color:rgba(128, 128, 128, 25%);
}
/*鼠标按下按钮样式*/
QPushButton:pressed[whatsThis="BTStyleSheet10"]
{
padding: 10px;
border-style: solid;
border-width: 2px;
border-radius: 20px;
border: rgba(60, 255, 138, 25%);
background-color:rgba(128, 128, 128, 25%);
padding-right:4px;
padding-bottom:4px;
}
/*滑动条样式表*/
QScrollBar:vertical
{
width:40px;
background:rgba(0,128,255,0%);
margin:0px,0px,0px,0px;
padding-top:40px;
padding-bottom:40px;
}
QScrollBar::handle:vertical
{
width:40px;
background:rgba(0,128,255,25%);
border-radius:10px;
min-height:40;
}
QScrollBar::handle:vertical:hover
{
width:40px;
background:rgba(0,128,255,50%);
border-radius:10px;
min-height:40;
}
QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical
{
background:rgba(0,128,255,10%);
border-radius:0px;
}
QScrollBar:horizontal
{
height:40px;
background:rgba(0,128,255,0%);
margin:0px,0px,0px,0px;
padding-left:40px;
padding-right:40px;
}
QScrollBar::handle:horizontal
{
height:40x;
background:rgba(0,128,255,25%);
border-radius:10px;
min-width:40;
}
QScrollBar::handle:horizontal:hover
{
height:40px;
background:rgba(0,128,255,50%);
border-radius:10px;
min-width:40;
}
QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal
{
background:rgba(0,128,255,10%);
border-radius:0px;
}
/* 未下拉时,QComboBox的样式 */
QComboBox {
border: none;
}
QComboBox::showPopup QAbstractItemView
{
outline: 0px solid gray; /* 选定项的虚框 */
color: rgb(255, 255, 255); /* 整个下拉窗体被选中项的背景色 */
background-color: rgb(128, 128, 128); /* 整个下拉窗体的背景色 */
selection-background-color: rgb(64, 64, 192); /* 整个下拉窗体被选中项的背景色 */
selection-color: rgb(0, 0, 0); /* 整个下拉窗体被选中项的背景色 */
}
================================================
FILE: accesscontrol.cpp
================================================
#include "accesscontrol.h"
//#include "octonetwork.h"//Global prama
#include <QJsonDocument>
#include <QJsonObject>
#include <QNetworkReply>
#include <QJsonArray>
//#include <filedialog.h>
//#include <mainwindow.h>
AccessControl::AccessControl()
{
// GetACRequest.setUrl(QUrl(MainUrl));//http://IP/api/login
GetACRequest.setHeader(QNetworkRequest::ContentTypeHeader,QVariant("application/json"));
}
//login
void AccessControl::acLogin()
{
if(userinfo.uid == NULL || userinfo.uid.trimmed() == "" || userinfo.pwd == NULL)
{
emit CommunicationStateChange(false);
return;
}
GetACRequest.setUrl(QUrl(MainUrl + "login"));//http://IP/api/login
QJsonObject TemperatureJsonObj;
// {
// "user": "uid",
// "pass": "pwd",
// "remember": "remember me"
// }
TemperatureJsonObj.insert("user",userinfo.uid);
TemperatureJsonObj.insert("pass",userinfo.pwd);
TemperatureJsonObj.insert("remember","remember me");
TemperatureJsonObj.insert("passive",true);//被动模式登录,如果免登录依旧能够获取session///需要允许被动登录才可以获得免登录方式
QJsonDocument _SenderJson;
_SenderJson.setObject(TemperatureJsonObj);
ACManager->disconnect(SIGNAL(finished(QNetworkReply*)));
connect(ACManager,&QNetworkAccessManager::finished,this,&AccessControl::LoginReply);
ACManager->post(GetACRequest,_SenderJson.toJson());
}
void AccessControl::LoginReply(QNetworkReply *reply)
{
bool _return=false;
// ACManager->disconnect(SIGNAL(finished(QNetworkReply*)));
if(reply->error() == QNetworkReply::NoError)
{
int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if(statusCode == 200)//Have receive
{
// userinfo.login = true;
//创建接收对象
QByteArray replyArray = reply->readAll();
QJsonDocument loadDoc(QJsonDocument::fromJson(replyArray));
QJsonObject QObj = loadDoc.object();
//获取登录反馈内容
QList<QJsonValue> result = SearchJsonValue(LoginMsg , QObj);//{{"active"},{"admin"},{"apikey"},{"name"},{"session"}};
userinfo.login = result[0].toBool();
userinfo.admin = result[1].toBool();
userinfo.API_Key = result[2].toString().toUtf8();
userinfo.onlineUid = result[3].toString();
userinfo.session = result[4].toString().toUtf8();
_return = true;
}
}
ACManager->disconnect(SIGNAL(finished(QNetworkReply*)));
emit CommunicationStateChange(_return);
}
//logout
void AccessControl::acLogout()
{
GetACRequest.setUrl(QUrl(MainUrl + "logout"));//http://IP/api/logout
ACManager->disconnect(SIGNAL(finished(QNetworkReply*)));
connect(ACManager,&QNetworkAccessManager::finished,this,&AccessControl::LogoutReply);
}
void AccessControl::LogoutReply(QNetworkReply *reply)
{
bool _return=false;
if(reply->error() == QNetworkReply::NoError)
{
int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if(statusCode == 200)//Have receive
{
//重置登录参数
userinfo = UserInfo(userinfo.uid,userinfo.pwd);
//创建接收对象
QByteArray replyArray = reply->readAll();
QJsonDocument loadDoc(QJsonDocument::fromJson(replyArray));
QJsonObject QObj = loadDoc.object();
// QList<QString> SearchLink ;
//获取登录反馈内容
QList<QJsonValue> result = SearchJsonValue(LoginMsg , QObj);//{{"active"},{"admin"},{"apikey"},{"name"},{"session"}};///被动账户执行退出登录才会返回账户信息
if(!result[3].isNull() && result[3].isString() && result[3].toString() == "_admin")
{
userinfo.login = result[0].toBool();
userinfo.admin = result[1].toBool();
userinfo.onlineUid = result[3].toString();//判定免登录账户:_admin
}
_return = true;
}
}
ACManager->disconnect(SIGNAL(finished(QNetworkReply*)));
emit CommunicationStateChange(_return);
}
//Function
//Find_List_Name : Retrieved List Sequence --> [Grandma,Mother,Me]
//_QObj:Retrieved Retrieved Json Objecet
QJsonValue AccessControl::SearchJsonValue(QList<QString> Find_List_Name , QJsonObject _QObj)
{
QJsonValue returnValue;
QList<QString> SearchLink ;
SearchLink << Find_List_Name;
if(SearchLink.count() > 1)
{
QString MotherKey = SearchLink[0];
SearchLink.removeFirst();
if(MotherKey.indexOf("*") >= 0)//wildcard
{
QJsonArray ArrayValue;
for(int i = 0 ; i <= 9 ; i++)
{
QString TempMotherKey = MotherKey;
if(_QObj.find(TempMotherKey.replace("*",QString::number(i))).value().isUndefined())continue;
// if(QSysInfo::productType() != "raspbian"){qDebug()<<_QObj.find(TempMotherKey.replace("*",QString::number(i))).value().isUndefined();};
QJsonValue data = SearchJsonValue(SearchLink , _QObj.constFind(TempMotherKey.replace("*",QString::number(i))).value().toObject());
ArrayValue.append(data);
}
returnValue = ArrayValue;
}
else
returnValue = SearchJsonValue(SearchLink , _QObj.constFind(MotherKey).value().toObject());
}
else
{
if(SearchLink[0].indexOf("*") >= 0)//wildcard
{
}
else
returnValue = _QObj.constFind(SearchLink[0]).value();
}
return returnValue;
}
QList<QJsonValue> AccessControl::SearchJsonValue(QList<QList<QString>> Find_List_Names , QJsonObject _QObj)
{
QList<QJsonValue> _returnValue ;
foreach(QList<QString> item , Find_List_Names)
{
_returnValue.append(SearchJsonValue(item,_QObj));
}
return _returnValue;
}
================================================
FILE: accesscontrol.h
================================================
#ifndef ACCESSCONTROL_H
#define ACCESSCONTROL_H
#include <QJsonDocument>
#include <QJsonObject>
#include <QMetaType>
#include <QNetworkReply>
struct UserInfo{
QString uid;//用户设置登录账号
QString onlineUid;//当前登录账号
QString pwd;//账户密码
bool admin;//{"admin"}//判断权限是否充足,仅仅高级账户才能运行UI运作
bool login;//{"active"}//登录失败403拒绝访问,布尔值归位默认false
QByteArray API_Key;//{"apikey"}//如果没设置就不存在,引用全局Key
QByteArray session;//{"session"}//每次登录成功会获得新的对话ID,不区分超级账户和用户账户///为websocket提供接入ID
UserInfo(QString _uid = NULL , QString _pwd = NULL)
{
if(_uid != NULL && _pwd != NULL)
{
uid = _uid;
pwd = _pwd;
}
admin = false;
login = false;
API_Key = "";
session = "";
}
};
Q_DECLARE_METATYPE(UserInfo);
class AccessControl: public QObject
{
Q_OBJECT
public:
AccessControl();
QNetworkAccessManager *ACManager = new QNetworkAccessManager();
QNetworkRequest GetACRequest;
void acLogin();
void acLogout();
UserInfo userinfo = UserInfo();
// QByteArray user_X_API_Key = "";
signals:
void CommunicationStateChange(bool);
private:
// QWidget *FUI;
QString MainIP = "127.0.0.1";
QString MainAddress = "http://"+MainIP+"/";
QString MainUrl = MainAddress + "api/";
QJsonValue SearchJsonValue(QList<QString> Find_List_Name , QJsonObject _QObj);
QList<QJsonValue> SearchJsonValue(QList<QList<QString>> Find_List_Names , QJsonObject _QObj);
const QList<QList<QString>> LoginMsg = {{"active"},{"admin"},{"apikey"},{"name"},{"session"}};
private slots:
void LoginReply(QNetworkReply *reply);
void LogoutReply(QNetworkReply *reply);
};
#endif // ACCESSCONTROL_H
================================================
FILE: assets.qrc
================================================
<RCC>
<qresource prefix="/">
<file>assets/adjust.svg</file>
<file>assets/back.svg</file>
<file>assets/cancel.svg</file>
<file>assets/checkmark.svg</file>
<file>assets/confirm.svg</file>
<file>assets/control.svg</file>
<file>assets/delete.svg</file>
<file>assets/error.svg</file>
<file>assets/fan.svg</file>
<file>assets/filament.svg</file>
<file>assets/folder.svg</file>
<file>assets/heat-bed.svg</file>
<file>assets/help.svg</file>
<file>assets/invalid-config.svg</file>
<file>assets/next.svg</file>
<file>assets/nozzle.svg</file>
<file>assets/object.svg</file>
<file>assets/pause.svg</file>
<file>assets/print.svg</file>
<file>assets/resume.svg</file>
<file>assets/settings.svg</file>
<file>assets/sort.svg</file>
<file>assets/thermometer.svg</file>
<file>assets/upload.svg</file>
<file>assets/sync-alt.svg</file>
<file>assets/arrow_down.svg</file>
<file>assets/arrow_up.svg</file>
<file>assets/camera.svg</file>
<file>assets/daochu.svg</file>
<file>assets/daoru.svg</file>
<file>assets/emoji.svg</file>
<file>assets/guanji.svg</file>
<file>assets/info.svg</file>
<file>assets/more.svg</file>
<file>assets/off.svg</file>
<file>assets/rizhi.svg</file>
<file>assets/setting.svg</file>
<file>assets/shanchu.svg</file>
<file>assets/shangchuan.svg</file>
<file>assets/shezhi.svg</file>
<file>assets/shuaxin.svg</file>
<file>assets/video.svg</file>
<file>assets/xiazai.svg</file>
<file>assets/xinzeng.svg</file>
<file>assets/yuanchengkongzhi.svg</file>
<file>assets/zhongqi.svg</file>
<file>assets/chupeng.svg</file>
<file>assets/re.svg</file>
<file>assets/Wifi.svg</file>
<file>assets/penzui.svg</file>
<file>assets/heat.svg</file>
<file>assets/Network.svg</file>
<file>assets/heat-gas.svg</file>
<file>assets/nib.svg</file>
<file>assets/icon/icon-main-btt.svg</file>
<file>assets/icon/icon-main-btt-blue.svg</file>
<file>assets/3ddayin.svg</file>
<file>assets/Ddayin.svg</file>
<file>assets/huidaoyuandian.svg</file>
<file>assets/kongzhiqi_fengji.svg</file>
<file>assets/sanweidianyunsaomiao.svg</file>
<file>assets/sanweizuobiao.svg</file>
<file>assets/shanchuwenjian.svg</file>
<file>assets/shangchuanwenjian.svg</file>
<file>assets/wenjian.svg</file>
<file>assets/xiazaiwenjian.svg</file>
<file>assets/xitongpeizhi.svg</file>
<file>assets/yuandian.svg</file>
<file>assets/zhouxiang.svg</file>
<file>assets/haocaiguanli.svg</file>
<file>assets/jinggao.svg</file>
<file>assets/icon/BTT_Duck.svg</file>
<file>assets/dangxinjixieshangren.svg</file>
<file>assets/jixiezhizao.svg</file>
<file>assets/shebeiweilianjie-copy.svg</file>
<file>assets/fanhuiyemian.svg</file>
<file>assets/hazard.svg</file>
<file>assets/huijia.svg</file>
<file>assets/icon_liangchi.svg</file>
<file>assets/jiareqi.svg</file>
<file>assets/shuangdong.svg</file>
<file>assets/zhongzhi.svg</file>
<file>assets/kongzhimianban.svg</file>
<file>assets/kongzhimianban_B.svg</file>
<file>assets/kongzhimianban_L.svg</file>
<file>assets/kongzhimianban_W.svg</file>
<file>assets/xiangxiaji.svg</file>
<file>assets/jiare.svg</file>
<file>assets/huitui.svg</file>
<file>assets/shang.svg</file>
<file>assets/shangsheng.svg</file>
<file>assets/xia.svg</file>
<file>assets/xiajiang.svg</file>
<file>assets/you.svg</file>
<file>assets/yuandian_W.svg</file>
<file>assets/zuo.svg</file>
<file>assets/shangxiajuzhong.svg</file>
<file>assets/zuoyoujuzhong.svg</file>
<file>assets/chuizhijuzhong.svg</file>
<file>assets/youshang.svg</file>
<file>assets/zuoxia.svg</file>
<file>assets/tingzhi.svg</file>
<file>assets/hold__easyico.svg</file>
<file>assets/jiesuo.svg</file>
<file>assets/terminal.svg</file>
<file>assets/usb.svg</file>
<file>assets/queren.svg</file>
<file>assets/wangluo.svg</file>
<file>assets/wangluolianjiechaoshi.svg</file>
<file>assets/Wifi_Lock.svg</file>
<file>assets/Wifi_Unlock.svg</file>
<file>assets/WiFi2.svg</file>
<file>assets/kongzhimianban2.svg</file>
<file>assets/xiangji.svg</file>
<file>assets/yuanchengkongzhi2.svg</file>
<file>assets/terminal-box-line.svg</file>
<file>assets/ceshi.gif</file>
<file>assets/start.svg</file>
<file>assets/stop.svg</file>
<file>assets/flip-2.svg</file>
<file>assets/flip.svg</file>
<file>assets/webside.svg</file>
<file>assets/webside2.svg</file>
<file>config.conf</file>
<file>StyleSheet/globalStyleSheet.qss</file>
<file>assets/kongge.svg</file>
<file>assets/deleteBtn.svg</file>
<file>assets/icon/BingoTouch_Logo_H.svg</file>
</qresource>
</RCC>
================================================
FILE: cameradialog.cpp
================================================
#include "cameradialog.h"
#include "ui_cameradialog.h"
#include <mainwindow.h>
//#include <QSizeF>
//#include "QList"
//#include "QCamera"
//#include "QCameraInfo"
CameraDialog::CameraDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CameraDialog)
{
ui->setupUi(this);
FUI = (MainWindow*)parent;
// QList<QCameraInfo> list;
// list = QCameraInfo::availableCameras();
// ui->Box_CameraId->clear();
// for (int i = 0; i < list.size(); i++)
// {
// ui->Box_CameraId->addItem(list.at(i).description());
// }
this->resize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setMaximumSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setFixedSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
QFont _font = ui->Btn_Sensor->font();
_font.setPointSize(this->maximumWidth() > this->maximumHeight() ? (int)this->maximumHeight()/30 : (int)this->maximumWidth()/30);
ui->Btn_Sensor->setFont(_font);
ui->Btn_FlipH->setFont(_font);
ui->Btn_FlipV->setFont(_font);
// if(ui->Windows->geometry().width() > ui->Windows->geometry().height())
// ui->Windows->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Expanding);
// else
// ui->Windows->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
/* 创建一个用于应用程序发送网络请求和接收网络应答的"管理员" */
manager = new QNetworkAccessManager(this);
/* 创建一个要发送的请求实例 */
request = new QNetworkRequest(QUrl(((MainWindow*)FUI)->octonetwork.MainAddress +"/webcam/?action=snapshot"));
request->setRawHeader("X_Api_Key",((MainWindow*)FUI)->octonetwork.X_API_Key);
ui->Btn_Sensor->setChecked(false);
}
CameraDialog::~CameraDialog()
{
delete ui;
}
void CameraDialog::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
ui->Btn_Sensor->setChecked(true);
}
void CameraDialog::on_Btn_Back_clicked()
{
// ui->Btn_Sensor->setText("Start");
// ui->Windows->clear();
// /* 解除关联,这样就不显示了 */
// disconnect(manager, SIGNAL(finished(QNetworkReply*)), this, NULL);
ui->Btn_Sensor->setChecked(false);
this->close();
}
/* 实现槽函数 */
void CameraDialog::mjpeg_streamer_reply(QNetworkReply *reply)
{
/* 读出全部数据 */
QByteArray byteArr = reply->readAll();
// qDebug() << byteArr;
/* 构建pixmap */
// QPixmap pixmap;
// pixmap.loadFromData(byteArr);
QImage image;
image.loadFromData(byteArr);
// QPixmap pixmap = QPixmap::fromImage(mirroredImage);
/* Label显示图像 */
ui->Windows->clear();
ui->Windows->setPixmap(QPixmap::fromImage(image.mirrored(ui->Btn_FlipH->isChecked(), ui->Btn_FlipV->isChecked())));
// ui->Windows->setScaledContents(true);
ui->Windows->show();
delete(reply);
/* 继续请求URL */
manager->get(*request);
}
void CameraDialog::on_Btn_Sensor_toggled(bool checked)
{
if(checked)
{
ui->Btn_Sensor->setText("Stop");
ui->Btn_Sensor->setIcon(QIcon(":/assets/stop.svg"));
request->setUrl(QUrl(((MainWindow*)FUI)->octonetwork.MainAddress +"/webcam/?action=snapshot"));
/* 设置"请求完成"与mjpeg_streamer_reply()这个槽关联 */
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(mjpeg_streamer_reply(QNetworkReply*)));
/* 开始请求URL */
manager->get(*request);
}
else
{
ui->Btn_Sensor->setText("Start");
ui->Btn_Sensor->setIcon(QIcon(":/assets/start.svg"));
ui->Windows->clear();
/* 解除关联,这样就不显示了 */
disconnect(manager, SIGNAL(finished(QNetworkReply*)), this, NULL);
}
}
================================================
FILE: cameradialog.h
================================================
#ifndef CAMERADIALOG_H
#define CAMERADIALOG_H
#include <QDialog>
#include <QSizeF>
#include <QNetworkReply>
extern int DebugFlat ;
extern QSizeF SizePercent;
//#include <QCamera>
//#include <QCameraImageCapture>
//#include <QMediaRecorder>
namespace Ui {
class CameraDialog;
}
//class QCamera;
//class QCameraViewfinder;
//class QCameraImageCapture;
class CameraDialog : public QDialog
{
Q_OBJECT
public:
explicit CameraDialog(QWidget *parent = nullptr);
~CameraDialog();
private slots:
virtual void on_Btn_Back_clicked();
void mjpeg_streamer_reply(QNetworkReply *reply);
void on_Btn_Sensor_toggled(bool checked);
private:
Ui::CameraDialog *ui;
QNetworkAccessManager *manager = new QNetworkAccessManager();
QNetworkRequest *request;
QWidget *FUI;
protected:
void showEvent(QShowEvent *event);
};
#endif // CAMERADIALOG_H
================================================
FILE: cameradialog.ui
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CameraDialog</class>
<widget class="QDialog" name="CameraDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>.AppleSystemUIFont</family>
</font>
</property>
<property name="windowTitle">
<string>Camera</string>
</property>
<property name="windowIcon">
<iconset resource="assets.qrc">
<normaloff>:/assets/xiangji.svg</normaloff>:/assets/xiangji.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0,7">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="Btn_Back">
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/huitui.svg</normaloff>:/assets/huitui.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Logo">
<property name="styleSheet">
<string notr="true">border:none;
font: 75 30pt "Gill Sans MT";
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/camera.svg</normaloff>:/assets/camera.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_null">
<property name="minimumSize">
<size>
<width>76</width>
<height>72</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="1">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,4,0,1">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0" rowminimumheight="0,0,0">
<item row="0" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="Windows">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0">
<property name="spacing">
<number>7</number>
</property>
<item>
<widget class="QToolButton" name="Btn_Sensor">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>SimSun</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="whatsThis">
<string>BTStyleSheet8</string>
</property>
<property name="text">
<string>Stop</string>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/stop.svg</normaloff>:/assets/stop.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>140</width>
<height>80</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="Btn_FlipH">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>SimSun</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="whatsThis">
<string>BTStyleSheet8</string>
</property>
<property name="text">
<string>Flip Horizontal</string>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/flip-2.svg</normaloff>:/assets/flip-2.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>140</width>
<height>80</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="Btn_FlipV">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>SimSun</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="whatsThis">
<string>BTStyleSheet8</string>
</property>
<property name="text">
<string>Flip Vertical</string>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/flip.svg</normaloff>:/assets/flip.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>140</width>
<height>80</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="assets.qrc"/>
</resources>
<connections/>
</ui>
================================================
FILE: config.conf
================================================
/*1.0.0*/
================================================
FILE: configuration.cpp
================================================
#include "configuration.h"
#include "ui_configuration.h"
#include <mainwindow.h>
//#include <QSizeF>
Configuration::Configuration(QWidget *parent) :
QDialog(parent),
ui(new Ui::Configuration)
{
ui->setupUi(this);
FUI = (MainWindow*)parent;//((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_Setting);
//各个窗体名字
QStringList strList;
strList.append("Wifi");
// strList.append("GConde");
strList.append("RPI Terminal");
strList.append("Gcode Terminal");
// strList.append("OctoPrint Webside");
foreach(QString item,strList)
{
QStandardItem *menulist = new QStandardItem(static_cast<QString>(item));
menulist->setForeground(QColor(255,255,255));
menulist->setTextAlignment(Qt::AlignCenter);
if(item == "Wifi")
{
menulist->setIcon(QIcon(":/assets/Wifi.svg"));
}
else if(item == "RPI Terminal")
{
menulist->setIcon(QIcon(":/assets/terminal.svg"));
}
else if(item == "Gcode Terminal")
{
menulist->setIcon(QIcon(":/assets/yuanchengkongzhi.svg"));
}
// else if(item == "OctoPrint Webside")
// {
// menulist->setIcon(QIcon(":/assets/webside.svg"));
// menulist->setBackground(QBrush(Qt::blue));
// }
ItemModel->appendRow(menulist);
}
ui->Frm_ListView->setModel(ItemModel);
ui->Frm_ListView->setIconSize(QSize((int)(SizePercent.width()*72),(int)(SizePercent.height()*72)));
QFont font;
font.setPointSize((int)(ui->Frm_ListView->font().pointSize()*(SizePercent.width() < SizePercent.height() ? SizePercent.width():SizePercent.height())));
ui->Frm_ListView->setFont(font);
this->resize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setMaximumSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setFixedSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
}
Configuration::~Configuration()
{
delete ui;
}
void Configuration::on_Btn_Back_clicked()
{
this->close();
}
void Configuration::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
}
void Configuration::on_Frm_ListView_clicked(const QModelIndex &index)
{
//ui->Btn_Help->setText(index.data().toString());
if(index.data().toString() == "Wifi")
((MainWindow*)FUI)->wlanconfig->show();
if(index.data().toString() == "RPI Terminal")
((MainWindow*)FUI)->terminaldialog->show();
if(index.data().toString() == "Gcode Terminal")//GCode 控制台
((MainWindow*)FUI)->gcodedialog->show();
// if(index.data().toString() == "OctoPrint Webside")
// ((MainWindow*)FUI)->webdialog->show();
}
void Configuration::on_Btn_Help_clicked()
{
((MainWindow*)FUI)->wlanconfig->GetNetworkInfo();
}
================================================
FILE: configuration.h
================================================
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include <QDialog>
#include <QSizeF>
#include <QStandardItemModel>
extern int DebugFlat ;
extern QSizeF SizePercent;
namespace Ui {
class Configuration;
}
class Configuration : public QDialog
{
Q_OBJECT
public:
explicit Configuration(QWidget *parent = nullptr);
~Configuration();
private slots:
virtual void on_Btn_Back_clicked();
void on_Frm_ListView_clicked(const QModelIndex &index);
void on_Btn_Help_clicked();
private:
Ui::Configuration *ui;
QWidget *FUI;
QStandardItemModel *ItemModel = new QStandardItemModel(this);
protected:
void showEvent(QShowEvent *event);
};
#endif // CONFIGURATION_H
================================================
FILE: configuration.ui
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Configuration</class>
<widget class="QDialog" name="Configuration">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Configuration</string>
</property>
<property name="windowIcon">
<iconset resource="assets.qrc">
<normaloff>:/assets/xitongpeizhi.svg</normaloff>:/assets/xitongpeizhi.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,7">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="Btn_Back">
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/huitui.svg</normaloff>:/assets/huitui.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Logo">
<property name="styleSheet">
<string notr="true">border:none;
font: 75 30pt "Gill Sans MT";
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/xitongpeizhi.svg</normaloff>:/assets/xitongpeizhi.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Help">
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/help.svg</normaloff>:/assets/help.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QListView" name="Frm_ListView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>50</pointsize>
</font>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="assets.qrc"/>
</resources>
<connections/>
</ui>
================================================
FILE: controlpanel.cpp
================================================
#include "controlpanel.h"
#include "ui_controlpanel.h"
#include <QProcess>
#include <mainwindow.h>
#include <QDialog>
//#include <QSizeF>
#include <QPalette>
#include <QBitmap>
#include <QPainter>
#include <QTextBrowser>
#include <QDesktopWidget>
ControlPanel::ControlPanel(QWidget *parent) :
QDialog(parent),
ui(new Ui::ControlPanel)
{
ui->setupUi(this);
FUI = (MainWindow*)parent;//((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_Setting);
//使控件适应屏幕的大小
this->resize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480)); //将控件大小固定为800*480
this->setMaximumSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setFixedSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
//设置冷热按键的样式表
ui->Btn_Cool->setStyleSheet("QPushButton {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251);color: rgb(245, 246, 250);}"\
"QPushButton:hover {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251); background-color: rgb(18, 74, 125);}"\
"QPushButton:pressed{padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251); background-color: rgb(18, 74, 125); padding-right:4px;padding-bottom:4px;}");
ui->Btn_Heat->setStyleSheet("QPushButton {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6);color: rgb(245, 246, 250);}"\
"QPushButton:hover {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6); background-color: rgb(108, 15, 3);}"\
"QPushButton:pressed{padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6); background-color: rgb(108, 15, 3); padding-right:4px;padding-bottom:4px;}");
ui->Btn_Axle_Home->setStyleSheet("border-color: rgb(230, 230, 230);");
ui->Btn_Unlock->setStyleSheet("border-color: rgb(43, 166, 56);");
ui->Btn_Restore->setStyleSheet("border-color: rgb(205, 205, 205);");
ui->Btn_Shutdown->setStyleSheet("border-color: rgb(216, 30, 6);");
ui->Btn_Extruder_E->setStyleSheet("border-color: rgb(245, 246, 255);");
ui->Btn_Extruder_R->setStyleSheet("border-color: rgb(245, 246, 255);");
}
ControlPanel::~ControlPanel()
{
delete ui;
}
void ControlPanel::on_Btn_Back_clicked()
{
this->close();//关闭窗口
}
void ControlPanel::on_Btn_R_1_clicked()
{
MoveSpeed = 1;
ui->Btn_R_1->setStyleSheet(SelectKey);
ui->Btn_R_5->setStyleSheet(UnSelectKey);
ui->Btn_R_10->setStyleSheet(UnSelectKey);
ui->Btn_R_50->setStyleSheet(UnSelectKey);
ui->Btn_R_100->setStyleSheet(UnSelectKey);
}
void ControlPanel::on_Btn_R_5_clicked()
{
MoveSpeed = 5;
ui->Btn_R_1->setStyleSheet(UnSelectKey);
ui->Btn_R_5->setStyleSheet(SelectKey);
ui->Btn_R_10->setStyleSheet(UnSelectKey);
ui->Btn_R_50->setStyleSheet(UnSelectKey);
ui->Btn_R_100->setStyleSheet(UnSelectKey);
}
void ControlPanel::on_Btn_R_10_clicked()
{
MoveSpeed = 10;
ui->Btn_R_1->setStyleSheet(UnSelectKey);
ui->Btn_R_5->setStyleSheet(UnSelectKey);
ui->Btn_R_10->setStyleSheet(SelectKey);
ui->Btn_R_50->setStyleSheet(UnSelectKey);
ui->Btn_R_100->setStyleSheet(UnSelectKey);
}
void ControlPanel::on_Btn_R_50_clicked()
{
MoveSpeed = 50;
ui->Btn_R_1->setStyleSheet(UnSelectKey);
ui->Btn_R_5->setStyleSheet(UnSelectKey);
ui->Btn_R_10->setStyleSheet(UnSelectKey);
ui->Btn_R_50->setStyleSheet(SelectKey);
ui->Btn_R_100->setStyleSheet(UnSelectKey);
}
void ControlPanel::on_Btn_R_100_clicked()
{
MoveSpeed = 100;
ui->Btn_R_1->setStyleSheet(UnSelectKey);
ui->Btn_R_5->setStyleSheet(UnSelectKey);
ui->Btn_R_10->setStyleSheet(UnSelectKey);
ui->Btn_R_50->setStyleSheet(UnSelectKey);
ui->Btn_R_100->setStyleSheet(SelectKey);
}
void ControlPanel::on_Btn_Heat_toggled(bool checked)
{
if(checked)//如果升温按钮被点击,关闭降温按钮
{
ui->Btn_Cool->setStyleSheet("QPushButton {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251);}"\
"QPushButton:hover {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251); background-color: rgb(18, 74, 125);}"\
"QPushButton:pressed{padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251); background-color: rgb(18, 74, 125); padding-right:4px;padding-bottom:4px;}");
ui->Btn_Heat->setStyleSheet("QPushButton {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6); background-color: rgb(108, 15, 3); padding-right:4px;padding-bottom:4px;}"\
"QPushButton:hover {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6); background-color: rgb(108, 15, 3); padding-right:4px;padding-bottom:4px;}"\
"QPushButton:pressed{padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6); background-color: rgb(108, 15, 3); padding-right:4px;padding-bottom:4px;}");
if(ui->Btn_Cool->isChecked())
{
ui->Btn_Cool->setChecked(false);
//发送升温指令
QList<QString> _GCode_Setting;
_GCode_Setting.append("M140 S60");
_GCode_Setting.append("M104 S200");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_Setting);
}
}
}
void ControlPanel::on_Btn_Cool_toggled(bool checked)
{
if(checked)
{
ui->Btn_Heat->setStyleSheet("QPushButton {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6);}"\
"QPushButton:hover {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6); background-color: rgb(108, 15, 3);}"\
"QPushButton:pressed{padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(216, 30, 6); background-color: rgb(108, 15, 3); padding-right:4px;padding-bottom:4px;}");
ui->Btn_Cool->setStyleSheet("QPushButton {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251); background-color: rgb(18, 74, 125); padding-right:4px;padding-bottom:4px;}"\
"QPushButton:hover {padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251); background-color: rgb(18, 74, 125); padding-right:4px;padding-bottom:4px;}"\
"QPushButton:pressed{padding: 10px;border-style: solid;border-width: 5px;border-radius: 20px;border-color: rgb(36, 148, 251); background-color: rgb(18, 74, 125); padding-right:4px;padding-bottom:4px;}");
}
// ui->Btn_Cool->setStyleSheet(checked?ui->Btn_Cool->styleSheet()+"background-color:rgb(18, 74, 125);":"padding: 10px;\nborder-style: solid;\nborder-width: 5px;\nborder-radius: 20px;\nborder-color: rgb(36, 148, 251);");
QList<QString> _GCode_;
if(checked)//如果降下温按钮被点击,关闭升温按钮
{
if(ui->Btn_Heat->isChecked())
ui->Btn_Heat->setChecked(false);
//发送降温指令
_GCode_.append("M106 S255");
_GCode_.append("M104 S0");
_GCode_.append("M140 S0");
}
else
{
_GCode_.append("M106 S0");//?
}
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
//坐标归位按键按下所有坐标归位,按键变色
void ControlPanel::on_Btn_Axle_Home_clicked()
{
//发送归位指令
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G28");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
//Unlock Motors 锁定喷头温度和工床温度
void ControlPanel::on_Btn_Unlock_clicked()
{
QList<QString> _GCode_;
_GCode_.append("M18");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
//重启 OctoBTT、重启OctoPrint以及取消
void ControlPanel::on_Btn_Restore_clicked()
{
// StyleSheet_Temp = ui->Btn_Restore->styleSheet();//获取按键的样式表用以恢复颜色
// ui->Btn_Restore->setStyleSheet(StyleSheet_Temp+"\nbackground-color:rgb(128,128,128,128);");
QStringList btnName = {"Restart OctoBTT" , "Restart OctoPrint", "Cancel"} ;
CustomDialog *newDialog = new CustomDialog();
QObject::connect(newDialog, &CustomDialog::OutputEvent, newDialog,[=](QString instruct)
{
if(instruct == "Restart OctoBTT")
{
//重启OctoBTT
qApp->exit(Base_Restart);
}
else if(instruct == "Restart OctoPrint")
{
//重启Octoprint
QProcess P(0);
P.start("sudo service octoprint restart");
P.waitForStarted();
P.waitForFinished();
qApp->exit(Base_Restart);
}
});
newDialog->showCustomDialog("what do you want ?",":/assets/zhongzhi.svg",btnName,this);
}
//紧急制停、关机以及取消
void ControlPanel::on_Btn_Shutdown_clicked()
{
QStringList btnName = {"Emergency Stop" , "Shutdown", "Cancel"} ;
CustomDialog *newDialog = new CustomDialog();
QObject::connect(newDialog, &CustomDialog::OutputEvent, newDialog,[=](QString instruct)
{
if(instruct == "Emergency Stop")
{
//紧急制停
QList<QString> _GCode_;
// _GCode_.append("M110 N0");
_GCode_.append("M112");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
else if(instruct == "Shutdown")
{
//关机
QProcess P(0);
P.start("xset dpms force off");
P.waitForStarted();
P.waitForFinished();
qApp->exit(Base_Shutdown);
}
});
newDialog->showCustomDialog("what do you want ?",":/assets/hazard.svg",btnName,this);
}
void ControlPanel::on_Btn_Axle_X_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G28 X");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Axle_Y_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G28 Y");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Axle_Z_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G28 Z");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_XY_Res_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G28 X Y");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Y_Add_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G1 Y"+QString::number(MoveSpeed)+" F6000");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Y_Dec_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G1 Y-"+QString::number(MoveSpeed)+" F6000");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_X_Dec_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G1 X-"+QString::number(MoveSpeed)+" F6000");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_X_Add_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G1 X"+QString::number(MoveSpeed)+" F6000");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Z_Add_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G1 Z"+QString::number(MoveSpeed)+" F200");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Z_Dec_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G1 Z-"+QString::number(MoveSpeed)+" F200");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Extruder_R_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G1 E-"+QString::number(MoveSpeed)+" F300");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Extruder_E_clicked()
{
QList<QString> _GCode_;
_GCode_.append("G91");
_GCode_.append("G1 E"+QString::number(MoveSpeed)+" F300");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Z_BS_Add_clicked()
{
QList<QString> _GCode_;
// _GCode_.append("M110 N0");
_GCode_.append("G91");
_GCode_.append("M290 Z"+QString::number((double)MoveSpeed/100));
_GCode_.append("M500");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
void ControlPanel::on_Btn_Z_BS_Dec_clicked()
{
QList<QString> _GCode_;
// _GCode_.append("M110 N0");
_GCode_.append("G91");
_GCode_.append("M290 Z-"+QString::number((double)MoveSpeed/100));
_GCode_.append("M500");
_GCode_.append("G90");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
//自动调平按键
void ControlPanel::on_Btn_Level_clicked()
{
//如果点击退出,关闭弹窗
if(((MainWindow*)FUI)->octonetwork.ConnectState == "Operational")
{
QStringList btnName = {"Yes", "No"} ;
CustomDialog *newDialog = new CustomDialog();
QObject::connect(newDialog, &CustomDialog::OutputEvent, newDialog,[=](QString instruct)
{
if(instruct == "Yes")
{
QList<QString> _GCode_;
_GCode_.append("M502");
_GCode_.append("M500");
_GCode_.append("G91");
_GCode_.append("G28");
_GCode_.append("G29");
_GCode_.append("G90");
_GCode_.append("M500");
((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_);
}
});
newDialog->showCustomDialog("Self-leveling",":/assets/kongzhimianban_B.svg",btnName,"Whether the automatic leveling sensor has been installed ?",this);
}
else
{
CustomDialog *newDialog = new CustomDialog();
newDialog->showCustomDialog("Self-leveling",":/assets/kongzhimianban_B.svg","Current state not supported !",this);
}
}
================================================
FILE: controlpanel.h
================================================
#ifndef CONTROLPANEL_H
#define CONTROLPANEL_H
#include <QDialog>
#include <QSizeF>
#include <QResizeEvent>
#include "customdialog.h"
extern int DebugFlat ;
extern QSizeF SizePercent;
const static int Base_Restart = 773;
const static int Base_Shutdown = 772;
const static int Base_OnlyExitApp = 770;
namespace Ui {
class ControlPanel;
}
class ControlPanel : public QDialog
{
Q_OBJECT
public:
explicit ControlPanel(QWidget *parent = nullptr);
~ControlPanel();
private slots:
virtual void on_Btn_Back_clicked();
virtual void on_Btn_R_1_clicked();
virtual void on_Btn_R_5_clicked();
virtual void on_Btn_R_10_clicked();
virtual void on_Btn_R_50_clicked();
virtual void on_Btn_R_100_clicked();
virtual void on_Btn_Heat_toggled(bool checked);
virtual void on_Btn_Cool_toggled(bool checked);
virtual void on_Btn_Axle_Home_clicked();
virtual void on_Btn_Unlock_clicked();
virtual void on_Btn_Restore_clicked();
virtual void on_Btn_Shutdown_clicked();
virtual void on_Btn_Axle_X_clicked();
virtual void on_Btn_Axle_Y_clicked();
virtual void on_Btn_Axle_Z_clicked();
virtual void on_Btn_XY_Res_clicked();
virtual void on_Btn_Y_Add_clicked();
virtual void on_Btn_Y_Dec_clicked();
virtual void on_Btn_X_Dec_clicked();
virtual void on_Btn_X_Add_clicked();
virtual void on_Btn_Z_Add_clicked();
virtual void on_Btn_Z_Dec_clicked();
virtual void on_Btn_Extruder_R_clicked();
virtual void on_Btn_Extruder_E_clicked();
virtual void on_Btn_Z_BS_Add_clicked();
virtual void on_Btn_Z_BS_Dec_clicked();
virtual void on_Btn_Level_clicked();
private:
Ui::ControlPanel *ui;
QString UnSelectKey = "QPushButton{color: rgb(245, 246, 250); border-color:rgb(245, 246, 250); border-style: solid; border-width: 5px; border-radius: 20px;}"\
"QPushButton:hover{border:none;background-color:rgb(128,128,128,128); border-color:rgb(245, 246, 250); border-style: solid; border-width: 5px; border-radius: 20px;}"\
"QPushButton:pressed{border:none; padding-right:4px; padding-bottom:4px; border-color:rgb(245, 246, 250); border-style: solid; border-width: 5px; border-radius: 20px;}";
QString SelectKey = "background-color: rgb(128,128,128);\ncolor: rgb(245, 246, 250);\nborder-color:rgb(0, 255, 0)";
QString StyleSheet_Temp;
int MoveSpeed = 10;
QWidget *FUI;
int RestoreFlag = 0;
};
#endif // CONTROLPANEL_H
================================================
FILE: controlpanel.ui
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ControlPanel</class>
<widget class="QDialog" name="ControlPanel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Control</string>
</property>
<property name="windowIcon">
<iconset resource="assets.qrc">
<normaloff>:/assets/Ddayin.svg</normaloff>:/assets/Ddayin.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,7">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="Btn_Back">
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/huitui.svg</normaloff>:/assets/huitui.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Logo">
<property name="styleSheet">
<string notr="true">border:none;
font: 75 30pt "Gill Sans MT";
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/jixiezhizao.svg</normaloff>:/assets/jixiezhizao.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>84</width>
<height>78</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="3,0">
<property name="spacing">
<number>2</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="7,0,1">
<property name="spacing">
<number>5</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1,0,1,0,1,0,0" columnstretch="0,1,0,1,1,1,0,1">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="spacing">
<number>2</number>
</property>
<item row="6" column="6">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="5" alignment="Qt::AlignLeft|Qt::AlignVCenter">
<widget class="QPushButton" name="Btn_X_Add">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/you.svg</normaloff>:/assets/you.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Axle</string>
</attribute>
</widget>
</item>
<item row="3" column="1" alignment="Qt::AlignVCenter">
<widget class="QPushButton" name="Btn_Axle_Y">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/shangxiajuzhong.svg</normaloff>:/assets/shangxiajuzhong.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3" alignment="Qt::AlignRight|Qt::AlignBottom">
<widget class="QPushButton" name="Btn_Z_Add">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/youshang.svg</normaloff>:/assets/youshang.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Axle</string>
</attribute>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="3" colspan="3">
<widget class="QPushButton" name="pushButton_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>15</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>Z BabyStep</string>
</property>
</widget>
</item>
<item row="5" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QPushButton" name="pushButton_14">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>15</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>Z</string>
</property>
</widget>
</item>
<item row="1" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QPushButton" name="pushButton_16">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>15</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QPushButton" name="pushButton_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>15</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>Restore</string>
</property>
</widget>
</item>
<item row="5" column="7" alignment="Qt::AlignHCenter|Qt::AlignTop">
<widget class="QPushButton" name="Btn_Extruder_E">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="whatsThis">
<string>BTStyleSheet1</string>
</property>
<property name="text">
<string>Ext.</string>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="2" column="6">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" alignment="Qt::AlignVCenter">
<widget class="QPushButton" name="Btn_Axle_X">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/zuoyoujuzhong.svg</normaloff>:/assets/zuoyoujuzhong.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="7" column="7" alignment="Qt::AlignHCenter">
<widget class="QPushButton" name="pushButton_15">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>15</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>Level</string>
</property>
</widget>
</item>
<item row="4" column="6">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="4" alignment="Qt::AlignHCenter|Qt::AlignTop">
<widget class="QPushButton" name="Btn_XY_Res">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>XY Axle Restore</string>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/yuandian_W.svg</normaloff>:/assets/yuandian_W.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Axle</string>
</attribute>
</widget>
</item>
<item row="5" column="3" alignment="Qt::AlignRight|Qt::AlignTop">
<widget class="QPushButton" name="Btn_Z_BS_Add">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>BabyStep : Speed Value Divided By One Hundred</string>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/shangsheng.svg</normaloff>:/assets/shangsheng.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="1" column="4" alignment="Qt::AlignHCenter|Qt::AlignBottom">
<widget class="QPushButton" name="Btn_Y_Add">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/shang.svg</normaloff>:/assets/shang.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Axle</string>
</attribute>
</widget>
</item>
<item row="3" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QPushButton" name="pushButton_17">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>15</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>Y</string>
</property>
</widget>
</item>
<item row="3" column="4" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QPushButton" name="Btn_Y_Dec">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/xia.svg</normaloff>:/assets/xia.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Axle</string>
</attribute>
</widget>
</item>
<item row="4" column="2">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="7" alignment="Qt::AlignHCenter|Qt::AlignBottom">
<widget class="QPushButton" name="Btn_Extruder_R">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="whatsThis">
<string>BTStyleSheet1</string>
</property>
<property name="text">
<string>Ret.</string>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="6" column="2">
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="7" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QPushButton" name="Btn_Level">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/kongzhimianban.svg</normaloff>:/assets/kongzhimianban.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Axle</string>
</attribute>
</widget>
</item>
<item row="0" column="6">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="5" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QPushButton" name="Btn_Z_BS_Dec">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>BabyStep : Speed Value Divided By One Hundred</string>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/xiajiang.svg</normaloff>:/assets/xiajiang.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="1" column="5" alignment="Qt::AlignLeft|Qt::AlignBottom">
<widget class="QPushButton" name="Btn_Z_Dec">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/zuoxia.svg</normaloff>:/assets/zuoxia.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Axle</string>
</attribute>
</widget>
</item>
<item row="3" column="3" alignment="Qt::AlignRight|Qt::AlignVCenter">
<widget class="QPushButton" name="Btn_X_Dec">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/zuo.svg</normaloff>:/assets/zuo.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Axle</string>
</attribute>
</widget>
</item>
<item row="5" column="1" alignment="Qt::AlignVCenter">
<widget class="QPushButton" name="Btn_Axle_Z">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/chuizhijuzhong.svg</normaloff>:/assets/chuizhijuzhong.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton_18">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>15</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">border: none;
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>Speed</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<property name="styleSheet">
<string notr="true"> padding: 10px;
border-style: solid;
border-width: 5px;
border-radius: 20px;</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="Btn_R_1">
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>1</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Rate</string>
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="Btn_R_5">
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>5</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Rate</string>
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="Btn_R_10">
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(245, 246, 250);
border-color:rgb(0, 255, 0);
background-color: rgb(128, 128, 128);</string>
</property>
<property name="text">
<string>10</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Rate</string>
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="Btn_R_50">
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>50</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Rate</string>
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="Btn_R_100">
<property name="font">
<font>
<family>Gill Sans MT</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">
color: rgb(245, 246, 250);</string>
</property>
<property name="text">
<string>100</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">Btn_Rate</string>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="widgetR" native="true">
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1,1,1" columnstretch="1,1">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="spacing">
<number>3</number>
</property>
<item row="2" column="0">
<widget class="QPushButton" name="Btn_Restore">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet1</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/zhongzhi.svg</normaloff>:/assets/zhongzhi.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="Btn_Shutdown">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet1</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/hazard.svg</normaloff>:/assets/hazard.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="Btn_Cool">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/shuangdong.svg</normaloff>:/assets/shuangdong.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="Btn_Axle_Home">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet1</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/huijia.svg</normaloff>:/assets/huijia.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="Btn_Unlock">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>BTStyleSheet1</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/jiesuo.svg</normaloff>:/assets/jiesuo.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="Btn_Heat">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/jiare.svg</normaloff>:/assets/jiare.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="assets.qrc"/>
</resources>
<connections/>
<buttongroups>
<buttongroup name="Btn_Rate"/>
<buttongroup name="Btn_Axle"/>
</buttongroups>
</ui>
================================================
FILE: customdialog.cpp
================================================
#include "customdialog.h"
/// windowName:窗体标题
/// windowIcon:窗体标识图片路径
/// buttonName:按键水平布局---纯按键(垂直布局)
/// textContent:文本垂直布局
void CustomDialog::showCustomDialog(QString windowName, QString windowIcon, QStringList buttonName, QString textContent, QWidget *parent)
{
//传参
_WindowName = windowName;
_WindowIcon = windowIcon;
_ButtonName = buttonName;
_TextContent = textContent;
_Parent = parent;
//背景颜色
this->setWindowOpacity(0.9); //透明度
this->setStyleSheet("background-color: rgba(128, 128, 128, 25%)"); //背景
//设置窗口的标题和标识
this->setWindowTitle(_WindowName);
this->setWindowIcon(QIcon(_WindowIcon));
//适应屏幕大小
this->resize(_Parent->width()*0.9,_Parent->height()*0.9);
this->setFixedSize(_Parent->width()*0.9,_Parent->height()*0.9);
//使弹窗居中显示
this->move(_Parent->pos().x() + (_Parent->width() - this->width()) / 2,_Parent->pos().y() + (_Parent->height() - this->height()) / 2);
//设置文本显示
QTextBrowser textBrowser;
textBrowser.setStyleSheet("border: none; color: rgb(245, 246, 255);background-color: rgba(128, 128, 128, 0%);");
textBrowser.setText(_TextContent);
textBrowser.setFixedSize(_Parent->width()*0.877,_Parent->height()*0.5);
// textBrowser.move();
// textBrowser.setGeometry(50,50,_Parent->width()*800*0.8,_Parent->height()*480*0.5);
textBrowser.setAlignment(Qt::AlignCenter);
//根据QStringList buttonName创建按键
QList<QPushButton*> btn;
for(int i = 0;i < _ButtonName.count() ;i++)
{
btn.append(new QPushButton(_ButtonName[i]));
btn[i] = new QPushButton(_ButtonName[i]);
//指定按键样式
btn[i]->setWhatsThis("BTStyleSheet");
//调整字体大小
QFont _font = btn[i]->font();
_font.setPointSize(_Parent->maximumWidth() > _Parent->maximumHeight() ? (int)_Parent->maximumHeight()/30 : (int)_Parent->maximumWidth()/30);
btn[i]->setFont(_font);
textBrowser.setFont(_font);
}
//调整按键和文本的位置
//文本垂直布局
QVBoxLayout VLayout(this);
VLayout.addSpacing(150);
VLayout.addWidget(&textBrowser);
VLayout.addSpacing(300);
//按键水平布局
QHBoxLayout RestartBT;
foreach(QPushButton *item , btn)
{
RestartBT.addWidget(item);
//按键信号连接槽
QObject::connect(item, &QPushButton::clicked, this,[=]()
{
QPushButton *optBtn = qobject_cast<QPushButton *>(sender());
emit OutputEvent(optBtn->text());
this->close();
});
}
VLayout.addLayout(&RestartBT);
//模态显示
this->exec();
}
void CustomDialog::showCustomDialog(QString windowName, QString windowIcon, QStringList buttonName, QWidget *parent)
{
//传参
_WindowName = windowName;
_WindowIcon = windowIcon;
_ButtonName = buttonName;
_Parent = parent;
//背景颜色
this->setWindowOpacity(0.9); //透明度
this->setStyleSheet("background-color: rgba(128, 128, 128, 25%)"); //背景
//设置窗口的标题和标识
this->setWindowTitle(_WindowName);
this->setWindowIcon(QIcon(_WindowIcon));
//适应屏幕大小
this->resize(_Parent->width()*0.9,_Parent->height()*0.9);
this->setFixedSize(_Parent->width()*0.9,_Parent->height()*0.9);
//使弹窗居中显示
this->move(_Parent->pos().x() + (_Parent->width() - this->width()) / 2,_Parent->pos().y() + (_Parent->height() - this->height()) / 2);
//根据QStringList buttonName创建按键
QList<QPushButton*> btn;
for(int i = 0;i < _ButtonName.count() ;i++)
{
btn.append(new QPushButton(_ButtonName[i]));
btn[i] = new QPushButton(_ButtonName[i]);
//指定按键样式
btn[i]->setWhatsThis("BTStyleSheet");
//调整字体大小
QFont _font = btn[i]->font();
_font.setPointSize(_Parent->maximumWidth() > _Parent->maximumHeight() ? (int)_Parent->maximumHeight()/30 : (int)_Parent->maximumWidth()/30);
btn[i]->setFont(_font);
}
//调整按键的位置
QVBoxLayout VLayout(this);
//按键水平布局
foreach(QPushButton *item , btn)
{
VLayout.addWidget(item);
//按键信号连接槽
QObject::connect(item, &QPushButton::clicked, this,[=]()
{
QPushButton *optBtn = qobject_cast<QPushButton *>(sender());
emit OutputEvent(optBtn->text());
this->close();
});
}
//模态显示
this->exec();
}
void CustomDialog::showCustomDialog(QString windowName, QString windowIcon, QString textContent, QWidget *parent)
{
QStringList btnName = {"Ok"};
showCustomDialog(windowName, windowIcon, btnName, textContent, parent);
}
================================================
FILE: customdialog.h
================================================
#ifndef CUSTOMDIALOG_H
#define CUSTOMDIALOG_H
#include <QWidget>
#include <QDialog>
#include <QPushButton>
#include <QTextBrowser>
#include <QLayout>
class CustomDialog : public QDialog
{
Q_OBJECT
public:
//文本加按键(按键属于水平布局,文本和按键属于垂直布局)
void showCustomDialog(QString windowName, QString windowIcon, QStringList buttonName, QString textContent, QWidget *parent = nullptr);
//纯按键(垂直布局)
void showCustomDialog(QString windowName, QString windowIcon, QStringList buttonName, QWidget *parent = nullptr);
//纯文本(居中显示,提醒语句)
void showCustomDialog(QString windowName, QString windowIcon, QString textContent, QWidget *parent = nullptr);
private:
QString _WindowName;
QString _WindowIcon;
QStringList _ButtonName;
QString _TextContent;
QWidget *_Parent;
signals:
void OutputEvent(QString);
};
#endif // CUSTOMDIALOG_H
================================================
FILE: filedialog.cpp
================================================
#include "filedialog.h"
#include "ui_filedialog.h"
//MY Dialog
#include <mainwindow.h>
#include <QNetworkReply>
#include <QJsonArray>
#include <QTreeWidgetItem>
#include <QScrollBar>
#include <QThread>
#include <QDir>
#include <QHttpMultiPart>
#include <QDirIterator>
#include <QTextBrowser>
#include <QDesktopWidget>
//#include <QSizeF>
FileDialog::FileDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::FileDialog)
{
ui->setupUi(this);
FUI = (MainWindow*)parent;
// SelectURL = QUrl(((MainWindow*)FUI)->octonetwork.MainUrl + "files/local/Demo.gcode");
//Init File
// QObject::connect(((MainWindow*)FUI)->octonetwork.FSnetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(FSReply(QNetworkReply*)),Qt::UniqueConnection);
// ((MainWindow*)FUI)->octonetwork.FSnetworkAccessManager->get(((MainWindow*)FUI)->octonetwork.FileRequest);
terminal_timer = new QTimer(this);
terminal_timer->setSingleShot(true);
this->resize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setMaximumSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setFixedSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
QFont _font = ui->Btn_Upload->font();
_font.setPointSize(this->maximumWidth() > this->maximumHeight() ? (int)this->maximumHeight()/30 : (int)this->maximumWidth()/30);
ui->Btn_Upload->setFont(_font);
ui->Btn_Print->setFont(_font);
ui->Btn_Delete->setFont(_font);
/* 创建一个用于应用程序发送网络请求和接收网络应答的"管理员" */
manager = new QNetworkAccessManager(this);
/* 创建一个要发送的请求实例 */
request = new QNetworkRequest(QUrl(((MainWindow*)FUI)->octonetwork.MainUrl +"/files"));
request->setRawHeader("X_Api_Key",((MainWindow*)FUI)->octonetwork.X_API_Key);
// InitializeUSBDrive();
}
FileDialog::~FileDialog()
{
delete ui;
}
void FileDialog::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
RefreshFileList();
// ui->Btn_Upload->setEnabled(true);
}
void FileDialog::on_Btn_back_clicked()
{
this->close();
}
void FileDialog::on_Btn_Refresh_pressed()
{
StyleSheet_Temp = ui->Btn_Refresh->styleSheet();
ui->Btn_Refresh->setStyleSheet(StyleSheet_Temp+"\nbackground-color:rgb(128,128,128,128);");
}
void FileDialog::on_Btn_Refresh_released()
{
ui->Btn_Refresh->setStyleSheet(StyleSheet_Temp);
}
void FileDialog::RefreshFileList()
{
ReFreshJson();
disconnect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,0,0);
// QObject::connect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,this,SLOT(GetDirlist(QStringList)));
QObject::connect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,this,[=](QStringList CommandLine)
{
GetDirlist(CommandLine);
});
((MainWindow*)FUI)->terminaldialog->SendCMD("cd /home/pi/USB && find [s,h]d[a-z]* -maxdepth 0 -type d -regex \"[s,h]d[a-z][0-9]+$\"; cd /home/pi",TeminalState);
QObject::connect(terminal_timer,SIGNAL(timeout()),this,SLOT(GetDirlistTimeout()));
terminal_timer->start(500);
}
void FileDialog::ReFreshJson()
{
//ReFresh Json
((MainWindow*)FUI)->octonetwork.SD_ReLoad();
//Reload FileList
// if(((MainWindow*)FUI)->octonetwork.ConnectState == "Operational" || ((MainWindow*)FUI)->octonetwork.ConnectState == "Pausing" || ((MainWindow*)FUI)->octonetwork.ConnectState == "Starting" || ((MainWindow*)FUI)->octonetwork.ConnectState == "Printing" || ((MainWindow*)FUI)->octonetwork.ConnectState == "Cancelling")
// {}
((MainWindow*)FUI)->octonetwork.FSnetworkAccessManager->disconnect(SIGNAL(finished(QNetworkReply*)));//disconnect
QObject::connect(((MainWindow*)FUI)->octonetwork.FSnetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(FSReply(QNetworkReply*)),Qt::UniqueConnection);
((MainWindow*)FUI)->octonetwork.FSnetworkAccessManager->get(((MainWindow*)FUI)->octonetwork.FileRequest);
}
void FileDialog::on_Btn_Refresh_clicked()
{
RefreshFileList();
}
void FileDialog::FSReply(QNetworkReply *reply)
{
int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if(reply->error() == QNetworkReply::NoError)
{
QByteArray replyArray = reply->readAll();
QJsonDocument loadDoc(QJsonDocument::fromJson(replyArray));
QJsonObject QObj = loadDoc.object();
//建立列表
ui->treeWidget->clear();
QTreeWidgetItem *RootItem = new QTreeWidgetItem(ui->treeWidget,QStringList(QString("Local")));
RootItem->setIcon(0,QIcon(":/assets/wenjian.svg"));
// QTreeWidgetItem *USBItem = new QTreeWidgetItem(ui->treeWidget,QStringList(QString("USB")));
// USBItem->setIcon(0,QIcon(":/assets/usb.svg"));
// QList<QTreeWidgetItem *> *USBItem;
SDcardItem = new QTreeWidgetItem(ui->treeWidget,QStringList(QString("Board")));
SDcardItem->setIcon(0,QIcon(":/assets/wenjian.svg"));
FilesPraser(RootItem , QObj.constFind("files").value().toArray());
QCoreApplication::processEvents();//update Dir
QList<QTreeWidgetItem *> USBDev = LoadUSBPath("/home/pi/USB");
QList<QTreeWidgetItem *> AllItems;
AllItems.append(RootItem);
AllItems.append(USBDev);
AllItems.append(SDcardItem);
if(SDcardItem->childCount() <= 0)
{
SDcardItem->setHidden(true);
}
ui->treeWidget->insertTopLevelItems(0,AllItems);
ui->treeWidget->setItemsExpandable(true);
ui->treeWidget->expandAll();
if(QSysInfo::productType() != "raspbian"){
LibLog::LogRec(QString("%1___%2___%3").arg(QString(replyArray)).arg(__FILE__).arg(__LINE__), "connect");
}
}
if(QSysInfo::productType() != "raspbian")
{
LibLog::LogRec(QString("statusCode : %1___%2___%3").arg(statusCode).arg(__FILE__).arg(__LINE__), "connect");
LibLog::LogRec("***************************************" ,"connect");
}
reply->deleteLater();
ui->Btn_Delete->setEnabled(false);
ui->Btn_Print->setEnabled(false);
ui->Btn_Upload->setEnabled(false);
((MainWindow*)FUI)->octonetwork.FSnetworkAccessManager->disconnect(SIGNAL(finished(QNetworkReply*)));//disconnect
}
QList<QTreeWidgetItem *> FileDialog::LoadUSBPath(QString USBPath)
{
QList<QTreeWidgetItem *> USBDev;
QDir RootDir = QDir(USBPath);
if(RootDir.exists() && RootDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot).count() > 0)//文件夹存在,并且包含内容
{
QDirIterator dir_iterator(USBPath, QDir::Dirs | QDir::NoDotAndDotDot/*,QDirIterator::Subdirectories*/);
while(dir_iterator.hasNext())
{
dir_iterator.next();
// dir_iterator.fileInfo().dir().path();
QTreeWidgetItem *USBItem = new QTreeWidgetItem(ui->treeWidget,QStringList(QString(dir_iterator.fileName().toUpper())));
USBItem->setIcon(0,QIcon(":/assets/usb.svg"));
// QStringList chilData;
// chilData.append(dir_iterator.fileName().toUpper());
// QTreeWidgetItem *chilItem = new QTreeWidgetItem(MotherItem,chilData);
// chilItem->setIcon(0,QIcon(":/assets/usb.svg"));
LoadFiles(USBItem , dir_iterator.filePath());
USBDev.append(USBItem);
// MotherItem->addChild(chilItem);
}
}
return USBDev;
}
void FileDialog::LoadFiles(QTreeWidgetItem *MotherItem , QString DirPath)
{
QDirIterator dir_iterator(DirPath,QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot/*,QDirIterator::Subdirectories*/);
while(dir_iterator.hasNext())
{
dir_iterator.next();
// QFileInfo file_info = dir_iterator.fileInfo();
// QString files = file_info.absoluteFilePath();
if(dir_iterator.fileInfo().isDir())
{
if(dir_iterator.fileInfo().fileName() == "System Volume Information")
continue;
QStringList chilData;
chilData.append(dir_iterator.fileName());
QTreeWidgetItem *chilItem = new QTreeWidgetItem(MotherItem,chilData);
chilItem->setIcon(0,QIcon(":/assets/wenjian.svg"));
LoadFiles(chilItem , dir_iterator.filePath());
MotherItem->addChild(chilItem);
}
else if(dir_iterator.fileInfo().isFile())
{
QStringList chilData;
chilData.append(dir_iterator.fileName());
chilData.append(dir_iterator.filePath());
QTreeWidgetItem *chilItem = new QTreeWidgetItem(MotherItem,chilData);
QString ext = dir_iterator.fileInfo().suffix().toLower();
if(ext == "gco" || ext == "gcode" || ext == "g")//machinecode
{
chilItem->setIcon(0,QIcon(":/assets/3ddayin.svg"));
}
else if(ext == "stl" || ext == "obj" )//model object
{
chilItem->setIcon(0,QIcon(":/assets/object.svg"));
}
else
{
chilItem->setIcon(0,QIcon(":/assets/rizhi.svg"));
}
MotherItem->addChild(chilItem);
}
}
}
void FileDialog::FilesPraser(QTreeWidgetItem *MotherItem , QJsonArray Data)
{
//QList<QTreeWidgetItem *> _return;
foreach(QJsonValue item,Data)
{
if(item.toObject().constFind("origin").value().toString() == "local")
{
QStringList chilData;
chilData.append(Hex2QString(item.toObject().constFind("display").value().toString()));
chilData.append(item.toObject().constFind("refs").value().toObject().constFind("resource").value().toString());
QTreeWidgetItem *chilItem = new QTreeWidgetItem(MotherItem,chilData);
chilItem->setIcon(0,
item.toObject().constFind("type").value().toString() == "machinecode" ? QIcon(":/assets/3ddayin.svg") :
item.toObject().constFind("type").value().toString() == "model" ? QIcon(":/assets/object.svg") : QIcon(":/assets/rizhi.svg"));
MotherItem->addChild(chilItem);
}
else if(item.toObject().constFind("origin").value().toString() == "sdcard")
{
QStringList chilData;
chilData.append(Hex2QString(item.toObject().constFind("display").value().toString()));
chilData.append(item.toObject().constFind("refs").value().toObject().constFind("resource").value().toString());
QTreeWidgetItem *chilItem = new QTreeWidgetItem(SDcardItem,chilData);
chilItem->setIcon(0,
item.toObject().constFind("type").value().toString() == "machinecode" ? QIcon(":/assets/3ddayin.svg") :
item.toObject().constFind("type").value().toString() == "model" ? QIcon(":/assets/object.svg") : QIcon(":/assets/rizhi.svg"));
SDcardItem->addChild(chilItem);
}
else if(item.toObject().constFind("type").value().toString() == "folder")
{
QStringList chilData;
chilData.append(item.toObject().constFind("display").value().toString());
QTreeWidgetItem *chilItem = new QTreeWidgetItem(MotherItem,chilData);
chilItem->setIcon(0,QIcon(":/assets/wenjian.svg"));
// if(item.toObject().constFind("display").value().toString().contains(QRegExp("[s,h]d[a-z][0-9]+")))
// chilItem->setIcon(0,QIcon(":/assets/usb.svg"));
// else
// chilItem->setIcon(0,QIcon(":/assets/wenjian.svg"));
FilesPraser(chilItem , item.toObject().constFind("children").value().toArray());
MotherItem->addChild(chilItem);
}
}
}
void FileDialog::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column)
{
if(QSysInfo::productType() != "raspbian")
{
LibLog::LogRec(QString("%1:%2___%3___%4").arg(column).arg(item->text(column)).arg(__FILE__).arg(__LINE__), "connect");
LibLog::LogRec(QString("%1___%3___%4").arg(item->data(1,0).toString()).arg(__FILE__).arg(__LINE__), "connect");
}
if(((MainWindow*)FUI)->octonetwork.ConnectState.contains("Printing") ||((MainWindow*)FUI)->octonetwork.ConnectState == "Starting print from SD" || ((MainWindow*)FUI)->octonetwork.ConnectState == "Starting")
return;
QString ext = item->data(1,0).toString().split('.').last();
if(ext.toLower() == "gcode" || ext.toLower() == "gco" || ext.toLower() == "g")
{
SelectURL = QUrl(item->data(1,0).toString());
DisplayName = item->data(0,0).toString();
ui->Btn_Delete->setEnabled(true);
ui->Btn_Print->setEnabled(true);
if(!SelectURL.url().startsWith("http://"))
ui->Btn_Upload->setEnabled(true);
else
ui->Btn_Upload->setEnabled(false);
}
else
{
ui->Btn_Delete->setEnabled(false);
ui->Btn_Print->setEnabled(false);
ui->Btn_Upload->setEnabled(false);
}
}
//quick print
void FileDialog::on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
{
Q_UNUSED(column);
QString ext = item->data(1,0).toString().split('.').last();
if(ext.toLower() == "gcode" || ext.toLower() == "gco" || ext.toLower() == "g")
{
((MainWindow*)FUI)->octonetwork.JobSwitch(SelectURL);
this->close();
}
}
QUrl FileDialog::GetRealURL(QUrl URL)
{
QUrl _URL;
if(!URL.url().startsWith("http://"))
{
// QString newFileName = QString2Hex(URL.url() , false);
// //构建新文件名称
// if(!QDir("/home/pi").exists("temp"))
// QDir("/home/pi").mkdir("temp");
// if(QFile::exists("/home/pi/temp/"+newFileName))
// QFile::remove("/home/pi/temp/"+newFileName);
// //检查同名堆积
// QFile::copy(URL.url(),"/home/pi/temp/"+newFileName);
// //复制外部路径文件到临时文件夹
// _URL = UploadFile("/home/pi/temp/"+newFileName);
// //上传临时文件至Octoprint并索取真实URL
// QFile::remove("/home/pi/temp/"+newFileName);
// //删除临时文件
_URL = UploadFile(URL.url());
}
else
{
_URL = URL;
}
return _URL;
}
void FileDialog::DeleteURL(QUrl URL)
{
QString FileName = Hex2QString(URL.url(),false);
QStringList btnName = {"Yes", "No",} ;
CustomDialog *newDialog = new CustomDialog();
QObject::connect(newDialog, &CustomDialog::OutputEvent, newDialog,[=](QString instruct)
{
if(instruct == "Yes")
{
if(URL.url().toLower().startsWith("http://"))
{
request->setUrl(URL);
if(manager->deleteResource(*request)->error() == QNetworkReply::NoError)
RefreshFileList();
}
else
{
DeleteFile(URL.url());
}
SelectURL.setUrl("");
}
});
newDialog->showCustomDialog("Delete",":/assets/delete.svg",btnName,"Do you want to Delete "+FileName+" ?",this);
}
void FileDialog::DeleteFile(QString FilePath)
{
if(QFile::exists(FilePath))
{
QFile::remove(FilePath);
RefreshFileList();
}
}
QUrl FileDialog::UploadFile(QString FilePath)
{
QUrl _return;
//设置发送的数据
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
QFile *file = new QFile(FilePath); //由于是异步,所以记得一定要new
file->open(QIODevice::ReadOnly);
QHttpPart contentPart;
contentPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QString("form-data; name=\"file\"; filename=\"%1\"").arg(QFileInfo(FilePath).fileName())));
contentPart.setBodyDevice(file);
file->setParent(multiPart);
multiPart->append(contentPart);
request->setUrl(QUrl(((MainWindow*)FUI)->octonetwork.MainUrl +"/files/local"));
QNetworkReply *reply = manager->post(*request,multiPart);
while(!reply->isFinished())
QCoreApplication::processEvents();//update http post
// QMessageBox::information(NULL, "item.dir().path()", "reply statusCode:" + QString::number(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()), QMessageBox::Ok, QMessageBox::Ok);//Debug
file->close();
if(reply->error() == QNetworkReply::NoError)
{
QByteArray replyArray = reply->readAll();
QJsonDocument loadDoc(QJsonDocument::fromJson(replyArray));
QJsonObject QObj = loadDoc.object();
QList<QString> ResourcesLocation = {"files","local","refs","resource"};
_return = QUrl(((MainWindow*)FUI)->octonetwork.SearchJsonValue( ResourcesLocation, QObj).toString());
}
reply->deleteLater();
return _return;
}
QUrl FileDialog::GetRealURL()
{
return GetRealURL(SelectURL);
}
void FileDialog::GetDirlist(QStringList CommandLine)
{
disconnect(terminal_timer,SIGNAL(timeout()),0,0);
terminal_timer->stop();
DirList.clear();
foreach(QString Dir , CommandLine)
{
DirList.append(Dir.split("\t", QString::SkipEmptyParts));
}
disconnect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,0,0);
// QObject::connect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,this,SLOT(GetDevlist(QStringList)));
QObject::connect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,this,[=](QStringList CommandLine)
{
GetDevlist(CommandLine);
});
((MainWindow*)FUI)->terminaldialog->SendCMD("cd /dev/ && find [s,h]d[a-z]* -maxdepth 0 -type b -regex \"[s,h]d[a-z][0-9]+$\"; cd /home/pi",TeminalState);
QObject::connect(terminal_timer,SIGNAL(timeout()),this,SLOT(GetDevlistTimeout()));
terminal_timer->start(500);
}
void FileDialog::GetDirlistTimeout()
{
DirList.clear();
disconnect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,0,0);
// QObject::connect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,this,SLOT(GetDevlist(QStringList)));
QObject::connect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,this,[=](QStringList CommandLine)
{
GetDevlist(CommandLine);
});
((MainWindow*)FUI)->terminaldialog->SendCMD("cd /dev/ && find [s,h]d[a-z]* -maxdepth 0 -type b -regex \"[s,h]d[a-z][0-9]+$\"; cd /home/pi",TeminalState);
disconnect(terminal_timer,SIGNAL(timeout()),0,0);
QObject::connect(terminal_timer,SIGNAL(timeout()),this,SLOT(GetDevlistTimeout()));
terminal_timer->start(500);
}
void FileDialog::GetDevlist(QStringList CommandLine)
{
disconnect(terminal_timer,SIGNAL(timeout()),0,0);
terminal_timer->stop();
DevList.clear();
foreach(QString Dev , CommandLine)
{
DevList.append(Dev.split("\t", QString::SkipEmptyParts));
}
disconnect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,0,0);
RmList.clear();
foreach(QString Dir , DirList)
{
if(!DevList.contains(Dir))
RmList.append(Dir);
}
NewList.clear();
foreach(QString Dev , DevList)
{
if(!DirList.contains(Dev))
NewList.append(Dev);
}
if(!RmList.isEmpty())
{
QString RmCMD = "cd /home/pi/USB ; sudo umount ";
// RmCMD = RmCMD + RmList.join(" ") + " ; rm -rf " + RmList.join(" ") + " ; cd /home/pi";
RmCMD = RmCMD + RmList.join(" ") + " ; cd /home/pi";
((MainWindow*)FUI)->terminaldialog->SendCMD(RmCMD,TeminalState);
QCoreApplication::processEvents();
QThread::msleep(500);
QCoreApplication::processEvents();
RmCMD = "cd /home/pi/USB ; rm -rf " + RmList.join(" ") + " ; cd /home/pi";
((MainWindow*)FUI)->terminaldialog->SendCMD(RmCMD,TeminalState);
QCoreApplication::processEvents();
QThread::msleep(500);
QCoreApplication::processEvents();
if(!SelectURL.url().startsWith("http://"))
{
SelectURL = QUrl();
}
}
if(!NewList.isEmpty())//sudo mount -o uid=pi,gid=pi /dev/sda1 /mnt/1GB_USB_flash
{
QString NewCMD = "";
QDir dir("/home/pi/USB");//Load USB Path
if(QSysInfo::productType() == "raspbian" && !dir.exists())
{
NewCMD = "mkdir /home/pi/USB ; ";
}
NewCMD = NewCMD + "cd /home/pi/USB ; mkdir " + NewList.join(" ");
foreach(QString Newitem , NewList)
{
NewCMD = NewCMD + " ; sudo mount -o uid=pi,gid=pi,utf8=true,iocharset=utf8 /dev/" + Newitem + " " + Newitem;//字符集编码异常Debug文件夹被破坏
}
NewCMD = NewCMD + " ; cd /home/pi";
((MainWindow*)FUI)->terminaldialog->SendCMD(NewCMD,TeminalState);
QCoreApplication::processEvents();
QThread::msleep(500);
QCoreApplication::processEvents();
}
if(!RmList.isEmpty() || !NewList.isEmpty())
{
QThread::msleep(500);
ReFreshJson();
}
}
void FileDialog::GetDevlistTimeout()
{
DevList.clear();
disconnect(((MainWindow*)FUI)->terminaldialog,&TerminalDialog::CMD_Reply,0,0);
disconnect(terminal_timer,SIGNAL(timeout()),0,0);
RmList.clear();
foreach(QString Dir , DirList)
{
if(!DevList.contains(Dir))
RmList.append(Dir);
}
NewList.clear();
foreach(QString Dev , DevList)
{
if(!DirList.contains(Dev))
NewList.append(Dev);
}
if(!RmList.isEmpty())
{
QString RmCMD = "cd /home/pi/USB ; sudo umount ";
// RmCMD = RmCMD + RmList.join(" ") + " ; rm -rf " + RmList.join(" ") + " ; cd /home/pi";
RmCMD = RmCMD + RmList.join(" ") + " ; cd /home/pi";
((MainWindow*)FUI)->terminaldialog->SendCMD(RmCMD,TeminalState);
QCoreApplication::processEvents();
QThread::msleep(500);
QCoreApplication::processEvents();
RmCMD = "cd /home/pi/USB ; rm -rf " + RmList.join(" ") + " ; cd /home/pi";
((MainWindow*)FUI)->terminaldialog->SendCMD(RmCMD,TeminalState);
QCoreApplication::processEvents();
QThread::msleep(500);
QCoreApplication::processEvents();
if(!SelectURL.url().startsWith("http://"))
{
SelectURL = QUrl();
}
}
if(!NewList.isEmpty())
{
QString NewCMD = "";
QDir dir("/home/pi/USB");//Load USB Path
if(QSysInfo::productType() == "raspbian" && !dir.exists())
{
NewCMD = "mkdir /home/pi/USB ; ";
}
NewCMD = NewCMD + "cd /home/pi/.octoprint/uploads ; mkdir " + NewList.join(" ");
foreach(QString Newitem , NewList)
{
NewCMD = NewCMD + " ; sudo mount -o uid=pi,gid=pi,utf8=true,iocharset=utf8 /dev/" + Newitem + " " + Newitem;
//字符集编码异常(iocharset=cp936,codepage=cp936) posix=true utf8=true uid=pi,gid=pi nls=utf8
}
NewCMD = NewCMD + " ; cd /home/pi";
((MainWindow*)FUI)->terminaldialog->SendCMD(NewCMD,TeminalState);
QCoreApplication::processEvents();
QThread::msleep(500);
QCoreApplication::processEvents();
}
if(!RmList.isEmpty() || !NewList.isEmpty())
{
// QThread::msleep(500);
ReFreshJson();
}
}
void FileDialog::InitializeUSBDrive()
{
QDir dir("/home/pi/USB");//Load USB Path
if(QSysInfo::productType() == "raspbian" && dir.exists())
{
QStringList DirList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
QString RmCMD = "cd /home/pi/USB ; ";
RmCMD = RmCMD + "sudo umount " + DirList.join(" ") + " ; cd /home/pi";
((MainWindow*)FUI)->terminaldialog->SendCMD(RmCMD,TeminalState);
// QStringList DirList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
// QString RmCMD = "cd /home/pi/USB ; ";
// RmCMD = RmCMD + "sudo umount " + DirList.join(" ") + " ; rm -rf " + DirList.join(" ") + " ; cd /home/pi";
// ((MainWindow*)FUI)->terminaldialog->SendCMD(RmCMD,TeminalState);
QCoreApplication::processEvents();
QThread::msleep(500);
QCoreApplication::processEvents();
RmCMD = "cd /home/pi/USB ; ";
RmCMD = RmCMD + " rm -rf " + DirList.join(" ") + " ; cd /home/pi";
((MainWindow*)FUI)->terminaldialog->SendCMD(RmCMD,TeminalState);
QCoreApplication::processEvents();
QThread::msleep(500);
QCoreApplication::processEvents();
}
RefreshFileList();
}
QString FileDialog::QString2Hex(QString str ,bool FullPath)
{
QString _returnData = "--BTT--";
QStringList strList = str.split('.');
if(str.contains(QRegExp("([a-z]|[A-Z])+:\\\\")))//windows path mode
{
if(FullPath)
_returnData = str.left(str.length() - str.split("\\").last().length()) + _returnData;
str = str.split("\\").last();
}
else if(str.startsWith("/"))//unix path mode
{
if(FullPath)
_returnData = str.left(str.length() - str.split("/").last().length()) + _returnData;
str = str.split("/").last();
}
QByteArray hexData = str.left(str.length() - strList.last().length() - 1).toUtf8();
_returnData = _returnData + hexData.toHex('-').toUpper() + (strList.length() >= 2 ? ("." + strList.last()) : "");
return _returnData;
}
QString FileDialog::Hex2QString(QString hx,bool FullPath)
{
QString _returnData = "";
if(hx.contains(("--BTT--")))
{
QString fileNameWExt = hx.split("--BTT--").last();
QStringList strList = fileNameWExt.split('.');
QByteArray hexData = QByteArray::fromHex(fileNameWExt.left(fileNameWExt.length() - strList.last().length() - 1).replace("-","").toLocal8Bit());
_returnData = FullPath ? hx.left(hx.length()-fileNameWExt.length() - 7) : "" + QString::fromUtf8(hexData.data(),hexData.size()) + (strList.length() >= 2 ? ("." + strList.last()) : "");
}
else
{
if(FullPath)
_returnData=hx;
else
{
if(hx.contains(QRegExp("([a-z]|[A-Z])+:\\\\")))//windows path mode
{
_returnData = hx.split("\\").last();
}
else if(hx.startsWith("/"))//unix path mode
{
_returnData = hx.split("/").last();
}
else if(hx.startsWith("http://"))//url mode
{
_returnData = hx.split("/").last();
}
else
_returnData=hx;
}
}
return _returnData;
}
void FileDialog::on_Btn_Upload_clicked()
{
if(!SelectURL.url().startsWith("http://") && !SelectURL.url().isEmpty())
{
SelectURL=UploadFile(SelectURL.url());
RefreshFileList();
}
}
void FileDialog::on_Btn_Print_clicked()
{
if(!SelectURL.url().isEmpty())
{
((MainWindow*)FUI)->octonetwork.JobSwitch(SelectURL);
this->close();
}
}
void FileDialog::on_Btn_Delete_clicked()
{
if(!SelectURL.url().isEmpty())
{
DeleteURL(SelectURL);
}
}
================================================
FILE: filedialog.h
================================================
#ifndef FILEDIALOG_H
#define FILEDIALOG_H
#include <QDialog>
#include <QSizeF>
//MY Dialog
#include <QNetworkReply>
#include <QTreeWidgetItem>
#include <QTimer>
#include <QNetworkReply>
#include "liblog.h"
#define BTSTYLE6 "QPushButton {padding: 10px;border-style: solid;border-width: 1px;border-radius: 20px;border-color: rgb(245,246,255); color: rgb(245, 246, 255);}"\
"QPushButton:hover {padding: 10px;border-style: solid;border-width: 1px;border-radius: 20px;border-color: rgb(245,246,255); background-color:rgb(128,128,128,128);color: rgb(245, 246, 255);}"\
"QPushButton:pressed{padding: 10px;border-style: solid;border-width: 1px;border-radius: 20px;border-color: rgb(245,246,255); background-color:rgb(128,128,128,128);color: rgb(245, 246, 255);padding-right:4px;padding-bottom:4px;}"
extern int DebugFlat ;
extern QSizeF SizePercent;
namespace Ui {
class FileDialog;
}
class FileDialog : public QDialog
{
Q_OBJECT
public:
explicit FileDialog(QWidget *parent = nullptr);
~FileDialog();
private slots:
virtual void on_Btn_back_clicked();
virtual void on_Btn_Refresh_pressed();
virtual void on_Btn_Refresh_released();
virtual void on_Btn_Refresh_clicked();
virtual void FSReply(QNetworkReply *reply);
virtual void ReFreshJson();
virtual void GetDirlistTimeout();
virtual void GetDevlistTimeout();
virtual void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column);
virtual void on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column);
void on_Btn_Upload_clicked();
void on_Btn_Print_clicked();
void on_Btn_Delete_clicked();
private:
Ui::FileDialog *ui;
public:
QUrl SelectURL;
QString DisplayName;
QUrl GetRealURL(QUrl URL);
QUrl GetRealURL();
static QString QString2Hex(QString str,bool FullPath = true);
static QString Hex2QString(QString hx,bool FullPath = true);
void InitializeUSBDrive();
private:
virtual void FilesPraser(QTreeWidgetItem *MotherItem , QJsonArray Data);
virtual QList<QTreeWidgetItem *> LoadUSBPath(QString USBPath);
virtual void LoadFiles(QTreeWidgetItem *MotherItem , QString DirPath);
virtual void RefreshFileList();
virtual void GetDirlist(QStringList CommandLine);
virtual void GetDevlist(QStringList CommandLine);
void DeleteURL(QUrl URL);
void DeleteFile(QString FilePath);
QUrl UploadFile(QString FilePath);
private:
QNetworkAccessManager *manager = new QNetworkAccessManager();
QNetworkRequest *request;
QString StyleSheet_Temp;
QWidget *FUI;
QTreeWidgetItem *SDcardItem;
QStringList DirList;
QStringList DevList;
QStringList RmList;
QStringList NewList;
QTimer *terminal_timer;
QString TeminalState = "-q-e";
protected:
void showEvent(QShowEvent *event);
};
#endif // FILEDIALOG_H
================================================
FILE: filedialog.ui
================================================
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FileDialog</class>
<widget class="QDialog" name="FileDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Files</string>
</property>
<property name="windowIcon">
<iconset resource="assets.qrc">
<normaloff>:/assets/wenjian.svg</normaloff>:/assets/wenjian.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,7">
<property name="spacing">
<number>3</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0,0,0">
<property name="spacing">
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="Btn_back">
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/huitui.svg</normaloff>:/assets/huitui.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Logo">
<property name="styleSheet">
<string notr="true">border:none;
font: 75 30pt "Gill Sans MT";
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/folder.svg</normaloff>:/assets/folder.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Refresh">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>76</width>
<height>72</height>
</size>
</property>
<property name="whatsThis">
<string>BTStyleSheet2</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/sync-alt.svg</normaloff>:/assets/sync-alt.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,0,0,0">
<property name="spacing">
<number>3</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>30</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="animated">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1,0,1,0,1,0">
<property name="spacing">
<number>6</number>
</property>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Upload">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="whatsThis">
<string>BTStyleSheet6</string>
</property>
<property name="text">
<string>UpLoad to OctoPrint</string>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/upload.svg</normaloff>:/assets/upload.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Print">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="whatsThis">
<string>BTStyleSheet6</string>
</property>
<property name="text">
<string>Print</string>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/print.svg</normaloff>:/assets/print.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Btn_Delete">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="whatsThis">
<string>BTStyleSheet6</string>
</property>
<property name="text">
<string>Delete</string>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/delete.svg</normaloff>:/assets/delete.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="assets.qrc"/>
</resources>
<connections/>
</ui>
================================================
FILE: gcodedialog.cpp
================================================
#include "gcodedialog.h"
#include "ui_gcodedialog.h"
#include <QTreeWidgetItem>
#include <QScrollBar>
//#include <QSizeF>
#include <QTimer>
#include <QStringList>
#include <mainwindow.h>
#include <QTextCodec>
#include "inputdialog.h"
#include <QWebSocket>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
GcodeDialog::GcodeDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::GcodeDialog)
{
ui->setupUi(this);
FUI = (MainWindow*)parent;//((MainWindow*)FUI)->octonetwork.SendGCode(_GCode_Setting);
ui->Sender->setFocus();
_ptimer = new QTimer();
connect(_pdataRecvWS,SIGNAL(disconnected()),this,SLOT(onWSDisconnected()),Qt::AutoConnection);
connect(_pdataRecvWS,SIGNAL(textMessageReceived(QString)),this,SLOT(onWSTextReceived(QString)),Qt::AutoConnection);
connect(_pdataRecvWS,SIGNAL(connected()),this,SLOT(onWSConnected()),Qt::AutoConnection);
connect(_ptimer,SIGNAL(timeout()),this,SLOT(onWSReconnect()),Qt::AutoConnection);
_pdataRecvWS->open(QUrl("ws://"+((MainWindow*)FUI)->octonetwork.MainIP+"/sockjs/websocket"));
// _pdataRecvWS->open(QUrl("ws://192.168.100.111/sockjs/websocket"));
this->resize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setMaximumSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
this->setFixedSize((int)(SizePercent.width()*800),(int)(SizePercent.height()*480));
}
GcodeDialog::~GcodeDialog()
{
delete ui;
}
void GcodeDialog::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
}
void GcodeDialog::on_Btn_Back_clicked()
{
this->close();
}
void GcodeDialog::on_Btn_Send_clicked()
{
if(ui->Sender->text().isEmpty())
{
// ui->Sender->setFocus();
return;
}
ui->Sender->setText(ui->Sender->text().trimmed());
// SendCMD(ui->Sender->text());
((MainWindow*)FUI)->octonetwork.SendGCode(ui->Sender->text());
ui->Sender->setFocus();
}
void GcodeDialog::on_pushButton_clicked()
{
ui->Receiver->clear();
}
void GcodeDialog::on_Btn_Logo_clicked()
{
}
//断开连接会触发这个槽函数
void GcodeDialog::onWSDisconnected()
{
_ptimer->start();
}
//连接成功会触发这个槽函数
void GcodeDialog::onWSConnected()
{
_ptimer->stop();
}
//收到服务发来的消息会触发这个槽函数
void GcodeDialog::onWSTextReceived(QString msg)
{
// msg = msg.replace("\\","\"");
if(!msg.trimmed().startsWith("{\"current\":") || msg.trimmed().length() == 0)
return;
QJsonDocument loadDoc(QJsonDocument::fromJson(msg.toUtf8()));
QJsonObject QObj = loadDoc.object();
QList<QString> SearchLink ;
SearchLink << "current" << "logs";
foreach(QJsonValue _value, SearchWSJsonValue(SearchLink , QObj).toArray())
{
ui->Receiver->append(_value.toString());
// recveData(_value.toString());
}
// recveData(SearchWSJsonValue(SearchLink , QObj)[0].toString());
// recvData(SearchJsonValue(SearchLink , QObj).toString());
}
//断开连接会启动定时器,触发这个槽函数重新连接
void GcodeDialog::onWSReconnect()
{
_pdataRecvWS->abort();
_pdataRecvWS->open(QUrl("ws://"+((MainWindow*)FUI)->octonetwork.MainIP+"/sockjs/websocket"));
}
//Find_List_Name : Retrieved List Sequence --> [Grandma,Mother,Me]
//_QObj:Retrieved Retrieved Json Objecet
QJsonValue GcodeDialog::SearchWSJsonValue(QList<QString> Find_List_Name , QJsonObject _QObj)
{
QJsonValue returnValue;
QList<QString> SearchLink ;
SearchLink << Find_List_Name;
if(SearchLink.count() > 1)
{
QString MotherKey = SearchLink[0];
SearchLink.removeFirst();
if(MotherKey.indexOf("*") >= 0)//wildcard
{
QJsonArray ArrayValue;
for(int i = 0 ; i <= 9 ; i++)
{
QString TempMotherKey = MotherKey;
if(_QObj.find(TempMotherKey.replace("*",QString::number(i))).value().isUndefined())continue;
// if(QSysInfo::productType() != "raspbian"){qDebug()<<_QObj.find(TempMotherKey.replace("*",QString::number(i))).value().isUndefined();};
QJsonValue data = SearchWSJsonValue(SearchLink , _QObj.constFind(TempMotherKey.replace("*",QString::number(i))).value().toObject());
ArrayValue.append(data);
}
returnValue = ArrayValue;
}
else
returnValue = SearchWSJsonValue(SearchLink , _QObj.constFind(Moth
gitextract_r06cqxp9/ ├── .gitattributes ├── .gitignore ├── LICENSE ├── OctoBTT.pro ├── OctoBTT.sudoers.d ├── OctoBTT_zh_CN.ts ├── README.md ├── StyleSheet/ │ └── globalStyleSheet.qss ├── accesscontrol.cpp ├── accesscontrol.h ├── assets.qrc ├── cameradialog.cpp ├── cameradialog.h ├── cameradialog.ui ├── config.conf ├── configuration.cpp ├── configuration.h ├── configuration.ui ├── controlpanel.cpp ├── controlpanel.h ├── controlpanel.ui ├── customdialog.cpp ├── customdialog.h ├── filedialog.cpp ├── filedialog.h ├── filedialog.ui ├── gcodedialog.cpp ├── gcodedialog.h ├── gcodedialog.ui ├── inputdialog.cpp ├── inputdialog.h ├── inputdialog.ui ├── install.sh ├── liblog.cpp ├── liblog.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── materialctrlpanel.cpp ├── materialctrlpanel.h ├── materialctrlpanel.ui ├── mylineedit.cpp ├── mylineedit.h ├── octonetwork.cpp ├── octonetwork.h ├── start.sh ├── startup.sh ├── terminaldialog.cpp ├── terminaldialog.h ├── terminaldialog.ui ├── update.sh ├── upgrade.sh ├── wlanconfig.cpp ├── wlanconfig.h └── wlanconfig.ui
SYMBOL INDEX (72 symbols across 26 files)
FILE: accesscontrol.cpp
function QJsonValue (line 114) | QJsonValue AccessControl::SearchJsonValue(QList<QString> Find_List_Name ...
function foreach (line 153) | foreach(QList<QString> item , Find_List_Names)
FILE: accesscontrol.h
type UserInfo (line 10) | struct UserInfo{
function class (line 33) | class AccessControl: public QObject
FILE: cameradialog.h
function namespace (line 15) | namespace Ui {
function class (line 22) | class CameraDialog : public QDialog
FILE: configuration.cpp
function foreach (line 21) | foreach(QString item,strList)
FILE: configuration.h
function namespace (line 11) | namespace Ui {
function class (line 15) | class Configuration : public QDialog
FILE: controlpanel.h
function namespace (line 17) | namespace Ui {
function class (line 21) | class ControlPanel : public QDialog
FILE: customdialog.cpp
function foreach (line 65) | foreach(QPushButton *item , btn)
function foreach (line 125) | foreach(QPushButton *item , btn)
FILE: customdialog.h
function class (line 10) | class CustomDialog : public QDialog
FILE: filedialog.cpp
function foreach (line 244) | foreach(QJsonValue item,Data)
function QUrl (line 327) | QUrl FileDialog::GetRealURL(QUrl URL)
function QUrl (line 390) | QUrl FileDialog::UploadFile(QString FilePath)
function QUrl (line 427) | QUrl FileDialog::GetRealURL()
function foreach (line 437) | foreach(QString Dir , CommandLine)
function foreach (line 477) | foreach(QString Dev , CommandLine)
function foreach (line 485) | foreach(QString Dir , DirList)
function foreach (line 491) | foreach(QString Dev , DevList)
function foreach (line 527) | foreach(QString Newitem , NewList)
function foreach (line 553) | foreach(QString Dir , DirList)
function foreach (line 559) | foreach(QString Dev , DevList)
function foreach (line 596) | foreach(QString Newitem , NewList)
function QString (line 644) | QString FileDialog::QString2Hex(QString str ,bool FullPath)
function QString (line 665) | QString FileDialog::Hex2QString(QString hx,bool FullPath)
FILE: filedialog.h
function namespace (line 21) | namespace Ui {
function class (line 25) | class FileDialog : public QDialog
FILE: gcodedialog.cpp
function foreach (line 101) | foreach(QJsonValue _value, SearchWSJsonValue(SearchLink , QObj).toArray())
function QJsonValue (line 119) | QJsonValue GcodeDialog::SearchWSJsonValue(QList<QString> Find_List_Name ...
function foreach (line 158) | foreach(QList<QString> item , Find_List_Names)
FILE: gcodedialog.h
function namespace (line 18) | namespace Ui {
function class (line 22) | class GcodeDialog : public QDialog
FILE: inputdialog.cpp
function foreach (line 20) | foreach(QPushButton *item , CharBtns)
function foreach (line 24) | foreach(QPushButton *item , NumBtns)
function foreach (line 28) | foreach(QPushButton *item , SymbBtns)
function foreach (line 32) | foreach(QPushButton *item , AllBtns)
function foreach (line 42) | foreach(QPushButton *item , AllBtns)
function foreach (line 225) | foreach(QPushButton *item , CharBtns)
function foreach (line 229) | foreach(QPushButton *item , NumBtns)
function foreach (line 281) | foreach(QPushButton *item , CharBtns)
function foreach (line 285) | foreach(QPushButton *item , NumBtns)
function foreach (line 315) | foreach(QPushButton *item , NumBtns)
FILE: inputdialog.h
function namespace (line 11) | namespace Ui {
type Option (line 29) | enum Option
function QStringList (line 40) | QStringList Options
FILE: liblog.cpp
function foreach (line 47) | foreach(QString inf , messageModule)
FILE: liblog.h
function class (line 11) | class LibLog
FILE: main.cpp
function main (line 26) | int main(int argc, char *argv[])
FILE: mainwindow.cpp
function foreach (line 192) | foreach(QJsonValue item , ReplyResult[1].toArray())//遍历可连接非串口设备
FILE: mainwindow.h
function QT_BEGIN_NAMESPACE (line 28) | QT_BEGIN_NAMESPACE
FILE: materialctrlpanel.h
function namespace (line 15) | namespace Ui {
function class (line 20) | class mTimer : public QTimer
function class (line 53) | class MaterialCtrlPanel : public QDialog
FILE: mylineedit.h
function class (line 7) | class MyLineEdit : public QLineEdit
FILE: octonetwork.cpp
function QJsonValue (line 56) | QJsonValue OctoNetwork::SearchJsonValue(QList<QString> Find_List_Name ,Q...
function QJsonValue (line 120) | QJsonValue OctoNetwork::SearchJsonValue(QList<QString> Find_List_Name , ...
function foreach (line 159) | foreach(QList<QString> item , Find_List_Names)
function foreach (line 172) | foreach(QString item,_GCode_)//遍历_GCode_,把所有指令加入指令合集
FILE: octonetwork.h
function class (line 14) | class OctoNetwork
FILE: terminaldialog.h
function namespace (line 14) | namespace Ui {
function class (line 18) | class TerminalDialog : public QDialog
FILE: wlanconfig.cpp
function foreach (line 164) | foreach(QString item ,Responses)
function foreach (line 429) | foreach(QString item , Responses)
function QString (line 467) | QString Wlanconfig::ReverseStr(QString args)
function foreach (line 525) | foreach(QString item , Responses)
function foreach (line 681) | foreach(QString item , Responses)
function foreach (line 707) | foreach(QString item , WPA_Switch.keys())
FILE: wlanconfig.h
function namespace (line 32) | namespace Ui {
function class (line 36) | class Wlanconfig : public QDialog
Condensed preview — 56 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (476K chars).
[
{
"path": ".gitattributes",
"chars": 66,
"preview": "# Auto detect text files and perform LF normalization\n* text=auto\n"
},
{
"path": ".gitignore",
"chars": 709,
"preview": "# C++ objects and libs\n*.slo\n*.lo\n*.o\n*.a\n*.la\n*.lai\n*.so\n*.so.*\n*.dll\n*.dylib\n\n# Qt-es\nobject_script.*.Release\nobject_s"
},
{
"path": "LICENSE",
"chars": 34503,
"preview": "GNU AFFERO GENERAL PUBLIC LICENSE\n Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software "
},
{
"path": "OctoBTT.pro",
"chars": 2333,
"preview": "QT += core gui svg\n#QT += multimedia\n#QT += multimediawidgets\nQT += network websockets\n#QT += multimedia\n#QT += script\n#"
},
{
"path": "OctoBTT.sudoers.d",
"chars": 84,
"preview": "pi ALL=(ALL) NOPASSWD: /sbin/iwlist, /sbin/wpa_cli, /sbin/iwconfig, /sbins/ifconfig\n"
},
{
"path": "OctoBTT_zh_CN.ts",
"chars": 102,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE TS>\n<TS version=\"2.1\" language=\"OctoBTT_zh_CN\"></TS>\n"
},
{
"path": "README.md",
"chars": 3148,
"preview": "# OctoBTT\n\n\n\n## Introduce\n* A UI that matches OctoPrint printer\n\n## Softwa"
},
{
"path": "StyleSheet/globalStyleSheet.qss",
"chars": 8560,
"preview": "/*1.0.0*/\n\n/*\n=================================\n上述为版本号,如您自己更换了新的样式表,\n请将版本号首位改为0,例如:0.5.6\n=============================="
},
{
"path": "accesscontrol.cpp",
"chars": 5793,
"preview": "#include \"accesscontrol.h\"\n//#include \"octonetwork.h\"//Global prama\n#include <QJsonDocument>\n#include <QJsonObject>\n#in"
},
{
"path": "accesscontrol.h",
"chars": 1710,
"preview": "#ifndef ACCESSCONTROL_H\n#define ACCESSCONTROL_H\n\n#include <QJsonDocument>\n#include <QJsonObject>\n#include <QMetaType>\n\n"
},
{
"path": "assets.qrc",
"chars": 5397,
"preview": "<RCC>\n <qresource prefix=\"/\">\n <file>assets/adjust.svg</file>\n <file>assets/back.svg</file>\n <f"
},
{
"path": "cameradialog.cpp",
"chars": 3587,
"preview": "#include \"cameradialog.h\"\n#include \"ui_cameradialog.h\"\n#include <mainwindow.h>\n//#include <QSizeF>\n\n//#include \"QList\"\n/"
},
{
"path": "cameradialog.h",
"chars": 940,
"preview": "#ifndef CAMERADIALOG_H\n#define CAMERADIALOG_H\n\n#include <QDialog>\n#include <QSizeF>\n#include <QNetworkReply>\n\n\nextern in"
},
{
"path": "cameradialog.ui",
"chars": 11787,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>CameraDialog</class>\n <widget class=\"QDialog\" name=\"Ca"
},
{
"path": "config.conf",
"chars": 9,
"preview": "/*1.0.0*/"
},
{
"path": "configuration.cpp",
"chars": 2817,
"preview": "#include \"configuration.h\"\n#include \"ui_configuration.h\"\n#include <mainwindow.h>\n//#include <QSizeF>\n\nConfiguration::Co"
},
{
"path": "configuration.h",
"chars": 697,
"preview": "#ifndef CONFIGURATION_H\n#define CONFIGURATION_H\n\n#include <QDialog>\n#include <QSizeF>\n#include <QStandardItemModel>\n\next"
},
{
"path": "configuration.ui",
"chars": 4846,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>Configuration</class>\n <widget class=\"QDialog\" name=\"C"
},
{
"path": "controlpanel.cpp",
"chars": 14817,
"preview": "#include \"controlpanel.h\"\n#include \"ui_controlpanel.h\"\n#include <QProcess>\n#include <mainwindow.h>\n#include <QDialog>\n/"
},
{
"path": "controlpanel.h",
"chars": 2679,
"preview": "#ifndef CONTROLPANEL_H\n#define CONTROLPANEL_H\n\n#include <QDialog>\n#include <QSizeF>\n#include <QResizeEvent>\n#include \"c"
},
{
"path": "controlpanel.ui",
"chars": 41139,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>ControlPanel</class>\n <widget class=\"QDialog\" name=\"Co"
},
{
"path": "customdialog.cpp",
"chars": 4514,
"preview": "#include \"customdialog.h\"\n\n/// windowName:窗体标题\n/// windowIcon:窗体标识图片路径\n/// buttonName:按键水平布局---纯按键(垂直布局)\n/// textConten"
},
{
"path": "customdialog.h",
"chars": 865,
"preview": "#ifndef CUSTOMDIALOG_H\n#define CUSTOMDIALOG_H\n\n#include <QWidget>\n#include <QDialog>\n#include <QPushButton>\n#include <Q"
},
{
"path": "filedialog.cpp",
"chars": 26754,
"preview": "#include \"filedialog.h\"\n#include \"ui_filedialog.h\"\n//MY Dialog\n#include <mainwindow.h>\n#include <QNetworkReply>\n#includ"
},
{
"path": "filedialog.h",
"chars": 3084,
"preview": "#ifndef FILEDIALOG_H\n#define FILEDIALOG_H\n\n#include <QDialog>\n#include <QSizeF>\n//MY Dialog\n#include <QNetworkReply>\n#i"
},
{
"path": "filedialog.ui",
"chars": 11429,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>FileDialog</class>\n <widget class=\"QDialog\" name=\"File"
},
{
"path": "gcodedialog.cpp",
"chars": 4886,
"preview": "#include \"gcodedialog.h\"\n#include \"ui_gcodedialog.h\"\n#include <QTreeWidgetItem>\n#include <QScrollBar>\n//#include <QSize"
},
{
"path": "gcodedialog.h",
"chars": 1189,
"preview": "#ifndef GCODEDIALOG_H\n#define GCODEDIALOG_H\n\n#include <QDialog>\n#include <QProcess>\n#include <QShowEvent>\n#include <QSi"
},
{
"path": "gcodedialog.ui",
"chars": 6625,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>GcodeDialog</class>\n <widget class=\"QDialog\" name=\"Gco"
},
{
"path": "inputdialog.cpp",
"chars": 16617,
"preview": "#include \"inputdialog.h\"\n#include \"ui_inputdialog.h\"\n#include <mainwindow.h>\n//#include <QSizeF>\n//#include <QSound>\n//"
},
{
"path": "inputdialog.h",
"chars": 2063,
"preview": "#ifndef INPUTDIALOG_H\n#define INPUTDIALOG_H\n\n#include <QDialog>\n#include <QSizeF>\n#include <QTimer>\n\nextern int DebugFl"
},
{
"path": "inputdialog.ui",
"chars": 44140,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>InputDialog</class>\n <widget class=\"QDialog\" name=\"Inp"
},
{
"path": "install.sh",
"chars": 2669,
"preview": "echo \"Updating system resources ...\"\nsudo apt update -y\n#sudo apt upgrade -y\necho \"Done.\"\n\n#install Dependencies and Dis"
},
{
"path": "liblog.cpp",
"chars": 1720,
"preview": "#include \"liblog.h\"\n#include <QDebug>\n\n\nvoid LibLog::LogRec(QString message, QString exceptionName)\n{\n\n QTime systemT"
},
{
"path": "liblog.h",
"chars": 448,
"preview": "#ifndef LIBLOG_H\n#define LIBLOG_H\n\n#include <QDir>\n#include <QFile>\n#include <QTime>\n#include <QDate>\n#include <QExcept"
},
{
"path": "main.cpp",
"chars": 9690,
"preview": "#include \"mainwindow.h\"\n//#include \"controlpanel.h\"\n\n#include <QApplication>\n#include <QScreen>\n#include <QProcess>\n#in"
},
{
"path": "mainwindow.cpp",
"chars": 13500,
"preview": "#include \"mainwindow.h\"\n#include \"ui_mainwindow.h\"\n\n#include <QTimer>\n#include <QTime>\n//#include <QSizeF>\n\n#include <QJ"
},
{
"path": "mainwindow.h",
"chars": 2527,
"preview": "#ifndef MAINWINDOW_H\n#define MAINWINDOW_H\n\n#include <QMainWindow>\n#include <QSizeF>\n\n\n//#include <QJsonDocument>\n//#inc"
},
{
"path": "mainwindow.ui",
"chars": 28260,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>MainWindow</class>\n <widget class=\"QMainWindow\" name=\""
},
{
"path": "materialctrlpanel.cpp",
"chars": 12592,
"preview": "#include \"materialctrlpanel.h\"\n#include \"ui_materialctrlpanel.h\"\n\n#include <QJsonDocument>\n#include <QJsonArray>\n#inclu"
},
{
"path": "materialctrlpanel.h",
"chars": 3341,
"preview": "#ifndef MATERIALCTRLPANEL_H\n#define MATERIALCTRLPANEL_H\n\n\n#include <QDialog>\n#include <QNetworkReply>\n#include <QSizeF>"
},
{
"path": "materialctrlpanel.ui",
"chars": 27848,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>MaterialCtrlPanel</class>\n <widget class=\"QDialog\" nam"
},
{
"path": "mylineedit.cpp",
"chars": 1063,
"preview": "#include \"mylineedit.h\"\n\nMyLineEdit::MyLineEdit(QWidget *parent):QLineEdit(parent)\n{\n FUI = (QWidget*)parent;//((Mai"
},
{
"path": "mylineedit.h",
"chars": 492,
"preview": "#ifndef MYLINEEDIT_H\n#define MYLINEEDIT_H\n\n#include <QLineEdit>\n#include \"inputdialog.h\"\n\nclass MyLineEdit : public QLin"
},
{
"path": "octonetwork.cpp",
"chars": 11491,
"preview": "#include \"octonetwork.h\"\n#include <QJsonDocument>\n#include <QJsonObject>\n#include <QNetworkReply>\n#include <QDebug>\n#in"
},
{
"path": "octonetwork.h",
"chars": 2403,
"preview": "#ifndef OCTONETWORK_H\n#define OCTONETWORK_H\n\n#include <QJsonDocument>\n#include <QJsonObject>\n\n#include <QNetworkReply>\n"
},
{
"path": "start.sh",
"chars": 57,
"preview": "sleep 2\ncd /home/pi/OctoBTT && ./OctoBTT -platform eglfs\n"
},
{
"path": "startup.sh",
"chars": 212,
"preview": "su -l pi << EOF\ncd\nwget --no-check-certificate https://raw.githubusercontent.com/bigtreetech/OctoBTT/master/install.sh\ns"
},
{
"path": "terminaldialog.cpp",
"chars": 9241,
"preview": "#include \"terminaldialog.h\"\n#include \"ui_terminaldialog.h\"\n#include <QTreeWidgetItem>\n#include <QScrollBar>\n#include <Q"
},
{
"path": "terminaldialog.h",
"chars": 1398,
"preview": "#ifndef TERMINALDIALOG_H\n#define TERMINALDIALOG_H\n\n#include <QDialog>\n#include <QProcess>\n#include <QShowEvent>\n#includ"
},
{
"path": "terminaldialog.ui",
"chars": 7694,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>TerminalDialog</class>\n <widget class=\"QDialog\" name=\""
},
{
"path": "update.sh",
"chars": 1550,
"preview": "sleep 2\nsu -l pi << EOF\necho \"Update Dependencies ...\"\nsudo apt install qt5-default qtcreator python3-pyqt5-dbg libqt5sv"
},
{
"path": "upgrade.sh",
"chars": 1483,
"preview": "sleep 2\nsu -l pi << EOF\necho \"Update Dependencies ...\"\nsudo apt install qt5-default qtcreator python3-pyqt5-dbg libqt5sv"
},
{
"path": "wlanconfig.cpp",
"chars": 27203,
"preview": "#include \"wlanconfig.h\"\n#include \"ui_wlanconfig.h\"\n#include <mainwindow.h>\n//#include <QSizeF>\n#include <QScrollBar>\n#in"
},
{
"path": "wlanconfig.h",
"chars": 2134,
"preview": "#ifndef WLANCONFIG_H\n#define WLANCONFIG_H\n\n#include <QDialog>\n#include <QMap>\n#include <QSizeF>\n#include <QMetaType>\n#in"
},
{
"path": "wlanconfig.ui",
"chars": 9863,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>Wlanconfig</class>\n <widget class=\"QDialog\" name=\"Wlan"
}
]
About this extraction
This page contains the full source code of the bigtreetech/OctoBTT GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 56 files (436.3 KB), approximately 116.4k tokens, and a symbol index with 72 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.