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

Merge remote-tracking branch 'thenain38/status-username-dynamic-trans'

This commit is contained in:
agilob 2015-09-27 20:47:49 +01:00
commit 3341834625
No known key found for this signature in database
GPG Key ID: 296F0B764741106C
2 changed files with 43 additions and 12 deletions

View File

@ -858,9 +858,6 @@ QSplitter:handle{
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>Your name</string>
</property>
</widget>
</item>
<item>
@ -940,9 +937,6 @@ QSplitter:handle{
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>Your status</string>
</property>
</widget>
</item>
</layout>

View File

@ -792,9 +792,18 @@ void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUse
}
void Widget::setUsername(const QString& username)
{
if (username.isEmpty())
{
ui->nameLabel->setText(tr("Your name"));
ui->nameLabel->setToolTip(tr("Your name"));
}
else
{
ui->nameLabel->setText(username);
ui->nameLabel->setToolTip(username); // for overlength names
}
QString sanename = username;
sanename.remove(QRegExp("[\\t\\n\\v\\f\\r\\x0000]"));
nameMention = QRegExp("\\b" + QRegExp::escape(username) + "\\b", Qt::CaseInsensitive);
@ -808,10 +817,18 @@ void Widget::onStatusMessageChanged(const QString& newStatusMessage)
}
void Widget::setStatusMessage(const QString &statusMessage)
{
if (statusMessage.isEmpty())
{
ui->statusLabel->setText(tr("Your status"));
ui->statusLabel->setToolTip(tr("Your status"));
}
else
{
ui->statusLabel->setText(statusMessage);
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
}
}
void Widget::reloadHistory()
{
@ -2016,9 +2033,29 @@ void Widget::setActiveToolMenuButton(ActiveToolMenuButton newActiveButton)
void Widget::retranslateUi()
{
QString name = ui->nameLabel->text(), status = ui->statusLabel->text();
Core* core = Nexus::getCore();
ui->retranslateUi(this);
if (core->getUsername().isEmpty())
{
ui->nameLabel->setText(tr("Your name"));
ui->nameLabel->setToolTip(tr("Your name"));
}
else
{
ui->nameLabel->setText(name);
ui->nameLabel->setToolTip(name);
}
if (core->getStatusMessage().isEmpty())
{
ui->statusLabel->setText(tr("Your status"));
ui->statusLabel->setToolTip(tr("Your status"));
}
else
{
ui->statusLabel->setText(status);
ui->statusLabel->setToolTip(status);
}
filterDisplayName->setText(tr("By Name"));
filterDisplayActivity->setText(tr("By Activity"));