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

refactor(profileform): Small changes

* Renamed function
* Added comment
This commit is contained in:
Polshakov Dmitry 2016-04-13 01:20:16 +03:00
parent 2dc3dd6964
commit a146c43a1e
2 changed files with 7 additions and 5 deletions

View File

@ -88,7 +88,7 @@ ProfileForm::ProfileForm(QWidget *parent) :
if (toxmeInfo.isEmpty()) // User not registered if (toxmeInfo.isEmpty()) // User not registered
showRegisterToxme(); showRegisterToxme();
else else
showExistenToxme(); showExistingToxme();
bodyUI->qrLabel->setWordWrap(true); bodyUI->qrLabel->setWordWrap(true);
@ -444,7 +444,7 @@ void ProfileForm::showRegisterToxme()
bodyUI->toxmePasswordLabel->hide(); bodyUI->toxmePasswordLabel->hide();
} }
void ProfileForm::showExistenToxme() void ProfileForm::showExistingToxme()
{ {
QStringList info = Settings::getInstance().getToxmeInfo().split("@"); QStringList info = Settings::getInstance().getToxmeInfo().split("@");
bodyUI->toxmeUsername->setText(info[0]); bodyUI->toxmeUsername->setText(info[0]);
@ -487,18 +487,20 @@ void ProfileForm::onRegisterButtonClicked()
QString response = Toxme::createAddress(code, server, id, name, privacy, bio); QString response = Toxme::createAddress(code, server, id, name, privacy, bio);
Core* newCore = Core::getInstance(); Core* newCore = Core::getInstance();
// Make sure the user didn't logout (or logout and login)
// before the request is finished, else qTox will crash.
if (oldCore == newCore) if (oldCore == newCore)
{ {
switch (code) { switch (code) {
case Toxme::Updated: case Toxme::Updated:
GUI::showInfo(tr("Done!"), tr("Account %1@%2 updated successfully").arg(name, server)); GUI::showInfo(tr("Done!"), tr("Account %1@%2 updated successfully").arg(name, server));
Settings::getInstance().setToxme(name, server, bio, privacy); Settings::getInstance().setToxme(name, server, bio, privacy);
showExistenToxme(); showExistingToxme();
break; break;
case Toxme::Ok: case Toxme::Ok:
GUI::showInfo(tr("Done!"), tr("Successfully added %1@%2 to the database. Save your password").arg(name, server)); GUI::showInfo(tr("Done!"), tr("Successfully added %1@%2 to the database. Save your password").arg(name, server));
Settings::getInstance().setToxme(name, server, bio, privacy, response); Settings::getInstance().setToxme(name, server, bio, privacy, response);
showExistenToxme(); showExistingToxme();
break; break;
default: default:
QString errorMessage = Toxme::getErrorMessage(code); QString errorMessage = Toxme::getErrorMessage(code);

View File

@ -83,7 +83,7 @@ private slots:
void onRegisterButtonClicked(); void onRegisterButtonClicked();
private: private:
void showExistenToxme(); void showExistingToxme();
void retranslateUi(); void retranslateUi();
void prFileLabelUpdate(); void prFileLabelUpdate();