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

Fix GUI refresh when creating new profile

Previously the username/status, and the combobox in profileForm weren't refreshing themselves
This commit is contained in:
tux3 2015-04-23 23:42:50 +02:00
parent 3bf338e9ff
commit e03d80392a
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 14 additions and 10 deletions

View File

@ -238,15 +238,17 @@ void Core::start()
QByteArray savedata = loadToxSave(loadPath);
make_tox(savedata);
// Do we need to create a new save & profile?
if (savedata.isNull())
{
qDebug() << "Save file not found, creating a new profile";
Settings::getInstance().load();
setStatusMessage(tr("Toxing on qTox"));
setUsername(tr("qTox User"));
}
make_tox(savedata);
qsrand(time(nullptr));
/** TODO: Review this mess. Actually rewrite it all
@ -278,14 +280,6 @@ void Core::start()
// loadPath is meaningless after this
loadPath = "";
}
else // new ID
{
QString id = getSelfId().toString();
if (!id.isEmpty())
emit idSet(id);
setStatusMessage(tr("Toxing on qTox")); // this also solves the not updating issue
setUsername(tr("qTox User"));
}
*/
// set GUI with user and statusmsg
@ -357,6 +351,15 @@ void Core::start()
ready = true;
// If we created a new profile earlier,
// now that we're ready save it and ONLY THEN broadcast the new ID.
// This is useful for e.g. the profileForm that searches for saves.
if (savedata.isNull())
{
saveConfiguration();
emit idSet(getSelfId().toString());
}
process(); // starts its own timer
}

View File

@ -183,6 +183,7 @@ void ProfileForm::setToxId(const QString& id)
qr = new QRWidget();
qr->setQRData("tox:"+id);
bodyUI->qrCode->setPixmap(QPixmap::fromImage(qr->getImage()->scaledToWidth(150)));
refreshProfiles();
}
void ProfileForm::onAvatarClicked()