X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FFileMonitor.h;h=07a8dc532c93335007ab4f9b79e5b24afa445dd6;hb=cf14e814124ccbc8155fa1dde98d03be319c0e87;hp=fdf2bca69df1f938d0833c8e9b62ac8707356707;hpb=b30161b591264f06579dd30805573e456bb870d3;p=lyx.git diff --git a/src/support/FileMonitor.h b/src/support/FileMonitor.h index fdf2bca69d..07a8dc532c 100644 --- a/src/support/FileMonitor.h +++ b/src/support/FileMonitor.h @@ -60,16 +60,6 @@ typedef std::unique_ptr ActiveFileMonitorPtr; /// monitor.connect(...); /// (stops watching the first) /// -/// Block notifications for the duration of a scope: -/// { -/// FileMonitorBlocker block = monitor.block(); -/// ... -/// } -/// -/// Reset connections: -/// monitor.disconnect(); -/// or the disconnect method of the connection object for the boost signal. -/// class FileSystemWatcher { public: @@ -131,27 +121,10 @@ private: }; -class FileMonitorBlockerGuard : public QObject -{ - Q_OBJECT - QPointer monitor_; - int delay_; - -public: - FileMonitorBlockerGuard(FileMonitor * monitor); - ~FileMonitorBlockerGuard(); - void setDelay(int delay); -}; - - -typedef std::shared_ptr FileMonitorBlocker; - - /// Main class class FileMonitor : public QObject { Q_OBJECT - friend class FileMonitorBlockerGuard; public: FileMonitor(std::shared_ptr monitor); @@ -160,25 +133,8 @@ public: typedef sig::slot_type slot; /// Connect and you'll be informed when the file has changed. signals2::connection connect(slot const &); - /// disconnect all slots connected to the boost signal fileChanged_ or to - /// the qt signal fileChanged() - void disconnect(); /// absolute path being tracked std::string const & filename() { return monitor_->filename(); } - /// Creates a guard that blocks notifications. Copyable. Notifications from - /// this monitor are blocked as long as there are copies of the - /// FileMonitorBlocker around. - /// \param delay is the amount waited in ms after expiration of the guard - /// before reconnecting. It can be used to slow down incoming events - /// accordingly. A value of 0 is still made asynchronous, because of the - /// fundamentally asynchronous nature of QFileSystemWatcher. To catch one's - /// own file operations, a value of 0 for delay is sufficient with the - /// inotify backend (e.g. Linux); for OSX (kqueue), a value of 100ms is - /// unsufficient and more tests need to be done in combination with - /// flushing/syncing to disk in order to understand how to catch one's own - /// operations reliably. No feedback about Windows. See - /// . - FileMonitorBlocker block(int delay = 0); /// Make sure the good file is being monitored, after e.g. a move or a /// deletion. See . This is /// called automatically. @@ -199,8 +155,6 @@ private: sig fileChanged_; /// the unique watch for our file std::shared_ptr const monitor_; - /// - std::weak_ptr blocker_; };