Browse Source

docs(core): Added leading stars

reviewable/pr3577/r8
Diadlo 9 years ago
parent
commit
9a62f44c33
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 7
      src/core/cdata.cpp
  2. 106
      src/core/core.cpp
  3. 174
      src/core/coreav.cpp
  4. 20
      src/core/coreencryption.cpp
  5. 20
      src/core/corefile.cpp
  6. 4
      src/core/corestructs.cpp
  7. 30
      src/core/toxcall.cpp
  8. 94
      src/core/toxid.cpp
  9. 4
      src/friend.cpp
  10. 40
      src/ipc.cpp
  11. 65
      src/nexus.cpp

7
src/core/cdata.cpp

@ -22,8 +22,6 @@ @@ -22,8 +22,6 @@
#include <QString>
#include <tox/tox.h>
// CData
CData::CData(const QString &data, uint16_t byteSize)
{
cData = new uint8_t[byteSize+1];
@ -57,9 +55,6 @@ uint16_t CData::fromString(const QString& data, uint8_t* cData) @@ -57,9 +55,6 @@ uint16_t CData::fromString(const QString& data, uint8_t* cData)
return arr.size();
}
// CUserId
const uint16_t CUserId::SIZE{TOX_PUBLIC_KEY_SIZE};
CUserId::CUserId(const QString &userId) :
@ -74,8 +69,6 @@ QString CUserId::toString(const uint8_t* cUserId) @@ -74,8 +69,6 @@ QString CUserId::toString(const uint8_t* cUserId)
}
// CFriendAddress
const uint16_t CFriendAddress::SIZE{TOX_ADDRESS_SIZE};
CFriendAddress::CFriendAddress(const QString &friendAddress) :

106
src/core/core.cpp

