Fix forward navigation control on Linux.
[dorian] / trace.h
1 #ifndef TRACE_H
2 #define TRACE_H
3
4 #include <QtGlobal>
5 #include <QtDebug>
6 #include <QString>
7 #include <QTime>
8 #include <QEvent>
9 #include <QFile>
10
11 #ifdef Q_OS_SYMBIAN
12 #   ifdef __PRETTY_FUNCTION__
13 #       define TRACE Trace _(__PRETTY_FUNCTION__)
14 #   else
15 #       define TRACE Trace _(__FUNCTION__)
16 #   endif
17 #else
18 #   define TRACE Trace _(Q_FUNC_INFO)
19 #endif
20
21 /** Trace helper. */
22 class Trace
23 {
24 public:
25     Trace(const QString &s);
26     ~Trace();
27     static QString event(QEvent::Type t);
28     static void messageHandler(QtMsgType type, const char *msg);
29     static QtMsgType level;
30     static void setFileName(const QString &fileName);
31     static QString fileName();
32
33 protected:
34     static QString prefix();
35     QString name;
36     static int indent;
37     typedef struct {int type; const char *name;} EventName;
38     static EventName eventTab[];
39     static QFile file;
40 };
41
42 #endif // TRACE_H