├── .gitignore ├── LICENSE ├── README.md ├── doc └── picture │ ├── File_Manager_Copy.gif │ ├── File_Manager_New.gif │ ├── File_Manager_View.gif │ ├── File_Manager_del.gif │ ├── Setting.gif │ ├── Task_Manager.gif │ └── sdk.png ├── flow chart ├── 流程图-主框架.vsdx ├── 流程图-任务管理器.vsdx └── 流程图-文件管理器.vsdx ├── inc ├── ctl │ ├── mainwindow.h │ ├── seimey_qwchse.h │ ├── seimey_setting.h │ └── seimey_text.h ├── seimey_data.h ├── seimey_dfs.h ├── seimey_finsh.h ├── seimey_plugin.h └── seimey_serial.h ├── logo.ico ├── plugin └── pack │ └── gdut_fsae_interface.h ├── qrc └── icon │ ├── about.png │ ├── application.png │ ├── communicate.png │ ├── device.png │ ├── device_0.png │ ├── device_1.png │ ├── device_2.png │ ├── dfs_clone.png │ ├── dfs_copy.png │ ├── dfs_echo.png │ ├── dfs_mkdir.png │ ├── dfs_open.png │ ├── dfs_paste.png │ ├── dfs_rm.png │ ├── event.png │ ├── file manager.png │ ├── file.png │ ├── folder.png │ ├── github.png │ ├── logo.ico │ ├── mail.png │ ├── memheap.png │ ├── memory.png │ ├── mempool.png │ ├── mutex.png │ ├── plugin.png │ ├── plugin_0.png │ ├── plugin_1.png │ ├── plugin_2.png │ ├── preference.png │ ├── property.png │ ├── queue.png │ ├── refresh.png │ ├── semaphore.png │ ├── serial setting.png │ ├── serial.png │ ├── setting.png │ ├── signal.png │ ├── synchronize.png │ ├── task manager.png │ ├── thread.png │ ├── thread_obj_0.png │ ├── thread_obj_1.png │ ├── thread_obj_2.png │ ├── timer.png │ ├── timer_0.png │ ├── timer_1.png │ └── timer_2.png ├── release_notes.md ├── sdk ├── navlabel.h └── progresswater.h ├── seimey.pro ├── seimey.qrc ├── seimey.rc ├── seimey_zh_CN.ts ├── src ├── ctl │ ├── mainwindow.cpp │ ├── seimey_qwchse.cpp │ ├── seimey_setting.cpp │ └── seimey_text.cpp ├── main.cpp ├── seimey_data.cpp ├── seimey_dfs.cpp ├── seimey_finsh.cpp ├── seimey_plugin.cpp └── seimey_serial.cpp └── ui ├── mainwindow.ui ├── seimey_qwchse.ui ├── seimey_setting.ui └── seimey_text.ui /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | sdk/quc.dll 3 | sdk/qucd.dll 4 | *.user 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | 474 | Copyright (C) 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 489 | USA 490 | 491 | Also add information on how to contact you by electronic and paper mail. 492 | 493 | You should also get your employer (if you work as a programmer) or your 494 | school, if any, to sign a "copyright disclaimer" for the library, if 495 | necessary. Here is a sample; alter the names: 496 | 497 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 498 | library `Frob' (a library for tweaking knobs) written by James Random 499 | Hacker. 500 | 501 | , 1 April 1990 502 | Ty Coon, President of Vice 503 | 504 | That's all there is to it! 505 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # seimey 2 | 3 | 此项目已作废,已搬迁到新项目[Misaka-Station](https://github.com/xqyjlj/Misaka-Station) 4 | 5 | ## 功能简介 6 | 7 | ​ 一款串口终端,基于RT-Thread的FinSH控制台。 8 | 9 | ​ 具有任务管理器,文件管理器,插件功能的终端。 10 | 11 | ## 设计初衷 12 | 13 | ​ 在使用`Windows`的任务管理器时,有感而发,以及想对一些不适应shell的使用者提供一些便利。 14 | 15 | ## 更新说明 16 | 17 | ​ 见文件[release_notes.md](https://github.com/xqyjlj/seimey/blob/master/release_notes.md) 18 | 19 | ## 编译说明 20 | 21 | 因为本程序用到了其他的SDK(作者:**飞扬青云**)。且文件较大(大于100M),因此本项目不提供此SDK,如果需要下载编译的,请移步到: 22 | 23 | [github](https://github.com/feiyangqingyun/qucsdk/tree/master/sdk_V20191009) 24 | 25 | [gitee](https://gitee.com/feiyangqingyun/QUCSDK/tree/master/sdk_V20191009) 26 | 27 | 选择对应版本之后,下载解压到sdk目录下,即可正常编译。 28 | 29 | ![sdk](./doc/picture/sdk.png) 30 | 31 | ## 设置 32 | 33 | > 通过设置来配置功能。 34 | 35 | ![Setting](./doc/picture/Setting.gif) 36 | 37 | - 串口设置:用来选择串口的基本信息,具有记忆功能,可记下用户上次使用的设置。 38 | 39 | - 设置:一些功能配置: 40 | 41 | - ​ 是否保存串口数据:选择之后,程序会将收到的数据按照(“`\n`”还有“`\r\n`”进行分行,并且加上时间戳),存进文件夹(`\.workspace\.serial\serial.txt`)中。以下是列举的串口数据: 42 | 43 | ```c 44 | [ 2020-09-01 17:43:49:219 ] msh >list_timer 45 | [ 2020-09-01 17:43:49:223 ] timer periodic timeout flag 46 | [ 2020-09-01 17:43:49:228 ] -------- ---------- ---------- ----------- 47 | [ 2020-09-01 17:43:49:232 ] tshell 0x00000000 0x00000000 deactivated 48 | [ 2020-09-01 17:43:49:234 ] tidle0 0x00000000 0x00000000 deactivated 49 | [ 2020-09-01 17:43:49:240 ] timer 0x00000000 0x00000000 deactivated 50 | [ 2020-09-01 17:43:49:244 ] main 0x000003e8 0x055d17bd activated 51 | [ 2020-09-01 17:43:49:246 ] current tick:0x055d1785 52 | [ 2020-09-01 17:43:49:247 ] msh > 53 | ``` 54 | 55 | - 定时刷新时间:由于任务管理器是依赖定时刷新来不断更新信息的,所以我们需要设置定时刷新的时间,但是为了不干扰单片机的本身程序,此值最小为0.5,单位为秒。 56 | 57 | ## 任务管理器功能 58 | 59 | ![Task_Manager](./doc/picture/Task_Manager.gif) 60 | 61 | ## 文件管理器功能 62 | 63 | ### 浏览 64 | 65 | ![File_Manager_View](./doc/picture/File_Manager_View.gif) 66 | 67 | ### 新建 68 | 69 | ![File_Manager_New](./doc/picture/File_Manager_New.gif) 70 | 71 | ### 删除 72 | 73 | ![File_Manager_del](./doc/picture/File_Manager_del.gif) 74 | 75 | ### 复制粘贴 76 | 77 | ![File_Manager_Copy](./doc/picture/File_Manager_Copy.gif) 78 | 79 | ## 插件功能 80 | 81 | > 放入dll文件,即可在插件表里面找到该插件,[插件库地址](https://github.com/xqyjlj/seimey_plugin) 82 | 83 | 目前插件功能还在试验阶段,暂不开放。 84 | 85 | -------------------------------------------------------------------------------- /doc/picture/File_Manager_Copy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/doc/picture/File_Manager_Copy.gif -------------------------------------------------------------------------------- /doc/picture/File_Manager_New.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/doc/picture/File_Manager_New.gif -------------------------------------------------------------------------------- /doc/picture/File_Manager_View.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/doc/picture/File_Manager_View.gif -------------------------------------------------------------------------------- /doc/picture/File_Manager_del.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/doc/picture/File_Manager_del.gif -------------------------------------------------------------------------------- /doc/picture/Setting.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/doc/picture/Setting.gif -------------------------------------------------------------------------------- /doc/picture/Task_Manager.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/doc/picture/Task_Manager.gif -------------------------------------------------------------------------------- /doc/picture/sdk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/doc/picture/sdk.png -------------------------------------------------------------------------------- /flow chart/流程图-主框架.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/flow chart/流程图-主框架.vsdx -------------------------------------------------------------------------------- /flow chart/流程图-任务管理器.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/flow chart/流程图-任务管理器.vsdx -------------------------------------------------------------------------------- /flow chart/流程图-文件管理器.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/flow chart/流程图-文件管理器.vsdx -------------------------------------------------------------------------------- /inc/ctl/mainwindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 主窗口 3 | * 4 | * 修改日志: 5 | * 6 | * 日期 作者 Notes 7 | * 2020-08-12 xqyjlj 0.0.0 :创建项目 8 | * 2020-08-13 xqyjlj 0.0.2 :创建菜单及其基本控件 9 | * ... ... (中间日志丢失) 10 | * 2020-08-25 xqyjlj 0.0.8 :创建插件管理器 11 | */ 12 | #ifndef MAINWINDOW_H 13 | #define MAINWINDOW_H 14 | 15 | #include 16 | #include "seimey_serial.h" 17 | #include "seimey_qwchse.h" 18 | #include "seimey_setting.h" 19 | #include "seimey_plugin.h" 20 | #include "seimey_data.h" 21 | #include "seimey_finsh.h" 22 | #include "seimey_dfs.h" 23 | #include 24 | #include 25 | QT_BEGIN_NAMESPACE 26 | namespace Ui 27 | { 28 | class MainWindow; 29 | } 30 | QT_END_NAMESPACE 31 | 32 | class MainWindow : public QMainWindow 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | MainWindow(QWidget *parent = nullptr); 38 | ~MainWindow(); 39 | 40 | signals: 41 | void sort_item(int index); 42 | 43 | private slots: 44 | void on_menu_setting_serial_setting_triggered(void);/* 菜单·串口设置按键点击槽函数 */ 45 | void on_menu_setting_serial_link_triggered(void);/* 菜单·串口连接按键点击槽函数 */ 46 | void on_menu_help_about_triggered(void);/* 菜单·帮助·关于按键点击槽函数 */ 47 | void on_menu_help_github_triggered(void);/* 菜单·帮助·github地址按键点击槽函数 */ 48 | void on_menu_setting_preference_triggered(void);/* 菜单·首选项设置按键点击槽函数 */ 49 | void on_menu_setting_serial_setting_2_triggered(void);/* 菜单·串口设置按键点击槽函数 */ 50 | void serial_data_coming(QByteArray msg);/* 串口数据来临槽函数 */ 51 | void on_comdLB_mem_pool_clicked(void);/* 内存池按钮点击槽函数 */ 52 | void on_comdLB_mem_heap_clicked(void);/* 内存堆按钮点击槽函数 */ 53 | void on_comdLB_mem_free_clicked(void);/* 动态按钮点击槽函数 */ 54 | void on_comdLB_synchronize_semaphore_clicked();/* 信号量按钮点击槽函数 */ 55 | void on_comdLB_synchronize_mutex_clicked();/* 二值信号量按钮点击槽函数 */ 56 | void on_comdLB_synchronize_event_clicked();/* 事件按钮点击槽函数 */ 57 | void on_comdLB_communicate_mail_clicked();/* 邮箱按钮点击槽函数 */ 58 | void on_comdLB_communicate_queue_clicked();/* 队列按钮点击槽函数 */ 59 | void on_menu_setting_preference_2_triggered();/* 菜单·首选项设置按键点击槽函数 */ 60 | void finsh_timer_timeout();/* finsh定时刷新触发的槽函数 */ 61 | void on_tabW_main_currentChanged(int index); 62 | void on_tabW_main_tabBarDoubleClicked(int index); 63 | void on_treeW_file_mannage_itemDoubleClicked(QTreeWidgetItem *item); 64 | void showTreeRightMenu(QPoint pos); 65 | void on_dfs_menu_open_triggered(); 66 | void on_dfs_menu_clone_triggered(); 67 | void on_dfs_menu_mkdir_triggered(); 68 | void on_dfs_menu_echo_triggered(); 69 | void on_dfs_menu_rm_triggered(); 70 | void on_dfs_menu_copy_triggered(); 71 | void on_dfs_menu_paste_triggered(); 72 | void on_dfs_menu_clone_2_triggered(); 73 | void on_dfs_menu_mkdir_2_triggered(); 74 | void on_dfs_menu_echo_2_triggered(); 75 | void on_dfs_menu_paste_2_triggered(); 76 | void on_treeW_plugin_itemDoubleClicked(QTreeWidgetItem *item, int column); 77 | void send_msg(QByteArray msg); 78 | void sortHeader(int index); 79 | 80 | private: 81 | void init_ctl(void);/* 初始化界面的控件 */ 82 | void init_connect(void);/* 用来初始化一些connect函数 */ 83 | void task_manager(int index);/* 任务管理器顶端标签改变槽函数 */ 84 | 85 | private: 86 | Ui::MainWindow *ui; 87 | seimey_serial *c_Seimey_Serial = new seimey_serial(this); 88 | seimey_qwchse *c_Seimey_Qwchse = nullptr; 89 | seimey_setting *c_Seimey_Setting = nullptr; 90 | seimey_plugin *c_Seimey_Plugin = new seimey_plugin(this); 91 | QTimer *finsh_timerID = new QTimer(this); 92 | seimey_data *c_Seimey_Data = new seimey_data(this); 93 | seimey_finsh *c_Seimey_Finsh = new seimey_finsh(this); 94 | seimey_dfs *c_Seimey_Dfs = new seimey_dfs(this); 95 | QMenu *dfs_menu = new QMenu(this); 96 | QTreeWidgetItem *treew_dfs_MenuRequested = nullptr; 97 | QString dfs_clipboard; 98 | struct 99 | { 100 | QLabel *port_status; 101 | QLabel *baud_status; 102 | QLabel *status; 103 | } serial_status; 104 | 105 | struct 106 | { 107 | bool is_save_serial; 108 | double timed_refresh; 109 | } setting; 110 | }; 111 | 112 | 113 | 114 | #endif // MAINWINDOW_H 115 | -------------------------------------------------------------------------------- /inc/ctl/seimey_qwchse.h: -------------------------------------------------------------------------------- 1 | #ifndef SEIMEY_QWCHSE_H 2 | #define SEIMEY_QWCHSE_H 3 | 4 | #include 5 | #include 6 | #include 7 | namespace Ui 8 | { 9 | class seimey_qwchse; 10 | } 11 | 12 | class seimey_qwchse : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit seimey_qwchse(QWidget *parent = nullptr); 18 | ~seimey_qwchse(); 19 | 20 | private slots: 21 | void set_serial_comboBox(void); 22 | 23 | private: 24 | Ui::seimey_qwchse *ui; 25 | 26 | void set_excserial_comboBox(void); 27 | 28 | protected: 29 | virtual void closeEvent(QCloseEvent *event); 30 | 31 | signals: 32 | void window_close(void); 33 | 34 | }; 35 | 36 | 37 | 38 | class seimey_qwchse_Label : public QLabel 39 | { 40 | Q_OBJECT 41 | public: 42 | explicit seimey_qwchse_Label(QWidget *parent = nullptr); 43 | ~seimey_qwchse_Label(); 44 | 45 | protected: 46 | virtual void mousePressEvent(QMouseEvent *event); 47 | 48 | signals: 49 | void clicked(void); 50 | }; 51 | 52 | 53 | 54 | #endif // SEIMEY_QWCHSE_H 55 | -------------------------------------------------------------------------------- /inc/ctl/seimey_setting.h: -------------------------------------------------------------------------------- 1 | #ifndef SEIMEY_SETTING_H 2 | #define SEIMEY_SETTING_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui 8 | { 9 | class seimey_setting; 10 | } 11 | 12 | class seimey_setting : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit seimey_setting(QWidget *parent = nullptr); 18 | ~seimey_setting(); 19 | 20 | protected: 21 | virtual void closeEvent(QCloseEvent *event); 22 | 23 | private: 24 | Ui::seimey_setting *ui; 25 | 26 | void set_setting(void); 27 | 28 | signals: 29 | void window_close(void); 30 | }; 31 | 32 | #endif // SEIMEY_SETTING_H 33 | -------------------------------------------------------------------------------- /inc/ctl/seimey_text.h: -------------------------------------------------------------------------------- 1 | #ifndef SEIMEY_TEXT_H 2 | #define SEIMEY_TEXT_H 3 | 4 | #include 5 | #include 6 | namespace Ui 7 | { 8 | class seimey_text; 9 | } 10 | 11 | class seimey_text : public QMainWindow 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit seimey_text(QWidget *parent = nullptr); 17 | ~seimey_text(); 18 | 19 | void show_text(QString msg); 20 | signals: 21 | void window_Close(void); 22 | 23 | protected: 24 | virtual void closeEvent(QCloseEvent *event); 25 | private: 26 | Ui::seimey_text *ui; 27 | }; 28 | 29 | #endif // SEIMEY_TEXT_H 30 | -------------------------------------------------------------------------------- /inc/seimey_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 数据处理 3 | * 4 | * 修改日志: 5 | * 6 | * 日期 作者 Notes 7 | * 2020-08-17 xqyjlj 0.0.0 :创建项目 8 | * ... ... (中间日志丢失) 9 | * 2020-08-25 xqyjlj 0.0.8 :创建插件管理器 10 | */ 11 | #ifndef SEIMEY_DATA_H 12 | #define SEIMEY_DATA_H 13 | #include 14 | #include 15 | 16 | class seimey_data : public QObject 17 | { 18 | Q_OBJECT 19 | public: 20 | explicit seimey_data(QObject *parent = nullptr); 21 | public: 22 | void create_Dir(void);/* 创建目录 */ 23 | bool get_Is_Save_Serial_Data(void);/* 获得是否保存串口数据的标志位 */ 24 | double get_Timed_Refresh_Time(void);/* 获得定时器刷新时间 */ 25 | void save_Serial_Data(QByteArray msg);/* 保存串口数据 */ 26 | signals: 27 | 28 | public slots: 29 | 30 | private: 31 | void ceate_Serial(void); 32 | void ceate_Log(void); 33 | void ceate_Setting(void); 34 | void create_Workspace(void); 35 | private: 36 | 37 | }; 38 | 39 | 40 | 41 | #endif // SEIMEY_DATA_H 42 | -------------------------------------------------------------------------------- /inc/seimey_dfs.h: -------------------------------------------------------------------------------- 1 | #ifndef SEIMEY_DFS_H 2 | #define SEIMEY_DFS_H 3 | 4 | #include "seimey_serial.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "seimey_text.h" 12 | class seimey_dfs : public QObject 13 | { 14 | Q_OBJECT 15 | public: 16 | explicit seimey_dfs(QObject *parent = nullptr); 17 | ~seimey_dfs(); 18 | public: 19 | void master(seimey_serial *Serial, QTreeWidget *obj); 20 | void servant(seimey_serial *Serial, QTreeWidgetItem *obj); 21 | void mkdir(seimey_serial *Serial, QString msg, QTreeWidgetItem *obj); 22 | void echo(seimey_serial *Serial, QString name, QString msg, QTreeWidgetItem *obj); 23 | void mastermkdir(seimey_serial *Serial, QString msg, QTreeWidget *obj); 24 | void masterecho(seimey_serial *Serial, QString name, QString msg, QTreeWidget *obj); 25 | void rm(seimey_serial *Serial, QTreeWidgetItem *obj1, QTreeWidget *obj2); 26 | void cp(seimey_serial *Serial, QString src, QString pur, QTreeWidgetItem *obj1, QTreeWidget *obj2); 27 | void mastercp(seimey_serial *Serial, QString src, QTreeWidget *obj); 28 | void handle(QString msg);/* */ 29 | signals: 30 | 31 | public slots: 32 | 33 | 34 | private: 35 | void ctl_ls(QStringList *list); 36 | void ctl_master(QStringList *list); 37 | void ctl_servant(QStringList *list); 38 | void ctl_cat(QStringList *list); 39 | void sleep(int msec); 40 | void bypass(QStringList *list); 41 | private: 42 | uint8_t event; 43 | QStringList msg_list; 44 | QTimer *timer = new QTimer(this); 45 | QTreeWidget *tree_dfs; 46 | QTreeWidgetItem *tree_dfs_item; 47 | seimey_text *c_Seimey_text = NULL; 48 | public: 49 | enum itemType {enumdir = QTreeWidgetItem::UserType, enumfile}; 50 | private slots: 51 | void timer_Timeout(void); 52 | }; 53 | 54 | #endif // SEIMEY_DFS_H 55 | -------------------------------------------------------------------------------- /inc/seimey_finsh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * finsh基础命令 3 | * 4 | * 修改日志: 5 | * 6 | * 日期 作者 Notes 7 | * 2020-08-26 xqyjlj 0.0.0 :创建项目 8 | */ 9 | #ifndef SEIMEY_FINSH_H 10 | #define SEIMEY_FINSH_H 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "progresswater.h" 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "seimey_serial.h" 24 | class seimey_finsh : public QObject 25 | { 26 | Q_OBJECT 27 | public: 28 | explicit seimey_finsh(QObject *parent = nullptr); 29 | public: 30 | void handle(QString msg);/* 任务管理器的控制函数 */ 31 | void thread(seimey_serial *Serial, QTableWidget *obj); /* finsh Thread */ 32 | void device(seimey_serial *Serial, QTreeWidget *obj); /* finsh Device */ 33 | void time(seimey_serial *Serial, QTreeWidget *obj, QLineEdit *line); 34 | void mem_pool(seimey_serial *Serial, QTreeWidget *obj); 35 | void mem_heap(seimey_serial *Serial, QTreeWidget *obj); 36 | void mem_free(seimey_serial *Serial, ProgressWater *obj, QLabel *total, QLabel *max, QLabel *current); 37 | void synchr_sem(seimey_serial *Serial, QTreeWidget *obj); 38 | void synchr_mutex(seimey_serial *Serial, QTreeWidget *obj); 39 | void synchr_event(seimey_serial *Serial, QTreeWidget *obj); 40 | void commun_mail(seimey_serial *Serial, QTreeWidget *obj); 41 | void commun_queue(seimey_serial *Serial, QTreeWidget *obj); 42 | 43 | signals: 44 | 45 | public slots: 46 | void widget_sort(int index); 47 | 48 | private: 49 | void sleep(int msec); 50 | void bypass(QStringList *list); 51 | void ctl_thread(QStringList *list); 52 | void ctl_device(QStringList *list); 53 | void ctl_timer(QStringList *list); 54 | void ctl_mem_pool(QStringList *list); 55 | void ctl_mem_heap(QStringList *list); 56 | void ctl_mem_free(QStringList *list); 57 | void ctl_synchr_sem(QStringList *list); 58 | void ctl_synchr_mutex(QStringList *list); 59 | void ctl_synchr_event(QStringList *list); 60 | void ctl_commun_mail(QStringList *list); 61 | void ctl_commun_queue(QStringList *list); 62 | 63 | private: 64 | uint8_t event; 65 | QTimer *timer = new QTimer(this); 66 | QStringList msg_list; 67 | QTableWidget *tree_thread; 68 | QTreeWidget *tree_device; 69 | QTreeWidget *tree_timer; 70 | QTreeWidget *tree_mem_pool; 71 | QTreeWidget *tree_mem_heap; 72 | QTreeWidget *tree_synchr_sem; 73 | QTreeWidget *tree_synchr_mutex; 74 | QTreeWidget *tree_synchr_event; 75 | QTreeWidget *tree_commun_mail; 76 | QTreeWidget *tree_commun_queue; 77 | QLineEdit *line_timer; 78 | ProgressWater *progresswater; 79 | QLabel *label_total; 80 | QLabel *label_max; 81 | QLabel *label_current; 82 | 83 | bool thread_sort = true; 84 | 85 | private slots: 86 | void timer_Timeout(void); 87 | }; 88 | 89 | #endif // SEIMEY_FINSH_H 90 | -------------------------------------------------------------------------------- /inc/seimey_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef SEIMEY_PLUGIN_H 2 | #define SEIMEY_PLUGIN_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "gdut_fsae_interface.h" 10 | class seimey_plugin : public QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit seimey_plugin(QObject *parent = nullptr); 15 | 16 | void rec_msg(QByteArray msg);/*插件通信口,用来传递主程序到插件的QString变量(通常为串口数据)*/ 17 | void set_plugin(QTreeWidget *obj); 18 | void open_plugin(QTreeWidgetItem *obj); 19 | signals: 20 | void send_msg(QByteArray msg); 21 | public slots: 22 | 23 | private slots: 24 | void close_event_collect(QString msg);/* 收集插件的关闭信息,用来将插件指针置为NULL */ 25 | void forward_msg(QByteArray msg); 26 | private: 27 | void loader_plugin(QObject *obj); 28 | void loader_gdut_fsae_plugin(QObject *obj); 29 | private: 30 | gdut_fsae_interface *_pgdut_fsae_interface = nullptr; 31 | 32 | QStringList plugin_list = 33 | { 34 | "", 35 | "gdut_fsae_plugin", 36 | }; 37 | 38 | enum enum_plugin 39 | { 40 | PLUGIN_NULL = 0, 41 | PLUGIN_GDUT_FSAE 42 | }; 43 | }; 44 | 45 | #endif // SEIMEY_PLUGIN_H 46 | -------------------------------------------------------------------------------- /inc/seimey_serial.h: -------------------------------------------------------------------------------- 1 | #ifndef SEIMEY_SERIAL_H 2 | #define SEIMEY_SERIAL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | class seimey_serial : public QObject 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit seimey_serial(QObject *parent = nullptr); 14 | 15 | bool set_serial_link(bool status); 16 | QString get_seial_port(void); 17 | QString get_seial_baud(void); 18 | void send_data(const char *data); 19 | void send_data(QByteArray byteArray); 20 | bool get_serial_status(); 21 | 22 | signals: 23 | void already_recv_data(QByteArray msg); 24 | 25 | private slots: 26 | void serial_read_data(void); 27 | void serial_error(QSerialPort::SerialPortError error); 28 | private: 29 | QByteArray msg; 30 | }; 31 | 32 | #endif // SEIMEY_SERIAL_H 33 | -------------------------------------------------------------------------------- /logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/logo.ico -------------------------------------------------------------------------------- /plugin/pack/gdut_fsae_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef GDUT_FSAE_INTERFACE_H 2 | #define GDUT_FSAE_INTERFACE_H 3 | 4 | #include 5 | #include 6 | 7 | class gdut_fsae_interface 8 | { 9 | public: 10 | virtual ~gdut_fsae_interface() {} 11 | 12 | virtual void show() = 0; 13 | 14 | virtual void rec_msg(QByteArray msg) = 0;/* 接收到来自创建管理器的消息 */ 15 | 16 | virtual void send_msg(QByteArray msg) = 0;/* 发送到创建管理器的消息 */ 17 | 18 | virtual void plugin_close(QString msg) = 0; 19 | }; 20 | 21 | #define gdut_fsae_interface_iid "gdut_fsae_plugin.interface" 22 | 23 | Q_DECLARE_INTERFACE(gdut_fsae_interface, gdut_fsae_interface_iid) 24 | 25 | 26 | 27 | #endif // GDUT_FSAE_INTERFACE_H 28 | -------------------------------------------------------------------------------- /qrc/icon/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/about.png -------------------------------------------------------------------------------- /qrc/icon/application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/application.png -------------------------------------------------------------------------------- /qrc/icon/communicate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/communicate.png -------------------------------------------------------------------------------- /qrc/icon/device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/device.png -------------------------------------------------------------------------------- /qrc/icon/device_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/device_0.png -------------------------------------------------------------------------------- /qrc/icon/device_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/device_1.png -------------------------------------------------------------------------------- /qrc/icon/device_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/device_2.png -------------------------------------------------------------------------------- /qrc/icon/dfs_clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/dfs_clone.png -------------------------------------------------------------------------------- /qrc/icon/dfs_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/dfs_copy.png -------------------------------------------------------------------------------- /qrc/icon/dfs_echo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/dfs_echo.png -------------------------------------------------------------------------------- /qrc/icon/dfs_mkdir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/dfs_mkdir.png -------------------------------------------------------------------------------- /qrc/icon/dfs_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/dfs_open.png -------------------------------------------------------------------------------- /qrc/icon/dfs_paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/dfs_paste.png -------------------------------------------------------------------------------- /qrc/icon/dfs_rm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/dfs_rm.png -------------------------------------------------------------------------------- /qrc/icon/event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/event.png -------------------------------------------------------------------------------- /qrc/icon/file manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/file manager.png -------------------------------------------------------------------------------- /qrc/icon/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/file.png -------------------------------------------------------------------------------- /qrc/icon/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/folder.png -------------------------------------------------------------------------------- /qrc/icon/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/github.png -------------------------------------------------------------------------------- /qrc/icon/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/logo.ico -------------------------------------------------------------------------------- /qrc/icon/mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/mail.png -------------------------------------------------------------------------------- /qrc/icon/memheap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/memheap.png -------------------------------------------------------------------------------- /qrc/icon/memory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/memory.png -------------------------------------------------------------------------------- /qrc/icon/mempool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/mempool.png -------------------------------------------------------------------------------- /qrc/icon/mutex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/mutex.png -------------------------------------------------------------------------------- /qrc/icon/plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/plugin.png -------------------------------------------------------------------------------- /qrc/icon/plugin_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/plugin_0.png -------------------------------------------------------------------------------- /qrc/icon/plugin_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/plugin_1.png -------------------------------------------------------------------------------- /qrc/icon/plugin_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/plugin_2.png -------------------------------------------------------------------------------- /qrc/icon/preference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/preference.png -------------------------------------------------------------------------------- /qrc/icon/property.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/property.png -------------------------------------------------------------------------------- /qrc/icon/queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/queue.png -------------------------------------------------------------------------------- /qrc/icon/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/refresh.png -------------------------------------------------------------------------------- /qrc/icon/semaphore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/semaphore.png -------------------------------------------------------------------------------- /qrc/icon/serial setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/serial setting.png -------------------------------------------------------------------------------- /qrc/icon/serial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/serial.png -------------------------------------------------------------------------------- /qrc/icon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/setting.png -------------------------------------------------------------------------------- /qrc/icon/signal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/signal.png -------------------------------------------------------------------------------- /qrc/icon/synchronize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/synchronize.png -------------------------------------------------------------------------------- /qrc/icon/task manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/task manager.png -------------------------------------------------------------------------------- /qrc/icon/thread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/thread.png -------------------------------------------------------------------------------- /qrc/icon/thread_obj_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/thread_obj_0.png -------------------------------------------------------------------------------- /qrc/icon/thread_obj_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/thread_obj_1.png -------------------------------------------------------------------------------- /qrc/icon/thread_obj_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/thread_obj_2.png -------------------------------------------------------------------------------- /qrc/icon/timer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/timer.png -------------------------------------------------------------------------------- /qrc/icon/timer_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/timer_0.png -------------------------------------------------------------------------------- /qrc/icon/timer_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/timer_1.png -------------------------------------------------------------------------------- /qrc/icon/timer_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xqyjlj/seimey/5ec3b04ee686b4f91256fe4c7636be1ed1de5231/qrc/icon/timer_2.png -------------------------------------------------------------------------------- /release_notes.md: -------------------------------------------------------------------------------- 1 | # 更新说明 2 | 3 | ## V0.0.0 4 | 5 | > 初步制定了UI界面,后续将会按照这个界面开发 6 | 7 | 8 | ![image-20200814175426951](https://i.loli.net/2020/08/14/Nelwyr2OU5j89ic.png) 9 | 10 | ![image-20200814175508818](https://i.loli.net/2020/08/14/Pn4OwRFfBsd7i2K.png) 11 | 12 | ![image-20200814175542163](https://i.loli.net/2020/08/14/makcdlJCF6Ue5go.png) 13 | 14 | ![image-20200814175602421](https://i.loli.net/2020/08/14/rId8l6Xm7agOxfo.png) 15 | 16 | ![image-20200814175638388](https://i.loli.net/2020/08/14/6pRk4zqfuNMIAOx.png) 17 | 18 | ![image-20200814175704610](https://i.loli.net/2020/08/14/D4lY3hMyOU7Evgq.png) 19 | 20 | ## V0.0.1 21 | 22 | > 增加了JSON的设置, 完善了UI界面,开始写串口部分代码(已完成串口异常,串口列表,串口开关) 23 | 24 | ![image-20200815190446929](https://i.loli.net/2020/08/15/KYma36pkn5gLJo8.png) 25 | 26 | ![image-20200815190511665](https://i.loli.net/2020/08/15/8MYHnNyTmQKiRDB.png) 27 | 28 | ![image-20200815190543571](https://i.loli.net/2020/08/15/3I4XOtaTgU7JpBd.png) 29 | 30 | 以下是串口的设置`JSON`文件 31 | 32 | ```json 33 | { 34 | "BaudRate": "115200", 35 | "DataBits": "5", 36 | "FlowControl": "硬流控", 37 | "Parity": "偶校验", 38 | "SerialPort": "COM5", 39 | "StopBits": "2.0" 40 | } 41 | ``` 42 | 43 | ## V0.0.2 44 | 45 | > 新加了串口解析。实现了线程,设备,定时器的功能,修复了性能,同步,通信的按钮冲突 46 | 47 | ![image.png](https://i.loli.net/2020/08/16/8bgCSXMJys15rei.png) 48 | 49 | ![image-20200816173448261](https://i.loli.net/2020/08/16/DKu92eSN16fBtJO.png) 50 | 51 | ![image.png](https://i.loli.net/2020/08/16/WIGVerb3h4oHN8F.png) 52 | 53 | ## V0.0.3 54 | 55 | > 将性能,同步,通信也全部配置完毕,新增首选项设置 56 | 57 | ![image-20200817202317928](https://i.loli.net/2020/08/17/IFv6xsnbOkcS2T5.png) 58 | 59 | ![image-20200817202353876](https://i.loli.net/2020/08/17/EhjwumxXvblePOF.png) 60 | 61 | ![image-20200817202408920](https://i.loli.net/2020/08/17/dGTXwDgU38fYIRz.png) 62 | 63 | ![image-20200817202444443](https://i.loli.net/2020/08/17/dGTXwDgU38fYIRz.png) 64 | 65 | ![image-20200817202512188](https://i.loli.net/2020/08/17/vT2U3BhudOWP6Vs.png) 66 | 67 | ![image-20200817202521362](https://i.loli.net/2020/08/17/uVYFPTlHKU2Aczt.png) 68 | 69 | > 新增串口数据保存,且可选择是否配置 70 | 71 | ![image-20200817202814111](https://i.loli.net/2020/08/17/LGTN4suSFoYUvIB.png) 72 | 73 | ![image-20200817202834019](https://i.loli.net/2020/08/17/7K2f6PRE1UoA3zB.png) 74 | 75 | ## V0.0.4 76 | 77 | > 已实现其基本功能 78 | 79 | ![xxx.gif](https://i.loli.net/2020/08/21/ibwkVJ4ymEXZ37j.gif) 80 | 81 | ![xxx.gif](https://i.loli.net/2020/08/22/LtBSYHAi3wbo24z.gif) 82 | 83 | ## V0.0.5 84 | 85 | > 修复部分bug 86 | 87 | ## V0.0.7 88 | 89 | > 修复部分bug(msh) 90 | 91 | ## V0.0.8 92 | 93 | > 修复部分BUG,加入文件管理器,加入插件功能 94 | 95 | ![image.png](https://i.loli.net/2020/08/25/5vAQIOM6KD37Bel.png) 96 | 97 | ![image.png](https://i.loli.net/2020/08/25/S12DnzRPGtdNYwV.png) 98 | 99 | ![image.png](https://i.loli.net/2020/08/25/soE8ARFl91ehubc.png) 100 | 101 | ## V0.0.9 102 | 103 | > 新增文件管理器,修复闪退bug 104 | 105 | ![image.png](https://i.loli.net/2020/09/01/8h3dg4JYkLKtVDi.png) 106 | 107 | ![image.png](https://i.loli.net/2020/09/01/r5CQdHgV3xR98KF.png) 108 | 109 | ![image.png](https://i.loli.net/2020/09/01/NRbBkKAIeysLF63.png) 110 | 111 | ## V0.0.10 112 | 113 | > 修复了动态内存显示为0的bug -------------------------------------------------------------------------------- /sdk/navlabel.h: -------------------------------------------------------------------------------- 1 | #ifndef NAVLABEL_H 2 | #define NAVLABEL_H 3 | 4 | /** 5 | * 导航标签控件 作者:feiyangqingyun(QQ:517216493) 2016-11-28 6 | * 1:可设置前景色和背景色 7 | * 2:可设置箭头位置方向 左右上下 8 | * 3:可设置箭头大小 9 | * 4:可设置显示倒三角 10 | * 5:可设置倒三角长度/位置/颜色 11 | */ 12 | 13 | #include 14 | 15 | #ifdef quc 16 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | class QDESIGNER_WIDGET_EXPORT NavLabel : public QLabel 23 | #else 24 | class NavLabel : public QLabel 25 | #endif 26 | 27 | { 28 | Q_OBJECT 29 | Q_ENUMS(ArrowPosition) 30 | Q_ENUMS(TrianglePosition) 31 | Q_PROPERTY(int borderRadius READ getBorderRadius WRITE setBorderRadius) 32 | Q_PROPERTY(QColor background READ getBackground WRITE setBackground) 33 | Q_PROPERTY(QColor foreground READ getForeground WRITE setForeground) 34 | 35 | Q_PROPERTY(bool showArrow READ getShowArrow WRITE setShowArrow) 36 | Q_PROPERTY(int arrowSize READ getArrowSize WRITE setArrowSize) 37 | Q_PROPERTY(ArrowPosition arrowPosition READ getArrowPosition WRITE setArrowPosition) 38 | 39 | Q_PROPERTY(bool showTriangle READ getShowTriangle WRITE setShowTriangle) 40 | Q_PROPERTY(int triangleLen READ getTriangleLen WRITE setTriangleLen) 41 | Q_PROPERTY(TrianglePosition trianglePosition READ getTrianglePosition WRITE setTrianglePosition) 42 | Q_PROPERTY(QColor triangleColor READ getTriangleColor WRITE setTriangleColor) 43 | 44 | public: 45 | enum ArrowPosition { 46 | ArrowPosition_Left = 0, //向左箭头 47 | ArrowPosition_Right = 1, //向右箭头 48 | ArrowPosition_Top = 2, //向上箭头 49 | ArrowPosition_Bottom = 3 //向下箭头 50 | }; 51 | 52 | enum TrianglePosition { 53 | TrianglePosition_Left = 0, //左侧 54 | TrianglePosition_Right = 1, //右侧 55 | TrianglePosition_Top = 2, //顶部 56 | TrianglePosition_Bottom = 3 //底部 57 | }; 58 | 59 | explicit NavLabel(QWidget *parent = nullptr); 60 | 61 | protected: 62 | void mousePressEvent(QMouseEvent *); 63 | void paintEvent(QPaintEvent *); 64 | void drawBg(QPainter *painter); 65 | void drawText(QPainter *painter); 66 | void drawTriangle(QPainter *painter); 67 | 68 | private: 69 | int borderRadius; //边框圆角角度 70 | QColor background; //背景色 71 | QColor foreground; //前景色 72 | 73 | bool showArrow; //显示箭头 74 | int arrowSize; //箭头大小 75 | ArrowPosition arrowPosition; //箭头位置 76 | 77 | bool showTriangle; //显示倒三角 78 | int triangleLen; //倒三角边长 79 | TrianglePosition trianglePosition; //倒三角位置 80 | QColor triangleColor; //倒三角颜色 81 | 82 | QRect bgRect; //绘制区域 83 | 84 | public: 85 | int getBorderRadius() const; 86 | QColor getBackground() const; 87 | QColor getForeground() const; 88 | 89 | bool getShowArrow() const; 90 | int getArrowSize() const; 91 | ArrowPosition getArrowPosition() const; 92 | 93 | bool getShowTriangle() const; 94 | int getTriangleLen() const; 95 | TrianglePosition getTrianglePosition()const; 96 | QColor getTriangleColor() const; 97 | 98 | QSize sizeHint() const; 99 | QSize minimumSizeHint() const; 100 | 101 | public Q_SLOTS: 102 | //设置边框圆角角度 103 | void setBorderRadius(int borderRadius); 104 | //设置前景色 105 | void setBackground(const QColor &background); 106 | //设置前景色 107 | void setForeground(const QColor &foreground); 108 | 109 | //设置显示箭头 110 | void setShowArrow(bool showArrow); 111 | //设置箭头大小 112 | void setArrowSize(int arrowSize); 113 | //设置箭头位置 114 | void setArrowPosition(const ArrowPosition &arrowPosition); 115 | 116 | //设置显示倒三角 117 | void setShowTriangle(bool showTriangle); 118 | //设置倒三角边长 119 | void setTriangleLen(int triangleLen); 120 | //设置倒三角位置 121 | void setTrianglePosition(const TrianglePosition &trianglePosition); 122 | //设置倒三角颜色 123 | void setTriangleColor(const QColor &triangleColor); 124 | 125 | Q_SIGNALS: 126 | void clicked(); 127 | }; 128 | 129 | #endif // NAVLABEL_H 130 | -------------------------------------------------------------------------------- /sdk/progresswater.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRESSWATER_H 2 | #define PROGRESSWATER_H 3 | 4 | /** 5 | * 水波进度条控件 作者:feiyangqingyun(QQ:517216493) 2017-8-23 6 | * 1:可设置范围值,支持负数值 7 | * 2:可设置水波密度,密度越大浪越多 8 | * 3:可设置水波高度,高度越大越浪 9 | * 4:可设置边框宽度 10 | * 5:可设置是否显示进度值 11 | * 6:可设置进度值是否为百分比格式 12 | * 7:可设置背景颜色、边框颜色、当前进度颜色、文字颜色 13 | * 8:可设置两条波浪是否反着走,类似迅雷进度球风格 14 | * 9:提供槽函数启动和停止浪 15 | * 9:提供四种样式风格选择 矩形风格 圆形风格 椭圆风格 圆柱风格 16 | */ 17 | 18 | #include 19 | 20 | class QTimer; 21 | 22 | #ifdef quc 23 | #if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) 24 | #include 25 | #else 26 | #include 27 | #endif 28 | 29 | class QDESIGNER_WIDGET_EXPORT ProgressWater : public QWidget 30 | #else 31 | class ProgressWater : public QWidget 32 | #endif 33 | 34 | { 35 | Q_OBJECT 36 | Q_ENUMS(PercentStyle) 37 | 38 | Q_PROPERTY(int minValue READ getMinValue WRITE setMinValue) 39 | Q_PROPERTY(int maxValue READ getMaxValue WRITE setMaxValue) 40 | Q_PROPERTY(int value READ getValue WRITE setValue) 41 | 42 | Q_PROPERTY(double borderWidth READ getBorderWidth WRITE setBorderWidth) 43 | Q_PROPERTY(double waterHeight READ getWaterHeight WRITE setWaterHeight) 44 | Q_PROPERTY(double waterDensity READ getWaterDensity WRITE setWaterDensity) 45 | 46 | Q_PROPERTY(bool showValue READ getShowValue WRITE setShowValue) 47 | Q_PROPERTY(bool showPercent READ getShowPercent WRITE setShowPercent) 48 | Q_PROPERTY(bool reverse READ getReverse WRITE setReverse) 49 | 50 | Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor) 51 | Q_PROPERTY(QColor bgColor READ getBgColor WRITE setBgColor) 52 | Q_PROPERTY(QColor usedColor READ getUsedColor WRITE setUsedColor) 53 | Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor) 54 | 55 | Q_PROPERTY(PercentStyle percentStyle READ getPercentStyle WRITE setPercentStyle) 56 | 57 | public: 58 | enum PercentStyle { 59 | PercentStyle_Rect = 0, //矩形风格 60 | PercentStyle_Circle = 1, //圆形风格 61 | PercentStyle_Ellipse = 2, //椭圆风格 62 | PercentStyle_Cylinder = 3 //圆柱风格 63 | }; 64 | 65 | explicit ProgressWater(QWidget *parent = nullptr); 66 | ~ProgressWater(); 67 | 68 | protected: 69 | void paintEvent(QPaintEvent *); 70 | void drawBg(QPainter *painter); 71 | void drawProgress(QPainter *painter); 72 | void drawValue(QPainter *painter); 73 | 74 | private: 75 | int maxValue; //最小值 76 | int minValue; //最大值 77 | int value; //目标值 78 | 79 | double borderWidth; //边框宽度 80 | double waterHeight; //水波高度 81 | double waterDensity; //水波密度 82 | 83 | bool showValue; //是否显示值 84 | bool showPercent; //是否显示百分比 85 | bool reverse; //反向 86 | 87 | QColor borderColor; //边框颜色 88 | QColor bgColor; //背景颜色 89 | QColor usedColor; //进度颜色 90 | QColor textColor; //文字颜色 91 | 92 | PercentStyle percentStyle; //进度样式风格 93 | 94 | double offset; //水波偏移量 95 | QTimer *timer; //定时器绘制动画 96 | 97 | public: 98 | int getMinValue() const; 99 | int getMaxValue() const; 100 | int getValue() const; 101 | 102 | double getBorderWidth() const; 103 | double getWaterHeight() const; 104 | double getWaterDensity() const; 105 | 106 | bool getShowPercent() const; 107 | bool getShowValue() const; 108 | bool getReverse() const; 109 | 110 | QColor getBorderColor() const; 111 | QColor getBgColor() const; 112 | QColor getUsedColor() const; 113 | QColor getTextColor() const; 114 | 115 | PercentStyle getPercentStyle() const; 116 | 117 | QSize sizeHint() const; 118 | QSize minimumSizeHint() const; 119 | 120 | public Q_SLOTS: 121 | //设置范围值 122 | void setRange(int minValue, int maxValue); 123 | 124 | //设置最大最小值 125 | void setMinValue(int minValue); 126 | void setMaxValue(int maxValue); 127 | 128 | //设置目标值 129 | void setValue(int value); 130 | 131 | //设置边框宽度 132 | void setBorderWidth(double borderWidth); 133 | 134 | //设置水波高度 135 | void setWaterHeight(double waterHeight); 136 | 137 | //设置水波密度 138 | void setWaterDensity(double waterDensity); 139 | 140 | //设置是否显示值 141 | void setShowValue(bool showValue); 142 | //设置是否显示百分比 143 | void setShowPercent(bool showPercent); 144 | //设置波浪是否反向走 145 | void setReverse(bool reverse); 146 | 147 | //设置边框颜色 148 | void setBorderColor(const QColor &borderColor); 149 | //设置背景颜色 150 | void setBgColor(const QColor &bgColor); 151 | //设置进度颜色 152 | void setUsedColor(const QColor &usedColor); 153 | //设置文本颜色 154 | void setTextColor(const QColor &textColor); 155 | 156 | //设置进度样式风格 157 | void setPercentStyle(const PercentStyle &percentStyle); 158 | 159 | //启动和停止波浪 160 | void start(); 161 | void stop(); 162 | 163 | Q_SIGNALS: 164 | void valueChanged(int value); 165 | }; 166 | 167 | #endif // PROGRESSWATER_H 168 | -------------------------------------------------------------------------------- /seimey.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2020-08-14T14:37:27 4 | # 5 | #------------------------------------------------- 6 | 7 | 8 | QT += serialport 9 | QT += core gui 10 | 11 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 12 | 13 | CONFIG += c++11 14 | 15 | 16 | TARGET = seimey 17 | TEMPLATE = app 18 | 19 | # The following define makes your compiler emit warnings if you use 20 | # any Qt feature that has been marked deprecated (the exact warnings 21 | # depend on your compiler). Please consult the documentation of the 22 | # deprecated API in order to know how to port your code away from it. 23 | DEFINES += QT_DEPRECATED_WARNINGS 24 | 25 | # You can also make your code fail to compile if it uses deprecated APIs. 26 | # In order to do so, uncomment the following line. 27 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 28 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 29 | 30 | SOURCES += \ 31 | src\seimey_plugin.cpp \ 32 | src\ctl\seimey_text.cpp \ 33 | src\seimey_dfs.cpp \ 34 | src\seimey_finsh.cpp \ 35 | src\seimey_data.cpp \ 36 | src\ctl\seimey_setting.cpp \ 37 | src\ctl\seimey_qwchse.cpp \ 38 | src\seimey_serial.cpp \ 39 | src\main.cpp \ 40 | src\ctl\mainwindow.cpp 41 | 42 | HEADERS += \ 43 | inc\ctl\mainwindow.h \ 44 | inc\seimey_serial.h \ 45 | inc\ctl\seimey_qwchse.h \ 46 | sdk\progresswater.h \ 47 | sdk\navlabel.h\ 48 | inc\ctl\seimey_setting.h \ 49 | inc\seimey_data.h \ 50 | inc\seimey_finsh.h \ 51 | inc\seimey_dfs.h \ 52 | inc\ctl\seimey_text.h \ 53 | inc\seimey_plugin.h 54 | 55 | FORMS += \ 56 | ui\seimey_text.ui \ 57 | ui\mainwindow.ui \ 58 | ui\seimey_qwchse.ui \ 59 | ui\seimey_setting.ui 60 | 61 | TRANSLATIONS += \ 62 | seimey_zh_CN.ts 63 | 64 | INCLUDEPATH += \ 65 | inc\ 66 | inc\ctl\ 67 | sdk\ 68 | plugin\ 69 | plugin\pack 70 | 71 | QT += xml 72 | CONFIG(debug, debug|release){ 73 | LIBS += -L$$PWD/sdk/ -lqucd 74 | } else { 75 | LIBS += -L$$PWD/sdk/ -lquc 76 | } 77 | 78 | 79 | RC_FILE = seimey.rc 80 | # Default rules for deployment. 81 | qnx: target.path = /tmp/$${TARGET}/bin 82 | else: unix:!android: target.path = /opt/$${TARGET}/bin 83 | !isEmpty(target.path): INSTALLS += target 84 | 85 | RESOURCES += \ 86 | seimey.qrc 87 | 88 | DISTFILES += \ 89 | seimey.rc 90 | 91 | DEFINES += QT_MESSAGELOGCONTEXT 92 | -------------------------------------------------------------------------------- /seimey.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | qrc/icon/logo.ico 5 | qrc/icon/serial.png 6 | qrc/icon/thread.png 7 | qrc/icon/setting.png 8 | qrc/icon/property.png 9 | qrc/icon/communicate.png 10 | qrc/icon/event.png 11 | qrc/icon/mail.png 12 | qrc/icon/mutex.png 13 | qrc/icon/queue.png 14 | qrc/icon/semaphore.png 15 | qrc/icon/signal.png 16 | qrc/icon/synchronize.png 17 | qrc/icon/memory.png 18 | qrc/icon/timer.png 19 | qrc/icon/device.png 20 | qrc/icon/task manager.png 21 | qrc/icon/application.png 22 | qrc/icon/memheap.png 23 | qrc/icon/mempool.png 24 | qrc/icon/about.png 25 | qrc/icon/github.png 26 | qrc/icon/refresh.png 27 | qrc/icon/thread_obj_0.png 28 | qrc/icon/thread_obj_1.png 29 | qrc/icon/thread_obj_2.png 30 | qrc/icon/serial setting.png 31 | qrc/icon/preference.png 32 | qrc/icon/file manager.png 33 | qrc/icon/file.png 34 | qrc/icon/folder.png 35 | qrc/icon/plugin.png 36 | qrc/icon/plugin_0.png 37 | qrc/icon/plugin_1.png 38 | qrc/icon/plugin_2.png 39 | qrc/icon/device_0.png 40 | qrc/icon/device_1.png 41 | qrc/icon/device_2.png 42 | qrc/icon/timer_0.png 43 | qrc/icon/timer_1.png 44 | qrc/icon/timer_2.png 45 | qrc/icon/dfs_clone.png 46 | qrc/icon/dfs_copy.png 47 | qrc/icon/dfs_echo.png 48 | qrc/icon/dfs_mkdir.png 49 | qrc/icon/dfs_open.png 50 | qrc/icon/dfs_paste.png 51 | qrc/icon/dfs_rm.png 52 | 53 | 54 | -------------------------------------------------------------------------------- /seimey.rc: -------------------------------------------------------------------------------- 1 | #include 2 | IDI_ICON1 ICON DISCARDABLE "logo.ico"//这个指定全局图标,可以删除,即表现为不要应用图标而可以自己指定窗口图标 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 0, 0, 0, 7 6 | PRODUCTVERSION 0, 0, 0, 7 7 | FILEFLAGSMASK 0x3fL 8 | #ifdef _DEBUG 9 | FILEFLAGS VS_FF_DEBUG 10 | #else 11 | FILEFLAGS 0x0L 12 | #endif 13 | FILEOS VOS__WINDOWS32 //win64 14 | FILETYPE VFT_DLL //文件类型 15 | FILESUBTYPE 0x0L 16 | BEGIN 17 | BLOCK "StringFileInfo" 18 | BEGIN 19 | BLOCK "040904b0" 20 | BEGIN 21 | VALUE "CompanyName", "xqyjlj\0" 22 | VALUE "FileDescription", "seimey\0" //文件说明,显示在任务管理器应用处的名字 23 | VALUE "FileVersion", "0.0.0.7\0" //文件版本 24 | VALUE "LegalCopyright", "https://github.com/xqyjlj/seimey\0" //版权 25 | VALUE "ProductName", "seimey\0" //产品名称 26 | VALUE "ProductVersion", "0.0.0.7\0" //产品版本 27 | VALUE "OriginalFileName", "seimey.exe\0" //原始文件名 28 | END 29 | END 30 | BLOCK "VarFileInfo" 31 | BEGIN 32 | VALUE "Translation", 0x0004, 1200 //语言,0x0004代表中文,可以手动改写,而忽略第四步 33 | END 34 | END 35 | /* End of Version info */ 36 | -------------------------------------------------------------------------------- /seimey_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/ctl/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 主窗口 3 | * 4 | * 修改日志: 5 | * 6 | * 日期 作者 Notes 7 | * 2020-08-12 xqyjlj 0.0.0 :创建项目 8 | * 2020-08-13 xqyjlj 0.0.2 :创建菜单及其基本控件 9 | * ... ... (中间日志丢失) 10 | * 2020-08-25 xqyjlj 0.0.8 :创建插件管理器 11 | */ 12 | #include "mainwindow.h" 13 | #include "ui_mainwindow.h" 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | MainWindow::MainWindow(QWidget *parent) 24 | : QMainWindow(parent) 25 | , ui(new Ui::MainWindow) 26 | { 27 | ui->setupUi(this); 28 | c_Seimey_Data->create_Dir(); 29 | init_ctl(); 30 | init_connect(); 31 | setAttribute(Qt::WA_QuitOnClose, true); 32 | qInfo() << "open"; 33 | } 34 | 35 | MainWindow::~MainWindow() 36 | { 37 | delete ui; 38 | } 39 | /* 40 | * 初始化界面的控件 41 | */ 42 | void MainWindow::init_ctl(void) 43 | { 44 | 45 | /* 设置主界面背景为白色 */ 46 | setPalette(QPalette(Qt::white)); 47 | setAutoFillBackground(true); 48 | /* 获取设置 */ 49 | setting.is_save_serial = c_Seimey_Data->get_Is_Save_Serial_Data(); 50 | setting.timed_refresh = c_Seimey_Data->get_Timed_Refresh_Time(); 51 | /* 设置QScrollArea为Light风格 */ 52 | ui->scrollA_task_communicate->setBackgroundRole(QPalette::Light); 53 | ui->scrollA_task_synchronize->setBackgroundRole(QPalette::Light); 54 | ui->scrollA_task_property->setBackgroundRole(QPalette::Light); 55 | /* 设置 treeW_finsh_thread 的 item 大小自适应缩放*/ 56 | ui->treeW_finsh_thread->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); 57 | /* 设置 */ 58 | serial_status.status = new QLabel("连接状态:", this); 59 | serial_status.baud_status = new QLabel("波特率:", this); 60 | serial_status.port_status = new QLabel("端口:", this); 61 | statusBar()->addPermanentWidget(serial_status.port_status); 62 | statusBar()->addPermanentWidget(serial_status.baud_status); 63 | statusBar()->addPermanentWidget(serial_status.status); 64 | /* 创建定时器 */ 65 | connect(finsh_timerID, SIGNAL(timeout()), this, SLOT(finsh_timer_timeout()), Qt::UniqueConnection); 66 | if (setting.timed_refresh > 0) 67 | { 68 | if (ui->tabW_main->currentIndex() == 0) 69 | { 70 | finsh_timerID->setInterval(static_cast(setting.timed_refresh * 1000)); 71 | finsh_timerID->start(); 72 | } 73 | } 74 | QHeaderView *head = ui->treeW_file_mannage->header(); 75 | head->setSectionResizeMode(QHeaderView::ResizeToContents); 76 | 77 | connect(ui->treeW_finsh_thread->horizontalHeader(),&QHeaderView::sectionClicked, this,&MainWindow::sortHeader); 78 | connect(this,&MainWindow::sort_item,c_Seimey_Finsh,&seimey_finsh::widget_sort); 79 | } 80 | /* 81 | * 用来初始化一些connect函数 82 | */ 83 | void MainWindow::init_connect(void) 84 | { 85 | connect(c_Seimey_Serial, SIGNAL(already_recv_data(QByteArray)), this, SLOT(serial_data_coming(QByteArray)), Qt::UniqueConnection); 86 | connect(c_Seimey_Plugin, SIGNAL(send_msg(QByteArray)), this, SLOT(send_msg(QByteArray)), Qt::UniqueConnection); 87 | connect(ui->treeW_file_mannage, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTreeRightMenu(QPoint)), Qt::UniqueConnection); 88 | } 89 | /* 90 | * 菜单·串口设置按键点击槽函数 91 | */ 92 | void MainWindow::on_menu_setting_serial_setting_triggered() 93 | { 94 | c_Seimey_Qwchse = new seimey_qwchse(this); 95 | connect(c_Seimey_Qwchse, &seimey_qwchse::window_close, [ = ]() 96 | { 97 | on_menu_setting_serial_link_triggered(); 98 | c_Seimey_Qwchse = nullptr; 99 | }); 100 | c_Seimey_Qwchse->show(); 101 | } 102 | /* 103 | * 菜单·串口连接按键点击槽函数 104 | */ 105 | void MainWindow::on_menu_setting_serial_link_triggered(void) 106 | { 107 | bool status; 108 | status = c_Seimey_Serial->set_serial_link(ui->menu_setting_serial_link->isChecked()); 109 | ui->menu_setting_serial_link->setChecked(status); 110 | QString tmp = status ? "已连接" : "未连接"; 111 | serial_status.status->setText(QString("连接状态:") + tmp); 112 | serial_status.baud_status->setText(QString("波特率:") + c_Seimey_Serial->get_seial_baud()); 113 | serial_status.port_status->setText(QString("端口:") + c_Seimey_Serial->get_seial_port()); 114 | } 115 | /* 116 | * 菜单·帮助·关于按键点击槽函数 117 | */ 118 | void MainWindow::on_menu_help_about_triggered(void) 119 | { 120 | QString dlgTitle = QStringLiteral("关于"); 121 | QString strInfo = QStringLiteral("此开源软件是本人(小权一句两句)。\n" 122 | "在使用Windows的任务管理器时,有感而发。\n" 123 | "此软件完全免费,但是还是可以联系作者给作者打赏一杯奶茶钱。\n" 124 | "基于LGPL开源协议"); 125 | QMessageBox::about(this, dlgTitle, strInfo); 126 | } 127 | /* 128 | * 菜单·帮助·github地址按键点击槽函数 129 | */ 130 | void MainWindow::on_menu_help_github_triggered(void) 131 | { 132 | QDesktopServices::openUrl(QUrl(QLatin1String("https://github.com/xqyjlj/seimey"))); 133 | } 134 | /* 135 | * 菜单·首选项设置按键点击槽函数 136 | */ 137 | void MainWindow::on_menu_setting_preference_triggered() 138 | { 139 | c_Seimey_Setting = new seimey_setting(this); 140 | connect(c_Seimey_Setting, &seimey_setting::window_close, [ = ]() 141 | { 142 | /* 获取设置的变量 */ 143 | setting.is_save_serial = c_Seimey_Data->get_Is_Save_Serial_Data(); 144 | setting.timed_refresh = c_Seimey_Data->get_Timed_Refresh_Time(); 145 | /* 如果启动了定时刷新,则会启动定时器 */ 146 | if (setting.timed_refresh > 0) 147 | { 148 | if (ui->tabW_main->currentIndex() == 0) 149 | { 150 | finsh_timerID->setInterval(static_cast(setting.timed_refresh * 1000)); 151 | finsh_timerID->start(); 152 | } 153 | } 154 | else 155 | { 156 | finsh_timerID->stop(); 157 | } 158 | c_Seimey_Setting = nullptr; 159 | }); 160 | c_Seimey_Setting->show(); 161 | } 162 | /* 163 | * 菜单·串口设置按键点击槽函数 164 | */ 165 | void MainWindow::on_menu_setting_serial_setting_2_triggered() 166 | { 167 | on_menu_setting_serial_setting_triggered(); 168 | } 169 | /* 170 | * 串口数据来临槽函数 171 | */ 172 | void MainWindow::serial_data_coming(QByteArray msg) 173 | { 174 | if (setting.is_save_serial) 175 | { 176 | c_Seimey_Data->save_Serial_Data(msg); 177 | } 178 | if (c_Seimey_Plugin != nullptr) 179 | { 180 | c_Seimey_Plugin->rec_msg(msg); 181 | } 182 | switch (ui->tabW_main->currentIndex()) 183 | { 184 | case 0: 185 | c_Seimey_Finsh->handle(QString::fromLocal8Bit(msg)); 186 | break; 187 | case 1: 188 | c_Seimey_Dfs->handle(QString::fromLocal8Bit(msg)); 189 | break; 190 | default: 191 | break; 192 | } 193 | } 194 | /* 195 | * 任务管理器顶端标签改变槽函数 196 | */ 197 | void MainWindow::task_manager(int index) 198 | { 199 | if (c_Seimey_Serial->get_serial_status()) 200 | { 201 | switch (index) 202 | { 203 | case 0: 204 | c_Seimey_Finsh->thread(c_Seimey_Serial, ui->treeW_finsh_thread); 205 | break; 206 | case 1: 207 | if (ui->comdLB_mem_pool->isChecked()) 208 | c_Seimey_Finsh->mem_pool(c_Seimey_Serial, ui->treeW_finsh_mempool); 209 | else if (ui->comdLB_mem_heap->isChecked()) 210 | c_Seimey_Finsh->mem_heap(c_Seimey_Serial, ui->treeW_finsh_memheap); 211 | else if (ui->comdLB_mem_free->isChecked()) 212 | c_Seimey_Finsh->mem_free(c_Seimey_Serial, ui->proW_memfree, ui->label_total_mem, ui->label_maxused_mem, ui->label_remaining_mem); 213 | break; 214 | case 2: 215 | if (ui->comdLB_synchronize_event->isChecked()) 216 | c_Seimey_Finsh->synchr_event(c_Seimey_Serial, ui->treeW_finsh_event); 217 | else if (ui->comdLB_synchronize_mutex->isChecked()) 218 | c_Seimey_Finsh->synchr_mutex(c_Seimey_Serial, ui->treeW_finsh_mutex); 219 | else if (ui->comdLB_synchronize_semaphore->isChecked()) 220 | c_Seimey_Finsh->synchr_sem(c_Seimey_Serial, ui->treeW_finsh_sem); 221 | break; 222 | case 3: 223 | if (ui->comdLB_communicate_mail->isChecked()) 224 | c_Seimey_Finsh->commun_mail(c_Seimey_Serial, ui->treeW_finsh_mailbox); 225 | else if (ui->comdLB_communicate_queue->isChecked()) 226 | c_Seimey_Finsh->commun_queue(c_Seimey_Serial, ui->treeW_finsh_msqueue); 227 | break; 228 | case 4: 229 | c_Seimey_Finsh->device(c_Seimey_Serial, ui->treeW_finsh_device); 230 | break; 231 | case 5: 232 | c_Seimey_Finsh->time(c_Seimey_Serial, ui->treeW_finsh_timer, ui->lineE_current_tick); 233 | break; 234 | } 235 | } 236 | } 237 | /* 238 | * 内存池按钮点击槽函数 239 | */ 240 | void MainWindow::on_comdLB_mem_pool_clicked(void) 241 | { 242 | ui->comdLB_mem_pool->setChecked(true); 243 | ui->comdLB_mem_free->setChecked(false); 244 | ui->comdLB_mem_heap->setChecked(false); 245 | ui->stackedW_property->setCurrentIndex(0); 246 | } 247 | /* 248 | * 内存堆按钮点击槽函数 249 | */ 250 | void MainWindow::on_comdLB_mem_heap_clicked(void) 251 | { 252 | ui->comdLB_mem_heap->setChecked(true); 253 | ui->comdLB_mem_free->setChecked(false); 254 | ui->comdLB_mem_pool->setChecked(false); 255 | ui->stackedW_property->setCurrentIndex(1); 256 | } 257 | /* 258 | * 动态按钮点击槽函数 259 | */ 260 | void MainWindow::on_comdLB_mem_free_clicked(void) 261 | { 262 | ui->comdLB_mem_free->setChecked(true); 263 | ui->comdLB_mem_pool->setChecked(false); 264 | ui->comdLB_mem_heap->setChecked(false); 265 | ui->stackedW_property->setCurrentIndex(2); 266 | } 267 | /* 268 | * 信号量按钮点击槽函数 269 | */ 270 | void MainWindow::on_comdLB_synchronize_semaphore_clicked() 271 | { 272 | ui->comdLB_synchronize_semaphore->setChecked(true); 273 | ui->comdLB_synchronize_mutex->setChecked(false); 274 | ui->comdLB_synchronize_event->setChecked(false); 275 | ui->stackedW_synchronize->setCurrentIndex(0); 276 | } 277 | /* 278 | * 二值信号量按钮点击槽函数 279 | */ 280 | void MainWindow::on_comdLB_synchronize_mutex_clicked() 281 | { 282 | ui->comdLB_synchronize_mutex->setChecked(true); 283 | ui->comdLB_synchronize_semaphore->setChecked(false); 284 | ui->comdLB_synchronize_event->setChecked(false); 285 | ui->stackedW_synchronize->setCurrentIndex(1); 286 | } 287 | /* 288 | * 事件按钮点击槽函数 289 | */ 290 | void MainWindow::on_comdLB_synchronize_event_clicked() 291 | { 292 | ui->comdLB_synchronize_event->setChecked(true); 293 | ui->comdLB_synchronize_semaphore->setChecked(false); 294 | ui->comdLB_synchronize_mutex->setChecked(false); 295 | ui->stackedW_synchronize->setCurrentIndex(2); 296 | } 297 | /* 298 | * 邮箱按钮点击槽函数 299 | */ 300 | void MainWindow::on_comdLB_communicate_mail_clicked() 301 | { 302 | ui->comdLB_communicate_mail->setChecked(true); 303 | ui->comdLB_communicate_queue->setChecked(false); 304 | ui->stackedW_communicate->setCurrentIndex(1); 305 | } 306 | /* 307 | * 队列按钮点击槽函数 308 | */ 309 | void MainWindow::on_comdLB_communicate_queue_clicked() 310 | { 311 | ui->comdLB_communicate_queue->setChecked(true); 312 | ui->comdLB_communicate_mail->setChecked(false); 313 | ui->stackedW_communicate->setCurrentIndex(0); 314 | } 315 | /* 316 | * 菜单·首选项设置按键点击槽函数 317 | */ 318 | void MainWindow::on_menu_setting_preference_2_triggered() 319 | { 320 | on_menu_setting_preference_triggered(); 321 | } 322 | /* 323 | * finsh定时刷新触发的槽函数 324 | */ 325 | void MainWindow::finsh_timer_timeout() 326 | { 327 | if (ui->tabW_main->currentIndex() != 0) 328 | { 329 | finsh_timerID->stop(); 330 | } 331 | else 332 | { 333 | task_manager(ui->tabW_task_manager->currentIndex()); 334 | } 335 | } 336 | 337 | void MainWindow::on_tabW_main_currentChanged(int index) 338 | { 339 | on_tabW_main_tabBarDoubleClicked(index); 340 | } 341 | 342 | void MainWindow::on_tabW_main_tabBarDoubleClicked(int index) 343 | { 344 | switch (index) 345 | { 346 | case 0: 347 | setting.timed_refresh = c_Seimey_Data->get_Timed_Refresh_Time(); 348 | if (setting.timed_refresh > 0) 349 | { 350 | finsh_timerID->setInterval(static_cast(setting.timed_refresh * 1000)); 351 | finsh_timerID->start(); 352 | } 353 | else 354 | { 355 | finsh_timerID->stop(); 356 | } 357 | break; 358 | case 1: 359 | c_Seimey_Dfs->master(c_Seimey_Serial, ui->treeW_file_mannage); 360 | break; 361 | case 2: 362 | c_Seimey_Plugin->set_plugin(ui->treeW_plugin); 363 | break; 364 | default: 365 | break; 366 | } 367 | } 368 | 369 | void MainWindow::on_treeW_file_mannage_itemDoubleClicked(QTreeWidgetItem *item) 370 | { 371 | c_Seimey_Dfs->servant(c_Seimey_Serial, item); 372 | } 373 | 374 | void MainWindow::showTreeRightMenu(QPoint pos) 375 | { 376 | dfs_menu->clear(); 377 | treew_dfs_MenuRequested = ui->treeW_file_mannage->itemAt(pos);//关键 378 | if (treew_dfs_MenuRequested) 379 | { 380 | switch (treew_dfs_MenuRequested->type()) 381 | { 382 | case seimey_dfs::enumdir: 383 | dfs_menu->addAction(ui->dfs_menu_open); 384 | dfs_menu->addSeparator(); 385 | dfs_menu->addAction(ui->dfs_menu_mkdir); 386 | dfs_menu->addAction(ui->dfs_menu_echo); 387 | dfs_menu->addSeparator(); 388 | dfs_menu->addAction(ui->dfs_menu_rm); 389 | dfs_menu->addSeparator(); 390 | dfs_menu->addAction(ui->dfs_menu_clone); 391 | dfs_menu->addSeparator(); 392 | dfs_menu->addAction(ui->dfs_menu_copy); 393 | if (!dfs_clipboard.isEmpty()) 394 | { 395 | dfs_menu->addAction(ui->dfs_menu_paste); 396 | } 397 | dfs_menu->addSeparator(); 398 | break; 399 | case seimey_dfs::enumfile: 400 | dfs_menu->addAction(ui->dfs_menu_open); 401 | dfs_menu->addSeparator(); 402 | dfs_menu->addAction(ui->dfs_menu_rm); 403 | dfs_menu->addSeparator(); 404 | dfs_menu->addAction(ui->dfs_menu_clone); 405 | dfs_menu->addSeparator(); 406 | dfs_menu->addAction(ui->dfs_menu_copy); 407 | dfs_menu->addSeparator(); 408 | break; 409 | } 410 | } 411 | else 412 | { 413 | dfs_menu->addAction(ui->dfs_menu_mkdir_2); 414 | dfs_menu->addAction(ui->dfs_menu_echo_2); 415 | dfs_menu->addSeparator(); 416 | if (!dfs_clipboard.isEmpty()) 417 | { 418 | dfs_menu->addAction(ui->dfs_menu_paste_2); 419 | } 420 | dfs_menu->addAction(ui->dfs_menu_clone_2); 421 | 422 | } 423 | dfs_menu->move(ui->treeW_file_mannage->cursor().pos()); 424 | dfs_menu->show(); 425 | } 426 | 427 | void MainWindow::on_dfs_menu_open_triggered() 428 | { 429 | if (treew_dfs_MenuRequested) 430 | { 431 | c_Seimey_Dfs->servant(c_Seimey_Serial, treew_dfs_MenuRequested); 432 | treew_dfs_MenuRequested = nullptr; 433 | } 434 | } 435 | 436 | 437 | void MainWindow::on_dfs_menu_clone_triggered() 438 | { 439 | QMessageBox::information(this, "信息", "该功能还未实现"); 440 | } 441 | 442 | void MainWindow::on_dfs_menu_mkdir_triggered() 443 | { 444 | if (treew_dfs_MenuRequested) 445 | { 446 | QString dlgTitle = "新建文件夹"; 447 | QString txtLabel = "请输入文件夹名称,不能含有空格,输入的空格将会用'_'代替"; 448 | QString defaultInput = ""; 449 | QLineEdit::EchoMode echoMode = QLineEdit::Normal; //正常文字输入 450 | //QLineEdit::EchoMode echoMode=QLineEdit::Password;//密码输入 451 | bool ok = false; 452 | QString msg = QInputDialog::getText(this, dlgTitle, txtLabel, echoMode, defaultInput, &ok, Qt::MSWindowsFixedSizeDialogHint); 453 | if (ok && !msg.isEmpty()) 454 | { 455 | if (msg.contains(" ")) 456 | { 457 | msg.replace(QString(" "), QString("_")); 458 | } 459 | c_Seimey_Dfs->mkdir(c_Seimey_Serial, msg, treew_dfs_MenuRequested); 460 | treew_dfs_MenuRequested = nullptr; 461 | } 462 | } 463 | } 464 | 465 | void MainWindow::on_dfs_menu_echo_triggered() 466 | { 467 | if (treew_dfs_MenuRequested) 468 | { 469 | QDialog dialog(this); 470 | dialog.setMinimumSize(200, 200); 471 | QFormLayout form(&dialog); 472 | form.addRow(new QLabel("输入的字符不能含有空格,输入的空格将会用'_'代替")); 473 | QLineEdit *filename = new QLineEdit(&dialog); 474 | form.addRow(QString("文件名"), filename); 475 | QLineEdit *filedata = new QLineEdit(&dialog); 476 | form.addRow(QString("内容"), filedata); 477 | 478 | QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, 479 | Qt::Horizontal, &dialog); 480 | form.addRow(&buttonBox); 481 | QObject::connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()), Qt::UniqueConnection); 482 | QObject::connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()), Qt::UniqueConnection); 483 | 484 | if (dialog.exec() == QDialog::Accepted) 485 | { 486 | QString name = filename->text(); 487 | QString msg = filedata->text(); 488 | if (name.isEmpty()) 489 | { 490 | QMessageBox::warning(nullptr, "警告", "文件名未输入"); 491 | return; 492 | } 493 | else if (msg.isEmpty()) 494 | { 495 | QMessageBox::warning(nullptr, "警告", "文件内容未输入"); 496 | return; 497 | } 498 | 499 | if (!name.isEmpty() && !msg.isEmpty()) 500 | { 501 | if (name.contains(" ")) 502 | { 503 | name.replace(QString(" "), QString("_")); 504 | } 505 | if (msg.contains(" ")) 506 | { 507 | msg.replace(QString(" "), QString("_")); 508 | } 509 | c_Seimey_Dfs->echo(c_Seimey_Serial, name, msg, treew_dfs_MenuRequested); 510 | treew_dfs_MenuRequested = nullptr; 511 | } 512 | } 513 | } 514 | } 515 | 516 | void MainWindow::on_dfs_menu_rm_triggered() 517 | { 518 | if (treew_dfs_MenuRequested) 519 | { 520 | c_Seimey_Dfs->rm(c_Seimey_Serial, treew_dfs_MenuRequested, ui->treeW_file_mannage); 521 | treew_dfs_MenuRequested = nullptr; 522 | } 523 | } 524 | 525 | void MainWindow::on_dfs_menu_copy_triggered() 526 | { 527 | if (treew_dfs_MenuRequested) 528 | { 529 | dfs_clipboard = treew_dfs_MenuRequested->whatsThis(0) + treew_dfs_MenuRequested->text(0); 530 | treew_dfs_MenuRequested = nullptr; 531 | } 532 | } 533 | 534 | void MainWindow::on_dfs_menu_paste_triggered() 535 | { 536 | if (treew_dfs_MenuRequested) 537 | { 538 | QString pur = treew_dfs_MenuRequested->whatsThis(0) + treew_dfs_MenuRequested->text(0); 539 | if (pur == dfs_clipboard) 540 | { 541 | pur += QString("x"); 542 | } 543 | c_Seimey_Dfs->cp(c_Seimey_Serial, dfs_clipboard, pur, treew_dfs_MenuRequested, ui->treeW_file_mannage); 544 | dfs_clipboard.clear(); 545 | treew_dfs_MenuRequested = nullptr; 546 | } 547 | } 548 | 549 | void MainWindow::on_dfs_menu_clone_2_triggered() 550 | { 551 | QMessageBox::information(this, "信息", "该功能还未实现"); 552 | } 553 | 554 | void MainWindow::on_dfs_menu_mkdir_2_triggered() 555 | { 556 | QString dlgTitle = "新建文件夹"; 557 | QString txtLabel = "请输入文件夹名称,不能含有空格,输入的空格将会用'_'代替"; 558 | QString defaultInput = ""; 559 | QLineEdit::EchoMode echoMode = QLineEdit::Normal; //正常文字输入 560 | //QLineEdit::EchoMode echoMode=QLineEdit::Password;//密码输入 561 | bool ok = false; 562 | QString msg = QInputDialog::getText(this, dlgTitle, txtLabel, echoMode, defaultInput, &ok, Qt::MSWindowsFixedSizeDialogHint); 563 | if (ok && !msg.isEmpty()) 564 | { 565 | if (msg.contains(" ")) 566 | { 567 | msg.replace(QString(" "), QString("_")); 568 | } 569 | c_Seimey_Dfs->mastermkdir(c_Seimey_Serial, msg, ui->treeW_file_mannage); 570 | } 571 | } 572 | 573 | void MainWindow::on_dfs_menu_echo_2_triggered() 574 | { 575 | QDialog dialog(this); 576 | dialog.setMinimumSize(200, 200); 577 | QFormLayout form(&dialog); 578 | form.addRow(new QLabel("输入的字符不能含有空格,输入的空格将会用'_'代替")); 579 | QLineEdit *filename = new QLineEdit(&dialog); 580 | form.addRow(QString("文件名"), filename); 581 | QLineEdit *filedata = new QLineEdit(&dialog); 582 | form.addRow(QString("内容"), filedata); 583 | 584 | QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, 585 | Qt::Horizontal, &dialog); 586 | form.addRow(&buttonBox); 587 | QObject::connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()), Qt::UniqueConnection); 588 | QObject::connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()), Qt::UniqueConnection); 589 | 590 | if (dialog.exec() == QDialog::Accepted) 591 | { 592 | QString name = filename->text(); 593 | QString msg = filedata->text(); 594 | if (name.isEmpty()) 595 | { 596 | QMessageBox::warning(nullptr, "警告", "文件名未输入"); 597 | return; 598 | } 599 | else if (msg.isEmpty()) 600 | { 601 | QMessageBox::warning(nullptr, "警告", "文件内容未输入"); 602 | return; 603 | } 604 | 605 | if (!name.isEmpty() && !msg.isEmpty()) 606 | { 607 | if (name.contains(" ")) 608 | { 609 | name.replace(QString(" "), QString("_")); 610 | } 611 | if (msg.contains(" ")) 612 | { 613 | msg.replace(QString(" "), QString("_")); 614 | } 615 | c_Seimey_Dfs->masterecho(c_Seimey_Serial, name, msg, ui->treeW_file_mannage); 616 | } 617 | } 618 | } 619 | 620 | void MainWindow::on_dfs_menu_paste_2_triggered() 621 | { 622 | c_Seimey_Dfs->mastercp(c_Seimey_Serial, dfs_clipboard, ui->treeW_file_mannage); 623 | dfs_clipboard.clear(); 624 | } 625 | 626 | void MainWindow::on_treeW_plugin_itemDoubleClicked(QTreeWidgetItem *item, int column) 627 | { 628 | if (column >= 0) 629 | { 630 | c_Seimey_Plugin->open_plugin(item); 631 | } 632 | } 633 | 634 | void MainWindow::send_msg(QByteArray msg) 635 | { 636 | c_Seimey_Serial->send_data(msg); 637 | } 638 | 639 | void MainWindow::sortHeader(int index) 640 | { 641 | emit sort_item(index); 642 | } 643 | -------------------------------------------------------------------------------- /src/ctl/seimey_qwchse.cpp: -------------------------------------------------------------------------------- 1 | #include "seimey_qwchse.h" 2 | #include "ui_seimey_qwchse.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "QDebug" 9 | seimey_qwchse::seimey_qwchse(QWidget *parent) : 10 | QMainWindow(parent), 11 | ui(new Ui::seimey_qwchse) 12 | { 13 | ui->setupUi(this); 14 | setPalette(QPalette(Qt::white)); 15 | setAutoFillBackground(true); 16 | setWindowModality(Qt::WindowModal); 17 | setAttribute(Qt::WA_QuitOnClose, false); 18 | set_serial_comboBox(); 19 | connect(ui->label_serialport, SIGNAL(clicked()), this, SLOT(set_serial_comboBox())); 20 | set_excserial_comboBox(); 21 | } 22 | 23 | seimey_qwchse::~seimey_qwchse() 24 | { 25 | delete ui; 26 | } 27 | 28 | void seimey_qwchse::set_serial_comboBox() 29 | { 30 | QStringList serialPortName; 31 | foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) 32 | { 33 | serialPortName << info.portName(); 34 | } 35 | ui->comb_serialport->clear(); 36 | ui->comb_serialport->addItems(serialPortName); 37 | } 38 | 39 | void seimey_qwchse::closeEvent(QCloseEvent *event) 40 | { 41 | event->accept(); 42 | 43 | /* create serial json object */ 44 | QJsonObject serial_json_obj; 45 | serial_json_obj.insert("SerialPort", ui->comb_serialport->currentText()); 46 | serial_json_obj.insert("BaudRate", ui->comb_baudrate->currentText()); 47 | serial_json_obj.insert("DataBits", ui->comb_databits->currentText()); 48 | serial_json_obj.insert("FlowControl", ui->comb_flowcontrol->currentText()); 49 | serial_json_obj.insert("Parity", ui->comb_parity->currentText()); 50 | serial_json_obj.insert("StopBits", ui->comb_stopbits->currentText()); 51 | 52 | QJsonDocument serial_json; 53 | serial_json.setObject(serial_json_obj); 54 | 55 | /* open serial json file */ 56 | QString qs_serial_file = QDir::currentPath() + "/.workspace/.serial/serial.json"; 57 | QFile serial_file(qs_serial_file); 58 | serial_file.open(QIODevice::ReadWrite | QIODevice::Truncate); 59 | 60 | /* write file bom and json data */ 61 | unsigned char bom[] = {0xEF, 0xBB, 0xBF}; 62 | serial_file.write(static_cast(static_cast(bom)), sizeof(bom)); 63 | QTextStream in(&serial_file); 64 | in.setCodec("UTF-8"); 65 | in << QString(serial_json.toJson()); 66 | 67 | /* close file */ 68 | serial_file.flush(); 69 | serial_file.close(); 70 | 71 | emit window_close(); 72 | } 73 | 74 | void seimey_qwchse::set_excserial_comboBox(void) 75 | { 76 | QJsonParseError jsonError; 77 | 78 | QString qs_serial_file = QDir::currentPath() + "/.workspace/.serial/serial.json"; 79 | QFile serial_file(qs_serial_file); 80 | serial_file.open(QIODevice::ReadOnly); 81 | 82 | QJsonDocument serial_json = QJsonDocument::fromJson(serial_file.readAll(), &jsonError); 83 | if (!serial_json.isNull() && (jsonError.error == QJsonParseError::NoError)) 84 | { 85 | QJsonObject serial_json_obj = serial_json.object(); 86 | ui->comb_serialport->setCurrentText(serial_json_obj.value("SerialPort").toString()); 87 | ui->comb_baudrate->setCurrentText(serial_json_obj.value("BaudRate").toString()); 88 | ui->comb_parity->setCurrentText(serial_json_obj.value("Parity").toString()); 89 | ui->comb_stopbits->setCurrentText(serial_json_obj.value("StopBits").toString()); 90 | ui->comb_flowcontrol->setCurrentText(serial_json_obj.value("FlowControl").toString()); 91 | ui->comb_databits->setCurrentText(serial_json_obj.value("DataBits").toString()); 92 | } 93 | 94 | serial_file.close(); 95 | } 96 | 97 | 98 | seimey_qwchse_Label::seimey_qwchse_Label(QWidget *parent): QLabel(parent) 99 | { 100 | } 101 | 102 | seimey_qwchse_Label::~seimey_qwchse_Label() 103 | { 104 | } 105 | 106 | void seimey_qwchse_Label::mousePressEvent(QMouseEvent *event) 107 | { 108 | if (event->button() == Qt::LeftButton) 109 | { 110 | emit clicked(); 111 | } 112 | QLabel::mousePressEvent(event); 113 | } 114 | -------------------------------------------------------------------------------- /src/ctl/seimey_setting.cpp: -------------------------------------------------------------------------------- 1 | #include "seimey_setting.h" 2 | #include "ui_seimey_setting.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | seimey_setting::seimey_setting(QWidget *parent) : 11 | QMainWindow(parent), 12 | ui(new Ui::seimey_setting) 13 | { 14 | ui->setupUi(this); 15 | set_setting(); 16 | setPalette(QPalette(Qt::white)); 17 | setAutoFillBackground(true); 18 | setWindowModality(Qt::WindowModal); 19 | setAttribute(Qt::WA_QuitOnClose, false); 20 | } 21 | 22 | seimey_setting::~seimey_setting() 23 | { 24 | delete ui; 25 | } 26 | 27 | void seimey_setting::closeEvent(QCloseEvent *event) 28 | { 29 | event->accept(); 30 | QJsonObject setting_json_obj; 31 | setting_json_obj.insert("Save serial", QJsonValue(ui->checkB_Save_serial_data->isChecked())); 32 | setting_json_obj.insert("Timed refresh", QJsonValue(ui->doubleS_timer_refresh->value())); 33 | 34 | QJsonDocument setting_json; 35 | setting_json.setObject(setting_json_obj); 36 | 37 | QString qs_setting_file = QDir::currentPath() + "/.workspace/.setting/setting.json"; 38 | QFile setting_file(qs_setting_file); 39 | setting_file.open(QIODevice::ReadWrite | QIODevice::Truncate); 40 | 41 | unsigned char bom[] = {0xEF, 0xBB, 0xBF}; 42 | setting_file.write(static_cast(static_cast(bom)), sizeof(bom)); 43 | QTextStream in(&setting_file); 44 | in.setCodec("UTF-8"); 45 | in << QString(setting_json.toJson()); 46 | 47 | setting_file.flush(); 48 | setting_file.close(); 49 | 50 | emit window_close(); 51 | } 52 | 53 | void seimey_setting::set_setting(void) 54 | { 55 | QJsonParseError jsonError; 56 | 57 | QString qs_setting_file = QDir::currentPath() + "/.workspace/.setting/setting.json"; 58 | QFile setting_file(qs_setting_file); 59 | setting_file.open(QIODevice::ReadOnly); 60 | 61 | QJsonDocument setting_json = QJsonDocument::fromJson(setting_file.readAll(), &jsonError); 62 | if (!setting_json.isNull() && (jsonError.error == QJsonParseError::NoError)) 63 | { 64 | QJsonObject setting_json_obj = setting_json.object(); 65 | ui->checkB_Save_serial_data->setChecked(setting_json_obj.value("Save serial").toBool()); 66 | ui->doubleS_timer_refresh->setValue(setting_json_obj.value("Timed refresh").toDouble()); 67 | } 68 | 69 | setting_file.close(); 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/ctl/seimey_text.cpp: -------------------------------------------------------------------------------- 1 | #include "seimey_text.h" 2 | #include "ui_seimey_text.h" 3 | 4 | seimey_text::seimey_text(QWidget *parent) : 5 | QMainWindow(parent), 6 | ui(new Ui::seimey_text) 7 | { 8 | ui->setupUi(this); 9 | setPalette(QPalette(Qt::white)); 10 | setAutoFillBackground(true); 11 | setWindowModality(Qt::WindowModal); 12 | setAttribute(Qt::WA_QuitOnClose, false); 13 | } 14 | 15 | seimey_text::~seimey_text() 16 | { 17 | delete ui; 18 | } 19 | void seimey_text::closeEvent(QCloseEvent *event) 20 | { 21 | event->accept(); 22 | emit window_Close(); 23 | } 24 | 25 | void seimey_text::show_text(QString msg) 26 | { 27 | ui->textEdit->setText(msg); 28 | } 29 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * main函数 3 | * 4 | * 修改日志: 5 | * 6 | * 日期 作者 Notes 7 | * 2020-08-12 xqyjlj 0.0.0 :创建项目 8 | * ... ... (中间日志丢失) 9 | * 2020-08-25 xqyjlj 0.0.8 :增加日志输出路径转移哦 10 | */ 11 | #include "mainwindow.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | /* 17 | * 改变日志输出路径 18 | */ 19 | void msg_Output(QtMsgType type, const QMessageLogContext &context, const QString &msg) 20 | { 21 | static QMutex mutex; 22 | mutex.lock(); 23 | QString time = QDateTime::currentDateTime().toString(QString("[ yyyy-MM-dd HH:mm:ss:zzz ]")); 24 | QString mmsg; 25 | switch (type) 26 | { 27 | case QtDebugMsg: 28 | mmsg = QString("%1: Debug:\t%2 (file:%3, line:%4, func: %5)").arg(time).arg(msg).arg(QString(context.file)).arg(context.line).arg(QString(context.function)); 29 | break; 30 | case QtInfoMsg: 31 | mmsg = QString("%1: Info:\t%2 (file:%3, line:%4, func: %5)").arg(time).arg(msg).arg(QString(context.file)).arg(context.line).arg(QString(context.function)); 32 | break; 33 | case QtWarningMsg: 34 | mmsg = QString("%1: Warning:\t%2 (file:%3, line:%4, func: %5)").arg(time).arg(msg).arg(QString(context.file)).arg(context.line).arg(QString(context.function)); 35 | break; 36 | case QtCriticalMsg: 37 | mmsg = QString("%1: Critical:\t%2 (file:%3, line:%4, func: %5)").arg(time).arg(msg).arg(QString(context.file)).arg(context.line).arg(QString(context.function)); 38 | break; 39 | case QtFatalMsg: 40 | mmsg = QString("%1: Fatal:\t%2 (file:%3, line:%4, func: %5)").arg(time).arg(msg).arg(QString(context.file)).arg(context.line).arg(QString(context.function)); 41 | abort(); 42 | } 43 | static QString qs_log_file = QDir::currentPath() + "/.workspace" + "/.log" + "/seimey.log"; 44 | QFile file(qs_log_file); 45 | file.open(QIODevice::ReadWrite | QIODevice::Append); 46 | QTextStream stream(&file); 47 | stream.setCodec("UTF-8"); 48 | stream << mmsg << "\r\n"; 49 | file.flush(); 50 | file.close(); 51 | mutex.unlock(); 52 | } 53 | 54 | int main(int argc, char *argv[]) 55 | { 56 | #ifdef QT_NO_DEBUG 57 | qInstallMessageHandler(msg_Output); 58 | #endif 59 | QApplication a(argc, argv); 60 | MainWindow w; 61 | w.show(); 62 | return a.exec(); 63 | } 64 | -------------------------------------------------------------------------------- /src/seimey_data.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * 数据处理 3 | * 4 | * 修改日志: 5 | * 6 | * 日期 作者 Notes 7 | * 2020-08-17 xqyjlj 0.0.0 :创建项目 8 | * ... ... (中间日志丢失) 9 | * 2020-08-25 xqyjlj 0.0.8 :创建插件管理器 10 | */ 11 | #include "seimey_data.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | seimey_data::seimey_data(QObject *parent) : QObject(parent) 22 | { 23 | 24 | } 25 | /* 26 | * 创建串口工作目录 27 | */ 28 | void seimey_data::ceate_Serial(void) 29 | { 30 | QString qs_serial_dir = QDir::currentPath() + "/.workspace" + "/.serial"; 31 | 32 | QDir serial_dir(qs_serial_dir); 33 | if (!serial_dir.exists()) 34 | { 35 | serial_dir.mkdir(qs_serial_dir); 36 | } 37 | 38 | QString qs_serial_set_file = qs_serial_dir + "/serial.json"; 39 | QFile serial_set_file(qs_serial_set_file); 40 | if (!serial_set_file.exists()) 41 | { 42 | serial_set_file.open(QIODevice::Append | QIODevice::Text); 43 | unsigned char bom[] = {0xEF, 0xBB, 0xBF}; 44 | serial_set_file.write(static_cast(static_cast(bom)), sizeof(bom)); 45 | QTextStream in(&serial_set_file); 46 | in.setCodec("UTF-8"); 47 | in << "{\n"; 48 | in << " \"SerialPort\": \"\",\n"; 49 | in << " \"BaudRate\": \"\",\n"; 50 | in << " \"DataBits\": \"\",\n"; 51 | in << " \"FlowControl\": \"\",\n"; 52 | in << " \"Parity\": \"\",\n"; 53 | in << " \"StopBits\": \"\"\n"; 54 | in << "}"; 55 | serial_set_file.flush(); 56 | serial_set_file.close(); 57 | } 58 | 59 | QString qs_serial_data_file = qs_serial_dir + "/serial.txt"; 60 | QFile serial_data_file(qs_serial_data_file); 61 | if (!serial_data_file.exists()) 62 | { 63 | serial_data_file.open(QIODevice::Append | QIODevice::Text); 64 | unsigned char bom[] = {0xEF, 0xBB, 0xBF}; 65 | serial_data_file.write(static_cast(static_cast(bom)), sizeof(bom)); 66 | QTextStream in(&serial_data_file); 67 | in.setCodec("UTF-8"); 68 | in << QString("# 串口数据\n"); 69 | serial_data_file.flush(); 70 | serial_data_file.close(); 71 | } 72 | } 73 | /* 74 | * 创建日志工作目录 75 | */ 76 | void seimey_data::ceate_Log(void) 77 | { 78 | 79 | QString qs_log_dir = QDir::currentPath() + "/.workspace" + "/.log"; 80 | QDir log_dir(qs_log_dir); 81 | if (!log_dir.exists()) 82 | { 83 | log_dir.mkdir(qs_log_dir); 84 | } 85 | 86 | QString qs_log_file = qs_log_dir + "/seimey.log"; 87 | QFile log_file(qs_log_file); 88 | if (!log_file.exists()) 89 | { 90 | log_file.open(QIODevice::Append | QIODevice::Text); 91 | unsigned char bom[] = {0xEF, 0xBB, 0xBF}; 92 | log_file.write(static_cast(static_cast(bom)), sizeof(bom)); 93 | log_file.flush(); 94 | log_file.close(); 95 | } 96 | } 97 | /* 98 | * 创建设置工作目录 99 | */ 100 | void seimey_data::ceate_Setting(void) 101 | { 102 | 103 | QString qs_set_dir = QDir::currentPath() + "/.workspace" + "/.setting"; 104 | QDir set_dir(qs_set_dir); 105 | if (!set_dir.exists()) 106 | { 107 | set_dir.mkdir(qs_set_dir); 108 | } 109 | 110 | QString qs_setting_file = qs_set_dir + "/setting.json"; 111 | QFile setting_file(qs_setting_file); 112 | if (!setting_file.exists()) 113 | { 114 | setting_file.open(QIODevice::Append | QIODevice::Text); 115 | unsigned char bom[] = {0xEF, 0xBB, 0xBF}; 116 | setting_file.write(static_cast(static_cast(bom)), sizeof(bom)); 117 | QTextStream in(&setting_file); 118 | in.setCodec("UTF-8"); 119 | in << "{\n"; 120 | in << " \"Save serial\": false,\n"; 121 | in << " \"Timed refresh\": 0.5\n"; 122 | in << "}"; 123 | setting_file.flush(); 124 | setting_file.close(); 125 | } 126 | } 127 | /* 128 | * 创建工作目录 129 | */ 130 | void seimey_data::create_Workspace(void) 131 | { 132 | /* create workspace folder */ 133 | QString qs_workspace_dir = QDir::currentPath() + "/.workspace"; 134 | QDir workspace_dir(qs_workspace_dir); 135 | if (!workspace_dir.exists()) 136 | { 137 | workspace_dir.mkdir(qs_workspace_dir); 138 | } 139 | ceate_Serial(); 140 | ceate_Log(); 141 | ceate_Setting(); 142 | } 143 | /* 144 | * 创建插件工作目录 145 | */ 146 | void create_Plugin(void) 147 | { 148 | QString qs_plugin_dir = QDir::currentPath() + "/.plugin"; 149 | QDir plugin_dir(qs_plugin_dir); 150 | if (!plugin_dir.exists()) 151 | { 152 | plugin_dir.mkdir(qs_plugin_dir); 153 | } 154 | } 155 | /* 156 | * 创建目录 157 | */ 158 | void seimey_data::create_Dir(void) 159 | { 160 | create_Workspace(); 161 | create_Plugin(); 162 | } 163 | /* 164 | * 获得是否保存串口数据的标志位 165 | */ 166 | bool seimey_data::get_Is_Save_Serial_Data(void) 167 | { 168 | QJsonParseError jsonError; 169 | 170 | bool is_save_serial_data = false; 171 | QString qs_setting_file = QDir::currentPath() + "/.workspace/.setting/setting.json"; 172 | QFile setting_file(qs_setting_file); 173 | setting_file.open(QIODevice::ReadOnly); 174 | 175 | QJsonDocument setting_json = QJsonDocument::fromJson(setting_file.readAll(), &jsonError); 176 | if (!setting_json.isNull() && (jsonError.error == QJsonParseError::NoError)) 177 | { 178 | QJsonObject setting_json_obj = setting_json.object(); 179 | is_save_serial_data = setting_json_obj.value("Save serial").toBool(); 180 | } 181 | 182 | setting_file.close(); 183 | return is_save_serial_data; 184 | } 185 | /* 186 | * 获得定时器刷新时间 187 | */ 188 | double seimey_data::get_Timed_Refresh_Time(void) 189 | { 190 | QJsonParseError jsonError; 191 | 192 | double timed_refresh_time = 0; 193 | QString qs_setting_file = QDir::currentPath() + "/.workspace/.setting/setting.json"; 194 | QFile setting_file(qs_setting_file); 195 | setting_file.open(QIODevice::ReadOnly); 196 | 197 | QJsonDocument setting_json = QJsonDocument::fromJson(setting_file.readAll(), &jsonError); 198 | if (!setting_json.isNull() && (jsonError.error == QJsonParseError::NoError)) 199 | { 200 | QJsonObject setting_json_obj = setting_json.object(); 201 | timed_refresh_time = setting_json_obj.value("Timed refresh").toDouble(); 202 | } 203 | 204 | setting_file.close(); 205 | return timed_refresh_time; 206 | } 207 | /* 208 | * 保存串口数据 209 | */ 210 | void seimey_data::save_Serial_Data(QByteArray msg) 211 | { 212 | static QString qs_serial_data_file = QDir::currentPath() + "/.workspace" + "/.serial" + "/serial.txt"; 213 | QString time = QDateTime::currentDateTime().toString(QString("[ yyyy-MM-dd HH:mm:ss:zzz ]")); 214 | QFile file(qs_serial_data_file); 215 | file.open(QIODevice::ReadWrite | QIODevice::Append); 216 | QTextStream stream(&file); 217 | stream.setCodec("UTF-8"); 218 | stream << (time + QString(" ")); 219 | stream << msg; 220 | stream << QString("\r\n"); 221 | file.flush(); 222 | file.close(); 223 | } 224 | -------------------------------------------------------------------------------- /src/seimey_dfs.cpp: -------------------------------------------------------------------------------- 1 | #include "seimey_dfs.h" 2 | #include 3 | #include 4 | #include 5 | seimey_dfs::seimey_dfs(QObject *parent) : QObject(parent) 6 | { 7 | connect(timer, SIGNAL(timeout()), this, SLOT(timer_Timeout()), Qt::UniqueConnection); 8 | } 9 | seimey_dfs::~seimey_dfs() 10 | { 11 | 12 | } 13 | /* 14 | * 文件管理器的控制函数 15 | */ 16 | void seimey_dfs::handle(QString msg) 17 | { 18 | if ((event & 0x01) == 0x01) 19 | { 20 | timer->setInterval(100); 21 | timer->start(); 22 | msg_list << msg; 23 | } 24 | } 25 | void seimey_dfs::timer_Timeout() 26 | { 27 | timer->stop(); 28 | event &= 0xfe; 29 | bypass(&msg_list); 30 | msg_list.clear(); 31 | } 32 | void seimey_dfs::bypass(QStringList *list) 33 | { 34 | QString msg = list->at(0); 35 | if (msg.contains(">cd ") && msg.contains("msh")) 36 | { 37 | ctl_ls(list); 38 | } 39 | else if (msg.contains(">cat ") && msg.contains("msh")) 40 | { 41 | ctl_cat(list); 42 | } 43 | } 44 | void seimey_dfs::sleep(int msec) 45 | { 46 | QTime dieTime = QTime::currentTime().addMSecs(msec); 47 | while (QTime::currentTime() < dieTime) 48 | QCoreApplication::processEvents(QEventLoop::AllEvents, 50); 49 | } 50 | 51 | void seimey_dfs::ctl_ls(QStringList *list) 52 | { 53 | if (list->size() >= 5) 54 | { 55 | QString msg = list->at(0); 56 | if (msg.indexOf(">cd /") == (msg.length() - QString(">cd /").length())) 57 | { 58 | ctl_master(list); 59 | } 60 | else if (msg.indexOf(">cd /")) 61 | { 62 | ctl_servant(list); 63 | } 64 | } 65 | } 66 | 67 | void seimey_dfs::ctl_master(QStringList *list) 68 | { 69 | QString msg = list->at(1); 70 | if (msg == QString("msh />")) 71 | { 72 | msg = list->at(2); 73 | if (msg == QString("msh />ls")) 74 | { 75 | if (list->at(1) == list->last()) 76 | { 77 | msg = list->at(3); 78 | if (msg == QString("Directory /:")) 79 | { 80 | for (int j = 4; j < list->size() - 1; j++) 81 | { 82 | msg = list->at(j); 83 | msg = msg.simplified(); 84 | QStringList list_eu = msg.split(" "); 85 | if (list_eu.size() == 2) 86 | { 87 | if (list_eu.at(1) == QString("")) 88 | { 89 | QTreeWidgetItem *child = new QTreeWidgetItem(enumdir); 90 | child->setWhatsThis(0, QString("/")); 91 | child->setText(0, list_eu.at(0)); 92 | child->setIcon(0, QIcon(QString(":/icon/qrc/icon/folder.png"))); 93 | tree_dfs->addTopLevelItem(child); 94 | } 95 | else 96 | { 97 | QTreeWidgetItem *child = new QTreeWidgetItem(enumfile); 98 | child->setWhatsThis(0, QString("/")); 99 | child->setText(0, list_eu.at(0)); 100 | child->setText(1, list_eu.at(1)); 101 | child->setIcon(0, QIcon(QString(":/icon/qrc/icon/file.png"))); 102 | tree_dfs->addTopLevelItem(child); 103 | } 104 | } 105 | } 106 | } 107 | } 108 | } 109 | } 110 | } 111 | 112 | void seimey_dfs::ctl_servant(QStringList *list) 113 | { 114 | QString msg = list->at(0); 115 | QString dir; 116 | int index = msg.indexOf(">cd /"); 117 | dir = msg.remove(0, index + QString(">cd ").length()); 118 | msg = list->at(1); 119 | if (msg == (QString("msh ") + dir + QString(">"))) 120 | { 121 | if (list->at(2) == (list->at(1) + QString("ls"))) 122 | { 123 | if (list->at(1) == list->last()) 124 | { 125 | msg = list->at(3); 126 | if (msg == (QString("Directory ") + dir + QString(":"))) 127 | { 128 | for (int j = 4; j < list->size() - 1; j++) 129 | { 130 | msg = list->at(j); 131 | msg = msg.simplified(); 132 | QStringList list_eu = msg.split(" "); 133 | if (list_eu.size() == 2) 134 | { 135 | 136 | if (list_eu.at(1) == QString("")) 137 | { 138 | QTreeWidgetItem *child = new QTreeWidgetItem(enumdir); 139 | child->setWhatsThis(0, dir + QString("/")); 140 | child->setText(0, list_eu.at(0)); 141 | child->setIcon(0, QIcon(QString(":/icon/qrc/icon/folder.png"))); 142 | tree_dfs_item->addChild(child); 143 | tree_dfs_item->setExpanded(true); 144 | } 145 | else 146 | { 147 | QTreeWidgetItem *child = new QTreeWidgetItem(enumfile); 148 | child->setWhatsThis(0, dir + QString("/")); 149 | child->setText(0, list_eu.at(0)); 150 | child->setText(1, list_eu.at(1)); 151 | child->setIcon(0, QIcon(QString(":/icon/qrc/icon/file.png"))); 152 | tree_dfs_item->addChild(child); 153 | tree_dfs_item->setExpanded(true); 154 | } 155 | } 156 | } 157 | } 158 | } 159 | } 160 | } 161 | } 162 | void seimey_dfs::master(seimey_serial *Serial, QTreeWidget *obj) 163 | { 164 | event |= 0x01; 165 | Serial->send_data((char *)"cd /\r\nls\r\n"); 166 | tree_dfs = obj; 167 | tree_dfs->clear(); 168 | } 169 | void seimey_dfs::servant(seimey_serial *Serial, QTreeWidgetItem *obj) 170 | { 171 | QString aims; 172 | QByteArray aims_byte; 173 | tree_dfs_item = obj; 174 | aims = obj->whatsThis(0) + obj->text(0); 175 | aims_byte = aims.toLatin1(); 176 | if (tree_dfs_item->text(1) == "") 177 | { 178 | QList Children = tree_dfs_item->takeChildren(); 179 | qDeleteAll(Children.begin(), Children.end()); 180 | Children.clear(); 181 | event |= 0x01; 182 | Serial->send_data((char *)"cd "); 183 | Serial->send_data((char *)aims_byte.data()); 184 | Serial->send_data((char *)"\r\nls\r\n"); 185 | } 186 | else if (tree_dfs_item->text(1).toULongLong() != 0) 187 | { 188 | event |= 0x01; 189 | Serial->send_data((char *)"cat "); 190 | Serial->send_data((char *)aims_byte.data()); 191 | Serial->send_data((char *)"\r\n"); 192 | } 193 | } 194 | void seimey_dfs::mkdir(seimey_serial *Serial, QString msg, QTreeWidgetItem *obj) 195 | { 196 | QString aims; 197 | QByteArray aims_byte; 198 | tree_dfs_item = obj; 199 | aims = obj->whatsThis(0) + obj->text(0) + QString("/") + msg; 200 | aims_byte = aims.toLatin1(); 201 | Serial->send_data((char *)"mkdir "); 202 | Serial->send_data((char *)aims_byte.data()); 203 | Serial->send_data((char *)"\r\n"); 204 | sleep(500); 205 | servant(Serial, obj); 206 | } 207 | void seimey_dfs::echo(seimey_serial *Serial, QString name, QString msg, QTreeWidgetItem *obj) 208 | { 209 | QString aims; 210 | QByteArray aims_byte, msg_byte; 211 | tree_dfs_item = obj; 212 | aims = obj->whatsThis(0) + obj->text(0) + QString("/") + name; 213 | aims_byte = aims.toLatin1(); 214 | msg_byte = msg.toLatin1(); 215 | Serial->send_data((char *)"echo "); 216 | Serial->send_data((char *)msg_byte.data()); 217 | Serial->send_data((char *)" "); 218 | Serial->send_data((char *)aims_byte.data()); 219 | Serial->send_data((char *)"\r\n"); 220 | sleep(500); 221 | servant(Serial, obj); 222 | } 223 | void seimey_dfs::mastermkdir(seimey_serial *Serial, QString msg, QTreeWidget *obj) 224 | { 225 | QByteArray msg_byte; 226 | tree_dfs = obj; 227 | msg_byte = msg.toLatin1(); 228 | Serial->send_data((char *)"mkdir /"); 229 | Serial->send_data((char *)msg_byte.data()); 230 | Serial->send_data((char *)"\r\n"); 231 | sleep(500); 232 | master(Serial, obj); 233 | } 234 | void seimey_dfs::masterecho(seimey_serial *Serial, QString name, QString msg, QTreeWidget *obj) 235 | { 236 | QByteArray name_byte, msg_byte; 237 | tree_dfs = obj; 238 | name_byte = name.toLatin1(); 239 | msg_byte = msg.toLatin1(); 240 | Serial->send_data((char *)"echo "); 241 | Serial->send_data((char *)msg_byte.data()); 242 | Serial->send_data((char *)" /"); 243 | Serial->send_data((char *)name_byte.data()); 244 | Serial->send_data((char *)"\r\n"); 245 | sleep(500); 246 | master(Serial, obj); 247 | } 248 | void seimey_dfs::rm(seimey_serial *Serial, QTreeWidgetItem *obj1, QTreeWidget *obj2) 249 | { 250 | QString aims; 251 | QByteArray aims_byte; 252 | aims = obj1->whatsThis(0) + obj1->text(0); 253 | aims_byte = aims.toLatin1(); 254 | Serial->send_data((char *)"rm "); 255 | Serial->send_data((char *)aims_byte.data()); 256 | Serial->send_data((char *)"\r\n"); 257 | sleep(500); 258 | 259 | if (obj1->parent() != nullptr) 260 | { 261 | tree_dfs_item = obj1->parent(); 262 | servant(Serial, tree_dfs_item); 263 | } 264 | else 265 | { 266 | master(Serial, obj2); 267 | } 268 | } 269 | void seimey_dfs::cp(seimey_serial *Serial, QString src, QString pur, QTreeWidgetItem *obj1, QTreeWidget *obj2) 270 | { 271 | QByteArray src_byte, pur_byte; 272 | src_byte = src.toLatin1(); 273 | pur_byte = pur.toLatin1(); 274 | Serial->send_data((char *)"cp "); 275 | Serial->send_data((char *)src_byte.data()); 276 | Serial->send_data((char *)" "); 277 | Serial->send_data((char *)pur_byte.data()); 278 | Serial->send_data((char *)"\r\n"); 279 | sleep(500); 280 | if (obj1->parent() != nullptr) 281 | { 282 | tree_dfs_item = obj1->parent(); 283 | servant(Serial, tree_dfs_item); 284 | } 285 | else 286 | { 287 | master(Serial, obj2); 288 | } 289 | } 290 | void seimey_dfs::mastercp(seimey_serial *Serial, QString src, QTreeWidget *obj) 291 | { 292 | QByteArray src_byte; 293 | src_byte = src.toLatin1(); 294 | Serial->send_data((char *)"cp "); 295 | Serial->send_data((char *)src_byte.data()); 296 | Serial->send_data((char *)" /"); 297 | Serial->send_data((char *)"\r\n"); 298 | sleep(500); 299 | master(Serial, obj); 300 | } 301 | void seimey_dfs::ctl_cat(QStringList *list) 302 | { 303 | if (list->size() >= 2) 304 | { 305 | QString head, msg; 306 | msg = list->at(0); 307 | head = msg.left(msg.indexOf("cat /")); 308 | if (head.contains("msh") && head.contains(">")) 309 | { 310 | msg.clear(); 311 | for (int i = 1 ; i < list->size(); i++) 312 | { 313 | msg += list->at(i); 314 | } 315 | if (msg.contains(head)) 316 | { 317 | int index = msg.indexOf(head); 318 | if (index == msg.length() - head.length()) 319 | { 320 | msg = msg.left(index); 321 | if (c_Seimey_text == nullptr) 322 | { 323 | c_Seimey_text = new seimey_text(); 324 | connect(c_Seimey_text, &seimey_text::window_Close, [ = ]() 325 | { 326 | c_Seimey_text = nullptr; 327 | }); 328 | c_Seimey_text->show(); 329 | c_Seimey_text->show_text(msg); 330 | } 331 | } 332 | } 333 | } 334 | } 335 | } 336 | -------------------------------------------------------------------------------- /src/seimey_finsh.cpp: -------------------------------------------------------------------------------- 1 | #include "seimey_finsh.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | seimey_finsh::seimey_finsh(QObject *parent) : QObject(parent) 7 | { 8 | connect(timer, SIGNAL(timeout()), this, SLOT(timer_Timeout()), Qt::UniqueConnection);//定时器超时链接函数 9 | } 10 | void seimey_finsh::handle(QString msg)/* 任务管理器的控制函数 */ 11 | { 12 | if ((event & 0x01) == 0x01) 13 | { 14 | timer->setInterval(100); //设置定时器的超时事件是 100ms 15 | timer->start(); 16 | msg_list << msg; //插入 msg 17 | } 18 | } 19 | 20 | //定时器超时函数 21 | void seimey_finsh::timer_Timeout() 22 | { 23 | timer->stop(); 24 | event &= 0xfe; 25 | 26 | bypass(&msg_list); 27 | 28 | msg_list.clear();//清空 msg_list 29 | } 30 | 31 | //对 list 进行处理 32 | void seimey_finsh::bypass(QStringList *list) 33 | { 34 | //这个函数只对 size = 3 和 4 进行了处理 todo 35 | if (list->size() == 3) 36 | { 37 | if (list->at(1).contains(QString("command not found."))) 38 | { 39 | return; 40 | } 41 | } 42 | if (list->size() >= 4) 43 | { 44 | QString msg = list->at(0);// 找到list 中的第一个字符串 45 | //必须同时包含两个字符串 46 | if (msg.contains(">list_thread") && msg.contains("msh ")) 47 | { 48 | ctl_thread(list); 49 | } 50 | else if (msg.contains(">list_device") && msg.contains("msh ")) 51 | { 52 | ctl_device(list); 53 | } 54 | else if (msg.contains(">list_timer") && msg.contains("msh ")) 55 | { 56 | ctl_timer(list); 57 | } 58 | else if (msg.contains(">list_mempool") && msg.contains("msh ")) 59 | { 60 | ctl_mem_pool(list); 61 | } 62 | else if (msg.contains(">list_memheap") && msg.contains("msh ")) 63 | { 64 | ctl_mem_heap(list); 65 | } 66 | else if (msg.contains(">free") && msg.contains("msh ")) 67 | { 68 | ctl_mem_free(list); 69 | } 70 | else if (msg.contains(">list_sem") && msg.contains("msh ")) 71 | { 72 | ctl_synchr_sem(list); 73 | } 74 | else if (msg.contains(">list_mutex") && msg.contains("msh ")) 75 | { 76 | ctl_synchr_mutex(list); 77 | } 78 | else if (msg.contains(">list_event") && msg.contains("msh ")) 79 | { 80 | ctl_synchr_event(list); 81 | } 82 | else if (msg.contains(">list_mailbox") && msg.contains("msh ")) 83 | { 84 | ctl_commun_mail(list); 85 | } 86 | } 87 | } 88 | /* 89 | * finsh Thread 90 | */ 91 | void seimey_finsh::thread(seimey_serial *Serial, QTableWidget *obj) 92 | { 93 | event |= 0x01; 94 | Serial->send_data("list_thread\r\n"); 95 | tree_thread = obj; 96 | } 97 | 98 | void seimey_finsh::widget_sort(int index) 99 | { 100 | if(index == 1) 101 | { 102 | if(thread_sort) 103 | thread_sort = false; 104 | else thread_sort = true; 105 | } 106 | } 107 | 108 | bool SortOrder(const QString &s1, const QString &s2) 109 | { 110 | QString s_s1, s_s2; 111 | QStringList l_s1,l_s2; 112 | 113 | s_s1 = s1.simplified(); 114 | l_s1 = s_s1.split(QString(" ")); 115 | 116 | s_s2 = s2.simplified(); 117 | l_s2 = s_s2.split(QString(" ")); 118 | 119 | if(l_s1.at(1).toInt() < l_s2.at(1).toInt()) return true; 120 | else 121 | return false; 122 | } 123 | 124 | bool SortReverse(const QString &s1, const QString &s2) 125 | { 126 | QString s_s1, s_s2; 127 | QStringList l_s1,l_s2; 128 | 129 | s_s1 = s1.simplified(); 130 | l_s1 = s_s1.split(QString(" ")); 131 | 132 | s_s2 = s2.simplified(); 133 | l_s2 = s_s2.split(QString(" ")); 134 | 135 | if(l_s1.at(1).toInt() > l_s2.at(1).toInt()) return true; 136 | else 137 | return false; 138 | } 139 | 140 | void seimey_finsh::ctl_thread(QStringList *list) 141 | { 142 | QString head, msg; 143 | QStringList f_list; 144 | 145 | msg = list->at(0); 146 | head = msg.left(msg.length() - QString("list_thread").length()); 147 | msg = list->last(); //列表中的最后一个字符串 148 | 149 | for(int a = 3; a < list->size() - 1; a++) { 150 | f_list.append(list->at(a)); 151 | } 152 | 153 | if(thread_sort) 154 | std::sort(f_list.begin(),f_list.end(), SortOrder); 155 | else 156 | std::sort(f_list.begin(),f_list.end(), SortReverse); 157 | 158 | if (msg == head) //第一个和最后一个 都是 "msh >" 表示报文接收完毕 159 | { 160 | int index = 0; 161 | 162 | tree_thread->setRowCount(list->size() - 4); 163 | 164 | for (int i = 0; i < list->size() - 4; i++) 165 | { 166 | msg = f_list.at(i); 167 | msg = msg.simplified(); 168 | QStringList list_eu = msg.split(QString(" ")); 169 | 170 | if (list_eu.size() >= 8) 171 | { 172 | QTableWidgetItem *child = tree_thread->item(index, 0); 173 | if (!child) { 174 | child = new QTableWidgetItem(); 175 | tree_thread->setItem(index, 0, child); 176 | } 177 | QString Icon = QString(":/icon/qrc/icon/thread_obj_") + QString::number(i % 3) + QString(".png"); 178 | 179 | child->setIcon(QIcon(Icon)); 180 | child->setText(list_eu.at(0)); 181 | 182 | for(int j = 1; j < 8; j++) 183 | { 184 | QTableWidgetItem *child_Item = tree_thread->item(index, j); 185 | if (!child_Item) { 186 | child_Item = new QTableWidgetItem(); 187 | tree_thread->setItem(index, j, child_Item); 188 | } 189 | child_Item->setText(list_eu.at(j)); 190 | child_Item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter); 191 | } 192 | 193 | index++; 194 | } 195 | } 196 | } 197 | } 198 | /* 199 | * finsh Device 200 | */ 201 | void seimey_finsh::device(seimey_serial *Serial, QTreeWidget *obj) 202 | { 203 | event |= 0x01; 204 | Serial->send_data("list_device\r\n"); 205 | tree_device = obj; 206 | } 207 | void seimey_finsh::ctl_device(QStringList *list) 208 | { 209 | QString head, msg; 210 | msg = list->at(0); 211 | head = msg.left(msg.length() - QString("list_device").length()); 212 | msg = list->last(); 213 | if (msg == head) 214 | { 215 | tree_device->clear(); 216 | for (int i = 3; i < list->size(); i++) 217 | { 218 | msg = list->at(i); 219 | msg = msg.simplified(); 220 | QStringList list_eu = msg.split(QString(" ")); 221 | 222 | QTreeWidgetItem *child = tree_device->currentItem(); 223 | if(!child){ 224 | child = new QTreeWidgetItem(); 225 | } 226 | QString Icon = QString(":/icon/qrc/icon/device_") + QString::number(i % 3) + QString(".png"); 227 | child->setIcon(0, QIcon(Icon)); 228 | if (list_eu.size() == 4) 229 | { 230 | child->setText(2, list_eu.at(3)); 231 | child->setText(1, list_eu.at(1) + QString(" ") + list_eu.at(2)); 232 | child->setText(0, list_eu.at(0)); 233 | tree_device->addTopLevelItem(child); 234 | } 235 | if (list_eu.size() == 3) 236 | { 237 | for (int j = 2; j >= 0; j--) 238 | { 239 | child->setText(j, list_eu.at(j)); 240 | } 241 | tree_device->addTopLevelItem(child); 242 | } 243 | } 244 | } 245 | } 246 | void seimey_finsh::time(seimey_serial *Serial, QTreeWidget *obj, QLineEdit *line) 247 | { 248 | event |= 0x01; 249 | Serial->send_data("list_timer\r\n"); 250 | tree_timer = obj; 251 | line_timer = line; 252 | } 253 | void seimey_finsh::ctl_timer(QStringList *list) 254 | { 255 | QString head, msg; 256 | msg = list->at(0); 257 | head = msg.left(msg.length() - QString("list_timer").length()); 258 | msg = list->last(); 259 | if (msg == head) 260 | { 261 | tree_timer->clear(); 262 | line_timer->setText(QString("********")); 263 | for (int i = 3; i < list->size() - 2; i++) 264 | { 265 | msg = list->at(i); 266 | msg = msg.simplified(); 267 | QStringList list_eu = msg.split(QString(" ")); 268 | if (list_eu.size() >= 4) 269 | { 270 | QTreeWidgetItem *child = tree_timer->currentItem(); 271 | if(!child){ 272 | child = new QTreeWidgetItem(); 273 | } 274 | QString Icon = QString(":/icon/qrc/icon/timer_") + QString::number(i % 3) + QString(".png"); 275 | child->setIcon(0, QIcon(Icon)); 276 | int index = 3; 277 | for (int j = list_eu.size() - 1; j >= list_eu.size() - 4; j--) 278 | { 279 | child->setText(index--, list_eu.at(j)); 280 | } 281 | tree_timer->addTopLevelItem(child); 282 | } 283 | } 284 | msg = list->at(list->size() - 2); 285 | if (msg.contains(QString("current tick:"))) 286 | { 287 | msg = msg.remove(0, 13); 288 | line_timer->setText(msg); 289 | } 290 | } 291 | } 292 | void seimey_finsh::mem_pool(seimey_serial *Serial, QTreeWidget *obj) 293 | { 294 | event |= 0x01; 295 | Serial->send_data("list_mempool\r\n"); 296 | tree_mem_pool = obj; 297 | } 298 | void seimey_finsh::ctl_mem_pool(QStringList *list) 299 | { 300 | QString head, msg; 301 | msg = list->at(0); 302 | head = msg.left(msg.length() - QString("list_mempool").length()); 303 | msg = list->last(); 304 | if (msg == head) 305 | { 306 | tree_mem_pool->clear(); 307 | for (int i = 3; i < list->size() - 1; i++) 308 | { 309 | msg = list->at(i); 310 | msg = msg.simplified(); 311 | QStringList list_eu = msg.split(QString(" ")); 312 | if (list_eu.size() >= 5) 313 | { 314 | int index = 4; 315 | QTreeWidgetItem *child = tree_mem_pool->currentItem(); 316 | if(!child){ 317 | child = new QTreeWidgetItem(); 318 | } 319 | for (int j = list_eu.size() - 1; j >= list_eu.size() - 5; j--) 320 | { 321 | child->setText(index--, list_eu.at(j)); 322 | } 323 | tree_mem_pool->addTopLevelItem(child); 324 | } 325 | } 326 | } 327 | } 328 | void seimey_finsh::mem_heap(seimey_serial *Serial, QTreeWidget *obj) 329 | { 330 | event |= 0x01; 331 | Serial->send_data("list_memheap\r\n"); 332 | tree_mem_heap = obj; 333 | } 334 | void seimey_finsh::ctl_mem_heap(QStringList *list) 335 | { 336 | QString head, msg; 337 | msg = list->at(0); 338 | head = msg.left(msg.length() - QString("list_memheap").length()); 339 | msg = list->last(); 340 | if (msg == head) 341 | { 342 | if (list->at(2).contains("----")) 343 | { 344 | tree_mem_heap->clear(); 345 | for (int i = 3; i < list->size() - 1; i++) 346 | { 347 | msg = list->at(i); 348 | msg = msg.simplified(); 349 | QStringList list_eu = msg.split(QString(" ")); 350 | if (list_eu.size() >= 4) 351 | { 352 | int index = 3; 353 | QTreeWidgetItem *child = tree_mem_heap->currentItem(); 354 | if(!child){ 355 | child = new QTreeWidgetItem(); 356 | } 357 | for (int j = list_eu.size() - 1; j >= list_eu.size() - 4; j--) 358 | { 359 | child->setText(index--, list_eu.at(j)); 360 | } 361 | tree_mem_heap->addTopLevelItem(child); 362 | } 363 | } 364 | } 365 | } 366 | } 367 | void seimey_finsh::mem_free(seimey_serial *Serial, ProgressWater *obj, QLabel *total, QLabel *max, QLabel *current) 368 | { 369 | event |= 0x01; 370 | Serial->send_data("free\r\n"); 371 | progresswater = obj; 372 | label_total = total; 373 | label_max = max; 374 | label_current = current; 375 | } 376 | 377 | void seimey_finsh::ctl_mem_free(QStringList *list) 378 | { 379 | QString head, msg; 380 | msg = list->at(0); 381 | head = msg.left(msg.length() - QString("free").length()); 382 | msg = list->last(); 383 | uint64_t max = 0; 384 | uint64_t total = 0; 385 | uint64_t current = 0; 386 | int pro = 0; 387 | if (msg == head) 388 | { 389 | progresswater->setValue(0); 390 | label_max->setText(QString("*******")); 391 | label_total->setText(QString("*******")); 392 | label_current->setText(QString("*******")); 393 | if (list->at(1).contains(QString("total memory:"))) 394 | { 395 | if (list->size() == 5) 396 | { 397 | msg = list->at(1); 398 | if (msg.contains("total memory: ")) 399 | { 400 | msg = msg.remove(0, QString("total memory: ").length()); 401 | total = static_cast(msg.toLongLong()); 402 | } 403 | msg = list->at(2); 404 | if (msg.contains("used memory : ")) 405 | { 406 | msg = msg.remove(0, QString("used memory : ").length()); 407 | current = total - msg.toULongLong(); 408 | } 409 | msg = list->at(3); 410 | if (msg.contains("maximum allocated memory: ")) 411 | { 412 | msg = msg.remove(0, QString("maximum allocated memory: ").length()); 413 | max = msg.toULongLong(); 414 | } 415 | } 416 | if (total == 0) 417 | { 418 | pro = 0; 419 | } 420 | else 421 | { 422 | pro = 100 - static_cast((current * 100) / total); 423 | } 424 | if (progresswater->getValue() != pro) 425 | { 426 | progresswater->setValue(pro); 427 | } 428 | label_max->setText(QString::number(max)); 429 | label_total->setText(QString::number(total)); 430 | label_current->setText(QString::number(current)); 431 | } 432 | else if (list->at(2).contains(QString("----"))) 433 | { 434 | for (int i = 3; i < list->size() - 1; i++) 435 | { 436 | msg = list->at(i); 437 | msg = msg.simplified(); 438 | QStringList list_eu = msg.split(QString(" ")); 439 | if (list_eu.size() >= 4) 440 | { 441 | total += list_eu.at(list_eu.size() - 3).toULongLong(); 442 | max += list_eu.at(list_eu.size() - 2).toULongLong(); 443 | current += list_eu.at(list_eu.size() - 1).toULongLong(); 444 | } 445 | } 446 | if (total == 0) 447 | { 448 | pro = 0; 449 | } 450 | else 451 | { 452 | pro = 100 - static_cast((current * 100) / total); 453 | } 454 | if (progresswater->getValue() != pro) 455 | { 456 | progresswater->setValue(pro); 457 | } 458 | label_max->setText(QString::number(max)); 459 | label_total->setText(QString::number(total)); 460 | label_current->setText(QString::number(current)); 461 | } 462 | } 463 | } 464 | void seimey_finsh::synchr_sem(seimey_serial *Serial, QTreeWidget *obj) 465 | { 466 | event |= 0x01; 467 | Serial->send_data("list_sem\r\n"); 468 | tree_synchr_sem = obj; 469 | } 470 | void seimey_finsh::ctl_synchr_sem(QStringList *list) 471 | { 472 | QString head, msg; 473 | msg = list->at(0); 474 | head = msg.left(msg.length() - QString("list_sem").length()); 475 | msg = list->last(); 476 | if (msg == head) 477 | { 478 | tree_synchr_sem->clear(); 479 | for (int i = 3; i < list->size() - 1; i++) 480 | { 481 | msg = list->at(i); 482 | msg = msg.simplified(); 483 | QStringList list_eu = msg.split(QString(" ")); 484 | if (list_eu.size() >= 3) 485 | { 486 | int index = 2; 487 | QTreeWidgetItem *child = tree_synchr_sem->currentItem(); 488 | if(!child){ 489 | child = new QTreeWidgetItem(); 490 | } 491 | for (int j = list_eu.size() - 1; j >= list_eu.size() - 3; j--) 492 | { 493 | child->setText(index--, list_eu.at(j)); 494 | } 495 | tree_synchr_sem->addTopLevelItem(child); 496 | } 497 | } 498 | } 499 | } 500 | void seimey_finsh::synchr_mutex(seimey_serial *Serial, QTreeWidget *obj) 501 | { 502 | event |= 0x01; 503 | Serial->send_data("list_mutex\r\n"); 504 | tree_synchr_mutex = obj; 505 | } 506 | void seimey_finsh::ctl_synchr_mutex(QStringList *list) 507 | { 508 | QString head, msg; 509 | msg = list->at(0); 510 | head = msg.left(msg.length() - QString("list_mutex").length()); 511 | msg = list->last(); 512 | if (msg == head) 513 | { 514 | tree_synchr_mutex->clear(); 515 | for (int i = 3; i < list->size() - 1; i++) 516 | { 517 | msg = list->at(i); 518 | msg = msg.simplified(); 519 | QStringList list_eu = msg.split(QString(" ")); 520 | if (list_eu.size() >= 4) 521 | { 522 | int index = 3; 523 | QTreeWidgetItem *child = tree_synchr_mutex->currentItem(); 524 | if(!child){ 525 | child = new QTreeWidgetItem(); 526 | } 527 | for (int j = list_eu.size() - 1; j >= list_eu.size() - 4; j--) 528 | { 529 | child->setText(index--, list_eu.at(j)); 530 | } 531 | tree_synchr_mutex->addTopLevelItem(child); 532 | } 533 | } 534 | } 535 | } 536 | void seimey_finsh::synchr_event(seimey_serial *Serial, QTreeWidget *obj) 537 | { 538 | event |= 0x01; 539 | Serial->send_data("list_event\r\n"); 540 | tree_synchr_event = obj; 541 | } 542 | void seimey_finsh::ctl_synchr_event(QStringList *list) 543 | { 544 | QString head, msg; 545 | msg = list->at(0); 546 | head = msg.left(msg.length() - QString("list_event").length()); 547 | msg = list->last(); 548 | if (msg == head) 549 | { 550 | tree_synchr_event->clear(); 551 | for (int i = 3; i < list->size() - 1; i++) 552 | { 553 | msg = list->at(i); 554 | msg = msg.simplified(); 555 | QStringList list_eu = msg.split(QString(" ")); 556 | if (list_eu.size() >= 3) 557 | { 558 | int index = 2; 559 | QTreeWidgetItem *child = tree_synchr_event->currentItem(); 560 | if(!child){ 561 | child = new QTreeWidgetItem(); 562 | } 563 | for (int j = list_eu.size() - 1; j >= list_eu.size() - 3; j--) 564 | { 565 | child->setText(index--, list_eu.at(j)); 566 | } 567 | tree_synchr_event->addTopLevelItem(child); 568 | } 569 | } 570 | } 571 | } 572 | void seimey_finsh::commun_mail(seimey_serial *Serial, QTreeWidget *obj) 573 | { 574 | event |= 0x01; 575 | Serial->send_data("list_mailbox\r\n"); 576 | tree_commun_mail = obj; 577 | } 578 | void seimey_finsh::ctl_commun_mail(QStringList *list) 579 | { 580 | QString head, msg; 581 | msg = list->at(0); 582 | head = msg.left(msg.length() - QString("list_mailbox").length()); 583 | msg = list->last(); 584 | if (msg == head) 585 | { 586 | tree_commun_mail->clear(); 587 | for (int i = 3; i < list->size() - 1; i++) 588 | { 589 | msg = list->at(i); 590 | msg = msg.simplified(); 591 | QStringList list_eu = msg.split(QString(" ")); 592 | if (list_eu.size() >= 4) 593 | { 594 | int index = 3; 595 | QTreeWidgetItem *child = tree_commun_mail->currentItem(); 596 | if(!child){ 597 | child = new QTreeWidgetItem(); 598 | } 599 | for (int j = list_eu.size() - 1; j >= list_eu.size() - 4; j--) 600 | { 601 | child->setText(index--, list_eu.at(j)); 602 | } 603 | tree_commun_mail->addTopLevelItem(child); 604 | } 605 | } 606 | } 607 | } 608 | void seimey_finsh::commun_queue(seimey_serial *Serial, QTreeWidget *obj) 609 | { 610 | event |= 0x01; 611 | Serial->send_data("list_msgqueue\r\n"); 612 | tree_commun_queue = obj; 613 | } 614 | void seimey_finsh::ctl_commun_queue(QStringList *list) 615 | { 616 | QString head, msg; 617 | msg = list->at(0); 618 | head = msg.left(msg.length() - QString("list_msgqueue").length()); 619 | msg = list->last(); 620 | if (msg == head) 621 | { 622 | tree_commun_queue->clear(); 623 | for (int i = 3; i < list->size() - 1; i++) 624 | { 625 | msg = list->at(i); 626 | msg = msg.simplified(); 627 | QStringList list_eu = msg.split(QString(" ")); 628 | if (list_eu.size() >= 3) 629 | { 630 | int index = 2; 631 | QTreeWidgetItem *child = tree_commun_queue->currentItem(); 632 | if(!child){ 633 | child = new QTreeWidgetItem(); 634 | } 635 | for (int j = list_eu.size() - 1; j >= list_eu.size() - 3; j--) 636 | { 637 | child->setText(index--, list_eu.at(j)); 638 | } 639 | tree_commun_queue->addTopLevelItem(child); 640 | } 641 | } 642 | } 643 | } 644 | void seimey_finsh::sleep(int msec) 645 | { 646 | QTime dieTime = QTime::currentTime().addMSecs(msec); 647 | while (QTime::currentTime() < dieTime) 648 | QCoreApplication::processEvents(QEventLoop::AllEvents, 50); 649 | } 650 | -------------------------------------------------------------------------------- /src/seimey_plugin.cpp: -------------------------------------------------------------------------------- 1 | #include "seimey_plugin.h" 2 | #include 3 | #include 4 | seimey_plugin::seimey_plugin(QObject *parent) : QObject(parent) 5 | { 6 | 7 | } 8 | 9 | void seimey_plugin::set_plugin(QTreeWidget *obj) 10 | { 11 | obj->clear(); 12 | QString qs_plugin_dir = QDir::currentPath() + "/.plugin"; 13 | QDir plugin_dir(qs_plugin_dir); 14 | QFileInfoList fileInfoList = plugin_dir.entryInfoList(QDir::Files);/* 获取文件列表 */ 15 | for (int i = 0; i < fileInfoList.size(); i++) 16 | { 17 | QFileInfo fileInfo = fileInfoList.at(i); 18 | if (fileInfo.suffix() == "dll")/* 判断文件后缀 */ 19 | { 20 | QTreeWidgetItem *child = new QTreeWidgetItem(); 21 | QString icon = ":/icon/qrc/icon/plugin_" + QString::number(i % 3) + ".png"; 22 | /* 设置节点信息 */ 23 | child->setText(0, fileInfo.baseName()); 24 | child->setIcon(0, QIcon(icon)); 25 | obj->addTopLevelItem(child); 26 | } 27 | } 28 | } 29 | 30 | void seimey_plugin::rec_msg(QByteArray msg) 31 | { 32 | if (_pgdut_fsae_interface != nullptr) 33 | { 34 | _pgdut_fsae_interface->rec_msg(msg); 35 | } 36 | } 37 | 38 | 39 | void seimey_plugin::open_plugin(QTreeWidgetItem *obj) 40 | { 41 | QString qs_plugin_path = QDir::currentPath() + "/.plugin/" + obj->text(0) + ".dll"; 42 | 43 | if (!QFile::exists(qs_plugin_path)) 44 | { 45 | /* 如果插件不存在,将退出 */ 46 | QByteArray qb_plugin_path = qs_plugin_path.toLatin1(); 47 | qDebug() << "Not exist file: " << qb_plugin_path.data(); 48 | return; 49 | } 50 | 51 | QPluginLoader pluginLoader(qs_plugin_path);/* 插件对象 */ 52 | pluginLoader.load();/* 加载插件 */ 53 | QObject *pPlugin = pluginLoader.instance();/* 获取插件的根组件对象 */ 54 | loader_plugin(pPlugin); 55 | } 56 | 57 | void seimey_plugin::loader_plugin(QObject *obj) 58 | { 59 | if (obj) 60 | { 61 | QString pluginName = obj->metaObject()->className();/* 获取插件的类名 */ 62 | int index = plugin_list.indexOf(pluginName);/* 获取插件类名在插件列表的位置 */ 63 | if (index >= 0) 64 | { 65 | switch (index) 66 | { 67 | case PLUGIN_GDUT_FSAE: 68 | loader_gdut_fsae_plugin(obj); 69 | break; 70 | default: 71 | break; 72 | } 73 | } 74 | } 75 | } 76 | void seimey_plugin::loader_gdut_fsae_plugin(QObject *obj) 77 | { 78 | if (_pgdut_fsae_interface == nullptr) 79 | { 80 | _pgdut_fsae_interface = qobject_cast(obj); 81 | if (_pgdut_fsae_interface != nullptr) 82 | { 83 | connect(obj, SIGNAL(plugin_close(QString)), this, SLOT(close_event_collect(QString)), Qt::UniqueConnection); 84 | connect(obj, SIGNAL(send_msg(QByteArray)), this, SLOT(forward_msg(QByteArray)), Qt::UniqueConnection); 85 | _pgdut_fsae_interface->show(); 86 | } 87 | } 88 | } 89 | void seimey_plugin::close_event_collect(QString msg) 90 | { 91 | int index = plugin_list.indexOf(msg); 92 | if (index >= 0) 93 | { 94 | switch (index) 95 | { 96 | case PLUGIN_GDUT_FSAE: 97 | _pgdut_fsae_interface = nullptr; 98 | break; 99 | } 100 | } 101 | } 102 | 103 | 104 | void seimey_plugin::forward_msg(QByteArray msg) 105 | { 106 | qDebug() << "1" << msg; 107 | emit send_msg(msg); 108 | } 109 | -------------------------------------------------------------------------------- /src/seimey_serial.cpp: -------------------------------------------------------------------------------- 1 | #include "seimey_serial.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | /* serial base info */ 10 | typedef struct 11 | { 12 | QString SerialPort; 13 | QString BaudRate; 14 | QString FlowControl; 15 | QString Parity; 16 | QString StopBits; 17 | QString DataBits; 18 | } serial_baseinfo_t; 19 | 20 | 21 | static QSerialPort *serialport;/* serial object */ 22 | static serial_baseinfo_t serial_baseinfo;/* serial base info */ 23 | 24 | seimey_serial::seimey_serial(QObject *parent) : QObject(parent) 25 | { 26 | serialport = new QSerialPort(this); 27 | connect(serialport, SIGNAL(readyRead()), this, SLOT(serial_read_data()), Qt::UniqueConnection); 28 | connect(serialport, SIGNAL(errorOccurred(QSerialPort::SerialPortError)), this, SLOT(serial_error(QSerialPort::SerialPortError)), Qt::UniqueConnection); 29 | } 30 | 31 | void get_serial_info(serial_baseinfo_t *baseinfo) 32 | { 33 | QJsonParseError jsonError; 34 | 35 | QString qs_serial_file = QDir::currentPath() + "/.workspace/.serial/serial.json"; 36 | QFile serial_file(qs_serial_file); 37 | serial_file.open(QIODevice::ReadOnly); 38 | 39 | QJsonDocument serial_json = QJsonDocument::fromJson(serial_file.readAll(), &jsonError); 40 | if (!serial_json.isNull() && (jsonError.error == QJsonParseError::NoError)) 41 | { 42 | QJsonObject serial_json_obj = serial_json.object(); 43 | baseinfo->BaudRate = serial_json_obj.value("BaudRate").toString(); 44 | baseinfo->Parity = serial_json_obj.value("Parity").toString(); 45 | baseinfo->StopBits = serial_json_obj.value("StopBits").toString(); 46 | baseinfo->FlowControl = serial_json_obj.value("FlowControl").toString(); 47 | baseinfo->DataBits = serial_json_obj.value("DataBits").toString(); 48 | baseinfo->SerialPort = serial_json_obj.value("SerialPort").toString(); 49 | } 50 | serial_file.close(); 51 | } 52 | 53 | 54 | static void open_serial(serial_baseinfo_t *baseinfo) 55 | { 56 | if (!serialport->isOpen()) 57 | { 58 | serialport->setPortName(baseinfo->SerialPort); 59 | 60 | serialport->setBaudRate(baseinfo->BaudRate.toInt()); 61 | 62 | QSerialPort::DataBits DataBits; 63 | switch (baseinfo->DataBits.toInt()) 64 | { 65 | case 8: 66 | DataBits = QSerialPort::Data8; 67 | break; 68 | case 7: 69 | DataBits = QSerialPort::Data7; 70 | break; 71 | case 6: 72 | DataBits = QSerialPort::Data6; 73 | break; 74 | case 5: 75 | DataBits = QSerialPort::Data5; 76 | break; 77 | default: 78 | DataBits = QSerialPort::Data8; 79 | break; 80 | } 81 | serialport->setDataBits(DataBits); 82 | 83 | QSerialPort::Parity Parity; 84 | if (baseinfo->Parity == QString("无校验")) 85 | Parity = QSerialPort::NoParity; 86 | else if (baseinfo->Parity == QString("奇校验")) 87 | Parity = QSerialPort::OddParity; 88 | else if (baseinfo->Parity == QString("偶校验")) 89 | Parity = QSerialPort::EvenParity; 90 | else if (baseinfo->Parity == QString("1校验")) 91 | Parity = QSerialPort::MarkParity; 92 | else if (baseinfo->Parity == QString("0校验")) 93 | Parity = QSerialPort::SpaceParity; 94 | else 95 | Parity = QSerialPort::NoParity; 96 | serialport->setParity(Parity); 97 | 98 | QSerialPort::StopBits StopBits; 99 | if (baseinfo->StopBits == QString("1.0")) 100 | StopBits = QSerialPort::OneStop; 101 | else if (baseinfo->StopBits == QString("1.0")) 102 | StopBits = QSerialPort::OneAndHalfStop; 103 | else if (baseinfo->StopBits == QString("1.0")) 104 | StopBits = QSerialPort::TwoStop; 105 | else 106 | StopBits = QSerialPort::OneStop; 107 | serialport->setStopBits(StopBits); 108 | 109 | QSerialPort::FlowControl FlowControl; 110 | if (baseinfo->FlowControl == QString("无流控")) 111 | FlowControl = QSerialPort::NoFlowControl; 112 | else if (baseinfo->FlowControl == QString("硬流控")) 113 | FlowControl = QSerialPort::HardwareControl; 114 | else if (baseinfo->FlowControl == QString("软流控")) 115 | FlowControl = QSerialPort::SoftwareControl; 116 | else 117 | FlowControl = QSerialPort::NoFlowControl; 118 | serialport->setFlowControl(FlowControl); 119 | serialport->open(QIODevice::ReadWrite); 120 | } 121 | 122 | } 123 | 124 | static void close_serial(void) 125 | { 126 | if (serialport->isOpen()) 127 | { 128 | serialport->clear(); 129 | serialport->close(); 130 | } 131 | } 132 | 133 | 134 | bool seimey_serial::set_serial_link(bool status) 135 | { 136 | static QMutex mutex; 137 | mutex.lock(); 138 | get_serial_info(&serial_baseinfo); 139 | if (status) 140 | { 141 | open_serial(&serial_baseinfo); 142 | } 143 | else 144 | { 145 | close_serial(); 146 | } 147 | mutex.unlock(); 148 | return serialport->isOpen(); 149 | } 150 | 151 | QString seimey_serial::get_seial_port(void) 152 | { 153 | return serial_baseinfo.SerialPort; 154 | } 155 | 156 | QString seimey_serial::get_seial_baud(void) 157 | { 158 | return serial_baseinfo.BaudRate; 159 | } 160 | void seimey_serial::serial_read_data(void) 161 | { 162 | static QMutex mutex; 163 | mutex.lock(); 164 | QByteArray info = serialport->readAll(); 165 | msg += info; 166 | while (msg.contains("\n")) 167 | { 168 | if (msg.contains("\n")) //重复判断了 169 | { 170 | int len = msg.indexOf("\n"); 171 | if (len > -1) 172 | { 173 | QByteArray _msg = msg.left(len + 1); 174 | if (_msg.contains("\r\n")) 175 | { 176 | _msg = _msg.left(_msg.length() - 2); 177 | } 178 | msg.remove(0, len + 1); 179 | emit already_recv_data(_msg); 180 | } 181 | } 182 | } 183 | mutex.unlock(); 184 | } 185 | 186 | void seimey_serial::serial_error(QSerialPort::SerialPortError error) 187 | { 188 | if (error == QSerialPort::DeviceNotFoundError) 189 | { 190 | QMessageBox::warning(nullptr, "警告", "未知的设备,请刷新设备表"); 191 | } 192 | else if (error == QSerialPort::OpenError) 193 | { 194 | QMessageBox::warning(nullptr, "警告", "重复打开串口设备"); 195 | } 196 | else if (error == QSerialPort::PermissionError) 197 | { 198 | QMessageBox::warning(nullptr, "警告", "此串口已被其他应用程序使用"); 199 | } 200 | else if (error == QSerialPort::WriteError) 201 | { 202 | QMessageBox::warning(nullptr, "警告", "串口写入错误"); 203 | } 204 | } 205 | 206 | void seimey_serial::send_data(const char *data) 207 | { 208 | if (serialport->isOpen()) 209 | { 210 | serialport->write(data); 211 | } 212 | } 213 | 214 | bool seimey_serial::get_serial_status(void) 215 | { 216 | return serialport->isOpen(); 217 | } 218 | 219 | void seimey_serial::send_data(QByteArray byteArray) 220 | { 221 | if (serialport->isOpen()) 222 | { 223 | serialport->write(byteArray); 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /ui/seimey_qwchse.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | seimey_qwchse 4 | 5 | 6 | 7 | 0 8 | 0 9 | 385 10 | 235 11 | 12 | 13 | 14 | 15 | PreferDefault 16 | 17 | 18 | 19 | 串口设置 20 | 21 | 22 | 23 | 24 | 25 | 26 | Qt::Vertical 27 | 28 | 29 | 30 | 20 31 | 0 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | Qt::Horizontal 40 | 41 | 42 | 43 | 0 44 | 20 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | PointingHandCursor 59 | 60 | 61 | 串行端口 * 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 波特率 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 115200 86 | 87 | 88 | 89 | 90 | 57600 91 | 92 | 93 | 94 | 95 | 38400 96 | 97 | 98 | 99 | 100 | 19200 101 | 102 | 103 | 104 | 105 | 9600 106 | 107 | 108 | 109 | 110 | 4800 111 | 112 | 113 | 114 | 115 | 2400 116 | 117 | 118 | 119 | 120 | 1200 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 数据位 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 8 143 | 144 | 145 | 146 | 147 | 7 148 | 149 | 150 | 151 | 152 | 6 153 | 154 | 155 | 156 | 157 | 5 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 停止位 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 1.0 180 | 181 | 182 | 183 | 184 | 1.5 185 | 186 | 187 | 188 | 189 | 2.0 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 校验位 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 无校验 212 | 213 | 214 | 215 | 216 | 奇校验 217 | 218 | 219 | 220 | 221 | 偶校验 222 | 223 | 224 | 225 | 226 | 1校验 227 | 228 | 229 | 230 | 231 | 0校验 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 流控 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 无流控 254 | 255 | 256 | 257 | 258 | 软流控 259 | 260 | 261 | 262 | 263 | 硬流控 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | Qt::Horizontal 278 | 279 | 280 | 281 | 0 282 | 20 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | Qt::Vertical 291 | 292 | 293 | 294 | 20 295 | 0 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 0 306 | 0 307 | 385 308 | 26 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | seimey_qwchse_Label 317 | QLabel 318 |
seimey_qwchse.h
319 |
320 |
321 | 322 | 323 |
324 | -------------------------------------------------------------------------------- /ui/seimey_setting.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | seimey_setting 4 | 5 | 6 | 7 | 0 8 | 0 9 | 698 10 | 452 11 | 12 | 13 | 14 | 设置 15 | 16 | 17 | 18 | 19 | 20 | 21 | Qt::Vertical 22 | 23 | 24 | 25 | 20 26 | 95 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Qt::Horizontal 35 | 36 | 37 | 38 | 133 39 | 20 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 是否保存串口数据 51 | 52 | 53 | 54 | 55 | 56 | 57 | Qt::Vertical 58 | 59 | 60 | 61 | 62 | 63 | 64 | 定时刷新时间,单位为秒(精确到小数点后一位) 65 | 66 | 67 | 68 | 69 | 70 | 定时刷新时间 71 | 72 | 73 | 74 | 75 | 76 | 77 | 1 78 | 79 | 80 | 0.500000000000000 81 | 82 | 83 | 0.100000000000000 84 | 85 | 86 | 0.500000000000000 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | Qt::Horizontal 100 | 101 | 102 | 103 | 133 104 | 20 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | Qt::Vertical 113 | 114 | 115 | 116 | 20 117 | 95 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 0 128 | 0 129 | 698 130 | 25 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /ui/seimey_text.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | seimey_text 4 | 5 | 6 | 7 | 0 8 | 0 9 | 800 10 | 600 11 | 12 | 13 | 14 | 文本浏览器 15 | 16 | 17 | 18 | 19 | 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 0 31 | 0 32 | 800 33 | 25 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | --------------------------------------------------------------------------------