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

FIX: updated username and status message on editingFinished() instead of textEdited(). I.e. if the user presses return or the widget loses focus.

This commit is contained in:
Arne Böckmann 2014-07-07 19:10:24 +02:00
parent b3b01906f7
commit a164e7a991
2 changed files with 8 additions and 6 deletions

View File

@ -244,8 +244,8 @@ Widget::Widget(QWidget *parent) :
connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
connect(setStatusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));
connect(&settingsForm.name, SIGNAL(textEdited(QString)), this, SLOT(onUsernameChanged(QString)));
connect(&settingsForm.statusText, SIGNAL(textEdited(QString)), this, SLOT(onStatusMessageChanged(QString)));
connect(&settingsForm.name, SIGNAL(editingFinished()), this, SLOT(onUsernameChanged()));
connect(&settingsForm.statusText, SIGNAL(editingFinished()), this, SLOT(onStatusMessageChanged()));
connect(&friendForm, SIGNAL(friendRequested(QString,QString)), this, SIGNAL(friendRequested(QString,QString)));
coreThread->start();
@ -410,8 +410,9 @@ void Widget::hideMainForms()
}
}
void Widget::onUsernameChanged(const QString& newUsername)
void Widget::onUsernameChanged()
{
const QString newUsername = settingsForm.name.text();
ui->nameLabel->setText(newUsername);
settingsForm.name.setText(newUsername);
core->setUsername(newUsername);
@ -431,8 +432,9 @@ void Widget::setUsername(const QString& username)
Settings::getInstance().setUsername(username);
}
void Widget::onStatusMessageChanged(const QString& newStatusMessage)
void Widget::onStatusMessageChanged()
{
const QString newStatusMessage = settingsForm.statusText.text();
ui->statusLabel->setText(newStatusMessage);
settingsForm.statusText.setText(newStatusMessage);
core->setStatusMessage(newStatusMessage);

View File

@ -87,8 +87,8 @@ private slots:
void onFailedToStartCore();
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
void onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage);
void onUsernameChanged(const QString& newUsername);
void onStatusMessageChanged(const QString& newStatusMessage);
void onUsernameChanged();
void onStatusMessageChanged();
void setUsername(const QString& username);
void setStatusMessage(const QString &statusMessage);
void addFriend(int friendId, const QString& userId);