mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 19:02:48 +00:00

for compatibilty reasons automoc4 support is not removed but it shall be in the future. automoc4 has not been maintained for a while (last commit is from 2011) and the stable release is from 2009. CMake version >= 2.8.6 provides the functionality for mocking so I see no reason to not make use of it.
76 lines
1.8 KiB
C++
76 lines
1.8 KiB
C++
/* -*- C++ -*-
|
|
|
|
This file implements the ComputeThumbNNailJob class.
|
|
|
|
$ Author: Mirko Boehm $
|
|
$ Copyright: (C) 2005, Mirko Boehm $
|
|
$ Contact: mirko@kde.org
|
|
http://www.kde.org
|
|
http://www.hackerbuero.org $
|
|
$ License: LGPL with the following explicit clarification:
|
|
This code may be linked against any version of the Qt toolkit
|
|
from Trolltech, Norway. $
|
|
|
|
$Id: ComputeThumbNailJob.cpp 30 2005-08-16 16:16:04Z mirko $
|
|
*/
|
|
|
|
#include "ComputeThumbNailJob.h"
|
|
|
|
#include <DebuggingAids.h>
|
|
|
|
#include "SMIVItemDelegate.h"
|
|
|
|
#define NO_QIMAGE_SCALED 0
|
|
|
|
ComputeThumbNailJob::ComputeThumbNailJob ( QImageLoaderJob *imageLoader,
|
|
QObject *parent)
|
|
: Job (parent),
|
|
m_image (imageLoader)
|
|
{
|
|
// addDependency ( imageLoader );
|
|
}
|
|
|
|
QImage ComputeThumbNailJob::thumb()
|
|
{
|
|
P_ASSERT ( isFinished() && ! m_thumb.isNull() );
|
|
return m_thumb;
|
|
}
|
|
|
|
int ComputeThumbNailJob::priority() const
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
void ComputeThumbNailJob::run()
|
|
{
|
|
P_ASSERT ( m_image->isFinished() );
|
|
|
|
#if ! NO_QIMAGE_SCALED
|
|
QImage im = m_image->image();
|
|
if ( !im.isNull() )
|
|
{
|
|
m_thumb = im.scaled ( SMIVItemDelegate::ThumbWidth,
|
|
SMIVItemDelegate::ThumbHeight,
|
|
Qt::KeepAspectRatio,
|
|
Qt::SmoothTransformation );
|
|
} else {
|
|
debug ( 0, "ComputeThumbNailJob::run: m_image returns a nil image.\n" );
|
|
}
|
|
#else
|
|
// dummy code to disable QImage::scaled (..):
|
|
static QImage *im;
|
|
if ( im == 0 )
|
|
{
|
|
GlobalMutex.lock();
|
|
if ( im == 0 )
|
|
{
|
|
im = new QImage();
|
|
im->load ( "thumbnail.jpg" );
|
|
}
|
|
GlobalMutex.unlock();
|
|
}
|
|
m_thumb = *im;
|
|
#endif
|
|
}
|
|
|
|
#include "moc_ComputeThumbNailJob.cpp"
|