Commit 6e2ea1e1 authored by Zach's avatar Zach
Browse files

Merge pull request #912 from poixen/mention_popup_fix

Mention popup fix
parents 8ca2135f b20ae971
...@@ -5,13 +5,11 @@ ...@@ -5,13 +5,11 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QApplication> #include <QApplication>
#include <QDebug> #include <QDebug>
#include <QSystemTrayIcon>
#include "chatview.h" #include "chatview.h"
#include "user_level.h" #include "user_level.h"
#include "user_context_menu.h" #include "user_context_menu.h"
#include "pixmapgenerator.h" #include "pixmapgenerator.h"
#include "settingscache.h" #include "settingscache.h"
#include "main.h"
#include "tab_userlists.h" #include "tab_userlists.h"
const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47); const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47);
...@@ -282,9 +280,7 @@ bool ChatView::shouldShowSystemPopup() { ...@@ -282,9 +280,7 @@ bool ChatView::shouldShowSystemPopup() {
} }
void ChatView::showSystemPopup(QString &sender) { void ChatView::showSystemPopup(QString &sender) {
disconnect(trayIcon, SIGNAL(messageClicked()), 0, 0); emit showMentionPopup(sender);
trayIcon->showMessage(sender + tr(" mentioned you."), tr("Click to view"));
connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(actMessageClicked()));
} }
......
...@@ -65,6 +65,7 @@ signals: ...@@ -65,6 +65,7 @@ signals:
void deleteCardInfoPopup(QString cardName); void deleteCardInfoPopup(QString cardName);
void addMentionTag(QString mentionTag); void addMentionTag(QString mentionTag);
void messageClickedSignal(); void messageClickedSignal();
void showMentionPopup(QString &sender);
}; };
#endif #endif
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <QToolButton> #include <QToolButton>
#include <QSplitter> #include <QSplitter>
#include <QApplication> #include <QApplication>
#include <QSystemTrayIcon>
#include "tab_supervisor.h" #include "tab_supervisor.h"
#include "tab_room.h" #include "tab_room.h"
#include "tab_userlists.h" #include "tab_userlists.h"
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
#include "chatview.h" #include "chatview.h"
#include "gameselector.h" #include "gameselector.h"
#include "settingscache.h" #include "settingscache.h"
#include "main.h"
#include "get_pb_extension.h" #include "get_pb_extension.h"
#include "pb/room_commands.pb.h" #include "pb/room_commands.pb.h"
...@@ -43,6 +45,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI ...@@ -43,6 +45,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool))); connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool)));
chatView = new ChatView(tabSupervisor, 0, true); 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(messageClickedSignal()), this, SLOT(focusTab()));
connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool))); connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString))); connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
...@@ -132,6 +135,15 @@ void TabRoom::focusTab() { ...@@ -132,6 +135,15 @@ void TabRoom::focusTab() {
tabSupervisor->setCurrentIndex(tabSupervisor->indexOf(this)); 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() void TabRoom::closeRequest()
{ {
actLeaveRoom(); actLeaveRoom();
......
...@@ -57,6 +57,7 @@ private slots: ...@@ -57,6 +57,7 @@ private slots:
void actOpenChatSettings(); void actOpenChatSettings();
void addMentionTag(QString mentionTag); void addMentionTag(QString mentionTag);
void focusTab(); void focusTab();
void actShowMentionPopup(QString &sender);
void processListGamesEvent(const Event_ListGames &event); void processListGamesEvent(const Event_ListGames &event);
void processJoinRoomEvent(const Event_JoinRoom &event); void processJoinRoomEvent(const Event_JoinRoom &event);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment