]> git.lyx.org Git - lyx.git/commitdiff
Replace FileMonitor with FileMonitor2 in GraphicsCacheItem
authorGuillaume Munch <gm@lyx.org>
Mon, 6 Mar 2017 22:16:04 +0000 (23:16 +0100)
committerGuillaume Munch <gm@lyx.org>
Fri, 10 Mar 2017 23:50:57 +0000 (00:50 +0100)
Remove dead code

src/graphics/GraphicsCacheItem.cpp
src/graphics/GraphicsCacheItem.h
src/graphics/GraphicsLoader.cpp
src/graphics/GraphicsLoader.h

index c698168dee0c22a67e47eb7528e07b0f02d9a12f..9eb449a1f85cfefcefdda3c531c7314be6f58b11 100644 (file)
@@ -45,6 +45,8 @@ public:
        ///
        Impl(FileName const & file, FileName const & doc_file);
 
+       void startMonitor();
+
        /**
         *  If no file conversion is needed, then tryDisplayFormat() calls
         *  loadImage() directly.
@@ -97,7 +99,7 @@ public:
        /// The document filename this graphic item belongs to
        FileName const & doc_file_;
        ///
-       FileMonitor const monitor_;
+       FileMonitorPtr monitor_;
 
        /// Is the file compressed?
        bool zipped_;
@@ -167,20 +169,13 @@ void CacheItem::startLoading() const
 
 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_;
 }
 
 
@@ -209,12 +204,18 @@ boost::signals2::connection CacheItem::connect(slot_type const & slot) const
 
 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(); });
 }
 
 
index ee2348d8fc49b11485a7e9761aca66469f3d0fb7..b6d7d4164ca0411e7fd0b44503f0e69a7875348d 100644 (file)
@@ -66,11 +66,6 @@ public:
        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.
@@ -85,8 +80,7 @@ public:
        /** 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;
 
index 987a973139088f5a6e763d7fc1e0297fb9957640..617ce24fd0ae907c2bb15cdd6bbd93c084063238 100644 (file)
@@ -328,15 +328,6 @@ bool Loader::monitoring() 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;
index 8b97114f60f2a32864a362aeae6c4fca590b0f0f..0b5885772e0e74528e80b9f16c95579c29f71d51 100644 (file)
@@ -81,11 +81,6 @@ public:
        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;