summaryrefslogtreecommitdiffstats
path: root/ksystemlog/src/logManager.h
blob: ba193936fff384f30222b47963e9af1b4cc833f3 (plain)
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/***************************************************************************
 *   Copyright (C) 2005 by Nicolas Ternisien                               *
 *   nicolas.ternisien@gmail.com                                           *
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 ***************************************************************************/
#ifndef LOG_MANAGER_H
#define LOG_MANAGER_H

//TQt includes
#include <tqobject.h>
#include <tqpixmap.h>
#include <tqstringlist.h>
#include <tqfile.h>
#include <tqdatetime.h>
#include <tqlistview.h>

#include <tqptrlist.h>

#include <tqvaluevector.h>
#include <tqvaluelist.h>

//KDE includes
#include <kurl.h>

//Project includes
#include "globals.h"

#include "logLineList.h"
#include "logMode.h"
#include "logFile.h"
#include "logViewColumns.h"

class Reader;
class View;
class KSystemLog;
class LoadingDialog;

class LogManager;

typedef TQPtrList<LogManager> LogManagers;

/**
 * @author Nicolas Ternisien
 * TODO !!!!!!!!!!!!! Separate OpeningFileName from LogManager !!!!!!!!!!!!
 */
class LogManager : public TQObject {
	Q_OBJECT
  
	
	public:
	
		LogManager(KSystemLog* main, LoadingDialog* progress);
		
		virtual ~LogManager();
		
		View* getView();
		
		Reader* getReader();
		
		groupByType getGroupBy();
		int getGroupByColumn();
		
		TQTime& getLastUpdate();
		
		LogMode* getLogMode();
		void initialize(LogMode* mode);
				
		void setParsingPaused(bool paused);
		bool isParsingPaused();
		
		void setTooltipEnabled(bool enabled);
		bool isTooltipEnabled();

		void setNewLinesDisplayed(bool displayed);
		bool isNewLinesDisplayed();
		
		void clearView();
		
		int getIndex();
		
		void setGroupBy(groupByType group, int column=-1);
	
		void setCurrent(bool cur);
		bool isCurrent();
		
		LogViewColumns* getColumns();

		void reload();

		void setLogFiles(LogFiles* files);
		LogFiles& getLogFiles();

		void synchronize(LogLineList* buffer);


		void toggleFilterBar();
	
		void saveConfig();
	
	protected:	
		void reinitialize();
		
		void initView();
	
	public slots:
		void slotExpandAll();
		void slotCollapseAll();
		
		void slotCopyToClipboard();
		void slotFileSave();
		
		void slotSendMail();

		
	protected slots:
		
		//TODO Change the method name
		void slotOpenContextualMenu(TQListViewItem *item, const TQPoint& pos, int value);

		//Redirect the openingProgressed signal from Reader to connected object
		void openingProgress(int percent);
		
		void slotLogUpdated(int lineCount);
		
		void slotSelectionChanged();

		
		void slotChangeCaption(const TQString& message);
		void slotChangeStatusbar(const TQString& message);
		
		void slotDetails(TQListViewItem *, const TQPoint &, int);
		
		void readingBegun();
		void readingFile(int currentFile);
		void readingEnded();
		
	signals:
		void changeTitle(View* view, const TQString& label);
		void changeTitle(View* view, const TQIconSet& icon, const TQString& label);
		
		void changeCaption(const TQString& caption);
		void changeStatusbar(const TQString& message);
		
		void detailsCalled();
		
		void GUIUpdated();
		
		void selectionChanged();
		
		void reloaded();
		void logUpdated(int);

	protected:
		KSystemLog* main;
		
		TQTime lastUpdate;
		
		LogMode* logMode;
		

		bool sortOrder;
		
		int sortColumn;
		
		bool newLinesDisplayed;
		bool parsingPaused;
		bool tooltipEnabled;

		LogFiles logFiles;
		
		bool current;
		
		int newLinesSinceLastSelection;

		
		LoadingDialog* loadingDialog;
		
		Reader* reader;
		View* view;
		
		groupByType groupBy;
		int groupByColumn;
		
		LogViewColumns* columns;

};

#endif //LOG_MANAGER_H