This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/102290/

Ship it!

there is an issue with the threading implementation, but this is easier to fix than to explain and the fix will serve as a good explanation itself ;) so commit what you have so far and i'll fix it and then you can look at the changes to see how it was done. cheers ...

editors/imageviewer/imageviewer.cpp (Diff revision 6)
ImageViewer::ImageViewer(const KUrl& image,QWidget* parent)
47
    loadImage(m_image);
48
}
49
50
void ImageViewer::loadImage(const KUrl& image)
51
{
52
    if(image.path().endsWith(".svg") || image.path().endsWith(".svgz")) {
53
        loadSvg(image);
54
    } else {
55
        m_loader = new ImageLoader(image, this);
56
        connect(m_loader, SIGNAL(loadImage(QImage)), this, SLOT(loadPixmap(QImage)));
57
        QThreadPool::globalInstance()->start(m_loader);
58
    }
59
}
the way to fix this is to render it from resizeEvent and tell the thread what size to make it. it's easier to show than to explain, so if you commit this patch, then i'll make the necessary changes and you can look and see how it was done.

editors/imageviewer/imageviewer.cpp (Diff revision 6)
ImageViewer::ImageViewer(const KUrl& image,QWidget* parent)
74
const QSize ImageViewer::imageSize()
75
{
76
    return m_size;
77
}
78
79
void ImageViewer::setImageSize(const QSize& size)
80
{//TODO because the non svg images are being threaded the
81
//QSize becomes invalid.
82
    m_size = size;
83
}
these become unecessary when the size of the image is the size of the widget :)

mainwindow.cpp (Diff revision 6)
void MainWindow::loadImageViewer(const KUrl& target)
631
632
    if (m_imageViewer->imageSize().height() < m_imageViewer->size().height() &&
633
        m_imageViewer->imageSize().width() < m_imageViewer->size().width()) {
634
        m_central->switchTo(m_imageViewer);
635
    } else {
636
        KMessageBox::information(this, "Your image is bigger than your screen and it will not be rendered");
637
    }
unecessary; just have the thread scale the image.

- Aaron J.


On November 29th, 2011, 4:42 p.m., Giorgos Tsiapaliwkas wrote:

Review request for Plasma and Aaron J. Seigo.
By Giorgos Tsiapaliwkas.

Updated Nov. 29, 2011, 4:42 p.m.

Description

hello,

without this patch a user cannot add an image with plasmate.

reproduce,go to files-images-new,the plasmate will open a text editor instead of a dialog,which(the dialog) is able to open an image.

With the patch a dialog will open asking for an image.

Testing

the patch is not ready yet,i have noted some questions.
Also the plasmate tries to open the image with a text editor.This have to be fixed,but how?Should we make plasmate able to preview images?

In addition,when you add something in the list of files(using the different options provided by the files qdockwidget) it names it as "new".This has to be fixed and the plasmate has to show the real name of the file.(different request,i just want an approval for this patch).

Diffs

  • CMakeLists.txt (e825271)
  • editors/CMakeLists.txt (1feb1ce)
  • editors/editpage.h (7b5dca3)
  • editors/editpage.cpp (d4b0082)
  • editors/imageviewer/imageloader.h (e69de29)
  • editors/imageviewer/imageloader.cpp (e69de29)
  • editors/imageviewer/imageviewer.h (e69de29)
  • editors/imageviewer/imageviewer.cpp (e69de29)
  • main.cpp (66a7cd8)
  • mainwindow.h (7d89815)
  • mainwindow.cpp (6ea7f0c)
  • packagemodel.cpp (8c0907a)

View Diff