@ -105,8 +105,8 @@ Core::~Core() @@ -105,8 +105,8 @@ Core::~Core()
}
/**
@brief Returns the global widget's Core instance
*/
* @brief Returns the global widget's Core instance
*/
Core* Core::getInstance()
{
return Nexus::getCore();
@ -221,8 +221,8 @@ void Core::makeTox(QByteArray savedata) @@ -221,8 +221,8 @@ void Core::makeTox(QByteArray savedata)
}
/**
@brief Initializes the core, must be called before anything else
*/
* @brief Initializes the core, must be called before anything else
*/
void Core::start()
{
bool isNewProfile = profile.isNewProfile();
@ -336,8 +336,8 @@ void Core::start() @@ -336,8 +336,8 @@ void Core::start()
#define CORE_DISCONNECT_TOLERANCE 30
/**
@brief Processes toxcore events and ensure we stay connected, called by its own timer
*/
* @brief Processes toxcore events and ensure we stay connected, called by its own timer
*/
void Core::process()
{
if (!isReady())
@ -393,8 +393,8 @@ bool Core::checkConnection() @@ -393,8 +393,8 @@ bool Core::checkConnection()
}
/**
@brief Connects us to the Tox network
*/
* @brief Connects us to the Tox network
*/
void Core::bootstrapDht()
{
const Settings& s = Settings::getInstance();
@ -733,8 +733,8 @@ void Core::removeGroup(int groupId, bool fake) @@ -733,8 +733,8 @@ void Core::removeGroup(int groupId, bool fake)
}
/**
@brief Returns our username, or an empty string on failure
*/
* @brief Returns our username, or an empty string on failure
*/
QString Core::getUsername() const
{
QString sname;
@ -785,8 +785,8 @@ void Core::setAvatar(const QByteArray& data) @@ -785,8 +785,8 @@ void Core::setAvatar(const QByteArray& data)
}
/**
@brief Returns our Tox ID
*/
* @brief Returns our Tox ID
*/
ToxId Core::getSelfId() const
{
uint8_t friendAddress[TOX_ADDRESS_SIZE] = {0};
@ -795,8 +795,8 @@ ToxId Core::getSelfId() const @@ -795,8 +795,8 @@ ToxId Core::getSelfId() const
}
/**
@brief Returns our public and private keys
*/
* @brief Returns our public and private keys
*/
QPair<QByteArray, QByteArray> Core::getKeypair() const
{
QPair<QByteArray, QByteArray> keypair;
@ -812,8 +812,8 @@ QPair<QByteArray, QByteArray> Core::getKeypair() const @@ -812,8 +812,8 @@ QPair<QByteArray, QByteArray> Core::getKeypair() const
}
/**
@brief Returns our status message, or an empty string on failure
*/
* @brief Returns our status message, or an empty string on failure
*/
QString Core::getStatusMessage() const
{
QString sname;
@ -828,8 +828,8 @@ QString Core::getStatusMessage() const @@ -828,8 +828,8 @@ QString Core::getStatusMessage() const
}
/**
@brief Returns our user status
*/
* @brief Returns our user status
*/
Status Core::getStatus() const
{
return (Status)tox_self_get_status(tox);
@ -895,8 +895,8 @@ QString Core::sanitize(QString name) @@ -895,8 +895,8 @@ QString Core::sanitize(QString name)
}
/**
@brief Returns the unencrypted tox save data
*/
* @brief Returns the unencrypted tox save data
*/
QByteArray Core::getToxSaveData()
{
uint32_t fileSize = tox_get_savedata_size(tox);
@ -956,8 +956,8 @@ void Core::checkLastOnline(uint32_t friendId) { @@ -956,8 +956,8 @@ void Core::checkLastOnline(uint32_t friendId) {
}
/**
@brief Returns the list of friendIds in our friendlist, an empty list on error
*/
* @brief Returns the list of friendIds in our friendlist, an empty list on error
*/
QVector<uint32_t> Core::getFriendList() const
{
QVector<uint32_t> friends;
@ -967,16 +967,16 @@ QVector<uint32_t> Core::getFriendList() const @@ -967,16 +967,16 @@ QVector<uint32_t> Core::getFriendList() const
}
/**
@brief Return the number of peers in the group chat on success, or -1 on failure
*/
* @brief Return the number of peers in the group chat on success, or -1 on failure
*/
int Core::getGroupNumberPeers(int groupId) const
{
return tox_group_number_peers(tox, groupId);
}
/**
@brief Get the name of a peer of a group
*/
* @brief Get the name of a peer of a group
*/
QString Core::getGroupPeerName(int groupId, int peerId) const
{
QString name;
@ -992,8 +992,8 @@ QString Core::getGroupPeerName(int groupId, int peerId) const @@ -992,8 +992,8 @@ QString Core::getGroupPeerName(int groupId, int peerId) const
}
/**
@brief Get the public key of a peer of a group
*/
* @brief Get the public key of a peer of a group
*/
ToxId Core::getGroupPeerToxId(int groupId, int peerId) const
{
ToxId peerToxId;
@ -1011,8 +1011,8 @@ ToxId Core::getGroupPeerToxId(int groupId, int peerId) const @@ -1011,8 +1011,8 @@ ToxId Core::getGroupPeerToxId(int groupId, int peerId) const
}
/**
@brief Get the names of the peers of a group
*/
* @brief Get the names of the peers of a group
*/
QList<QString> Core::getGroupPeerNames(int groupId) const
{
QList<QString> names;
@ -1045,8 +1045,8 @@ QList<QString> Core::getGroupPeerNames(int groupId) const @@ -1045,8 +1045,8 @@ QList<QString> Core::getGroupPeerNames(int groupId) const
}
/**
@brief Accept a groupchat invite
*/
* @brief Accept a groupchat invite
*/
int Core::joinGroupchat(int32_t friendnumber, uint8_t type, const uint8_t* friend_group_public_key,uint16_t length) const
{
if (type == TOX_GROUPCHAT_TYPE_TEXT)
@ -1069,8 +1069,8 @@ int Core::joinGroupchat(int32_t friendnumber, uint8_t type, const uint8_t* frien @@ -1069,8 +1069,8 @@ int Core::joinGroupchat(int32_t friendnumber, uint8_t type, const uint8_t* frien
}
/**
@brief Quit a groupchat
*/
* @brief Quit a groupchat
*/
void Core::quitGroupChat(int groupId) const
{
tox_del_groupchat(tox, groupId);
@ -1104,16 +1104,16 @@ int Core::createGroup(uint8_t type) @@ -1104,16 +1104,16 @@ int Core::createGroup(uint8_t type)
}
/**
@brief Checks if a friend is online. Unknown friends are considered offline.
*/
* @brief Checks if a friend is online. Unknown friends are considered offline.
*/
bool Core::isFriendOnline(uint32_t friendId) const
{
return tox_friend_get_connection_status(tox, friendId, nullptr) != TOX_CONNECTION_NONE;
}
/**
@brief Checks if we have a friend by address
*/
* @brief Checks if we have a friend by address
*/
bool Core::hasFriendWithAddress(const QString &addr) const
{
// Valid length check
@ -1127,8 +1127,8 @@ bool Core::hasFriendWithAddress(const QString &addr) const @@ -1127,8 +1127,8 @@ bool Core::hasFriendWithAddress(const QString &addr) const
}
/**
@brief Checks if we have a friend by public key
*/
* @brief Checks if we have a friend by public key
*/
bool Core::hasFriendWithPublicKey(const QString &pubkey) const
{
// Valid length check
@ -1161,8 +1161,8 @@ bool Core::hasFriendWithPublicKey(const QString &pubkey) const @@ -1161,8 +1161,8 @@ bool Core::hasFriendWithPublicKey(const QString &pubkey) const
}
/**
@brief Get the full address if known, or public key of a friend
*/
* @brief Get the full address if known, or public key of a friend
*/
QString Core::getFriendAddress(uint32_t friendNumber) const
{
QString id = getFriendPublicKey(friendNumber);
@ -1174,8 +1174,8 @@ QString Core::getFriendAddress(uint32_t friendNumber) const @@ -1174,8 +1174,8 @@ QString Core::getFriendAddress(uint32_t friendNumber) const
}
/**
@brief Get the public key part of the ToxID only
*/
* @brief Get the public key part of the ToxID only
*/
QString Core::getFriendPublicKey(uint32_t friendNumber) const
{
uint8_t rawid[TOX_PUBLIC_KEY_SIZE];
@ -1191,8 +1191,8 @@ QString Core::getFriendPublicKey(uint32_t friendNumber) const @@ -1191,8 +1191,8 @@ QString Core::getFriendPublicKey(uint32_t friendNumber) const
}
/**
@brief Get the username of a friend
*/
* @brief Get the username of a friend
*/
QString Core::getFriendUsername(uint32_t friendnumber) const
{
size_t namesize = tox_friend_get_name_size(tox, friendnumber, nullptr);
@ -1267,8 +1267,8 @@ QString Core::getPeerName(const ToxId& id) const @@ -1267,8 +1267,8 @@ QString Core::getPeerName(const ToxId& id) const
}
/**
@brief Most of the API shouldn't be used until Core is ready, call start() first
*/
* @brief Most of the API shouldn't be used until Core is ready, call start() first
*/
bool Core::isReady()
{
return av && av->getToxAv() && tox && ready;
@ -1284,8 +1284,8 @@ void Core::setNospam(uint32_t nospam) @@ -1284,8 +1284,8 @@ void Core::setNospam(uint32_t nospam)
}
/**
@brief Returns the unencrypted tox save data
*/
* @brief Returns the unencrypted tox save data
*/
void Core::killTimers(bool onlyStop)
{
assert(QThread::currentThread() == coreThread);
@ -1299,9 +1299,9 @@ void Core::killTimers(bool onlyStop) @@ -1299,9 +1299,9 @@ void Core::killTimers(bool onlyStop)
}
/**
@brief Reinitialized the core.
@warning Must be called from the Core thread, with the GUI thread ready to process events.
*/
* @brief Reinitialized the core.
* @warning Must be called from the Core thread, with the GUI thread ready to process events.
*/
void Core::reset()
{
assert(QThread::currentThread() == coreThread);

174
src/core/coreav.cpp

@ -32,51 +32,49 @@ @@ -32,51 +32,49 @@
#include <QtConcurrent/QtConcurrentRun>
/**
@fn void CoreAV::avInvite(uint32_t friendId, bool video)
@brief Sent when a friend calls us.
@param friendId Id of friend in call list.
@param video False if chat is audio only, true audio and video.
@fn void CoreAV::avStart(uint32_t friendId, bool video)
@brief Sent when a call we initiated has started.
@param friendId Id of friend in call list.
@param video False if chat is audio only, true audio and video.
@fn void CoreAV::avEnd(uint32_t friendId)
@brief Sent when a call was ended by the peer.
@param friendId Id of friend in call list.
*/
/**
@var CoreAV::AUDIO_DEFAULT_BITRATE
@brief In kb/s. More than enough for Opus.
@var CoreAV::VIDEO_DEFAULT_BITRATE
@brief Picked at random by fair dice roll.
*/
* @fn void CoreAV::avInvite(uint32_t friendId, bool video)
* @brief Sent when a friend calls us.
* @param friendId Id of friend in call list.
* @param video False if chat is audio only, true audio and video.
*
* @fn void CoreAV::avStart(uint32_t friendId, bool video)
* @brief Sent when a call we initiated has started.
* @param friendId Id of friend in call list.
* @param video False if chat is audio only, true audio and video.
*
* @fn void CoreAV::avEnd(uint32_t friendId)
* @brief Sent when a call was ended by the peer.
* @param friendId Id of friend in call list.
*
* @var CoreAV::AUDIO_DEFAULT_BITRATE
* @brief In kb/s. More than enough for Opus.
*
* @var CoreAV::VIDEO_DEFAULT_BITRATE
* @brief Picked at random by fair dice roll.
*/
/**
@var std::atomic_flag CoreAV::threadSwitchLock
@brief This flag is to be acquired before switching in a blocking way between the UI and CoreAV thread.
The CoreAV thread must have priority for the flag, other threads should back off or release it quickly.
CoreAV needs to interface with three threads, the toxcore/Core thread that fires non-payload
toxav callbacks, the toxav/CoreAV thread that fires AV payload callbacks and manages
most of CoreAV's members, and the UI thread, which calls our [start/answer/cancel]Call functions
and which we call via signals.
When the UI calls us, we switch from the UI thread to the CoreAV thread to do the processing,
when toxcore fires a non-payload av callback, we do the processing in the CoreAV thread and then
switch to the UI thread to send it a signal. Both switches block both threads, so this would deadlock.
*/
* @var std::atomic_flag CoreAV::threadSwitchLock
* @brief This flag is to be acquired before switching in a blocking way between the UI and CoreAV thread.
*
* The CoreAV thread must have priority for the flag, other threads should back off or release it quickly.
* CoreAV needs to interface with three threads, the toxcore/Core thread that fires non-payload
* toxav callbacks, the toxav/CoreAV thread that fires AV payload callbacks and manages
* most of CoreAV's members, and the UI thread, which calls our [start/answer/cancel]Call functions
* and which we call via signals.
* When the UI calls us, we switch from the UI thread to the CoreAV thread to do the processing,
* when toxcore fires a non-payload av callback, we do the processing in the CoreAV thread and then
* switch to the UI thread to send it a signal. Both switches block both threads, so this would deadlock.
*/
/**
@brief Maps friend IDs to ToxFriendCall.
*/
* @brief Maps friend IDs to ToxFriendCall.
*/
IndexedList<ToxFriendCall> CoreAV::calls;
/**
@brief Maps group IDs to ToxGroupCalls.
*/
* @brief Maps group IDs to ToxGroupCalls.
*/
IndexedList<ToxGroupCall> CoreAV::groupCalls;
CoreAV::CoreAV(Tox *tox)
@ -120,8 +118,8 @@ const ToxAV *CoreAV::getToxAv() const @@ -120,8 +118,8 @@ const ToxAV *CoreAV::getToxAv() const
}
/**
@brief Starts the CoreAV main loop that calls toxav's main loop
*/
* @brief Starts the CoreAV main loop that calls toxav's main loop
*/
void CoreAV::start()
{
// Timers can only be touched from their own thread
@ -131,8 +129,8 @@ void CoreAV::start() @@ -131,8 +129,8 @@ void CoreAV::start()
}
/**
@brief Stops the main loop
*/
* @brief Stops the main loop
*/
void CoreAV::stop()
{
// Timers can only be touched from their own thread
@ -142,8 +140,8 @@ void CoreAV::stop() @@ -142,8 +140,8 @@ void CoreAV::stop()
}
/**
@brief Calls itself blocking queued on the coreav thread
*/
* @brief Calls itself blocking queued on the coreav thread
*/
void CoreAV::killTimerFromThread()
{
// Timers can only be touched from their own thread
@ -159,10 +157,10 @@ void CoreAV::process() @@ -159,10 +157,10 @@ void CoreAV::process()
}
/**
@brief Check, that and calls are active now
@return True is any calls are currently active, False otherwise
@note A call about to start is not yet active
*/
* @brief Check, that and calls are active now
* @return True is any calls are currently active, False otherwise
* @note A call about to start is not yet active
*/
bool CoreAV::anyActiveCalls()
{
return !calls.isEmpty();
@ -296,14 +294,14 @@ void CoreAV::timeoutCall(uint32_t friendNum) @@ -296,14 +294,14 @@ void CoreAV::timeoutCall(uint32_t friendNum)
}
/**
@brief Send audio frame to a friend
@param callId Id of friend in call list.
@param pcm An array of audio samples (Pulse-code modulation).
@param samples Number of samples in this frame.
@param chans Number of audio channels.
@param rate Audio sampling rate used in this frame.
@return False only on error, but not if there's nothing to send.
*/
* @brief Send audio frame to a friend
* @param callId Id of friend in call list.
* @param pcm An array of audio samples (Pulse-code modulation).
* @param samples Number of samples in this frame.
* @param chans Number of audio channels.
* @param rate Audio sampling rate used in this frame.
* @return False only on error, but not if there's nothing to send.
*/
bool CoreAV::sendCallAudio(uint32_t callId, const int16_t *pcm, size_t samples, uint8_t chans, uint32_t rate)
{
if (!calls.contains(callId))
@ -403,17 +401,17 @@ void CoreAV::volMuteToggle(uint32_t callId) @@ -403,17 +401,17 @@ void CoreAV::volMuteToggle(uint32_t callId)
}
/**
@brief Called from Tox API when group call receives audio data.
@param[in] tox the Tox object
@param[in] group the group number
@param[in] peer the peer number
@param[in] data the audio data to playback
@param[in] samples the audio samples
@param[in] channels the audio channels
@param[in] sample_rate the audio sample rate
@param[in] core the qTox Core class
*/
* @brief Called from Tox API when group call receives audio data.
*
* @param[in] tox the Tox object
* @param[in] group the group number
* @param[in] peer the peer number
* @param[in] data the audio data to playback
* @param[in] samples the audio samples
* @param[in] channels the audio channels
* @param[in] sample_rate the audio sample rate
* @param[in] core the qTox Core class
*/
void CoreAV::groupCallCallback(void* tox, int group, int peer,
const int16_t* data, unsigned samples,
uint8_t channels, unsigned sample_rate,
@ -445,10 +443,10 @@ void CoreAV::groupCallCallback(void* tox, int group, int peer, @@ -445,10 +443,10 @@ void CoreAV::groupCallCallback(void* tox, int group, int peer,
}
/**
@brief Get a call's video source.
@param friendNum Id of friend in call list.
@return Video surface to show
*/
* @brief Get a call's video source.
* @param friendNum Id of friend in call list.
* @return Video surface to show
*/
VideoSource *CoreAV::getVideoSourceFromCall(int friendNum)
{
if (!calls.contains(friendNum))
@ -461,10 +459,10 @@ VideoSource *CoreAV::getVideoSourceFromCall(int friendNum) @@ -461,10 +459,10 @@ VideoSource *CoreAV::getVideoSourceFromCall(int friendNum)
}
/**
@brief Starts a call in an existing AV groupchat.
@note Call from the GUI thread.
@param groupId Id of group to join
*/
* @brief Starts a call in an existing AV groupchat.
* @note Call from the GUI thread.
* @param groupId Id of group to join
*/
void CoreAV::joinGroupCall(int groupId)
{
qDebug() << QString("Joining group call %1").arg(groupId);
@ -474,10 +472,10 @@ void CoreAV::joinGroupCall(int groupId) @@ -474,10 +472,10 @@ void CoreAV::joinGroupCall(int groupId)
}
/**
@brief Will not leave the group, just stop the call.
@note Call from the GUI thread.
@param groupId Id of group to leave
*/
* @brief Will not leave the group, just stop the call.
* @note Call from the GUI thread.
* @param groupId Id of group to leave
*/
void CoreAV::leaveGroupCall(int groupId)
{
qDebug() << QString("Leaving group call %1").arg(groupId);
@ -532,18 +530,18 @@ bool CoreAV::isGroupCallVolEnabled(int groupId) const @@ -532,18 +530,18 @@ bool CoreAV::isGroupCallVolEnabled(int groupId) const
}
/**
@brief Check, that group has audio or video stream
@param groupId Id of group to check
@return True for AV groups, false for text-only groups
*/
* @brief Check, that group has audio or video stream
* @param groupId Id of group to check
* @return True for AV groups, false for text-only groups
*/
bool CoreAV::isGroupAvEnabled(int groupId) const
{
return tox_group_get_type(Core::getInstance()->tox, groupId) == TOX_GROUPCHAT_TYPE_AV;
}
/**
@brief Forces to regenerate each call's audio sources.
*/
* @brief Forces to regenerate each call's audio sources.
*/
void CoreAV::invalidateCallSources()
{
for (ToxGroupCall& call : groupCalls)
@ -558,9 +556,9 @@ void CoreAV::invalidateCallSources() @@ -558,9 +556,9 @@ void CoreAV::invalidateCallSources()
}
/**
@brief Signal to all peers that we're not sending video anymore.
@note The next frame sent cancels this.
*/
* @brief Signal to all peers that we're not sending video anymore.
* @note The next frame sent cancels this.
*/
void CoreAV::sendNoVideo()
{
// We don't change the audio bitrate, but we signal that we're not sending video anymore

20
src/core/coreencryption.cpp

@ -52,11 +52,11 @@ std::unique_ptr<TOX_PASS_KEY> Core::createPasskey(const QString& password, uint8 @@ -52,11 +52,11 @@ std::unique_ptr<TOX_PASS_KEY> Core::createPasskey(const QString& password, uint8
}
/**
@brief Encrypts data.
@note Uses the default profile's key.
@param data Data to encrypt.
@return Encrypted data.
*/
* @brief Encrypts data.
* @note Uses the default profile's key.
* @param data Data to encrypt.
* @return Encrypted data.
*/
QByteArray Core::encryptData(const QByteArray &data)
{
return encryptData(data, Nexus::getProfile()->getPasskey());
@ -75,11 +75,11 @@ QByteArray Core::encryptData(const QByteArray& data, const TOX_PASS_KEY& encrypt @@ -75,11 +75,11 @@ QByteArray Core::encryptData(const QByteArray& data, const TOX_PASS_KEY& encrypt
}
/**
@brief Decrypts data.
@note Uses the default profile's key.
@param data Data to decrypt.
@return Decrypted data.
*/
* @brief Decrypts data.
* @note Uses the default profile's key.
* @param data Data to decrypt.
* @return Decrypted data.
*/
QByteArray Core::decryptData(const QByteArray &data)
{
return decryptData(data, Nexus::getProfile()->getPasskey());

20
src/core/corefile.cpp

@ -31,22 +31,22 @@ @@ -31,22 +31,22 @@
#include <memory>
/**
@class CoreFile
@brief Implements Core's file transfer callbacks.
Avoids polluting core.h with private internal callbacks.
*/
* @class CoreFile
* @brief Implements Core's file transfer callbacks.
*
* Avoids polluting core.h with private internal callbacks.
*/
QMutex CoreFile::fileSendMutex;
QHash<uint64_t, ToxFile> CoreFile::fileMap;
using namespace std;
/**
@brief Get corefile iteration interval.
tox_iterate calls to get good file transfer performances
@return The maximum amount of time in ms that Core should wait between two tox_iterate() calls.
*/
* @brief Get corefile iteration interval.
*
* tox_iterate calls to get good file transfer performances
* @return The maximum amount of time in ms that Core should wait between two tox_iterate() calls.
*/
unsigned CoreFile::corefileIterationInterval()
{
/// Sleep at most 1000ms if we have no FT, 10 for user FTs, 50 for the rest (avatars, ...)

4
src/core/corestructs.cpp

@ -12,8 +12,8 @@ @@ -12,8 +12,8 @@
*
* They should include this file directly instead to reduce compilation times
*
*
* @var ToxFile::fileKind Data file (default) or avatar
* @var uint8_t ToxFile::fileKind
* @brief Data file (default) or avatar
*/
/**

30
src/core/toxcall.cpp

@ -8,21 +8,21 @@ @@ -8,21 +8,21 @@
#include <QtConcurrent/QtConcurrent>
/**
@var uint32_t ToxCall::callId
@brief Could be a friendNum or groupNum, must uniquely identify the call. Do not modify!
@var bool ToxCall::inactive
@brief True while we're not participating. (stopped group call, ringing but hasn't started yet, ...)
@var bool ToxCall::videoEnabled
@brief True if our user asked for a video call, sending and recieving.
@var bool ToxCall::nullVideoBitrate
@brief True if our video bitrate is zero, i.e. if the device is closed.
@var TOXAV_FRIEND_CALL_STATE ToxCall::state
@brief State of the peer (not ours!)
*/
* @var uint32_t ToxCall::callId
* @brief Could be a friendNum or groupNum, must uniquely identify the call. Do not modify!
*
* @var bool ToxCall::inactive
* @brief True while we're not participating. (stopped group call, ringing but hasn't started yet, ...)
*
* @var bool ToxCall::videoEnabled
* @brief True if our user asked for a video call, sending and recieving.
*
* @var bool ToxCall::nullVideoBitrate
* @brief True if our video bitrate is zero, i.e. if the device is closed.
*
* @var TOXAV_FRIEND_CALL_STATE ToxCall::state
* @brief State of the peer (not ours!)
*/
using namespace std;

94
src/core/toxid.cpp

@ -31,44 +31,44 @@ @@ -31,44 +31,44 @@
#define TOX_HEX_ID_LENGTH 2*TOX_ADDRESS_SIZE
/**
@class ToxId
@brief This class represents a Tox ID.
An ID is composed of 32 bytes long public key, 4 bytes long NoSpam
and 2 bytes long checksum.
e.g.
@code
| C7719C6808C14B77348004956D1D98046CE09A34370E7608150EAD74C3815D30 | C8BA3AB9 | BEB9
| / |
| / NoSpam | Checksum
| Public Key (PK), 32 bytes, 64 characters / 4 bytes | 2 bytes
| | 8 characters| 4 characters
@endcode
*/
* @class ToxId
* @brief This class represents a Tox ID.
*
* An ID is composed of 32 bytes long public key, 4 bytes long NoSpam
* and 2 bytes long checksum.
*
* e.g.
* @code
* | C7719C6808C14B77348004956D1D98046CE09A34370E7608150EAD74C3815D30 | C8BA3AB9 | BEB9
* | / |
* | / NoSpam | Checksum
* | Public Key (PK), 32 bytes, 64 characters / 4 bytes | 2 bytes
* | | 8 characters| 4 characters
* @endcode
*/
/**
@brief The default constructor. Creates an empty Tox ID.
*/
* @brief The default constructor. Creates an empty Tox ID.
*/
ToxId::ToxId()
: publicKey(), noSpam(), checkSum()
{}
/**
@brief The copy constructor.
@param other ToxId to copy
*/
* @brief The copy constructor.
* @param other ToxId to copy
*/
ToxId::ToxId(const ToxId &other)
: publicKey(other.publicKey), noSpam(other.noSpam), checkSum(other.checkSum)
{}
/**
@brief Create a Tox ID from QString.
If the given id is not a valid Tox ID, then:
publicKey == id and noSpam == "" == checkSum.
@param id Tox ID string to convert to ToxId object
* @brief Create a Tox ID from QString.
*
* If the given id is not a valid Tox ID, then:
* publicKey == id and noSpam == "" == checkSum.
*
* @param id Tox ID string to convert to ToxId object
*/
ToxId::ToxId(const QString &id)
{
@ -85,47 +85,47 @@ ToxId::ToxId(const QString &id) @@ -85,47 +85,47 @@ ToxId::ToxId(const QString &id)
}
/**
@brief Compares, that public key equals.
@param other Tox ID to compare.
@return True if both Tox ID have same public keys, false otherwise.
*/
* @brief Compares, that public key equals.
* @param other Tox ID to compare.
* @return True if both Tox ID have same public keys, false otherwise.
*/
bool ToxId::operator==(const ToxId& other) const
{
return publicKey == other.publicKey;
}
/**
@brief Compares, that only public key not equals.
@param other Tox ID to compare.
@return True if both Tox ID have different public keys, false otherwise.
*/
* @brief Compares, that only public key not equals.
* @param other Tox ID to compare.
* @return True if both Tox ID have different public keys, false otherwise.
*/
bool ToxId::operator!=(const ToxId &other) const
{
return publicKey != other.publicKey;
}
/**
@brief Check, that the current user ID is the active user ID
@return True if this Tox ID is equals to
the Tox ID of the currently active profile.
*/
* @brief Check, that the current user ID is the active user ID
* @return True if this Tox ID is equals to
* the Tox ID of the currently active profile.
*/
bool ToxId::isSelf() const
{
return *this == Core::getInstance()->getSelfId();
}
/**
@brief Returns Tox ID converted to QString.
@return The Tox ID as QString.
*/
* @brief Returns Tox ID converted to QString.
* @return The Tox ID as QString.
*/
QString ToxId::toString() const
{
return publicKey + noSpam + checkSum;
}
/**
@brief Clears all elements of the Tox ID.
*/
* @brief Clears all elements of the Tox ID.
*/
void ToxId::clear()
{
publicKey.clear();
@ -134,10 +134,10 @@ void ToxId::clear() @@ -134,10 +134,10 @@ void ToxId::clear()
}
/**
@brief Check, that id is a valid Tox ID.
@param id Tox ID to check.
@return True if id is a valid Tox ID, false otherwise.
*/
* @brief Check, that id is a valid Tox ID.
* @param id Tox ID to check.
* @return True if id is a valid Tox ID, false otherwise.
*/
bool ToxId::isToxId(const QString &id)
{
const QRegularExpression hexRegExp("^[A-Fa-f0-9]+$");

4
src/friend.cpp

@ -52,8 +52,8 @@ Friend::~Friend() @@ -52,8 +52,8 @@ Friend::~Friend()
}
/**
@brief Loads the friend's chat history if enabled
*/
* @brief Loads the friend's chat history if enabled
*/
void Friend::loadHistory()
{
if (Nexus::getProfile()->isHistoryEnabled())

40
src/ipc.cpp

@ -26,17 +26,17 @@ @@ -26,17 +26,17 @@
#include <unistd.h>
/**
@var time_t IPC::lastEvent
@brief When last event was posted.
@var time_t IPC::lastProcessed
@brief When processEvents() ran last time
*/
* @var time_t IPC::lastEvent
* @brief When last event was posted.
*
* @var time_t IPC::lastProcessed
* @brief When processEvents() ran last time
*/
/**
@class IPC
@brief Inter-process communication
*/
* @class IPC
* @brief Inter-process communication
*/
IPC::IPC()
: globalMemory{"qtox-" IPC_PROTOCOL_VERSION}
@ -98,8 +98,8 @@ IPC::~IPC() @@ -98,8 +98,8 @@ IPC::~IPC()
}
/**
@brief Returns the singleton instance.
*/
* @brief Returns the singleton instance.
*/
IPC& IPC::getInstance()
{
static IPC instance;
@ -107,12 +107,12 @@ IPC& IPC::getInstance() @@ -107,12 +107,12 @@ IPC& IPC::getInstance()
}
/**
@brief Post IPC event.
@param name Name to set in IPC event.
@param data Data to set in IPC event (default QByteArray()).
@param dest Settings::getCurrentProfileId() or 0 (main instance, default).
@return Time the event finished.
*/
* @brief Post IPC event.
* @param name Name to set in IPC event.
* @param data Data to set in IPC event (default QByteArray()).
* @param dest Settings::getCurrentProfileId() or 0 (main instance, default).
* @return Time the event finished.
*/
time_t IPC::postEvent(const QString &name, const QByteArray& data, uint32_t dest)
{
QByteArray binName = name.toUtf8();
@ -219,9 +219,9 @@ bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout/*=-1*/) @@ -219,9 +219,9 @@ bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout/*=-1*/)
}
/**
@brief Only called when global memory IS LOCKED.
@return nullptr if no evnts present, IPC event otherwise
*/
* @brief Only called when global memory IS LOCKED.
* @return nullptr if no evnts present, IPC event otherwise
*/
IPC::IPCEvent *IPC::fetchEvent()
{
IPCMemory* mem = global();

65
src/nexus.cpp

@ -44,12 +44,12 @@ @@ -44,12 +44,12 @@
#endif
/**
@class Nexus
This class is in charge of connecting various systems together
and forwarding signals appropriately to the right objects,
it is in charge of starting the GUI and the Core.
*/
* @class Nexus
*
* This class is in charge of connecting various systems together
* and forwarding signals appropriately to the right objects,
* it is in charge of starting the GUI and the Core.
*/
Q_DECLARE_OPAQUE_POINTER(ToxAV*)
@ -75,10 +75,11 @@ Nexus::~Nexus() @@ -75,10 +75,11 @@ Nexus::~Nexus()
}
/**
Sets up invariants and calls showLogin
Hides the login screen and shows the GUI for the given profile.
Will delete the current GUI, if it exists.
*/
* @brief Sets up invariants and calls showLogin
*
* Hides the login screen and shows the GUI for the given profile.
* Will delete the current GUI, if it exists.
*/
void Nexus::start()
{
qDebug() << "Starting up";
@ -145,8 +146,8 @@ void Nexus::start() @@ -145,8 +146,8 @@ void Nexus::start()
}
/**
@brief Hides the main GUI, delete the profile, and shows the login screen
*/
* @brief Hides the main GUI, delete the profile, and shows the login screen
*/
void Nexus::showLogin()
{
delete widget;
@ -218,8 +219,8 @@ void Nexus::showMainGUI() @@ -218,8 +219,8 @@ void Nexus::showMainGUI()
}
/**
@brief Returns the singleton instance.
*/
* @brief Returns the singleton instance.
*/
Nexus& Nexus::getInstance()
{
if (!nexus)
@ -235,9 +236,9 @@ void Nexus::destroyInstance() @@ -235,9 +236,9 @@ void Nexus::destroyInstance()
}
/**
@brief Get core instance.
@return nullptr if not started, core instance otherwise.
*/
* @brief Get core instance.
* @return nullptr if not started, core instance otherwise.
*/
Core* Nexus::getCore()
{
Nexus& nexus = getInstance();
@ -248,18 +249,18 @@ Core* Nexus::getCore() @@ -248,18 +249,18 @@ Core* Nexus::getCore()
}
/**
@brief Get current user profile.
@return nullptr if not started, profile otherwise.
*/
* @brief Get current user profile.
* @return nullptr if not started, profile otherwise.
*/
Profile* Nexus::getProfile()
{
return getInstance().profile;
}
/**
@brief Unload the current profile, if any, and replaces it.
@param profile Profile to set.
*/
* @brief Unload the current profile, if any, and replaces it.
* @param profile Profile to set.
*/
void Nexus::setProfile(Profile* profile)
{
getInstance().profile = profile;
@ -268,9 +269,9 @@ void Nexus::setProfile(Profile* profile) @@ -268,9 +269,9 @@ void Nexus::setProfile(Profile* profile)
}
/**
@brief Get desktop GUI widget.
@return nullptr if not started, desktop widget otherwise.
*/
* @brief Get desktop GUI widget.
* @return nullptr if not started, desktop widget otherwise.
*/
Widget* Nexus::getDesktopGUI()
{
return getInstance().widget;
@ -286,10 +287,10 @@ QString Nexus::getSupportedImageFilter() @@ -286,10 +287,10 @@ QString Nexus::getSupportedImageFilter()
}
/**
@brief Dangerous way to find out if a path is writable.
@param filepath Path to file which should be deleted.
@return True, if file writeable, false otherwise.
*/
* @brief Dangerous way to find out if a path is writable.
* @param filepath Path to file which should be deleted.
* @return True, if file writeable, false otherwise.
*/
bool Nexus::tryRemoveFile(const QString& filepath)
{
QFile tmp(filepath);
@ -299,8 +300,8 @@ bool Nexus::tryRemoveFile(const QString& filepath) @@ -299,8 +300,8 @@ bool Nexus::tryRemoveFile(const QString& filepath)
}
/**
@brief Calls showLogin asynchronously, so we can safely logout from within the main GUI
*/
* @brief Calls showLogin asynchronously, so we can safely logout from within the main GUI
*/
void Nexus::showLoginLater()
{
GUI::setEnabled(false);

Loading…
Cancel
Save