mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
docs(persistence): Added leading stars
This commit is contained in:
parent
1332abed11
commit
902828fcc2
|
@ -30,8 +30,8 @@
|
|||
#include <QSqlError>
|
||||
|
||||
/**
|
||||
@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;
|
||||
|
|
|
@ -15,58 +15,58 @@
|
|||
#include <sqlcipher/sqlite3.h>
|
||||
|
||||
/**
|
||||
@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<QByteArray> RawDatabase::Query::blobs
|
||||
@brief Bound data blobs
|
||||
|
||||
@var std::function<void(int64_t)> RawDatabase::Query::insertCallback
|
||||
@brief Called after execution with the last insert rowid
|
||||
|
||||
@var std::function<void(const QVector<QVariant>&)> RawDatabase::Query::rowCallback
|
||||
@brief Called during execution for each row
|
||||
|
||||
@var QVector<sqlite3_stmt*> 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<QByteArray> RawDatabase::Query::blobs
|
||||
* @brief Bound data blobs
|
||||
*
|
||||
* @var std::function<void(int64_t)> RawDatabase::Query::insertCallback
|
||||
* @brief Called after execution with the last insert rowid
|
||||
*
|
||||
* @var std::function<void(const QVector<QVariant>&)> RawDatabase::Query::rowCallback
|
||||
* @brief Called during execution for each row
|
||||
*
|
||||
* @var QVector<sqlite3_stmt*> 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,10 +88,10 @@ 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)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ 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()
|
||||
{
|
||||
|
@ -153,8 +153,8 @@ 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()
|
||||
{
|
||||
|
@ -163,9 +163,9 @@ 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)
|
||||
{
|
||||
|
@ -173,9 +173,9 @@ bool RawDatabase::execNow(const QString& 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)
|
||||
{
|
||||
|
@ -183,9 +183,9 @@ bool RawDatabase::execNow(const RawDatabase::Query &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<RawDatabase::Query> &statements)
|
||||
{
|
||||
|
@ -217,8 +217,8 @@ bool RawDatabase::execNow(const QVector<RawDatabase::Query> &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)
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ void RawDatabase::execLater(const QVector<RawDatabase::Query> &statements)
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Waits until all the pending transactions are executed.
|
||||
* @brief Waits until all the pending transactions are executed.
|
||||
*/
|
||||
void RawDatabase::sync()
|
||||
{
|
||||
|
@ -257,10 +257,10 @@ void RawDatabase::sync()
|
|||
}
|
||||
|
||||
/**
|
||||
@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)
|
||||
{
|
||||
|
@ -356,11 +356,11 @@ 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)
|
||||
{
|
||||
|
@ -394,9 +394,9 @@ 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()
|
||||
{
|
||||
|
@ -419,9 +419,9 @@ 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)
|
||||
{
|
||||
|
@ -439,10 +439,10 @@ 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()
|
||||
{
|
||||
|
@ -578,10 +578,10 @@ 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)
|
||||
{
|
||||
|
|
|
@ -9,18 +9,18 @@
|
|||
using namespace std;
|
||||
|
||||
/**
|
||||
@class History
|
||||
@brief Interacts with the profile database to save the chat history.
|
||||
|
||||
@var QHash<QString, int64_t> 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<QString, int64_t> 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,10 +29,10 @@ 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,8 +48,8 @@ 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()
|
||||
{
|
||||
|
@ -57,8 +57,8 @@ bool History::isValid()
|
|||
}
|
||||
|
||||
/**
|
||||
@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)
|
||||
{
|
||||
|
@ -66,8 +66,8 @@ void History::setPassword(const QString& 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)
|
||||
{
|
||||
|
@ -75,8 +75,8 @@ void History::rename(const QString &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()
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ bool History::remove()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Erases all the chat history from the database.
|
||||
* @brief Erases all the chat history from the database.
|
||||
*/
|
||||
void History::eraseHistory()
|
||||
{
|
||||
|
@ -96,8 +96,8 @@ 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)
|
||||
{
|
||||
|
@ -125,14 +125,14 @@ 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<RawDatabase::Query> History::generateNewMessageQueries(const QString &friendPk, const QString &message,
|
||||
const QString &sender, const QDateTime &time, bool isSent, QString dispName,
|
||||
|
@ -193,14 +193,14 @@ QVector<RawDatabase::Query> 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<void(int64_t)> insertIdCallback)
|
||||
|
@ -209,11 +209,11 @@ 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::HistMessage> History::getChatHistory(const QString &friendPk, const QDateTime &from, const QDateTime &to)
|
||||
{
|
||||
|
@ -245,10 +245,10 @@ QList<History::HistMessage> 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)
|
||||
{
|
||||
|
@ -256,9 +256,9 @@ void History::markAsSent(qint64 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)
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ QString History::getDbPath(const QString &profileName)
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Makes sure the history tables are created
|
||||
* @brief Makes sure the history tables are created
|
||||
*/
|
||||
void History::init()
|
||||
{
|
||||
|
@ -292,8 +292,8 @@ 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)
|
||||
{
|
||||
|
|
|
@ -36,17 +36,17 @@
|
|||
#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)
|
||||
{
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
#include <QTimer>
|
||||
|
||||
/**
|
||||
@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.
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -36,18 +36,18 @@
|
|||
#include <sodium.h>
|
||||
|
||||
/**
|
||||
@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<QString> Profile::profiles;
|
||||
|
@ -81,12 +81,12 @@ 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)
|
||||
{
|
||||
|
@ -166,12 +166,12 @@ 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)
|
||||
{
|
||||
|
@ -214,9 +214,9 @@ 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<QString> Profile::getFilesByExt(QString extension)
|
||||
{
|
||||
|
@ -232,8 +232,8 @@ QVector<QString> 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()
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ QString Profile::getName() const
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Starts the Core thread
|
||||
* @brief Starts the Core thread
|
||||
*/
|
||||
void Profile::startCore()
|
||||
{
|
||||
|
@ -276,8 +276,8 @@ 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()
|
||||
{
|
||||
|
@ -338,8 +338,8 @@ 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()
|
||||
{
|
||||
|
@ -350,9 +350,9 @@ 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)
|
||||
{
|
||||
|
@ -397,10 +397,10 @@ 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)
|
||||
{
|
||||
|
@ -420,8 +420,8 @@ 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()
|
||||
{
|
||||
|
@ -429,9 +429,9 @@ QPixmap Profile::loadAvatar()
|
|||
}
|
||||
|
||||
/**
|
||||
@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)
|
||||
{
|
||||
|
@ -441,9 +441,9 @@ 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)
|
||||
{
|
||||
|
@ -451,10 +451,10 @@ QByteArray Profile::loadAvatarData(const QString &ownerId)
|
|||
}
|
||||
|
||||
/**
|
||||
@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)
|
||||
{
|
||||
|
@ -484,9 +484,9 @@ 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)
|
||||
{
|
||||
|
@ -513,9 +513,9 @@ 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)
|
||||
{
|
||||
|
@ -526,7 +526,7 @@ QByteArray Profile::getAvatarHash(const QString &ownerId)
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Removes our own avatar.
|
||||
* @brief Removes our own avatar.
|
||||
*/
|
||||
void Profile::removeAvatar()
|
||||
{
|
||||
|
@ -534,8 +534,8 @@ void Profile::removeAvatar()
|
|||
}
|
||||
|
||||
/**
|
||||
@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()
|
||||
{
|
||||
|
@ -543,8 +543,8 @@ bool Profile::isHistoryEnabled()
|
|||
}
|
||||
|
||||
/**
|
||||
@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()
|
||||
{
|
||||
|
@ -552,8 +552,8 @@ History *Profile::getHistory()
|
|||
}
|
||||
|
||||
/**
|
||||
@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)
|
||||
{
|
||||
|
@ -569,8 +569,8 @@ 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
|
||||
{
|
||||
|
@ -578,10 +578,10 @@ bool Profile::isEncrypted() const
|
|||
}
|
||||
|
||||
/**
|
||||
@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)
|
||||
{
|
||||
|
@ -601,10 +601,10 @@ 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<QString> Profile::remove()
|
||||
{
|
||||
|
@ -670,9 +670,9 @@ QVector<QString> 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)
|
||||
{
|
||||
|
@ -697,8 +697,8 @@ 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()
|
||||
{
|
||||
|
@ -719,7 +719,7 @@ 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()
|
||||
{
|
||||
|
@ -730,8 +730,8 @@ 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)
|
||||
{
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include <QDebug>
|
||||
|
||||
/**
|
||||
@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,12 +42,12 @@ 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)
|
||||
{
|
||||
|
@ -60,9 +60,9 @@ 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)
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ bool ProfileLocker::lock(QString profile)
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Releases the lock on the current profile.
|
||||
* @brief Releases the lock on the current profile.
|
||||
*/
|
||||
void ProfileLocker::unlock()
|
||||
{
|
||||
|
@ -98,10 +98,10 @@ 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()
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ void ProfileLocker::assertLock()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Print an error then exit immediately.
|
||||
* @brief Print an error then exit immediately.
|
||||
*/
|
||||
void ProfileLocker::deathByBrokenLock()
|
||||
{
|
||||
|
@ -137,8 +137,8 @@ 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()
|
||||
{
|
||||
|
@ -146,8 +146,8 @@ bool ProfileLocker::hasLock()
|
|||
}
|
||||
|
||||
/**
|
||||
@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()
|
||||
{
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
#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)
|
||||
|
|
|
@ -48,14 +48,14 @@
|
|||
#include <QNetworkProxy>
|
||||
|
||||
/**
|
||||
@var QHash<QString, QByteArray> 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<QString, QByteArray> 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";
|
||||
|
@ -83,7 +83,7 @@ Settings::~Settings()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Returns the singleton instance.
|
||||
* @brief Returns the singleton instance.
|
||||
*/
|
||||
Settings& Settings::getInstance()
|
||||
{
|
||||
|
@ -392,7 +392,7 @@ void Settings::loadPersonal(Profile* profile)
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Asynchronous, saves the global settings.
|
||||
* @brief Asynchronous, saves the global settings.
|
||||
*/
|
||||
void Settings::saveGlobal()
|
||||
{
|
||||
|
@ -514,7 +514,7 @@ void Settings::saveGlobal()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Asynchronous, saves the current profile.
|
||||
* @brief Asynchronous, saves the current profile.
|
||||
*/
|
||||
void Settings::savePersonal()
|
||||
{
|
||||
|
@ -522,8 +522,8 @@ void Settings::savePersonal()
|
|||
}
|
||||
|
||||
/**
|
||||
@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)
|
||||
{
|
||||
|
@ -623,8 +623,8 @@ 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
|
||||
{
|
||||
|
@ -646,8 +646,8 @@ 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
|
||||
{
|
||||
|
@ -671,8 +671,8 @@ 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
|
||||
{
|
||||
|
@ -2201,9 +2201,9 @@ 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)
|
||||
{
|
||||
|
@ -2222,7 +2222,7 @@ 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()
|
||||
{
|
||||
|
@ -2233,7 +2233,7 @@ void Settings::createSettingsDir()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Waits for all asynchronous operations to complete
|
||||
* @brief Waits for all asynchronous operations to complete
|
||||
*/
|
||||
void Settings::sync()
|
||||
{
|
||||
|
|
|
@ -29,33 +29,33 @@
|
|||
#include <cassert>
|
||||
|
||||
/**
|
||||
@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};
|
||||
|
||||
|
@ -241,9 +241,9 @@ 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)
|
||||
{
|
||||
|
@ -257,7 +257,7 @@ bool SettingsSerializer::isSerializedFormat(QString filePath)
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Loads the settings from file.
|
||||
* @brief Loads the settings from file.
|
||||
*/
|
||||
void SettingsSerializer::load()
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ void SettingsSerializer::load()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Saves the current settings back to file
|
||||
* @brief Saves the current settings back to file
|
||||
*/
|
||||
void SettingsSerializer::save()
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -36,20 +36,20 @@
|
|||
#include <QtConcurrent/QtConcurrentRun>
|
||||
|
||||
/**
|
||||
@class SmileyPack
|
||||
@brief Maps emoticons to smileys.
|
||||
|
||||
@var QHash<QString, QString> SmileyPack::filenameTable
|
||||
@brief Matches an emoticon to its corresponding smiley ie. ":)" -> "happy.png"
|
||||
|
||||
@var QHash<QString, QIcon> SmileyPack::iconCache
|
||||
@brief representation of a smiley ie. "happy.png" -> data
|
||||
|
||||
@var QList<QStringList> SmileyPack::emoticons
|
||||
@brief {{ ":)", ":-)" }, {":(", ...}, ... }
|
||||
|
||||
@var QString SmileyPack::path
|
||||
@brief directory containing the cfg and image files
|
||||
* @class SmileyPack
|
||||
* @brief Maps emoticons to smileys.
|
||||
*
|
||||
* @var QHash<QString, QString> SmileyPack::filenameTable
|
||||
* @brief Matches an emoticon to its corresponding smiley ie. ":)" -> "happy.png"
|
||||
*
|
||||
* @var QHash<QString, QIcon> SmileyPack::iconCache
|
||||
* @brief representation of a smiley ie. "happy.png" -> data
|
||||
*
|
||||
* @var QList<QStringList> SmileyPack::emoticons
|
||||
* @brief {{ ":)", ":-)" }, {":(", ...}, ... }
|
||||
*
|
||||
* @var QString SmileyPack::path
|
||||
* @brief directory containing the cfg and image files
|
||||
*/
|
||||
|
||||
SmileyPack::SmileyPack()
|
||||
|
@ -60,7 +60,7 @@ SmileyPack::SmileyPack()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Returns the singleton instance.
|
||||
* @brief Returns the singleton instance.
|
||||
*/
|
||||
SmileyPack& SmileyPack::getInstance()
|
||||
{
|
||||
|
@ -113,10 +113,10 @@ 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)
|
||||
{
|
||||
|
|
|
@ -35,10 +35,10 @@ 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)
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ 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()
|
||||
{
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
#include <QScrollArea>
|
||||
|
||||
/**
|
||||
@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()
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#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
|
||||
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
#include <QtAlgorithms>
|
||||
|
||||
/**
|
||||
@var QList<QLabel*> GroupChatForm::peerLabels
|
||||
@brief Maps peernumbers to the QLabels in namesListLayout.
|
||||
|
||||
@var QMap<int, QTimer*> GroupChatForm::peerAudioTimers
|
||||
@brief Timeout = peer stopped sending audio.
|
||||
* @var QList<QLabel*> GroupChatForm::peerLabels
|
||||
* @brief Maps peernumbers to the QLabels in namesListLayout.
|
||||
*
|
||||
* @var QMap<int, QTimer*> GroupChatForm::peerAudioTimers
|
||||
* @brief Timeout = peer stopped sending audio.
|
||||
*/
|
||||
|
||||
GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||
|
|
|
@ -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<QComboBox*>())
|
||||
{
|
||||
cb->installEventFilter(this);
|
||||
|
|
|
@ -20,13 +20,6 @@
|
|||
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@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 <QRegExp>
|
||||
|
@ -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)
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
#include <QThread>
|
||||
|
||||
/**
|
||||
@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) :
|
||||
|
@ -52,7 +52,7 @@ GUI::GUI(QObject *parent) :
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Returns the singleton instance.
|
||||
* @brief Returns the singleton instance.
|
||||
*/
|
||||
GUI& GUI::getInstance()
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ 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()
|
||||
{
|
||||
|
@ -74,9 +74,9 @@ 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)
|
||||
{
|
||||
|
@ -92,10 +92,10 @@ 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)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ 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()
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ 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()
|
||||
{
|
||||
|
@ -141,9 +141,9 @@ 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)
|
||||
{
|
||||
|
@ -159,9 +159,9 @@ 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)
|
||||
{
|
||||
|
@ -177,9 +177,9 @@ 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)
|
||||
{
|
||||
|
@ -200,13 +200,13 @@ 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,
|
||||
|
@ -229,16 +229,16 @@ 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,
|
||||
|
@ -260,19 +260,19 @@ 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,
|
||||
|
@ -298,10 +298,10 @@ 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)
|
||||
{
|
||||
|
@ -468,8 +468,8 @@ 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()
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ LoginScreen::~LoginScreen()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Resets the UI, clears all fields.
|
||||
* @brief Resets the UI, clears all fields.
|
||||
*/
|
||||
void LoginScreen::reset()
|
||||
{
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include <QPainter>
|
||||
|
||||
/**
|
||||
@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)
|
||||
|
|
|
@ -67,15 +67,15 @@ 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)
|
||||
{
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#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")
|
||||
|
@ -63,9 +63,9 @@ 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)
|
||||
{
|
||||
|
|
|
@ -32,28 +32,28 @@
|
|||
#include <QPainter>
|
||||
|
||||
/**
|
||||
@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
|
||||
|
@ -207,10 +207,10 @@ 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)
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ void Style::setThemeColor(const QColor &color)
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Reloads some CCS
|
||||
* @brief Reloads some CCS
|
||||
*/
|
||||
void Style::applyTheme()
|
||||
{
|
||||
|
|
|
@ -32,23 +32,23 @@
|
|||
#include <QPalette>
|
||||
|
||||
/**
|
||||
@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) :
|
||||
|
@ -96,7 +96,7 @@ 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()
|
||||
{
|
||||
|
|
|
@ -152,8 +152,8 @@ 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()
|
||||
{
|
||||
|
|
|
@ -188,8 +188,8 @@ 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()
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ QVector<Translator::Callback> 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()
|
||||
{
|
||||
|
@ -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<void()> f, void *owner)
|
||||
{
|
||||
|
@ -102,8 +102,8 @@ void Translator::registerHandler(std::function<void()> 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)
|
||||
{
|
||||
|
|
|
@ -539,7 +539,7 @@ Widget::~Widget()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Returns the singleton instance.
|
||||
* @brief Returns the singleton instance.
|
||||
*/
|
||||
Widget* Widget::getInstance()
|
||||
{
|
||||
|
@ -550,7 +550,7 @@ Widget* Widget::getInstance()
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Switches to the About settings page.
|
||||
* @brief Switches to the About settings page.
|
||||
*/
|
||||
void Widget::showUpdateDownloadProgress()
|
||||
{
|
||||
|
@ -1711,7 +1711,7 @@ void Widget::onEmptyGroupCreated(int groupId)
|
|||
}
|
||||
|
||||
/**
|
||||
@brief Used to reset the blinking icon.
|
||||
* @brief Used to reset the blinking icon.
|
||||
*/
|
||||
void Widget::resetIcon() {
|
||||
eventIcon = false;
|
||||
|
|
Loading…
Reference in New Issue
Block a user