1bb02e0acSNicolas Bonnefon /* 26a12446eSNicolas Bonnefon * Copyright (C) 2010, 2014 Nicolas Bonnefon and other contributors 3bb02e0acSNicolas Bonnefon * 4bb02e0acSNicolas Bonnefon * This file is part of glogg. 5bb02e0acSNicolas Bonnefon * 6bb02e0acSNicolas Bonnefon * glogg is free software: you can redistribute it and/or modify 7bb02e0acSNicolas Bonnefon * it under the terms of the GNU General Public License as published by 8bb02e0acSNicolas Bonnefon * the Free Software Foundation, either version 3 of the License, or 9bb02e0acSNicolas Bonnefon * (at your option) any later version. 10bb02e0acSNicolas Bonnefon * 11bb02e0acSNicolas Bonnefon * glogg is distributed in the hope that it will be useful, 12bb02e0acSNicolas Bonnefon * but WITHOUT ANY WARRANTY; without even the implied warranty of 13bb02e0acSNicolas Bonnefon * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14bb02e0acSNicolas Bonnefon * GNU General Public License for more details. 15bb02e0acSNicolas Bonnefon * 16bb02e0acSNicolas Bonnefon * You should have received a copy of the GNU General Public License 17bb02e0acSNicolas Bonnefon * along with glogg. If not, see <http://www.gnu.org/licenses/>. 18bb02e0acSNicolas Bonnefon */ 19bb02e0acSNicolas Bonnefon 20bb02e0acSNicolas Bonnefon #ifndef FILEWATCHER_H 21bb02e0acSNicolas Bonnefon #define FILEWATCHER_H 22bb02e0acSNicolas Bonnefon 23bb02e0acSNicolas Bonnefon #include <QObject> 24bb02e0acSNicolas Bonnefon 25*9ebe83d5SNicolas Bonnefon // This abstract class defines a way to watch a group of (potentially 26*9ebe83d5SNicolas Bonnefon // absent) files for update. 27bb02e0acSNicolas Bonnefon class FileWatcher : public QObject { 28bb02e0acSNicolas Bonnefon Q_OBJECT 29bb02e0acSNicolas Bonnefon 30bb02e0acSNicolas Bonnefon public: 31bb02e0acSNicolas Bonnefon // Create an empty object FileWatcher()326a12446eSNicolas Bonnefon FileWatcher() {} 33bb02e0acSNicolas Bonnefon // Destroy the object ~FileWatcher()346a12446eSNicolas Bonnefon virtual ~FileWatcher() {} 35bb02e0acSNicolas Bonnefon 36bb02e0acSNicolas Bonnefon // Adds the file to the list of file to watch 37bb02e0acSNicolas Bonnefon // (do nothing if a file is already monitored) 386a12446eSNicolas Bonnefon virtual void addFile( const QString& fileName ) = 0; 39bb02e0acSNicolas Bonnefon // Removes the file to the list of file to watch 40bb02e0acSNicolas Bonnefon // (do nothing if said file is not monitored) 416a12446eSNicolas Bonnefon virtual void removeFile( const QString& fileName ) = 0; 42bb02e0acSNicolas Bonnefon 4380bca0a3SNicolas Bonnefon // Set the polling interval (0 means disabled) setPollingInterval(uint32_t)4480bca0a3SNicolas Bonnefon virtual void setPollingInterval( uint32_t ) {} 4580bca0a3SNicolas Bonnefon 46bb02e0acSNicolas Bonnefon signals: 47bb02e0acSNicolas Bonnefon // Sent when the file on disk has changed in any way. 48bb02e0acSNicolas Bonnefon void fileChanged( const QString& ); 49bb02e0acSNicolas Bonnefon }; 50bb02e0acSNicolas Bonnefon 51bb02e0acSNicolas Bonnefon #endif 52