summaryrefslogtreecommitdiffstats
path: root/kdvi/dviRenderer.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-02 19:23:46 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-02 19:23:46 +0000
commiteba47f8f0637f451e21348187591e1f1fd58ac74 (patch)
tree448f10b95c656604acc331a3236c1e59bde5c1ad /kdvi/dviRenderer.cpp
parentc7e8736c69373f48b0401319757c742e8607431a (diff)
downloadtdegraphics-eba47f8f0637f451e21348187591e1f1fd58ac74.tar.gz
tdegraphics-eba47f8f0637f451e21348187591e1f1fd58ac74.zip
TQt conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1158446 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdvi/dviRenderer.cpp')
-rw-r--r--kdvi/dviRenderer.cpp158
1 files changed, 79 insertions, 79 deletions
diff --git a/kdvi/dviRenderer.cpp b/kdvi/dviRenderer.cpp
index b9bf6256..2e0b0512 100644
--- a/kdvi/dviRenderer.cpp
+++ b/kdvi/dviRenderer.cpp
@@ -14,19 +14,19 @@
#include <stdlib.h>
#include <string.h>
-#include <qcheckbox.h>
-#include <qclipboard.h>
-#include <qcursor.h>
-#include <qlabel.h>
-#include <qfileinfo.h>
-#include <qlayout.h>
-#include <qmessagebox.h>
-#include <qpaintdevice.h>
-#include <qpainter.h>
-#include <qptrstack.h>
-#include <qregexp.h>
-#include <qurl.h>
-#include <qvbox.h>
+#include <tqcheckbox.h>
+#include <tqclipboard.h>
+#include <tqcursor.h>
+#include <tqlabel.h>
+#include <tqfileinfo.h>
+#include <tqlayout.h>
+#include <tqmessagebox.h>
+#include <tqpaintdevice.h>
+#include <tqpainter.h>
+#include <tqptrstack.h>
+#include <tqregexp.h>
+#include <tqurl.h>
+#include <tqvbox.h>
#include <kapplication.h>
#include <kmessagebox.h>
@@ -62,12 +62,12 @@
//#define DEBUG_DVIRENDERER
-QPainter *foreGroundPainter; // QPainter used for text
+TQPainter *foreGroundPainter; // TQPainter used for text
//------ now comes the dviRenderer class implementation ----------
-dviRenderer::dviRenderer(QWidget *par)
+dviRenderer::dviRenderer(TQWidget *par)
: DocumentRenderer(par), info(new infoDialog(par))
{
#ifdef DEBUG_DVIRENDERER
@@ -77,14 +77,14 @@ dviRenderer::dviRenderer(QWidget *par)
// initialize the dvi machinery
dviFile = 0;
- connect(&font_pool, SIGNAL( setStatusBarText( const QString& ) ), this, SIGNAL( setStatusBarText( const QString& ) ) );
+ connect(&font_pool, TQT_SIGNAL( setStatusBarText( const TQString& ) ), this, TQT_SIGNAL( setStatusBarText( const TQString& ) ) );
parentWidget = par;
shrinkfactor = 3;
current_page = 0;
resolutionInDPI = 0.0;
- connect( &clearStatusBarTimer, SIGNAL(timeout()), this, SLOT(clearStatusBar()) );
+ connect( &clearStatusBarTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(clearStatusBar()) );
currentlyDrawnPage = 0;
editorCommand = "";
@@ -103,7 +103,7 @@ dviRenderer::dviRenderer(QWidget *par)
PS_interface = new ghostscript_interface();
// pass status bar messages through
- connect(PS_interface, SIGNAL( setStatusBarText( const QString& ) ), this, SIGNAL( setStatusBarText( const QString& ) ) );
+ connect(PS_interface, TQT_SIGNAL( setStatusBarText( const TQString& ) ), this, TQT_SIGNAL( setStatusBarText( const TQString& ) ) );
}
@@ -125,9 +125,9 @@ dviRenderer::~dviRenderer()
}
-void dviRenderer::setPrefs(bool flag_showPS, const QString &str_editorCommand, bool useFontHints )
+void dviRenderer::setPrefs(bool flag_showPS, const TQString &str_editorCommand, bool useFontHints )
{
- QMutexLocker locker(&mutex);
+ TQMutexLocker locker(&mutex);
_postscript = flag_showPS;
editorCommand = str_editorCommand;
font_pool.setParameters( useFontHints );
@@ -195,14 +195,14 @@ void dviRenderer::drawPage(double resolution, RenderedDocumentPage *page)
colorStack.clear();
globalColor = Qt::black;
- QApplication::setOverrideCursor( waitCursor );
+ TQApplication::setOverrideCursor( waitCursor );
foreGroundPainter = page->getPainter();
if (foreGroundPainter != 0) {
- errorMsg = QString::null;
+ errorMsg = TQString::null;
draw_page();
page->returnPainter(foreGroundPainter);
}
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
page->isEmpty = false;
if (errorMsg.isEmpty() != true) {
@@ -210,7 +210,7 @@ void dviRenderer::drawPage(double resolution, RenderedDocumentPage *page)
i18n("<qt><strong>File corruption!</strong> KDVI had trouble interpreting your DVI file. Most "
"likely this means that the DVI file is broken.</qt>"),
errorMsg, i18n("DVI File Error"));
- errorMsg = QString::null;
+ errorMsg = TQString::null;
currentlyDrawnPage = 0;
mutex.unlock();
return;
@@ -225,7 +225,7 @@ void dviRenderer::drawPage(double resolution, RenderedDocumentPage *page)
dviFile->sourceSpecialMarker = false;
// Show the dialog as soon as event processing is finished, and
// the program is idle
- QTimer::singleShot( 0, this, SLOT(showThatSourceInformationIsPresent()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(showThatSourceInformationIsPresent()) );
}
}
@@ -262,27 +262,27 @@ void dviRenderer::showThatSourceInformationIsPresent()
KDialogBase *dialog= new KDialogBase(i18n("KDVI: Information"), KDialogBase::Yes, KDialogBase::Yes, KDialogBase::Yes,
parentWidget, "information", true, true,KStdGuiItem::ok() );
- QVBox *topcontents = new QVBox (dialog);
+ TQVBox *topcontents = new TQVBox (dialog);
topcontents->setSpacing(KDialog::spacingHint()*2);
topcontents->setMargin(KDialog::marginHint()*2);
- QWidget *contents = new QWidget(topcontents);
- QHBoxLayout * lay = new QHBoxLayout(contents);
+ TQWidget *contents = new TQWidget(topcontents);
+ TQHBoxLayout * lay = new TQHBoxLayout(contents);
lay->setSpacing(KDialog::spacingHint()*2);
lay->addStretch(1);
- QLabel *label1 = new QLabel( contents);
- label1->setPixmap(QMessageBox::standardIcon(QMessageBox::Information));
+ TQLabel *label1 = new TQLabel( contents);
+ label1->setPixmap(TQMessageBox::standardIcon(TQMessageBox::Information));
lay->add( label1 );
- QLabel *label2 = new QLabel( i18n("<qt>This DVI file contains source file information. You may click into the text with the "
+ TQLabel *label2 = new TQLabel( i18n("<qt>This DVI file contains source file information. You may click into the text with the "
"middle mouse button, and an editor will open the TeX-source file immediately.</qt>"),
contents);
label2->setMinimumSize(label2->sizeHint());
lay->add( label2 );
lay->addStretch(1);
- QSize extraSize = QSize(50,30);
- QCheckBox *checkbox = new QCheckBox(i18n("Do not show this message again"), topcontents);
- extraSize = QSize(50,0);
+ TQSize extraSize = TQSize(50,30);
+ TQCheckBox *checkbox = new TQCheckBox(i18n("Do not show this message again"), topcontents);
+ extraSize = TQSize(50,0);
dialog->setHelpLinkText(i18n("Explain in more detail..."));
dialog->setHelp("inverse-search", "kdvi");
dialog->enableLinkedHelp(true);
@@ -312,7 +312,7 @@ void dviRenderer::embedPostScript()
return;
embedPS_progress = new KProgressDialog(parentWidget, "embedPSProgressDialog",
- i18n("Embedding PostScript Files"), QString::null, true);
+ i18n("Embedding PostScript Files"), TQString::null, true);
if (!embedPS_progress)
return;
embedPS_progress->setAllowCancel(false);
@@ -324,7 +324,7 @@ void dviRenderer::embedPostScript()
Q_UINT16 currPageSav = current_page;
- errorMsg = QString::null;
+ errorMsg = TQString::null;
for(current_page=0; current_page < dviFile->total_pages; current_page++) {
if (current_page < dviFile->total_pages) {
command_pointer = dviFile->dvi_Data() + dviFile->page_offset[current_page];
@@ -343,22 +343,22 @@ void dviRenderer::embedPostScript()
if (!errorMsg.isEmpty()) {
errorMsg = "<qt>" + errorMsg + "</qt>";
KMessageBox::detailedError(parentWidget, "<qt>" + i18n("Not all PostScript files could be embedded into your document.") + "</qt>", errorMsg);
- errorMsg = QString::null;
+ errorMsg = TQString::null;
} else
KMessageBox::information(parentWidget, "<qt>" + i18n("All external PostScript files were embedded into your document. You "
"will probably want to save the DVI file now.") + "</qt>",
- QString::null, "embeddingDone");
+ TQString::null, "embeddingDone");
// Prescan phase starts here
#ifdef PERFORMANCE_MEASUREMENT
kdDebug(4300) << "Time elapsed till prescan phase starts " << performanceTimer.elapsed() << "ms" << endl;
- QTime preScanTimer;
+ TQTime preScanTimer;
preScanTimer.start();
#endif
dviFile->numberOfExternalPSFiles = 0;
prebookmarks.clear();
for(current_page=0; current_page < dviFile->total_pages; current_page++) {
- PostScriptOutPutString = new QString();
+ PostScriptOutPutString = new TQString();
if (current_page < dviFile->total_pages) {
command_pointer = dviFile->dvi_Data() + dviFile->page_offset[current_page];
@@ -387,9 +387,9 @@ void dviRenderer::embedPostScript()
}
-bool dviRenderer::isValidFile(const QString& filename) const
+bool dviRenderer::isValidFile(const TQString& filename) const
{
- QFile f(filename);
+ TQFile f(filename);
if (!f.open(IO_ReadOnly))
return false;
@@ -411,16 +411,16 @@ bool dviRenderer::isValidFile(const QString& filename) const
}
-bool dviRenderer::setFile(const QString &fname, const KURL &base)
+bool dviRenderer::setFile(const TQString &fname, const KURL &base)
{
#ifdef DEBUG_DVIRENDERER
kdDebug(4300) << "dviRenderer::setFile( fname='" << fname << "', ref='" << ref << "', sourceMarker=" << sourceMarker << " )" << endl;
#endif
- QMutexLocker lock(&mutex);
+ TQMutexLocker lock(&mutex);
- QFileInfo fi(fname);
- QString filename = fi.absFilePath();
+ TQFileInfo fi(fname);
+ TQString filename = fi.absFilePath();
// If fname is the empty string, then this means: "close". Delete
// the dvifile and the pixmap.
@@ -446,7 +446,7 @@ bool dviRenderer::setFile(const QString &fname, const KURL &base)
// mime type, if the file is not DVI. Perhaps we should move the
// procedure later to the kviewpart, instead of the implementaton in
// the multipage.
- QString mimetype( KMimeMagic::self()->findFileType( fname )->mimeType() );
+ TQString mimetype( KMimeMagic::self()->findFileType( fname )->mimeType() );
if (mimetype != "application/x-dvi") {
KMessageBox::sorry( parentWidget,
i18n( "<qt>Could not open file <nobr><strong>%1</strong></nobr> which has "
@@ -466,7 +466,7 @@ bool dviRenderer::setFile(const QString &fname, const KURL &base)
return false;
}
- QApplication::setOverrideCursor( waitCursor );
+ TQApplication::setOverrideCursor( waitCursor );
dvifile *dviFile_new = new dvifile(filename, &font_pool);
if ((dviFile == 0) || (dviFile->filename != filename))
@@ -475,7 +475,7 @@ bool dviRenderer::setFile(const QString &fname, const KURL &base)
dviFile_new->sourceSpecialMarker = false;
if ((dviFile_new->dvi_Data() == NULL)||(dviFile_new->errorMsg.isEmpty() != true)) {
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
if (dviFile_new->errorMsg.isEmpty() != true)
KMessageBox::detailedError(parentWidget,
i18n("<qt>File corruption! KDVI had trouble interpreting your DVI file. Most "
@@ -504,7 +504,7 @@ bool dviRenderer::setFile(const QString &fname, const KURL &base)
// web server), we limit the PostScript files that can be accessed
// by this file to the download directory, in order to limit the
// possibilities of a denial of service attack.
- QString includePath;
+ TQString includePath;
if (!baseURL.isLocalFile()) {
includePath = filename;
includePath.truncate(includePath.findRev('/'));
@@ -534,7 +534,7 @@ bool dviRenderer::setFile(const QString &fname, const KURL &base)
// PRESCAN STARTS HERE
#ifdef PERFORMANCE_MEASUREMENT
kdDebug(4300) << "Time elapsed till prescan phase starts " << performanceTimer.elapsed() << "ms" << endl;
- QTime preScanTimer;
+ TQTime preScanTimer;
preScanTimer.start();
#endif
dviFile->numberOfExternalPSFiles = 0;
@@ -542,7 +542,7 @@ bool dviRenderer::setFile(const QString &fname, const KURL &base)
prebookmarks.clear();
for(current_page=0; current_page < dviFile->total_pages; current_page++) {
- PostScriptOutPutString = new QString();
+ PostScriptOutPutString = new TQString();
if (current_page < dviFile->total_pages) {
command_pointer = dviFile->dvi_Data() + dviFile->page_offset[current_page];
@@ -563,9 +563,9 @@ bool dviRenderer::setFile(const QString &fname, const KURL &base)
// Generate the list of bookmarks
bookmarks.clear();
- QPtrStack<Bookmark> stack;
+ TQPtrStack<Bookmark> stack;
stack.setAutoDelete (false);
- QValueVector<PreBookmark>::iterator it;
+ TQValueVector<PreBookmark>::iterator it;
for( it = prebookmarks.begin(); it != prebookmarks.end(); ++it ) {
Bookmark *bmk = new Bookmark((*it).title, findAnchor((*it).anchorName));
if (stack.isEmpty())
@@ -593,12 +593,12 @@ bool dviRenderer::setFile(const QString &fname, const KURL &base)
pageSizes.resize(dviFile->total_pages, *(dviFile->suggestedPageSize));
}
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
return true;
}
-Anchor dviRenderer::parseReference(const QString &reference)
+Anchor dviRenderer::parseReference(const TQString &reference)
{
mutex.lock();
@@ -634,7 +634,7 @@ Anchor dviRenderer::parseReference(const QString &reference)
// Extract the file name and the numeral part from the reference string
DVI_SourceFileSplitter splitter(reference, dviFile->filename);
Q_UINT32 refLineNumber = splitter.line();
- QString refFileName = splitter.filePath();
+ TQString refFileName = splitter.filePath();
if (sourceHyperLinkAnchors.isEmpty()) {
KMessageBox::sorry(parentWidget, i18n("<qt>You have asked KDVI to locate the place in the DVI file which corresponds to "
@@ -662,8 +662,8 @@ Anchor dviRenderer::parseReference(const QString &reference)
// document.
bool anchorForRefFileFound = false; // Flag that is set if source file anchors for the refFileName could be found at all
- QValueVector<DVI_SourceFileAnchor>::iterator bestMatch = sourceHyperLinkAnchors.end();
- QValueVector<DVI_SourceFileAnchor>::iterator it;
+ TQValueVector<DVI_SourceFileAnchor>::iterator bestMatch = sourceHyperLinkAnchors.end();
+ TQValueVector<DVI_SourceFileAnchor>::iterator it;
for( it = sourceHyperLinkAnchors.begin(); it != sourceHyperLinkAnchors.end(); ++it )
if (refFileName.stripWhiteSpace() == it->fileName.stripWhiteSpace()
|| refFileName.stripWhiteSpace() == it->fileName.stripWhiteSpace() + ".tex"
@@ -715,11 +715,11 @@ void dviRenderer::setResolution(double resolution_in_DPI)
void dviRenderer::clearStatusBar()
{
- emit setStatusBarText( QString::null );
+ emit setStatusBarText( TQString::null );
}
-void dviRenderer::handleSRCLink(const QString &linkText, QMouseEvent *e, DocumentWidget *win)
+void dviRenderer::handleSRCLink(const TQString &linkText, TQMouseEvent *e, DocumentWidget *win)
{
#ifdef DEBUG_SPECIAL
RenderedDviPagePixmap* currentDVIPage = dynamic_cast<RenderedDviPagePixmap*> currentlyDrawnPage;
@@ -730,25 +730,25 @@ void dviRenderer::handleSRCLink(const QString &linkText, QMouseEvent *e, Documen
#endif
DVI_SourceFileSplitter splitter(linkText, dviFile->filename);
- QString TeXfile = splitter.filePath();
+ TQString TeXfile = splitter.filePath();
if ( ! splitter.fileExists() )
{
- KMessageBox::sorry(parentWidget, QString("<qt>") +
+ KMessageBox::sorry(parentWidget, TQString("<qt>") +
i18n("The DVI-file refers to the TeX-file "
"<strong>%1</strong> which could not be found.").arg(KShellProcess::quote(TeXfile)) +
- QString("</qt>"),
+ TQString("</qt>"),
i18n( "Could Not Find File" ));
return;
}
- QString command = editorCommand;
+ TQString command = editorCommand;
if (command.isEmpty() == true) {
- int r = KMessageBox::warningContinueCancel(parentWidget, QString("<qt>") +
+ int r = KMessageBox::warningContinueCancel(parentWidget, TQString("<qt>") +
i18n("You have not yet specified an editor for inverse search. "
"Please choose your favorite editor in the "
"<strong>DVI options dialog</strong> "
"which you will find in the <strong>Settings</strong>-menu.") +
- QString("</qt>"),
+ TQString("</qt>"),
i18n("Need to Specify Editor"),
i18n("Use KDE's Editor Kate for Now"));
if (r == KMessageBox::Continue)
@@ -756,7 +756,7 @@ void dviRenderer::handleSRCLink(const QString &linkText, QMouseEvent *e, Documen
else
return;
}
- command = command.replace( "%l", QString::number(splitter.line()) ).replace( "%f", KShellProcess::quote(TeXfile) );
+ command = command.replace( "%l", TQString::number(splitter.line()) ).replace( "%f", KShellProcess::quote(TeXfile) );
#ifdef DEBUG_SPECIAL
kdDebug(4300) << "Calling program: " << command << endl;
@@ -767,8 +767,8 @@ void dviRenderer::handleSRCLink(const QString &linkText, QMouseEvent *e, Documen
// henceforth dimiss the output of the older programm. "If it
// hasn't failed until now, we don't care."
if (proc != 0) {
- qApp->disconnect(proc, SIGNAL(receivedStderr(KProcess *, char *, int)), 0, 0);
- qApp->disconnect(proc, SIGNAL(receivedStdout(KProcess *, char *, int)), 0, 0);
+ qApp->disconnect(proc, TQT_SIGNAL(receivedStderr(KProcess *, char *, int)), 0, 0);
+ qApp->disconnect(proc, TQT_SIGNAL(receivedStdout(KProcess *, char *, int)), 0, 0);
proc = 0;
}
@@ -778,9 +778,9 @@ void dviRenderer::handleSRCLink(const QString &linkText, QMouseEvent *e, Documen
kdError(4300) << "Could not allocate ShellProcess for the editor command." << endl;
return;
}
- qApp->connect(proc, SIGNAL(receivedStderr(KProcess *, char *, int)), this, SLOT(dvips_output_receiver(KProcess *, char *, int)));
- qApp->connect(proc, SIGNAL(receivedStdout(KProcess *, char *, int)), this, SLOT(dvips_output_receiver(KProcess *, char *, int)));
- qApp->connect(proc, SIGNAL(processExited(KProcess *)), this, SLOT(editorCommand_terminated(KProcess *)));
+ qApp->connect(proc, TQT_SIGNAL(receivedStderr(KProcess *, char *, int)), this, TQT_SLOT(dvips_output_receiver(KProcess *, char *, int)));
+ qApp->connect(proc, TQT_SIGNAL(receivedStdout(KProcess *, char *, int)), this, TQT_SLOT(dvips_output_receiver(KProcess *, char *, int)));
+ qApp->connect(proc, TQT_SIGNAL(processExited(KProcess *)), this, TQT_SLOT(editorCommand_terminated(KProcess *)));
// Merge the editor-specific editor message here.
export_errorString = i18n("<qt>The external program<br><br><tt><strong>%1</strong></tt><br/><br/>which was used to call the editor "
"for inverse search, reported an error. You might wish to look at the <strong>document info "
@@ -804,12 +804,12 @@ void dviRenderer::handleSRCLink(const QString &linkText, QMouseEvent *e, Documen
}
-QString dviRenderer::PDFencodingToQString(const QString& _pdfstring)
+TQString dviRenderer::PDFencodingToQString(const TQString& _pdfstring)
{
// This method locates special PDF characters in a string and
// replaces them by UTF8. See Section 3.2.3 of the PDF reference
// guide for information.
- QString pdfstring = _pdfstring;
+ TQString pdfstring = _pdfstring;
pdfstring = pdfstring.replace("\\n", "\n");
pdfstring = pdfstring.replace("\\r", "\n");
pdfstring = pdfstring.replace("\\t", "\t");
@@ -820,17 +820,17 @@ QString dviRenderer::PDFencodingToQString(const QString& _pdfstring)
// Now replace octal character codes with the characters they encode
int pos;
- QRegExp rx( "(\\\\)(\\d\\d\\d)" ); // matches "\xyz" where x,y,z are numbers
+ TQRegExp rx( "(\\\\)(\\d\\d\\d)" ); // matches "\xyz" where x,y,z are numbers
while((pos = rx.search( pdfstring )) != -1) {
- pdfstring = pdfstring.replace(pos, 4, QChar(rx.cap(2).toInt(0,8)));
+ pdfstring = pdfstring.replace(pos, 4, TQChar(rx.cap(2).toInt(0,8)));
}
rx.setPattern( "(\\\\)(\\d\\d)" ); // matches "\xy" where x,y are numbers
while((pos = rx.search( pdfstring )) != -1) {
- pdfstring = pdfstring.replace(pos, 3, QChar(rx.cap(2).toInt(0,8)));
+ pdfstring = pdfstring.replace(pos, 3, TQChar(rx.cap(2).toInt(0,8)));
}
rx.setPattern( "(\\\\)(\\d)" ); // matches "\x" where x is a number
while((pos = rx.search( pdfstring )) != -1) {
- pdfstring = pdfstring.replace(pos, 4, QChar(rx.cap(2).toInt(0,8)));
+ pdfstring = pdfstring.replace(pos, 4, TQChar(rx.cap(2).toInt(0,8)));
}
return pdfstring;
}