OSDN Git Service

Automatically align underspecified tasks boundaries on project boundaries when possible.
[tjqt4port/tj2qt4.git] / taskjuggler / TjMessageHandler.cpp
1 /*
2  * TjMessageHandler.h - TaskJuggler
3  *
4  * Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007
5  *               by Chris Schlaeger <cs@kde.org>
6  *
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.
10  *
11  * $Id$
12  */
13
14 #include "TjMessageHandler.h"
15
16 TjMessageHandler TJMH(true);
17
18 void
19 TjMessageHandler::warningMessage(const QString& msg, const QString& file, int
20                                  line)
21 {
22     warnings++;
23
24     if (consoleMode)
25     {
26         if (file.isEmpty())
27             qWarning("%s", msg.latin1());
28         else
29             qWarning("%s:%d: %s", file.latin1(), line, msg.latin1());
30     }
31     else
32         printWarning(msg, file, line);
33 }
34
35 void
36 TjMessageHandler::errorMessage(const QString& msg, const QString& file, int
37                                line)
38 {
39     errors++;
40
41     if (consoleMode)
42     {
43         if (file.isEmpty())
44             qWarning("%s", msg.latin1());
45         else
46             qWarning("%s:%d: %s", file.latin1(), line, msg.latin1());
47     }
48     else
49         printError(msg, file, line);
50 }
51
52 void
53 TjMessageHandler::fatalMessage(const QString& msg, const QString& file, int
54                                line)
55 {
56     if (consoleMode)
57     {
58         if (file.isEmpty())
59             qFatal("%s", msg.latin1());
60         else
61             qFatal("%s:%d: %s", file.latin1(), line, msg.latin1());
62     }
63     else
64         printFatal(msg, file, line);
65 }
66
67 #include "TjMessageHandler.moc"