X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Ftransfer.h;h=cacfeaacff14de1656f6d2c490e9f593394fb429;hp=e36ed15cc955d9d53dfb1f010b0bf0ef1dbe7012;hb=2d753d5d08707cc668c7d029adec09c16a6f5298;hpb=f5bb6544096b45cde4642e821654c48e26a9f79c diff --git a/src/common/transfer.h b/src/common/transfer.h index e36ed15c..cacfeaac 100644 --- a/src/common/transfer.h +++ b/src/common/transfer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2014 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -24,8 +24,8 @@ #include #include +#include "peer.h" #include "syncableobject.h" -#include "types.h" class Transfer : public SyncableObject { @@ -45,6 +45,7 @@ public: enum State { New, Pending, + Connecting, Transferring, Paused, Completed, @@ -61,6 +62,7 @@ public: Transfer(const QUuid &uuid, QObject *parent = 0); // for creating a syncable object client-side Transfer(Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size = 0, QObject *parent = 0); + inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; } QUuid uuid() const; State state() const; @@ -71,16 +73,14 @@ public: quint64 fileSize() const; QString nick() const; - QString savePath() const; - public slots: // called on the client side - void accept(const QString &savePath) const; - void reject() const; + virtual void accept(const QString &savePath) const { Q_UNUSED(savePath); } + virtual void reject() const {} // called on the core side through sync calls - void requestAccepted(PeerPtr peer = 0); - void requestRejected(); + virtual void requestAccepted(PeerPtr peer) { Q_UNUSED(peer); } + virtual void requestRejected(PeerPtr peer) { Q_UNUSED(peer); } signals: void stateChanged(State state); @@ -91,11 +91,19 @@ signals: void fileSizeChanged(quint64 fileSize); void nickChanged(const QString &nick); + void error(const QString &errorString); + void accepted(PeerPtr peer = 0) const; - void rejected() const; + void rejected(PeerPtr peer = 0) const; -protected: +protected slots: void setState(State state); + void setError(const QString &errorString); + + // called on the client side through sync calls + virtual void dataReceived(PeerPtr, const QByteArray &data) { Q_UNUSED(data); } + + virtual void cleanUp() = 0; private: void init(); @@ -116,9 +124,6 @@ private: quint64 _fileSize; QString _nick; QUuid _uuid; - - // non-synced attributes - mutable QString _savePath; }; #endif