From f5193edeadf246e97d0578e93fdd718825adc9d3 Mon Sep 17 00:00:00 2001 From: marcus Date: Sun, 30 Aug 2009 20:40:38 +0200 Subject: [PATCH] Window Alerts for messagelogwidget and chatwidget --- cockatrice/src/chatwidget.cpp | 2 ++ cockatrice/src/messagelogwidget.cpp | 15 +++++++++++++++ cockatrice/src/messagelogwidget.h | 1 + 3 files changed, 18 insertions(+) diff --git a/cockatrice/src/chatwidget.cpp b/cockatrice/src/chatwidget.cpp index 065afdf6..75d6bd74 100644 --- a/cockatrice/src/chatwidget.cpp +++ b/cockatrice/src/chatwidget.cpp @@ -1,4 +1,5 @@ #include +#include #include "chatwidget.h" #include "client.h" @@ -65,6 +66,7 @@ void ChannelWidget::leaveEvent(const QString &playerName) void ChannelWidget::sayEvent(const QString &playerName, const QString &s) { textEdit->append(QString("%1: %2").arg(playerName).arg(s)); + QApplication::alert(this); } void ChannelWidget::serverMessageEvent(const QString &s) diff --git a/cockatrice/src/messagelogwidget.cpp b/cockatrice/src/messagelogwidget.cpp index 2a553e4f..3039cd59 100644 --- a/cockatrice/src/messagelogwidget.cpp +++ b/cockatrice/src/messagelogwidget.cpp @@ -2,6 +2,7 @@ #include "game.h" #include "player.h" #include "cardzone.h" +#include QString MessageLogWidget::sanitizeHtml(QString dirty) const { @@ -286,6 +287,20 @@ void MessageLogWidget::connectToGame(Game *game) connect(game, SIGNAL(logStopDumpZone(Player *, CardZone *, Player *)), this, SLOT(logStopDumpZone(Player *, CardZone *, Player *))); connect(game, SIGNAL(logSetActivePlayer(Player *)), this, SLOT(logSetActivePlayer(Player *))); connect(game, SIGNAL(setActivePhase(int)), this, SLOT(logSetActivePhase(int))); + + //Alert Test + connect(game, SIGNAL(logSay(Player *, QString)), this, SLOT(msgAlert())); + connect(game, SIGNAL(logJoin(Player *)), this, SLOT(msgAlert())); + connect(game, SIGNAL(logLeave(Player *)), this, SLOT(msgAlert())); + connect(game, SIGNAL(logSetActivePlayer(Player *)), this, SLOT(msgAlert())); + connect(game, SIGNAL(setActivePhase(int)), this, SLOT(msgAlert())); + connect(game, SIGNAL(logDraw(Player *, int)), this, SLOT(msgAlert())); + connect(game, SIGNAL(logMoveCard(Player *, QString, CardZone *, int, CardZone *, int)), this, SLOT(msgAlert())); +} + +void MessageLogWidget::msgAlert() +{ + QApplication::alert(this); } MessageLogWidget::MessageLogWidget(QWidget *parent) diff --git a/cockatrice/src/messagelogwidget.h b/cockatrice/src/messagelogwidget.h index 56c5a81e..f38a5e8f 100644 --- a/cockatrice/src/messagelogwidget.h +++ b/cockatrice/src/messagelogwidget.h @@ -41,6 +41,7 @@ private slots: void logStopDumpZone(Player *player, CardZone *zone, Player *zoneOwner); void logSetActivePlayer(Player *player); void logSetActivePhase(int phase); + void msgAlert(); public: void connectToGame(Game *game); MessageLogWidget(QWidget *parent = 0);