diff options
Diffstat (limited to 'src/image.cpp')
-rw-r--r-- | src/image.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/image.cpp b/src/image.cpp index 35e14cb..88c134f 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -19,8 +19,8 @@ #include <kpixmapio.h> #include <kstaticdeleter.h> -#include <qbuffer.h> -#include <qregexp.h> +#include <tqbuffer.h> +#include <tqregexp.h> using Tellico::Data::Image; using Tellico::Data::ImageInfo; @@ -34,45 +34,45 @@ KPixmapIO* Image::io() { return s_pixmapIO; } -Image::Image() : QImage(), m_id(QString::null), m_linkOnly(false) { +Image::Image() : TQImage(), m_id(TQString()), m_linkOnly(false) { } // I'm using the MD5 hash as the id. I consider it rather unlikely that two images in one // collection could ever have the same hash, and this lets me do a fast comparison of two images // simply by comparing their ids. -Image::Image(const QString& filename_) : QImage(filename_), m_linkOnly(false) { - m_format = QImage::imageFormat(filename_); +Image::Image(const TQString& filename_) : TQImage(filename_), m_linkOnly(false) { + m_format = TQImage::imageFormat(filename_); calculateID(); } -Image::Image(const QImage& img_, const QString& format_) : QImage(img_), m_format(format_), m_linkOnly(false) { +Image::Image(const TQImage& img_, const TQString& format_) : TQImage(img_), m_format(format_), m_linkOnly(false) { calculateID(); } -Image::Image(const QByteArray& data_, const QString& format_, const QString& id_) - : QImage(data_), m_id(idClean(id_)), m_format(format_), m_linkOnly(false) { +Image::Image(const TQByteArray& data_, const TQString& format_, const TQString& id_) + : TQImage(data_), m_id(idClean(id_)), m_format(format_), m_linkOnly(false) { if(isNull()) { - m_id = QString(); + m_id = TQString(); } } Image::~Image() { } -QByteArray Image::byteArray() const { +TQByteArray Image::byteArray() const { return byteArray(*this, outputFormat(m_format)); } bool Image::isNull() const { // 1x1 images are considered null for Tellico. Amazon returns some like that. - return QImage::isNull() || (width() < 2 && height() < 2); + return TQImage::isNull() || (width() < 2 && height() < 2); } -QPixmap Image::convertToPixmap() const { +TQPixmap Image::convertToPixmap() const { return io()->convertToPixmap(*this); } -QPixmap Image::convertToPixmap(int w_, int h_) const { +TQPixmap Image::convertToPixmap(int w_, int h_) const { if(w_ < width() || h_ < height()) { return io()->convertToPixmap(this->smoothScale(w_, h_, ScaleMin)); } else { @@ -80,9 +80,9 @@ QPixmap Image::convertToPixmap(int w_, int h_) const { } } -QCString Image::outputFormat(const QCString& inputFormat) { - QStrList list = QImage::outputFormats(); - for(QStrListIterator it(list); it.current(); ++it) { +TQCString Image::outputFormat(const TQCString& inputFormat) { + TQStrList list = TQImage::outputFormats(); + for(TQStrListIterator it(list); it.current(); ++it) { if(inputFormat == it.current()) { return inputFormat; } @@ -91,24 +91,24 @@ QCString Image::outputFormat(const QCString& inputFormat) { return "PNG"; } -QByteArray Image::byteArray(const QImage& img_, const QCString& outputFormat_) { - QByteArray ba; - QBuffer buf(ba); +TQByteArray Image::byteArray(const TQImage& img_, const TQCString& outputFormat_) { + TQByteArray ba; + TQBuffer buf(ba); buf.open(IO_WriteOnly); - QImageIO iio(&buf, outputFormat_); + TQImageIO iio(&buf, outputFormat_); iio.setImage(img_); iio.write(); buf.close(); return ba; } -QString Image::idClean(const QString& id_) { - static const QRegExp rx('[' + QRegExp::escape(QString::fromLatin1("/@<>#\"&%?={}|^~[]'`\\:+")) + ']'); - QString clean = id_; +TQString Image::idClean(const TQString& id_) { + static const TQRegExp rx('[' + TQRegExp::escape(TQString::tqfromLatin1("/@<>#\"&%?={}|^~[]'`\\:+")) + ']'); + TQString clean = id_; return clean.remove(rx); } -void Image::setID(const QString& id_) { +void Image::setID(const TQString& id_) { m_id = id_; } @@ -116,7 +116,7 @@ void Image::calculateID() { // the id will eventually be used as a filename if(!isNull()) { KMD5 md5(byteArray()); - m_id = QString::fromLatin1(md5.hexDigest()) + QString::fromLatin1(".") + QString::fromLatin1(m_format).lower(); + m_id = TQString::tqfromLatin1(md5.hexDigest()) + TQString::tqfromLatin1(".") + TQString::tqfromLatin1(m_format).lower(); m_id = idClean(m_id); } } @@ -131,7 +131,7 @@ ImageInfo::ImageInfo(const Image& img_) , m_height(img_.height()) { } -ImageInfo::ImageInfo(const QString& id_, const QCString& format_, int w_, int h_, bool l_) +ImageInfo::ImageInfo(const TQString& id_, const TQCString& format_, int w_, int h_, bool l_) : id(id_) , format(format_) , linkOnly(l_) |