From 902828fcc2338b1e598ad5a58687f0745b15d770 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Mon, 1 Aug 2016 11:21:23 +0300 Subject: [PATCH] docs(persistence): Added leading stars --- src/persistence/db/encrypteddb.cpp | 6 +- src/persistence/db/rawdatabase.cpp | 206 ++++++++++----------- src/persistence/history.cpp | 142 +++++++-------- src/persistence/historykeeper.cpp | 14 +- src/persistence/offlinemsgengine.cpp | 12 +- src/persistence/profile.cpp | 222 +++++++++++------------ src/persistence/profilelocker.cpp | 64 +++---- src/persistence/serialize.cpp | 8 +- src/persistence/settings.cpp | 70 +++---- src/persistence/settingsserializer.cpp | 68 +++---- src/persistence/smileypack.cpp | 44 ++--- src/persistence/toxsave.cpp | 10 +- src/widget/about/aboutuser.cpp | 4 +- src/widget/form/addfriendform.cpp | 6 +- src/widget/form/chatform.cpp | 2 +- src/widget/form/genericchatform.h | 6 +- src/widget/form/groupchatform.cpp | 12 +- src/widget/form/settings/generalform.cpp | 8 +- src/widget/form/tabcompleter.cpp | 14 +- src/widget/gui.cpp | 158 ++++++++-------- src/widget/loginscreen.cpp | 4 +- src/widget/maskablepixmapwidget.cpp | 6 +- src/widget/notificationscrollarea.cpp | 10 +- src/widget/qrwidget.cpp | 14 +- src/widget/style.cpp | 60 +++--- src/widget/tool/callconfirmwidget.cpp | 40 ++-- src/widget/tool/croppinglabel.cpp | 6 +- src/widget/tool/screenshotgrabber.cpp | 6 +- src/widget/translator.cpp | 16 +- src/widget/widget.cpp | 12 +- 30 files changed, 625 insertions(+), 625 deletions(-) diff --git a/src/persistence/db/encrypteddb.cpp b/src/persistence/db/encrypteddb.cpp index f69ecd9e5..381bdc948 100644 --- a/src/persistence/db/encrypteddb.cpp +++ b/src/persistence/db/encrypteddb.cpp @@ -30,9 +30,9 @@ #include /** -@var static TOX_PASS_KEY EncryptedDb::decryptionKey -@note When importing, the decryption key may not be the same as the profile key -*/ + * @var static TOX_PASS_KEY EncryptedDb::decryptionKey + * @note When importing, the decryption key may not be the same as the profile key + */ qint64 EncryptedDb::encryptedChunkSize = 4096; qint64 EncryptedDb::plainChunkSize = EncryptedDb::encryptedChunkSize - TOX_PASS_ENCRYPTION_EXTRA_LENGTH; diff --git a/src/persistence/db/rawdatabase.cpp b/src/persistence/db/rawdatabase.cpp index 0da3ae0a9..fb54c5a43 100644 --- a/src/persistence/db/rawdatabase.cpp +++ b/src/persistence/db/rawdatabase.cpp @@ -15,59 +15,59 @@ #include /** -@class RawDatabase -@brief Implements a low level RAII interface to a SQLCipher (SQlite3) database. - -Thread-safe, does all database operations on a worker thread. -The queries must not contain transaction commands (BEGIN/COMMIT/...) or the behavior is undefined. - -@var QMutex RawDatabase::transactionsMutex; -@brief Protects pendingTransactions -*/ + * @class RawDatabase + * @brief Implements a low level RAII interface to a SQLCipher (SQlite3) database. + * + * Thread-safe, does all database operations on a worker thread. + * The queries must not contain transaction commands (BEGIN/COMMIT/...) or the behavior is undefined. + * + * @var QMutex RawDatabase::transactionsMutex; + * @brief Protects pendingTransactions + */ /** -@class Query -@brief A query to be executed by the database. - -Can be composed of one or more SQL statements in the query, -optional BLOB parameters to be bound, and callbacks fired when the query is executed -Calling any database method from a query callback is undefined behavior. - -@var QByteArray RawDatabase::Query::query -@brief UTF-8 query string - -@var QVector RawDatabase::Query::blobs -@brief Bound data blobs - -@var std::function RawDatabase::Query::insertCallback -@brief Called after execution with the last insert rowid - -@var std::function&)> RawDatabase::Query::rowCallback -@brief Called during execution for each row - -@var QVector RawDatabase::Query::statements -@brief Statements to be compiled from the query -*/ + * @class Query + * @brief A query to be executed by the database. + * + * Can be composed of one or more SQL statements in the query, + * optional BLOB parameters to be bound, and callbacks fired when the query is executed + * Calling any database method from a query callback is undefined behavior. + * + * @var QByteArray RawDatabase::Query::query + * @brief UTF-8 query string + * + * @var QVector RawDatabase::Query::blobs + * @brief Bound data blobs + * + * @var std::function RawDatabase::Query::insertCallback + * @brief Called after execution with the last insert rowid + * + * @var std::function&)> RawDatabase::Query::rowCallback + * @brief Called during execution for each row + * + * @var QVector RawDatabase::Query::statements + * @brief Statements to be compiled from the query + */ /** -@struct Transaction -@brief SQL transactions to be processed. - -A transaction is made of queries, which can have bound BLOBs. - -@var std::atomic_bool* RawDatabase::Transaction::success = nullptr; -@brief If not a nullptr, the result of the transaction will be set - -@var std::atomic_bool* RawDatabase::Transaction::done = nullptr; -@brief If not a nullptr, will be set to true when the transaction has been executed -*/ + * @struct Transaction + * @brief SQL transactions to be processed. + * + * A transaction is made of queries, which can have bound BLOBs. + * + * @var std::atomic_bool* RawDatabase::Transaction::success = nullptr; + * @brief If not a nullptr, the result of the transaction will be set + * + * @var std::atomic_bool* RawDatabase::Transaction::done = nullptr; + * @brief If not a nullptr, will be set to true when the transaction has been executed + */ /** -@brief Tries to open a database. -@param path Path to database. -@param password If empty, the database will be opened unencrypted. -Otherwise we will use toxencryptsave to derive a key and encrypt the database. -*/ + * @brief Tries to open a database. + * @param path Path to database. + * @param password If empty, the database will be opened unencrypted. + * Otherwise we will use toxencryptsave to derive a key and encrypt the database. + */ RawDatabase::RawDatabase(const QString &path, const QString& password) : workerThread{new QThread}, path{path}, currentHexKey{deriveKey(password)} { @@ -88,11 +88,11 @@ RawDatabase::~RawDatabase() } /** -@brief Tries to open the database with the given (possibly empty) key. -@param path Path to database. -@param hexKey Hex representation of the key in string. -@return True if success, false otherwise. -*/ + * @brief Tries to open the database with the given (possibly empty) key. + * @param path Path to database. + * @param hexKey Hex representation of the key in string. + * @return True if success, false otherwise. + */ bool RawDatabase::open(const QString& path, const QString &hexKey) { if (QThread::currentThread() != workerThread.get()) @@ -136,8 +136,8 @@ bool RawDatabase::open(const QString& path, const QString &hexKey) } /** -@brief Close the database and free its associated resources. -*/ + * @brief Close the database and free its associated resources. + */ void RawDatabase::close() { if (QThread::currentThread() != workerThread.get()) @@ -153,9 +153,9 @@ void RawDatabase::close() } /** -@brief Checks, that the database is open. -@return True if the database was opened successfully. -*/ + * @brief Checks, that the database is open. + * @return True if the database was opened successfully. + */ bool RawDatabase::isOpen() { // We don't need thread safety since only the ctor/dtor can write this pointer @@ -163,30 +163,30 @@ bool RawDatabase::isOpen() } /** -@brief Executes a SQL transaction synchronously. -@param statement Statement to execute. -@return Whether the transaction was successful. -*/ + * @brief Executes a SQL transaction synchronously. + * @param statement Statement to execute. + * @return Whether the transaction was successful. + */ bool RawDatabase::execNow(const QString& statement) { return execNow(Query{statement}); } /** -@brief Executes a SQL transaction synchronously. -@param statement Statement to execute. -@return Whether the transaction was successful. -*/ + * @brief Executes a SQL transaction synchronously. + * @param statement Statement to execute. + * @return Whether the transaction was successful. + */ bool RawDatabase::execNow(const RawDatabase::Query &statement) { return execNow(QVector{statement}); } /** -@brief Executes a SQL transaction synchronously. -@param statements List of statements to execute. -@return Whether the transaction was successful. -*/ + * @brief Executes a SQL transaction synchronously. + * @param statements List of statements to execute. + * @return Whether the transaction was successful. + */ bool RawDatabase::execNow(const QVector &statements) { if (!sqlite) @@ -217,9 +217,9 @@ bool RawDatabase::execNow(const QVector &statements) } /** -@brief Executes a SQL transaction asynchronously. -@param statement Statement to execute. -*/ + * @brief Executes a SQL transaction asynchronously. + * @param statement Statement to execute. + */ void RawDatabase::execLater(const QString &statement) { execLater(Query{statement}); @@ -249,19 +249,19 @@ void RawDatabase::execLater(const QVector &statements) } /** -@brief Waits until all the pending transactions are executed. -*/ + * @brief Waits until all the pending transactions are executed. + */ void RawDatabase::sync() { QMetaObject::invokeMethod(this, "process", Qt::BlockingQueuedConnection); } /** -@brief Changes the database password, encrypting or decrypting if necessary. -@param password If password is empty, the database will be decrypted. -@return True if success, false otherwise. -@note Will process all transactions before changing the password. -*/ + * @brief Changes the database password, encrypting or decrypting if necessary. + * @param password If password is empty, the database will be decrypted. + * @return True if success, false otherwise. + * @note Will process all transactions before changing the password. + */ bool RawDatabase::setPassword(const QString& password) { if (!sqlite) @@ -356,12 +356,12 @@ bool RawDatabase::setPassword(const QString& password) } /** -@brief Moves the database file on disk to match the new path. -@param newPath Path to move database file. -@return True if success, false otherwise. - -@note Will process all transactions before renaming -*/ + * @brief Moves the database file on disk to match the new path. + * @param newPath Path to move database file. + * @return True if success, false otherwise. + * + * @note Will process all transactions before renaming + */ bool RawDatabase::rename(const QString &newPath) { if (!sqlite) @@ -394,10 +394,10 @@ bool RawDatabase::rename(const QString &newPath) } /** -@brief Deletes the on disk database file after closing it. -@note Will process all transactions before deletings. -@return True if success, false otherwise. -*/ + * @brief Deletes the on disk database file after closing it. + * @note Will process all transactions before deletings. + * @return True if success, false otherwise. + */ bool RawDatabase::remove() { if (!sqlite) @@ -419,10 +419,10 @@ bool RawDatabase::remove() } /** -@brief Derives a 256bit key from the password and returns it hex-encoded -@param password Password to decrypt database -@return String representation of key -*/ + * @brief Derives a 256bit key from the password and returns it hex-encoded + * @param password Password to decrypt database + * @return String representation of key + */ QString RawDatabase::deriveKey(const QString &password) { if (password.isEmpty()) @@ -439,11 +439,11 @@ QString RawDatabase::deriveKey(const QString &password) } /** -@brief Implements the actual processing of pending transactions. -Unqueues, compiles, binds and executes queries, then notifies of results - -@warning MUST only be called from the worker thread -*/ + * @brief Implements the actual processing of pending transactions. + * Unqueues, compiles, binds and executes queries, then notifies of results + * + * @warning MUST only be called from the worker thread + */ void RawDatabase::process() { assert(QThread::currentThread() == workerThread.get()); @@ -578,11 +578,11 @@ void RawDatabase::process() } /** -@brief Extracts a variant from one column of a result row depending on the column type. -@param stmt Statement to execute. -@param col Number of column to extract. -@return Extracted data. -*/ + * @brief Extracts a variant from one column of a result row depending on the column type. + * @param stmt Statement to execute. + * @param col Number of column to extract. + * @return Extracted data. + */ QVariant RawDatabase::extractData(sqlite3_stmt *stmt, int col) { int type = sqlite3_column_type(stmt, col); diff --git a/src/persistence/history.cpp b/src/persistence/history.cpp index 268061174..b29f679e3 100644 --- a/src/persistence/history.cpp +++ b/src/persistence/history.cpp @@ -9,19 +9,19 @@ using namespace std; /** -@class History -@brief Interacts with the profile database to save the chat history. - -@var QHash History::peers -@brief Maps friend public keys to unique IDs by index. -Caches mappings to speed up message saving. -*/ + * @class History + * @brief Interacts with the profile database to save the chat history. + * + * @var QHash History::peers + * @brief Maps friend public keys to unique IDs by index. + * Caches mappings to speed up message saving. + */ /** -@brief Opens the profile database and prepares to work with the history. -@param profileName Profile name to load. -@param password If empty, the database will be opened unencrypted. -*/ + * @brief Opens the profile database and prepares to work with the history. + * @param profileName Profile name to load. + * @param password If empty, the database will be opened unencrypted. + */ History::History(const QString &profileName, const QString &password) : db{getDbPath(profileName), password} { @@ -29,11 +29,11 @@ History::History(const QString &profileName, const QString &password) } /** -@brief Opens the profile database, and import from the old database. -@param profileName Profile name to load. -@param password If empty, the database will be opened unencrypted. -@param oldHistory Old history to import. -*/ + * @brief Opens the profile database, and import from the old database. + * @param profileName Profile name to load. + * @param password If empty, the database will be opened unencrypted. + * @param oldHistory Old history to import. + */ History::History(const QString &profileName, const QString &password, const HistoryKeeper &oldHistory) : History{profileName, password} { @@ -48,44 +48,44 @@ History::~History() } /** -@brief Checks if the database was opened successfully -@return True if database if opened, false otherwise. -*/ + * @brief Checks if the database was opened successfully + * @return True if database if opened, false otherwise. + */ bool History::isValid() { return db.isOpen(); } /** -@brief Changes the database password, will encrypt or decrypt if necessary. -@param password Password to set. -*/ + * @brief Changes the database password, will encrypt or decrypt if necessary. + * @param password Password to set. + */ void History::setPassword(const QString& password) { db.setPassword(password); } /** -@brief Moves the database file on disk to match the new name. -@param newName New name. -*/ + * @brief Moves the database file on disk to match the new name. + * @param newName New name. + */ void History::rename(const QString &newName) { db.rename(getDbPath(newName)); } /** -@brief Deletes the on-disk database file. -@return True if success, false otherwise. -*/ + * @brief Deletes the on-disk database file. + * @return True if success, false otherwise. + */ bool History::remove() { return db.remove(); } /** -@brief Erases all the chat history from the database. -*/ + * @brief Erases all the chat history from the database. + */ void History::eraseHistory() { db.execNow("DELETE FROM faux_offline_pending;" @@ -96,9 +96,9 @@ void History::eraseHistory() } /** -@brief Erases the chat history with one friend. -@param friendPk Friend public key to erase. -*/ + * @brief Erases the chat history with one friend. + * @param friendPk Friend public key to erase. + */ void History::removeFriendHistory(const QString &friendPk) { if (!peers.contains(friendPk)) @@ -125,15 +125,15 @@ void History::removeFriendHistory(const QString &friendPk) } /** -@brief Generate query to insert new message in database -@param friendPk Friend publick key to save. -@param message Message to save. -@param sender Sender to save. -@param time Time of message sending. -@param isSent True if message was already sent. -@param dispName Name, which should be displayed. -@param insertIdCallback Function, called after query execution. -*/ + * @brief Generate query to insert new message in database + * @param friendPk Friend publick key to save. + * @param message Message to save. + * @param sender Sender to save. + * @param time Time of message sending. + * @param isSent True if message was already sent. + * @param dispName Name, which should be displayed. + * @param insertIdCallback Function, called after query execution. + */ QVector History::generateNewMessageQueries(const QString &friendPk, const QString &message, const QString &sender, const QDateTime &time, bool isSent, QString dispName, std::function insertIdCallback) @@ -193,15 +193,15 @@ QVector History::generateNewMessageQueries(const QString &fr } /** -@brief Saves a chat message in the database. -@param friendPk Friend publick key to save. -@param message Message to save. -@param sender Sender to save. -@param time Time of message sending. -@param isSent True if message was already sent. -@param dispName Name, which should be displayed. -@param insertIdCallback Function, called after query execution. -*/ + * @brief Saves a chat message in the database. + * @param friendPk Friend publick key to save. + * @param message Message to save. + * @param sender Sender to save. + * @param time Time of message sending. + * @param isSent True if message was already sent. + * @param dispName Name, which should be displayed. + * @param insertIdCallback Function, called after query execution. + */ void History::addNewMessage(const QString &friendPk, const QString &message, const QString &sender, const QDateTime &time, bool isSent, QString dispName, std::function insertIdCallback) { @@ -209,12 +209,12 @@ void History::addNewMessage(const QString &friendPk, const QString &message, con } /** -@brief Fetches chat messages from the database. -@param friendPk Friend publick key to fetch. -@param from Start of period to fetch. -@param to End of period to fetch. -@return List of messages. -*/ + * @brief Fetches chat messages from the database. + * @param friendPk Friend publick key to fetch. + * @param from Start of period to fetch. + * @param to End of period to fetch. + * @return List of messages. + */ QList History::getChatHistory(const QString &friendPk, const QDateTime &from, const QDateTime &to) { QList messages; @@ -245,29 +245,29 @@ QList History::getChatHistory(const QString &friendPk, con } /** -@brief Marks a message as sent. -Removing message from the faux-offline pending messages list. - -@param id Message ID. -*/ + * @brief Marks a message as sent. + * Removing message from the faux-offline pending messages list. + * + * @param id Message ID. + */ void History::markAsSent(qint64 id) { db.execLater(QString("DELETE FROM faux_offline_pending WHERE id=%1;").arg(id)); } /** -@brief Retrieves the path to the database file for a given profile. -@param profileName Profile name. -@return Path to database. -*/ + * @brief Retrieves the path to the database file for a given profile. + * @param profileName Profile name. + * @return Path to database. + */ QString History::getDbPath(const QString &profileName) { return Settings::getInstance().getSettingsDirPath() + profileName + ".db"; } /** -@brief Makes sure the history tables are created -*/ + * @brief Makes sure the history tables are created + */ void History::init() { if (!isValid()) @@ -292,9 +292,9 @@ void History::init() } /** -@brief Imports messages from the old history file. -@param oldHistory Old history to import. -*/ + * @brief Imports messages from the old history file. + * @param oldHistory Old history to import. + */ void History::import(const HistoryKeeper &oldHistory) { if (!isValid()) diff --git a/src/persistence/historykeeper.cpp b/src/persistence/historykeeper.cpp index 60e19aea0..aa322bf72 100644 --- a/src/persistence/historykeeper.cpp +++ b/src/persistence/historykeeper.cpp @@ -36,18 +36,18 @@ #include "src/persistence/db/encrypteddb.h" /** -@class HistoryKeeper -@brief THIS IS A LEGACY CLASS KEPT FOR BACKWARDS COMPATIBILITY -@deprecated See the History class instead -@warning DO NOT USE! -*/ + * @class HistoryKeeper + * @brief THIS IS A LEGACY CLASS KEPT FOR BACKWARDS COMPATIBILITY + * @deprecated See the History class instead + * @warning DO NOT USE! + */ static HistoryKeeper *historyInstance = nullptr; QMutex HistoryKeeper::historyMutex; /** -@brief Returns the singleton instance. -*/ + * @brief Returns the singleton instance. + */ HistoryKeeper *HistoryKeeper::getInstance(const Profile& profile) { historyMutex.lock(); diff --git a/src/persistence/offlinemsgengine.cpp b/src/persistence/offlinemsgengine.cpp index 46736065b..fdfb6a662 100644 --- a/src/persistence/offlinemsgengine.cpp +++ b/src/persistence/offlinemsgengine.cpp @@ -27,12 +27,12 @@ #include /** -@var static const int OfflineMsgEngine::offlineTimeout -@brief timeout after which faux offline messages get to be re-sent. -Originally was 2s, but since that was causing lots of duplicated -messages on receiving end, make qTox be more lazy about re-sending -should be 20s. -*/ + * @var static const int OfflineMsgEngine::offlineTimeout + * @brief timeout after which faux offline messages get to be re-sent. + * Originally was 2s, but since that was causing lots of duplicated + * messages on receiving end, make qTox be more lazy about re-sending + * should be 20s. + */ const int OfflineMsgEngine::offlineTimeout = 20000; diff --git a/src/persistence/profile.cpp b/src/persistence/profile.cpp index 9492cdc97..c9bd01351 100644 --- a/src/persistence/profile.cpp +++ b/src/persistence/profile.cpp @@ -36,19 +36,19 @@ #include /** -@class Profile -@brief Manages user profiles. - -@var bool Profile::newProfile -@brief True if this is a newly created profile, with no .tox save file yet. - -@var bool Profile::isRemoved -@brief True if the profile has been removed by remove(). - -@var static constexpr int Profile::encryptHeaderSize = 8 -@brief How much data we need to read to check if the file is encrypted. -@note Must be >= TOX_ENC_SAVE_MAGIC_LENGTH (8), which isn't publicly defined. -*/ + * @class Profile + * @brief Manages user profiles. + * + * @var bool Profile::newProfile + * @brief True if this is a newly created profile, with no .tox save file yet. + * + * @var bool Profile::isRemoved + * @brief True if the profile has been removed by remove(). + * + * @var static constexpr int Profile::encryptHeaderSize = 8 + * @brief How much data we need to read to check if the file is encrypted. + * @note Must be >= TOX_ENC_SAVE_MAGIC_LENGTH (8), which isn't publicly defined. + */ QVector Profile::profiles; @@ -81,13 +81,13 @@ Profile::Profile(QString name, const QString &password, bool isNewProfile) } /** -@brief Locks and loads an existing profile and creates the associate Core* instance. -@param name Profile name. -@param password Profile password. -@return Returns a nullptr on error. Profile pointer otherwise. - -@example If the profile is already in use return nullptr. -*/ + * @brief Locks and loads an existing profile and creates the associate Core* instance. + * @param name Profile name. + * @param password Profile password. + * @return Returns a nullptr on error. Profile pointer otherwise. + * + * @example If the profile is already in use return nullptr. + */ Profile* Profile::loadProfile(QString name, const QString &password) { if (ProfileLocker::hasLock()) @@ -166,13 +166,13 @@ Profile* Profile::loadProfile(QString name, const QString &password) } /** -@brief Creates a new profile and the associated Core* instance. -@param name Username. -@param password If password is not empty, the profile will be encrypted. -@return Returns a nullptr on error. Profile pointer otherwise. - -@example If the profile is already in use return nullptr. -*/ + * @brief Creates a new profile and the associated Core* instance. + * @param name Username. + * @param password If password is not empty, the profile will be encrypted. + * @return Returns a nullptr on error. Profile pointer otherwise. + * + * @example If the profile is already in use return nullptr. + */ Profile* Profile::createProfile(QString name, QString password) { if (ProfileLocker::hasLock()) @@ -214,10 +214,10 @@ Profile::~Profile() } /** -@brief Lists all the files in the config dir with a given extension -@param extension Raw extension, e.g. "jpeg" not ".jpeg". -@return Vector of filenames. -*/ + * @brief Lists all the files in the config dir with a given extension + * @param extension Raw extension, e.g. "jpeg" not ".jpeg". + * @return Vector of filenames. + */ QVector Profile::getFilesByExt(QString extension) { QDir dir(Settings::getInstance().getSettingsDirPath()); @@ -232,9 +232,9 @@ QVector Profile::getFilesByExt(QString extension) } /** -@brief Scan for profile, automatically importing them if needed. -@warning NOT thread-safe. -*/ + * @brief Scan for profile, automatically importing them if needed. + * @warning NOT thread-safe. + */ void Profile::scanProfiles() { profiles.clear(); @@ -263,8 +263,8 @@ QString Profile::getName() const } /** -@brief Starts the Core thread -*/ + * @brief Starts the Core thread + */ void Profile::startCore() { coreThread->start(); @@ -276,9 +276,9 @@ bool Profile::isNewProfile() } /** -@brief Loads the profile's .tox save from file, unencrypted -@return Byte array of loaded profile save. -*/ + * @brief Loads the profile's .tox save from file, unencrypted + * @return Byte array of loaded profile save. + */ QByteArray Profile::loadToxSave() { assert(!isRemoved); @@ -338,9 +338,9 @@ fail: } /** -@brief Saves the profile's .tox save, encrypted if needed. -@warning Invalid on deleted profiles. -*/ + * @brief Saves the profile's .tox save, encrypted if needed. + * @warning Invalid on deleted profiles. + */ void Profile::saveToxSave() { assert(core->isReady()); @@ -350,10 +350,10 @@ void Profile::saveToxSave() } /** -@brief Write the .tox save, encrypted if needed. -@param data Byte array of profile save. -@warning Invalid on deleted profiles. -*/ + * @brief Write the .tox save, encrypted if needed. + * @param data Byte array of profile save. + * @warning Invalid on deleted profiles. + */ void Profile::saveToxSave(QByteArray data) { assert(!isRemoved); @@ -397,11 +397,11 @@ void Profile::saveToxSave(QByteArray data) } /** -@brief Gets the path of the avatar file cached by this profile and corresponding to this owner ID. -@param ownerId Path to avatar of friend with this ID will returned. -@param forceUnencrypted If true, return the path to the plaintext file even if this is an encrypted profile. -@return Path to the avatar. -*/ + * @brief Gets the path of the avatar file cached by this profile and corresponding to this owner ID. + * @param ownerId Path to avatar of friend with this ID will returned. + * @param forceUnencrypted If true, return the path to the plaintext file even if this is an encrypted profile. + * @return Path to the avatar. + */ QString Profile::avatarPath(const QString &ownerId, bool forceUnencrypted) { if (password.isEmpty() || forceUnencrypted) @@ -420,19 +420,19 @@ QString Profile::avatarPath(const QString &ownerId, bool forceUnencrypted) } /** -@brief Get our avatar from cache. -@return Avatar as QPixmap. -*/ + * @brief Get our avatar from cache. + * @return Avatar as QPixmap. + */ QPixmap Profile::loadAvatar() { return loadAvatar(core->getSelfId().publicKey); } /** -@brief Get a contact's avatar from cache. -@param ownerId Friend ID to load avatar. -@return Avatar as QPixmap. -*/ + * @brief Get a contact's avatar from cache. + * @param ownerId Friend ID to load avatar. + * @return Avatar as QPixmap. + */ QPixmap Profile::loadAvatar(const QString &ownerId) { QPixmap pic; @@ -441,21 +441,21 @@ QPixmap Profile::loadAvatar(const QString &ownerId) } /** -@brief Get a contact's avatar from cache -@param ownerId Friend ID to load avatar. -@return Avatar as QByteArray. -*/ + * @brief Get a contact's avatar from cache + * @param ownerId Friend ID to load avatar. + * @return Avatar as QByteArray. + */ QByteArray Profile::loadAvatarData(const QString &ownerId) { return loadAvatarData(ownerId, password); } /** -@brief Get a contact's avatar from cache, with a specified profile password. -@param ownerId Friend ID to load avatar. -@param password Profile password to decrypt data. -@return Avatar as QByteArray. -*/ + * @brief Get a contact's avatar from cache, with a specified profile password. + * @param ownerId Friend ID to load avatar. + * @param password Profile password to decrypt data. + * @return Avatar as QByteArray. + */ QByteArray Profile::loadAvatarData(const QString &ownerId, const QString &password) { QString path = avatarPath(ownerId); @@ -484,10 +484,10 @@ QByteArray Profile::loadAvatarData(const QString &ownerId, const QString &passwo } /** -@brief Save an avatar to cache. -@param pic Picture to save. -@param ownerId ID of avatar owner. -*/ + * @brief Save an avatar to cache. + * @param pic Picture to save. + * @param ownerId ID of avatar owner. + */ void Profile::saveAvatar(QByteArray pic, const QString &ownerId) { if (!password.isEmpty() && !pic.isEmpty()) @@ -513,10 +513,10 @@ void Profile::saveAvatar(QByteArray pic, const QString &ownerId) } /** -@brief Get the tox hash of a cached avatar. -@param ownerId Friend ID to get hash. -@return Avatar tox hash. -*/ + * @brief Get the tox hash of a cached avatar. + * @param ownerId Friend ID to get hash. + * @return Avatar tox hash. + */ QByteArray Profile::getAvatarHash(const QString &ownerId) { QByteArray pic = loadAvatarData(ownerId); @@ -526,35 +526,35 @@ QByteArray Profile::getAvatarHash(const QString &ownerId) } /** -@brief Removes our own avatar. -*/ + * @brief Removes our own avatar. + */ void Profile::removeAvatar() { removeAvatar(core->getSelfId().publicKey); } /** -@brief Checks that the history is enabled in the settings, and loaded successfully for this profile. -@return True if enabled, false otherwise. -*/ + * @brief Checks that the history is enabled in the settings, and loaded successfully for this profile. + * @return True if enabled, false otherwise. + */ bool Profile::isHistoryEnabled() { return Settings::getInstance().getEnableLogging() && history; } /** -@brief Get chat history. -@return May return a nullptr if the history failed to load. -*/ + * @brief Get chat history. + * @return May return a nullptr if the history failed to load. + */ History *Profile::getHistory() { return history.get(); } /** -@brief Removes a cached avatar. -@param ownerId Friend ID whose avater to delete. -*/ + * @brief Removes a cached avatar. + * @param ownerId Friend ID whose avater to delete. + */ void Profile::removeAvatar(const QString &ownerId) { QFile::remove(avatarPath(ownerId)); @@ -569,20 +569,20 @@ bool Profile::exists(QString name) } /** -@brief Checks, if profile has a password. -@return True if we have a password set (doesn't check the actual file on disk). -*/ + * @brief Checks, if profile has a password. + * @return True if we have a password set (doesn't check the actual file on disk). + */ bool Profile::isEncrypted() const { return !password.isEmpty(); } /** -@brief Checks if profile is encrypted. -@note Checks the actual file on disk. -@param name Profile name. -@return True if profile is encrypted, false otherwise. -*/ + * @brief Checks if profile is encrypted. + * @note Checks the actual file on disk. + * @param name Profile name. + * @return True if profile is encrypted, false otherwise. + */ bool Profile::isEncrypted(QString name) { uint8_t data[encryptHeaderSize] = {0}; @@ -601,11 +601,11 @@ bool Profile::isEncrypted(QString name) } /** -@brief Removes the profile permanently. -Updates the profiles vector. -@return Vector of filenames that could not be removed. -@warning It is invalid to call loadToxSave or saveToxSave on a deleted profile. -*/ + * @brief Removes the profile permanently. + * Updates the profiles vector. + * @return Vector of filenames that could not be removed. + * @warning It is invalid to call loadToxSave or saveToxSave on a deleted profile. + */ QVector Profile::remove() { if (isRemoved) @@ -670,10 +670,10 @@ QVector Profile::remove() } /** -@brief Tries to rename the profile. -@param newName New name for the profile. -@return False on error, true otherwise. -*/ + * @brief Tries to rename the profile. + * @param newName New name for the profile. + * @return False on error, true otherwise. + */ bool Profile::rename(QString newName) { QString path = Settings::getInstance().getSettingsDirPath() + name, @@ -697,9 +697,9 @@ bool Profile::rename(QString newName) } /** -@brief Checks whether the password is valid. -@return True, if password is valid, false otherwise. -*/ + * @brief Checks whether the password is valid. + * @return True, if password is valid, false otherwise. + */ bool Profile::checkPassword() { if (isRemoved) @@ -719,8 +719,8 @@ const TOX_PASS_KEY& Profile::getPasskey() const } /** -@brief Delete core and restart a new one -*/ + * @brief Delete core and restart a new one + */ void Profile::restartCore() { GUI::setEnabled(false); // Core::reset re-enables it @@ -730,9 +730,9 @@ void Profile::restartCore() } /** -@brief Changes the encryption password and re-saves everything with it -@param newPassword Password for encryption. -*/ + * @brief Changes the encryption password and re-saves everything with it + * @param newPassword Password for encryption. + */ void Profile::setPassword(const QString &newPassword) { QByteArray avatar = loadAvatarData(core->getSelfId().publicKey); diff --git a/src/persistence/profilelocker.cpp b/src/persistence/profilelocker.cpp index d82e39a1e..fc9d51505 100644 --- a/src/persistence/profilelocker.cpp +++ b/src/persistence/profilelocker.cpp @@ -24,12 +24,12 @@ #include /** -@class ProfileLocker -@brief Locks a Tox profile so that multiple instances can not use the same profile. -Only one lock can be acquired at the same time, which means -that there is little need for manually unlocking. -The current lock will expire if you exit or acquire a new one. -*/ + * @class ProfileLocker + * @brief Locks a Tox profile so that multiple instances can not use the same profile. + * Only one lock can be acquired at the same time, which means + * that there is little need for manually unlocking. + * The current lock will expire if you exit or acquire a new one. + */ using namespace std; @@ -42,13 +42,13 @@ QString ProfileLocker::lockPathFromName(const QString& name) } /** -@brief Checks if a profile is currently locked by *another* instance. -If we own the lock, we consider it lockable. -There is no guarantee that the result will still be valid by the -time it is returned, this is provided on a best effort basis. -@param profile Profile name to check. -@return True, if profile locked, false otherwise. -*/ + * @brief Checks if a profile is currently locked by *another* instance. + * If we own the lock, we consider it lockable. + * There is no guarantee that the result will still be valid by the + * time it is returned, this is provided on a best effort basis. + * @param profile Profile name to check. + * @return True, if profile locked, false otherwise. + */ bool ProfileLocker::isLockable(QString profile) { // If we already have the lock, it's definitely lockable @@ -60,10 +60,10 @@ bool ProfileLocker::isLockable(QString profile) } /** -@brief Tries to acquire the lock on a profile, will not block. -@param profile Profile to lock. -@return Returns true if we already own the lock. -*/ + * @brief Tries to acquire the lock on a profile, will not block. + * @param profile Profile to lock. + * @return Returns true if we already own the lock. + */ bool ProfileLocker::lock(QString profile) { if (lockfile && curLockName == profile) @@ -84,8 +84,8 @@ bool ProfileLocker::lock(QString profile) } /** -@brief Releases the lock on the current profile. -*/ + * @brief Releases the lock on the current profile. + */ void ProfileLocker::unlock() { if (!lockfile) @@ -98,11 +98,11 @@ void ProfileLocker::unlock() } /** -@brief Check that we actually own the lock. -In case the file was deleted on disk, restore it. -If we can't get a lock, exit qTox immediately. -If we never had a lock in the first place, exit immediately. -*/ + * @brief Check that we actually own the lock. + * In case the file was deleted on disk, restore it. + * If we can't get a lock, exit qTox immediately. + * If we never had a lock in the first place, exit immediately. + */ void ProfileLocker::assertLock() { if (!lockfile) @@ -128,8 +128,8 @@ void ProfileLocker::assertLock() } /** -@brief Print an error then exit immediately. -*/ + * @brief Print an error then exit immediately. + */ void ProfileLocker::deathByBrokenLock() { qCritical() << "Lock is *BROKEN*, exiting immediately"; @@ -137,18 +137,18 @@ void ProfileLocker::deathByBrokenLock() } /** -@brief Chacks, that profile locked. -@return Returns true if we're currently holding a lock. -*/ + * @brief Chacks, that profile locked. + * @return Returns true if we're currently holding a lock. + */ bool ProfileLocker::hasLock() { return lockfile.operator bool(); } /** -@brief Get current locked profile name. -@return Return the name of the currently loaded profile, a null string if there is none. -*/ + * @brief Get current locked profile name. + * @return Return the name of the currently loaded profile, a null string if there is none. + */ QString ProfileLocker::getCurLockName() { if (lockfile) diff --git a/src/persistence/serialize.cpp b/src/persistence/serialize.cpp index 5b43ece12..293471ee8 100644 --- a/src/persistence/serialize.cpp +++ b/src/persistence/serialize.cpp @@ -20,10 +20,10 @@ #include "src/persistence/serialize.h" /** -@file serialize.cpp -Most of functions in this file are unsafe unless otherwise specified. -@warning Do not use them on untrusted data (e.g. check a signature first). -*/ + * @file serialize.cpp + * Most of functions in this file are unsafe unless otherwise specified. + * @warning Do not use them on untrusted data (e.g. check a signature first). + */ QString dataToString(QByteArray data) { diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index 343cd802c..15b0386c4 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -48,15 +48,15 @@ #include /** -@var QHash Settings::widgetSettings -@brief Assume all widgets have unique names -@warning Don't use it to save every single thing you want to save, use it -for some general purpose widgets, such as MainWindows or Splitters, -which have widget->saveX() and widget->loadX() methods. - -@var QString Settings::toxmeInfo -@brief Toxme info like name@server -*/ + * @var QHash Settings::widgetSettings + * @brief Assume all widgets have unique names + * @warning Don't use it to save every single thing you want to save, use it + * for some general purpose widgets, such as MainWindows or Splitters, + * which have widget->saveX() and widget->loadX() methods. + * + * @var QString Settings::toxmeInfo + * @brief Toxme info like name@server + */ const QString Settings::globalSettingsFile = "qtox.ini"; Settings* Settings::settings{nullptr}; @@ -83,8 +83,8 @@ Settings::~Settings() } /** -@brief Returns the singleton instance. -*/ + * @brief Returns the singleton instance. + */ Settings& Settings::getInstance() { if (!settings) @@ -392,8 +392,8 @@ void Settings::loadPersonal(Profile* profile) } /** -@brief Asynchronous, saves the global settings. -*/ + * @brief Asynchronous, saves the global settings. + */ void Settings::saveGlobal() { if (QThread::currentThread() != settingsThread) @@ -514,17 +514,17 @@ void Settings::saveGlobal() } /** -@brief Asynchronous, saves the current profile. -*/ + * @brief Asynchronous, saves the current profile. + */ void Settings::savePersonal() { savePersonal(Nexus::getProfile()); } /** -@brief Asynchronous, saves the profile. -@param profile Profile to save. -*/ + * @brief Asynchronous, saves the profile. + * @param profile Profile to save. + */ void Settings::savePersonal(Profile* profile) { if (!profile) @@ -623,9 +623,9 @@ uint32_t Settings::makeProfileId(const QString& profile) } /** -@brief Get path to directory, where the settings files are stored. -@return Path to settings directory, ends with a directory separator. -*/ + * @brief Get path to directory, where the settings files are stored. + * @return Path to settings directory, ends with a directory separator. + */ QString Settings::getSettingsDirPath() const { QMutexLocker locker{&bigLock}; @@ -646,9 +646,9 @@ QString Settings::getSettingsDirPath() const } /** -@brief Get path to directory, where the application data are stored. -@return Path to application data, ends with a directory separator. -*/ + * @brief Get path to directory, where the application data are stored. + * @return Path to application data, ends with a directory separator. + */ QString Settings::getAppDataDirPath() const { QMutexLocker locker{&bigLock}; @@ -671,9 +671,9 @@ QString Settings::getAppDataDirPath() const } /** -@brief Get path to directory, where the application cache are stored. -@return Path to application cache, ends with a directory separator. -*/ + * @brief Get path to directory, where the application cache are stored. + * @return Path to application cache, ends with a directory separator. + */ QString Settings::getAppCacheDirPath() const { QMutexLocker locker{&bigLock}; @@ -2201,10 +2201,10 @@ void Settings::setAutoLogin(bool state) } /** -@brief Write a default personal .ini settings file for a profile. -@param basename Filename without extension to save settings. -@example If basename is "profile", settings will be saved in profile.ini -*/ + * @brief Write a default personal .ini settings file for a profile. + * @param basename Filename without extension to save settings. + * @example If basename is "profile", settings will be saved in profile.ini + */ void Settings::createPersonal(QString basename) { QString path = getSettingsDirPath() + QDir::separator() + basename + ".ini"; @@ -2222,8 +2222,8 @@ void Settings::createPersonal(QString basename) } /** -@brief Creates a path to the settings dir, if it doesn't already exist -*/ + * @brief Creates a path to the settings dir, if it doesn't already exist + */ void Settings::createSettingsDir() { QString dir = Settings::getSettingsDirPath(); @@ -2233,8 +2233,8 @@ void Settings::createSettingsDir() } /** -@brief Waits for all asynchronous operations to complete -*/ + * @brief Waits for all asynchronous operations to complete + */ void Settings::sync() { if (QThread::currentThread() != settingsThread) diff --git a/src/persistence/settingsserializer.cpp b/src/persistence/settingsserializer.cpp index bafad9a43..929c165ca 100644 --- a/src/persistence/settingsserializer.cpp +++ b/src/persistence/settingsserializer.cpp @@ -29,34 +29,34 @@ #include /** -@class SettingsSerializer -@brief Serializes a QSettings's data in an (optionally) encrypted binary format. -SettingsSerializer can detect regular .ini files and serialized ones, -it will read both regular and serialized .ini, but only save in serialized format. -The file is encrypted with the current profile's password, if any. -The file is only written to disk if save() is called, the destructor does not save to disk -All member functions are reentrant, but not thread safe. - -@enum SettingsSerializer::RecordTag -@var Value -Followed by a QString key then a QVariant value -@var GroupStart -Followed by a QString group name -@var ArrayStart -Followed by a QString array name and a vuint array size -@var ArrayValue -Followed by a vuint array index, a QString key then a QVariant value -@var ArrayEnd -Not followed by any data -*/ + * @class SettingsSerializer + * @brief Serializes a QSettings's data in an (optionally) encrypted binary format. + * SettingsSerializer can detect regular .ini files and serialized ones, + * it will read both regular and serialized .ini, but only save in serialized format. + * The file is encrypted with the current profile's password, if any. + * The file is only written to disk if save() is called, the destructor does not save to disk + * All member functions are reentrant, but not thread safe. + * + * @enum SettingsSerializer::RecordTag + * @var Value + * Followed by a QString key then a QVariant value + * @var GroupStart + * Followed by a QString group name + * @var ArrayStart + * Followed by a QString array name and a vuint array size + * @var ArrayValue + * Followed by a vuint array index, a QString key then a QVariant value + * @var ArrayEnd + * Not followed by any data + */ enum class RecordTag : uint8_t { }; /** -@var static const char magic[]; -@brief Little endian ASCII "QTOX" magic -*/ + * @var static const char magic[]; + * @brief Little endian ASCII "QTOX" magic + */ const char SettingsSerializer::magic[] = {0x51,0x54,0x4F,0x58}; QDataStream& writeStream(QDataStream& dataStream, const SettingsSerializer::RecordTag& tag) @@ -241,10 +241,10 @@ SettingsSerializer::Value* SettingsSerializer::findValue(const QString& key) } /** -@brief Checks if the file is serialized settings. -@param filePath Path to file to check. -@return False on error, true otherwise. -*/ + * @brief Checks if the file is serialized settings. + * @param filePath Path to file to check. + * @return False on error, true otherwise. + */ bool SettingsSerializer::isSerializedFormat(QString filePath) { QFile f(filePath); @@ -257,8 +257,8 @@ bool SettingsSerializer::isSerializedFormat(QString filePath) } /** -@brief Loads the settings from file. -*/ + * @brief Loads the settings from file. + */ void SettingsSerializer::load() { if (isSerializedFormat(path)) @@ -268,8 +268,8 @@ void SettingsSerializer::load() } /** -@brief Saves the current settings back to file -*/ + * @brief Saves the current settings back to file + */ void SettingsSerializer::save() { QSaveFile f(path); @@ -600,9 +600,9 @@ void SettingsSerializer::readIni() } /** -@brief Remove group. -@note The group must be empty. -@param group ID of group to remove. + * @brief Remove group. + * @note The group must be empty. + * @param group ID of group to remove. */ void SettingsSerializer::removeGroup(int group) { diff --git a/src/persistence/smileypack.cpp b/src/persistence/smileypack.cpp index 3688ced59..4b94f1051 100644 --- a/src/persistence/smileypack.cpp +++ b/src/persistence/smileypack.cpp @@ -36,21 +36,21 @@ #include /** -@class SmileyPack -@brief Maps emoticons to smileys. - -@var QHash SmileyPack::filenameTable -@brief Matches an emoticon to its corresponding smiley ie. ":)" -> "happy.png" - -@var QHash SmileyPack::iconCache -@brief representation of a smiley ie. "happy.png" -> data - -@var QList SmileyPack::emoticons -@brief {{ ":)", ":-)" }, {":(", ...}, ... } - -@var QString SmileyPack::path -@brief directory containing the cfg and image files -*/ + * @class SmileyPack + * @brief Maps emoticons to smileys. + * + * @var QHash SmileyPack::filenameTable + * @brief Matches an emoticon to its corresponding smiley ie. ":)" -> "happy.png" + * + * @var QHash SmileyPack::iconCache + * @brief representation of a smiley ie. "happy.png" -> data + * + * @var QList SmileyPack::emoticons + * @brief {{ ":)", ":-)" }, {":(", ...}, ... } + * + * @var QString SmileyPack::path + * @brief directory containing the cfg and image files + */ SmileyPack::SmileyPack() { @@ -60,8 +60,8 @@ SmileyPack::SmileyPack() } /** -@brief Returns the singleton instance. -*/ + * @brief Returns the singleton instance. + */ SmileyPack& SmileyPack::getInstance() { static SmileyPack smileyPack; @@ -113,11 +113,11 @@ bool SmileyPack::isValid(const QString &filename) } /** -@brief Load smile pack -@note The caller must lock loadingMutex and should run it in a thread -@param filename Filename of smilepack. -@return False if cannot open file, true otherwise. -*/ + * @brief Load smile pack + * @note The caller must lock loadingMutex and should run it in a thread + * @param filename Filename of smilepack. + * @return False if cannot open file, true otherwise. + */ bool SmileyPack::load(const QString& filename) { // discard old data diff --git a/src/persistence/toxsave.cpp b/src/persistence/toxsave.cpp index 2d52ec466..c4990f1e8 100644 --- a/src/persistence/toxsave.cpp +++ b/src/persistence/toxsave.cpp @@ -35,11 +35,11 @@ bool toxSaveEventHandler(const QByteArray& eventData) } /** -@brief Import new profile. -@note Will wait until the core is ready first. -@param path Path to .tox file. -@return True if import success, false, otherwise. -*/ + * @brief Import new profile. + * @note Will wait until the core is ready first. + * @param path Path to .tox file. + * @return True if import success, false, otherwise. + */ bool handleToxSave(const QString& path) { Core* core = Core::getInstance(); diff --git a/src/widget/about/aboutuser.cpp b/src/widget/about/aboutuser.cpp index da51ed64b..8be26d47d 100644 --- a/src/widget/about/aboutuser.cpp +++ b/src/widget/about/aboutuser.cpp @@ -89,8 +89,8 @@ void AboutUser::onSelectDirClicked() } /** -@brief Called when user clicks the bottom OK button, save all settings -*/ + * @brief Called when user clicks the bottom OK button, save all settings + */ void AboutUser::onAcceptedClicked() { ToxId toxId = ToxId(ui->publicKey->text()); diff --git a/src/widget/form/addfriendform.cpp b/src/widget/form/addfriendform.cpp index fd587f49e..50933abee 100644 --- a/src/widget/form/addfriendform.cpp +++ b/src/widget/form/addfriendform.cpp @@ -42,9 +42,9 @@ #include /** -@var QString AddFriendForm::lastUsername -@brief Cached username so we can retranslate the invite message -*/ + * @var QString AddFriendForm::lastUsername + * @brief Cached username so we can retranslate the invite message + */ AddFriendForm::AddFriendForm() { diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index 36b85b2d8..d6cbd6209 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -1010,7 +1010,7 @@ void ChatForm::SendMessageStr(QString msg) } else { - /// TODO: Make faux-offline messaging work partially with the history disabled + /// @todo Make faux-offline messaging work partially with the history disabled ma->markAsSent(QDateTime::currentDateTime()); } diff --git a/src/widget/form/genericchatform.h b/src/widget/form/genericchatform.h index 749e51607..913ed3468 100644 --- a/src/widget/form/genericchatform.h +++ b/src/widget/form/genericchatform.h @@ -29,9 +29,9 @@ #include "src/core/toxid.h" /** -Spacing in px inserted when the author of the last message changes -@note Why the hell is this a thing? surely the different font is enough? -*/ + * Spacing in px inserted when the author of the last message changes + * @note Why the hell is this a thing? surely the different font is enough? + */ #define AUTHOR_CHANGE_SPACING 5 class QLabel; diff --git a/src/widget/form/groupchatform.cpp b/src/widget/form/groupchatform.cpp index 81003fb78..fc3104de6 100644 --- a/src/widget/form/groupchatform.cpp +++ b/src/widget/form/groupchatform.cpp @@ -38,12 +38,12 @@ #include /** -@var QList GroupChatForm::peerLabels -@brief Maps peernumbers to the QLabels in namesListLayout. - -@var QMap GroupChatForm::peerAudioTimers -@brief Timeout = peer stopped sending audio. -*/ + * @var QList GroupChatForm::peerLabels + * @brief Maps peernumbers to the QLabels in namesListLayout. + * + * @var QMap GroupChatForm::peerAudioTimers + * @brief Timeout = peer stopped sending audio. + */ GroupChatForm::GroupChatForm(Group* chatGroup) : group(chatGroup), inCall{false} diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index 7445d5fb2..ac57b6f8b 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -267,10 +267,10 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) connect(bodyUI->cbDontGroupWindows, &QCheckBox::stateChanged, this, &GeneralForm::onDontGroupWindowsChanged); connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged); - // prevent stealing mouse wheel scroll - // scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling - // you can scroll through general settings without accidentially changing theme/skin/icons etc. - // @see GeneralForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more + /// prevent stealing mouse wheel scroll + /// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling + /// you can scroll through general settings without accidentially changing theme/skin/icons etc. + /// @see GeneralForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more for (QComboBox *cb : findChildren()) { cb->installEventFilter(this); diff --git a/src/widget/form/tabcompleter.cpp b/src/widget/form/tabcompleter.cpp index a660cf078..316f112fe 100644 --- a/src/widget/form/tabcompleter.cpp +++ b/src/widget/form/tabcompleter.cpp @@ -20,13 +20,6 @@ along with qTox. If not, see . */ -/** -@file tabcompleter.h -@file tabcompleter.cpp -These files were taken from the Quassel IRC client source (src/uisupport), and -was greatly simplified for use in qTox. -*/ - #include "tabcompleter.h" #include @@ -36,6 +29,13 @@ was greatly simplified for use in qTox. #include "src/group.h" #include "src/widget/tool/chattextedit.h" +/** + * @file tabcompleter.h + * @file tabcompleter.cpp + * These files were taken from the Quassel IRC client source (src/uisupport), and + * was greatly simplified for use in qTox. + */ + const QString TabCompleter::nickSuffix = QString(": "); TabCompleter::TabCompleter(ChatTextEdit* msgEdit, Group* group) diff --git a/src/widget/gui.cpp b/src/widget/gui.cpp index 3f04272f7..628886492 100644 --- a/src/widget/gui.cpp +++ b/src/widget/gui.cpp @@ -33,15 +33,15 @@ #include /** -@class GUI -@brief Abstracts the GUI from the target backend (DesktopGUI, ...) - -All the functions exposed here are thread-safe. -Prefer calling this class to calling a GUI backend directly. - -@fn void GUI::resized() -@brief Emitted when the GUI is resized on supported platforms. -*/ + * @class GUI + * @brief Abstracts the GUI from the target backend (DesktopGUI, ...) + * + * All the functions exposed here are thread-safe. + * Prefer calling this class to calling a GUI backend directly. + * + * @fn void GUI::resized() + * @brief Emitted when the GUI is resized on supported platforms. + */ GUI::GUI(QObject *parent) : QObject(parent) @@ -52,8 +52,8 @@ GUI::GUI(QObject *parent) : } /** -@brief Returns the singleton instance. -*/ + * @brief Returns the singleton instance. + */ GUI& GUI::getInstance() { static GUI gui; @@ -63,8 +63,8 @@ GUI& GUI::getInstance() // Implementation of the public clean interface /** -@brief Clear the GUI's contact list. -*/ + * @brief Clear the GUI's contact list. + */ void GUI::clearContacts() { if (QThread::currentThread() == qApp->thread()) @@ -74,10 +74,10 @@ void GUI::clearContacts() } /** -@brief Will enable or disable the GUI. -@note A disabled GUI can't be interacted with by the user. -@param state Enable/disable GUI. -*/ + * @brief Will enable or disable the GUI. + * @note A disabled GUI can't be interacted with by the user. + * @param state Enable/disable GUI. + */ void GUI::setEnabled(bool state) { if (QThread::currentThread() == qApp->thread()) @@ -92,11 +92,11 @@ void GUI::setEnabled(bool state) } /** -@brief Change the title of the main window. -@param title Titile to set. - -This is usually always visible to the user. -*/ + * @brief Change the title of the main window. + * @param title Titile to set. + * + * This is usually always visible to the user. + */ void GUI::setWindowTitle(const QString& title) { if (QThread::currentThread() == qApp->thread()) @@ -111,8 +111,8 @@ void GUI::setWindowTitle(const QString& title) } /** -@brief Reloads the application theme and redraw the window. -*/ + * @brief Reloads the application theme and redraw the window. + */ void GUI::reloadTheme() { if (QThread::currentThread() == qApp->thread()) @@ -126,8 +126,8 @@ void GUI::reloadTheme() } /** -@brief Optionally switches to a view of the qTox update being downloaded. -*/ + * @brief Optionally switches to a view of the qTox update being downloaded. + */ void GUI::showUpdateDownloadProgress() { if (QThread::currentThread() == qApp->thread()) @@ -141,10 +141,10 @@ void GUI::showUpdateDownloadProgress() } /** -@brief Show some text to the user. -@param title Title of information window. -@param msg Text in information window. -*/ + * @brief Show some text to the user. + * @param title Title of information window. + * @param msg Text in information window. + */ void GUI::showInfo(const QString& title, const QString& msg) { if (QThread::currentThread() == qApp->thread()) @@ -159,10 +159,10 @@ void GUI::showInfo(const QString& title, const QString& msg) } /** -@brief Show a warning to the user -@param title Title of warning window. -@param msg Text in warning window. -*/ + * @brief Show a warning to the user + * @param title Title of warning window. + * @param msg Text in warning window. + */ void GUI::showWarning(const QString& title, const QString& msg) { if (QThread::currentThread() == qApp->thread()) @@ -177,10 +177,10 @@ void GUI::showWarning(const QString& title, const QString& msg) } /** -@brief Show an error to the user. -@param title Title of error window. -@param msg Text in error window. -*/ + * @brief Show an error to the user. + * @param title Title of error window. + * @param msg Text in error window. + */ void GUI::showError(const QString& title, const QString& msg) { if (QThread::currentThread() == qApp->thread()) @@ -200,14 +200,14 @@ void GUI::showError(const QString& title, const QString& msg) } /** -@brief Asks the user a question with Ok/Cancel or Yes/No buttons. -@param title Title of question window. -@param msg Text in question window. -@param defaultAns If is true, default was positive answer. Negative otherwise. -@param warning If is true, we will use a special warning style. -@param yesno Show "Yes" and "No" buttons. -@return True if the answer is positive, false otherwise. -*/ + * @brief Asks the user a question with Ok/Cancel or Yes/No buttons. + * @param title Title of question window. + * @param msg Text in question window. + * @param defaultAns If is true, default was positive answer. Negative otherwise. + * @param warning If is true, we will use a special warning style. + * @param yesno Show "Yes" and "No" buttons. + * @return True if the answer is positive, false otherwise. + */ bool GUI::askQuestion(const QString& title, const QString& msg, bool defaultAns, bool warning, bool yesno) @@ -229,17 +229,17 @@ bool GUI::askQuestion(const QString& title, const QString& msg, } /** -@brief Asks the user a question. - -The text for the displayed buttons can be specified. -@param title Title of question window. -@param msg Text in question window. -@param button1 Text of positive button. -@param button2 Text of negative button. -@param defaultAns If is true, default was positive answer. Negative otherwise. -@param warning If is true, we will use a special warning style. -@return True if the answer is positive, false otherwise. -*/ + * @brief Asks the user a question. + * + * The text for the displayed buttons can be specified. + * @param title Title of question window. + * @param msg Text in question window. + * @param button1 Text of positive button. + * @param button2 Text of negative button. + * @param defaultAns If is true, default was positive answer. Negative otherwise. + * @param warning If is true, we will use a special warning style. + * @return True if the answer is positive, false otherwise. + */ bool GUI::askQuestion(const QString& title, const QString& msg, const QString& button1, const QString& button2, bool defaultAns, bool warning) @@ -260,20 +260,20 @@ bool GUI::askQuestion(const QString& title, const QString& msg, } /** -@brief Asks the user to input text and returns the answer. - -The interface is equivalent to QInputDialog::getItem() -@param parent Is the dialog's parent widget -@param title Is the text which is displayed in the title bar of the dialog. -@param label Is the text which is shown to the user (it should say what should be entered). -@param items Is the string list which is inserted into the combobox. -@param current Is the number of the item which should be the current item. -@param editable If is true the user can enter their own text, otherwise the user may only select one of the existing items. -@param ok If is nonnull will be set to true if the user pressed OK and to false if the user pressed Cancel. -@param flags The dialog will uses to widget flags. -@param hints Is the input method hints that will be used if the combobox is editable and an input method is active. -@return This function returns the text of the current item, or if editable is true, the current text of the combobox. -*/ + * @brief Asks the user to input text and returns the answer. + * + * The interface is equivalent to QInputDialog::getItem() + * @param parent Is the dialog's parent widget + * @param title Is the text which is displayed in the title bar of the dialog. + * @param label Is the text which is shown to the user (it should say what should be entered). + * @param items Is the string list which is inserted into the combobox. + * @param current Is the number of the item which should be the current item. + * @param editable If is true the user can enter their own text, otherwise the user may only select one of the existing items. + * @param ok If is nonnull will be set to true if the user pressed OK and to false if the user pressed Cancel. + * @param flags The dialog will uses to widget flags. + * @param hints Is the input method hints that will be used if the combobox is editable and an input method is active. + * @return This function returns the text of the current item, or if editable is true, the current text of the combobox. + */ QString GUI::itemInputDialog(QWidget * parent, const QString & title, const QString & label, const QStringList & items, int current, bool editable, bool * ok, @@ -298,11 +298,11 @@ QString GUI::itemInputDialog(QWidget * parent, const QString & title, } /** -@brief Asks the user to answer a password. -@param cancel Is the text on the cancel button. -@param body Is descriptive text that will be shown to the user. -@return Entered password. -*/ + * @brief Asks the user to answer a password. + * @param cancel Is the text on the cancel button. + * @param body Is descriptive text that will be shown to the user. + * @return Entered password. + */ QString GUI::passwordDialog(const QString& cancel, const QString& body) { if (QThread::currentThread() == qApp->thread()) @@ -468,9 +468,9 @@ QString GUI::_passwordDialog(const QString& cancel, const QString& body) // Other /** -@brief Get the main widget. -@return The main QWidget* of the application -*/ + * @brief Get the main widget. + * @return The main QWidget* of the application + */ QWidget* GUI::getMainWidget() { QWidget* maingui{nullptr}; diff --git a/src/widget/loginscreen.cpp b/src/widget/loginscreen.cpp index f7ebec522..e128dac31 100644 --- a/src/widget/loginscreen.cpp +++ b/src/widget/loginscreen.cpp @@ -72,8 +72,8 @@ LoginScreen::~LoginScreen() } /** -@brief Resets the UI, clears all fields. -*/ + * @brief Resets the UI, clears all fields. + */ void LoginScreen::reset() { ui->newUsername->clear(); diff --git a/src/widget/maskablepixmapwidget.cpp b/src/widget/maskablepixmapwidget.cpp index 8409108a7..aa855836a 100644 --- a/src/widget/maskablepixmapwidget.cpp +++ b/src/widget/maskablepixmapwidget.cpp @@ -21,9 +21,9 @@ #include /** -@var QPixmap* MaskablePixmapWidget::renderTarget -@brief pointer to dynamically call the constructor. -*/ + * @var QPixmap* MaskablePixmapWidget::renderTarget + * @brief pointer to dynamically call the constructor. + */ MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName) : QWidget(parent) diff --git a/src/widget/notificationscrollarea.cpp b/src/widget/notificationscrollarea.cpp index 0956f8884..f0adf1d7a 100644 --- a/src/widget/notificationscrollarea.cpp +++ b/src/widget/notificationscrollarea.cpp @@ -67,16 +67,16 @@ void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget) } /** -@brief Delete notification bar from visible elements on scroll area -*/ + * @brief Delete notification bar from visible elements on scroll area + */ void NotificationScrollArea::updateVisualTracking() { updateTracking(nullptr); } /** -@brief Delete notification bar from visible elements and widget on scroll area -@param widget Chatroom widget to remove from tracked widgets -*/ + * @brief Delete notification bar from visible elements and widget on scroll area + * @param widget Chatroom widget to remove from tracked widgets + */ void NotificationScrollArea::updateTracking(GenericChatroomWidget *widget) { QHash::iterator i = trackedWidgets.begin(); diff --git a/src/widget/qrwidget.cpp b/src/widget/qrwidget.cpp index 1e1c91dbd..9e37f6669 100644 --- a/src/widget/qrwidget.cpp +++ b/src/widget/qrwidget.cpp @@ -32,9 +32,9 @@ #endif /** -@file qrwidget.cpp -@link https://stackoverflow.com/questions/21400254/how-to-draw-a-qr-code-with-qt-in-native-c-c -*/ + * @file qrwidget.cpp + * @link https://stackoverflow.com/questions/21400254/how-to-draw-a-qr-code-with-qt-in-native-c-c + */ QRWidget::QRWidget(QWidget *parent) : QWidget(parent), data("0") //Note: The encoding fails with empty string so I just default to something else. @@ -63,10 +63,10 @@ QImage* QRWidget::getImage() } /** -@brief QRWidget::saveImage -@param path Full path to the file with extension. -@return indicate if saving was successful. -*/ + * @brief QRWidget::saveImage + * @param path Full path to the file with extension. + * @return indicate if saving was successful. + */ bool QRWidget::saveImage(QString path) { return image->save(path, 0, 75); //0 - image format same as file extension, 75-quality, png file is ~6.3kb diff --git a/src/widget/style.cpp b/src/widget/style.cpp index d63ac6795..6a6730329 100644 --- a/src/widget/style.cpp +++ b/src/widget/style.cpp @@ -32,29 +32,29 @@ #include /** -@enum Style::Font - -@var ExtraBig -@brief [SystemDefault + 2]px, bold - -@var Big -@brief [SystemDefault]px - -@var BigBold -@brief [SystemDefault]px, bold - -@var Medium -@brief [SystemDefault - 1]px - -@var MediumBold -@brief [SystemDefault - 1]px, bold - -@var Small -@brief [SystemDefault - 2]px - -@var SmallLight -@brief [SystemDefault - 2]px, light -*/ + * @enum Style::Font + * + * @var ExtraBig + * @brief [SystemDefault + 2]px, bold + * + * @var Big + * @brief [SystemDefault]px + * + * @var BigBold + * @brief [SystemDefault]px, bold + * + * @var Medium + * @brief [SystemDefault - 1]px + * + * @var MediumBold + * @brief [SystemDefault - 1]px, bold + * + * @var Small + * @brief [SystemDefault - 2]px + * + * @var SmallLight + * @brief [SystemDefault - 2]px, light + */ // helper functions QFont appFont(int pixelSize, int weight) @@ -207,11 +207,11 @@ void Style::setThemeColor(int color) } /** -@brief Set theme color. -@param color Color to set. - -Pass an invalid QColor to reset to defaults. -*/ + * @brief Set theme color. + * @param color Color to set. + * + * Pass an invalid QColor to reset to defaults. + */ void Style::setThemeColor(const QColor &color) { if (!color.isValid()) @@ -237,8 +237,8 @@ void Style::setThemeColor(const QColor &color) } /** -@brief Reloads some CCS -*/ + * @brief Reloads some CCS + */ void Style::applyTheme() { GUI::reloadTheme(); diff --git a/src/widget/tool/callconfirmwidget.cpp b/src/widget/tool/callconfirmwidget.cpp index 234bb6a3f..9da42dd61 100644 --- a/src/widget/tool/callconfirmwidget.cpp +++ b/src/widget/tool/callconfirmwidget.cpp @@ -32,24 +32,24 @@ #include /** -@class CallConfirmWidget -@brief This is a widget with dialog buttons to accept/reject a call - -It tracks the position of another widget called the anchor -and looks like a bubble at the bottom of that widget. - -@var const QWidget* CallConfirmWidget::anchor -@brief The widget we're going to be tracking - -@var const Friend& CallConfirmWidget::f -@brief The friend on whose chat form we should appear - -@var const int CallConfirmWidget::roundedFactor -@brief By how much are the corners of the main rect rounded - -@var const qreal CallConfirmWidget::rectRatio -@brief Used to correct the rounding factors on non-square rects -*/ + * @class CallConfirmWidget + * @brief This is a widget with dialog buttons to accept/reject a call + * + * It tracks the position of another widget called the anchor + * and looks like a bubble at the bottom of that widget. + * + * @var const QWidget* CallConfirmWidget::anchor + * @brief The widget we're going to be tracking + * + * @var const Friend& CallConfirmWidget::f + * @brief The friend on whose chat form we should appear + * + * @var const int CallConfirmWidget::roundedFactor + * @brief By how much are the corners of the main rect rounded + * + * @var const qreal CallConfirmWidget::rectRatio + * @brief Used to correct the rounding factors on non-square rects + */ CallConfirmWidget::CallConfirmWidget(const QWidget *Anchor, const Friend& f) : QWidget(), anchor(Anchor), f(f), @@ -96,8 +96,8 @@ CallConfirmWidget::CallConfirmWidget(const QWidget *Anchor, const Friend& f) : } /** -@brief Recalculate our positions to track the anchor -*/ + * @brief Recalculate our positions to track the anchor + */ void CallConfirmWidget::reposition() { if (parentWidget()) diff --git a/src/widget/tool/croppinglabel.cpp b/src/widget/tool/croppinglabel.cpp index c3d8f44df..4d9c67bae 100644 --- a/src/widget/tool/croppinglabel.cpp +++ b/src/widget/tool/croppinglabel.cpp @@ -152,9 +152,9 @@ void CroppingLabel::showTextEdit() } /** -@brief Get original full text. -@return The un-cropped text. -*/ + * @brief Get original full text. + * @return The un-cropped text. + */ QString CroppingLabel::fullText() { return origText; diff --git a/src/widget/tool/screenshotgrabber.cpp b/src/widget/tool/screenshotgrabber.cpp index bf02f560d..1a6636b0b 100644 --- a/src/widget/tool/screenshotgrabber.cpp +++ b/src/widget/tool/screenshotgrabber.cpp @@ -188,9 +188,9 @@ void ScreenshotGrabber::chooseHelperTooltipText(QRect rect) } /** -@internal -@brief Align the tooltip centered at top of screen with the mouse cursor. -*/ + * @internal + * @brief Align the tooltip centered at top of screen with the mouse cursor. + */ void ScreenshotGrabber::adjustTooltipPosition() { QRect recGL = QGuiApplication::primaryScreen()->virtualGeometry(); diff --git a/src/widget/translator.cpp b/src/widget/translator.cpp index 1973971f8..880166a5a 100644 --- a/src/widget/translator.cpp +++ b/src/widget/translator.cpp @@ -34,8 +34,8 @@ QVector Translator::callbacks; QMutex Translator::lock; /** -@brief Loads the translations according to the settings or locale. -*/ + * @brief Loads the translations according to the settings or locale. + */ void Translator::translate() { QMutexLocker locker{&lock}; @@ -91,9 +91,9 @@ void Translator::translate() } /** -@brief Register a function to be called when the UI needs to be retranslated. -@param f Function, wich will called. -@param owner Widget to retanslate. + * @brief Register a function to be called when the UI needs to be retranslated. + * @param f Function, wich will called. + * @param owner Widget to retanslate. */ void Translator::registerHandler(std::function f, void *owner) { @@ -102,9 +102,9 @@ void Translator::registerHandler(std::function f, void *owner) } /** -@brief Unregisters all handlers of an owner. -@param owner Owner to unregister. -*/ + * @brief Unregisters all handlers of an owner. + * @param owner Owner to unregister. + */ void Translator::unregister(void *owner) { QMutexLocker locker{&lock}; diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index db16c51a9..a0a66dd94 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -539,8 +539,8 @@ Widget::~Widget() } /** -@brief Returns the singleton instance. -*/ + * @brief Returns the singleton instance. + */ Widget* Widget::getInstance() { if (!instance) @@ -550,8 +550,8 @@ Widget* Widget::getInstance() } /** -@brief Switches to the About settings page. -*/ + * @brief Switches to the About settings page. + */ void Widget::showUpdateDownloadProgress() { settingsWidget->showAbout(); @@ -1711,8 +1711,8 @@ void Widget::onEmptyGroupCreated(int groupId) } /** -@brief Used to reset the blinking icon. -*/ + * @brief Used to reset the blinking icon. + */ void Widget::resetIcon() { eventIcon = false; eventFlag = false;