Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
CoreTransfer Class Reference

#include </tmp/quassel/src/core/coretransfer.h>

Inheritance diagram for CoreTransfer:
Collaboration diagram for CoreTransfer:

Public Types

enum  State {
  New, Pending, Connecting, Transferring,
  Paused, Completed, Failed, Rejected
}

Public Slots

void start ()
void requestAccepted (PeerPtr peer)
void requestRejected (PeerPtr peer)
virtual void accept (const QString &savePath) const
virtual void reject () const
virtual void setInitialized ()
void requestUpdate (const QVariantMap &properties)
virtual void update (const QVariantMap &properties)

Signals

void stateChanged (State state)
void directionChanged (Direction direction)
void addressChanged (const QHostAddress &address)
void portChanged (quint16 port)
void fileNameChanged (const QString &fileName)
void fileSizeChanged (quint64 fileSize)
void nickChanged (const QString &nick)
void error (const QString &errorString)
void accepted (PeerPtr peer=0) const
void rejected (PeerPtr peer=0) const
void initDone ()
void updatedRemotely ()
void updated ()

Public Member Functions

 CoreTransfer (Direction direction, const QString &nick, const QString &fileName, const QHostAddress &address, quint16 port, quint64 size=0, QObject *parent=0)
QUuid uuid () const
State state () const
Direction direction () const
QHostAddress address () const
quint16 port () const
QString fileName () const
quint64 fileSize () const
QString nick () const
 Q_ENUMS (State) enum Direction
 Q_ENUMS (Direction) Transfer(const QUuid &uuid
virtual const QMetaObject * syncMetaObject () const
virtual QVariantMap toVariantMap ()
 Stores the object's state into a QVariantMap.
virtual void fromVariantMap (const QVariantMap &properties)
 Initialize the object's state from a given QVariantMap.
virtual bool isInitialized () const
void setAllowClientUpdates (bool allow)
bool allowClientUpdates () const

Public Attributes

QObject * parent = 0)

Protected Slots

void setState (State state)
void setError (const QString &errorString)
virtual void dataReceived (PeerPtr, const QByteArray &data)

Protected Member Functions

void sync_call__ (SignalProxy::ProxyMode modeType, const char *funcname,...) const
void renameObject (const QString &newName)

Properties

QUuid uuid
State state
Direction direction
QHostAddress address
quint16 port
QString fileName
quint64 fileSize
QString nick

Private Slots

void startReceiving ()
void onDataReceived ()
void onSocketDisconnected ()
void onSocketError (QAbstractSocket::SocketError error)

Private Member Functions

void setupConnectionForReceive ()
bool relayData (const QByteArray &data, bool requireChunkSize)
virtual void cleanUp ()

Private Attributes

QPointer< Peer_peer
QTcpSocket * _socket
quint64 _pos
QByteArray _buffer
bool _reading

Detailed Description

Definition at line 31 of file coretransfer.h.

Member Enumeration Documentation

enum State
inherited
Enumerator:
New 
Pending 
Connecting 
Transferring 
Paused 
Completed 
Failed 
Rejected 

Definition at line 45 of file transfer.h.

Constructor & Destructor Documentation

CoreTransfer ( Direction  direction,
const QString &  nick,
const QString &  fileName,
const QHostAddress &  address,
quint16  port,
quint64  size = 0,
QObject *  parent = 0 
)

Member Function Documentation

void start ( )
slot
void requestAccepted ( PeerPtr  peer)
slot
void requestRejected ( PeerPtr  peer)
slot
void startReceiving ( )
privateslot

Definition at line 130 of file coretransfer.cpp.

References Transfer::setState(), and Transfer::Transferring.

Referenced by setupConnectionForReceive().

void onDataReceived ( )
privateslot
void onSocketDisconnected ( )
privateslot
void onSocketError ( QAbstractSocket::SocketError  error)
privateslot
bool relayData ( const QByteArray &  data,
bool  requireChunkSize 
)
private

Definition at line 172 of file coretransfer.cpp.

References _buffer, _peer, ARG, chunkSize, Transfer::dataReceived(), Transfer::setError(), and SYNC_OTHER.

Referenced by onDataReceived().

void cleanUp ( )
privatevirtual

Definition at line 42 of file coretransfer.cpp.

References _buffer, _reading, and _socket.

Referenced by onSocketDisconnected().

QUuid uuid ( ) const
inherited
Direction direction ( ) const
inherited

Referenced by Transfer::setDirection(), and start().

QHostAddress address ( ) const
inherited
quint16 port ( ) const
inherited
QString fileName ( ) const
inherited

Referenced by Transfer::setFileName().

quint64 fileSize ( ) const
inherited
QString nick ( ) const
inherited

Referenced by Transfer::setNick().

Q_ENUMS ( State  )
inlineinherited

Definition at line 55 of file transfer.h.

Q_ENUMS ( Direction  ) const
inherited
virtual const QMetaObject* syncMetaObject ( ) const
inlinevirtualinherited

Reimplemented from SyncableObject.

Definition at line 65 of file transfer.h.

virtual void accept ( const QString &  savePath) const
inlinevirtualslotinherited

Definition at line 78 of file transfer.h.

