Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef WATCHDOG_H
- #define WATCHDOG_H
- #include <QtGui/QDialog>
- #include "ui_WatchDog.h"
- #include <QSystemTrayIcon>
- #include <QTimerEvent>
- #include <QString>
- #include <vector>
- #include <windows.h>
- class QAction;
- class WatchDog : public QDialog
- {
- Q_OBJECT
- public:
- WatchDog( QWidget * parent = 0, Qt::WFlags flags = 0 );
- ~WatchDog();
- protected:
- void setVisible( bool visible );
- void closeEvent( QCloseEvent * event );
- void timerEvent( QTimerEvent * event );
- protected slots:
- void iconActivated( QSystemTrayIcon::ActivationReason reason );
- private:
- Ui::WatchDogClass ui;
- struct ExeParams {
- QString exeName;
- QString startCommand;
- QStringList captionMasks;
- };
- typedef std::vector< ExeParams > ExeParamsList;
- ExeParamsList m_exeNames;
- QSystemTrayIcon * m_trayIcon;
- QAction * m_restoreAction;
- int m_timerInterval;
- std::vector< HWND > m_windows;
- static BOOL CALLBACK nextWindow( HWND hwnd, LPARAM lParam );
- static DWORD getProcessId( const QString & exe );
- static QString getWindowCaption( HWND hwnd );
- static bool isCaptionMatches( HWND hwnd, const QStringList & masks );
- };
- #endif // WATCHDOG_H
Add Comment
Please, Sign In to add comment