]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewLoader.h
Fix C++20 warning on implicit capture of this via [=]
[lyx.git] / src / graphics / PreviewLoader.h
index d954401b7b996d35c2c40e375c06edfa9ed11c15..272c4d361bd47e133498335d2ffa29f492643266 100644 (file)
 #ifndef PREVIEWLOADER_H
 #define PREVIEWLOADER_H
 
-#include <boost/scoped_ptr.hpp>
-#include <boost/signal.hpp>
+#include "ColorCode.h"
+#include "support/signals.h"
 
+#include <QObject>
+
+#include <memory>
 
 namespace lyx {
 
@@ -30,14 +33,13 @@ namespace graphics {
 
 class PreviewImage;
 
-class PreviewLoader {
+class PreviewLoader : public QObject {
+       Q_OBJECT
 public:
        /** We need buffer because we require the preamble to the
         *  LaTeX file.
         */
        PreviewLoader(Buffer const & buffer);
-       ///
-       ~PreviewLoader();
 
        /** Is there an image already associated with this snippet of LaTeX?
         *  If so, returns a pointer to it, else returns 0.
@@ -68,16 +70,16 @@ public:
        /** We have accumulated several latex snippets with status "InQueue".
         *  Initiate their transformation into bitmap images.
         */
-       void startLoading() const;
+       void startLoading(bool wait = false) const;
 
        /** Connect and you'll be informed when the bitmap image file
         *  has been created and is ready for loading through
         *  lyx::graphics::PreviewImage::image().
         */
-       typedef boost::signal<void(PreviewImage const &)> sig_type;
-       typedef sig_type::slot_type slot_type;
+       typedef signal<void(PreviewImage const &)> sig;
+       typedef sig::slot_type slot;
        ///
-       boost::signals::connection connect(slot_type const &) const;
+       connection connect(slot const &) const;
 
        /** When PreviewImage has finished loading the image file into memory,
         *  it tells the PreviewLoader to tell the outside world
@@ -86,6 +88,16 @@ public:
 
        /// Which buffer owns this loader.
        Buffer const & buffer() const;
+       /// The background color used
+       static ColorCode backgroundColor() { return Color_background; }
+       /// The foreground color used
+       static ColorCode foregroundColor() { return Color_preview; }
+
+       double displayPixelRatio() const ;
+
+public Q_SLOTS:
+       ///
+       void refreshPreviews();
 
 private:
        /// noncopyable
@@ -95,7 +107,7 @@ private:
        /// Use the Pimpl idiom to hide the internals.
        class Impl;
        /// The pointer never changes although *pimpl_'s contents may.
-       boost::scoped_ptr<Impl> const pimpl_;
+       std::shared_ptr<Impl> const pimpl_;
 };
 
 } // namespace graphics