2 * TjMessageHandler.h - TaskJuggler
4 * Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007
5 * by Chris Schlaeger <cs@kde.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
13 #ifndef _TjMessageHandler_h_
14 #define _TjMessageHandler_h_
20 * This class handles all error or warning messages that the library functions
21 * can send out. Depending on the mode it either send the messages to STDERR
22 * or raises a Qt signal.
24 * @short Handles all error or warning messages.
25 * @author Chris Schlaeger <cs@kde.org>
27 class TjMessageHandler : public QObject
31 TjMessageHandler(bool cm = true) :
37 virtual ~TjMessageHandler() { }
39 void warningMessage(const QString& msg, const QString& file = QString::null,
41 void errorMessage(const QString& msg, const QString& file = QString::null,
43 void fatalMessage(const QString& msg, const QString& file = QString::null,
46 void setConsoleMode(bool cm) { consoleMode = cm; }
48 void resetCounters() { warnings = errors = 0; }
50 int getWarnings() const { return warnings; }
51 int getErrors() const { return errors; }
54 void printWarning(const QString& msg, const QString& file, int line);
55 void printError(const QString& msg, const QString& file, int line);
56 void printFatal(const QString& msg, const QString& file, int line);
64 extern TjMessageHandler TJMH;