source: src-qt4/life-preserver/LPWatcher.h @ 284b216

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 284b216 was 284b216, checked in by Ken Moore <ken@…>, 14 months ago

Add a new class to life-preserver that handles all the log/error/process tracking from lpreserver. Not implemented in the tray yet, still needs a bit more work before it is ready to replace a lot of the code in LPTray.
Also add the beginnings of a couple new device management functions to the LPBackend.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#ifndef _LP_WATCHER_H
2#define _LP_WATCHER_H
3
4#include <QObject>
5#include <QFileSystemWatcher>
6#include <QStringList>
7#include <QString>
8#include <QHash>
9#include <QTimer>
10#include <QFile>
11#include <QTextStream>
12#include <QDebug>
13
14class LPWatcher : public QObject{
15        Q_OBJECT
16public:
17        LPWatcher();
18        ~LPWatcher();
19
20        QStringList getMessages(QString type, QStringList msgList);
21        //Valid types - "critical"/"running"/"message"
22        //Valid messages - "dataset","message","summary","id", "timestamp", "time"
23
24public slots:
25        void start();
26        void stop();
27
28private:
29        //Internal paths for the lpreserver output files
30        QString FILE_LOG, FILE_ERROR, FILE_REPLICATION;
31        //Internal message Logs
32        QHash<unsigned int,QString> LOGS;
33        //File system watcher
34        QFileSystemWatcher *watcher;
35        QTimer *timer;
36        QFile *logfile, *repfile;
37        QTextStream *LFSTREAM, *RFSTREAM;
38        //Replication size variables
39        QString repTotK, lastSize;
40
41        void readLogFile(bool quiet = false);
42        void readReplicationFile(bool quiet = false);
43
44        void startRepFileWatcher();
45        void stopRepFileWatcher();
46
47private slots:
48        void fileChanged(QString); //file system watcher saw a change
49        void checkErrorFile(); //check for serious system error file
50
51signals:
52        void CriticalMessageAvailable();
53        void ProcessUpdateAvailable();
54        void NotificationMessageAvailable();
55};
56
57#endif
Note: See TracBrowser for help on using the repository browser.