Move the PeerPtr declaration out of types.h
[quassel.git] / src / common / transfer.h
index e36ed15..cacfeaa 100644 (file)
@@ -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 <QHostAddress>
 #include <QUuid>
 
+#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