/***************************************************************************
- * 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 *
#include <QHostAddress>
#include <QUuid>
+#include "peer.h"
#include "syncableobject.h"
-#include "types.h"
class Transfer : public SyncableObject
{
enum State {
New,
Pending,
+ Connecting,
Transferring,
Paused,
Completed,
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;
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);
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();
quint64 _fileSize;
QString _nick;
QUuid _uuid;
-
- // non-synced attributes
- mutable QString _savePath;
};
#endif