1 /* 2 * Copyright (C) 2010, 2014 Nicolas Bonnefon and other contributors 3 * 4 * This file is part of glogg. 5 * 6 * glogg is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * glogg 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 glogg. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef FILEWATCHER_H 21 #define FILEWATCHER_H 22 23 #include <QObject> 24 25 // This abstract class defines a way to watch a group of (potentially 26 // absent) files for update. 27 class FileWatcher : public QObject { 28 Q_OBJECT 29 30 public: 31 // Create an empty object 32 FileWatcher() {} 33 // Destroy the object 34 virtual ~FileWatcher() {} 35 36 // Adds the file to the list of file to watch 37 // (do nothing if a file is already monitored) 38 virtual void addFile( const QString& fileName ) = 0; 39 // Removes the file to the list of file to watch 40 // (do nothing if said file is not monitored) 41 virtual void removeFile( const QString& fileName ) = 0; 42 43 // Set the polling interval (0 means disabled) 44 virtual void setPollingInterval( uint32_t ) {} 45 46 signals: 47 // Sent when the file on disk has changed in any way. 48 void fileChanged( const QString& ); 49 }; 50 51 #endif 52