summaryrefslogtreecommitdiffstats
path: root/kexi/main/printing/kexisimpleprintingengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/main/printing/kexisimpleprintingengine.cpp')
-rw-r--r--kexi/main/printing/kexisimpleprintingengine.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/kexi/main/printing/kexisimpleprintingengine.cpp b/kexi/main/printing/kexisimpleprintingengine.cpp
index e021c912..34b8af21 100644
--- a/kexi/main/printing/kexisimpleprintingengine.cpp
+++ b/kexi/main/printing/kexisimpleprintingengine.cpp
@@ -29,13 +29,13 @@
#include <kurllabel.h>
#include <kdebug.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qcheckbox.h>
-#include <qwhatsthis.h>
-#include <qpaintdevicemetrics.h>
-#include <qimage.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
+#include <tqcheckbox.h>
+#include <tqwhatsthis.h>
+#include <tqpaintdevicemetrics.h>
+#include <tqimage.h>
#include <kexiutils/tristate.h>
#include <kexidb/connection.h>
@@ -51,7 +51,7 @@ KexiSimplePrintingSettings::KexiSimplePrintingSettings()
addDateAndTime = true;
addTableBorders = false;
pageTitleFont = kapp->font();
- pageTitleFont.setPointSizeFloat( (double)QFontInfo(pageTitleFont).pointSize()*1.5 );
+ pageTitleFont.setPointSizeFloat( (double)TQFontInfo(pageTitleFont).pointSize()*1.5 );
pageTitleFont.setBold(true);
}
@@ -71,7 +71,7 @@ KexiSimplePrintingSettings KexiSimplePrintingSettings::load()
if (config->hasKey("pageFormat"))
settings.pageLayout.format = KoPageFormat::formatFromString(
config->readEntry("pageFormat" ) );
- if (config->readEntry("pageOrientation", "portrait").lower()=="landscape")
+ if (config->readEntry("pageQt::Orientation", "portrait").lower()=="landscape")
settings.pageLayout.orientation = PG_LANDSCAPE;
else
settings.pageLayout.orientation = PG_PORTRAIT;
@@ -99,7 +99,7 @@ void KexiSimplePrintingSettings::save()
config->setGroup("Simple Printing");
config->writeEntry( "pageTitleFont", pageTitleFont );
config->writeEntry( "pageFormat", KoPageFormat::formatString( pageLayout.format ) );
- config->writeEntry("pageOrientation",
+ config->writeEntry("pageQt::Orientation",
pageLayout.orientation == PG_PORTRAIT ? "portrait" : "landscape");
config->writeEntry("pageWidth", pageLayout.ptWidth);
config->writeEntry("pageHeight", pageLayout.ptHeight);
@@ -116,8 +116,8 @@ void KexiSimplePrintingSettings::save()
//------------------------
KexiSimplePrintingEngine::KexiSimplePrintingEngine(
- const KexiSimplePrintingSettings& settings, QObject* parent)
- : QObject(parent, "KexiSimplePrintingEngine")
+ const KexiSimplePrintingSettings& settings, TQObject* tqparent)
+ : TQObject(tqparent, "KexiSimplePrintingEngine")
, m_settings(&settings)
, m_pdm(0)
{
@@ -134,9 +134,9 @@ KexiSimplePrintingEngine::~KexiSimplePrintingEngine()
}
bool KexiSimplePrintingEngine::init(KexiDB::Connection& conn,
- KexiDB::TableOrQuerySchema& tableOrQuery, const QString& titleText, QString& errorMessage)
+ KexiDB::TableOrQuerySchema& tableOrQuery, const TQString& titleText, TQString& errorMessage)
{
- errorMessage = QString::null;
+ errorMessage = TQString();
done();
m_headerText = titleText; //tableOrQuery.captionOrName();
@@ -199,7 +199,7 @@ void KexiSimplePrintingEngine::clear()
m_paintInitialized = false;
}
-void KexiSimplePrintingEngine::paintPage(int pageNumber, QPainter& painter, bool paint)
+void KexiSimplePrintingEngine::paintPage(int pageNumber, TQPainter& painter, bool paint)
{
uint offset = 0;
if (pageNumber < (int)m_dataOffsets.count()) {
@@ -208,19 +208,19 @@ void KexiSimplePrintingEngine::paintPage(int pageNumber, QPainter& painter, bool
double y = 0.0;
- const bool printing = painter.device()->devType() == QInternal::Printer;
+ const bool printing = painter.device()->devType() == TQInternal::Printer;
m_SCALE = printing ? 1 : 20;
double w, h;
- m_pdm = QPaintDeviceMetrics( painter.device() );
+ m_pdm = TQPaintDeviceMetrics( painter.device() );
- if (dynamic_cast<QWidget*>(painter.device())) {
- w = dynamic_cast<QWidget*>(painter.device())->width() * m_SCALE;
- h = dynamic_cast<QWidget*>(painter.device())->height() * m_SCALE;
+ if (dynamic_cast<TQWidget*>(painter.device())) {
+ w = dynamic_cast<TQWidget*>(painter.device())->width() * m_SCALE;
+ h = dynamic_cast<TQWidget*>(painter.device())->height() * m_SCALE;
}
- else if (dynamic_cast<QPixmap*>(painter.device())) {
- w = dynamic_cast<QPixmap*>(painter.device())->width() * m_SCALE;
- h = dynamic_cast<QPixmap*>(painter.device())->height() * m_SCALE;
+ else if (dynamic_cast<TQPixmap*>(painter.device())) {
+ w = dynamic_cast<TQPixmap*>(painter.device())->width() * m_SCALE;
+ h = dynamic_cast<TQPixmap*>(painter.device())->height() * m_SCALE;
}
else {//KPrinter...
w = m_pdm.widthMM();
@@ -237,7 +237,7 @@ void KexiSimplePrintingEngine::paintPage(int pageNumber, QPainter& painter, bool
m_dpiY = m_pdm.logicalDpiY();
m_dpiX = m_pdm.logicalDpiX();
-#ifdef Q_WS_WIN //fix for 120dpi
+#ifdef TQ_WS_WIN //fix for 120dpi
if (!printing) {
m_dpiY = 96;
m_dpiX = 96;
@@ -260,12 +260,12 @@ void KexiSimplePrintingEngine::paintPage(int pageNumber, QPainter& painter, bool
m_fy = heightMM / (pdHeightMM);// * screenF);
//screen only
- // painter.fillRect(QRect(0,0,w,h), QBrush(white));
+ // painter.fillRect(TQRect(0,0,w,h), TQBrush(white));
m_pageWidth = uint( m_fx*double(m_pdm.width()) * m_SCALE - m_leftMargin - m_rightMargin );
m_pageHeight = uint( m_fy*double(m_pdm.height()) * m_SCALE - m_topMargin - m_bottomMargin );
m_headerFont = m_settings->pageTitleFont;
if(!printing) {
- int pixelSize = int( POINT_TO_INCH((double)QFontInfo(m_headerFont).pointSize())*m_dpiX ) * m_SCALE;
+ int pixelSize = int( POINT_TO_INCH((double)TQFontInfo(m_headerFont).pointSize())*m_dpiX ) * m_SCALE;
m_headerFont.setPixelSize(pixelSize);
}
@@ -278,7 +278,7 @@ void KexiSimplePrintingEngine::paintPage(int pageNumber, QPainter& painter, bool
}
painter.setFont(m_mainFont);
- m_dateTimeText = KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(),
+ m_dateTimeText = KGlobal::locale()->formatDateTime(TQDateTime::tqcurrentDateTime(),
true, false);
m_dateTimeWidth = painter.fontMetrics().width(m_dateTimeText+" ");
m_mainLineSpacing = painter.fontMetrics().lineSpacing();
@@ -287,10 +287,10 @@ void KexiSimplePrintingEngine::paintPage(int pageNumber, QPainter& painter, bool
m_headerTextRect = painter.fontMetrics().boundingRect(
(int)m_leftMargin, (int)m_topMargin,
m_pageWidth - m_dateTimeWidth,
- m_pageHeight, Qt::AlignAuto|Qt::WordBreak, m_headerText);
+ m_pageHeight, TQt::AlignAuto|TQt::WordBreak, m_headerText);
m_headerTextRect.setRight(m_headerTextRect.right()+10);
m_headerTextRect.setWidth(
- QMIN(int(m_pageWidth - m_dateTimeWidth), m_headerTextRect.width()));
+ TQMIN(int(m_pageWidth - m_dateTimeWidth), m_headerTextRect.width()));
//--compute max width of field names
m_maxFieldNameWidth = 0;
@@ -315,24 +315,24 @@ void KexiSimplePrintingEngine::paintPage(int pageNumber, QPainter& painter, bool
//paint header
painter.setFont(m_headerFont);
if (paint) {
- painter.drawText(m_headerTextRect, Qt::AlignAuto|Qt::WordBreak, m_headerText);
+ painter.drawText(m_headerTextRect, TQt::AlignAuto|TQt::WordBreak, m_headerText);
}
painter.setFont(m_mainFont);
if (paint) {
painter.drawText((int)m_leftMargin + m_pageWidth - m_dateTimeWidth,
(int)m_topMargin, m_dateTimeWidth,
- m_headerTextRect.height(), Qt::AlignRight, m_dateTimeText);
+ m_headerTextRect.height(), TQt::AlignRight, m_dateTimeText);
//footer
- QString pageNumString;
+ TQString pageNumString;
if (m_pagesCount>0)
pageNumString = i18n("Page (number) of (total)", "Page %1 of %2")
- .arg(pageNumber+1).arg(m_pagesCount);
+ .tqarg(pageNumber+1).tqarg(m_pagesCount);
else
- pageNumString = i18n("Page %1").arg(pageNumber+1);
+ pageNumString = i18n("Page %1").tqarg(pageNumber+1);
painter.drawText((int)m_leftMargin,
(int)m_topMargin + m_pageHeight - m_mainLineSpacing,
m_pageWidth, m_mainLineSpacing,
- Qt::AlignRight | Qt::AlignBottom, pageNumString);
+ TQt::AlignRight | TQt::AlignBottom, pageNumString);
painter.drawLine((int)m_leftMargin,
(int)m_topMargin + m_pageHeight - m_mainLineSpacing*3/2,
(int)m_leftMargin + m_pageWidth,
@@ -387,16 +387,16 @@ void KexiSimplePrintingEngine::paintPage(int pageNumber, QPainter& painter, bool
m_eof = offset == rows;
}
-void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *item,
+void KexiSimplePrintingEngine::paintRecord(TQPainter& painter, KexiTableItem *item,
int cellMargin, double &y, uint paintedRows, bool paint, bool printing)
{
if (paintedRows>0 && !m_settings->addTableBorders) {//separator
if (paint) {
- painter.setPen(Qt::darkGray);
+ painter.setPen(TQt::darkGray);
painter.drawLine(
int(m_leftMargin), int( y-(double)m_mainLineSpacing ),
int(m_leftMargin)+m_pageWidth-1, int(y-(double)m_mainLineSpacing));
- painter.setPen(Qt::black);
+ painter.setPen(TQt::black);
}
}
@@ -405,10 +405,10 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
if (paint) {
painter.drawText(
(int)m_leftMargin+cellMargin, (int)y, m_maxFieldNameWidth-cellMargin*2, m_mainLineSpacing,
- Qt::AlignTop, m_fieldsExpanded[i]->captionOrAliasOrName()
+ TQt::AlignTop, m_fieldsExpanded[i]->captionOrAliasOrName()
+ (m_settings->addTableBorders ? "" : ":"));
}
- QString text;
+ TQString text;
//! @todo optimize like in KexiCSVExport::exportData()
//get real column and real index to get the visible value
KexiDB::QueryColumnInfo* ci;
@@ -420,9 +420,9 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
indexForVisibleLookupValue = i;
}
- QVariant v(item->at( indexForVisibleLookupValue ));
+ TQVariant v(item->at( indexForVisibleLookupValue ));
KexiDB::Field::Type ftype = ci->field->type();
- QRect rect( (int)m_leftMargin + m_maxFieldNameWidth + cellMargin, (int)y,
+ TQRect rect( (int)m_leftMargin + m_maxFieldNameWidth + cellMargin, (int)y,
m_pageWidth - m_maxFieldNameWidth - cellMargin*2, m_pageHeight - (int)y);
if (v.isNull() || !v.isValid()) {
@@ -430,19 +430,19 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
}
//! todo inherit format
else if (ftype==KexiDB::Field::DateTime) {
- QDateTime dt(v.toDateTime());
+ TQDateTime dt(v.toDateTime());
if (dt.isValid())
text = KGlobal::locale()->formatDateTime(dt);
}
//! todo inherit format
else if (ftype==KexiDB::Field::Date) {
- QDate date(v.toDate());
+ TQDate date(v.toDate());
if (date.isValid())
text = KGlobal::locale()->formatDate(date, true/*short*/);
}
//! todo inherit format
else if (ftype==KexiDB::Field::Time) {
- QTime time(v.toTime());
+ TQTime time(v.toTime());
if (time.isValid())
text = KGlobal::locale()->formatTime(time);
}
@@ -453,9 +453,9 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
text = v.toBool()
? i18n("Boolean Yes (true)","Yes") : i18n("Boolean No (false)", "No");
else if (ftype==KexiDB::Field::BLOB) {
- const QByteArray ba( v.toByteArray() );
+ const TQByteArray ba( v.toByteArray() );
if (!ba.isEmpty()) {
- QPixmap pixmap(ba);
+ TQPixmap pixmap(ba);
#define MAX_PIXMAP_HEIGHT (m_mainLineSpacing * 5)
double pixmapHeight = MAX_PIXMAP_HEIGHT;
double pixmapWidth = double(MAX_PIXMAP_HEIGHT) * pixmap.width() / (double)pixmap.height();
@@ -467,21 +467,21 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
if (paint && !pixmap.isNull()) {
if (printing) {
painter.drawPixmap(
- QRect(rect.x(), rect.y()+m_mainLineSpacing/4,
+ TQRect(rect.x(), rect.y()+m_mainLineSpacing/4,
int(pixmapWidth), int(pixmapHeight)), pixmap );
}
else {// we're just previewing the pixmap, so let's resize it and cache
// so redrawing will be faster
painter.save();
painter.setWindow( // set 1:1 scale to avoid unnecessary image scaling
- QRect(painter.window().topLeft(),
+ TQRect(painter.window().topLeft(),
painter.window().size() / (int)m_SCALE ) );
painter.drawImage(
int(rect.x() / m_SCALE),
int( (rect.y()+m_mainLineSpacing/4) / m_SCALE),
pixmap.convertToImage().smoothScale(
int(pixmapWidth / m_SCALE), int(pixmapHeight / m_SCALE),
- QImage::ScaleMin ));
+ TQ_ScaleMin ));
painter.restore(); // back to m_SCALE:1 scale
}
}
@@ -491,9 +491,9 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
text = v.toString();
if (ftype!=KexiDB::Field::BLOB || v.isNull() || !v.isValid())
- rect = QRect( painter.fontMetrics().boundingRect(
+ rect = TQRect( painter.fontMetrics().boundingRect(
rect.x(), rect.y(), rect.width(), rect.height(),
- Qt::AlignAuto|Qt::WordBreak, text) );
+ TQt::AlignAuto|TQt::WordBreak, text) );
if (!text.isEmpty() && paint) {
// kdDebug() << "print engine: painter.drawText: "
// << rect.x() <<" "<< rect.y() <<" "<< m_pageWidth - m_maxFieldNameWidth - cellMargin*2
@@ -502,11 +502,11 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
// rect.x(), rect.y(), rect.width(), rect.height(),
rect.x(), rect.y(), m_pageWidth - m_maxFieldNameWidth - cellMargin*2,
int(m_topMargin + m_pageHeight - (int)y),
- Qt::AlignTop|Qt::WordBreak, text);
+ TQt::AlignTop|TQt::WordBreak, text);
}
if (m_settings->addTableBorders) {
if (paint) {
- painter.setPen(Qt::darkGray);
+ painter.setPen(TQt::darkGray);
painter.drawLine(
(int)m_leftMargin, rect.top(), (int)m_leftMargin+m_pageWidth-1, rect.top());
painter.drawLine(
@@ -517,17 +517,17 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
painter.drawLine(
(int)m_leftMargin+m_maxFieldNameWidth, rect.top(),
(int)m_leftMargin+m_maxFieldNameWidth, rect.bottom());
- painter.setPen(Qt::black);
+ painter.setPen(TQt::black);
}
}
y += (double)rect.height();
}
if (m_settings->addTableBorders) {
if (paint) {
- painter.setPen(Qt::darkGray);
+ painter.setPen(TQt::darkGray);
painter.drawLine(
(int)m_leftMargin, (int)y, (int)m_leftMargin+m_pageWidth-1, (int)y);
- painter.setPen(Qt::black);
+ painter.setPen(TQt::black);
}
}
//record spacing
@@ -536,7 +536,7 @@ void KexiSimplePrintingEngine::paintRecord(QPainter& painter, KexiTableItem *ite
// y -= m_mainLineSpacing; //a bit less
}
-void KexiSimplePrintingEngine::calculatePagesCount(QPainter& painter)
+void KexiSimplePrintingEngine::calculatePagesCount(TQPainter& painter)
{
if (m_eof || !m_data) {
m_pagesCount = 0;
@@ -550,7 +550,7 @@ void KexiSimplePrintingEngine::calculatePagesCount(QPainter& painter)
m_pagesCount = pageNumber;
}
-void KexiSimplePrintingEngine::setTitleText(const QString& titleText)
+void KexiSimplePrintingEngine::setTitleText(const TQString& titleText)
{
m_headerText = titleText;
}