]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiImage.cpp
Make GuiRef and GuiInclude subclasses of GuiCommand.
[lyx.git] / src / frontends / qt4 / GuiImage.cpp
index 51eb3cf6f74b36a54cb964af572b26733fb13c5a..efa198bc69efb2137d6385108456ed7b4f425657 100644 (file)
@@ -23,8 +23,6 @@
 #include "support/lstrings.h"       // ascii_lowercase
 
 #include <QPainter>
-#include <QPictureIO>
-#include <QPicture>
 #include <QImage>
 #include <QImageReader>
 
@@ -40,22 +38,20 @@ using std::equal_to;
 using std::find_if;
 using std::string;
 
-QPictureIO StaticPicture;
-
 namespace lyx {
 namespace graphics {
 
 /// Access to this class is through this static method.
-Image::ImagePtr QLImage::newImage()
+Image::ImagePtr GuiImage::newImage()
 {
        ImagePtr ptr;
-       ptr.reset(new QLImage);
+       ptr.reset(new GuiImage);
        return ptr;
 }
 
 
 /// Return the list of loadable formats.
-Image::FormatList QLImage::loadableFormats()
+Image::FormatList GuiImage::loadableFormats()
 {
        static FormatList fmts;
 
@@ -76,16 +72,17 @@ Image::FormatList QLImage::loadableFormats()
 //                     << "pictureFormat not returned NULL\n" << endl;
 //                     << "Supported formats are: " << Pic.inputFormats() << endl;
 
-       QList<QByteArray> qt_formats = QImageReader::supportedImageFormats ();
+       QList<QByteArray> qt_formats = QImageReader::supportedImageFormats();
 
        LYXERR(Debug::GRAPHICS)
                << "\nThe image loader can load the following directly:\n";
 
-       if (qt_formats.empty())
+       if (qt_formats.empty()) {
                LYXERR(Debug::GRAPHICS)
                        << "\nQt4 Problem: No Format available!" << endl;
+       }
 
-       for (QList<QByteArray>::const_iterator it =qt_formats.begin(); it != qt_formats.end(); ++it) {
+       for (QList<QByteArray>::const_iterator it = qt_formats.begin(); it != qt_formats.end(); ++it) {
 
                LYXERR(Debug::GRAPHICS) << (const char *) *it << ", ";
 
@@ -111,8 +108,9 @@ Image::FormatList QLImage::loadableFormats()
                FormatList::const_iterator fbegin = fmts.begin();
                FormatList::const_iterator fend   = fmts.end();
                for (FormatList::const_iterator fit = fbegin; fit != fend; ++fit) {
-                       if (fit != fbegin)
+                       if (fit != fbegin) {
                                LYXERR(Debug::GRAPHICS) << ", ";
+                       }
                        LYXERR(Debug::GRAPHICS) << *fit;
                }
                LYXERR(Debug::GRAPHICS) << '\n' << endl;
@@ -122,38 +120,32 @@ Image::FormatList QLImage::loadableFormats()
 }
 
 
-QLImage::QLImage()
-       : Image()
-{
-}
-
-
-QLImage::QLImage(QLImage const & other)
+GuiImage::GuiImage(GuiImage const & other)
        : Image(other), original_(other.original_),
          transformed_(other.transformed_),
          transformed_pixmap_(other.transformed_pixmap_)
 {}
 
 
-Image * QLImage::clone_impl() const
+Image * GuiImage::clone_impl() const
 {
-       return new QLImage(*this);
+       return new GuiImage(*this);
 }
 
 
-unsigned int QLImage::getWidth_impl() const
+unsigned int GuiImage::getWidth_impl() const
 {
        return transformed_.width();
 }
 
 
-unsigned int QLImage::getHeight_impl() const
+unsigned int GuiImage::getHeight_impl() const
 {
        return transformed_.height();
 }
 
 
-void QLImage::load_impl(support::FileName const & filename)
+void GuiImage::load_impl(support::FileName const & filename)
 {
        if (!original_.isNull()) {
                LYXERR(Debug::GRAPHICS)
@@ -173,10 +165,8 @@ void QLImage::load_impl(support::FileName const & filename)
 }
 
 
-namespace {
-
 // This code is taken from KImageEffect::toGray
-QImage & toGray(QImage & img)
+static QImage & toGray(QImage & img)
 {
        if (img.width() == 0 || img.height() == 0)
                return img;
@@ -195,10 +185,8 @@ QImage & toGray(QImage & img)
        return img;
 }
 
-} // namespace anon
-
 
-bool QLImage::setPixmap_impl(Params const & params)
+bool GuiImage::setPixmap_impl(Params const & params)
 {
        if (original_.isNull() || params.display == NoDisplay)
                return false;
@@ -223,7 +211,7 @@ bool QLImage::setPixmap_impl(Params const & params)
 }
 
 
-void QLImage::clip_impl(Params const & params)
+void GuiImage::clip_impl(Params const & params)
 {
        if (transformed_.isNull())
                return;
@@ -254,7 +242,7 @@ void QLImage::clip_impl(Params const & params)
 }
 
 
-void QLImage::rotate_impl(Params const & params)
+void GuiImage::rotate_impl(Params const & params)
 {
        if (transformed_.isNull())
                return;
@@ -269,7 +257,7 @@ void QLImage::rotate_impl(Params const & params)
 }
 
 
-void QLImage::scale_impl(Params const & params)
+void GuiImage::scale_impl(Params const & params)
 {
        if (transformed_.isNull())
                return;