1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
/***************************************************************************
* Copyright (C) 1999-2001 by Bernd Gehrmann *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef MakeItem_h
#define MakeItem_h
#include <qstring.h>
enum EOutputLevel
{
// appropriate to the ID's in the button group of settingswidget.ui
eVeryShort = 0
,eShort
,eFull
};
class MakeItem
{
public:
enum Type { Normal, Error, Warning, Diagnostic };
MakeItem();
MakeItem( const QString& text );
virtual ~MakeItem();
enum DisplayModes
{
DelayedDisplay = 0, // item can be displayed later
ImmDisplay = 1, // item has to be displayed ASAP
Append = 2 // item's text can be appended (append has been overloaded)
};
virtual int displayMode() const { return ImmDisplay; }
virtual bool append( const QString& ) { return false; }
virtual Type type() { return Diagnostic; }
virtual bool visible( EOutputLevel level ) { return level > eVeryShort; }
virtual QString text( EOutputLevel );
virtual QString formattedText( EOutputLevel, bool bright_bg );
QString icon();
QString color( bool bright_bg );
static QString br();
QString m_text;
};
class CommandItem : public MakeItem
{
public:
CommandItem(const QString command)
: MakeItem( command )
{}
Type type() { return Diagnostic; }
virtual bool visible( EOutputLevel ) { return true; }
};
class ExitStatusItem : public MakeItem
{
public:
ExitStatusItem( bool normalExit, int exitStatus );
Type type() { return m_normalExit && m_exitStatus == 0 ? Diagnostic : Error; }
virtual bool visible( EOutputLevel ) { return true; }
QString text( EOutputLevel level );
private:
bool m_normalExit;
int m_exitStatus;
};
class DirectoryItem : public MakeItem
{
public:
DirectoryItem( const QString& dir, const QString& text )
: MakeItem( text )
, directory( dir )
{}
Type type() { return Diagnostic; }
static void setShowDirectoryMessages( bool show ) { m_showDirectoryMessages = show; }
static bool getShowDirectoryMessages() { return m_showDirectoryMessages; }
QString directory;
protected:
static bool m_showDirectoryMessages;
};
class EnteringDirectoryItem : public DirectoryItem
{
public:
EnteringDirectoryItem( const QString& dir, const QString& text )
: DirectoryItem( dir, text )
{}
bool visible( EOutputLevel )
{
return m_showDirectoryMessages;
}
virtual QString text( EOutputLevel );
};
class ExitingDirectoryItem : public DirectoryItem
{
public:
ExitingDirectoryItem( const QString& dir, const QString& text )
: DirectoryItem( dir, text )
{}
bool visible( EOutputLevel level )
{
return m_showDirectoryMessages && level > eVeryShort;
}
virtual QString text( EOutputLevel );
};
namespace KTextEditor { class Cursor; class Document; }
class ErrorItem : public MakeItem
{
public:
ErrorItem( const QString& fn, int ln, const QString& tx, const QString& line, bool isWarning, bool isInstatiationInfo, const QString& compiler );
virtual ~ErrorItem();
virtual bool append( const QString& text );
virtual int displayMode() const { return DelayedDisplay | Append; }
Type type() { return m_isInstatiationInfo ? Diagnostic : (m_isWarning ? Warning : Error); }
virtual bool visible( EOutputLevel ) { return true; }
QString fileName;
int lineNum;
QString m_error;
bool m_isWarning;
bool m_isInstatiationInfo; ///this also implies isWarning
QString m_compiler;
};
class ActionItem : public MakeItem
{
public:
ActionItem( const QString& action, const QString& file, const QString& tool, const QString& line )
: MakeItem( line )
, m_action( action )
, m_file( file )
, m_tool( tool )
{}
virtual bool visible( EOutputLevel ) { return true; }
virtual QString text( EOutputLevel level );
QString m_action;
QString m_file;
QString m_tool;
};
#endif
|