mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'master' of https://github.com/tux3/qTox into FriendListLayoutFix
This commit is contained in:
commit
af7b8b7a25
File diff suppressed because it is too large
Load Diff
@ -58,7 +58,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
|
|||||||
{
|
{
|
||||||
case ACTION:
|
case ACTION:
|
||||||
senderText = "*";
|
senderText = "*";
|
||||||
text = wrapDiv(QString("%1 %2").arg(sender, text), "action");
|
text = wrapDiv(QString("%1 %2").arg(sender.toHtmlEscaped(), text), "action");
|
||||||
msg->setAsAction();
|
msg->setAsAction();
|
||||||
break;
|
break;
|
||||||
case ALERT:
|
case ALERT:
|
||||||
|
@ -188,7 +188,7 @@ bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout/*=-1*/)
|
|||||||
while (!(result = isEventAccepted(postTime)))
|
while (!(result = isEventAccepted(postTime)))
|
||||||
{
|
{
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
QThread::sleep(10);
|
QThread::msleep(10);
|
||||||
if (timeout > 0 && difftime(time(0), start) >= timeout)
|
if (timeout > 0 && difftime(time(0), start) >= timeout)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -858,6 +858,9 @@ QSplitter:handle{
|
|||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -937,6 +940,9 @@ QSplitter:handle{
|
|||||||
<pointsize>8</pointsize>
|
<pointsize>8</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -1003,7 +1003,7 @@ void ChatForm::setFriendTyping(bool isTyping)
|
|||||||
chatWidget->setTypingNotificationVisible(isTyping);
|
chatWidget->setTypingNotificationVisible(isTyping);
|
||||||
|
|
||||||
Text* text = static_cast<Text*>(chatWidget->getTypingNotification()->getContent(1));
|
Text* text = static_cast<Text*>(chatWidget->getTypingNotification()->getContent(1));
|
||||||
text->setText("<div class=typing>" + QString("%1 is typing").arg(f->getDisplayedName()) + "</div>");
|
text->setText("<div class=typing>" + QString("%1 is typing").arg(f->getDisplayedName().toHtmlEscaped()) + "</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::show(ContentLayout* contentLayout)
|
void ChatForm::show(ContentLayout* contentLayout)
|
||||||
@ -1093,5 +1093,17 @@ void ChatForm::hideNetcam()
|
|||||||
|
|
||||||
void ChatForm::retranslateUi()
|
void ChatForm::retranslateUi()
|
||||||
{
|
{
|
||||||
|
QString volObjectName = volButton->objectName();
|
||||||
|
QString micObjectName = micButton->objectName();
|
||||||
loadHistoryAction->setText(tr("Load chat history..."));
|
loadHistoryAction->setText(tr("Load chat history..."));
|
||||||
|
|
||||||
|
if (volObjectName == QStringLiteral("green"))
|
||||||
|
volButton->setToolTip(tr("Mute call"));
|
||||||
|
else if (volObjectName == QStringLiteral("red"))
|
||||||
|
volButton->setToolTip(tr("Unmute call"));
|
||||||
|
|
||||||
|
if (micObjectName == QStringLiteral("green"))
|
||||||
|
micButton->setToolTip(tr("Mute microphone"));
|
||||||
|
else if (micObjectName == QStringLiteral("red"))
|
||||||
|
micButton->setToolTip(tr("Unmute microphone"));
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ QDate GenericChatForm::getLatestDate() const
|
|||||||
void GenericChatForm::setName(const QString &newName)
|
void GenericChatForm::setName(const QString &newName)
|
||||||
{
|
{
|
||||||
nameLabel->setText(newName);
|
nameLabel->setText(newName);
|
||||||
nameLabel->setToolTip(newName); // for overlength names
|
nameLabel->setToolTip(newName.toHtmlEscaped()); // for overlength names
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericChatForm::show(ContentLayout* contentLayout)
|
void GenericChatForm::show(ContentLayout* contentLayout)
|
||||||
@ -294,17 +294,18 @@ void GenericChatForm::onChatContextMenuRequested(QPoint pos)
|
|||||||
ChatMessage::Ptr GenericChatForm::addMessage(const ToxId& author, const QString &message, bool isAction,
|
ChatMessage::Ptr GenericChatForm::addMessage(const ToxId& author, const QString &message, bool isAction,
|
||||||
const QDateTime &datetime, bool isSent)
|
const QDateTime &datetime, bool isSent)
|
||||||
{
|
{
|
||||||
QString authorStr = author.isActiveProfile() ? Core::getInstance()->getUsername() : resolveToxId(author);
|
bool authorIsActiveProfile = author.isActiveProfile();
|
||||||
|
QString authorStr = authorIsActiveProfile ? Core::getInstance()->getUsername() : resolveToxId(author);
|
||||||
|
|
||||||
ChatMessage::Ptr msg;
|
ChatMessage::Ptr msg;
|
||||||
if (isAction)
|
if (isAction)
|
||||||
{
|
{
|
||||||
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ACTION, false);
|
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ACTION, authorIsActiveProfile);
|
||||||
previousId.clear();
|
previousId.clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, author.isActiveProfile());
|
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, authorIsActiveProfile);
|
||||||
if ( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) )
|
if ( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) )
|
||||||
msg->hideSender();
|
msg->hideSender();
|
||||||
|
|
||||||
@ -512,12 +513,27 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
|||||||
|
|
||||||
void GenericChatForm::retranslateUi()
|
void GenericChatForm::retranslateUi()
|
||||||
{
|
{
|
||||||
|
QString callObjectName = callButton->objectName();
|
||||||
|
QString videoObjectName = videoButton->objectName();
|
||||||
|
|
||||||
|
if (callObjectName == QStringLiteral("green"))
|
||||||
|
callButton->setToolTip(tr("Start audio call"));
|
||||||
|
else if (callObjectName == QStringLiteral("yellow"))
|
||||||
|
callButton->setToolTip(tr("Accept audio call"));
|
||||||
|
else if (callObjectName == QStringLiteral("red"))
|
||||||
|
callButton->setToolTip(tr("End audio call"));
|
||||||
|
|
||||||
|
if (videoObjectName == QStringLiteral("green"))
|
||||||
|
videoButton->setToolTip(tr("Start video call"));
|
||||||
|
else if (videoObjectName == QStringLiteral("yellow"))
|
||||||
|
videoButton->setToolTip(tr("Accept video call"));
|
||||||
|
else if (videoObjectName == QStringLiteral("red"))
|
||||||
|
videoButton->setToolTip(tr("End video call"));
|
||||||
|
|
||||||
sendButton->setToolTip(tr("Send message"));
|
sendButton->setToolTip(tr("Send message"));
|
||||||
emoteButton->setToolTip(tr("Smileys"));
|
emoteButton->setToolTip(tr("Smileys"));
|
||||||
fileButton->setToolTip(tr("Send file(s)"));
|
fileButton->setToolTip(tr("Send file(s)"));
|
||||||
screenshotButton->setToolTip(tr("Send a screenshot"));
|
screenshotButton->setToolTip(tr("Send a screenshot"));
|
||||||
callButton->setToolTip(tr("Start an audio call"));
|
|
||||||
videoButton->setToolTip(tr("Start a video call"));
|
|
||||||
saveChatAction->setText(tr("Save chat log"));
|
saveChatAction->setText(tr("Save chat log"));
|
||||||
clearAction->setText(tr("Clear displayed messages"));
|
clearAction->setText(tr("Clear displayed messages"));
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,11 @@ void GroupChatForm::onSendTriggered()
|
|||||||
|
|
||||||
void GroupChatForm::onUserListChanged()
|
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;
|
QLayoutItem *child;
|
||||||
while ((child = namesListLayout->takeAt(0)))
|
while ((child = namesListLayout->takeAt(0)))
|
||||||
@ -204,7 +208,7 @@ void GroupChatForm::onUserListChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable or disable call button
|
// Enable or disable call button
|
||||||
if (group->getPeersCount() != 1)
|
if (peersCount != 1)
|
||||||
{
|
{
|
||||||
callButton->setEnabled(true);
|
callButton->setEnabled(true);
|
||||||
callButton->setObjectName("green");
|
callButton->setObjectName("green");
|
||||||
@ -367,5 +371,9 @@ void GroupChatForm::keyReleaseEvent(QKeyEvent* ev)
|
|||||||
|
|
||||||
void GroupChatForm::retranslateUi()
|
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));
|
||||||
}
|
}
|
||||||
|
@ -479,5 +479,7 @@ bool GeneralForm::eventFilter(QObject *o, QEvent *e)
|
|||||||
|
|
||||||
void GeneralForm::retranslateUi()
|
void GeneralForm::retranslateUi()
|
||||||
{
|
{
|
||||||
|
int proxyType = bodyUI->proxyType->currentIndex();
|
||||||
bodyUI->retranslateUi(this);
|
bodyUI->retranslateUi(this);
|
||||||
|
bodyUI->proxyType->setCurrentIndex(proxyType);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "src/widget/style.h"
|
#include "src/widget/style.h"
|
||||||
#include "src/core/core.h"
|
#include "src/core/core.h"
|
||||||
#include "tool/croppinglabel.h"
|
#include "tool/croppinglabel.h"
|
||||||
|
#include "src/widget/translator.h"
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
@ -56,6 +57,7 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
|
|||||||
emit g->getChatForm()->groupTitleChanged(groupId, newName.left(128));
|
emit g->getChatForm()->groupTitleChanged(groupId, newName.left(128));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Translator::registerHandler(std::bind(&GroupWidget::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupWidget::contextMenuEvent(QContextMenuEvent* event)
|
void GroupWidget::contextMenuEvent(QContextMenuEvent* event)
|
||||||
@ -82,7 +84,7 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
QAction* setTitle = menu.addAction(tr("Set title..."));
|
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());
|
QAction* selectedItem = menu.exec(event->globalPos());
|
||||||
|
|
||||||
@ -145,9 +147,13 @@ void GroupWidget::onUserListChanged()
|
|||||||
{
|
{
|
||||||
Group* g = GroupList::findGroup(groupId);
|
Group* g = GroupList::findGroup(groupId);
|
||||||
if (g)
|
if (g)
|
||||||
statusMessageLabel->setText(tr("%1 users in chat").arg(g->getPeersCount()));
|
{
|
||||||
else
|
int peersCount = g->getPeersCount();
|
||||||
statusMessageLabel->setText(tr("0 users in chat"));
|
if (peersCount == 1)
|
||||||
|
statusMessageLabel->setText(tr("1 user in chat"));
|
||||||
|
else
|
||||||
|
statusMessageLabel->setText(tr("%1 users in chat").arg(peersCount));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupWidget::setAsActiveChatroom()
|
void GroupWidget::setAsActiveChatroom()
|
||||||
@ -249,3 +255,16 @@ void GroupWidget::setName(const QString& name)
|
|||||||
{
|
{
|
||||||
nameLabel->setText(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 dragLeaveEvent(QDragLeaveEvent* ev) override;
|
||||||
void dropEvent(QDropEvent* ev) override;
|
void dropEvent(QDropEvent* ev) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int groupId;
|
int groupId;
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ RemoveFriendDialog::RemoveFriendDialog(QWidget *parent, const Friend *f)
|
|||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
setAttribute(Qt::WA_QuitOnClose, false);
|
setAttribute(Qt::WA_QuitOnClose, false);
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
ui.label->setText(ui.label->text().replace("<name>", f->getDisplayedName()));
|
ui.label->setText(ui.label->text().replace("<name>", f->getDisplayedName().toHtmlEscaped()));
|
||||||
auto removeButton = ui.buttonBox->button(QDialogButtonBox::Ok);
|
auto removeButton = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||||
auto cancelButton = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
auto cancelButton = ui.buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
removeButton->setText(tr("Remove"));
|
removeButton->setText(tr("Remove"));
|
||||||
|
@ -341,7 +341,16 @@ void Widget::init()
|
|||||||
//restore window state
|
//restore window state
|
||||||
restoreGeometry(Settings::getInstance().getWindowGeometry());
|
restoreGeometry(Settings::getInstance().getWindowGeometry());
|
||||||
restoreState(Settings::getInstance().getWindowState());
|
restoreState(Settings::getInstance().getWindowState());
|
||||||
ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());
|
if (!ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState()))
|
||||||
|
{
|
||||||
|
// Set the status panel (friendlist) to a reasonnable width by default/on first start
|
||||||
|
constexpr int spWidthPc = 33;
|
||||||
|
ui->mainSplitter->resize(size());
|
||||||
|
QList<int> sizes = ui->mainSplitter->sizes();
|
||||||
|
sizes[0] = ui->mainSplitter->width()*spWidthPc/100;
|
||||||
|
sizes[1] = ui->mainSplitter->width() - sizes[0];
|
||||||
|
ui->mainSplitter->setSizes(sizes);
|
||||||
|
}
|
||||||
|
|
||||||
connect(settingsWidget, &SettingsWidget::compactToggled, contactListWidget, &FriendListWidget::onCompactChanged);
|
connect(settingsWidget, &SettingsWidget::compactToggled, contactListWidget, &FriendListWidget::onCompactChanged);
|
||||||
connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, contactListWidget, &FriendListWidget::onGroupchatPositionChanged);
|
connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, contactListWidget, &FriendListWidget::onGroupchatPositionChanged);
|
||||||
@ -451,6 +460,16 @@ Widget* Widget::getInstance()
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::moveEvent(QMoveEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::Move)
|
||||||
|
{
|
||||||
|
saveWindowGeometry();
|
||||||
|
saveSplitterGeometry();
|
||||||
|
}
|
||||||
|
QWidget::moveEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::closeEvent(QCloseEvent *event)
|
void Widget::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if (Settings::getInstance().getShowSystemTray() && Settings::getInstance().getCloseToTray() == true)
|
if (Settings::getInstance().getShowSystemTray() && Settings::getInstance().getCloseToTray() == true)
|
||||||
@ -801,7 +820,7 @@ void Widget::setUsername(const QString& username)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->nameLabel->setText(username);
|
ui->nameLabel->setText(username);
|
||||||
ui->nameLabel->setToolTip(username); // for overlength names
|
ui->nameLabel->setToolTip(username.toHtmlEscaped()); // for overlength names
|
||||||
}
|
}
|
||||||
|
|
||||||
QString sanename = username;
|
QString sanename = username;
|
||||||
@ -826,7 +845,7 @@ void Widget::setStatusMessage(const QString &statusMessage)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->statusLabel->setText(statusMessage);
|
ui->statusLabel->setText(statusMessage);
|
||||||
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
|
ui->statusLabel->setToolTip(statusMessage.toHtmlEscaped()); // for overlength messsages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,7 +1444,7 @@ void Widget::onGroupInviteReceived(int32_t friendId, uint8_t type, QByteArray in
|
|||||||
{
|
{
|
||||||
if (type == TOX_GROUPCHAT_TYPE_TEXT || type == TOX_GROUPCHAT_TYPE_AV)
|
if (type == TOX_GROUPCHAT_TYPE_TEXT || type == TOX_GROUPCHAT_TYPE_AV)
|
||||||
{
|
{
|
||||||
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId)), true, false))
|
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId).toHtmlEscaped()), true, false))
|
||||||
{
|
{
|
||||||
int groupId = Nexus::getCore()->joinGroupchat(friendId, type, (uint8_t*)invite.data(), invite.length());
|
int groupId = Nexus::getCore()->joinGroupchat(friendId, type, (uint8_t*)invite.data(), invite.length());
|
||||||
if (groupId < 0)
|
if (groupId < 0)
|
||||||
|
@ -157,6 +157,7 @@ protected:
|
|||||||
virtual void closeEvent(QCloseEvent *event) final override;
|
virtual void closeEvent(QCloseEvent *event) final override;
|
||||||
virtual void changeEvent(QEvent *event) final override;
|
virtual void changeEvent(QEvent *event) final override;
|
||||||
virtual void resizeEvent(QResizeEvent *event) final override;
|
virtual void resizeEvent(QResizeEvent *event) final override;
|
||||||
|
virtual void moveEvent(QMoveEvent *event) final override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAddClicked();
|
void onAddClicked();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user