Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
/*
netFileCopyer
Copyright (C) 2004 Dmitry S. Vasilchenko.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The GNU GPL is contained in /usr/doc/copyright/GPL on a Debian
system and in the file COPYING in the Linux kernel source.
*/
#ifndef _FTRANSFER_H
#define _FTRANSFER_H
#include <qdialog.h>
#include <time.h>
#include "uthreads.h"
class QPushButton;
class QLabel;
class QProgressBar;
class QTextEdit;
class QTimer;
class FTransferDialog;
const int S_SEND = 1;
const int S_RECEIVE = 2;
const unsigned char ACC_OK = 32;
const unsigned char ACC_ERR = 33;
const int STAGE_PRE = 0;
const int STAGE_CONNECT = 2;
const int STAGE_ACCEPT = 3;
const int STAGE_SENDFILE = 5;
const int STAGE_RECEIVEFILE = 12;
const int STAGE_FINISH = 20;
const int STAGE_ERSOCKET = 21;
const int STAGE_ERCONNECT = 22;
const int STAGE_ERSENDINFO = 23;
const int STAGE_ERWAITACK = 24;
const int STAGE_ERFOPEN = 26;
const int STAGE_ERFREAD = 27;
const int STAGE_ERFSEND = 28;
const int STAGE_ERACCEPT = 31;
const int STAGE_ERGETINFO = 32;
const int STAGE_ERSENDACK = 33;
const int STAGE_ERFWRITE = 34;
const int STAGE_ERFRECEIVE = 35;
static const char *stateStrings[] = {
/*00*/ "Preparing for transfer",
/*01*/ "",
/*02*/ "Connecting",
/*03*/ "Accepting connection",
/*04*/ "",
/*05*/ "Send file",
/*06*/ "",
/*07*/ "",
/*08*/ "",
/*09*/ "",
/*10*/ "",
/*11*/ "",
/*12*/ "Receive file",
/*13*/ "",
/*14*/ "",
/*15*/ "",
/*16*/ "",
/*17*/ "",
/*18*/ "",
/*19*/ "",
/*20*/ "Transfer finished",
/*21*/ "Socket error",
/*22*/ "Connection error",
/*23*/ "Error while sending info",
/*24*/ "Error getting ACK",
/*25*/ "",
/*26*/ "File open error",
/*27*/ "File read error",
/*28*/ "File send error",
/*29*/ "",
/*30*/ "",
/*31*/ "Error accepting connection",
/*32*/ "Error getting info",
/*33*/ "Error sending ACK",
/*34*/ "File write error",
/*35*/ "File receive error",
/*36*/ ""
};
class FTransferDialog : public QDialog {
Q_OBJECT;
private: /* state */
size_t file_size, file_progress;
time_t start_time;
int stage;
QString file_name;
public:
int start_transfer;
FTransferDialog(QWidget *parent = 0, const char *name = 0,
bool modal = FALSE, WFlags f = 0,
QString ip = "", int port = 0, QString file = "", int state = 0);
void stateUpdate(int pstage,
size_t pfile_size, size_t pfile_progress,
time_t pstart_time, QString pfile_name);
public slots:
void viewUpdate();
private:
QString ip, file;
int port, state;
QProgressBar *progress;
QLabel *stateLabel, *timeLabel, *speedLabel, *fnameLabel;
QPushButton *haltButton;
QTextEdit *statEdit;
ThMain *tmain;
QTimer *upTimer;
protected:
void closeEvent( QCloseEvent *event);
public:
};
#endif
Соседние файлы в папке net_copy