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

refactor(startup): remove unnecessary arg. passing in loadDatabase

This commit is contained in:
jenli669 2019-06-24 01:19:44 +02:00
parent a7df4bfddb
commit 68d24eec64
No known key found for this signature in database
GPG Key ID: 8267F9F7C2BF7E5E
2 changed files with 8 additions and 5 deletions

View File

@ -105,10 +105,11 @@ Profile::Profile(QString name, const QString& password, bool isNewProfile,
, encrypted{this->passkey != nullptr}
{
Settings& s = Settings::getInstance();
// TODO(kriby): Move/refactor core initialization to remove settings dependency
// note to self: use slots/signals for this?
initCore(toxsave, s, isNewProfile);
const ToxId& selfId = core->getSelfId();
loadDatabase(selfId, password);
loadDatabase(password);
}
/**
@ -470,14 +471,16 @@ QByteArray Profile::loadAvatarData(const ToxPk& owner)
return pic;
}
void Profile::loadDatabase(const ToxId& id, QString password)
void Profile::loadDatabase(QString password)
{
assert(core);
if (isRemoved) {
qDebug() << "Can't load database of removed profile";
return;
}
QByteArray salt = id.getPublicKey().getByteArray();
QByteArray salt = core->getSelfId().getPublicKey().getByteArray();
if (salt.size() != TOX_PASS_SALT_LENGTH) {
qWarning() << "Couldn't compute salt from public key" << name;
GUI::showError(QObject::tr("Error"),

View File

@ -90,7 +90,7 @@ public slots:
void onRequestSent(const ToxPk& friendPk, const QString& message);
private slots:
void loadDatabase(const ToxId& id, QString password);
void loadDatabase(QString password);
void saveAvatar(const ToxPk& owner, const QByteArray& avatar);
void removeAvatar(const ToxPk& owner);
void onSaveToxSave();