Referenced by ReceiveFileDlg::on_buttonBox_clicked().

virtual void reject ( ) const
inlinevirtualslotinherited

Definition at line 79 of file transfer.h.

void stateChanged ( State  state)
signalinherited

Referenced by Transfer::setState().

void directionChanged ( Direction  direction)
signalinherited

Referenced by Transfer::setDirection().

void addressChanged ( const QHostAddress &  address)
signalinherited

Referenced by Transfer::setAddress().

void portChanged ( quint16  port)
signalinherited

Referenced by Transfer::setPort().

void fileNameChanged ( const QString &  fileName)
signalinherited

Referenced by Transfer::setFileName().

void fileSizeChanged ( quint64  fileSize)
signalinherited

Referenced by Transfer::setFileSize().

void nickChanged ( const QString &  nick)
signalinherited

Referenced by Transfer::setNick().

void error ( const QString &  errorString)
signalinherited
void accepted ( PeerPtr  peer = 0) const
signalinherited
void rejected ( PeerPtr  peer = 0) const
signalinherited
void setError ( const QString &  errorString)
protectedslotinherited
virtual void dataReceived ( PeerPtr  ,
const QByteArray &  data 
)
inlineprotectedvirtualslotinherited

Definition at line 104 of file transfer.h.

Referenced by relayData().

QVariantMap toVariantMap ( )
virtualinherited

Stores the object's state into a QVariantMap.

The default implementation takes dynamic properties as well as getters that have names starting with "init" and stores them in a QVariantMap. Override this method in derived classes in order to store the object state in a custom form.

Note
This is used by SignalProxy to transmit the state of the object to clients that request the initial object state. Later updates use a different mechanism and assume that the state is completely covered by properties and init* getters. DO NOT OVERRIDE THIS unless you know exactly what you do!
Returns
The object's state in a QVariantMap

Definition at line 91 of file syncableobject.cpp.

References SignalProxy::ExtendedMetaObject::methodBaseName(), and SignalProxy::ExtendedMetaObject::methodName().

Referenced by BufferViewSettingsPage::cloneConfig(), AliasesModel::commit(), IgnoreListModel::commit(), ClientBufferViewConfig::ensureDecoration(), IrcConnectionWizard::finishClicked(), SignalProxy::initData(), CoreNetworkConfig::save(), BufferViewSettingsPage::save(), and ClientBufferViewManager::setInitialized().

void fromVariantMap ( const QVariantMap &  properties)
virtualinherited

Initialize the object's state from a given QVariantMap.

See Also
toVariantMap() for important information concerning this method.

Definition at line 135 of file syncableobject.cpp.

References SyncableObject::setInitValue().

Referenced by BufferViewConfig::BufferViewConfig(), BufferViewSettingsPage::cloneConfig(), Network::newIrcChannel(), Network::newIrcUser(), SignalProxy::setInitData(), and SyncableObject::update().

void setAllowClientUpdates ( bool  allow)
inlineinherited
bool allowClientUpdates ( ) const
inlineinherited

Definition at line 82 of file syncableobject.h.

References SyncableObject::_allowClientUpdates.

Referenced by SyncableObject::requestUpdate().

void update ( const QVariantMap &  properties)
virtualslotinherited
void sync_call__ ( SignalProxy::ProxyMode  modeType,
const char *  funcname,
  ... 
) const
protectedinherited
void renameObject ( const QString &  newName)
protectedinherited
void initDone ( )
signalinherited
void updatedRemotely ( )
signalinherited
void updated ( )
signalinherited

Member Data Documentation

QPointer<Peer> _peer
private

Definition at line 57 of file coretransfer.h.

Referenced by relayData(), requestAccepted(), requestRejected(), and start().

QTcpSocket* _socket
private

Definition at line 58 of file coretransfer.h.

Referenced by cleanUp(), onDataReceived(), onSocketError(), and setupConnectionForReceive().

quint64 _pos
private

Definition at line 59 of file coretransfer.h.

Referenced by onDataReceived().

QByteArray _buffer
private

Definition at line 60 of file coretransfer.h.

Referenced by cleanUp(), and relayData().

bool _reading
private

Definition at line 61 of file coretransfer.h.

Referenced by cleanUp(), and onDataReceived().

QObject* parent = 0)
inherited

Definition at line 63 of file transfer.h.

Property Documentation

QUuid uuid
readinherited

Definition at line 35 of file transfer.h.

Referenced by TransferManager::addTransfer().

Transfer::State state
readwriteinherited

Definition at line 35 of file transfer.h.

Transfer::Direction direction
readwriteinherited

Definition at line 36 of file transfer.h.

QHostAddress address
readwriteinherited

Definition at line 37 of file transfer.h.

quint16 port
readwriteinherited

Definition at line 38 of file transfer.h.

QString fileName
readwriteinherited
quint64 fileSize
readwriteinherited

Definition at line 40 of file transfer.h.

Referenced by ReceiveFileDlg::ReceiveFileDlg().

QString nick
readwriteinherited

Definition at line 41 of file transfer.h.

Referenced by ReceiveFileDlg::ReceiveFileDlg().


The documentation for this class was generated from the following files: