mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Added dynamic translation to status and username
This commit is contained in:
parent
42c29c8b8f
commit
879c396efc
|
@ -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>
|
||||
|
|
|
@ -793,8 +793,17 @@ void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUse
|
|||
|
||||
void Widget::setUsername(const QString& username)
|
||||
{
|
||||
ui->nameLabel->setText(username);
|
||||
ui->nameLabel->setToolTip(username); // for overlength names
|
||||
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);
|
||||
|
@ -809,8 +818,16 @@ void Widget::onStatusMessageChanged(const QString& newStatusMessage)
|
|||
|
||||
void Widget::setStatusMessage(const QString &statusMessage)
|
||||
{
|
||||
ui->statusLabel->setText(statusMessage);
|
||||
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
|
||||
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);
|
||||
ui->nameLabel->setText(name);
|
||||
ui->statusLabel->setText(status);
|
||||
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"));
|
||||
|
|
Loading…
Reference in New Issue
Block a user