qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Signals | Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CoreFile Class Reference

Manages the file transfer service of toxcore. More...

#include <corefile.h>

Inheritance diagram for CoreFile:
Inheritance graph
Collaboration diagram for CoreFile:
Collaboration graph

Signals

void fileSendStarted (ToxFile file)
 
void fileReceiveRequested (ToxFile file)
 
void fileTransferAccepted (ToxFile file)
 
void fileTransferCancelled (ToxFile file)
 
void fileTransferFinished (ToxFile file)
 
void fileTransferPaused (ToxFile file)
 
void fileTransferInfo (ToxFile file)
 
void fileTransferRemotePausedUnpaused (ToxFile file, bool paused)
 
void fileTransferBrokenUnbroken (ToxFile file, bool broken)
 
void fileNameChanged (const ToxPk &friendPk)
 
void fileSendFailed (uint32_t friendId, const QString &fname)
 

Public Member Functions

void handleAvatarOffer (uint32_t friendId, uint32_t fileId, bool accept, uint64_t filesize)
 
void sendFile (uint32_t friendId, QString filename, QString filePath, long long filesize)
 
void sendAvatarFile (uint32_t friendId, const QByteArray &data)
 
void pauseResumeFile (uint32_t friendId, uint32_t fileId)
 
void cancelFileSend (uint32_t friendId, uint32_t fileId)
 
void cancelFileRecv (uint32_t friendId, uint32_t fileId)
 
void rejectFileRecvRequest (uint32_t friendId, uint32_t fileId)
 
void acceptFileRecvRequest (uint32_t friendId, uint32_t fileId, QString path)
 
unsigned corefileIterationInterval ()
 Get corefile iteration interval. More...
 

Static Public Member Functions

static CoreFilePtr makeCoreFile (Core *core, Tox *tox, CompatibleRecursiveMutex &coreLoopLock)
 

Private Slots

void onConnectionStatusChanged (uint32_t friendId, Status::Status state)
 

Private Member Functions

 CoreFile (Tox *core, CompatibleRecursiveMutex &coreLoopLock)
 
ToxFilefindFile (uint32_t friendId, uint32_t fileId)
 
void addFile (uint32_t friendId, uint32_t fileId, const ToxFile &file)
 
void removeFile (uint32_t friendId, uint32_t fileId)
 

Static Private Member Functions

static constexpr uint64_t getFriendKey (uint32_t friendId, uint32_t fileId)
 
static void connectCallbacks (Tox &tox)
 
static void onFileReceiveCallback (Tox *tox, uint32_t friendId, uint32_t fileId, uint32_t kind, uint64_t filesize, const uint8_t *fname, size_t fnameLen, void *vCore)
 
static void onFileControlCallback (Tox *tox, uint32_t friendId, uint32_t fileId, Tox_File_Control control, void *vCore)
 
static void onFileDataCallback (Tox *tox, uint32_t friendId, uint32_t fileId, uint64_t pos, size_t length, void *vCore)
 
static void onFileRecvChunkCallback (Tox *tox, uint32_t friendId, uint32_t fileId, uint64_t position, const uint8_t *data, size_t length, void *vCore)
 
static QString getCleanFileName (QString filename)
 

Private Attributes

QHash< uint64_t, ToxFilefileMap
 
Tox * tox
 
CompatibleRecursiveMutex * coreLoopLock = nullptr
 

Detailed Description

Manages the file transfer service of toxcore.

Definition at line 46 of file corefile.h.

Constructor & Destructor Documentation

◆ CoreFile()

CoreFile::CoreFile ( Tox *  core,
CompatibleRecursiveMutex &  coreLoopLock 
)
private

Definition at line 53 of file corefile.cpp.

Member Function Documentation

◆ acceptFileRecvRequest()

void CoreFile::acceptFileRecvRequest ( uint32_t  friendId,
uint32_t  fileId,
QString  path 
)

Definition at line 254 of file corefile.cpp.

Here is the caller graph for this function:

◆ addFile()

void CoreFile::addFile ( uint32_t  friendId,
uint32_t  fileId,
const ToxFile file 
)
private

Definition at line 286 of file corefile.cpp.

◆ cancelFileRecv()

void CoreFile::cancelFileRecv ( uint32_t  friendId,
uint32_t  fileId 
)

Definition at line 224 of file corefile.cpp.

Here is the caller graph for this function:

◆ cancelFileSend()

void CoreFile::cancelFileSend ( uint32_t  friendId,
uint32_t  fileId 
)

Definition at line 208 of file corefile.cpp.

Here is the caller graph for this function:

◆ connectCallbacks()

void CoreFile::connectCallbacks ( Tox &  tox)
staticprivate

Definition at line 83 of file corefile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ corefileIterationInterval()

unsigned CoreFile::corefileIterationInterval ( )

Get corefile iteration interval.

tox_iterate calls to get good file transfer performances

Returns
The maximum amount of time in ms that Core should wait between two tox_iterate() calls.

Definition at line 65 of file corefile.cpp.

◆ fileNameChanged

void CoreFile::fileNameChanged ( const ToxPk friendPk)
signal

◆ fileReceiveRequested

