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:
parent
a7df4bfddb
commit
68d24eec64
|
@ -105,10 +105,11 @@ Profile::Profile(QString name, const QString& password, bool isNewProfile,
|
||||||
, encrypted{this->passkey != nullptr}
|
, encrypted{this->passkey != nullptr}
|
||||||
{
|
{
|
||||||
Settings& s = Settings::getInstance();
|
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);
|
initCore(toxsave, s, isNewProfile);
|
||||||
|
|
||||||
const ToxId& selfId = core->getSelfId();
|
loadDatabase(password);
|
||||||
loadDatabase(selfId, password);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -470,14 +471,16 @@ QByteArray Profile::loadAvatarData(const ToxPk& owner)
|
||||||
return pic;
|
return pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profile::loadDatabase(const ToxId& id, QString password)
|
void Profile::loadDatabase(QString password)
|
||||||
{
|
{
|
||||||
|
assert(core);
|
||||||
|
|
||||||
if (isRemoved) {
|
if (isRemoved) {
|
||||||
qDebug() << "Can't load database of removed profile";
|
qDebug() << "Can't load database of removed profile";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray salt = id.getPublicKey().getByteArray();
|
QByteArray salt = core->getSelfId().getPublicKey().getByteArray();
|
||||||
if (salt.size() != TOX_PASS_SALT_LENGTH) {
|
if (salt.size() != TOX_PASS_SALT_LENGTH) {
|
||||||
qWarning() << "Couldn't compute salt from public key" << name;
|
qWarning() << "Couldn't compute salt from public key" << name;
|
||||||
GUI::showError(QObject::tr("Error"),
|
GUI::showError(QObject::tr("Error"),
|
||||||
|
|
|
@ -90,7 +90,7 @@ public slots:
|
||||||
void onRequestSent(const ToxPk& friendPk, const QString& message);
|
void onRequestSent(const ToxPk& friendPk, const QString& message);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void loadDatabase(const ToxId& id, QString password);
|
void loadDatabase(QString password);
|
||||||
void saveAvatar(const ToxPk& owner, const QByteArray& avatar);
|
void saveAvatar(const ToxPk& owner, const QByteArray& avatar);
|
||||||
void removeAvatar(const ToxPk& owner);
|
void removeAvatar(const ToxPk& owner);
|
||||||
void onSaveToxSave();
|
void onSaveToxSave();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user