mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:10:40 +02:00
Enabled going to the clicked user in the chat.
This commit is contained in:
parent
65f912249d
commit
a48ca65236
4 changed files with 52 additions and 37 deletions
|
@ -45,7 +45,7 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="src/ui/ChatWindow.cpp" line="128"/>
|
||||
<location filename="src/ui/ChatWindow.cpp" line="133"/>
|
||||
<source>day</source>
|
||||
<translation>
|
||||
<numerusform>%n day</numerusform>
|
||||
|
@ -53,7 +53,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="src/ui/ChatWindow.cpp" line="128"/>
|
||||
<location filename="src/ui/ChatWindow.cpp" line="133"/>
|
||||
<source>hour</source>
|
||||
<translation>
|
||||
<numerusform>%n hour</numerusform>
|
||||
|
@ -61,7 +61,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<location filename="src/ui/ChatWindow.cpp" line="128"/>
|
||||
<location filename="src/ui/ChatWindow.cpp" line="133"/>
|
||||
<source>minute</source>
|
||||
<translation>
|
||||
<numerusform>%n minute</numerusform>
|
||||
|
@ -76,7 +76,7 @@
|
|||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="src/ui/ChatWindow.cpp" line="183"/>
|
||||
<location filename="src/ui/ChatWindow.cpp" line="188"/>
|
||||
<source>%1 online now:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -923,12 +923,16 @@ void Menu::goTo() {
|
|||
gotoDialog.resize(gotoDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW, gotoDialog.size().height());
|
||||
|
||||
int dialogReturn = gotoDialog.exec();
|
||||
if (dialogReturn == QDialog::Accepted && !gotoDialog.textValue().isEmpty()) {
|
||||
LocationManager* manager = &LocationManager::getInstance();
|
||||
manager->goTo(gotoDialog.textValue());
|
||||
connect(manager, &LocationManager::multipleDestinationsFound, this, &Menu::multipleDestinationsDecision);
|
||||
goToUser(dialogReturn == QDialog::Accepted && !gotoDialog.textValue().isEmpty(),
|
||||
gotoDialog.textValue());
|
||||
}
|
||||
|
||||
void Menu::goToUser(bool go, const QString& user) {
|
||||
if (go) {
|
||||
LocationManager* manager = &LocationManager::getInstance();
|
||||
manager->goTo(user);
|
||||
connect(manager, &LocationManager::multipleDestinationsFound, this, &Menu::multipleDestinationsDecision);
|
||||
}
|
||||
sendFakeEnterEvent();
|
||||
}
|
||||
|
||||
|
|
|
@ -122,6 +122,7 @@ public slots:
|
|||
void importSettings();
|
||||
void exportSettings();
|
||||
void goTo();
|
||||
void goToUser(bool go, const QString& user);
|
||||
void pasteToVoxel();
|
||||
|
||||
void toggleLoginMenuItem();
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <QPalette>
|
||||
#include <QScrollBar>
|
||||
#include <QSizePolicy>
|
||||
#include <QTextDocument>
|
||||
#include <QTimer>
|
||||
|
||||
#include "Application.h"
|
||||
|
@ -90,8 +89,7 @@ void ChatWindow::showEvent(QShowEvent* event) {
|
|||
}
|
||||
|
||||
bool ChatWindow::eventFilter(QObject* sender, QEvent* event) {
|
||||
Q_UNUSED(sender);
|
||||
|
||||
if (sender == ui->messagePlainTextEdit) {
|
||||
if (event->type() != QEvent::KeyPress) {
|
||||
return false;
|
||||
}
|
||||
|
@ -112,6 +110,13 @@ bool ChatWindow::eventFilter(QObject* sender, QEvent* event) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (event->type() != QEvent::MouseButtonRelease) {
|
||||
return false;
|
||||
}
|
||||
QString user = sender->property("user").toString();
|
||||
Menu::getInstance()->goToUser(true, user);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -187,7 +192,9 @@ void ChatWindow::participantsChanged() {
|
|||
delete item;
|
||||
}
|
||||
foreach (const QString& participant, participants) {
|
||||
QLabel* userLabel = new QLabel(getParticipantName(participant));
|
||||
QString participantName = getParticipantName(participant);
|
||||
QLabel* userLabel = new QLabel();
|
||||
userLabel->setText(participantName);
|
||||
userLabel->setStyleSheet("background-color: palette(light);"
|
||||
"border-radius: 5px;"
|
||||
"color: #267077;"
|
||||
|
@ -197,6 +204,9 @@ void ChatWindow::participantsChanged() {
|
|||
"padding-left: 2px;"
|
||||
"border: 1px solid palette(shadow);"
|
||||
"font-weight: bold");
|
||||
userLabel->setProperty("user", participantName);
|
||||
userLabel->setCursor(Qt::PointingHandCursor);
|
||||
userLabel->installEventFilter(this);
|
||||
ui->usersWidget->layout()->addWidget(userLabel);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue