///
Impl(FileName const & file, FileName const & doc_file);
+ void startMonitor();
+
/**
* If no file conversion is needed, then tryDisplayFormat() calls
* loadImage() directly.
/// The document filename this graphic item belongs to
FileName const & doc_file_;
///
- FileMonitor const monitor_;
+ FileMonitorPtr monitor_;
/// Is the file compressed?
bool zipped_;
void CacheItem::startMonitoring() const
{
- if (!pimpl_->monitor_.monitoring())
- pimpl_->monitor_.start();
+ pimpl_->startMonitor();
}
bool CacheItem::monitoring() const
{
- return pimpl_->monitor_.monitoring();
-}
-
-
-unsigned long CacheItem::checksum() const
-{
- return pimpl_->monitor_.checksum();
+ return (bool)pimpl_->monitor_;
}
CacheItem::Impl::Impl(FileName const & file, FileName const & doc_file)
: filename_(file), doc_file_(doc_file),
- monitor_(file, 2000),
zipped_(false),
remove_loaded_file_(false),
status_(WaitingToLoad)
+{}
+
+
+void CacheItem::Impl::startMonitor()
{
- monitor_.connect(bind(&Impl::startLoading, this));
+ if (monitor_)
+ return;
+ monitor_ = FileSystemWatcher::monitor(filename_);
+ monitor_->connect([=](){ startLoading(); });
}
void startMonitoring() const;
///
bool monitoring() const;
- /** Returns the check checksum of filename() so that, for example, you can
- * ascertain whether to output a new PostScript version of the file
- * for a LaTeX run.
- */
- unsigned long checksum() const;
/** Get the image associated with filename().
* If the image is not yet loaded, returns 0.
/** Connect and you'll be informed when the loading status of the image
* changes.
*/
- typedef boost::signals2::signal<void()> sig_type;
- typedef sig_type::slot_type slot_type;
+ typedef boost::signals2::signal<void()>::slot_type slot_type;
///
boost::signals2::connection connect(slot_type const &) const;
}
-unsigned long Loader::checksum() const
-{
- if (!pimpl_->cached_item_)
- return 0;
-
- return pimpl_->cached_item_->checksum();
-}
-
-
FileName const & Loader::filename() const
{
static FileName const empty;
void startMonitoring() const;
///
bool monitoring() const;
- /** Returns the check checksum of filename() so that, for example, you can
- * ascertain whether to output a new PostScript version of the file
- * for a LaTeX run.
- */
- unsigned long checksum() const;
/// How far have we got in loading the image?
ImageStatus status() const;