source: src-qt4/life-preserver/lp-tray/LPWatcher.h @ d45a9eb

releng/10.0
Last change on this file since d45a9eb was d45a9eb, checked in by Kris Moore <kris@…>, 7 months ago

Couple quick fixes to the life-preserver tray:
1) Make sure that the new single-instance functionality will not startup a prompt to open the main GUI for 30 seconds after the tray gets launched. This prevents "double-taps" on user login when the DE also starts up an instance automatically.
2) Whenever the system check timer goes off, also check that the lpreserver log file is being watched, and re-initialize the log file watcher if necessary.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#ifndef _LP_WATCHER_H
2#define _LP_WATCHER_H
3
4#include <QCoreApplication>
5#include <QDir>
6#include <QObject>
7#include <QFileSystemWatcher>
8#include <QStringList>
9#include <QString>
10#include <QHash>
11#include <QTimer>
12#include <QFile>
13#include <QTextStream>
14#include <QDebug>
15#include <QProcess>
16
17class LPWatcher : public QObject{
18        Q_OBJECT
19public:
20        LPWatcher();
21        ~LPWatcher();
22
23        QStringList getMessages(QString type, QStringList msgList);
24        QStringList getAllCurrentMessages();
25        bool isRunning();
26        bool hasError();
27        bool initPhase();
28
29public slots:
30        void start();
31        void stop();
32        void refresh();
33
34private:
35        //Internal paths for the lpreserver output files
36        QString FILE_LOG, FILE_ERROR, FILE_REPLICATION;
37        //Internal message Logs
38        QHash<unsigned int,QString> LOGS;
39        //File system watcher
40        QFileSystemWatcher *watcher;
41        QTimer *timer, *iniTimer;
42        int sysCheckTime;
43        QFile *logfile, *repfile;
44        QTextStream *LFSTREAM, *RFSTREAM;
45        //Replication size variables
46        QString repTotK, lastSize;
47        bool INIT;
48
49        void setupLogFile();
50        void readLogFile(bool quiet = false);
51        void readReplicationFile(); //always sends quiet signals
52
53        bool startRepFileWatcher();
54        void stopRepFileWatcher();
55
56        double displayToDoubleK(QString); // string->double conversion
57        bool isReplicationRunning(); //check for replication PID file
58       
59        QStringList listReplicatedPools();
60        QStringList getCmdOutput(QString cmd);
61       
62private slots:
63        void fileChanged(QString); //file system watcher saw a change
64        void checkPoolStatus(); //check for serious system errors
65        void endInitPhase();
66
67signals:
68        void MessageAvailable(QString type);
69        void StatusUpdated();
70};
71
72#endif
Note: See TracBrowser for help on using the repository browser.