void CoreFile::fileReceiveRequested ( ToxFile  file)
signal
Here is the caller graph for this function:

◆ fileSendFailed

void CoreFile::fileSendFailed ( uint32_t  friendId,
const QString &  fname 
)
signal
Here is the caller graph for this function:

◆ fileSendStarted

void CoreFile::fileSendStarted ( ToxFile  file)
signal
Here is the caller graph for this function:

◆ fileTransferAccepted

void CoreFile::fileTransferAccepted ( ToxFile  file)
signal
Here is the caller graph for this function:

◆ fileTransferBrokenUnbroken

void CoreFile::fileTransferBrokenUnbroken ( ToxFile  file,
bool  broken 
)
signal
Here is the caller graph for this function:

◆ fileTransferCancelled

void CoreFile::fileTransferCancelled ( ToxFile  file)
signal
Here is the caller graph for this function:

◆ fileTransferFinished

void CoreFile::fileTransferFinished ( ToxFile  file)
signal
Here is the caller graph for this function:

◆ fileTransferInfo

void CoreFile::fileTransferInfo ( ToxFile  file)
signal
Here is the caller graph for this function:

◆ fileTransferPaused

void CoreFile::fileTransferPaused ( ToxFile  file)
signal
Here is the caller graph for this function:

◆ fileTransferRemotePausedUnpaused

void CoreFile::fileTransferRemotePausedUnpaused ( ToxFile  file,
bool  paused 
)
signal
Here is the caller graph for this function:

◆ findFile()

ToxFile * CoreFile::findFile ( uint32_t  friendId,
uint32_t  fileId 
)
private

Definition at line 273 of file corefile.cpp.

◆ getCleanFileName()

QString CoreFile::getCleanFileName ( QString  filename)
staticprivate

Definition at line 309 of file corefile.cpp.

◆ getFriendKey()

static constexpr uint64_t CoreFile::getFriendKey ( uint32_t  friendId,
uint32_t  fileId 
)
inlinestaticconstexprprivate

Definition at line 85 of file corefile.h.

◆ handleAvatarOffer()

void CoreFile::handleAvatarOffer ( uint32_t  friendId,
uint32_t  fileId,
bool  accept,
uint64_t  filesize 
)

◆ makeCoreFile()

CoreFilePtr CoreFile::makeCoreFile ( Core core,
Tox *  tox,
CompatibleRecursiveMutex &  coreLoopLock 
)
static

Definition at line 42 of file corefile.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onConnectionStatusChanged

void CoreFile::onConnectionStatusChanged ( uint32_t  friendId,
Status::Status  state 
)
privateslot
Here is the caller graph for this function:

◆ onFileControlCallback()

static void CoreFile::onFileControlCallback ( Tox *  tox,
uint32_t  friendId,
uint32_t  fileId,
Tox_File_Control  control,
void *  vCore 
)
staticprivate
Here is the caller graph for this function:

◆ onFileDataCallback()

static void CoreFile::onFileDataCallback ( Tox *  tox,
uint32_t  friendId,
uint32_t  fileId,
uint64_t  pos,
size_t  length,
void *  vCore 
)
staticprivate
Here is the caller graph for this function:

◆ onFileReceiveCallback()

static void CoreFile::onFileReceiveCallback ( Tox *  tox,
uint32_t  friendId,
uint32_t  fileId,
uint32_t  kind,
uint64_t  filesize,
const uint8_t *  fname,
size_t  fnameLen,
void *  vCore 
)
staticprivate
Here is the caller graph for this function:

◆ onFileRecvChunkCallback()

static void CoreFile::onFileRecvChunkCallback ( Tox *  tox,
uint32_t  friendId,
uint32_t  fileId,
uint64_t  position,
const uint8_t *  data,
size_t  length,
void *  vCore 
)
staticprivate
Here is the caller graph for this function:

◆ pauseResumeFile()

void CoreFile::pauseResumeFile ( uint32_t  friendId,
uint32_t  fileId 
)

Definition at line 173 of file corefile.cpp.

Here is the caller graph for this function:

◆ rejectFileRecvRequest()

void CoreFile::rejectFileRecvRequest ( uint32_t  friendId,
uint32_t  fileId 
)

Definition at line 239 of file corefile.cpp.

◆ removeFile()

void CoreFile::removeFile ( uint32_t  friendId,
uint32_t  fileId 
)
private

Definition at line 298 of file corefile.cpp.

◆ sendAvatarFile()

void CoreFile::sendAvatarFile ( uint32_t  friendId,
const QByteArray &  data 
)

Definition at line 92 of file corefile.cpp.

Here is the caller graph for this function:

◆ sendFile()

void CoreFile::sendFile ( uint32_t  friendId,
QString  filename,
QString  filePath,
long long  filesize 
)

Definition at line 144 of file corefile.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ coreLoopLock

CompatibleRecursiveMutex* CoreFile::coreLoopLock = nullptr
private

Definition at line 109 of file corefile.h.

◆ fileMap

QHash<uint64_t, ToxFile> CoreFile::fileMap
private

Definition at line 107 of file corefile.h.

◆ tox

Tox* CoreFile::tox
private

Definition at line 108 of file corefile.h.


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