Commit 6b307469 authored by Matt Lowe's avatar Matt Lowe
Browse files

Fixed issue with clicking on PM bubbles

Previously would not open the client if the window was minimized.
Added the same popup fix for mentions
parent c07ec9aa
...@@ -275,8 +275,7 @@ void ChatView::actMessageClicked() { ...@@ -275,8 +275,7 @@ void ChatView::actMessageClicked() {
} }
bool ChatView::shouldShowSystemPopup() { bool ChatView::shouldShowSystemPopup() {
return tabSupervisor->currentIndex() != tabSupervisor->indexOf(this) || return QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0 ||tabSupervisor->currentIndex() != tabSupervisor->indexOf(this);
QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0;
} }
void ChatView::showSystemPopup(QString &sender) { void ChatView::showSystemPopup(QString &sender) {
......
...@@ -118,9 +118,8 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event) ...@@ -118,9 +118,8 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
} }
bool TabMessage::shouldShowSystemPopup(const Event_UserMessage &event) { bool TabMessage::shouldShowSystemPopup(const Event_UserMessage &event) {
return (event.sender_name() == otherUserInfo->name() && return (QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0 ||
tabSupervisor->currentIndex() != tabSupervisor->indexOf(this)) || event.sender_name() == otherUserInfo->name() && tabSupervisor->currentIndex() != tabSupervisor->indexOf(this));
QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0;
} }
void TabMessage::showSystemPopup(const Event_UserMessage &event) { void TabMessage::showSystemPopup(const Event_UserMessage &event) {
...@@ -132,6 +131,7 @@ void TabMessage::showSystemPopup(const Event_UserMessage &event) { ...@@ -132,6 +131,7 @@ void TabMessage::showSystemPopup(const Event_UserMessage &event) {
void TabMessage::messageClicked() { void TabMessage::messageClicked() {
tabSupervisor->setCurrentIndex(tabSupervisor->indexOf(this)); tabSupervisor->setCurrentIndex(tabSupervisor->indexOf(this));
QApplication::setActiveWindow(this); QApplication::setActiveWindow(this);
emit maximizeClient();
} }
void TabMessage::processUserLeft() void TabMessage::processUserLeft()
......
...@@ -25,6 +25,7 @@ private: ...@@ -25,6 +25,7 @@ private:
QAction *aLeave; QAction *aLeave;
signals: signals:
void talkClosing(TabMessage *tab); void talkClosing(TabMessage *tab);
void maximizeClient();
private slots: private slots:
void sendMessage(); void sendMessage();
void actLeave(); void actLeave();
......
...@@ -133,6 +133,7 @@ void TabRoom::retranslateUi() ...@@ -133,6 +133,7 @@ void TabRoom::retranslateUi()
void TabRoom::focusTab() { void TabRoom::focusTab() {
QApplication::setActiveWindow(this); QApplication::setActiveWindow(this);
tabSupervisor->setCurrentIndex(tabSupervisor->indexOf(this)); tabSupervisor->setCurrentIndex(tabSupervisor->indexOf(this));
emit maximizeClient();
} }
void TabRoom::actShowMentionPopup(QString &sender) { void TabRoom::actShowMentionPopup(QString &sender) {
......
...@@ -49,6 +49,7 @@ private: ...@@ -49,6 +49,7 @@ private:
signals: signals:
void roomClosing(TabRoom *tab); void roomClosing(TabRoom *tab);
void openMessageDialog(const QString &userName, bool focus); void openMessageDialog(const QString &userName, bool focus);
void maximizeClient();
private slots: private slots:
void sendMessage(); void sendMessage();
void sayFinished(const Response &response); void sayFinished(const Response &response);
......
...@@ -364,6 +364,7 @@ void TabSupervisor::gameLeft(TabGame *tab) ...@@ -364,6 +364,7 @@ void TabSupervisor::gameLeft(TabGame *tab)
void TabSupervisor::addRoomTab(const ServerInfo_Room &info, bool setCurrent) void TabSupervisor::addRoomTab(const ServerInfo_Room &info, bool setCurrent)
{ {
TabRoom *tab = new TabRoom(this, client, userInfo, info); TabRoom *tab = new TabRoom(this, client, userInfo, info);
connect(tab, SIGNAL(maximizeClient()), this, SLOT(maximizeMainWindow()));
connect(tab, SIGNAL(roomClosing(TabRoom *)), this, SLOT(roomLeft(TabRoom *))); connect(tab, SIGNAL(roomClosing(TabRoom *)), this, SLOT(roomLeft(TabRoom *)));
connect(tab, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool))); connect(tab, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
int tabIndex = myAddTab(tab); int tabIndex = myAddTab(tab);
...@@ -422,6 +423,7 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus ...@@ -422,6 +423,7 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
tab = new TabMessage(this, client, *userInfo, otherUser); tab = new TabMessage(this, client, *userInfo, otherUser);
connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *))); connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *)));
connect(tab, SIGNAL(maximizeClient()), this, SLOT(maximizeMainWindow()));
int tabIndex = myAddTab(tab); int tabIndex = myAddTab(tab);
addCloseButtonToTab(tab, tabIndex); addCloseButtonToTab(tab, tabIndex);
messageTabs.insert(receiverName, tab); messageTabs.insert(receiverName, tab);
...@@ -430,6 +432,10 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus ...@@ -430,6 +432,10 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
return tab; return tab;
} }
void TabSupervisor::maximizeMainWindow() {
emit maximize();
}
void TabSupervisor::talkLeft(TabMessage *tab) void TabSupervisor::talkLeft(TabMessage *tab)
{ {
if (tab == currentWidget()) if (tab == currentWidget())
......
...@@ -78,9 +78,11 @@ signals: ...@@ -78,9 +78,11 @@ signals:
void setMenu(const QList<QMenu *> &newMenuList = QList<QMenu *>()); void setMenu(const QList<QMenu *> &newMenuList = QList<QMenu *>());
void localGameEnded(); void localGameEnded();
void adminLockChanged(bool lock); void adminLockChanged(bool lock);
void maximize();
public slots: public slots:
TabDeckEditor *addDeckEditorTab(const DeckLoader *deckToOpen); TabDeckEditor *addDeckEditorTab(const DeckLoader *deckToOpen);
void openReplay(GameReplay *replay); void openReplay(GameReplay *replay);
void maximizeMainWindow();
private slots: private slots:
void closeButtonPressed(); void closeButtonPressed();
void updateCurrent(int index); void updateCurrent(int index);
......
...@@ -408,6 +408,7 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -408,6 +408,7 @@ MainWindow::MainWindow(QWidget *parent)
tabSupervisor = new TabSupervisor(client); tabSupervisor = new TabSupervisor(client);
connect(tabSupervisor, SIGNAL(setMenu(QList<QMenu *>)), this, SLOT(updateTabMenu(QList<QMenu *>))); connect(tabSupervisor, SIGNAL(setMenu(QList<QMenu *>)), this, SLOT(updateTabMenu(QList<QMenu *>)));
connect(tabSupervisor, SIGNAL(localGameEnded()), this, SLOT(localGameEnded())); connect(tabSupervisor, SIGNAL(localGameEnded()), this, SLOT(localGameEnded()));
connect(tabSupervisor, SIGNAL(maximize()), this, SLOT(maximize()));
tabSupervisor->addDeckEditorTab(0); tabSupervisor->addDeckEditorTab(0);
setCentralWidget(tabSupervisor); setCentralWidget(tabSupervisor);
...@@ -507,3 +508,7 @@ void MainWindow::pixmapCacheSizeChanged(int newSizeInMBs) ...@@ -507,3 +508,7 @@ void MainWindow::pixmapCacheSizeChanged(int newSizeInMBs)
// translate MBs to KBs // translate MBs to KBs
QPixmapCache::setCacheLimit(newSizeInMBs * 1024); QPixmapCache::setCacheLimit(newSizeInMBs * 1024);
} }
void MainWindow::maximize() {
showNormal();
}
...@@ -59,6 +59,8 @@ private slots: ...@@ -59,6 +59,8 @@ private slots:
void actAbout(); void actAbout();
void iconActivated(QSystemTrayIcon::ActivationReason reason); void iconActivated(QSystemTrayIcon::ActivationReason reason);
void maximize();
private: private:
static const QString appName; static const QString appName;
void setClientStatusTitle(); void setClientStatusTitle();
......
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