- bool convertImage(string const & filename);
-
- /// Load the image into memory, this gets called from imageConverted(bool).
- void loadImage();
-
- /// Sets the status of the image, in the future will also notify listeners
- /// that the status is updated.
- void setStatus(ImageStatus new_status);
-
- /** The filename we refer too.
- This is used when removing ourselves from the cache.
- */
- string filename_;
- /// The temporary file that we use
- string tempfile;
- /// The image status
- ImageStatus imageStatus_;
- /// The image (if it got loaded)
- boost::scoped_ptr<LyXImage> image_;
+ 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.
+ * This routine returns a pointer to const; if you want to modify it,
+ * create a copy and modify that.
+ */
+ Image const * image() const;
+
+ /// How far have we got in loading the image?
+ ImageStatus status() const;
+
+ /** Connect and you'll be informed when the loading status of the image
+ * changes.
+ */
+ typedef boost::signal<void()> sig_type;
+ typedef sig_type::slot_type slot_type;
+ ///
+ boost::signals::connection connect(slot_type const &) const;
+
+private:
+ /// noncopyable
+ CacheItem(CacheItem const &);
+ void operator=(CacheItem const &);
+
+ /// Use the Pimpl idiom to hide the internals.
+ class Impl;
+ /// The pointer never changes although *pimpl_'s contents may.
+ Impl * const pimpl_;