FTP client

  • S3_282808
    了解作者
  • 87.8KB
    文件大小
  • 7z
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 05:19
    上传日期
基于Qt4.7 的FTP客户端,能对多个站点进行管理和资源的下载。
FtpClient.7z
内容介绍
#include "FtpClient.h" #include "ftpconnect.h" #include "ftpbookmark.h" #include "basicdialog.h" extern QString CheminConf; FtpClient::FtpClient(QWidget * parent):QMainWindow(parent) { setupUi(this); systemTray = false; menu = new QMenu(this); menu->addAction(QPixmap(":pixmaps/hiddenfiles.png"), tr("&Show Tux'Ftp Client"), this, SLOT(showOrHide())); menu->addSeparator(); menu->addAction(QPixmap(":pixmaps/exit.png"), tr("&Quit"), qApp, SLOT(quit())); trayIcon = new QSystemTrayIcon(this); trayIcon->setIcon(QIcon(":pixmaps/network.png")); trayIcon->setToolTip("Tux'Ftp Client"); trayIcon->setContextMenu(menu); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); trayIcon->show(); connect(quitAction, SIGNAL(triggered(bool)), qApp, SLOT(quit())); connect(closeConnectAction, SIGNAL(triggered(bool)), this, SLOT(slotDisconnect())); connect(rapidConnectAction, SIGNAL(triggered(bool)), this, SLOT(slotConnect())); connect(ShowToolbarConnect, SIGNAL(triggered(bool)), this, SLOT(slotShowToolbarConnect())); connect(hideToolbarConnect, SIGNAL(triggered(bool)), this, SLOT(slotHideToolbarConnect())); connect(newFolder, SIGNAL(triggered(bool)), this, SLOT(slotNewFolder())); connect(removeFile, SIGNAL(triggered(bool)), this, SLOT(slotRemoveFile())); connect(renameFile, SIGNAL(triggered(bool)), this, SLOT(slotRenameFile())); connect(reloadLocalList, SIGNAL(triggered(bool)), this, SLOT(slotReloadLocalList())); connect(reloadFtpList, SIGNAL(triggered(bool)), this, SLOT(slotReloadFtpList())); connect(localPathEdit, SIGNAL(returnPressed()), this, SLOT(slotLocalPathChanged())); connect(ShowToolbarFile, SIGNAL(triggered(bool)), this, SLOT(slotShowToolbarFile())); connect(ShowToolbarTransfert, SIGNAL(triggered(bool)), this, SLOT(slotShowToolbarTransfert())); connect(hideToolbarFile, SIGNAL(triggered(bool)), this, SLOT(slotHideToolbarFile())); connect(hideToolbarTransfert, SIGNAL(triggered(bool)), this, SLOT(slotHideToolbarTransfert())); connect(ftpPathEdit, SIGNAL(returnPressed()), this, SLOT(slotFtpPathChanged())); connect(uploadButton, SIGNAL(clicked()), this, SLOT(slot_upload())); connect(downloadButton, SIGNAL(clicked()), this, SLOT(slot_download())); connect(hiddenFiles, SIGNAL(triggered(bool)), this, SLOT(slotHiddenFiles())); connect(addFtpAction, SIGNAL(triggered(bool)), this, SLOT(slotAddbookmark())); verticalSplitter->setStretchFactor(0, 2); ftp = new MyFtp(ftpList, localList, ftpPathEdit, localPathEdit); QString headers="Name"; localList->setHeaderLabel(headers); QVBoxLayout *layout = new QVBoxLayout(transfersGroup); transfersWidget = new transfers(ftp); layout->addWidget(transfersWidget); connect(stopAllTransfertAction, SIGNAL(triggered(bool)), transfersWidget, SLOT(slotRemoveAllTransfers())); connect(stopTransferAction, SIGNAL(triggered(bool)), transfersWidget, SLOT(slotRemoveTransfers())); ShowToolbarConnect->setVisible(false); ShowToolbarFile->setVisible(false); ShowToolbarTransfert->setVisible(false); QLabel *begin = new QLabel(this); begin->setText(tr("<font color =\"#61b9e2\">Status :</font>")); statusBar()->addPermanentWidget(begin); stateLabel = new QLabel(this); stateLabel->setText(trUtf8("<font color =\"#ff0000\">Disconnect</font>")); statusBar()->addPermanentWidget(stateLabel); connectLabel = new QLabel(this); connectLabel->setPixmap(QPixmap(":/pixmaps/connect_no.png")); statusBar()->addPermanentWidget(connectLabel); waitLabel = new QLabel(this); waitLabel->setPixmap(QPixmap(":/pixmaps/network.png")); statusBar()->addPermanentWidget(waitLabel); connect(ftpList, SIGNAL(buttonClicked(QTreeWidgetItem *)), SLOT(slotFtpSelection(QTreeWidgetItem *))); connect(localList, SIGNAL(buttonClicked(QTreeWidgetItem *)), SLOT(slotLocalSelection(QTreeWidgetItem *))); // connect(transfersWidget->transferListWidget, SIGNAL(buttonClicked(QTreeWidgetItem *)), // SLOT(slotTransferSelection(QTreeWidgetItem *))); connect(transfersWidget->transferListWidget, SIGNAL(buttonClicked(QTreeWidgetItem *)), SLOT(slotTransferSelection(QTreeWidgetItem *))); connect(ftpList, SIGNAL(doubleClickedOnItem(QTreeWidgetItem *)), SLOT(slotChangeFtpPath(QTreeWidgetItem *))); connect(localList, SIGNAL(doubleClickedOnItem(QTreeWidgetItem *)), SLOT(slotChangeLocalPath(QTreeWidgetItem *))); connect(ftpList, SIGNAL(rightButtonClicked(QTreeWidgetItem *, QPoint)), SLOT(slotPopupFtp(QTreeWidgetItem *, QPoint))); connect(localList,SIGNAL(rightButtonClicked(QTreeWidgetItem *, QPoint)), SLOT(slotPopupLocal(QTreeWidgetItem *, QPoint))); connect(ftpList, SIGNAL(startDownloadOrUpload(const QString &)), SLOT(slotUpload(const QString &))); connect(localList, SIGNAL(startDownloadOrUpload(const QString &)), SLOT(slotDownload(const QString &))); connect(ftp, SIGNAL(downloadFinished(const QString&, int, bool)), SLOT(slotDownloadFinished(const QString&, int, bool))); connect(ftp, SIGNAL(uploadFinished(const QString&, int, bool)), SLOT(slotUploadFinished(const QString&, int, bool))); connect(ftp, SIGNAL(stateChanged(int)), SLOT(slotStateChanged(int))); connect(ftp, SIGNAL(detailledError(const QString &)), SLOT(slotDetailledError(const QString &))); connect(ftp, SIGNAL(currentActionChanged(MyFtp::FtpCurrentAction)), SLOT(slotCurrentActionChanged(MyFtp::FtpCurrentAction))); (void) new QShortcut(Qt::CTRL + Qt::Key_A, this, SLOT(slotSelectAll())); (void) new QShortcut(Qt::Key_F5, this, SLOT(slotReloadList())); } FtpClient::~FtpClient() { delete ftp; } void FtpClient::slotConnect() { ftpConnect c; if (c.exec() == QDialog::Rejected) return; if (ftp->state() != QFtp::Unconnected && ftp->state() != QFtp::Closing) slotDisconnect(); QString mode = c.transferMode->currentText(); if (mode != tr("Passive") && mode != tr("Active")) mode = tr("Passive"); if (c.addbookmark->isChecked()) { QString ident = c.identifiant->text(); if (ident == "") ident = c.host->currentText(); if (c.anonymous->isChecked()) ident += " [anonyme]"; list.AddBookmark(ident, c.username->text(), c.host->currentText(), c.password->text(), c.port->value(), mode, c.proxyName->text(), c.proxyPort->value()); } ftpList->clear(); qDebug()<<mode; if (mode == tr("Passive")) ftp->setTransferMode(QFtp::Passive); else ftp->setTransferMode(QFtp::Active); if (c.proxyName->text() != "") ftp->setProxy(c.proxyName->text(), c.proxyPort->value()); ftp->connectFtp(c.host->currentText(), c.port->value(), c.username->text(), c.password->text()); } void FtpClient::slotDisconnect() { if (ftp->state() == QFtp::Unconnected) return; ftp->disconnectFtp(); } void FtpClient::slotStateChanged(int state) { switch ((QFtp::State) state) { case QFtp::Unconnected: stateLabel->setText(trUtf8("<font color =\"#ff0000\">Disconnected</font>")); connectLabel->setPixmap(QPixmap(":/pixmaps/connect_no.png")); ftpList->clear(); transfersWidget->slotRemoveTransfers(); ftp->disconnectFtp(); break; case QFtp::HostLookup: stateLabel->setText(trUtf8("<font color =\"blue\">Host_Research</font>")); break; case QFtp::Connecting: stateLabel->setText(tr("<font color =\"blue\">Connection</font>")); break; case QFtp::Connected: stateLabel->setText(trUtf8("<font color =\"blue\">Connected</font>")); break; case QFtp::LoggedIn: stateLabel->setText(tr("<font color =\"green\">Recognized</font
评论
    相关推荐
    • FTP工具
      FTP工具
    • ftp工具
      ftp工具
    • ftp同步
      ftp同步 FTP Synchronizer
    • FTP工具
      FTP工具
    • ftp
      FTP Golang中的简单客户端-服务器ftp实现 ftp客户端 当前实现以下功能: 目录 光盘 残障人士 ftp服务器 通过TCP套接字与ftpClient通信以显示目录信息。 硬编码以使用localhost端口1202 目前实现: 目录 光盘 ...
    • ftp client
      ftp 客户端,免费绿色,解压后就可以直接用,方便易用。
    • FTP Server
      一款很不錯的FTP軟件,試了很多軟件,都沒這款好用,架設FTP服務很容易
    • FTP commander
      免费的FTP客户端。 具有一般FTP的全部功能。 文件比较小,性能稳定
    • FTP12312321
      FTP 64位 直接解压就可以用,无需安装秘钥。FTP 64位 直接解压就可以用,无需安装秘钥。FTP 64位 直接解压就可以用,无需安装秘钥。
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等