diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
commit | dc6b8e72fed2586239e3514819238c520636c9d9 (patch) | |
tree | 88b200df0a0b7fab9d6f147596173556f1ed9a13 /kommander/editor/pixmapchooser.cpp | |
parent | 6927d4436e54551917f600b706a8d6109e49de1c (diff) | |
download | tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/editor/pixmapchooser.cpp')
-rw-r--r-- | kommander/editor/pixmapchooser.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/kommander/editor/pixmapchooser.cpp b/kommander/editor/pixmapchooser.cpp index 1a5a8535..92512c68 100644 --- a/kommander/editor/pixmapchooser.cpp +++ b/kommander/editor/pixmapchooser.cpp @@ -18,7 +18,7 @@ ** **********************************************************************/ -#include <qvariant.h> // HP-UX compiler needs this here +#include <tqvariant.h> // HP-UX compiler needs this here #include "pixmapchooser.h" #include "formwindow.h" @@ -37,13 +37,13 @@ #include "project.h" #endif -#include <qapplication.h> -#include <qimage.h> -#include <qpainter.h> -#include <qlabel.h> -#include <qlineedit.h> -#include <qpushbutton.h> -#include <qiconview.h> +#include <tqapplication.h> +#include <tqimage.h> +#include <tqpainter.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqpushbutton.h> +#include <tqiconview.h> #include <klocale.h> @@ -876,30 +876,30 @@ static ImageIconProvider *imageIconProvider = 0; static PixmapChooser *pixmapChooser = 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 { @@ -907,63 +907,63 @@ void PixmapView::previewUrl( const QUrl &u ) } } -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 = qApp->translate( "qChoosePixmap", "All Pixmaps (" ); - for ( uint i = 0; i < QImageIO::outputFormats().count(); i++ ) { + TQString filter; + TQString all = qApp->translate( "qChoosePixmap", "All Pixmaps (" ); + for ( uint i = 0; i < TQImageIO::outputFormats().count(); i++ ) { filter += qApp->translate( "qChoosePixmap", "%1-Pixmaps (%2)\n" ). - arg( QImageIO::outputFormats().at( i ) ). - arg( "*." + QString( QImageIO::outputFormats().at( i ) ).lower() ); - all += "*." + QString( QImageIO::outputFormats().at( i ) ).lower() + ";"; + arg( TQImageIO::outputFormats().at( i ) ). + arg( "*." + TQString( TQImageIO::outputFormats().at( i ) ).lower() ); + all += "*." + TQString( TQImageIO::outputFormats().at( i ) ).lower() + ";"; } filter.prepend( all + qApp->translate( "qChoosePixmap", ")\n" ) ); filter += qApp->translate( "qChoosePixmap", "All Files (*)" ); - 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(); + 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 = i18n( "All Pixmaps" ); + TQString filter; + TQString all = i18n( "All Pixmaps" ); all += " ("; - for ( uint i = 0; i < QImageIO::outputFormats().count(); i++ ) { + for ( uint i = 0; i < TQImageIO::outputFormats().count(); i++ ) { filter += i18n( "%1-Pixmaps (%2)\n" ). - arg( QImageIO::outputFormats().at( i ) ). - arg( "*." + QString( QImageIO::outputFormats().at( i ) ).lower() ); - all += "*." + QString( QImageIO::outputFormats().at( i ) ).lower() + ";"; + arg( TQImageIO::outputFormats().at( i ) ). + arg( "*." + TQString( TQImageIO::outputFormats().at( i ) ).lower() ); + all += "*." + TQString( TQImageIO::outputFormats().at( i ) ).lower() + ";"; } filter.prepend( all + ")\n" ); filter += i18n( "All Files (*)" ); - 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( i18n( "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() ); @@ -976,8 +976,8 @@ 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; } @@ -985,12 +985,12 @@ QPixmap qChoosePixmap( QWidget *parent, FormWindow *fw, const QPixmap &old, QStr #endif 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( PixmapChooser::loadPixmap( "image.xpm" ) ); + if ( dia.exec() == TQDialog::Accepted ) { + TQPixmap pix( PixmapChooser::loadPixmap( "image.xpm" ) ); MetaDataBase::setPixmapArgument( fw, pix.serialNumber(), dia.editArguments->text() ); return pix; } @@ -1000,26 +1000,26 @@ 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( PixmapChooser::loadPixmap( "image.xpm", PixmapChooser::Mini ) ) +ImageIconProvider::ImageIconProvider( TQWidget *parent, const char *name ) + : TQFileIconProvider( parent, name ), imagepm( PixmapChooser::loadPixmap( "image.xpm", PixmapChooser::Mini ) ) { - 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 ); } } @@ -1032,7 +1032,7 @@ PixmapChooser::PixmapChooser() largePixDir = "pics/large/"; } -QString PixmapChooser::pixmapPath( Size size ) const +TQString PixmapChooser::pixmapPath( Size size ) const { if ( size == Small ) return smallPixDir; @@ -1043,19 +1043,19 @@ QString PixmapChooser::pixmapPath( Size size ) const return largePixDir; } -QPixmap PixmapChooser::loadPixmap( const QString &name, Size size ) +TQPixmap PixmapChooser::loadPixmap( const TQString &name, Size size ) { #if defined(DESIGNER) if ( !pixmapChooser ) pixmapChooser = new PixmapChooser; if ( name == "logo" ) - return QPixmap( logo_xpm ); + return TQPixmap( logo_xpm ); if ( name[ 0 ] == '/' || name[ 0 ] == '\\' || name[ 1 ] == ':' ) - return QPixmap( name ); + return TQPixmap( name ); - QString lookup; + TQString lookup; switch ( size ) { case Small: lookup = "small/"; @@ -1073,21 +1073,21 @@ QPixmap PixmapChooser::loadPixmap( const QString &name, Size size ) break; } - QString lookup_png = lookup + QFileInfo( name ).baseName() + ".png"; + TQString lookup_png = lookup + TQFileInfo( name ).baseName() + ".png"; lookup += name; Embed *e = &embed_vec[ 0 ]; while ( e->name ) { - if ( QString( e->name ) == lookup ) { - QImage img; + if ( TQString( e->name ) == lookup ) { + TQImage img; img.loadFromData( (const uchar*)e->data, e->size ); - QPixmap pix; + TQPixmap pix; pix.convertFromImage( img ); return pix; - } else if ( QString( e->name ) == lookup_png ) { - QImage img; + } else if ( TQString( e->name ) == lookup_png ) { + TQImage img; img.loadFromData( (const uchar*)e->data, e->size ); - QPixmap pix; + TQPixmap pix; pix.convertFromImage( img ); return pix; } @@ -1095,11 +1095,11 @@ QPixmap PixmapChooser::loadPixmap( const QString &name, Size size ) } // fallback - return QPixmap( pixmapChooser->pixmapPath( size ) + name ); + return TQPixmap( pixmapChooser->pixmapPath( size ) + name ); #else Q_UNUSED( name ); Q_UNUSED( size ); - return QPixmap(); + return TQPixmap(); #endif } #include "pixmapchooser.moc" |