In case one cannot rely on QFileSystemWatcher.
see https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg199112.html
/// The document filename this graphic item belongs to
FileName const & doc_file_;
///
- FileMonitorPtr monitor_;
+ ActiveFileMonitorPtr monitor_;
/// Is the file compressed?
bool zipped_;
}
+void CacheItem::checkModifiedAsync() const
+{
+ if (!pimpl_->monitor_)
+ return;
+ pimpl_->monitor_->checkModifiedAsync();
+}
+
+
Image const * CacheItem::image() const
{
return pimpl_->image_.get();
{
if (monitor_)
return;
- monitor_ = FileSystemWatcher::monitor(filename_);
+ monitor_ = FileSystemWatcher::activeMonitor(filename_);
monitor_->connect([=](){ startLoading(); });
}
void startMonitoring() const;
///
bool monitoring() const;
+ /// perform a modification check asynchronously
+ void checkModifiedAsync() const;
/** Get the image associated with filename().
* If the image is not yet loaded, returns 0.
}
+void Loader::checkModifiedAsync() const
+{
+ if (!pimpl_->cached_item_)
+ return;
+
+ pimpl_->cached_item_->checkModifiedAsync();
+}
+
+
FileName const & Loader::filename() const
{
static FileName const empty;
void startMonitoring() const;
///
bool monitoring() const;
+ ///
+ void checkModifiedAsync() const;
/// How far have we got in loading the image?
ImageStatus status() const;
loader_.startLoading();
if (!loader_.monitoring())
loader_.startMonitoring();
+ loader_.checkModifiedAsync();
}
bool const image_ready = displayGraphic(params_) && readyToDisplay(loader_);