Window Alerts for messagelogwidget and chatwidget

This commit is contained in:
marcus 2009-08-30 20:40:38 +02:00
parent 4beb990f38
commit f5193edead
3 changed files with 18 additions and 0 deletions

View file

@ -1,4 +1,5 @@
#include <QtGui> #include <QtGui>
#include <QApplication>
#include "chatwidget.h" #include "chatwidget.h"
#include "client.h" #include "client.h"
@ -65,6 +66,7 @@ void ChannelWidget::leaveEvent(const QString &playerName)
void ChannelWidget::sayEvent(const QString &playerName, const QString &s) void ChannelWidget::sayEvent(const QString &playerName, const QString &s)
{ {
textEdit->append(QString("<font color=\"red\">%1:</font> %2").arg(playerName).arg(s)); textEdit->append(QString("<font color=\"red\">%1:</font> %2").arg(playerName).arg(s));
QApplication::alert(this);
} }
void ChannelWidget::serverMessageEvent(const QString &s) void ChannelWidget::serverMessageEvent(const QString &s)

View file

@ -2,6 +2,7 @@
#include "game.h" #include "game.h"
#include "player.h" #include "player.h"
#include "cardzone.h" #include "cardzone.h"
#include <QApplication>
QString MessageLogWidget::sanitizeHtml(QString dirty) const 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(logStopDumpZone(Player *, CardZone *, Player *)), this, SLOT(logStopDumpZone(Player *, CardZone *, Player *)));
connect(game, SIGNAL(logSetActivePlayer(Player *)), this, SLOT(logSetActivePlayer(Player *))); connect(game, SIGNAL(logSetActivePlayer(Player *)), this, SLOT(logSetActivePlayer(Player *)));
connect(game, SIGNAL(setActivePhase(int)), this, SLOT(logSetActivePhase(int))); 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) MessageLogWidget::MessageLogWidget(QWidget *parent)

View file

@ -41,6 +41,7 @@ private slots:
void logStopDumpZone(Player *player, CardZone *zone, Player *zoneOwner); void logStopDumpZone(Player *player, CardZone *zone, Player *zoneOwner);
void logSetActivePlayer(Player *player); void logSetActivePlayer(Player *player);
void logSetActivePhase(int phase); void logSetActivePhase(int phase);
void msgAlert();
public: public:
void connectToGame(Game *game); void connectToGame(Game *game);
MessageLogWidget(QWidget *parent = 0); MessageLogWidget(QWidget *parent = 0);