summaryrefslogtreecommitdiffstats
path: root/kaddressbook/thumbnailcreator
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /kaddressbook/thumbnailcreator
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kaddressbook/thumbnailcreator')
-rw-r--r--kaddressbook/thumbnailcreator/ldifvcardcreator.cpp60
-rw-r--r--kaddressbook/thumbnailcreator/ldifvcardcreator.h14
2 files changed, 37 insertions, 37 deletions
diff --git a/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp b/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp
index 4c8a5611e..0ed562e18 100644
--- a/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp
+++ b/kaddressbook/thumbnailcreator/ldifvcardcreator.cpp
@@ -26,12 +26,12 @@
*
*/
-#include <qdatetime.h>
-#include <qfile.h>
-#include <qpixmap.h>
-#include <qimage.h>
-#include <qpainter.h>
-#include <qtextstream.h>
+#include <tqdatetime.h>
+#include <tqfile.h>
+#include <tqpixmap.h>
+#include <tqimage.h>
+#include <tqpainter.h>
+#include <tqtextstream.h>
#include <kdebug.h>
#include <kglobal.h>
@@ -64,18 +64,18 @@ VCard_LDIFCreator::~VCard_LDIFCreator()
}
-bool VCard_LDIFCreator::readContents( const QString &path )
+bool VCard_LDIFCreator::readContents( const TQString &path )
{
// read file contents
- QFile file( path );
+ TQFile file( path );
if ( !file.open( IO_ReadOnly ) )
return false;
- QString info;
+ TQString info;
text.truncate(0);
// read the file
- QString contents = file.readAll();
+ TQString contents = file.readAll();
file.close();
// convert the file contents to a KABC::Addressee address
@@ -117,9 +117,9 @@ bool VCard_LDIFCreator::readContents( const QString &path )
KABC::PhoneNumber::List pnList = addr.phoneNumbers();
- QStringList phoneNumbers;
+ TQStringList phoneNumbers;
for (unsigned int no=0; no<pnList.count(); ++no) {
- QString pn = pnList[no].number().simplifyWhiteSpace();
+ TQString pn = pnList[no].number().simplifyWhiteSpace();
if (!pn.isEmpty() && !phoneNumbers.contains(pn))
phoneNumbers.append(pn);
}
@@ -150,18 +150,18 @@ bool VCard_LDIFCreator::createImageSmall()
if ( !mSplitter ) {
mSplitter = new KPixmapSplitter;
- QString pixmap = locate( "data", "konqueror/pics/thumbnailfont_7x4.png" );
+ TQString pixmap = locate( "data", "konqueror/pics/thumbnailfont_7x4.png" );
if ( pixmap.isEmpty() ) {
delete mSplitter;
mSplitter=0;
kdWarning() << "VCard_LDIFCreator: Font image \"thumbnailfont_7x4.png\" not found!\n";
return false;
}
- mSplitter->setPixmap( QPixmap( pixmap ) );
- mSplitter->setItemSize( QSize( 4, 7 ) );
+ mSplitter->setPixmap( TQPixmap( pixmap ) );
+ mSplitter->setItemSize( TQSize( 4, 7 ) );
}
- QSize chSize = mSplitter->itemSize(); // the size of one char
+ TQSize chSize = mSplitter->itemSize(); // the size of one char
int xOffset = chSize.width();
int yOffset = chSize.height();
@@ -172,7 +172,7 @@ bool VCard_LDIFCreator::createImageSmall()
int numLines = (int) (canvasHeight / chSize.height());
// render the information
- QRect rect;
+ TQRect rect;
int rest = mPixmap.width() - (numCharsPerLine * chSize.width());
xborder = QMAX( xborder, rest / 2 ); // center horizontally
rest = mPixmap.height() - (numLines * chSize.height());
@@ -184,7 +184,7 @@ bool VCard_LDIFCreator::createImageSmall()
int posLastLine = mPixmap.height() - (chSize.height() + yborder);
bool newLine = false;
Q_ASSERT( posNewLine > 0 );
- const QPixmap *fontPixmap = &(mSplitter->pixmap());
+ const TQPixmap *fontPixmap = &(mSplitter->pixmap());
for ( uint i = 0; i < text.length(); i++ ) {
if ( x > posNewLine || newLine ) { // start a new line?
@@ -206,7 +206,7 @@ bool VCard_LDIFCreator::createImageSmall()
}
// check for newlines in the text (unix,dos)
- QChar ch = text.at( i );
+ TQChar ch = text.at( i );
if ( ch == '\n' ) {
newLine = true;
continue;
@@ -218,7 +218,7 @@ bool VCard_LDIFCreator::createImageSmall()
rect = mSplitter->coordinates( ch );
if ( !rect.isEmpty() )
- bitBlt( &mPixmap, QPoint(x,y), fontPixmap, rect, Qt::CopyROP );
+ bitBlt( &mPixmap, TQPoint(x,y), fontPixmap, rect, Qt::CopyROP );
x += xOffset; // next character
}
@@ -228,19 +228,19 @@ bool VCard_LDIFCreator::createImageSmall()
bool VCard_LDIFCreator::createImageBig()
{
- QFont normalFont( KGlobalSettings::generalFont() );
- QFont titleFont( normalFont );
+ TQFont normalFont( KGlobalSettings::generalFont() );
+ TQFont titleFont( normalFont );
titleFont.setBold(true);
// titleFont.setUnderline(true);
titleFont.setItalic(true);
- QPainter painter(&mPixmap);
+ TQPainter painter(&mPixmap);
painter.setFont(titleFont);
- QFontMetrics fm(painter.fontMetrics());
+ TQFontMetrics fm(painter.fontMetrics());
// draw contact name
painter.setClipRect(2, 2, pixmapSize.width()-4, pixmapSize.height()-4);
- QPoint p(5, fm.height()+2);
+ TQPoint p(5, fm.height()+2);
painter.drawText(p, name);
p.setY( 3*p.y()/2 );
@@ -248,8 +248,8 @@ bool VCard_LDIFCreator::createImageBig()
painter.setFont(normalFont);
fm = painter.fontMetrics();
- const QStringList list( QStringList::split('\n', text) );
- for ( QStringList::ConstIterator it = list.begin();
+ const TQStringList list( TQStringList::split('\n', text) );
+ for ( TQStringList::ConstIterator it = list.begin();
p.y()<=pixmapSize.height() && it != list.end(); ++it ) {
p.setY( p.y() + fm.height() );
painter.drawText(p, *it);
@@ -258,13 +258,13 @@ bool VCard_LDIFCreator::createImageBig()
return true;
}
-bool VCard_LDIFCreator::create(const QString &path, int width, int height, QImage &img)
+bool VCard_LDIFCreator::create(const TQString &path, int width, int height, TQImage &img)
{
if ( !readContents(path) )
return false;
// resize the image if necessary
- pixmapSize = QSize( width, height );
+ pixmapSize = TQSize( width, height );
if (height * 3 > width * 4)
pixmapSize.setHeight( width * 4 / 3 );
else
@@ -273,7 +273,7 @@ bool VCard_LDIFCreator::create(const QString &path, int width, int height, QImag
if ( pixmapSize != mPixmap.size() )
mPixmap.resize( pixmapSize );
- mPixmap.fill( QColor( 245, 245, 245 ) ); // light-grey background
+ mPixmap.fill( TQColor( 245, 245, 245 ) ); // light-grey background
// one pixel for the rectangle, the rest. whitespace
xborder = 1 + pixmapSize.width()/16; // minimum x-border
diff --git a/kaddressbook/thumbnailcreator/ldifvcardcreator.h b/kaddressbook/thumbnailcreator/ldifvcardcreator.h
index e6ae6ba42..7b5cface5 100644
--- a/kaddressbook/thumbnailcreator/ldifvcardcreator.h
+++ b/kaddressbook/thumbnailcreator/ldifvcardcreator.h
@@ -21,7 +21,7 @@
#ifndef VCARD_LDIFCREATOR_H
#define VCARD_LDIFCREATOR_H
-#include <qpixmap.h>
+#include <tqpixmap.h>
#include <kio/thumbcreator.h>
class KPixmapSplitter;
@@ -31,18 +31,18 @@ class VCard_LDIFCreator : public ThumbCreator
public:
VCard_LDIFCreator();
virtual ~VCard_LDIFCreator();
- virtual bool create(const QString &path, int width, int height, QImage &img);
+ virtual bool create(const TQString &path, int width, int height, TQImage &img);
virtual Flags flags() const;
private:
KPixmapSplitter *mSplitter;
- QPixmap mPixmap;
+ TQPixmap mPixmap;
- QString name;
- QString text;
- bool readContents( const QString &path );
+ TQString name;
+ TQString text;
+ bool readContents( const TQString &path );
int xborder, yborder;
- QSize pixmapSize;
+ TQSize pixmapSize;
bool createImageSmall();
bool createImageBig();
};