mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3475
a68366 (2): fix(groupinviteform): consider dateTime format in group invites fix(generalform): call UI retranslation when date or time format changes
This commit is contained in:
commit
1bd86f7eee
|
@ -29,6 +29,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
#include "src/persistence/settings.h"
|
||||||
#include "src/widget/tool/croppinglabel.h"
|
#include "src/widget/tool/croppinglabel.h"
|
||||||
#include "src/widget/translator.h"
|
#include "src/widget/translator.h"
|
||||||
#include "src/nexus.h"
|
#include "src/nexus.h"
|
||||||
|
@ -107,8 +108,10 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray
|
||||||
CroppingLabel* groupLabel = new CroppingLabel(this);
|
CroppingLabel* groupLabel = new CroppingLabel(this);
|
||||||
groupLabels.insert(groupLabel);
|
groupLabels.insert(groupLabel);
|
||||||
QString name = Nexus::getCore()->getFriendUsername(friendId);
|
QString name = Nexus::getCore()->getFriendUsername(friendId);
|
||||||
QString time = QDateTime::currentDateTime().toString();
|
QDateTime currentDateTime = QDateTime::currentDateTime();
|
||||||
groupLabel->setText(tr("Invited by <b>%1</b> on %2.").arg(name, time));
|
QString date = currentDateTime.toString(Settings::getInstance().getDateFormat());
|
||||||
|
QString time = currentDateTime.toString(Settings::getInstance().getTimestampFormat());
|
||||||
|
groupLabel->setText(tr("Invited by <b>%1</b> on %2 at %3.").arg(name, date, time));
|
||||||
groupLayout->addWidget(groupLabel);
|
groupLayout->addWidget(groupLabel);
|
||||||
|
|
||||||
QPushButton* acceptButton = new QPushButton(this);
|
QPushButton* acceptButton = new QPushButton(this);
|
||||||
|
@ -206,8 +209,11 @@ void GroupInviteForm::retranslateGroupLabel(CroppingLabel* label)
|
||||||
GroupInvite invite = groupInvites.at(index);
|
GroupInvite invite = groupInvites.at(index);
|
||||||
|
|
||||||
QString name = Nexus::getCore()->getFriendUsername(invite.friendId);
|
QString name = Nexus::getCore()->getFriendUsername(invite.friendId);
|
||||||
QString date = invite.time.toString();
|
|
||||||
label->setText(tr("Invited by <b>%1</b> on %2.").arg(name, date));
|
QString date = invite.time.toString(Settings::getInstance().getDateFormat());
|
||||||
|
QString time = invite.time.toString(Settings::getInstance().getTimestampFormat());
|
||||||
|
|
||||||
|
label->setText(tr("Invited by <b>%1</b> on %2 at %3.").arg(name, date, time));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInviteForm::retranslateAcceptButton(QPushButton* acceptButton)
|
void GroupInviteForm::retranslateAcceptButton(QPushButton* acceptButton)
|
||||||
|
|
|
@ -356,11 +356,13 @@ void GeneralForm::onEmoticonSizeChanged()
|
||||||
void GeneralForm::onTimestampSelected(int index)
|
void GeneralForm::onTimestampSelected(int index)
|
||||||
{
|
{
|
||||||
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
||||||
|
Translator::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onDateFormatSelected(int index)
|
void GeneralForm::onDateFormatSelected(int index)
|
||||||
{
|
{
|
||||||
Settings::getInstance().setDateFormat(dateFormats.at(index));
|
Settings::getInstance().setDateFormat(dateFormats.at(index));
|
||||||
|
Translator::translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onAutoAwayChanged()
|
void GeneralForm::onAutoAwayChanged()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user