From aa0726b20f398264f0a2abc60215be044b106f9c Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 17 May 2011 08:20:48 +0000 Subject: TQt4 port basket This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/variouswidgets.cpp | 124 ++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'src/variouswidgets.cpp') diff --git a/src/variouswidgets.cpp b/src/variouswidgets.cpp index 3d0fa74..7be265f 100644 --- a/src/variouswidgets.cpp +++ b/src/variouswidgets.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2003 by Sébastien Laoût * + * Copyright (C) 2003 by S�bastien Lao�t * * slaout@linux62.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,40 +18,40 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include #include #include -#include -#include +#include +#include #include "variouswidgets.h" /** class RunCommandRequester: */ -RunCommandRequester::RunCommandRequester(const QString &runCommand, const QString &message, QWidget *parent, const char *name) - : QWidget(parent, name) +RunCommandRequester::RunCommandRequester(const TQString &runCommand, const TQString &message, TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name) { m_message = message; - QHBoxLayout *layout = new QHBoxLayout(this, /*margin=*/0, KDialogBase::spacingHint()); - m_runCommand = new QLineEdit(runCommand, this); - QPushButton *pb = new QPushButton(/*"C&hoose..."*/i18n("..."), this); + TQHBoxLayout *tqlayout = new TQHBoxLayout(this, /*margin=*/0, KDialogBase::spacingHint()); + m_runCommand = new TQLineEdit(runCommand, this); + TQPushButton *pb = new TQPushButton(/*"C&hoose..."*/i18n("..."), this); - pb->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + pb->tqsetSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed); - layout->addWidget(m_runCommand); - layout->addWidget(pb); + tqlayout->addWidget(m_runCommand); + tqlayout->addWidget(pb); - connect( pb, SIGNAL(clicked()), this, SLOT(slotSelCommand()) ); + connect( pb, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSelCommand()) ); } RunCommandRequester::~RunCommandRequester() @@ -66,20 +66,20 @@ void RunCommandRequester::slotSelCommand() m_runCommand->setText(dlg->text()); } -QString RunCommandRequester::runCommand() +TQString RunCommandRequester::runCommand() { return m_runCommand->text(); } -void RunCommandRequester::setRunCommand(const QString &runCommand) +void RunCommandRequester::setRunCommand(const TQString &runCommand) { m_runCommand->setText(runCommand); } /** class IconSizeCombo: */ -IconSizeCombo::IconSizeCombo(bool rw, QWidget *parent, const char *name) - : QComboBox(rw, parent, name) +IconSizeCombo::IconSizeCombo(bool rw, TQWidget *tqparent, const char *name) + : TQComboBox(rw, tqparent, name) { insertItem(i18n("16 by 16 pixels")); insertItem(i18n("22 by 22 pixels")); @@ -122,18 +122,18 @@ void IconSizeCombo::setSize(int size) /** class ViewSizeDialog: */ -ViewSizeDialog::ViewSizeDialog(QWidget *parent, int w, int h) - : QDialog(parent, "ViewSizeDialog") +ViewSizeDialog::ViewSizeDialog(TQWidget *tqparent, int w, int h) + : TQDialog(tqparent, "ViewSizeDialog") { - QLabel *label = new QLabel(i18n( + TQLabel *label = new TQLabel(i18n( "Resize the window to select the image size\n" "and close it or press Escape to accept changes."), this); label->move(8, 8); - label->setFixedSize( label->sizeHint() ); + label->setFixedSize( label->tqsizeHint() ); // setSizeGripEnabled(true) doesn't work (the grip stay at the same place), so we emulate it: - m_sizeGrip = new QSizeGrip(this); - m_sizeGrip->setFixedSize( m_sizeGrip->sizeHint() ); + m_sizeGrip = new TQSizeGrip(this); + m_sizeGrip->setFixedSize( m_sizeGrip->tqsizeHint() ); setGeometry(x(), y(), w, h); } @@ -142,19 +142,19 @@ ViewSizeDialog::~ViewSizeDialog() { } -void ViewSizeDialog::resizeEvent(QResizeEvent *) +void ViewSizeDialog::resizeEvent(TQResizeEvent *) { - setCaption( i18n("%1 by %2 pixels").arg(QString::number(width())).arg(QString::number(height())) ); + setCaption( i18n("%1 by %2 pixels").tqarg(TQString::number(width())).tqarg(TQString::number(height())) ); m_sizeGrip->move( width() - m_sizeGrip->width(), height() - m_sizeGrip->height() ); } /** class HelpLabel: */ -HelpLabel::HelpLabel(const QString &text, const QString &message, QWidget *parent) - : KURLLabel(parent), m_message(message) +HelpLabel::HelpLabel(const TQString &text, const TQString &message, TQWidget *tqparent) + : KURLLabel(tqparent), m_message(message) { setText(text); - connect( this, SIGNAL(leftClickedURL()), this, SLOT(showMessage()) ); + connect( this, TQT_SIGNAL(leftClickedURL()), this, TQT_SLOT(showMessage()) ); } HelpLabel::~HelpLabel() @@ -163,12 +163,12 @@ HelpLabel::~HelpLabel() void HelpLabel::showMessage() { - QWhatsThis::display(m_message, mapToGlobal( QPoint(width() / 2, height()) )); + TQWhatsThis::display(m_message, mapToGlobal( TQPoint(width() / 2, height()) )); } -void HelpLabel::keyPressEvent(QKeyEvent *event) +void HelpLabel::keyPressEvent(TQKeyEvent *event) { - if (event->key() == Qt::Key_Space) + if (event->key() == TQt::Key_Space) showMessage(); else KURLLabel::keyPressEvent(event); @@ -179,18 +179,18 @@ void HelpLabel::keyPressEvent(QKeyEvent *event) class UndraggableKIconView : public KIconView { public: - UndraggableKIconView(QWidget * parent = 0, const char * name = 0, WFlags f = 0) : KIconView(parent, name, f) {} - QDragObject* dragObject() { return 0; } + UndraggableKIconView(TQWidget * tqparent = 0, const char * name = 0, WFlags f = 0) : KIconView(tqparent, name, f) {} + TQDragObject* dragObject() { return 0; } }; -IconSizeDialog::IconSizeDialog(const QString &caption, const QString &message, const QString &icon, int iconSize, QWidget *parent) +IconSizeDialog::IconSizeDialog(const TQString &caption, const TQString &message, const TQString &icon, int iconSize, TQWidget *tqparent) : KDialogBase(KDialogBase::Swallow, caption, KDialogBase::Ok | KDialogBase::Cancel, - KDialogBase::Ok, parent, /*name=*/0, /*modal=*/true, /*separator=*/false) + KDialogBase::Ok, tqparent, /*name=*/0, /*modal=*/true, /*separator=*/false) { - QWidget *page = new QWidget(this); - QVBoxLayout *topLayout = new QVBoxLayout(page, /*margin=*/0, spacingHint()); + TQWidget *page = new TQWidget(this); + TQVBoxLayout *topLayout = new TQVBoxLayout(page, /*margin=*/0, spacingHint()); - QLabel *label = new QLabel(message, page); + TQLabel *label = new TQLabel(message, page); topLayout->addWidget(label); KIconView *iconView = new UndraggableKIconView(page); @@ -216,9 +216,9 @@ IconSizeDialog::IconSizeDialog(const QString &caption, const QString &message, c case 128: iconView->setSelected(m_size128, true); m_iconSize = 128; break; } - connect( iconView, SIGNAL(executed(QIconViewItem*)), this, SLOT(choose(QIconViewItem*)) ); - connect( iconView, SIGNAL(returnPressed(QIconViewItem*)), this, SLOT(choose(QIconViewItem*)) ); - connect( iconView, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()) ); + connect( iconView, TQT_SIGNAL(executed(TQIconViewItem*)), this, TQT_SLOT(choose(TQIconViewItem*)) ); + connect( iconView, TQT_SIGNAL(returnPressed(TQIconViewItem*)), this, TQT_SLOT(choose(TQIconViewItem*)) ); + connect( iconView, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(slotSelectionChanged()) ); setMainWidget(page); } @@ -249,7 +249,7 @@ void IconSizeDialog::slotSelectionChanged() } } -void IconSizeDialog::choose(QIconViewItem*) +void IconSizeDialog::choose(TQIconViewItem*) { actionButton(KDialogBase::Ok)->animateClick(); } @@ -262,19 +262,19 @@ void IconSizeDialog::slotCancel() /** class FontSizeCombo: */ -FontSizeCombo::FontSizeCombo(bool rw, bool withDefault, QWidget *parent, const char *name) - : KComboBox(rw, parent, name), m_withDefault(withDefault) +FontSizeCombo::FontSizeCombo(bool rw, bool withDefault, TQWidget *tqparent, const char *name) + : KComboBox(rw, tqparent, name), m_withDefault(withDefault) { if (m_withDefault) insertItem(i18n("(Default)")); - QFontDatabase fontDB; - QValueList sizes = fontDB.standardSizes(); - for (QValueList::Iterator it = sizes.begin(); it != sizes.end(); ++it) - insertItem(QString::number(*it)); + TQFontDatabase fontDB; + TQValueList sizes = fontDB.tqstandardSizes(); + for (TQValueList::Iterator it = sizes.begin(); it != sizes.end(); ++it) + insertItem(TQString::number(*it)); -// connect( this, SIGNAL(acivated(const QString&)), this, SLOT(textChangedInCombo(const QString&)) ); - connect( this, SIGNAL(textChanged(const QString&)), this, SLOT(textChangedInCombo(const QString&)) ); +// connect( this, TQT_SIGNAL(acivated(const TQString&)), this, TQT_SLOT(textChangedInCombo(const TQString&)) ); + connect( this, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(textChangedInCombo(const TQString&)) ); // TODO: 01617 void KFontSizeAction::setFontSize( int size ) } @@ -283,7 +283,7 @@ FontSizeCombo::~FontSizeCombo() { } -void FontSizeCombo::textChangedInCombo(const QString &text) +void FontSizeCombo::textChangedInCombo(const TQString &text) { bool ok = false; int size = text.toInt(&ok); @@ -291,11 +291,11 @@ void FontSizeCombo::textChangedInCombo(const QString &text) emit sizeChanged(size); } -void FontSizeCombo::keyPressEvent(QKeyEvent *event) +void FontSizeCombo::keyPressEvent(TQKeyEvent *event) { - if (event->key() == Qt::Key_Escape) + if (event->key() == TQt::Key_Escape) emit escapePressed(); - else if (event->key() == Qt::Key_Return) + else if (event->key() == TQt::Key_Return) emit returnPressed2(); else KComboBox::keyPressEvent(event); @@ -303,7 +303,7 @@ void FontSizeCombo::keyPressEvent(QKeyEvent *event) void FontSizeCombo::setFontSize(int size) { - setCurrentText(QString::number(size)); + setCurrentText(TQString::number(size)); // TODO: SEE KFontSizeAction::setFontSize( int size ) !!! for a more complete method! } -- cgit v1.2.1