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
This commit is contained in:
Matt Lowe 2015-04-07 23:09:51 +02:00
parent c07ec9aa23
commit 6b307469fe
9 changed files with 22 additions and 5 deletions

View file

@ -275,8 +275,7 @@ void ChatView::actMessageClicked() {
}
bool ChatView::shouldShowSystemPopup() {
return tabSupervisor->currentIndex() != tabSupervisor->indexOf(this) ||
QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0;
return QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0 ||tabSupervisor->currentIndex() != tabSupervisor->indexOf(this);
}
void ChatView::showSystemPopup(QString &sender) {

View file

@ -118,9 +118,8 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
}
bool TabMessage::shouldShowSystemPopup(const Event_UserMessage &event) {
return (event.sender_name() == otherUserInfo->name() &&
tabSupervisor->currentIndex() != tabSupervisor->indexOf(this)) ||
QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0;
return (QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0 ||
event.sender_name() == otherUserInfo->name() && tabSupervisor->currentIndex() != tabSupervisor->indexOf(this));
}
void TabMessage::showSystemPopup(const Event_UserMessage &event) {
@ -132,6 +131,7 @@ void TabMessage::showSystemPopup(const Event_UserMessage &event) {
void TabMessage::messageClicked() {
tabSupervisor->setCurrentIndex(tabSupervisor->indexOf(this));
QApplication::setActiveWindow(this);
emit maximizeClient();
}
void TabMessage::processUserLeft()

View file

@ -25,6 +25,7 @@ private:
QAction *aLeave;
signals:
void talkClosing(TabMessage *tab);
void maximizeClient();
private slots:
void sendMessage();
void actLeave();

View file

@ -133,6 +133,7 @@ void TabRoom::retranslateUi()
void TabRoom::focusTab() {
QApplication::setActiveWindow(this);
tabSupervisor->setCurrentIndex(tabSupervisor->indexOf(this));
emit maximizeClient();
}
void TabRoom::actShowMentionPopup(QString &sender) {

View file

@ -49,6 +49,7 @@ private:
signals:
void roomClosing(TabRoom *tab);
void openMessageDialog(const QString &userName, bool focus);
void maximizeClient();
private slots:
void sendMessage();
void sayFinished(const Response &response);

View file

@ -364,6 +364,7 @@ void TabSupervisor::gameLeft(TabGame *tab)
void TabSupervisor::addRoomTab(const ServerInfo_Room &info, bool setCurrent)
{
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(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
int tabIndex = myAddTab(tab);
@ -422,6 +423,7 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
tab = new TabMessage(this, client, *userInfo, otherUser);
connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *)));
connect(tab, SIGNAL(maximizeClient()), this, SLOT(maximizeMainWindow()));
int tabIndex = myAddTab(tab);
addCloseButtonToTab(tab, tabIndex);
messageTabs.insert(receiverName, tab);
@ -430,6 +432,10 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
return tab;
}
void TabSupervisor::maximizeMainWindow() {
emit maximize();
}
void TabSupervisor::talkLeft(TabMessage *tab)
{
if (tab == currentWidget())

View file

@ -78,9 +78,11 @@ signals:
void setMenu(const QList<QMenu *> &newMenuList = QList<QMenu *>());
void localGameEnded();
void adminLockChanged(bool lock);
void maximize();
public slots:
TabDeckEditor *addDeckEditorTab(const DeckLoader *deckToOpen);
void openReplay(GameReplay *replay);
void maximizeMainWindow();
private slots:
void closeButtonPressed();
void updateCurrent(int index);

View file

@ -408,6 +408,7 @@ MainWindow::MainWindow(QWidget *parent)
tabSupervisor = new TabSupervisor(client);
connect(tabSupervisor, SIGNAL(setMenu(QList<QMenu *>)), this, SLOT(updateTabMenu(QList<QMenu *>)));
connect(tabSupervisor, SIGNAL(localGameEnded()), this, SLOT(localGameEnded()));
connect(tabSupervisor, SIGNAL(maximize()), this, SLOT(maximize()));
tabSupervisor->addDeckEditorTab(0);
setCentralWidget(tabSupervisor);
@ -507,3 +508,7 @@ void MainWindow::pixmapCacheSizeChanged(int newSizeInMBs)
// translate MBs to KBs
QPixmapCache::setCacheLimit(newSizeInMBs * 1024);
}
void MainWindow::maximize() {
showNormal();
}

View file

@ -59,6 +59,8 @@ private slots:
void actAbout();
void iconActivated(QSystemTrayIcon::ActivationReason reason);
void maximize();
private:
static const QString appName;
void setClientStatusTitle();