1 /*
2     KSysGuard, the KDE System Guard
3 
4 	Copyright (c) 2001 Tobias Koenig <tokoe@kde.org>
5 
6     This program is free software; you can redistribute it and/or
7     modify it under the terms of the GNU General Public
8     License as published by the Free Software Foundation; either
9     version 2 of the License, or (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 
20 */
21 
22 #ifndef _LogFile_h
23 #define _LogFile_h
24 
25 #define MAXLINES 500
26 
27 class QListWidget;
28 
29 #include <QDomElement>
30 
31 #include <SensorDisplay.h>
32 
33 class Ui_LogFileSettings;
34 
35 class LogFile : public KSGRD::SensorDisplay
36 {
37 	Q_OBJECT
38 public:
39     explicit LogFile(QWidget *parent, const QString& title, SharedSettings *workSheetSettings);
40     ~LogFile() override;
41 
42 	bool addSensor(const QString& hostName, const QString& sensorName,
43 				   const QString& sensorType, const QString& sensorDescr) override;
44 	void answerReceived(int id, const QList<QByteArray>& answer) override;
45 
46 	bool restoreSettings(QDomElement& element) override;
47 	bool saveSettings(QDomDocument& doc, QDomElement& element) override;
48 
49 	void updateMonitor(void);
50 
51 	void configureSettings(void) override;
52 
timerTick()53 	void timerTick() override
54 	{
55 		updateMonitor();
56 	}
57 
hasSettingsDialog()58 	bool hasSettingsDialog() const override
59 	{
60 		return true;
61 	}
62 
63 public Q_SLOTS:
64 	void applySettings() override;
65 	void applyStyle() override;
66 
67 	void settingsAddRule();
68 	void settingsDeleteRule();
69 	void settingsChangeRule();
70 	void settingsRuleListSelected(int index);
71 	void settingsRuleTextChanged();
72 
73 private:
74 	Ui_LogFileSettings* lfs;
75 	QListWidget* monitor;
76 	QStringList filterRules;
77 
78 	unsigned long logFileID;
79 };
80 
81 #endif // _LogFile_h
82