summaryrefslogtreecommitdiffstats
path: root/src/gvcore/document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gvcore/document.cpp')
-rw-r--r--src/gvcore/document.cpp152
1 files changed, 76 insertions, 76 deletions
diff --git a/src/gvcore/document.cpp b/src/gvcore/document.cpp
index 14a6410..3069ae5 100644
--- a/src/gvcore/document.cpp
+++ b/src/gvcore/document.cpp
@@ -21,12 +21,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <sys/stat.h> // For S_ISDIR
-// Qt
-#include <qfileinfo.h>
-#include <qguardedptr.h>
-#include <qpaintdevicemetrics.h>
-#include <qpainter.h>
-#include <qwmatrix.h>
+// TQt
+#include <tqfileinfo.h>
+#include <tqguardedptr.h>
+#include <tqpaintdevicemetrics.h>
+#include <tqpainter.h>
+#include <tqwmatrix.h>
// KDE
#include <kapplication.h>
@@ -73,9 +73,9 @@ const char* CONFIG_SAVE_AUTOMATICALLY="save automatically";
/**
- * Returns a widget suitable to use as a dialog parent
+ * Returns a widget suitable to use as a dialog tqparent
*/
-static QWidget* dialogParentWidget() {
+static TQWidget* dialogParentWidget() {
return KApplication::kApplication()->mainWidget();
}
@@ -88,11 +88,11 @@ class DocumentPrivate {
public:
KURL mURL;
bool mModified;
- QImage mImage;
- QString mMimeType;
- QCString mImageFormat;
+ TQImage mImage;
+ TQString mMimeType;
+ TQCString mImageFormat;
DocumentImpl* mImpl;
- QGuardedPtr<KIO::StatJob> mStatJob;
+ TQGuardedPtr<KIO::StatJob> mStatJob;
int mFileSize;
};
@@ -102,8 +102,8 @@ public:
// Document
//
//-------------------------------------------------------------------
-Document::Document(QObject* parent)
-: QObject(parent) {
+Document::Document(TQObject* tqparent)
+: TQObject(tqparent) {
d=new DocumentPrivate;
d->mModified=false;
d->mImpl=new DocumentEmptyImpl(this);
@@ -114,9 +114,9 @@ Document::Document(QObject* parent)
KImageIO::registerFormats();
XCFImageFormat::registerFormat();
- // First load Qt's plugins, so that Gwenview's decoders that
+ // First load TQt's plugins, so that Gwenview's decoders that
// override some of them are installed later and thus come first.
- QImageIO::inputFormats();
+ TQImageIO::inputFormats();
{
static Gwenview::JPEGFormatType sJPEGFormatType;
static Gwenview::PNGFormatType sPNGFormatType;
@@ -125,10 +125,10 @@ Document::Document(QObject* parent)
static Gwenview::XCursorFormatType sXCursorFormatType;
}
- connect( this, SIGNAL( loading()),
- this, SLOT( slotLoading()));
- connect( this, SIGNAL( loaded(const KURL&)),
- this, SLOT( slotLoaded()));
+ connect( this, TQT_SIGNAL( loading()),
+ this, TQT_SLOT( slotLoading()));
+ connect( this, TQT_SIGNAL( loaded(const KURL&)),
+ this, TQT_SLOT( slotLoaded()));
}
@@ -143,11 +143,11 @@ Document::~Document() {
// Properties
//
//---------------------------------------------------------------------
-QString Document::mimeType() const {
+TQString Document::mimeType() const {
return d->mMimeType;
}
-void Document::setMimeType(const QString& mimeType) {
+void Document::setMimeType(const TQString& mimeType) {
d->mMimeType = mimeType;
}
@@ -188,7 +188,7 @@ void Document::setURL(const KURL& paramURL) {
// Fix wrong protocol
if (Archive::protocolIsArchive(localURL.protocol())) {
- QFileInfo info(localURL.path());
+ TQFileInfo info(localURL.path());
if (info.exists()) {
localURL.setProtocol("file");
}
@@ -197,8 +197,8 @@ void Document::setURL(const KURL& paramURL) {
d->mURL = localURL; // this may be fixed after stat() is complete, but set at least something
d->mStatJob = KIO::stat( localURL, !localURL.isLocalFile() );
d->mStatJob->setWindow(KApplication::kApplication()->mainWidget());
- connect( d->mStatJob, SIGNAL( result (KIO::Job *) ),
- this, SLOT( slotStatResult (KIO::Job *) ) );
+ connect( d->mStatJob, TQT_SIGNAL( result (KIO::Job *) ),
+ this, TQT_SLOT( slotStatResult (KIO::Job *) ) );
}
@@ -242,11 +242,11 @@ void Document::setDirURL(const KURL& paramURL) {
}
-const QImage& Document::image() const {
+const TQImage& Document::image() const {
return d->mImage;
}
-void Document::setImage(QImage img) {
+void Document::setImage(TQImage img) {
bool sizechange = d->mImage.size() != img.size();
d->mImage = img;
if( sizechange ) emit sizeUpdated();
@@ -263,15 +263,15 @@ KURL Document::dirURL() const {
}
}
-QString Document::filename() const {
+TQString Document::filename() const {
return d->mURL.filename(false);
}
-const QCString& Document::imageFormat() const {
+const TQCString& Document::imageFormat() const {
return d->mImageFormat;
}
-void Document::setImageFormat(const QCString& format) {
+void Document::setImageFormat(const TQCString& format) {
d->mImageFormat=format;
}
@@ -279,27 +279,27 @@ void Document::setFileSize(int size) {
d->mFileSize=size;
}
-QString Document::comment() const {
+TQString Document::comment() const {
return d->mImpl->comment();
}
-QString Document::aperture() const {
+TQString Document::aperture() const {
return d->mImpl->aperture();
}
-QString Document::exposureTime() const {
+TQString Document::exposureTime() const {
return d->mImpl->exposureTime();
}
-QString Document::iso() const {
+TQString Document::iso() const {
return d->mImpl->iso();
}
-QString Document::focalLength() const {
+TQString Document::focalLength() const {
return d->mImpl->focalLength();
}
-void Document::setComment(const QString& comment) {
+void Document::setComment(const TQString& comment) {
d->mImpl->setComment(comment);
d->mModified=true;
emit modified();
@@ -343,43 +343,43 @@ void Document::slotLoaded() {
//
//---------------------------------------------------------------------
void Document::reload() {
- Cache::instance()->invalidate( url());
+ Cache::instance()->tqinvalidate( url());
load();
emit reloaded(url());
}
void Document::print(KPrinter *pPrinter) {
- QPainter printPainter;
+ TQPainter printPainter;
printPainter.begin(pPrinter);
doPaint(pPrinter, &printPainter);
printPainter.end();
}
-void Document::doPaint(KPrinter *printer, QPainter *painter) {
+void Document::doPaint(KPrinter *printer, TQPainter *painter) {
// will contain the final image to print
- QImage image = d->mImage;
+ TQImage image = d->mImage;
image.detach();
- // We use a QPaintDeviceMetrics to know the actual page size in pixel,
+ // We use a TQPaintDeviceMetrics to know the actual page size in pixel,
// this gives the real painting area
- QPaintDeviceMetrics pdMetrics(painter->device());
+ TQPaintDeviceMetrics pdMetrics(painter->device());
const int margin = pdMetrics.logicalDpiY() / 2; // half-inch margin
painter->setFont( KGlobalSettings::generalFont() );
- QFontMetrics fMetrics = painter->fontMetrics();
+ TQFontMetrics fMetrics = painter->fontMetrics();
int x = 0;
int y = 0;
int pdWidth = pdMetrics.width();
int pdHeight = pdMetrics.height();
- QString t = "true";
- QString f = "false";
+ TQString t = "true";
+ TQString f = "false";
- int alignment = (printer->option("app-gwenview-position").isEmpty() ?
- Qt::AlignCenter : printer->option("app-gwenview-position").toInt());
+ int tqalignment = (printer->option("app-gwenview-position").isEmpty() ?
+ TQt::AlignCenter : printer->option("app-gwenview-position").toInt());
// Compute filename offset
int filenameOffset = 0;
@@ -403,11 +403,11 @@ void Document::doPaint(KPrinter *printer, QPainter *painter) {
// Apply scaling
int scaling = printer->option( "app-gwenview-scale" ).toInt();
- QSize size = image.size();
+ TQSize size = image.size();
if (scaling==GV_FITTOPAGE /* Fit to page */) {
bool enlargeToFit = printer->option( "app-gwenview-enlargeToFit" ) != f;
if ((image.width() > pdWidth || image.height() > pdHeight) || enlargeToFit) {
- size.scale( pdWidth, pdHeight, QSize::ScaleMin );
+ size.tqscale( pdWidth, pdHeight, TQSize::ScaleMin );
}
} else {
if (scaling==GV_SCALE /* Scale To */) {
@@ -445,38 +445,38 @@ void Document::doPaint(KPrinter *printer, QPainter *painter) {
if (size.width() > pdWidth || size.height() > pdHeight) {
int resp = KMessageBox::warningYesNoCancel(dialogParentWidget(),
i18n("The image will not fit on the page, what do you want to do?"),
- QString::null,KStdGuiItem::cont(),
+ TQString(),KStdGuiItem::cont(),
i18n("Shrink") );
if (resp==KMessageBox::Cancel) {
printer->abort();
return;
} else if (resp == KMessageBox::No) { // Shrink
- size.scale(pdWidth, pdHeight, QSize::ScaleMin);
+ size.tqscale(pdWidth, pdHeight, TQSize::ScaleMin);
}
}
}
// Compute x and y
- if ( alignment & Qt::AlignHCenter )
+ if ( tqalignment & TQt::AlignHCenter )
x = (pdWidth - size.width())/2;
- else if ( alignment & Qt::AlignLeft )
+ else if ( tqalignment & TQt::AlignLeft )
x = 0;
- else if ( alignment & Qt::AlignRight )
+ else if ( tqalignment & TQt::AlignRight )
x = pdWidth - size.width();
- if ( alignment & Qt::AlignVCenter )
+ if ( tqalignment & TQt::AlignVCenter )
y = (pdHeight - size.height())/2;
- else if ( alignment & Qt::AlignTop )
+ else if ( tqalignment & TQt::AlignTop )
y = 0;
- else if ( alignment & Qt::AlignBottom )
+ else if ( tqalignment & TQt::AlignBottom )
y = pdHeight - size.height();
// Draw, the image will be scaled to fit the given area if necessary
- painter->drawImage( QRect( x, y, size.width(), size.height()), image );
+ painter->drawImage( TQRect( x, y, size.width(), size.height()), image );
if ( printFilename ) {
- QString fname = KStringHandler::cPixelSqueeze( filename(), fMetrics, pdWidth );
+ TQString fname = KStringHandler::cPixelSqueeze( filename(), fMetrics, pdWidth );
if ( !fname.isEmpty() ) {
int fw = fMetrics.width( fname );
int x = (pdWidth - fw)/2;
@@ -485,7 +485,7 @@ void Document::doPaint(KPrinter *printer, QPainter *painter) {
}
}
if ( printComment ) {
- QString comm = comment();
+ TQString comm = comment();
if ( !comm.isEmpty() ) {
int fw = fMetrics.width( comm );
int x = (pdWidth - fw)/2;
@@ -504,7 +504,7 @@ void Document::transform(ImageUtils::Orientation orientation) {
void Document::save() {
- QString msg=saveInternal(url(), d->mImageFormat);
+ TQString msg=saveInternal(url(), d->mImageFormat);
if (!msg.isNull()) {
KMessageBox::error(dialogParentWidget(), msg);
// If it can't be saved we leave it as modified, because user
@@ -520,7 +520,7 @@ void Document::saveAs() {
dialog.setSelection(url().fileName());
if (!dialog.exec()) return;
- QString msg=saveInternal(saveURL, dialog.imageFormat() );
+ TQString msg=saveInternal(saveURL, dialog.imageFormat() );
if (!msg.isNull()) {
// If it can't be saved we leave it as modified, because user
// could choose a wrong readonly path from dialog and retry to
@@ -531,10 +531,10 @@ void Document::saveAs() {
void Document::saveBeforeClosing() {
if (!d->mModified) return;
- QString msg=i18n("<qt>The image <b>%1</b> has been modified, do you want to save the changes?</qt>")
- .arg(url().prettyURL());
+ TQString msg=i18n("<qt>The image <b>%1</b> has been modified, do you want to save the changes?</qt>")
+ .tqarg(url().prettyURL());
- int result=KMessageBox::questionYesNo(dialogParentWidget(), msg, QString::null,
+ int result=KMessageBox::questionYesNo(dialogParentWidget(), msg, TQString(),
KStdGuiItem::save(), KStdGuiItem::discard(), CONFIG_SAVE_AUTOMATICALLY);
if (result == KMessageBox::Yes) {
@@ -561,12 +561,12 @@ void Document::switchToImpl(DocumentImpl* impl) {
delete d->mImpl;
d->mImpl=impl;
- connect(d->mImpl, SIGNAL(finished(bool)),
- this, SLOT(slotFinished(bool)) );
- connect(d->mImpl, SIGNAL(sizeUpdated()),
- this, SIGNAL(sizeUpdated()) );
- connect(d->mImpl, SIGNAL(rectUpdated(const QRect&)),
- this, SIGNAL(rectUpdated(const QRect&)) );
+ connect(d->mImpl, TQT_SIGNAL(finished(bool)),
+ this, TQT_SLOT(slotFinished(bool)) );
+ connect(d->mImpl, TQT_SIGNAL(sizeUpdated()),
+ this, TQT_SIGNAL(sizeUpdated()) );
+ connect(d->mImpl, TQT_SIGNAL(rectUpdated(const TQRect&)),
+ this, TQT_SIGNAL(rectUpdated(const TQRect&)) );
d->mImpl->init();
}
@@ -594,18 +594,18 @@ void Document::slotFinished(bool success) {
}
-QString Document::saveInternal(const KURL& url, const QCString& format) {
- QString msg=d->mImpl->save(url, format);
+TQString Document::saveInternal(const KURL& url, const TQCString& format) {
+ TQString msg=d->mImpl->save(url, format);
if (msg.isNull()) {
emit saved(url);
d->mModified=false;
- return QString::null;
+ return TQString();
}
LOG("Save failed: " << msg);
- return QString("<qt><b>%1</b><br/>")
- .arg(i18n("Could not save the image to %1.").arg(url.prettyURL()))
+ return TQString("<qt><b>%1</b><br/>")
+ .tqarg(i18n("Could not save the image to %1.").tqarg(url.prettyURL()))
+ msg + "</qt>";
}