diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
commit | bf7f88413be3831a9372d323d02fc0335b9f9188 (patch) | |
tree | 516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvcore/printdialog.cpp | |
parent | e238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff) | |
download | gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip |
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvcore/printdialog.cpp')
-rw-r--r-- | src/gvcore/printdialog.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/src/gvcore/printdialog.cpp b/src/gvcore/printdialog.cpp index cce06fb..2359793 100644 --- a/src/gvcore/printdialog.cpp +++ b/src/gvcore/printdialog.cpp @@ -18,12 +18,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// Qt -#include <qcheckbox.h> -#include <qlayout.h> -#include <qpainter.h> -#include <qradiobutton.h> -#include <qvbuttongroup.h> +// TQt +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqpainter.h> +#include <tqradiobutton.h> +#include <tqvbuttongroup.h> // KDE #include <kcombobox.h> @@ -44,7 +44,7 @@ namespace Gwenview { const char* STR_TRUE="true"; const char* STR_FALSE="false"; -static inline Unit stringToUnit(const QString& unit) { +static inline Unit stringToUnit(const TQString& unit) { if (unit == i18n("Millimeters")) { return GV_MILLIMETERS; } else if (unit == i18n("Centimeters")) { @@ -54,7 +54,7 @@ static inline Unit stringToUnit(const QString& unit) { } } -static inline QString unitToString(Unit unit) { +static inline TQString unitToString(Unit unit) { if (unit == GV_MILLIMETERS) { return i18n("Millimeters"); } else if (unit == GV_CENTIMETERS) { @@ -76,30 +76,30 @@ static inline double unitToMM(Unit unit) { } -PrintDialogPage::PrintDialogPage( Document* document, QWidget *parent, const char *name ) - : KPrintDialogPage( parent, name ) { +PrintDialogPage::PrintDialogPage( Document* document, TQWidget *tqparent, const char *name ) + : KPrintDialogPage( tqparent, name ) { mDocument = document; mContent = new PrintDialogPageBase(this); setTitle( mContent->caption() ); - QVBoxLayout *layout = new QVBoxLayout( this ); - layout->addWidget( mContent ); + TQVBoxLayout *tqlayout = new TQVBoxLayout( this ); + tqlayout->addWidget( mContent ); - connect(mContent->mWidth, SIGNAL( valueChanged( double )), SLOT( slotWidthChanged( double ))); - connect(mContent->mHeight, SIGNAL( valueChanged( double )), SLOT( slotHeightChanged( double ))); - connect(mContent->mKeepRatio, SIGNAL( toggled( bool )), SLOT( toggleRatio( bool ))); - connect(mContent->mUnit, SIGNAL(activated(const QString &)), SLOT(slotUnitChanged(const QString& ))); + connect(mContent->mWidth, TQT_SIGNAL( valueChanged( double )), TQT_SLOT( slotWidthChanged( double ))); + connect(mContent->mHeight, TQT_SIGNAL( valueChanged( double )), TQT_SLOT( slotHeightChanged( double ))); + connect(mContent->mKeepRatio, TQT_SIGNAL( toggled( bool )), TQT_SLOT( toggleRatio( bool ))); + connect(mContent->mUnit, TQT_SIGNAL(activated(const TQString &)), TQT_SLOT(slotUnitChanged(const TQString& ))); mPreviousUnit = GV_MILLIMETERS; } PrintDialogPage::~PrintDialogPage() {} -void PrintDialogPage::getOptions( QMap<QString,QString>& opts, bool /*incldef*/ ) { - opts["app-gwenview-position"] = QString::number(getPosition(mContent->mPosition->currentText())); +void PrintDialogPage::getOptions( TQMap<TQString,TQString>& opts, bool /*incldef*/ ) { + opts["app-gwenview-position"] = TQString::number(getPosition(mContent->mPosition->currentText())); opts["app-gwenview-printFilename"] = mContent->mAddFileName->isChecked() ? STR_TRUE : STR_FALSE; opts["app-gwenview-printComment"] = mContent->mAddComment->isChecked() ? STR_TRUE : STR_FALSE; - opts["app-gwenview-scale"] = QString::number( + opts["app-gwenview-scale"] = TQString::number( mContent->mNoScale->isChecked() ? GV_NOSCALE : mContent->mFitToPage->isChecked() ? GV_FITTOPAGE : GV_SCALE); @@ -107,16 +107,16 @@ void PrintDialogPage::getOptions( QMap<QString,QString>& opts, bool /*incldef*/ opts["app-gwenview-enlargeToFit"] = mContent->mEnlargeToFit->isChecked() ? STR_TRUE : STR_FALSE; opts["app-gwenview-scaleKeepRatio"] = mContent->mKeepRatio->isChecked() ? STR_TRUE : STR_FALSE; - opts["app-gwenview-scaleUnit"] = QString::number(stringToUnit(mContent->mUnit->currentText())); - opts["app-gwenview-scaleWidth"] = QString::number( scaleWidth() ); - opts["app-gwenview-scaleHeight"] = QString::number( scaleHeight() ); + opts["app-gwenview-scaleUnit"] = TQString::number(stringToUnit(mContent->mUnit->currentText())); + opts["app-gwenview-scaleWidth"] = TQString::number( scaleWidth() ); + opts["app-gwenview-scaleHeight"] = TQString::number( scaleHeight() ); } -void PrintDialogPage::setOptions( const QMap<QString,QString>& opts ) { +void PrintDialogPage::setOptions( const TQMap<TQString,TQString>& opts ) { int val; bool ok; - QString stVal; + TQString stVal; val = opts["app-gwenview-position"].toInt( &ok ); if (ok) { @@ -168,58 +168,58 @@ void PrintDialogPage::setScaleHeight( double value ) { mContent->mHeight->setValue(value); } -int PrintDialogPage::getPosition(const QString& align) { - int alignment; +int PrintDialogPage::getPosition(const TQString& align) { + int tqalignment; if (align == i18n("Central-Left")) { - alignment = Qt::AlignLeft | Qt::AlignVCenter; + tqalignment = TQt::AlignLeft | TQt::AlignVCenter; } else if (align == i18n("Central-Right")) { - alignment = Qt::AlignRight | Qt::AlignVCenter; + tqalignment = TQt::AlignRight | TQt::AlignVCenter; } else if (align == i18n("Top-Left")) { - alignment = Qt::AlignTop | Qt::AlignLeft; + tqalignment = TQt::AlignTop | TQt::AlignLeft; } else if (align == i18n("Top-Right")) { - alignment = Qt::AlignTop | Qt::AlignRight; + tqalignment = TQt::AlignTop | TQt::AlignRight; } else if (align == i18n("Bottom-Left")) { - alignment = Qt::AlignBottom | Qt::AlignLeft; + tqalignment = TQt::AlignBottom | TQt::AlignLeft; } else if (align == i18n("Bottom-Right")) { - alignment = Qt::AlignBottom | Qt::AlignRight; + tqalignment = TQt::AlignBottom | TQt::AlignRight; } else if (align == i18n("Top-Central")) { - alignment = Qt::AlignTop | Qt::AlignHCenter; + tqalignment = TQt::AlignTop | TQt::AlignHCenter; } else if (align == i18n("Bottom-Central")) { - alignment = Qt::AlignBottom | Qt::AlignHCenter; + tqalignment = TQt::AlignBottom | TQt::AlignHCenter; } else { // Central - alignment = Qt::AlignCenter; // Qt::AlignHCenter || Qt::AlignVCenter + tqalignment = TQt::AlignCenter; // TQt::AlignHCenter || TQt::AlignVCenter } - return alignment; + return tqalignment; } -QString PrintDialogPage::setPosition(int align) { - QString alignment; - - if (align == (Qt::AlignLeft | Qt::AlignVCenter)) { - alignment = i18n("Central-Left"); - } else if (align == (Qt::AlignRight | Qt::AlignVCenter)) { - alignment = i18n("Central-Right"); - } else if (align == (Qt::AlignTop | Qt::AlignLeft)) { - alignment = i18n("Top-Left"); - } else if (align == (Qt::AlignTop | Qt::AlignRight)) { - alignment = i18n("Top-Right"); - } else if (align == (Qt::AlignBottom | Qt::AlignLeft)) { - alignment = i18n("Bottom-Left"); - } else if (align == (Qt::AlignBottom | Qt::AlignRight)) { - alignment = i18n("Bottom-Right"); - } else if (align == (Qt::AlignTop | Qt::AlignHCenter)) { - alignment = i18n("Top-Central"); - } else if (align == (Qt::AlignBottom | Qt::AlignHCenter)) { - alignment = i18n("Bottom-Central"); +TQString PrintDialogPage::setPosition(int align) { + TQString tqalignment; + + if (align == (TQt::AlignLeft | TQt::AlignVCenter)) { + tqalignment = i18n("Central-Left"); + } else if (align == (TQt::AlignRight | TQt::AlignVCenter)) { + tqalignment = i18n("Central-Right"); + } else if (align == (TQt::AlignTop | TQt::AlignLeft)) { + tqalignment = i18n("Top-Left"); + } else if (align == (TQt::AlignTop | TQt::AlignRight)) { + tqalignment = i18n("Top-Right"); + } else if (align == (TQt::AlignBottom | TQt::AlignLeft)) { + tqalignment = i18n("Bottom-Left"); + } else if (align == (TQt::AlignBottom | TQt::AlignRight)) { + tqalignment = i18n("Bottom-Right"); + } else if (align == (TQt::AlignTop | TQt::AlignHCenter)) { + tqalignment = i18n("Top-Central"); + } else if (align == (TQt::AlignBottom | TQt::AlignHCenter)) { + tqalignment = i18n("Bottom-Central"); } else { - // Central: Qt::AlignCenter or (Qt::AlignHCenter || Qt::AlignVCenter) - alignment = i18n("Central"); + // Central: TQt::AlignCenter or (TQt::AlignHCenter || TQt::AlignVCenter) + tqalignment = i18n("Central"); } - return alignment; + return tqalignment; } // SLOTS @@ -275,7 +275,7 @@ void PrintDialogPage::toggleRatio(bool enable) { } -void PrintDialogPage::slotUnitChanged(const QString& string) { +void PrintDialogPage::slotUnitChanged(const TQString& string) { Unit newUnit = stringToUnit(string); double ratio = unitToMM(mPreviousUnit) / unitToMM(newUnit); |