mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 16:24:45 -07:00
Mention popup fix
+ will now only popup with a mention alert when you are not on the same tab/window. + will also no longer popup by mentioning yourself
This commit is contained in:
parent
8ca2135f08
commit
b20ae9710c
4 changed files with 15 additions and 5 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include <QToolButton>
|
||||
#include <QSplitter>
|
||||
#include <QApplication>
|
||||
#include <QSystemTrayIcon>
|
||||
#include "tab_supervisor.h"
|
||||
#include "tab_room.h"
|
||||
#include "tab_userlists.h"
|
||||
|
|
@ -18,6 +19,7 @@
|
|||
#include "chatview.h"
|
||||
#include "gameselector.h"
|
||||
#include "settingscache.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "get_pb_extension.h"
|
||||
#include "pb/room_commands.pb.h"
|
||||
|
|
@ -43,6 +45,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool)));
|
||||
|
||||
chatView = new ChatView(tabSupervisor, 0, true);
|
||||
connect(chatView, SIGNAL(showMentionPopup(QString&)), this, SLOT(actShowMentionPopup(QString&)));
|
||||
connect(chatView, SIGNAL(messageClickedSignal()), this, SLOT(focusTab()));
|
||||
connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
||||
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||
|
|
@ -132,6 +135,15 @@ void TabRoom::focusTab() {
|
|||
tabSupervisor->setCurrentIndex(tabSupervisor->indexOf(this));
|
||||
}
|
||||
|
||||
void TabRoom::actShowMentionPopup(QString &sender) {
|
||||
if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this)
|
||||
|| QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0) {
|
||||
disconnect(trayIcon, SIGNAL(messageClicked()), 0, 0);
|
||||
trayIcon->showMessage(sender + tr(" mentioned you."), tr("Click to view"));
|
||||
connect(trayIcon, SIGNAL(messageClicked()), chatView, SLOT(actMessageClicked()));
|
||||
}
|
||||
}
|
||||
|
||||
void TabRoom::closeRequest()
|
||||
{
|
||||
actLeaveRoom();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue