File indexing completed on 2024-05-19 04:48:46
0001 /**************************************************************************************** 0002 * Copyright (c) 2004-2009 Mark Kretschmann <kretschmann@kde.org> * 0003 * Copyright (c) 2009 Artur Szymiec <artur.szymiec@gmail.com> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) any later * 0008 * version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0012 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License along with * 0015 * this program. If not, see <http://www.gnu.org/licenses/>. * 0016 ****************************************************************************************/ 0017 0018 #include "PlaybackConfig.h" 0019 0020 #include "amarokconfig.h" 0021 #include "core/support/Amarok.h" 0022 #include "ActionClasses.h" 0023 #include "EngineController.h" 0024 #include "core/support/Debug.h" 0025 0026 #include <KCMultiDialog> 0027 0028 0029 PlaybackConfig::PlaybackConfig( Amarok2ConfigDialog* parent ) 0030 : ConfigDialogBase( parent ) 0031 { 0032 setupUi( this ); 0033 0034 EngineController *engine = EngineController::instance(); 0035 Q_ASSERT( engine ); 0036 if( !engine->supportsFadeout() ) 0037 { 0038 const QString toolTip = i18n( "Current Phonon backend does not support volume fading" ); 0039 kcfg_FadeoutOnStop->setEnabled( false ); 0040 kcfg_FadeoutOnStop->setToolTip( toolTip ); 0041 kcfg_FadeoutOnPause->setEnabled( false ); 0042 kcfg_FadeoutOnPause->setToolTip( toolTip ); 0043 fadeoutLengthLabel->setEnabled( false ); 0044 fadeoutLengthLabel->setToolTip( toolTip ); 0045 kcfg_FadeoutLength->setEnabled( false ); 0046 kcfg_FadeoutLength->setToolTip( toolTip ); 0047 } 0048 0049 connect( kcfg_FadeoutOnStop, &QCheckBox::toggled, this, &PlaybackConfig::setFadeoutState ); 0050 connect( kcfg_FadeoutOnPause, &QCheckBox::toggled, this, &PlaybackConfig::setFadeoutState ); 0051 } 0052 0053 PlaybackConfig::~PlaybackConfig() 0054 {} 0055 0056 0057 /////////////////////////////////////////////////////////////// 0058 // REIMPLEMENTED METHODS from ConfigDialogBase 0059 /////////////////////////////////////////////////////////////// 0060 0061 bool 0062 PlaybackConfig::hasChanged() 0063 { 0064 return false; 0065 } 0066 0067 bool 0068 PlaybackConfig::isDefault() 0069 { 0070 return false; 0071 } 0072 0073 void 0074 PlaybackConfig::updateSettings() 0075 {} 0076 0077 0078 /////////////////////////////////////////////////////////////// 0079 // PRIVATE METHODS 0080 /////////////////////////////////////////////////////////////// 0081 0082 void 0083 PlaybackConfig::setFadeoutState() //SLOT 0084 { 0085 if( !EngineController::instance()->supportsFadeout() ) 0086 return; 0087 0088 const bool enabled = kcfg_FadeoutOnPause->isChecked() || kcfg_FadeoutOnStop->isChecked(); 0089 0090 fadeoutLengthLabel->setEnabled( enabled ); 0091 kcfg_FadeoutLength->setEnabled( enabled ); 0092 } 0093 0094