From eba47f8f0637f451e21348187591e1f1fd58ac74 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 2 Aug 2010 19:23:46 +0000 Subject: TQt conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1158446 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpdf/core/document.cpp | 302 ++++++++++++------------ kpdf/core/document.h | 38 +-- kpdf/core/generator.h | 12 +- kpdf/core/generator_kimgio/generator_kimgio.cpp | 12 +- kpdf/core/generator_kimgio/generator_kimgio.h | 4 +- kpdf/core/generator_pdf/generator_pdf.cpp | 146 ++++++------ kpdf/core/generator_pdf/generator_pdf.h | 32 +-- kpdf/core/generator_pdf/gp_outputdev.cpp | 36 +-- kpdf/core/generator_pdf/gp_outputdev.h | 16 +- kpdf/core/link.cpp | 12 +- kpdf/core/link.h | 36 +-- kpdf/core/observer.h | 6 +- kpdf/core/page.cpp | 46 ++-- kpdf/core/page.h | 32 +-- 14 files changed, 365 insertions(+), 365 deletions(-) (limited to 'kpdf/core') diff --git a/kpdf/core/document.cpp b/kpdf/core/document.cpp index 25e19d9a..02395747 100644 --- a/kpdf/core/document.cpp +++ b/kpdf/core/document.cpp @@ -9,14 +9,14 @@ ***************************************************************************/ // qt/kde/system includes -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -43,7 +43,7 @@ class KPDFDocumentPrivate { public: // find descriptors, mapped by ID (we handle multiple searches) - QMap< int, RunningSearch * > searches; + TQMap< int, RunningSearch * > searches; int m_lastSearchID; // needed because for remote documents docFileName is a local file and @@ -51,26 +51,26 @@ class KPDFDocumentPrivate KURL url; // cached stuff - QString docFileName; - QString xmlFileName; + TQString docFileName; + TQString xmlFileName; // a list of the mimetypes qimage can understand - QStringList kimgioMimes; + TQStringList kimgioMimes; // viewport stuff - QValueList< DocumentViewport > viewportHistory; - QValueList< DocumentViewport >::iterator viewportIterator; + TQValueList< DocumentViewport > viewportHistory; + TQValueList< DocumentViewport >::iterator viewportIterator; DocumentViewport nextDocumentViewport; // see KPDFLink::Goto for an explanation // observers / requests / allocator stuff - QMap< int, DocumentObserver * > observers; - QValueList< PixmapRequest * > pixmapRequestsStack; - QValueList< AllocatedPixmap * > allocatedPixmapsFifo; + TQMap< int, DocumentObserver * > observers; + TQValueList< PixmapRequest * > pixmapRequestsStack; + TQValueList< AllocatedPixmap * > allocatedPixmapsFifo; int allocatedPixmapsTotalMemory; // timers (memory checking / info saver) - QTimer * memCheckTimer; - QTimer * saveBookmarksTimer; + TQTimer * memCheckTimer; + TQTimer * saveBookmarksTimer; }; struct AllocatedPixmap @@ -88,37 +88,37 @@ struct RunningSearch // store search properties int continueOnPage; NormalizedRect continueOnMatch; - QValueList< int > highlightedPages; + TQValueList< int > highlightedPages; // fields related to previous searches (used for 'continueSearch') - QString cachedString; + TQString cachedString; KPDFDocument::SearchType cachedType; bool cachedCaseSensitive; bool cachedViewportMove; bool cachedNoDialogs; - QColor cachedColor; + TQColor cachedColor; }; #define foreachObserver( cmd ) {\ - QMap< int, DocumentObserver * >::iterator it=d->observers.begin(), end=d->observers.end();\ + TQMap< int, DocumentObserver * >::iterator it=d->observers.begin(), end=d->observers.end();\ for ( ; it != end ; ++ it ) { (*it)-> cmd ; } } /** KPDFDocument **/ -KPDFDocument::KPDFDocument(QWidget *widget) - : QObject(widget), generator( 0 ), d( new KPDFDocumentPrivate ) +KPDFDocument::KPDFDocument(TQWidget *widget) + : TQObject(widget), generator( 0 ), d( new KPDFDocumentPrivate ) { d->allocatedPixmapsTotalMemory = 0; d->memCheckTimer = 0; d->saveBookmarksTimer = 0; d->m_lastSearchID = -1; KImageIO::registerFormats(); - QStringList list = QImage::inputFormatList(); - QStringList::Iterator it = list.begin(); + TQStringList list = TQImage::inputFormatList(); + TQStringList::Iterator it = list.begin(); while( it != list.end() ) { - d->kimgioMimes << KMimeType::findByPath(QString("foo.%1").arg(*it), 0, true)->name(); + d->kimgioMimes << KMimeType::findByPath(TQString("foo.%1").arg(*it), 0, true)->name(); ++it; } } @@ -133,20 +133,20 @@ KPDFDocument::~KPDFDocument() } -bool KPDFDocument::openDocument( const QString & docFile, const KURL & url, const KMimeType::Ptr &mime ) +bool KPDFDocument::openDocument( const TQString & docFile, const KURL & url, const KMimeType::Ptr &mime ) { - // docFile is always local so we can use QFile on it - QFile fileReadTest( docFile ); + // docFile is always local so we can use TQFile on it + TQFile fileReadTest( docFile ); if ( !fileReadTest.open( IO_ReadOnly ) ) { - d->docFileName = QString::null; + d->docFileName = TQString::null; return false; } // determine the related "xml document-info" filename d->url = url; d->docFileName = docFile; - QString fn = docFile.contains('/') ? docFile.section('/', -1, -1) : docFile; - fn = "kpdf/" + QString::number(fileReadTest.size()) + "." + fn + ".xml"; + TQString fn = docFile.contains('/') ? docFile.section('/', -1, -1) : docFile; + fn = "kpdf/" + TQString::number(fileReadTest.size()) + "." + fn + ".xml"; fileReadTest.close(); d->xmlFileName = locateLocal( "data", fn ); @@ -157,7 +157,7 @@ bool KPDFDocument::openDocument( const QString & docFile, const KURL & url, cons // kdError() << "PS generator not available" << endl; else { - QStringList::Iterator it = d->kimgioMimes.begin(); + TQStringList::Iterator it = d->kimgioMimes.begin(); while( it != d->kimgioMimes.end() ) { kdDebug() << *it << endl; @@ -176,9 +176,9 @@ bool KPDFDocument::openDocument( const QString & docFile, const KURL & url, cons } // 1. load Document (and set busy cursor while loading) - QApplication::setOverrideCursor( waitCursor ); + TQApplication::setOverrideCursor( waitCursor ); bool openOk = generator->loadDocument( docFile, pages_vector ); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); if ( !openOk || pages_vector.size() <= 0 ) { delete generator; @@ -203,16 +203,16 @@ bool KPDFDocument::openDocument( const QString & docFile, const KURL & url, cons // start bookmark saver timer if ( !d->saveBookmarksTimer ) { - d->saveBookmarksTimer = new QTimer( this ); - connect( d->saveBookmarksTimer, SIGNAL( timeout() ), this, SLOT( saveDocumentInfo() ) ); + d->saveBookmarksTimer = new TQTimer( this ); + connect( d->saveBookmarksTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( saveDocumentInfo() ) ); } d->saveBookmarksTimer->start( 5 * 60 * 1000 ); // start memory check timer if ( !d->memCheckTimer ) { - d->memCheckTimer = new QTimer( this ); - connect( d->memCheckTimer, SIGNAL( timeout() ), this, SLOT( slotTimedMemoryCheck() ) ); + d->memCheckTimer = new TQTimer( this ); + connect( d->memCheckTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotTimedMemoryCheck() ) ); } d->memCheckTimer->start( 2000 ); @@ -244,32 +244,32 @@ void KPDFDocument::closeDocument() d->url = KURL(); // remove requests left in queue - QValueList< PixmapRequest * >::iterator sIt = d->pixmapRequestsStack.begin(); - QValueList< PixmapRequest * >::iterator sEnd = d->pixmapRequestsStack.end(); + TQValueList< PixmapRequest * >::iterator sIt = d->pixmapRequestsStack.begin(); + TQValueList< PixmapRequest * >::iterator sEnd = d->pixmapRequestsStack.end(); for ( ; sIt != sEnd; ++sIt ) delete *sIt; d->pixmapRequestsStack.clear(); // send an empty list to observers (to free their data) - foreachObserver( notifySetup( QValueVector< KPDFPage * >(), true ) ); + foreachObserver( notifySetup( TQValueVector< KPDFPage * >(), true ) ); // delete pages and clear 'pages_vector' container - QValueVector< KPDFPage * >::iterator pIt = pages_vector.begin(); - QValueVector< KPDFPage * >::iterator pEnd = pages_vector.end(); + TQValueVector< KPDFPage * >::iterator pIt = pages_vector.begin(); + TQValueVector< KPDFPage * >::iterator pEnd = pages_vector.end(); for ( ; pIt != pEnd; ++pIt ) delete *pIt; pages_vector.clear(); // clear 'memory allocation' descriptors - QValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); - QValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); + TQValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); + TQValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); for ( ; aIt != aEnd; ++aIt ) delete *aIt; d->allocatedPixmapsFifo.clear(); // clear 'running searches' descriptors - QMap< int, RunningSearch * >::iterator rIt = d->searches.begin(); - QMap< int, RunningSearch * >::iterator rEnd = d->searches.end(); + TQMap< int, RunningSearch * >::iterator rIt = d->searches.begin(); + TQMap< int, RunningSearch * >::iterator rEnd = d->searches.end(); for ( ; rIt != rEnd; ++rIt ) delete *rIt; d->searches.clear(); @@ -302,13 +302,13 @@ void KPDFDocument::removeObserver( DocumentObserver * pObserver ) { // free observer's pixmap data int observerId = pObserver->observerId(); - QValueVector::iterator it = pages_vector.begin(), end = pages_vector.end(); + TQValueVector::iterator it = pages_vector.begin(), end = pages_vector.end(); for ( ; it != end; ++it ) (*it)->deletePixmap( observerId ); // [MEM] free observer's allocation descriptors - QValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); - QValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); + TQValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); + TQValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); while ( aIt != aEnd ) { AllocatedPixmap * p = *aIt; @@ -332,13 +332,13 @@ void KPDFDocument::reparseConfig() if ( generator && generator->reparseConfig() ) { // invalidate pixmaps - QValueVector::iterator it = pages_vector.begin(), end = pages_vector.end(); + TQValueVector::iterator it = pages_vector.begin(), end = pages_vector.end(); for ( ; it != end; ++it ) (*it)->deletePixmapsAndRects(); // [MEM] remove allocation descriptors - QValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); - QValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); + TQValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); + TQValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); for ( ; aIt != aEnd; ++aIt ) delete *aIt; d->allocatedPixmapsFifo.clear(); @@ -355,9 +355,9 @@ void KPDFDocument::reparseConfig() } -QWidget *KPDFDocument::widget() const +TQWidget *KPDFDocument::widget() const { - return static_cast(parent()); + return static_cast(parent()); } bool KPDFDocument::isOpened() const @@ -415,9 +415,9 @@ bool KPDFDocument::historyAtEnd() const return d->viewportIterator == --(d->viewportHistory.end()); } -QString KPDFDocument::getMetaData( const QString & key, const QString & option ) const +TQString KPDFDocument::getMetaData( const TQString & key, const TQString & option ) const { - return generator ? generator->getMetaData( key, option ) : QString(); + return generator ? generator->getMetaData( key, option ) : TQString(); } bool KPDFDocument::supportsSearching() const @@ -435,12 +435,12 @@ void KPDFDocument::putFontInfo(KListView *list) if (generator) generator->putFontInfo(list); } -void KPDFDocument::requestPixmaps( const QValueList< PixmapRequest * > & requests ) +void KPDFDocument::requestPixmaps( const TQValueList< PixmapRequest * > & requests ) { if ( !generator ) { // delete requests.. - QValueList< PixmapRequest * >::const_iterator rIt = requests.begin(), rEnd = requests.end(); + TQValueList< PixmapRequest * >::const_iterator rIt = requests.begin(), rEnd = requests.end(); for ( ; rIt != rEnd; ++rIt ) delete *rIt; // ..and return @@ -449,7 +449,7 @@ void KPDFDocument::requestPixmaps( const QValueList< PixmapRequest * > & request // 1. [CLEAN STACK] remove previous requests of requesterID int requesterID = requests.first()->id; - QValueList< PixmapRequest * >::iterator sIt = d->pixmapRequestsStack.begin(), sEnd = d->pixmapRequestsStack.end(); + TQValueList< PixmapRequest * >::iterator sIt = d->pixmapRequestsStack.begin(), sEnd = d->pixmapRequestsStack.end(); while ( sIt != sEnd ) { if ( (*sIt)->id == requesterID ) @@ -464,7 +464,7 @@ void KPDFDocument::requestPixmaps( const QValueList< PixmapRequest * > & request // 2. [ADD TO STACK] add requests to stack bool threadingDisabled = !KpdfSettings::enableThreading(); - QValueList< PixmapRequest * >::const_iterator rIt = requests.begin(), rEnd = requests.end(); + TQValueList< PixmapRequest * >::const_iterator rIt = requests.begin(), rEnd = requests.end(); for ( ; rIt != rEnd; ++rIt ) { // set the 'page field' (see PixmapRequest) and check if it is valid @@ -568,7 +568,7 @@ void KPDFDocument::setViewport( const DocumentViewport & viewport, int excludeId } // notify change to all other (different from id) observers - QMap< int, DocumentObserver * >::iterator it = d->observers.begin(), end = d->observers.end(); + TQMap< int, DocumentObserver * >::iterator it = d->observers.begin(), end = d->observers.end(); for ( ; it != end ; ++ it ) if ( it.key() != excludeId ) (*it)->notifyViewportChanged( smoothMove ); @@ -577,9 +577,9 @@ void KPDFDocument::setViewport( const DocumentViewport & viewport, int excludeId if ( d->allocatedPixmapsFifo.count() > 1 ) { const int page = viewport.pageNumber; - QValueList< AllocatedPixmap * > viewportPixmaps; - QValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); - QValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); + TQValueList< AllocatedPixmap * > viewportPixmaps; + TQValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); + TQValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); while ( aIt != aEnd ) { if ( (*aIt)->page == page ) @@ -609,7 +609,7 @@ void KPDFDocument::setPrevViewport() void KPDFDocument::setNextViewport() // restore next viewport from the history { - QValueList< DocumentViewport >::iterator nextIterator = d->viewportIterator; + TQValueList< DocumentViewport >::iterator nextIterator = d->viewportIterator; ++nextIterator; if ( nextIterator != d->viewportHistory.end() ) { @@ -625,8 +625,8 @@ void KPDFDocument::setNextDocumentViewport( const DocumentViewport & viewport ) } -bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStart, bool caseSensitive, - SearchType type, bool moveViewport, const QColor & color, bool noDialogs ) +bool KPDFDocument::searchText( int searchID, const TQString & text, bool fromStart, bool caseSensitive, + SearchType type, bool moveViewport, const TQColor & color, bool noDialogs ) { // don't perform searches on empty docs if ( !generator || pages_vector.isEmpty() ) @@ -657,23 +657,23 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar // global data for search bool foundAMatch = false; - QValueList< int > pagesToNotify; + TQValueList< int > pagesToNotify; // remove highlights from pages and queue them for notifying changes pagesToNotify += s->highlightedPages; - QValueList< int >::iterator it = s->highlightedPages.begin(), end = s->highlightedPages.end(); + TQValueList< int >::iterator it = s->highlightedPages.begin(), end = s->highlightedPages.end(); for ( ; it != end; ++it ) pages_vector[ *it ]->deleteHighlights( searchID ); s->highlightedPages.clear(); // set hourglass cursor - QApplication::setOverrideCursor( waitCursor ); + TQApplication::setOverrideCursor( waitCursor ); // 1. ALLDOC - proces all document marking pages if ( type == AllDoc ) { // search and highlight text on all pages - QValueVector< KPDFPage * >::iterator it = pages_vector.begin(), end = pages_vector.end(); + TQValueVector< KPDFPage * >::iterator it = pages_vector.begin(), end = pages_vector.end(); for ( ; it != end; ++it ) { // get page (from the first to the last) @@ -713,7 +713,7 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar } // reset cursor to previous shape - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); // send page lists if found anything new //if ( foundAMatch ) ?maybe? @@ -747,7 +747,7 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar { if ( currentPage >= pageCount ) { - if ( noDialogs || KMessageBox::questionYesNo(widget(), i18n("End of document reached.\nContinue from the beginning?"), QString::null, KStdGuiItem::cont(), KStdGuiItem::cancel()) == KMessageBox::Yes ) + if ( noDialogs || KMessageBox::questionYesNo(widget(), i18n("End of document reached.\nContinue from the beginning?"), TQString::null, KStdGuiItem::cont(), KStdGuiItem::cancel()) == KMessageBox::Yes ) currentPage = 0; else break; @@ -765,7 +765,7 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar } // reset cursor to previous shape - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); // if a match has been found.. if ( match ) @@ -804,12 +804,12 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar { // search and highlight every word in 'text' on all pages bool matchAll = type == GoogleAll; - QStringList words = QStringList::split( " ", text ); + TQStringList words = TQStringList::split( " ", text ); int wordsCount = words.count(), hueStep = (wordsCount > 1) ? (60 / (wordsCount - 1)) : 60, baseHue, baseSat, baseVal; color.getHsv( &baseHue, &baseSat, &baseVal ); - QValueVector< KPDFPage * >::iterator it = pages_vector.begin(), end = pages_vector.end(); + TQValueVector< KPDFPage * >::iterator it = pages_vector.begin(), end = pages_vector.end(); for ( ; it != end; ++it ) { // get page (from the first to the last) @@ -825,11 +825,11 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar anyMatched = false; for ( int w = 0; w < wordsCount; w++ ) { - QString word = words[ w ]; + TQString word = words[ w ]; int newHue = baseHue - w * hueStep; if ( newHue < 0 ) newHue += 360; - QColor wordColor = QColor( newHue, baseSat, baseVal, QColor::Hsv ); + TQColor wordColor = TQColor( newHue, baseSat, baseVal, TQColor::Hsv ); NormalizedRect * lastMatch = 0; // add all highlights for current word bool wordMatched = false; @@ -866,14 +866,14 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar } // reset cursor to previous shape - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); // send page lists to update observers (since some filter on bookmarks) foreachObserver( notifySetup( pages_vector, false ) ); } // notify observers about highlights changes - QValueList< int >::iterator nIt = pagesToNotify.begin(), nEnd = pagesToNotify.end(); + TQValueList< int >::iterator nIt = pagesToNotify.begin(), nEnd = pagesToNotify.end(); for ( ; nIt != nEnd; ++nIt ) foreachObserver( notifyPageChanged( *nIt, DocumentObserver::Highlights ) ); @@ -904,7 +904,7 @@ void KPDFDocument::resetSearch( int searchID ) RunningSearch * s = d->searches[ searchID ]; // unhighlight pages and inform observers about that - QValueList< int >::iterator it = s->highlightedPages.begin(), end = s->highlightedPages.end(); + TQValueList< int >::iterator it = s->highlightedPages.begin(), end = s->highlightedPages.end(); for ( ; it != end; ++it ) { int pageNumber = *it; @@ -972,7 +972,7 @@ void KPDFDocument::processLink( const KPDFLink * link ) case KPDFLink::Execute: { const KPDFLinkExecute * exe = static_cast< const KPDFLinkExecute * >( link ); - QString fileName = exe->fileName(); + TQString fileName = exe->fileName(); if ( fileName.endsWith( ".pdf" ) || fileName.endsWith( ".PDF" ) ) { openRelativeFile( fileName ); @@ -1071,7 +1071,7 @@ void KPDFDocument::processLink( const KPDFLink * link ) kapp->invokeMailer( browse->url() ); else { - QString url = browse->url(); + TQString url = browse->url(); // fix for #100366, documents with relative links that are the form of http:foo.pdf if (url.find("http:") == 0 && url.find("http://") == -1 && url.right(4) == ".pdf") @@ -1105,8 +1105,8 @@ void KPDFDocument::requestDone( PixmapRequest * req ) #endif // [MEM] 1.1 find and remove a previous entry for the same page and id - QValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); - QValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); + TQValueList< AllocatedPixmap * >::iterator aIt = d->allocatedPixmapsFifo.begin(); + TQValueList< AllocatedPixmap * >::iterator aEnd = d->allocatedPixmapsFifo.end(); for ( ; aIt != aEnd; ++aIt ) if ( (*aIt)->page == req->pageNumber && (*aIt)->id == req->id ) { @@ -1197,8 +1197,8 @@ void KPDFDocument::cleanupPixmapMemory( int /*sure? bytesOffset*/ ) { // [MEM] free memory starting from older pixmaps int pagesFreed = 0; - QValueList< AllocatedPixmap * >::iterator pIt = d->allocatedPixmapsFifo.begin(); - QValueList< AllocatedPixmap * >::iterator pEnd = d->allocatedPixmapsFifo.end(); + TQValueList< AllocatedPixmap * >::iterator pIt = d->allocatedPixmapsFifo.begin(); + TQValueList< AllocatedPixmap * >::iterator pEnd = d->allocatedPixmapsFifo.end(); while ( (pIt != pEnd) && (memoryToFree > 0) ) { AllocatedPixmap * p = *pIt; @@ -1228,16 +1228,16 @@ int KPDFDocument::getTotalMemory() #ifdef __linux__ // if /proc/meminfo doesn't exist, return 128MB - QFile memFile( "/proc/meminfo" ); + TQFile memFile( "/proc/meminfo" ); if ( !memFile.open( IO_ReadOnly ) ) return (cachedValue = 134217728); // read /proc/meminfo and sum up the contents of 'MemFree', 'Buffers' // and 'Cached' fields. consider swapped memory as used memory. - QTextStream readStream( &memFile ); + TQTextStream readStream( &memFile ); while ( !readStream.atEnd() ) { - QString entry = readStream.readLine(); + TQString entry = readStream.readLine(); if ( entry.startsWith( "MemTotal:" ) ) return (cachedValue = (1024 * entry.section( ' ', -2, -2 ).toInt())); } @@ -1247,23 +1247,23 @@ int KPDFDocument::getTotalMemory() int KPDFDocument::getFreeMemory() { - static QTime lastUpdate = QTime::currentTime(); + static TQTime lastUpdate = TQTime::currentTime(); static int cachedValue = 0; - if ( lastUpdate.secsTo( QTime::currentTime() ) <= 2 ) + if ( lastUpdate.secsTo( TQTime::currentTime() ) <= 2 ) return cachedValue; #ifdef __linux__ // if /proc/meminfo doesn't exist, return MEMORY FULL - QFile memFile( "/proc/meminfo" ); + TQFile memFile( "/proc/meminfo" ); if ( !memFile.open( IO_ReadOnly ) ) return 0; // read /proc/meminfo and sum up the contents of 'MemFree', 'Buffers' // and 'Cached' fields. consider swapped memory as used memory. int memoryFree = 0; - QString entry; - QTextStream readStream( &memFile ); + TQString entry; + TQTextStream readStream( &memFile ); while ( !readStream.atEnd() ) { entry = readStream.readLine(); @@ -1277,7 +1277,7 @@ int KPDFDocument::getFreeMemory() } memFile.close(); - lastUpdate = QTime::currentTime(); + lastUpdate = TQTime::currentTime(); return ( cachedValue = ( 1024 * memoryFree ) ); #else @@ -1291,12 +1291,12 @@ void KPDFDocument::loadDocumentInfo() // are still uninitialized at this point so don't access them { //kdDebug() << "Using '" << d->xmlFileName << "' as document info file." << endl; - QFile infoFile( d->xmlFileName ); + TQFile infoFile( d->xmlFileName ); if ( !infoFile.exists() || !infoFile.open( IO_ReadOnly ) ) return; // Load DOM from XML file - QDomDocument doc( "documentInfo" ); + TQDomDocument doc( "documentInfo" ); if ( !doc.setContent( &infoFile ) ) { kdDebug() << "Could not set content" << endl; @@ -1305,21 +1305,21 @@ void KPDFDocument::loadDocumentInfo() } infoFile.close(); - QDomElement root = doc.documentElement(); + TQDomElement root = doc.documentElement(); if ( root.tagName() != "documentInfo" ) return; // Parse the DOM tree - QDomNode topLevelNode = root.firstChild(); + TQDomNode topLevelNode = root.firstChild(); while ( topLevelNode.isElement() ) { - QString catName = topLevelNode.toElement().tagName(); + TQString catName = topLevelNode.toElement().tagName(); // Get bookmarks list from DOM if ( catName == "bookmarkList" ) { - QDomNode n = topLevelNode.firstChild(); - QDomElement e; + TQDomNode n = topLevelNode.firstChild(); + TQDomElement e; int pageNumber; bool ok; while ( n.isElement() ) @@ -1337,10 +1337,10 @@ void KPDFDocument::loadDocumentInfo() // Get 'general info' from the DOM else if ( catName == "generalInfo" ) { - QDomNode infoNode = topLevelNode.firstChild(); + TQDomNode infoNode = topLevelNode.firstChild(); while ( infoNode.isElement() ) { - QDomElement infoElement = infoNode.toElement(); + TQDomElement infoElement = infoNode.toElement(); // compatibility: [pre-3.4 viewport storage] @remove after 3.4 relase if ( infoElement.tagName() == "activePage" ) @@ -1355,13 +1355,13 @@ void KPDFDocument::loadDocumentInfo() // clear history d->viewportHistory.clear(); // append old viewports - QDomNode historyNode = infoNode.firstChild(); + TQDomNode historyNode = infoNode.firstChild(); while ( historyNode.isElement() ) { - QDomElement historyElement = historyNode.toElement(); + TQDomElement historyElement = historyNode.toElement(); if ( historyElement.hasAttribute( "viewport" ) ) { - QString vpString = historyElement.attribute( "viewport" ); + TQString vpString = historyElement.attribute( "viewport" ); d->viewportIterator = d->viewportHistory.append( DocumentViewport( vpString ) ); } @@ -1378,17 +1378,17 @@ void KPDFDocument::loadDocumentInfo() } // } -QString KPDFDocument::giveAbsolutePath( const QString & fileName ) +TQString KPDFDocument::giveAbsolutePath( const TQString & fileName ) { if ( !d->url.isValid() ) - return QString::null; + return TQString::null; return d->url.upURL().url() + fileName; } -bool KPDFDocument::openRelativeFile( const QString & fileName ) +bool KPDFDocument::openRelativeFile( const TQString & fileName ) { - QString absFileName = giveAbsolutePath( fileName ); + TQString absFileName = giveAbsolutePath( fileName ); if ( absFileName.isNull() ) return false; @@ -1404,35 +1404,35 @@ void KPDFDocument::saveDocumentInfo() const if ( d->docFileName.isNull() ) return; - QFile infoFile( d->xmlFileName ); + TQFile infoFile( d->xmlFileName ); if (infoFile.open( IO_WriteOnly | IO_Truncate) ) { // Create DOM - QDomDocument doc( "documentInfo" ); - QDomElement root = doc.createElement( "documentInfo" ); + TQDomDocument doc( "documentInfo" ); + TQDomElement root = doc.createElement( "documentInfo" ); doc.appendChild( root ); // Add bookmark list to DOM - QDomElement bookmarkList = doc.createElement( "bookmarkList" ); + TQDomElement bookmarkList = doc.createElement( "bookmarkList" ); root.appendChild( bookmarkList ); for ( uint i = 0; i < pages_vector.count() ; i++ ) { if ( pages_vector[i]->hasBookmark() ) { - QDomElement page = doc.createElement( "page" ); - page.appendChild( doc.createTextNode( QString::number(i) ) ); + TQDomElement page = doc.createElement( "page" ); + page.appendChild( doc.createTextNode( TQString::number(i) ) ); bookmarkList.appendChild( page ); } } // Add general info to DOM - QDomElement generalInfo = doc.createElement( "generalInfo" ); + TQDomElement generalInfo = doc.createElement( "generalInfo" ); root.appendChild( generalInfo ); // ... saves history up to 10 viewports - QValueList< DocumentViewport >::iterator backIterator = d->viewportIterator; + TQValueList< DocumentViewport >::iterator backIterator = d->viewportIterator; if ( backIterator != d->viewportHistory.end() ) { // go back up to 10 steps from the current viewportIterator @@ -1441,16 +1441,16 @@ void KPDFDocument::saveDocumentInfo() const --backIterator; // create history root node - QDomElement historyNode = doc.createElement( "history" ); + TQDomElement historyNode = doc.createElement( "history" ); generalInfo.appendChild( historyNode ); // add old[backIterator] and present[viewportIterator] items - QValueList< DocumentViewport >::iterator endIt = d->viewportIterator; + TQValueList< DocumentViewport >::iterator endIt = d->viewportIterator; ++endIt; while ( backIterator != endIt ) { - QString name = (backIterator == d->viewportIterator) ? "current" : "oldPage"; - QDomElement historyEntry = doc.createElement( name ); + TQString name = (backIterator == d->viewportIterator) ? "current" : "oldPage"; + TQDomElement historyEntry = doc.createElement( name ); historyEntry.setAttribute( "viewport", (*backIterator).toString() ); historyNode.appendChild( historyEntry ); ++backIterator; @@ -1458,8 +1458,8 @@ void KPDFDocument::saveDocumentInfo() const } // Save DOM to XML file - QString xml = doc.toString(); - QTextStream os( &infoFile ); + TQString xml = doc.toString(); + TQTextStream os( &infoFile ); os << xml; } infoFile.close(); @@ -1489,7 +1489,7 @@ DocumentViewport::DocumentViewport( int n ) autoFit.height = false; } -DocumentViewport::DocumentViewport( const QString & xmlDesc ) +DocumentViewport::DocumentViewport( const TQString & xmlDesc ) : pageNumber( -1 ) { // default settings (maybe overridden below) @@ -1508,7 +1508,7 @@ DocumentViewport::DocumentViewport( const QString & xmlDesc ) // decode the string bool ok; int field = 0; - QString token = xmlDesc.section( ';', field, field ); + TQString token = xmlDesc.section( ';', field, field ); while ( !token.isEmpty() ) { // decode the current token @@ -1545,18 +1545,18 @@ DocumentViewport::DocumentViewport( const QString & xmlDesc ) } } -QString DocumentViewport::toString() const +TQString DocumentViewport::toString() const { // start string with page number - QString s = QString::number( pageNumber ); + TQString s = TQString::number( pageNumber ); // if has center coordinates, save them on string if ( rePos.enabled ) - s += QString( ";C2:" ) + QString::number( rePos.normalizedX ) + - ':' + QString::number( rePos.normalizedY ) + - ':' + QString::number( rePos.pos ); + s += TQString( ";C2:" ) + TQString::number( rePos.normalizedX ) + + ':' + TQString::number( rePos.normalizedY ) + + ':' + TQString::number( rePos.pos ); // if has autofit enabled, save its state on string if ( autoFit.enabled ) - s += QString( ";AF1:" ) + (autoFit.width ? "T" : "F") + + s += TQString( ";AF1:" ) + (autoFit.width ? "T" : "F") + ':' + (autoFit.height ? "T" : "F"); return s; } @@ -1583,20 +1583,20 @@ bool DocumentViewport::operator==( const DocumentViewport & vp ) const /** DocumentInfo **/ DocumentInfo::DocumentInfo() - : QDomDocument( "DocumentInformation" ) + : TQDomDocument( "DocumentInformation" ) { - QDomElement docElement = createElement( "DocumentInfo" ); + TQDomElement docElement = createElement( "DocumentInfo" ); appendChild( docElement ); } -void DocumentInfo::set( const QString &key, const QString &value, - const QString &title ) +void DocumentInfo::set( const TQString &key, const TQString &value, + const TQString &title ) { - QDomElement docElement = documentElement(); - QDomElement element; + TQDomElement docElement = documentElement(); + TQDomElement element; // check whether key already exists - QDomNodeList list = docElement.elementsByTagName( key ); + TQDomNodeList list = docElement.elementsByTagName( key ); if ( list.count() > 0 ) element = list.item( 0 ).toElement(); else @@ -1609,24 +1609,24 @@ void DocumentInfo::set( const QString &key, const QString &value, docElement.appendChild( element ); } -QString DocumentInfo::get( const QString &key ) const +TQString DocumentInfo::get( const TQString &key ) const { - QDomElement docElement = documentElement(); - QDomElement element; + TQDomElement docElement = documentElement(); + TQDomElement element; // check whether key already exists - QDomNodeList list = docElement.elementsByTagName( key ); + TQDomNodeList list = docElement.elementsByTagName( key ); if ( list.count() > 0 ) return list.item( 0 ).toElement().attribute( "value" ); else - return QString(); + return TQString(); } /** DocumentSynopsis **/ DocumentSynopsis::DocumentSynopsis() - : QDomDocument( "DocumentSynopsis" ) + : TQDomDocument( "DocumentSynopsis" ) { // void implementation, only subclassed for naming } diff --git a/kpdf/core/document.h b/kpdf/core/document.h index 8e4c1d8e..c1eb840a 100644 --- a/kpdf/core/document.h +++ b/kpdf/core/document.h @@ -11,10 +11,10 @@ #ifndef _KPDF_DOCUMENT_H_ #define _KPDF_DOCUMENT_H_ -#include -#include -#include -#include +#include +#include +#include +#include #include @@ -51,11 +51,11 @@ class KPDFDocument : public QObject { Q_OBJECT public: - KPDFDocument( QWidget *widget ); + KPDFDocument( TQWidget *widget ); ~KPDFDocument(); // document handling - bool openDocument( const QString & docFile, const KURL & url, const KMimeType::Ptr &mime ); + bool openDocument( const TQString & docFile, const KURL & url, const KMimeType::Ptr &mime ); void closeDocument(); // misc methods @@ -67,7 +67,7 @@ class KPDFDocument : public QObject enum Permission { AllowModify = 1, AllowCopy = 2, AllowPrint = 4, AllowNotes = 8 }; // returns the widget where the document is shown - QWidget *widget() const; + TQWidget *widget() const; // query methods (const ones) bool isOpened() const; @@ -81,7 +81,7 @@ class KPDFDocument : public QObject bool isAllowed( int /*Document::Permisison(s)*/ ) const; bool historyAtBegin() const; bool historyAtEnd() const; - QString getMetaData( const QString & key, const QString & option = QString() ) const; + TQString getMetaData( const TQString & key, const TQString & option = TQString() ) const; bool supportsSearching() const; bool hasFonts() const; void putFontInfo(KListView *list); @@ -92,12 +92,12 @@ class KPDFDocument : public QObject void setPrevViewport(); void setNextViewport(); void setNextDocumentViewport( const DocumentViewport & viewport ); - void requestPixmaps( const QValueList< PixmapRequest * > & requests ); + void requestPixmaps( const TQValueList< PixmapRequest * > & requests ); void requestTextPage( uint page ); enum SearchType { NextMatch, PrevMatch, AllDoc, GoogleAll, GoogleAny }; - bool searchText( int searchID, const QString & text, bool fromStart, bool caseSensitive, - SearchType type, bool moveViewport, const QColor & color, bool noDialogs = false ); + bool searchText( int searchID, const TQString & text, bool fromStart, bool caseSensitive, + SearchType type, bool moveViewport, const TQColor & color, bool noDialogs = false ); bool continueSearch( int searchID ); void resetSearch( int searchID ); bool continueLastSearch(); @@ -125,11 +125,11 @@ class KPDFDocument : public QObject int getFreeMemory(); // more private functions void loadDocumentInfo(); - QString giveAbsolutePath( const QString & fileName ); - bool openRelativeFile( const QString & fileName ); + TQString giveAbsolutePath( const TQString & fileName ); + bool openRelativeFile( const TQString & fileName ); Generator * generator; - QValueVector< KPDFPage * > pages_vector; + TQValueVector< KPDFPage * > pages_vector; class KPDFDocumentPrivate * d; private slots: @@ -173,8 +173,8 @@ class DocumentViewport /** class methods **/ // allowed constructors, don't use others DocumentViewport( int pageNumber = -1 ); - DocumentViewport( const QString & xmlDesc ); - QString toString() const; + DocumentViewport( const TQString & xmlDesc ); + TQString toString() const; bool operator==( const DocumentViewport & vp ) const; }; @@ -193,14 +193,14 @@ class DocumentInfo : public QDomDocument * Sets a value for a special key. The title should be an i18n'ed * string, since it's used in the document information dialog. */ - void set( const QString &key, const QString &value, - const QString &title = QString() ); + void set( const TQString &key, const TQString &value, + const TQString &title = TQString() ); /** * Returns the value for a given key or an empty string when the * key doesn't exist. */ - QString get( const QString &key ) const; + TQString get( const TQString &key ) const; }; /** diff --git a/kpdf/core/generator.h b/kpdf/core/generator.h index e0c892fd..841915a2 100644 --- a/kpdf/core/generator.h +++ b/kpdf/core/generator.h @@ -10,9 +10,9 @@ #ifndef _KPDF_GENERATOR_H_ #define _KPDF_GENERATOR_H_ -#include -#include -#include +#include +#include +#include #include "core/document.h" class KListView; class KPrinter; @@ -24,7 +24,7 @@ class PixmapRequest; * Many observers may want to request data syncronously or asyncronously. * - Sync requests. These should be done in-place. * - Async request must be done in real background. That usually means a - * thread, such as QThread derived classes. + * thread, such as TQThread derived classes. * Once contents are available, they must be immediately stored in the * KPDFPage they refer to, and a signal is emitted as soon as storing * (even for sync or async queries) has been done. @@ -45,7 +45,7 @@ class Generator : public QObject public: /** virtual methods to reimplement **/ // load a document and fill up the pagesVector - virtual bool loadDocument( const QString & fileName, QValueVector< KPDFPage * > & pagesVector ) = 0; + virtual bool loadDocument( const TQString & fileName, TQValueVector< KPDFPage * > & pagesVector ) = 0; // Document description and Table of contents virtual const DocumentInfo * generateDocumentInfo() { return 0L; } @@ -69,7 +69,7 @@ class Generator : public QObject // print document using already configured kprinter virtual bool print( KPrinter& /*printer*/ ) { return false; } // access meta data of the generator - virtual QString getMetaData( const QString &/*key*/, const QString &/*option*/ ) { return QString(); } + virtual TQString getMetaData( const TQString &/*key*/, const TQString &/*option*/ ) { return TQString(); } // tell generator to re-parse configuration and return true if something changed virtual bool reparseConfig() { return false; } diff --git a/kpdf/core/generator_kimgio/generator_kimgio.cpp b/kpdf/core/generator_kimgio/generator_kimgio.cpp index bb754686..82491ddc 100644 --- a/kpdf/core/generator_kimgio/generator_kimgio.cpp +++ b/kpdf/core/generator_kimgio/generator_kimgio.cpp @@ -7,8 +7,8 @@ * (at your option) any later version. * ***************************************************************************/ -#include -#include +#include +#include #include #include "core/page.h" @@ -23,9 +23,9 @@ KIMGIOGenerator::~KIMGIOGenerator() delete m_pix; } -bool KIMGIOGenerator::loadDocument( const QString & fileName, QValueVector & pagesVector ) +bool KIMGIOGenerator::loadDocument( const TQString & fileName, TQValueVector & pagesVector ) { - m_pix = new QPixmap(fileName); + m_pix = new TQPixmap(fileName); pagesVector.resize( 1 ); @@ -42,7 +42,7 @@ bool KIMGIOGenerator::canGeneratePixmap() void KIMGIOGenerator::generatePixmap( PixmapRequest * request ) { - QPixmap *p = new QPixmap(*m_pix); + TQPixmap *p = new TQPixmap(*m_pix); request->page->setPixmap(request->id, p); } @@ -66,7 +66,7 @@ void KIMGIOGenerator::putFontInfo( KListView * ) bool KIMGIOGenerator::print( KPrinter& printer ) { - QPainter p(&printer); + TQPainter p(&printer); p.drawPixmap(0, 0, *m_pix); return true; } diff --git a/kpdf/core/generator_kimgio/generator_kimgio.h b/kpdf/core/generator_kimgio/generator_kimgio.h index bda411f2..2e4606a7 100644 --- a/kpdf/core/generator_kimgio/generator_kimgio.h +++ b/kpdf/core/generator_kimgio/generator_kimgio.h @@ -19,7 +19,7 @@ class KIMGIOGenerator : public Generator virtual ~KIMGIOGenerator(); // [INHERITED] load a document and fill up the pagesVector - bool loadDocument( const QString & fileName, QValueVector & pagesVector ); + bool loadDocument( const TQString & fileName, TQValueVector & pagesVector ); // [INHERITED] perform actions on document / pages bool canGeneratePixmap(); @@ -37,7 +37,7 @@ class KIMGIOGenerator : public Generator bool print( KPrinter& printer ); private: - QPixmap *m_pix; + TQPixmap *m_pix; }; #endif diff --git a/kpdf/core/generator_pdf/generator_pdf.cpp b/kpdf/core/generator_pdf/generator_pdf.cpp index 35020e56..9540d2fd 100644 --- a/kpdf/core/generator_pdf/generator_pdf.cpp +++ b/kpdf/core/generator_pdf/generator_pdf.cpp @@ -9,13 +9,13 @@ ***************************************************************************/ // qt/kde includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -95,7 +95,7 @@ PDFGenerator::~PDFGenerator() //BEGIN Generator inherited functions -bool PDFGenerator::loadDocument( const QString & filePath, QValueVector & pagesVector ) +bool PDFGenerator::loadDocument( const TQString & filePath, TQValueVector & pagesVector ) { #ifndef NDEBUG if ( pdfdoc ) @@ -105,7 +105,7 @@ bool PDFGenerator::loadDocument( const QString & filePath, QValueVectorisOk() && pdfdoc->getErrorCode() == errEncrypted ) { - QCString password; + TQCString password; // 1.A. try to retrieve the first password from the kde wallet system if ( !triedWallet ) { - QString walletName = KWallet::Wallet::NetworkWallet(); + TQString walletName = KWallet::Wallet::NetworkWallet(); wallet = KWallet::Wallet::openWallet( walletName ); if ( wallet ) { @@ -129,7 +129,7 @@ bool PDFGenerator::loadDocument( const QString & filePath, QValueVectorsetFolder( "KPdf" ); // look for the pass in that folder - QString retrievedPass; + TQString retrievedPass; if ( !wallet->readPassword( filePath.section('/', -1, -1), retrievedPass ) ) password = retrievedPass.local8Bit(); } @@ -139,7 +139,7 @@ bool PDFGenerator::loadDocument( const QString & filePath, QValueVectorisOk() && wallet && /*safety check*/ wallet->isOpen() && keep > 0 ) { - QString goodPass = QString::fromLocal8Bit( password.data() ); + TQString goodPass = TQString::fromLocal8Bit( password.data() ); wallet->writePassword( filePath.section('/', -1, -1), goodPass ); } } @@ -209,12 +209,12 @@ const DocumentInfo * PDFGenerator::generateDocumentInfo() if ( pdfdoc ) { docInfo.set( "format", i18n( "PDF v. ", "PDF v. %1" ) - .arg( QString::number( pdfdoc->getPDFVersion() ) ), i18n( "Format" ) ); + .arg( TQString::number( pdfdoc->getPDFVersion() ) ), i18n( "Format" ) ); docInfo.set( "encryption", pdfdoc->isEncrypted() ? i18n( "Encrypted" ) : i18n( "Unencrypted" ), i18n("Security") ); docInfo.set( "optimization", pdfdoc->isLinearized() ? i18n( "Yes" ) : i18n( "No" ), i18n("Optimized") ); - docInfo.set( "pages", QString::number( pdfdoc->getCatalog()->getNumPages() ), i18n("Pages") ); + docInfo.set( "pages", TQString::number( pdfdoc->getCatalog()->getNumPages() ), i18n("Pages") ); } else { @@ -381,7 +381,7 @@ void PDFGenerator::putFontInfo(KListView *list) fonts = NULL; fontsLen = fontsSize = 0; - QValueVector visitedXObjects; + TQValueVector visitedXObjects; for (pg = 1; pg <= pdfdoc->getNumPages(); ++pg) { page = pdfdoc->getCatalog()->getPage(pg); @@ -414,7 +414,7 @@ void PDFGenerator::putFontInfo(KListView *list) bool PDFGenerator::print( KPrinter& printer ) { // PageSize is a CUPS artificially created setting - QString ps = printer.option("PageSize"); + TQString ps = printer.option("PageSize"); int paperWidth, paperHeight; int marginTop, marginLeft, marginRight, marginBottom; marginTop = (int)printer.option("kde-margin-top").toDouble(); @@ -423,7 +423,7 @@ bool PDFGenerator::print( KPrinter& printer ) marginBottom = (int)printer.option("kde-margin-bottom").toDouble(); bool forceRasterize = printer.option("kde-kpdf-forceRaster").toInt(); - if (ps.find(QRegExp("w\\d+h\\d+")) == 0) + if (ps.find(TQRegExp("w\\d+h\\d+")) == 0) { // size not supported by Qt, CUPS gives us the size as wWIDTHhHEIGHT, at least on the printers i tester // remove the w @@ -440,19 +440,19 @@ bool PDFGenerator::print( KPrinter& printer ) if (!ps.isEmpty()) qtPageSize = pageNameToPageSize(ps); else qtPageSize = printer.pageSize(); - QPrinter dummy(QPrinter::PrinterResolution); + TQPrinter dummy(TQPrinter::PrinterResolution); dummy.setFullPage(true); - dummy.setPageSize((QPrinter::PageSize)qtPageSize); + dummy.setPageSize((TQPrinter::PageSize)qtPageSize); - QPaintDeviceMetrics metrics(&dummy); + TQPaintDeviceMetrics metrics(&dummy); paperWidth = metrics.width(); paperHeight = metrics.height(); } - KTempFile tf( QString::null, ".ps" ); + KTempFile tf( TQString::null, ".ps" ); globalParams->setPSPaperWidth(paperWidth); globalParams->setPSPaperHeight(paperHeight); - QString pstitle = getDocumentInfo("Title", true); + TQString pstitle = getDocumentInfo("Title", true); if ( pstitle.isEmpty() ) { pstitle = m_document->currentDocument().fileName( false ); @@ -460,7 +460,7 @@ bool PDFGenerator::print( KPrinter& printer ) // this looks non-unicode-safe and it is. anything other than ASCII is not specified // and some printers actually stop printing when they encounter non-ASCII characters in the // Postscript %%Title tag - QCString pstitle8Bit = pstitle.latin1(); + TQCString pstitle8Bit = pstitle.latin1(); const char* pstitlechar; if (!pstitle.isEmpty()) { @@ -492,7 +492,7 @@ bool PDFGenerator::print( KPrinter& printer ) if (result == KMessageBox::Yes) psOut->setScale(xScale, yScale); } - QValueList pageList; + TQValueList pageList; if (!printer.previewOnly()) { @@ -503,7 +503,7 @@ bool PDFGenerator::print( KPrinter& printer ) for(int i = 1; i <= pdfdoc->getNumPages(); i++) pageList.append(i); } - QValueList::const_iterator pIt = pageList.begin(), pEnd = pageList.end(); + TQValueList::const_iterator pIt = pageList.begin(), pEnd = pageList.end(); docLock.lock(); for ( ; pIt != pEnd; ++pIt ) { @@ -524,7 +524,7 @@ bool PDFGenerator::print( KPrinter& printer ) } } -static GString *QStringToGString(const QString &s) { +static GString *QStringToGString(const TQString &s) { int len = s.length(); char *cstring = (char *)gmallocn(s.length(), sizeof(char)); for (int i = 0; i < len; ++i) @@ -532,20 +532,20 @@ static GString *QStringToGString(const QString &s) { return new GString(cstring, len); } -static QString unicodeToQString(Unicode* u, int len) { - QString ret; +static TQString unicodeToQString(Unicode* u, int len) { + TQString ret; ret.setLength(len); - QChar* qch = (QChar*) ret.unicode(); + TQChar* qch = (TQChar*) ret.unicode(); for (;len;--len) - *qch++ = (QChar) *u++; + *qch++ = (TQChar) *u++; return ret; } -static QString UnicodeParsedString(GString *s1) { +static TQString UnicodeParsedString(GString *s1) { GBool isUnicode; int i; Unicode u; - QString result; + TQString result; if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff ) { isUnicode = gTrue; @@ -573,7 +573,7 @@ static QString UnicodeParsedString(GString *s1) { return result; } -QString PDFGenerator::getMetaData( const QString & key, const QString & option ) +TQString PDFGenerator::getMetaData( const TQString & key, const TQString & option ) { if ( key == "StartFullScreen" ) { @@ -603,13 +603,13 @@ QString PDFGenerator::getMetaData( const QString & key, const QString & option ) if ( pdfdoc->getCatalog()->getPageMode() == Catalog::UseOutlines ) return "yes"; } - return QString(); + return TQString(); } bool PDFGenerator::reparseConfig() { // load paper color from Settings or use the white default color - QColor color = ( (KpdfSettings::renderMode() == KpdfSettings::EnumRenderMode::Paper ) && + TQColor color = ( (KpdfSettings::renderMode() == KpdfSettings::EnumRenderMode::Paper ) && KpdfSettings::changeColors() ) ? KpdfSettings::paperColor() : Qt::white; // if paper color is changed we have to rebuild every visible pixmap in addition // to the outputDevice. it's the 'heaviest' case, other effect are just recoloring @@ -634,7 +634,7 @@ bool PDFGenerator::reparseConfig() } //END Generator inherited functions -void PDFGenerator::scanFonts(Dict *resDict, KListView *list, Ref **fonts, int &fontsLen, int &fontsSize, QValueVector *visitedXObjects) +void PDFGenerator::scanFonts(Dict *resDict, KListView *list, Ref **fonts, int &fontsLen, int &fontsSize, TQValueVector *visitedXObjects) { Object obj1, obj2, xObjDict, xObj, xObj2, resObj; Ref r; @@ -717,7 +717,7 @@ void PDFGenerator::scanFont(GfxFont *font, KListView *list, Ref **fonts, int &fo GBool emb; int i; - QString fontTypeNames[12] = { + TQString fontTypeNames[12] = { i18n("unknown"), i18n("Type 1"), i18n("Type 1C"), @@ -750,7 +750,7 @@ void PDFGenerator::scanFont(GfxFont *font, KListView *list, Ref **fonts, int &fo if (font->getType() == fontType3) emb = gTrue; else emb = font->getEmbeddedFontID(&embRef); - QString sName, sEmb, sPath; + TQString sName, sEmb, sPath; if (name) { sName = name->getCString(); @@ -783,34 +783,34 @@ void PDFGenerator::scanFont(GfxFont *font, KListView *list, Ref **fonts, int &fo (*fonts)[fontsLen++] = *font->getID(); } -QString PDFGenerator::getDocumentInfo( const QString & data, bool canReturnNull ) const +TQString PDFGenerator::getDocumentInfo( const TQString & data, bool canReturnNull ) const // note: MUTEX is LOCKED while calling this { // [Albert] Code adapted from pdfinfo.cc on xpdf Object info; if ( !pdfdoc ) - return canReturnNull ? QString::null : i18n( "Unknown" ); + return canReturnNull ? TQString::null : i18n( "Unknown" ); pdfdoc->getDocInfo( &info ); if ( !info.isDict() ) - return canReturnNull ? QString::null : i18n( "Unknown" ); + return canReturnNull ? TQString::null : i18n( "Unknown" ); Object obj; Dict *infoDict = info.getDict(); if ( infoDict->lookup( (char*)data.latin1(), &obj )->isString() ) { - QString result = UnicodeParsedString(obj.getString()); + TQString result = UnicodeParsedString(obj.getString()); obj.free(); info.free(); return result; } obj.free(); info.free(); - return canReturnNull ? QString::null : i18n( "Unknown" ); + return canReturnNull ? TQString::null : i18n( "Unknown" ); } -QString PDFGenerator::getDocumentDate( const QString & data ) const +TQString PDFGenerator::getDocumentDate( const TQString & data ) const // note: MUTEX is LOCKED while calling this { // [Albert] Code adapted from pdfinfo.cc on xpdf @@ -826,23 +826,23 @@ QString PDFGenerator::getDocumentDate( const QString & data ) const int year, mon, day, hour, min, sec; Dict *infoDict = info.getDict(); UnicodeMap *uMap = globalParams->getTextEncoding(); - QString result; + TQString result; if ( !uMap ) return i18n( "Unknown Date" ); if ( infoDict->lookup( (char*)data.latin1(), &obj )->isString() ) { - QString s = UnicodeParsedString(obj.getString()); + TQString s = UnicodeParsedString(obj.getString()); if ( s[0] == 'D' && s[1] == ':' ) s = s.mid(2); if ( !s.isEmpty() && sscanf( s.latin1(), "%4d%2d%2d%2d%2d%2d", &year, &mon, &day, &hour, &min, &sec ) == 6 ) { - QDate d( year, mon, day ); //CHECK: it was mon-1, Jan->0 (??) - QTime t( hour, min, sec ); + TQDate d( year, mon, day ); //CHECK: it was mon-1, Jan->0 (??) + TQTime t( hour, min, sec ); if ( d.isValid() && t.isValid() ) - result = KGlobal::locale()->formatDateTime( QDateTime(d, t), false, true ); + result = KGlobal::locale()->formatDateTime( TQDateTime(d, t), false, true ); else result = s; } @@ -856,7 +856,7 @@ QString PDFGenerator::getDocumentDate( const QString & data ) const return result; } -void PDFGenerator::addSynopsisChildren( QDomNode * parent, GList * items ) +void PDFGenerator::addSynopsisChildren( TQDomNode * parent, GList * items ) { int numItems = items->getLength(); for ( int i = 0; i < numItems; ++i ) @@ -865,13 +865,13 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, GList * items ) OutlineItem * outlineItem = (OutlineItem *)items->get( i ); // 1. create element using outlineItem's title as tagName - QString name; + TQString name; Unicode * uniChar = outlineItem->getTitle(); int titleLength = outlineItem->getTitleLength(); name = unicodeToQString(uniChar, titleLength); if ( name.isEmpty() ) continue; - QDomElement item = docSyn.createElement( name ); + TQDomElement item = docSyn.createElement( name ); parent->appendChild( item ); // 2. find the page the link refers to @@ -888,9 +888,9 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, GList * items ) // so better storing the reference and provide the viewport as metadata // on demand GString *s = g->getNamedDest(); - QChar *charArray = new QChar[s->getLength()]; - for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]); - QString option(charArray, s->getLength()); + TQChar *charArray = new QChar[s->getLength()]; + for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->getCString()[i]); + TQString option(charArray, s->getLength()); item.setAttribute( "ViewportName", option ); delete[] charArray; } @@ -907,7 +907,7 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, GList * items ) } } - item.setAttribute( "Open", QVariant( (bool)outlineItem->isOpen() ).toString() ); + item.setAttribute( "Open", TQVariant( (bool)outlineItem->isOpen() ).toString() ); // 3. recursively descend over children outlineItem->open(); @@ -1042,7 +1042,7 @@ void PDFGenerator::addTransition( int pageNumber, KPDFPage * page ) -void PDFGenerator::customEvent( QCustomEvent * event ) +void PDFGenerator::customEvent( TQCustomEvent * event ) { // catch generator 'ready events' only if ( event->type() != TGE_DATAREADY_ID ) @@ -1074,11 +1074,11 @@ void PDFGenerator::customEvent( QCustomEvent * event ) // 2. put thread's generated data into the KPDFPage PixmapRequest * request = static_cast< PixmapRequest * >( event->data() ); - QImage * outImage = generatorThread->takeImage(); + TQImage * outImage = generatorThread->takeImage(); TextPage * outTextPage = generatorThread->takeTextPage(); - QValueList< ObjectRect * > outRects = generatorThread->takeObjectRects(); + TQValueList< ObjectRect * > outRects = generatorThread->takeObjectRects(); - request->page->setPixmap( request->id, new QPixmap( *outImage ) ); + request->page->setPixmap( request->id, new TQPixmap( *outImage ) ); delete outImage; if ( outTextPage ) request->page->setSearchPage( outTextPage ); @@ -1105,9 +1105,9 @@ struct PPGThreadPrivate PixmapRequest * currentRequest; // internal temp stored items. don't delete this. - QImage * m_image; + TQImage * m_image; TextPage * m_textPage; - QValueList< ObjectRect * > m_rects; + TQValueList< ObjectRect * > m_rects; bool m_rectsTaken; }; @@ -1129,7 +1129,7 @@ PDFPixmapGeneratorThread::~PDFPixmapGeneratorThread() delete d->m_textPage; if ( !d->m_rectsTaken && d->m_rects.count() ) { - QValueList< ObjectRect * >::iterator it = d->m_rects.begin(), end = d->m_rects.end(); + TQValueList< ObjectRect * >::iterator it = d->m_rects.begin(), end = d->m_rects.end(); for ( ; it != end; ++it ) delete *it; } @@ -1161,7 +1161,7 @@ void PDFPixmapGeneratorThread::startGeneration( PixmapRequest * request ) #endif // set generation parameters and run thread d->currentRequest = request; - start( QThread::InheritPriority ); + start( TQThread::InheritPriority ); } void PDFPixmapGeneratorThread::endGeneration() @@ -1179,9 +1179,9 @@ void PDFPixmapGeneratorThread::endGeneration() d->currentRequest = 0; } -QImage * PDFPixmapGeneratorThread::takeImage() const +TQImage * PDFPixmapGeneratorThread::takeImage() const { - QImage * img = d->m_image; + TQImage * img = d->m_image; d->m_image = 0; return img; } @@ -1193,7 +1193,7 @@ TextPage * PDFPixmapGeneratorThread::takeTextPage() const return tp; } -QValueList< ObjectRect * > PDFPixmapGeneratorThread::takeObjectRects() const +TQValueList< ObjectRect * > PDFPixmapGeneratorThread::takeObjectRects() const { d->m_rectsTaken = true; return d->m_rects; @@ -1253,7 +1253,7 @@ void PDFPixmapGeneratorThread::run() d->generator->docLock.unlock(); // notify the GUI thread that data is pending and can be read - QCustomEvent * readyEvent = new QCustomEvent( TGE_DATAREADY_ID ); + TQCustomEvent * readyEvent = new TQCustomEvent( TGE_DATAREADY_ID ); readyEvent->setData( d->currentRequest ); - QApplication::postEvent( d->generator, readyEvent ); + TQApplication::postEvent( d->generator, readyEvent ); } diff --git a/kpdf/core/generator_pdf/generator_pdf.h b/kpdf/core/generator_pdf/generator_pdf.h index ca267b18..662c19fd 100644 --- a/kpdf/core/generator_pdf/generator_pdf.h +++ b/kpdf/core/generator_pdf/generator_pdf.h @@ -11,10 +11,10 @@ #ifndef _KPDF_GENERATOR_PDF_H_ #define _KPDF_GENERATOR_PDF_H_ -#include -#include -#include -#include +#include +#include +#include +#include #include "core/generator.h" #include "core/document.h" #include "core/link.h" @@ -42,7 +42,7 @@ class PDFPixmapGeneratorThread; * For generating page contents we tell PDFDoc to render a page and grab * contents from out OutputDevs when rendering finishes. * - * Background asyncronous contents providing is done via a QThread inherited + * Background asyncronous contents providing is done via a TQThread inherited * class defined at the bottom of the file. */ class PDFGenerator : public Generator @@ -52,7 +52,7 @@ class PDFGenerator : public Generator virtual ~PDFGenerator(); // [INHERITED] load a document and fill up the pagesVector - bool loadDocument( const QString & fileName, QValueVector & pagesVector ); + bool loadDocument( const TQString & fileName, TQValueVector & pagesVector ); // [INHERITED] document informations const DocumentInfo * generateDocumentInfo(); @@ -77,7 +77,7 @@ class PDFGenerator : public Generator bool print( KPrinter& printer ); // [INHERITED] reply to some metadata requests - QString getMetaData( const QString & key, const QString & option ); + TQString getMetaData( const TQString & key, const TQString & option ); // [INHERITED] reparse configuration bool reparseConfig(); @@ -86,26 +86,26 @@ class PDFGenerator : public Generator // friend class to access private document related variables friend class PDFPixmapGeneratorThread; - void scanFonts(Dict *resDict, KListView *list, Ref **fonts, int &fontsLen, int &fontsSize, QValueVector *visitedXObjects); + void scanFonts(Dict *resDict, KListView *list, Ref **fonts, int &fontsLen, int &fontsSize, TQValueVector *visitedXObjects); void scanFont(GfxFont *font, KListView *list, Ref **fonts, int &fontsLen, int &fontsSize); void fillViewportFromLink( DocumentViewport &viewport, LinkDest *destination ); // private functions for accessing document informations via PDFDoc - QString getDocumentInfo( const QString & data, bool canReturnNull = false ) const; - QString getDocumentDate( const QString & data ) const; + TQString getDocumentInfo( const TQString & data, bool canReturnNull = false ) const; + TQString getDocumentDate( const TQString & data ) const; // private function for creating the document synopsis hieracy - void addSynopsisChildren( QDomNode * parent, GList * items ); + void addSynopsisChildren( TQDomNode * parent, GList * items ); // private function for creating the transition information void addTransition( int pageNumber, KPDFPage * page ); // (async related) receive data from the generator thread - void customEvent( QCustomEvent * ); + void customEvent( TQCustomEvent * ); // xpdf dependant stuff - QMutex docLock; + TQMutex docLock; PDFDoc * pdfdoc; KPDFOutputDev * kpdfOutputDev; - QColor paperColor; + TQColor paperColor; // asyncronous generation related stuff PDFPixmapGeneratorThread * generatorThread; @@ -136,9 +136,9 @@ class PDFPixmapGeneratorThread : public QThread void endGeneration(); // methods for getting contents from the GUI thread - QImage * takeImage() const; + TQImage * takeImage() const; TextPage * takeTextPage() const; - QValueList< ObjectRect * > takeObjectRects() const; + TQValueList< ObjectRect * > takeObjectRects() const; private: // can't be called from the outside (but from startGeneration) diff --git a/kpdf/core/generator_pdf/gp_outputdev.cpp b/kpdf/core/generator_pdf/gp_outputdev.cpp index c55ccd7c..df3fd85b 100644 --- a/kpdf/core/generator_pdf/gp_outputdev.cpp +++ b/kpdf/core/generator_pdf/gp_outputdev.cpp @@ -20,8 +20,8 @@ #endif #include -#include -#include +#include +#include #include "gp_outputdev.h" #include "generator_pdf.h" @@ -66,25 +66,25 @@ void KPDFOutputDev::setParams( int width, int height, bool genL, bool genI, bool m_generateImages = genI; } -QPixmap * KPDFOutputDev::takePixmap() +TQPixmap * KPDFOutputDev::takePixmap() { - QPixmap * pix = m_pixmap; + TQPixmap * pix = m_pixmap; m_pixmap = 0; return pix; } -QImage * KPDFOutputDev::takeImage() +TQImage * KPDFOutputDev::takeImage() { - QImage * img = m_image; + TQImage * img = m_image; m_image = 0; return img; } -QValueList< ObjectRect * > KPDFOutputDev::takeObjectRects() +TQValueList< ObjectRect * > KPDFOutputDev::takeObjectRects() { if ( m_rects.isEmpty() ) return m_rects; - QValueList< ObjectRect * > rectsCopy( m_rects ); + TQValueList< ObjectRect * > rectsCopy( m_rects ); m_rects.clear(); return rectsCopy; } @@ -101,8 +101,8 @@ void KPDFOutputDev::endPage() // does not work /* SplashColorPtr dataPtr = getBitmap()->getDataPtr(); // construct a qimage SHARING the raw bitmap data in memory - QImage * img = new QImage( dataPtr, bw, bh, 32, 0, 0, QImage::IgnoreEndian );*/ - QImage * img = new QImage( bw, bh, 32 ); + TQImage * img = new TQImage( dataPtr, bw, bh, 32, 0, 0, TQImage::IgnoreEndian );*/ + TQImage * img = new TQImage( bw, bh, 32 ); SplashColorPtr pixel = new Guchar[4]; for (int i = 0; i < bw; i++) { @@ -114,26 +114,26 @@ void KPDFOutputDev::endPage() } delete [] pixel; - // use the QImage or convert it immediately to QPixmap for better + // use the TQImage or convert it immediately to TQPixmap for better // handling and memory unloading if ( m_qtThreadSafety ) { delete m_image; // it may happen (in fact it doesn't) that we need a rescaling if ( bw != m_pixmapWidth && bh != m_pixmapHeight ) - m_image = new QImage( img->smoothScale( m_pixmapWidth, m_pixmapHeight ) ); + m_image = new TQImage( img->smoothScale( m_pixmapWidth, m_pixmapHeight ) ); else // dereference image from the xpdf memory - m_image = new QImage( img->copy() ); + m_image = new TQImage( img->copy() ); } else { delete m_pixmap; // it may happen (in fact it doesn't) that we need a rescaling if ( bw != m_pixmapWidth || bh != m_pixmapHeight ) - m_pixmap = new QPixmap( img->smoothScale( m_pixmapWidth, m_pixmapHeight ) ); + m_pixmap = new TQPixmap( img->smoothScale( m_pixmapWidth, m_pixmapHeight ) ); else - m_pixmap = new QPixmap( *img ); + m_pixmap = new TQPixmap( *img ); } // destroy the shared descriptor and (###) unload underlying xpdf bitmap @@ -217,7 +217,7 @@ void KPDFOutputDev::clear() // delete rects if ( m_rects.count() ) { - QValueList< ObjectRect * >::iterator it = m_rects.begin(), end = m_rects.end(); + TQValueList< ObjectRect * >::iterator it = m_rects.begin(), end = m_rects.end(); for ( ; it != end; ++it ) delete *it; m_rects.clear(); @@ -246,7 +246,7 @@ KPDFLink * KPDFOutputDev::generateLink( LinkAction * a ) { LinkGoTo * g = (LinkGoTo *) a; // ceate link: no ext file, namedDest, object pointer - link = new KPDFLinkGoto( QString::null, decodeViewport( g->getNamedDest(), g->getDest() ) ); + link = new KPDFLinkGoto( TQString::null, decodeViewport( g->getNamedDest(), g->getDest() ) ); } break; @@ -256,7 +256,7 @@ KPDFLink * KPDFOutputDev::generateLink( LinkAction * a ) // copy link file const char * fileName = g->getFileName()->getCString(); // ceate link: fileName, namedDest, object pointer - link = new KPDFLinkGoto( (QString)fileName, decodeViewport( g->getNamedDest(), g->getDest() ) ); + link = new KPDFLinkGoto( (TQString)fileName, decodeViewport( g->getNamedDest(), g->getDest() ) ); } break; diff --git a/kpdf/core/generator_pdf/gp_outputdev.h b/kpdf/core/generator_pdf/gp_outputdev.h index e08724e0..7788b1db 100644 --- a/kpdf/core/generator_pdf/gp_outputdev.h +++ b/kpdf/core/generator_pdf/gp_outputdev.h @@ -19,11 +19,11 @@ #pragma interface #endif -#include +#include #include "xpdf/PDFDoc.h" // for 'Object' #include "xpdf/SplashOutputDev.h" -class QPixmap; +class TQPixmap; class KPDFLink; class ObjectRect; class DocumentViewport; @@ -52,9 +52,9 @@ class KPDFOutputDev : public SplashOutputDev bool decodeLinks, bool decodeImages, bool qtThreadSafety = false ); // takes pointers out of the class (so deletion it's up to others) - QPixmap * takePixmap(); - QImage * takeImage(); - QValueList< ObjectRect * > takeObjectRects(); + TQPixmap * takePixmap(); + TQImage * takeImage(); + TQValueList< ObjectRect * > takeObjectRects(); /** inherited from OutputDev */ // End a page. @@ -82,9 +82,9 @@ class KPDFOutputDev : public SplashOutputDev // Internal objects PDFDoc * m_doc; - QPixmap * m_pixmap; - QImage * m_image; - QValueList< ObjectRect * > m_rects; // objectRects (links/images) + TQPixmap * m_pixmap; + TQImage * m_image; + TQValueList< ObjectRect * > m_rects; // objectRects (links/images) }; #endif diff --git a/kpdf/core/link.cpp b/kpdf/core/link.cpp index d8e47a49..33d0fe98 100644 --- a/kpdf/core/link.cpp +++ b/kpdf/core/link.cpp @@ -16,22 +16,22 @@ KPDFLink::~KPDFLink() { } -QString KPDFLinkGoto::linkTip() const +TQString KPDFLinkGoto::linkTip() const { - return m_extFileName.isEmpty() ? ( m_vp.pageNumber != -1 ? i18n( "Go to page %1" ).arg( m_vp.pageNumber + 1 ) : QString::null ) : i18n("Open external file"); + return m_extFileName.isEmpty() ? ( m_vp.pageNumber != -1 ? i18n( "Go to page %1" ).arg( m_vp.pageNumber + 1 ) : TQString::null ) : i18n("Open external file"); } -QString KPDFLinkExecute::linkTip() const +TQString KPDFLinkExecute::linkTip() const { return i18n( "Execute '%1'..." ).arg( m_fileName ); } -QString KPDFLinkBrowse::linkTip() const +TQString KPDFLinkBrowse::linkTip() const { return m_url; } -QString KPDFLinkAction::linkTip() const +TQString KPDFLinkAction::linkTip() const { switch ( m_type ) { @@ -61,5 +61,5 @@ QString KPDFLinkAction::linkTip() const default: ; } - return QString::null; + return TQString::null; } diff --git a/kpdf/core/link.h b/kpdf/core/link.h index 10420c50..eff3573e 100644 --- a/kpdf/core/link.h +++ b/kpdf/core/link.h @@ -10,8 +10,8 @@ #ifndef _KPDF_LINK_H_ #define _KPDF_LINK_H_ -#include -#include +#include +#include #include "core/document.h" // for DocumentViewport /** @@ -27,7 +27,7 @@ class KPDFLink // get link type (inherited classes mustreturn an unique identifier) enum LinkType { Goto, Execute, Browse, Action, Movie }; virtual LinkType linkType() const = 0; - virtual QString linkTip() const { return QString::null; } + virtual TQString linkTip() const { return TQString::null; } // virtual destructor (remove warnings) virtual ~KPDFLink(); @@ -40,16 +40,16 @@ class KPDFLinkGoto : public KPDFLink public: // query for goto parameters bool isExternal() const { return !m_extFileName.isEmpty(); } - const QString & fileName() const { return m_extFileName; } + const TQString & fileName() const { return m_extFileName; } const DocumentViewport & destViewport() const { return m_vp; } // create a KPDFLink_Goto - KPDFLinkGoto( QString extFileName, const DocumentViewport & vp ) { m_extFileName = extFileName; m_vp = vp; } + KPDFLinkGoto( TQString extFileName, const DocumentViewport & vp ) { m_extFileName = extFileName; m_vp = vp; } LinkType linkType() const { return Goto; } - QString linkTip() const; + TQString linkTip() const; private: - QString m_extFileName; + TQString m_extFileName; DocumentViewport m_vp; }; @@ -58,17 +58,17 @@ class KPDFLinkExecute : public KPDFLink { public: // query for filename / parameters - const QString & fileName() const { return m_fileName; } - const QString & parameters() const { return m_parameters; } + const TQString & fileName() const { return m_fileName; } + const TQString & parameters() const { return m_parameters; } // create a KPDFLink_Execute - KPDFLinkExecute( const QString & file, const QString & params ) { m_fileName = file; m_parameters = params; } + KPDFLinkExecute( const TQString & file, const TQString & params ) { m_fileName = file; m_parameters = params; } LinkType linkType() const { return Execute; } - QString linkTip() const; + TQString linkTip() const; private: - QString m_fileName; - QString m_parameters; + TQString m_fileName; + TQString m_parameters; }; /** Browse: an URL to open, ranging from 'http://' to 'mailto:' etc.. **/ @@ -76,15 +76,15 @@ class KPDFLinkBrowse : public KPDFLink { public: // query for URL - const QString & url() const { return m_url; } + const TQString & url() const { return m_url; } // create a KPDFLink_Browse - KPDFLinkBrowse( const QString &url ) { m_url = url; } + KPDFLinkBrowse( const TQString &url ) { m_url = url; } LinkType linkType() const { return Browse; } - QString linkTip() const; + TQString linkTip() const; private: - QString m_url; + TQString m_url; }; /** Action: contains an action to perform on document / kpdf **/ @@ -100,7 +100,7 @@ class KPDFLinkAction : public KPDFLink // create a KPDFLink_Action KPDFLinkAction( enum ActionType actionType ) { m_type = actionType; } LinkType linkType() const { return Action; } - QString linkTip() const; + TQString linkTip() const; private: ActionType m_type; diff --git a/kpdf/core/observer.h b/kpdf/core/observer.h index 28f07bf5..ea0ce6c1 100644 --- a/kpdf/core/observer.h +++ b/kpdf/core/observer.h @@ -11,8 +11,8 @@ #ifndef _KPDF_DOCUMENTOBSERVER_H_ #define _KPDF_DOCUMENTOBSERVER_H_ -#include -#include +#include +#include /** IDs for observers. Globally defined here. **/ #define PRESENTATION_ID 1 @@ -46,7 +46,7 @@ class DocumentObserver // commands from the Document to all observers enum ChangedFlags { Pixmap = 1, Bookmark = 2, Highlights = 4 }; - virtual void notifySetup( const QValueVector< KPDFPage * > & /*pages*/, bool /*documentChanged*/ ) {}; + virtual void notifySetup( const TQValueVector< KPDFPage * > & /*pages*/, bool /*documentChanged*/ ) {}; virtual void notifyViewportChanged( bool /*smoothMove*/ ) {}; virtual void notifyPageChanged( int /*pageNumber*/, int /*changedFlags*/ ) {}; virtual void notifyContentsCleared( int /*changedFlags*/ ) {}; diff --git a/kpdf/core/page.cpp b/kpdf/core/page.cpp index 70bc71bc..6b611360 100644 --- a/kpdf/core/page.cpp +++ b/kpdf/core/page.cpp @@ -8,9 +8,9 @@ ***************************************************************************/ // qt/kde includes -#include -#include -#include +#include +#include +#include #include // local includes @@ -78,7 +78,7 @@ bool KPDFPage::hasPixmap( int id, int width, int height ) const return false; if ( width == -1 || height == -1 ) return true; - QPixmap * p = m_pixmaps[ id ]; + TQPixmap * p = m_pixmaps[ id ]; return p ? ( p->width() == width && p->height() == height ) : false; } @@ -96,7 +96,7 @@ bool KPDFPage::hasObjectRect( double x, double y ) const { if ( m_rects.count() < 1 ) return false; - QValueList< ObjectRect * >::const_iterator it = m_rects.begin(), end = m_rects.end(); + TQValueList< ObjectRect * >::const_iterator it = m_rects.begin(), end = m_rects.end(); for ( ; it != end; ++it ) if ( (*it)->contains( x, y ) ) return true; @@ -112,7 +112,7 @@ bool KPDFPage::hasHighlights( int s_id ) const if ( s_id == -1 ) return true; // iterate on the highlights list to find an entry by id - QValueList< HighlightRect * >::const_iterator it = m_highlights.begin(), end = m_highlights.end(); + TQValueList< HighlightRect * >::const_iterator it = m_highlights.begin(), end = m_highlights.end(); for ( ; it != end; ++it ) if ( (*it)->s_id == s_id ) return true; @@ -125,15 +125,15 @@ bool KPDFPage::hasTransition() const } -NormalizedRect * KPDFPage::findText( const QString & text, bool strictCase, NormalizedRect * lastRect ) const +NormalizedRect * KPDFPage::findText( const TQString & text, bool strictCase, NormalizedRect * lastRect ) const { if ( text.isEmpty() ) return 0; // create a xpf's Unicode (unsigned int) array for the given text - const QChar * str = text.unicode(); + const TQChar * str = text.unicode(); int len = text.length(); - QMemArray u(len); + TQMemArray u(len); for (int i = 0; i < len; ++i) u[i] = str[i].unicode(); @@ -172,23 +172,23 @@ NormalizedRect * KPDFPage::findText( const QString & text, bool strictCase, Norm return 0; } -const QString KPDFPage::getText( const NormalizedRect & rect ) const +const TQString KPDFPage::getText( const NormalizedRect & rect ) const { if ( !m_text ) - return QString::null; + return TQString::null; int left = (int)( rect.left * m_width ), top = (int)( rect.top * m_height ), right = (int)( rect.right * m_width ), bottom = (int)( rect.bottom * m_height ); GString * text = m_text->getText( left, top, right, bottom ); - QString result = QString::fromUtf8( text->getCString() ); + TQString result = TQString::fromUtf8( text->getCString() ); delete text; return result; } const ObjectRect * KPDFPage::hasObject( ObjectRect::ObjectType type, double x, double y ) const { - QValueList< ObjectRect * >::const_iterator it = m_rects.begin(), end = m_rects.end(); + TQValueList< ObjectRect * >::const_iterator it = m_rects.begin(), end = m_rects.end(); for ( ; it != end; ++it ) if ( (*it)->contains( x, y ) ) if ((*it)->objectType() == type) return *it; @@ -201,7 +201,7 @@ const KPDFPageTransition * KPDFPage::getTransition() const } -void KPDFPage::setPixmap( int id, QPixmap * pixmap ) +void KPDFPage::setPixmap( int id, TQPixmap * pixmap ) { if ( m_pixmaps.contains( id ) ) delete m_pixmaps[id]; @@ -219,15 +219,15 @@ void KPDFPage::setBookmark( bool state ) m_bookmarked = state; } -void KPDFPage::setObjectRects( const QValueList< ObjectRect * > rects ) +void KPDFPage::setObjectRects( const TQValueList< ObjectRect * > rects ) { - QValueList< ObjectRect * >::iterator it = m_rects.begin(), end = m_rects.end(); + TQValueList< ObjectRect * >::iterator it = m_rects.begin(), end = m_rects.end(); for ( ; it != end; ++it ) delete *it; m_rects = rects; } -void KPDFPage::setHighlight( int s_id, NormalizedRect * &rect, const QColor & color ) +void KPDFPage::setHighlight( int s_id, NormalizedRect * &rect, const TQColor & color ) { // create a HighlightRect descriptor taking values from params HighlightRect * hr = new HighlightRect(); @@ -262,12 +262,12 @@ void KPDFPage::deletePixmap( int id ) void KPDFPage::deletePixmapsAndRects() { // delete all stored pixmaps - QMap::iterator it = m_pixmaps.begin(), end = m_pixmaps.end(); + TQMap::iterator it = m_pixmaps.begin(), end = m_pixmaps.end(); for ( ; it != end; ++it ) delete *it; m_pixmaps.clear(); // delete ObjectRects - QValueList< ObjectRect * >::iterator rIt = m_rects.begin(), rEnd = m_rects.end(); + TQValueList< ObjectRect * >::iterator rIt = m_rects.begin(), rEnd = m_rects.end(); for ( ; rIt != rEnd; ++rIt ) delete *rIt; m_rects.clear(); @@ -276,7 +276,7 @@ void KPDFPage::deletePixmapsAndRects() void KPDFPage::deleteHighlights( int s_id ) { // delete highlights by ID - QValueList< HighlightRect * >::iterator it = m_highlights.begin(), end = m_highlights.end(); + TQValueList< HighlightRect * >::iterator it = m_highlights.begin(), end = m_highlights.end(); while ( it != end ) { HighlightRect * highlight = *it; @@ -300,7 +300,7 @@ NormalizedRect::NormalizedRect( double l, double t, double r, double b ) // note: check for swapping coords? : left( l ), top( t ), right( r ), bottom( b ) {} -NormalizedRect::NormalizedRect( const QRect & r, double xScale, double yScale ) +NormalizedRect::NormalizedRect( const TQRect & r, double xScale, double yScale ) : left( (double)r.left() / xScale ), top( (double)r.top() / yScale ), right( (double)r.right() / xScale ), bottom( (double)r.bottom() / yScale ) {} @@ -319,13 +319,13 @@ bool NormalizedRect::intersects( double l, double t, double r, double b ) const return (l < right) && (r > left) && (t < bottom) && (b > top); } -QRect NormalizedRect::geometry( int xScale, int yScale ) const +TQRect NormalizedRect::geometry( int xScale, int yScale ) const { int l = (int)( left * xScale ), t = (int)( top * yScale ), r = (int)( right * xScale ), b = (int)( bottom * yScale ); - return QRect( l, t, r - l + 1, b - t + 1 ); + return TQRect( l, t, r - l + 1, b - t + 1 ); } diff --git a/kpdf/core/page.h b/kpdf/core/page.h index 4a8be71d..2de7aceb 100644 --- a/kpdf/core/page.h +++ b/kpdf/core/page.h @@ -10,11 +10,11 @@ #ifndef _KPDF_PAGE_H_ #define _KPDF_PAGE_H_ -#include -#include +#include +#include -class QPixmap; -class QRect; +class TQPixmap; +class TQRect; class TextPage; class KPDFPageTransition; class HighlightRect; @@ -30,13 +30,13 @@ class NormalizedRect NormalizedRect(); NormalizedRect( double l, double t, double r, double b ); - NormalizedRect( const QRect & r, double xScale, double yScale ); + NormalizedRect( const TQRect & r, double xScale, double yScale ); bool contains( double x, double y ) const; bool intersects( const NormalizedRect & normRect ) const; bool intersects( double l, double t, double r, double b ) const; - QRect geometry( int xScale, int yScale ) const; + TQRect geometry( int xScale, int yScale ) const; }; /** @@ -102,18 +102,18 @@ class KPDFPage //bool hasAnnotation( double x, double y ) const; bool hasTransition() const; - NormalizedRect * findText( const QString & text, bool keepCase, NormalizedRect * last = 0 ) const; - const QString getText( const NormalizedRect & rect ) const; + NormalizedRect * findText( const TQString & text, bool keepCase, NormalizedRect * last = 0 ) const; + const TQString getText( const NormalizedRect & rect ) const; const ObjectRect * hasObject( ObjectRect::ObjectType type, double x, double y ) const; //const Annotation * getAnnotation( double x, double y ) const; const KPDFPageTransition * getTransition() const; // operations: set/delete contents (by KPDFDocument) - void setPixmap( int p_id, QPixmap * pixmap ); + void setPixmap( int p_id, TQPixmap * pixmap ); void setSearchPage( TextPage * text ); void setBookmark( bool state ); - void setObjectRects( const QValueList< ObjectRect * > rects ); - void setHighlight( int s_id, NormalizedRect * &r, const QColor & color ); + void setObjectRects( const TQValueList< ObjectRect * > rects ); + void setHighlight( int s_id, NormalizedRect * &r, const TQColor & color ); //void setAnnotation( Annotation * annotation ); void setTransition( KPDFPageTransition * transition ); void deletePixmap( int p_id ); @@ -129,11 +129,11 @@ class KPDFPage float m_width, m_height; bool m_bookmarked; - QMap< int, QPixmap * > m_pixmaps; + TQMap< int, TQPixmap * > m_pixmaps; TextPage * m_text; - QValueList< ObjectRect * > m_rects; - QValueList< HighlightRect * > m_highlights; - //QValueList< Annotation * > m_annotations; + TQValueList< ObjectRect * > m_rects; + TQValueList< HighlightRect * > m_highlights; + //TQValueList< Annotation * > m_annotations; KPDFPageTransition * m_transition; }; @@ -146,7 +146,7 @@ struct HighlightRect : public NormalizedRect // searchID of the highlight owner int s_id; // color of the highlight - QColor color; + TQColor color; }; #endif -- cgit v1.2.3