1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

added isActiveProfile function and fixed a typo

This commit is contained in:
marcel 2015-05-17 22:48:24 +02:00
parent 2ffabb19ec
commit 66dc368662
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,7 @@
#include "toxid.h"
#include "core.h"
#include <tox/tox.h>
#include <qregularexpression.h>
@ -40,6 +42,11 @@ bool ToxId::operator!=(const ToxId &other) const
return publicKey != other.publicKey;
}
bool ToxId::isActiveProfile() const
{
return *this == Core::getInstance()->getSelfId();
}
QString ToxId::toString() const
{
return publicKey + noSpam + checkSum;

View File

@ -13,11 +13,13 @@ public:
ToxId(); ///< The default constructor. Creates an empty Tox ID.
ToxId(const ToxId& other); ///< The copy constructor.
ToxId(const QString& id); ///< Create a Tox ID from QString.
/// If the given id is not a valid Tox ID, than
/// If the given id is not a valid Tox ID, then:
/// publicKey == id and noSpam == "" == checkSum.
bool operator==(const ToxId& other) const; ///< Compares only publicKey.
bool operator!=(const ToxId& other) const; ///< Compares only publicKey.
bool isActiveProfile() const; ///< Returns true if this Tox ID is equals to
/// the Tox ID of the currently active profile.
QString toString() const; ///< Returns the Tox ID as QString.
void clear(); ///< Clears all elements of the Tox ID.