X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Ftransfer.h;h=ce24b8b7589cd43d7306da278c03815457071fae;hp=797c2b8ff607f451eafec4ab099399a3b77dff9a;hb=e3c42d072b2b8f39c8c9ea44dfc3bded87ae43b0;hpb=234d1cbd0d5b83602df964251ced84ec5ed4f371 diff --git a/src/common/transfer.h b/src/common/transfer.h index 797c2b8f..ce24b8b7 100644 --- a/src/common/transfer.h +++ b/src/common/transfer.h @@ -25,6 +25,7 @@ #include #include "syncableobject.h" +#include "types.h" class Transfer : public SyncableObject { @@ -44,6 +45,7 @@ public: enum State { New, Pending, + Connecting, Transferring, Paused, Completed, @@ -60,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; @@ -70,6 +73,15 @@ public: quint64 fileSize() const; QString nick() const; +public slots: + // called on the client side + virtual void accept(const QString &savePath) const { Q_UNUSED(savePath); } + virtual void reject() const {} + + // called on the core side through sync calls + virtual void requestAccepted(PeerPtr peer) { Q_UNUSED(peer); } + virtual void requestRejected(PeerPtr peer) { Q_UNUSED(peer); } + signals: void stateChanged(State state); void directionChanged(Direction direction); @@ -79,10 +91,23 @@ signals: void fileSizeChanged(quint64 fileSize); void nickChanged(const QString &nick); -protected: + void error(const QString &errorString); + + void accepted(PeerPtr peer = 0) const; + void rejected(PeerPtr peer = 0) const; + +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(); + void setDirection(Direction direction); void setAddress(const QHostAddress &address); void setPort(quint16 port);