From e5a5cdd586c0d56a8134f3d94b4680baf8d12297 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Fri, 22 Jul 2005 21:00:54 +0000 Subject: [PATCH] Extend the Exporter to use the Power Of KImgIO. svn path=/trunk/KDE/kdeedu/kalzium/src/spectrum.cpp; revision=437715 --- kalzium/src/spectrum.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/kalzium/src/spectrum.cpp b/kalzium/src/spectrum.cpp index c6168cf..64b4041 100644 --- a/kalzium/src/spectrum.cpp +++ b/kalzium/src/spectrum.cpp @@ -191,7 +191,7 @@ SpectrumView::SpectrumView( Spectrum *spec, QWidget *parent, const char* name ) QPopupMenu *pp = new QPopupMenu( m_button_save ); m_button_save->setPopup( pp ); KActionCollection *coll = new KActionCollection( this ); - KAction *actExpImage = new KAction( i18n( "PNG" ), 0, 0, + KAction *actExpImage = new KAction( i18n( "Image" ), "image", 0, this, SLOT( slotExportAsImage() ), coll, "export_image" ); actExpImage->plug( pp ); @@ -200,8 +200,8 @@ SpectrumView::SpectrumView( Spectrum *spec, QWidget *parent, const char* name ) connect( m_spectrumWidget, SIGNAL( bordersChanged( int, int ) ), this, SLOT( slotBordersChanged( int, int ) ) ); m_spectrumbox = new KComboBox( this, "combobox" ); - m_spectrumbox->insertItem( "Emission Spectrum" ); - m_spectrumbox->insertItem( "Absorption Spectrum" ); + m_spectrumbox->insertItem( i18n( "Emission Spectrum" ) ); + m_spectrumbox->insertItem( i18n( "Absorption Spectrum" ) ); connect( m_spectrumbox, SIGNAL( activated( int ) ), m_spectrumWidget, SLOT( slotActivateSpectrum( int ) ) ); m_spinbox_left->setValue( 100 ); @@ -232,14 +232,16 @@ void SpectrumView::slotBordersChanged( int left, int right ) void SpectrumView::slotExportAsImage() { - QString fileName = KFileDialog::getSaveFileName( QString::null, "*.png", this, i18n( "Save Spectrum" ) ); + Exporter* exporter = new Exporter(); + QString fileName = KFileDialog::getSaveFileName( + QString::null, exporter->supportedImageFormats(), + this, i18n( "Save Spectrum" ) ); if( !fileName.isEmpty() ) { - Exporter* exporter = new Exporter(); - if ( !exporter->saveAsPNG( &m_spectrumWidget->pixmap(), fileName ) ) - KMessageBox::error( this, i18n( "The spectrum could not be saved"), i18n( "PNG could not be saved") ); - delete exporter; + if ( !exporter->saveAsImage( &m_spectrumWidget->pixmap(), fileName ) ) + KMessageBox::error( this, i18n( "The spectrum could not be saved" ), i18n( "Image could not be saved") ); } + delete exporter; } #include "spectrum.moc" -- 2.47.3