qftrans/ctransfermanager.h
2009-04-23 10:15:30 +02:00

111 lines
3.4 KiB
C++

/***************************************************************************
* Copyright (C) 2008 by Oliver Groß *
* z.o.gross@gmx.de *
* *
* 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. *
***************************************************************************/
#ifndef QFTRANS_CTRANSFERMANAGER_H
#define QFTRANS_CTRANSFERMANAGER_H
#include <QMainWindow>
#include "common.h"
#include <QItemSelection>
// #include <QAbstractSocket>
class QListView;
namespace qftrans {
class CTransferThread;
class CWorker;
class CConnectionDialog;
/**
@author Oliver Groß <z.o.gross@gmx.de>
*/
class CTransferManager : public QMainWindow {
Q_OBJECT
public:
CTransferManager(QWidget * parent = 0);
~CTransferManager();
public slots:
void openFile();
void setDestinationDir();
void requestServerThread();
void requestClientThread();
void cleanupThread();
void restartSelected();
void cancelSelected();
signals:
void transferAdded(TransferData * transfer);
void transferRemoved(TransferData * transfer);
void uploadAddRequested(TransferData * transfer);
void uploadRemoveRequested(TransferData * transfer);
void uploadRestartRequested(TransferData * transfer);
void downloadRemoveRequested(TransferData * transfer);
void destinationDirChanged(QString & value);
void setupConnectionRequested(bool server, quint16 port, QString & host);
private:
CConnectionDialog * m_ConnectionDialog;
QAction * m_FileOpen;
QAction * m_ConnectionAsServer;
QAction * m_ConnectionAsClient;
QAction * m_ConnectionDisconnect;
QAction * m_TransferRestartAction;
QAction * m_TransferCancelAction;
bool m_ActAsServer;
bool m_Connected;
QString m_DestinationDir;
QTransferDataList m_Data;
CTransferThread * m_TransferThread;
QListView * m_TransferView;
// TransferData * m_SelectedTransfer;
void setupUi();
void removeFileTransfer(TransferData * transfer);
void cleanup();
inline void createThread();
private slots:
void setupConnection();
void connectToWorker(CWorker * worker);
void updateConnectionState(bool connected);
void handleSelectionChanged(const QItemSelection & selected);
void addTransfer(TransferData * transfer);
void removeTransfer(TransferData * transfer);
void updateStatusBar(const QString & message);
void about();
};
}
#endif