diff options
Diffstat (limited to 'kexi/main/printing/kexisimpleprintpreviewwindow.cpp')
-rw-r--r-- | kexi/main/printing/kexisimpleprintpreviewwindow.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/kexi/main/printing/kexisimpleprintpreviewwindow.cpp b/kexi/main/printing/kexisimpleprintpreviewwindow.cpp index 4ba487d9..960a23b2 100644 --- a/kexi/main/printing/kexisimpleprintpreviewwindow.cpp +++ b/kexi/main/printing/kexisimpleprintpreviewwindow.cpp @@ -22,10 +22,10 @@ #include "kexisimpleprintpreviewwindow_p.h" #include <kexi_version.h> -#include <qlayout.h> -#include <qaccel.h> -#include <qtimer.h> -#include <qlabel.h> +#include <tqlayout.h> +#include <tqaccel.h> +#include <tqtimer.h> +#include <tqlabel.h> #include <kdialogbase.h> #include <ktoolbarbutton.h> @@ -36,8 +36,8 @@ #include <kapplication.h> KexiSimplePrintPreviewView::KexiSimplePrintPreviewView( - QWidget *parent, KexiSimplePrintPreviewWindow *window) - : QWidget(parent, "KexiSimplePrintPreviewView", WStaticContents)//|WNoAutoErase) + TQWidget *tqparent, KexiSimplePrintPreviewWindow *window) + : TQWidget(tqparent, "KexiSimplePrintPreviewView", WStaticContents)//|WNoAutoErase) , m_window(window) { enablePainting = false; @@ -45,16 +45,16 @@ KexiSimplePrintPreviewView::KexiSimplePrintPreviewView( // resizeContents(200, 400); } -void KexiSimplePrintPreviewView::paintEvent( QPaintEvent *pe ) +void KexiSimplePrintPreviewView::paintEvent( TQPaintEvent *pe ) { Q_UNUSED(pe); if (!enablePainting) return; - QPixmap pm(size()); //dbl buffered - QPainter p; - p.begin(&pm, this); + TQPixmap pm(size()); //dbl buffered + TQPainter p; + p.tqbegin(TQT_TQPAINTDEVICE(&pm), this); //! @todo only for screen! - p.fillRect(QRect(QPoint(0,0),pm.size()), QBrush(white));//pe->rect(), QBrush(white)); + p.fillRect(TQRect(TQPoint(0,0),pm.size()), TQBrush(white));//pe->rect(), TQBrush(white)); if (m_window->currentPage()>=0) m_window->m_engine.paintPage(m_window->currentPage(), p); // emit m_window->paintingPageRequested(m_window->currentPage(), p); @@ -68,7 +68,7 @@ void KexiSimplePrintPreviewView::paintEvent( QPaintEvent *pe ) KexiSimplePrintPreviewScrollView::KexiSimplePrintPreviewScrollView( KexiSimplePrintPreviewWindow *window) - : QScrollView(window, "scrollview", WStaticContents|WNoAutoErase) + : TQScrollView(window, "scrollview", WStaticContents|WNoAutoErase) , m_window(window) { // this->settings = settings; @@ -84,9 +84,9 @@ KexiSimplePrintPreviewScrollView::KexiSimplePrintPreviewScrollView( addChild(widget); } -void KexiSimplePrintPreviewScrollView::resizeEvent( QResizeEvent *re ) +void KexiSimplePrintPreviewScrollView::resizeEvent( TQResizeEvent *re ) { - QScrollView::resizeEvent(re); + TQScrollView::resizeEvent(re); // kdDebug() << re->size().width() << " " << re->size().height() << endl; // kdDebug() << contentsWidth() << " " << contentsHeight() << endl; // kdDebug() << widget->width() << " " << widget->height() << endl; @@ -95,13 +95,13 @@ void KexiSimplePrintPreviewScrollView::resizeEvent( QResizeEvent *re ) || re->size().height() > (widget->height()+2*KexiSimplePrintPreviewScrollView_MARGIN)) { resizeContents( - QMAX(re->size().width(), widget->width()+2*KexiSimplePrintPreviewScrollView_MARGIN), - QMAX(re->size().height(), widget->height()+2*KexiSimplePrintPreviewScrollView_MARGIN)); + TQMAX(re->size().width(), widget->width()+2*KexiSimplePrintPreviewScrollView_MARGIN), + TQMAX(re->size().height(), widget->height()+2*KexiSimplePrintPreviewScrollView_MARGIN)); int vscrbarWidth = verticalScrollBar()->isVisible() ? verticalScrollBar()->width() : 0; int newContentsWidth - = QMAX(re->size().width(), widget->width()+2*KexiSimplePrintPreviewScrollView_MARGIN); + = TQMAX(re->size().width(), widget->width()+2*KexiSimplePrintPreviewScrollView_MARGIN); int newContentsHeight - = QMAX(re->size().height(), widget->height()+2*KexiSimplePrintPreviewScrollView_MARGIN); + = TQMAX(re->size().height(), widget->height()+2*KexiSimplePrintPreviewScrollView_MARGIN); moveChild(widget, (newContentsWidth - vscrbarWidth - widget->width())/2, (newContentsHeight - widget->height())/2); resizeContents( newContentsWidth, newContentsHeight ); @@ -120,10 +120,10 @@ void KexiSimplePrintPreviewScrollView::setFullWidth() // int constantWidth = m_window->width()- KexiSimplePrintPreviewScrollView_MARGIN*6; double constantWidth = width()- KexiSimplePrintPreviewScrollView_MARGIN*6; double heightForWidth = constantWidth * heightMM / widthMM; -// heightForWidth = QMIN(kapp->desktop()->height()*4/5, heightForWidth); +// heightForWidth = TQMIN(kapp->desktop()->height()*4/5, heightForWidth); kdDebug() << "1: " << heightForWidth << endl; #if 0 //todo we can use this if we want to fix the height to width of the page - heightForWidth = QMIN(height(), heightForWidth); + heightForWidth = TQMIN(height(), heightForWidth); kdDebug() << "2: " << heightForWidth << endl; #endif constantWidth = heightForWidth * widthMM / heightMM; @@ -133,9 +133,9 @@ void KexiSimplePrintPreviewScrollView::setFullWidth() moveChild(widget, (contentsWidth()-widget->width())/2, (contentsHeight()-widget->height())/2); viewport()->setUpdatesEnabled(true); - resize(size()+QSize(1,1)); //to update pos. + resize(size()+TQSize(1,1)); //to update pos. widget->enablePainting = true; - widget->repaint(); + widget->tqrepaint(); } void KexiSimplePrintPreviewScrollView::setContentsPos(int x, int y) @@ -143,65 +143,65 @@ void KexiSimplePrintPreviewScrollView::setContentsPos(int x, int y) // kdDebug() << "############" << x << " " << y << " " << contentsX()<< " " <<contentsY() << endl; if (x<0 || y<0) //to avoid endless loop on Linux return; - QScrollView::setContentsPos(x,y); + TQScrollView::setContentsPos(x,y); } //------------------ KexiSimplePrintPreviewWindow::KexiSimplePrintPreviewWindow( - KexiSimplePrintingEngine &engine, const QString& previewName, - QWidget *parent, WFlags f) - : QWidget(parent, "KexiSimplePrintPreviewWindow", f) + KexiSimplePrintingEngine &engine, const TQString& previewName, + TQWidget *tqparent, WFlags f) + : TQWidget(tqparent, "KexiSimplePrintPreviewWindow", f) , m_engine(engine) , m_settings(*m_engine.settings()) , m_pageNumber(-1) , m_pagesCount(-1) { - setCaption(i18n("%1 - Print Preview - %2").arg(previewName).arg(KEXI_APP_NAME)); + setCaption(i18n("%1 - Print Preview - %2").tqarg(previewName).tqarg(KEXI_APP_NAME)); setIcon(DesktopIcon("filequickprint")); - QVBoxLayout *lyr = new QVBoxLayout(this, 6); + TQVBoxLayout *lyr = new TQVBoxLayout(this, 6); int id; m_toolbar = new KToolBar(0, this); m_toolbar->setLineWidth(0); - m_toolbar->setFrameStyle(QFrame::NoFrame); + m_toolbar->setFrameStyle(TQFrame::NoFrame); m_toolbar->setIconText(KToolBar::IconTextRight); lyr->addWidget(m_toolbar); id = m_toolbar->insertWidget( -1, 0, new KPushButton(KStdGuiItem::print(), m_toolbar) ); - m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotPrintClicked())); - static_cast<KPushButton*>(m_toolbar->getWidget(id))->setAccel(Qt::CTRL|Qt::Key_P); + m_toolbar->addConnection(id, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotPrintClicked())); + static_cast<KPushButton*>(m_toolbar->getWidget(id))->setAccel(TQt::CTRL|TQt::Key_P); m_toolbar->insertSeparator(); id = m_toolbar->insertWidget(-1, 0, new KPushButton(i18n("Page Set&up..."), m_toolbar)); - m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotPageSetup())); + m_toolbar->addConnection(id, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotPageSetup())); m_toolbar->insertSeparator(); #ifndef KEXI_NO_UNFINISHED //! @todo unfinished id = m_toolbar->insertWidget( -1, 0, new KPushButton(BarIconSet("viewmag+"), i18n("Zoom In"), m_toolbar)); - m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotZoomInClicked())); + m_toolbar->addConnection(id, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotZoomInClicked())); m_toolbar->insertSeparator(); id = m_toolbar->insertWidget( -1, 0, new KPushButton(BarIconSet("viewmag-"), i18n("Zoom Out"), m_toolbar)); - m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(slotZoomOutClicked())); + m_toolbar->addConnection(id, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotZoomOutClicked())); m_toolbar->insertSeparator(); #endif id = m_toolbar->insertWidget(-1, 0, new KPushButton(KStdGuiItem::close(), m_toolbar)); - m_toolbar->addConnection(id, SIGNAL(clicked()), this, SLOT(close())); + m_toolbar->addConnection(id, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(close())); m_toolbar->alignItemRight(id); m_scrollView = new KexiSimplePrintPreviewScrollView(this); m_scrollView->setUpdatesEnabled(false); m_view = m_scrollView->widget; - m_scrollView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + m_scrollView->tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Minimum); lyr->addWidget(m_scrollView); - QWidget* navToolbarWidget = new QWidget(this); //widget used to center the navigator toolbar - navToolbarWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - QHBoxLayout *navToolbarLyr = new QHBoxLayout(navToolbarWidget); + TQWidget* navToolbarWidget = new TQWidget(this); //widget used to center the navigator toolbar + navToolbarWidget->tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Fixed); + TQHBoxLayout *navToolbarLyr = new TQHBoxLayout(navToolbarWidget); lyr->addWidget(navToolbarWidget); m_navToolbar = new KToolBar(0, navToolbarWidget); @@ -210,33 +210,33 @@ KexiSimplePrintPreviewWindow::KexiSimplePrintPreviewWindow( navToolbarLyr->addStretch(1); // m_navToolbar->setFullWidth(true); m_navToolbar->setLineWidth(0); - m_navToolbar->setFrameStyle(QFrame::NoFrame); + m_navToolbar->setFrameStyle(TQFrame::NoFrame); m_navToolbar->setIconText(KToolBar::IconTextRight); m_idFirst = m_navToolbar->insertWidget( -1, 0, new KPushButton(BarIconSet("start"), i18n("First Page"), m_navToolbar)); - m_navToolbar->addConnection(m_idFirst, SIGNAL(clicked()), this, SLOT(slotFirstClicked())); + m_navToolbar->addConnection(m_idFirst, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotFirstClicked())); m_navToolbar->insertSeparator(); m_idPrevious = m_navToolbar->insertWidget( -1, 0, new KPushButton(BarIconSet("previous"), i18n("Previous Page"), m_navToolbar)); - m_navToolbar->addConnection(m_idPrevious, SIGNAL(clicked()), this, SLOT(slotPreviousClicked())); + m_navToolbar->addConnection(m_idPrevious, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotPreviousClicked())); m_navToolbar->insertSeparator(); - m_idPageNumberLabel = m_navToolbar->insertWidget( -1, 0, new QLabel(m_navToolbar)); + m_idPageNumberLabel = m_navToolbar->insertWidget( -1, 0, new TQLabel(m_navToolbar)); m_navToolbar->insertSeparator(); m_idNext = m_navToolbar->insertWidget( -1, 0, new KPushButton(BarIconSet("next"), i18n("Next Page"), m_navToolbar)); - m_navToolbar->addConnection(m_idNext, SIGNAL(clicked()), this, SLOT(slotNextClicked())); + m_navToolbar->addConnection(m_idNext, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotNextClicked())); m_navToolbar->insertSeparator(); m_idLast = m_navToolbar->insertWidget( -1, 0, new KPushButton(BarIconSet("finish"), i18n("Last Page"), m_navToolbar)); - m_navToolbar->addConnection(m_idLast, SIGNAL(clicked()), this, SLOT(slotLastClicked())); + m_navToolbar->addConnection(m_idLast, TQT_SIGNAL(clicked()), TQT_TQOBJECT(this), TQT_SLOT(slotLastClicked())); m_navToolbar->insertSeparator(); resize(width(), kapp->desktop()->height()*4/5); //! @todo progress bar... - QTimer::singleShot(50, this, SLOT(initLater())); + TQTimer::singleShot(50, TQT_TQOBJECT(this), TQT_SLOT(initLater())); } void KexiSimplePrintPreviewWindow::initLater() @@ -308,14 +308,14 @@ void KexiSimplePrintPreviewWindow::goToPage(int pageNumber) m_pageNumber = pageNumber; m_pagesCount = m_engine.pagesCount(); - m_view->repaint(); //this will automatically paint a new page + m_view->tqrepaint(); //this will automatically paint a new page m_navToolbar->setItemEnabled(m_idNext, pageNumber < ((int)m_engine.pagesCount()-1)); m_navToolbar->setItemEnabled(m_idLast, pageNumber < ((int)m_engine.pagesCount()-1)); m_navToolbar->setItemEnabled(m_idPrevious, pageNumber > 0); m_navToolbar->setItemEnabled(m_idFirst, pageNumber > 0); - static_cast<QLabel*>(m_navToolbar->getWidget(m_idPageNumberLabel))->setText( - i18n("Page (number) of (total)", "Page %1 of %2").arg(m_pageNumber+1).arg(m_engine.pagesCount())); + static_cast<TQLabel*>(m_navToolbar->getWidget(m_idPageNumberLabel))->setText( + i18n("Page (number) of (total)", "Page %1 of %2").tqarg(m_pageNumber+1).tqarg(m_engine.pagesCount())); } void KexiSimplePrintPreviewWindow::setFullWidth() @@ -325,29 +325,29 @@ void KexiSimplePrintPreviewWindow::setFullWidth() void KexiSimplePrintPreviewWindow::updatePagesCount() { - QPixmap pm(m_view->size()); //dbl buffered - QPainter p(m_view); + TQPixmap pm(m_view->size()); //dbl buffered + TQPainter p(m_view); //p.begin(&pm, this); ////! @todo only for screen! -// p.fillRect(pe->rect(), QBrush(white)); +// p.fillRect(pe->rect(), TQBrush(white)); m_engine.calculatePagesCount(p); p.end(); } -bool KexiSimplePrintPreviewWindow::event( QEvent * e ) +bool KexiSimplePrintPreviewWindow::event( TQEvent * e ) { - QEvent::Type t = e->type(); - if (t==QEvent::KeyPress) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + TQEvent::Type t = e->type(); + if (t==TQEvent::KeyPress) { + TQKeyEvent *ke = TQT_TQKEYEVENT(e); const int k = ke->key(); bool ok = true; - if (k==Qt::Key_Equal || k==Qt::Key_Plus) + if (k==TQt::Key_Equal || k==TQt::Key_Plus) slotZoomInClicked(); - else if (k==Qt::Key_Minus) + else if (k==TQt::Key_Minus) slotZoomOutClicked(); - else if (k==Qt::Key_Home) + else if (k==TQt::Key_Home) slotFirstClicked(); - else if (k==Qt::Key_End) + else if (k==TQt::Key_End) slotLastClicked(); else ok = false; @@ -357,13 +357,13 @@ bool KexiSimplePrintPreviewWindow::event( QEvent * e ) return true; } } - else if (t==QEvent::AccelOverride) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + else if (t==TQEvent::AccelOverride) { + TQKeyEvent *ke = TQT_TQKEYEVENT(e); const int k = ke->key(); bool ok = true; - if (k==Qt::Key_PageUp) + if (k==TQt::Key_PageUp) slotPreviousClicked(); - else if (k==Qt::Key_PageDown) + else if (k==TQt::Key_PageDown) slotNextClicked(); else ok = false; @@ -373,7 +373,7 @@ bool KexiSimplePrintPreviewWindow::event( QEvent * e ) return true; } } - return QWidget::event(e); + return TQWidget::event(e); } |