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:
parent
3bf338e9ff
commit
e03d80392a
23
src/core.cpp
23
src/core.cpp
|
@ -238,15 +238,17 @@ void Core::start()
|
||||||
|
|
||||||
QByteArray savedata = loadToxSave(loadPath);
|
QByteArray savedata = loadToxSave(loadPath);
|
||||||
|
|
||||||
|
make_tox(savedata);
|
||||||
|
|
||||||
// Do we need to create a new save & profile?
|
// Do we need to create a new save & profile?
|
||||||
if (savedata.isNull())
|
if (savedata.isNull())
|
||||||
{
|
{
|
||||||
qDebug() << "Save file not found, creating a new profile";
|
qDebug() << "Save file not found, creating a new profile";
|
||||||
Settings::getInstance().load();
|
Settings::getInstance().load();
|
||||||
|
setStatusMessage(tr("Toxing on qTox"));
|
||||||
|
setUsername(tr("qTox User"));
|
||||||
}
|
}
|
||||||
|
|
||||||
make_tox(savedata);
|
|
||||||
|
|
||||||
qsrand(time(nullptr));
|
qsrand(time(nullptr));
|
||||||
|
|
||||||
/** TODO: Review this mess. Actually rewrite it all
|
/** TODO: Review this mess. Actually rewrite it all
|
||||||
|
@ -278,14 +280,6 @@ void Core::start()
|
||||||
// loadPath is meaningless after this
|
// loadPath is meaningless after this
|
||||||
loadPath = "";
|
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
|
// set GUI with user and statusmsg
|
||||||
|
@ -357,6 +351,15 @@ void Core::start()
|
||||||
|
|
||||||
ready = true;
|
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
|
process(); // starts its own timer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,7 @@ void ProfileForm::setToxId(const QString& id)
|
||||||
qr = new QRWidget();
|
qr = new QRWidget();
|
||||||
qr->setQRData("tox:"+id);
|
qr->setQRData("tox:"+id);
|
||||||
bodyUI->qrCode->setPixmap(QPixmap::fromImage(qr->getImage()->scaledToWidth(150)));
|
bodyUI->qrCode->setPixmap(QPixmap::fromImage(qr->getImage()->scaledToWidth(150)));
|
||||||
|
refreshProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileForm::onAvatarClicked()
|
void ProfileForm::onAvatarClicked()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user