kpresenter

KPrEffectDia.cpp

00001 // -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
00002 /* This file is part of the KDE project
00003    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "KPrView.h"
00022 #include "KPrDocument.h"
00023 #include "KPrEffectDia.h"
00024 #include "KPrCommand.h"
00025 #include "KPrObject.h"
00026 #include "KPrSoundPlayer.h"
00027 
00028 #include <qpushbutton.h>
00029 #include <qcombobox.h>
00030 #include <qlabel.h>
00031 #include <qgroupbox.h>
00032 #include <qcheckbox.h>
00033 #include <qlineedit.h>
00034 #include <qvaluelist.h>
00035 #include <qlayout.h>
00036 #include <qspinbox.h>
00037 #include <qstringlist.h>
00038 #include <qdir.h>
00039 #include <qtooltip.h>
00040 #include <qwhatsthis.h>
00041 
00042 #include <klocale.h>
00043 #include <kglobal.h>
00044 #include <kbuttonbox.h>
00045 #include <knuminput.h>
00046 #include <kurlrequester.h>
00047 #include <kurl.h>
00048 #include <kstandarddirs.h>
00049 #include <kfiledialog.h>
00050 
00051 KPrEffectDia::KPrEffectDia( QWidget* parent, const char* name, const QPtrList<KPrObject>& _objs,
00052                       KPrView *_view )
00053     : KDialogBase( parent, name, true ), objs( _objs )
00054 {
00055     view = _view;
00056     KPrObject *obj = objs.at( 0 );
00057     soundPlayer1 = 0;
00058     soundPlayer2 = 0;
00059 
00060     QWidget *page = new QWidget( this );
00061     setMainWidget(page);
00062     topLayout = new QVBoxLayout( page, 0, spacingHint() );
00063 
00064     QGroupBox *grp1 = new QGroupBox(0, Qt::Vertical, i18n( "Appear" ), page );
00065     grp1->layout()->setSpacing(KDialog::spacingHint());
00066     grp1->layout()->setMargin(KDialog::marginHint());
00067     topLayout->addWidget(grp1);
00068     QGridLayout *upperRow = new QGridLayout(grp1->layout(), 6, 4);
00069 
00070     lAppear = new QLabel( i18n( "Order of appearance:" ), grp1 );
00071     lAppear->setAlignment( AlignVCenter );
00072     upperRow->addWidget(lAppear, 0, 0);
00073 
00074     eAppearStep = new QSpinBox( 0, 100, 1, grp1 );
00075     eAppearStep->setValue( obj->getAppearStep() );
00076     upperRow->addWidget(eAppearStep, 0, 1);
00077 
00078     //( void )new QWidget( grp1 );
00079     //( void )new QWidget( grp1 );
00080 
00081     lEffect = new QLabel( i18n( "Effect (appearing):" ), grp1 );
00082     lEffect->setAlignment( AlignVCenter );
00083     upperRow->addWidget(lEffect, 1, 0);
00084 
00085     cEffect = new QComboBox( false, grp1, "cEffect" );
00086     cEffect->insertItem( i18n( "No Effect" ) );
00087     cEffect->insertItem( i18n( "Come From Right" ) );
00088     cEffect->insertItem( i18n( "Come From Left" ) );
00089     cEffect->insertItem( i18n( "Come From Top" ) );
00090     cEffect->insertItem( i18n( "Come From Bottom" ) );
00091     cEffect->insertItem( i18n( "Come From Right/Top" ) );
00092     cEffect->insertItem( i18n( "Come From Right/Bottom" ) );
00093     cEffect->insertItem( i18n( "Come From Left/Top" ) );
00094     cEffect->insertItem( i18n( "Come From Left/Bottom" ) );
00095     cEffect->insertItem( i18n( "Wipe From Left" ) );
00096     cEffect->insertItem( i18n( "Wipe From Right" ) );
00097     cEffect->insertItem( i18n( "Wipe From Top" ) );
00098     cEffect->insertItem( i18n( "Wipe From Bottom" ) );
00099     cEffect->setCurrentItem( static_cast<int>( obj->getEffect() ) );
00100     upperRow->addWidget(cEffect, 1, 1);
00101 
00102     connect( cEffect, SIGNAL( activated( int ) ), this, SLOT( appearEffectChanged( int ) ) );
00103 
00104     lAppearSpeed = new QLabel( i18n( "Speed:" ), grp1 );
00105     lAppearSpeed->setAlignment( AlignVCenter );
00106     upperRow->addWidget(lAppearSpeed, 2, 0);
00107 
00108     cAppearSpeed = new QComboBox( false, grp1, "cEffect" );
00109     cAppearSpeed->insertItem( i18n( "Slow" ) );
00110     cAppearSpeed->insertItem( i18n( "Medium" ) );
00111     cAppearSpeed->insertItem( i18n( "Fast" ) );
00112     cAppearSpeed->setCurrentItem( static_cast<int>( obj->getAppearSpeed() ) );
00113     upperRow->addWidget(cAppearSpeed, 2, 1);
00114     appearEffectChanged( cEffect->currentItem() );
00115 
00116     lEffect2 = new QLabel( i18n( "Effect (object specific):" ), grp1 );
00117     lEffect2->setAlignment( AlignVCenter );
00118     upperRow->addWidget(lEffect2, 3, 0);
00119 
00120     cEffect2 = new QComboBox( false, grp1, "cEffect2" );
00121     cEffect2->insertItem( i18n( "No Effect" ) );
00122     upperRow->addWidget(cEffect2, 3, 1);
00123 
00124     switch ( obj->getType() ) {
00125     case OT_TEXT: {
00126         cEffect2->insertItem( i18n( "Paragraph After Paragraph" ) );
00127     } break;
00128     default:
00129         lEffect2->setEnabled(false);
00130         cEffect2->setEnabled(false);
00131         break;
00132     }
00133 
00134     if ( obj->getEffect2() == EF2_NONE )
00135         cEffect2->setCurrentItem( static_cast<int>( obj->getEffect2() ) );
00136     else {
00137         switch ( obj->getType() )
00138         {
00139         case OT_TEXT:
00140             cEffect2->setCurrentItem( static_cast<int>( obj->getEffect2() + TxtObjOffset ) );
00141             break;
00142         default: break;
00143         }
00144     }
00145 
00146     QLabel *lTimerOfAppear = new QLabel( i18n( "Timer of the object:" ), grp1 );
00147     lTimerOfAppear->setAlignment( AlignVCenter );
00148     upperRow->addWidget( lTimerOfAppear, 4, 0 );
00149 
00150     timerOfAppear = new KIntNumInput( obj->getAppearTimer(), grp1 );
00151     timerOfAppear->setRange( 1, 600, 1 );
00152     timerOfAppear->setSuffix( i18n( " seconds" ) );
00153     upperRow->addWidget( timerOfAppear, 4, 1 );
00154 
00155     if ( view->kPresenterDoc()->spManualSwitch() )
00156         timerOfAppear->setEnabled( false );
00157 
00158 
00159     // setup the Sound Effect stuff
00160     appearSoundEffect = new QCheckBox( i18n( "Sound effect" ), grp1 );
00161     appearSoundEffect->setChecked( obj->getAppearSoundEffect() );
00162     upperRow->addWidget( appearSoundEffect, 5, 0 );
00163 
00164     connect( appearSoundEffect, SIGNAL( clicked() ), this, SLOT( appearSoundEffectChanged() ) );
00165 
00166     lSoundEffect1 = new QLabel( i18n( "File name:" ), grp1 );
00167     lSoundEffect1->setAlignment( AlignVCenter );
00168     upperRow->addWidget( lSoundEffect1, 6, 0 );
00169 
00170     requester1 = new KURLRequester( grp1 );
00171     requester1->setURL( obj->getAppearSoundEffectFileName() );
00172     upperRow->addWidget( requester1, 6, 1 );
00173 
00174     connect( requester1, SIGNAL( openFileDialog( KURLRequester * ) ),
00175              this, SLOT( slotRequesterClicked( KURLRequester * ) ) );
00176 
00177     connect( requester1, SIGNAL( textChanged( const QString& ) ),
00178              this, SLOT( slotAppearFileChanged( const QString& ) ) );
00179 
00180     buttonTestPlaySoundEffect1 = new QPushButton( grp1 );
00181     buttonTestPlaySoundEffect1->setIconSet( SmallIconSet("1rightarrow") );
00182     QToolTip::add( buttonTestPlaySoundEffect1, i18n("Play") );
00183     upperRow->addWidget( buttonTestPlaySoundEffect1, 6, 2 );
00184 
00185     connect( buttonTestPlaySoundEffect1, SIGNAL( clicked() ), this, SLOT( playSound1() ) );
00186 
00187     buttonTestStopSoundEffect1 = new QPushButton( grp1 );
00188     buttonTestStopSoundEffect1->setIconSet( SmallIconSet("player_stop") );
00189     QToolTip::add( buttonTestStopSoundEffect1, i18n("Stop") );
00190     upperRow->addWidget( buttonTestStopSoundEffect1, 6, 3 );
00191 
00192     connect( buttonTestStopSoundEffect1, SIGNAL( clicked() ), this, SLOT( stopSound1() ) );
00193 
00194 
00195     disappear = new QCheckBox( i18n( "Disappear" ), page );
00196     disappear->setChecked( obj->getDisappear() );
00197     topLayout->addWidget(disappear);
00198 
00199     QGroupBox *grp2 = new QGroupBox(0, Qt::Vertical, i18n( "Disappear" ), page);
00200     grp2->layout()->setSpacing(KDialog::spacingHint());
00201     grp2->layout()->setMargin(KDialog::marginHint());
00202     topLayout->addWidget(grp2);
00203     QGridLayout *lowerRow = new QGridLayout(grp2->layout(), 5, 4);
00204 
00205     lDisappear = new QLabel( i18n( "Order of disappearance:" ), grp2 );
00206     lDisappear->setAlignment( AlignVCenter );
00207     lowerRow->addWidget(lDisappear, 0, 0);
00208 
00209     eDisappearStep = new QSpinBox( 0, 100, 1, grp2 );
00210     eDisappearStep->setValue( obj->getDisappearStep() );
00211     lowerRow->addWidget(eDisappearStep, 0, 1);
00212 
00213     lDEffect = new QLabel( i18n( "Effect (disappearing):" ), grp2 );
00214     lDEffect->setAlignment( AlignVCenter );
00215     lowerRow->addWidget(lDEffect, 1, 0);
00216 
00217     cDisappear = new QComboBox( false, grp2, "cDisappear" );
00218     cDisappear->insertItem( i18n( "No Effect" ) );
00219     cDisappear->insertItem( i18n( "Disappear to Right" ) );
00220     cDisappear->insertItem( i18n( "Disappear to Left" ) );
00221     cDisappear->insertItem( i18n( "Disappear to Top" ) );
00222     cDisappear->insertItem( i18n( "Disappear to Bottom" ) );
00223     cDisappear->insertItem( i18n( "Disappear to Right/Top" ) );
00224     cDisappear->insertItem( i18n( "Disappear to Right/Bottom" ) );
00225     cDisappear->insertItem( i18n( "Disappear to Left/Top" ) );
00226     cDisappear->insertItem( i18n( "Disappear to Left/Bottom" ) );
00227     cDisappear->insertItem( i18n( "Wipe to Left" ) );
00228     cDisappear->insertItem( i18n( "Wipe to Right" ) );
00229     cDisappear->insertItem( i18n( "Wipe to Top" ) );
00230     cDisappear->insertItem( i18n( "Wipe to Bottom" ) );
00231     cDisappear->setCurrentItem( static_cast<int>( obj->getEffect3() ) );
00232     lowerRow->addWidget(cDisappear, 1, 1);
00233 
00234     connect( cDisappear, SIGNAL( activated( int ) ), this, SLOT( disappearEffectChanged( int ) ) );
00235 
00236     lDisappearSpeed = new QLabel( i18n( "Speed:" ), grp2 );
00237     lDisappearSpeed->setAlignment( AlignVCenter );
00238     lowerRow->addWidget(lDisappearSpeed, 2, 0);
00239 
00240     cDisappearSpeed = new QComboBox( false, grp2, "cEffect" );
00241     cDisappearSpeed->insertItem( i18n( "Slow" ) );
00242     cDisappearSpeed->insertItem( i18n( "Medium" ) );
00243     cDisappearSpeed->insertItem( i18n( "Fast" ) );
00244     cDisappearSpeed->setCurrentItem( static_cast<int>( obj->getDisappearSpeed() ) );
00245     lowerRow->addWidget(cDisappearSpeed, 2, 1);
00246     
00247     //appearEffectChanged( cEffect->currentItem() );
00248 
00249     QLabel *lTimerOfDisappear = new QLabel( i18n( "Timer of the object:" ), grp2 );
00250     lTimerOfDisappear->setAlignment( AlignVCenter );
00251     lowerRow->addWidget( lTimerOfDisappear, 3, 0 );
00252 
00253     timerOfDisappear = new KIntNumInput( obj->getDisappearTimer(), grp2 );
00254     timerOfDisappear->setRange( 1, 600, 1 );
00255     timerOfDisappear->setSuffix( i18n( " seconds" ) );
00256     lowerRow->addWidget( timerOfDisappear, 3, 1 );
00257 
00258     if ( view->kPresenterDoc()->spManualSwitch() )
00259         timerOfDisappear->setEnabled( false );
00260 
00261 
00262     // setup the Sound Effect stuff
00263     disappearSoundEffect = new QCheckBox( i18n( "Sound effect" ), grp2 );
00264     disappearSoundEffect->setChecked( obj->getDisappearSoundEffect() );
00265     lowerRow->addWidget( disappearSoundEffect, 4, 0 );
00266     disappearSoundEffect->setEnabled( disappear->isChecked() );
00267 
00268     connect( disappearSoundEffect, SIGNAL( clicked() ), this, SLOT( disappearSoundEffectChanged() ) );
00269 
00270     lSoundEffect2 = new QLabel( i18n( "File name:" ), grp2 );
00271     lSoundEffect2->setAlignment( AlignVCenter );
00272     lowerRow->addWidget( lSoundEffect2, 5, 0 );
00273 
00274     requester2 = new KURLRequester( grp2 );
00275     requester2->setURL( obj->getDisappearSoundEffectFileName() );
00276     lowerRow->addWidget( requester2, 5, 1 );
00277 
00278     connect( requester2, SIGNAL( openFileDialog( KURLRequester * ) ),
00279              this, SLOT( slotRequesterClicked( KURLRequester * ) ) );
00280 
00281     connect( requester2, SIGNAL( textChanged( const QString& ) ),
00282              this, SLOT( slotDisappearFileChanged( const QString& ) ) );
00283 
00284     buttonTestPlaySoundEffect2 = new QPushButton( grp2 );
00285     buttonTestPlaySoundEffect2->setIconSet( SmallIconSet("1rightarrow") );
00286     QToolTip::add( buttonTestPlaySoundEffect2, i18n("Play") );
00287     lowerRow->addWidget( buttonTestPlaySoundEffect2, 5, 2 );
00288 
00289     connect( buttonTestPlaySoundEffect2, SIGNAL( clicked() ), this, SLOT( playSound2() ) );
00290 
00291     buttonTestStopSoundEffect2 = new QPushButton( grp2 );
00292     buttonTestStopSoundEffect2->setIconSet( SmallIconSet("player_stop") );
00293     QToolTip::add( buttonTestStopSoundEffect2, i18n("Stop") );
00294     lowerRow->addWidget( buttonTestStopSoundEffect2, 5, 3 );
00295 
00296     connect( buttonTestStopSoundEffect2, SIGNAL( clicked() ), this, SLOT( stopSound2() ) );
00297 
00298 
00299     topLayout->activate();
00300 
00301     connect( this, SIGNAL( okClicked() ), this, SLOT( slotEffectDiaOk() ) );
00302     connect( this, SIGNAL( okClicked() ), this, SLOT( accept() ) );
00303     connect( disappear, SIGNAL( clicked() ), this, SLOT( disappearChanged() ) );
00304     disappearChanged();
00305     appearSoundEffectChanged();
00306 }
00307 
00308 KPrEffectDia::~KPrEffectDia()
00309 {
00310     stopSound1();
00311     stopSound2();
00312 
00313     delete soundPlayer1;
00314     delete soundPlayer2;
00315 }
00316 
00317 void KPrEffectDia::slotEffectDiaOk()
00318 {
00319     QValueList<KPrEffectCmd::EffectStruct> oldEffects;
00320     for ( unsigned int i = 0; i < objs.count(); ++i ) {
00321         KPrObject *o = objs.at( i );
00322         KPrEffectCmd::EffectStruct e;
00323         e.appearStep = o->getAppearStep();
00324         e.disappearStep = o->getDisappearStep();
00325         e.effect = o->getEffect();
00326         e.effect2 = o->getEffect2();
00327         e.effect3 = o->getEffect3();
00328         e.m_appearSpeed = o->getAppearSpeed();
00329         e.m_disappearSpeed = o->getDisappearSpeed();
00330         e.disappear = o->getDisappear();
00331         e.appearTimer = o->getAppearTimer();
00332         e.disappearTimer = o->getDisappearTimer();
00333         e.appearSoundEffect = o->getAppearSoundEffect();
00334         e.disappearSoundEffect = o->getDisappearSoundEffect();
00335         e.a_fileName = o->getAppearSoundEffectFileName();
00336         e.d_fileName = o->getDisappearSoundEffectFileName();
00337         oldEffects << e;
00338     }
00339 
00340     KPrEffectCmd::EffectStruct eff;
00341     eff.appearStep = eAppearStep->value();
00342     eff.disappearStep = eDisappearStep->value();
00343     eff.effect = ( Effect )cEffect->currentItem();
00344     eff.effect2 = ( Effect2 )cEffect2->currentItem();
00345     eff.effect3 = ( Effect3 )cDisappear->currentItem();
00346     eff.m_appearSpeed = ( EffectSpeed )cAppearSpeed->currentItem();
00347     eff.m_disappearSpeed = ( EffectSpeed )cDisappearSpeed->currentItem();
00348     eff.disappear = disappear->isChecked();
00349     eff.appearTimer = timerOfAppear->value();
00350     eff.disappearTimer = timerOfDisappear->value();
00351     eff.appearSoundEffect = (requester1->url().isEmpty() ? false : appearSoundEffect->isChecked());
00352     eff.disappearSoundEffect = (requester2->url().isEmpty() ? false : disappearSoundEffect->isChecked());
00353     eff.a_fileName = requester1->url();
00354     eff.d_fileName = requester2->url();
00355 
00356     KPrEffectCmd *effectCmd = new KPrEffectCmd( i18n( "Assign Object Effects" ), objs, oldEffects, eff );
00357     effectCmd->execute();
00358     view->kPresenterDoc()->addCommand( effectCmd );
00359     accept();
00360 }
00361 
00362 void KPrEffectDia::resizeEvent( QResizeEvent *e )
00363 {
00364     QDialog::resizeEvent( e );
00365     //topLayout->resize( size() );
00366 }
00367 
00368 void KPrEffectDia::disappearChanged()
00369 {
00370     cDisappear->setEnabled( disappear->isChecked() );
00371     eDisappearStep->setEnabled( disappear->isChecked() );
00372     disappearSoundEffect->setEnabled( disappear->isChecked() );
00373     disappearSoundEffectChanged();
00374     disappearEffectChanged( cDisappear->currentItem() );
00375 
00376     if ( !view->kPresenterDoc()->spManualSwitch() )
00377         timerOfDisappear->setEnabled( disappear->isChecked() );
00378 }
00379 
00380 void KPrEffectDia::appearEffectChanged( int /*num*/ )
00381 {
00382     bool b = ( cEffect->currentItem() != 0 );
00383     lAppearSpeed->setEnabled( b );
00384     cAppearSpeed->setEnabled( b );
00385 }
00386 
00387 void KPrEffectDia::disappearEffectChanged( int /*num*/ )
00388 {
00389     bool b = ( cDisappear->currentItem() !=0 && disappear->isChecked() );
00390     lDisappearSpeed->setEnabled( b );
00391     cDisappearSpeed->setEnabled( b );
00392 }
00393 
00394 void KPrEffectDia::appearSoundEffectChanged()
00395 {
00396     lSoundEffect1->setEnabled( appearSoundEffect->isChecked() );
00397     requester1->setEnabled( appearSoundEffect->isChecked() );
00398 
00399     if ( !requester1->url().isEmpty() ) {
00400         buttonTestPlaySoundEffect1->setEnabled( appearSoundEffect->isChecked() );
00401         buttonTestStopSoundEffect1->setEnabled( appearSoundEffect->isChecked() );
00402     }
00403     else {
00404         buttonTestPlaySoundEffect1->setEnabled( false );
00405         buttonTestStopSoundEffect1->setEnabled( false );
00406     }
00407 }
00408 
00409 void KPrEffectDia::disappearSoundEffectChanged()
00410 {
00411     lSoundEffect2->setEnabled( disappear->isChecked() && disappearSoundEffect->isChecked() );
00412     requester2->setEnabled( disappear->isChecked() && disappearSoundEffect->isChecked() );
00413 
00414     if ( !requester2->url().isEmpty() ) {
00415         buttonTestPlaySoundEffect2->setEnabled( disappear->isChecked() && disappearSoundEffect->isChecked() );
00416         buttonTestStopSoundEffect2->setEnabled( disappear->isChecked() && disappearSoundEffect->isChecked() );
00417     }
00418     else {
00419         buttonTestPlaySoundEffect2->setEnabled( false );
00420         buttonTestStopSoundEffect2->setEnabled( false );
00421     }
00422 }
00423 
00424 void KPrEffectDia::slotRequesterClicked( KURLRequester *requester )
00425 {
00426     QString filter = getSoundFileFilter();
00427     requester->fileDialog()->setFilter( filter );
00428 
00429     // find the first "sound"-resource that contains files
00430     QStringList soundDirs = KGlobal::dirs()->resourceDirs( "sound" );
00431     if ( !soundDirs.isEmpty() ) {
00432         KURL soundURL;
00433         QDir dir;
00434         dir.setFilter( QDir::Files | QDir::Readable );
00435         QStringList::ConstIterator it = soundDirs.begin();
00436         while ( it != soundDirs.end() ) {
00437             dir = *it;
00438             if ( dir.isReadable() && dir.count() > 2 ) {
00439                 soundURL.setPath( *it );
00440                 requester->fileDialog()->setURL( soundURL );
00441                 break;
00442             }
00443             ++it;
00444         }
00445     }
00446 }
00447 
00448 void KPrEffectDia::slotAppearFileChanged( const QString &text )
00449 {
00450     buttonTestPlaySoundEffect1->setEnabled( !text.isEmpty() );
00451     buttonTestStopSoundEffect1->setEnabled( !text.isEmpty() );
00452 }
00453 
00454 void KPrEffectDia::slotDisappearFileChanged( const QString &text )
00455 {
00456     buttonTestPlaySoundEffect2->setEnabled( !text.isEmpty() );
00457     buttonTestStopSoundEffect2->setEnabled( !text.isEmpty() );
00458 }
00459 
00460 void KPrEffectDia::playSound1()
00461 {
00462     delete soundPlayer1;
00463     soundPlayer1 = new KPrSoundPlayer( requester1->url() );
00464     soundPlayer1->play();
00465 
00466     buttonTestPlaySoundEffect1->setEnabled( false );
00467     buttonTestStopSoundEffect1->setEnabled( true );
00468 }
00469 
00470 void KPrEffectDia::playSound2()
00471 {
00472     delete soundPlayer2;
00473     soundPlayer2 = new KPrSoundPlayer( requester2->url() );
00474     soundPlayer2->play();
00475 
00476     buttonTestPlaySoundEffect2->setEnabled( false );
00477     buttonTestStopSoundEffect2->setEnabled( true );
00478 }
00479 
00480 void KPrEffectDia::stopSound1()
00481 {
00482     if ( soundPlayer1 ) {
00483         soundPlayer1->stop();
00484         delete soundPlayer1;
00485         soundPlayer1 = 0;
00486 
00487         buttonTestPlaySoundEffect1->setEnabled( true );
00488         buttonTestStopSoundEffect1->setEnabled( false );
00489     }
00490 }
00491 
00492 void KPrEffectDia::stopSound2()
00493 {
00494     if ( soundPlayer2 ) {
00495         soundPlayer2->stop();
00496         delete soundPlayer2;
00497         soundPlayer2 = 0;
00498 
00499         buttonTestPlaySoundEffect2->setEnabled( true );
00500         buttonTestStopSoundEffect2->setEnabled( false );
00501     }
00502 }
00503 
00504 QString KPrEffectDia::getSoundFileFilter() const
00505 {
00506     QStringList fileList;
00507     fileList << "wav" << "au" << "mp3" << "mp1" << "mp2" << "mpg" << "dat"
00508              << "mpeg" << "ogg" << "cdda" << "cda " << "vcd" << "null";
00509     fileList.sort();
00510 
00511     bool comma = false;
00512     QString full, str;
00513     for ( QStringList::ConstIterator it = fileList.begin(); it != fileList.end(); ++it ) {
00514         if ( comma )
00515             str += '\n';
00516         comma = true;
00517         str += QString( i18n( "*.%1|%2 Files" ) ).arg( *it ).arg( (*it).upper() );
00518 
00519         full += QString( "*.") + (*it) + ' ';
00520     }
00521 
00522     str = full + '|' + i18n( "All Supported Files" ) + '\n' + str;
00523     str += "\n*|" + i18n( "All Files" );
00524 
00525     return str;
00526 }
00527 
00528 #include "KPrEffectDia.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys