mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge remote-tracking branch 'thenain38/master'
This commit is contained in:
commit
bc6e2287d9
|
@ -164,7 +164,11 @@ void GroupChatForm::onSendTriggered()
|
|||
|
||||
void GroupChatForm::onUserListChanged()
|
||||
{
|
||||
nusersLabel->setText(tr("%1 users in chat", "Number of users in chat").arg(group->getPeersCount()));
|
||||
int peersCount = group->getPeersCount();
|
||||
if (peersCount == 1)
|
||||
nusersLabel->setText(tr("1 user in chat", "Number of users in chat"));
|
||||
else
|
||||
nusersLabel->setText(tr("%1 users in chat", "Number of users in chat").arg(peersCount));
|
||||
|
||||
QLayoutItem *child;
|
||||
while ((child = namesListLayout->takeAt(0)))
|
||||
|
@ -204,7 +208,7 @@ void GroupChatForm::onUserListChanged()
|
|||
}
|
||||
|
||||
// Enable or disable call button
|
||||
if (group->getPeersCount() != 1)
|
||||
if (peersCount != 1)
|
||||
{
|
||||
callButton->setEnabled(true);
|
||||
callButton->setObjectName("green");
|
||||
|
@ -367,5 +371,9 @@ void GroupChatForm::keyReleaseEvent(QKeyEvent* ev)
|
|||
|
||||
void GroupChatForm::retranslateUi()
|
||||
{
|
||||
nusersLabel->setText(GroupChatForm::tr("%1 users in chat", "Number of users in chat").arg(group->getPeersCount()));
|
||||
int peersCount = group->getPeersCount();
|
||||
if (peersCount == 1)
|
||||
nusersLabel->setText(tr("1 user in chat", "Number of users in chat"));
|
||||
else
|
||||
nusersLabel->setText(tr("%1 users in chat", "Number of users in chat").arg(peersCount));
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "src/widget/style.h"
|
||||
#include "src/core/core.h"
|
||||
#include "tool/croppinglabel.h"
|
||||
#include "src/widget/translator.h"
|
||||
#include <QPalette>
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
|
@ -56,6 +57,7 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
|
|||
emit g->getChatForm()->groupTitleChanged(groupId, newName.left(128));
|
||||
}
|
||||
});
|
||||
Translator::registerHandler(std::bind(&GroupWidget::retranslateUi, this), this);
|
||||
}
|
||||
|
||||
void GroupWidget::contextMenuEvent(QContextMenuEvent* event)
|
||||
|
@ -82,7 +84,7 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent* event)
|
|||
menu.addSeparator();
|
||||
|
||||
QAction* setTitle = menu.addAction(tr("Set title..."));
|
||||
QAction* quitGroup = menu.addAction(tr("Quit group","Menu to quit a groupchat"));
|
||||
QAction* quitGroup = menu.addAction(tr("Quit group", "Menu to quit a groupchat"));
|
||||
|
||||
QAction* selectedItem = menu.exec(event->globalPos());
|
||||
|
||||
|
@ -145,9 +147,13 @@ void GroupWidget::onUserListChanged()
|
|||
{
|
||||
Group* g = GroupList::findGroup(groupId);
|
||||
if (g)
|
||||
statusMessageLabel->setText(tr("%1 users in chat").arg(g->getPeersCount()));
|
||||
{
|
||||
int peersCount = g->getPeersCount();
|
||||
if (peersCount == 1)
|
||||
statusMessageLabel->setText(tr("1 user in chat"));
|
||||
else
|
||||
statusMessageLabel->setText(tr("0 users in chat"));
|
||||
statusMessageLabel->setText(tr("%1 users in chat").arg(peersCount));
|
||||
}
|
||||
}
|
||||
|
||||
void GroupWidget::setAsActiveChatroom()
|
||||
|
@ -249,3 +255,16 @@ void GroupWidget::setName(const QString& name)
|
|||
{
|
||||
nameLabel->setText(name);
|
||||
}
|
||||
|
||||
void GroupWidget::retranslateUi()
|
||||
{
|
||||
Group* g = GroupList::findGroup(groupId);
|
||||
if (g)
|
||||
{
|
||||
int peersCount = g->getPeersCount();
|
||||
if (peersCount == 1)
|
||||
statusMessageLabel->setText(tr("1 user in chat"));
|
||||
else
|
||||
statusMessageLabel->setText(tr("%1 users in chat").arg(peersCount));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,9 @@ protected:
|
|||
void dragLeaveEvent(QDragLeaveEvent* ev) override;
|
||||
void dropEvent(QDropEvent* ev) override;
|
||||
|
||||
private:
|
||||
void retranslateUi();
|
||||
|
||||
public:
|
||||
int groupId;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user