├── LICENSE ├── LICENSE1 ├── README.md ├── ZcCommandEditor.pro ├── ZcCommandEditor.pro.user ├── ZcCommandEditor_resource.rc ├── helps_ui.cpp ├── helps_ui.h ├── helps_ui.ui ├── hook.cpp ├── hook.h ├── image.qrc ├── image ├── bjq.png ├── block.png ├── hshb.png ├── ls-wtj.png ├── ls-ytj.png ├── mc-wtj.png ├── mc-ytj.png ├── xh-wtj.png └── xh-ytj.png ├── logo2.ico ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── miniwindows.cpp ├── miniwindows.h ├── miniwindows.ui ├── resource.qrc ├── stylesheet.qss ├── ui_helps_ui.h ├── ui_mainwindow.h ├── ui_miniwindows.h ├── ui_update_ui.h ├── update_ui.cpp ├── update_ui.h └── update_ui.ui /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /LICENSE1: -------------------------------------------------------------------------------- 1 | 版权说明 2 | 3 | 早晨命令组编辑器(以下简称编辑器)第一作者为Zao-chen,所有资源均为免费使用。 4 | 5 | 根据Qt要求,本项目采取GPL-3协议 6 | 7 | 如需在编辑器上进行二次开发或使用源码请遵守GPL-3协议。 8 | 9 | 使用本编辑器规定的json格式进行开发无需遵守GPL-3协议,允许闭源和商用。 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 命令组编辑器 2 | ## 这是什么? 3 | - 命令组:一个全新的概念,它可以用于在我的世界游戏外进行命令方块编辑。里面有一个地图,里面可以放置和编写命令。 4 | - 命令组格式:一种统一格式的设想(类似于.md),对于指令系统的保存和分享。你可以将做好的命令组通过这种格式的json发送给其他人,其他人可以用编辑器打开查看你做的命令系统。 5 | - 编辑器:可以打开编辑命令组格式的程序。 6 | 7 | 概念图: 8 | ![image](https://github.com/Zao-chen/ZcCommandEditor/assets/77674075/03440d4e-ee2e-454c-9477-5fcf13a30c49) 9 | 10 | ## 它能干什么? 11 | 相比于在游戏内编写,它有几大优势优势: 12 | - 更方便的操作:你可以更快捷的编辑、注解,还可以直接打开、移动、旋转、复制、删除、命令方块。 13 | - 更简单的编写:可以导入指令提示库、物品名称库、粒子效果库……用于在编写指令的时候快捷查询以及补全。还可以链接json生成器来编辑指令的json。 14 | - 更快捷的分享:在原版你写完了一个系统,只能录视频给别人一个一个的看,然后别人一个一个的抄,现在,你只需要把json文件发送给他就可以直接查看了。 15 | - 更简洁的界面:二维的地图,可以帮你在编写的时候理清思路,提高效率。 16 | ## 它有什么功能? 17 | 阶段目标: 18 | - [x] 基础的编辑功能 19 | - [x] 导入、导出和分享 20 | - [x] 游戏内悬浮窗实现 21 | - [x] 快捷wiki查询功能 22 | - [ ] 直接转成地图文件 23 | - [ ] 快速移动、旋转、复制、删除 24 | - [ ] 导出ooc 25 | - [ ] 链接json生成器 26 | - [ ] 链接nbt生成 27 | - [ ] 实现插件接口 28 | - [ ] 通过插件增加指令助手库 29 | - [ ] 通过插件增加物品库 30 | - [ ] 通过插件增加粒子效果库 31 | - [ ] 通过插件增加指令语法检查器 32 | - [ ] 模拟指令执行过程 33 | - [ ] 多端同步 34 | - [ ] 快捷放置功能 35 | - [ ] 更多方块层 36 | - [ ] 模拟指令输出 37 | - [ ] 模拟计分板内容 38 | 39 | ## 食用教程 40 | 在[发行版](https://github.com/Zao-chen/ZcCommandEditor/releases)中下载最新版解压运行即可 41 | 可以发布到[讨论版](https://github.com/Zao-chen/ZcCommandEditor/discussions/categories/%E8%A1%8D%E7%94%9F%E9%A1%B9%E7%9B%AE%E5%8F%91%E5%B8%83) 42 | ## 开发教程 43 | ### 衍生项目开发 44 | 详见开发[wiki](https://github.com/Zao-chen/ZcCommandEditor/wiki/%E5%BC%80%E5%8F%91%E7%9B%B8%E5%85%B3) 45 | 46 | ### 指令组开发 47 | 直接使用编辑器导出功能,然后发布到[讨论版](https://github.com/Zao-chen/ZcCommandEditor/discussions/categories/%E6%8C%87%E4%BB%A4%E7%BB%84%E9%A1%B9%E7%9B%AE%E5%8F%91%E5%B8%83)即可 48 | 49 | ## 相关项目 50 | |项目英文名|项目中文名|作者|介绍|平台|状态| 51 | |---|---|---|---|---|---| 52 | |[ZcCommandEditor](https://github.com/Zao-chen/ZcCommandEditor)|命令组编辑器|[Zao_chen](https://github.com/Zao-chen)|开源免费的命令组编辑器|Windows&linux|测试中 53 | |[ZcCommandViewerr](https://github.com/Zao-chen/ZcCommandViewer)|命令组查看器|[Zao_chen](https://github.com/Zao-chen)|为安卓设计的命令组查看器|Android|开发中 54 | -------------------------------------------------------------------------------- /ZcCommandEditor.pro: -------------------------------------------------------------------------------- 1 | QT += core gui 2 | QT += network 3 | QT += webenginecore 4 | QT += webenginewidgets 5 | RC_ICONS = logo2.ico 6 | 7 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 8 | 9 | CONFIG += c++11 10 | 11 | # The following define makes your compiler emit warnings if you use 12 | # any Qt feature that has been marked deprecated (the exact warnings 13 | # depend on your compiler). Please consult the documentation of the 14 | # deprecated API in order to know how to port your code away from it. 15 | DEFINES += QT_DEPRECATED_WARNINGS 16 | 17 | # You can also make your code fail to compile if it uses deprecated APIs. 18 | # In order to do so, uncomment the following line. 19 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 20 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 21 | 22 | SOURCES += \ 23 | helps_ui.cpp \ 24 | hook.cpp \ 25 | main.cpp \ 26 | mainwindow.cpp \ 27 | miniwindows.cpp \ 28 | update_ui.cpp 29 | 30 | HEADERS += \ 31 | helps_ui.h \ 32 | hook.h \ 33 | mainwindow.h \ 34 | miniwindows.h \ 35 | update_ui.h 36 | 37 | FORMS += \ 38 | helps_ui.ui \ 39 | mainwindow.ui \ 40 | miniwindows.ui \ 41 | update_ui.ui 42 | 43 | # Default rules for deployment. 44 | qnx: target.path = /tmp/$${TARGET}/bin 45 | else: unix:!android: target.path = /opt/$${TARGET}/bin 46 | !isEmpty(target.path): INSTALLS += target 47 | 48 | DISTFILES += 49 | 50 | RESOURCES += \ 51 | image.qrc 52 | 53 | -------------------------------------------------------------------------------- /ZcCommandEditor.pro.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {6f4293c5-75d4-4e9b-910b-c0a57428a08a} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | 0 41 | false 42 | true 43 | false 44 | 2 45 | true 46 | true 47 | 0 48 | 8 49 | true 50 | false 51 | 1 52 | true 53 | true 54 | true 55 | *.md, *.MD, Makefile 56 | false 57 | true 58 | true 59 | 60 | 61 | 62 | ProjectExplorer.Project.PluginSettings 63 | 64 | 65 | true 66 | false 67 | true 68 | true 69 | true 70 | true 71 | 72 | false 73 | 74 | 75 | 0 76 | true 77 | 78 | true 79 | true 80 | Builtin.DefaultTidyAndClazy 81 | 8 82 | true 83 | 84 | 85 | 86 | true 87 | 88 | 89 | 90 | 91 | ProjectExplorer.Project.Target.0 92 | 93 | Desktop 94 | Desktop Qt 6.5.2 MSVC2019 64bit 95 | Desktop Qt 6.5.2 MSVC2019 64bit 96 | qt.qt6.652.win64_msvc2019_64_kit 97 | 0 98 | 0 99 | 0 100 | 101 | P:\Qt\Project\ZcCommandEditor-main\build 102 | P:/Qt/Project/ZcCommandEditor-main/build 103 | 104 | 105 | true 106 | QtProjectManager.QMakeBuildStep 107 | false 108 | 109 | 110 | 111 | true 112 | Qt4ProjectManager.MakeStep 113 | 114 | 2 115 | 构建 116 | 构建 117 | ProjectExplorer.BuildSteps.Build 118 | 119 | 120 | 121 | true 122 | Qt4ProjectManager.MakeStep 123 | clean 124 | 125 | 1 126 | 清除 127 | 清除 128 | ProjectExplorer.BuildSteps.Clean 129 | 130 | 2 131 | false 132 | 133 | false 134 | 135 | Release 136 | Qt4ProjectManager.Qt4BuildConfiguration 137 | 0 138 | 0 139 | 140 | 141 | 0 142 | P:\Qt\Project\ZcCommandEditor-main 143 | P:/Qt/Project/ZcCommandEditor-main 144 | 145 | 146 | true 147 | QtProjectManager.QMakeBuildStep 148 | false 149 | 150 | 151 | 152 | true 153 | Qt4ProjectManager.MakeStep 154 | 155 | 2 156 | 构建 157 | 构建 158 | ProjectExplorer.BuildSteps.Build 159 | 160 | 161 | 162 | true 163 | Qt4ProjectManager.MakeStep 164 | clean 165 | 166 | 1 167 | 清除 168 | 清除 169 | ProjectExplorer.BuildSteps.Clean 170 | 171 | 2 172 | false 173 | 174 | false 175 | 176 | Debug 177 | Qt4ProjectManager.Qt4BuildConfiguration 178 | 2 179 | 180 | 2 181 | 182 | 183 | 0 184 | 部署 185 | 部署 186 | ProjectExplorer.BuildSteps.Deploy 187 | 188 | 1 189 | 190 | false 191 | ProjectExplorer.DefaultDeployConfiguration 192 | 193 | 1 194 | 195 | true 196 | true 197 | 0 198 | true 199 | 200 | 2 201 | 202 | false 203 | -e cpu-cycles --call-graph "dwarf,4096" -F 250 204 | 205 | Qt4ProjectManager.Qt4RunConfiguration:P:/Qt/Project/ZcCommandEditor-main/ZcCommandEditor.pro 206 | P:/Qt/Project/ZcCommandEditor-main/ZcCommandEditor.pro 207 | false 208 | true 209 | true 210 | true 211 | P:/Qt/Project/ZcCommandEditor-main/build 212 | 213 | 1 214 | 215 | 216 | 217 | ProjectExplorer.Project.TargetCount 218 | 1 219 | 220 | 221 | ProjectExplorer.Project.Updater.FileVersion 222 | 22 223 | 224 | 225 | Version 226 | 22 227 | 228 | 229 | -------------------------------------------------------------------------------- /ZcCommandEditor_resource.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | IDI_ICON1 ICON "D:\\great\\Downloads\\ZcCommandEditor-main (1)\\ZcCommandEditor-main\\logo2.ico" 4 | 5 | VS_VERSION_INFO VERSIONINFO 6 | FILEVERSION 0,0,0,0 7 | PRODUCTVERSION 0,0,0,0 8 | FILEFLAGSMASK 0x3fL 9 | #ifdef _DEBUG 10 | FILEFLAGS VS_FF_DEBUG 11 | #else 12 | FILEFLAGS 0x0L 13 | #endif 14 | FILEOS VOS_NT_WINDOWS32 15 | FILETYPE VFT_DLL 16 | FILESUBTYPE VFT2_UNKNOWN 17 | BEGIN 18 | BLOCK "StringFileInfo" 19 | BEGIN 20 | BLOCK "040904b0" 21 | BEGIN 22 | VALUE "CompanyName", "\0" 23 | VALUE "FileDescription", "\0" 24 | VALUE "FileVersion", "0.0.0.0\0" 25 | VALUE "LegalCopyright", "\0" 26 | VALUE "OriginalFilename", "ZcCommandEditor.exe\0" 27 | VALUE "ProductName", "ZcCommandEditor\0" 28 | VALUE "ProductVersion", "0.0.0.0\0" 29 | VALUE "InternalName", "\0" 30 | VALUE "Comments", "\0" 31 | VALUE "LegalTrademarks", "\0" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x0409, 1200 37 | END 38 | END 39 | /* End of Version info */ 40 | 41 | -------------------------------------------------------------------------------- /helps_ui.cpp: -------------------------------------------------------------------------------- 1 | #include "helps_ui.h" 2 | #include "ui_helps_ui.h" 3 | 4 | /* 5 | * 快捷方式窗口 6 | */ 7 | 8 | helps_ui::helps_ui(QWidget *parent) : 9 | QMainWindow(parent), 10 | ui(new Ui::helps_ui) 11 | { 12 | ui->setupUi(this); 13 | setWindowTitle("快捷方式"); 14 | ui->tableWidget->horizontalHeader()->setDefaultSectionSize(150); //设置默认大小 15 | } 16 | 17 | helps_ui::~helps_ui() 18 | { 19 | delete ui; 20 | } 21 | -------------------------------------------------------------------------------- /helps_ui.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPS_UI_H 2 | #define HELPS_UI_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class helps_ui; 8 | } 9 | 10 | class helps_ui : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit helps_ui(QWidget *parent = nullptr); 16 | ~helps_ui(); 17 | 18 | private: 19 | Ui::helps_ui *ui; 20 | }; 21 | 22 | #endif // HELPS_UI_H 23 | -------------------------------------------------------------------------------- /helps_ui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | helps_ui 4 | 5 | 6 | 7 | 0 8 | 0 9 | 433 10 | 386 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | * { 18 | background-color: #FFFEF9; 19 | } 20 | 21 | QMenuBar { 22 | background-color: #FFFCF3; 23 | } 24 | 25 | QMenu { 26 | background-color: #FFFCF3; 27 | } 28 | 29 | QMenu::item { 30 | padding: 5px 20px; 31 | background-color: transparent; 32 | } 33 | 34 | QMenu::item:selected { 35 | background-color: #f8b156; 36 | } 37 | 38 | QMenu::separator { 39 | height: 1px; 40 | background-color: #f7931e; 41 | margin: 5px 0px 5px 0px; 42 | } 43 | 44 | QMenuBar::item { 45 | padding: 5px 20px; 46 | background-color: transparent; 47 | } 48 | 49 | QMenuBar::item:selected { 50 | background-color: #f8b156; 51 | } 52 | 53 | QMenuBar::item:pressed { 54 | background-color: #DAA520; 55 | } 56 | 57 | 58 | QLineEdit { 59 | border: 2px solid #f7931e; 60 | border-radius: 3px; 61 | background-color: #FFFCF3; 62 | padding: 2px; 63 | font-size: 16px; 64 | } 65 | 66 | 67 | QTextEdit { 68 | border: 2px solid #f7931e; 69 | border-radius: 3px;; 70 | padding: 5px; 71 | font-size: 10px; 72 | background-color: #FFFCF3; 73 | } 74 | 75 | QTableView { 76 | background-color: #FFFCF3; 77 | } 78 | 79 | QPushButton { 80 | background-color: #FFBC33; 81 | color: #ffffff; 82 | border: none; 83 | border-radius: 2px; 84 | padding: 2px 2px; 85 | font-size: 16px; 86 | font-weight: bold; 87 | } 88 | 89 | QPushButton:hover { 90 | background-color: #f8b156; 91 | } 92 | 93 | QPushButton:pressed { 94 | background-color: #DAA520; 95 | } 96 | 97 | 98 | QComboBox { 99 | border: none; 100 | border-radius: 20px; 101 | background-color: #FFBC33; 102 | color: #ffffff; 103 | font-size: 16px; 104 | font-weight: bold; 105 | padding: 8px 20px; 106 | padding-right: 4px; /* 右侧留出一定空间 */ 107 | selection-background-color: #f8b156; /* 选中项背景色 */ 108 | selection-color: #ffffff; /* 选中项前景色 */ 109 | outline: none; 110 | } 111 | 112 | QComboBox:hover { 113 | background-color: #f8b156; 114 | } 115 | 116 | QComboBox::drop-down { 117 | width: 0; /* 去掉下拉箭头 */ 118 | } 119 | 120 | QCheckBox { 121 | color: #FFBC33; 122 | font-size: 16px; 123 | font-weight: bold; 124 | padding-left: 20px; 125 | } 126 | 127 | QCheckBox::indicator { 128 | width: 18px; 129 | height: 18px; 130 | } 131 | 132 | QCheckBox::indicator::unchecked { 133 | border: 2px solid #FFBC33; 134 | background-color: #FFFEF9; 135 | } 136 | 137 | QCheckBox::indicator::unchecked:hover { 138 | border: 2px solid #f8b156; 139 | } 140 | 141 | QCheckBox::indicator::checked { 142 | border: 2px solid #FFBC33; 143 | background-color: #FFBC33; 144 | } 145 | 146 | QCheckBox::indicator::checked:hover { 147 | background-color: #f8b156; 148 | } 149 | 150 | 151 | 152 | 153 | 154 | 155 | 10 156 | 10 157 | 411 158 | 331 159 | 160 | 161 | 162 | 163 | 放置空气 164 | 165 | 166 | 167 | 168 | 放置命令方块 169 | 170 | 171 | 172 | 173 | 放置普通方块 174 | 175 | 176 | 177 | 178 | 上下左右(悬浮窗下) 179 | 180 | 181 | 182 | 183 | 按键 184 | 185 | 186 | 187 | 188 | 说明 189 | 190 | 191 | 192 | 193 | a 194 | 195 | 196 | 197 | 198 | air 199 | 200 | 201 | 202 | 203 | c 204 | 205 | 206 | 207 | 208 | command_block 209 | 210 | 211 | 212 | 213 | b 214 | 215 | 216 | 217 | 218 | block 219 | 220 | 221 | 222 | 223 | t g f h 224 | 225 | 226 | 227 | 228 | 类似wsad 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 0 237 | 0 238 | 433 239 | 30 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /hook.cpp: -------------------------------------------------------------------------------- 1 | #include "hook.h" 2 | #include 3 | #pragma comment (lib, "User32.lib") 4 | 5 | /* 6 | * 系统钩子 7 | * 8 | * 监听后台键盘事件 9 | * 用于悬浮窗模式的键盘监听 10 | */ 11 | 12 | static HHOOK keyHook=nullptr;//钩子对象 13 | static Hook* hook;//Qt界面中调用Hook类的对象 14 | LRESULT CALLBACK keyProc(int nCode,WPARAM wParam,LPARAM lParam){//钩子消息函数,系统消息队列信息会返回到该函数中 15 | KBDLLHOOKSTRUCT* pkbhs = (KBDLLHOOKSTRUCT*)lParam;//lParam用于判断按键类型 16 | if(wParam == WM_KEYDOWN) //wParam用于判断事件类型,当前为按键按下事件 17 | { 18 | if(pkbhs->vkCode == 0x54) hook->sendSignal(Hook::T); //按下t 19 | if(pkbhs->vkCode == 0x47) hook->sendSignal(Hook::G); //按下g 20 | if(pkbhs->vkCode == 0x46) hook->sendSignal(Hook::F); //按下f 21 | if(pkbhs->vkCode == 0x48) hook->sendSignal(Hook::H); //按下h 22 | } 23 | return CallNextHookEx(keyHook,nCode,wParam,lParam);//继续原有的事件队列 24 | } 25 | 26 | Hook::Hook() 27 | { 28 | 29 | } 30 | 31 | void Hook::installHook() //安装钩子函数 32 | { 33 | keyHook = SetWindowsHookEx(WH_KEYBOARD_LL,keyProc,nullptr,0); 34 | hook = this; 35 | } 36 | void Hook::unInstallHook() //删除钩子函数 37 | { 38 | UnhookWindowsHookEx(keyHook); 39 | keyHook = nullptr; 40 | } 41 | 42 | void Hook::sendSignal(Type type) //发送信号函数 43 | { 44 | emit sendKeyType(type); 45 | } 46 | -------------------------------------------------------------------------------- /hook.h: -------------------------------------------------------------------------------- 1 | #ifndef HOOK_H 2 | #define HOOK_H 3 | #include 4 | #include 5 | class Hook:public QObject 6 | { 7 | Q_OBJECT 8 | public: 9 | Hook(); 10 | enum Type{T,G,F,H}; //自定义枚举按键 11 | void installHook(); //安装钩子函数 12 | void unInstallHook(); //卸载钩子函数 13 | void sendSignal(Type type); 14 | Q_ENUM(Type) //注册枚举类型进元对象系统,否则无法将枚举类型作为信号参数传递 15 | signals: 16 | void sendKeyType(Type); //发送按键监控信号 17 | }; 18 | 19 | #endif // HOOK_H 20 | -------------------------------------------------------------------------------- /image.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | image/ls-wtj.png 4 | image/ls-ytj.png 5 | image/mc-wtj.png 6 | image/mc-ytj.png 7 | image/xh-wtj.png 8 | image/xh-ytj.png 9 | image/block.png 10 | image/bjq.png 11 | image/hshb.png 12 | 13 | 14 | -------------------------------------------------------------------------------- /image/bjq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/bjq.png -------------------------------------------------------------------------------- /image/block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/block.png -------------------------------------------------------------------------------- /image/hshb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/hshb.png -------------------------------------------------------------------------------- /image/ls-wtj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/ls-wtj.png -------------------------------------------------------------------------------- /image/ls-ytj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/ls-ytj.png -------------------------------------------------------------------------------- /image/mc-wtj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/mc-wtj.png -------------------------------------------------------------------------------- /image/mc-ytj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/mc-ytj.png -------------------------------------------------------------------------------- /image/xh-wtj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/xh-wtj.png -------------------------------------------------------------------------------- /image/xh-ytj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/image/xh-ytj.png -------------------------------------------------------------------------------- /logo2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/logo2.ico -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | MainWindow w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /mainwindow.cpp: -------------------------------------------------------------------------------- 1 | /*头文件相关*/ 2 | #include "mainwindow.h" 3 | #include "ui_mainwindow.h" 4 | /*调试相关*/ 5 | #include 6 | #include 7 | /*json相关*/ 8 | #include // { } 9 | #include // [ ] 10 | #include // 解析Json 11 | #include // int float double bool null { } [ ] 12 | #include //Json错误 13 | #include 14 | /*其他窗口*/ 15 | #include //检查更新窗口 16 | #include //帮助窗口 17 | #include //悬浮窗 18 | #include //文件框 19 | #include //消息框 20 | #include //网页框 21 | /*网络相关*/ 22 | #include 23 | #include 24 | #include 25 | /*功能性*/ 26 | #include //剪贴板 27 | #include //文件 28 | #include //字符串 29 | #include 30 | #include //网页 31 | #include //列表 32 | 33 | /* 34 | * 主窗口 35 | */ 36 | 37 | /*全局变量*/ 38 | int static global_row; //当前格 39 | int static global_column; 40 | QString json_version = "1.4"; //json版本 41 | QString editor_version = "v0.7.2-alpha"; 42 | QString load_version; //加载版本 43 | int now_input = 0; //当前添加数量 44 | QString file_name = "Untitle"; //文件名 45 | 46 | struct save_map //保存东西的结构体 47 | { 48 | QString block = "air"; //当前方块东西 49 | int toward = 1; 50 | /* 51 | * 朝向 52 | * 1=上 2=右 3=下 4=左 53 | */ 54 | int type = 1; 55 | /* 56 | * 类型 57 | * 1=脉冲 2=连锁 3=循环 58 | */ 59 | int condition = 1; 60 | /* 61 | * 条件 62 | * 1=无条件 2=有条件 63 | */ 64 | int redstone = 1; 65 | /* 66 | * 条件 67 | * 1=红石控制 2=保持开启 68 | */ 69 | int delay = 0; //延迟 70 | bool execute = false; 71 | QString note = ""; //备注 72 | QString content = ""; //内容 73 | }static save_map_class[101][101]; 74 | 75 | void show_reload(Ui::MainWindow *dis,int x,int y) //刷新当前格 76 | { 77 | if(save_map_class[x][y].block == "command_block") //如果是命令方块 78 | { 79 | QTransform matrix; 80 | QLabel *label = new QLabel(""); 81 | QString image; 82 | /*设置图像*/ 83 | if(save_map_class[x][y].type == 1) //命令方块类型 84 | { 85 | /*条件*/ 86 | if(save_map_class[x][y].condition == 1) image = ":/image/image/mc-wtj.png"; 87 | else if(save_map_class[x][y].condition == 2) image = ":/image/mc-ytj.png"; 88 | } 89 | else if (save_map_class[x][y].type == 2) 90 | { 91 | if(save_map_class[x][y].condition == 1) image = ":/image/image/ls-wtj.png"; 92 | else if(save_map_class[x][y].condition == 2) image = ":/image/image/ls-ytj.png"; 93 | } 94 | else if (save_map_class[x][y].type == 3) 95 | { 96 | if(save_map_class[x][y].condition == 1) image = ":/image/image/xh-wtj.png"; 97 | else if(save_map_class[x][y].condition == 2) image = ":/image/image/xh-ytj.png"; 98 | } 99 | /*设置朝向*/ 100 | if(save_map_class[x][y].toward == 1) matrix.rotate(-90); 101 | else if(save_map_class[x][y].toward == 2) matrix.rotate(0); 102 | else if(save_map_class[x][y].toward == 3) matrix.rotate(90); 103 | else if(save_map_class[x][y].toward == 4) matrix.rotate(180); 104 | /*设置图像*/ 105 | label->setPixmap(QPixmap(image).scaled(40,40).transformed(matrix, Qt::SmoothTransformation)); 106 | dis->tableWidget->setCellWidget(x,y,label); 107 | 108 | } 109 | else if(save_map_class[x][y].block == "block") //如果是方块 110 | { 111 | QTransform matrix; 112 | QLabel *label = new QLabel(""); 113 | QString image; 114 | image = ":/image/image/block.png"; 115 | label->setPixmap(QPixmap(image).scaled(40,40).transformed(matrix, Qt::SmoothTransformation)); 116 | dis->tableWidget->setCellWidget(x,y,label); 117 | } 118 | else if(save_map_class[x][y].block == "redstone_comparator") //如果是命令方块 119 | { 120 | QTransform matrix; 121 | QLabel *label = new QLabel(""); 122 | QString image; 123 | if(save_map_class[x][y].condition == 1) image = ":/image/image/bjq.png"; 124 | /*设置朝向*/ 125 | if(save_map_class[x][y].toward == 1) matrix.rotate(-90); 126 | else if(save_map_class[x][y].toward == 2) matrix.rotate(0); 127 | else if(save_map_class[x][y].toward == 3) matrix.rotate(90); 128 | else if(save_map_class[x][y].toward == 4) matrix.rotate(180); 129 | /*设置图像*/ 130 | label->setPixmap(QPixmap(image).scaled(40,40).transformed(matrix, Qt::SmoothTransformation)); 131 | dis->tableWidget->setCellWidget(x,y,label); 132 | } 133 | else if(save_map_class[x][y].block == "redstone_torch") //如果是方块 134 | { 135 | QTransform matrix; 136 | QLabel *label = new QLabel(""); 137 | QString image; 138 | image = ":/image/image/hshb.png"; 139 | label->setPixmap(QPixmap(image).scaled(40,40).transformed(matrix, Qt::SmoothTransformation)); 140 | dis->tableWidget->setCellWidget(x,y,label); 141 | } 142 | else //什么也不是 143 | { 144 | dis->tableWidget->removeCellWidget(x,y); 145 | } 146 | /*设置内容*/ 147 | dis->content_textEdit->setPlainText(save_map_class[x][y].content); 148 | dis->notes_content_textEdit->setPlainText(save_map_class[x][y].note); 149 | dis->toward_comboBox->setCurrentIndex(save_map_class[x][y].toward-1); 150 | dis->type_comboBox->setCurrentIndex(save_map_class[x][y].type-1); 151 | dis->condition_comboBox->setCurrentIndex(save_map_class[x][y].condition-1); 152 | dis->redstone_comboBox->setCurrentIndex(save_map_class[x][y].redstone-1); 153 | dis->delay_lineEdit_3->setText(QString::number(save_map_class[x][y].delay)); 154 | dis->checkBox->setChecked(save_map_class[x][y].execute); 155 | if(save_map_class[x][y].block == "air"){ dis->block_comboBox->setCurrentIndex(0); } 156 | else if(save_map_class[x][y].block == "command_block"){ dis->block_comboBox->setCurrentIndex(1); } 157 | else if(save_map_class[x][y].block == "block"){ dis->block_comboBox->setCurrentIndex(2); } 158 | else if(save_map_class[x][y].block == "redstone_comparator"){ dis->block_comboBox->setCurrentIndex(3); } 159 | else if(save_map_class[x][y].block == "redstone_torch"){ dis->block_comboBox->setCurrentIndex(4); } 160 | } 161 | 162 | MainWindow::MainWindow(QWidget *parent) 163 | : QMainWindow(parent) 164 | , ui(new Ui::MainWindow) 165 | { 166 | /*初始化*/ 167 | ui->setupUi(this); 168 | /*相关测试*/ 169 | setWindowTitle("ZcCommandEditor"); 170 | ui->label_now->setText("编辑器使用json版本:"+json_version); 171 | /*表格初始化*/ 172 | ui->tableWidget->horizontalHeader()->setDefaultSectionSize(40); //设置默认大小 173 | ui->tableWidget->verticalHeader()->setDefaultSectionSize(40); 174 | ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); //设置不可更改 175 | ui->tableWidget->setColumnCount(100); //设置表格大小 176 | ui->tableWidget->setRowCount(100); 177 | QStringList headers; //表头设置 178 | for (int i = -50; i <= 50; i++) { 179 | headers << QString::number(i); 180 | } 181 | ui->tableWidget->setRowCount(101); 182 | ui->tableWidget->setColumnCount(101); 183 | ui->tableWidget->setVerticalHeaderLabels(headers); 184 | ui->tableWidget->setHorizontalHeaderLabels(headers); 185 | QTableWidgetItem *item = new QTableWidgetItem("0"); 186 | ui->tableWidget->setItem(50, 50, item); 187 | ui->tableWidget->scrollToItem(item, QAbstractItemView::PositionAtCenter); //滚动视图到指定单元格 188 | ui->tableWidget->setFocusPolicy(Qt::NoFocus); 189 | /*信号初始化*/ 190 | connect(ui->actionoutput,SIGNAL(triggered()),this,SLOT(on_menu_save_clicked())); //导出按钮信号绑定 191 | connect(ui->actioninput,SIGNAL(triggered()),this,SLOT(on_menu_load_clicked())); //导入按钮信号绑定 192 | connect(ui->action_help,SIGNAL(triggered()),this,SLOT(on_menu_help_clicked())); //导入按钮信号绑定 193 | connect(ui->action_open,SIGNAL(triggered()),this,SLOT(on_menu_github_clicked())); //github信号绑定 194 | connect(ui->action_updata,SIGNAL(triggered()),this,SLOT(on_menu_updata_clicked())); //检查更新信号绑定 195 | /*提示初始化*/ 196 | ui->label_ver->setText("编译器版本:"+editor_version+" mady by Zao_chen with <3 and bug"); 197 | } 198 | 199 | MainWindow::~MainWindow() 200 | { 201 | delete ui; 202 | } 203 | 204 | /*点击单元格槽*/ 205 | void MainWindow::on_tableWidget_cellClicked(int row, int column) 206 | { 207 | global_row = row; 208 | global_column = column; 209 | ui->label_location_2->setText(" ( " + QString::number(global_row-50) + " , " + QString::number(global_column-50)+" )"); 210 | show_reload(ui,global_row,global_column); 211 | } 212 | /*修改方块类型*/ 213 | void MainWindow::on_type_comboBox_activated(int index) 214 | { 215 | save_map_class[global_row][global_column].type = index+1; 216 | show_reload(ui,global_row,global_column); 217 | } 218 | /*修改方向*/ 219 | void MainWindow::on_toward_comboBox_activated(int index) 220 | { 221 | save_map_class[global_row][global_column].toward = index+1; 222 | show_reload(ui,global_row,global_column); 223 | } 224 | /*修改方块条件*/ 225 | void MainWindow::on_condition_comboBox_activated(int index) 226 | { 227 | save_map_class[global_row][global_column].condition = index+1; 228 | show_reload(ui,global_row,global_column); 229 | } 230 | /*修改指令*/ 231 | void MainWindow::on_content_textEdit_textChanged() 232 | { 233 | save_map_class[global_row][global_column].content = ui->content_textEdit->toPlainText(); 234 | /*提示文本*/ 235 | QStringList input_cmd_List = ui->content_textEdit->toPlainText().split(" "); 236 | if(input_cmd_List.length()==1) //如果在输主指令 237 | { 238 | ui->cmd_lineEdit->setText(input_cmd_List[0]); //修改查询对象 239 | } 240 | } 241 | /*修改备注*/ 242 | void MainWindow::on_notes_content_textEdit_textChanged() 243 | { 244 | save_map_class[global_row][global_column].note = ui->notes_content_textEdit->toPlainText(); 245 | } 246 | /*修改红石*/ 247 | void MainWindow::on_redstone_comboBox_activated(int index) 248 | { 249 | save_map_class[global_row][global_column].redstone = index+1; 250 | show_reload(ui,global_row,global_column); 251 | } 252 | /*导出json*/ 253 | void MainWindow::on_menu_save_clicked(void) 254 | { 255 | /*遍历方块消息*/ 256 | QJsonObject blockObject; 257 | QJsonArray blockArray; 258 | for (int x = 0;x != ui->tableWidget->columnCount(); x++) 259 | { 260 | for (int y = 0;y != ui->tableWidget->rowCount(); y++) 261 | { 262 | if(save_map_class[x][y].block != "air") //插入元素 263 | { 264 | blockObject.insert("x", x-50); 265 | blockObject.insert("y", y-50); 266 | blockObject.insert("z", 0); 267 | blockObject.insert("id",save_map_class[x][y].block); 268 | blockObject.insert("toward",save_map_class[x][y].toward); 269 | blockObject.insert("type",save_map_class[x][y].type); 270 | blockObject.insert("conditionMet",save_map_class[x][y].condition); 271 | blockObject.insert("auto",save_map_class[x][y].redstone); 272 | blockObject.insert("command",save_map_class[x][y].content); 273 | blockObject.insert("note",save_map_class[x][y].note); 274 | blockObject.insert("tick_delay",save_map_class[x][y].delay); 275 | blockObject.insert("execute_on_first_tick",save_map_class[x][y].execute); 276 | blockArray.append(blockObject); 277 | } 278 | } 279 | ; 280 | } 281 | //添加到最外 282 | QJsonObject rootObject; 283 | /*其他消息导入*/ 284 | rootObject.insert("content", blockArray); 285 | rootObject.insert("jsonversion", json_version); 286 | rootObject.insert("mcversion", ui->vv_lineEdit->text()); 287 | rootObject.insert("author", ui->auth_lineEdit->text()); 288 | /*写入*/ 289 | QJsonDocument doc; //将object设置为本文档的主要对象 290 | doc.setObject(rootObject); 291 | /*文件对话框*/ 292 | QString Filename = QFileDialog::getSaveFileName(this,"导出到",qApp->applicationDirPath()+"/"+file_name+".json","*.json"); 293 | QFile file(Filename); 294 | if(!file.open(QIODevice::WriteOnly)) //打开失败 295 | { 296 | QMessageBox msgBox; 297 | msgBox.setText("导出失败,请检查路径以及读写权限"); 298 | msgBox.exec(); 299 | } 300 | QTextStream stream(&file); 301 | stream << doc.toJson(); //写入文件 302 | file.close(); 303 | } 304 | /*导入json*/ 305 | void MainWindow::on_menu_load_clicked(void) 306 | { 307 | /*文件对话框*/ 308 | QString Filename = QFileDialog::getOpenFileName(this,"选择这里组",qApp->applicationDirPath(),"*.json"); 309 | QFile file(Filename); 310 | if (!file.open(QFile::ReadOnly | QFile::Text)) { 311 | QMessageBox msgBox; 312 | msgBox.setText("打开失败,请检查路径以及读写权限"); 313 | msgBox.exec(); 314 | return; 315 | } 316 | ui->name_lineEdit->setText(Filename.split("/")[Filename.split("/").length()-1].replace(".json","")); 317 | // 读取文件的全部内容 318 | QTextStream stream(&file); 319 | QString str = stream.readAll(); 320 | file.close(); 321 | // QJsonParseError类用于在JSON解析期间报告错误。 322 | QJsonParseError jsonError; 323 | // 将json解析为UTF-8编码的json文档,并从中创建一个QJsonDocument。 324 | // 如果解析成功,返回QJsonDocument对象,否则返回null 325 | QJsonDocument doc = QJsonDocument::fromJson(str.toUtf8(), &jsonError); 326 | // 判断是否解析失败 327 | if (jsonError.error != QJsonParseError::NoError && !doc.isNull()) { 328 | QMessageBox msgBox; 329 | msgBox.setText("json格式错误"); 330 | msgBox.exec(); 331 | return; 332 | } 333 | QJsonObject rootObj = doc.object(); 334 | // 根键获取值 335 | QJsonValue blockValue = rootObj.value("content"); 336 | // 判断类型是否是数组类型 337 | if (blockValue.type() == QJsonValue::Array) { 338 | // 转换成数组类型 339 | QStringList headers; 340 | for (int i = -50; i <= 50; i++) { 341 | headers << QString::number(i); 342 | } 343 | //重置表格 344 | ui->tableWidget->clear(); 345 | ui->tableWidget->setRowCount(101); 346 | ui->tableWidget->setColumnCount(101); 347 | ui->tableWidget->setVerticalHeaderLabels(headers); 348 | ui->tableWidget->setHorizontalHeaderLabels(headers); 349 | QTableWidgetItem *item = new QTableWidgetItem("0"); 350 | ui->tableWidget->setItem(50, 50, item); 351 | ui->tableWidget->scrollToItem(item, QAbstractItemView::PositionAtCenter); //滚动视图到指定单元格 352 | QJsonArray blockArray = blockValue.toArray(); 353 | // 遍历数组 354 | for (int i = 0; i < blockArray.count(); i++) { 355 | // 获取数组的第一个元素,类型是QJsonValue 356 | QJsonValue blockValueChild = blockArray.at(i); 357 | // 判断是不是对象类型 358 | if (blockValueChild.type() == QJsonValue::Object) { 359 | // 转换成对象类型 360 | QJsonObject blockObj = blockValueChild.toObject(); 361 | // 最后通过value函数就可以获取到值了,解析成功! 362 | QJsonValue x = blockObj.value("x"); 363 | QJsonValue y = blockObj.value("y"); 364 | int int_x = x.toInt()+50; 365 | int int_y = y.toInt()+50; 366 | QJsonValue content = blockObj.value("command"); 367 | save_map_class[int_x][int_y].content = content.toString(); 368 | QJsonValue note = blockObj.value("note"); 369 | save_map_class[int_x][int_y].note = note.toString(); 370 | QJsonValue redstone = blockObj.value("auto"); 371 | save_map_class[int_x][int_y].redstone = redstone.toInt(); 372 | QJsonValue toward = blockObj.value("toward"); 373 | save_map_class[int_x][int_y].toward = toward.toInt(); 374 | QJsonValue type = blockObj.value("type"); 375 | save_map_class[int_x][int_y].type = type.toInt(); 376 | QJsonValue block = blockObj.value("id"); 377 | save_map_class[int_x][int_y].block = block.toString(); 378 | QJsonValue delay = blockObj.value("tick_delay"); 379 | save_map_class[int_x][int_y].delay = delay.toInt(); 380 | QJsonValue execute = blockObj.value("execute_on_first_tick"); 381 | save_map_class[int_x][int_y].execute = execute.toBool(); 382 | QJsonValue con = blockObj.value("conditionMet"); 383 | save_map_class[int_x][int_y].condition = con.toInt(); 384 | global_row = int_x; 385 | global_column = int_y; 386 | show_reload(ui,global_row,global_column); 387 | } 388 | } 389 | } 390 | ui->auth_lineEdit->setText(rootObj.value("author").toString()); 391 | load_version = rootObj.value("jsonversion").toString(); 392 | ui->label_in->setText("导入的命令组json版本:"+load_version); 393 | ui->vv_lineEdit->setText(rootObj.value("mcversion").toString()); 394 | if(load_version!=json_version) 395 | { 396 | QMessageBox msgBox; 397 | msgBox.setText("导入json版本与编辑器版本不同,可能出现bug,建议进行迁移"); 398 | msgBox.exec(); 399 | } 400 | } 401 | /*修改方块*/ 402 | void MainWindow::on_block_comboBox_activated(int index) 403 | { 404 | if(index==0) save_map_class[global_row][global_column].block = "air"; 405 | else if(index==1) save_map_class[global_row][global_column].block = "command_block"; 406 | else if(index==2) save_map_class[global_row][global_column].block = "block"; 407 | else if(index==3) save_map_class[global_row][global_column].block = "redstone_comparator"; 408 | else if(index==4) save_map_class[global_row][global_column].block = "redstone_torch"; 409 | show_reload(ui,global_row,global_column); 410 | } 411 | /*修改延迟*/ 412 | void MainWindow::on_delay_lineEdit_3_textChanged(const QString &arg1) 413 | { 414 | save_map_class[global_row][global_column].delay = arg1.toInt(); 415 | } 416 | /*执行一个已知项*/ 417 | void MainWindow::on_checkBox_clicked(bool checked) 418 | { 419 | save_map_class[global_row][global_column].execute = checked; 420 | } 421 | /*文件位置*/ 422 | void MainWindow::on_name_lineEdit_textChanged(const QString &arg1) 423 | { 424 | file_name = qApp->applicationDirPath()+"\\"+arg1; 425 | } 426 | /*键盘按下事件*/ 427 | void MainWindow::keyPressEvent(QKeyEvent * event) 428 | { 429 | // 普通键 430 | switch (event->key()) 431 | { 432 | // ESC键 433 | case Qt::Key_C: 434 | save_map_class[global_row][global_column].block = "command_block"; 435 | show_reload(ui,global_row,global_column); 436 | break; 437 | case Qt::Key_B: 438 | save_map_class[global_row][global_column].block = "block"; 439 | show_reload(ui,global_row,global_column); 440 | break; 441 | case Qt::Key_A: 442 | save_map_class[global_row][global_column].block = "air"; 443 | show_reload(ui,global_row,global_column); 444 | break; 445 | } 446 | } 447 | /*打开帮助*/ 448 | void MainWindow::on_menu_help_clicked(void){ 449 | helps_ui *hpwindows = new helps_ui; 450 | hpwindows->show(); 451 | } 452 | /*打开github*/ 453 | void MainWindow::on_menu_github_clicked(void){ 454 | QDesktopServices::openUrl(QUrl("https://github.com/Zao-chen/ZcCommandEditor", QUrl::TolerantMode)); 455 | } 456 | /*检查更新*/ 457 | void MainWindow::on_menu_updata_clicked(void) 458 | { 459 | update_ui *upwindows = new update_ui; 460 | upwindows->show(); 461 | } 462 | /*百科搜索*/ 463 | void MainWindow::on_pushButton_search_clicked() 464 | { 465 | //获取搜索内容 466 | QString URLSTR; 467 | if(ui->cmd_comboBox->currentIndex()==0) 468 | { 469 | URLSTR = "https://minecraft.fandom.com/zh/wiki/%E5%91%BD%E4%BB%A4/"+ui->cmd_lineEdit->text(); 470 | //储存网页代码的文件 471 | const QString FILE_NAME = "test.text"; 472 | QUrl url(URLSTR); 473 | QNetworkAccessManager manager; 474 | QEventLoop loop; 475 | //发出请求 476 | QNetworkReply *reply = manager.get(QNetworkRequest(url)); 477 | //请求结束并下载完成后,退出子事件循环 478 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 479 | //开启子事件循环 480 | loop.exec(); 481 | //将读到的信息写入文件 482 | code = reply->readAll(); 483 | QRegularExpression re1(""); 484 | QRegularExpressionMatch match=re1.match(code); 485 | QString matched = match.captured(0).replace("",""); 486 | ui->label_command->setText(ui->cmd_lineEdit->text()); //指令显示 487 | QList matched_list = matched.split(" "); 488 | ui->label_des->setText(matched_list[0]); //描述显示 489 | QRegularExpression re2("

