diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /kdevdesigner/designer/pixmapchooser.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdevdesigner/designer/pixmapchooser.cpp')
-rw-r--r-- | kdevdesigner/designer/pixmapchooser.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/kdevdesigner/designer/pixmapchooser.cpp b/kdevdesigner/designer/pixmapchooser.cpp index aaac22c0..28912c62 100644 --- a/kdevdesigner/designer/pixmapchooser.cpp +++ b/kdevdesigner/designer/pixmapchooser.cpp @@ -24,7 +24,7 @@ ** **********************************************************************/ -#include <qvariant.h> // HP-UX compiler needs this here +#include <tqvariant.h> // HP-UX compiler needs this here #include <kiconloader.h> #include <kimageio.h> @@ -45,41 +45,41 @@ #include "pixmapcollection.h" #include "project.h" -#include <qapplication.h> -#include <qimage.h> -#include <qpainter.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qiconview.h> +#include <tqapplication.h> +#include <tqimage.h> +#include <tqpainter.h> +#include <tqlabel.h> +#include <tqpushbutton.h> +#include <tqiconview.h> #if defined(DESIGNER) static ImageIconProvider *imageIconProvider = 0; #endif -PixmapView::PixmapView( QWidget *parent ) - : QScrollView( parent ) +PixmapView::PixmapView( TQWidget *parent ) + : TQScrollView( parent ) { viewport()->setBackgroundMode( PaletteBase ); } -void PixmapView::setPixmap( const QPixmap &pix ) +void PixmapView::setPixmap( const TQPixmap &pix ) { pixmap = pix; resizeContents( pixmap.size().width(), pixmap.size().height() ); viewport()->repaint( FALSE ); } -void PixmapView::drawContents( QPainter *p, int cx, int cy, int cw, int ch ) +void PixmapView::drawContents( TQPainter *p, int cx, int cy, int cw, int ch ) { - p->fillRect( cx, cy, cw, ch, colorGroup().brush( QColorGroup::Base ) ); + p->fillRect( cx, cy, cw, ch, colorGroup().brush( TQColorGroup::Base ) ); p->drawPixmap( 0, 0, pixmap ); } -void PixmapView::previewUrl( const QUrl &u ) +void PixmapView::previewUrl( const TQUrl &u ) { if ( u.isLocalFile() ) { - QString path = u.path(); - QPixmap pix( path ); + TQString path = u.path(); + TQPixmap pix( path ); if ( !pix.isNull() ) setPixmap( pix ); } else { @@ -87,12 +87,12 @@ void PixmapView::previewUrl( const QUrl &u ) } } -static void buildImageFormatList( QString &filter, QString &all ) +static void buildImageFormatList( TQString &filter, TQString &all ) { all = qApp->translate( "qChoosePixmap", "All Pixmaps (" ); - for ( uint i = 0; i < QImageIO::outputFormats().count(); i++ ) { - QString outputFormat = QImageIO::outputFormats().at( i ); - QString outputExtension; + for ( uint i = 0; i < TQImageIO::outputFormats().count(); i++ ) { + TQString outputFormat = TQImageIO::outputFormats().at( i ); + TQString outputExtension; if ( outputFormat != "JPEG" ) outputExtension = outputFormat.lower(); else @@ -105,28 +105,28 @@ static void buildImageFormatList( QString &filter, QString &all ) filter += qApp->translate( "qChoosePixmap", "All Files (*)" ); } -QStringList qChoosePixmaps( QWidget *parent ) +TQStringList qChoosePixmaps( TQWidget *parent ) { -/* if ( !imageIconProvider && !QFileDialog::iconProvider() ) - QFileDialog::setIconProvider( ( imageIconProvider = new ImageIconProvider ) ); +/* if ( !imageIconProvider && !TQFileDialog::iconProvider() ) + TQFileDialog::setIconProvider( ( imageIconProvider = new ImageIconProvider ) ); - QString filter; - QString all; + TQString filter; + TQString all; buildImageFormatList( filter, all ); - QFileDialog fd( QString::null, filter, parent, 0, TRUE ); - fd.setMode( QFileDialog::ExistingFiles ); + TQFileDialog fd( TQString::null, filter, parent, 0, TRUE ); + fd.setMode( TQFileDialog::ExistingFiles ); fd.setContentsPreviewEnabled( TRUE ); PixmapView *pw = new PixmapView( &fd ); fd.setContentsPreview( pw, pw ); - fd.setViewMode( QFileDialog::List ); - fd.setPreviewMode( QFileDialog::Contents ); + fd.setViewMode( TQFileDialog::List ); + fd.setPreviewMode( TQFileDialog::Contents ); fd.setCaption( qApp->translate( "qChoosePixmap", "Choose Images..." ) ); - if ( fd.exec() == QDialog::Accepted ) + if ( fd.exec() == TQDialog::Accepted ) return fd.selectedFiles(); - return QStringList();*/ - QStringList mimetypes = KImageIO::mimeTypes( KImageIO::Reading ); - KFileDialog dlg(QString::null, mimetypes.join(" "), parent, "filedialog", true); + return TQStringList();*/ + TQStringList mimetypes = KImageIO::mimeTypes( KImageIO::Reading ); + KFileDialog dlg(TQString::null, mimetypes.join(" "), parent, "filedialog", true); dlg.setOperationMode( KFileDialog::Opening ); dlg.setCaption( qApp->translate( "qChoosePixmap", "Choose Images..." ) ); dlg.setMode( KFile::Files ); @@ -134,36 +134,36 @@ QStringList qChoosePixmaps( QWidget *parent ) dlg.setPreviewWidget( ip ); if (dlg.exec()) return dlg.selectedFiles(); - return QStringList(); + return TQStringList(); } -QPixmap qChoosePixmap( QWidget *parent, FormWindow *fw, const QPixmap &old, QString *fn ) +TQPixmap qChoosePixmap( TQWidget *parent, FormWindow *fw, const TQPixmap &old, TQString *fn ) { #if defined(DESIGNER) if ( !fw || fw->savePixmapInline() ) { -/* if ( !imageIconProvider && !QFileDialog::iconProvider() ) - QFileDialog::setIconProvider( ( imageIconProvider = new ImageIconProvider ) ); +/* if ( !imageIconProvider && !TQFileDialog::iconProvider() ) + TQFileDialog::setIconProvider( ( imageIconProvider = new ImageIconProvider ) ); - QString filter; - QString all; + TQString filter; + TQString all; buildImageFormatList( filter, all ); - QFileDialog fd( QString::null, filter, parent, 0, TRUE ); + TQFileDialog fd( TQString::null, filter, parent, 0, TRUE ); fd.setContentsPreviewEnabled( TRUE ); PixmapView *pw = new PixmapView( &fd ); fd.setContentsPreview( pw, pw ); - fd.setViewMode( QFileDialog::List ); - fd.setPreviewMode( QFileDialog::Contents ); + fd.setViewMode( TQFileDialog::List ); + fd.setPreviewMode( TQFileDialog::Contents ); fd.setCaption( qApp->translate( "qChoosePixmap", "Choose Pixmap" ) ); - if ( fd.exec() == QDialog::Accepted ) { - QPixmap pix( fd.selectedFile() ); + if ( fd.exec() == TQDialog::Accepted ) { + TQPixmap pix( fd.selectedFile() ); if ( fn ) *fn = fd.selectedFile(); MetaDataBase::setPixmapArgument( fw, pix.serialNumber(), fd.selectedFile() ); return pix; }*/ - QStringList mimetypes = KImageIO::mimeTypes( KImageIO::Reading ); - KFileDialog dlg(QString::null, mimetypes.join(" "), parent, "filedialog", true); + TQStringList mimetypes = KImageIO::mimeTypes( KImageIO::Reading ); + KFileDialog dlg(TQString::null, mimetypes.join(" "), parent, "filedialog", true); dlg.setOperationMode( KFileDialog::Opening ); dlg.setCaption( qApp->translate( "qChoosePixmap", "Choose Pixmap" ) ); dlg.setMode( KFile::File ); @@ -171,7 +171,7 @@ QPixmap qChoosePixmap( QWidget *parent, FormWindow *fw, const QPixmap &old, QStr dlg.setPreviewWidget( ip ); if (dlg.exec()) { - QPixmap pix( dlg.selectedURL().path() ); + TQPixmap pix( dlg.selectedURL().path() ); if ( fn ) *fn = dlg.selectedURL().path(); MetaDataBase::setPixmapArgument( fw, pix.serialNumber(), dlg.selectedURL().path() ); @@ -182,19 +182,19 @@ QPixmap qChoosePixmap( QWidget *parent, FormWindow *fw, const QPixmap &old, QStr dia.setProject( fw->project() ); dia.setChooserMode( TRUE ); dia.setCurrentItem( MetaDataBase::pixmapKey( fw, old.serialNumber() ) ); - if ( dia.exec() == QDialog::Accepted ) { - QPixmap pix( fw->project()->pixmapCollection()->pixmap( dia.viewPixmaps->currentItem()->text() ) ); + if ( dia.exec() == TQDialog::Accepted ) { + TQPixmap pix( fw->project()->pixmapCollection()->pixmap( dia.viewPixmaps->currentItem()->text() ) ); MetaDataBase::setPixmapKey( fw, pix.serialNumber(), dia.viewPixmaps->currentItem()->text() ); return pix; } } else { PixmapFunction dia( parent, 0, TRUE ); - QObject::connect( dia.helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + TQObject::connect( dia.helpButton, TQT_SIGNAL( clicked() ), MainWindow::self, TQT_SLOT( showDialogHelp() ) ); dia.labelFunction->setText( fw->pixmapLoaderFunction() + "(" ); dia.editArguments->setText( MetaDataBase::pixmapArgument( fw, old.serialNumber() ) ); dia.editArguments->setFocus(); - if ( dia.exec() == QDialog::Accepted ) { - QPixmap pix; + if ( dia.exec() == TQDialog::Accepted ) { + TQPixmap pix; // we have to force the pixmap to get a new and unique serial number. Unfortunately detatch() doesn't do that pix.convertFromImage( BarIcon( "designer_image.png", KDevDesignerPartFactory::instance() ).convertToImage() ); @@ -207,25 +207,25 @@ QPixmap qChoosePixmap( QWidget *parent, FormWindow *fw, const QPixmap &old, QStr Q_UNUSED( fw ); Q_UNUSED( old ); #endif - return QPixmap(); + return TQPixmap(); } -ImageIconProvider::ImageIconProvider( QWidget *parent, const char *name ) - : QFileIconProvider( parent, name ), imagepm( BarIcon( "designer_image.png", KDevDesignerPartFactory::instance() ) ) +ImageIconProvider::ImageIconProvider( TQWidget *parent, const char *name ) + : TQFileIconProvider( parent, name ), imagepm( BarIcon( "designer_image.png", KDevDesignerPartFactory::instance() ) ) { - fmts = QImage::inputFormats(); + fmts = TQImage::inputFormats(); } ImageIconProvider::~ImageIconProvider() { } -const QPixmap * ImageIconProvider::pixmap( const QFileInfo &fi ) +const TQPixmap * ImageIconProvider::pixmap( const TQFileInfo &fi ) { - QString ext = fi.extension().upper(); + TQString ext = fi.extension().upper(); if ( fmts.contains( ext ) ) { return &imagepm; } else { - return QFileIconProvider::pixmap( fi ); + return TQFileIconProvider::pixmap( fi ); } } |