├── .gitignore
├── LICENSE
├── README.md
├── README_CN.md
├── dir.png
├── file.png
├── ftp-preview.png
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── myFTP.pro
└── preview.png
/.gitignore:
--------------------------------------------------------------------------------
1 | # C++ objects and libs
2 |
3 | *.slo
4 | *.lo
5 | *.o
6 | *.a
7 | *.la
8 | *.lai
9 | *.so
10 | *.dll
11 | *.dylib
12 |
13 | # Qt-es
14 |
15 | /.qmake.cache
16 | /.qmake.stash
17 | *.pro.user
18 | *.pro.user.*
19 | *.qbs.user
20 | *.qbs.user.*
21 | *.moc
22 | moc_*.cpp
23 | qrc_*.cpp
24 | ui_*.h
25 | Makefile*
26 | *-build-*
27 |
28 | # QtCreator
29 |
30 | *.autosave
31 |
32 | #QtCtreator Qml
33 | *.qmlproject.user
34 | *.qmlproject.user.*
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 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 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Ftp Client
2 | [简体中文](README_CN.md)
3 | ## Introduction:
4 |
5 | This is an FTP client written in Qt and C++. It utilizes the QFtp class for its functionality. The client is simple in nature and the following features are described below.
6 |
7 | ## Features:
8 |
9 | FTP Server Address Input Box: The client has a text box for entering the FTP server address. The default username is "anonymous" for anonymous login. The username and password can be modified within the program. However, there is no text box provided in the program interface for user input. You can add it yourself as needed.
10 |
11 | Connecting to Server Port: The default port for connecting to the server is 8021. There is a macro definition for the port in the program, which can be modified according to your needs.
12 |
13 | File Batch Upload and Download: The client supports batch upload and download of files within the same folder.
14 |
15 | Folder Operations: The client supports right-click creation of folders and batch deletion of files.
16 |
17 | ### Preview
18 |
19 |
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 | # Ftp-Client (FTP客户端)
2 | ### 简介:
3 | This is a Ftp Client written in Qt
4 | 这是一个ftp client,是用Qt和C++写成了,主要用到了QFtp这个类,客户端功能很简单,下面有介绍.
5 |
6 | ### 功能:
7 |
8 | 1. 这个客户端有个文本框用来输入ftp服务器地址,默认用户名是anonymous,即匿名登录,在程序中可以自己更改用户名和密码,但是没有在程序界面留出文本框用于/入,可以根据情况自己添加.
9 | 2. 默认的连接服务器端口为8021,程序中有一个端口宏定义,大家可以根据需要修改.
10 | 3. 客户端可以实现同一文件夹中的文件批量上传和下载,支持右键创建文件夹和批量删除文件.
11 |
12 | ### 预览
13 |
14 | 
15 |
--------------------------------------------------------------------------------
/dir.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaaronkot/ftp-client/f90d9eb0f552039d6bab33badabe511062fec539/dir.png
--------------------------------------------------------------------------------
/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaaronkot/ftp-client/f90d9eb0f552039d6bab33badabe511062fec539/file.png
--------------------------------------------------------------------------------
/ftp-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaaronkot/ftp-client/f90d9eb0f552039d6bab33badabe511062fec539/ftp-preview.png
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "mainwindow.h"
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 |
8 | QApplication a(argc, argv);
9 |
10 | QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
11 | QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
12 | QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
13 |
14 | MainWindow w;
15 | w.show();
16 | return a.exec();
17 | }
18 |
--------------------------------------------------------------------------------
/mainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include "ui_mainwindow.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | MainWindow::MainWindow(QWidget *parent) :
13 | QMainWindow(parent),
14 | ui(new Ui::MainWindow)
15 | {
16 | ui->setupUi(this);
17 | this->initDisplay();
18 | this->showLocalFile();
19 | connect(ui->treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showLocalTreeViewMenu(QPoint)));
20 | }
21 | MainWindow::~MainWindow()
22 | {
23 | delete ui;
24 | }
25 | void MainWindow::initDisplay()
26 | {
27 | ui->cdToParentButton->setEnabled(false);
28 | ui->downloadButton->setEnabled(false);
29 | ui->uploadButton->setEnabled(false);
30 | ui->progressBar->setValue(0);
31 |
32 | ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
33 | //fileLish 可使用右键菜单
34 | ui->fileList->setContextMenuPolicy(Qt::CustomContextMenu);
35 | this->m_server_menu = new QMenu(this);
36 |
37 | QAction *server_rm = new QAction(QObject::tr("删除"),this);
38 | this->m_server_menu->addAction(server_rm);
39 | }
40 | void MainWindow::ftpCommandStarted(int)
41 | {
42 | int id = ftp->currentCommand();
43 | switch (id)
44 | {
45 | case QFtp::ConnectToHost :
46 | ui->label->setText(tr("正在连接到服务器…"));
47 | break;
48 | case QFtp::Login :
49 | ui->label->setText(tr("正在登录…"));
50 | break;
51 | case QFtp::Get :
52 | ui->label->setText(tr("正在下载…"));
53 | break;
54 | case QFtp::Close :
55 | ui->label->setText(tr("正在关闭连接…"));
56 | }
57 | }
58 |
59 | void MainWindow::ftpCommandFinished(int, bool error)
60 | {
61 | if(ftp->currentCommand() == QFtp::ConnectToHost) {
62 | if (error){
63 | ui->label->setText(tr("连接服务器出现错误:%1").arg(ftp->errorString()));
64 | }
65 | else{
66 | ui->connectButton->setDisabled(true);
67 | ui->connectButton->setText("已连接");
68 | ui->label->setText(tr("连接到服务器成功"));
69 | }
70 | } else if (ftp->currentCommand() == QFtp::Login) {
71 | if (error){
72 | ui->label->setText(tr("登录出现错误:%1").arg(ftp->errorString()));
73 | }
74 | else {
75 | ui->downloadButton->setEnabled(true);
76 | ui->uploadButton->setEnabled(true);
77 | ui->label->setText(tr("登录成功"));
78 | ftp->list();
79 | }
80 | } else if (ftp->currentCommand() == QFtp::Get) {
81 | if(error) ui->label->setText(tr("下载出现错误:%1").arg(ftp->errorString()));
82 | else {
83 | file->close();
84 | ui->label->setText(tr("下载完成"));
85 | currentIndex ++;
86 | if(currentIndex < indexCount){
87 | this->downloadFtpFile(currentIndex);
88 | }
89 | else{
90 | currentIndex = 0;
91 | dirModel->refresh();
92 | }
93 | }
94 | ui->downloadButton->setEnabled(true);
95 | } else if (ftp->currentCommand() == QFtp::List){
96 | if (isDirectory.isEmpty())
97 | {
98 | ui->fileList->addTopLevelItem(
99 | new QTreeWidgetItem(QStringList()<< tr("")));
100 | ui->fileList->setEnabled(false);
101 | ui->label->setText(tr("该目录为空"));
102 | }
103 | }else if (ftp->currentCommand() == QFtp::Put) {
104 | if(error) ui->label->setText(tr("上传出现错误:检查文件是否重名!").arg(ftp->errorString()));
105 | else {
106 | ui->label->setText(tr("上传完成"));
107 | file->close();
108 | currentIndex ++;
109 | if(currentIndex < indexCount){
110 | this->uploadLocalFile(currentIndex);
111 | }
112 | else{
113 | currentIndex = 0;
114 | //刷新显示列表
115 | isDirectory.clear();
116 | ui->fileList->clear();
117 | ftp->list();
118 | }
119 | }
120 | }else if (ftp->currentCommand() == QFtp::Mkdir){
121 | ui->label->setText(tr("新建文件夹完成"));
122 | //刷新显示列表
123 | isDirectory.clear();
124 | ui->fileList->clear();
125 | ftp->list();
126 | }else if (ftp->currentCommand() == QFtp::Remove){
127 | currentIndex++;
128 | if(currentIndex >= indexCount){
129 | ui->label->setText(tr("删除完成!"));
130 | isDirectory.clear();
131 | ui->fileList->clear();
132 | ftp->list();
133 | }
134 | }else if(ftp->currentCommand() == QFtp::Rmdir){
135 | currentIndex++;
136 | if(currentIndex >= indexCount){
137 | ui->label->setText(tr("删除完成!"));
138 | isDirectory.clear();
139 | ui->fileList->clear();
140 | ftp->list();
141 | }
142 | }
143 | else if (ftp->currentCommand() == QFtp::Close) {
144 | ui->label->setText(tr("已经关闭连接"));
145 | }
146 | }
147 |
148 | // 连接按钮
149 | void MainWindow::on_connectButton_clicked()
150 | {
151 | ui->fileList->clear();
152 | currentPath.clear();
153 | isDirectory.clear();
154 |
155 | ftp = new QFtp(this);
156 | connect(ftp, SIGNAL(commandStarted(int)), this, SLOT(ftpCommandStarted(int)));
157 | connect(ftp, SIGNAL(commandFinished(int, bool)),
158 | this, SLOT(ftpCommandFinished(int, bool)));
159 | connect(ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(addToList(QUrlInfo)));
160 | connect(ftp, SIGNAL(dataTransferProgress(qint64, qint64)),
161 | this, SLOT(updateDataTransferProgress(qint64, qint64)));
162 |
163 | connect(ui->fileList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showFtpTreeViewMenu(QPoint)));
164 | //双击进入目录
165 | connect(ui->fileList, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
166 | this, SLOT(processItem(QTreeWidgetItem*, int)));
167 |
168 | QString ftpServer = ui->ftpServerLineEdit->text();
169 | QString userName = "anonymous";
170 | QString passWord = "admin123";
171 | ftp->connectToHost(ftpServer,SERVERPORT);
172 | ftp->login(userName, passWord);
173 | }
174 |
175 | void MainWindow::addToList(const QUrlInfo &urlInfo)
176 | {
177 | //
178 | if(_FromSpecialEncoding(urlInfo.name()).startsWith("."))
179 | return;
180 | QTreeWidgetItem *item = new QTreeWidgetItem;
181 | item->setText(0, _FromSpecialEncoding(urlInfo.name()));
182 | double dFileSize = ((int)(urlInfo.size()/1024.0*100))/100.0;
183 | QString fileSize = QString::number(dFileSize,'g',10)+"KB";
184 |
185 | item->setText(1, fileSize);
186 | item->setText(2, urlInfo.lastModified().toString("MMM dd yyyy"));
187 | item->setText(3, urlInfo.owner());
188 | item->setText(4, urlInfo.group());
189 | QPixmap pixmap(urlInfo.isDir() ? "./dir.png" : "./file.png");
190 | item->setIcon(0, pixmap);
191 | isDirectory[_FromSpecialEncoding(urlInfo.name())] = urlInfo.isDir();
192 | ui->fileList->addTopLevelItem(item);
193 | if (!ui->fileList->currentItem()) {
194 | ui->fileList->setCurrentItem(ui->fileList->topLevelItem(0));
195 | ui->fileList->setEnabled(true);
196 | }
197 | }
198 |
199 | void MainWindow::processItem(QTreeWidgetItem *item, int)
200 | {
201 | if(item->isDisabled())
202 | return;
203 | QString name = item->text(0);
204 | // 如果这个文件是个目录,则打开
205 | if (isDirectory.value(name)) {
206 | ui->fileList->clear();
207 | isDirectory.clear();
208 | currentPath += "/";
209 | currentPath += name;
210 | ftp->cd(_ToSpecialEncoding(name));
211 | ftp->list(); //重新显示文件列表
212 | ui->cdToParentButton->setEnabled(true);
213 | }
214 | }
215 |
216 | // 返回上级目录按钮
217 | void MainWindow::on_cdToParentButton_clicked()
218 | {
219 | qDebug()<<"re:currentPath:"<fileList->clear();
221 | isDirectory.clear();
222 | currentPath = currentPath.left(currentPath.lastIndexOf('/'));
223 | qDebug()<<"now:currentPath:"<cdToParentButton->setEnabled(false);
226 | ftp->cd("/");
227 | } else {
228 | ftp->cd(_ToSpecialEncoding(currentPath));
229 | }
230 | ftp->list();
231 | }
232 |
233 | // 下载按钮
234 | void MainWindow::on_downloadButton_clicked()
235 | {
236 | //防止目录为空时,点击下载按钮出错
237 | if(isDirectory.isEmpty())
238 | return;
239 | //测试下载路径
240 | QModelIndex index = ui->treeView->currentIndex();
241 | if (!index.isValid()) {
242 | ui->label->setText("请选择正确的下载路径!");
243 | return;
244 | }
245 | //获取下载文件信息
246 |
247 | indexCount = ui->fileList->selectionModel()->selectedRows().count();
248 | if (indexCount <= 0) {
249 | return;
250 | }
251 | ui->downloadButton->setEnabled(false);
252 | currentIndex = 0;
253 | this->downloadFtpFile(currentIndex);
254 | }
255 | void MainWindow::downloadFtpFile(int rowIndex)
256 | {
257 | QModelIndex index = ui->treeView->currentIndex();
258 | QModelIndexList indexList = ui->fileList->selectionModel()->selectedRows();
259 | QFileInfo fileInfo = dirModel->fileInfo(index);
260 | QString fileName;
261 | if(fileInfo.isDir())
262 | fileName = fileInfo.absoluteFilePath() + indexList.at(rowIndex).data().toString();
263 | else
264 | fileName = fileInfo.absolutePath() + "/" + indexList.at(rowIndex).data().toString();
265 | file = new QFile(fileName);
266 | if (!file->open(QIODevice::WriteOnly)) {
267 | delete file;
268 | return;
269 | }
270 | ftp->get(_ToSpecialEncoding(indexList.at(rowIndex).data().toString()), file);
271 | }
272 |
273 | void MainWindow::updateDataTransferProgress(qint64 readBytes,qint64 totalBytes)
274 | {
275 | ui->progressBar->setMaximum(totalBytes);
276 | ui->progressBar->setValue(readBytes);
277 | }
278 |
279 | //本地目录操作
280 | void MainWindow::showLocalFile()
281 | {
282 | dirModel = new QDirModel;
283 |
284 | dirModel->setReadOnly(false);
285 | dirModel->setSorting(QDir::DirsFirst | QDir::IgnoreCase | QDir::Name);
286 |
287 | //QTreeView treeView = new QTreeView;
288 | ui->treeView->setModel(dirModel);
289 | // ui->treeView->setRootIndex(dirModel->index("c:\\"));
290 | ui->treeView->header()->setStretchLastSection(true);
291 | ui->treeView->header()->setSortIndicator(0, Qt::AscendingOrder);
292 | ui->treeView->header()->setSortIndicatorShown(true);
293 | ui->treeView->header()->setClickable(true);
294 |
295 | QModelIndex index = dirModel->index(QDir::currentPath());
296 | ui->treeView->expand(index);
297 | ui->treeView->scrollTo(index);
298 | ui->treeView->resizeColumnToContents(0);
299 |
300 | QPushButton *createBtn = new QPushButton(tr("Create Directory..."));
301 | QPushButton *delBtn = new QPushButton(tr("Remove"));
302 |
303 | connect(createBtn, SIGNAL(clicked()), this, SLOT(mkdir()));
304 | connect(delBtn, SIGNAL(clicked()), this, SLOT(rm()));
305 | }
306 |
307 | void MainWindow::mkdir()
308 | {
309 | QModelIndex index = ui->treeView->currentIndex();
310 | if (!index.isValid()) {
311 | return;
312 | }
313 | QString dirName = QInputDialog::getText(this,
314 | tr("新建文件夹"),
315 | tr("文件夹名称"));
316 | if (!dirName.isEmpty()) {
317 | if (!dirModel->mkdir(index, dirName).isValid()) {
318 | QMessageBox::information(this,
319 | tr("新建文件夹"),
320 | tr("创建文件夹失败"));
321 | }
322 | }
323 | }
324 |
325 | void MainWindow::on_treeView_doubleClicked(const QModelIndex &index)
326 | {
327 |
328 | }
329 | //文件上传
330 | void MainWindow::on_uploadButton_clicked()
331 | {
332 | indexCount = ui->treeView->selectionModel()->selectedRows().count();
333 | if (indexCount <= 0) {
334 | return;
335 | }
336 | currentIndex = 0;
337 | this->uploadLocalFile(currentIndex);
338 | }
339 |
340 | void MainWindow::uploadLocalFile(int rowIndex)
341 | {
342 | QModelIndexList indexList = ui->treeView->selectionModel()->selectedRows();
343 | QFileInfo fileInfo = dirModel->fileInfo(indexList.at(rowIndex));
344 | QString fileName = fileInfo.absoluteFilePath();
345 | file = new QFile(fileName);
346 | if (!file->open(QIODevice::ReadOnly)) {
347 | delete file;
348 | return;
349 | }
350 | ftp->put(file,_ToSpecialEncoding(fileInfo.fileName()));
351 | }
352 |
353 |
354 |
355 |
356 | //有FTP端编码转本地编码
357 | QString MainWindow::_FromSpecialEncoding(const QString &InputStr)
358 | {
359 | #ifdef Q_OS_WIN
360 | return QString::fromLocal8Bit(InputStr.toLatin1());
361 | #else
362 | QTextCodec *codec = QTextCodec::codecForName("gbk");
363 | if (codec)
364 | {
365 | return codec->toUnicode(InputStr.toLatin1());
366 | }
367 | else
368 | {
369 | return QString("");
370 | }
371 | #endif
372 | }
373 | //put get等上传文件时,转换为FTP端编码
374 | QString MainWindow::_ToSpecialEncoding(const QString &InputStr)
375 | {
376 | #ifdef Q_OS_WIN
377 | return QString::fromLatin1(InputStr.toLocal8Bit());
378 | #else
379 | QTextCodec *codec= QTextCodec::codecForName("gbk");
380 | if (codec)
381 | {
382 | return QString::fromLatin1(codec->fromUnicode(InputStr));
383 | }
384 | else
385 | {
386 | return QString("");
387 | }
388 | #endif
389 | }
390 | //fileList 右键菜单
391 | void MainWindow::showFtpTreeViewMenu(const QPoint &pos)
392 | {
393 |
394 | QMenu* menu=new QMenu;
395 | menu->addAction(QString(tr("新建文件夹")),this,SLOT(slotMkdir()));
396 | menu->addAction(QString(tr("刷新")),this,SLOT(slotRefreshFtpList()));
397 | menu->addAction(QString(tr("删除")),this,SLOT(slotDeleteFile()));
398 | menu->exec(QCursor::pos());
399 | }
400 |
401 | void MainWindow::slotRefreshFtpList()
402 | {
403 | isDirectory.clear();
404 | ui->fileList->clear();
405 | ftp->list();
406 | }
407 |
408 | void MainWindow::slotMkdir()
409 | {
410 | QString dirName = QInputDialog::getText(this,
411 | tr("新建文件夹"),
412 | tr("文件夹名称"));
413 | if (!dirName.isEmpty()) {
414 | ftp->mkdir(_ToSpecialEncoding(dirName));
415 | }
416 | }
417 |
418 | void MainWindow::slotDeleteFile()
419 | {
420 | QModelIndexList indexList = ui->fileList->selectionModel()->selectedRows();
421 | QString fileName;
422 | currentIndex = 0;
423 | indexCount = indexList.count();
424 | ui->label->setText("正在删除中......请稍等!");
425 | for(int i = 0;i < indexCount;i++)
426 | {
427 | fileName = indexList.at(i).data().toString();
428 | if(isDirectory.value(fileName))
429 | ftp->rmdir(_ToSpecialEncoding(fileName));
430 | else
431 | ftp->remove(_ToSpecialEncoding(fileName));
432 | }
433 | }
434 |
435 | //本地文件 右键操作
436 | void MainWindow::showLocalTreeViewMenu(const QPoint &pos)
437 | {
438 | QMenu* menu=new QMenu;
439 | menu->addAction(QString(tr("新建文件夹")),this,SLOT(mkdir()));
440 | menu->addAction(QString(tr("删除")),this,SLOT(rm()));
441 | menu->addAction(QString(tr("刷新")),this,SLOT(localDirRefresh()));
442 | menu->exec(QCursor::pos());
443 | }
444 |
445 |
446 | void MainWindow::rm()
447 | {
448 | QModelIndexList indexList = ui->treeView->selectionModel()->selectedRows();
449 | if (indexList.count() == 0) {
450 | return;
451 | }
452 | bool ok;
453 | for(int i=0;ifileInfo(index).isDir())
457 | {
458 | ok = dirModel->rmdir(index);
459 | } else {
460 | ok = dirModel->remove(index);
461 | }
462 | if (!ok) {
463 | // QMessageBox::information(this,
464 | // tr("Remove"),
465 | // tr("Failed to remove %1").arg(dirModel->fileName(indexList.at(i))));
466 | }
467 | }
468 | }
469 | //本地目录刷新
470 | void MainWindow::localDirRefresh(){
471 | dirModel->refresh();
472 | }
473 |
474 | //按键事件
475 | void MainWindow::keyPressEvent(QKeyEvent *event)
476 | {
477 | //按回车键,默认执行“连接”按钮操作
478 | if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
479 | on_connectButton_clicked();
480 | }
481 |
482 |
--------------------------------------------------------------------------------
/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 |
17 |
18 | #define SERVERPORT 8021
19 |
20 | class QFtp;
21 |
22 | #include
23 | class QFile;
24 | class QUrlInfo;
25 | class QTreeWidgetItem;
26 |
27 | namespace Ui {
28 | class MainWindow;
29 | }
30 |
31 | class MainWindow : public QMainWindow
32 | {
33 | Q_OBJECT
34 |
35 | public:
36 | explicit MainWindow(QWidget *parent = 0);
37 | ~MainWindow();
38 | private:
39 | Ui::MainWindow *ui;
40 | QFtp *ftp;
41 | //初始化界面显示
42 | void initDisplay();
43 | // 用来存储FTP端一个路径是否为目录的信息
44 | QHash isDirectory;
45 | //判断本地路径是否为目录
46 | QHash isLocalDirectory;
47 | // 用来存储现在的路径
48 | QString currentPath;
49 | QDirModel *dirModel;
50 | //用来表示下载的文件
51 | QFile *file;
52 | void showLocalFile();
53 | //两个转码函数,解决中文名文件乱码
54 | QString _ToSpecialEncoding(const QString &InputStr);
55 | QString _FromSpecialEncoding(const QString &InputStr);
56 | //下载FTP端文件
57 | void downloadFtpFile(int rowIndex);
58 | void uploadLocalFile(int rowIndex);
59 | //客户端,服务器端treeview右键菜单
60 | QMenu *m_server_menu;
61 | QMenu *m_client_menu;
62 |
63 | //记录上传和下载文件的个数
64 | int indexCount;
65 | int currentIndex;
66 |
67 | protected:
68 | void keyPressEvent(QKeyEvent *event);
69 |
70 | private slots:
71 | void ftpCommandStarted(int);
72 | void ftpCommandFinished(int, bool);
73 |
74 | // 更新进度条
75 | void updateDataTransferProgress(qint64, qint64 );
76 | // 将服务器上的文件添加到Tree Widget部件中
77 | void addToList(const QUrlInfo &urlInfo);
78 | // 双击一个目录时显示其内容
79 | void processItem(QTreeWidgetItem*, int);
80 | void on_connectButton_clicked();
81 | void on_cdToParentButton_clicked();
82 | void on_downloadButton_clicked();
83 | //新建目录与删除操作
84 | void mkdir();
85 | void rm();
86 |
87 | void localDirRefresh();
88 | void on_treeView_doubleClicked(const QModelIndex &index);
89 | void on_uploadButton_clicked();
90 | //TreeView显示右键菜单
91 | void showFtpTreeViewMenu(const QPoint &point );
92 | void showLocalTreeViewMenu(const QPoint &point );
93 |
94 | void slotMkdir();
95 | void slotDeleteFile();
96 | void slotRefreshFtpList();
97 | };
98 |
99 | #endif // MAINWINDOW_H
100 |
--------------------------------------------------------------------------------
/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 514
10 | 567
11 |
12 |
13 |
14 | FTP客户端
15 |
16 |
17 | QWidget:focus{outline: none;}
18 | .QWidget{background-color:rgba(255,255,255,200);}
19 | QWidget:focus{outline: none;}/*remove all QWidget's focus border*/
20 | /*文本框样式*/
21 | QTimeEdit,QDoubleSpinBox,QSpinBox,QLineEdit{background:white;border:1px groove lightgray; border-radius:2px}
22 | /*QLineEdit:focus{background:white;border:1px groove lightgray; border-radius:2px}*/
23 |
24 | /*定义所有按钮的样式*/
25 | QPushButton{
26 | background-color:#2dabf9;
27 | border-radius:2px;
28 | border-color:#2dabf9;
29 | font-size:12px;
30 | color:#ffffff;
31 | padding: 6px 15px;
32 | }
33 |
34 | QPushButton:pressed{
35 | background-color:#0061a7;
36 | border-color:#0061a7;
37 | }
38 |
39 | QPushButton::disabled{
40 | background-color:#B8B8B8;
41 | }
42 | /*进度条样式*/
43 | QProgressBar{
44 | border: 1px solid lightgray;
45 | border-radius:1px;
46 | text-align:center;
47 | height:20px;
48 | }
49 |
50 | QProgressBar::chunk{
51 | background-color: #2dabf9;
52 | width: 12px;
53 | /*margin:0.5px;*/
54 | }
55 |
56 | /*tablewidget 样式*/
57 | QTreeView,QTableView , QTableWidget{
58 | selection-background-color:#44c767;
59 | background-color:white;
60 | border:1px solid #E0DDDC;
61 | gridline-color:lightgray;
62 | }
63 | /*表头样式*/
64 | QHeaderView::section{
65 | background-color:white;
66 | border:0px solid #E0DDDC;
67 | border-bottom:1px solid #00cc00;
68 | border-right:1px solid #E0DDDC;
69 | height:20px;
70 | /*color: #E0DDDC;*/
71 | }
72 | /*水平滚动条样式*/
73 |
74 | QScrollBar:horizontal
75 | {
76 |
77 | height:14px;
78 | border:0px solid #eee9e9;
79 | margin:0px;
80 | padding-left:10px;
81 | padding-right:10px;
82 | }
83 | /*滚动手柄样式*/
84 | QScrollBar::handle:horizontal
85 | {
86 | height:14px;
87 | border-radius:6px;
88 | background:#C4C4C4;
89 | border:1px solid #C4C4C4;
90 | }
91 |
92 | /*上翻页,下翻页按钮样式*/
93 | QScrollBar::add-line:horizontal
94 | {
95 | width:30px;
96 | background:#C4C4C4;
97 | subcontrol-position:right;
98 | }
99 | QScrollBar::sub-line:horizontal
100 | {
101 | width:30px;
102 | background:#C4C4C4;
103 | subcontrol-position:left;
104 | }
105 |
106 | /*左右空白滚动条出颜色*/
107 | QScrollBar::add-page:horizontal
108 | {
109 | background:#EAEAEA;
110 | }
111 |
112 | QScrollBar::sub-page:horizontal
113 | {
114 | background:#EAEAEA;
115 | }
116 |
117 |
118 | QScrollBar::up-arrow:horizontal
119 | {
120 | height:30px;
121 | min-width:50px;
122 | }
123 | QScrollBar::down-arrow:horizontal
124 | {
125 | height:30px;
126 | min-width:50px;
127 | }
128 |
129 |
130 | /*垂直滚动条样式-BEGIN*/
131 | QScrollBar:vertical
132 | {
133 | width:14px;
134 | border:0px solid #eee9e9;
135 | margin:0px;
136 | padding-top:10px;
137 | padding-bottom:10px;
138 | }
139 | QScrollBar::handle:vertical
140 | {
141 | width:14px;
142 | border-radius:6px;
143 | background:#C4C4C4;
144 | border:1px solid #C4C4C4;
145 | }
146 |
147 | QScrollBar::add-line:vertical
148 | {
149 | height:10px;
150 | background:#C4C4C4;
151 | subcontrol-position:bottom;
152 | }
153 | QScrollBar::sub-line:vertical
154 | {
155 | height:10px;
156 | background:#C4C4C4;
157 | subcontrol-position:top;
158 | }
159 | QScrollBar::add-page:vertical
160 | {
161 | background:#EAEAEA;
162 | }
163 |
164 | QScrollBar::sub-page:vertical
165 | {
166 | background:#EAEAEA;
167 | }
168 | QScrollBar::up-arrow:vertical
169 | {
170 | max-height:16px;
171 | min-width:17px;
172 | }
173 | QScrollBar::down-arrow:vertical
174 | {
175 | /*border-style:outset;*/
176 | }
177 | /*垂直滚动条样式-END*/
178 |
179 |
180 |
181 | -
182 |
183 |
-
184 |
185 |
186 | -
187 |
188 |
-
189 |
190 |
191 | 10
192 |
193 |
-
194 |
195 |
-
196 |
197 |
198 | IP地址:
199 |
200 |
201 |
202 | -
203 |
204 |
205 |
206 | 200
207 | 0
208 |
209 |
210 |
211 | 请输入FTP服务器IP地址
212 |
213 |
214 |
215 |
216 |
217 | -
218 |
219 |
220 | Qt::Horizontal
221 |
222 |
223 |
224 | 40
225 | 20
226 |
227 |
228 |
229 |
230 | -
231 |
232 |
233 | 连接
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 | -
242 |
243 |
244 | QAbstractItemView::ExtendedSelection
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 |
278 | 24
279 |
280 |
281 |
282 | -
283 |
284 |
285 | 返回上级
286 |
287 |
288 |
289 |
290 |
291 | -
292 |
293 |
-
294 |
295 |
296 | FTP客户端
297 |
298 |
299 |
300 | -
301 |
302 |
303 | Qt::Horizontal
304 |
305 |
306 |
307 | 40
308 | 20
309 |
310 |
311 |
312 |
313 | -
314 |
315 |
316 | 下载
317 |
318 |
319 |
320 |
321 |
322 | -
323 |
324 |
325 | QAbstractItemView::ExtendedSelection
326 |
327 |
328 |
329 | -
330 |
331 |
-
332 |
333 |
334 | Qt::Horizontal
335 |
336 |
337 |
338 | 40
339 | 20
340 |
341 |
342 |
343 |
344 | -
345 |
346 |
347 | 上传
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
--------------------------------------------------------------------------------
/myFTP.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2011-10-26T11:44:11
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui sql xml
8 | QT += network
9 |
10 | TARGET = myFTP
11 | TEMPLATE = app
12 | #window下添加此宏,linux下去掉
13 | DEFINES += Q_OS_WIN
14 |
15 | SOURCES += main.cpp\
16 | mainwindow.cpp
17 |
18 | HEADERS += mainwindow.h
19 |
20 | FORMS += mainwindow.ui
21 |
--------------------------------------------------------------------------------
/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaaronkot/ftp-client/f90d9eb0f552039d6bab33badabe511062fec539/preview.png
--------------------------------------------------------------------------------