([\\s\\S]*)"); 490 | match=re2.match(code); //详细显示 491 | ui->textBrowser_des->setText(""+match.captured()); 492 | } 493 | else if(ui->cmd_comboBox->currentIndex()==1||2||3) 494 | { 495 | URLSTR = "https://minecraft.fandom.com/zh/wiki/"+ui->cmd_lineEdit->text(); 496 | //储存网页代码的文件 497 | const QString FILE_NAME = "test.text"; 498 | QUrl url(URLSTR); 499 | QNetworkAccessManager manager; 500 | QEventLoop loop; 501 | //发出请求 502 | QNetworkReply *reply = manager.get(QNetworkRequest(url)); 503 | //请求结束并下载完成后,退出子事件循环 504 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 505 | //开启子事件循环 506 | loop.exec(); 507 | //将读到的信息写入文件 508 | code = reply->readAll(); 509 | QRegularExpression re1(""); 510 | QRegularExpressionMatch match=re1.match(code); 511 | QString matched = match.captured(0).replace("",""); 512 | ui->label_command->setText(ui->cmd_lineEdit->text()); 513 | ui->label_des->setText(matched); 514 | 515 | } 516 | } 517 | 518 | /*一键清空*/ 519 | void MainWindow::on_delet_pushButton_clicked() 520 | { 521 | ui->content_textEdit->clear(); 522 | } 523 | /*一键复制*/ 524 | void MainWindow::on_copy_pushButton_clicked() 525 | { 526 | QClipboard* clip = QApplication::clipboard(); 527 | clip->setText(ui->content_textEdit->toPlainText()); 528 | } 529 | /*打开迷你窗口*/ 530 | void MainWindow::on_openminiwin_pushButton_clicked() 531 | { 532 | qDebug()<<"小窗"; 533 | /*遍历方块消息*/ 534 | QJsonObject blockObject; 535 | QJsonArray blockArray; 536 | for (int x = 0;x != ui->tableWidget->columnCount(); x++) 537 | { 538 | for (int y = 0;y != ui->tableWidget->rowCount(); y++) 539 | { 540 | if(save_map_class[x][y].block != "air") //插入元素 541 | { 542 | blockObject.insert("x", x-50); 543 | blockObject.insert("y", y-50); 544 | blockObject.insert("z", 0); 545 | blockObject.insert("id",save_map_class[x][y].block); 546 | blockObject.insert("toward",save_map_class[x][y].toward); 547 | blockObject.insert("type",save_map_class[x][y].type); 548 | blockObject.insert("conditionMet",save_map_class[x][y].condition); 549 | blockObject.insert("auto",save_map_class[x][y].redstone); 550 | blockObject.insert("command",save_map_class[x][y].content); 551 | blockObject.insert("note",save_map_class[x][y].note); 552 | blockObject.insert("tick_delay",save_map_class[x][y].delay); 553 | blockObject.insert("execute_on_first_tick",save_map_class[x][y].execute); 554 | blockArray.append(blockObject); 555 | } 556 | } 557 | ; 558 | } 559 | //添加到最外 560 | QJsonObject rootObject; 561 | /*其他消息导入*/ 562 | rootObject.insert("content", blockArray); 563 | rootObject.insert("jsonversion", json_version); 564 | rootObject.insert("mcversion", ui->vv_lineEdit->text()); 565 | rootObject.insert("author", ui->auth_lineEdit->text()); 566 | /*写入*/ 567 | QJsonDocument doc; //将object设置为本文档的主要对象 568 | doc.setObject(rootObject); 569 | /*文件对话框*/ 570 | QString Filename = qApp->applicationDirPath()+"/temp.json"; 571 | QFile file(Filename); 572 | if(!file.open(QIODevice::WriteOnly)) 573 | { 574 | QMessageBox msgBox; 575 | msgBox.setText("导出失败,请检查路径以及读写权限"); 576 | msgBox.exec(); 577 | } 578 | QTextStream stream(&file); 579 | stream << doc.toJson(); //写入文件 580 | file.close(); 581 | miniwindows *miniwindow = new miniwindows(); 582 | 583 | /*打开悬浮窗*/ 584 | miniwindow->setWindowFlags(miniwindow->windowFlags() |Qt::Dialog); 585 | miniwindow->setWindowModality(Qt::ApplicationModal); 586 | miniwindow->show(); 587 | qDebug()<applicationDirPath()+"/temp.json"; 588 | } 589 | 590 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | #include //键盘事件 7 | 8 | extern QString editor_version; //编译器版本 9 | 10 | QT_BEGIN_NAMESPACE 11 | namespace Ui { class MainWindow; } 12 | QT_END_NAMESPACE 13 | 14 | class MainWindow : public QMainWindow 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | MainWindow(QWidget *parent = nullptr); 20 | ~MainWindow(); 21 | 22 | QString code; //网页源代码 23 | QByteArray InitGetRequest(QString url, QString obj); 24 | QStringList strl; 25 | 26 | 27 | private slots: 28 | /*表格点击*/ 29 | void on_tableWidget_cellClicked(int row, int column); 30 | 31 | /*方块修改*/ 32 | void on_type_comboBox_activated(int index); 33 | void on_toward_comboBox_activated(int index); 34 | void on_condition_comboBox_activated(int index); 35 | void on_content_textEdit_textChanged(); 36 | void on_redstone_comboBox_activated(int index); 37 | void on_notes_content_textEdit_textChanged(); 38 | void on_block_comboBox_activated(int index); 39 | void on_delay_lineEdit_3_textChanged(const QString &arg1); 40 | void on_checkBox_clicked(bool checked); 41 | 42 | /*菜单操作*/ 43 | void on_menu_save_clicked(); 44 | void on_menu_load_clicked(); 45 | void on_menu_help_clicked(); 46 | void on_menu_github_clicked(); 47 | void on_menu_updata_clicked(); 48 | 49 | /*搜索相关*/ 50 | void on_name_lineEdit_textChanged(const QString &arg1); 51 | void on_pushButton_search_clicked(); 52 | 53 | /*快捷操作*/ 54 | void on_delet_pushButton_clicked(); 55 | void on_copy_pushButton_clicked(); 56 | 57 | /*工具栏*/ 58 | void on_openminiwin_pushButton_clicked(); 59 | 60 | protected: 61 | void keyPressEvent(QKeyEvent *event); //键盘按下事件 62 | 63 | private: 64 | Ui::MainWindow *ui; 65 | }; 66 | #endif // MAINWINDOW_H 67 | -------------------------------------------------------------------------------- /mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1483 10 | 735 11 | 12 | 13 | 14 | ZcCommandEditor 15 | 16 | 17 | * { 18 | background-color: #FFFEF9; 19 | } 20 | 21 | QMenuBar { 22 | background-color: #FFFCF3; 23 | } 24 | 25 | QMenu { 26 | background-color: #FFFCF3; 27 | } 28 | 29 | QMenu::item { 30 | padding: 5px 20px; 31 | background-color: transparent; 32 | } 33 | 34 | QMenu::item:selected { 35 | background-color: #f8b156; 36 | } 37 | 38 | QMenu::separator { 39 | height: 1px; 40 | background-color: #f7931e; 41 | margin: 5px 0px 5px 0px; 42 | } 43 | 44 | QMenuBar::item { 45 | padding: 5px 20px; 46 | background-color: transparent; 47 | } 48 | 49 | QMenuBar::item:selected { 50 | background-color: #f8b156; 51 | } 52 | 53 | QMenuBar::item:pressed { 54 | background-color: #DAA520; 55 | } 56 | 57 | 58 | QLineEdit { 59 | border: 2px solid #f7931e; 60 | border-radius: 3px; 61 | background-color: #FFFCF3; 62 | padding: 2px; 63 | font-size: 16px; 64 | } 65 | 66 | 67 | QTextEdit { 68 | border: 2px solid #f7931e; 69 | border-radius: 3px;; 70 | padding: 5px; 71 | font-size: 16px; 72 | background-color: #FFFCF3; 73 | } 74 | 75 | QTableView { 76 | background-color: #FFFCF3; 77 | } 78 | 79 | QPushButton { 80 | background-color: #FFBC33; 81 | color: #ffffff; 82 | border: none; 83 | border-radius: 2px; 84 | padding: 2px 2px; 85 | font-size: 16px; 86 | font-weight: bold; 87 | } 88 | 89 | QPushButton:hover { 90 | background-color: #f8b156; 91 | } 92 | 93 | QPushButton:pressed { 94 | background-color: #DAA520; 95 | } 96 | 97 | 98 | QComboBox { 99 | border: none; 100 | background-color: #FFBC33; 101 | color: #ffffff; 102 | font-size: 16px; 103 | font-weight: bold; 104 | selection-background-color: #f8b156; /* 选中项背景色 */ 105 | selection-color: #ffffff; /* 选中项前景色 */ 106 | -webkit-transition-duration: 0.4s; /* Safari */ 107 | transition-duration: 0.4s; 108 | } 109 | 110 | QComboBox:hover { 111 | background-color: #f8b156; 112 | } 113 | 114 | QComboBox::drop-down { 115 | width: 0; /* 去掉下拉箭头 */ 116 | } 117 | 118 | QCheckBox { 119 | color: #FFBC33; 120 | font-size: 16px; 121 | font-weight: bold; 122 | padding-left: 20px; 123 | } 124 | 125 | QCheckBox::indicator { 126 | width: 18px; 127 | height: 18px; 128 | } 129 | 130 | QCheckBox::indicator::unchecked { 131 | border: 2px solid #FFBC33; 132 | background-color: #FFFEF9; 133 | } 134 | 135 | QCheckBox::indicator::unchecked:hover { 136 | border: 2px solid #f8b156; 137 | } 138 | 139 | QCheckBox::indicator::checked { 140 | border: 2px solid #FFBC33; 141 | background-color: #FFBC33; 142 | } 143 | 144 | QCheckBox::indicator::checked:hover { 145 | background-color: #f8b156; 146 | } 147 | 148 | 149 | 150 | 151 | 152 | 153 | 10 154 | 670 155 | 131 156 | 16 157 | 158 | 159 | 160 | 161 | 微软雅黑 162 | 6 163 | false 164 | false 165 | 166 | 167 | 168 | 导入的命令组json版本: 169 | 170 | 171 | 172 | 173 | 174 | 320 175 | 670 176 | 131 177 | 16 178 | 179 | 180 | 181 | 182 | 6 183 | 184 | 185 | 186 | 编辑器使用json版本: 187 | 188 | 189 | 190 | 191 | 192 | 1180 193 | 670 194 | 291 195 | 16 196 | 197 | 198 | 199 | 200 | 6 201 | 202 | 203 | 204 | 编译器版本:0.1 mady by Zao_chen with <3 and bug 205 | 206 | 207 | 208 | 209 | 210 | 690 211 | 0 212 | 781 213 | 671 214 | 215 | 216 | 217 | 指令设置 218 | 219 | 220 | 221 | 222 | 10 223 | 30 224 | 761 225 | 631 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 600 238 | 0 239 | 240 | 241 | 242 | 243 | 16777215 244 | 20 245 | 246 | 247 | 248 | 249 | 14 250 | 251 | 252 | 253 | 备注(&B) 254 | 255 | 256 | notes_content_textEdit 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 16777215 265 | 50 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 微软雅黑 279 | 12 280 | true 281 | 282 | 283 | 284 | 名称 285 | 286 | 287 | name_lineEdit 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 微软雅黑 296 | 12 297 | true 298 | 299 | 300 | 301 | 作者 302 | 303 | 304 | auth_lineEdit 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 微软雅黑 313 | 12 314 | true 315 | 316 | 317 | 318 | 版本 319 | 320 | 321 | vv_lineEdit 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 16777215 330 | 23 331 | 332 | 333 | 334 | 335 | -1 336 | 337 | 338 | 339 | Untitle 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 16777215 348 | 23 349 | 350 | 351 | 352 | 353 | -1 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 0 366 | 10 367 | 368 | 369 | 370 | 371 | 16777215 372 | 23 373 | 374 | 375 | 376 | 377 | -1 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 14 400 | 401 | 402 | 403 | 指令(&Z) 404 | 405 | 406 | content_textEdit 407 | 408 | 409 | 410 | 411 | 412 | 413 | 语法检查 414 | 415 | 416 | 417 | 418 | 419 | 420 | 一键清空 421 | 422 | 423 | 424 | 425 | 426 | 427 | 一键复制 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 60 443 | 28 444 | 445 | 446 | 447 | 448 | 指令 449 | 450 | 451 | 452 | 453 | 方块 454 | 455 | 456 | 457 | 458 | 物品 459 | 460 | 461 | 462 | 463 | 实体 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 搜索…… 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 50 480 | 28 481 | 482 | 483 | 484 | 搜索 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 350 497 | 0 498 | 499 | 500 | 501 | 502 | 503 | 10 504 | 10 505 | 191 506 | 21 507 | 508 | 509 | 510 | 511 | 15 512 | 513 | 514 | 515 | 详细信息(爬自wiki) 516 | 517 | 518 | 519 | 520 | 521 | 10 522 | 40 523 | 191 524 | 21 525 | 526 | 527 | 528 | 529 | 12 530 | 531 | 532 | 533 | …… 534 | 535 | 536 | 537 | 538 | 539 | 10 540 | 70 541 | 381 542 | 61 543 | 544 | 545 | 546 | 547 | 10 548 | 549 | 550 | 551 | …… 552 | 553 | 554 | true 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 0 566 | 300 567 | 568 | 569 | 570 | 571 | -1 572 | false 573 | false 574 | 575 | 576 | 577 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 578 | <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> 579 | p, li { white-space: pre-wrap; } 580 | hr { height: 1px; border-width: 0; } 581 | li.unchecked::marker { content: "\2610"; } 582 | li.checked::marker { content: "\2612"; } 583 | </style></head><body style=" font-family:'Microsoft YaHei UI'; font-size:16px; font-weight:400; font-style:normal;"> 584 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 10 595 | 0 596 | 671 597 | 671 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 16777215 606 | 120 607 | 608 | 609 | 610 | 方块设置 611 | 612 | 613 | 614 | 615 | 10 616 | 30 617 | 641 618 | 78 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 14 627 | 628 | 629 | 630 | (x,y,z) 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 14 639 | 640 | 641 | 642 | 红石(&H) 643 | 644 | 645 | redstone_comboBox 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | -1 654 | 655 | 656 | 657 | 0 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 14 666 | 667 | 668 | 669 | 延迟(&Y) 670 | 671 | 672 | delay_lineEdit_3 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 14 681 | 682 | 683 | 684 | 选中方块 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 0 693 | 28 694 | 695 | 696 | 697 | 698 | 脉冲 699 | 700 | 701 | 702 | 703 | 连锁 704 | 705 | 706 | 707 | 708 | 循环 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 14 725 | 726 | 727 | 728 | 执行(&X) 729 | 730 | 731 | checkBox 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 14 740 | 741 | 742 | 743 | 朝向(&C) 744 | 745 | 746 | toward_comboBox 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 90 755 | 28 756 | 757 | 758 | 759 | 760 | 无条件 761 | 762 | 763 | 764 | 765 | 有条件 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 14 775 | 776 | 777 | 778 | 方块(&F) 779 | 780 | 781 | block_comboBox 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 0 790 | 28 791 | 792 | 793 | 794 | 795 | 红石控制 796 | 797 | 798 | 799 | 800 | 保持开启 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 14 810 | 811 | 812 | 813 | 条件(&T) 814 | 815 | 816 | condition_comboBox 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 14 825 | 826 | 827 | 828 | 类型(&L) 829 | 830 | 831 | type_comboBox 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 80 840 | 28 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 命令方块 851 | 852 | 853 | 854 | 855 | 普通方块 856 | 857 | 858 | 859 | 860 | 比较器 861 | 862 | 863 | 864 | 865 | 红石火把 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 80 875 | 28 876 | 877 | 878 | 879 | 880 | 北(↑) 881 | 882 | 883 | 884 | 885 | 东(→) 886 | 887 | 888 | 889 | 890 | 南(↓) 891 | 892 | 893 | 894 | 895 | 西(←) 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 地图编辑 908 | 909 | 910 | 911 | 912 | 10 913 | 20 914 | 651 915 | 511 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 90 924 | 16777215 925 | 926 | 927 | 928 | true 929 | 930 | 931 | 932 | 933 | 0 934 | 0 935 | 88 936 | 507 937 | 938 | 939 | 940 | 941 | 942 | 10 943 | 430 944 | 71 945 | 71 946 | 947 | 948 | 949 | 打开 950 | 悬浮窗 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | true 960 | 961 | 962 | 963 | 550 964 | 0 965 | 966 | 967 | 968 | QTableWidget::item { 969 | padding: 0px; 970 | border: 0; 971 | } 972 | 973 | 974 | false 975 | 976 | 977 | 978 | 新建行 979 | 980 | 981 | 982 | 983 | 新建行 984 | 985 | 986 | 987 | 988 | 新建列 989 | 990 | 991 | 992 | 993 | 新建列 994 | 995 | 996 | 997 | 998 | 1 999 | 1000 | 1001 | 1002 | 1003 | 2 1004 | 1005 | 1006 | 1007 | 1008 | 1 1009 | 1010 | 1011 | 1012 | 1013 | 1 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 0 1029 | 0 1030 | 1483 1031 | 26 1032 | 1033 | 1034 | 1035 | 1036 | 文件 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 帮助 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 插件 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 关于 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 导入 1069 | 1070 | 1071 | 1072 | 1073 | 导出 1074 | 1075 | 1076 | 1077 | 1078 | 快捷键 1079 | 1080 | 1081 | 1082 | 1083 | github 1084 | 1085 | 1086 | 1087 | 1088 | 导入插件 1089 | 1090 | 1091 | 1092 | 1093 | 版本 1094 | 1095 | 1096 | 1097 | 1098 | toward_comboBox 1099 | condition_comboBox 1100 | delay_lineEdit_3 1101 | block_comboBox 1102 | type_comboBox 1103 | redstone_comboBox 1104 | checkBox 1105 | notes_content_textEdit 1106 | name_lineEdit 1107 | auth_lineEdit 1108 | vv_lineEdit 1109 | check_delet_pushButton 1110 | delet_pushButton 1111 | copy_pushButton 1112 | content_textEdit 1113 | cmd_comboBox 1114 | cmd_lineEdit 1115 | pushButton_search 1116 | textBrowser_des 1117 | scrollArea 1118 | tableWidget 1119 | openminiwin_pushButton 1120 | 1121 | 1122 | 1123 | 1124 | -------------------------------------------------------------------------------- /miniwindows.cpp: -------------------------------------------------------------------------------- 1 | #include "miniwindows.h" 2 | #include "ui_miniwindows.h" 3 | 4 | #include 5 | 6 | /*json相关*/ 7 | #include // { } 8 | #include // [ ] 9 | #include // 解析Json 10 | #include // int float double bool null { } [ ] 11 | #include //Json错误 12 | #include 13 | #include //消息框 14 | #include //文件 15 | #include 16 | #include 17 | #include 18 | 19 | /* 20 | * 悬浮窗窗口 21 | */ 22 | 23 | int static global_row=50; //当前格 24 | int static global_column=50; 25 | int static global_player_row=0; //玩家格 26 | int static global_player_column=0; 27 | 28 | struct save_map //保存东西的结构体 29 | { 30 | QString block = "air"; //当前方块东西 31 | int toward = 1; 32 | /* 33 | * 朝向 34 | * 1=上 2=右 3=下 4=左 35 | */ 36 | int type = 1; 37 | /* 38 | * 类型 39 | * 1=脉冲 2=连锁 3=循环 40 | */ 41 | int condition = 1; 42 | /* 43 | * 条件 44 | * 1=无条件 2=有条件 45 | */ 46 | int redstone = 1; 47 | /* 48 | * 条件 49 | * 1=红石控制 2=保持开启 50 | */ 51 | int delay = 0; //延迟 52 | bool execute = false; //执行一个已知项 53 | QString note = ""; //备注 54 | QString content = ""; //内容 55 | }static save_map_class[101][101]; 56 | 57 | void show_reload(Ui::miniwindows *dis,int x,int y) //刷新当前格 58 | { 59 | if(save_map_class[x][y].block == "command_block") //设置图像 60 | { 61 | QTransform matrix; 62 | QLabel *label = new QLabel(""); 63 | QString image; 64 | /*设置图像*/ 65 | if(save_map_class[x][y].type == 1) //类型 66 | { 67 | /*条件*/ 68 | if(save_map_class[x][y].condition == 1) image = ":/image/image/mc-wtj.png"; 69 | else if(save_map_class[x][y].condition == 2) image = ":/image/mc-ytj.png"; 70 | } 71 | else if (save_map_class[x][y].type == 2) 72 | { 73 | if(save_map_class[x][y].condition == 1) image = ":/image/image/ls-wtj.png"; 74 | else if(save_map_class[x][y].condition == 2) image = ":/image/image/ls-ytj.png"; 75 | } 76 | else if (save_map_class[x][y].type == 3) 77 | { 78 | if(save_map_class[x][y].condition == 1) image = ":/image/image/xh-wtj.png"; 79 | else if(save_map_class[x][y].condition == 2) image = ":/image/image/xh-ytj.png"; 80 | } 81 | /*设置朝向*/ 82 | if(save_map_class[x][y].toward == 1) matrix.rotate(-90); 83 | else if(save_map_class[x][y].toward == 2) matrix.rotate(0); 84 | else if(save_map_class[x][y].toward == 3) matrix.rotate(90); 85 | else if(save_map_class[x][y].toward == 4) matrix.rotate(180); 86 | 87 | label->setPixmap(QPixmap(image).scaled(23,23).transformed(matrix, Qt::SmoothTransformation)); 88 | dis->tableWidget->setCellWidget(x,y,label); 89 | 90 | } 91 | else if(save_map_class[x][y].block == "block") 92 | { 93 | QTransform matrix; 94 | QLabel *label = new QLabel(""); 95 | QString image; 96 | image = ":/image/image/block.png"; 97 | label->setPixmap(QPixmap(image).scaled(23,23).transformed(matrix, Qt::SmoothTransformation)); 98 | dis->tableWidget->setCellWidget(x,y,label); 99 | } 100 | else if(save_map_class[x][y].block == "redstone_comparator") //如果是命令方块 101 | { 102 | QTransform matrix; 103 | QLabel *label = new QLabel(""); 104 | QString image; 105 | if(save_map_class[x][y].condition == 1) image = ":/image/image/bjq.png"; 106 | /*设置朝向*/ 107 | if(save_map_class[x][y].toward == 1) matrix.rotate(-90); 108 | else if(save_map_class[x][y].toward == 2) matrix.rotate(0); 109 | else if(save_map_class[x][y].toward == 3) matrix.rotate(90); 110 | else if(save_map_class[x][y].toward == 4) matrix.rotate(180); 111 | /*设置图像*/ 112 | label->setPixmap(QPixmap(image).scaled(23,23).transformed(matrix, Qt::SmoothTransformation)); 113 | dis->tableWidget->setCellWidget(x,y,label); 114 | } 115 | else if(save_map_class[x][y].block == "redstone_torch") //如果是方块 116 | { 117 | QTransform matrix; 118 | QLabel *label = new QLabel(""); 119 | QString image; 120 | image = ":/image/image/hshb.png"; 121 | label->setPixmap(QPixmap(image).scaled(23,23).transformed(matrix, Qt::SmoothTransformation)); 122 | dis->tableWidget->setCellWidget(x,y,label); 123 | } 124 | else 125 | { 126 | dis->tableWidget->removeCellWidget(x,y); 127 | } 128 | } 129 | 130 | /*窗口打开*/ 131 | miniwindows::miniwindows(QWidget *parent) : 132 | QWidget(parent,Qt::Widget | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint), 133 | ui(new Ui::miniwindows) 134 | { 135 | ui->setupUi(this); 136 | setWindowTitle("游戏悬浮窗"); 137 | 138 | hook.installHook(); 139 | qRegisterMetaType("Type");//为了信号中能传递自定义枚举类型,如果传递常规参数,可省略该行 140 | connect(&hook,SIGNAL(sendKeyType(Type)),this,SLOT(checkType(Type))); 141 | 142 | 143 | /*表格初始化*/ 144 | ui->tableWidget->horizontalHeader()->setDefaultSectionSize(20); //设置默认大小 145 | ui->tableWidget->verticalHeader()->setDefaultSectionSize(20); 146 | ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); //设置不可更改 147 | ui->tableWidget->setColumnCount(100); //设置表格大小 148 | ui->tableWidget->setRowCount(100); 149 | QStringList headers; 150 | for (int i = -50; i <= 50; i++) { 151 | headers << QString::number(i); 152 | } 153 | ui->tableWidget->setRowCount(101); 154 | ui->tableWidget->setColumnCount(101); 155 | ui->tableWidget->setVerticalHeaderLabels(headers); 156 | ui->tableWidget->setHorizontalHeaderLabels(headers); 157 | QTableWidgetItem *item = new QTableWidgetItem("0"); 158 | ui->tableWidget->setItem(50, 50, item); 159 | ui->tableWidget->scrollToItem(item, QAbstractItemView::PositionAtCenter); //滚动视图到指定单元格 160 | ui->tableWidget->setFocusPolicy(Qt::NoFocus); 161 | 162 | /*还原界面*/ 163 | QString Filename = qApp->applicationDirPath()+"/temp.json"; 164 | qDebug()<<"读取:"<applicationDirPath()+"/temp.json"; 165 | QFile file(Filename); 166 | if (!file.open(QFile::ReadOnly | QFile::Text)) { 167 | QMessageBox msgBox; 168 | msgBox.setText("打开失败,请检查路径以及读写权限"); 169 | msgBox.exec(); 170 | return; 171 | } 172 | // 读取文件的全部内容 173 | QTextStream stream(&file); 174 | QString str = stream.readAll(); 175 | qDebug()<tableWidget->clear(); 202 | ui->tableWidget->setRowCount(101); 203 | ui->tableWidget->setColumnCount(101); 204 | ui->tableWidget->setVerticalHeaderLabels(headers); 205 | ui->tableWidget->setHorizontalHeaderLabels(headers); 206 | QTableWidgetItem *item = new QTableWidgetItem("0"); 207 | ui->tableWidget->setItem(50, 50, item); 208 | ui->tableWidget->scrollToItem(item, QAbstractItemView::PositionAtCenter); //滚动视图到指定单元格 209 | QJsonArray blockArray = blockValue.toArray(); 210 | // 遍历数组 211 | for (int i = 0; i < blockArray.count(); i++) { 212 | // 获取数组的第一个元素,类型是QJsonValue 213 | QJsonValue blockValueChild = blockArray.at(i); 214 | // 判断是不是对象类型 215 | if (blockValueChild.type() == QJsonValue::Object) { 216 | // 转换成对象类型 217 | QJsonObject blockObj = blockValueChild.toObject(); 218 | // 最后通过value函数就可以获取到值了,解析成功! 219 | QJsonValue x = blockObj.value("x"); 220 | QJsonValue y = blockObj.value("y"); 221 | int int_x = x.toInt()+50; 222 | int int_y = y.toInt()+50; 223 | QJsonValue content = blockObj.value("command"); 224 | save_map_class[int_x][int_y].content = content.toString(); 225 | QJsonValue note = blockObj.value("note"); 226 | save_map_class[int_x][int_y].note = note.toString(); 227 | QJsonValue redstone = blockObj.value("auto"); 228 | save_map_class[int_x][int_y].redstone = redstone.toInt(); 229 | QJsonValue toward = blockObj.value("toward"); 230 | save_map_class[int_x][int_y].toward = toward.toInt(); 231 | QJsonValue type = blockObj.value("type"); 232 | save_map_class[int_x][int_y].type = type.toInt(); 233 | QJsonValue block = blockObj.value("id"); 234 | save_map_class[int_x][int_y].block = block.toString(); 235 | QJsonValue delay = blockObj.value("tick_delay"); 236 | save_map_class[int_x][int_y].delay = delay.toInt(); 237 | QJsonValue execute = blockObj.value("execute_on_first_tick"); 238 | save_map_class[int_x][int_y].execute = execute.toBool(); 239 | QJsonValue con = blockObj.value("conditionMet"); 240 | save_map_class[int_x][int_y].condition = con.toInt(); 241 | global_row = int_x; 242 | global_column = int_y; 243 | show_reload(ui,global_row,global_column); 244 | qDebug()<<"刷新方块"; 245 | } 246 | } 247 | } 248 | } 249 | 250 | /*关闭窗口*/ 251 | miniwindows::~miniwindows() 252 | { 253 | delete ui; 254 | hook.unInstallHook(); //移除钩子 255 | } 256 | 257 | /*拖动窗口操作*/ 258 | void miniwindows::mousePressEvent(QMouseEvent *event) 259 | { 260 | if( (event->button() == Qt::LeftButton) ){ 261 | mouse_press = true; 262 | mousePoint = event->globalPos() - this->pos(); 263 | } 264 | else if(event->button() == Qt::RightButton){ 265 | //如果是右键 266 | hook.unInstallHook(); //移除钩子 267 | this->close(); 268 | } 269 | } 270 | void miniwindows::mouseMoveEvent(QMouseEvent *event) 271 | { 272 | if(mouse_press) 273 | { 274 | move(event->globalPos() - mousePoint); 275 | } 276 | } 277 | void miniwindows::mouseReleaseEvent(QMouseEvent *event) 278 | { 279 | mouse_press = false; 280 | } 281 | 282 | /*点击单元格*/ 283 | void miniwindows::on_tableWidget_cellClicked(int row, int column) 284 | { 285 | global_row = row; 286 | global_column = column; 287 | ui->label_location->setText("选中方块 ( " + QString::number(global_row-50) + " , " + QString::number(global_column-50)+" )"); 288 | show_reload(ui,global_row,global_column); 289 | } 290 | 291 | /*按键监听*/ 292 | void miniwindows::checkType(Hook::Type type){ 293 | switch (type) { 294 | case Hook::T: 295 | if(global_column>0) global_column-=1; 296 | break; 297 | case Hook::G: 298 | if(global_column<100) global_column+=1; 299 | break; 300 | case Hook::F: 301 | if(global_row>0) global_row-=1; 302 | break; 303 | case Hook::H: 304 | if(global_row<100) global_row+=1; 305 | break; 306 | default: 307 | break; 308 | } 309 | /*移动单元格*/ 310 | QTableWidgetItem *item = new QTableWidgetItem(); 311 | ui->tableWidget->setItem(global_column, global_row, item); 312 | ui->tableWidget->scrollToItem(item, QAbstractItemView::PositionAtCenter); 313 | /*刷新单元格内容*/ 314 | ui->label_location->setText("选中方块 ( " + QString::number(global_column-50) + " , " + QString::number(global_row-50)+" )"); 315 | ui->label_block->setText("方块:"+save_map_class[global_column][global_row].block); 316 | if(save_map_class[global_column][global_row].condition==1) ui->label_condition->setText("条件:无条件"); 317 | else ui->label_condition->setText("条件:有条件"); 318 | ui->label_delay->setText("延迟:"+QString::number(save_map_class[global_column][global_row].delay)); 319 | if(save_map_class[global_column][global_row].execute) ui->label_execute->setText("执行:√"); 320 | else ui->label_execute->setText("执行:×"); 321 | if(save_map_class[global_column][global_row].redstone==1) ui->label_redstone->setText("红石:红石控制"); 322 | else ui->label_redstone->setText("红石:保持开启"); 323 | if(save_map_class[global_column][global_row].toward==1) ui->label_toward->setText("方向:北↑"); 324 | else if(save_map_class[global_column][global_row].toward==2) ui->label_toward->setText("方向:东→"); 325 | else if(save_map_class[global_column][global_row].toward==3) ui->label_toward->setText("方向:南↓"); 326 | else if(save_map_class[global_column][global_row].toward==4) ui->label_toward->setText("方向:西←"); 327 | if(save_map_class[global_column][global_row].type==1) ui->label_toward->setText("类型:脉冲"); 328 | else if(save_map_class[global_column][global_row].type==2) ui->label_toward->setText("类型:连锁"); 329 | else if(save_map_class[global_column][global_row].type==3) ui->label_toward->setText("类型:循环"); 330 | ui->textEdit_notes->setText(save_map_class[global_column][global_row].note); 331 | ui->textEdit_cmd->setText(save_map_class[global_column][global_row].content); 332 | } 333 | 334 | void simulateMouseClick(const QPoint& screenPos,bool isLeft) { 335 | // 设置鼠标位置 336 | SetCursorPos(screenPos.x(), screenPos.y()); 337 | // 创建输入事件数组 338 | INPUT inputs[2] = {}; 339 | if(isLeft) 340 | { 341 | // 模拟鼠标按下 342 | inputs[0].type = INPUT_MOUSE; 343 | inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN; 344 | // 模拟鼠标释放 345 | inputs[1].type = INPUT_MOUSE; 346 | inputs[1].mi.dwFlags = MOUSEEVENTF_LEFTUP; 347 | } 348 | 349 | else 350 | { 351 | // 模拟鼠标按下 352 | inputs[0].type = INPUT_MOUSE; 353 | inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTDOWN; 354 | // 模拟鼠标释放 355 | inputs[1].type = INPUT_MOUSE; 356 | inputs[1].mi.dwFlags = MOUSEEVENTF_RIGHTUP; 357 | } 358 | 359 | // 注入输入事件 360 | SendInput(2, inputs, sizeof(INPUT)); 361 | } 362 | void simulateTyping(QString text) { 363 | for (char c : text.toStdString()) { 364 | // 将字符转换为虚拟键码 365 | SHORT vk = VkKeyScanA(c); 366 | if (vk == -1) { 367 | qWarning("无法处理字符: %c", c); 368 | continue; 369 | } 370 | // 检查是否需要 Shift 键 371 | bool shiftRequired = (vk & 0x0100) != 0; 372 | 373 | INPUT inputs[4] = {}; 374 | int inputIndex = 0; 375 | // 如果需要 Shift 键,先按下 376 | if (shiftRequired) { 377 | inputs[inputIndex].type = INPUT_KEYBOARD; 378 | inputs[inputIndex].ki.wVk = VK_SHIFT; 379 | ++inputIndex; 380 | } 381 | // 按下字符键 382 | inputs[inputIndex].type = INPUT_KEYBOARD; 383 | inputs[inputIndex].ki.wVk = vk & 0xFF; // 提取虚拟键码 384 | ++inputIndex; 385 | // 释放字符键 386 | inputs[inputIndex].type = INPUT_KEYBOARD; 387 | inputs[inputIndex].ki.wVk = vk & 0xFF; 388 | inputs[inputIndex].ki.dwFlags = KEYEVENTF_KEYUP; 389 | ++inputIndex; 390 | // 如果需要 Shift 键,释放它 391 | if (shiftRequired) { 392 | inputs[inputIndex].type = INPUT_KEYBOARD; 393 | inputs[inputIndex].ki.wVk = VK_SHIFT; 394 | inputs[inputIndex].ki.dwFlags = KEYEVENTF_KEYUP; 395 | ++inputIndex; 396 | } 397 | // 注入输入事件 398 | SendInput(inputIndex, inputs, sizeof(INPUT)); 399 | } 400 | } 401 | void TypingOneWord(WORD word) 402 | { 403 | // 创建输入事件数组 404 | INPUT inputs[2] = {}; 405 | // 按下 ESC 键 406 | inputs[0].type = INPUT_KEYBOARD; 407 | inputs[0].ki.wVk = word; 408 | // 释放 ESC 键 409 | inputs[1].type = INPUT_KEYBOARD; 410 | inputs[1].ki.wVk = word; 411 | inputs[1].ki.dwFlags = KEYEVENTF_KEYUP; 412 | // 注入 ESC 键的事件 413 | SendInput(2, inputs, sizeof(INPUT)); 414 | } 415 | void typetp(int x,int y) 416 | { 417 | simulateTyping("tp ~"+QString::number(y-50-global_player_row)+" ~ ~"+QString::number(x-50-global_player_column)); 418 | global_player_row = y-50; 419 | global_player_column = x-50; 420 | std::this_thread::sleep_for(std::chrono::milliseconds(1000)); 421 | TypingOneWord(VK_RETURN); 422 | } 423 | void setblock(int x,int y) 424 | { 425 | qDebug()<tableWidget->columnCount(); x++) 452 | { 453 | for (int y = 0;y != ui->tableWidget->rowCount(); y++) 454 | { 455 | if(save_map_class[x][y].block != "air") //插入元素 456 | { 457 | TypingOneWord(VK_OEM_2); 458 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 459 | typetp(x,y); 460 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 461 | TypingOneWord(VK_OEM_2); 462 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 463 | setblock(x,y); 464 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 465 | simulateMouseClick(QPoint(0,0),0); // 模拟点击屏幕坐标 466 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 467 | simulateTyping(save_map_class[x][y].content); 468 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 469 | TypingOneWord(VK_ESCAPE); 470 | if(save_map_class[x][y].redstone==2) 471 | { 472 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 473 | TypingOneWord(VK_LEFT); 474 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 475 | TypingOneWord(VK_DOWN); 476 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 477 | TypingOneWord(VK_DOWN); 478 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 479 | TypingOneWord(VK_DOWN); 480 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 481 | TypingOneWord(VK_RETURN); 482 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 483 | TypingOneWord(VK_RETURN); 484 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 485 | } 486 | TypingOneWord(VK_ESCAPE); 487 | std::this_thread::sleep_for(std::chrono::milliseconds(delay)); 488 | } 489 | } 490 | ; 491 | } 492 | } 493 | 494 | 495 | 496 | void miniwindows::on_pushButton_clicked() 497 | { 498 | qDebug()< 7 | 8 | namespace Ui { 9 | class miniwindows; 10 | } 11 | 12 | class miniwindows : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit miniwindows(QWidget *parent = nullptr); 18 | ~miniwindows(); 19 | 20 | protected: 21 | /*鼠标相关事件*/ 22 | void mouseMoveEvent(QMouseEvent *event); 23 | void mousePressEvent(QMouseEvent *event); 24 | void mouseReleaseEvent(QMouseEvent *event); 25 | private slots: 26 | void on_tableWidget_cellClicked(int row, int column); 27 | void checkType(Hook::Type); //按键信号 28 | 29 | void on_pushButton_start_clicked(); 30 | 31 | 32 | void on_pushButton_clicked(); 33 | 34 | private: 35 | /*鼠标相关参数*/ 36 | QPoint mousePoint; 37 | bool mouse_press; 38 | Ui::miniwindows *ui; 39 | Hook hook; //钩子对象 40 | }; 41 | 42 | #endif // MINIWINDOWS_H 43 | -------------------------------------------------------------------------------- /miniwindows.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | miniwindows 4 | 5 | 6 | 7 | 0 8 | 0 9 | 562 10 | 353 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | * { 18 | background-color: #FFFEF9; 19 | } 20 | 21 | QMenuBar { 22 | background-color: #FFFCF3; 23 | } 24 | 25 | QMenu { 26 | background-color: #FFFCF3; 27 | } 28 | 29 | QMenu::item { 30 | padding: 5px 20px; 31 | background-color: transparent; 32 | } 33 | 34 | QMenu::item:selected { 35 | background-color: #f8b156; 36 | } 37 | 38 | QMenu::separator { 39 | height: 1px; 40 | background-color: #f7931e; 41 | margin: 5px 0px 5px 0px; 42 | } 43 | 44 | QMenuBar::item { 45 | padding: 5px 20px; 46 | background-color: transparent; 47 | } 48 | 49 | QMenuBar::item:selected { 50 | background-color: #f8b156; 51 | } 52 | 53 | QMenuBar::item:pressed { 54 | background-color: #DAA520; 55 | } 56 | 57 | 58 | QLineEdit { 59 | border: 2px solid #f7931e; 60 | border-radius: 3px; 61 | background-color: #FFFCF3; 62 | padding: 2px; 63 | font-size: 16px; 64 | } 65 | 66 | 67 | QTextEdit { 68 | border: 2px solid #f7931e; 69 | border-radius: 3px;; 70 | padding: 5px; 71 | font-size: 10px; 72 | background-color: #FFFCF3; 73 | } 74 | 75 | QTableView { 76 | background-color: #FFFCF3; 77 | } 78 | 79 | QPushButton { 80 | background-color: #FFBC33; 81 | color: #ffffff; 82 | border: none; 83 | border-radius: 2px; 84 | padding: 2px 2px; 85 | font-size: 16px; 86 | font-weight: bold; 87 | } 88 | 89 | QPushButton:hover { 90 | background-color: #f8b156; 91 | } 92 | 93 | QPushButton:pressed { 94 | background-color: #DAA520; 95 | } 96 | 97 | 98 | QComboBox { 99 | border: none; 100 | border-radius: 20px; 101 | background-color: #FFBC33; 102 | color: #ffffff; 103 | font-size: 16px; 104 | font-weight: bold; 105 | padding: 8px 20px; 106 | padding-right: 4px; /* 右侧留出一定空间 */ 107 | selection-background-color: #f8b156; /* 选中项背景色 */ 108 | selection-color: #ffffff; /* 选中项前景色 */ 109 | outline: none; 110 | } 111 | 112 | QComboBox:hover { 113 | background-color: #f8b156; 114 | } 115 | 116 | QComboBox::drop-down { 117 | width: 0; /* 去掉下拉箭头 */ 118 | } 119 | 120 | QCheckBox { 121 | color: #FFBC33; 122 | font-size: 16px; 123 | font-weight: bold; 124 | padding-left: 20px; 125 | } 126 | 127 | QCheckBox::indicator { 128 | width: 18px; 129 | height: 18px; 130 | } 131 | 132 | QCheckBox::indicator::unchecked { 133 | border: 2px solid #FFBC33; 134 | background-color: #FFFEF9; 135 | } 136 | 137 | QCheckBox::indicator::unchecked:hover { 138 | border: 2px solid #f8b156; 139 | } 140 | 141 | QCheckBox::indicator::checked { 142 | border: 2px solid #FFBC33; 143 | background-color: #FFBC33; 144 | } 145 | 146 | QCheckBox::indicator::checked:hover { 147 | background-color: #f8b156; 148 | } 149 | 150 | 151 | 152 | 153 | true 154 | 155 | 156 | 157 | 0 158 | 0 159 | 291 160 | 291 161 | 162 | 163 | 164 | 165 | 0 166 | 0 167 | 168 | 169 | 170 | QTableWidget::item { 171 | padding: 0px; 172 | border: 0; 173 | } 174 | 175 | 176 | false 177 | 178 | 179 | 180 | 新建行 181 | 182 | 183 | 184 | 185 | 新建行 186 | 187 | 188 | 189 | 190 | 新建列 191 | 192 | 193 | 194 | 195 | 新建列 196 | 197 | 198 | 199 | 200 | 1 201 | 202 | 203 | 204 | 205 | 2 206 | 207 | 208 | 209 | 210 | 1 211 | 212 | 213 | 214 | 215 | 1 216 | 217 | 218 | 219 | 220 | 221 | 222 | 300 223 | 0 224 | 241 225 | 31 226 | 227 | 228 | 229 | 230 | 12 231 | 232 | 233 | 234 | 选中方块: 235 | 236 | 237 | 238 | 239 | 240 | 300 241 | 40 242 | 241 243 | 21 244 | 245 | 246 | 247 | 248 | 10 249 | 250 | 251 | 252 | 方块: 253 | 254 | 255 | 256 | 257 | 258 | 300 259 | 60 260 | 111 261 | 21 262 | 263 | 264 | 265 | 266 | 10 267 | 268 | 269 | 270 | 朝向: 271 | 272 | 273 | 274 | 275 | 276 | 410 277 | 60 278 | 131 279 | 21 280 | 281 | 282 | 283 | 284 | 10 285 | 286 | 287 | 288 | 类型: 289 | 290 | 291 | 292 | 293 | 294 | 410 295 | 80 296 | 131 297 | 21 298 | 299 | 300 | 301 | 302 | 10 303 | 304 | 305 | 306 | 红石: 307 | 308 | 309 | 310 | 311 | 312 | 300 313 | 80 314 | 111 315 | 21 316 | 317 | 318 | 319 | 320 | 10 321 | 322 | 323 | 324 | 条件: 325 | 326 | 327 | 328 | 329 | 330 | 410 331 | 100 332 | 131 333 | 21 334 | 335 | 336 | 337 | 338 | 10 339 | 340 | 341 | 342 | 执行: 343 | 344 | 345 | 346 | 347 | 348 | 300 349 | 100 350 | 111 351 | 21 352 | 353 | 354 | 355 | 356 | 10 357 | 358 | 359 | 360 | 延迟: 361 | 362 | 363 | 364 | 365 | 366 | 300 367 | 130 368 | 41 369 | 21 370 | 371 | 372 | 373 | 374 | 10 375 | 376 | 377 | 378 | 备注: 379 | 380 | 381 | 382 | 383 | 384 | 300 385 | 210 386 | 41 387 | 21 388 | 389 | 390 | 391 | 392 | 10 393 | 394 | 395 | 396 | 命令 397 | 398 | 399 | 400 | 401 | 402 | 300 403 | 150 404 | 241 405 | 51 406 | 407 | 408 | 409 | true 410 | 411 | 412 | 413 | 414 | 415 | 300 416 | 230 417 | 241 418 | 61 419 | 420 | 421 | 422 | true 423 | 424 | 425 | 426 | 427 | 428 | 10 429 | 300 430 | 75 431 | 23 432 | 433 | 434 | 435 | 开始导入 436 | 437 | 438 | 439 | 440 | 441 | 100 442 | 300 443 | 75 444 | 23 445 | 446 | 447 | 448 | 位置 449 | 450 | 451 | 452 | 453 | 454 | 455 | -------------------------------------------------------------------------------- /resource.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | stylesheet.qss 4 | 5 | 6 | -------------------------------------------------------------------------------- /stylesheet.qss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zao-chen/ZcCommandEditor/194811642b26eb3fb60a1274212879ed12439d33/stylesheet.qss -------------------------------------------------------------------------------- /ui_helps_ui.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'helps_ui.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 6.5.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_HELPS_UI_H 10 | #define UI_HELPS_UI_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | class Ui_helps_ui 24 | { 25 | public: 26 | QWidget *centralwidget; 27 | QTableWidget *tableWidget; 28 | QMenuBar *menubar; 29 | QStatusBar *statusbar; 30 | 31 | void setupUi(QMainWindow *helps_ui) 32 | { 33 | if (helps_ui->objectName().isEmpty()) 34 | helps_ui->setObjectName("helps_ui"); 35 | helps_ui->resize(433, 386); 36 | helps_ui->setStyleSheet(QString::fromUtf8("* {\n" 37 | " background-color: #FFFEF9;\n" 38 | "}\n" 39 | "\n" 40 | "QMenuBar {\n" 41 | " background-color: #FFFCF3;\n" 42 | "}\n" 43 | "\n" 44 | "QMenu {\n" 45 | " background-color: #FFFCF3;\n" 46 | "}\n" 47 | "\n" 48 | "QMenu::item {\n" 49 | " padding: 5px 20px;\n" 50 | " background-color: transparent;\n" 51 | "}\n" 52 | "\n" 53 | "QMenu::item:selected {\n" 54 | " background-color: #f8b156;\n" 55 | "}\n" 56 | "\n" 57 | "QMenu::separator {\n" 58 | " height: 1px;\n" 59 | " background-color: #f7931e;\n" 60 | " margin: 5px 0px 5px 0px;\n" 61 | "}\n" 62 | "\n" 63 | "QMenuBar::item {\n" 64 | " padding: 5px 20px;\n" 65 | " background-color: transparent;\n" 66 | "}\n" 67 | "\n" 68 | "QMenuBar::item:selected {\n" 69 | " background-color: #f8b156;\n" 70 | "}\n" 71 | "\n" 72 | "QMenuBar::item:pressed {\n" 73 | " background-color: #DAA520;\n" 74 | "}\n" 75 | "\n" 76 | "\n" 77 | "QLineEdit {\n" 78 | " border: 2px solid #f7931e;\n" 79 | " border-radius: 3px;\n" 80 | " background-color: #FFFCF3;\n" 81 | " padding: 2px;\n" 82 | " font-size: 16px;\n" 83 | "}\n" 84 | "\n" 85 | "\n" 86 | "QTextEdit {\n" 87 | " border: 2px solid #f7931e;\n" 88 | " border-radius: 3px;;\n" 89 | " padding: 5px;\n" 90 | " font-size: 10px;\n" 91 | " " 92 | " background-color: #FFFCF3;\n" 93 | "}\n" 94 | "\n" 95 | "QTableView {\n" 96 | " background-color: #FFFCF3;\n" 97 | "}\n" 98 | "\n" 99 | "QPushButton {\n" 100 | " background-color: #FFBC33;\n" 101 | " color: #ffffff;\n" 102 | " border: none;\n" 103 | " border-radius: 2px;\n" 104 | " padding: 2px 2px;\n" 105 | " font-size: 16px;\n" 106 | " font-weight: bold;\n" 107 | "}\n" 108 | "\n" 109 | "QPushButton:hover {\n" 110 | " background-color: #f8b156;\n" 111 | "}\n" 112 | "\n" 113 | "QPushButton:pressed {\n" 114 | " background-color: #DAA520;\n" 115 | "}\n" 116 | "\n" 117 | "\n" 118 | "QComboBox {\n" 119 | " border: none;\n" 120 | " border-radius: 20px;\n" 121 | " background-color: #FFBC33;\n" 122 | " color: #ffffff;\n" 123 | " font-size: 16px;\n" 124 | " font-weight: bold;\n" 125 | " padding: 8px 20px;\n" 126 | " padding-right: 4px; /* \345\217\263\344\276\247\347\225\231\345\207\272\344\270\200\345\256\232\347\251\272\351\227\264 */\n" 127 | " selection-background-color: #f8b156; /* \351\200\211\344\270\255\351\241\271\350\203\214\346\231\257\350\211\262 */\n" 128 | " selection-color: #ffffff; /* \351\200\211\344\270\255\351\241\271\345\211\215\346\231\257\350" 129 | "\211\262 */\n" 130 | " outline: none;\n" 131 | "}\n" 132 | "\n" 133 | "QComboBox:hover {\n" 134 | " background-color: #f8b156;\n" 135 | "}\n" 136 | "\n" 137 | "QComboBox::drop-down {\n" 138 | " width: 0; /* \345\216\273\346\216\211\344\270\213\346\213\211\347\256\255\345\244\264 */\n" 139 | "}\n" 140 | "\n" 141 | "QCheckBox {\n" 142 | " color: #FFBC33;\n" 143 | " font-size: 16px;\n" 144 | " font-weight: bold;\n" 145 | " padding-left: 20px;\n" 146 | "}\n" 147 | "\n" 148 | "QCheckBox::indicator {\n" 149 | " width: 18px;\n" 150 | " height: 18px;\n" 151 | "}\n" 152 | "\n" 153 | "QCheckBox::indicator::unchecked {\n" 154 | " border: 2px solid #FFBC33;\n" 155 | " background-color: #FFFEF9;\n" 156 | "}\n" 157 | "\n" 158 | "QCheckBox::indicator::unchecked:hover {\n" 159 | " border: 2px solid #f8b156;\n" 160 | "}\n" 161 | "\n" 162 | "QCheckBox::indicator::checked {\n" 163 | " border: 2px solid #FFBC33;\n" 164 | " background-color: #FFBC33;\n" 165 | "}\n" 166 | "\n" 167 | "QCheckBox::indicator::checked:hover {\n" 168 | " background-color: #f8b156;\n" 169 | "}\n" 170 | "")); 171 | centralwidget = new QWidget(helps_ui); 172 | centralwidget->setObjectName("centralwidget"); 173 | tableWidget = new QTableWidget(centralwidget); 174 | if (tableWidget->columnCount() < 2) 175 | tableWidget->setColumnCount(2); 176 | QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); 177 | tableWidget->setHorizontalHeaderItem(0, __qtablewidgetitem); 178 | QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem(); 179 | tableWidget->setHorizontalHeaderItem(1, __qtablewidgetitem1); 180 | if (tableWidget->rowCount() < 4) 181 | tableWidget->setRowCount(4); 182 | QTableWidgetItem *__qtablewidgetitem2 = new QTableWidgetItem(); 183 | tableWidget->setVerticalHeaderItem(0, __qtablewidgetitem2); 184 | QTableWidgetItem *__qtablewidgetitem3 = new QTableWidgetItem(); 185 | tableWidget->setVerticalHeaderItem(1, __qtablewidgetitem3); 186 | QTableWidgetItem *__qtablewidgetitem4 = new QTableWidgetItem(); 187 | tableWidget->setVerticalHeaderItem(2, __qtablewidgetitem4); 188 | QTableWidgetItem *__qtablewidgetitem5 = new QTableWidgetItem(); 189 | tableWidget->setVerticalHeaderItem(3, __qtablewidgetitem5); 190 | QTableWidgetItem *__qtablewidgetitem6 = new QTableWidgetItem(); 191 | tableWidget->setItem(0, 0, __qtablewidgetitem6); 192 | QTableWidgetItem *__qtablewidgetitem7 = new QTableWidgetItem(); 193 | tableWidget->setItem(0, 1, __qtablewidgetitem7); 194 | QTableWidgetItem *__qtablewidgetitem8 = new QTableWidgetItem(); 195 | tableWidget->setItem(1, 0, __qtablewidgetitem8); 196 | QTableWidgetItem *__qtablewidgetitem9 = new QTableWidgetItem(); 197 | tableWidget->setItem(1, 1, __qtablewidgetitem9); 198 | QTableWidgetItem *__qtablewidgetitem10 = new QTableWidgetItem(); 199 | tableWidget->setItem(2, 0, __qtablewidgetitem10); 200 | QTableWidgetItem *__qtablewidgetitem11 = new QTableWidgetItem(); 201 | tableWidget->setItem(2, 1, __qtablewidgetitem11); 202 | QTableWidgetItem *__qtablewidgetitem12 = new QTableWidgetItem(); 203 | tableWidget->setItem(3, 0, __qtablewidgetitem12); 204 | QTableWidgetItem *__qtablewidgetitem13 = new QTableWidgetItem(); 205 | tableWidget->setItem(3, 1, __qtablewidgetitem13); 206 | tableWidget->setObjectName("tableWidget"); 207 | tableWidget->setGeometry(QRect(10, 10, 411, 331)); 208 | helps_ui->setCentralWidget(centralwidget); 209 | menubar = new QMenuBar(helps_ui); 210 | menubar->setObjectName("menubar"); 211 | menubar->setGeometry(QRect(0, 0, 433, 30)); 212 | helps_ui->setMenuBar(menubar); 213 | statusbar = new QStatusBar(helps_ui); 214 | statusbar->setObjectName("statusbar"); 215 | helps_ui->setStatusBar(statusbar); 216 | 217 | retranslateUi(helps_ui); 218 | 219 | QMetaObject::connectSlotsByName(helps_ui); 220 | } // setupUi 221 | 222 | void retranslateUi(QMainWindow *helps_ui) 223 | { 224 | helps_ui->setWindowTitle(QCoreApplication::translate("helps_ui", "MainWindow", nullptr)); 225 | QTableWidgetItem *___qtablewidgetitem = tableWidget->horizontalHeaderItem(0); 226 | ___qtablewidgetitem->setText(QCoreApplication::translate("helps_ui", "\346\214\211\351\224\256", nullptr)); 227 | QTableWidgetItem *___qtablewidgetitem1 = tableWidget->horizontalHeaderItem(1); 228 | ___qtablewidgetitem1->setText(QCoreApplication::translate("helps_ui", "\350\257\264\346\230\216", nullptr)); 229 | QTableWidgetItem *___qtablewidgetitem2 = tableWidget->verticalHeaderItem(0); 230 | ___qtablewidgetitem2->setText(QCoreApplication::translate("helps_ui", "\346\224\276\347\275\256\347\251\272\346\260\224", nullptr)); 231 | QTableWidgetItem *___qtablewidgetitem3 = tableWidget->verticalHeaderItem(1); 232 | ___qtablewidgetitem3->setText(QCoreApplication::translate("helps_ui", "\346\224\276\347\275\256\345\221\275\344\273\244\346\226\271\345\235\227", nullptr)); 233 | QTableWidgetItem *___qtablewidgetitem4 = tableWidget->verticalHeaderItem(2); 234 | ___qtablewidgetitem4->setText(QCoreApplication::translate("helps_ui", "\346\224\276\347\275\256\346\231\256\351\200\232\346\226\271\345\235\227", nullptr)); 235 | QTableWidgetItem *___qtablewidgetitem5 = tableWidget->verticalHeaderItem(3); 236 | ___qtablewidgetitem5->setText(QCoreApplication::translate("helps_ui", "\344\270\212\344\270\213\345\267\246\345\217\263\357\274\210\346\202\254\346\265\256\347\252\227\344\270\213\357\274\211", nullptr)); 237 | 238 | const bool __sortingEnabled = tableWidget->isSortingEnabled(); 239 | tableWidget->setSortingEnabled(false); 240 | QTableWidgetItem *___qtablewidgetitem6 = tableWidget->item(0, 0); 241 | ___qtablewidgetitem6->setText(QCoreApplication::translate("helps_ui", "a", nullptr)); 242 | QTableWidgetItem *___qtablewidgetitem7 = tableWidget->item(0, 1); 243 | ___qtablewidgetitem7->setText(QCoreApplication::translate("helps_ui", "air", nullptr)); 244 | QTableWidgetItem *___qtablewidgetitem8 = tableWidget->item(1, 0); 245 | ___qtablewidgetitem8->setText(QCoreApplication::translate("helps_ui", "c", nullptr)); 246 | QTableWidgetItem *___qtablewidgetitem9 = tableWidget->item(1, 1); 247 | ___qtablewidgetitem9->setText(QCoreApplication::translate("helps_ui", "command_block", nullptr)); 248 | QTableWidgetItem *___qtablewidgetitem10 = tableWidget->item(2, 0); 249 | ___qtablewidgetitem10->setText(QCoreApplication::translate("helps_ui", "b", nullptr)); 250 | QTableWidgetItem *___qtablewidgetitem11 = tableWidget->item(2, 1); 251 | ___qtablewidgetitem11->setText(QCoreApplication::translate("helps_ui", "block", nullptr)); 252 | QTableWidgetItem *___qtablewidgetitem12 = tableWidget->item(3, 0); 253 | ___qtablewidgetitem12->setText(QCoreApplication::translate("helps_ui", "t g f h", nullptr)); 254 | QTableWidgetItem *___qtablewidgetitem13 = tableWidget->item(3, 1); 255 | ___qtablewidgetitem13->setText(QCoreApplication::translate("helps_ui", "\347\261\273\344\274\274wsad", nullptr)); 256 | tableWidget->setSortingEnabled(__sortingEnabled); 257 | 258 | } // retranslateUi 259 | 260 | }; 261 | 262 | namespace Ui { 263 | class helps_ui: public Ui_helps_ui {}; 264 | } // namespace Ui 265 | 266 | QT_END_NAMESPACE 267 | 268 | #endif // UI_HELPS_UI_H 269 | -------------------------------------------------------------------------------- /ui_miniwindows.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'miniwindows.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 6.5.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_MINIWINDOWS_H 10 | #define UI_MINIWINDOWS_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | QT_BEGIN_NAMESPACE 21 | 22 | class Ui_miniwindows 23 | { 24 | public: 25 | QTableWidget *tableWidget; 26 | QLabel *label_location; 27 | QLabel *label_block; 28 | QLabel *label_toward; 29 | QLabel *label_type; 30 | QLabel *label_redstone; 31 | QLabel *label_condition; 32 | QLabel *label_execute; 33 | QLabel *label_delay; 34 | QLabel *label_delay_2; 35 | QLabel *label_delay_3; 36 | QTextEdit *textEdit_notes; 37 | QTextEdit *textEdit_cmd; 38 | 39 | void setupUi(QWidget *miniwindows) 40 | { 41 | if (miniwindows->objectName().isEmpty()) 42 | miniwindows->setObjectName("miniwindows"); 43 | miniwindows->resize(549, 303); 44 | miniwindows->setStyleSheet(QString::fromUtf8("* {\n" 45 | " background-color: #FFFEF9;\n" 46 | "}\n" 47 | "\n" 48 | "QMenuBar {\n" 49 | " background-color: #FFFCF3;\n" 50 | "}\n" 51 | "\n" 52 | "QMenu {\n" 53 | " background-color: #FFFCF3;\n" 54 | "}\n" 55 | "\n" 56 | "QMenu::item {\n" 57 | " padding: 5px 20px;\n" 58 | " background-color: transparent;\n" 59 | "}\n" 60 | "\n" 61 | "QMenu::item:selected {\n" 62 | " background-color: #f8b156;\n" 63 | "}\n" 64 | "\n" 65 | "QMenu::separator {\n" 66 | " height: 1px;\n" 67 | " background-color: #f7931e;\n" 68 | " margin: 5px 0px 5px 0px;\n" 69 | "}\n" 70 | "\n" 71 | "QMenuBar::item {\n" 72 | " padding: 5px 20px;\n" 73 | " background-color: transparent;\n" 74 | "}\n" 75 | "\n" 76 | "QMenuBar::item:selected {\n" 77 | " background-color: #f8b156;\n" 78 | "}\n" 79 | "\n" 80 | "QMenuBar::item:pressed {\n" 81 | " background-color: #DAA520;\n" 82 | "}\n" 83 | "\n" 84 | "\n" 85 | "QLineEdit {\n" 86 | " border: 2px solid #f7931e;\n" 87 | " border-radius: 3px;\n" 88 | " background-color: #FFFCF3;\n" 89 | " padding: 2px;\n" 90 | " font-size: 16px;\n" 91 | "}\n" 92 | "\n" 93 | "\n" 94 | "QTextEdit {\n" 95 | " border: 2px solid #f7931e;\n" 96 | " border-radius: 3px;;\n" 97 | " padding: 5px;\n" 98 | " font-size: 10px;\n" 99 | " " 100 | " background-color: #FFFCF3;\n" 101 | "}\n" 102 | "\n" 103 | "QTableView {\n" 104 | " background-color: #FFFCF3;\n" 105 | "}\n" 106 | "\n" 107 | "QPushButton {\n" 108 | " background-color: #FFBC33;\n" 109 | " color: #ffffff;\n" 110 | " border: none;\n" 111 | " border-radius: 2px;\n" 112 | " padding: 2px 2px;\n" 113 | " font-size: 16px;\n" 114 | " font-weight: bold;\n" 115 | "}\n" 116 | "\n" 117 | "QPushButton:hover {\n" 118 | " background-color: #f8b156;\n" 119 | "}\n" 120 | "\n" 121 | "QPushButton:pressed {\n" 122 | " background-color: #DAA520;\n" 123 | "}\n" 124 | "\n" 125 | "\n" 126 | "QComboBox {\n" 127 | " border: none;\n" 128 | " border-radius: 20px;\n" 129 | " background-color: #FFBC33;\n" 130 | " color: #ffffff;\n" 131 | " font-size: 16px;\n" 132 | " font-weight: bold;\n" 133 | " padding: 8px 20px;\n" 134 | " padding-right: 4px; /* \345\217\263\344\276\247\347\225\231\345\207\272\344\270\200\345\256\232\347\251\272\351\227\264 */\n" 135 | " selection-background-color: #f8b156; /* \351\200\211\344\270\255\351\241\271\350\203\214\346\231\257\350\211\262 */\n" 136 | " selection-color: #ffffff; /* \351\200\211\344\270\255\351\241\271\345\211\215\346\231\257\350" 137 | "\211\262 */\n" 138 | " outline: none;\n" 139 | "}\n" 140 | "\n" 141 | "QComboBox:hover {\n" 142 | " background-color: #f8b156;\n" 143 | "}\n" 144 | "\n" 145 | "QComboBox::drop-down {\n" 146 | " width: 0; /* \345\216\273\346\216\211\344\270\213\346\213\211\347\256\255\345\244\264 */\n" 147 | "}\n" 148 | "\n" 149 | "QCheckBox {\n" 150 | " color: #FFBC33;\n" 151 | " font-size: 16px;\n" 152 | " font-weight: bold;\n" 153 | " padding-left: 20px;\n" 154 | "}\n" 155 | "\n" 156 | "QCheckBox::indicator {\n" 157 | " width: 18px;\n" 158 | " height: 18px;\n" 159 | "}\n" 160 | "\n" 161 | "QCheckBox::indicator::unchecked {\n" 162 | " border: 2px solid #FFBC33;\n" 163 | " background-color: #FFFEF9;\n" 164 | "}\n" 165 | "\n" 166 | "QCheckBox::indicator::unchecked:hover {\n" 167 | " border: 2px solid #f8b156;\n" 168 | "}\n" 169 | "\n" 170 | "QCheckBox::indicator::checked {\n" 171 | " border: 2px solid #FFBC33;\n" 172 | " background-color: #FFBC33;\n" 173 | "}\n" 174 | "\n" 175 | "QCheckBox::indicator::checked:hover {\n" 176 | " background-color: #f8b156;\n" 177 | "}\n" 178 | "")); 179 | tableWidget = new QTableWidget(miniwindows); 180 | if (tableWidget->columnCount() < 2) 181 | tableWidget->setColumnCount(2); 182 | QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); 183 | tableWidget->setHorizontalHeaderItem(0, __qtablewidgetitem); 184 | QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem(); 185 | tableWidget->setHorizontalHeaderItem(1, __qtablewidgetitem1); 186 | if (tableWidget->rowCount() < 2) 187 | tableWidget->setRowCount(2); 188 | QTableWidgetItem *__qtablewidgetitem2 = new QTableWidgetItem(); 189 | tableWidget->setVerticalHeaderItem(0, __qtablewidgetitem2); 190 | QTableWidgetItem *__qtablewidgetitem3 = new QTableWidgetItem(); 191 | tableWidget->setVerticalHeaderItem(1, __qtablewidgetitem3); 192 | QTableWidgetItem *__qtablewidgetitem4 = new QTableWidgetItem(); 193 | tableWidget->setItem(0, 0, __qtablewidgetitem4); 194 | QTableWidgetItem *__qtablewidgetitem5 = new QTableWidgetItem(); 195 | tableWidget->setItem(0, 1, __qtablewidgetitem5); 196 | QTableWidgetItem *__qtablewidgetitem6 = new QTableWidgetItem(); 197 | tableWidget->setItem(1, 0, __qtablewidgetitem6); 198 | QTableWidgetItem *__qtablewidgetitem7 = new QTableWidgetItem(); 199 | tableWidget->setItem(1, 1, __qtablewidgetitem7); 200 | tableWidget->setObjectName("tableWidget"); 201 | tableWidget->setEnabled(true); 202 | tableWidget->setGeometry(QRect(0, 0, 291, 291)); 203 | tableWidget->setMinimumSize(QSize(0, 0)); 204 | tableWidget->setStyleSheet(QString::fromUtf8("QTableWidget::item {\n" 205 | " padding: 0px;\n" 206 | " border: 0;\n" 207 | "}")); 208 | tableWidget->setDragEnabled(false); 209 | label_location = new QLabel(miniwindows); 210 | label_location->setObjectName("label_location"); 211 | label_location->setGeometry(QRect(300, 0, 241, 31)); 212 | QFont font; 213 | font.setPointSize(12); 214 | label_location->setFont(font); 215 | label_block = new QLabel(miniwindows); 216 | label_block->setObjectName("label_block"); 217 | label_block->setGeometry(QRect(300, 40, 241, 21)); 218 | QFont font1; 219 | font1.setPointSize(10); 220 | label_block->setFont(font1); 221 | label_toward = new QLabel(miniwindows); 222 | label_toward->setObjectName("label_toward"); 223 | label_toward->setGeometry(QRect(300, 60, 111, 21)); 224 | label_toward->setFont(font1); 225 | label_type = new QLabel(miniwindows); 226 | label_type->setObjectName("label_type"); 227 | label_type->setGeometry(QRect(410, 60, 131, 21)); 228 | label_type->setFont(font1); 229 | label_redstone = new QLabel(miniwindows); 230 | label_redstone->setObjectName("label_redstone"); 231 | label_redstone->setGeometry(QRect(410, 80, 131, 21)); 232 | label_redstone->setFont(font1); 233 | label_condition = new QLabel(miniwindows); 234 | label_condition->setObjectName("label_condition"); 235 | label_condition->setGeometry(QRect(300, 80, 111, 21)); 236 | label_condition->setFont(font1); 237 | label_execute = new QLabel(miniwindows); 238 | label_execute->setObjectName("label_execute"); 239 | label_execute->setGeometry(QRect(410, 100, 131, 21)); 240 | label_execute->setFont(font1); 241 | label_delay = new QLabel(miniwindows); 242 | label_delay->setObjectName("label_delay"); 243 | label_delay->setGeometry(QRect(300, 100, 111, 21)); 244 | label_delay->setFont(font1); 245 | label_delay_2 = new QLabel(miniwindows); 246 | label_delay_2->setObjectName("label_delay_2"); 247 | label_delay_2->setGeometry(QRect(300, 130, 41, 21)); 248 | label_delay_2->setFont(font1); 249 | label_delay_3 = new QLabel(miniwindows); 250 | label_delay_3->setObjectName("label_delay_3"); 251 | label_delay_3->setGeometry(QRect(300, 210, 41, 21)); 252 | label_delay_3->setFont(font1); 253 | textEdit_notes = new QTextEdit(miniwindows); 254 | textEdit_notes->setObjectName("textEdit_notes"); 255 | textEdit_notes->setGeometry(QRect(300, 150, 241, 51)); 256 | textEdit_notes->setReadOnly(true); 257 | textEdit_cmd = new QTextEdit(miniwindows); 258 | textEdit_cmd->setObjectName("textEdit_cmd"); 259 | textEdit_cmd->setGeometry(QRect(300, 230, 241, 61)); 260 | textEdit_cmd->setReadOnly(true); 261 | 262 | retranslateUi(miniwindows); 263 | 264 | QMetaObject::connectSlotsByName(miniwindows); 265 | } // setupUi 266 | 267 | void retranslateUi(QWidget *miniwindows) 268 | { 269 | miniwindows->setWindowTitle(QCoreApplication::translate("miniwindows", "Form", nullptr)); 270 | QTableWidgetItem *___qtablewidgetitem = tableWidget->horizontalHeaderItem(0); 271 | ___qtablewidgetitem->setText(QCoreApplication::translate("miniwindows", "\346\226\260\345\273\272\345\210\227", nullptr)); 272 | QTableWidgetItem *___qtablewidgetitem1 = tableWidget->horizontalHeaderItem(1); 273 | ___qtablewidgetitem1->setText(QCoreApplication::translate("miniwindows", "\346\226\260\345\273\272\345\210\227", nullptr)); 274 | QTableWidgetItem *___qtablewidgetitem2 = tableWidget->verticalHeaderItem(0); 275 | ___qtablewidgetitem2->setText(QCoreApplication::translate("miniwindows", "\346\226\260\345\273\272\350\241\214", nullptr)); 276 | QTableWidgetItem *___qtablewidgetitem3 = tableWidget->verticalHeaderItem(1); 277 | ___qtablewidgetitem3->setText(QCoreApplication::translate("miniwindows", "\346\226\260\345\273\272\350\241\214", nullptr)); 278 | 279 | const bool __sortingEnabled = tableWidget->isSortingEnabled(); 280 | tableWidget->setSortingEnabled(false); 281 | QTableWidgetItem *___qtablewidgetitem4 = tableWidget->item(0, 0); 282 | ___qtablewidgetitem4->setText(QCoreApplication::translate("miniwindows", "1", nullptr)); 283 | QTableWidgetItem *___qtablewidgetitem5 = tableWidget->item(0, 1); 284 | ___qtablewidgetitem5->setText(QCoreApplication::translate("miniwindows", "2", nullptr)); 285 | QTableWidgetItem *___qtablewidgetitem6 = tableWidget->item(1, 0); 286 | ___qtablewidgetitem6->setText(QCoreApplication::translate("miniwindows", "1", nullptr)); 287 | QTableWidgetItem *___qtablewidgetitem7 = tableWidget->item(1, 1); 288 | ___qtablewidgetitem7->setText(QCoreApplication::translate("miniwindows", "1", nullptr)); 289 | tableWidget->setSortingEnabled(__sortingEnabled); 290 | 291 | label_location->setText(QCoreApplication::translate("miniwindows", "\351\200\211\344\270\255\346\226\271\345\235\227\357\274\232", nullptr)); 292 | label_block->setText(QCoreApplication::translate("miniwindows", "\346\226\271\345\235\227\357\274\232", nullptr)); 293 | label_toward->setText(QCoreApplication::translate("miniwindows", "\346\234\235\345\220\221\357\274\232", nullptr)); 294 | label_type->setText(QCoreApplication::translate("miniwindows", "\347\261\273\345\236\213\357\274\232", nullptr)); 295 | label_redstone->setText(QCoreApplication::translate("miniwindows", "\347\272\242\347\237\263\357\274\232", nullptr)); 296 | label_condition->setText(QCoreApplication::translate("miniwindows", "\346\235\241\344\273\266\357\274\232", nullptr)); 297 | label_execute->setText(QCoreApplication::translate("miniwindows", "\346\211\247\350\241\214\357\274\232", nullptr)); 298 | label_delay->setText(QCoreApplication::translate("miniwindows", "\345\273\266\350\277\237\357\274\232", nullptr)); 299 | label_delay_2->setText(QCoreApplication::translate("miniwindows", "\345\244\207\346\263\250", nullptr)); 300 | label_delay_3->setText(QCoreApplication::translate("miniwindows", "\345\221\275\344\273\244", nullptr)); 301 | } // retranslateUi 302 | 303 | }; 304 | 305 | namespace Ui { 306 | class miniwindows: public Ui_miniwindows {}; 307 | } // namespace Ui 308 | 309 | QT_END_NAMESPACE 310 | 311 | #endif // UI_MINIWINDOWS_H 312 | -------------------------------------------------------------------------------- /ui_update_ui.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'update_ui.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 6.5.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_UPDATE_UI_H 10 | #define UI_UPDATE_UI_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | QT_BEGIN_NAMESPACE 18 | 19 | class Ui_update_ui 20 | { 21 | public: 22 | QLabel *label; 23 | QLabel *label_ver; 24 | QLabel *label_con; 25 | QLabel *label_2; 26 | QLabel *label_file; 27 | QLabel *label_3; 28 | QLabel *label_text; 29 | QLabel *label_4; 30 | QLabel *label_ver_old; 31 | 32 | void setupUi(QDialog *update_ui) 33 | { 34 | if (update_ui->objectName().isEmpty()) 35 | update_ui->setObjectName("update_ui"); 36 | update_ui->resize(496, 373); 37 | update_ui->setStyleSheet(QString::fromUtf8("* {\n" 38 | " background-color: #FFFEF9;\n" 39 | "}\n" 40 | "\n" 41 | "QMenuBar {\n" 42 | " background-color: #FFFCF3;\n" 43 | "}\n" 44 | "\n" 45 | "QMenu {\n" 46 | " background-color: #FFFCF3;\n" 47 | "}\n" 48 | "\n" 49 | "QMenu::item {\n" 50 | " padding: 5px 20px;\n" 51 | " background-color: transparent;\n" 52 | "}\n" 53 | "\n" 54 | "QMenu::item:selected {\n" 55 | " background-color: #f8b156;\n" 56 | "}\n" 57 | "\n" 58 | "QMenu::separator {\n" 59 | " height: 1px;\n" 60 | " background-color: #f7931e;\n" 61 | " margin: 5px 0px 5px 0px;\n" 62 | "}\n" 63 | "\n" 64 | "QMenuBar::item {\n" 65 | " padding: 5px 20px;\n" 66 | " background-color: transparent;\n" 67 | "}\n" 68 | "\n" 69 | "QMenuBar::item:selected {\n" 70 | " background-color: #f8b156;\n" 71 | "}\n" 72 | "\n" 73 | "QMenuBar::item:pressed {\n" 74 | " background-color: #DAA520;\n" 75 | "}\n" 76 | "\n" 77 | "\n" 78 | "QLineEdit {\n" 79 | " border: 2px solid #f7931e;\n" 80 | " border-radius: 3px;\n" 81 | " background-color: #FFFCF3;\n" 82 | " padding: 2px;\n" 83 | " font-size: 16px;\n" 84 | "}\n" 85 | "\n" 86 | "\n" 87 | "QTextEdit {\n" 88 | " border: 2px solid #f7931e;\n" 89 | " border-radius: 3px;;\n" 90 | " padding: 5px;\n" 91 | " font-size: 10px;\n" 92 | " " 93 | " background-color: #FFFCF3;\n" 94 | "}\n" 95 | "\n" 96 | "QTableView {\n" 97 | " background-color: #FFFCF3;\n" 98 | "}\n" 99 | "\n" 100 | "QPushButton {\n" 101 | " background-color: #FFBC33;\n" 102 | " color: #ffffff;\n" 103 | " border: none;\n" 104 | " border-radius: 2px;\n" 105 | " padding: 2px 2px;\n" 106 | " font-size: 16px;\n" 107 | " font-weight: bold;\n" 108 | "}\n" 109 | "\n" 110 | "QPushButton:hover {\n" 111 | " background-color: #f8b156;\n" 112 | "}\n" 113 | "\n" 114 | "QPushButton:pressed {\n" 115 | " background-color: #DAA520;\n" 116 | "}\n" 117 | "\n" 118 | "\n" 119 | "QComboBox {\n" 120 | " border: none;\n" 121 | " border-radius: 20px;\n" 122 | " background-color: #FFBC33;\n" 123 | " color: #ffffff;\n" 124 | " font-size: 16px;\n" 125 | " font-weight: bold;\n" 126 | " padding: 8px 20px;\n" 127 | " padding-right: 4px; /* \345\217\263\344\276\247\347\225\231\345\207\272\344\270\200\345\256\232\347\251\272\351\227\264 */\n" 128 | " selection-background-color: #f8b156; /* \351\200\211\344\270\255\351\241\271\350\203\214\346\231\257\350\211\262 */\n" 129 | " selection-color: #ffffff; /* \351\200\211\344\270\255\351\241\271\345\211\215\346\231\257\350" 130 | "\211\262 */\n" 131 | " outline: none;\n" 132 | "}\n" 133 | "\n" 134 | "QComboBox:hover {\n" 135 | " background-color: #f8b156;\n" 136 | "}\n" 137 | "\n" 138 | "QComboBox::drop-down {\n" 139 | " width: 0; /* \345\216\273\346\216\211\344\270\213\346\213\211\347\256\255\345\244\264 */\n" 140 | "}\n" 141 | "\n" 142 | "QCheckBox {\n" 143 | " color: #FFBC33;\n" 144 | " font-size: 16px;\n" 145 | " font-weight: bold;\n" 146 | " padding-left: 20px;\n" 147 | "}\n" 148 | "\n" 149 | "QCheckBox::indicator {\n" 150 | " width: 18px;\n" 151 | " height: 18px;\n" 152 | "}\n" 153 | "\n" 154 | "QCheckBox::indicator::unchecked {\n" 155 | " border: 2px solid #FFBC33;\n" 156 | " background-color: #FFFEF9;\n" 157 | "}\n" 158 | "\n" 159 | "QCheckBox::indicator::unchecked:hover {\n" 160 | " border: 2px solid #f8b156;\n" 161 | "}\n" 162 | "\n" 163 | "QCheckBox::indicator::checked {\n" 164 | " border: 2px solid #FFBC33;\n" 165 | " background-color: #FFBC33;\n" 166 | "}\n" 167 | "\n" 168 | "QCheckBox::indicator::checked:hover {\n" 169 | " background-color: #f8b156;\n" 170 | "}\n" 171 | "")); 172 | label = new QLabel(update_ui); 173 | label->setObjectName("label"); 174 | label->setGeometry(QRect(20, 110, 71, 16)); 175 | QFont font; 176 | font.setBold(true); 177 | label->setFont(font); 178 | label_ver = new QLabel(update_ui); 179 | label_ver->setObjectName("label_ver"); 180 | label_ver->setGeometry(QRect(220, 130, 72, 21)); 181 | label_con = new QLabel(update_ui); 182 | label_con->setObjectName("label_con"); 183 | label_con->setGeometry(QRect(20, 190, 461, 111)); 184 | label_con->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); 185 | label_2 = new QLabel(update_ui); 186 | label_2->setObjectName("label_2"); 187 | label_2->setGeometry(QRect(20, 310, 72, 15)); 188 | QFont font1; 189 | font1.setBold(true); 190 | font1.setItalic(false); 191 | label_2->setFont(font1); 192 | label_file = new QLabel(update_ui); 193 | label_file->setObjectName("label_file"); 194 | label_file->setGeometry(QRect(20, 330, 461, 21)); 195 | label_file->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); 196 | label_3 = new QLabel(update_ui); 197 | label_3->setObjectName("label_3"); 198 | label_3->setGeometry(QRect(20, 170, 72, 15)); 199 | label_3->setFont(font); 200 | label_text = new QLabel(update_ui); 201 | label_text->setObjectName("label_text"); 202 | label_text->setGeometry(QRect(40, 10, 401, 51)); 203 | QFont font2; 204 | font2.setPointSize(15); 205 | label_text->setFont(font2); 206 | label_text->setAlignment(Qt::AlignCenter); 207 | label_4 = new QLabel(update_ui); 208 | label_4->setObjectName("label_4"); 209 | label_4->setGeometry(QRect(220, 110, 71, 16)); 210 | label_4->setFont(font); 211 | label_ver_old = new QLabel(update_ui); 212 | label_ver_old->setObjectName("label_ver_old"); 213 | label_ver_old->setGeometry(QRect(20, 130, 72, 21)); 214 | 215 | retranslateUi(update_ui); 216 | 217 | QMetaObject::connectSlotsByName(update_ui); 218 | } // setupUi 219 | 220 | void retranslateUi(QDialog *update_ui) 221 | { 222 | update_ui->setWindowTitle(QCoreApplication::translate("update_ui", "Dialog", nullptr)); 223 | label->setText(QCoreApplication::translate("update_ui", "\345\275\223\345\211\215\347\211\210\346\234\254\357\274\232", nullptr)); 224 | label_ver->setText(QCoreApplication::translate("update_ui", "loading", nullptr)); 225 | label_con->setText(QCoreApplication::translate("update_ui", "loading", nullptr)); 226 | label_2->setText(QCoreApplication::translate("update_ui", "\346\226\207\344\273\266\345\210\227\350\241\250\357\274\232", nullptr)); 227 | label_file->setText(QCoreApplication::translate("update_ui", "loading", nullptr)); 228 | label_3->setText(QCoreApplication::translate("update_ui", "\346\233\264\346\226\260\345\206\205\345\256\271", nullptr)); 229 | label_text->setText(QCoreApplication::translate("update_ui", "\345\275\223\345\211\215\345\267\262\346\230\257\346\234\200\346\226\260\347\211\210", nullptr)); 230 | label_4->setText(QCoreApplication::translate("update_ui", "\346\234\200\346\226\260\347\211\210\346\234\254\357\274\232", nullptr)); 231 | label_ver_old->setText(QCoreApplication::translate("update_ui", "loading", nullptr)); 232 | } // retranslateUi 233 | 234 | }; 235 | 236 | namespace Ui { 237 | class update_ui: public Ui_update_ui {}; 238 | } // namespace Ui 239 | 240 | QT_END_NAMESPACE 241 | 242 | #endif // UI_UPDATE_UI_H 243 | -------------------------------------------------------------------------------- /update_ui.cpp: -------------------------------------------------------------------------------- 1 | #include "update_ui.h" 2 | #include "ui_update_ui.h" 3 | #include // { } 4 | #include // [ ] 5 | #include // 解析Json 6 | #include // int float double bool null { } [ ] 7 | #include //Json错误 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | /* 14 | * 检查更新窗口 15 | */ 16 | 17 | update_ui::update_ui(QWidget *parent) : 18 | QDialog(parent), 19 | ui(new Ui::update_ui) 20 | { 21 | extern QString editor_version; 22 | ui->setupUi(this); 23 | ui->label_ver_old->setText(editor_version); 24 | /*请求网络*/ 25 | QNetworkAccessManager* networkManager = new QNetworkAccessManager(this); //创建QNetworkAccessManager对象 26 | QUrl url("https://api.github.com/repos/Zao-chen/ZcCommandEditor/releases/latest"); //设置URL 27 | QNetworkReply* reply = networkManager->get(QNetworkRequest(url)); //发送HTTP GET请求 28 | while (!reply->isFinished()) //等待网络响应 29 | { 30 | qApp->processEvents(); 31 | } 32 | QByteArray response = reply->readAll(); //获取服务器返回的数据 33 | QTextStream stream(response); //读取文件的全部内容 34 | QString str = stream.readAll(); //QJsonParseError类用于在JSON解析期间报告错误。 35 | QJsonParseError jsonError; //将json解析为UTF-8编码的json文档,并从中创建一个QJsonDocument。如果解析成功,返回QJsonDocument对象,否则返回null 36 | QJsonDocument doc = QJsonDocument::fromJson(str.toUtf8(), &jsonError); //判断是否解析失败 37 | if (jsonError.error != QJsonParseError::NoError && !doc.isNull()) { 38 | qDebug() << "Json格式错误!" << jsonError.error; 39 | return; 40 | } 41 | QJsonObject rootObj = doc.object(); 42 | QJsonValue conValue = rootObj.value("body"); 43 | ui->label_con->setText(conValue.toString()); 44 | QJsonValue verValue = rootObj.value("tag_name"); 45 | ui->label_ver->setText(verValue.toString()); 46 | if(editor_version.contains("alpha")) ui->label_text->setText("正在使用预发布版,请积极反馈issue"); 47 | else if(editor_version.replace("-beta","")==verValue.toString()) ui->label_text->setText("当前已是最新版"); 48 | else ui->label_text->setText("有新版可以更新"); 49 | QJsonValue likeValue = rootObj.value("assets"); //根键获取值 50 | // 判断类型是否是数组类型 51 | if (likeValue.type() == QJsonValue::Array) { 52 | // 转换成数组类型 53 | QJsonArray likeArray = likeValue.toArray(); 54 | // 遍历数组 55 | for (int i = 0; i < likeArray.count(); i++) { 56 | // 获取数组的第一个元素,类型是QJsonValue 57 | QJsonValue likeValueChild = likeArray.at(i); 58 | // 判断是不是对象类型 59 | if (likeValueChild.type() == QJsonValue::Object) { 60 | // 转换成对象类型 61 | QJsonObject likeObj = likeValueChild.toObject(); 62 | // 最后通过value函数就可以获取到值了,解析成功! 63 | QJsonValue gameLikeValue = likeObj.value("name"); 64 | QJsonValue priceLikeValue1 = likeObj.value("size"); 65 | ui->label_file->setText(gameLikeValue.toString()+" 大小:"+QString::number(priceLikeValue1.toDouble())); 66 | } 67 | } 68 | } 69 | } 70 | 71 | update_ui::~update_ui() 72 | { 73 | delete ui; 74 | } 75 | -------------------------------------------------------------------------------- /update_ui.h: -------------------------------------------------------------------------------- 1 | #ifndef UPDATE_UI_H 2 | #define UPDATE_UI_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class update_ui; 8 | } 9 | 10 | class update_ui : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit update_ui(QWidget *parent = nullptr); 16 | ~update_ui(); 17 | 18 | private: 19 | Ui::update_ui *ui; 20 | }; 21 | 22 | #endif // UPDATE_UI_H 23 | -------------------------------------------------------------------------------- /update_ui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | update_ui 4 | 5 | 6 | 7 | 0 8 | 0 9 | 496 10 | 373 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | * { 18 | background-color: #FFFEF9; 19 | } 20 | 21 | QMenuBar { 22 | background-color: #FFFCF3; 23 | } 24 | 25 | QMenu { 26 | background-color: #FFFCF3; 27 | } 28 | 29 | QMenu::item { 30 | padding: 5px 20px; 31 | background-color: transparent; 32 | } 33 | 34 | QMenu::item:selected { 35 | background-color: #f8b156; 36 | } 37 | 38 | QMenu::separator { 39 | height: 1px; 40 | background-color: #f7931e; 41 | margin: 5px 0px 5px 0px; 42 | } 43 | 44 | QMenuBar::item { 45 | padding: 5px 20px; 46 | background-color: transparent; 47 | } 48 | 49 | QMenuBar::item:selected { 50 | background-color: #f8b156; 51 | } 52 | 53 | QMenuBar::item:pressed { 54 | background-color: #DAA520; 55 | } 56 | 57 | 58 | QLineEdit { 59 | border: 2px solid #f7931e; 60 | border-radius: 3px; 61 | background-color: #FFFCF3; 62 | padding: 2px; 63 | font-size: 16px; 64 | } 65 | 66 | 67 | QTextEdit { 68 | border: 2px solid #f7931e; 69 | border-radius: 3px;; 70 | padding: 5px; 71 | font-size: 10px; 72 | background-color: #FFFCF3; 73 | } 74 | 75 | QTableView { 76 | background-color: #FFFCF3; 77 | } 78 | 79 | QPushButton { 80 | background-color: #FFBC33; 81 | color: #ffffff; 82 | border: none; 83 | border-radius: 2px; 84 | padding: 2px 2px; 85 | font-size: 16px; 86 | font-weight: bold; 87 | } 88 | 89 | QPushButton:hover { 90 | background-color: #f8b156; 91 | } 92 | 93 | QPushButton:pressed { 94 | background-color: #DAA520; 95 | } 96 | 97 | 98 | QComboBox { 99 | border: none; 100 | border-radius: 20px; 101 | background-color: #FFBC33; 102 | color: #ffffff; 103 | font-size: 16px; 104 | font-weight: bold; 105 | padding: 8px 20px; 106 | padding-right: 4px; /* 右侧留出一定空间 */ 107 | selection-background-color: #f8b156; /* 选中项背景色 */ 108 | selection-color: #ffffff; /* 选中项前景色 */ 109 | outline: none; 110 | } 111 | 112 | QComboBox:hover { 113 | background-color: #f8b156; 114 | } 115 | 116 | QComboBox::drop-down { 117 | width: 0; /* 去掉下拉箭头 */ 118 | } 119 | 120 | QCheckBox { 121 | color: #FFBC33; 122 | font-size: 16px; 123 | font-weight: bold; 124 | padding-left: 20px; 125 | } 126 | 127 | QCheckBox::indicator { 128 | width: 18px; 129 | height: 18px; 130 | } 131 | 132 | QCheckBox::indicator::unchecked { 133 | border: 2px solid #FFBC33; 134 | background-color: #FFFEF9; 135 | } 136 | 137 | QCheckBox::indicator::unchecked:hover { 138 | border: 2px solid #f8b156; 139 | } 140 | 141 | QCheckBox::indicator::checked { 142 | border: 2px solid #FFBC33; 143 | background-color: #FFBC33; 144 | } 145 | 146 | QCheckBox::indicator::checked:hover { 147 | background-color: #f8b156; 148 | } 149 | 150 | 151 | 152 | 153 | 154 | 20 155 | 110 156 | 71 157 | 16 158 | 159 | 160 | 161 | 162 | true 163 | 164 | 165 | 166 | 当前版本: 167 | 168 | 169 | 170 | 171 | 172 | 220 173 | 130 174 | 72 175 | 21 176 | 177 | 178 | 179 | loading 180 | 181 | 182 | 183 | 184 | 185 | 20 186 | 190 187 | 461 188 | 111 189 | 190 | 191 | 192 | loading 193 | 194 | 195 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop 196 | 197 | 198 | 199 | 200 | 201 | 20 202 | 310 203 | 72 204 | 15 205 | 206 | 207 | 208 | 209 | false 210 | true 211 | 212 | 213 | 214 | 文件列表: 215 | 216 | 217 | 218 | 219 | 220 | 20 221 | 330 222 | 461 223 | 21 224 | 225 | 226 | 227 | loading 228 | 229 | 230 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop 231 | 232 | 233 | 234 | 235 | 236 | 20 237 | 170 238 | 72 239 | 15 240 | 241 | 242 | 243 | 244 | true 245 | 246 | 247 | 248 | 更新内容 249 | 250 | 251 | 252 | 253 | 254 | 40 255 | 10 256 | 401 257 | 51 258 | 259 | 260 | 261 | 262 | 15 263 | 264 | 265 | 266 | 当前已是最新版 267 | 268 | 269 | Qt::AlignCenter 270 | 271 | 272 | 273 | 274 | 275 | 220 276 | 110 277 | 71 278 | 16 279 | 280 | 281 | 282 | 283 | true 284 | 285 | 286 | 287 | 最新版本: 288 | 289 | 290 | 291 | 292 | 293 | 20 294 | 130 295 | 72 296 | 21 297 | 298 | 299 | 300 | loading 301 | 302 | 303 | 304 | 305 | 306 | 307 | --------------------------------------------------------------------------------