Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Лабы / 3 / 3.tar / 3 / 3 / net_copy / ftransfer

.h
Скачиваний:
17
Добавлен:
17.04.2013
Размер:
2.64 Кб
Скачать
/*
  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;

const int STAGE_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;
	
	QString last_error;
protected:
	void closeEvent( QCloseEvent *event);
		
public:
};



#endif
Соседние файлы в папке net_copy