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

refactor(profile): use const reference in createNew/loadProfile

This commit is contained in:
jenli669 2019-06-26 14:16:02 +02:00
parent 040c6b95ae
commit 2d1d5b2a3e
No known key found for this signature in database
GPG Key ID: 8267F9F7C2BF7E5E
2 changed files with 4 additions and 4 deletions

View File

@ -120,7 +120,7 @@ Profile::Profile(QString name, const QString& password, bool isNewProfile,
* *
* @example If the profile is already in use return nullptr. * @example If the profile is already in use return nullptr.
*/ */
Profile* Profile::loadProfile(QString name, const QString& password) Profile* Profile::loadProfile(const QString& name, const QString& password)
{ {
if (ProfileLocker::hasLock()) { if (ProfileLocker::hasLock()) {
qCritical() << "Tried to load profile " << name << ", but another profile is already locked!"; qCritical() << "Tried to load profile " << name << ", but another profile is already locked!";
@ -200,7 +200,7 @@ fail:
* *
* @note If the profile is already in use return nullptr. * @note If the profile is already in use return nullptr.
*/ */
Profile* Profile::createProfile(QString name, QString password) Profile* Profile::createProfile(const QString& name, const QString& password)
{ {
std::unique_ptr<ToxEncrypt> tmpKey; std::unique_ptr<ToxEncrypt> tmpKey;
if (!password.isEmpty()) { if (!password.isEmpty()) {

View File

@ -39,8 +39,8 @@ class Profile : public QObject
Q_OBJECT Q_OBJECT
public: public:
static Profile* loadProfile(QString name, const QString& password = QString()); static Profile* loadProfile(const QString& name, const QString& password = QString());
static Profile* createProfile(QString name, QString password); static Profile* createProfile(const QString& name, const QString& password);
~Profile(); ~Profile();
Core* getCore(); Core* getCore();