mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Makes toxgui translatable
This commit is contained in:
parent
9eca1784f7
commit
537d55bd7f
|
@ -142,8 +142,8 @@ bool Camera::isFormatSupported(const QVideoSurfaceFormat& format) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(0, "Camera eror",
|
QMessageBox::warning(0, tr("Camera eror"),
|
||||||
QString("Camera format %1 not supported, can't use the camera")
|
tr("Camera format %1 not supported, can't use the camera")
|
||||||
.arg(format.pixelFormat()));
|
.arg(format.pixelFormat()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ void FileTransfertWidget::rejectRecvRequest()
|
||||||
|
|
||||||
void FileTransfertWidget::acceptRecvRequest()
|
void FileTransfertWidget::acceptRecvRequest()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getSaveFileName(0,"Save a file",QDir::currentPath()+'/'+filename->text());
|
QString path = QFileDialog::getSaveFileName(0,tr("Save a file","Title of the file saving dialog"),QDir::currentPath()+'/'+filename->text());
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,12 @@ AddFriendForm::AddFriendForm() : dns(this)
|
||||||
main = new QWidget(), head = new QWidget();
|
main = new QWidget(), head = new QWidget();
|
||||||
QFont bold;
|
QFont bold;
|
||||||
bold.setBold(true);
|
bold.setBold(true);
|
||||||
headLabel.setText("Add Friends");
|
headLabel.setText(tr("Add Friends"));
|
||||||
headLabel.setFont(bold);
|
headLabel.setFont(bold);
|
||||||
|
|
||||||
toxIdLabel.setText("Tox ID");
|
toxIdLabel.setText(tr("Tox ID","Tox ID of the person you're sending a friend request to"));
|
||||||
messageLabel.setText("Message");
|
messageLabel.setText(tr("Message","The message you send in friend requests"));
|
||||||
sendButton.setText("Send friend request");
|
sendButton.setText(tr("Send friend request"));
|
||||||
|
|
||||||
main->setLayout(&layout);
|
main->setLayout(&layout);
|
||||||
layout.addWidget(&toxIdLabel);
|
layout.addWidget(&toxIdLabel);
|
||||||
|
@ -64,7 +64,7 @@ void AddFriendForm::showWarning(const QString &message) const
|
||||||
QString AddFriendForm::getMessage() const
|
QString AddFriendForm::getMessage() const
|
||||||
{
|
{
|
||||||
const QString msg = message.toPlainText();
|
const QString msg = message.toPlainText();
|
||||||
return !msg.isEmpty() ? msg : "Tox me maybe?";
|
return !msg.isEmpty() ? msg : tr("Tox me maybe?","Default message in friend requests if the field is left blank. Write something appropriate!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFriendForm::onSendTriggered()
|
void AddFriendForm::onSendTriggered()
|
||||||
|
@ -72,7 +72,7 @@ void AddFriendForm::onSendTriggered()
|
||||||
QString id = toxId.text().trimmed();
|
QString id = toxId.text().trimmed();
|
||||||
|
|
||||||
if (id.isEmpty()) {
|
if (id.isEmpty()) {
|
||||||
showWarning("Please fill in a valid Tox ID");
|
showWarning(tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to"));
|
||||||
} else if (isToxId(id)) {
|
} else if (isToxId(id)) {
|
||||||
emit friendRequested(id, getMessage());
|
emit friendRequested(id, getMessage());
|
||||||
} else {
|
} else {
|
||||||
|
@ -87,38 +87,38 @@ void AddFriendForm::handleDnsLookup()
|
||||||
const QString idKeyWord("id=");
|
const QString idKeyWord("id=");
|
||||||
|
|
||||||
if (dns.error() != QDnsLookup::NoError) {
|
if (dns.error() != QDnsLookup::NoError) {
|
||||||
showWarning("Error while looking up DNS");
|
showWarning(tr("Error while looking up DNS","The DNS gives the Tox ID associated to toxme.se addresses"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<QDnsTextRecord> textRecords = dns.textRecords();
|
const QList<QDnsTextRecord> textRecords = dns.textRecords();
|
||||||
if (textRecords.length() != 1) {
|
if (textRecords.length() != 1) {
|
||||||
showWarning("Unexpected number of text records");
|
showWarning(tr("Unexpected number of text records", "Error with the DNS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<QByteArray> textRecordValues = textRecords.first().values();
|
const QList<QByteArray> textRecordValues = textRecords.first().values();
|
||||||
if (textRecordValues.length() != 1) {
|
if (textRecordValues.length() != 1) {
|
||||||
showWarning("Unexpected number of values in text record");
|
showWarning(tr("Unexpected number of values in text record", "Error with the DNS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString entry(textRecordValues.first());
|
const QString entry(textRecordValues.first());
|
||||||
int idx = entry.indexOf(idKeyWord);
|
int idx = entry.indexOf(idKeyWord);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
showWarning("The DNS lookup does not contain any Tox ID");
|
showWarning(tr("The DNS lookup does not contain any Tox ID", "Error with the DNS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
idx += idKeyWord.length();
|
idx += idKeyWord.length();
|
||||||
if (entry.length() < idx + static_cast<int>(TOX_ID_SIZE)) {
|
if (entry.length() < idx + static_cast<int>(TOX_ID_SIZE)) {
|
||||||
showWarning("The DNS lookup does not contain a valid Tox ID");
|
showWarning(tr("The DNS lookup does not contain a valid Tox ID", "Error with the DNS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString friendAdress = entry.mid(idx, TOX_ID_SIZE);
|
const QString friendAdress = entry.mid(idx, TOX_ID_SIZE);
|
||||||
if (!isToxId(friendAdress)) {
|
if (!isToxId(friendAdress)) {
|
||||||
showWarning("The DNS lookup does not contain a valid Tox ID");
|
showWarning(tr("The DNS lookup does not contain a valid Tox ID", "Error with the DNS"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ void ChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date)
|
||||||
|
|
||||||
void ChatForm::onAttachClicked()
|
void ChatForm::onAttachClicked()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getOpenFileName(0,"Send a file");
|
QString path = QFileDialog::getOpenFileName(0,tr("Send a file"));
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -583,13 +583,13 @@ void ChatForm::onChatContextMenuRequested(QPoint pos)
|
||||||
QWidget* sender = (QWidget*)QObject::sender();
|
QWidget* sender = (QWidget*)QObject::sender();
|
||||||
pos = sender->mapToGlobal(pos);
|
pos = sender->mapToGlobal(pos);
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
menu.addAction("Save chat log", this, SLOT(onSaveLogClicked()));
|
menu.addAction(tr("Save chat log"), this, SLOT(onSaveLogClicked()));
|
||||||
menu.exec(pos);
|
menu.exec(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onSaveLogClicked()
|
void ChatForm::onSaveLogClicked()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getSaveFileName(0,"Save chat log");
|
QString path = QFileDialog::getSaveFileName(0,tr("Save chat log"));
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
name->setText(group->widget->name.text());
|
name->setText(group->widget->name.text());
|
||||||
name->setFont(bold);
|
name->setFont(bold);
|
||||||
nusers->setFont(small);
|
nusers->setFont(small);
|
||||||
nusers->setText(QString("%1 users in chat").arg(group->peers.size()));
|
nusers->setText(tr("%1 users in chat").arg(group->peers.size()));
|
||||||
avatar->setPixmap(QPixmap(":/img/group.png"));
|
avatar->setPixmap(QPixmap(":/img/group.png"));
|
||||||
QString names;
|
QString names;
|
||||||
for (QString& s : group->peers)
|
for (QString& s : group->peers)
|
||||||
|
@ -152,7 +152,7 @@ void GroupChatForm::addGroupMessage(QString message, int peerId)
|
||||||
if (group->peers.contains(peerId))
|
if (group->peers.contains(peerId))
|
||||||
msgAuthor = new QLabel(group->peers[peerId]);
|
msgAuthor = new QLabel(group->peers[peerId]);
|
||||||
else
|
else
|
||||||
msgAuthor = new QLabel("<Unknown>");
|
msgAuthor = new QLabel(tr("<Unknown>"));
|
||||||
|
|
||||||
QLabel *msgText = new QLabel(message);
|
QLabel *msgText = new QLabel(message);
|
||||||
QLabel *msgDate = new QLabel(QTime::currentTime().toString("hh:mm"));
|
QLabel *msgDate = new QLabel(QTime::currentTime().toString("hh:mm"));
|
||||||
|
@ -217,7 +217,7 @@ void GroupChatForm::onSliderRangeChanged()
|
||||||
|
|
||||||
void GroupChatForm::onUserListChanged()
|
void GroupChatForm::onUserListChanged()
|
||||||
{
|
{
|
||||||
nusers->setText(QString("%1 users in chat").arg(group->nPeers));
|
nusers->setText(tr("%1 users in chat").arg(group->nPeers));
|
||||||
QString names;
|
QString names;
|
||||||
for (QString& s : group->peers)
|
for (QString& s : group->peers)
|
||||||
names.append(s+", ");
|
names.append(s+", ");
|
||||||
|
@ -236,7 +236,7 @@ void GroupChatForm::onChatContextMenuRequested(QPoint pos)
|
||||||
|
|
||||||
void GroupChatForm::onSaveLogClicked()
|
void GroupChatForm::onSaveLogClicked()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getSaveFileName(0,"Save chat log");
|
QString path = QFileDialog::getSaveFileName(0,tr("Save chat log"));
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -10,17 +10,17 @@ SettingsForm::SettingsForm()
|
||||||
QFont bold, small;
|
QFont bold, small;
|
||||||
bold.setBold(true);
|
bold.setBold(true);
|
||||||
small.setPixelSize(7);
|
small.setPixelSize(7);
|
||||||
headLabel.setText("User Settings");
|
headLabel.setText(tr("User Settings","\"Headline\" of the window"));
|
||||||
headLabel.setFont(bold);
|
headLabel.setFont(bold);
|
||||||
|
|
||||||
nameLabel.setText("Name");
|
nameLabel.setText(tr("Name","Username/nick"));
|
||||||
statusTextLabel.setText("Status");
|
statusTextLabel.setText(tr("Status","Status message"));
|
||||||
idLabel.setText("Tox ID");
|
idLabel.setText("Tox ID");
|
||||||
id.setFont(small);
|
id.setFont(small);
|
||||||
id.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
id.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
|
|
||||||
videoTest.setText("Test video");
|
videoTest.setText(tr("Test video","Text on a button to test the video/webcam"));
|
||||||
enableIPv6.setText("Enable IPv6 (recommended)");
|
enableIPv6.setText(tr("Enable IPv6 (recommended)","Text on a checkbox to enable IPv6"));
|
||||||
enableIPv6.setChecked(Settings::getInstance().getEnableIPv6());
|
enableIPv6.setChecked(Settings::getInstance().getEnableIPv6());
|
||||||
|
|
||||||
main->setLayout(&layout);
|
main->setLayout(&layout);
|
||||||
|
|
|
@ -62,8 +62,8 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
{
|
{
|
||||||
QPoint pos = event->globalPos();
|
QPoint pos = event->globalPos();
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
menu.addAction("Copy friend ID");
|
menu.addAction(tr("Copy friend ID","Menu to copy the Tox ID of that friend"));
|
||||||
QMenu* inviteMenu = menu.addMenu("Invite in group");
|
QMenu* inviteMenu = menu.addMenu(tr("Invite in group","Menu to invite a friend in a groupchat"));
|
||||||
QMap<QAction*, Group*> groupActions;
|
QMap<QAction*, Group*> groupActions;
|
||||||
for (Group* group : GroupList::groupList)
|
for (Group* group : GroupList::groupList)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
if (groupActions.isEmpty())
|
if (groupActions.isEmpty())
|
||||||
inviteMenu->setEnabled(false);
|
inviteMenu->setEnabled(false);
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addAction("Remove friend");
|
menu.addAction(tr("Remove friend", "Menu to remove the friend from our friendlist"));
|
||||||
|
|
||||||
QAction* selectedItem = menu.exec(pos);
|
QAction* selectedItem = menu.exec(pos);
|
||||||
if (selectedItem)
|
if (selectedItem)
|
||||||
|
|
|
@ -35,9 +35,9 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
|
||||||
this->setPalette(pal3);
|
this->setPalette(pal3);
|
||||||
Group* g = GroupList::findGroup(groupId);
|
Group* g = GroupList::findGroup(groupId);
|
||||||
if (g)
|
if (g)
|
||||||
nusers.setText(QString("%1 users in chat").arg(g->peers.size()));
|
nusers.setText(QString(tr("%1 users in chat")).arg(g->peers.size()));
|
||||||
else
|
else
|
||||||
nusers.setText("0 users in chat");
|
nusers.setText(tr("0 users in chat"));
|
||||||
|
|
||||||
textLayout.addStretch();
|
textLayout.addStretch();
|
||||||
textLayout.addWidget(&name);
|
textLayout.addWidget(&name);
|
||||||
|
@ -65,7 +65,7 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
{
|
{
|
||||||
QPoint pos = event->globalPos();
|
QPoint pos = event->globalPos();
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
menu.addAction("Quit group");
|
menu.addAction(tr("Quit group","Menu to quit a groupchat"));
|
||||||
|
|
||||||
QAction* selectedItem = menu.exec(pos);
|
QAction* selectedItem = menu.exec(pos);
|
||||||
if (selectedItem)
|
if (selectedItem)
|
||||||
|
@ -123,9 +123,9 @@ void GroupWidget::onUserListChanged()
|
||||||
{
|
{
|
||||||
Group* g = GroupList::findGroup(groupId);
|
Group* g = GroupList::findGroup(groupId);
|
||||||
if (g)
|
if (g)
|
||||||
nusers.setText(QString("%1 users in chat").arg(g->nPeers));
|
nusers.setText(tr("%1 users in chat").arg(g->nPeers));
|
||||||
else
|
else
|
||||||
nusers.setText("0 users in chat");
|
nusers.setText(tr("0 users in chat"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupWidget::setAsActiveChatroom()
|
void GroupWidget::setAsActiveChatroom()
|
||||||
|
|
|
@ -13,7 +13,7 @@ SelfCamView::SelfCamView(Camera* Cam, QWidget* parent)
|
||||||
mainLayout{new QHBoxLayout()}, cam(Cam)
|
mainLayout{new QHBoxLayout()}, cam(Cam)
|
||||||
{
|
{
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
setWindowTitle("Tox video test");
|
setWindowTitle(tr("Tox video test","Title of the window to test the video/webcam"));
|
||||||
setMinimumSize(320,240);
|
setMinimumSize(320,240);
|
||||||
|
|
||||||
updateDisplayTimer.setInterval(5);
|
updateDisplayTimer.setInterval(5);
|
||||||
|
|
|
@ -27,22 +27,22 @@ FriendRequestDialog::FriendRequestDialog(QWidget *parent, const QString &userId,
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
{
|
{
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
setWindowTitle("Friend request");
|
setWindowTitle(tr("Friend request","Title of the window to aceept/deny a friend request"));
|
||||||
|
|
||||||
QLabel *friendsLabel = new QLabel("Someone wants to make friends with you.", this);
|
QLabel *friendsLabel = new QLabel(tr("Someone wants to make friends with you"), this);
|
||||||
QLabel *userIdLabel = new QLabel("User ID:", this);
|
QLabel *userIdLabel = new QLabel(tr("User ID:"), this);
|
||||||
QLineEdit *userIdEdit = new QLineEdit(userId, this);
|
QLineEdit *userIdEdit = new QLineEdit(userId, this);
|
||||||
userIdEdit->setCursorPosition(0);
|
userIdEdit->setCursorPosition(0);
|
||||||
userIdEdit->setReadOnly(true);
|
userIdEdit->setReadOnly(true);
|
||||||
QLabel *messageLabel = new QLabel("Friend request message:", this);
|
QLabel *messageLabel = new QLabel(tr("Friend request message:"), this);
|
||||||
QPlainTextEdit *messageEdit = new QPlainTextEdit(message, this);
|
QPlainTextEdit *messageEdit = new QPlainTextEdit(message, this);
|
||||||
messageEdit->setReadOnly(true);
|
messageEdit->setReadOnly(true);
|
||||||
|
|
||||||
|
|
||||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
|
||||||
|
|
||||||
buttonBox->addButton("Accept", QDialogButtonBox::AcceptRole);
|
buttonBox->addButton(tr("Accept","Accept a friend request"), QDialogButtonBox::AcceptRole);
|
||||||
buttonBox->addButton("Reject", QDialogButtonBox::RejectRole);
|
buttonBox->addButton(tr("Reject","Reject a friend request"), QDialogButtonBox::RejectRole);
|
||||||
|
|
||||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &FriendRequestDialog::accept);
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &FriendRequestDialog::accept);
|
||||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &FriendRequestDialog::reject);
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &FriendRequestDialog::reject);
|
||||||
|
|
|
@ -1109,9 +1109,9 @@ void Widget::minimizeBtnClicked()
|
||||||
void Widget::onStatusImgClicked()
|
void Widget::onStatusImgClicked()
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
menu.addAction("Online");
|
menu.addAction(tr("Online","Button to set your status to 'Online'"));
|
||||||
menu.addAction("Away");
|
menu.addAction(tr("Away","Button to set your status to 'Away'"));
|
||||||
menu.addAction("Busy");
|
menu.addAction(tr("Busy","Button to set your status to 'Busy'"));
|
||||||
|
|
||||||
QPoint pos = QCursor::pos();
|
QPoint pos = QCursor::pos();
|
||||||
QAction* selectedItem = menu.exec(pos);
|
QAction* selectedItem = menu.exec(pos);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user